From: <bi...@us...> - 2007-09-28 14:01:21
|
Revision: 830 http://oorexx.svn.sourceforge.net/oorexx/?rev=830&view=rev Author: bigrixx Date: 2007-09-28 07:01:25 -0700 (Fri, 28 Sep 2007) Log Message: ----------- [ 1804151 ] 3.2 Rev 829 Broke ooDialog ObjectTable/Normal table methods inadvertently mixed. Revision Links: -------------- http://oorexx.svn.sourceforge.net/oorexx/?rev=829&view=rev Modified Paths: -------------- interpreter-3.x/trunk/kernel/classes/TableClass.hpp interpreter-3.x/trunk/kernel/runtime/RexxHashTable.cpp interpreter-3.x/trunk/kernel/runtime/RexxHashTable.hpp Modified: interpreter-3.x/trunk/kernel/classes/TableClass.hpp =================================================================== --- interpreter-3.x/trunk/kernel/classes/TableClass.hpp 2007-09-28 10:27:30 UTC (rev 829) +++ interpreter-3.x/trunk/kernel/classes/TableClass.hpp 2007-09-28 14:01:25 UTC (rev 830) @@ -65,7 +65,6 @@ RexxArray * requestArray(); inline RexxArray * stringGetAll(RexxString *key) {return this->contents->stringGetAll(key); }; inline RexxObject * stringGet(RexxString *key) {return this->contents->stringGet(key); }; - inline RexxObject * findSuperScope(RexxObject *v) { return this->contents->nextItem(v, TheNilObject); }; RexxObject *newRexx(RexxObject **, size_t); }; @@ -83,5 +82,6 @@ RexxObject *put(RexxObject *, RexxObject *); RexxObject *add(RexxObject *, RexxObject *); inline RexxArray *allAt(RexxObject *key) {return this->contents->primitiveGetAll(key);} + inline RexxObject * findSuperScope(RexxObject *v) { return this->contents->primitiveNextItem(v, TheNilObject); }; }; #endif Modified: interpreter-3.x/trunk/kernel/runtime/RexxHashTable.cpp =================================================================== --- interpreter-3.x/trunk/kernel/runtime/RexxHashTable.cpp 2007-09-28 10:27:30 UTC (rev 829) +++ interpreter-3.x/trunk/kernel/runtime/RexxHashTable.cpp 2007-09-28 14:01:25 UTC (rev 830) @@ -650,6 +650,46 @@ return TheNilObject; /* item was not found */ } + +RexxObject *RexxHashTable::primitiveNextItem( + RexxObject *value, /* item to locate */ + RexxObject *index ) /* index to locate */ +/******************************************************************************/ +/* Function: Return the next item with the key index that follows the */ +/* given (value index) pair. Used only for superscope lookup. */ +/* Note: This routine does the comparisons in as fast as way */ +/* as possible, relying solely on object identify for a match. */ +/******************************************************************************/ +{ + HashLink position; /* target hash position */ + RexxObject *scope; /* returned scope */ + + 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 */ + /* get a match? */ + if (this->entries[position].index == index && this->entries[position].value == value) { + while ((position = this->entries[position].next) != NO_MORE) { + /* same index value? */ + if (this->entries[position].index == index) + /* this is the value we want */ + return this->entries[position].value; + } + return TheNilObject; /* didn't find what we wanted */ + } + /* step to the next link */ + } while ((position = this->entries[position].next) != NO_MORE); + /* must be added via setmethod, so */ + scope = this->primitiveGet(index); /* return first one for this index */ + /* truely not there? */ + if (scope == (RexxObject *)OREF_NULL) + return TheNilObject; /* return a failure */ + return scope; /* return the first scope */ + } + return TheNilObject; /* item was not found */ +} + RexxArray *RexxHashTable::getAll( RexxObject *index) /* target index */ /******************************************************************************/ @@ -942,7 +982,17 @@ discard_hold(newHash); /* release again */ break; } - position = newHash->hashIndex(index);/* calculate the hash slot */ + + // primitive tables require a primitive index. + if (type == PRIMITIVE_TABLE) + { + position = newHash->hashPrimitiveIndex(index);/* calculate the hash slot */ + } + else + { + + position = newHash->hashIndex(index);/* calculate the hash slot */ + } /* if the hash slot is empty */ if (newHash->entries[position].index == OREF_NULL) { /* fill in both the value and index */ Modified: interpreter-3.x/trunk/kernel/runtime/RexxHashTable.hpp =================================================================== --- interpreter-3.x/trunk/kernel/runtime/RexxHashTable.hpp 2007-09-28 10:27:30 UTC (rev 829) +++ interpreter-3.x/trunk/kernel/runtime/RexxHashTable.hpp 2007-09-28 14:01:25 UTC (rev 830) @@ -114,6 +114,7 @@ void primitiveMerge(RexxHashTable *target); RexxHashTable *insert(RexxObject *value, RexxObject *index, HashLink position, LONG type); RexxObject *nextItem(RexxObject *, RexxObject *); + RexxObject *primitiveNextItem(RexxObject *, RexxObject *); inline size_t mainSlotsSize() { return this->u_size; }; inline size_t totalSlotsSize() { return this->u_size * 2; }; inline BOOL available(HashLink position) { return (size_t)position < this->totalSlotsSize(); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |