30 lines
608 B
C
30 lines
608 B
C
#ifndef SYMBOLSTABLE_H
|
|
#define SYMBOLSTABLE_H
|
|
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#define SYMBOLSTABLE_DEFAULT_CAPACITY 128
|
|
|
|
typedef struct {
|
|
void* Value;
|
|
char* Name;
|
|
int Length;
|
|
int Resolved;
|
|
} Symbol;
|
|
|
|
typedef struct {
|
|
Symbol** Symbols;
|
|
int Size;
|
|
int Capacity;
|
|
} SymbolTable;
|
|
|
|
SymbolTable* CreateSymbolTable(void);
|
|
Symbol* TryGetSymbol(char* name, SymbolTable* table);
|
|
Symbol* AddSymbolToTable(char* name, void* value, int length, SymbolTable* table);
|
|
void FreeSymbolTable(SymbolTable* table);
|
|
void FreeSymbol(Symbol* symbol);
|
|
|
|
#endif |