/* by the compiler (e.g. DefArt) which the program doesn't */
/* provide */
/* */
-/* Copyright (c) Graham Nelson 1993 - 2020 */
-/* */
-/* This file is part of Inform. */
+/* Part of Inform 6.41 */
+/* 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 */
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)
{
(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". */
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) {
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;
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);
}
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);
assemble_label_no(constants_l);
for (j=0, no_named_constants=0; j<no_symbols; j++)
- { if (((stypes[j] == OBJECT_T) || (stypes[j] == CLASS_T)
- || (stypes[j] == CONSTANT_T))
- && ((sflags[j] & (UNKNOWN_SFLAG+ACTION_SFLAG))==0))
+ { if (((symbols[j].type == OBJECT_T) || (symbols[j].type == CLASS_T)
+ || (symbols[j].type == CONSTANT_T))
+ && ((symbols[j].flags & (UNKNOWN_SFLAG+ACTION_SFLAG))==0))
{ AO2.value = no_named_constants++;
if (AO2.value<256) AO2.type = SHORT_CONSTANT_OT;
else AO2.type = LONG_CONSTANT_OT;
sequence_point_follows = FALSE;
assemblez_2_branch(je_zc, AO, AO2, nl, FALSE);
AO3.value = 0;
- if (stypes[j] == OBJECT_T) AO3.value = 2;
- if (stypes[j] == CLASS_T) AO3.value = 1;
- if (sflags[j] & (INSF_SFLAG+SYSTEM_SFLAG))
+ if (symbols[j].type == OBJECT_T) AO3.value = 2;
+ if (symbols[j].type == CLASS_T) AO3.value = 1;
+ if (symbols[j].flags & (INSF_SFLAG+SYSTEM_SFLAG))
AO3.value = AO3.value + 16;
AO3.marker = 0;
assemblez_store(temp_var3, AO3);
sequence_point_follows = 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;
}
if (define_INFIX_switch == FALSE)
{ assembleg_1(return_gc, zero_operand);
- 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;
{ int i, j, try_veneer_again;
VeneerRoutine *VRs;
- if (module_switch) return;
-
VRs = (!glulx_mode) ? VRs_z : VRs_g;
/* Called at the end of the pass to insert as much of the veneer as is
for (i=0; i<VENEER_ROUTINES; i++)
{ if (veneer_routine_needs_compilation[i] == VR_CALLED)
{ j = symbol_index(VRs[i].name, -1);
- if (sflags[j] & UNKNOWN_SFLAG)
+ if (symbols[j].flags & UNKNOWN_SFLAG)
{ veneer_mode = TRUE;
strcpy(veneer_source_area, VRs[i].source1);
strcat(veneer_source_area, VRs[i].source2);
VRs[i].name, TRUE, j),
ROUTINE_T);
veneer_mode = FALSE;
- if (trace_fns_setting==3) sflags[j] |= STAR_SFLAG;
+ if (trace_fns_setting==3) symbols[j].flags |= STAR_SFLAG;
}
else
- { if (stypes[j] != ROUTINE_T)
+ { if (symbols[j].type != ROUTINE_T)
error_named("The following name is reserved by Inform for its \
own use as a routine name; you can use it as a routine name yourself (to \
override the standard definition) but cannot use it for anything else:",
VRs[i].name);
else
- sflags[j] |= USED_SFLAG;
+ symbols[j].flags |= USED_SFLAG;
}
- veneer_routine_address[i] = svals[j];
+ veneer_routine_address[i] = symbols[j].value;
veneer_routine_needs_compilation[i] = VR_COMPILED;
try_veneer_again = TRUE;
}