--- parser3/src/main/execute.C 2003/01/31 14:03:54 1.295.2.5 +++ parser3/src/main/execute.C 2003/04/07 12:39:32 1.296 @@ -1,11 +1,11 @@ /** @file Parser: executor part of request class. - Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_EXECUTE_C="$Date: 2003/01/31 14:03:54 $"; +static const char* IDENT_EXECUTE_C="$Date: 2003/04/07 12:39:32 $"; #include "pa_opcode.h" #include "pa_array.h" @@ -62,13 +62,13 @@ char *opcode_name[]={ "IS" }; -void va_debug_printf(Pool& pool, const char* fmt,va_list args) { +void va_debug_printf(Pool& pool, const char *fmt,va_list args) { char buf[MAX_STRING]; vsnprintf(buf, MAX_STRING, fmt, args); SAPI::log(pool, "%s", buf); } -void debug_printf(Pool& pool, const char* fmt, ...) { +void debug_printf(Pool& pool, const char *fmt, ...) { va_list args; va_start(args,fmt); va_debug_printf(pool,fmt,args); @@ -112,8 +112,6 @@ void debug_dump(Pool& pool, int level, c #define POP_NAME() static_cast(stack.pop())->as_string() #define POP_CODE() static_cast(stack.pop()) -// Request - void Request::execute(const Array& ops) { // _asm int 3; #ifdef DEBUG_EXECUTE @@ -127,7 +125,7 @@ void Request::execute(const Array& ops) while(i.has_next()) { if(interrupted()) throw Exception("parser.interrupted", - Exception::undefined_source, + 0, "execution stopped"); Operation op; @@ -434,7 +432,7 @@ void Request::execute(const Array& ops) if(frame.junction.method->call_type!=Method::CT_STATIC) { // this is a constructor call - if(ValuePtr value=called_class->create_new_value()) { + if(Value *value=called_class->create_new_value(pool())) { // some stateless_class creatable derivates new_self=value; } else @@ -480,7 +478,7 @@ void Request::execute(const Array& ops) } catch(...) { // record it to stack trace exception_trace.push((void *)&frame.name()); - rethrow; + /*re*/throw; } } else throw Exception("parser.runtime", @@ -545,7 +543,7 @@ void Request::execute(const Array& ops) { /// @test String::cmp Value *operand=POP(); - const char* path=operand->as_string().cstr(); + const char *path=operand->as_string().cstr(); value=NEW VBool(pool(), info.uri && strncmp(path, info.uri, strlen(path))==0); PUSH(value); @@ -728,48 +726,54 @@ void Request::execute(const Array& ops) case OP_NUM_LT: { b=POP(); a=POP(); - double result=a->as_double() - b->as_double(); - value=NEW VBool(pool(), result < 0.0); + volatile double a_double=a->as_double(); + volatile double b_double=b->as_double(); + value=NEW VBool(pool(), a_doubleas_double() - b->as_double(); - value=NEW VBool(pool(), result > 0.0); + volatile double a_double=a->as_double(); + volatile double b_double=b->as_double(); + value=NEW VBool(pool(), a_double>b_double); PUSH(value); break; } case OP_NUM_LE: { b=POP(); a=POP(); - double result=a->as_double() - b->as_double(); - value=NEW VBool(pool(), result <= 0.0); + volatile double a_double=a->as_double(); + volatile double b_double=b->as_double(); + value=NEW VBool(pool(), a_double<=b_double); PUSH(value); break; } case OP_NUM_GE: { b=POP(); a=POP(); - double result=a->as_double() - b->as_double(); - value=NEW VBool(pool(), result >= 0.0); + volatile double a_double=a->as_double(); + volatile double b_double=b->as_double(); + value=NEW VBool(pool(), a_double>=b_double); PUSH(value); break; } case OP_NUM_EQ: { b=POP(); a=POP(); - double result=a->as_double() - b->as_double(); - value=NEW VBool(pool(), result == 0.0); + volatile double a_double=a->as_double(); + volatile double b_double=b->as_double(); + value=NEW VBool(pool(), a_double==b_double); PUSH(value); break; } case OP_NUM_NE: { b=POP(); a=POP(); - double result=a->as_double() - b->as_double(); - value=NEW VBool(pool(), result != 0.0); + volatile double a_double=a->as_double(); + volatile double b_double=b->as_double(); + value=NEW VBool(pool(), a_double!=b_double); PUSH(value); break; } @@ -1007,7 +1011,7 @@ void Request::execute_method(Value& asel } void Request::execute_nonvirtual_method(VStateless_class& aclass, - StringPtr method_name, VStringPtr optional_param, + const String& method_name, VString *optional_param, const String **return_string, const Method **return_method) { @@ -1021,8 +1025,8 @@ void Request::execute_nonvirtual_method( execute_method(aclass, *method, optional_param, return_string); } -StringPtr Request::execute_virtual_method(Value& aself, - StringPtr method_name) { +const String *Request::execute_virtual_method(Value& aself, + const String& method_name) { if(Value *value=aself.get_element(method_name, aself, false)) if(Junction *junction=value->get_junction()) if(const Method *method=junction->method) {