This commit is contained in:
2026-01-16 03:20:38 -08:00
parent e0d8693840
commit 94d5749d31
19 changed files with 1358 additions and 3 deletions

26
src/hashtable.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef INCLUDED_HASHTABLE_H
#define INCLUDED_HASHTABLE_H
#include "base.h"
struct HashTableBucket {
uintptr_t hash;
LispVal *key;
LispVal *value;
};
DEFOBJTYPE(HashTable, HASH_TABLE, HASH_TABLE_P, {
LispVal *hash_fn;
LispVal *eq_fn;
struct HashTableBucket *data;
size_t size;
size_t count;
});
DECLARE_FUNCTION(make_hash_table, (LispVal * hash_fn, LispVal *eq_fn));
DECLARE_FUNCTION(gethash, (LispVal * ht, LispVal *key, LispVal *def));
DECLARE_FUNCTION(puthash, (LispVal * ht, LispVal *key, LispVal *val));
DECLARE_FUNCTION(remhash, (LispVal * ht, LispVal *key));
DECLARE_FUNCTION(hash_table_count, (LispVal * ht));
#endif