1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #ifndef STRINGINTMAP_H
- #define STRINGINTMAP_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <stdbool.h>
- #include "Check.h"
- #include "DataType.h"
- typedef enum { VE_OK, VE_CANNOT_FIND, VE_SIZE_ERROR } VariableError;
- typedef struct {
- int address;
- int entries;
- int scope;
- } Scope;
- typedef struct {
- const char* name;
- DataType type;
- int address;
- } Variable;
- typedef struct {
- int capacity;
- int entries;
- int address;
- int scope;
- Variable* data;
- int maxAddress;
- char padding[sizeof(Variable*) - sizeof(int)];
- } Variables;
- void vsInit(Variables* v);
- void vsDelete(Variables* v);
- check_return bool vsSearch(const Variables* vs, Variable* v, const char* s);
- check_return VariableError vSearchStruct(Variable* v, const Structs* sts,
- const Struct* st, const char* s);
- check_return bool vsInScope(const Variables* vs, const char* s);
- check_return VariableError vsAdd(Variables* vs, const char* s, DataType type,
- const Structs* sts, Variable** v);
- void vsReset(Variables* v);
- void vsEnterScope(Variables* v, Scope* s);
- void vsLeaveScope(Variables* v, const Scope* s);
- #ifdef __cplusplus
- }
- #endif
- #endif
|