@@ -627,7 +627,6 @@ int EpromReadInt (int *addr) {
627
627
#endif
628
628
629
629
unsigned int saveimage (object *arg) {
630
- #if defined(sdcardsupport)
631
630
unsigned int imagesize = compactimage (&arg);
632
631
SD.begin ();
633
632
File file;
@@ -649,57 +648,9 @@ unsigned int saveimage (object *arg) {
649
648
}
650
649
file.close ();
651
650
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
699
651
}
700
652
701
653
unsigned int loadimage (object *arg) {
702
- #if defined(sdcardsupport)
703
654
SD.begin ();
704
655
File file;
705
656
char buffer[BUFFERSIZE];
@@ -719,56 +670,9 @@ unsigned int loadimage (object *arg) {
719
670
file.close ();
720
671
gc (NULL , NULL );
721
672
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
768
673
}
769
674
770
675
void autorunimage () {
771
- #if defined(sdcardsupport)
772
676
SD.begin ();
773
677
File file = SD.open (autorunimagepath);
774
678
if (!file) error2 (NIL, PSTR (" problem autorunning from SD card image" ));
@@ -778,27 +682,6 @@ void autorunimage () {
778
682
loadimage (NULL );
779
683
apply (NIL, autorun, NULL , NULL );
780
684
}
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
802
685
}
803
686
804
687
// Tracing
@@ -2478,7 +2361,7 @@ object *sp_expand (object *args, object *env) {
2478
2361
object *a;
2479
2362
for (p = params, a = cdr (args); p != NULL ; p = cdr (p), a = cdr (a)) {
2480
2363
if (isbuiltin (car (p), AMPREST)) {
2481
- push (cons (car ( cdr (p) ), a), newenv);
2364
+ push (cons (second (p ), a), newenv);
2482
2365
car (GCStack) = newenv;
2483
2366
break ;
2484
2367
} else {
@@ -5017,7 +4900,7 @@ object *eval (object *form, object *env) {
5017
4900
EVAL:
5018
4901
yield ();
5019
4902
// Enough space?
5020
- if (Freespace <= WORKSPACESIZE>>4 ) gc (form, env);
4903
+ // if (Freespace <= WORKSPACESIZE>>4) gc(form, env);
5021
4904
// Escape
5022
4905
if (tstflag (ESCAPE)) { clrflag (ESCAPE); error2 (NIL, PSTR (" escape!" ));}
5023
4906
if (!tstflag (NOESC)) testescape ();
@@ -5804,7 +5687,7 @@ void setup () {
5804
5687
void repl (object *env) {
5805
5688
for (;;) {
5806
5689
randomSeed (micros ());
5807
- gc (NULL , env);
5690
+ // gc(NULL, env);
5808
5691
#if defined (printfreespace)
5809
5692
pint (Freespace, pserial);
5810
5693
#endif
0 commit comments