|
|
| version 1.243, 2002/08/01 11:26:49 | version 1.248, 2002/08/12 10:32:52 |
|---|---|
| Line 5 | Line 5 |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| static const char* IDENT_EXECUTE_C="$Id$"; | static const char* IDENT_EXECUTE_C="$Date$"; |
| #include "pa_opcode.h" | #include "pa_opcode.h" |
| #include "pa_array.h" | #include "pa_array.h" |
| Line 504 void Request::execute(const Array& ops) | Line 504 void Request::execute(const Array& ops) |
| rcontext=wcontext=&frame; | rcontext=wcontext=&frame; |
| { | { |
| // take object or class from any wrappers | |
| // and substitute class alias to the class they are called AS | |
| Temp_alias temp_alias(*self->get_aliased(), *frame.junction.vclass); | |
| const Method& method=*frame.junction.method; | const Method& method=*frame.junction.method; |
| Method::Call_type call_type= | Method::Call_type call_type= |
| called_class==self ? Method::CT_STATIC : Method::CT_DYNAMIC; | called_class==self ? Method::CT_STATIC : Method::CT_DYNAMIC; |
| Line 545 void Request::execute(const Array& ops) | Line 541 void Request::execute(const Array& ops) |
| wcontext=static_cast<WContext *>(POP()); | wcontext=static_cast<WContext *>(POP()); |
| rcontext=POP(); | rcontext=POP(); |
| root=POP(); | root=POP(); |
| self=static_cast<VAliased *>(POP()); | self=static_cast<Value *>(POP()); |
| #ifdef DEBUG_STRING_APPENDS_VS_EXPANDS | #ifdef DEBUG_STRING_APPENDS_VS_EXPANDS |
| if(const String *s=value->get_string()) | if(const String *s=value->get_string()) |
| Line 848 void Request::execute(const Array& ops) | Line 844 void Request::execute(const Array& ops) |
| } | } |
| case OP_IS: | case OP_IS: |
| { | { |
| //_asm int 3; | |
| b=POP(); a=POP(); | b=POP(); a=POP(); |
| value=NEW VBool(pool(), b->as_string() == a->type()); | value=NEW VBool(pool(), a->as(b->as_string().cstr())!=0); |
| PUSH(value); | PUSH(value); |
| break; | break; |
| } | } |
| Line 950 StringOrValue Request::process(Value& in | Line 945 StringOrValue Request::process(Value& in |
| wcontext=static_cast<WContext *>(POP()); | wcontext=static_cast<WContext *>(POP()); |
| rcontext=POP(); | rcontext=POP(); |
| root=POP(); | root=POP(); |
| self=static_cast<VAliased *>(POP()); | self=static_cast<Value *>(POP()); |
| #ifdef DEBUG_EXECUTE | #ifdef DEBUG_EXECUTE |
| debug_printf(pool(), "<-ja returned"); | debug_printf(pool(), "<-ja returned"); |
| Line 980 const String& Request::execute_method(VM | Line 975 const String& Request::execute_method(VM |
| wcontext=static_cast<WContext *>(POP()); | wcontext=static_cast<WContext *>(POP()); |
| rcontext=POP(); | rcontext=POP(); |
| root=POP(); | root=POP(); |
| self=static_cast<VAliased *>(POP()); | self=static_cast<Value *>(POP()); |
| // return | // return |
| return result; | return result; |
| Line 1007 void Request::execute_method(Value& asel | Line 1002 void Request::execute_method(Value& asel |
| } | } |
| local_frame.set_self(*self); | local_frame.set_self(*self); |
| root=rcontext=wcontext=&local_frame; | root=rcontext=wcontext=&local_frame; |
| // prevent non-string writes for better error reporting | |
| if(return_string) | |
| wcontext->write(local_frame); | |
| // execute! | // execute! |
| execute(*method.parser_code); | execute(*method.parser_code); |
| // result | // result |
| const String *result=0; | const String *result=0; |
| if(return_string) { | if(return_string) |
| /*if(Value *result_var_value=wcontext->get_element(*result_var_name)) | |
| *return_string=&result_var_value->as_string(); | |
| else | |
| *return_string=&wcontext->as_string();*/ | |
| *return_string=&wcontext->result().as_string(); | *return_string=&wcontext->result().as_string(); |
| } | |
| wcontext=static_cast<WContext *>(POP()); | wcontext=static_cast<WContext *>(POP()); |
| rcontext=POP(); | rcontext=POP(); |
| root=POP(); | root=POP(); |
| self=static_cast<VAliased *>(POP()); | self=static_cast<Value *>(POP()); |
| } | } |
| void Request::execute_nonvirtual_method(VStateless_class& aclass, | void Request::execute_nonvirtual_method(VStateless_class& aclass, |