Annotation of parser3/src/main/execute.C, revision 1.1
1.1 ! paf 1: /*
! 2: $Id: core.C,v 1.20 2001/02/20 12:18:28 paf Exp $
! 3: */
! 4:
! 5: #include "pa_array.h"
! 6: #include "code.h"
! 7:
! 8: #include <stdio.h>
! 9:
! 10: char *opcode_name[]={
! 11: "STRING",
! 12: "CODE_ARRAY",
! 13: "WITH_ROOT", "WITH_SELF", "WITH_READ", "WITH_WRITE",
! 14: "CONSTRUCT",
! 15: "EXPRESSION_EVAL", "MODIFY_EVAL",
! 16: "WRITE",
! 17: "REPLACE_RESULT",
! 18: "GET_ELEMENT", "GET_ELEMENT__WRITE",
! 19: "CREATE_EWPOOL", "REDUCE_EWPOOL",
! 20: "CREATE_RWPOOL", "REDUCE_RWPOOL",
! 21: "GET_METHOD_FRAME",
! 22: "CREATE_JUNCTION",
! 23: "STORE_PARAM",
! 24: "CALL"
! 25: };
! 26:
! 27: void dump(int level, const Array *ops) {
! 28: int size=ops->size();
! 29: for(int i=0; i<size; i++) {
! 30: int code=reinterpret_cast<int>(ops->raw_get(i));
! 31: printf("%*s%s", level*4, "", opcode_name[code]);
! 32:
! 33: if(code==OP_STRING) {
! 34: printf(" \"%s\"", static_cast<const String *>(ops->raw_get(++i))->cstr());
! 35: }
! 36: printf("\n");
! 37:
! 38: if(code==OP_CODE_ARRAY) {
! 39: const Array *local_ops=reinterpret_cast<const Array *>(ops->raw_get(++i));
! 40: dump(level=1, local_ops);
! 41: }
! 42: }
! 43: }
! 44:
! 45: void execute(Pool *pool, const Array *ops) {
! 46: if(!ops)
! 47: return;
! 48:
! 49: dump(0, ops);
! 50: }
E-mail: