aboutsummaryrefslogtreecommitdiffstats
path: root/creole.c
diff options
context:
space:
mode:
authorGravatar Peter McGoron @ planck 2023-04-04 12:03:15 -0400
committerGravatar Peter McGoron @ planck 2023-04-04 12:03:15 -0400
commitc7fc965fcfa72f26456f5221a6480de52f7d776a (patch)
treeb72ad66a5306492451626c591ff771e706827b40 /creole.c
parentput upsilon_creole calls into creole.c (diff)
syntax error fixes for compile
Diffstat (limited to 'creole.c')
-rw-r--r--creole.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/creole.c b/creole.c
index 9df59bd..d5f6648 100644
--- a/creole.c
+++ b/creole.c
@@ -559,7 +559,7 @@ load_into_array(const struct creole_reader *start, creole_word *buf, size_t bufl
{
size_t i = 0;
struct creole_word w;
- struct creole_reader r = start;
+ struct creole_reader r = *start;
while (creole_decode(&r, &w) && i < buflen) {
buf[i++] = w.word;
@@ -573,7 +573,7 @@ upsilon_load_waveform(struct creole_env *env, creole_word slot,
creole_word db)
{
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)
return 0;
return waveform_load(buf, slot, K_FOREVER);
@@ -591,12 +591,13 @@ upsilon_sendval(struct creole_env *env, creole_word num)
static creole_word
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 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)
return -EINVAL;
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) {
case CREOLE_DB:
- env->dats[ins->w[0]].p = ins->datapt;
- env->dats[ins->w[0]].left = ins->dataptlen;
+ env->dats[ins.w[0]].p = ins.datapt;
+ env->dats[ins.w[0]].left = ins.dataptlen;
break;
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, &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);
check(creole_push(env, a0));
} else {
@@ -792,7 +793,7 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc)
case CREOLE_SENDVAL:
check(read_val(env, &ins, 0, &a0));
- check(creole_push(env, upsilon_sendval(a0)));
+ check(creole_push(env, upsilon_sendval(env, a0)));
break;
case CREOLE_SENDDAT: