aboutsummaryrefslogtreecommitdiff
path: root/pkg/cl/opcodes.h
blob: bcce4b7f9a88b3f0e38c83e16a7cf33abc45911e (plain) (blame)
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
85
86
87
88
89
90
91
92
93
94
95
/*
 * OPCODES.H -- This structure is a template for each instruction in the
 * dictionary.  C_opcode is a constant, from below, and is an index into
 * opcodetbl[]; c_length is the total length, including the opcode, in # of
 * integers; the address of c_args will be the address of the first argument
 * (or if there is just one, it IS the first argument).
 *
 * The intent is to allow invoking the opcode with
 * 	(*opcodetbl[cp->c_opcode]) (&cp->c_args)
 *	where cp is a ptr to struct codeentry.
 */

struct codeentry {
	memel c_opcode;		/* opcodetbl index; see below		*/
	memel c_length;		/* total length in memory elements	*/
	memel c_args;		/* addr of this is addr of first arg	*/
};

extern void (*opcodetbl[])();

/* manifest constant opcodes used in c_opcode.
 * value is index into opcodetbl[].
 */

#define	ABSARGSET	1
#define	ADD		2
#define	ADDASSIGN	3
#define	ADDPIPE		4
#define	ALLAPPEND 	5

#define	ALLREDIR	6
#define	AND		7
#define	APPENDOUT	8
#define	ASSIGN		9
#define	BIFF		10

#define	CALL		11
#define CASE		12
#define	CHSIGN		13
#define	CONCAT		14
#define DEFAULT		15

#define	DIV		16
#define DIVASSIGN	17
#define	END		18
#define	EQ		19
#define	EXEC		20

#define FSCAN		21
#define FSCANF		22
#define	GE		23
#define	GOTO		24
#define	GETPIPE		25

#define	GT		26
#define	IMMED		27
#define	INDIRABSSET	28
#define	INDIRPOSSET	29
#define INDXINCR	30

#define	INSPECT		31
#define	INTRINSIC	32
#define	LE		33
#define	LT		34
#define	MUL		35

#define	MULASSIGN	36
#define	NE		37
#define	NOT		38
#define	OR		39
#define	OSESC		40

#define	POSARGSET	41
#define	POW		42
#define	PRINT		43
#define	PUSHCONST	44
#define	PUSHINDEX	45

#define	PUSHPARAM	46
#define	REDIR		47
#define	REDIRIN		48
#define	RMPIPES		49
#define	RETURN		50

#define	SCAN		51
#define	SCANF		52
#define	SUB		53
#define	SUBASSIGN	54
#define	SWITCH		55

#define	SWOFF		56
#define	SWON		57
#define	FIXLANGUAGE	58
#define	GSREDIR		59
#define	CATASSIGN	60