--- parser3/src/main/execute.C 2001/03/06 12:57:30 1.50 +++ parser3/src/main/execute.C 2001/03/06 14:32:19 1.52 @@ -1,5 +1,5 @@ /* - $Id: execute.C,v 1.50 2001/03/06 12:57:30 paf Exp $ + $Id: execute.C,v 1.52 2001/03/06 14:32:19 paf Exp $ */ #include "pa_array.h" @@ -22,12 +22,11 @@ char *opcode_name[]={ // literals - "STRING", "CODE", "CLASS", + "VALUE", "CODE", "CLASS", // actions - "WITH_ROOT", "WITH_SELF", "WITH_READ", "WITH_WRITE", + "WITH_SELF", "WITH_ROOT", "WITH_READ", "WITH_WRITE", "CONSTRUCT", - "EXPRESSION_EVAL", "MODIFY_EVAL", "WRITE", "GET_ELEMENT", "GET_ELEMENT__WRITE", "CREATE_EWPOOL", "REDUCE_EWPOOL", @@ -35,7 +34,7 @@ char *opcode_name[]={ "CREATE_SWPOOL", "REDUCE_SWPOOL", "GET_METHOD_FRAME", "STORE_PARAM", - "CALL" + "CALL", // expression ops: unary "NEG", "INV", "NOT", "DEF", "IN", "FEXISTS", @@ -66,9 +65,9 @@ void dump(int level, const Array& ops) { op.cast=ops.quick_get(i); fprintf(stderr, "%*s%s", level*4, "", opcode_name[op.code]); - if(op.code==OP_STRING) { - VString *vstring=static_cast(ops.quick_get(++i)); - fprintf(stderr, " \"%s\"", vstring->get_string()->cstr()); + if(op.code==OP_VALUE) { + Value *value=static_cast(ops.quick_get(++i)); + fprintf(stderr, " \"%s\" %s", value->get_string()->cstr(), value->type()); } if(op.code==OP_CLASS) { VClass *vclass=static_cast(ops.quick_get(++i)); @@ -85,9 +84,9 @@ void dump(int level, const Array& ops) { void Request::execute(const Array& ops) { if(1) { - fputs("source----------------------------", stderr); + fputs("source----------------------------\n", stderr); dump(0, ops); - fputs("execution-------------------------", stderr); + fputs("execution-------------------------\n", stderr); } int size=ops.size(); @@ -98,12 +97,12 @@ void Request::execute(const Array& ops) fprintf(stderr, "%d:%s", stack.top(), opcode_name[op.code]); switch(op.code) { - // param in next instruction - case OP_STRING: + // param in next instruction + case OP_VALUE: { - VString *vstring=static_cast(ops.quick_get(++i)); - fprintf(stderr, " \"%s\"", vstring->get_string()->cstr()); - PUSH(vstring); + Value *value=static_cast(ops.quick_get(++i)); + fprintf(stderr, " \"%s\" %s", value->get_string()->cstr(), value->type()); + PUSH(value); break; } case OP_CODE: @@ -127,7 +126,7 @@ void Request::execute(const Array& ops) break; } - // OP_WITH + // OP_WITH case OP_WITH_SELF: { PUSH(self); @@ -149,7 +148,7 @@ void Request::execute(const Array& ops) break; } - // ... + // OTHER ACTIONS BUT WITHs case OP_CONSTRUCT: { Value *value=POP(); @@ -159,7 +158,6 @@ void Request::execute(const Array& ops) ncontext->put_element(name, value); break; } - // TODO: OP_EXPRESSION_EVAL, OP_MODIFY_EVAL, case OP_WRITE: { Value *value=POP(); @@ -231,8 +229,7 @@ void Request::execute(const Array& ops) break; } - - // CALL + // CALL case OP_GET_METHOD_FRAME: { Value *value=POP(); @@ -299,6 +296,7 @@ void Request::execute(const Array& ops) break; } + // EXPRESSION case OP_MUL: { Value *b=POP();