rune/bytecode/
opcode.rs

1use num_enum::TryFromPrimitive;
2
3#[derive(Copy, Clone, Debug, TryFromPrimitive)]
4#[repr(u8)]
5pub(crate) enum OpCode {
6    StackRef0 = 0,
7    StackRef1 = 1,
8    StackRef2 = 2,
9    StackRef3 = 3,
10    StackRef4 = 4,
11    StackRef5 = 5,
12    StackRefN = 6,
13    StackRefN2 = 7,
14    VarRef0 = 8,
15    VarRef1 = 9,
16    VarRef2 = 10,
17    VarRef3 = 11,
18    VarRef4 = 12,
19    VarRef5 = 13,
20    VarRefN = 14,
21    VarRefN2 = 15,
22    VarSet0 = 16,
23    VarSet1 = 17,
24    VarSet2 = 18,
25    VarSet3 = 19,
26    VarSet4 = 20,
27    VarSet5 = 21,
28    VarSetN = 22,
29    VarSetN2 = 23,
30    VarBind0 = 24,
31    VarBind1 = 25,
32    VarBind2 = 26,
33    VarBind3 = 27,
34    VarBind4 = 28,
35    VarBind5 = 29,
36    VarBindN = 30,
37    VarBindN2 = 31,
38    Call0 = 32,
39    Call1 = 33,
40    Call2 = 34,
41    Call3 = 35,
42    Call4 = 36,
43    Call5 = 37,
44    CallN = 38,
45    CallN2 = 39,
46    Unbind0 = 40,
47    Unbind1 = 41,
48    Unbind2 = 42,
49    Unbind3 = 43,
50    Unbind4 = 44,
51    Unbind5 = 45,
52    UnbindN = 46,
53    UnbindN2 = 47,
54    PopHandler = 48,
55    PushCondtionCase = 49,
56    PushCatch = 50,
57    // Unused51,
58    // Unused52,
59    // Unused53,
60    // Unused54,
61    // Unused55,
62    Nth = 56,
63    Symbolp = 57,
64    Consp = 58,
65    Stringp = 59,
66    Listp = 60,
67    Eq = 61,
68    Memq = 62,
69    Not = 63,
70    Car = 64,
71    Cdr = 65,
72    Cons = 66,
73    List1 = 67,
74    List2 = 68,
75    List3 = 69,
76    List4 = 70,
77    Length = 71,
78    Aref = 72,
79    Aset = 73,
80    SymbolValue = 74,
81    SymbolFunction = 75,
82    Set = 76,
83    Fset = 77,
84    Get = 78,
85    Substring = 79,
86    Concat2 = 80,
87    Concat3 = 81,
88    Concat4 = 82,
89    Sub1 = 83,
90    Add1 = 84,
91    EqlSign = 85,
92    GreaterThan = 86,
93    LessThan = 87,
94    LessThanOrEqual = 88,
95    GreaterThanOrEqual = 89,
96    Diff = 90,
97    Negate = 91,
98    Plus = 92,
99    Max = 93,
100    Min = 94,
101    Multiply = 95,
102    Point = 96,
103    // ObsoleteSaveCurrentBuffer = 97,
104    GotoChar = 98,
105    Insert = 99,
106    PointMax = 100,
107    PointMin = 101,
108    CharAfter = 102,
109    FollowingChar = 103,
110    PrecedingChar = 104,
111    CurrentColumn = 105,
112    IndentTo = 106,
113    // ObsoleteScanBuffer = 107,
114    EndOfLineP = 108,
115    EndOfBufferP = 109,
116    BeginningOfLineP = 110,
117    BeginningOfBufferP = 111,
118    CurrentBuffer = 112,
119    SetBuffer = 113,
120    SaveCurrentBuffer1 = 114,
121    // Unused115,
122    // ObsoleteInteractiveP = 116,
123    ForwardChar = 117,
124    ForwardWord = 118,
125    SkipCharsForward = 119,
126    SkipCharsBackward = 120,
127    ForwardLine = 121,
128    CharSyntax = 122,
129    BufferSubstring = 123,
130    DeleteRegion = 124,
131    NarrowToRegion = 125,
132    Widen = 126,
133    EndOfLine = 127,
134    // Unused128,
135    ConstantN2 = 129,
136    Goto = 130,
137    GotoIfNil = 131,
138    GotoIfNonNil = 132,
139    GotoIfNilElsePop = 133,
140    GotoIfNonNilElsePop = 134,
141    Return = 135,
142    Discard = 136,
143    Duplicate = 137,
144    SaveExcursion = 138,
145    // ObsoleteSaveWindowExcursion = 139,
146    SaveRestriction = 140,
147    // ObsoleteCatch = 141,
148    UnwindProtect = 142,
149    // ObsoleteConditionCase = 143,
150    // ObsoleteTempOutputBufferSetup = 144,
151    // ObsoleteTempOutputBufferShow = 145,
152    // Unused146,
153    SetMarker = 147,
154    MatchBeginning = 148,
155    MatchEnd = 149,
156    Upcase = 150,
157    Downcase = 151,
158    StringEqlSign = 152,
159    StringLessThan = 153,
160    Equal = 154,
161    Nthcdr = 155,
162    Elt = 156,
163    Member = 157,
164    Assq = 158,
165    Nreverse = 159,
166    Setcar = 160,
167    Setcdr = 161,
168    CarSafe = 162,
169    CdrSafe = 163,
170    Nconc = 164,
171    Quo = 165,
172    Rem = 166,
173    Numberp = 167,
174    Integerp = 168,
175    // Unused169,
176    // Unused170,
177    // Unused171,
178    // Unused172,
179    // Unused173,
180    // Unused174,
181    ListN = 175,
182    ConcatN = 176,
183    InsertN = 177,
184    StackSetN = 178,
185    StackSetN2 = 179,
186    // Unused180,
187    // Unused181,
188    DiscardN = 182,
189    Switch = 183,
190    // Unused184,
191    // Unused185,
192    // Unused186,
193    // Unused187,
194    // Unused188,
195    // Unused189,
196    // Unused190,
197    // Unused191,
198    Constant0 = 192,
199    Constant1 = 193,
200    Constant2 = 194,
201    Constant3 = 195,
202    Constant4 = 196,
203    Constant5 = 197,
204    Constant6 = 198,
205    Constant7 = 199,
206    Constant8 = 200,
207    Constant9 = 201,
208    Constant10 = 202,
209    Constant11 = 203,
210    Constant12 = 204,
211    Constant13 = 205,
212    Constant14 = 206,
213    Constant15 = 207,
214    Constant16 = 208,
215    Constant17 = 209,
216    Constant18 = 210,
217    Constant19 = 211,
218    Constant20 = 212,
219    Constant21 = 213,
220    Constant22 = 214,
221    Constant23 = 215,
222    Constant24 = 216,
223    Constant25 = 217,
224    Constant26 = 218,
225    Constant27 = 219,
226    Constant28 = 220,
227    Constant29 = 221,
228    Constant30 = 222,
229    Constant31 = 223,
230    Constant32 = 224,
231    Constant33 = 225,
232    Constant34 = 226,
233    Constant35 = 227,
234    Constant36 = 228,
235    Constant37 = 229,
236    Constant38 = 230,
237    Constant39 = 231,
238    Constant40 = 232,
239    Constant41 = 233,
240    Constant42 = 234,
241    Constant43 = 235,
242    Constant44 = 236,
243    Constant45 = 237,
244    Constant46 = 238,
245    Constant47 = 239,
246    Constant48 = 240,
247    Constant49 = 241,
248    Constant50 = 242,
249    Constant51 = 243,
250    Constant52 = 244,
251    Constant53 = 245,
252    Constant54 = 246,
253    Constant55 = 247,
254    Constant56 = 248,
255    Constant57 = 249,
256    Constant58 = 250,
257    Constant59 = 251,
258    Constant60 = 252,
259    Constant61 = 253,
260    Constant62 = 254,
261    Constant63 = 255,
262}