mirror of
https://github.com/CPunch/Cosmo.git
synced 2026-02-02 01:00:02 +00:00
Minor table refactor, added cosmoV_compileString and loadstring() to baselib
cosmoV_compileString is recommended since it'll push the result (<error> or <closure>) onto the stack. also, fixed some GC-related bugs, so yay!
This commit is contained in:
@@ -13,20 +13,19 @@ typedef struct CTableEntry {
|
||||
|
||||
typedef struct CTable {
|
||||
int count;
|
||||
int capacity;
|
||||
int capacityMask; // +1 to get the capacity
|
||||
int tombstones;
|
||||
CTableEntry *table;
|
||||
} CTable;
|
||||
|
||||
COSMO_API void cosmoT_initTable(CState *state, CTable *tbl, int startCap);
|
||||
COSMO_API void cosmoT_clearTable(CState *state, CTable *tbl);
|
||||
COSMO_API void cosmoT_addTable(CState *state, CTable *from, CTable *to);
|
||||
COSMO_API int cosmoT_count(CTable *tbl);
|
||||
|
||||
bool cosmoT_checkShrink(CState *state, CTable *tbl);
|
||||
|
||||
CObjString *cosmoT_lookupString(CTable *tbl, const char *str, int length, uint32_t hash);
|
||||
COSMO_API CValue *cosmoT_insert(CState *state, CTable *tbl, CValue key);
|
||||
CValue *cosmoT_insert(CState *state, CTable *tbl, CValue key);
|
||||
bool cosmoT_get(CTable *tbl, CValue key, CValue *val);
|
||||
bool cosmoT_remove(CState *state, CTable *tbl, CValue key);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user