|
|
| version 1.2, 2001/02/20 19:21:13 | version 1.9, 2001/02/21 11:19:19 |
|---|---|
| Line 2 | Line 2 |
| $Id$ | $Id$ |
| */ | */ |
| #include "pa_array.h" | #include "pa_array.h" |
| #include "code.h" | #include "code.h" |
| #include <stdio.h> | #include <stdio.h> |
| Line 14 char *opcode_name[]={ | Line 14 char *opcode_name[]={ |
| "CONSTRUCT", | "CONSTRUCT", |
| "EXPRESSION_EVAL", "MODIFY_EVAL", | "EXPRESSION_EVAL", "MODIFY_EVAL", |
| "WRITE", | "WRITE", |
| "REPLACE_RESULT", | |
| "GET_ELEMENT", "GET_ELEMENT__WRITE", | "GET_ELEMENT", "GET_ELEMENT__WRITE", |
| "CREATE_EWPOOL", "REDUCE_EWPOOL", | "CREATE_EWPOOL", "REDUCE_EWPOOL", |
| "CREATE_RWPOOL", "REDUCE_RWPOOL", | "CREATE_RWPOOL", "REDUCE_RWPOOL", |
| Line 24 char *opcode_name[]={ | Line 23 char *opcode_name[]={ |
| "CALL" | "CALL" |
| }; | }; |
| void dump(int level, const Array *ops) { | void dump(int level, const Array& ops) { |
| if(!ops) | int size=ops.size(); |
| return; | |
| int size=ops->size(); | |
| for(int i=0; i<size; i++) { | for(int i=0; i<size; i++) { |
| int code=reinterpret_cast<int>(ops->raw_get(i)); | int code=reinterpret_cast<int>(ops.raw_get(i)); |
| printf("%*s%s", level*4, "", opcode_name[code]); | printf("%*s%s", level*4, "", opcode_name[code]); |
| if(code==OP_STRING) { | if(code==OP_STRING) { |
| printf(" \"%s\"", static_cast<const String *>(ops->raw_get(++i))->cstr()); | printf(" \"%s\"", static_cast<const String *>(ops.raw_get(++i))->cstr()); |
| } | } |
| printf("\n"); | printf("\n"); |
| if(code==OP_CODE_ARRAY) { | if(code==OP_CODE_ARRAY) { |
| const Array *local_ops=reinterpret_cast<const Array *>(ops->raw_get(++i)); | const Array *local_ops=reinterpret_cast<const Array *>(ops.raw_get(++i)); |
| dump(level=1, local_ops); | dump(level+1, *local_ops); |
| } | } |
| } | } |
| } | } |
| void execute(Pool *pool, const Array *ops) { | void execute(Pool& pool, const Array& ops) { |
| if(!ops) | |
| return; | |
| puts("---------------------------"); | puts("---------------------------"); |
| dump(0, ops); | dump(0, ops); |
| puts("---------------------------"); | puts("---------------------------"); |