/* "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 */
static int constant_made_yet; /* Have any constants been defined yet? */
-static int ifdef_stack[32], ifdef_sp;
+#define MAX_IFDEF_STACK (32)
+static int ifdef_stack[MAX_IFDEF_STACK], ifdef_sp;
/* ------------------------------------------------------------------------- */
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)
assembly_operand AO;
put_token_back();
AO = parse_expression(CONSTANT_CONTEXT);
- if (module_switch && (AO.marker != 0))
+ if (AO.marker != 0)
error("A definite value must be given as a Dictionary flag");
else
val1 = AO.value;
assembly_operand AO;
put_token_back();
AO = parse_expression(CONSTANT_CONTEXT);
- if (module_switch && (AO.marker != 0))
+ if (AO.marker != 0)
error("A definite value must be given as a Dictionary flag");
else
val3 = AO.value;
case IFTRUE_CODE:
{ assembly_operand AO;
AO = parse_expression(CONSTANT_CONTEXT);
- if (module_switch && (AO.marker != 0))
+ if (AO.marker != 0)
{ error("This condition can't be determined");
flag = 0;
}
case IFFALSE_CODE:
{ assembly_operand AO;
AO = parse_expression(CONSTANT_CONTEXT);
- if (module_switch && (AO.marker != 0))
+ if (AO.marker != 0)
{ error("This condition can't be determined");
flag = 1;
}
if (!((token_type == SEP_TT) && (token_value == SEMICOLON_SEP)))
return ebf_error_recover("semicolon after 'If...' condition", token_text);
+ if (ifdef_sp >= MAX_IFDEF_STACK) {
+ error("'If' directives nested too deeply");
+ panic_mode_error_recovery(); return FALSE;
+ }
+
if (flag)
{ ifdef_stack[ifdef_sp++] = TRUE; return FALSE; }
else
{ 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);
if (token_type != DQ_TT)
return ebf_error_recover("literal string in double-quotes", token_text);
- assign_symbol(i, compile_string(token_text, TRUE, TRUE), CONSTANT_T);
+ assign_symbol(i, compile_string(token_text, STRCTX_LOWSTRING), CONSTANT_T);
break;
/* --------------------------------------------------------------------- */
case RELEASE_CODE:
{ assembly_operand AO;
AO = parse_expression(CONSTANT_CONTEXT);
- if (module_switch && (AO.marker != 0))
+ if (AO.marker != 0)
error("A definite value must be given as release number");
else
release_number = AO.value;
break;
}
- if (module_switch && (AO.marker != 0))
+ if (AO.marker != 0)
error("A definite value must be given as version number");
else
if (glulx_mode)