Diff for /parser3/src/main/execute.C between versions 1.136 and 1.142

version 1.136, 2001/04/03 05:23:41 version 1.142, 2001/04/09 10:08:30
Line 155  void Request::execute(const Array& ops) Line 155  void Request::execute(const Array& ops)
                                         *self, 0, 0,                                          *self, 0, 0,
                                         root,                                           root, 
                                         wcontext->somebody_entered_some_object()>1?                                          wcontext->somebody_entered_some_object()>1?
                                                 &frame->junction.self /* ^t.menu{} */:rcontext/* ^if() */,                                                   &frame->junction.self /*^t.menu{}*/:rcontext/*^if()*/, 
                                         op.code==OP_EXPR_CODE__STORE_PARAM?                                          op.code==OP_EXPR_CODE__STORE_PARAM?
                                                 0:wcontext->somebody_entered_some_object()>1?                                                  0:wcontext->somebody_entered_some_object()>1?
                                                         frame/* ^t.menu{} */:wcontext/* ^if() */,                                                           frame/*^t.menu{}*/:wcontext/*^if()*/, 
                                         local_ops);                                          local_ops);
                                                                   
                                 Value *value=NEW VJunction(j);                                  Value *value=NEW VJunction(j);
Line 177  void Request::execute(const Array& ops) Line 177  void Request::execute(const Array& ops)
                                 if(!value)                                   if(!value) 
                                         THROW(0,0,                                          THROW(0,0,
                                                 &name,                                                  &name,
                                                 ": undefined class");                                                   "class undefined"); 
   
                                 PUSH(value);                                  PUSH(value);
                                 break;                                  break;
Line 265  void Request::execute(const Array& ops) Line 265  void Request::execute(const Array& ops)
                 case OP_CREATE_EWPOOL:                  case OP_CREATE_EWPOOL:
                         {                          {
                                 PUSH(wcontext);                                  PUSH(wcontext);
                                 wcontext=NEW WWrapper(pool(), 0 /* empty */, true /* constructing */);                                  PUSH((void *)flang);
                                   flang=String::UL_PASS_APPENDED;
                                   wcontext=NEW WWrapper(pool(), 0 /*empty*/, true /*constructing*/);
                                 break;                                  break;
                         }                          }
                 case OP_REDUCE_EWPOOL:                  case OP_REDUCE_EWPOOL:
                         {                          {
                                 Value *value=wcontext->result();                                  Value *value=wcontext->result();
                                   flang=static_cast<String::Untaint_lang>(reinterpret_cast<int>(POP()));
                                 wcontext=static_cast<WContext *>(POP());                                  wcontext=static_cast<WContext *>(POP());
                                 PUSH(value);                                  PUSH(value);
                                 break;                                  break;
Line 282  void Request::execute(const Array& ops) Line 285  void Request::execute(const Array& ops)
                                 PUSH(rcontext);                                  PUSH(rcontext);
                                 rcontext=ncontext;                                  rcontext=ncontext;
                                 PUSH(wcontext);                                  PUSH(wcontext);
                                 wcontext=NEW WWrapper(pool(), ncontext, false /* not constructing */);                                  wcontext=NEW WWrapper(pool(), ncontext, false /*not constructing*/);
                                 break;                                  break;
                         }                          }
                 case OP_REDUCE_RWPOOL:                  case OP_REDUCE_RWPOOL:
Line 301  void Request::execute(const Array& ops) Line 304  void Request::execute(const Array& ops)
                 case OP_CREATE_SWPOOL:                  case OP_CREATE_SWPOOL:
                         {                          {
                                 PUSH(wcontext);                                  PUSH(wcontext);
                                 wcontext=NEW WWrapper(pool(), 0 /* empty */, false /* not constructing */);                                  wcontext=NEW WWrapper(pool(), 0 /*empty*/, false /*not constructing*/);
                                 break;                                  break;
                         }                          }
                 case OP_REDUCE_SWPOOL:                  case OP_REDUCE_SWPOOL:
Line 323  void Request::execute(const Array& ops) Line 326  void Request::execute(const Array& ops)
                 case OP_GET_METHOD_FRAME:                  case OP_GET_METHOD_FRAME:
                         {                          {
                                 Value *value=POP();                                  Value *value=POP();
   
                                 // info:                                   // info: 
                                 //      code compiled so that this one's always method-junction,                                   //      code compiled so that this one's always method-junction, 
                                 //      not a code-junction                                  //      not a code-junction
Line 333  void Request::execute(const Array& ops) Line 337  void Request::execute(const Array& ops)
                                                 "(%s) not a method or junction, can not call it",                                                  "(%s) not a method or junction, can not call it",
                                                         value->type());                                                           value->type()); 
   
                                 VMethodFrame *frame=NEW VMethodFrame(pool(), *junction);                                  bool is_constructor=
                                           wcontext->constructing() && // constructing?
                                           wcontext->somebody_entered_some_class(); // ^class:method[..]?
                                   if(is_constructor)
                                           wcontext->constructing(false);
   
                                   VMethodFrame *frame=NEW VMethodFrame(pool(), *junction, is_constructor);
                                 frame->set_name(value->name());                                  frame->set_name(value->name());
                                 PUSH(frame);                                  PUSH(frame);
                                 break;                                  break;
Line 362  void Request::execute(const Array& ops) Line 372  void Request::execute(const Array& ops)
                                 if(read_class && read_class->is_or_derived_from(*called_class)) // yes                                  if(read_class && read_class->is_or_derived_from(*called_class)) // yes
                                         self=rcontext; // class dynamic call                                          self=rcontext; // class dynamic call
                                 else // no, not me or relative of mine (total stranger)                                  else // no, not me or relative of mine (total stranger)
                                         if(                                          if(frame->is_constructor) {
                                                 wcontext->constructing() && // constructing?                                                  // this is a constructor call
                                                 wcontext->somebody_entered_some_class()) { // ^class:method[..]?  
                                                 // yes, this is a constructor call  
                                                 // some stateless_object derivates with constructors                                                  // some stateless_object derivates with constructors
                                                 if(called_class==table_class)                                                  if(called_class==table_class)
                                                         self=NEW VTable(pool());                                                          self=NEW VTable(pool());
Line 647  void Request::execute(const Array& ops) Line 655  void Request::execute(const Array& ops)
                 default:                  default:
                         THROW(0,0,                          THROW(0,0,
                                 0,                                  0,
                                 "unhandled '%s' opcode", opcode_name[op.code]);                                   "invalid opcode %d", op.code); 
                 }                  }
         }          }
 }  }
Line 656  Value *Request::get_element() { Line 664  Value *Request::get_element() {
         const String& name=POP_NAME();          const String& name=POP_NAME();
         Value *ncontext=POP();          Value *ncontext=POP();
         Value *value=ncontext->get_element(name);          Value *value=ncontext->get_element(name);
           if(!value)
                   if(Method* method=OP.get_method(name)) { // operator?
                           // as if that method were in self and we have normal dynamic method here
                           Junction& junction=*NEW Junction(pool(), 
                                   *self, self->get_class(), method, 0,0,0,0);
                           value=NEW VJunction(junction);
                   }
         if(value)          if(value)
                 value=&process(*value, &name); // process possible code-junction                  value=&process(*value, &name); // process possible code-junction
         else {          else {
Line 737  const String *Request::execute_method(Va Line 751  const String *Request::execute_method(Va
                   
         // initialize contexts          // initialize contexts
         root=rcontext=self=&aself;          root=rcontext=self=&aself;
         wcontext=NEW WWrapper(pool(), &aself, false /* not constructing */);          wcontext=NEW WWrapper(pool(), &aself, false /*not constructing*/);
                   
         // execute!               // execute!     
         execute(*method.parser_code);          execute(*method.parser_code);

Removed from v.1.136  
changed lines
  Added in v.1.142


E-mail: