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