var.h 1.2 KB

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