Diff for /parser3/src/main/execute.C between versions 1.364 and 1.367

version 1.364, 2010/08/11 16:21:52 version 1.367, 2010/10/21 15:25:07
Line 639  void Request::execute(ArrayOperation& op Line 639  void Request::execute(ArrayOperation& op
   
                                 execute(local_ops);                                  execute(local_ops);
   
                                 Value* value;  
                                 // from "$a $b" part of expression taking only string value,                                  // from "$a $b" part of expression taking only string value,
                                 // ignoring any other content of wcontext                                  // ignoring any other content of wcontext
                                 if(const String* string=wcontext->get_string())                                  const String* string=wcontext->get_string();
                                         value=new VString(*string);                                  Value* value=string ? new VString(*string) : new VString();
                                 else  
                                         value=VVoid::get();  
                                 stack.push(*value);                                  stack.push(*value);
   
                                 wcontext=saved_wcontext;                                  wcontext=saved_wcontext;
Line 842  void Request::execute(ArrayOperation& op Line 839  void Request::execute(ArrayOperation& op
                                 object.enable_default_setter();                                  object.enable_default_setter();
   
                                 if(opcode==OP::OP_CONSTRUCT_OBJECT)                                  if(opcode==OP::OP_CONSTRUCT_OBJECT)
                                         stack.push(object);                                          stack.push(frame.result().as_value());
                                 else                                  else
                                         write_pass_lang(object);                                          write_pass_lang(frame.result());
   
                                 DEBUG_PRINT_STR("<-returned")                                  DEBUG_PRINT_STR("<-returned")
                                 break;                                  break;
Line 1207  void Request::op_call(VMethodFrame& fram Line 1204  void Request::op_call(VMethodFrame& fram
                                                                   
         SAVE_CONTEXT          SAVE_CONTEXT
   
         rcontext=wcontext=&frame;          rcontext=wcontext=method_frame=&frame;
         method_frame=&frame;  
   
         Value& self=frame.self();          Value& self=frame.self();
         const Method& method=frame.method;          const Method& method=frame.method;
Line 1290  void Request::put_element(Value& ncontex Line 1286  void Request::put_element(Value& ncontex
                                 frame.store_params(params, 2);                                  frame.store_params(params, 2);
   
                                 Temp_disable_default_setter temp(junction.self);                                  Temp_disable_default_setter temp(junction.self);
                                   execute_method(frame);
                                 SAVE_CONTEXT  
   
                                 rcontext=wcontext=&frame;  
                                 method_frame=&frame;  
   
                                 recoursion_checked_execute(*frame.method.parser_code);  
   
                                 RESTORE_CONTEXT  
                         } else {                          } else {
                                 // setter                                  // setter
                                 if(param_count!=1)                                  if(param_count!=1)
Line 1307  void Request::put_element(Value& ncontex Line 1295  void Request::put_element(Value& ncontex
                                                 "setter method must have ONE parameter (has %d parameters)", param_count);                                                  "setter method must have ONE parameter (has %d parameters)", param_count);
   
                                 frame.store_params(&value, 1);                                  frame.store_params(&value, 1);
                                   execute_method(frame);
                                 SAVE_CONTEXT  
   
                                 rcontext=wcontext=&frame;  
                                 method_frame=&frame;  
   
                                 recoursion_checked_execute(*frame.method.parser_code);  
   
                                 RESTORE_CONTEXT  
                         }                          }
                 }                  }
 }  }
Line 1338  StringOrValue Request::process_getter(Ju Line 1318  StringOrValue Request::process_getter(Ju
                 } // no need for else frame.empty_params()                  } // no need for else frame.empty_params()
   
                 Temp_disable_default_getter temp(junction.self);                  Temp_disable_default_getter temp(junction.self);
                                                   execute_method(frame);
                 SAVE_CONTEXT  
   
                 rcontext=wcontext=&frame;  
                 method_frame=&frame;  
   
                 recoursion_checked_execute(*frame.method.parser_code); // parser code, execute it  
   
                 RESTORE_CONTEXT  
         } else {          } else {
                 // getter                  // getter
                 if(param_count!=0)                  if(param_count!=0)
Line 1355  StringOrValue Request::process_getter(Ju Line 1327  StringOrValue Request::process_getter(Ju
                                 "getter method must have no parameters (has %d parameters)", param_count);                                  "getter method must have no parameters (has %d parameters)", param_count);
                                   
                 // no need for frame.empty_params()                  // no need for frame.empty_params()
                   execute_method(frame);
                 SAVE_CONTEXT  
   
                 rcontext=wcontext=&frame;  
                 method_frame=&frame;  
   
                 recoursion_checked_execute(*frame.method.parser_code); // parser code, execute it  
   
                 RESTORE_CONTEXT  
         }          }
   
         return frame.result();          return frame.result();
Line 1510  void Request::process_write(Value& input Line 1474  void Request::process_write(Value& input
         write_pass_lang(input_value);          write_pass_lang(input_value);
 }  }
   
 StringOrValue Request::execute_method(VMethodFrame& amethod_frame, const Method& method) {  void Request::execute_method(VMethodFrame& aframe) {
         SAVE_CONTEXT          SAVE_CONTEXT
                   
         // initialize contexts          // initialize contexts
         rcontext=wcontext=method_frame=&amethod_frame;          rcontext=wcontext=method_frame=&aframe;
                   
         // execute!               // execute!     
         execute(*method.parser_code);          recoursion_checked_execute(*aframe.method.parser_code);
           
         // result  
         StringOrValue result=wcontext->result();  
                   
         RESTORE_CONTEXT          RESTORE_CONTEXT
           
         // return  
         return result;  
 }  }
   
 const String* Request::execute_method(Value& aself,   const String* Request::execute_method(Value& aself, 
                                         const Method& method, Value* optional_param,                                          const Method& method, Value* optional_param,
                                         bool do_return_string) {                                          bool do_return_string) {
   
         SAVE_CONTEXT  
           
         VMethodFrame local_frame(method, method_frame/*caller*/, aself);          VMethodFrame local_frame(method, method_frame/*caller*/, aself);
   
         if(optional_param && local_frame.method_params_count()>0) {          if(optional_param && local_frame.method_params_count()>0) {
                 local_frame.store_params(&optional_param, 1);                  local_frame.store_params(&optional_param, 1);
         } else {          } else {
                 local_frame.empty_params();                  local_frame.empty_params();
         }          }
         rcontext=wcontext=method_frame=&local_frame;   
   
         // prevent non-string writes for better error reporting          // prevent non-string writes for better error reporting
         if(do_return_string)          if(do_return_string)
                 local_frame.write(local_frame);                  local_frame.write(local_frame);
                   
         // execute!               execute_method(local_frame);
         execute(*method.parser_code);  
                   
         // result          return do_return_string ? local_frame.get_string() : 0;
         const String* result=do_return_string ? local_frame.get_string() : 0;  
           
         RESTORE_CONTEXT  
   
         return result;  
 }  }
   
 Request::Execute_nonvirtual_method_result   Request::Execute_nonvirtual_method_result 

Removed from v.1.364  
changed lines
  Added in v.1.367


E-mail: