Version 4.4 - 21st March 2023

This commit is contained in:
David Johnson-Davies 2023-03-21 08:40:22 +00:00 committed by GitHub
parent 27d2480c65
commit 7ca8283858
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10728 additions and 1658 deletions

8768
ulisp-arm-comments.ino Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

50
ulisp-extensions.ino Normal file
View File

@ -0,0 +1,50 @@
/*
User Extensions
*/
// Definitions
object *fn_now (object *args, object *env) {
(void) env;
static unsigned long Offset;
unsigned long now = millis()/1000;
int nargs = listlength(args);
// Set time
if (nargs == 3) {
Offset = (unsigned long)((checkinteger(first(args))*60 + checkinteger(second(args)))*60
+ checkinteger(third(args)) - now);
} else if (nargs > 0) error2(PSTR("wrong number of arguments"));
// Return time
unsigned long secs = Offset + now;
object *seconds = number(secs%60);
object *minutes = number((secs/60)%60);
object *hours = number((secs/3600)%24);
return cons(hours, cons(minutes, cons(seconds, NULL)));
}
// Symbol names
const char stringnow[] PROGMEM = "now";
// Documentation strings
const char docnow[] PROGMEM = "(now [hh mm ss])\n"
"Sets the current time, or with no arguments returns the current time\n"
"as a list of three integers (hh mm ss).";
// Symbol lookup table
const tbl_entry_t lookup_table2[] PROGMEM = {
{ stringnow, fn_now, 0203, docnow },
};
// Table cross-reference functions
tbl_entry_t *tables[] = {lookup_table, lookup_table2};
const unsigned int tablesizes[] = { arraysize(lookup_table), arraysize(lookup_table2) };
const tbl_entry_t *table (int n) {
return tables[n];
}
unsigned int tablesize (int n) {
return tablesizes[n];
}