X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=src%2Fveneer.c;h=ce29ceb566e464cc261c5460417fd202540693c5;hb=8e63120c630c94c598d4e2d6ba823dac59bce8fa;hp=d32ad40c125db1e0460160e8e22cce81e24f235b;hpb=d11f2f726ed7feea617476d99cf7505ddd9a27ce;p=inform.git diff --git a/src/veneer.c b/src/veneer.c index d32ad40..ce29ceb 100644 --- a/src/veneer.c +++ b/src/veneer.c @@ -3,8 +3,8 @@ /* by the compiler (e.g. DefArt) which the program doesn't */ /* provide */ /* */ -/* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2021 */ +/* Part of Inform 6.40 */ +/* copyright (c) Graham Nelson 1993 - 2022 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -17,7 +17,7 @@ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ -/* along with Inform. If not, see https://gnu.org/licenses/ * +/* along with Inform. If not, see https://gnu.org/licenses/ */ /* */ /* ------------------------------------------------------------------------- */ @@ -27,7 +27,7 @@ int veneer_mode; /* Is the code currently being compiled from the veneer? */ static debug_locations null_debug_locations = - { { 0, 0, 0, 0, 0, 0, 0 }, NULL, 0 }; + { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, NULL, 0 }; extern void compile_initial_routine(void) { @@ -36,6 +36,10 @@ extern void compile_initial_routine(void) (since the interpreter begins execution with an empty stack frame): and it must "quit" rather than "return". + (Pedantically, in Z-code 1-5, this is not a routine at all. It's + a sequence of opcodes which ends with "quit". The one-byte + header generated by assemble_routine_header() is a dummy.) + In order not to impose these restrictions on "Main", we compile a trivial routine consisting of a call to "Main" followed by "quit". */ @@ -46,8 +50,8 @@ extern void compile_initial_routine(void) assign_symbol(j, assemble_routine_header(0, FALSE, "Main__", FALSE, j), ROUTINE_T); - sflags[j] |= SYSTEM_SFLAG + USED_SFLAG; - if (trace_fns_setting==3) sflags[j] |= STAR_SFLAG; + symbols[j].flags |= SYSTEM_SFLAG + USED_SFLAG; + if (trace_fns_setting==3) symbols[j].flags |= STAR_SFLAG; if (!glulx_mode) { @@ -2182,28 +2186,42 @@ extern assembly_operand veneer_routine(int code) return(AO); } +extern char *veneer_routine_name(int code) +{ + if (code < 0 || code >= VENEER_ROUTINES) { + return "???"; + } + if (!glulx_mode) { + return VRs_z[code].name; + } + else { + return VRs_g[code].name; + } +} + static void compile_symbol_table_routine(void) { int32 j, nl, arrays_l, routines_l, constants_l; assembly_operand AO, AO2, AO3; /* Assign local var names for the benefit of the debugging information - file. */ - local_variable_texts[0] = "dummy1"; - local_variable_texts[1] = "dummy2"; + file. (We don't set local_variable.keywords because we're not + going to be parsing any code.) */ + strcpy(local_variable_names[0].text, "dummy1"); + strcpy(local_variable_names[1].text, "dummy2"); veneer_mode = TRUE; j = symbol_index("Symb__Tab", -1); assign_symbol(j, assemble_routine_header(2, FALSE, "Symb__Tab", FALSE, j), ROUTINE_T); - sflags[j] |= SYSTEM_SFLAG + USED_SFLAG; - if (trace_fns_setting==3) sflags[j] |= STAR_SFLAG; + symbols[j].flags |= SYSTEM_SFLAG + USED_SFLAG; + if (trace_fns_setting==3) symbols[j].flags |= STAR_SFLAG; if (!glulx_mode) { if (define_INFIX_switch == FALSE) { assemblez_0(rfalse_zc); - variable_usage[1] = TRUE; - variable_usage[2] = TRUE; + variables[1].usage = TRUE; + variables[2].usage = TRUE; assemble_routine_end(FALSE, null_debug_locations); veneer_mode = FALSE; return; @@ -2238,16 +2256,16 @@ static void compile_symbol_table_routine(void) nl = next_label++; sequence_point_follows = FALSE; assemblez_2_branch(je_zc, AO, AO2, nl, FALSE); - AO3.value = array_sizes[j]; + AO3.value = arrays[j].size; AO3.marker = 0; assemblez_store(temp_var2, AO3); - AO3.value = array_types[j]; - if (sflags[array_symbols[j]] & (INSF_SFLAG+SYSTEM_SFLAG)) + AO3.value = arrays[j].type; + if (symbols[arrays[j].symbol].flags & (INSF_SFLAG+SYSTEM_SFLAG)) AO3.value = AO3.value + 16; AO3.marker = 0; assemblez_store(temp_var3, AO3); - AO3.value = svals[array_symbols[j]]; - AO3.marker = (!array_locs[j] ? ARRAY_MV : STATIC_ARRAY_MV); + AO3.value = symbols[arrays[j].symbol].value; + AO3.marker = (!arrays[j].loc ? ARRAY_MV : STATIC_ARRAY_MV); assemblez_1(ret_zc, AO3); assemble_label_no(nl); } @@ -2263,11 +2281,11 @@ static void compile_symbol_table_routine(void) sequence_point_follows = FALSE; assemblez_2_branch(je_zc, AO, AO2, nl, FALSE); AO3.value = 0; - if (sflags[named_routine_symbols[j]] + if (symbols[named_routine_symbols[j]].flags & (INSF_SFLAG+SYSTEM_SFLAG)) AO3.value = 16; AO3.marker = 0; assemblez_store(temp_var3, AO3); - AO3.value = svals[named_routine_symbols[j]]; + AO3.value = symbols[named_routine_symbols[j]].value; AO3.marker = IROUTINE_MV; assemblez_1(ret_zc, AO3); assemble_label_no(nl); @@ -2277,9 +2295,9 @@ static void compile_symbol_table_routine(void) assemble_label_no(constants_l); for (j=0, no_named_constants=0; j