var.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef VIRTUALMATH_VAR_H
  2. #define VIRTUALMATH_VAR_H
  3. #define MAX_SIZE (1024)
  4. struct Var{
  5. GCStatus gc_status;
  6. char *name;
  7. struct LinkValue *value;
  8. struct LinkValue *name_;
  9. struct Var *next;
  10. struct Var *gc_next;
  11. struct Var *gc_last;
  12. };
  13. struct HashTable{
  14. GCStatus gc_status;
  15. struct Var **hashtable;
  16. struct HashTable *gc_next;
  17. struct HashTable *gc_last;
  18. };
  19. struct VarList{
  20. struct HashTable *hashtable;
  21. struct VarList *next;
  22. };
  23. typedef struct Var Var;
  24. typedef struct HashTable HashTable;
  25. typedef struct VarList VarList;
  26. Var *makeVar(char *name, LinkValue *value, LinkValue *name_, Inter *inter);
  27. void freeVar(Var **var);
  28. HashTable *makeHashTable(Inter *inter);
  29. void freeHashTable(HashTable **value);
  30. VarList *makeVarList(Inter *inter);
  31. VarList *freeVarList(VarList *vl, bool self);
  32. HASH_INDEX time33(char *key);
  33. LinkValue *findVar(char *name, bool del_var, INTER_FUNCTIONSIG_CORE);
  34. LinkValue *findFromVarList(char *name, NUMBER_TYPE times, bool del_var, INTER_FUNCTIONSIG_CORE);
  35. void addVar(char *name, LinkValue *value, LinkValue *name_, INTER_FUNCTIONSIG_CORE);
  36. void updateHashTable(HashTable *update, HashTable *new, Inter *inter);
  37. void addFromVarList(char *name, LinkValue *name_, NUMBER_TYPE times, LinkValue *value, INTER_FUNCTIONSIG_CORE);
  38. VarList *pushVarList(VarList *base, Inter *inter);
  39. VarList *popVarList(VarList *base);
  40. VarList *copyVarList(VarList *base, bool n_new, Inter *inter);
  41. VarList *connectVarListBack(VarList *base, VarList *back);
  42. bool comparVarList(VarList *dest, VarList *src);
  43. VarList *connectSafeVarListBack(VarList *base, VarList *back);
  44. VarList *makeObjectVarList(FatherValue *value, Inter *inter);
  45. #endif //VIRTUALMATH_VAR_H