Initial commit
This commit is contained in:
commit
b2edca2cb4
25 changed files with 3590 additions and 0 deletions
29
table.h
Normal file
29
table.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef clox_table_h
|
||||
#define clox_table_h
|
||||
|
||||
#include "common.h"
|
||||
#include "value.h"
|
||||
|
||||
typedef struct {
|
||||
ObjString* key;
|
||||
Value value;
|
||||
} Entry;
|
||||
|
||||
typedef struct {
|
||||
int count;
|
||||
int capacity;
|
||||
Entry* entries;
|
||||
} Table;
|
||||
|
||||
void initTable(Table* table);
|
||||
void freeTable(Table* table);
|
||||
bool tableGet(Table* table, ObjString* key, Value* value);
|
||||
bool tableSet(Table* table, ObjString* key, Value value);
|
||||
bool tableDelete(Table* table, ObjString* key);
|
||||
void tableAddAll(Table* from, Table* to);
|
||||
ObjString* tableFindString(Table* table, const char* chars, int length, uint32_t hash);
|
||||
void tableRemoveWhite(Table* table);
|
||||
void markTable(Table* table);
|
||||
|
||||
#endif // clox_table_h
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue