From: <bi...@us...> - 2007-09-28 10:27:26
|
Revision: 829 http://oorexx.svn.sourceforge.net/oorexx/?rev=829&view=rev Author: bigrixx Date: 2007-09-28 03:27:30 -0700 (Fri, 28 Sep 2007) Log Message: ----------- Fix Control stack full problem and also add addWeeks methods to DateTime and TimeSpan. Modified Paths: -------------- interpreter-3.x/trunk/kernel/RexxClasses/CoreClasses.orx interpreter-3.x/trunk/kernel/runtime/RexxHashTable.cpp interpreter-3.x/trunk/kernel/runtime/RexxHashTable.hpp Modified: interpreter-3.x/trunk/kernel/RexxClasses/CoreClasses.orx =================================================================== --- interpreter-3.x/trunk/kernel/RexxClasses/CoreClasses.orx 2007-09-28 00:40:21 UTC (rev 828) +++ interpreter-3.x/trunk/kernel/RexxClasses/CoreClasses.orx 2007-09-28 10:27:30 UTC (rev 829) @@ -2078,7 +2078,12 @@ use strict arg time return self~new(time('F', time, 'C')) +-- Create a DateTime object from a Long time string. +::METHOD fromLongTime class + use strict arg time + return self~new(time('F', time, 'L')) + -- Create a DateTime object from a Iso date/time string. ::METHOD fromIsoDate class use strict arg time @@ -2421,7 +2426,18 @@ -- and finally recombine with the time to get the adjusted timestamp return newDate + dayoffset +-- Add a number of 7-day units to the datetime, returning a new instance +::METHOD addWeeks + expose timestamp + use strict arg weeks + .ArgUtil~validateNumber("weeks", weeks) + + numeric digits 18 + -- return a new instance of DateTime + return self~class~new(trunc(timestamp + weeks * (7 * 24 * 3600 * 1000000))) + + -- Add a number of days to a datetime, returning a new datetime instance. ::METHOD addDays expose timestamp @@ -3032,6 +3048,18 @@ return self~class~new(trunc(timestamp * multiplier)) +-- Add a number of 7-day units to the datetime, returning a new instance +::METHOD addWeeks + expose timestamp + use strict arg weeks + + .ArgUtil~validateNumber("weeks", weeks) + + numeric digits 18 + -- return a new instance of DateTime + return self~class~new(trunc(timestamp + weeks * (7 * 24 * 3600 * 1000000))) + + -- Add a number of days to a timespan, returning a new timespan instance. ::METHOD addDays expose timestamp Modified: interpreter-3.x/trunk/kernel/runtime/RexxHashTable.cpp =================================================================== --- interpreter-3.x/trunk/kernel/runtime/RexxHashTable.cpp 2007-09-28 00:40:21 UTC (rev 828) +++ interpreter-3.x/trunk/kernel/runtime/RexxHashTable.cpp 2007-09-28 10:27:30 UTC (rev 829) @@ -248,7 +248,7 @@ { HashLink position; /* current position */ - position = hashIndex(index); /* calculate the hash slot */ + position = hashPrimitiveIndex(index); /* calculate the hash slot */ /* if the hash slot is empty */ if (this->entries[position].index == OREF_NULL) { /* fill in both the value and index */ @@ -333,7 +333,7 @@ HashLink next; /* next hash position */ RexxObject *removed; /* removed item value */ - position = hashIndex(index); /* calculate the hash slot */ + position = hashPrimitiveIndex(index); /* calculate the hash slot */ previous = NO_LINK; /* no previous slot yet */ /* have an entry at this slot */ @@ -455,7 +455,7 @@ HashLink next; /* next hash position */ RexxObject * removed; /* removed item value */ - position = hashIndex(index); /* calculate the hash slot */ + position = hashPrimitiveIndex(index); /* calculate the hash slot */ previous = NO_LINK; /* no previous slot yet */ /* have an entry at this slot */ if (this->entries[position].index != OREF_NULL) { @@ -508,7 +508,7 @@ { HashLink position; /* target hash position */ - position = hashIndex(index); /* calculate the hash slot */ + position = hashPrimitiveIndex(index); /* calculate the hash slot */ /* have an entry at this slot */ if (this->entries[position].index != OREF_NULL) { do { /* while more items in chain */ @@ -701,7 +701,7 @@ size_t i; /* loop counter */ count = 0L; /* no items found yet */ - position = hashIndex(index); /* calculate the hash slot */ + position = hashPrimitiveIndex(index); /* calculate the hash slot */ /* have an entry at this slot */ if (this->entries[position].index != OREF_NULL) { do { /* while more items in chain */ @@ -716,8 +716,8 @@ return (RexxArray *)TheNullArray->copy(); result = new_array(count); /* get proper size result array */ - i = 1L; /* start at the first element */ - position = hashIndex(index); /* calculate the hash slot */ + i = 1; /* start at the first element */ + position = hashPrimitiveIndex(index); /* calculate the hash slot */ do { /* while more items in chain */ /* if got a match */ if (index == this->entries[position].index) @@ -873,7 +873,7 @@ { HashLink position; /* current position */ - position = hashIndex(index); /* calculate the hash slot */ + position = hashPrimitiveIndex(index); /* calculate the hash slot */ /* have an entry at this slot */ if (this->entries[position].index != OREF_NULL) { do { /* while more items in chain */ @@ -1100,7 +1100,7 @@ HashLink position; /* current position */ HashLink front; /* starting hash position */ - position = hashIndex(index); /* calculate the hash slot */ + position = hashPrimitiveIndex(index); /* calculate the hash slot */ /* have an entry at this slot */ if (this->entries[position].index != OREF_NULL) { front = position; /* save the starting position */ Modified: interpreter-3.x/trunk/kernel/runtime/RexxHashTable.hpp =================================================================== --- interpreter-3.x/trunk/kernel/runtime/RexxHashTable.hpp 2007-09-28 00:40:21 UTC (rev 828) +++ interpreter-3.x/trunk/kernel/runtime/RexxHashTable.hpp 2007-09-28 10:27:30 UTC (rev 829) @@ -118,8 +118,8 @@ inline size_t totalSlotsSize() { return this->u_size * 2; }; inline BOOL available(HashLink position) { return (size_t)position < this->totalSlotsSize(); }; inline HashLink hashIndex(RexxObject *obj) { return (HashLink)(obj->hash() % this->mainSlotsSize()); } + inline HashLink hashPrimitiveIndex(RexxObject *obj) { return (HashLink)(obj->identityHash() % this->mainSlotsSize()); } inline HashLink hashStringIndex(RexxObject *obj) { return (HashLink)(obj->hash() % this->mainSlotsSize()); } -// inline HashLink hashStringIndex(RexxString *obj) { ULONG hash HASHVALUE((RexxObject *)obj); size_t slotSize = mainSlotsSize(); return (hash > slotSize) ? hash % slotSize : ~hash % slotSize; } HashLink free; /* first free element */ TABENTRY entries[1]; /* hash table entries */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |