-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsymset.h
39 lines (31 loc) · 1.16 KB
/
symset.h
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
/* symset.h: Copyright (C) 2011-2022 by Brian Raiter <breadbox@muppetlabs.com>
* License GPLv2+: GNU GPL version 2 or later.
*/
#ifndef _symset_h_
#define _symset_h_
/*
* A symset is an unordered set of symbols, which in turn are id/value
* pairs, the ids being macro names. The strings representing the ids
* are not copied by the symset objects; the caller retains ownership.
*/
#include "types.h"
/* Creates an empty set of symbols.
*/
extern symset *initsymset(void);
/* Deallocates the set of symbols.
*/
extern void freesymset(symset *set);
/* Adds a symbol to the set.
*/
extern void addsymboltoset(symset *set, char const *id, long value);
/* Finds a symbol in a set. id points to an identifier, typically not
* NUL-delimited but embedded within a larger string. The return value
* is true if a symbol with that name is a member of the set. If value
* is not NULL, it receives the found symbol's value.
*/
extern int findsymbolinset(symset const *set, char const *id, long *value);
/* Removes a symbol from the set. The return value is false if the
* symbol was not a member of the set.
*/
extern int removesymbolfromset(symset *set, char const *id);
#endif