screenshot extension works

This commit is contained in:
Able 2024-11-11 16:27:44 -06:00
parent 066e7582c9
commit 0e41f059c6
3 changed files with 13 additions and 4 deletions

View file

@ -6,6 +6,10 @@
;; Quick shorthand ;; Quick shorthand
(defun dir () (directory)) (defun dir () (directory))
;; File manipulation
(defun file-read (filename) (with-sd-card (str filename) (read str))) (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-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))) (defun file-write (filename data) (with-sd-card (str filename 2) (print data str)))
;; Maths
(defun sq (x) (* x x))

View file

@ -12,7 +12,7 @@ object *fn_savescreen (object *args, object *env) {
(void) env; (void) env;
#if defined(sdcardsupport) #if defined(sdcardsupport)
object *arg = checkstring(first(args)); object *arg = checkstring(first(args));
sd_begin(); SDBegin();
File file; File file;
char buffer[BUFFERSIZE]; char buffer[BUFFERSIZE];
file = SD.open(MakeFilename(arg, buffer), FILE_WRITE); 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" 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." "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."; "If str is specified it prints to the specified stream. It returns no value.";
//
const char docsavescreen[] PROGMEM = "(save-screen filename)\n" const char docsavescreen[] PROGMEM = "(save-screen filename)\n"
"Saves an image of the text screen as a BMP file on the SD card."; "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) { unsigned int tablesize (int n) {
return tablesizes[n]; return tablesizes[n];
} }

View file

@ -6,7 +6,12 @@
const char LispLibrary[] PROGMEM = 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 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))))" "(defun add-to-package (filename list) (with-sd-card (str filename 1) (dolist (f list) (symbol-def f str))))"
; ;