Version 2.8a - 6th August 2019

Minor bug fixes
This commit is contained in:
David Johnson-Davies 2019-08-06 14:29:01 +01:00 committed by GitHub
parent ac677ecaf0
commit 8549aa0957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/* uLisp ARM 2.8 - www.ulisp.com /* uLisp ARM 2.8a - www.ulisp.com
David Johnson-Davies - www.technoblogy.com - 20th July 2019 David Johnson-Davies - www.technoblogy.com - 6th August 2019
Licensed under the MIT license: https://opensource.org/licenses/MIT 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); checkargs(fname, args);
return ((fn_ptr_type)lookupfn(fname))(args, env); 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); function = cdr(function);
object *result = closure(0, 0, NULL, function, args, &env); object *result = closure(0, 0, NULL, function, args, &env);
return eval(result, env); return eval(result, env);
} }
if (listp(function) && issymbol(car(function), CLOSURE)) { if (consp(function) && issymbol(car(function), CLOSURE)) {
function = cdr(function); function = cdr(function);
object *result = closure(0, 0, car(function), cdr(function), args, &env); object *result = closure(0, 0, car(function), cdr(function), args, &env);
return eval(result, env); return eval(result, env);
@ -1688,7 +1688,7 @@ object *sp_withspi (object *args, object *env) {
object *sp_withsdcard (object *args, object *env) { object *sp_withsdcard (object *args, object *env) {
#if defined(sdcardsupport) #if defined(sdcardsupport)
object *params = first(args); object *params = first(args);
if (params == NULL) error2(WITHSPCARD, nostream); if (params == NULL) error2(WITHSDCARD, nostream);
object *var = first(params); object *var = first(params);
object *filename = eval(second(params), env); object *filename = eval(second(params), env);
params = cddr(params); 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) oflag = O_RDWR | O_CREAT | O_APPEND; else if (mode == 2) oflag = O_RDWR | O_CREAT | O_TRUNC;
if (mode >= 1) { if (mode >= 1) {
SDpfile = SD.open(MakeFilename(filename), oflag); 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 { } else {
SDgfile = SD.open(MakeFilename(filename), oflag); 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)); object *pair = cons(var, stream(SDSTREAM, 1));
push(pair,env); push(pair,env);
@ -3788,7 +3788,7 @@ object *eval (object *form, object *env) {
object *function = car(form); object *function = car(form);
object *args = cdr(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); if (!listp(args)) error(0, PSTR("can't evaluate a dotted pair"), args);
// List starts with a symbol? // List starts with a symbol?
@ -3871,7 +3871,7 @@ object *eval (object *form, object *env) {
return result; 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); form = closure(TCstart, fname->name, NULL, cdr(function), args, &env);
pop(GCStack); pop(GCStack);
int trace = tracing(fname->name); 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); function = cdr(function);
form = closure(TCstart, fname->name, car(function), cdr(function), args, &env); form = closure(TCstart, fname->name, car(function), cdr(function), args, &env);
pop(GCStack); pop(GCStack);
@ -3897,7 +3897,7 @@ object *eval (object *form, object *env) {
goto EVAL; goto EVAL;
} }
error2((int)fname, PSTR("is an illegal function")); return nil; error(0, PSTR("illegal function"), fname); return nil;
} }
// Print functions // Print functions
@ -4138,7 +4138,7 @@ object *nextitem (gfun_t gfun) {
else if (ch == 'B') base = 2; else if (ch == 'B') base = 2;
else if (ch == 'O') base = 8; else if (ch == 'O') base = 8;
else if (ch == 'X') base = 16; 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 #")); else error2(0, PSTR("Illegal character after #"));
ch = gfun(); ch = gfun();
} }