4 * Basic symbol and namespace definitions.
6 * Copyright (C) 2003 Linus Torvalds, all rights reserved.
12 * An identifier with semantic meaning is a "symbol".
14 * There's a 1:n relationship: each symbol is always
15 * associated with one identifier, while each identifier
16 * can have one or more semantic meanings due to C scope
19 * The progression is symbol -> token -> identifier. The
20 * token contains the information on where the symbol was
48 unsigned long modifiers
;
49 struct symbol
*base_type
;
53 enum namespace namespace:8;
55 struct token
*token
; /* Where this symbol was declared */
56 struct token
*ident
; /* What identifier this symbol is associated with */
57 struct symbol
*next_id
; /* Next semantic symbol that shares this identifier */
58 struct symbol
**id_list
; /* Backpointer to symbol list head */
60 struct preprocessor_sym
{
62 struct token
*expansion
;
63 struct token
*arglist
;
66 struct symbol
*next
; /* Next symbol at this level */
69 struct symbol_list
*arguments
;
70 struct statement
*stmt
;
71 struct symbol_list
*symbol_list
;
77 #define SYM_AUTO 0x0001
78 #define SYM_REGISTER 0x0002
79 #define SYM_STATIC 0x0004
80 #define SYM_EXTERN 0x0008
82 #define SYM_CONST 0x0010
83 #define SYM_VOLATILE 0x0020
84 #define SYM_SIGNED 0x0040
85 #define SYM_UNSIGNED 0x0080
87 #define SYM_CHAR 0x0100
88 #define SYM_SHORT 0x0200
89 #define SYM_LONG 0x0400
90 #define SYM_LONGLONG 0x0800
92 #define SYM_TYPEDEF 0x1000
93 #define SYM_STRUCTOF 0x2000
94 #define SYM_UNIONOF 0x4000
95 #define SYM_ENUMOF 0x8000
97 #define SYM_TYPEOF 0x10000
98 #define SYM_ATTRIBUTE 0x20000
101 extern struct symbol void_type
,
107 /* Basic identifiers */
108 extern struct ident sizeof_ident
,
125 extern struct ident __asm___ident
,
134 #define symbol_is_typename(sym) ((sym)->type == SYM_TYPE)
136 extern struct symbol
*lookup_symbol(struct ident
*, enum namespace);
137 extern void init_symbols(void);
138 extern struct symbol
*alloc_symbol(struct token
*, int type
);
139 extern void show_type(struct symbol
*);
140 extern const char *modifier_string(unsigned long mod
);
141 extern void show_symbol(struct symbol
*);
142 extern void show_type_list(struct symbol
*);
143 extern void show_symbol_list(struct symbol_list
*, const char *);
144 extern void add_symbol(struct symbol_list
**, struct symbol
*);
145 extern void bind_symbol(struct symbol
*, struct ident
*, enum namespace);
147 #endif /* SEMANTIC_H */