Diff for /parser3/src/main/execute.C between versions 1.64 and 1.69

version 1.64, 2001/03/08 09:13:33 version 1.69, 2001/03/08 12:19:21
Line 23 Line 23
   
 char *opcode_name[]={  char *opcode_name[]={
         // literals          // literals
         "VALUE",  "CODE",  "CLASS",          "VALUE",  "CODE__STORE_PARAM",
   
         // actions          // actions
         "WITH_SELF",    "WITH_ROOT",    "WITH_READ",    "WITH_WRITE",          "WITH_SELF",    "WITH_ROOT",    "WITH_READ",    "WITH_WRITE",
           "GET_CLASS",
         "CONSTRUCT",          "CONSTRUCT",
         "WRITE",          "WRITE",
         "GET_ELEMENT",  "GET_ELEMENT__WRITE",          "GET_ELEMENT",  "GET_ELEMENT__WRITE",
Line 69  void dump(int level, const Array& ops) { Line 70  void dump(int level, const Array& ops) {
                         Value *value=static_cast<Value *>(ops.quick_get(++i));                          Value *value=static_cast<Value *>(ops.quick_get(++i));
                         fprintf(stderr, " \"%s\" %s", value->get_string()->cstr(), value->type());                          fprintf(stderr, " \"%s\" %s", value->get_string()->cstr(), value->type());
                 }                  }
                 if(op.code==OP_CLASS) {  
                         VClass *vclass=static_cast<VClass *>(ops.quick_get(++i));  
                         fprintf(stderr, " \"%s\"", vclass->name().cstr());  
                 }  
                 fprintf(stderr, "\n");                  fprintf(stderr, "\n");
   
                 if(op.code==OP_CODE) {                  if(op.code==OP_CODE__STORE_PARAM) {
                         const Array *local_ops=reinterpret_cast<const Array *>(ops.quick_get(++i));                          const Array *local_ops=reinterpret_cast<const Array *>(ops.quick_get(++i));
                         dump(level+1, *local_ops);                          dump(level+1, *local_ops);
                 }                  }
Line 106  void Request::execute(const Array& ops) Line 103  void Request::execute(const Array& ops)
                                 PUSH(value);                                  PUSH(value);
                                 break;                                  break;
                         }                          }
                 case OP_CODE:                  case OP_CODE__STORE_PARAM:
                         {                          {
                                 VMethodFrame *frame=static_cast<VMethodFrame *>(stack[stack.top()]);                                  VMethodFrame *frame=static_cast<VMethodFrame *>(stack[stack.top()]);
                                   // code
                                 const Array *local_ops=reinterpret_cast<const Array *>(ops.quick_get(++i));                                  const Array *local_ops=reinterpret_cast<const Array *>(ops.quick_get(++i));
                                 fprintf(stderr, " (%d)\n", local_ops->size());                                  fprintf(stderr, " (%d)\n", local_ops->size());
                                 dump(1, *local_ops);                                  dump(1, *local_ops);
Line 119  void Request::execute(const Array& ops) Line 117  void Request::execute(const Array& ops)
                                                                   
                                 Value *value=NEW VJunction(j);                                  Value *value=NEW VJunction(j);
                                 value->set_name(frame->name());                                  value->set_name(frame->name());
                                 PUSH(value);  
                                   // store param
                                   frame->store_param(value);
                                 break;                                  break;
                         }                          }
                 case OP_CLASS:                  case OP_GET_CLASS:
                         {                          {
                                 VClass *vclass=static_cast<VClass *>(ops.quick_get(++i));                                  String& name=POP_NAME();
                                 fprintf(stderr, " \"%s\"", vclass->name().cstr());                                  VClass *vclass=static_cast<VClass *>(classes().get(name));
                         PUSH(vclass);                                  if(!vclass) 
                                           THROW(0,0,
                                                   &name,
                                                   ": undefined class"); 
   
                                   PUSH(vclass);
                                 break;                                  break;
                         }                          }
                                                   
Line 288  void Request::execute(const Array& ops) Line 293  void Request::execute(const Array& ops)
                                         VAliased *aliased=self->get_aliased();                                          VAliased *aliased=self->get_aliased();
                                         // substitute class alias to the class they are called AS                                          // substitute class alias to the class they are called AS
                                         Temp_alias temp_alias(*aliased, *frame->junction.vclass);                                          Temp_alias temp_alias(*aliased, *frame->junction.vclass);
                                         execute(frame->junction.method->code);  
                                           Method& method=*frame->junction.method;
                                           if(method.native_code) // native code?
                                                   (*method.native_code)(*this); // execute it
                                           else // parser code
                                                   execute(*method.parser_code); // execute it
                                 }                                  }
                                 Value *value=wcontext->result();                                  Value *value=wcontext->result();
   
Line 519  void Request::execute(const Array& ops) Line 529  void Request::execute(const Array& ops)
                         }                          }
   
                 default:                  default:
                         fprintf(stderr, "\tTODO");                          THROW(0,0,
                         break;                                  0,
                                   "unhandled '%s' opcode", opcode_name[op.code]); 
                 }                  }
                 fprintf(stderr, "\n");                  fprintf(stderr, "\n");
         }          }

Removed from v.1.64  
changed lines
  Added in v.1.69


E-mail: