|
|
| version 1.87, 2001/03/10 15:44:31 | version 1.91, 2001/03/11 21:41:04 |
|---|---|
| Line 1 | Line 1 |
| /* | /* |
| $Id$ | Parser |
| Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) | |
| Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) | |
| $Id$ | |
| */ | */ |
| #include "pa_array.h" | #include "pa_array.h" |
| Line 577 Value *Request::get_element() { | Line 581 Value *Request::get_element() { |
| return value; | return value; |
| } | } |
| Value& Request::autocalc(Value& value, const String *name, bool make_string) { | Value& Request::autocalc(Value& value, const String *name, bool intercept_string) { |
| // intercept_string: | |
| // true: | |
| // they want result=string value, | |
| // possible object result goes to wcontext | |
| // false: | |
| // they want any result[string|object] | |
| // nothing goes to wcontext. | |
| // used in (expression) params evaluation | |
| Value *result; | |
| Junction *junction=value.get_junction(); | Junction *junction=value.get_junction(); |
| if(junction && junction->code) { // is it a code-junction? | if(junction && junction->code) { // is it a code-junction? |
| // autocalc it | // autocalc it |
| Line 588 Value& Request::autocalc(Value& value, c | Line 602 Value& Request::autocalc(Value& value, c |
| PUSH(wcontext); | PUSH(wcontext); |
| WContext *frame; | WContext *frame; |
| if(make_string) { | if(intercept_string) { |
| // almost plain wwrapper about junction wcontext, | // almost plain wwrapper about junction wcontext, |
| // BUT intercepts string writes | // BUT intercepts string writes |
| frame=NEW VCodeFrame(pool(), *junction->wcontext); | frame=NEW VCodeFrame(pool(), *junction->wcontext); |
| Line 602 Value& Request::autocalc(Value& value, c | Line 616 Value& Request::autocalc(Value& value, c |
| root=junction->root; | root=junction->root; |
| rcontext=junction->rcontext; | rcontext=junction->rcontext; |
| execute(*junction->code); | execute(*junction->code); |
| Value *result; | if(intercept_string) { |
| if(make_string) { | |
| // CodeFrame soul: | // CodeFrame soul: |
| // string writes were intercepted | // string writes were intercepted |
| // returning them as the result of getting code-junction | // returning them as the result of getting code-junction |
| result=NEW VString(*frame->get_string()); | result=NEW VString(*frame->get_string()); |
| } else | } else |
| result=frame->result(); | result=frame->result(); |
| if(name) | |
| result->set_name(*name); | |
| wcontext=static_cast<WContext *>(POP()); | wcontext=static_cast<WContext *>(POP()); |
| rcontext=POP(); | rcontext=POP(); |
| Line 619 Value& Request::autocalc(Value& value, c | Line 630 Value& Request::autocalc(Value& value, c |
| self=static_cast<VAliased *>(POP()); | self=static_cast<VAliased *>(POP()); |
| fprintf(stderr, "<-ja returned"); | fprintf(stderr, "<-ja returned"); |
| return *result; | |
| } else | } else |
| return value; | result=&value; |
| if(name) | |
| result->set_name(*name); | |
| return *result; | |
| } | } |
| char *Request::execute_static_method(VClass& vclass, String& method_name, bool return_cstr) { | char *Request::execute_static_method(VClass& vclass, String& method_name, bool return_cstr) { |