Diff for /parser3/src/classes/op.C between versions 1.101 and 1.106

version 1.101, 2002/08/08 09:35:22 version 1.106, 2002/09/10 12:02:23
Line 13  static const char* IDENT_OP_C="$Date$"; Line 13  static const char* IDENT_OP_C="$Date$";
 #include "pa_vint.h"  #include "pa_vint.h"
 #include "pa_sql_connection.h"  #include "pa_sql_connection.h"
 #include "pa_vdate.h"  #include "pa_vdate.h"
   #include "pa_vmethod_frame.h"
   
 // limits  // limits
   
Line 202  static void _for(Request& r, const Strin Line 203  static void _for(Request& r, const Strin
   
         bool need_delim=false;          bool need_delim=false;
         VInt *vint=new(pool) VInt(pool, 0);          VInt *vint=new(pool) VInt(pool, 0);
         r.root->put_element(var_name, vint);          r.method_frame->put_element(var_name, vint, false);
         for(int i=from; i<=to; i++) {          for(int i=from; i<=to; i++) {
                 vint->set_int(i);                  vint->set_int(i);
   
Line 291  static void _switch(Request& r, const St Line 292  static void _switch(Request& r, const St
         r.process(cases_code, true/*intercept_string*/);          r.process(cases_code, true/*intercept_string*/);
         if(Value *selected_code=data.found ? data.found : data._default) {          if(Value *selected_code=data.found ? data.found : data._default) {
                 // setting code context, would execute in ^switch[...]{>>context<<}                  // setting code context, would execute in ^switch[...]{>>context<<}
                 selected_code->get_junction()->change_context(cases_code.get_junction());                  //selected_code->get_junction()->change_context(cases_code.get_junction());
                 r.write_pass_lang(r.process(*selected_code));                  r.write_pass_lang(r.process(*selected_code, false /* get all that can be got */ ));
         }          }
 }  }
   
Line 310  static void _case(Request& r, const Stri Line 311  static void _case(Request& r, const Stri
                   
         // killing context for safety, would execute in ^switch[...]{>>context<<}          // killing context for safety, would execute in ^switch[...]{>>context<<}
         // reason: context is stacked, and it would become invalid afterwards          // reason: context is stacked, and it would become invalid afterwards
         code->get_junction()->change_context(0);          //code->get_junction()->change_context(0);
   
         for(int i=0; i<count; i++) {          for(int i=0; i<count; i++) {
                 Value& value=r.process_to_value(params->get(i));                  Value& value=r.process_to_value(params->get(i));
Line 441  static time_t as_expires(Request& r, con Line 442  static time_t as_expires(Request& r, con
                                                 int index, time_t now) {                                                  int index, time_t now) {
         time_t result;          time_t result;
         Value& vlifespan_or_expires=params->get(index);          Value& vlifespan_or_expires=params->get(index);
         if(strcmp(vlifespan_or_expires.type(), VDATE_TYPE)==0)          if(Value *vdate=vlifespan_or_expires.as(VDATE_TYPE, false))
                 result=static_cast<VDate&>(vlifespan_or_expires).get_time();                  result=static_cast<VDate *>(vdate)->get_time();
         else          else
                 result=now+(time_t)params->as_double(index, "lifespan must be date or number", r);                  result=now+(time_t)params->as_double(index, "lifespan must be date or number", r);
                   
Line 580  static void _try_operator(Request& r, co Line 581  static void _try_operator(Request& r, co
         // taking snapshot of request processing status          // taking snapshot of request processing status
         //int ssexception_trace=r.exception_trace.top_index();          //int ssexception_trace=r.exception_trace.top_index();
         int sstack=r.stack.top_index();          int sstack=r.stack.top_index();
         Value *sself=r.self, *sroot=r.root, *srcontext=r.rcontext;            Value *sself=r.self;
           VMethodFrame *smethod_frame=r.method_frame;
           Value *srcontext=r.rcontext;  
         WContext *swcontext=r.wcontext;           WContext *swcontext=r.wcontext; 
         try {          try {
                 result=r.process(body_code);                  result=r.process(body_code);
Line 588  static void _try_operator(Request& r, co Line 591  static void _try_operator(Request& r, co
                 // restoring request processing status                  // restoring request processing status
                 //r.exception_trace.top_index(ssexception_trace);                  //r.exception_trace.top_index(ssexception_trace);
                 r.stack.top_index(sstack);                  r.stack.top_index(sstack);
                 r.self=sself; r.root=sroot, r.rcontext=srcontext; r.wcontext=swcontext;                  r.self=sself; r.method_frame=smethod_frame, r.rcontext=srcontext; r.wcontext=swcontext;
                                   
                                   
                 VHash& vhash=exception2vhash(pool, e);                  VHash& vhash=exception2vhash(pool, e);
   
                 Junction *junction=catch_code.get_junction();                  Junction *junction=catch_code.get_junction();
                 Value *saved_exception_var_value=junction->root->get_element(*exception_var_name);                  Value *method_frame=junction->method_frame;
                 junction->root->put_element(*exception_var_name, &vhash);                  Value *saved_exception_var_value=method_frame->get_element(*exception_var_name, method_frame, false);
                   junction->method_frame->put_element(*exception_var_name, &vhash, false);
                 result=r.process(catch_code);                  result=r.process(catch_code);
                 bool handled=false;                  bool handled=false;
                 if(Value *value=static_cast<Value *>(vhash.hash(0).get(*exception_handled_part_name)))                  if(Value *value=static_cast<Value *>(vhash.hash(0).get(*exception_handled_part_name)))
                         handled=value->as_bool();                                         handled=value->as_bool();               
                 junction->root->put_element(*exception_var_name, saved_exception_var_value);                  junction->method_frame->put_element(*exception_var_name, saved_exception_var_value, false);
   
                 if(!handled)                  if(!handled)
                         throw(e); // rethrow                          throw(e); // rethrow
Line 712  void MOP::configure_user(Request& r) { Line 716  void MOP::configure_user(Request& r) {
         Pool& pool=r.pool();          Pool& pool=r.pool();
   
         // $MAIN:SQL.drivers          // $MAIN:SQL.drivers
         if(Value *sql=r.main_class->get_element(main_sql_name))          if(Value *sql=r.main_class->get_element(main_sql_name, r.main_class, false))
                 if(Value *element=sql->get_element(main_sql_drivers_name))                  if(Value *element=sql->get_element(main_sql_drivers_name, sql, false))
                         if(Table *protocol2library=element->get_table())                          if(Table *protocol2library=element->get_table())
                                 r.classes_conf.put(name(), protocol2library);                                  r.classes_conf.put(name(), protocol2library);
 }  }

Removed from v.1.101  
changed lines
  Added in v.1.106


E-mail: