work transfer from laptop

This commit is contained in:
Felix Brendel
2019-03-27 13:21:39 +01:00
parent 33ca222922
commit 3863b96dac
6 changed files with 29 additions and 27 deletions
+2 -4
View File
@@ -1,5 +1,3 @@
Source_Code_Location* current_source_code_location = nullptr;
proc apply_arguments_to_function(Lisp_Object* arguments, Function* function) -> Lisp_Object* {
Environment* new_env = Memory::create_child_environment(function->parent_environment);
@@ -389,7 +387,7 @@ proc eval_expr(Lisp_Object* node, Environment* env) -> Lisp_Object* {
return symbol;
}
case Lisp_Object_Type::Pair: {
current_source_code_location = node->sourceCodeLocation;
current_source_code = node;
Lisp_Object* lispOperator;
if (node->value.pair.first->type != Lisp_Object_Type::CFunction &&
@@ -429,7 +427,7 @@ proc eval_expr(Lisp_Object* node, Environment* env) -> Lisp_Object* {
}
}
default: {
create_generic_error("Not a function.");
create_generic_error("%s is not a function.", Lisp_Object_Type_to_string(node->type));
return nullptr;
}
}
+2
View File
@@ -15,3 +15,5 @@ proc Lisp_Object_Type_to_string(Lisp_Object_Type type) -> const char*;
namespace Memory {
proc get_or_create_lisp_object_keyword(const char* identifier) -> Lisp_Object*;
}
Lisp_Object* current_source_code = nullptr;
+10 -8
View File
@@ -281,14 +281,16 @@ proc print(Lisp_Object* node, bool print_quotes = false, FILE* file = stdout) ->
proc print_error_location() -> void {
// if (error->location) {
// printf("%s (line %d, position %d)",
// Memory::get_c_str(error->location->file),
// error->location->line,
// error->location->column);
// } else {
// printf("no source code location avaliable");
// }
if (current_source_code) {
printf("%s (line %d, position %d) code:" console_red "\n ",
Memory::get_c_str(
current_source_code->sourceCodeLocation->file),
current_source_code->sourceCodeLocation->line,
current_source_code->sourceCodeLocation->column);
print(current_source_code);
} else {
printf("no source code location avaliable");
}
}
proc log_error() -> void {
+1 -1
View File
@@ -143,7 +143,7 @@ namespace Memory {
t->type = Lisp_Object_Type::T;
}
proc reset() {
proc reset() -> void {
free_spots_in_object_memory->next_index = 0;
free_spots_in_string_memory->next_index = 0;
next_index_in_object_memory = 2; // because t and nil are always there
+1 -1
View File
@@ -480,7 +480,7 @@ proc test_singular_t_and_nil() -> testresult {
proc test_file(const char* file) -> testresult {
Memory::reset();
Environment* env = Memory::create_built_ins_environment();
static Environment* env = Memory::create_built_ins_environment();
Parser::init(env);