Mercurial > hg > index.cgi
comparison lwbasic/symtab.h @ 29:bc96cd02fbf4
Added basic symbol table structure
author | lost@l-w.ca |
---|---|
date | Fri, 28 Jan 2011 22:35:04 -0700 |
parents | |
children | 49d608aecc4d |
comparison
equal
deleted
inserted
replaced
28:9ac1c97d01db | 29:bc96cd02fbf4 |
---|---|
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 */ | |
45 | |
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); | |
57 __E void symtab_register(symtab_t *st, char *name, int addr, int symtype); | |
58 | |
59 #undef __E | |
60 | |
61 #endif /* __symtab_h_seen__ */ |