From: Jason Self Date: Sun, 4 Apr 2021 17:16:54 +0000 (-0700) Subject: Update to commit af5309356bfa197d7a7ea09101c317f94e9b856b X-Git-Tag: v6.35~2 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=c881aa3386c00d7021ffabf2f66275d6c110c1c1;p=inform.git Update to commit af5309356bfa197d7a7ea09101c317f94e9b856b Dated March 31 2021. These changes are similiarly relicensed to GPL per Section 4(c)(ii) of the Artistic License 2.0. --- diff --git a/src/arrays.c b/src/arrays.c index c1f410c..4c8f56f 100644 --- a/src/arrays.c +++ b/src/arrays.c @@ -4,7 +4,7 @@ /* simpler form of the same thing. */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -292,6 +292,9 @@ extern void make_global(int array_flag, int name_only) int array_type, data_type; int is_static = FALSE; assembly_operand AO; + + int extraspace; + int orig_area_size; int32 global_symbol; const char *global_name; @@ -525,13 +528,11 @@ extern void make_global(int array_flag, int name_only) /* Leave room to write the array size in later, if string/table array */ - int extraspace = 0; + extraspace = 0; if ((array_type==STRING_ARRAY) || (array_type==TABLE_ARRAY)) extraspace += array_entry_size; if (array_type==BUFFER_ARRAY) extraspace += WORDSIZE; - - int orig_area_size; if (!is_static) { orig_area_size = dynamic_array_area_size; @@ -693,12 +694,14 @@ advance as part of 'Zcharacter table':", unicode); finish_array(i, is_static); if (debugfile_switch) - { debug_file_printf(""); + { + int32 new_area_size; + debug_file_printf(""); debug_file_printf("%s", global_name); debug_file_printf(""); write_debug_array_backpatch(svals[global_symbol]); debug_file_printf(""); - int32 new_area_size = (!is_static ? dynamic_array_area_size : static_array_area_size); + new_area_size = (!is_static ? dynamic_array_area_size : static_array_area_size); debug_file_printf ("%d", new_area_size - array_base); diff --git a/src/asm.c b/src/asm.c index e8a20fe..faace9c 100644 --- a/src/asm.c +++ b/src/asm.c @@ -2,7 +2,7 @@ /* "asm" : The Inform assembler */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ diff --git a/src/bpatch.c b/src/bpatch.c index 4e6aa4b..b3a467e 100644 --- a/src/bpatch.c +++ b/src/bpatch.c @@ -3,7 +3,7 @@ /* correcting symbol values not known at compilation time */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ diff --git a/src/chars.c b/src/chars.c index 9bd257a..239d576 100644 --- a/src/chars.c +++ b/src/chars.c @@ -2,7 +2,7 @@ /* "chars" : Character set mappings and the Z-machine alphabet table */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ diff --git a/src/directs.c b/src/directs.c index fc725a0..5df6b0b 100644 --- a/src/directs.c +++ b/src/directs.c @@ -2,7 +2,7 @@ /* "directs" : Directives (# commands) */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -106,9 +106,8 @@ extern int parse_given_directive(int internal_flag) if ((token_type == SEP_TT) && (token_value == SEMICOLON_SEP)) return FALSE; - /* Z-code has a 64-abbrev limit; Glulx doesn't. */ - if (!glulx_mode && no_abbreviations==64) - { error("All 64 abbreviations already declared"); + if (!glulx_mode && no_abbreviations==96) + { error("All 96 Z-machine abbreviations already declared"); panic_mode_error_recovery(); return FALSE; } if (no_abbreviations==MAX_ABBREVS) @@ -608,6 +607,10 @@ Fake_Action directives to a point after the inclusion of \"Parser\".)"); { error("'LowString' cannot be used in -M (Module) mode"); panic_mode_error_recovery(); return FALSE; } + if (glulx_mode) { + error("The LowString directive has no meaning in Glulx."); + panic_mode_error_recovery(); return FALSE; + } get_next_token(); i = token_value; if (token_type != SYMBOL_TT) return ebf_error_recover("new low string name", token_text); diff --git a/src/errors.c b/src/errors.c index c1e6241..08dd87e 100644 --- a/src/errors.c +++ b/src/errors.c @@ -3,7 +3,7 @@ /* (with error throwback code for RISC OS machines) */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -93,6 +93,10 @@ static void print_preamble(void) static char *location_text(brief_location report_line) { + int j; + char *p; + int len; + /* Convert the location to a brief string. (Some error messages need to report a secondary location.) This uses the static buffer other_pos_buff. */ @@ -104,9 +108,6 @@ static char *location_text(brief_location report_line) errpos.main_flag = 0; errpos.orig_source = NULL; export_brief_location(report_line, &errpos); - - int j; - char *p; j = errpos.file_number; if (j <= 0 || j > total_files) p = errpos.source; @@ -114,7 +115,7 @@ static char *location_text(brief_location report_line) if (!p) p = ""; - int len = 0; + len = 0; if (!(errpos.main_flag)) { snprintf(other_pos_buff+len, ERROR_BUFLEN-len, diff --git a/src/expressc.c b/src/expressc.c index 3b5fe6a..378582e 100644 --- a/src/expressc.c +++ b/src/expressc.c @@ -2,7 +2,7 @@ /* "expressc" : The expression code generator */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ diff --git a/src/expressp.c b/src/expressp.c index ce063c2..c5577db 100644 --- a/src/expressp.c +++ b/src/expressp.c @@ -2,7 +2,7 @@ /* "expressp" : The expression parser */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ diff --git a/src/files.c b/src/files.c index c465139..70cfc90 100644 --- a/src/files.c +++ b/src/files.c @@ -8,7 +8,7 @@ /* settings and are very host OS-dependent. */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -195,6 +195,7 @@ extern void close_all_source(void) extern int register_orig_sourcefile(char *filename) { int ix; + char *name; /* If the filename has already been used as an origsource filename, return that entry. We check the most-recently-used file first, and @@ -216,7 +217,7 @@ extern int register_orig_sourcefile(char *filename) /* This filename has never been used before. Allocate a new InputFiles entry. */ - char *name = filename; /* no translation */ + name = filename; /* no translation */ if (total_files == MAX_SOURCE_FILES) memoryerror("MAX_SOURCE_FILES", MAX_SOURCE_FILES); diff --git a/src/header.h b/src/header.h index 652a0c8..82d0644 100644 --- a/src/header.h +++ b/src/header.h @@ -4,7 +4,7 @@ /* Inform 6.35 */ /* */ /* This header file and the others making up the Inform source code are */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* This file is part of Inform. */ /* */ @@ -2538,7 +2538,7 @@ extern int MAX_QTEXT_SIZE, MAX_SYMBOLS, HASH_TAB_SIZE, MAX_DICT_ENTRIES, MAX_EXPRESSION_NODES, MAX_LABELS, MAX_LINESPACE, MAX_LOW_STRINGS, MAX_CLASSES, MAX_VERBS, MAX_VERBSPACE, MAX_ARRAYS, MAX_INCLUSION_DEPTH, - MAX_SOURCE_FILES; + MAX_SOURCE_FILES, MAX_DYNAMIC_STRINGS; extern int32 MAX_STATIC_STRINGS, MAX_ZCODE_SIZE, MAX_LINK_DATA_SIZE, MAX_TRANSCRIPT_SIZE, MAX_INDIV_PROP_TABLE_SIZE, @@ -2745,8 +2745,6 @@ extern int32 static_strings_extent; extern int32 no_strings, no_dynamic_strings; extern int no_unicode_chars; -#define MAX_DYNAMIC_STRINGS (64) - typedef struct unicode_usage_s unicode_usage_t; struct unicode_usage_s { int32 ch; diff --git a/src/inform.c b/src/inform.c index 93bfcc7..9b30ad3 100644 --- a/src/inform.c +++ b/src/inform.c @@ -3,7 +3,7 @@ /* conventions, ICL (Inform Command Line) files, main */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -219,6 +219,34 @@ static void select_target(int targ) DICT_ENTRY_FLAG_POS = (4+DICT_WORD_BYTES); } } + + if (!targ) { + /* Z-machine */ + /* The Z-machine's 96 abbreviations are used for these two purposes. + Make sure they are set consistently. If exactly one has been + set non-default, set the other to match. */ + if (MAX_DYNAMIC_STRINGS == 32 && MAX_ABBREVS != 64) { + MAX_DYNAMIC_STRINGS = 96 - MAX_ABBREVS; + } + if (MAX_ABBREVS == 64 && MAX_DYNAMIC_STRINGS != 32) { + MAX_ABBREVS = 96 - MAX_DYNAMIC_STRINGS; + } + if (MAX_ABBREVS + MAX_DYNAMIC_STRINGS != 96 + || MAX_ABBREVS < 0 + || MAX_DYNAMIC_STRINGS < 0) { + warning("MAX_ABBREVS plus MAX_DYNAMIC_STRINGS must be 96 in Z-code; resetting both"); + MAX_DYNAMIC_STRINGS = 32; + MAX_ABBREVS = 64; + } + } + else { + if (MAX_DYNAMIC_STRINGS > 100) { + MAX_DYNAMIC_STRINGS = 100; + warning("MAX_DYNAMIC_STRINGS cannot exceed 100; resetting to 100"); + /* This is because they are specified in text literals like "@00", + with two digits. */ + } + } } /* ------------------------------------------------------------------------- */ @@ -1238,7 +1266,7 @@ static void cli_print_help(int help_level) printf( "\nThis program is a compiler of Infocom format (also called \"Z-machine\")\n\ story files, as well as \"Glulx\" story files:\n\ -Copyright (c) Graham Nelson 1993 - 2020.\n\n"); +Copyright (c) Graham Nelson 1993 - 2021.\n\n"); /* For people typing just "inform", a summary only: */ @@ -1917,8 +1945,9 @@ static void read_command_line(int argc, char **argv) for (i=1, cli_files_specified=0; iorig_file = 0; @@ -963,7 +965,7 @@ extern void set_origsource_location(char *source, int32 line, int32 charnum) } /* Get the file number for a new or existing InputFiles entry. */ - int file_no = register_orig_sourcefile(source); + file_no = register_orig_sourcefile(source); CurrentLB->orig_file = file_no; CurrentLB->orig_source = InputFiles[file_no-1].filename; diff --git a/src/linker.c b/src/linker.c index ab9dabe..d05310a 100644 --- a/src/linker.c +++ b/src/linker.c @@ -2,7 +2,7 @@ /* "linker" : For compiling and linking modules */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ diff --git a/src/memory.c b/src/memory.c index 9b4a669..6b81727 100644 --- a/src/memory.c +++ b/src/memory.c @@ -3,7 +3,7 @@ /* (For "memoryerror", see "errors.c") */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -255,6 +255,7 @@ int MAX_DICT_ENTRIES; int MAX_STATIC_DATA; int MAX_PROP_TABLE_SIZE; int MAX_ABBREVS; +int MAX_DYNAMIC_STRINGS; int MAX_EXPRESSION_NODES; int MAX_VERBS; int MAX_VERBSPACE; @@ -299,6 +300,7 @@ static int MAX_LOCAL_VARIABLES_z, MAX_LOCAL_VARIABLES_g; static int DICT_WORD_SIZE_z, DICT_WORD_SIZE_g; static int NUM_ATTR_BYTES_z, NUM_ATTR_BYTES_g; static int ALLOC_CHUNK_SIZE_z, ALLOC_CHUNK_SIZE_g; +static int MAX_DYNAMIC_STRINGS_z, MAX_DYNAMIC_STRINGS_g; /* ------------------------------------------------------------------------- */ /* Memory control from the command line */ @@ -319,6 +321,7 @@ static void list_memory_sizes(void) printf("| %25s = %-7d |\n","DICT_WORD_SIZE",DICT_WORD_SIZE); if (glulx_mode) printf("| %25s = %-7d |\n","DICT_CHAR_SIZE",DICT_CHAR_SIZE); + printf("| %25s = %-7d |\n","MAX_DYNAMIC_STRINGS",MAX_DYNAMIC_STRINGS); printf("| %25s = %-7d |\n","MAX_EXPRESSION_NODES",MAX_EXPRESSION_NODES); printf("| %25s = %-7d |\n","MAX_GLOBAL_VARIABLES",MAX_GLOBAL_VARIABLES); printf("| %25s = %-7d |\n","HASH_TAB_SIZE",HASH_TAB_SIZE); @@ -396,8 +399,6 @@ extern void set_memory_sizes(int size_flag) MAX_PROP_TABLE_SIZE_z = 30000; MAX_PROP_TABLE_SIZE_g = 60000; - MAX_ABBREVS = 64; - MAX_EXPRESSION_NODES = 100; MAX_VERBS = 200; MAX_VERBSPACE = 4096; @@ -446,8 +447,6 @@ extern void set_memory_sizes(int size_flag) MAX_PROP_TABLE_SIZE_z = 15000; MAX_PROP_TABLE_SIZE_g = 30000; - MAX_ABBREVS = 64; - MAX_EXPRESSION_NODES = 100; MAX_VERBS = 140; MAX_VERBSPACE = 4096; @@ -496,8 +495,6 @@ extern void set_memory_sizes(int size_flag) MAX_PROP_TABLE_SIZE_z = 8000; MAX_PROP_TABLE_SIZE_g = 16000; - MAX_ABBREVS = 64; - MAX_EXPRESSION_NODES = 40; MAX_VERBS = 110; MAX_VERBSPACE = 2048; @@ -539,6 +536,9 @@ extern void set_memory_sizes(int size_flag) DICT_WORD_SIZE_g = 9; NUM_ATTR_BYTES_z = 6; NUM_ATTR_BYTES_g = 7; + MAX_ABBREVS = 64; + MAX_DYNAMIC_STRINGS_z = 32; + MAX_DYNAMIC_STRINGS_g = 64; /* Backwards-compatible behavior: allow for a unicode table whether we need one or not. The user can set this to zero if there's no unicode table. */ @@ -569,6 +569,7 @@ extern void adjust_memory_sizes() DICT_WORD_SIZE = DICT_WORD_SIZE_z; NUM_ATTR_BYTES = NUM_ATTR_BYTES_z; ALLOC_CHUNK_SIZE = ALLOC_CHUNK_SIZE_z; + MAX_DYNAMIC_STRINGS = MAX_DYNAMIC_STRINGS_z; INDIV_PROP_START = 64; } else { @@ -579,6 +580,7 @@ extern void adjust_memory_sizes() DICT_WORD_SIZE = DICT_WORD_SIZE_g; NUM_ATTR_BYTES = NUM_ATTR_BYTES_g; ALLOC_CHUNK_SIZE = ALLOC_CHUNK_SIZE_g; + MAX_DYNAMIC_STRINGS = MAX_DYNAMIC_STRINGS_g; INDIV_PROP_START = 256; } } @@ -696,7 +698,13 @@ static void explain_parameter(char *command) if (strcmp(command,"MAX_ABBREVS")==0) { printf( " MAX_ABBREVS is the maximum number of declared abbreviations. It is not \n\ - allowed to exceed 64.\n"); + allowed to exceed 96 in Z-code.\n"); + return; + } + if (strcmp(command,"MAX_DYNAMIC_STRINGS")==0) + { printf( +" MAX_DYNAMIC_STRINGS is the maximum number of string substitution variables\n\ + (\"@00\"). It is not allowed to exceed 96 in Z-code or 100 in Glulx.\n"); return; } if (strcmp(command,"MAX_ARRAYS")==0) @@ -1033,6 +1041,10 @@ extern void memory_command(char *command) flag=2; if (strcmp(command,"MAX_ABBREVS")==0) MAX_ABBREVS=j, flag=1; + if (strcmp(command,"MAX_DYNAMIC_STRINGS")==0) + { MAX_DYNAMIC_STRINGS=j, flag=1; + MAX_DYNAMIC_STRINGS_g=MAX_DYNAMIC_STRINGS_z=j; + } if (strcmp(command,"MAX_ARRAYS")==0) MAX_ARRAYS=j, flag=1; if (strcmp(command,"MAX_EXPRESSION_NODES")==0) diff --git a/src/objects.c b/src/objects.c index 9d54ec2..242ec3c 100644 --- a/src/objects.c +++ b/src/objects.c @@ -7,7 +7,7 @@ /* specifications for the object-maker. */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -1433,7 +1433,8 @@ the names '%s' and '%s' actually refer to the same property", if (token_type == SEGMENT_MARKER_TT) { put_token_back(); break; } if ((!individual_property) && (property_number==1) - && (token_type != SQ_TT) && (token_type != DQ_TT) + && ((token_type != SQ_TT) || (strlen(token_text) <2 )) + && (token_type != DQ_TT) ) warning ("'name' property should only contain dictionary words"); diff --git a/src/states.c b/src/states.c index 8feb6a7..3f0e874 100644 --- a/src/states.c +++ b/src/states.c @@ -2,7 +2,7 @@ /* "states" : Statement translator */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -1191,6 +1191,14 @@ static void parse_statement_z(int break_label, int continue_label) statements.enabled = TRUE; get_next_token(); + + /* An #if directive around the ELSE clause is legal. */ + while ((token_type == SEP_TT) && (token_value == HASH_SEP)) + { parse_directive(TRUE); + statements.enabled = TRUE; + get_next_token(); + } + if ((token_type == STATEMENT_TT) && (token_value == ELSE_CODE)) { flag = TRUE; if (ln >= 0) @@ -1589,6 +1597,15 @@ static void parse_statement_z(int break_label, int continue_label) assemblez_2_to(loadw_zc, AO, AO2, AO3); AO2 = code_generate(parse_expression(QUANTITY_CONTEXT), QUANTITY_CONTEXT, -1); + if (is_constant_ot(AO2.type) && AO2.marker == 0) { + if (AO2.value >= 96) + { error("Z-machine dynamic strings are limited to 96"); + AO2.value = 0; + } + if (AO2.value < 0 || AO2.value >= MAX_DYNAMIC_STRINGS) { + memoryerror("MAX_DYNAMIC_STRINGS", MAX_DYNAMIC_STRINGS); + } + } get_next_token(); if (token_type == DQ_TT) { INITAOT(&AO4, LONG_CONSTANT_OT); @@ -2165,6 +2182,14 @@ static void parse_statement_g(int break_label, int continue_label) statements.enabled = TRUE; get_next_token(); + + /* An #if directive around the ELSE clause is legal. */ + while ((token_type == SEP_TT) && (token_value == HASH_SEP)) + { parse_directive(TRUE); + statements.enabled = TRUE; + get_next_token(); + } + if ((token_type == STATEMENT_TT) && (token_value == ELSE_CODE)) { flag = TRUE; if (ln >= 0) @@ -2513,6 +2538,11 @@ static void parse_statement_g(int break_label, int continue_label) case STRING_CODE: AO2 = code_generate(parse_expression(QUANTITY_CONTEXT), QUANTITY_CONTEXT, -1); + if (is_constant_ot(AO2.type) && AO2.marker == 0) { + if (AO2.value < 0 || AO2.value >= MAX_DYNAMIC_STRINGS) { + memoryerror("MAX_DYNAMIC_STRINGS", MAX_DYNAMIC_STRINGS); + } + } get_next_token(); if (token_type == DQ_TT) { INITAOT(&AO4, CONSTANT_OT); diff --git a/src/symbols.c b/src/symbols.c index d2f42da..90ec3bf 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -2,7 +2,7 @@ /* "symbols" : The symbols table; creating stock of reserved words */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -1223,6 +1223,8 @@ uint32 df_stripped_offset_for_code_offset(uint32 offset, int *stripped) { df_function_t *func; int count; + int beg; + int end; if (!track_unused_routines) compiler_error("DF: df_stripped_offset_for_code_offset called, but function references have not been mapped"); @@ -1250,13 +1252,14 @@ uint32 df_stripped_offset_for_code_offset(uint32 offset, int *stripped) /* Do a binary search. Maintain beg <= res < end, where res is the function containing the desired address. */ - int beg = 0; - int end = df_functions_sorted_count; + beg = 0; + end = df_functions_sorted_count; /* Set stripped flag until we decide on a non-stripped function. */ *stripped = TRUE; while (1) { + int new; if (beg >= end) { error("DF: offset_for_code_offset: Could not locate address."); return 0; @@ -1268,7 +1271,7 @@ uint32 df_stripped_offset_for_code_offset(uint32 offset, int *stripped) *stripped = FALSE; return func->newaddress + (offset - func->address); } - int new = (beg + end) / 2; + new = (beg + end) / 2; if (new <= beg || new >= end) compiler_error("DF: binary search went off the rails"); diff --git a/src/syntax.c b/src/syntax.c index 08e61c9..982d49f 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -2,7 +2,7 @@ /* "syntax" : Syntax analyser and compiler */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ diff --git a/src/tables.c b/src/tables.c index 8a29da8..1f7ba01 100644 --- a/src/tables.c +++ b/src/tables.c @@ -4,7 +4,7 @@ /* tables. */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -295,13 +295,23 @@ static void construct_storyfile_z(void) p[0x42+i]=low_strings[i]; abbrevs_at = mark; - for (i=0; i<3*32; i++) /* Initially all 96 entries */ - { p[mark++]=0; p[mark++]=0x20; /* are set to " " */ + + if (MAX_ABBREVS + MAX_DYNAMIC_STRINGS != 96) + fatalerror("MAX_ABBREVS + MAX_DYNAMIC_STRINGS is not 96"); + + /* Initially all 96 entries are set to " ". (We store half of 0x40, + the address of the " " we wrote above.) */ + for (i=0; i<3*32; i++) + { p[mark++]=0; p[mark++]=0x20; } - for (i=0; i= 10) || (d2 == 127) || (d2 >= 10)) error("'@..' must have two decimal digits"); else - { i+=2; - write_z_char_z(1); write_z_char_z(d1*10 + d2); + { + j = d1*10 + d2; + if (!glulx_mode && j >= 96) + { error("Z-machine dynamic strings are limited to 96"); + j = 0; + } + if (j >= MAX_DYNAMIC_STRINGS) { + memoryerror("MAX_DYNAMIC_STRINGS", MAX_DYNAMIC_STRINGS); + j = 0; + } + i+=2; + write_z_char_z(j/32+1); write_z_char_z(j%32); } } else @@ -2211,7 +2219,6 @@ extern void init_text_vars(void) grandflags = NULL; no_chars_transcribed = 0; is_abbreviation = FALSE; - put_strings_in_low_memory = FALSE; for (j=0; j<256; j++) abbrevs_lookup[j] = -1; diff --git a/src/veneer.c b/src/veneer.c index cbb4c3e..d32ad40 100644 --- a/src/veneer.c +++ b/src/veneer.c @@ -4,7 +4,7 @@ /* provide */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ diff --git a/src/verbs.c b/src/verbs.c index 8b7e649..2caa67c 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -3,7 +3,7 @@ /* Verb and Extend. */ /* */ /* Part of Inform 6.35 */ -/* copyright (c) Graham Nelson 1993 - 2020 */ +/* copyright (c) Graham Nelson 1993 - 2021 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */