📄 gbx_exec_loop.c
字号:
_NEXT: PC++;/*-----------------------------------------------*/_MAIN: /* if (EXEC_stop_next) { EXEC_stop_next = FALSE; TRACE_next(); } if (EXEC_stop_next_line) { if ((EXEC_stop_function == NULL || FP == EXEC_stop_function) && (PC < EXEC_begin_line || PC >= EXEC_end_line)) { EXEC_stop_next_line = FALSE; TRACE_main(); } } *//*_MAIN_BREAK:*//*#define DEBUG_PCODE 1*/#if DEBUG_PCODE TRACE_where();#if DEBUG_STACK printf("[%d] ", SP - (VALUE *)STACK_base);#endif if (*PC >> 8) PCODE_dump(PC - FP->code, PC);#endif /*{ char *addr; long len; if (SP > (VALUE *)STACK_base) { VALUE_to_string(SP - 1, &addr, &len); printf("SP -> %.*s\n", (int)len, addr); } }*/#if 0 /*printf("RET->type = %ld\n", RET.type);*/ /*printf("EC = %p ", EC);*/ TRACE_where(); printf("[%d] ", SP - (VALUE *)STACK_base); if (*PC >> 8) PCODE_dump(PC - FP->code, PC); /*fflush(stdout); bug */#endif /*TRACE_check_signal();*/ code = *PC; goto *jump_table[code >> 8];/*-----------------------------------------------*/_TODO: printf("** Not yet implemented\n"); goto _NEXT;/*-----------------------------------------------*/_ILLEGAL: THROW(E_ILLEGAL);/*-----------------------------------------------*/_BREAK: if (EXEC_debug && CP && CP->belong == ARCHIVE_main) { TRACE.ec = PC + 1; TRACE.ep = SP; ind = GET_XX(); if (ind == 0) { if (!TRACE.stop) goto _NEXT; if (TRACE.fp != NULL) { if (BP > TRACE.bp) goto _NEXT; /*if (TRACE.fp != FP) goto _NEXT;*/ /*printf("BP = %p bp = %p\n", BP, TRACE.bp);*/ } } TRACE_breakpoint(ind); } goto _NEXT;/*-----------------------------------------------*/_QUIT: if (GET_XX() == 0) EXEC_quit(); if (EXEC_debug) TRACE_breakpoint(0); goto _NEXT;/*-----------------------------------------------*/_SUBR: EXEC_code = code; (*SubrTable[(code >> 8) - 0x28])(); if (PCODE_is_void(EXEC_code)) POP(); goto _NEXT;/*-----------------------------------------------*/_PUSH_LOCAL: *SP = BP[GET_XX()]; PUSH(); goto _NEXT;/*-----------------------------------------------*/_PUSH_ARRAY: EXEC_push_array(); goto _NEXT;/*-----------------------------------------------*/_PUSH_UNKNOWN: EXEC_push_unknown(); goto _NEXT;/*-----------------------------------------------*/_PUSH_SPECIAL: EXEC_push_special(); goto _NEXT;/*-----------------------------------------------*/_PUSH_EVENT: { OBJECT_EVENT *ev; OBJECT *parent; ind = GET_XX(); ev = OBJECT_event(OP); if (CP->parent) ind += CP->parent->n_event; ind = ev->event[ind]; parent = ev->parent; if (parent == NULL || ind == 0) { /* fonction ne faisant rien si ce n'est renvoyer une valeur par d�aut */ SP->_function.object = NULL; SP->_function.class = NULL; SP->_function.kind = FUNCTION_NULL; /*SP->_function.function = (long)(CP->load->event[GET_XX()].type);*/ /* ??? Pourquoi n'utilise-t-on pas desc ? */ } else { ind--; SP->_function.kind = FUNCTION_PUBLIC; /*SP->_function.function = (long)parent->class->table[ind].desc;*/ /*SP->_function.function = (long)((CLASS *)parent)->table[ind].desc;*/ SP->_function.index = ind; SP->_function.defined = FALSE; if (parent->class == CLASS_Class) { SP->_function.object = NULL; SP->_function.class = (CLASS *)parent; } else { SP->_function.object = parent; SP->_function.class = parent->class; } EVENT_Last = OP; } SP->type = T_FUNCTION; OBJECT_REF(SP->_function.object, "exec_loop._PUSH_EVENT (FUNCTION)"); SP++; } goto _NEXT;/*-----------------------------------------------*/_POP_LOCAL: { register VALUE *val = &BP[GET_XX()]; VALUE_conv(&SP[-1], val->type); RELEASE(val); SP--; *val = *SP; } goto _NEXT;/*-----------------------------------------------*/_POP_CTRL: _pop_ctrl(GET_XX()); goto _NEXT;/*-----------------------------------------------*/_POP_ARRAY: EXEC_pop_array(); goto _NEXT;/*-----------------------------------------------*/_POP_UNKNOWN: EXEC_pop_unknown(); goto _NEXT;/*-----------------------------------------------*/_POP_OPTIONAL: /* if (ind >= 0) val = &BP[ind]; else val = &PP[ind]; */ { register VALUE *val = &BP[GET_XX()]; if (val->type == T_VOID) { if (SP[-1].type == T_VOID) VALUE_default(&SP[-1], val->_void.ptype); else VALUE_conv(&SP[-1], val->_void.ptype); /* RELEASE(val); Pas n�essaire */ SP--; *val = *SP; } else POP(); } goto _NEXT;/*-----------------------------------------------*/_PUSH_SHORT: SP->type = T_INTEGER; PC++; SP->_integer.value = *((short *)PC); SP++; goto _NEXT;/*-----------------------------------------------*/_PUSH_INTEGER: SP->type = T_INTEGER; PC++; SP->_integer.value = PC[0] | ((unsigned long)PC[1] << 16); SP++; goto _NEXT2;/*-----------------------------------------------*/_PUSH_CHAR: STRING_char_value(SP, (char)GET_XX()); SP++; goto _NEXT;/*-----------------------------------------------*/_PUSH_ME: if (GET_XX()) { if (TRACE.op) { SP->_object.class = TRACE.cp; SP->_object.object = TRACE.op; } else if (TRACE.cp) { SP->type = T_CLASS; SP->_class.class = TRACE.cp; } else SP->type = T_NULL; } else { if (OP == NULL) { SP->type = T_CLASS; SP->_class.class = CP; } else { SP->_object.class = CP; SP->_object.object = OP; } } PUSH(); goto _NEXT;/*-----------------------------------------------*/_PUSH_NULL: SP->type = T_NULL; SP->_integer.value = 0; SP++; goto _NEXT;/*-----------------------------------------------*/_EVENT: switch(GET_XX()) { case 1: GAMBAS_DoNotRaiseEvent = FALSE; break; case 2: GAMBAS_StopEvent = TRUE; break; default: GAMBAS_DoNotRaiseEvent = TRUE; break; } goto _NEXT;/*-----------------------------------------------*//*_PUSH_RETURN: *SP++ = *RP; goto _NEXT;*//*-----------------------------------------------*/_PUSH_BOOLEAN: SP->type = T_BOOLEAN; SP->_integer.value = (GET_XX() != 0) ? -1 : 0; SP++; goto _NEXT;/*-----------------------------------------------*/_PUSH_LAST: SP->type = T_OBJECT; SP->_object.object = EVENT_Last; PUSH(); goto _NEXT;/*-----------------------------------------------*/_PUSH_VOID: SP->type = T_VOID; SP++; goto _NEXT;/*-----------------------------------------------*/_DUP: *SP = SP[-1]; PUSH(); goto _NEXT;/*-----------------------------------------------*/_DROP: ind = GET_3X(); while (ind > 0) { POP(); ind--; } goto _NEXT;/*-----------------------------------------------*/_NEW: EXEC_new(); goto _NEXT;/*-----------------------------------------------*/_JUMP: PC += (signed short)PC[1] + 2; goto _MAIN;/*-----------------------------------------------*/_JUMP_IF_TRUE: VALUE_conv(&SP[-1], T_BOOLEAN); SP--; if (SP->_boolean.value) { PC += (signed short)PC[1] + 2; goto _MAIN; } goto _NEXT2;/*-----------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -