var.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef VIRTUALMATH_VAR_H
  2. #define VIRTUALMATH_VAR_H
  3. #include "inter.h"
  4. #include "value.h"
  5. #define MAX_SIZE (1024)
  6. typedef struct VirtualMathVar{
  7. char *name;
  8. struct VirtualMathLinkValue *value;
  9. struct VirtualMathVar *next;
  10. } Var;
  11. typedef struct VirtualMathHashTable{
  12. struct VirtualMathVar **hashtable;
  13. int count;
  14. struct VirtualMathHashTable *next;
  15. struct VirtualMathHashTable *last;
  16. } HashTable;
  17. typedef struct VirtualMathVarList{
  18. struct VirtualMathHashTable *hashtable;
  19. struct VirtualMathVarList *next;
  20. } VarList;
  21. VarList *makeVarList(Inter *inter);
  22. VarList *freeVarList(VarList *vl, bool self);
  23. LinkValue *findFromVarList(char *name, VarList *var_list, NUMBER_TYPE times);
  24. void addFromVarList(char *name, VarList *var_list, NUMBER_TYPE times, LinkValue *value);
  25. void freeHashTable(HashTable *ht, Inter *inter);
  26. VarList *pushVarList(VarList *base, Inter *inter);
  27. VarList *popVarList(VarList *base, Inter *inter);
  28. VarList *copyVarList(VarList *base, bool n_new, Inter *inter);
  29. #endif //VIRTUALMATH_VAR_H