2 * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
89 TAILQ_HEAD(opstacks, opstack);
91 TAILQ_ENTRY(opstack) entry;
97 TAILQ_HEAD(procs, proc);
99 TAILQ_ENTRY(proc) entry;
103 char *args[MAXWELEM];
105 int (*nativefn)(int);
108 TAILQ_HEAD(tests, test);
110 TAILQ_ENTRY(test) entry;
122 void global_set(char *, struct op *);
124 struct op *newop(int);
125 void free_op(struct op *);
126 struct op *op_assign(char *, struct op *);
127 struct op *op_assert(struct op *);
128 struct op *op_var(char *);
129 struct op *op_lit_str(char *);
130 struct op *op_lit_num(uint64_t);
131 struct op *op_cmp_eq(struct op *, struct op *);
132 struct op *op_cast(struct op *, int);
134 void ppf_val(FILE *, struct value *);
135 void pp_val(struct value *);
136 int val_trueish(struct value *);
137 int val_eq(struct value *, struct value *);
138 int val_cast(struct value *, int);
139 void pp_op(struct op *);
140 void pp_block(struct op *);
141 int eval(struct op *);
144 void prepare_funcall(void);
145 void push_arg(struct op *);
146 struct op *op_funcall(struct proc *);
149 void add_builtin_proc(const char *name, int (*)(int));
150 void prepare_proc(void);
151 /* push_arg works on procs too */
152 int proc_setup_body(void);
153 void proc_done(char *name);
154 void block_push(struct op *);
155 struct proc *proc_by_name(const char *);
158 void prepare_test(void);
159 void test_done(char *, char *);
162 void loadfile(const char *);