-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathScope.h
52 lines (42 loc) · 1.23 KB
/
Scope.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#include "Enum.h"
#include "Function.h"
#include "GenericList.h"
#include "Struct.h"
#include "Variables.h"
#include <string.h>
#ifndef CUSTOM_COMP
typedef struct Scope Scope;
#endif
#ifdef CUSTOM_COMP
struct Scope;
#endif
typedef struct
{
VariableType* type;
const char* name;
} Typedef;
typedef struct Scope
{
Scope* parent;
GenericList variables;
GenericList structs;
GenericList enums;
GenericList typedefs;
uint16_t preferredRegisters[8];
} Scope;
Scope Scope_Create(Scope* parent);
void Scope_Dispose(Scope* this);
bool Scope_NameIsUsed(Scope* this, char* id);
void Scope_DeleteVariable(Scope* this, Variable* var);
void Scope_DeleteVariablesAfterLoop(Scope* this, void* loop);
bool CompareVariableToID(const void* variable, const void* identifier);
Variable* Scope_FindVariable(Scope* this, char* id);
Variable* Scope_FindVariableByValue(Scope* this, Value* val);
Struct* Scope_FindStruct(Scope* this, char* id);
Enum* Scope_FindEnum(Scope* this, char* id);
Typedef* Scope_FindTypedef(Scope* this, char* id);
void Scope_AddVariable(Scope* this, Variable var);
void Scope_AddStruct(Scope* this, Struct* s);
void Scope_AddEnum(Scope* this, Enum e);
void Scope_AddTypedef (Scope* this, Typedef t);