Squashed 'lispBM/lispBM/' changes from a33d675a..fa3a730e

fa3a730e added an extra condition to writing symbols to flash, the reader must now be incremental for this to happen
3b7c98b0 addition to lbmref

git-subtree-dir: lispBM/lispBM
git-subtree-split: fa3a730e3e9d90da3ea9732addd5a687af03eea7
This commit is contained in:
Benjamin Vedder 2023-08-08 12:50:50 +02:00
parent b60ecc8a2d
commit d7dfb53109
3 changed files with 18 additions and 1 deletions

View File

@ -1552,6 +1552,18 @@ Example:
---
### self
Use `self` to obtain the thread-id of the thread in which `self` is evaluated.
The form of a `self` expression is `(self)`. The thread id is of an integer type.
Example:
```clj
# (self)
> 314
```
---
### wait
Use `wait` to wait for a spawned process to finish.

View File

@ -39,6 +39,7 @@ extern "C" {
#define EVAL_CPS_CONTEXT_FLAG_TRAP (uint32_t)0x1
#define EVAL_CPS_CONTEXT_FLAG_CONST (uint32_t)0x2
#define EVAL_CPS_CONTEXT_FLAG_CONST_SYMBOL_STRINGS (uint32_t)0x4
#define EVAL_CPS_CONTEXT_FLAG_INCREMENTAL_READ (uint32_t)0x5
/** The eval_context_t struct represents a lispbm process.
*

View File

@ -2081,6 +2081,7 @@ static void apply_read_program(lbm_value *args, lbm_uint nargs, eval_context_t *
}
static void apply_read_eval_program(lbm_value *args, lbm_uint nargs, eval_context_t *ctx) {
ctx->flags |= EVAL_CPS_CONTEXT_FLAG_INCREMENTAL_READ;
apply_read_base(args,nargs,ctx,true,true);
}
@ -2878,6 +2879,8 @@ static void read_finish(lbm_char_channel_t *str, eval_context_t *ctx) {
*/
ctx->flags &= ~EVAL_CPS_CONTEXT_FLAG_INCREMENTAL_READ;
if (lbm_is_symbol(ctx->r)) {
lbm_uint sym_val = lbm_dec_sym(ctx->r);
if (sym_val >= TOKENIZER_SYMBOLS_START &&
@ -3165,7 +3168,8 @@ static void cont_read_next_token(eval_context_t *ctx) {
} else if (tokpar_sym_str[0] == '#') {
r = lbm_add_variable_symbol(tokpar_sym_str, &symbol_id);
} else {
if (ctx->flags & EVAL_CPS_CONTEXT_FLAG_CONST_SYMBOL_STRINGS) {
if (ctx->flags & EVAL_CPS_CONTEXT_FLAG_CONST_SYMBOL_STRINGS &&
ctx->flags & EVAL_CPS_CONTEXT_FLAG_INCREMENTAL_READ) {
r = lbm_add_symbol_flash(tokpar_sym_str, &symbol_id);
} else {
r = lbm_add_symbol(tokpar_sym_str, &symbol_id);