var.h 974 B

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