--- parser3/src/main/execute.C 2001/03/08 15:19:37 1.74 +++ parser3/src/main/execute.C 2001/03/09 04:47:29 1.79 @@ -1,5 +1,5 @@ /* - $Id: execute.C,v 1.74 2001/03/08 15:19:37 paf Exp $ + $Id: execute.C,v 1.79 2001/03/09 04:47:29 paf Exp $ */ #include "pa_array.h" @@ -215,7 +215,7 @@ void Request::execute(const Array& ops) case OP_REDUCE_RWPOOL: { String *string=wcontext->get_string(); - Value *value=string?NEW VString(*string):NEW VString(pool()); + Value *value=string?NEW VString(*string):NEW VString(); wcontext=static_cast(POP()); rcontext=POP(); PUSH(value); @@ -232,7 +232,7 @@ void Request::execute(const Array& ops) // from "$a $b" part of expression taking only string value, // ignoring any other content of wcontext String *string=wcontext->get_string(); - Value *value=string?NEW VString(*string):NEW VString(pool()); + Value *value=string?NEW VString(*string):NEW VString(); wcontext=static_cast(POP()); PUSH(value); break; @@ -278,16 +278,14 @@ void Request::execute(const Array& ops) VClass *read_class=rcontext->get_class(); if(read_class && read_class->is_or_derived_from(*called_class)) // yes self=rcontext; // class dynamic call - else { // no, not me or relative of mine (total stranger) - // constructing? - if(wcontext->constructing()) { // yes - // constructor call: $some(^class:method(..)) - self=NEW VObject(pool(), *called_class); + else // no, not me or relative of mine (total stranger) + if(wcontext->constructing()) { // constructing? + // yes, constructor call: $some(^class:method(..)) + self=NEW VObject(*called_class); frame->write(*self); - } else { // no - self=&frame->junction.self; // static or simple dynamic call - } - } + } else + self=&frame->junction.self; // no, static or simple dynamic call + frame->set_self(*self); root=rcontext=wcontext=frame; { @@ -318,7 +316,8 @@ void Request::execute(const Array& ops) case OP_NEG: { Value *operand=POP(); - Value *value=NEW VDouble(pool(), -operand->get_double()); + Value *value=NEW VDouble(pool(), + -operand->get_double()); PUSH(value); break; } @@ -363,28 +362,32 @@ void Request::execute(const Array& ops) case OP_SUB: { Value *b=POP(); Value *a=POP(); - Value *value=NEW VDouble(pool(), a->get_double() - b->get_double()); + Value *value=NEW VDouble(pool(), + a->get_double() - b->get_double()); PUSH(value); break; } case OP_ADD: { Value *b=POP(); Value *a=POP(); - Value *value=NEW VDouble(pool(), a->get_double() + b->get_double()); + Value *value=NEW VDouble(pool(), + a->get_double() + b->get_double()); PUSH(value); break; } case OP_MUL: { Value *b=POP(); Value *a=POP(); - Value *value=NEW VDouble(pool(), a->get_double() * b->get_double()); + Value *value=NEW VDouble(pool(), + a->get_double() * b->get_double()); PUSH(value); break; } case OP_DIV: { Value *b=POP(); Value *a=POP(); - Value *value=NEW VDouble(pool(), a->get_double() / b->get_double()); + Value *value=NEW VDouble(pool(), + a->get_double() / b->get_double()); PUSH(value); break; } @@ -544,10 +547,13 @@ Value *Request::get_element() { Value *ncontext=POP(); Value *value=ncontext->get_element(name); - // autocalc possible code-junction - value=value?&autocalc(*value):NEW VUnknown(pool()); + if(value) + value=&autocalc(*value); // autocalc possible code-junction + else { + value=NEW VUnknown(pool()); + value->set_name(name); + } - value->set_name(name); return value; } @@ -595,7 +601,3 @@ Value& Request::autocalc(Value& value, b } else return value; } - -void Request::write(Value& avalue) { - wcontext->write(avalue); -} \ No newline at end of file