syntax error fixes for compile

This commit is contained in:
Peter McGoron @ planck 2023-04-04 12:03:15 -04:00
parent dc1abae13a
commit c7fc965fcf
1 changed files with 10 additions and 9 deletions

View File

@ -559,7 +559,7 @@ load_into_array(const struct creole_reader *start, creole_word *buf, size_t bufl
{ {
size_t i = 0; size_t i = 0;
struct creole_word w; struct creole_word w;
struct creole_reader r = start; struct creole_reader r = *start;
while (creole_decode(&r, &w) && i < buflen) { while (creole_decode(&r, &w) && i < buflen) {
buf[i++] = w.word; buf[i++] = w.word;
@ -573,7 +573,7 @@ upsilon_load_waveform(struct creole_env *env, creole_word slot,
creole_word db) creole_word db)
{ {
creole_word buf[MAX_WL_SIZE]; creole_word buf[MAX_WL_SIZE];
size_t len = load_into_array(env->dats[db], buf, ARRAY_SIZE(buf)); size_t len = load_into_array(env->dats + db, buf, ARRAY_SIZE(buf));
if (len < MAX_WL_SIZE) if (len < MAX_WL_SIZE)
return 0; return 0;
return waveform_load(buf, slot, K_FOREVER); return waveform_load(buf, slot, K_FOREVER);
@ -591,12 +591,13 @@ upsilon_sendval(struct creole_env *env, creole_word num)
static creole_word static creole_word
upsilon_senddat(struct creole_env *env, creole_word db) upsilon_senddat(struct creole_env *env, creole_word db)
{ {
char buf[128]; #define SENDDAT_BUFLEN 128
char buf[SENDDAT_BUFLEN];
struct bufptr bp = {buf, 0}; struct bufptr bp = {buf, 0};
struct creole_word w; struct creole_word w;
struct creole_reader r = start; struct creole_reader r = env->dats[db];
while (creole_decode(&r, &w) && bp.left < buflen) { while (creole_decode(&r, &w) && bp.left < SENDDAT_BUFLEN) {
if (w.word > 0xFF) if (w.word > 0xFF)
return -EINVAL; return -EINVAL;
buf[bp.left++] = w.word; buf[bp.left++] = w.word;
@ -641,8 +642,8 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc)
switch (ins.opcode) { switch (ins.opcode) {
case CREOLE_DB: case CREOLE_DB:
env->dats[ins->w[0]].p = ins->datapt; env->dats[ins.w[0]].p = ins.datapt;
env->dats[ins->w[0]].left = ins->dataptlen; env->dats[ins.w[0]].left = ins.dataptlen;
break; break;
case CREOLE_PUSH: case CREOLE_PUSH:
@ -753,7 +754,7 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc)
check(read_val(env, &ins, 0, &a1)); check(read_val(env, &ins, 0, &a1));
check(read_val(env, &ins, 0, &a2)); check(read_val(env, &ins, 0, &a2));
if (valid_reglen(env, a1) && valid_reglen(env, a2)) { if (valid_register(env, a1) && valid_register(env, a2)) {
a0 = cloop_read(a0, env->reg + a1, env->reg + a2, K_FOREVER); a0 = cloop_read(a0, env->reg + a1, env->reg + a2, K_FOREVER);
check(creole_push(env, a0)); check(creole_push(env, a0));
} else { } else {
@ -792,7 +793,7 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc)
case CREOLE_SENDVAL: case CREOLE_SENDVAL:
check(read_val(env, &ins, 0, &a0)); check(read_val(env, &ins, 0, &a0));
check(creole_push(env, upsilon_sendval(a0))); check(creole_push(env, upsilon_sendval(env, a0)));
break; break;
case CREOLE_SENDDAT: case CREOLE_SENDDAT: