improve symtab.h signature
This commit is contained in:
16
src/symtab.h
16
src/symtab.h
@@ -28,7 +28,6 @@ typedef struct LineListRec {
|
||||
*/
|
||||
typedef struct BucketListRec {
|
||||
char *name;
|
||||
TreeNode *treeNode;
|
||||
LineList lines;
|
||||
ExpType type;
|
||||
int memloc; /* memory location for variable */
|
||||
@@ -74,46 +73,35 @@ void insert_scope_to_list(Scope scope);
|
||||
* @return the current scope or NULL if the stack is empty
|
||||
*/
|
||||
Scope curr_scope(void);
|
||||
|
||||
/**
|
||||
* insert a variable into the symbol table
|
||||
* or update a variable if it already exists
|
||||
* @param scope_name name of the scope
|
||||
* @param name name of the variable
|
||||
* @param type type of the variable
|
||||
* @param treeNode syntax tree node
|
||||
* @param lineno line number of the variable
|
||||
* @param loc memory location of the variable
|
||||
* @return 0 if success, -1 if failure
|
||||
*/
|
||||
int st_try_insert(
|
||||
char *scope_name,
|
||||
char *name,
|
||||
ExpType type,
|
||||
TreeNode *treeNode,
|
||||
int loc);
|
||||
|
||||
int st_try_insert(char *name, ExpType type, int loc);
|
||||
/**
|
||||
* lookup a variable in the current scope
|
||||
* @param name name of the variable to lookup
|
||||
* @return the bucket list entry of the variable or NULL if not found
|
||||
*/
|
||||
BucketList st_lookup_current(char *name);
|
||||
|
||||
/**
|
||||
* lookup a variable from the given scope
|
||||
* lookup a variable from the given scope to root
|
||||
* @param name name of the variable to lookup
|
||||
* @return the bucket list entry of the variable or NULL if not found
|
||||
*/
|
||||
BucketList st_lookup(char *name);
|
||||
|
||||
/**
|
||||
* find a scope from the scope list
|
||||
* @param scope_name name of the scope to find
|
||||
* @return the scope or NULL if not found
|
||||
*/
|
||||
Scope find_scope(char *scope_name);
|
||||
|
||||
/**
|
||||
* Procedure printSymTab prints a formatted
|
||||
* listing of the symbol table contents
|
||||
|
||||
Reference in New Issue
Block a user