1
- /* uLisp ESP Version 3.5 - www.ulisp.com
2
- David Johnson-Davies - www.technoblogy.com - 16th February 2021
1
+ /* uLisp ESP Version 3.6 - www.ulisp.com
2
+ David Johnson-Davies - www.technoblogy.com - 4th April 2021
3
3
4
4
Licensed under the MIT license: https://opensource.org/licenses/MIT
5
5
*/
@@ -208,7 +208,7 @@ char LastChar = 0;
208
208
char LastPrint = 0 ;
209
209
210
210
// Flags
211
- enum flag { PRINTREADABLY, RETURNFLAG, ESCAPE, EXITEDITOR, LIBRARYLOADED, NOESC };
211
+ enum flag { PRINTREADABLY, RETURNFLAG, ESCAPE, EXITEDITOR, LIBRARYLOADED, NOESC, NOECHO };
212
212
volatile uint8_t Flags = 0b00001 ; // PRINTREADABLY set by default
213
213
214
214
// Forward references
@@ -561,14 +561,14 @@ unsigned int loadimage (object *arg) {
561
561
else error (LOADIMAGE, PSTR (" illegal argument" ), arg);
562
562
if (!file) error2 (LOADIMAGE, PSTR (" problem loading from SD card" ));
563
563
SDReadInt (file);
564
- int imagesize = SDReadInt (file);
564
+ unsigned int imagesize = SDReadInt (file);
565
565
GlobalEnv = (object *)SDReadInt (file);
566
566
GCStack = (object *)SDReadInt (file);
567
567
#if SYMBOLTABLESIZE > BUFFERSIZE
568
568
SymbolTop = (char *)SDReadInt (file);
569
569
for (int i=0 ; i<SYMBOLTABLESIZE; i++) SymbolTable[i] = file.read ();
570
570
#endif
571
- for (int i=0 ; i<imagesize; i++) {
571
+ for (unsigned int i=0 ; i<imagesize; i++) {
572
572
object *obj = &Workspace[i];
573
573
car (obj) = (object *)SDReadInt (file);
574
574
cdr (obj) = (object *)SDReadInt (file);
@@ -580,15 +580,15 @@ unsigned int loadimage (object *arg) {
580
580
EEPROM.begin (EEPROMSIZE);
581
581
int addr = 0 ;
582
582
EpromReadInt (&addr); // Skip eval address
583
- int imagesize = EpromReadInt (&addr);
584
- if (imagesize == 0 || imagesize == 0xFFFF ) error2 (LOADIMAGE, PSTR (" no saved image" ));
583
+ unsigned int imagesize = EpromReadInt (&addr);
584
+ if (imagesize == 0 || imagesize == 0xFFFFFFFF ) error2 (LOADIMAGE, PSTR (" no saved image" ));
585
585
GlobalEnv = (object *)EpromReadInt (&addr);
586
586
GCStack = (object *)EpromReadInt (&addr);
587
587
#if SYMBOLTABLESIZE > BUFFERSIZE
588
588
SymbolTop = (char *)EpromReadInt (&addr);
589
589
for (int i=0 ; i<SYMBOLTABLESIZE; i++) SymbolTable[i] = EEPROM.read (addr++);
590
590
#endif
591
- for (int i=0 ; i<imagesize; i++) {
591
+ for (unsigned int i=0 ; i<imagesize; i++) {
592
592
object *obj = &Workspace[i];
593
593
car (obj) = (object *)EpromReadInt (&addr);
594
594
cdr (obj) = (object *)EpromReadInt (&addr);
@@ -3394,7 +3394,7 @@ object *fn_pinmode (object *args, object *env) {
3394
3394
int pin = checkinteger (PINMODE, first (args));
3395
3395
PinMode pm = INPUT;
3396
3396
object *arg = second (args);
3397
- if (keywordp (arg)) pm = checkkeyword (PINMODE, arg);
3397
+ if (keywordp (arg)) pm = (PinMode) checkkeyword (PINMODE, arg);
3398
3398
else if (integerp (arg)) {
3399
3399
int mode = arg->integer ;
3400
3400
if (mode == 1 ) pm = OUTPUT; else if (mode == 2 ) pm = INPUT_PULLUP;
@@ -4945,9 +4945,10 @@ int gserial () {
4945
4945
WritePtr = 0 ;
4946
4946
return ' \n ' ;
4947
4947
#else
4948
- while (!Serial.available ());
4948
+ unsigned long start = millis ();
4949
+ while (!Serial.available ()) if (millis () - start > 1000 ) clrflag (NOECHO);
4949
4950
char temp = Serial.read ();
4950
- if (temp != ' \n ' ) pserial (temp);
4951
+ if (temp != ' \n ' && ! tstflag (NOECHO) ) pserial (temp);
4951
4952
return temp;
4952
4953
#endif
4953
4954
}
@@ -4957,8 +4958,8 @@ object *nextitem (gfun_t gfun) {
4957
4958
while (issp (ch)) ch = gfun ();
4958
4959
4959
4960
if (ch == ' ;' ) {
4960
- while ( ch != ' ( ' ) ch = gfun ();
4961
- ch = ' (' ;
4961
+ do { ch = gfun (); if ( ch == ' ; ' || ch == ' ( ' ) setflag (NOECHO); }
4962
+ while ( ch ! = ' (' ) ;
4962
4963
}
4963
4964
if (ch == ' \n ' ) ch = gfun ();
4964
4965
if (ch == -1 ) return nil;
@@ -5136,7 +5137,7 @@ void setup () {
5136
5137
initenv ();
5137
5138
initsleep ();
5138
5139
initgfx ();
5139
- pfstring (PSTR (" uLisp 3.5 " ), pserial); pln (pserial);
5140
+ pfstring (PSTR (" uLisp 3.6 " ), pserial); pln (pserial);
5140
5141
}
5141
5142
5142
5143
// Read/Evaluate/Print loop
0 commit comments