mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Add new_symbol_type to ease creation of typed symbols.
This is inteded for code generation functions that need to create variables and structures.
This commit is contained in:
parent
ffea505678
commit
537b930ba6
2 changed files with 20 additions and 0 deletions
|
@ -71,6 +71,17 @@ typedef struct symtab_s {
|
|||
*/
|
||||
symbol_t *new_symbol (const char *name);
|
||||
|
||||
/** Create a new, typed, named symbol.
|
||||
|
||||
Only the symbol name and type fields will be filled in. \a name will
|
||||
be copied using save_string().
|
||||
|
||||
\param name The name of the symbol.
|
||||
\param type The type of the symbol.
|
||||
\return The new symbol.
|
||||
*/
|
||||
symbol_t *new_symbol_type (const char *name, struct type_s *type);
|
||||
|
||||
/** Create a new, empty symbol table.
|
||||
|
||||
The symbol tables support scoping via their \c parent pointer. This
|
||||
|
|
|
@ -22,6 +22,15 @@ new_symbol (const char *name)
|
|||
return symbol;
|
||||
}
|
||||
|
||||
symbol_t *
|
||||
new_symbol_type (const char *name, type_t *type)
|
||||
{
|
||||
symbol_t *symbol;
|
||||
symbol = new_symbol (name);
|
||||
symbol->type = type;
|
||||
return symbol;
|
||||
}
|
||||
|
||||
static const char *
|
||||
sym_getkey (void *k, void *unused)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue