28 lines
627 B
C
28 lines
627 B
C
#ifndef TABLE_H
|
|
#define 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 *talbe, const char *chars, int length,
|
|
uint32_t hash);
|
|
void markTable(Table *table);
|
|
|
|
#endif
|