mirror of https://github.com/rusefi/bldc.git
Squashed 'lispBM/lispBM/' changes from ac1d06ab..f7c74492
f7c74492 tweak lbm_is_closure 072e2063 bug fixes realted to move-to-flash git-subtree-dir: lispBM/lispBM git-subtree-split: f7c74492b8413b5d55b45f85e0e6cce3b16e35a2
This commit is contained in:
parent
5a9ec0efd6
commit
d012c202a1
|
@ -801,6 +801,12 @@ static inline bool lbm_is_closure(lbm_value exp) {
|
||||||
(lbm_dec_sym(lbm_car(exp)) == SYM_CLOSURE));
|
(lbm_dec_sym(lbm_car(exp)) == SYM_CLOSURE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool lbm_is_closure_general(lbm_value exp) {
|
||||||
|
return ((lbm_is_cons_general(exp)) &&
|
||||||
|
(lbm_type_of(lbm_car(exp)) == LBM_TYPE_SYMBOL) &&
|
||||||
|
(lbm_dec_sym(lbm_car(exp)) == SYM_CLOSURE));
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool lbm_is_continuation(lbm_value exp) {
|
static inline bool lbm_is_continuation(lbm_value exp) {
|
||||||
return ((lbm_type_of(exp) == LBM_TYPE_CONS) &&
|
return ((lbm_type_of(exp) == LBM_TYPE_CONS) &&
|
||||||
(lbm_type_of(lbm_car(exp)) == LBM_TYPE_SYMBOL) &&
|
(lbm_type_of(lbm_car(exp)) == LBM_TYPE_SYMBOL) &&
|
||||||
|
|
|
@ -1826,12 +1826,12 @@ static void apply_spawn_base(lbm_value *args, lbm_uint nargs, eval_context_t *ct
|
||||||
|
|
||||||
if (nargs >= 2 &&
|
if (nargs >= 2 &&
|
||||||
lbm_is_number(args[0]) &&
|
lbm_is_number(args[0]) &&
|
||||||
lbm_is_closure(args[1])) {
|
lbm_is_closure_general(args[1])) {
|
||||||
stack_size = lbm_dec_as_u32(args[0]);
|
stack_size = lbm_dec_as_u32(args[0]);
|
||||||
closure_pos = 1;
|
closure_pos = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lbm_is_closure(args[closure_pos]) ||
|
if (!lbm_is_closure_general(args[closure_pos]) ||
|
||||||
nargs < 1) {
|
nargs < 1) {
|
||||||
error_ctx(ENC_SYM_EERROR);
|
error_ctx(ENC_SYM_EERROR);
|
||||||
return;
|
return;
|
||||||
|
@ -3385,7 +3385,7 @@ static lbm_value request_flash_storage_cell(lbm_value val) {
|
||||||
new_val &= ~LBM_PTR_VAL_MASK; // clear the value part of the ptr
|
new_val &= ~LBM_PTR_VAL_MASK; // clear the value part of the ptr
|
||||||
new_val |= (flash_cell & LBM_PTR_VAL_MASK);
|
new_val |= (flash_cell & LBM_PTR_VAL_MASK);
|
||||||
new_val |= LBM_PTR_TO_CONSTANT_BIT;
|
new_val |= LBM_PTR_TO_CONSTANT_BIT;
|
||||||
return flash_cell;
|
return new_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cont_move_to_flash(eval_context_t *ctx) {
|
static void cont_move_to_flash(eval_context_t *ctx) {
|
||||||
|
@ -3523,6 +3523,7 @@ static void cont_move_val_to_flash_dispatch(eval_context_t *ctx) {
|
||||||
}
|
}
|
||||||
ctx->r = flash_cell;
|
ctx->r = flash_cell;
|
||||||
ctx->app_cont = true;
|
ctx->app_cont = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->r = val;
|
ctx->r = val;
|
||||||
|
|
|
@ -930,7 +930,7 @@ static lbm_value fundamental_append(lbm_value *args, lbm_uint nargs, eval_contex
|
||||||
(void) ctx;
|
(void) ctx;
|
||||||
if (nargs == 0) return ENC_SYM_NIL;
|
if (nargs == 0) return ENC_SYM_NIL;
|
||||||
if (nargs == 1 && !lbm_is_list_general(args[0])) return ENC_SYM_TERROR;
|
if (nargs == 1 && !lbm_is_list_general(args[0])) return ENC_SYM_TERROR;
|
||||||
if (nargs > 0) {
|
|
||||||
lbm_value res = args[nargs-1];
|
lbm_value res = args[nargs-1];
|
||||||
for (int i = (int)nargs -2; i >= 0; i --) {
|
for (int i = (int)nargs -2; i >= 0; i --) {
|
||||||
lbm_value curr = args[i];
|
lbm_value curr = args[i];
|
||||||
|
@ -946,7 +946,6 @@ static lbm_value fundamental_append(lbm_value *args, lbm_uint nargs, eval_contex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(res);
|
return(res);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static lbm_value fundamental_undefine(lbm_value *args, lbm_uint nargs, eval_context_t *ctx) {
|
static lbm_value fundamental_undefine(lbm_value *args, lbm_uint nargs, eval_context_t *ctx) {
|
||||||
|
|
|
@ -389,7 +389,7 @@ int lbm_print_internal(lbm_char_channel_t *chan, lbm_value v) {
|
||||||
case LBM_TYPE_CONS: {
|
case LBM_TYPE_CONS: {
|
||||||
int res = lbm_push_2(&print_stack, curr, START_LIST);
|
int res = lbm_push_2(&print_stack, curr, START_LIST);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
r = print_emit_string(chan,"Error: Out of print stack\n");
|
print_emit_string(chan," ...");
|
||||||
return EMIT_OK;
|
return EMIT_OK;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue