|
|
|
@@ -2,12 +2,41 @@ struct Lisp_Object; |
|
|
|
struct String; |
|
|
|
struct Environment; |
|
|
|
|
|
|
|
// ARRAY LISTS |
|
|
|
define_array_list(Lisp_Object*, Lisp_Object); |
|
|
|
define_array_list(Environment*, Environment); |
|
|
|
define_array_list(String*, String); |
|
|
|
define_array_list(int, Int); |
|
|
|
define_array_list(void*, Void_Ptr); |
|
|
|
|
|
|
|
// HASH MAPS |
|
|
|
inline bool hm_objects_match(char* a, char* b) { |
|
|
|
return strcmp(a, b) == 0; |
|
|
|
} |
|
|
|
|
|
|
|
inline bool hm_objects_match(void* a, void* b) { |
|
|
|
return a == b; |
|
|
|
} |
|
|
|
|
|
|
|
u32 hm_hash(void* ptr) { |
|
|
|
return ((unsigned long long)ptr * 2654435761) % 4294967296; |
|
|
|
} |
|
|
|
|
|
|
|
u32 hm_hash(char* str) { |
|
|
|
u32 value = str[0] << 7; |
|
|
|
int i = 0; |
|
|
|
while (str[i]) { |
|
|
|
value = (10000003 * value) ^ str[i++]; |
|
|
|
} |
|
|
|
return value ^ i; |
|
|
|
} |
|
|
|
|
|
|
|
define_hash_map(char*, String); |
|
|
|
define_hash_map(void*, Void_Ptr); |
|
|
|
#define for_str_hash_map(hm) __for_hm_generator(char*, hm) |
|
|
|
#define for_ptr_hash_map(hm) __for_hm_generator(void*, hm) |
|
|
|
|
|
|
|
// STRUCTS |
|
|
|
enum struct Thread_Type { |
|
|
|
Main, |
|
|
|
GarbageCollection |
|
|
|
@@ -111,7 +140,7 @@ struct Arguments { |
|
|
|
|
|
|
|
struct Environment { |
|
|
|
Environment_Array_List parents; |
|
|
|
StringHashMap* hm; |
|
|
|
String_Hash_Map* hm; |
|
|
|
// int capacity; |
|
|
|
// int next_index; |
|
|
|
|
|
|
|
|