Changed the implementation of variable lists from linked lists to
hashtables, by changing the definitions of the VAR_xxx macros in script.h. The old macros are still there but disabled by a '#if' directive. The new macros do not yet work with the threaded version. Added hash.h and hash.c, containing structures and functions for manipulating hashtables. There is also code for garbage collection, but this is untested, and needs more changes to the interpreter (the way function arguments are stored) before it can be useful. The hashtable code can also be used to implement arrays, but there are no new commands for this yet. Removed the second (string) argument to VAR_FOUND. It was redundant, because a pointer to the variable name is already stored in the var_op_t structure. Introduced a few new macros for iterating through variable lists. Modified some functions to use the new (and old) macros, including ListVars(). Removed the function VAR_STR_GET, which has never been used, from script.h.
Showing
- src/Makefile 4 additions, 1 deletionsrc/Makefile
- src/hash.c 401 additions, 0 deletionssrc/hash.c
- src/hash.h 66 additions, 0 deletionssrc/hash.h
- src/main.c 3 additions, 0 deletionssrc/main.c
- src/proto.h 1 addition, 0 deletionssrc/proto.h
- src/script.c 25 additions, 20 deletionssrc/script.c
- src/script.h 85 additions, 27 deletionssrc/script.h
- src/script_inst.c 10 additions, 10 deletionssrc/script_inst.c
Loading
Please register or sign in to comment