Variables.h 721 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. 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 vInit(Variables* v);
  24. void vDelete(Variables* v);
  25. Variable* vSearch(Variables* v, const char* s);
  26. Variable* vSearchScope(Variables* v, const char* s);
  27. Variable* vAdd(Variables* v, const char* s, DataType type);
  28. void vReset(Variables* v);
  29. void vEnterScope(Variables* v, Scope* s);
  30. void vLeaveScope(Variables* v, Scope* s);
  31. #endif