diff options
Diffstat (limited to 'cscmd/symtab.h')
-rw-r--r-- | cscmd/symtab.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/cscmd/symtab.h b/cscmd/symtab.h new file mode 100644 index 0000000..5019569 --- /dev/null +++ b/cscmd/symtab.h @@ -0,0 +1,67 @@ + +#ifndef __SYMTAB_H +#define __SYMTAB_H + + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************** + SYMBOL is a node of symlist: + */ +typedef struct symbol SYMBOL; +struct symbol +{ + char *name; /* Variable name */ + int type; /* VARIABLE, SECTION, REPO, NUMERICAL, STRING, PATH */ + union + { + int value; /* for NUMERICAL */ + char *string; /* for STRING */ + char *path; /* for PATH */ + } u; + + struct symbol *list; /* The list of variables. Used for SECTION and REPO */ + + struct symbol *next; /* Next Symbol */ +}; + +/********************************************** + SYMTAB is an entry of the stack of symlists: + */ +typedef struct symtab SYMTAB; +struct symtab +{ + SYMBOL **symlist; + struct symtab *next; /* Next Entry */ +}; + + +extern SYMBOL *symlist; + +extern void init_symtab( void ); +extern void push_symlist( SYMBOL **head ); +extern void pop_symlist( void ); +extern void fini_symtab( void ); + +extern void reverse_symlist( SYMBOL **head ); +extern void remove_consts( SYMBOL **head ); + +//debug +extern void print_symlist( int indent, SYMBOL *head ); + +extern SYMBOL *install( const char *s, int type, ... ); +extern SYMBOL *lookup( const char *s ); +extern SYMBOL *lookup_section( const char *s ); +extern SYMBOL *lookup_repo( const char *s ); + +extern SYMBOL *assign_value( SYMBOL *dest, SYMBOL *src ); + + + +#ifdef __cplusplus +} +#endif + +#endif /* __SYMTAB_H */ |