|
|
| version 1.26, 2001/02/23 11:53:06 | version 1.28, 2001/02/23 14:18:27 |
|---|---|
| Line 8 | Line 8 |
| #include "pa_vstring.h" | #include "pa_vstring.h" |
| #include "pa_vhash.h" | #include "pa_vhash.h" |
| #include "pa_vunknown.h" | #include "pa_vunknown.h" |
| #include "pa_vframe.h" | |
| #include <stdio.h> | #include <stdio.h> |
| #define PUSH(value) stack.push(value) | #define PUSH(value) stack.push(value) |
| #define POP() static_cast<Value *>(stack.pop()) | #define POP() static_cast<Value *>(stack.pop()) |
| #define POP_SR() static_cast<Value *>(stack.pop())->as_string() | |
| char *opcode_name[]={ | char *opcode_name[]={ |
| Line 33 char *opcode_name[]={ | Line 35 char *opcode_name[]={ |
| void dump(int level, const Array& ops) { | void dump(int level, const Array& ops) { |
| if(0){ | if(0){ |
| int size=ops.size(); | int size=ops.size(); |
| printf("size=%d\n", size); | //printf("size=%d\n", size); |
| for(int i=0; i<size; i++) { | for(int i=0; i<size; i++) { |
| Operation op; | Operation op; |
| op.cast=ops.quick_get(i); | op.cast=ops.quick_get(i); |
| Line 42 void dump(int level, const Array& ops) { | Line 44 void dump(int level, const Array& ops) { |
| } | } |
| int size=ops.size(); | int size=ops.size(); |
| printf("size=%d\n", size); | //printf("size=%d\n", size); |
| for(int i=0; i<size; i++) { | for(int i=0; i<size; i++) { |
| Operation op; | Operation op; |
| op.cast=ops.quick_get(i); | op.cast=ops.quick_get(i); |
| Line 69 void Request::execute(Array& ops) { | Line 71 void Request::execute(Array& ops) { |
| } | } |
| int size=ops.size(); | int size=ops.size(); |
| printf("size=%d\n", size); | //printf("size=%d\n", size); |
| for(int i=0; i<size; i++) { | for(int i=0; i<size; i++) { |
| Operation op; | Operation op; |
| op.cast=ops.quick_get(i); | op.cast=ops.quick_get(i); |
| Line 113 void Request::execute(Array& ops) { | Line 115 void Request::execute(Array& ops) { |
| case OP_CONSTRUCT: | case OP_CONSTRUCT: |
| { | { |
| Value *value=POP(); | Value *value=POP(); |
| String& name=POP()->as_string(); | String& name=POP_SR(); |
| Value *ncontext=POP(); | Value *ncontext=POP(); |
| value->set_name(name); | value->set_name(name); |
| ncontext->put_element(name, value); | ncontext->put_element(name, value); |
| Line 174 void Request::execute(Array& ops) { | Line 176 void Request::execute(Array& ops) { |
| break; | break; |
| } | } |
| case OP_GET_METHOD_FRAME: | |
| { | |
| String& name=POP_SR(); // ýòî áûâàåò junction, íå name | |
| Value *ncontext=static_cast<Value *>(stack[0]); | |
| // [self/class?;params;local;code/native_code](name) | |
| Method *method=ncontext->get_method(name); | |
| if(!method) | |
| THROW(0,0, | |
| &name, | |
| "method not found in %s", ncontext->name()->cstr()); | |
| //unless(method) method=operators.get_method[...;code/native_code](name) | |
| VFrame *frame=NEW VFrame(pool(), *method); | |
| PUSH(frame); | |
| break; | |
| } | |
| case OP_STORE_PARAM: | |
| { | |
| Value *value=POP(); | |
| VFrame *frame=static_cast<VFrame *>(stack[0]); | |
| frame->store_param(value); | |
| break; | |
| } | |
| default: | default: |
| printf("\tTODO"); | printf("\tTODO"); |
| break; | break; |
| Line 183 void Request::execute(Array& ops) { | Line 209 void Request::execute(Array& ops) { |
| } | } |
| Value *Request::get_element() { | Value *Request::get_element() { |
| String& name=POP()->as_string(); | String& name=POP_SR(); |
| Value *ncontext=POP(); | Value *ncontext=POP(); |
| Value *value=ncontext->get_element(name); // name áûâàåò method, òîãäà âûäà¸ò new junction(ÀÂÒÎÂÛ×ÈÑËßÒÜ=false, root,self,rcontext,wcontext,code) | Value *value=ncontext->get_element(name); // name áûâàåò method, òîãäà âûäà¸ò new junction(ÀÂÒÎÂÛ×ÈÑËßÒÜ=false, root,self,rcontext,wcontext,code) |
| // name áûâàåò èìÿ junction, òîãäà èëè îñòàâëÿåò â ïîêîå, èëè âû÷èñëÿåò â çàâèñèìîñòè îò ôëàãà ÀÂÒÎÂÛ×ÈÑËßÒÜ | // name áûâàåò èìÿ junction, òîãäà èëè îñòàâëÿåò â ïîêîå, èëè âû÷èñëÿåò â çàâèñèìîñòè îò ôëàãà ÀÂÒÎÂÛ×ÈÑËßÒÜ |