|
|
| version 1.82, 2001/03/10 11:44:42 | version 1.85, 2001/03/10 14:05:36 |
|---|---|
| Line 179 void Request::execute(const Array& ops) | Line 179 void Request::execute(const Array& ops) |
| case OP_WRITE: | case OP_WRITE: |
| { | { |
| Value *value=POP(); | Value *value=POP(); |
| wcontext->write(*value); | write(*value); |
| break; | break; |
| } | } |
| Line 193 void Request::execute(const Array& ops) | Line 193 void Request::execute(const Array& ops) |
| case OP_GET_ELEMENT__WRITE: | case OP_GET_ELEMENT__WRITE: |
| { | { |
| Value *value=get_element(); | Value *value=get_element(); |
| wcontext->write(*value); | write(*value); |
| break; | break; |
| } | } |
| Line 299 void Request::execute(const Array& ops) | Line 299 void Request::execute(const Array& ops) |
| if(wcontext->constructing()) { // constructing? | if(wcontext->constructing()) { // constructing? |
| // yes, constructor call: $some(^class:method(..)) | // yes, constructor call: $some(^class:method(..)) |
| self=NEW VObject(pool(), *called_class); | self=NEW VObject(pool(), *called_class); |
| frame->write(*self); | frame->write(*self, |
| String::Untaint_lang::NO // not used, always an object, not string | |
| ); | |
| } else | } else |
| self=&frame->junction.self; // no, static or simple dynamic call | self=&frame->junction.self; // no, static or simple dynamic call |
| Line 560 Value *Request::get_element() { | Line 562 Value *Request::get_element() { |
| Value *value=ncontext->get_element(name); | Value *value=ncontext->get_element(name); |
| if(value) | if(value) |
| value=&autocalc(*value); // autocalc possible code-junction | value=&autocalc(*value, &name); // autocalc possible code-junction |
| else { | else { |
| value=NEW VUnknown(pool()); | value=NEW VUnknown(pool()); |
| value->set_name(name); | value->set_name(name); |
| Line 569 Value *Request::get_element() { | Line 571 Value *Request::get_element() { |
| return value; | return value; |
| } | } |
| Value& Request::autocalc(Value& value, bool make_string) { | Value& Request::autocalc(Value& value, const String *name, 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 602 Value& Request::autocalc(Value& value, b | Line 604 Value& Request::autocalc(Value& value, b |
| 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 613 Value& Request::autocalc(Value& value, b | Line 617 Value& Request::autocalc(Value& value, b |
| } else | } else |
| return value; | return value; |
| } | } |
| char *Request::execute_static(VClass& vclass, String& method_name, bool return_cstr) { | |
| Value *value=vclass.get_element(method_name); | |
| if(value) { // found some 'METHOD_NAME' element | |
| Junction *junction=value->get_junction(); | |
| if(junction) {// it even has junction! | |
| const Method *method=junction->method; | |
| if(method) { // and junction is method-junction! call it | |
| PUSH(self); | |
| PUSH(root); | |
| PUSH(rcontext); | |
| PUSH(wcontext); | |
| // initialize contexts | |
| root=rcontext=self=&vclass; | |
| wcontext=NEW WWrapper(pool(), &vclass, false /* not constructing */); | |
| // execute! | |
| execute(*method->parser_code); | |
| // result | |
| char *result; | |
| if(return_cstr) | |
| result=wcontext->get_string()->cstr(); // chars | |
| else | |
| result=0; // ignore result | |
| wcontext=static_cast<WContext *>(POP()); | |
| rcontext=POP(); | |
| root=POP(); | |
| self=static_cast<VAliased *>(POP()); | |
| // return | |
| return result; | |
| } | |
| } | |
| } | |
| return 0; | |
| } |