X-Git-Url: https://jxself.org/git/?p=inform.git;a=blobdiff_plain;f=symbols.c;h=13a5aee313f5d81f98da6fd9c96d1bd4899f13d7;hp=c73259c85d04a54cd19d42bcf894e635655f7b48;hb=102561b82ccf272bcf4943bd3a2c61f74534ed92;hpb=5154191043a9b7227ef0eee1a2b40299fc188655 diff --git a/symbols.c b/symbols.c index c73259c..13a5aee 100644 --- a/symbols.c +++ b/symbols.c @@ -65,7 +65,7 @@ int no_named_constants; /* Copied into story file */ int32 **symbs; int32 *svals; int *smarks; /* Glulx-only */ - int32 *slines; + brief_location *slines; int *sflags; #ifdef VAX char *stypes; /* In VAX C, insanely, "signed char" is illegal */ @@ -244,8 +244,7 @@ extern int symbol_index(char *p, int hashcode) unbound-symbol-causes-asm-error? */ sflags[no_symbols] = UNKNOWN_SFLAG; stypes[no_symbols] = CONSTANT_T; - slines[no_symbols] = ErrorReport.line_number - + FILE_LINE_SCALE_FACTOR*ErrorReport.file_number; + slines[no_symbols] = get_brief_location(&ErrorReport); if (debugfile_switch) { nullify_debug_file_position (&symbol_debug_backpatch_positions[no_symbols]); @@ -330,8 +329,8 @@ static void describe_flags(int flags) extern void describe_symbol(int k) { printf("%4d %-16s %2d:%04d %04x %s ", k, (char *) (symbs[k]), - (int)(slines[k]/FILE_LINE_SCALE_FACTOR), - (int)(slines[k]%FILE_LINE_SCALE_FACTOR), + (int)(slines[k].file_index), + (int)(slines[k].line_number), svals[k], typename(stypes[k])); describe_flags(sflags[k]); } @@ -521,8 +520,7 @@ static void assign_symbol_base(int index, int32 value, int type) if (sflags[index] & UNKNOWN_SFLAG) { sflags[index] &= (~UNKNOWN_SFLAG); if (is_systemfile()) sflags[index] |= INSF_SFLAG; - slines[index] = ErrorReport.line_number - + FILE_LINE_SCALE_FACTOR*ErrorReport.file_number; + slines[index] = get_brief_location(&ErrorReport); } } @@ -599,14 +597,14 @@ static void emit_debug_information_for_predefined_symbol static void create_symbol(char *p, int32 value, int type) { int i = symbol_index(p, -1); - svals[i] = value; stypes[i] = type; slines[i] = 0; + svals[i] = value; stypes[i] = type; slines[i] = blank_brief_location; sflags[i] = USED_SFLAG + SYSTEM_SFLAG; emit_debug_information_for_predefined_symbol(p, i, value, type); } static void create_rsymbol(char *p, int value, int type) { int i = symbol_index(p, -1); - svals[i] = value; stypes[i] = type; slines[i] = 0; + svals[i] = value; stypes[i] = type; slines[i] = blank_brief_location; sflags[i] = USED_SFLAG + SYSTEM_SFLAG + REDEFINABLE_SFLAG; emit_debug_information_for_predefined_symbol(p, i, value, type); } @@ -827,7 +825,7 @@ typedef struct df_reference_struct df_reference_t; struct df_function_struct { char *name; /* borrowed reference, generally to the symbs[] table */ - int32 source_line; /* copied from routine_starts_line */ + brief_location source_line; /* copied from routine_starts_line */ int sysfile; /* does this occur in a system file? */ uint32 address; /* function offset in zcode_area (not the final address) */ uint32 newaddress; /* function offset after stripping */ @@ -898,7 +896,7 @@ uint32 df_total_size_after_stripping; Any symbol referenced from now on will be associated with the function. */ extern void df_note_function_start(char *name, uint32 address, - int embedded_flag, int32 source_line) + int embedded_flag, brief_location source_line) { df_function_t *func; int bucket; @@ -1374,7 +1372,7 @@ extern void symbols_allocate_arrays(void) svals = my_calloc(sizeof(int32), MAX_SYMBOLS, "symbol values"); if (glulx_mode) smarks = my_calloc(sizeof(int), MAX_SYMBOLS, "symbol markers"); - slines = my_calloc(sizeof(int32), MAX_SYMBOLS, "symbol lines"); + slines = my_calloc(sizeof(brief_location), MAX_SYMBOLS, "symbol lines"); stypes = my_calloc(sizeof(char), MAX_SYMBOLS, "symbol types"); sflags = my_calloc(sizeof(int), MAX_SYMBOLS, "symbol flags"); if (debugfile_switch) @@ -1407,7 +1405,7 @@ extern void symbols_allocate_arrays(void) df_functions_sorted = NULL; df_functions_sorted_count = 0; - df_note_function_start("", DF_NOT_IN_FUNCTION, FALSE, -1); + df_note_function_start("", DF_NOT_IN_FUNCTION, FALSE, blank_brief_location); df_note_function_end(DF_NOT_IN_FUNCTION); /* Now df_current_function is df_functions_head. */ }