From 78f5b98f9f89fdd381281f744d78cd44b64dd332 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Mon, 2 Nov 2020 15:23:04 -0500 Subject: [PATCH] Don't print newlines on (prn) or last expr in file --- src/object.h | 1 + src/pebblisp.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/object.h b/src/object.h index fe4b91f..2d178f0 100644 --- a/src/object.h +++ b/src/object.h @@ -90,6 +90,7 @@ struct Other { char* stringObj(char *dest, const Object *obj); void printList(const Object *list); void printObj(const Object *obj); +void _printObj(const Object *obj, int newline); void debugObj(const Object *obj); void printErr(const Object *obj); diff --git a/src/pebblisp.c b/src/pebblisp.c index 5ba62a0..dbf09fe 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -396,8 +396,7 @@ Object print(Object p, Object ignore, struct Environment *env) { p = cloneObject(p); p = eval(&p, env); - printObj(&p); - printf("\n"); + _printObj(&p, 0); return p; } @@ -624,7 +623,8 @@ int readFile(const char *filename, struct Environment *env) { } r = parseEval(page, env); - printAndClean(&r); + cleanObject(&r); + printf("\n"); fclose(input); return 0;