blob: fd765e9e87344ab23b69f5dee533003a96df45fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
/* fornax - distributed network
*
* by team teso
*
* symbol management include file
*/
#ifndef FNX_SYMBOL_H
#define FNX_SYMBOL_H
typedef struct sym_elem {
char *key; /* string of variable name */
char *value; /* NULL or string */
} sym_elem;
/* sym_subst
*
* substitute symbol information contained in string `str' using the global
* symbol table
*
* return newly allocated char pointer
*/
char * sym_subst (sym_elem **stab, char *str);
/* sym_elem_create
*
* symbol element constructor. create a new symbol element and set values
* to `key' and `value'
*
* return pointer to new sym_elem structure
*/
sym_elem * sym_elem_create (char *key, char *value);
/* sym_elem_free
*
* free symbol element pointed to by `se'
*
* return in any case
*/
void sym_elem_free (sym_elem *se);
/* sym_elem_add
*
* add a symbol element pointed to by `elem' to the symbol table pointed to
* by `tab'. if the table doesn't exist yet, just create it
*
* return in any case
*/
sym_elem ** sym_elem_add (sym_elem **tab, sym_elem *elem);
/* sym_remove
*
* remove a symbol with the key `key' from the symbol table pointed to by
* `tab'
*
* return in any case
*/
sym_elem ** sym_remove (sym_elem **tab, char *key);
/* sym_add
*
* create a new symbol table entry in the table `tab'. if `tab' is empty or
* is a NULL pointer create a new table. add the key `key' with the value
* `value' to this table. if it already exists within the table overwrite it.
* if `value' is a NULL pointer remove the element from the table, freeing
* the table if it was the last symbol entry.
*
* return pointer to modified list
*/
sym_elem ** sym_add (sym_elem **tab, char *key, char *value);
/* sym_resolve
*
* find the character value associated to the key `key' in the symbol table
* `stab'
*
* return pointer to ASCIIZ value on success
* return NULL on failure
*/
const char * sym_resolve (sym_elem **stab, char *key);
/* sym_free
*
* free a symbol table pointed to by `stab'
*
* return in any case
*/
void sym_free (sym_elem **stab);
#endif
|