Variables.h 905 B

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