fixed import bug
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
(define a 10)
|
(define a 1111)
|
||||||
|
|
||||||
(define (get-a-1) a)
|
(define (get-a-1) a)
|
||||||
|
|||||||
@@ -1,27 +1,20 @@
|
|||||||
(import "tests/import1.slime")
|
(import "tests/import1.slime")
|
||||||
|
|
||||||
(print)
|
(assert (= a 1111))
|
||||||
(print ">" a)
|
(assert (= (get-a-1) 1111))
|
||||||
(assert (= a 10))
|
|
||||||
(print ">" (get-a-1))
|
|
||||||
(assert (= (get-a-1) 10))
|
|
||||||
|
|
||||||
|
|
||||||
(import "tests/import2.slime")
|
(import "tests/import2.slime")
|
||||||
|
|
||||||
(print ">" a)
|
|
||||||
(assert (= a 10))
|
(assert (= a 1111))
|
||||||
(print ">" (get-a-1))
|
(assert (= (get-a-1) 1111))
|
||||||
(assert (= (get-a-1) 10))
|
(assert (= (get-a-2) 1111))
|
||||||
(print ">" (get-a-2))
|
|
||||||
(assert (= (get-a-2) 10))
|
|
||||||
|
|
||||||
(set-a-2 11)
|
(set-a-2 11)
|
||||||
(print "> should be 11 from now on")
|
|
||||||
|
|
||||||
(print ">" a)
|
|
||||||
(assert (= a 11))
|
(assert (= a 11))
|
||||||
(print ">" (get-a-1))
|
|
||||||
(assert (= (get-a-1) 11))
|
(assert (= (get-a-1) 11))
|
||||||
(print ">" (get-a-2))
|
|
||||||
(assert (= (get-a-2) 11))
|
(assert (= (get-a-2) 11))
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
namespace Slime {
|
||||||
proc generate_docs(String* path) -> void {
|
proc generate_docs(String* path) -> void {
|
||||||
FILE *f = fopen(Memory::get_c_str(path), "w");
|
FILE *f = fopen(Memory::get_c_str(path), "w");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
@@ -142,3 +143,4 @@ proc generate_docs(String* path) -> void {
|
|||||||
|
|
||||||
print_this_env(print_this_env, get_current_environment(), (char*)"");
|
print_this_env(print_this_env, get_current_environment(), (char*)"");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
+5
-5
@@ -97,11 +97,11 @@ namespace Slime {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// if(env == get_root_environment()) {
|
if(env == get_root_environment()) {
|
||||||
// print_indent(indent);
|
print_indent(indent);
|
||||||
// printf("[built-ins]-Environment (%lld)\n", (long long)env);
|
printf("[built-ins]-Environment (%lld)\n", (long long)env);
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
for_hash_map (env->hm) {
|
for_hash_map (env->hm) {
|
||||||
print_indent(indent);
|
print_indent(indent);
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
namespace Slime {
|
||||||
|
|
||||||
proc delete_error() -> void {
|
proc delete_error() -> void {
|
||||||
using Globals::error;
|
using Globals::error;
|
||||||
|
|
||||||
@@ -52,3 +54,4 @@ proc create_error(const char* c_func_name, const char* c_file_name, int c_file_l
|
|||||||
free(out_msg);
|
free(out_msg);
|
||||||
create_error(c_func_name, c_file_name, c_file_line, type, formatted_string);
|
create_error(c_func_name, c_file_name, c_file_line, type, formatted_string);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
namespace Slime {
|
||||||
proc create_extended_environment_for_function_application(
|
proc create_extended_environment_for_function_application(
|
||||||
Lisp_Object* unevaluated_arguments,
|
Lisp_Object* unevaluated_arguments,
|
||||||
Lisp_Object* function,
|
Lisp_Object* function,
|
||||||
@@ -520,3 +521,4 @@ proc interprete_stdin() -> void {
|
|||||||
}();
|
}();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
namespace Slime {
|
||||||
void add_to_load_path(const char*);
|
void add_to_load_path(const char*);
|
||||||
bool lisp_object_equal(Lisp_Object*,Lisp_Object*);
|
bool lisp_object_equal(Lisp_Object*,Lisp_Object*);
|
||||||
Lisp_Object* built_in_load(String*);
|
Lisp_Object* built_in_load(String*);
|
||||||
@@ -81,3 +82,4 @@ namespace Globals {
|
|||||||
extern Error* error;
|
extern Error* error;
|
||||||
extern bool breaking_on_errors;
|
extern bool breaking_on_errors;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace GC {
|
namespace Slime::GC {
|
||||||
proc maybe_mark(Environment* env) -> void;
|
proc maybe_mark(Environment* env) -> void;
|
||||||
|
|
||||||
int current_mark;
|
int current_mark;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace Globals {
|
namespace Slime::Globals {
|
||||||
char* bin_path = nullptr;
|
char* bin_path = nullptr;
|
||||||
Log_Level log_level = Log_Level::Debug;
|
Log_Level log_level = Log_Level::Debug;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
namespace Slime {
|
||||||
proc string_equal(const char input[], const char check[]) -> bool {
|
proc string_equal(const char input[], const char check[]) -> bool {
|
||||||
if (input == check) return true;
|
if (input == check) return true;
|
||||||
|
|
||||||
@@ -458,3 +459,4 @@ proc log_error() -> void {
|
|||||||
print_call_stack();
|
print_call_stack();
|
||||||
puts(console_normal);
|
puts(console_normal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
+3
-4
@@ -39,14 +39,14 @@ unsigned int hm_hash(void* ptr);
|
|||||||
unsigned int hm_hash(Slime::Lisp_Object* obj);
|
unsigned int hm_hash(Slime::Lisp_Object* obj);
|
||||||
#include "ftb/hashmap.hpp"
|
#include "ftb/hashmap.hpp"
|
||||||
|
|
||||||
namespace Slime {
|
|
||||||
# include "defines.cpp"
|
# include "defines.cpp"
|
||||||
# include "assert.hpp"
|
# include "assert.hpp"
|
||||||
# include "define_macros.hpp"
|
# include "define_macros.hpp"
|
||||||
# include "platform.cpp"
|
# include "platform.cpp"
|
||||||
# include "structs.cpp"
|
# include "structs.cpp"
|
||||||
# include "forward_decls.cpp"
|
# include "forward_decls.cpp"
|
||||||
}
|
|
||||||
|
|
||||||
bool hm_objects_match(char* a, char* b) {
|
bool hm_objects_match(char* a, char* b) {
|
||||||
return strcmp(a, b) == 0;
|
return strcmp(a, b) == 0;
|
||||||
@@ -107,7 +107,6 @@ unsigned int hm_hash(Slime::Lisp_Object* obj) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Slime {
|
|
||||||
# include "globals.cpp"
|
# include "globals.cpp"
|
||||||
# include "memory.cpp"
|
# include "memory.cpp"
|
||||||
# include "gc.cpp"
|
# include "gc.cpp"
|
||||||
@@ -122,4 +121,4 @@ namespace Slime {
|
|||||||
# include "built_ins.cpp"
|
# include "built_ins.cpp"
|
||||||
# include "testing.cpp"
|
# include "testing.cpp"
|
||||||
// # include "undefines.cpp"
|
// # include "undefines.cpp"
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
namespace Slime {
|
||||||
proc create_source_code_location(String* file, int line, int col) -> Source_Code_Location* {
|
proc create_source_code_location(String* file, int line, int col) -> Source_Code_Location* {
|
||||||
if (!file)
|
if (!file)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -51,3 +52,4 @@ Lisp_Object::~Lisp_Object() {
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace Memory {
|
namespace Slime::Memory {
|
||||||
|
|
||||||
// ------------------
|
// ------------------
|
||||||
// global symbol / keyword table
|
// global symbol / keyword table
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace Parser {
|
namespace Slime::Parser {
|
||||||
String* standard_in;
|
String* standard_in;
|
||||||
String* parser_file;
|
String* parser_file;
|
||||||
int parser_line;
|
int parser_line;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
namespace Slime {
|
||||||
|
|
||||||
inline proc get_cwd() -> char* {
|
inline proc get_cwd() -> char* {
|
||||||
const int buf_size = 2048;
|
const int buf_size = 2048;
|
||||||
char* res = (char*)malloc(buf_size * sizeof(char));
|
char* res = (char*)malloc(buf_size * sizeof(char));
|
||||||
@@ -165,3 +167,4 @@ proc get_exe_dir() -> char* {
|
|||||||
return path;
|
return path;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
namespace Slime {
|
||||||
struct Lisp_Object;
|
struct Lisp_Object;
|
||||||
struct String;
|
struct String;
|
||||||
struct Environment;
|
struct Environment;
|
||||||
@@ -140,3 +141,4 @@ struct Error {
|
|||||||
Lisp_Object* type;
|
Lisp_Object* type;
|
||||||
String* message;
|
String* message;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
namespace Slime {
|
||||||
|
|
||||||
#define epsilon 2.2204460492503131E-16
|
#define epsilon 2.2204460492503131E-16
|
||||||
|
|
||||||
#define testresult int
|
#define testresult int
|
||||||
@@ -602,6 +604,8 @@ proc run_all_tests() -> bool {
|
|||||||
|
|
||||||
try Memory::init(409600);
|
try Memory::init(409600);
|
||||||
|
|
||||||
|
push_environment(Memory::create_child_environment(
|
||||||
|
get_current_environment()));
|
||||||
printf("-- Util --\n");
|
printf("-- Util --\n");
|
||||||
invoke_test(test_array_lists_adding_and_removing);
|
invoke_test(test_array_lists_adding_and_removing);
|
||||||
invoke_test(test_array_lists_sorting);
|
invoke_test(test_array_lists_sorting);
|
||||||
@@ -629,6 +633,7 @@ proc run_all_tests() -> bool {
|
|||||||
invoke_test(test_singular_t_and_nil);
|
invoke_test(test_singular_t_and_nil);
|
||||||
invoke_test(test_singular_symbols);
|
invoke_test(test_singular_symbols);
|
||||||
|
|
||||||
|
pop_environment();
|
||||||
printf("\n-- Test Files --\n");
|
printf("\n-- Test Files --\n");
|
||||||
|
|
||||||
invoke_test_script("evaluation_of_default_args");
|
invoke_test_script("evaluation_of_default_args");
|
||||||
@@ -664,3 +669,4 @@ proc run_all_tests() -> bool {
|
|||||||
#undef assert_not_null
|
#undef assert_not_null
|
||||||
#undef invoke_test
|
#undef invoke_test
|
||||||
#undef invoke_test_script
|
#undef invoke_test_script
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
namespace Slime {
|
||||||
proc visualize_lisp_machine() -> void {
|
proc visualize_lisp_machine() -> void {
|
||||||
|
|
||||||
// // save the current working directory
|
// // save the current working directory
|
||||||
@@ -552,3 +553,4 @@ proc visualize_lisp_machine() -> void {
|
|||||||
// ">", -padding, -padding, max_x + 2*padding, max_y + 2*padding);
|
// ">", -padding, -padding, max_x + 2*padding, max_y + 2*padding);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user