/* "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 */
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)
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);
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)
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);