Mercurial > hg > index.cgi
annotate lwbasic/symtab.h @ 215:5330ba70836a
Fix undefined symbol error with pragma nosymbolcase
Made symbol tree lookup handle case sensitivity correctly. It is not
sufficient to switch which of strcmp and strcasecmp is used to do the
lookups. Instead, one must use strcasecmp all the way until a match and then
use additional sorting once a match is achieved, if relevant. In this case,
a simple linked list of symbols that differ only in case since this is not
expected to be a common case.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 10 Jun 2012 13:29:23 -0600 |
parents | 49d608aecc4d |
children |
rev | line source |
---|---|
29 | 1 /* |
2 symtab.h | |
3 | |
4 Copyright © 2011 William Astle | |
5 | |
6 This file is part of LWTOOLS. | |
7 | |
8 LWTOOLS is free software: you can redistribute it and/or modify it under the | |
9 terms of the GNU General Public License as published by the Free Software | |
10 Foundation, either version 3 of the License, or (at your option) any later | |
11 version. | |
12 | |
13 This program is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
16 more details. | |
17 | |
18 You should have received a copy of the GNU General Public License along with | |
19 this program. If not, see <http://www.gnu.org/licenses/>. | |
20 */ | |
21 | |
22 /* | |
23 Symbol table handling | |
24 */ | |
25 | |
26 #ifndef __symtab_h_seen__ | |
27 #define __symtab_h_seen__ | |
28 | |
29 #ifndef __symtab_c_seen__ | |
30 #define __E extern | |
31 #else | |
32 #define __E | |
33 #endif | |
34 | |
35 /* | |
36 the meaning of "addr" and "symtype" is defined by the particular context | |
37 in which the symbol table is used | |
38 */ | |
39 typedef struct symtab_entry_s symtab_entry_t; | |
40 struct symtab_entry_s | |
41 { | |
42 char *name; /* name of the symbol */ | |
43 int addr; /* address of symbol */ | |
44 int symtype; /* type of symbol */ | |
32
49d608aecc4d
Framework for handling local stack frame and/or variables
lost@l-w.ca
parents:
29
diff
changeset
|
45 void *privdata; /* random data associated with symbol */ |
29 | 46 symtab_entry_t *next; /* next in the list */ |
47 }; | |
48 | |
49 typedef struct symtab_s | |
50 { | |
51 symtab_entry_t *head; | |
52 } symtab_t; | |
53 | |
54 __E symtab_t *symtab_init(void); | |
55 __E void symtab_destroy(symtab_t *st); | |
56 __E symtab_entry_t *symtab_find(symtab_t *st, char *name); | |
32
49d608aecc4d
Framework for handling local stack frame and/or variables
lost@l-w.ca
parents:
29
diff
changeset
|
57 __E void symtab_register(symtab_t *st, char *name, int addr, int symtype, void *data); |
29 | 58 |
59 #undef __E | |
60 | |
61 #endif /* __symtab_h_seen__ */ |