-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshul_ident.h
38 lines (27 loc) · 1.09 KB
/
shul_ident.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
/* shul_ident.h - header for shullivan identifier lookup tables */
#ifndef __INCshul_identh
#define __INCshul_identh
#include <stddef.h>
#include "map.h"
typedef struct _IDENT {
int idlen;
int refcount;
char name [1]; /* Actually variable length, nul terminated */
} IDENT;
#define IDENT_LEN(stringlen) ((stringlen) + 1 + offsetof(IDENT, name))
#define NAME2ID(nadr) ((IDENT *)((char *)(nadr) - offsetof(IDENT,name)))
/*
* An IDENT_TABLE is MAPPING in which each domain element is
* an identifier name; the identifier itself is located with NAME2ID.
* The type of the range element varies with the table usage.
* strcmp() is used as the comparsion function.
*/
typedef MAPPING IDENT_TABLE;
extern IDENT_TABLE * allIdents; /* Debug, treat as read only! */
extern unsigned long numIdents; /* Debug, number of IDENTs in use */
extern int shulIdentInit (void);
extern void identTableDelete (IDENT_TABLE * table);
extern IDENT * identAlloc (char * buf, int buflen);
extern int identFree (IDENT * id);
extern IDENT * identPrefixed (char * prefix, int pfxlen, IDENT * id);
#endif /* __INCshul_identh */