bldc/repl/repl.c

883 lines
24 KiB
C
Raw Normal View History

/*
Copyright 2018, 2021, 2022 Joel Svensson svenssonjoel@yahoo.se
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <errno.h>
#include <pthread.h>
#include <sys/time.h>
#include <unistd.h>
#include <termios.h>
#include <ctype.h>
#include "lispbm.h"
Squashed 'lispBM/lispBM/' changes from 6a219e20..7930b985 7930b985 tweak change log e8869883 small amounts of optimization to eval_cps ac3bd152 silly call-cc test 8dba90e3 Merge branch 'master' into dev f4cf6a54 added one more test of array_extensions, packing and upacking floats b27895cb added test for hex numbers 337c0eda fix bug in compression that applies to hexadecimal numnbers. a55c5857 added another array_extensions test and fixed one bug d255d69b added another array_extensions test 983024d4 array creation from lisp and one test added 65d8a498 bug fix array_extensions 47ddb8ae updates to array_extensions cb5c3421 small tweaks to array-extensions, starting to maybe make sense 01233e92 some small additions to array_extensions fb9db7ab mini-tweak array_extensions a05aa268 fix bugs in lispbm.mk and add a test of variables2 ddca1665 small tweaks array-extensions 2466abc6 work in progress 0dc7ec7c work in progress with a library of array extensions df142ceb added .clang_complete 5229ca5e planning, no code yet cd6f5e3f Merge branch 'master' into dev 0f4c9bf2 added a rule for running tests from the makefile and tweaks test-script to only fail if there are unexpected failures 7a61f4e1 Merge branch 'master' into dev 9f8c9caf update lbm_version feab23d3 Merge branch 'master' into dev 112c01df added array creation from C on the lbm_memory. GC will remove these ca70c70a Merge branch 'master' into dev f8e38cc2 Merge branch 'master' into dev fc203669 Merge branch 'master' into dev 57af7182 Merge branch 'master' into dev 037e2352 commenting and version 977cd92a Merge branch 'master' into dev 34322bcf small tweak readme 1f22da9e fix recursion issue with macros fec81a7b version tweak 8548884b macros and callcc 7eadf3cc added a macro test2 8152930d improvement to macro subsystem cce45228 first sketch of macro expansion git-subtree-dir: lispBM/lispBM git-subtree-split: 7930b9854a05a8d09b40d078da94bb3743ef977b
2022-02-21 03:02:15 -08:00
#include "extensions/array_extensions.h"
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
#include "extensions/string_extensions.h"
#include "extensions/math_extensions.h"
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
#include "lbm_custom_type.h"
#include "lbm_channel.h"
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
#define EVAL_CPS_STACK_SIZE 256
#define GC_STACK_SIZE 256
#define PRINT_STACK_SIZE 256
#define EXTENSION_STORAGE_SIZE 256
#define VARIABLE_STORAGE_SIZE 256
#define WAIT_TIMEOUT 2500
#define STR_SIZE 1024
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
lbm_uint gc_stack_storage[GC_STACK_SIZE];
lbm_uint print_stack_storage[PRINT_STACK_SIZE];
extension_fptr extension_storage[EXTENSION_STORAGE_SIZE];
lbm_value variable_storage[VARIABLE_STORAGE_SIZE];
static volatile bool allow_print = true;
struct termios old_termios;
struct termios new_termios;
/* static lbm_tokenizer_string_state_t string_tok_state; */
/* static lbm_tokenizer_char_stream_t string_tok; */
static lbm_char_channel_t string_tok;
static lbm_string_channel_state_t string_tok_state;
pthread_mutex_t mut;
typedef struct read_s {
lbm_cid cid;
char *str;
struct read_s *next;
struct read_s *prev;
} read_t;
read_t *reading = NULL;
void add_reading( read_t *r ) {
pthread_mutex_lock(&mut);
r->next = reading;
r->prev = NULL;
if (reading) reading->prev = r;
reading = r;
pthread_mutex_unlock(&mut);
}
read_t *get_reading(lbm_cid cid) {
pthread_mutex_lock(&mut);
read_t *res = NULL;
read_t *curr = reading;
while (curr) {
if (curr->cid == cid) {
res = curr;
if (curr->prev) {
curr->prev->next = curr->next;
} else {
reading = curr->next;
}
if (curr->next) {
curr->next->prev = curr->prev;
}
break;
}
curr = curr->next;
}
pthread_mutex_unlock(&mut);
return res;
}
void free_reading(read_t *r) {
free(r->str);
free(r);
}
void setup_terminal(void) {
tcgetattr(0,&old_termios);
new_termios = old_termios;
//new_termios.c_iflag; // INPUT MODES
//new_termios.c_oflag; // OUTPUT MODES
//new_termios.c_cflag; // CONTROL MODES
// LOCAL MODES
new_termios.c_lflag &= (tcflag_t) ~(ICANON | ISIG | ECHO);
new_termios.c_cc[VMIN] = 0;
new_termios.c_cc[VTIME] = 0;
//new_termios.c_cc; // SPECIAL CHARACTERS
// LOCAL MODES
// Turn off:
// - canonical mode
// - Signal generation for certain characters (INTR, QUIT, SUSP, DSUSP)
// VMIN: Minimal number of characters for noncanonical read.
// VTIME: Timeout in deciseconds for noncanonical read.
tcsetattr(0, TCSANOW, &new_termios);
}
void restore_terminal(void) {
tcsetattr(0, TCSANOW, &old_termios);
}
void new_prompt() {
printf("\33[2K\r");
printf("# ");
fflush(stdout);
}
void erase() {
printf("\33[2K\r");
fflush(stdout);
}
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
int inputline(char *buffer, int size) {
int n = 0;
int c;
for (n = 0; n < size - 1; n++) {
c = getchar(); // busy waiting.
if (c < 0) {
n--;
struct timespec s;
struct timespec r;
s.tv_sec = 0;
s.tv_nsec = (long)1000 * 1000;
nanosleep(&s, &r);
continue;
}
switch (c) {
case 27:
break;
case 127: /* fall through to below */
case '\b': /* backspace character received */
if (n > 0)
n--;
buffer[n] = 0;
//putchar(0x8); /* output backspace character */
//putchar(' ');
//putchar(0x8);
n--; /* set up next iteration to deal with preceding char location */
break;
case '\n': /* fall through to \r */
case '\r':
buffer[n] = 0;
return n;
default:
if (isprint(c)) { /* ignore non-printable characters */
//putchar(c);
buffer[n] = (char)c;
} else {
n -= 1;
}
break;
}
}
buffer[size - 1] = 0;
return 0; // Filled up buffer without reading a linebreak
}
void *eval_thd_wrapper(void *v) {
lbm_run_eval();
return NULL;
}
void done_callback(eval_context_t *ctx) {
erase();
char output[1024];
lbm_value t = ctx->r;
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
lbm_print_value(output, 1024, t);
printf("> %s\n", output);
fflush(stdout);
new_prompt();
}
void read_done_callback(lbm_cid cid) {
erase();
read_t *r = get_reading(cid);
if (r == NULL) {
// This case happens if the lisp code executes "read"
} else {
free_reading(r);
}
fflush(stdout);
new_prompt();
}
int error_print(const char *format, ...) {
erase();
va_list args;
va_start (args, format);
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
int n = vprintf(format, args);
va_end(args);
new_prompt();
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
return n;
}
uint32_t timestamp_callback() {
struct timeval tv;
gettimeofday(&tv,NULL);
return (uint32_t)(tv.tv_sec * 1000000 + tv.tv_usec);
}
void sleep_callback(uint32_t us) {
struct timespec s;
struct timespec r;
s.tv_sec = 0;
s.tv_nsec = (long)us * 1000;
nanosleep(&s, &r);
}
bool dyn_load(const char *str, const char **code) {
bool res = false;
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
if (strlen(str) == 5 && strncmp(str, "defun", 5) == 0) {
*code = "(define defun (macro (name args body) `(define ,name (lambda ,args ,body))))";
res = true;
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
} else if (strlen(str) == 4 && strncmp(str, "iota", 4) == 0) {
*code = "(define iota (lambda (n) (range 0 n)))";
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
res = true;
} else if (strlen(str) == 6 && strncmp(str, "length", 6) == 0) {
*code = "(define length (lambda (xs)"
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
"(let ((len (lambda (l xs)"
"(if (eq xs nil) l"
"(len (+ l 1) (cdr xs))))))"
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
"(len 0 xs))))";
res = true;
} else if (strlen(str) == 4 && strncmp(str, "take", 4) == 0) {
*code = "(define take (lambda (n xs)"
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
"(let ((take-tail (lambda (acc n xs)"
"(if (= n 0) acc"
"(take-tail (cons (car xs) acc) (- n 1) (cdr xs))))))"
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
"(reverse (take-tail nil n xs)))))";
res = true;
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
} else if (strlen(str) == 4 && strncmp(str, "drop", 4) == 0) {
*code = "(define drop (lambda (n xs)"
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
"(if (= n 0) xs"
"(if (eq xs nil) nil"
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
"(drop (- n 1) (cdr xs))))))";
res = true;
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
} else if (strlen(str) == 3 && strncmp(str, "zip", 3) == 0) {
*code = "(define zip (lambda (xs ys)"
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
"(if (eq xs nil) nil"
"(if (eq ys nil) nil"
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
"(cons (cons (car xs) (car ys)) (zip (cdr xs) (cdr ys)))))))";
res = true;
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
} else if (strlen(str) == 6 && strncmp(str, "lookup", 6) == 0) {
*code = "(define lookup (lambda (x xs)"
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
"(if (eq xs nil) nil"
"(if (eq (car (car xs)) x)"
"(car (cdr (car xs)))"
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
"(lookup x (cdr xs))))))";
res = true;
} else if (strlen(str) == 5 && strncmp(str, "foldr", 5) == 0) {
*code = "(define foldr (lambda (f i xs)"
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
"(if (eq xs nil) i"
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
"(f (car xs) (foldr f i (cdr xs))))))";
res = true;
} else if (strlen(str) == 5 && strncmp(str, "foldl", 5) == 0) {
*code = "(define foldl (lambda (f i xs)"
"(if (eq xs nil) i (foldl f (f i (car xs)) (cdr xs)))))";
res = true;
}
return res;
}
lbm_value ext_block(lbm_value *args, lbm_uint argn) {
printf("blocking CID: %d\n", lbm_get_current_cid());
lbm_block_ctx_from_extension();
return lbm_enc_sym(SYM_TRUE);
}
lbm_value ext_print(lbm_value *args, lbm_uint argn) {
erase();
if (argn < 1) return lbm_enc_sym(SYM_NIL);
if (!allow_print) return lbm_enc_sym(SYM_TRUE);
char output[1024];
Squashed 'lispBM/lispBM/' changes from ccca9778..db80cb7d db80cb7d updates to how symbols are evaluated, mostly for readability but also efficiency bb573b53 slight optimizations to mark_phase and mark_freelist 58242f41 tweaking the manual 51666fb5 update manual fix prelude situation 2c6349da work on manual 39a15fd8 update a5310055 added a bit more text about symbols in the manual 60d59eec added a bit more text about symbols in the manual f685819e added a bit more text about symbols in the manual 31d56d35 added a bit more text about symbols in the manual 54796c35 added a bit more text about symbols in the manual e333c00f Small readability and efficiency tweaks to eval_cps 0d234b5e lbm_cadr added and sligth modifications to eval_cps.c using lbm_cadr 85cd864a update changelog 6d2c8685 work on manual 5203a64f work on manual 63ebbae2 work on manual 4a146954 work on manual 19a0d06f work on manual 91c1d992 work on manual ab393f46 work on manual 26309199 work on manual c474931b work on manual 1a822e8d work on manual 648f6433 work on manual 6737828a work on manual 2d8e7084 work on manual 3a834fce work on manual 7ae1b342 work on manual bc5b1fd0 work on manual d3b6ec4d work on manual 654d70f8 writing on the manual 0d66dda6 tweak readme d846ea3b update README 2c18d1a6 small tweak bd9f80e5 allowing more characters in symbols 61827fc2 remove the prelude library in its current form. It is still available in the REPL f1dcea8f small tweak benchmarking code 3a761cee update manual e9898b19 make the prelude functions load dynamically when needed by the repl and test-system 714be360 update manual e1804e3e update lbmref, renamings 508d167c Update README.md 6f3207fa Update ch1_introduction.md 6562daef Update ch1_introduction.md 76b48adf work in progress proramming doc 91c44751 fix repl-cps makefile to correctly build deps 54e66b25 remove lbmref.dox f0c90ffd update reference manual 5b577572 fix potential bug in cont_application_start git-subtree-dir: lispBM/lispBM git-subtree-split: db80cb7dd05eef9e71980a55ff7987118c32c6e9
2022-04-12 01:44:49 -07:00
for (unsigned int i = 0; i < argn; i ++) {
lbm_value t = args[i];
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
if (lbm_is_ptr(t) && lbm_type_of(t) == LBM_TYPE_ARRAY) {
lbm_array_header_t *array = (lbm_array_header_t *)lbm_car(t);
switch (array->elt_type){
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
case LBM_TYPE_CHAR: {
char *data = (char*)array->data;
printf("%s", data);
break;
}
default:
return lbm_enc_sym(SYM_NIL);
break;
}
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
} else if (lbm_type_of(t) == LBM_TYPE_CHAR) {
printf("%c", lbm_dec_char(t));
} else {
lbm_print_value(output, 1024, t);
printf("%s", output);
}
}
printf("\n");
new_prompt();
return lbm_enc_sym(SYM_TRUE);
}
char output[128];
static lbm_value ext_range(lbm_value *args, lbm_uint argn) {
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
if (argn != 2 || lbm_type_of(args[0]) != LBM_TYPE_I || lbm_type_of(args[1]) != LBM_TYPE_I) {
return lbm_enc_sym(SYM_EERROR);
}
lbm_int start = lbm_dec_i(args[0]);
lbm_int end = lbm_dec_i(args[1]);
if (start > end || (end - start) > 100) {
return lbm_enc_sym(SYM_EERROR);
}
lbm_value res = lbm_enc_sym(SYM_NIL);
for (lbm_int i = end;i >= start;i--) {
res = lbm_cons(lbm_enc_i(i), res);
}
return res;
}
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
static bool test_destruct(lbm_uint value) {
printf("destroying custom value\n");
free((lbm_uint*)value);
return true;
}
static lbm_value ext_custom(lbm_value *args, lbm_uint argn) {
lbm_uint *mem = (lbm_uint*)malloc(1000*sizeof(lbm_uint));
lbm_value res;
lbm_custom_type_create((lbm_uint)mem, test_destruct, "custom_type", &res);
return res;
}
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
static lbm_value ext_event(lbm_value *args, lbm_uint argn) {
if (argn != 1 || !lbm_is_symbol(args[0])) return ENC_SYM_EERROR;
lbm_event_t e;
e.type = LBM_EVENT_SYM;
e.sym = lbm_dec_sym(args[0]);
if (lbm_event(e, NULL, 0)) {
return ENC_SYM_TRUE;
}
return ENC_SYM_NIL;
}
/* load a file, caller is responsible for freeing the returned string */
char * load_file(char *filename) {
char *file_str = NULL;
//size_t str_len = strlen(filename);
//filename[str_len-1] = 0;
int i = 0;
while (filename[i] == ' ' && filename[i] != 0) {
i ++;
}
FILE *fp;
printf("filename: %s\n", &filename[i]);
if (strlen(&filename[i]) > 0) {
errno = 0;
fp = fopen(&filename[i], "r");
if (!fp) {
return NULL;
}
long fsize_long;
unsigned int fsize;
fseek(fp, 0, SEEK_END);
fsize_long = ftell(fp);
if (fsize_long <= 0) {
return NULL;
}
fsize = (unsigned int) fsize_long;
fseek(fp, 0, SEEK_SET);
file_str = malloc(fsize+1);
memset(file_str, 0 , fsize+1);
if (fread(file_str,1,fsize,fp) != fsize) {
free(file_str);
file_str = NULL;
}
fclose(fp);
}
return file_str;
}
void print_ctx_info(eval_context_t *ctx, void *arg1, void *arg2) {
(void) arg1;
(void) arg2;
char output[1024];
int print_ret = lbm_print_value(output, 1024, ctx->r);
printf("--------------------------------\n");
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
printf("ContextID: %"PRI_UINT"\n", ctx->id);
printf("Stack SP: %"PRI_UINT"\n", ctx->K.sp);
printf("Stack SP max: %"PRI_UINT"\n", ctx->K.max_sp);
if (print_ret) {
printf("Value: %s\n", output);
} else {
printf("Error: %s\n", output);
}
}
void ctx_exists(eval_context_t *ctx, void *arg1, void *arg2) {
lbm_cid id = *(lbm_cid*)arg1;
bool *exists = (bool*)arg2;
if (ctx->id == id) {
*exists = true;
}
}
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
void lookup_local(eval_context_t *ctx, void *arg1, void *arg2) {
char output[1024];
lbm_value res;
if (lbm_env_lookup_b(&res, (lbm_value)arg1, ctx->curr_env)) {
lbm_print_value(output, 1024, res);
printf("CTX %d: %s = %s\n", ctx->id, (char *)arg2, output);
} else {
printf("not found\n");
}
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
}
void sym_it(const char *str) {
printf("%s\n", str);
}
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
static lbm_uint memory[LBM_MEMORY_SIZE_8K];
static lbm_uint bitmap[LBM_MEMORY_BITMAP_SIZE_8K];
char char_array[1024];
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
lbm_uint word_array[1024];
int main(int argc, char **argv) {
int res = 0;
pthread_t lispbm_thd;
pthread_mutex_init(&mut, NULL);
lbm_heap_state_t heap_state;
unsigned int heap_size = 2048;
lbm_cons_t *heap_storage = NULL;
for (int i = 0; i < 1024; i ++) {
char_array[i] = (char)i;
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
word_array[i] = (lbm_uint)i;
}
//setup_terminal();
heap_storage = (lbm_cons_t*)malloc(sizeof(lbm_cons_t) * heap_size);
if (heap_storage == NULL) {
return 0;
}
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
if (!lbm_init(heap_storage, heap_size,
gc_stack_storage, GC_STACK_SIZE,
memory, LBM_MEMORY_SIZE_8K,
bitmap, LBM_MEMORY_BITMAP_SIZE_8K,
print_stack_storage, PRINT_STACK_SIZE,
extension_storage, EXTENSION_STORAGE_SIZE)) {
printf("Failed to initialize LispBM\n");
return 0;
}
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
if (!lbm_eval_init_events(20)) {
printf("Failed to initialize events\n");
return 0;
}
lbm_set_ctx_done_callback(done_callback);
lbm_set_timestamp_us_callback(timestamp_callback);
lbm_set_usleep_callback(sleep_callback);
lbm_set_dynamic_load_callback(dyn_load);
lbm_set_printf_callback(error_print);
lbm_set_reader_done_callback(read_done_callback);
lbm_variables_init(variable_storage, VARIABLE_STORAGE_SIZE);
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
if (lbm_array_extensions_init()) {
printf("Array extensions loaded\n");
} else {
printf("Loading array extensions failed\n");
}
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
if (lbm_string_extensions_init()) {
printf("String extensions loaded\n");
} else {
printf("Loading string extensions failed\n");
Squashed 'lispBM/lispBM/' changes from 6a219e20..7930b985 7930b985 tweak change log e8869883 small amounts of optimization to eval_cps ac3bd152 silly call-cc test 8dba90e3 Merge branch 'master' into dev f4cf6a54 added one more test of array_extensions, packing and upacking floats b27895cb added test for hex numbers 337c0eda fix bug in compression that applies to hexadecimal numnbers. a55c5857 added another array_extensions test and fixed one bug d255d69b added another array_extensions test 983024d4 array creation from lisp and one test added 65d8a498 bug fix array_extensions 47ddb8ae updates to array_extensions cb5c3421 small tweaks to array-extensions, starting to maybe make sense 01233e92 some small additions to array_extensions fb9db7ab mini-tweak array_extensions a05aa268 fix bugs in lispbm.mk and add a test of variables2 ddca1665 small tweaks array-extensions 2466abc6 work in progress 0dc7ec7c work in progress with a library of array extensions df142ceb added .clang_complete 5229ca5e planning, no code yet cd6f5e3f Merge branch 'master' into dev 0f4c9bf2 added a rule for running tests from the makefile and tweaks test-script to only fail if there are unexpected failures 7a61f4e1 Merge branch 'master' into dev 9f8c9caf update lbm_version feab23d3 Merge branch 'master' into dev 112c01df added array creation from C on the lbm_memory. GC will remove these ca70c70a Merge branch 'master' into dev f8e38cc2 Merge branch 'master' into dev fc203669 Merge branch 'master' into dev 57af7182 Merge branch 'master' into dev 037e2352 commenting and version 977cd92a Merge branch 'master' into dev 34322bcf small tweak readme 1f22da9e fix recursion issue with macros fec81a7b version tweak 8548884b macros and callcc 7eadf3cc added a macro test2 8152930d improvement to macro subsystem cce45228 first sketch of macro expansion git-subtree-dir: lispBM/lispBM git-subtree-split: 7930b9854a05a8d09b40d078da94bb3743ef977b
2022-02-21 03:02:15 -08:00
}
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
if (lbm_math_extensions_init()) {
printf("Math extensions loaded\n");
} else {
printf("Loading math extensions failed\n");
}
res = lbm_add_extension("block", ext_block);
if (res)
printf("Extension added.\n");
else
printf("Error adding extension.\n");
res = lbm_add_extension("print", ext_print);
if (res)
printf("Extension added.\n");
else
printf("Error adding extension.\n");
res = lbm_add_extension("range", ext_range);
if (res)
printf("Extension added.\n");
else
printf("Error adding extension.\n");
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
res = lbm_add_extension("custom", ext_custom);
if (res)
printf("Extension added.\n");
else
printf("Error adding extension.\n");
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
res = lbm_add_extension("event", ext_event);
if (res)
printf("Extension added.\n");
else
printf("Error adding extension.\n");
/* Start evaluator thread */
if (pthread_create(&lispbm_thd, NULL, eval_thd_wrapper, NULL)) {
printf("Error creating evaluation thread\n");
return 1;
}
printf("Lisp REPL started!\n");
printf("Type :quit to exit.\n");
printf(" :info for statistics.\n");
printf(" :load [filename] to load lisp source.\n");
char output[1024];
while (1) {
fflush(stdin);
new_prompt();
char *str = malloc(STR_SIZE);
memset(str, 0 ,STR_SIZE);
ssize_t n = inputline(str,STR_SIZE);
if (n >= 5 && strncmp(str, ":info", 5) == 0) {
printf("--(LISP HEAP)-----------------------------------------------\n");
lbm_get_heap_state(&heap_state);
printf("Heap size: %u Bytes\n", heap_size * 8);
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
printf("Used cons cells: %"PRI_INT"\n", heap_size - lbm_heap_num_free());
printf("Free cons cells: %"PRI_INT"\n", lbm_heap_num_free());
printf("GC counter: %"PRI_INT"\n", heap_state.gc_num);
printf("Recovered: %"PRI_INT"\n", heap_state.gc_recovered);
printf("Recovered arrays: %"PRI_UINT"\n", heap_state.gc_recovered_arrays);
printf("Marked: %"PRI_INT"\n", heap_state.gc_marked);
printf("--(Symbol and Array memory)---------------------------------\n");
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
printf("Memory size: %"PRI_UINT" Words\n", lbm_memory_num_words());
printf("Memory free: %"PRI_UINT" Words\n", lbm_memory_num_free());
printf("Allocated arrays: %"PRI_UINT"\n", heap_state.num_alloc_arrays);
printf("Symbol table size: %"PRI_UINT" Bytes\n", lbm_get_symbol_table_size());
printf("Symbol names size: %"PRI_UINT" Bytes\n", lbm_get_symbol_table_size_names());
free(str);
} else if (strncmp(str, ":env", 4) == 0) {
lbm_value curr = *lbm_get_env_ptr();
printf("Environment:\r\n");
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
while (lbm_type_of(curr) == LBM_TYPE_CONS) {
res = lbm_print_value(output,1024, lbm_car(curr));
curr = lbm_cdr(curr);
printf(" %s\r\n",output);
}
printf("Variables:\r\n");
for (int i = 0; i < lbm_get_num_variables(); i ++) {
const char *name = lbm_get_variable_name_by_index(i);
lbm_print_value(output,1024, lbm_get_variable_by_index(i));
printf(" %s = %s\r\n", name ? name : "error", output);
}
free(str);
}else if (n >= 5 && strncmp(str, ":load", 5) == 0) {
read_t *r = malloc(sizeof(read_t));
char *file_str = load_file(&str[5]);
if (file_str) {
/* lbm_create_char_stream_from_string(&string_tok_state, */
/* &string_tok, */
/* file_str); */
lbm_create_string_char_channel(&string_tok_state,
&string_tok,
file_str);
/* Get exclusive access to the heap */
lbm_pause_eval_with_gc(50);
while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) {
sleep_callback(10);
}
lbm_cid cid = lbm_load_and_eval_program(&string_tok);
r->str = file_str;
r->cid = cid;
add_reading(r);
lbm_continue_eval();
//printf("started ctx: %"PRI_UINT"\n", cid);
}
free(str);
} else if (n >= 5 && strncmp(str, ":verb", 5) == 0) {
lbm_toggle_verbose();
free(str);
continue;
} else if (n >= 4 && strncmp(str, ":pon", 4) == 0) {
allow_print = true;
free(str);
continue;
} else if (n >= 5 && strncmp(str, ":poff", 5) == 0) {
allow_print = false;
free(str);
continue;
} else if (strncmp(str, ":ctxs", 5) == 0) {
printf("****** Running contexts ******\n");
lbm_running_iterator(print_ctx_info, NULL, NULL);
printf("****** Blocked contexts ******\n");
lbm_blocked_iterator(print_ctx_info, NULL, NULL);
printf("****** Sleeping contexts *****\n");
lbm_sleeping_iterator(print_ctx_info, NULL, NULL);
free(str);
} else if (strncmp(str, ":unblock", 8) == 0) {
int id = atoi(str + 8);
printf("Unblocking: %d\n", id);
lbm_unblock_ctx(id, lbm_enc_i(42));
free(str);
} else if (n >= 5 && strncmp(str, ":quit", 5) == 0) {
free(str);
break;
} else if (strncmp(str, ":symbols", 8) == 0) {
lbm_symrepr_name_iterator(sym_it);
free(str);
} else if (strncmp(str, ":heap", 5) == 0) {
int size = atoi(str + 5);
if (size > 0) {
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
heap_size = (unsigned int)size;
free(heap_storage);
heap_storage = (lbm_cons_t*)malloc(sizeof(lbm_cons_t) * heap_size);
lbm_pause_eval();
while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) {
sleep_callback(10);
}
lbm_init(heap_storage, heap_size,
gc_stack_storage, GC_STACK_SIZE,
memory, LBM_MEMORY_SIZE_8K,
bitmap, LBM_MEMORY_BITMAP_SIZE_8K,
print_stack_storage, PRINT_STACK_SIZE,
extension_storage, EXTENSION_STORAGE_SIZE);
lbm_variables_init(variable_storage, VARIABLE_STORAGE_SIZE);
if (lbm_array_extensions_init()) {
printf("Array extensions loaded\n");
} else {
printf("Loading array extensions failed\n");
}
if (lbm_string_extensions_init()) {
printf("String extensions loaded\n");
} else {
printf("Loading string extensions failed\n");
}
if (lbm_math_extensions_init()) {
printf("Math extensions loaded\n");
} else {
printf("Loading math extensions failed\n");
}
res = lbm_add_extension("block", ext_block);
if (res)
printf("Extension added.\n");
else
printf("Error adding extension.\n");
lbm_add_extension("print", ext_print);
free(str);
}
} else if (strncmp(str, ":reset", 6) == 0) {
lbm_pause_eval();
while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) {
sleep_callback(10);
}
lbm_init(heap_storage, heap_size,
gc_stack_storage, GC_STACK_SIZE,
memory, LBM_MEMORY_SIZE_8K,
bitmap, LBM_MEMORY_BITMAP_SIZE_8K,
print_stack_storage, PRINT_STACK_SIZE,
extension_storage, EXTENSION_STORAGE_SIZE);
lbm_variables_init(variable_storage, VARIABLE_STORAGE_SIZE);
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
if (lbm_array_extensions_init()) {
printf("Array extensions loaded\n");
} else {
printf("Loading array extensions failed\n");
}
Squashed 'lispBM/lispBM/' changes from 6a219e20..7930b985 7930b985 tweak change log e8869883 small amounts of optimization to eval_cps ac3bd152 silly call-cc test 8dba90e3 Merge branch 'master' into dev f4cf6a54 added one more test of array_extensions, packing and upacking floats b27895cb added test for hex numbers 337c0eda fix bug in compression that applies to hexadecimal numnbers. a55c5857 added another array_extensions test and fixed one bug d255d69b added another array_extensions test 983024d4 array creation from lisp and one test added 65d8a498 bug fix array_extensions 47ddb8ae updates to array_extensions cb5c3421 small tweaks to array-extensions, starting to maybe make sense 01233e92 some small additions to array_extensions fb9db7ab mini-tweak array_extensions a05aa268 fix bugs in lispbm.mk and add a test of variables2 ddca1665 small tweaks array-extensions 2466abc6 work in progress 0dc7ec7c work in progress with a library of array extensions df142ceb added .clang_complete 5229ca5e planning, no code yet cd6f5e3f Merge branch 'master' into dev 0f4c9bf2 added a rule for running tests from the makefile and tweaks test-script to only fail if there are unexpected failures 7a61f4e1 Merge branch 'master' into dev 9f8c9caf update lbm_version feab23d3 Merge branch 'master' into dev 112c01df added array creation from C on the lbm_memory. GC will remove these ca70c70a Merge branch 'master' into dev f8e38cc2 Merge branch 'master' into dev fc203669 Merge branch 'master' into dev 57af7182 Merge branch 'master' into dev 037e2352 commenting and version 977cd92a Merge branch 'master' into dev 34322bcf small tweak readme 1f22da9e fix recursion issue with macros fec81a7b version tweak 8548884b macros and callcc 7eadf3cc added a macro test2 8152930d improvement to macro subsystem cce45228 first sketch of macro expansion git-subtree-dir: lispBM/lispBM git-subtree-split: 7930b9854a05a8d09b40d078da94bb3743ef977b
2022-02-21 03:02:15 -08:00
Squashed 'lispBM/lispBM/' changes from 6199703d..43ebce71 43ebce71 Fix formatting int print.c and constants that default to float/double fa220f0b update gc statistics collection a small bit 25b20686 fix get_heap_state 783d774e Arrays of 64bit values passes the associated tests. More tests are needed though ff40d02f working on 64bit arrays. more testing needed 204bea39 CMP as a macro instead of 8 different functions 44bb152d added a set of math extensions grabbed from Benjamin's bldc repo 9c34b4cd added string extensions from benjamins bldc repo b4370155 merge in changes on master into dev64bit c129344b fixed masking bug in fundamentals ed3ab5be closed down ome warnings when building 64bit d46564c9 expanded functionality of type-of to cover 64bit types and preparations for arrays of 64bit values f7cb5538 added more 64bit functionality to fundamentals and a tiny amount of tests 4dafbe6c added decoders for 64bit values 63026a8a added 64bit value literals 8c1f0f0f made GC aware of lbm_memory allocated values 17148ada 64 bit values allocated on lbm_memory on 32 bit version 4445e5a8 sketch of encoders for 64 bit values f636e64d suffix for the lisp size of int and uint are now i and u instead of i28 and u28 840723ca preparations and planning for 64bit types in both 32 and 64 bit versions. 13675dda 64bit up and running. but there are many TODOs 033bfd9a small fixes following bug hunt f5c984de fix bug in representation of important masks and constants d40b2437 Merge branch 'master' into dev64bit 06f9603f Merge branch 'master' into dev64bit 69950ba1 32 bit tests are ok 46b6fa28 Merge branch 'master' into dev64bit b9e2c993 work in progress 8dff9b4d work in progress a241aded work in progress 4738e0da update year in lbm_types ca469923 made it possible to run the same tests as on the 32 bit version on the 64 bit code 85acec30 small tweaks tp create_ctx, use correct type bf0286a7 Merge branch 'master' into dev64bit 824e1634 Merge branch 'master' into dev64bit 04a97f17 lots of testing needed ea862cce a bunch of changes in preparation for 64bit compatibility. git-subtree-dir: lispBM/lispBM git-subtree-split: 43ebce71a281f4a158b8d2dec3fc537c26766ec3
2022-03-25 07:47:05 -07:00
if (lbm_string_extensions_init()) {
printf("String extensions loaded\n");
} else {
printf("Loading string extensions failed\n");
}
if (lbm_math_extensions_init()) {
printf("Math extensions loaded\n");
} else {
printf("Loading math extensions failed\n");
}
lbm_add_extension("print", ext_print);
free(str);
} else if (strncmp(str, ":send", 5) == 0) {
int id;
int i_val;
if (sscanf(str + 5, "%d%d", &id, &i_val) == 2) {
lbm_pause_eval_with_gc(50);
while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) {
sleep_callback(10);
}
if (lbm_send_message((lbm_cid)id, lbm_enc_i(i_val)) == 0) {
printf("Could not send message\n");
}
lbm_continue_eval();
} else {
printf("Incorrect arguments to send\n");
}
free(str);
} else if (strncmp(str, ":pause", 6) == 0) {
lbm_pause_eval_with_gc(30);
while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) {
sleep_callback(10);
}
printf("Evaluator paused\n");
free(str);
} else if (strncmp(str, ":continue", 9) == 0) {
lbm_continue_eval();
free(str);
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
} else if (strncmp(str, ":inspect", 8) == 0) {
int i = 8;
if (strlen(str) >= 8) {
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
while (str[i] == ' ') i++;
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
}
char *sym = str + i;
lbm_uint sym_id = 0;
if (lbm_get_symbol_by_name(sym, &sym_id)) {
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
lbm_running_iterator(lookup_local, (void*)lbm_enc_sym(sym_id), (void*)sym);
lbm_blocked_iterator(lookup_local, (void*)lbm_enc_sym(sym_id), (void*)sym);
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
} else {
Squashed 'lispBM/lispBM/' changes from 1eceb43f..1267d006 1267d006 added one more memory test a9782eda added two tests that try to be quite hard on the lbm_memory. 5c0841f8 small additions to matvec bcb1ad7f added vector multiplication by scalar ce5025cc small additions to matvec. 1758b335 renamed blas_extensions to matvec extensions as they wont provide the same set of operations as a blas library usually does 2e48e6b4 fix silly typo in lbm_memory.c 62154010 only initialized mutices 1 time d1dbfd7c added a test of events cb97d623 only add events to the event queue if there is an event handler 7a642222 removed usage of send_message in process_events e3a68115 events are moving into the evaluator 64239a9b tweaks to random extensions d61950d9 removed a print from sierpinski f8a1d586 added sierpinski and flake examples to sdlrepl 72d8e4f4 added random number extensions to sdlrepl ba9c449a changed constants involved in the pseudorandom generator. 8806e369 remove left over debug printing 10cc7fab added random number generator extensions 184c756b added memory leakage tests for string extensions 4373713d work in progress linear_algebra extensions 135591bd added str-merge test 7bff0e97 added a test. more to follow e1aad339 added a small set of runtime system related extensions 5495b5da updates to custom type interface. 4e3b408a rename strnlen to strlen_max 03644f64 pulling in string extensions from vedderb\bldc into string_extensions.c 294f013b grabbed a few extra array-extensions into array_extensions.c from Vedderb/BLDC 87f95e67 adding all the Math extensions from Vedder/BLDC to math_extensions.c git-subtree-dir: lispBM/lispBM git-subtree-split: 1267d006e90085920a3de720480dc2d19d71c8ff
2023-01-24 00:19:05 -08:00
printf("symbol does not exist\n");
Squashed 'lispBM/lispBM/' changes from 3836952f..cdfd116c cdfd116c added some tests for partial applications 46d02e9c Added the possibilty to partially apply a closure 788dfa27 debug inspection of local environments in the REPL b28ceec1 shutting down some warnings originating in repl.c d35ef54d small tweak example code 5fa6f453 added some sanity checking of the type of the key used in let bindings 81314729 Updates chibios xmas-dac example so that it builds again 0d1f05ca updates chibios example repl so that it builds again 4ae17fc8 small tweak to texture loading demo. a309e37a added silly texture image for the sdl_texture.lisp example 1dc0e4e6 added texture loading extension and a blit function for drawing sprites on the window 6c249a37 proper scaling on the sleep and timestamp callbacks e65b0b83 ESP32c3 repl up and running 24f93026 work in progress esp32 repl 958a273d work in progress esp32 repl d4fb301b work in progress repl example for ESP platforms (esp32c3 specifically) 7e924bf6 freertos includes correctly, compiles. stiill untested 29b9e3a4 added freeRTOS platform files. Untested currently f3931c13 update README and small tweaks 357bb438 closing one warning 205ca17e small tweak to SDL tree-demo 27c1f601 added a way to explicitly run a custom type destructor and clean up its deference trampoline d955f26e added missing files a94dfb5c Update README.md 0e29e692 added SDL example that draws a tree a5417886 Bugfix in lbm_sdl.c for destructors of window and renderer b3a0e586 Getting started with interfacing LBM and SDL2 7aa2c1d0 started towards custom types with associated destructors for when they are freed by GC a8b33a8d safer behaviour of car and cdr in relation to pointer-types that are not really cons-cells 9fbf02ce fixed some inconsistencies 3051e8e7 update change log 8d002536 handling one warning in 64 bit compile 7794a9b2 added array tests a83f385c Merge branch 'master' of github.com:svenssonjoel/lispbm 21c79aaf fix problem with array parsing in the case of float arrays dc926e59 added script to generate ctags 38046a49 updates to changelog with changes up and including may 22 2022 45b5d6c0 fix potential corner case issue with call-cc on 64 bit platforms ebb100a5 some streamlining of the bind_to_key rest continuation in eval_cps.c 1c9a7df2 Added explicit stack version of defunctionalized evaluator example 2812b7b0 added some more testcases in evaluator.lisp and evaldefunc.lisp 0393bd21 New features in evaluator.lisp and evaldefunc.lisp c6dd4e10 found an evalutor bug related to progn thanks to writing evaluator.lisp and evaldefunc.lisp 5d1bfc75 added continuation passing style evaluator of a mini-lisp as well as a defunctionalized CPS style evaluator for the same mini-lisp a5a6c2a2 removed commented out old code c135b4a3 fix problem related to assoc 8ddd44cc removed some code duplication in eval_cps c625af8e lbmref update a1a7a4b6 lbmref update 12d9f4e9 lbmref update git-subtree-dir: lispBM/lispBM git-subtree-split: cdfd116c655e20bac787a2080b8c601c6bc846ca
2022-07-06 01:18:45 -07:00
}
Squashed 'lispBM/lispBM/' changes from 6a219e20..7930b985 7930b985 tweak change log e8869883 small amounts of optimization to eval_cps ac3bd152 silly call-cc test 8dba90e3 Merge branch 'master' into dev f4cf6a54 added one more test of array_extensions, packing and upacking floats b27895cb added test for hex numbers 337c0eda fix bug in compression that applies to hexadecimal numnbers. a55c5857 added another array_extensions test and fixed one bug d255d69b added another array_extensions test 983024d4 array creation from lisp and one test added 65d8a498 bug fix array_extensions 47ddb8ae updates to array_extensions cb5c3421 small tweaks to array-extensions, starting to maybe make sense 01233e92 some small additions to array_extensions fb9db7ab mini-tweak array_extensions a05aa268 fix bugs in lispbm.mk and add a test of variables2 ddca1665 small tweaks array-extensions 2466abc6 work in progress 0dc7ec7c work in progress with a library of array extensions df142ceb added .clang_complete 5229ca5e planning, no code yet cd6f5e3f Merge branch 'master' into dev 0f4c9bf2 added a rule for running tests from the makefile and tweaks test-script to only fail if there are unexpected failures 7a61f4e1 Merge branch 'master' into dev 9f8c9caf update lbm_version feab23d3 Merge branch 'master' into dev 112c01df added array creation from C on the lbm_memory. GC will remove these ca70c70a Merge branch 'master' into dev f8e38cc2 Merge branch 'master' into dev fc203669 Merge branch 'master' into dev 57af7182 Merge branch 'master' into dev 037e2352 commenting and version 977cd92a Merge branch 'master' into dev 34322bcf small tweak readme 1f22da9e fix recursion issue with macros fec81a7b version tweak 8548884b macros and callcc 7eadf3cc added a macro test2 8152930d improvement to macro subsystem cce45228 first sketch of macro expansion git-subtree-dir: lispBM/lispBM git-subtree-split: 7930b9854a05a8d09b40d078da94bb3743ef977b
2022-02-21 03:02:15 -08:00
} else if (strncmp(str, ":undef", 6) == 0) {
lbm_pause_eval_with_gc(50);
Squashed 'lispBM/lispBM/' changes from 6a219e20..7930b985 7930b985 tweak change log e8869883 small amounts of optimization to eval_cps ac3bd152 silly call-cc test 8dba90e3 Merge branch 'master' into dev f4cf6a54 added one more test of array_extensions, packing and upacking floats b27895cb added test for hex numbers 337c0eda fix bug in compression that applies to hexadecimal numnbers. a55c5857 added another array_extensions test and fixed one bug d255d69b added another array_extensions test 983024d4 array creation from lisp and one test added 65d8a498 bug fix array_extensions 47ddb8ae updates to array_extensions cb5c3421 small tweaks to array-extensions, starting to maybe make sense 01233e92 some small additions to array_extensions fb9db7ab mini-tweak array_extensions a05aa268 fix bugs in lispbm.mk and add a test of variables2 ddca1665 small tweaks array-extensions 2466abc6 work in progress 0dc7ec7c work in progress with a library of array extensions df142ceb added .clang_complete 5229ca5e planning, no code yet cd6f5e3f Merge branch 'master' into dev 0f4c9bf2 added a rule for running tests from the makefile and tweaks test-script to only fail if there are unexpected failures 7a61f4e1 Merge branch 'master' into dev 9f8c9caf update lbm_version feab23d3 Merge branch 'master' into dev 112c01df added array creation from C on the lbm_memory. GC will remove these ca70c70a Merge branch 'master' into dev f8e38cc2 Merge branch 'master' into dev fc203669 Merge branch 'master' into dev 57af7182 Merge branch 'master' into dev 037e2352 commenting and version 977cd92a Merge branch 'master' into dev 34322bcf small tweak readme 1f22da9e fix recursion issue with macros fec81a7b version tweak 8548884b macros and callcc 7eadf3cc added a macro test2 8152930d improvement to macro subsystem cce45228 first sketch of macro expansion git-subtree-dir: lispBM/lispBM git-subtree-split: 7930b9854a05a8d09b40d078da94bb3743ef977b
2022-02-21 03:02:15 -08:00
while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) {
sleep_callback(10);
}
char *sym = str + 7;
printf("undefining: %s\n", sym);
printf("%s\n", lbm_undefine(sym) ? "Cleared bindings" : "No definition found");
lbm_continue_eval();
free(str);
} else {
/* Get exclusive access to the heap */
read_t *r = malloc(sizeof(read_t));
lbm_pause_eval_with_gc(50);
while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) {
sleep_callback(10);
}
//printf("loading: %s\n", str);
//lbm_create_char_stream_from_string(&string_tok_state,
// &string_tok,
// str);
lbm_create_string_char_channel(&string_tok_state,
&string_tok,
str);
lbm_cid cid = lbm_load_and_eval_expression(&string_tok);
r->str = str;
r->cid = cid;
add_reading(r);
lbm_continue_eval();
//printf("started ctx: %"PRI_UINT"\n", cid);
}
}
free(heap_storage);
//restore_terminal();
return 0;
}