-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtables.h
32 lines (27 loc) · 806 Bytes
/
tables.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
#ifndef TABLES_H_
#define TABLES_H_
struct HeapChain
{
struct HeapChain* next;
void* allocation;
size_t size;
int tag;
};
struct Symtable
{
struct Symtable* next;
char* symbol;
void* value;
};
extern struct HeapChain* heap;
extern struct Symtable* symtab;
void allocate_heap_chain(struct HeapChain** chain);
void allocate_symbtable(struct Symtable** table);
void* insert_heap_chain(struct HeapChain** chain, void* data, size_t size, int tag);
void dump_heap(struct HeapChain** chain);
void dump_heap_tag(struct HeapChain** chain, int tag);
void* allocate_memory(size_t size, int tag);
char* duplicate_string(const char* str);
char* get_symbol_value(struct Symtable** table, char* symbol, char* repl);
void insert_symbol(struct Symtable** table, char* symbol, void* value, size_t size);
#endif