diff options
Diffstat (limited to 'src/ls_kw_impl.c')
-rw-r--r-- | src/ls_kw_impl.c | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/src/ls_kw_impl.c b/src/ls_kw_impl.c index 901852f..9b4b818 100644 --- a/src/ls_kw_impl.c +++ b/src/ls_kw_impl.c @@ -22,126 +22,126 @@ // --- PRIVATE FUNCTION PROTOTYPES --------------------------------------------- /// Call for keywords without implementations. -static void _no_impl(ls_context_t * ctx); +static void _no_impl(ls_t * self); -void ls_kw_fun_GOTO(ls_context_t * ctx); +void ls_kw_fun_GOTO(ls_t * self); // --- PUBLIC VARIABLES -------------------------------------------------------- // --- PRIVATE VARIABLES ------------------------------------------------------- // --- PUBLIC FUNCTIONS -------------------------------------------------------- -void ls_kw_fun_ABS(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_AND(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_AS(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_ASC(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_AT(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_ATN(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_CALL(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_CAT(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_CHR(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_CLOSE(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_COS(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_COUNT(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_DATA(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_DEC(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_DEF(ls_context_t * ctx) { _no_impl(ctx); } - -void ls_kw_fun_END(ls_context_t * ctx) { ls_throw_err(ctx, LS_STOPPED); } - -void ls_kw_fun_EQV(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_ERASE(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_ERROR(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_FN(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_FOR(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_HEX(ls_context_t * ctx) { _no_impl(ctx); } - -void ls_kw_fun_IF(ls_context_t * ctx) { +void ls_kw_fun_ABS(ls_t * self) { _no_impl(self); } +void ls_kw_fun_AND(ls_t * self) { _no_impl(self); } +void ls_kw_fun_AS(ls_t * self) { _no_impl(self); } +void ls_kw_fun_ASC(ls_t * self) { _no_impl(self); } +void ls_kw_fun_AT(ls_t * self) { _no_impl(self); } +void ls_kw_fun_ATN(ls_t * self) { _no_impl(self); } +void ls_kw_fun_CALL(ls_t * self) { _no_impl(self); } +void ls_kw_fun_CAT(ls_t * self) { _no_impl(self); } +void ls_kw_fun_CHR(ls_t * self) { _no_impl(self); } +void ls_kw_fun_CLOSE(ls_t * self) { _no_impl(self); } +void ls_kw_fun_COS(ls_t * self) { _no_impl(self); } +void ls_kw_fun_COUNT(ls_t * self) { _no_impl(self); } +void ls_kw_fun_DATA(ls_t * self) { _no_impl(self); } +void ls_kw_fun_DEC(ls_t * self) { _no_impl(self); } +void ls_kw_fun_DEF(ls_t * self) { _no_impl(self); } + +void ls_kw_fun_END(ls_t * self) { ls_throw_err(self, LS_STOPPED); } + +void ls_kw_fun_EQV(ls_t * self) { _no_impl(self); } +void ls_kw_fun_ERASE(ls_t * self) { _no_impl(self); } +void ls_kw_fun_ERROR(ls_t * self) { _no_impl(self); } +void ls_kw_fun_FN(ls_t * self) { _no_impl(self); } +void ls_kw_fun_FOR(ls_t * self) { _no_impl(self); } +void ls_kw_fun_HEX(ls_t * self) { _no_impl(self); } + +void ls_kw_fun_IF(ls_t * self) { // TODO how to support ELSE - the current parsing method doesn't // really allow it. Should we bother? ls_value_t cond; - ls_eval_expr(ctx, &cond, NULL); + ls_eval_expr(self, &cond, NULL); if (cond.ty != LS_TY_INT) - ls_throw_err(ctx, LS_SYNTAX_ERROR); + ls_throw_err(self, LS_SYNTAX_ERROR); if (cond.body.integer.value == 0) { // TODO: factor this out (also in REM) for (;;) { - ls_uchar uch = ls_fetch_rel(ctx, 0); + ls_uchar uch = ls_fetch_rel(self, 0); if (uch == 0 || uch == '\n') return; - ctx->pc++; + self->pc++; } return; } else { ls_token_t tok; - ls_lex(ctx, &tok); + ls_lex(self, &tok); if (tok.ty != LS_TOK_KEYWORD) - ls_throw_err(ctx, LS_SYNTAX_ERROR); + ls_throw_err(self, LS_SYNTAX_ERROR); if (tok.body.keyword_val == LS_KW_GOTO) - ls_kw_fun_GOTO(ctx); + ls_kw_fun_GOTO(self); else // TODO - need to factor something out of ls_exec_line - _no_impl(ctx); + _no_impl(self); } } -void ls_kw_fun_IMP(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_INPUT(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_LEFT(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_LET(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_LOG(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_MID(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_NEXT(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_NOT(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_OCT(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_ON(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_OR(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_OPEN(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_PACK(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_RANDOMIZE(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_READ(ls_context_t * ctx) { _no_impl(ctx); } - -void ls_kw_fun_REM(ls_context_t * ctx) +void ls_kw_fun_IMP(ls_t * self) { _no_impl(self); } +void ls_kw_fun_INPUT(ls_t * self) { _no_impl(self); } +void ls_kw_fun_LEFT(ls_t * self) { _no_impl(self); } +void ls_kw_fun_LET(ls_t * self) { _no_impl(self); } +void ls_kw_fun_LOG(ls_t * self) { _no_impl(self); } +void ls_kw_fun_MID(ls_t * self) { _no_impl(self); } +void ls_kw_fun_NEXT(ls_t * self) { _no_impl(self); } +void ls_kw_fun_NOT(ls_t * self) { _no_impl(self); } +void ls_kw_fun_OCT(ls_t * self) { _no_impl(self); } +void ls_kw_fun_ON(ls_t * self) { _no_impl(self); } +void ls_kw_fun_OR(ls_t * self) { _no_impl(self); } +void ls_kw_fun_OPEN(ls_t * self) { _no_impl(self); } +void ls_kw_fun_PACK(ls_t * self) { _no_impl(self); } +void ls_kw_fun_RANDOMIZE(ls_t * self) { _no_impl(self); } +void ls_kw_fun_READ(ls_t * self) { _no_impl(self); } + +void ls_kw_fun_REM(ls_t * self) { for (;;) { - ls_uchar uch = ls_fetch_rel(ctx, 0); + ls_uchar uch = ls_fetch_rel(self, 0); if (uch == 0 || uch == '\n') return; - ctx->pc++; + self->pc++; } } -void ls_kw_fun_RESTORE(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_RIGHT(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_RND(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_SIN(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_SQR(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_STEP(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_SWAP(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_TAN(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_THEN(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_TO(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_UNPACK(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_UNTIL(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_VAL(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_WEND(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_WHILE(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_WRITE(ls_context_t * ctx) { _no_impl(ctx); } -void ls_kw_fun_XOR(ls_context_t * ctx) { _no_impl(ctx); } +void ls_kw_fun_RESTORE(ls_t * self) { _no_impl(self); } +void ls_kw_fun_RIGHT(ls_t * self) { _no_impl(self); } +void ls_kw_fun_RND(ls_t * self) { _no_impl(self); } +void ls_kw_fun_SIN(ls_t * self) { _no_impl(self); } +void ls_kw_fun_SQR(ls_t * self) { _no_impl(self); } +void ls_kw_fun_STEP(ls_t * self) { _no_impl(self); } +void ls_kw_fun_SWAP(ls_t * self) { _no_impl(self); } +void ls_kw_fun_TAN(ls_t * self) { _no_impl(self); } +void ls_kw_fun_THEN(ls_t * self) { _no_impl(self); } +void ls_kw_fun_TO(ls_t * self) { _no_impl(self); } +void ls_kw_fun_UNPACK(ls_t * self) { _no_impl(self); } +void ls_kw_fun_UNTIL(ls_t * self) { _no_impl(self); } +void ls_kw_fun_VAL(ls_t * self) { _no_impl(self); } +void ls_kw_fun_WEND(ls_t * self) { _no_impl(self); } +void ls_kw_fun_WHILE(ls_t * self) { _no_impl(self); } +void ls_kw_fun_WRITE(ls_t * self) { _no_impl(self); } +void ls_kw_fun_XOR(ls_t * self) { _no_impl(self); } // --- PRIVATE FUNCTION DEFINITIONS -------------------------------------------- -static void _no_impl(ls_context_t * ctx) +static void _no_impl(ls_t * self) { - ls_throw_err(ctx, LS_BAD_KEYWORD); + ls_throw_err(self, LS_BAD_KEYWORD); } |