aboutsummaryrefslogtreecommitdiffstats
path: root/moon-abe/pbc-0.5.14/misc/symtab.h
blob: 39f255c34e119ad0961ace0daef5c6ed87c1cac8 (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
#ifndef __PBC_SYMTAB_H__
#define __PBC_SYMTAB_H__

#include "darray.h"

#pragma GCC visibility push(hidden)

struct symtab_s {
    darray_t list;
};
typedef struct symtab_s symtab_t[1];
typedef struct symtab_s *symtab_ptr;

/*@manual symtab
Initialize symbol table 't'. Must be called before 't' is used.
*/
void symtab_init(symtab_t t);

/*@manual symtab
Clears symbol table 't'. Should be called after 't' is no longer needed.
*/
void symtab_clear(symtab_t t);

/*@manual symtab
Puts 'value' at 'key' in 't'.
*/
void symtab_put(symtab_t t, void *value, const char *key);

/*@manual symtab
Returns true if 't' contains key 'key'.
*/
int symtab_has(symtab_t t, const char *key);

/*@manual symtab
Returns pointer at key 'key' in 't'.
*/
void *symtab_at(symtab_t t, const char *key);

void symtab_forall_data(symtab_t t, void (*func)(void *));

#pragma GCC visibility pop

#endif //__PBC_SYMTAB_H__