File: symbol.h

package info (click to toggle)
c2man 2.41-10
  • links: PTS
  • area: main
  • in suites: slink
  • size: 788 kB
  • ctags: 863
  • sloc: ansic: 6,559; sh: 5,095; yacc: 839; lex: 621; makefile: 226; perl: 81
file content (41 lines) | stat: -rw-r--r-- 976 bytes parent folder | download | duplicates (6)
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
/* $Id: symbol.h,v 2.0.1.2 1993/08/31 05:04:35 greyham Exp $
 *
 * Definitions for a symbol table
 */
#include "config.h"

#ifndef _SYMBOL_H
#define _SYMBOL_H

typedef struct _symbol {
    struct _symbol *next;	/* next symbol in list */
    char *name;			/* name of symbol */
    unsigned short flags;	/* symbol attributes */

	enum { SYMVAL_NONE, SYMVAL_ENUM } valtype;
	
	union {
	    struct _enumerator_list *enum_list;
	} value;
} Symbol;

/* The hash table length should be a prime number. */
#define SYM_MAX_HASH 251

typedef struct _symbol_table {
	Symbol *bucket[SYM_MAX_HASH];	/* hash buckets */
} SymbolTable;

/* Create symbol table */
extern SymbolTable *create_symbol_table();

/* destroy symbol table */
extern void destroy_symbol_table _((SymbolTable *symtab));

/* Lookup symbol name */
extern Symbol *find_symbol _((SymbolTable *symtab, char *name));

/* Define new symbol */
extern Symbol *new_symbol _((SymbolTable *symtab, char *name, int flags));

#endif