Diff for /parser3/src/main/execute.C between versions 1.32 and 1.35

version 1.32, 2001/02/24 08:28:37 version 1.35, 2001/02/24 11:30:10
Line 8 Line 8
 #include "pa_vstring.h"  #include "pa_vstring.h"
 #include "pa_vhash.h"  #include "pa_vhash.h"
 #include "pa_vunknown.h"  #include "pa_vunknown.h"
 #include "pa_vframe.h"  #include "pa_vcframe.h"
 #include "pa_wwrapper.h"  #include "pa_vmframe.h"
 #include "pa_vjunction.h"  
   
 #include <stdio.h>  #include <stdio.h>
   
Line 92  void Request::execute(const Array& ops) Line 91  void Request::execute(const Array& ops)
                                 const Array *local_ops=reinterpret_cast<const Array *>(ops.quick_get(++i));                                  const Array *local_ops=reinterpret_cast<const Array *>(ops.quick_get(++i));
                                 printf(" (%d)", local_ops->size());                                  printf(" (%d)", local_ops->size());
                                 Junction& j=*NEW Junction(pool(),                                   Junction& j=*NEW Junction(pool(), 
                                           *self,
                                         0,                                          0,
                                         root,self,rcontext,local_ops);                                          root,rcontext,wcontext,local_ops);
                                                                   
                                 Value *value=NEW VJunction(j);                                  Value *value=NEW VJunction(j);
                                 PUSH(value);                                  PUSH(value);
Line 162  void Request::execute(const Array& ops) Line 162  void Request::execute(const Array& ops)
                         }                          }
                 case OP_REDUCE_EWPOOL:                  case OP_REDUCE_EWPOOL:
                         {                          {
                                 Value *value=wcontext->value();                                  Value *value=wcontext->value_or_string();
                                 wcontext=static_cast<WContext *>(POP());                                  wcontext=static_cast<WContext *>(POP());
                                 PUSH(value);                                  PUSH(value);
                                 break;                                  break;
Line 198  void Request::execute(const Array& ops) Line 198  void Request::execute(const Array& ops)
                                                 "is not a method or a junction (it is '%s'), can not call it",                                                  "is not a method or a junction (it is '%s'), can not call it",
                                                 value->type());                                                   value->type()); 
                                 //unless(method) method=operators.get_method[...;code/native_code](name)                                  //unless(method) method=operators.get_method[...;code/native_code](name)
                                 VFrame *frame=NEW VFrame(pool(), *junction);                                  VMethodFrame *frame=NEW VMethodFrame(pool(), *junction);
                                 PUSH(frame);                                  PUSH(frame);
                                 break;                                  break;
                         }                          }
                 case OP_STORE_PARAM:                  case OP_STORE_PARAM:
                         {                          {
                                 Value *value=POP();                                  Value *value=POP();
                                 VFrame *frame=static_cast<VFrame *>(stack[0]);                                  VMethodFrame *frame=static_cast<VMethodFrame *>(stack[0]);
                                 frame->store_param(value);                                  frame->store_param(value);
                                 break;                                  break;
                         }                          }
Line 213  void Request::execute(const Array& ops) Line 213  void Request::execute(const Array& ops)
                 case OP_CALL:                  case OP_CALL:
                         {                          {
                                 printf("->\n");                                  printf("->\n");
                                 VFrame *frame=static_cast<VFrame *>(POP());                                  VMethodFrame *frame=static_cast<VMethodFrame *>(POP());
                                 frame->fill_empty_params();                                  frame->fill_unspecified_params();
                                 PUSH(self);  PUSH(root);  PUSH(rcontext);  PUSH(wcontext);                                  PUSH(self);  PUSH(root);  PUSH(rcontext);  PUSH(wcontext); 
                                 //left_class=ncontext.get_class()                                  //left_class=ncontext.get_class()
                                 //right_class=frame.self.get_class()                                  //right_class=frame.self.get_class()
                                 //self=f(left_class[thoughts' food], right_self[junction], right_class[static], wcontext.value()[dynamic], new(right_class)[construct])                                  //self=f(left_class[thoughts' food], right_self[junction], right_class[static], wcontext.value()[dynamic], new(right_class)[construct])
                                 self=frame->junction.self; // TODO: не всегда frame..self                                  self=&frame->junction.self; // TODO: не всегда frame..self
                                 frame->set_self(self);                                  frame->set_self(self);
                                 root=rcontext=wcontext=frame;                                  root=rcontext=wcontext=frame;
                                 execute(frame->junction.method->code);                                  execute(frame->junction.method->code);
Line 249  Value *Request::get_element() { Line 249  Value *Request::get_element() {
                 if(junction && junction->code) { // is it a code junction?                  if(junction && junction->code) { // is it a code junction?
                         // autocalc it                          // autocalc it
                         printf("ja->\n");                          printf("ja->\n");
                         VFrame frame(pool(), *junction);  
                         PUSH(self);  PUSH(root);  PUSH(rcontext);  PUSH(wcontext);                          PUSH(self);  PUSH(root);  PUSH(rcontext);  PUSH(wcontext);
                         frame.set_self(self=junction->self);                          // almost plain wwrapper about junction wcontext, 
                           // BUT intercepts string writes
                           VCodeFrame frame(pool(), *junction->wcontext);  wcontext=&frame;
                           self=&junction->self;
                         root=junction->root;                          root=junction->root;
                         rcontext=junction->rcontext;                          rcontext=junction->rcontext;
                         wcontext=&frame;  
                         execute(*junction->code);                          execute(*junction->code);
                         value=wcontext->value();                          // CodeFrame soul:
                         //value=wcontext->get_string();                          //    string writes intercepted
                           //   and they are the result of getting code junction
                           value=NEW VString(frame.get_string());
                         wcontext=static_cast<WContext *>(POP());  rcontext=POP();  root=POP();  self=POP();                          wcontext=static_cast<WContext *>(POP());  rcontext=POP();  root=POP();  self=POP();
                         printf("<-ja returned");                          printf("<-ja returned");
                 }                  }
Line 266  Value *Request::get_element() { Line 269  Value *Request::get_element() {
                 value->set_name(name);                  value->set_name(name);
         }          }
         return value;          return value;
 }  
   
   }

Removed from v.1.32  
changed lines
  Added in v.1.35


E-mail: