Skip to content

Commit 9fb204b

Browse files
comment out GCs, remove some non-ESP32 code
1 parent 4fc90d1 commit 9fb204b

File tree

1 file changed

+3
-120
lines changed

1 file changed

+3
-120
lines changed

ulisp-esp32.ino

Lines changed: 3 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,6 @@ int EpromReadInt (int *addr) {
627627
#endif
628628

629629
unsigned int saveimage (object *arg) {
630-
#if defined(sdcardsupport)
631630
unsigned int imagesize = compactimage(&arg);
632631
SD.begin();
633632
File file;
@@ -649,57 +648,9 @@ unsigned int saveimage (object *arg) {
649648
}
650649
file.close();
651650
return imagesize;
652-
#elif defined(LITTLEFS)
653-
unsigned int imagesize = compactimage(&arg);
654-
if (!LittleFS.begin(true)) error2(SAVEIMAGE, PSTR("problem mounting LittleFS"));
655-
File file;
656-
if (stringp(arg)) {
657-
char buffer[BUFFERSIZE];
658-
file = LittleFS.open(MakeFilename(arg, buffer), "w");
659-
if (!file) error2(SAVEIMAGE, PSTR("problem saving to LittleFS or invalid filename"));
660-
arg = NULL;
661-
} else if (arg == NULL || listp(arg)) {
662-
file = LittleFS.open(autorunimagepath, "w");
663-
if (!file) error2(SAVEIMAGE, PSTR("problem saving to LittleFS"));
664-
} else error(SAVEIMAGE, invalidarg, arg);
665-
FSWrite32(file, (uintptr_t)arg);
666-
FSWrite32(file, imagesize);
667-
FSWrite32(file, (uintptr_t)GlobalEnv);
668-
FSWrite32(file, (uintptr_t)GCStack);
669-
for (unsigned int i=0; i<imagesize; i++) {
670-
object *obj = &Workspace[i];
671-
FSWrite32(file, (uintptr_t)car(obj));
672-
FSWrite32(file, (uintptr_t)cdr(obj));
673-
}
674-
file.close();
675-
return imagesize;
676-
#elif defined(EEPROMSIZE)
677-
unsigned int imagesize = compactimage(&arg);
678-
if (!(arg == NULL || listp(arg))) error(SAVEIMAGE, PSTR("illegal argument"), arg);
679-
int bytesneeded = imagesize*8 + 36;
680-
if (bytesneeded > EEPROMSIZE) error(SAVEIMAGE, PSTR("image too large"), number(imagesize));
681-
EEPROM.begin(EEPROMSIZE);
682-
int addr = 0;
683-
EpromWriteInt(&addr, (uintptr_t)arg);
684-
EpromWriteInt(&addr, imagesize);
685-
EpromWriteInt(&addr, (uintptr_t)GlobalEnv);
686-
EpromWriteInt(&addr, (uintptr_t)GCStack);
687-
for (unsigned int i=0; i<imagesize; i++) {
688-
object *obj = &Workspace[i];
689-
EpromWriteInt(&addr, (uintptr_t)car(obj));
690-
EpromWriteInt(&addr, (uintptr_t)cdr(obj));
691-
}
692-
EEPROM.commit();
693-
return imagesize;
694-
#else
695-
(void) arg;
696-
error2(SAVEIMAGE, PSTR("not available"));
697-
return 0;
698-
#endif
699651
}
700652

701653
unsigned int loadimage (object *arg) {
702-
#if defined(sdcardsupport)
703654
SD.begin();
704655
File file;
705656
char buffer[BUFFERSIZE];
@@ -719,56 +670,9 @@ unsigned int loadimage (object *arg) {
719670
file.close();
720671
gc(NULL, NULL);
721672
return imagesize;
722-
#elif defined(LITTLEFS)
723-
if (!LittleFS.begin()) error2(LOADIMAGE, PSTR("problem mounting LittleFS"));
724-
File file;
725-
if (stringp(arg)) {
726-
char buffer[BUFFERSIZE];
727-
file = LittleFS.open(MakeFilename(arg, buffer), "r");
728-
if (!file) error2(LOADIMAGE, PSTR("problem loading from LittleFS or invalid filename"));
729-
}
730-
else if (arg == NULL) {
731-
file = LittleFS.open(autorunimagepath, "r");
732-
if (!file) error2(LOADIMAGE, PSTR("problem loading from LittleFS"));
733-
}
734-
else error(LOADIMAGE, invalidarg, arg);
735-
FSRead32(file);
736-
unsigned int imagesize = FSRead32(file);
737-
GlobalEnv = (object *)FSRead32(file);
738-
GCStack = (object *)FSRead32(file);
739-
for (unsigned int i=0; i<imagesize; i++) {
740-
object *obj = &Workspace[i];
741-
car(obj) = (object *)FSRead32(file);
742-
cdr(obj) = (object *)FSRead32(file);
743-
}
744-
file.close();
745-
gc(NULL, NULL);
746-
return imagesize;
747-
#elif defined(EEPROMSIZE)
748-
(void) arg;
749-
EEPROM.begin(EEPROMSIZE);
750-
int addr = 0;
751-
EpromReadInt(&addr); // Skip eval address
752-
unsigned int imagesize = EpromReadInt(&addr);
753-
if (imagesize == 0 || imagesize == 0xFFFFFFFF) error2(LOADIMAGE, PSTR("no saved image"));
754-
GlobalEnv = (object *)EpromReadInt(&addr);
755-
GCStack = (object *)EpromReadInt(&addr);
756-
for (unsigned int i=0; i<imagesize; i++) {
757-
object *obj = &Workspace[i];
758-
car(obj) = (object *)EpromReadInt(&addr);
759-
cdr(obj) = (object *)EpromReadInt(&addr);
760-
}
761-
gc(NULL, NULL);
762-
return imagesize;
763-
#else
764-
(void) arg;
765-
error2(LOADIMAGE, PSTR("not available"));
766-
return 0;
767-
#endif
768673
}
769674

770675
void autorunimage () {
771-
#if defined(sdcardsupport)
772676
SD.begin();
773677
File file = SD.open(autorunimagepath);
774678
if (!file) error2(NIL, PSTR("problem autorunning from SD card image"));
@@ -778,27 +682,6 @@ void autorunimage () {
778682
loadimage(NULL);
779683
apply(NIL, autorun, NULL, NULL);
780684
}
781-
#elif defined(LITTLEFS)
782-
if (!LittleFS.begin()) error2(NIL, PSTR("problem mounting LittleFS"));
783-
File file = LittleFS.open(autorunimagepath, "r");
784-
if (!file) error2(NIL, PSTR("problem autorunning from LittleFS"));
785-
object *autorun = (object *)FSRead32(file);
786-
file.close();
787-
if (autorun != NULL) {
788-
loadimage(NULL);
789-
apply(NIL, autorun, NULL, NULL);
790-
}
791-
#elif defined(EEPROMSIZE)
792-
EEPROM.begin(EEPROMSIZE);
793-
int addr = 0;
794-
object *autorun = (object *)EpromReadInt(&addr);
795-
if (autorun != NULL && (unsigned int)autorun != 0xFFFF) {
796-
loadimage(NULL);
797-
apply(NIL, autorun, NULL, NULL);
798-
}
799-
#else
800-
error2(NIL, PSTR("autorun not available"));
801-
#endif
802685
}
803686

804687
// Tracing
@@ -2478,7 +2361,7 @@ object *sp_expand (object *args, object *env) {
24782361
object *a;
24792362
for (p = params, a = cdr(args); p != NULL; p = cdr(p), a = cdr(a)) {
24802363
if (isbuiltin(car(p), AMPREST)) {
2481-
push(cons(car(cdr(p)), a), newenv);
2364+
push(cons(second(p), a), newenv);
24822365
car(GCStack) = newenv;
24832366
break;
24842367
} else {
@@ -5017,7 +4900,7 @@ object *eval (object *form, object *env) {
50174900
EVAL:
50184901
yield();
50194902
// Enough space?
5020-
if (Freespace <= WORKSPACESIZE>>4) gc(form, env);
4903+
// if (Freespace <= WORKSPACESIZE>>4) gc(form, env);
50214904
// Escape
50224905
if (tstflag(ESCAPE)) { clrflag(ESCAPE); error2(NIL, PSTR("escape!"));}
50234906
if (!tstflag(NOESC)) testescape();
@@ -5804,7 +5687,7 @@ void setup () {
58045687
void repl (object *env) {
58055688
for (;;) {
58065689
randomSeed(micros());
5807-
gc(NULL, env);
5690+
// gc(NULL, env);
58085691
#if defined (printfreespace)
58095692
pint(Freespace, pserial);
58105693
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy