|
|
| version 1.70, 2001/03/08 13:13:41 | version 1.71, 2001/03/08 13:42:32 |
|---|---|
| Line 544 Value *Request::get_element() { | Line 544 Value *Request::get_element() { |
| Value *value=ncontext->get_element(name); | Value *value=ncontext->get_element(name); |
| // autocalc possible code-junction | // autocalc possible code-junction |
| value=value?&autocalc(*value):NEW VUnknown(pool()); | value=value?&autocalc(*value, true/*make_string*/):NEW VUnknown(pool()); |
| value->set_name(name); | value->set_name(name); |
| return value; | return value; |
| } | } |
| Value& Request::autocalc(Value& value) { | Value& Request::autocalc(Value& value, bool make_string) { |
| 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 560 Value& Request::autocalc(Value& value) { | Line 560 Value& Request::autocalc(Value& value) { |
| PUSH(rcontext); | PUSH(rcontext); |
| PUSH(wcontext); | PUSH(wcontext); |
| // almost plain wwrapper about junction wcontext, | WContext *frame; |
| // BUT intercepts string writes | if(make_string) { |
| VCodeFrame frame(pool(), *junction->wcontext); wcontext=&frame; | // almost plain wwrapper about junction wcontext, |
| // BUT intercepts string writes | |
| frame=NEW VCodeFrame(pool(), *junction->wcontext); | |
| } else { | |
| // plain wwrapper | |
| frame=NEW WWrapper(pool(), 0 /* empty */, false /*not constructing*/); | |
| } | |
| wcontext=frame; | |
| self=&junction->self; | self=&junction->self; |
| root=junction->root; | root=junction->root; |
| rcontext=junction->rcontext; | rcontext=junction->rcontext; |
| execute(*junction->code); | execute(*junction->code); |
| // CodeFrame soul: | Value *result; |
| // string writes were intercepted | if(make_string) { |
| // returning them as the result of getting code-junction | // CodeFrame soul: |
| Value& result=*NEW VString(*frame.get_string()); | // string writes were intercepted |
| // returning them as the result of getting code-junction | |
| result=NEW VString(*frame->get_string()); | |
| } else | |
| result=frame->result(); | |
| wcontext=static_cast<WContext *>(POP()); | wcontext=static_cast<WContext *>(POP()); |
| rcontext=POP(); | rcontext=POP(); |
| Line 578 Value& Request::autocalc(Value& value) { | Line 590 Value& Request::autocalc(Value& value) { |
| self=static_cast<VAliased *>(POP()); | self=static_cast<VAliased *>(POP()); |
| fprintf(stderr, "<-ja returned"); | fprintf(stderr, "<-ja returned"); |
| return result; | return *result; |
| } else | } else |
| return value; | return value; |
| } | } |