1
/* ------------------------------------------------------------------------- */
2
/* "symbols" : The symbols table; creating stock of reserved words */
4
/* Part of Inform 6.30 */
5
/* copyright (c) Graham Nelson 1993 - 2004 */
7
/* ------------------------------------------------------------------------- */
11
/* ------------------------------------------------------------------------- */
12
/* This section of Inform is a service detached from the rest. */
13
/* Only two variables are accessible from the outside: */
14
/* ------------------------------------------------------------------------- */
16
int no_symbols; /* Total number of symbols defined */
17
int no_named_constants; /* Copied into story file */
19
/* ------------------------------------------------------------------------- */
20
/* Plus four arrays. Each symbol has its own index n (an int32) and */
22
/* svals[n] is its value (must be 32 bits wide, i.e. an int32, tho' */
23
/* it is used to hold an unsigned 16 bit Z-machine value) */
24
/* sflags[n] holds flags (see "header.h" for a list) */
25
/* stypes[n] is the "type", distinguishing between the data type of */
26
/* different kinds of constants/variables. */
27
/* (See the "typename()" below.) */
28
/* symbs[n] (needs to be cast to (char *) to be used) is the name */
29
/* of the symbol, in the same case form as when created. */
30
/* slines[n] is the source line on which the symbol value was first */
33
/* Comparison is case insensitive. */
34
/* Note that local variable names are not entered into the symbols table, */
35
/* as their numbers and scope are too limited for this to be efficient. */
36
/* ------------------------------------------------------------------------- */
37
/* Caveat editor: some array types are set up to work even on machines */
38
/* where sizeof(int32 *) differs from, e.g., sizeof(char *): so do not */
39
/* alter the types unless you understand what is going on! */
40
/* ------------------------------------------------------------------------- */
44
int *smarks; /* Glulx-only */
48
char *stypes; /* In VAX C, insanely, "signed char" is illegal */
53
/* ------------------------------------------------------------------------- */
54
/* Memory to hold the text of symbol names: note that this memory is */
55
/* allocated as needed in chunks of size SYMBOLS_CHUNK_SIZE. */
56
/* ------------------------------------------------------------------------- */
58
static uchar *symbols_free_space, /* Next byte free to hold new names */
59
*symbols_ceiling; /* Pointer to the end of the current
60
allocation of memory for names */
62
static char** symbol_name_space_chunks; /* For chunks of memory used to hold
63
the name strings of symbols */
64
static int no_symbol_name_space_chunks;
66
/* ------------------------------------------------------------------------- */
67
/* The symbols table is "hash-coded" into a disjoint union of linked */
68
/* lists, so that for any symbol i, next_entry[i] is either -1 (meaning */
69
/* that it's the last in its list) or the next in the list. */
71
/* Each list contains, in alphabetical order, all the symbols which share */
72
/* the same "hash code" (a numerical function of the text of the symbol */
73
/* name, designed with the aim that roughly equal numbers of symbols are */
74
/* given each possible hash code). The hash codes are 0 to HASH_TAB_SIZE */
75
/* (which is a memory setting) minus 1: start_of_list[h] gives the first */
76
/* symbol with hash code h, or -1 if no symbol exists with hash code h. */
78
/* Note that the running time of the symbol search algorithm is about */
80
/* O ( n^2 / HASH_TAB_SIZE ) */
82
/* (where n is the number of symbols in the program) so that it is a good */
83
/* idea to choose HASH_TAB_SIZE as large as conveniently possible. */
84
/* ------------------------------------------------------------------------- */
86
static int *next_entry;
87
static int32 *start_of_list;
89
/* ------------------------------------------------------------------------- */
91
/* ------------------------------------------------------------------------- */
93
static void init_symbol_banks(void)
95
for (i=0; i<HASH_TAB_SIZE; i++) start_of_list[i] = -1;
98
/* ------------------------------------------------------------------------- */
99
/* The hash coding we use is quite standard; the variable hashcode is */
100
/* expected to overflow a good deal. (The aim is to produce a number */
101
/* so that similar names do not produce the same number.) Note that */
102
/* 30011 is prime. It doesn't matter if the unsigned int to int cast */
103
/* behaves differently on different ports. */
104
/* ------------------------------------------------------------------------- */
106
int case_conversion_grid[128];
108
static void make_case_conversion_grid(void)
110
/* Assumes that A to Z are contiguous in the host OS character set:
111
true for ASCII but not for EBCDIC, for instance. */
114
for (i=0; i<128; i++) case_conversion_grid[i] = i;
115
for (i=0; i<26; i++) case_conversion_grid['A'+i]='a'+i;
118
extern int hash_code_from_string(char *p)
120
for (; *p; p++) hashcode=hashcode*30011 + case_conversion_grid[*p];
121
return (int) (hashcode % HASH_TAB_SIZE);
124
extern int strcmpcis(char *p, char *q)
126
/* Case insensitive strcmp */
129
for (i=0;p[i] != 0;i++)
130
{ pc = p[i]; if (isupper(pc)) pc = tolower(pc);
131
qc = q[i]; if (isupper(qc)) qc = tolower(qc);
135
qc = q[i]; if (isupper(qc)) qc = tolower(qc);
139
/* ------------------------------------------------------------------------- */
140
/* Symbol finding/creating. */
141
/* ------------------------------------------------------------------------- */
143
extern int symbol_index(char *p, int hashcode)
145
/* Return the index in the symbs/svals/sflags/stypes arrays of symbol
146
"p", creating a new symbol with that name if it isn't already there.
148
New symbols are created with fundamental type UNKNOWN_CONSTANT_FT,
149
value 0x100 (a 2-byte quantity in Z-machine terms) and type
152
The string "p" is undamaged. */
154
int32 new_entry, this, last; char *r;
156
if (hashcode == -1) hashcode = hash_code_from_string(p);
158
this = start_of_list[hashcode]; last = -1;
161
{ if (this == -1) break;
163
r = (char *)symbs[this];
164
new_entry = strcmpcis(r, p);
165
if (new_entry == 0) return this;
166
if (new_entry > 0) break;
169
this = next_entry[this];
170
} while (this != -1);
172
if (no_symbols >= MAX_SYMBOLS)
173
memoryerror("MAX_SYMBOLS", MAX_SYMBOLS);
176
{ next_entry[no_symbols]=start_of_list[hashcode];
177
start_of_list[hashcode]=no_symbols;
180
{ next_entry[no_symbols]=this;
181
next_entry[last]=no_symbols;
184
if (symbols_free_space+strlen(p)+1 >= symbols_ceiling)
186
= my_malloc(SYMBOLS_CHUNK_SIZE, "symbol names chunk");
187
symbols_ceiling = symbols_free_space + SYMBOLS_CHUNK_SIZE;
188
symbol_name_space_chunks[no_symbol_name_space_chunks++]
189
= (char *) symbols_free_space;
192
strcpy((char *) symbols_free_space, p);
193
symbs[no_symbols] = (int32 *) symbols_free_space;
194
symbols_free_space += strlen((char *)symbols_free_space) + 1;
196
svals[no_symbols] = 0x100; /* ###-wrong? Would this fix the
197
unbound-symbol-causes-asm-error? */
198
sflags[no_symbols] = UNKNOWN_SFLAG;
199
stypes[no_symbols] = CONSTANT_T;
200
slines[no_symbols] = ErrorReport.line_number
201
+ 0x10000*ErrorReport.file_number;
203
return(no_symbols++);
206
/* ------------------------------------------------------------------------- */
207
/* Printing diagnostics */
208
/* ------------------------------------------------------------------------- */
210
extern char *typename(int type)
213
/* These are the possible symbol types. Note that local variables
214
do not reside in the symbol table (for scope and efficiency
215
reasons) and actions have their own name-space (via routine
216
names with "Sub" appended). */
218
case ROUTINE_T: return("Routine");
219
case LABEL_T: return("Label");
220
case GLOBAL_VARIABLE_T: return("Global variable");
221
case ARRAY_T: return("Array");
222
case CONSTANT_T: return("Defined constant");
223
case ATTRIBUTE_T: return("Attribute");
224
case PROPERTY_T: return("Property");
225
case INDIVIDUAL_PROPERTY_T: return("Individual property");
226
case OBJECT_T: return("Object");
227
case CLASS_T: return("Class");
228
case FAKE_ACTION_T: return("Fake action");
230
default: return("(Unknown type)");
234
static void describe_flags(int flags)
235
{ if (flags & UNKNOWN_SFLAG) printf("(?) ");
236
if (flags & USED_SFLAG) printf("(used) ");
237
if (flags & REPLACE_SFLAG) printf("(Replaced) ");
238
if (flags & DEFCON_SFLAG) printf("(Defaulted) ");
239
if (flags & STUB_SFLAG) printf("(Stubbed) ");
240
if (flags & CHANGE_SFLAG) printf("(value will change) ");
241
if (flags & IMPORT_SFLAG) printf("(Imported) ");
242
if (flags & EXPORT_SFLAG) printf("(Exported) ");
243
if (flags & SYSTEM_SFLAG) printf("(System) ");
244
if (flags & INSF_SFLAG) printf("(created in sys file) ");
245
if (flags & UERROR_SFLAG) printf("('Unknown' error issued) ");
246
if (flags & ALIASED_SFLAG) printf("(aliased) ");
247
if (flags & ACTION_SFLAG) printf("(Action name) ");
248
if (flags & REDEFINABLE_SFLAG) printf("(Redefinable) ");
251
extern void describe_symbol(int k)
252
{ printf("%4d %-16s %2d:%04d %04x %s ",
253
k, (char *) (symbs[k]), slines[k]/0x10000, slines[k]%0x10000,
254
svals[k], typename(stypes[k]));
255
describe_flags(sflags[k]);
258
extern void list_symbols(int level)
260
for (k=0; k<no_symbols; k++)
262
((sflags[k] & (SYSTEM_SFLAG + UNKNOWN_SFLAG + INSF_SFLAG)) == 0))
263
{ describe_symbol(k); printf("\n");
268
extern void issue_unused_warnings(void)
271
if (module_switch) return;
273
/* Update any ad-hoc variables that might help the library */
275
{ global_initial_value[10]=statusline_flag;
277
/* Now back to mark anything necessary as used */
279
i = symbol_index("Main", -1);
280
if (!(sflags[i] & UNKNOWN_SFLAG)) sflags[i] |= USED_SFLAG;
282
for (i=0;i<no_symbols;i++)
284
& (SYSTEM_SFLAG + UNKNOWN_SFLAG + EXPORT_SFLAG
285
+ INSF_SFLAG + USED_SFLAG + REPLACE_SFLAG)) == 0)
286
&& (stypes[i] != OBJECT_T))
287
dbnu_warning(typename(stypes[i]), (char *) symbs[i], slines[i]);
291
/* ------------------------------------------------------------------------- */
292
/* These are arrays used only during story file (never module) creation, */
293
/* and not allocated until then. */
295
int32 *individual_name_strings; /* Packed addresses of Z-encoded
296
strings of the names of the
297
properties: this is an array
298
indexed by the property ID */
299
int32 *action_name_strings; /* Ditto for actions */
300
int32 *attribute_name_strings; /* Ditto for attributes */
301
int32 *array_name_strings; /* Ditto for arrays */
303
extern void write_the_identifier_names(void)
304
{ int i, j, k, t, null_value; char idname_string[256];
305
static char unknown_attribute[20] = "<unknown attribute>";
307
for (i=0; i<no_individual_properties; i++)
308
individual_name_strings[i] = 0;
310
if (module_switch) return;
314
null_value = compile_string(unknown_attribute, FALSE, FALSE);
315
for (i=0; i<NUM_ATTR_BYTES*8; i++) attribute_name_strings[i] = null_value;
317
for (i=0; i<no_symbols; i++)
319
if ((t == INDIVIDUAL_PROPERTY_T) || (t == PROPERTY_T))
320
{ if (sflags[i] & ALIASED_SFLAG)
321
{ if (individual_name_strings[svals[i]] == 0)
322
{ sprintf(idname_string, "%s", (char *) symbs[i]);
324
for (j=i+1, k=0; (j<no_symbols && k<3); j++)
325
{ if ((stypes[j] == stypes[i])
326
&& (svals[j] == svals[i]))
327
{ sprintf(idname_string+strlen(idname_string),
328
"/%s", (char *) symbs[j]);
333
if (debugfile_switch)
334
{ write_debug_byte(PROP_DBR);
335
write_debug_byte(svals[i]/256);
336
write_debug_byte(svals[i]%256);
337
write_debug_string(idname_string);
340
individual_name_strings[svals[i]]
341
= compile_string(idname_string, FALSE, FALSE);
345
{ sprintf(idname_string, "%s", (char *) symbs[i]);
347
if (debugfile_switch)
348
{ write_debug_byte(PROP_DBR);
349
write_debug_byte(svals[i]/256);
350
write_debug_byte(svals[i]%256);
351
write_debug_string(idname_string);
354
individual_name_strings[svals[i]]
355
= compile_string(idname_string, FALSE, FALSE);
358
if (t == ATTRIBUTE_T)
359
{ if (sflags[i] & ALIASED_SFLAG)
360
{ if (attribute_name_strings[svals[i]] == null_value)
361
{ sprintf(idname_string, "%s", (char *) symbs[i]);
363
for (j=i+1, k=0; (j<no_symbols && k<3); j++)
364
{ if ((stypes[j] == stypes[i])
365
&& (svals[j] == svals[i]))
366
{ sprintf(idname_string+strlen(idname_string),
367
"/%s", (char *) symbs[j]);
372
if (debugfile_switch)
373
{ write_debug_byte(ATTR_DBR);
374
write_debug_byte(svals[i]/256);
375
write_debug_byte(svals[i]%256);
376
write_debug_string(idname_string);
379
attribute_name_strings[svals[i]]
380
= compile_string(idname_string, FALSE, FALSE);
384
{ sprintf(idname_string, "%s", (char *) symbs[i]);
386
if (debugfile_switch)
387
{ write_debug_byte(ATTR_DBR);
388
write_debug_byte(svals[i]/256);
389
write_debug_byte(svals[i]%256);
390
write_debug_string(idname_string);
393
attribute_name_strings[svals[i]]
394
= compile_string(idname_string, FALSE, FALSE);
397
if (sflags[i] & ACTION_SFLAG)
398
{ sprintf(idname_string, "%s", (char *) symbs[i]);
399
idname_string[strlen(idname_string)-3] = 0;
401
if (debugfile_switch)
402
{ write_debug_byte(ACTION_DBR);
403
write_debug_byte(svals[i]/256);
404
write_debug_byte(svals[i]%256);
405
write_debug_string(idname_string);
408
action_name_strings[svals[i]]
409
= compile_string(idname_string, FALSE, FALSE);
413
for (i=0; i<no_symbols; i++)
414
{ if (stypes[i] == FAKE_ACTION_T)
415
{ sprintf(idname_string, "%s", (char *) symbs[i]);
416
idname_string[strlen(idname_string)-3] = 0;
418
if (debugfile_switch)
419
{ write_debug_byte(ACTION_DBR);
420
write_debug_byte(svals[i]/256);
421
write_debug_byte(svals[i]%256);
422
write_debug_string(idname_string);
425
action_name_strings[svals[i]
426
- ((grammar_version_number==1)?256:4096) + no_actions]
427
= compile_string(idname_string, FALSE, FALSE);
431
for (j=0; j<no_arrays; j++)
432
{ i = array_symbols[j];
433
sprintf(idname_string, "%s", (char *) symbs[i]);
435
if (debugfile_switch)
436
{ write_debug_byte(ARRAY_DBR);
437
write_debug_byte(svals[i]/256);
438
write_debug_byte(svals[i]%256);
439
write_debug_string(idname_string);
442
array_name_strings[j]
443
= compile_string(idname_string, FALSE, FALSE);
445
if (define_INFIX_switch)
446
{ for (i=0; i<no_symbols; i++)
447
{ if (stypes[i] == GLOBAL_VARIABLE_T)
448
{ sprintf(idname_string, "%s", (char *) symbs[i]);
449
array_name_strings[no_arrays + svals[i] -16]
450
= compile_string(idname_string, FALSE, FALSE);
454
for (i=0; i<no_named_routines; i++)
455
{ sprintf(idname_string, "%s", (char *) symbs[named_routine_symbols[i]]);
456
array_name_strings[no_arrays + no_globals + i]
457
= compile_string(idname_string, FALSE, FALSE);
460
for (i=0, no_named_constants=0; i<no_symbols; i++)
461
{ if (((stypes[i] == OBJECT_T) || (stypes[i] == CLASS_T)
462
|| (stypes[i] == CONSTANT_T))
463
&& ((sflags[i] & (UNKNOWN_SFLAG+ACTION_SFLAG))==0))
464
{ sprintf(idname_string, "%s", (char *) symbs[i]);
465
array_name_strings[no_arrays + no_globals + no_named_routines
466
+ no_named_constants++]
467
= compile_string(idname_string, FALSE, FALSE);
474
/* ------------------------------------------------------------------------- */
475
/* Creating symbols */
476
/* ------------------------------------------------------------------------- */
478
static void assign_symbol_base(int index, int32 value, int type)
479
{ svals[index] = value;
480
stypes[index] = type;
481
if (sflags[index] & UNKNOWN_SFLAG)
482
{ sflags[index] &= (~UNKNOWN_SFLAG);
483
if (is_systemfile()) sflags[index] |= INSF_SFLAG;
484
slines[index] = ErrorReport.line_number
485
+ 0x10000*ErrorReport.file_number;
489
extern void assign_symbol(int index, int32 value, int type)
492
assign_symbol_base(index, value, type);
496
assign_symbol_base(index, value, type);
500
extern void assign_marked_symbol(int index, int marker, int32 value, int type)
503
assign_symbol_base(index, (int32)marker*0x10000 + (value % 0x10000),
507
smarks[index] = marker;
508
assign_symbol_base(index, value, type);
513
static void create_symbol(char *p, int value, int type)
514
{ int i = symbol_index(p, -1);
515
svals[i] = value; stypes[i] = type; slines[i] = 0;
516
sflags[i] = USED_SFLAG + SYSTEM_SFLAG;
519
static void create_rsymbol(char *p, int value, int type)
520
{ int i = symbol_index(p, -1);
521
svals[i] = value; stypes[i] = type; slines[i] = 0;
522
sflags[i] = USED_SFLAG + SYSTEM_SFLAG + REDEFINABLE_SFLAG;
525
static void stockup_symbols(void)
528
create_symbol("TARGET_ZCODE", 0, CONSTANT_T);
530
create_symbol("TARGET_GLULX", 0, CONSTANT_T);
532
create_symbol("nothing", 0, OBJECT_T);
533
create_symbol("name", 1, PROPERTY_T);
535
create_symbol("true", 1, CONSTANT_T);
536
create_symbol("false", 0, CONSTANT_T);
538
/* Glulx defaults to GV2; Z-code to GV1 */
540
create_rsymbol("Grammar__Version", 1, CONSTANT_T);
542
create_rsymbol("Grammar__Version", 2, CONSTANT_T);
543
grammar_version_symbol = symbol_index("Grammar__Version", -1);
546
create_rsymbol("MODULE_MODE",0, CONSTANT_T);
548
if (runtime_error_checking_switch)
549
create_rsymbol("STRICT_MODE",0, CONSTANT_T);
551
if (define_DEBUG_switch)
552
create_rsymbol("DEBUG", 0, CONSTANT_T);
554
if (define_USE_MODULES_switch)
555
create_rsymbol("USE_MODULES",0, CONSTANT_T);
557
if (define_INFIX_switch)
558
{ create_rsymbol("INFIX", 0, CONSTANT_T);
559
create_symbol("infix__watching", 0, ATTRIBUTE_T);
562
create_symbol("WORDSIZE", WORDSIZE, CONSTANT_T);
564
create_symbol("DICT_WORD_SIZE", ((version_number==3)?4:6), CONSTANT_T);
565
create_symbol("NUM_ATTR_BYTES", ((version_number==3)?4:6), CONSTANT_T);
568
create_symbol("DICT_WORD_SIZE", DICT_WORD_SIZE, CONSTANT_T);
569
create_symbol("NUM_ATTR_BYTES", NUM_ATTR_BYTES, CONSTANT_T);
570
create_symbol("INDIV_PROP_START", INDIV_PROP_START, CONSTANT_T);
574
create_symbol("temp_global", 255, GLOBAL_VARIABLE_T);
575
create_symbol("temp__global2", 254, GLOBAL_VARIABLE_T);
576
create_symbol("temp__global3", 253, GLOBAL_VARIABLE_T);
577
create_symbol("temp__global4", 252, GLOBAL_VARIABLE_T);
578
create_symbol("self", 251, GLOBAL_VARIABLE_T);
579
create_symbol("sender", 250, GLOBAL_VARIABLE_T);
580
create_symbol("sw__var", 249, GLOBAL_VARIABLE_T);
582
create_symbol("sys__glob0", 16, GLOBAL_VARIABLE_T);
583
create_symbol("sys__glob1", 17, GLOBAL_VARIABLE_T);
584
create_symbol("sys__glob2", 18, GLOBAL_VARIABLE_T);
586
create_symbol("create", 64, INDIVIDUAL_PROPERTY_T);
587
create_symbol("recreate", 65, INDIVIDUAL_PROPERTY_T);
588
create_symbol("destroy", 66, INDIVIDUAL_PROPERTY_T);
589
create_symbol("remaining", 67, INDIVIDUAL_PROPERTY_T);
590
create_symbol("copy", 68, INDIVIDUAL_PROPERTY_T);
591
create_symbol("call", 69, INDIVIDUAL_PROPERTY_T);
592
create_symbol("print", 70, INDIVIDUAL_PROPERTY_T);
593
create_symbol("print_to_array",71, INDIVIDUAL_PROPERTY_T);
596
/* In Glulx, these system globals are entered in order, not down
598
create_symbol("temp_global", MAX_LOCAL_VARIABLES+0,
600
create_symbol("temp__global2", MAX_LOCAL_VARIABLES+1,
602
create_symbol("temp__global3", MAX_LOCAL_VARIABLES+2,
604
create_symbol("temp__global4", MAX_LOCAL_VARIABLES+3,
606
create_symbol("self", MAX_LOCAL_VARIABLES+4,
608
create_symbol("sender", MAX_LOCAL_VARIABLES+5,
610
create_symbol("sw__var", MAX_LOCAL_VARIABLES+6,
613
/* These are almost certainly meaningless, and can be removed. */
614
create_symbol("sys__glob0", MAX_LOCAL_VARIABLES+7,
616
create_symbol("sys__glob1", MAX_LOCAL_VARIABLES+8,
618
create_symbol("sys__glob2", MAX_LOCAL_VARIABLES+9,
621
/* value of statusline_flag to be written later */
622
create_symbol("sys_statusline_flag", MAX_LOCAL_VARIABLES+10,
625
/* These are created in order, but not necessarily at a fixed
627
create_symbol("create", INDIV_PROP_START+0,
628
INDIVIDUAL_PROPERTY_T);
629
create_symbol("recreate", INDIV_PROP_START+1,
630
INDIVIDUAL_PROPERTY_T);
631
create_symbol("destroy", INDIV_PROP_START+2,
632
INDIVIDUAL_PROPERTY_T);
633
create_symbol("remaining", INDIV_PROP_START+3,
634
INDIVIDUAL_PROPERTY_T);
635
create_symbol("copy", INDIV_PROP_START+4,
636
INDIVIDUAL_PROPERTY_T);
637
create_symbol("call", INDIV_PROP_START+5,
638
INDIVIDUAL_PROPERTY_T);
639
create_symbol("print", INDIV_PROP_START+6,
640
INDIVIDUAL_PROPERTY_T);
641
create_symbol("print_to_array",INDIV_PROP_START+7,
642
INDIVIDUAL_PROPERTY_T);
646
/* ========================================================================= */
647
/* Data structure management routines */
648
/* ------------------------------------------------------------------------- */
650
extern void init_symbols_vars(void)
658
start_of_list = NULL;
660
symbol_name_space_chunks = NULL;
661
no_symbol_name_space_chunks = 0;
662
symbols_free_space=NULL;
663
symbols_ceiling=symbols_free_space;
667
make_case_conversion_grid();
670
extern void symbols_begin_pass(void) { }
672
extern void symbols_allocate_arrays(void)
674
symbs = my_calloc(sizeof(char *), MAX_SYMBOLS, "symbols");
675
svals = my_calloc(sizeof(int32), MAX_SYMBOLS, "symbol values");
677
smarks = my_calloc(sizeof(int), MAX_SYMBOLS, "symbol markers");
678
slines = my_calloc(sizeof(int32), MAX_SYMBOLS, "symbol lines");
679
stypes = my_calloc(sizeof(char), MAX_SYMBOLS, "symbol types");
680
sflags = my_calloc(sizeof(int), MAX_SYMBOLS, "symbol flags");
681
next_entry = my_calloc(sizeof(int), MAX_SYMBOLS,
682
"symbol linked-list forward links");
683
start_of_list = my_calloc(sizeof(int32), HASH_TAB_SIZE,
684
"hash code list beginnings");
686
symbol_name_space_chunks
687
= my_calloc(sizeof(char *), 100, "symbol names chunk addresses");
692
/* Allocated during story file construction, not now */
693
individual_name_strings = NULL;
694
attribute_name_strings = NULL;
695
action_name_strings = NULL;
696
array_name_strings = NULL;
699
extern void symbols_free_arrays(void)
702
for (i=0; i<no_symbol_name_space_chunks; i++)
703
my_free(&(symbol_name_space_chunks[i]),
704
"symbol names chunk");
706
my_free(&symbol_name_space_chunks, "symbol names chunk addresses");
708
my_free(&symbs, "symbols");
709
my_free(&svals, "symbol values");
710
my_free(&smarks, "symbol markers");
711
my_free(&slines, "symbol lines");
712
my_free(&stypes, "symbol types");
713
my_free(&sflags, "symbol flags");
714
my_free(&next_entry, "symbol linked-list forward links");
715
my_free(&start_of_list, "hash code list beginnings");
717
if (individual_name_strings != NULL)
718
my_free(&individual_name_strings, "property name strings");
719
if (action_name_strings != NULL)
720
my_free(&action_name_strings, "action name strings");
721
if (attribute_name_strings != NULL)
722
my_free(&attribute_name_strings, "attribute name strings");
723
if (array_name_strings != NULL)
724
my_free(&array_name_strings, "array name strings");
727
/* ========================================================================= */