Skip to content

Commit a02019a

Browse files
authored
Add table.h header file with table structure and functions
1 parent 163b4d8 commit a02019a

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

include/table.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* include/table.h */
2+
#ifndef PROXPL_TABLE_H
3+
#define PROXPL_TABLE_H
4+
5+
#include "common.h"
6+
#include "value.h"
7+
8+
typedef struct {
9+
ObjString* key;
10+
Value value;
11+
} Entry;
12+
13+
typedef struct {
14+
int count;
15+
int capacity;
16+
Entry* entries;
17+
} Table;
18+
19+
void initTable(Table* table);
20+
void freeTable(Table* table);
21+
bool tableGet(Table* table, ObjString* key, Value* value);
22+
bool tableSet(Table* table, ObjString* key, Value value);
23+
bool tableDelete(Table* table, ObjString* key);
24+
void tableAddAll(Table* from, Table* to);
25+
ObjString* tableFindString(Table* table, const char* chars, int length, uint32_t hash);
26+
27+
#endif
28+

0 commit comments

Comments
 (0)