-
Notifications
You must be signed in to change notification settings - Fork 4
/
hoc.h
56 lines (50 loc) · 1.92 KB
/
hoc.h
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
typedef void (*Inst)(void);
#define STOP (Inst) 0
typedef struct Symbol { /* symbol table entry */
char *name;
long type;
union {
double val; /* VAR */
double (*ptr)(double); /* BLTIN */
Inst *defn; /* FUNCTION, PROCEDURE */
char *str; /* STRING */
} u;
struct Symbol *next; /* to link to another */
} Symbol;
Symbol *install(char*, int, double), *lookup(char*);
typedef union Datum { /* interpreter stack type */
double val;
Symbol *sym;
} Datum;
extern double Fgetd(int);
extern int moreinput(void);
extern void execerror(char*, char*);
extern void define(Symbol*), verify(Symbol*);
extern Datum pop(void);
extern void initcode(void), push(Datum), xpop(void), constpush(void);
extern void varpush(void);
extern void eval(void), add(void), sub(void), mul(void), divop(void), mod(void);
extern void negate(void), power(void);
extern void addeq(void), subeq(void), muleq(void), diveq(void), modeq(void);
extern Inst *progp, *progbase, prog[], *code(Inst);
extern void assign(void), bltin(void), varread(void);
extern void prexpr(void), prstr(void);
extern void gt(void), lt(void), eq(void), ge(void), le(void), ne(void);
extern void and(void), or(void), not(void);
extern void ifcode(void), whilecode(void), forcode(void);
extern void call(void), arg(void), argassign(void);
extern void funcret(void), procret(void);
extern void preinc(void), predec(void), postinc(void), postdec(void);
extern void argaddeq(void), argsubeq(void), argmuleq(void);
extern void argdiveq(void), argmodeq(void);
extern void execute(Inst*);
extern void printtop(void);
extern double Log(double), Log10(double), Gamma(double), Sqrt(double), Exp(double);
extern double Asin(double), Acos(double), Sinh(double), Cosh(double), integer(double);
extern double Pow(double, double);
extern void init(void);
extern int yyparse(void);
extern void execerror(char*, char*);
extern void *emalloc(unsigned);
extern void defnonly(char *);
extern void warning(char *s, char *t);