diff --git a/src/main.cpp b/src/main.cpp index 67a7393..bead382 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,19 +1,17 @@ #include "slime.h" -// using namespace Slime; - int main(int argc, char* argv[]) { if (argc > 1) { - if (string_equal(argv[1], "--run-tests")) { - return run_all_tests() ? 0 : 1; + if (Slime::string_equal(argv[1], "--run-tests")) { + return Slime::run_all_tests() ? 0 : 1; } - interprete_file(argv[1]); - if (Globals::error) { - log_error(); + Slime::interprete_file(argv[1]); + if (Slime::Globals::error) { + Slime::log_error(); return 1; } } else { - interprete_stdin(); + Slime::interprete_stdin(); } } diff --git a/src/memory.cpp b/src/memory.cpp index 7e3d85f..3446346 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -53,14 +53,14 @@ namespace Memory { inline proc get_type(Lisp_Object* node) -> Lisp_Object_Type { // the type is in the bits 0 to 5 (including) - return (Lisp_Object_Type) ((u64)node->flags & (u64)0xffffff); + return (Lisp_Object_Type) ((u64)node->flags & (u64)0b11111); } inline proc set_type(Lisp_Object* node, Lisp_Object_Type type) { // the type is in the bits 0 to 5 (including) u64 bitmask = (u64)-1; - bitmask -= 0xffffff; + bitmask -= 0b11111; bitmask += (u64) type; node->flags = (u64)(node->flags) | bitmask; } @@ -132,6 +132,7 @@ namespace Memory { index = free_spots_in_object_memory->data[free_spots_in_object_memory->next_index--]; } Lisp_Object* object = object_memory+index; + object->flags = 0; object->sourceCodeLocation = nullptr; object->userType = nullptr; return object; diff --git a/src/slime.h b/src/slime.h index e8db174..9e32f1a 100644 --- a/src/slime.h +++ b/src/slime.h @@ -12,7 +12,7 @@ #undef _CRT_SECURE_NO_DEPRECATE #undef _CRT_SECURE_NO_WARNINGS -// namespace Slime { +namespace Slime { # include "./defines.cpp" # include "./structs.cpp" # include "./forward_decls.cpp" @@ -26,4 +26,4 @@ # include "./built_ins.cpp" # include "./testing.cpp" # include "./undefines.cpp" -// } +}