diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-09-05 17:14:53 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-09-26 03:41:55 +0200 |
| commit | 3c0819236e4f07c8f57aaf1ca46d0d68aa761558 (patch) | |
| tree | bd8b57cf5420cabc4ec29815052df545b55026f9 /stmt.c | |
| parent | a3f56c76444fee090e62a59f257ed5f60b4e552b (diff) | |
| download | prc-3c0819236e4f07c8f57aaf1ca46d0d68aa761558.tar.gz | |
Move source to src/prc1
Diffstat (limited to 'stmt.c')
| -rw-r--r-- | stmt.c | 92 |
1 files changed, 0 insertions, 92 deletions
@@ -1,92 +0,0 @@ -#include "stmt.h" -#include "call.h" -#include "fn.h" -#include "from.h" -#include "parse.h" -#include "prv.h" -#include "display.h" -#include "exit.h" -#include "set.h" -#include "warn.h" - -void stmt_free(struct stmt *s) -{ - switch (s->type) - { - case DISPLAY: - display_free(&s->u.display); - break; - case SET: - set_free(&s->u.set); - break; - case CALL: - call_free(&s->u.call); - break; - case WARN: - warn_free(&s->u.warn); - break; - case FROM: - from_free(&s->u.from); - break; - case END: - end_free(&s->u.end); - break; - } -} - -int stmt_cgen(const struct stmt *s, struct cgen *c) -{ - switch (s->type) - { - case DISPLAY: - return display_cgen(&s->u.display, c); - case SET: - return set_cgen(&s->u.set, c); - case CALL: - return call_cgen(&s->u.call, c); - case WARN: - return warn_cgen(&s->u.warn, c); - case FROM: - return from_cgen(&s->u.from, c); - case END: - return end_cgen(&s->u.end, c); - } - - fprintf(stderr, "%s: unreachable\n", __func__); - return -1; -} - -struct stmt *stmt_cur(const struct prv *p) -{ - const struct fn *fn = fn_cur(p); - - return &fn->stmts[fn->nstmts - 1]; -} - -const struct seq stmts[] = -{ - {(struct step[]){ - {ID, "display"}, {ANY, NULL, 1}, {ID, "etc"}, {0}}, .fn = display}, - {(struct step[]) - {{ID, "display"}, {ANY, NULL, 1}, {0}}, .fn = display}, - {(struct step[]){ - {ID, "warn"}, {ANY, NULL, 1}, {ID, "etc"}, {0}}, .fn = warn}, - {(struct step[]) - {{ID, "warn"}, {ANY, NULL, 1}, {0}}, .fn = warn}, - {(struct step[]) - {{ID, "from"}, {ANY}, {ID, "to"}, {ANY}, {ID, "using"}, {ID}, - {ID, "by"}, {ANY}, {0}}, .fn = from_idby}, - {(struct step[]) - {{ID, "from"}, {ANY}, {ID, "to"}, {ANY}, {ID, "by"}, {ANY}, {0}}, - .fn = from_by}, - {(struct step[]) - {{ID, "from"}, {ANY}, {ID, "to"}, {ANY}, {ID, "using"}, {ID}, {0}}, - .fn = from_id}, - {(struct step[]) - {{ID, "from"}, {ANY}, {ID, "to"}, {ANY}, {0}}, .fn = from}, - {(struct step[]){{ID, "exit"}, {0}}, .fn = s_exit}, - {(struct step[]){{ID, "set"}, {0}}, .fn = set}, - {(struct step[]){{ID, "call"}, {0}}, .fn = call}, - {(struct step[]){{ID, "end"}, {0}}, .fn = end}, - {0} -}; |
