Explorar el Código

work transfer from laptop

master
Felix Brendel hace 7 años
padre
commit
3863b96dac
Se han modificado 6 ficheros con 29 adiciones y 27 borrados
  1. +2
    -4
      src/eval.cpp
  2. +2
    -0
      src/forward_decls.cpp
  3. +10
    -8
      src/io.cpp
  4. +1
    -1
      src/memory.cpp
  5. +13
    -13
      src/slime.h
  6. +1
    -1
      src/testing.cpp

+ 2
- 4
src/eval.cpp Ver fichero

@@ -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
- 0
src/forward_decls.cpp Ver fichero

@@ -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
src/io.cpp Ver fichero

@@ -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
src/memory.cpp Ver fichero

@@ -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


+ 13
- 13
src/slime.h Ver fichero

@@ -13,17 +13,17 @@
#undef _CRT_SECURE_NO_WARNINGS

namespace Slime {
#include "./defines.cpp"
#include "./structs.cpp"
#include "./forward_decls.cpp"
#include "./memory.cpp"
#include "./lisp_object.cpp"
#include "./error.cpp"
#include "./io.cpp"
#include "./env.cpp"
#include "./parse.cpp"
#include "./eval.cpp"
#include "./built_ins.cpp"
#include "./testing.cpp"
#include "./undefines.cpp"
# include "./defines.cpp"
# include "./structs.cpp"
# include "./forward_decls.cpp"
# include "./memory.cpp"
# include "./lisp_object.cpp"
# include "./error.cpp"
# include "./io.cpp"
# include "./env.cpp"
# include "./parse.cpp"
# include "./eval.cpp"
# include "./built_ins.cpp"
# include "./testing.cpp"
# include "./undefines.cpp"
}

+ 1
- 1
src/testing.cpp Ver fichero

@@ -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);



Cargando…
Cancelar
Guardar