1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/* This file is part of Mailfromd.
Copyright (C) 2006, 2007, 2008 Sergey Poznyakoff
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
struct optab {
char *name;
instr_t instr;
void (*dump) (prog_counter_t i);
unsigned length;
};
typedef void *STKVAL;
struct eval_environ;
#define B2STACK(s) (s + sizeof(STKVAL) - 1) / sizeof(STKVAL)
void runtime_warning(eval_environ_t env, const char *fmt, ...);
void runtime_error(eval_environ_t env, const char *fmt, ...)
ATTRIBUTE_NORETURN;
STKVAL get_arg(eval_environ_t env, unsigned n);
void get_pointer_arg(eval_environ_t env, unsigned n, void **p);
void get_string_arg(eval_environ_t env, unsigned n, char **ptr);
void get_numeric_arg(eval_environ_t env, unsigned n, long *np);
void push(eval_environ_t env, STKVAL val);
STKVAL pop(eval_environ_t env);
STKVAL *env_data_ref(eval_environ_t env, size_t off);
size_t heap_reserve(eval_environ_t env, size_t size);
size_t heap_reserve_words(eval_environ_t env, size_t size);
STKVAL heap_tempspace(eval_environ_t env, size_t size);
void heap_obstack_begin(eval_environ_t env);
STKVAL heap_obstack_finish(eval_environ_t env);
void heap_obstack_cancel(eval_environ_t env);
void *heap_obstack_grow(eval_environ_t env, void *ptr, size_t size);
void *heap_obstack_base(eval_environ_t env);
void pushs(eval_environ_t env, const char *s);
void advance_pc(eval_environ_t env, long cnt);
void adjust_stack(eval_environ_t env, unsigned cnt);
void unroll_stack(eval_environ_t env, unsigned cnt);
void prog_trace(eval_environ_t env, const char *fmt, ...);
void runtime_stack_trace(eval_environ_t env);
void env_var_inc(eval_environ_t env, size_t off);
const struct locus *env_get_locus(eval_environ_t env);
STKVAL env_get_reg(eval_environ_t env);
char *env_vaptr(eval_environ_t env, size_t off);
void *env_get_builtin_priv(eval_environ_t env, int id);
int builtin_priv_register(void *(*init)(void), void (*destroy)(void*),
void (*free_capture));
void env_free_captured(eval_environ_t env);
void ensure_initialized_variable(const char *name, struct value *val);
void scan_code(prog_counter_t start, prog_counter_t end,
void (*fun)(prog_counter_t pc, struct optab *op, void *d),
void *data);
int within_loop(struct literal *lit);
void enter_loop(struct literal *lit,
prog_counter_t *begptr, prog_counter_t *endptr);
void leave_loop(void);
extern instr_t *prog;
extern unsigned error_count;
extern unsigned long prog_trace_option;
extern STKVAL *dataseg;
extern size_t datasize;
extern size_t *dataseg_reloc;
extern size_t dataseg_reloc_count;
|