/** * "break" statement */ void dobreak(void) { WHILE *ptr; if ((ptr = readwhile ()) == 0) return; gen_modify_stack (ptr->stack_pointer); gen_jump (ptr->while_exit); }
/* * "break" statement */ void dobreak (void ) { INTPTR_T *ptr; if ((ptr = readwhile ()) == 0) return; modstk (ptr[WSSP]); jump (ptr[WSEXIT]); }
WHILE *readswitch () { WHILE *ptr; //int *ptr; if (ptr = readwhile ()) { //if (ptr[WSTYP] == WSSWITCH) if (ptr->type == WSSWITCH) { return (ptr); } } return (0); }
/* * "for" statement */ void dofor (void ) { INTPTR_T ws[7]; INTPTR_T *pws; ws[WSSYM] = (INTPTR_T)locptr; ws[WSSP] = stkp; ws[WSTYP] = WSFOR; ws[WSTEST] = getlabel (); ws[WSINCR] = getlabel (); ws[WSBODY] = getlabel (); ws[WSEXIT] = getlabel (); addwhile (ws); pws = readwhile (); needbrack ("("); if (!match (";")) { expression (YES); ns (); } gnlabel (pws[WSTEST]); if (!match (";")) { expression (YES); testjump (pws[WSBODY], TRUE); jump (pws[WSEXIT]); ns (); } else pws[WSTEST] = pws[WSBODY]; gnlabel (pws[WSINCR]); if (!match (")")) { expression (YES); needbrack (")"); jump (pws[WSTEST]); } else pws[WSINCR] = pws[WSTEST]; gnlabel (pws[WSBODY]); statement (NO); jump (pws[WSINCR]); gnlabel (pws[WSEXIT]); locptr = (char *)pws[WSSYM]; stkp = modstk (pws[WSSP]); delwhile (); }
/** * "for" statement */ void dofor(void) { WHILE ws; WHILE *pws; ws.symbol_idx = local_table_index; ws.stack_pointer = stkp; ws.type = WSFOR; ws.case_test = getlabel (); ws.incr_def = getlabel (); ws.body_tab = getlabel (); ws.while_exit = getlabel (); addwhile (&ws); pws = readwhile (); needbrack ("("); if (!match (";")) { expression (YES); need_semicolon (); } generate_label (pws->case_test); if (!match (";")) { expression (YES); gen_test_jump (pws->body_tab, TRUE); gen_jump (pws->while_exit); need_semicolon (); } else pws->case_test = pws->body_tab; generate_label (pws->incr_def); if (!match (")")) { expression (YES); needbrack (")"); gen_jump (pws->case_test); } else pws->incr_def = pws->case_test; generate_label (pws->body_tab); statement (NO); gen_jump (pws->incr_def); generate_label (pws->while_exit); local_table_index = pws->symbol_idx; stkp = gen_modify_stack (pws->stack_pointer); delwhile (); }
delwhile () { if (readwhile ()) { //wsptr = wsptr - WSSIZ; while_table_index--; } }