| @@ -16,11 +16,11 @@ stages: | |||||
| build_clang++_d: | build_clang++_d: | ||||
| image: warchantua/dev-essential | image: warchantua/dev-essential | ||||
| stage: build_debug | stage: build_debug | ||||
| script: clang++ -D_DEBUG -D_DONT_BREAK_ON_ERRORS src/main.cpp -gfull -gdwarf -o ./bin/slime_d --std=c++17 -I3rd/ | |||||
| script: clang++ -D_DEBUG -D_DONT_BREAK_ON_ERRORS src/main.cpp -gfull -gdwarf -o ./bin/slime_d --std=c++17 -I3rd/ | |||||
| build_g++_d: | build_g++_d: | ||||
| stage: build_debug | stage: build_debug | ||||
| script: g++ -D_DEBUG -D_DONT_BREAK_ON_ERRORS src/main.cpp -g -o ./bin/slime_d --std=c++17 -I3rd/ | |||||
| script: g++ -D_DEBUG -D_DONT_BREAK_ON_ERRORS src/main.cpp -g -o ./bin/slime_d --std=c++17 -I3rd/ | |||||
| build_clang++_r: | build_clang++_r: | ||||
| image: warchantua/dev-essential | image: warchantua/dev-essential | ||||
| @@ -33,13 +33,13 @@ build_g++_r: | |||||
| tests_d: | tests_d: | ||||
| stage: test | stage: test | ||||
| script: ./bin/sime_d --run-tests | |||||
| script: ./bin/slime_d --run-tests | |||||
| tests_r: | tests_r: | ||||
| stage: test | stage: test | ||||
| script: ./bin/sime --run-tests | |||||
| script: ./bin/slime --run-tests | |||||
| valgrind: | valgrind: | ||||
| image: warchantua/dev-essential | image: warchantua/dev-essential | ||||
| stage: test | stage: test | ||||
| script: valgrind ./bin/sime --run-tests | |||||
| script: valgrind ./bin/slime --run-tests | |||||
| @@ -71,10 +71,10 @@ namespace Slime { | |||||
| proc built_in_load(String file_name) -> Lisp_Object* { | proc built_in_load(String file_name) -> Lisp_Object* { | ||||
| profile_with_comment(file_name.data); | profile_with_comment(file_name.data); | ||||
| char* file_content; | char* file_content; | ||||
| path_char fullpath[MAX_PATH]; | |||||
| path_char fullpath[max_path_len]; | |||||
| #ifdef UNICODE | #ifdef UNICODE | ||||
| path_char* temp = char_to_path_char(Memory::get_c_str(file_name)); | path_char* temp = char_to_path_char(Memory::get_c_str(file_name)); | ||||
| swprintf(fullpath, MAX_PATH,L"%s", temp); | |||||
| swprintf(fullpath, max_path_len,L"%s", temp); | |||||
| file_content = read_entire_file(temp); | file_content = read_entire_file(temp); | ||||
| free(temp); | free(temp); | ||||
| #else | #else | ||||
| @@ -89,7 +89,7 @@ namespace Slime { | |||||
| #ifdef UNICODE | #ifdef UNICODE | ||||
| fullpath[0] = L'\0'; | fullpath[0] = L'\0'; | ||||
| path_char* temp = char_to_path_char(Memory::get_c_str(file_name)); | path_char* temp = char_to_path_char(Memory::get_c_str(file_name)); | ||||
| swprintf(fullpath, MAX_PATH, L"%s%s", it, temp); | |||||
| swprintf(fullpath, max_path_leno, L"%s%s", it, temp); | |||||
| free(temp); | free(temp); | ||||
| #else | #else | ||||
| fullpath[0] = '\0'; | fullpath[0] = '\0'; | ||||
| @@ -356,7 +356,7 @@ namespace Slime { | |||||
| if (abs(node->value.number - (s32)node->value.number) < 0.000001f) | if (abs(node->value.number - (s32)node->value.number) < 0.000001f) | ||||
| asprintf(&temp, "%d", (s32)node->value.number); | asprintf(&temp, "%d", (s32)node->value.number); | ||||
| else | else | ||||
| asprintf(&temp, "%f", node->value.number); | |||||
| asprintf(&temp, "%Lf", node->value.number); | |||||
| return temp; | return temp; | ||||
| } | } | ||||
| case (Lisp_Object_Type::Keyword): { | case (Lisp_Object_Type::Keyword): { | ||||
| @@ -17,6 +17,7 @@ | |||||
| # include <direct.h> | # include <direct.h> | ||||
| # include <windows.h> | # include <windows.h> | ||||
| #else | #else | ||||
| # include <limits.h> | |||||
| # include <unistd.h> | # include <unistd.h> | ||||
| # include <signal.h> | # include <signal.h> | ||||
| #endif | #endif | ||||
| @@ -126,8 +126,12 @@ namespace Slime::Memory { | |||||
| free(value); | free(value); | ||||
| } | } | ||||
| // free the exe dir: | |||||
| free(Globals::load_path.data[0]); | |||||
| // free paths in load path | |||||
| for (u32 i = 0; i < Globals::load_path.next_index; ++i) { | |||||
| free(Globals::load_path.data[i]); | |||||
| } | |||||
| Globals::load_path.dealloc(); | Globals::load_path.dealloc(); | ||||
| Globals::user_types.dealloc(); | Globals::user_types.dealloc(); | ||||
| Globals::docs.dealloc(); | Globals::docs.dealloc(); | ||||
| @@ -1,5 +1,12 @@ | |||||
| namespace Slime { | namespace Slime { | ||||
| #ifdef SLIME_WINDOWS | |||||
| constexpr u32 max_path_len = MAX_PATH; | |||||
| #else | |||||
| constexpr u32 max_path_len = PATH_MAX; | |||||
| #endif | |||||
| inline proc get_cwd() -> char* { | inline proc get_cwd() -> char* { | ||||
| const u32 buf_size = 2048; | const u32 buf_size = 2048; | ||||
| char* res = (char*)malloc(buf_size * sizeof(char)); | char* res = (char*)malloc(buf_size * sizeof(char)); | ||||
| @@ -46,13 +46,13 @@ namespace Slime { | |||||
| } \ | } \ | ||||
| #define assert_equal_f64(variable, value) \ | #define assert_equal_f64(variable, value) \ | ||||
| if (fabs((f64)variable - (f64)value) > epsilon) { \ | |||||
| if (fabsl((f64)variable - (f64)value) > epsilon) { \ | |||||
| print_assert_equal_fail(variable, value, f64, "%Lf"); \ | print_assert_equal_fail(variable, value, f64, "%Lf"); \ | ||||
| return fail; \ | return fail; \ | ||||
| } | } | ||||
| #define assert_not_equal_f64(variable, value) \ | #define assert_not_equal_f64(variable, value) \ | ||||
| if (fabs((f64)variable - (f64)value) <= epsilon) { \ | |||||
| if (fabsl((f64)variable - (f64)value) <= epsilon) { \ | |||||
| print_assert_not_equal_fail(variable, value, f64, "L%f"); \ | print_assert_not_equal_fail(variable, value, f64, "L%f"); \ | ||||
| return fail; \ | return fail; \ | ||||
| } | } | ||||