--- parser3/src/main/execute.C 2003/04/02 16:05:20 1.295.2.27.2.15 +++ parser3/src/main/execute.C 2003/04/03 09:30:13 1.295.2.27.2.18 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_EXECUTE_C="$Date: 2003/04/02 16:05:20 $"; +static const char* IDENT_EXECUTE_C="$Date: 2003/04/03 09:30:13 $"; #include "pa_opcode.h" #include "pa_array.h" @@ -24,7 +24,6 @@ static const char* IDENT_EXECUTE_C="$Dat #include "pa_wwrapper.h" //#define DEBUG_EXECUTE -#define LATER_STACK_TRACE #ifdef DEBUG_EXECUTE char *opcode_name[]={ @@ -71,20 +70,20 @@ void debug_printf(SAPI_Info& sapi_info, void debug_dump(SAPI_Info& sapi_info, int level, ArrayOperation& ops) { Array_iterator i(ops); while(i.has_next()) { - OPCODE opinfo.code()=i.next().code(); + OPCODE opcode=i.next().code(); - if(opinfo.code()==OP_VALUE || opinfo.code()==OP_STRING__WRITE) { + if(opcode==OP_VALUE || opcode==OP_STRING__WRITE) { Value& value=*i.next().value; debug_printf(sapi_info, "%*s%s" " \"%s\" %s", - level*4, "", opcode_name[opinfo.code()], + level*4, "", opcode_name[opcode], value.get_string()->cstr(), value.type()); continue; } - debug_printf(sapi_info, "%*s%s", level*4, "", opcode_name[opinfo.code()]); + debug_printf(sapi_info, "%*s%s", level*4, "", opcode_name[opcode]); - switch(opinfo.code()) { + switch(opcode) { case OP_CURLY_CODE__STORE_PARAM: case OP_EXPR_CODE__STORE_PARAM: case OP_CURLY_CODE__CONSTRUCT: @@ -105,7 +104,7 @@ void debug_dump(SAPI_Info& sapi_info, in void Request::execute(ArrayOperation& ops) { register Stack& stack=this->stack; // helps a lot on MSVC: 'esi' - const String* debug_name=0; Operation::Info debug_info; + const String* debug_name=0; Operation::Info debug_info; //bool is_debug_junction=false; try{ #ifdef DEBUG_EXECUTE debug_printf(sapi_info, "source----------------------------\n"); @@ -376,6 +375,7 @@ void Request::execute(ArrayOperation& op case OP_CALL: case OP_CALL__WRITE: { + //is_debug_junction=true; ArrayOperation* local_ops=i.next().ops; #ifdef DEBUG_EXECUTE debug_printf(sapi_info, " (%d)\n", local_ops?local_ops->count():0); @@ -387,11 +387,17 @@ void Request::execute(ArrayOperation& op Value& value=stack.pop().value(); Junction* junction=value.get_junction(); - if(!junction) - throw Exception("parser.runtime", - 0, - "(%s) not a method or junction, can not call it", - value.type()); + if(!junction) { + if(value.is("void")) + throw Exception("parser.runtime", + 0, + "undefined method"); + else + throw Exception("parser.runtime", + 0, + "is '%s', not a method or junction, can not call it", + value.type()); + } /* no check needed, code compiled the way that that's impossible // check: // that this is method-junction, not a code-junction @@ -401,7 +407,7 @@ void Request::execute(ArrayOperation& op if(!junction->method) throw Exception("parser.runtime", - "(%s) is code junction, can not call it", + "is '%s', it is code junction, can not call it", value.type()); */ @@ -487,6 +493,7 @@ void Request::execute(ArrayOperation& op #ifdef DEBUG_EXECUTE debug_printf(sapi_info, "<-returned"); #endif + //is_debug_junction=false; break; } @@ -800,12 +807,13 @@ void Request::execute(ArrayOperation& op default: throw Exception(0, 0, - "invalid opinfo.code() 0x%X", opinfo.code()); + "invalid opcode %d", opinfo.code()); } } } catch(...) { // record it to stack trace - exception_trace.push(Trace(debug_name, debug_info)); + //if(is_debug_junction) + exception_trace.push(Trace(debug_name, debug_info)); rethrow; } }