From 8549aa0957c8ce6291220ed195b52cfc7f9469d6 Mon Sep 17 00:00:00 2001 From: David Johnson-Davies Date: Tue, 6 Aug 2019 14:29:01 +0100 Subject: [PATCH] Version 2.8a - 6th August 2019 Minor bug fixes --- ulisp-arm.ino | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ulisp-arm.ino b/ulisp-arm.ino index 9319b1e..157d20a 100644 --- a/ulisp-arm.ino +++ b/ulisp-arm.ino @@ -1,5 +1,5 @@ -/* uLisp ARM 2.8 - www.ulisp.com - David Johnson-Davies - www.technoblogy.com - 20th July 2019 +/* uLisp ARM 2.8a - www.ulisp.com + David Johnson-Davies - www.technoblogy.com - 6th August 2019 Licensed under the MIT license: https://opensource.org/licenses/MIT */ @@ -1040,12 +1040,12 @@ object *apply (symbol_t name, object *function, object *args, object *env) { checkargs(fname, args); return ((fn_ptr_type)lookupfn(fname))(args, env); } - if (listp(function) && issymbol(car(function), LAMBDA)) { + if (consp(function) && issymbol(car(function), LAMBDA)) { function = cdr(function); object *result = closure(0, 0, NULL, function, args, &env); return eval(result, env); } - if (listp(function) && issymbol(car(function), CLOSURE)) { + if (consp(function) && issymbol(car(function), CLOSURE)) { function = cdr(function); object *result = closure(0, 0, car(function), cdr(function), args, &env); return eval(result, env); @@ -1688,7 +1688,7 @@ object *sp_withspi (object *args, object *env) { object *sp_withsdcard (object *args, object *env) { #if defined(sdcardsupport) object *params = first(args); - if (params == NULL) error2(WITHSPCARD, nostream); + if (params == NULL) error2(WITHSDCARD, nostream); object *var = first(params); object *filename = eval(second(params), env); params = cddr(params); @@ -1699,10 +1699,10 @@ object *sp_withsdcard (object *args, object *env) { if (mode == 1) oflag = O_RDWR | O_CREAT | O_APPEND; else if (mode == 2) oflag = O_RDWR | O_CREAT | O_TRUNC; if (mode >= 1) { SDpfile = SD.open(MakeFilename(filename), oflag); - if (!SDpfile) error2(WITHSPCARD, PSTR("problem writing to SD card")); + if (!SDpfile) error2(WITHSDCARD, PSTR("problem writing to SD card")); } else { SDgfile = SD.open(MakeFilename(filename), oflag); - if (!SDgfile) error2(WITHSPCARD, PSTR("problem reading from SD card")); + if (!SDgfile) error2(WITHSDCARD, PSTR("problem reading from SD card")); } object *pair = cons(var, stream(SDSTREAM, 1)); push(pair,env); @@ -3788,7 +3788,7 @@ object *eval (object *form, object *env) { object *function = car(form); object *args = cdr(form); - if (function == NULL) error2(0, PSTR("'nil' illegal function")); + if (function == NULL) error(0, PSTR("illegal function"), nil); if (!listp(args)) error(0, PSTR("can't evaluate a dotted pair"), args); // List starts with a symbol? @@ -3871,7 +3871,7 @@ object *eval (object *form, object *env) { return result; } - if (listp(function) && issymbol(car(function), LAMBDA)) { + if (consp(function) && issymbol(car(function), LAMBDA)) { form = closure(TCstart, fname->name, NULL, cdr(function), args, &env); pop(GCStack); int trace = tracing(fname->name); @@ -3889,7 +3889,7 @@ object *eval (object *form, object *env) { } } - if (listp(function) && issymbol(car(function), CLOSURE)) { + if (consp(function) && issymbol(car(function), CLOSURE)) { function = cdr(function); form = closure(TCstart, fname->name, car(function), cdr(function), args, &env); pop(GCStack); @@ -3897,7 +3897,7 @@ object *eval (object *form, object *env) { goto EVAL; } - error2((int)fname, PSTR("is an illegal function")); return nil; + error(0, PSTR("illegal function"), fname); return nil; } // Print functions @@ -4138,7 +4138,7 @@ object *nextitem (gfun_t gfun) { else if (ch == 'B') base = 2; else if (ch == 'O') base = 8; else if (ch == 'X') base = 16; - else if (ch == 0x07) return (object *)QUO; + else if (ch == 0x07) return nextitem(gfun); else error2(0, PSTR("Illegal character after #")); ch = gfun(); }