Variables.h 836 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef STRINGINTMAP_H
  2. #define STRINGINTMAP_H
  3. #include <stdbool.h>
  4. #include "DataType.h"
  5. typedef struct {
  6. int address;
  7. int entries;
  8. int scope;
  9. } Scope;
  10. typedef struct {
  11. const char* name;
  12. DataType type;
  13. int address;
  14. } Variable;
  15. typedef struct {
  16. int capacity;
  17. int entries;
  18. int address;
  19. int scope;
  20. Variable* data;
  21. int maxAddress;
  22. } Variables;
  23. void vsInit(Variables* v);
  24. void vsDelete(Variables* v);
  25. bool vsSearch(const Variables* vs, Variable* v, const char* s);
  26. bool vSearchStruct(Variable* v, Structs* sts, Struct* st, const char* s);
  27. bool vsInScope(const Variables* vs, const char* s);
  28. Variable* vsAdd(Variables* v, const char* s, DataType type, Structs* sts);
  29. void vsReset(Variables* v);
  30. void vsEnterScope(Variables* v, Scope* s);
  31. void vsLeaveScope(Variables* v, Scope* s);
  32. #endif