--- parser3/src/main/execute.C 2003/02/24 17:04:57 1.295.2.19 +++ parser3/src/main/execute.C 2003/03/13 11:46:18 1.295.2.27 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_EXECUTE_C="$Date: 2003/02/24 17:04:57 $"; +static const char* IDENT_EXECUTE_C="$Date: 2003/03/13 11:46:18 $"; #include "pa_opcode.h" #include "pa_array.h" @@ -24,6 +24,7 @@ static const char* IDENT_EXECUTE_C="$Dat #include "pa_wwrapper.h" // #define DEBUG_EXECUTE +#define PA_DEBUG_NO_STACK_TRACE #ifdef DEBUG_EXECUTE char *opcode_name[]={ @@ -116,15 +117,17 @@ void Request::execute(ArrayOperation& op //ArrayOperationPtr b_code; StringPtr name; - Value* ncontext; + ValuePtr ncontext; ArrayOperationPtr local_ops; while(i.has_next()) { - if(interrupted()) + if(get_interrupted()) { + set_interrupted(false); throw Exception("parser.interrupted", Exception::undefined_source, "execution stopped"); + } Operation& op=i.next(); #ifdef DEBUG_EXECUTE @@ -178,7 +181,7 @@ void Request::execute(ArrayOperation& op { if(wcontext==method_frame) throw Exception("parser.runtime", - Exception::undefined_source, + Exception::undefined_source, "$.name outside of $name[...]"); stack.push(ValuePtr(wcontext)); @@ -190,7 +193,7 @@ void Request::execute(ArrayOperation& op { value=stack.pop().value; name=stack.pop().string(pool()); - ncontext=stack.pop().value.get(); + ncontext=stack.pop().value; ncontext->put_element(name, value, false); break; } @@ -201,7 +204,7 @@ void Request::execute(ArrayOperation& op value=stack.pop().value; name=stack.pop().string(pool()); - ncontext=stack.pop().value.get(); + ncontext=stack.pop().value; ncontext->put_element(name, value->as_expr_result(), false); break; } @@ -220,7 +223,7 @@ void Request::execute(ArrayOperation& op local_ops)))); name=stack.pop().string(pool()); - ncontext=stack.pop().value.get(); + ncontext=stack.pop().value; ncontext->put_element(name, value, false); break; } @@ -286,7 +289,7 @@ void Request::execute(ArrayOperation& op local_ops=i.next().ops; WContext *saved_wcontext=wcontext; - uchar saved_lang= flang; + String_UL saved_lang=flang; flang=String::UL_PASS_APPENDED; WWrapper local(ValuePtr(0)/*empty*/, wcontext); local.ref(); wcontext=&local; @@ -454,7 +457,9 @@ void Request::execute(ArrayOperation& op if( method.call_type==Method::CT_ANY || method.call_type==call_type) { // allowed call type? +#ifndef PA_DEBUG_NO_STACK_TRACE try { +#endif method_frame=&frame; if(method.native_code) { // native code? method.check_actual_numbered_params( @@ -465,11 +470,13 @@ void Request::execute(ArrayOperation& op frame.name(), frame.numbered_params()); // execute it } else // parser code, execute it recoursion_checked_execute(frame.name(), *method.parser_code); +#ifndef PA_DEBUG_NO_STACK_TRACE } catch(...) { // record it to stack trace exception_trace.push(frame.name()); rethrow; } +#endif } else throw Exception("parser.runtime", frame.name(), @@ -759,42 +766,42 @@ void Request::execute(ArrayOperation& op case OP_STR_LT: { b=stack.pop().value; a=stack.pop().value; - value=ValuePtr(new VBool(a->as_string(&pool()) < b->as_string(&pool()))); + value=ValuePtr(new VBool(*a->as_string(&pool()) < *b->as_string(&pool()))); stack.push(value); break; } case OP_STR_GT: { b=stack.pop().value; a=stack.pop().value; - value=ValuePtr(new VBool(a->as_string(&pool()) > b->as_string(&pool()))); + value=ValuePtr(new VBool(*a->as_string(&pool()) > *b->as_string(&pool()))); stack.push(value); break; } case OP_STR_LE: { b=stack.pop().value; a=stack.pop().value; - value=ValuePtr(new VBool(a->as_string(&pool()) <= b->as_string(&pool()))); + value=ValuePtr(new VBool(*a->as_string(&pool()) <= *b->as_string(&pool()))); stack.push(value); break; } case OP_STR_GE: { b=stack.pop().value; a=stack.pop().value; - value=ValuePtr(new VBool(a->as_string(&pool()) >= b->as_string(&pool()))); + value=ValuePtr(new VBool(*a->as_string(&pool()) >= *b->as_string(&pool()))); stack.push(value); break; } case OP_STR_EQ: { b=stack.pop().value; a=stack.pop().value; - value=ValuePtr(new VBool(a->as_string(&pool()) == b->as_string(&pool()))); + value=ValuePtr(new VBool(*a->as_string(&pool()) == *b->as_string(&pool()))); stack.push(value); break; } case OP_STR_NE: { b=stack.pop().value; a=stack.pop().value; - value=ValuePtr(new VBool(a->as_string(&pool()) != b->as_string(&pool()))); + value=ValuePtr(new VBool(*a->as_string(&pool()) != *b->as_string(&pool()))); stack.push(value); break; } @@ -834,7 +841,7 @@ ValuePtr Request::get_element(StringPtr& if(VStateless_class *read_class=rcontext->get_class()) if(read_class->derived_from(*called_class)) // current derived from called if(ValuePtr base=get_self()->base()) { // doing DYNAMIC call - Temp_derived temp_derived(*base, VObjectPtr(0)); // temporarily prevent go-back-down virtual calls + Temp_derived temp_derived(*base, 0); // temporarily prevent go-back-down virtual calls value=base->get_element(name, *base, false); // virtual-up lookup starting from parent goto value_ready; } @@ -847,7 +854,8 @@ ValuePtr Request::get_element(StringPtr& if(junction->self->get_class()!=ncontext.get()) throw Exception("parser.runtime", name, - "constructor must be declared in class %s", ncontext->get_class()->name_cstr()); + "constructor must be declared in class '%s'", + ncontext->get_class()->name_cstr()); } value_ready: