diff --git a/ext.lisp b/ext.lisp index ea76e91..2ec0469 100644 --- a/ext.lisp +++ b/ext.lisp @@ -6,6 +6,10 @@ ;; Quick shorthand (defun dir () (directory)) +;; File manipulation (defun file-read (filename) (with-sd-card (str filename) (read str))) (defun file-append (filename data) (with-sd-card (str filename 2) (print data str))) (defun file-write (filename data) (with-sd-card (str filename 2) (print data str))) + +;; Maths +(defun sq (x) (* x x)) diff --git a/extensions.ino b/extensions.ino index 0c8aa00..3629162 100644 --- a/extensions.ino +++ b/extensions.ino @@ -12,7 +12,7 @@ object *fn_savescreen (object *args, object *env) { (void) env; #if defined(sdcardsupport) object *arg = checkstring(first(args)); - sd_begin(); + SDBegin(); File file; char buffer[BUFFERSIZE]; file = SD.open(MakeFilename(arg, buffer), FILE_WRITE); @@ -88,7 +88,7 @@ const char stringsavescreen[] PROGMEM = "save-screen"; const char doc_sym_def[] PROGMEM = "(symbol-def symbol [str])\n" "Prints the definition of a symbol (variable or function) defined in ulisp using the pretty printer." "If str is specified it prints to the specified stream. It returns no value."; - +// const char docsavescreen[] PROGMEM = "(save-screen filename)\n" "Saves an image of the text screen as a BMP file on the SD card."; @@ -109,4 +109,4 @@ const tbl_entry_t *table (int n) { unsigned int tablesize (int n) { return tablesizes[n]; -} \ No newline at end of file +} diff --git a/tdeck-ulisp.ino b/tdeck-ulisp.ino index 1922baf..3312cda 100644 --- a/tdeck-ulisp.ino +++ b/tdeck-ulisp.ino @@ -6,7 +6,12 @@ const char LispLibrary[] PROGMEM = -"(defun load-package (filename) (with-sd-card (str filename) (loop (let (ln (eval (read str))) (unless ln (return nothing))))))" +"(defun load-package (filename)" +" (with-sd-card (str filename)" +" (loop" +" (let ((ln (eval (read str))))" +" (unless ln (return nothing))))))" + "(defun save-package (filename list) (with-sd-card (str filename 2) (dolist (f list) (symbol-def f str))))" "(defun add-to-package (filename list) (with-sd-card (str filename 1) (dolist (f list) (symbol-def f str))))" ;