From: <bi...@us...> - 2014-07-05 16:33:21
|
Revision: 10281 http://sourceforge.net/p/oorexx/code-0/10281 Author: bigrixx Date: 2014-07-05 16:33:17 +0000 (Sat, 05 Jul 2014) Log Message: ----------- Another incrmental checkin Modified Paths: -------------- sandbox/rick/newsource/interpreter/classes/ArrayClass.hpp sandbox/rick/newsource/interpreter/classes/ObjectClass.hpp sandbox/rick/newsource/interpreter/classes/support/RexxHashTable.cpp sandbox/rick/newsource/interpreter/classes/support/RexxHashTable.hpp sandbox/rick/newsource/interpreter/instructions/AddressInstruction.cpp sandbox/rick/newsource/interpreter/instructions/CallInstruction.cpp sandbox/rick/newsource/interpreter/instructions/CallInstruction.hpp sandbox/rick/newsource/interpreter/instructions/ClassDirective.cpp sandbox/rick/newsource/interpreter/instructions/CommandInstruction.cpp sandbox/rick/newsource/interpreter/instructions/DoBlock.cpp sandbox/rick/newsource/interpreter/instructions/DoBlock.hpp sandbox/rick/newsource/interpreter/instructions/DoBlockComponents.cpp sandbox/rick/newsource/interpreter/instructions/DoBlockComponents.hpp sandbox/rick/newsource/interpreter/instructions/DoCountInstruction.cpp sandbox/rick/newsource/interpreter/instructions/DoOverInstruction.cpp sandbox/rick/newsource/interpreter/instructions/DoWhileInstruction.cpp sandbox/rick/newsource/interpreter/instructions/IfInstruction.cpp sandbox/rick/newsource/interpreter/instructions/RexxInstruction.hpp sandbox/rick/newsource/interpreter/parser/KeywordConstants.cpp sandbox/rick/newsource/interpreter/parser/Token.cpp sandbox/rick/newsource/interpreter/parser/Token.hpp Modified: sandbox/rick/newsource/interpreter/classes/ArrayClass.hpp =================================================================== --- sandbox/rick/newsource/interpreter/classes/ArrayClass.hpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/classes/ArrayClass.hpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -240,31 +240,96 @@ RexxObject *objects[1]; /* Data. */ }; +/** + * Make a zero-length array item. + * + * @return A new array. + */ +inline RexxArray *new_array() +{ + return new ((size_t)0) RexxArray; +} + + +/** + * Create an array with a given size. + * + * @param s The size of the array. + * + * @return The new array item. + */ inline RexxArray *new_array(size_t s) { return new (s) RexxArray; } + +/** + * Create an array populated with objects from another source. + * + * @param s The number of objects. + * @param o The pointer to the set of objects. + * + * @return A new array object. + */ inline RexxArray *new_array(size_t s, RexxObject **o) { return new (s) RexxArray(o, s); } + +/** + * Create a new array with one item. + * + * @param o1 The object to add to the array. + * + * @return A new array object. + */ inline RexxArray *new_array(RexxObject *o1) { return new (1) RexxArray(o1); } + +/** + * Create a new array with two items. + * + * @param o1 The first object to add to the array. + * @param o2 The second object to add + * + * @return A new array object. + */ inline RexxArray *new_array(RexxObject *o1, RexxObject *o2) { return new (2) RexxArray(o1, o2); } + +/** + * Create a new array with three items. + * + * @param o1 The first object to add to the array. + * @param o2 The second object to add + * @param o3 The third object to add. + * + * @return A new array object. + */ inline RexxArray *new_array(RexxObject *o1, RexxObject *o2, RexxObject *o3) { return new (3) RexxArray(o1, o2, o3); } + +/** + * Create a new array with four items. + * + * @param o1 The first object to add to the array. + * @param o2 The second object to add + * @param o3 The third object to add. + * @param o4 The fourth object to add. + * + * @return A new array object. + */ inline RexxArray *new_array(RexxObject *o1, RexxObject *o2, RexxObject *o3, RexxObject *o4) { return new (4) RexxArray(o1, o2, o3, o4); Modified: sandbox/rick/newsource/interpreter/classes/ObjectClass.hpp =================================================================== --- sandbox/rick/newsource/interpreter/classes/ObjectClass.hpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/classes/ObjectClass.hpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -534,6 +534,7 @@ return (this == other) || this->isEqual(other); } virtual wholenumber_t compareTo(RexxObject *); + RexxObject *callOperatorMethod(size_t methodOffset, RexxObject *argument); // Define operator methods here. Modified: sandbox/rick/newsource/interpreter/classes/support/RexxHashTable.cpp =================================================================== --- sandbox/rick/newsource/interpreter/classes/support/RexxHashTable.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/classes/support/RexxHashTable.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -64,14 +64,6 @@ // indicates not linked const HashLink NO_LINK = ~((HashLink)0); - /* compare a value item to the value */ - /* at the specified position */ -bool inline EQUAL_VALUE(RexxObject *value, RexxObject *other) -{ - /* true for either direct identity or*/ - /* real equality ("==") */ - return (value == other) || value->isEqual(other); -} RexxHashTable *RexxHashTable::newInstance( size_t entries ) /* number of entries in the table */ @@ -272,7 +264,7 @@ do { /* while more items in chain */ /* get a match? */ - if (EQUAL_VALUE(_index, this->entries[position].index)) + if (_index->equalValue(entries[position].index)) { /* save the current value */ removed = this->entries[position].value; @@ -350,7 +342,7 @@ /* copy the value into our array */ result->put(this->entries[position].value,i++); /* if got a match */ - if (EQUAL_VALUE(_index, this->entries[position].index)) + if (_index->equalValue(entries[position].index)) { /* get the next pointer */ HashLink _next = this->entries[position].next; @@ -496,8 +488,8 @@ do { /* while more items in chain */ /* get a match? */ - if (EQUAL_VALUE(_index, this->entries[position].index) && - EQUAL_VALUE(_value, this->entries[position].value)) + if (_index->equalValue(entries[position].index) && + _value->equalValue(entries[position].value)) { /* save the current value */ removed = this->entries[position].value; @@ -662,8 +654,8 @@ do { /* while more items in chain */ /* get a match? */ - if (EQUAL_VALUE(_index, this->entries[position].index) && - EQUAL_VALUE(_value, this->entries[position].value)) + if (_index->equalValue(entries[position].index) && + _value->equalValue(entries[position].value)) { /* got the one we want */ return(RexxObject *)TheTrueObject; @@ -695,7 +687,7 @@ // if we have an item, see if it's the one we're looking for. if (ep->index != OREF_NULL) { - if (EQUAL_VALUE(_value, ep->value)) + if (_value->equalValue(ep->value)) { return TheTrueObject; // return the index value @@ -726,7 +718,7 @@ // if we have an item, see if it's the one we're looking for. if (ep->index != OREF_NULL) { - if (EQUAL_VALUE(_value, ep->value)) + if (_value->equalValue(ep->value)) { // this is complicated, so it's easier to just remove // this using the fully qualified tuple. @@ -881,7 +873,7 @@ do { /* while more items in chain */ /* if got a match */ - if (EQUAL_VALUE(_index, this->entries[position].index)) + if (_index->equalValue(entries[position].index)) { /* copy the value into our array */ result->put(this->entries[position].value,i++); @@ -909,7 +901,7 @@ do { /* while more items in chain */ /* if got a match */ - if (EQUAL_VALUE(_index, this->entries[position].index)) + if (_index->equalValue(entries[position].index)) { count++; /* bump our counter */ } @@ -1033,7 +1025,7 @@ if (this->entries[i - 1].index != OREF_NULL) { /* is this the item we want? */ - if (EQUAL_VALUE(_value, this->entries[i - 1].value)) + if (_value->equalValue(entries[i - 1].value)) { count++; /* bump our counter */ } @@ -1049,7 +1041,7 @@ if (this->entries[i - 1].index != OREF_NULL) { /* is this the item we want? */ - if (EQUAL_VALUE(_value, this->entries[i - 1].value)) + if (_value->equalValue(entries[i - 1].value)) { /* copy the value into our array */ result->put(this->entries[i - 1].index, j++); @@ -1076,7 +1068,7 @@ if (this->entries[i - 1].index != OREF_NULL) { /* is this the item we want? */ - if (EQUAL_VALUE(_value, this->entries[i - 1].value)) + if (_value->equalValue(entries[i - 1].value)) { /* get the index */ result = this->entries[i - 1].index; @@ -1129,7 +1121,7 @@ do { /* while more items in chain */ /* if got a match */ - if (EQUAL_VALUE(_index, this->entries[position].index)) + if (_index->equalValue(entries[position].index)) { /* return this item's value */ return this->entries[position].value; @@ -1355,7 +1347,7 @@ do { /* while more items in chain */ /* if got a match */ - if (EQUAL_VALUE(_index, this->entries[position].index)) + if (_index->equalValue(entries[position].index)) { /* set a new value */ OrefSet(this,this->entries[position].value, _value); @@ -1427,7 +1419,7 @@ do { /* while more items in chain */ /* if got match on index and value */ - if (EQUAL_VALUE(_index, this->entries[position].index) && this->entries[position].value == _value) + if (_index->equalValue(entries[position].index) && this->entries[position].value == _value) { return OREF_NULL; /* indicate success */ } Modified: sandbox/rick/newsource/interpreter/classes/support/RexxHashTable.hpp =================================================================== --- sandbox/rick/newsource/interpreter/classes/support/RexxHashTable.hpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/classes/support/RexxHashTable.hpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -59,7 +59,8 @@ class RexxHashTableCollection; class RexxTable; -class RexxHashTable : public RexxInternalObject { +class RexxHashTable : public RexxInternalObject +{ public: enum { @@ -76,9 +77,10 @@ inline RexxHashTable(RESTORETYPE restoreType) { ; }; inline RexxHashTable() { ; } - void live(size_t); - void liveGeneral(MarkReason reason); - void flatten(RexxEnvelope *); + virtual void live(size_t); + virtual void liveGeneral(MarkReason reason); + virtual void flatten(RexxEnvelope *); + RexxArray * makeArray(); void empty(); bool isEmpty(); Modified: sandbox/rick/newsource/interpreter/instructions/AddressInstruction.cpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/AddressInstruction.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/AddressInstruction.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -168,7 +168,7 @@ else { // evaluate - RexxObject *result = expression->evaluate(context, stack); + RexxObject *result = dynamicAddress->evaluate(context, stack); RexxString *_address = REQUEST_STRING(result); // protect this stack->push(_address); Modified: sandbox/rick/newsource/interpreter/instructions/CallInstruction.cpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/CallInstruction.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/CallInstruction.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -41,7 +41,6 @@ /* Primitive Call Parse Class */ /* */ /******************************************************************************/ -#include <stdlib.h> #include "RexxCore.h" #include "StringClass.hpp" #include "DirectoryClass.hpp" @@ -52,6 +51,7 @@ #include "CallInstruction.hpp" #include "SourceFile.hpp" #include "ProtectedObject.hpp" +#include "MethodArguments.hpp" /** @@ -141,7 +141,7 @@ { // see if there is a matching label. If we get something, // we're finished. - targetInstruction = (RexxInstruction *)labels->at((RexxString *)targetName)); + targetInstruction = (RexxInstruction *)labels->at((RexxString *)targetName); } // really nothing else required here. If we did not resolve a label location, then @@ -162,7 +162,7 @@ context->traceInstruction(this); // before we do anything, we need to evaluate all of the arguments. - for (i = 0; i < argumentCount; i++) + for (size_t i = 0; i < argumentCount; i++) { // arguments can be omitted, so don't try to evaluate any of // those. @@ -298,20 +298,16 @@ ActivityManager::currentActivity->checkStackSpace(); context->traceInstruction(this); - // we need to evaluate this first - RexxObject *evaluatedTarget; - ProtectedObject targetName; - // NB: This leaves this on the stack...that's fine, because // it protects the expression RexxObject *evaluatedTarget = dynamicName->evaluate(context, stack); // this needs to be in string form, and protected - ProtectedObject targetName = REQUEST_STRING(evaluatedTarget); - context->traceResult((RexxString *)targetName); + Protected<RexxString> targetName = REQUEST_STRING(evaluatedTarget); + context->traceResult(targetName); // before we do anything, we need to evaluate all of the arguments. - for (i = 0; i < argumentCount; i++) + for (size_t i = 0; i < argumentCount; i++) { // arguments can be omitted, so don't try to evaluate any of // those. @@ -459,7 +455,7 @@ { // see if there is a matching label. If we get something, // we're finished. - targetInstruction = (RexxInstruction *)labels->at((RexxString *)targetName)); + targetInstruction = (RexxInstruction *)labels->at((RexxString *)targetName); if (targetInstruction != OREF_NULL) { return; Modified: sandbox/rick/newsource/interpreter/instructions/CallInstruction.hpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/CallInstruction.hpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/CallInstruction.hpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -108,7 +108,7 @@ inline void operator delete(void *) { } inline void operator delete(void *, void *) { } - RexxInstructionCall(RexxObject *, RexxString *, size_t, RexxQueue *, bool, BuiltinCode); + RexxInstructionCall(RexxString *, size_t, RexxQueue *, BuiltinCode); inline RexxInstructionCall(RESTORETYPE restoreType) { ; }; virtual void live(size_t); @@ -166,16 +166,18 @@ inline void operator delete(void *) { } inline void operator delete(void *, void *) { } - RexxInstructionCallOn(RexxString*, RexxString *); + RexxInstructionCallOn(RexxString*, RexxString *, BuiltinCode); inline RexxInstructionCallOn(RESTORETYPE restoreType) { ; }; - void live(size_t); - void liveGeneral(MarkReason reason); - void flatten(RexxEnvelope*); + virtual void live(size_t); + virtual void liveGeneral(MarkReason reason); + virtual void flatten(RexxEnvelope*); - void execute(RexxActivation *, RexxExpressionStack *); - void resolve(RexxDirectory *); + virtual void execute(RexxActivation *, RexxExpressionStack *); + virtual void resolve(RexxDirectory *); + virtual void trap(RexxActivation *context, RexxDirectory *conditionObj); + protected: BuiltinCode builtinIndex; // builtin function index Modified: sandbox/rick/newsource/interpreter/instructions/ClassDirective.cpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/ClassDirective.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/ClassDirective.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -48,6 +48,7 @@ #include "TableClass.hpp" #include "ListClass.hpp" #include "RexxActivation.hpp" +#include "MethodClass.hpp" /** @@ -321,7 +322,7 @@ { if (inheritsClasses == OREF_NULL) { - inheritsClasses = new_array()); + inheritsClasses = new_array(); } inheritsClasses->append(name); } Modified: sandbox/rick/newsource/interpreter/instructions/CommandInstruction.cpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/CommandInstruction.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/CommandInstruction.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -41,10 +41,10 @@ /* Primitive Command Parse Class */ /* */ /******************************************************************************/ -#include <stdlib.h> #include "RexxCore.h" #include "RexxActivation.hpp" #include "CommandInstruction.hpp" +#include "MethodArguments.hpp" /** Modified: sandbox/rick/newsource/interpreter/instructions/DoBlock.cpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/DoBlock.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/DoBlock.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -44,6 +44,7 @@ #include "RexxCore.h" #include "DoInstruction.hpp" #include "DoBlock.hpp" +#include "RexxActivation.hpp" @@ -120,7 +121,7 @@ // the array was stored in the too field RexxArray *overArray = (RexxArray *)to; // are we past the end of the array? - if (overArray->size() < for) + if (overArray->size() < forCount) { return false; // time to get out of here. } @@ -137,7 +138,7 @@ // assign the control variable and trace this result control->assign(context, stack, result); context->traceResult(result); - forCount++ + forCount++; return true; } @@ -164,7 +165,7 @@ // to add in the BY increment. if (increment) { - result = callOperatorMethod(result, OPERATOR_PLUS, by); + result = result->callOperatorMethod(OPERATOR_PLUS, by); // the control variable gets set immediately, and we trace this // increment result @@ -175,7 +176,7 @@ // if we have a termination condition, do the compare now by calling the operator method. if (to != OREF_NULL) { - if (callOperatorMethod(result, compare, to) == TheTrueObject) + if (result->callOperatorMethod(compare, to) == TheTrueObject) { return false; // time to stop if this is true } Modified: sandbox/rick/newsource/interpreter/instructions/DoBlock.hpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/DoBlock.hpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/DoBlock.hpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -45,6 +45,8 @@ #ifndef Included_RexxDoBlock #define Included_RexxDoBlock +#include "Token.hpp" + class RexxBlockInstruction; class RexxDoBlock : public RexxInternalObject @@ -70,12 +72,12 @@ inline void setControl(RexxVariableBase *v) { control = v; } inline void setTo(RexxObject * value) {to = value;}; inline void setBy(RexxObject * value) {by = value;}; - inline void setFor(wholenumber_t value) {forCount = value;}; + inline void setFor(size_t value) {forCount = value;}; inline void setCase(RexxObject * value) {to = value;}; - inline void setCompare(int value) {compare = (unsigned short)value;}; + inline void setCompare(TokenSubclass value) { compare = value;}; inline RexxObject *getCase() { return to; } inline size_t getIndent() { return indent; }; - inline bool checkFor() {return (forCount--) <= 0;}; + inline bool checkFor() { return (forCount--) > 0; }; bool checkControl(RexxActivation *context, RexxExpressionStack *stack, bool increment); bool checkOver(RexxActivation *context, RexxExpressionStack *stack); @@ -92,7 +94,7 @@ RexxVariableBase *control; // control variable for controlled loop RexxObject *to; // final target TO value RexxObject *by; // control increment value - wholenumber_t forCount; // number of iterations - int compare; // type of comparison + size_t forCount; // number of iterations + TokenSubclass compare; // type of comparison }; #endif Modified: sandbox/rick/newsource/interpreter/instructions/DoBlockComponents.cpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/DoBlockComponents.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/DoBlockComponents.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -43,6 +43,9 @@ /******************************************************************************/ #include "DoBlockComponents.hpp" #include "DoInstruction.hpp" +#include "DoBlock.hpp" +#include "RexxActivation.hpp" +#include "MethodArguments.hpp" /** * Set up for execution of a FOR loop. @@ -59,7 +62,7 @@ if (forCount == OREF_NULL) { // set this to a negative value to indicate not to use this. - forCount = -1; + doblock->setFor(SIZE_MAX); return; } @@ -67,9 +70,7 @@ // validate and convert now. wholenumber_t count = 0; RexxObject *result = forCount->evaluate(context, stack); - /* an integer value already, and */ - /* we're dealing with a "normal */ - /* NUMERIC DIGITS setting */ + // if this is an integer value already and we're at the default digits setting, // we should be able to use this directly. if (isOfClass(Integer, result) && context->digits() >= Numerics::DEFAULT_DIGITS) @@ -83,7 +84,7 @@ // first get the string version and force numeric rounding rules. RexxString *strResult = REQUEST_STRING(result); /* force rounding */ - RexxObject *rounded = callOperatorMethod(result, OPERATOR_PLUS, OREF_NULL); + RexxObject *rounded = result->callOperatorMethod(OPERATOR_PLUS, OREF_NULL); context->traceResult(rounded); // now convert the rounded value to an integer, if possible if (!rounded->requestNumber(count, number_digits())) @@ -101,9 +102,7 @@ } // set this value in the doblock - doblock->setFor(count); - break; - + doblock->setFor((size_t)count); } @@ -121,11 +120,11 @@ RexxObject *_initial = initial->evaluate(context, stack); // force rounding by adding zero to this - _initial = callOperatorMethod(_initial, OPERATOR_PLUS, OREF_NULL); + _initial = _initial->callOperatorMethod(OPERATOR_PLUS, OREF_NULL); // now process each of the expressions. the expressions // array allows us to process these in the order they were specified on // the instruction - for (i = 0; i < 3 && expressions[i] != 0; i++) + for (size_t i = 0; i < 3 && expressions[i] != 0; i++) { switch (expressions[i]) { @@ -136,7 +135,7 @@ // of also validating that this is a valid numeric. RexxObject *result = to->evaluate(context, stack); // prefix + is like adding zero - result = callOperatorMethod(result, OPERATOR_PLUS, OREF_NULL); + result = result->callOperatorMethod(OPERATOR_PLUS, OREF_NULL); // if the result is a string, see if we can convert this to // an integer value. This is very common in loops, and can @@ -156,13 +155,13 @@ { // get the expression value and round RexxObject *result = by->evaluate(context, stack); - result = callOperatorMethod(result, OPERATOR_PLUS, OREF_NULL); + result = result->callOperatorMethod(OPERATOR_PLUS, OREF_NULL); // this gets saved in the doblock doblock->setBy(result); // now we need to check if this is a negative value so set know how to // compare. - if (callOperatorMethod(result, OPERATOR_LESSTHAN, IntegerZero) == TheTrueObject) + if (result->callOperatorMethod(OPERATOR_LESSTHAN, IntegerZero) == TheTrueObject) { // we're counting down, so check less than for termination doblock->setCompare(OPERATOR_LESSTHAN); @@ -209,7 +208,7 @@ RexxExpressionStack *stack, RexxDoBlock *doblock) { // evaluate the array target - RexxObject result = target->evaluate(context, stack); + RexxObject* result = target->evaluate(context, stack); // anchor immediately to protect from GC doblock->setTo(result); Modified: sandbox/rick/newsource/interpreter/instructions/DoBlockComponents.hpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/DoBlockComponents.hpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/DoBlockComponents.hpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -48,6 +48,8 @@ #include "RexxCore.h" +class RexxDoBlock; + enum { EXP_TO, @@ -74,8 +76,7 @@ memory_mark_general(forCount); } - virtual void setup(RexxActivation *context, - RexxExpressionStack *stack, RexxDoBlock *doblock); + virtual void setup(RexxActivation *context, RexxExpressionStack *stack, RexxDoBlock *doblock); RexxObject *forCount; // number of iterations }; Modified: sandbox/rick/newsource/interpreter/instructions/DoCountInstruction.cpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/DoCountInstruction.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/DoCountInstruction.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -132,7 +132,7 @@ void RexxInstructionDoCount::setup(RexxActivation *context, RexxExpressionStack *stack, RexxDoBlock *doblock) { // perform the DO OVER initialization - forLoop.setup(context, stack, doblock) + forLoop.setup(context, stack, doblock); } @@ -271,21 +271,6 @@ whileLoop = w; } - -/** - * Initialize a Do Over While block from a fuller DO - * instruction. - * - * @param parent The parent DO instruction. - */ -RexxInstructionDoCountWhile::RexxInstructionDoCountWhile(RexxInstructionDo *parent) -{ - // we need the label and the DO OVER control logic from the parent - label = parent->label; - forLoop = parent->overLoop; - whileLoop = parent->whileLoop; -} - // NOTE The WHILE variant does not any additional fields, so it can // just use the live() methods inherited from the UNTIL version. Modified: sandbox/rick/newsource/interpreter/instructions/DoOverInstruction.cpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/DoOverInstruction.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/DoOverInstruction.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -133,7 +133,7 @@ void RexxInstructionDoOver::setup(RexxActivation *context, RexxExpressionStack *stack, RexxDoBlock *doblock) { // perform the DO OVER initialization - overLoop.setup(context, stack, doblock) + overLoop.setup(context, stack, doblock); } @@ -216,7 +216,7 @@ */ void RexxInstructionDoOverUntil::flatten(RexxEnvelope *envelope) { - setUpFlatten(RexxInstructionDoUntil) + setUpFlatten(RexxInstructionDoOverUntil) flattenRef(nextInstruction); flattenRef(end); Modified: sandbox/rick/newsource/interpreter/instructions/DoWhileInstruction.cpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/DoWhileInstruction.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/DoWhileInstruction.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -135,7 +135,7 @@ */ bool RexxInstructionDoWhile::iterate(RexxActivation *context, RexxExpressionStack *stack, RexxDoBlock *doblock, bool first) { - whileLoop.checkWhile(context, stack); + return whileLoop.checkWhile(context, stack); } Modified: sandbox/rick/newsource/interpreter/instructions/IfInstruction.cpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/IfInstruction.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/IfInstruction.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -186,7 +186,7 @@ // now perform the compare using the "==" operator method. // NOTE that the case value is the left hand side. - RexxObject *result = callOperatorMethod(caseValue, OPERATOR_PLUS, compareValue); + RexxObject *result = caseValue->callOperatorMethod(OPERATOR_STRICT_EQUAL, compareValue); context->traceResult(result); // the comparison methods return either .true or .false, so we Modified: sandbox/rick/newsource/interpreter/instructions/RexxInstruction.hpp =================================================================== --- sandbox/rick/newsource/interpreter/instructions/RexxInstruction.hpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/instructions/RexxInstruction.hpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -90,9 +90,7 @@ inline bool isType(InstructionKeyword type) { return instructionType == type; } inline size_t getLineNumber() { return instructionLocation.getLineNumber(); } - protected: InstructionKeyword instructionType; // name of the instruction - SourceLocation instructionLocation; // location of the instruction in its source RexxInstruction *nextInstruction; // the next instruction object in the assembled chain. }; @@ -135,7 +133,6 @@ bool isLabel(RexxString *name) { return name == label; } RexxString *getLabel() { return label; }; - protected: RexxString *label; // the block instruction label RexxInstructionEnd *end; // the END matching the block instruction }; Modified: sandbox/rick/newsource/interpreter/parser/KeywordConstants.cpp =================================================================== --- sandbox/rick/newsource/interpreter/parser/KeywordConstants.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/parser/KeywordConstants.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -6,7 +6,7 @@ /* This program and the accompanying materials are made available under */ /* the terms of the Common Public License v1.0 which accompanies this */ /* distribution. A copy is also available at the following address: */ -/* http://www.oorexx.org/license.html */ +/* http://www.oorexx.org/license.html */ /* */ /* Redistribution and use in source and binary forms, with or */ /* without modification, are permitted provided that the following */ @@ -186,8 +186,8 @@ KeywordEntry(CHAR_LINEOUT, BUILTIN_LINEOUT), KeywordEntry(CHAR_LINES, BUILTIN_LINES), KeywordEntry(CHAR_LOWER, BUILTIN_LOWER), - KeywordEntry(CHAR_ORXMAX, BUILTIN_MAX), - KeywordEntry(CHAR_ORXMIN, BUILTIN_MIN), + KeywordEntry(CHAR_ORXMAX, BUILTIN_MAX), + KeywordEntry(CHAR_ORXMIN, BUILTIN_MIN), KeywordEntry(CHAR_OVERLAY, BUILTIN_OVERLAY), KeywordEntry(CHAR_POS, BUILTIN_POS), KeywordEntry(CHAR_QUALIFY, BUILTIN_QUALIFY), Modified: sandbox/rick/newsource/interpreter/parser/Token.cpp =================================================================== --- sandbox/rick/newsource/interpreter/parser/Token.cpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/parser/Token.cpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -41,15 +41,11 @@ /* Primitive Translator Token Class */ /* */ /******************************************************************************/ -#include <ctype.h> -#include <string.h> #include "RexxCore.h" #include "StringClass.hpp" #include "Token.hpp" #include "SourceFile.hpp" - - /** * Create a new Token object. * @@ -70,7 +66,7 @@ */ void RexxToken::live(size_t liveMark) { - memory_mark(value); + memory_mark(stringValue); } @@ -83,7 +79,7 @@ */ void RexxToken::liveGeneral(MarkReason reason) { - memory_mark_general(value); + memory_mark_general(stringValue); } @@ -93,10 +89,10 @@ * * @param source The source for the original operator token. */ -void RexxToken::checkAssignment(RexxSource *source, RexxString *newValue) +void RexxToken::checkAssignment(LanguageParser *parser, RexxString *newValue) { // check if the next character is a special assignment shortcut - if (source->nextSpecial('=', tokenLocation)) + if (parser->nextSpecial('=', tokenLocation)) { // this is a special type, which uses the same subtype. classId = TOKEN_ASSIGNMENT; Modified: sandbox/rick/newsource/interpreter/parser/Token.hpp =================================================================== --- sandbox/rick/newsource/interpreter/parser/Token.hpp 2014-07-05 13:23:16 UTC (rev 10280) +++ sandbox/rick/newsource/interpreter/parser/Token.hpp 2014-07-05 16:33:17 UTC (rev 10281) @@ -236,6 +236,9 @@ KEYWORD_MESSAGE_DOUBLE, KEYWORD_SELECT_CASE, KEYWORD_WHEN_CASE, + KEYWORD_CLASS, + KEYWORD_LIBRARY, + KEYWORD_REQUIRES, } InstructionKeyword; @@ -540,7 +543,19 @@ int precedence(); bool isTerminator(int); + InstructionKeyword keyword(); + InstructionSubKeyword subKeyword(); + BuiltinCode builtin(); + ConditionKeyword condition(); + InstructionSubKeyword parseOption(); + DirectiveKeyword keyDirective(); + DirectiveSubKeyword subDirective(); + static BuiltinCode resolveBuiltin(RexxString *value); + protected: + + static int resolveKeyword(RexxString *token, KeywordEntry *table, int table_size); + RexxString *stringValue; // token string value TokenClass classId; // class of token TokenSubclass subclass; // specialized type of token |