"Post Window" -> "Post window" prevents it being seen as two separate
[supercollider.git] / include / lang / Opcodes.h
blobad099e29b301397d83f6c499045a1e5d992d9afe
1 /*
2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef _OPCODES_H_
22 #define _OPCODES_H_
24 /* opcodes */
25 enum {
26 opExtended, // 0
27 opPushInstVar,
28 opPushTempVar,
29 opPushTempZeroVar,
30 opPushLiteral,
31 opPushClassVar, // 5
32 opPushSpecialValue,
33 opStoreInstVar,
34 opStoreTempVar,
35 opStoreClassVar,
36 opSendMsg, // 10
37 opSendSuper,
38 opSendSpecialMsg,
39 opSendSpecialUnaryArithMsg,
40 opSendSpecialBinaryArithMsg,
41 opSpecialOpcode, // 15
44 opNumOpcodes
47 /* special opcodes */
48 enum {
49 opcDrop, // 0
50 opcDup,
51 opcFunctionReturn,
52 opcReturn,
53 opcReturnSelf,
54 opcReturnTrue, // 5
55 opcReturnFalse,
56 opcReturnNil,
57 opcJumpIfFalse, // IF 3 args
58 opcJumpIfFalsePushNil, // IF 2 args
59 opcJumpIfFalsePushFalse, // AND: (10)
60 opcJumpIfTruePushTrue, // OR:
61 opcJumpFwd,
62 opcJumpBak,
63 opcSpecialBinaryOpWithAdverb,
64 opcSuperSpecial, // 15
66 opcNewList,
68 opcNumSpecialOpcodes
70 opcSlotAt,
71 opcByteAt, // 15
72 opcShortAt,
73 opcInt32At,
74 opcColorAt,
75 opcFloatAt,
76 opcDoubleAt
80 /* special unary math operators */
81 enum {
82 opNeg,
83 opNot,
84 opIsNil,
85 opNotNil,
86 opBitNot,
87 opAbs,
88 opAsFloat,
89 opAsInt,
90 opCeil, //5
91 opFloor,
92 opFrac,
93 opSign,
94 opSquared,
95 opCubed, //10
96 opSqrt,
97 opExp,
98 opRecip,
99 opMIDICPS,
100 opCPSMIDI, //15
102 opMIDIRatio,
103 opRatioMIDI,
104 opDbAmp,
105 opAmpDb,
106 opOctCPS, //20
107 opCPSOct,
108 opLog,
109 opLog2,
110 opLog10,
111 opSin, //25
112 opCos,
113 opTan,
114 opArcSin,
115 opArcCos,
116 opArcTan,
117 opSinH,
118 opCosH, //30
119 opTanH,
120 opRand,
121 opRand2,
122 opLinRand,
123 opBiLinRand,
125 // opExpRand,
126 // opBiExpRand,
127 opSum3Rand,
128 // opGammaRand,
129 // opGaussRand,
130 // opPoiRand,
132 opDistort,
133 opSoftClip,
134 opCoin,
136 opDigitValue,
137 opSilence,
138 opThru,
139 opRectWindow,
140 opHanWindow,
141 opWelchWindow,
142 opTriWindow,
144 opRamp,
145 opSCurve,
147 opNumUnarySelectors
150 #define IS_UNARY_BOOL_OP(op) ((op)>=opCoin && (op)<=opOdd)
151 #define IS_BINARY_BOOL_OP(op) ((op)>=opEQ && (op)<=opGE)
153 /* special binary math operators */
154 enum {
155 opAdd,
156 opSub,
157 opMul,
158 opIDiv,
159 opFDiv,
160 opMod,
161 opEQ,
162 opNE,
163 opLT,
164 opGT,
165 opLE,
166 opGE,
167 //opIdentical,
168 //opNotIdentical,
170 opMin,
171 opMax,
172 opBitAnd,
173 opBitOr,
174 opBitXor,
175 opLCM,
176 opGCD,
177 opRound,
178 opRoundUp,
179 opTrunc,
180 opAtan2,
181 opHypot,
182 opHypotx,
183 opPow,
184 opShiftLeft,
185 opShiftRight,
186 opUnsignedShift,
187 opFill,
188 opRing1, // a * (b + 1) == a * b + a
189 opRing2, // a * b + a + b
190 opRing3, // a*a*b
191 opRing4, // a*a*b - a*b*b
192 opDifSqr, // a*a - b*b
193 opSumSqr, // a*a + b*b
194 opSqrSum, // (a + b)^2
195 opSqrDif, // (a - b)^2
196 opAbsDif, // |a - b|
197 opThresh,
198 opAMClip,
199 opScaleNeg,
200 opClip2,
201 opExcess,
202 opFold2,
203 opWrap2,
204 opFirstArg,
205 opRandRange,
206 opExpRandRange,
208 opNumBinarySelectors
211 /* other special math operators */
212 enum {
213 /* 3 operands */
214 opDivz,
215 opClip,
216 opWrap,
217 opFold,
218 opRampMult,
219 opMix,
220 /* 4 operands */
221 opPoly3,
222 /* 5 operands */
223 opMapRange
226 enum {
227 opmNew,
228 opmInit,
229 opmAt,
230 opmPut,
231 opmNext,
232 opmReset,
233 opmValue,
234 opmCopyToEnd, // used by multi assign
235 opmAdd, // used by dynamic list
236 //opmIsNil,
237 //opmNotNil,
238 opmSize,
239 opmClass,
240 opmIf,
241 opmWhile,
242 opmFor,
243 opmAnd,
244 opmOr,
245 opmCase,
246 opmSwitch,
247 opmIdentical,
248 opmNotIdentical,
249 opmPrint,
250 opmRemove,
251 opmIndexOf,
252 opmWrapAt,
253 opmClipAt,
254 opmFoldAt,
255 opmWrapPut,
256 opmClipPut,
257 opmFoldPut,
258 opmDo,
259 opmCollect,
260 opmSelect,
261 opmReject,
262 opmAny,
263 opmEvery,
264 opmFind,
265 opmChoose,
266 opmValueList,
267 opmAddFirst,
268 opmPrimitiveFailed,
269 opmSubclassResponsibility,
270 opmShouldNotImplement,
271 opmNotYetImplemented,
272 opmDoesNotUnderstand,
274 opmAtSign,
275 opmWrapAtSign,
276 opmClipAtSign,
277 opmFoldAtSign,
279 opmNewClear,
280 opmNewCopyArgs,
281 opmMultiNew,
282 opmMultiNewList,
283 opmAR,
284 opmKR,
285 opmIR,
287 opmCopy,
288 opmPerformList,
289 opmIsKindOf,
290 opmPostln,
291 opmAsString,
293 opmEnvirGet,
294 opmEnvirPut,
296 opmHalt,
297 opmForBy,
298 opmForSeries,
299 opmReverseDo,
300 opmLoop,
302 opmNonBooleanError,
304 opmPlusPlus,
305 opmLTLT,
306 opmQuestionMark,
307 opmDoubleQuestionMark,
308 opmExclamationQuestionMark,
310 opmYield,
311 opmName,
312 opmMulAdd,
314 opmSeries,
316 opmNumSpecialSelectors
319 enum {
320 opsvSelf, // 0
321 opsvMinusOne,
322 opsvNegOne,
323 opsvZero,
324 opsvOne,
325 opsvTwo, // 5
326 opsvFHalf,
327 opsvFNegOne,
328 opsvFZero,
329 opsvFOne,
330 opsvFTwo, // 10
331 opsvPlusOne,
332 opsvTrue,
333 opsvFalse,
334 opsvNil,
335 opsvInf, // 15
337 opsvNumSpecialValues
340 enum {
341 opgProcess,
342 opgMethod,
343 opgFunctionDef,
344 opgFunction,
345 opgThread,
346 //opgSampleRate,
347 //opgAudioClock,
348 //opgLogicalClock,
350 opgNumPseudoVars
353 /* selector types */
354 enum {
355 selNormal,
356 selSpecial,
357 selUnary,
358 selBinary,
359 selIf,
360 selWhile,
361 selAnd,
362 selOr,
363 selCase,
364 selSwitch,
365 selLoop,
366 selSuperNew,
367 selQuestionMark,
368 selDoubleQuestionMark,
369 selExclamationQuestionMark,
371 selNumSelectorTypes
377 special classes:
378 Object, List, Number, Int, Float, Signal, Complex, Point
380 enum {
381 op_class_object,
382 op_class_symbol,
383 op_class_nil,
384 op_class_boolean,
385 op_class_true,
386 op_class_false,
387 op_class_magnitude,
388 op_class_char,
389 op_class_number,
390 op_class_complex,
391 op_class_simple_number,
392 op_class_int,
393 op_class_float,
394 op_class_method,
395 op_class_fundef,
396 op_class_stream,
397 op_class_func,
398 op_class_frame,
399 op_class_process,
400 op_class_main,
401 op_class_class,
402 op_class_string,
403 op_class_collection,
404 op_class_sequenceable_collection,
405 op_class_arrayed_collection,
406 op_class_array,
407 op_class_int8array,
408 op_class_int16array,
409 op_class_int32array,
410 op_class_floatarray,
411 op_class_signal,
412 op_class_doublearray,
413 op_class_symbolarray,
414 op_class_list,
415 op_class_linkedlist,
416 op_class_bag,
417 op_class_set,
418 op_class_identityset,
419 op_class_dictionary,
420 op_class_identitydictionary,
421 op_class_sortedlist,
422 op_class_synth,
423 op_class_ref,
424 op_class_environment,
425 op_class_event,
426 op_class_wavetable,
427 op_class_env,
429 op_class_routine,
430 op_class_color,
431 op_class_rect,
433 op_NumSpecialClasses
438 #endif