Ver a proveniência

small changes before Fixing the macro bug

master
Felix Brendel há 6 anos
ascendente
cometimento
3b85873039
3 ficheiros alterados com 11 adições e 8 eliminações
  1. +1
    -1
      bin/pre.slime
  2. +5
    -6
      src/built_ins.cpp
  3. +5
    -1
      src/io.cpp

+ 1
- 1
bin/pre.slime Ver ficheiro

@@ -411,7 +411,7 @@ by the key 'from' and ends with the number defined in 'to'."
result) result)
(define (map fun seq) (define (map fun seq)
:doc "Takes a function and a sequence as arguments and returns a new
"Takes a function and a sequence as arguments and returns a new
sequence which contains the results of using the first sequences sequence which contains the results of using the first sequences
elemens as argument to that function." elemens as argument to that function."
(if (null? seq) (if (null? seq)


+ 5
- 6
src/built_ins.cpp Ver ficheiro

@@ -229,12 +229,10 @@ namespace Slime {
Lisp_Object_Type type = Memory::get_type(definee); Lisp_Object_Type type = Memory::get_type(definee);
switch (type) { switch (type) {
case Lisp_Object_Type::Symbol: { case Lisp_Object_Type::Symbol: {
// BUG(Felix): Defining with doc string crashes
if (form != Memory::nil) { if (form != Memory::nil) {
Lisp_Object* doc = thing; Lisp_Object* doc = thing;
try_void assert_type(doc, Lisp_Object_Type::String); try_void assert_type(doc, Lisp_Object_Type::String);
try_void assert_type(form, Lisp_Object_Type::Pair); try_void assert_type(form, Lisp_Object_Type::Pair);
form = form->value.pair.rest;
thing = form->value.pair.first; thing = form->value.pair.first;
try_void assert(form->value.pair.rest == Memory::nil); try_void assert(form->value.pair.rest == Memory::nil);
// TODO docs // TODO docs
@@ -1053,16 +1051,17 @@ namespace Slime {
} }
return Memory::t; return Memory::t;
}; };
define((print (:sep " ") (:end "\n") . things), "TODO") {
define((print (:sep " ") (:end "\n") (:repr ()) . things), "TODO") {
profile_with_name("(print)"); profile_with_name("(print)");
fetch(sep, end, things);
fetch(sep, end, repr, things);
if (things != Memory::nil) { if (things != Memory::nil) {
print(things->value.pair.first);
bool print_repr = repr != Memory::nil;
print(things->value.pair.first, repr);
for_lisp_list(things->value.pair.rest) { for_lisp_list(things->value.pair.rest) {
print(sep); print(sep);
print(it);
print(it, repr);
} }
} }


+ 5
- 1
src/io.cpp Ver ficheiro

@@ -304,7 +304,7 @@ namespace Slime {
} }
proc string_buider_to_string(Array_List<char*> string_builder) -> char* { proc string_buider_to_string(Array_List<char*> string_builder) -> char* {
int len = 1;
size_t len = 1;
int idx = 0; int idx = 0;
for (auto str : string_builder) { for (auto str : string_builder) {
len += strlen(str); len += strlen(str);
@@ -479,6 +479,10 @@ namespace Slime {
return string_buider_to_string(string_builder); return string_buider_to_string(string_builder);
} }
default:
create_generic_error("A Lisp_Object of type-id %d cannot be converted to a string",
(int)(Memory::get_type(node)));
return nullptr;
} }
} }


Carregando…
Cancelar
Guardar