now with generic hashmaps and array lists
This commit is contained in:
+5
-1
@@ -252,13 +252,17 @@ proc apply_arguments_to_function(Lisp_Object* arguments, Lisp_Object* function,
|
||||
filling it in
|
||||
*/
|
||||
proc create_arguments_from_lambda_list_and_inject(Lisp_Object* arguments, Lisp_Object* function) -> void {
|
||||
Arguments* result;;
|
||||
Arguments* result;
|
||||
if (Memory::get_type(function) == Lisp_Object_Type::CFunction) {
|
||||
result = &function->value.cFunction->args;
|
||||
} else {
|
||||
result = &function->value.function.args;
|
||||
}
|
||||
|
||||
::new ((&(result->positional.symbols))) Array_List<Lisp_Object*>;
|
||||
::new ((&(result->keyword.keywords))) Array_List<Lisp_Object*>;
|
||||
::new ((&(result->keyword.values))) Array_List<Lisp_Object*>;
|
||||
|
||||
// first init the fields
|
||||
// result->positional = create_positional_argument_list(16);
|
||||
// result->keyword = create_keyword_argument_list(16);
|
||||
|
||||
@@ -62,14 +62,6 @@ namespace Globals {
|
||||
Error* error = nullptr;
|
||||
}
|
||||
|
||||
bool hm_objects_match(char* a, char* b) {
|
||||
return strcmp(a, b) == 0;
|
||||
}
|
||||
|
||||
bool hm_objects_match(void* a, void* b) {
|
||||
return a == b;
|
||||
}
|
||||
|
||||
unsigned int hm_hash(void* ptr) {
|
||||
return ((unsigned long long)ptr * 2654435761) % 4294967296;
|
||||
}
|
||||
@@ -83,6 +75,14 @@ unsigned int hm_hash(char* str) {
|
||||
return value ^ i;
|
||||
}
|
||||
|
||||
bool hm_objects_match(char* a, char* b) {
|
||||
return strcmp(a, b) == 0;
|
||||
}
|
||||
|
||||
bool hm_objects_match(void* a, void* b) {
|
||||
return a == b;
|
||||
}
|
||||
|
||||
bool hm_objects_match(Lisp_Object* a, Lisp_Object* b) {
|
||||
return lisp_object_equal(a, b);
|
||||
}
|
||||
|
||||
+1
-1
Submodule src/ftb updated: e782aa70b7...dd7db5b330
+2
-10
@@ -24,19 +24,11 @@
|
||||
#include "./ftb/types.hpp"
|
||||
#include "./ftb/macros.hpp"
|
||||
#include "./ftb/profiler.hpp"
|
||||
|
||||
struct Lisp_Object;
|
||||
u32 hm_hash(Lisp_Object* obj);
|
||||
unsigned int hm_hash(char* obj);
|
||||
unsigned int hm_hash(void* obj);
|
||||
bool hm_objects_match(void* a, void* b);
|
||||
bool hm_objects_match(char* a, char* b);
|
||||
bool hm_objects_match(Lisp_Object* a, Lisp_Object* b);
|
||||
|
||||
#include "./ftb/hashmap.hpp"
|
||||
#include "./ftb/arraylist.hpp"
|
||||
|
||||
namespace Slime {
|
||||
#include "./ftb/hashmap.hpp"
|
||||
|
||||
# include "./defines.cpp"
|
||||
# include "./platform.cpp"
|
||||
# include "./structs.cpp"
|
||||
|
||||
+1
-3
@@ -33,9 +33,7 @@ enum struct Lisp_Object_Type {
|
||||
CFunction,
|
||||
};
|
||||
|
||||
typedef uint64_t u64;
|
||||
|
||||
enum class Lisp_Object_Flags : u64
|
||||
enum class Lisp_Object_Flags
|
||||
{
|
||||
// bits 1 to 5 (including) will be reserved for the type
|
||||
Already_Garbage_Collected = 1 << 5,
|
||||
|
||||
Reference in New Issue
Block a user