Release 4.7b - 20th March 2025
This commit is contained in:
committed by
GitHub
parent
1023816f9f
commit
75b2785b5a
@@ -1,5 +1,5 @@
|
||||
/* uLisp ARM Release 4.7a - www.ulisp.com
|
||||
David Johnson-Davies - www.technoblogy.com - 12th January 2025
|
||||
/* uLisp ARM Release 4.7b - www.ulisp.com
|
||||
David Johnson-Davies - www.technoblogy.com - 20th March 2025
|
||||
|
||||
Licensed under the MIT license: https://opensource.org/licenses/MIT
|
||||
*/
|
||||
@@ -241,7 +241,7 @@ const char LispLibrary[] = "";
|
||||
#define CPU_RP2040
|
||||
|
||||
#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)
|
||||
#define WORKSPACESIZE (15536-SDSIZE) /* Objects (8*bytes) */
|
||||
#define WORKSPACESIZE (15232-SDSIZE) /* Objects (8*bytes) */
|
||||
#define CODESIZE 256 /* Bytes */
|
||||
#define STACKDIFF 480
|
||||
#define LITTLEFS
|
||||
@@ -3894,8 +3894,8 @@ object *fn_copylist (object *args, object *env) {
|
||||
if (!listp(arg)) error(notalist, arg);
|
||||
object *result = cons(NULL, NULL);
|
||||
object *ptr = result;
|
||||
while (arg != NULL) {
|
||||
cdr(ptr) = cons(car(arg), NULL);
|
||||
while (consp(arg)) {
|
||||
cdr(ptr) = cons(car(arg), cdr(arg));
|
||||
ptr = cdr(ptr); arg = cdr(arg);
|
||||
}
|
||||
return cdr(result);
|
||||
@@ -4822,10 +4822,13 @@ object *fn_readline (object *args, object *env) {
|
||||
return readstring('\n', false, gfun);
|
||||
}
|
||||
|
||||
inline void serialwrite (char c) { Serial.write(c); }
|
||||
|
||||
object *fn_writebyte (object *args, object *env) {
|
||||
(void) env;
|
||||
int value = checkinteger(first(args));
|
||||
pfun_t pfun = pstreamfun(cdr(args));
|
||||
if (pfun == pserial) pfun = serialwrite;
|
||||
(pfun)(value);
|
||||
return nil;
|
||||
}
|
||||
@@ -4981,9 +4984,10 @@ object *fn_analogreference (object *args, object *env) {
|
||||
#if defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) || defined(MAX32620) \
|
||||
|| defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_RASPBERRY_PI_PICO_W) \
|
||||
|| defined(ARDUINO_ADAFRUIT_FEATHER_RP2040) || defined(ARDUINO_ADAFRUIT_FEATHER_RP2040_ADALOGGER) \
|
||||
|| defined(ARDUINO_ADAFRUIT_QTPY_RP2040) || defined(ARDUINO_RASPBERRY_PI_PICO_2) \
|
||||
|| defined(ARDUINO_RASPBERRY_PI_PICO_2W) || defined(ARDUINO_PIMORONI_PICO_PLUS_2) \
|
||||
|| defined(ARDUINO_PIMORONI_TINY2350) || defined(ARDUINO_NANO_MATTER)
|
||||
|| defined(ARDUINO_ADAFRUIT_QTPY_RP2040) || defined(ARDUINO_SEEED_XIAO_RP2040) \
|
||||
|| defined(ARDUINO_RASPBERRY_PI_PICO_2) || defined(ARDUINO_RASPBERRY_PI_PICO_2W) \
|
||||
|| defined(ARDUINO_PIMORONI_PICO_PLUS_2) || defined(ARDUINO_PIMORONI_TINY2350) \
|
||||
|| defined(ARDUINO_NANO_MATTER)
|
||||
error2("not supported");
|
||||
#else
|
||||
analogReference((eAnalogReference)checkkeyword(arg));
|
||||
@@ -5137,7 +5141,7 @@ object *fn_format (object *args, object *env) {
|
||||
object *save = NULL;
|
||||
args = cddr(args);
|
||||
int len = stringlength(formatstr);
|
||||
uint8_t n = 0, width = 0, w, bra = 0;
|
||||
uint16_t n = 0, width = 0, w, bra = 0;
|
||||
char pad = ' ';
|
||||
bool tilde = false, mute = false, comma = false, quote = false;
|
||||
while (n < len) {
|
||||
@@ -6205,8 +6209,12 @@ const char doc22[] = "(eq item item)\n"
|
||||
"or point to the same cons, and returns t or nil as appropriate.";
|
||||
const char doc23[] = "(car list)\n"
|
||||
"Returns the first item in a list.";
|
||||
const char doc24[] = "(first list)\n"
|
||||
"Returns the first item in a list. Equivalent to car.";
|
||||
const char doc25[] = "(cdr list)\n"
|
||||
"Returns a list with the first item removed.";
|
||||
const char doc26[] = "(rest list)\n"
|
||||
"Returns a list with the first item removed. Equivalent to cdr.";
|
||||
const char doc27[] = "(nth number list)\n"
|
||||
"Returns the nth item in list, counting from zero.";
|
||||
const char doc28[] = "(aref array index [index*])\n"
|
||||
@@ -6312,6 +6320,8 @@ const char doc64[] = "(and item*)\n"
|
||||
"Evaluates its arguments until one returns nil, and returns the last value.";
|
||||
const char doc65[] = "(not item)\n"
|
||||
"Returns t if its argument is nil, or nil otherwise. Equivalent to null.";
|
||||
const char doc66[] = "(null list)\n"
|
||||
"Returns t if its argument is nil, or nil otherwise. Equivalent to not.";
|
||||
const char doc67[] = "(cons item item)\n"
|
||||
"If the second argument is a list, cons returns a new list with item added to the front of the list.\n"
|
||||
"If the second argument isn't a list cons returns a dotted pair.";
|
||||
@@ -6338,6 +6348,8 @@ const char doc77[] = "(equal item item)\n"
|
||||
"or point to the same cons, and returns t or nil as appropriate.";
|
||||
const char doc78[] = "(caar list)";
|
||||
const char doc79[] = "(cadr list)";
|
||||
const char doc80[] = "(second list)\n"
|
||||
"Returns the second item in a list. Equivalent to cadr.";
|
||||
const char doc81[] = "(cdar list)\n"
|
||||
"Equivalent to (cdr (car list)).";
|
||||
const char doc82[] = "(cddr list)\n"
|
||||
@@ -6350,6 +6362,8 @@ const char doc85[] = "(cadar list)\n"
|
||||
"Equivalent to (car (cdr (car list))).";
|
||||
const char doc86[] = "(caddr list)\n"
|
||||
"Equivalent to (car (cdr (cdr list))).";
|
||||
const char doc87[] = "(third list)\n"
|
||||
"Returns the third item in a list. Equivalent to caddr.";
|
||||
const char doc88[] = "(cdaar list)\n"
|
||||
"Equivalent to (cdar (car (car list))).";
|
||||
const char doc89[] = "(cdadr list)\n"
|
||||
@@ -6760,9 +6774,9 @@ const tbl_entry_t lookup_table[] = {
|
||||
{ string21, sp_defcode, 0307, doc21 },
|
||||
{ string22, fn_eq, 0222, doc22 },
|
||||
{ string23, fn_car, 0211, doc23 },
|
||||
{ string24, fn_car, 0211, NULL },
|
||||
{ string24, fn_car, 0211, doc24 },
|
||||
{ string25, fn_cdr, 0211, doc25 },
|
||||
{ string26, fn_cdr, 0211, NULL },
|
||||
{ string26, fn_cdr, 0211, doc26 },
|
||||
{ string27, fn_nth, 0222, doc27 },
|
||||
{ string28, fn_aref, 0227, doc28 },
|
||||
{ string29, fn_char, 0222, doc29 },
|
||||
@@ -6802,7 +6816,7 @@ const tbl_entry_t lookup_table[] = {
|
||||
{ string63, tf_case, 0117, doc63 },
|
||||
{ string64, tf_and, 0107, doc64 },
|
||||
{ string65, fn_not, 0211, doc65 },
|
||||
{ string66, fn_not, 0211, NULL },
|
||||
{ string66, fn_not, 0211, doc66 },
|
||||
{ string67, fn_cons, 0222, doc67 },
|
||||
{ string68, fn_atom, 0211, doc68 },
|
||||
{ string69, fn_listp, 0211, doc69 },
|
||||
@@ -6816,14 +6830,14 @@ const tbl_entry_t lookup_table[] = {
|
||||
{ string77, fn_equal, 0222, doc77 },
|
||||
{ string78, fn_caar, 0211, doc78 },
|
||||
{ string79, fn_cadr, 0211, doc79 },
|
||||
{ string80, fn_cadr, 0211, NULL },
|
||||
{ string80, fn_cadr, 0211, doc80 },
|
||||
{ string81, fn_cdar, 0211, doc81 },
|
||||
{ string82, fn_cddr, 0211, doc82 },
|
||||
{ string83, fn_caaar, 0211, doc83 },
|
||||
{ string84, fn_caadr, 0211, doc84 },
|
||||
{ string85, fn_cadar, 0211, doc85 },
|
||||
{ string86, fn_caddr, 0211, doc86 },
|
||||
{ string87, fn_caddr, 0211, NULL },
|
||||
{ string87, fn_caddr, 0211, doc87 },
|
||||
{ string88, fn_cdaar, 0211, doc88 },
|
||||
{ string89, fn_cdadr, 0211, doc89 },
|
||||
{ string90, fn_cddar, 0211, doc90 },
|
||||
@@ -7999,7 +8013,6 @@ void initgfx () {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Entry point from the Arduino IDE
|
||||
void setup () {
|
||||
Serial.begin(9600);
|
||||
int start = millis();
|
||||
@@ -8008,7 +8021,7 @@ void setup () {
|
||||
initenv();
|
||||
initsleep();
|
||||
initgfx();
|
||||
pfstring(PSTR("uLisp 4.7a "), pserial); pln(pserial);
|
||||
pfstring(PSTR("uLisp 4.7b "), pserial); pln(pserial);
|
||||
}
|
||||
|
||||
// Read/Evaluate/Print loop
|
||||
|
||||
Reference in New Issue
Block a user