--- parser3/src/classes/op.C 2002/09/10 12:02:23 1.106 +++ parser3/src/classes/op.C 2002/10/14 13:53:20 1.112 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_OP_C="$Date: 2002/09/10 12:02:23 $"; +static const char* IDENT_OP_C="$Date: 2002/10/14 13:53:20 $"; #include "classes.h" #include "pa_common.h" @@ -102,7 +102,7 @@ static void _taint(Request& r, const Str static void _process(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); - VStateless_class& self_class=*r.self->get_class(); + VStateless_class& self_class=*r.get_self()->get_class(); const Method *main_method; { // temporary remove language change @@ -203,18 +203,18 @@ static void _for(Request& r, const Strin bool need_delim=false; VInt *vint=new(pool) VInt(pool, 0); - r.method_frame->put_element(var_name, vint, false); + r.get_method_frame()->put_element(var_name, vint, false); for(int i=from; i<=to; i++) { vint->set_int(i); - StringOrValue processed_body=r.process(body_code); - if(delim_maybe_code) { // delimiter set? - const String *string=processed_body.get_string(); - if(need_delim && string && string->size()) // need delim & iteration produced string? + StringOrValue sv_processed=r.process(body_code); + const String *s_processed=sv_processed.get_string(); + if(delim_maybe_code && s_processed && s_processed->size()) { // delimiter set and we have body + if(need_delim) // need delim & iteration produced string? r.write_pass_lang(r.process(*delim_maybe_code)); need_delim=true; } - r.write_pass_lang(processed_body); + r.write_pass_lang(sv_processed); } } @@ -293,7 +293,7 @@ static void _switch(Request& r, const St if(Value *selected_code=data.found ? data.found : data._default) { // setting code context, would execute in ^switch[...]{>>context<<} //selected_code->get_junction()->change_context(cases_code.get_junction()); - r.write_pass_lang(r.process(*selected_code, false /* get all that can be got */ )); + r.write_pass_lang(r.process(*selected_code)); } } @@ -577,23 +577,11 @@ static void _try_operator(Request& r, co Value& catch_code=params->as_junction(1, "catch_code must be code"); StringOrValue result; - - // taking snapshot of request processing status - //int ssexception_trace=r.exception_trace.top_index(); - int sstack=r.stack.top_index(); - Value *sself=r.self; - VMethodFrame *smethod_frame=r.method_frame; - Value *srcontext=r.rcontext; - WContext *swcontext=r.wcontext; try { + Request_context_saver context_saved(r); // taking snapshot of request processing status, restoring it at } result=r.process(body_code); + context_saved.restore(); // manually restoring context } catch(const Exception& e) { - // restoring request processing status - //r.exception_trace.top_index(ssexception_trace); - r.stack.top_index(sstack); - r.self=sself; r.method_frame=smethod_frame, r.rcontext=srcontext; r.wcontext=swcontext; - - VHash& vhash=exception2vhash(pool, e); Junction *junction=catch_code.get_junction();