46 lines
895 B
C
46 lines
895 B
C
#ifndef TABLE_H
|
|
#define TABLE_H
|
|
|
|
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
|
|
enum enumVarType {INT, FLOAT}; // a adapter
|
|
/*defined constants*/
|
|
#define START_TABLE_SIZE 128;
|
|
|
|
/*indexes in the array*/
|
|
static int currentIndex; // the next to index to be used
|
|
static int maxIndex;
|
|
static symbol* symbolTable;
|
|
|
|
// stack pointers
|
|
static int esp;
|
|
static int ebp;
|
|
|
|
static int currentDepth;
|
|
|
|
typedef struct {
|
|
char* name;
|
|
bool init;
|
|
enumVarType varType;
|
|
int offset;
|
|
int depth;
|
|
} Symbol;
|
|
|
|
// TODO : move comments here
|
|
|
|
void reallocateArray(int size);
|
|
void checkArraySanity();
|
|
void suppressElement(int index);
|
|
int initOffset(int index);
|
|
void addElement(Symbol element);
|
|
void toggleInit(char *name);
|
|
int getIndex(char* name);
|
|
Symbol getStruct(char* name);
|
|
void error(char* mess);
|
|
int getOffset(char* name);
|
|
void clearOutOfScopeVariable();
|
|
void increaseDepth();
|
|
void decreaseDepth();
|
|
|
|
#endif
|