diff -r -c inform63-mall/expressp.c inform63-globref/expressp.c *** inform63-mall/expressp.c 2007-02-04 20:43:29.000000000 -0500 --- inform63-globref/expressp.c 2009-02-08 10:50:37.000000000 -0500 *************** *** 299,304 **** --- 299,338 ---- token_text = current_token.text + 3; goto ActionUsedAsConstant; + case HASHGDOLLAR_SEP: + + /* This form generates the position of a global variable + in the global variables array. So Glob is the same as + #globals_array --> #g$Glob */ + + current_token.text += 3; + current_token.type = SYMBOL_TT; + symbol = symbol_index(current_token.text, -1); + if (stypes[symbol] != GLOBAL_VARIABLE_T) { + ebf_error( + "global variable name after '#g$'", + current_token.text); + current_token.value = 0; + current_token.type = SMALL_NUMBER_TT; + current_token.marker = 0; + break; + } + mark_symbol_as_used = TRUE; + current_token.value = svals[symbol] - MAX_LOCAL_VARIABLES; + current_token.marker = 0; + if (!glulx_mode) { + if (current_token.value >= 0x100) + current_token.type = LARGE_NUMBER_TT; + else current_token.type = SMALL_NUMBER_TT; + } + else { + if (current_token.value >= 0x8000 + || current_token.value < -0x8000) + current_token.type = LARGE_NUMBER_TT; + else current_token.type = SMALL_NUMBER_TT; + } + break; + case HASHNDOLLAR_SEP: /* This form is still needed for constants like #n$a (the *************** *** 338,344 **** system_constants.enabled = FALSE; if (token_type != SYSTEM_CONSTANT_TT) { ebf_error( ! "'r$', 'n$' or internal Inform constant name after '#'", token_text); break; } --- 372,378 ---- system_constants.enabled = FALSE; if (token_type != SYSTEM_CONSTANT_TT) { ebf_error( ! "'r$', 'n$', 'g$' or internal Inform constant name after '#'", token_text); break; } *************** *** 626,631 **** --- 660,667 ---- return grammar_table_offset; case actions_table_SC: return actions_offset; + case globals_array_SC: + return variables_offset; } error_named("System constant not implemented in Glulx", diff -r -c inform63-mall/header.h inform63-globref/header.h *** inform63-mall/header.h 2007-02-04 21:28:34.000000000 -0500 --- inform63-globref/header.h 2009-02-08 10:50:37.000000000 -0500 *************** *** 1491,1497 **** /* Index numbers into the operators group "separators" (see "lexer.c") */ ! #define NUMBER_SEPARATORS 48 #define ARROW_SEP 0 #define DARROW_SEP 1 --- 1491,1497 ---- /* Index numbers into the operators group "separators" (see "lexer.c") */ ! #define NUMBER_SEPARATORS 49 #define ARROW_SEP 0 #define DARROW_SEP 1 *************** *** 1536,1546 **** #define NBRANCH_SEP 40 #define BRANCH_SEP 41 #define HASHADOLLAR_SEP 42 ! #define HASHNDOLLAR_SEP 43 ! #define HASHRDOLLAR_SEP 44 ! #define HASHWDOLLAR_SEP 45 ! #define HASHHASH_SEP 46 ! #define HASH_SEP 47 #define UNARY_MINUS_SEP 100 #define POST_INC_SEP 101 --- 1536,1547 ---- #define NBRANCH_SEP 40 #define BRANCH_SEP 41 #define HASHADOLLAR_SEP 42 ! #define HASHGDOLLAR_SEP 43 ! #define HASHNDOLLAR_SEP 44 ! #define HASHRDOLLAR_SEP 45 ! #define HASHWDOLLAR_SEP 46 ! #define HASHHASH_SEP 47 ! #define HASH_SEP 48 #define UNARY_MINUS_SEP 100 #define POST_INC_SEP 101 diff -r -c inform63-mall/lexer.c inform63-globref/lexer.c *** inform63-mall/lexer.c 2007-02-04 21:27:35.000000000 -0500 --- inform63-globref/lexer.c 2009-02-08 10:50:37.000000000 -0500 *************** *** 615,621 **** ".&", ".#", "..&", "..#", "..", ".", "::", ":", "@", ";", "[", "]", "{", "}", "$", "?~", "?", ! "#a$", "#n$", "#r$", "#w$", "##", "#" }; static void make_tokeniser_grid(void) --- 615,621 ---- ".&", ".#", "..&", "..#", "..", ".", "::", ":", "@", ";", "[", "]", "{", "}", "$", "?~", "?", ! "#a$", "#g$", "#n$", "#r$", "#w$", "##", "#" }; static void make_tokeniser_grid(void) *************** *** 1284,1289 **** --- 1284,1290 ---- *lex_p++ = 0; break; case HASHADOLLAR_SEP: + case HASHGDOLLAR_SEP: case HASHRDOLLAR_SEP: case HASHHASH_SEP: if (tokeniser_grid[lookahead] != IDENTIFIER_CODE)