1 /*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine
5 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.cs.princeton.edu/
7 http://soundlab.cs.princeton.edu/
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 -----------------------------------------------------------------------------*/
25 //-----------------------------------------------------------------------------
26 // file: chuck_instr.h
29 // author: Ge Wang (gewang@cs.princeton.edu)
30 // Perry R. Cook (prc@cs.princeton.edu)
32 //-----------------------------------------------------------------------------
33 #ifndef __CHUCK_INSTR_H__
34 #define __CHUCK_INSTR_H__
37 #include "chuck_def.h"
43 struct Chuck_VM_Shred
;
50 //-----------------------------------------------------------------------------
51 // name: struct Chuck_Instr
53 //-----------------------------------------------------------------------------
57 virtual ~Chuck_Instr() { }
60 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
) = 0;
63 virtual const char * name() const;
64 virtual const char * params() const
71 //-----------------------------------------------------------------------------
72 // name: struct Chuck_Instr_Branch_Op
74 //-----------------------------------------------------------------------------
75 struct Chuck_Instr_Branch_Op
: public Chuck_Instr
78 inline void set( t_CKUINT jmp
) { m_jmp
= jmp
; }
81 virtual const char * params() const
82 { static char buffer
[256]; sprintf( buffer
, "%ld", m_jmp
); return buffer
; }
91 //-----------------------------------------------------------------------------
92 // name: struct Chuck_Instr_Unary_Op
94 //-----------------------------------------------------------------------------
95 struct Chuck_Instr_Unary_Op
: public Chuck_Instr
98 inline void set( t_CKUINT val
) { m_val
= val
; }
99 inline t_CKUINT
get() { return m_val
; }
102 virtual const char * params() const
103 { static char buffer
[256]; sprintf( buffer
, "%ld", m_val
); return buffer
; }
112 //-----------------------------------------------------------------------------
113 // name: struct Chuck_Instr_Unary_Op2
115 //-----------------------------------------------------------------------------
116 struct Chuck_Instr_Unary_Op2
: public Chuck_Instr
119 inline void set( t_CKFLOAT val
) { m_val
= val
; }
120 inline t_CKFLOAT
get() { return m_val
; }
123 virtual const char * params() const
124 { static char buffer
[256]; sprintf( buffer
, "%.6f", m_val
); return buffer
; }
133 //-----------------------------------------------------------------------------
134 // name: struct Chuck_Instr_Binary_Op
136 //-----------------------------------------------------------------------------
137 struct Chuck_Instr_Binary_Op
: public Chuck_Instr
143 //-----------------------------------------------------------------------------
144 // name: struct Chuck_Instr_Add_int
146 //-----------------------------------------------------------------------------
147 struct Chuck_Instr_Add_int
: public Chuck_Instr_Binary_Op
150 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
156 //-----------------------------------------------------------------------------
157 // name: struct Chuck_Instr_PreInc_int
159 //-----------------------------------------------------------------------------
160 struct Chuck_Instr_PreInc_int
: public Chuck_Instr
163 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
169 //-----------------------------------------------------------------------------
170 // name: struct Chuck_Instr_PostInc_int
172 //-----------------------------------------------------------------------------
173 struct Chuck_Instr_PostInc_int
: public Chuck_Instr
176 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
182 //-----------------------------------------------------------------------------
183 // name: struct Chuck_Instr_PreDec_int
185 //-----------------------------------------------------------------------------
186 struct Chuck_Instr_PreDec_int
: public Chuck_Instr
189 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
195 //-----------------------------------------------------------------------------
196 // name: struct Chuck_Instr_PostDec_int
198 //-----------------------------------------------------------------------------
199 struct Chuck_Instr_PostDec_int
: public Chuck_Instr
202 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
208 //-----------------------------------------------------------------------------
209 // name: struct Chuck_Instr_Dec_int_Addr
210 // desc: decrement int value at addr
211 //-----------------------------------------------------------------------------
212 struct Chuck_Instr_Dec_int_Addr
: public Chuck_Instr_Unary_Op
215 Chuck_Instr_Dec_int_Addr( t_CKUINT src
)
216 { this->set( src
); }
219 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
225 //-----------------------------------------------------------------------------
226 // name: struct Chuck_Instr_Complement_int
228 //-----------------------------------------------------------------------------
229 struct Chuck_Instr_Complement_int
: public Chuck_Instr
232 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
238 //-----------------------------------------------------------------------------
239 // name: struct Chuck_Instr_Mod_int
241 //-----------------------------------------------------------------------------
242 struct Chuck_Instr_Mod_int
: public Chuck_Instr_Binary_Op
245 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
251 //-----------------------------------------------------------------------------
252 // name: struct Chuck_Instr_Mod_int_Reverse
253 // desc: same as mod_int, operands reversed, for %=>
254 //-----------------------------------------------------------------------------
255 struct Chuck_Instr_Mod_int_Reverse
: public Chuck_Instr_Binary_Op
258 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
264 //-----------------------------------------------------------------------------
265 // name: struct Chuck_Instr_Minus_int
267 //-----------------------------------------------------------------------------
268 struct Chuck_Instr_Minus_int
: public Chuck_Instr_Binary_Op
271 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
277 //-----------------------------------------------------------------------------
278 // name: struct Chuck_Instr_Minus_int_Reverse
279 // desc: same as minus_int, operands reversed, for -=>
280 //-----------------------------------------------------------------------------
281 struct Chuck_Instr_Minus_int_Reverse
: public Chuck_Instr_Binary_Op
284 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
290 //-----------------------------------------------------------------------------
291 // name: struct Chuck_Instr_Times_int
293 //-----------------------------------------------------------------------------
294 struct Chuck_Instr_Times_int
: public Chuck_Instr_Binary_Op
297 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
303 //-----------------------------------------------------------------------------
304 // name: struct Chuck_Instr_Divide_int
306 //-----------------------------------------------------------------------------
307 struct Chuck_Instr_Divide_int
: public Chuck_Instr_Binary_Op
310 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
316 //-----------------------------------------------------------------------------
317 // name: struct Chuck_Instr_Divide_int_Reverse
318 // desc: same as divide_int, operands reversed, for /=>
319 //-----------------------------------------------------------------------------
320 struct Chuck_Instr_Divide_int_Reverse
: public Chuck_Instr_Binary_Op
323 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
329 //-----------------------------------------------------------------------------
330 // name: struct Chuck_Instr_Add_double
332 //-----------------------------------------------------------------------------
333 struct Chuck_Instr_Add_double
: public Chuck_Instr_Binary_Op
336 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
342 //-----------------------------------------------------------------------------
343 // name: struct Chuck_Instr_Minus_double
345 //-----------------------------------------------------------------------------
346 struct Chuck_Instr_Minus_double
: public Chuck_Instr_Binary_Op
349 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
355 //-----------------------------------------------------------------------------
356 // name: struct Chuck_Instr_Minus_double_Reverse
357 // desc: same as minus_double, operands reversed, for -=>
358 //-----------------------------------------------------------------------------
359 struct Chuck_Instr_Minus_double_Reverse
: public Chuck_Instr_Binary_Op
362 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
368 //-----------------------------------------------------------------------------
369 // name: struct Chuck_Instr_Times_double
371 //-----------------------------------------------------------------------------
372 struct Chuck_Instr_Times_double
: public Chuck_Instr_Binary_Op
375 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
381 //-----------------------------------------------------------------------------
382 // name: struct Chuck_Instr_Divide_double
384 //-----------------------------------------------------------------------------
385 struct Chuck_Instr_Divide_double
: public Chuck_Instr_Binary_Op
388 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
394 //-----------------------------------------------------------------------------
395 // name: struct Chuck_Instr_Divide_double_Reverse
396 // desc: same as divide_double, operands reversed, for /=>
397 //-----------------------------------------------------------------------------
398 struct Chuck_Instr_Divide_double_Reverse
: public Chuck_Instr_Binary_Op
401 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
407 //-----------------------------------------------------------------------------
408 // name: struct Chuck_Instr_Mod_double
410 //-----------------------------------------------------------------------------
411 struct Chuck_Instr_Mod_double
: public Chuck_Instr_Binary_Op
414 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
420 //-----------------------------------------------------------------------------
421 // name: struct Chuck_Instr_Mod_double_Reverse
422 // desc: same as mod_double, operands reversed, for %=>
423 //-----------------------------------------------------------------------------
424 struct Chuck_Instr_Mod_double_Reverse
: public Chuck_Instr_Binary_Op
427 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
433 //-----------------------------------------------------------------------------
434 // name: struct Chuck_Instr_Add_complex
436 //-----------------------------------------------------------------------------
437 struct Chuck_Instr_Add_complex
: public Chuck_Instr_Binary_Op
440 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
446 //-----------------------------------------------------------------------------
447 // name: struct Chuck_Instr_Minus_complex
449 //-----------------------------------------------------------------------------
450 struct Chuck_Instr_Minus_complex
: public Chuck_Instr_Binary_Op
453 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
459 //-----------------------------------------------------------------------------
460 // name: struct Chuck_Instr_Minus_complex_Reverse
461 // desc: same as minus_complex, operands reversed, for -=>
462 //-----------------------------------------------------------------------------
463 struct Chuck_Instr_Minus_complex_Reverse
: public Chuck_Instr_Binary_Op
466 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
472 //-----------------------------------------------------------------------------
473 // name: struct Chuck_Instr_Times_complex
475 //-----------------------------------------------------------------------------
476 struct Chuck_Instr_Times_complex
: public Chuck_Instr_Binary_Op
479 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
485 //-----------------------------------------------------------------------------
486 // name: struct Chuck_Instr_Divide_complex
488 //-----------------------------------------------------------------------------
489 struct Chuck_Instr_Divide_complex
: public Chuck_Instr_Binary_Op
492 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
498 //-----------------------------------------------------------------------------
499 // name: struct Chuck_Instr_Divide_complex_Reverse
500 // desc: same as divide_complex, operands reversed, for /=>
501 //-----------------------------------------------------------------------------
502 struct Chuck_Instr_Divide_complex_Reverse
: public Chuck_Instr_Binary_Op
505 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
511 //-----------------------------------------------------------------------------
512 // name: struct Chuck_Instr_Add_polar
514 //-----------------------------------------------------------------------------
515 struct Chuck_Instr_Add_polar
: public Chuck_Instr_Binary_Op
518 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
524 //-----------------------------------------------------------------------------
525 // name: struct Chuck_Instr_Minus_polar
527 //-----------------------------------------------------------------------------
528 struct Chuck_Instr_Minus_polar
: public Chuck_Instr_Binary_Op
531 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
537 //-----------------------------------------------------------------------------
538 // name: struct Chuck_Instr_Minus_polar_Reverse
539 // desc: same as minus_polar, operands reversed, for -=>
540 //-----------------------------------------------------------------------------
541 struct Chuck_Instr_Minus_polar_Reverse
: public Chuck_Instr_Binary_Op
544 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
550 //-----------------------------------------------------------------------------
551 // name: struct Chuck_Instr_Times_polar
553 //-----------------------------------------------------------------------------
554 struct Chuck_Instr_Times_polar
: public Chuck_Instr_Binary_Op
557 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
563 //-----------------------------------------------------------------------------
564 // name: struct Chuck_Instr_Divide_polar
566 //-----------------------------------------------------------------------------
567 struct Chuck_Instr_Divide_polar
: public Chuck_Instr_Binary_Op
570 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
576 //-----------------------------------------------------------------------------
577 // name: struct Chuck_Instr_Divide_polar_Reverse
578 // desc: same as divide_complex, operands reversed, for /=>
579 //-----------------------------------------------------------------------------
580 struct Chuck_Instr_Divide_polar_Reverse
: public Chuck_Instr_Binary_Op
583 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
589 //-----------------------------------------------------------------------------
590 // name: struct Chuck_Instr_Add_int_Assign
592 //-----------------------------------------------------------------------------
593 struct Chuck_Instr_Add_int_Assign
: public Chuck_Instr_Binary_Op
596 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
602 //-----------------------------------------------------------------------------
603 // name: struct Chuck_Instr_Mod_int_Assign
605 //-----------------------------------------------------------------------------
606 struct Chuck_Instr_Mod_int_Assign
: public Chuck_Instr_Binary_Op
609 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
615 //-----------------------------------------------------------------------------
616 // name: struct Chuck_Instr_Minus_int_Assign
618 //-----------------------------------------------------------------------------
619 struct Chuck_Instr_Minus_int_Assign
: public Chuck_Instr_Binary_Op
622 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
628 //-----------------------------------------------------------------------------
629 // name: struct Chuck_Instr_Times_int_Assign
631 //-----------------------------------------------------------------------------
632 struct Chuck_Instr_Times_int_Assign
: public Chuck_Instr_Binary_Op
635 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
641 //-----------------------------------------------------------------------------
642 // name: struct Chuck_Instr_Divide_int_Assign
644 //-----------------------------------------------------------------------------
645 struct Chuck_Instr_Divide_int_Assign
: public Chuck_Instr_Binary_Op
648 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
654 //-----------------------------------------------------------------------------
655 // name: struct Chuck_Instr_Add_double_Assign
657 //-----------------------------------------------------------------------------
658 struct Chuck_Instr_Add_double_Assign
: public Chuck_Instr_Binary_Op
661 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
667 //-----------------------------------------------------------------------------
668 // name: struct Chuck_Instr_Minus_double_Assign
670 //-----------------------------------------------------------------------------
671 struct Chuck_Instr_Minus_double_Assign
: public Chuck_Instr_Binary_Op
674 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
680 //-----------------------------------------------------------------------------
681 // name: struct Chuck_Instr_Times_double_Assign
683 //-----------------------------------------------------------------------------
684 struct Chuck_Instr_Times_double_Assign
: public Chuck_Instr_Binary_Op
687 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
693 //-----------------------------------------------------------------------------
694 // name: struct Chuck_Instr_Divide_double_Assign
696 //-----------------------------------------------------------------------------
697 struct Chuck_Instr_Divide_double_Assign
: public Chuck_Instr_Binary_Op
700 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
706 //-----------------------------------------------------------------------------
707 // name: struct Chuck_Instr_Mod_double_Assign
709 //-----------------------------------------------------------------------------
710 struct Chuck_Instr_Mod_double_Assign
: public Chuck_Instr_Binary_Op
713 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
719 //-----------------------------------------------------------------------------
720 // name: struct Chuck_Instr_Add_complex_Assign
722 //-----------------------------------------------------------------------------
723 struct Chuck_Instr_Add_complex_Assign
: public Chuck_Instr_Binary_Op
726 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
732 //-----------------------------------------------------------------------------
733 // name: struct Chuck_Instr_Minus_complex_Assign
735 //-----------------------------------------------------------------------------
736 struct Chuck_Instr_Minus_complex_Assign
: public Chuck_Instr_Binary_Op
739 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
745 //-----------------------------------------------------------------------------
746 // name: struct Chuck_Instr_Times_complex_Assign
748 //-----------------------------------------------------------------------------
749 struct Chuck_Instr_Times_complex_Assign
: public Chuck_Instr_Binary_Op
752 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
758 //-----------------------------------------------------------------------------
759 // name: struct Chuck_Instr_Divide_complex_Assign
761 //-----------------------------------------------------------------------------
762 struct Chuck_Instr_Divide_complex_Assign
: public Chuck_Instr_Binary_Op
765 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
771 //-----------------------------------------------------------------------------
772 // name: struct Chuck_Instr_Add_polar_Assign
774 //-----------------------------------------------------------------------------
775 struct Chuck_Instr_Add_polar_Assign
: public Chuck_Instr_Binary_Op
778 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
784 //-----------------------------------------------------------------------------
785 // name: struct Chuck_Instr_Minus_polar_Assign
787 //-----------------------------------------------------------------------------
788 struct Chuck_Instr_Minus_polar_Assign
: public Chuck_Instr_Binary_Op
791 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
797 //-----------------------------------------------------------------------------
798 // name: struct Chuck_Instr_Times_polar_Assign
800 //-----------------------------------------------------------------------------
801 struct Chuck_Instr_Times_polar_Assign
: public Chuck_Instr_Binary_Op
804 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
810 //-----------------------------------------------------------------------------
811 // name: struct Chuck_Instr_Divide_polar_Assign
813 //-----------------------------------------------------------------------------
814 struct Chuck_Instr_Divide_polar_Assign
: public Chuck_Instr_Binary_Op
817 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
823 //-----------------------------------------------------------------------------
824 // name: struct Chuck_Instr_Add_string
826 //-----------------------------------------------------------------------------
827 struct Chuck_Instr_Add_string
: public Chuck_Instr_Binary_Op
830 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
836 //-----------------------------------------------------------------------------
837 // name: struct Chuck_Instr_Add_string_Assign
839 //-----------------------------------------------------------------------------
840 struct Chuck_Instr_Add_string_Assign
: public Chuck_Instr_Binary_Op
843 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
849 //-----------------------------------------------------------------------------
850 // name: struct Chuck_Instr_Add_string_int
852 //-----------------------------------------------------------------------------
853 struct Chuck_Instr_Add_string_int
: public Chuck_Instr_Binary_Op
856 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
862 //-----------------------------------------------------------------------------
863 // name: struct Chuck_Instr_Add_string_float
865 //-----------------------------------------------------------------------------
866 struct Chuck_Instr_Add_string_float
: public Chuck_Instr_Binary_Op
869 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
875 //-----------------------------------------------------------------------------
876 // name: struct Chuck_Instr_Add_int_string
878 //-----------------------------------------------------------------------------
879 struct Chuck_Instr_Add_int_string
: public Chuck_Instr_Binary_Op
882 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
888 //-----------------------------------------------------------------------------
889 // name: struct Chuck_Instr_Add_float_string
891 //-----------------------------------------------------------------------------
892 struct Chuck_Instr_Add_float_string
: public Chuck_Instr_Binary_Op
895 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
901 //-----------------------------------------------------------------------------
902 // name: struct Chuck_Instr_Add_int_string_Assign
904 //-----------------------------------------------------------------------------
905 struct Chuck_Instr_Add_int_string_Assign
: public Chuck_Instr_Binary_Op
908 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
914 //-----------------------------------------------------------------------------
915 // name: struct Chuck_Instr_Add_float_string_Assign
917 //-----------------------------------------------------------------------------
918 struct Chuck_Instr_Add_float_string_Assign
: public Chuck_Instr_Binary_Op
921 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
927 //-----------------------------------------------------------------------------
928 // name: struct Chuck_Instr_Branch_Lt_int
930 //-----------------------------------------------------------------------------
931 struct Chuck_Instr_Branch_Lt_int
: public Chuck_Instr_Branch_Op
934 Chuck_Instr_Branch_Lt_int( t_CKUINT jmp
) { this->set( jmp
); }
935 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
941 //-----------------------------------------------------------------------------
942 // name: struct Chuck_Instr_Branch_Gt_int
944 //-----------------------------------------------------------------------------
945 struct Chuck_Instr_Branch_Gt_int
: public Chuck_Instr_Branch_Op
948 Chuck_Instr_Branch_Gt_int( t_CKUINT jmp
) { this->set( jmp
); }
949 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
955 //-----------------------------------------------------------------------------
956 // name: struct Chuck_Instr_Branch_Le_int
958 //-----------------------------------------------------------------------------
959 struct Chuck_Instr_Branch_Le_int
: public Chuck_Instr_Branch_Op
962 Chuck_Instr_Branch_Le_int( t_CKUINT jmp
) { this->set( jmp
); }
963 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
969 //-----------------------------------------------------------------------------
970 // name: struct Chuck_Instr_Branch_Ge_int
972 //-----------------------------------------------------------------------------
973 struct Chuck_Instr_Branch_Ge_int
: public Chuck_Instr_Branch_Op
976 Chuck_Instr_Branch_Ge_int( t_CKUINT jmp
) { this->set( jmp
); }
977 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
983 //-----------------------------------------------------------------------------
984 // name: struct Chuck_Instr_Branch_Eq_int
986 //-----------------------------------------------------------------------------
987 struct Chuck_Instr_Branch_Eq_int
: public Chuck_Instr_Branch_Op
990 Chuck_Instr_Branch_Eq_int( t_CKUINT jmp
) { this->set( jmp
); }
991 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
997 //-----------------------------------------------------------------------------
998 // name: struct Chuck_Instr_Branch_Neq_int
1000 //-----------------------------------------------------------------------------
1001 struct Chuck_Instr_Branch_Neq_int
: public Chuck_Instr_Branch_Op
1004 Chuck_Instr_Branch_Neq_int( t_CKUINT jmp
) { this->set( jmp
); }
1005 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1011 //-----------------------------------------------------------------------------
1012 // name: struct Chuck_Instr_Branch_Lt_double
1014 //-----------------------------------------------------------------------------
1015 struct Chuck_Instr_Branch_Lt_double
: public Chuck_Instr_Branch_Op
1018 Chuck_Instr_Branch_Lt_double( t_CKUINT jmp
) { this->set( jmp
); }
1019 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1025 //-----------------------------------------------------------------------------
1026 // name: struct Chuck_Instr_Branch_Gt_double
1028 //-----------------------------------------------------------------------------
1029 struct Chuck_Instr_Branch_Gt_double
: public Chuck_Instr_Branch_Op
1032 Chuck_Instr_Branch_Gt_double( t_CKUINT jmp
) { this->set( jmp
); }
1033 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1039 //-----------------------------------------------------------------------------
1040 // name: struct Chuck_Instr_Branch_Le_double
1042 //-----------------------------------------------------------------------------
1043 struct Chuck_Instr_Branch_Le_double
: public Chuck_Instr_Branch_Op
1046 Chuck_Instr_Branch_Le_double( t_CKUINT jmp
) { this->set( jmp
); }
1047 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1053 //-----------------------------------------------------------------------------
1054 // name: struct Chuck_Instr_Branch_Ge_double
1056 //-----------------------------------------------------------------------------
1057 struct Chuck_Instr_Branch_Ge_double
: public Chuck_Instr_Branch_Op
1060 Chuck_Instr_Branch_Ge_double( t_CKUINT jmp
) { this->set( jmp
); }
1061 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1067 //-----------------------------------------------------------------------------
1068 // name: struct Chuck_Instr_Branch_Eq_double
1070 //-----------------------------------------------------------------------------
1071 struct Chuck_Instr_Branch_Eq_double
: public Chuck_Instr_Branch_Op
1074 Chuck_Instr_Branch_Eq_double( t_CKUINT jmp
) { this->set( jmp
); }
1075 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1081 //-----------------------------------------------------------------------------
1082 // name: struct Chuck_Instr_Branch_Neq_double
1084 //-----------------------------------------------------------------------------
1085 struct Chuck_Instr_Branch_Neq_double
: public Chuck_Instr_Branch_Op
1088 Chuck_Instr_Branch_Neq_double( t_CKUINT jmp
) { this->set( jmp
); }
1089 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1095 //-----------------------------------------------------------------------------
1096 // name: struct Chuck_Instr_Lt_int
1098 //-----------------------------------------------------------------------------
1099 struct Chuck_Instr_Lt_int
: public Chuck_Instr_Binary_Op
1102 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1108 //-----------------------------------------------------------------------------
1109 // name: struct Chuck_Instr_Gt_int
1111 //-----------------------------------------------------------------------------
1112 struct Chuck_Instr_Gt_int
: public Chuck_Instr_Binary_Op
1115 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1121 //-----------------------------------------------------------------------------
1122 // name: struct Chuck_Instr_Le_int
1124 //-----------------------------------------------------------------------------
1125 struct Chuck_Instr_Le_int
: public Chuck_Instr_Binary_Op
1128 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1134 //-----------------------------------------------------------------------------
1135 // name: struct Chuck_Instr_Ge_int
1137 //-----------------------------------------------------------------------------
1138 struct Chuck_Instr_Ge_int
: public Chuck_Instr_Binary_Op
1141 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1147 //-----------------------------------------------------------------------------
1148 // name: struct Chuck_Instr_Eq_int
1150 //-----------------------------------------------------------------------------
1151 struct Chuck_Instr_Eq_int
: public Chuck_Instr_Binary_Op
1154 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1160 //-----------------------------------------------------------------------------
1161 // name: struct Chuck_Instr_Neq_int
1163 //-----------------------------------------------------------------------------
1164 struct Chuck_Instr_Neq_int
: public Chuck_Instr_Binary_Op
1167 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1173 //-----------------------------------------------------------------------------
1174 // name: struct Chuck_Instr_Not_int
1176 //-----------------------------------------------------------------------------
1177 struct Chuck_Instr_Not_int
: public Chuck_Instr
1180 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1186 //-----------------------------------------------------------------------------
1187 // name: struct Chuck_Instr_Negate_int
1189 //-----------------------------------------------------------------------------
1190 struct Chuck_Instr_Negate_int
: public Chuck_Instr
1193 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1199 //-----------------------------------------------------------------------------
1200 // name: struct Chuck_Instr_Negate_double
1202 //-----------------------------------------------------------------------------
1203 struct Chuck_Instr_Negate_double
: public Chuck_Instr
1206 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1212 //-----------------------------------------------------------------------------
1213 // name: struct Chuck_Instr_Lt_double
1215 //-----------------------------------------------------------------------------
1216 struct Chuck_Instr_Lt_double
: public Chuck_Instr_Binary_Op
1219 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1225 //-----------------------------------------------------------------------------
1226 // name: struct Chuck_Instr_Gt_double
1228 //-----------------------------------------------------------------------------
1229 struct Chuck_Instr_Gt_double
: public Chuck_Instr_Binary_Op
1232 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1238 //-----------------------------------------------------------------------------
1239 // name: struct Chuck_Instr_Le_double
1241 //-----------------------------------------------------------------------------
1242 struct Chuck_Instr_Le_double
: public Chuck_Instr_Binary_Op
1245 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1251 //-----------------------------------------------------------------------------
1252 // name: struct Chuck_Instr_Ge_double
1254 //-----------------------------------------------------------------------------
1255 struct Chuck_Instr_Ge_double
: public Chuck_Instr_Binary_Op
1258 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1264 //-----------------------------------------------------------------------------
1265 // name: struct Chuck_Instr_Eq_double
1267 //-----------------------------------------------------------------------------
1268 struct Chuck_Instr_Eq_double
: public Chuck_Instr_Binary_Op
1271 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1277 //-----------------------------------------------------------------------------
1278 // name: struct Chuck_Instr_Neq_double
1280 //-----------------------------------------------------------------------------
1281 struct Chuck_Instr_Neq_double
: public Chuck_Instr_Binary_Op
1284 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1290 //-----------------------------------------------------------------------------
1291 // name: struct Chuck_Instr_Binary_And
1293 //-----------------------------------------------------------------------------
1294 struct Chuck_Instr_Binary_And
: public Chuck_Instr_Binary_Op
1297 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1303 //-----------------------------------------------------------------------------
1304 // name: struct Chuck_Instr_Binary_Or
1306 //-----------------------------------------------------------------------------
1307 struct Chuck_Instr_Binary_Or
: public Chuck_Instr_Binary_Op
1310 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1316 //-----------------------------------------------------------------------------
1317 // name: struct Chuck_Instr_Binary_Xor
1319 //-----------------------------------------------------------------------------
1320 struct Chuck_Instr_Binary_Xor
: public Chuck_Instr_Binary_Op
1323 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1329 //-----------------------------------------------------------------------------
1330 // name: struct Chuck_Instr_Binary_Shift_Right
1332 //-----------------------------------------------------------------------------
1333 struct Chuck_Instr_Binary_Shift_Right
: public Chuck_Instr_Binary_Op
1336 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1342 //-----------------------------------------------------------------------------
1343 // name: struct Chuck_Instr_Binary_Shift_Right_Reverse
1344 // desc: same as shift_right, operands reversed, for >>=>
1345 //-----------------------------------------------------------------------------
1346 struct Chuck_Instr_Binary_Shift_Right_Reverse
: public Chuck_Instr_Binary_Op
1349 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1355 //-----------------------------------------------------------------------------
1356 // name: struct Chuck_Instr_Binary_Shift_Left
1358 //-----------------------------------------------------------------------------
1359 struct Chuck_Instr_Binary_Shift_Left
: public Chuck_Instr_Binary_Op
1362 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1368 //-----------------------------------------------------------------------------
1369 // name: struct Chuck_Instr_Binary_Shift_Left_Reverse
1370 // desc: same as shift_left, operands reversed, for <<=>
1371 //-----------------------------------------------------------------------------
1372 struct Chuck_Instr_Binary_Shift_Left_Reverse
: public Chuck_Instr_Binary_Op
1375 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1381 //-----------------------------------------------------------------------------
1382 // name: struct Chuck_Instr_Binary_And_Assign
1384 //-----------------------------------------------------------------------------
1385 struct Chuck_Instr_Binary_And_Assign
: public Chuck_Instr_Binary_Op
1388 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1394 //-----------------------------------------------------------------------------
1395 // name: struct Chuck_Instr_Binary_Or_Assign
1397 //-----------------------------------------------------------------------------
1398 struct Chuck_Instr_Binary_Or_Assign
: public Chuck_Instr_Binary_Op
1401 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1407 //-----------------------------------------------------------------------------
1408 // name: struct Chuck_Instr_Binary_Xor_Assign
1410 //-----------------------------------------------------------------------------
1411 struct Chuck_Instr_Binary_Xor_Assign
: public Chuck_Instr_Binary_Op
1414 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1420 //-----------------------------------------------------------------------------
1421 // name: struct Chuck_Instr_Binary_Shift_Right_Assign
1423 //-----------------------------------------------------------------------------
1424 struct Chuck_Instr_Binary_Shift_Right_Assign
: public Chuck_Instr_Binary_Op
1427 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1433 //-----------------------------------------------------------------------------
1434 // name: struct Chuck_Instr_Binary_Shift_Left_Assign
1436 //-----------------------------------------------------------------------------
1437 struct Chuck_Instr_Binary_Shift_Left_Assign
: public Chuck_Instr_Binary_Op
1440 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1446 //-----------------------------------------------------------------------------
1447 // name: struct Chuck_Instr_And
1449 //-----------------------------------------------------------------------------
1450 struct Chuck_Instr_And
: public Chuck_Instr_Binary_Op
1453 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1459 //-----------------------------------------------------------------------------
1460 // name: struct Chuck_Instr_Or
1462 //-----------------------------------------------------------------------------
1463 struct Chuck_Instr_Or
: public Chuck_Instr_Binary_Op
1466 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1472 //-----------------------------------------------------------------------------
1473 // name: struct Chuck_Instr_Goto
1475 //-----------------------------------------------------------------------------
1476 struct Chuck_Instr_Goto
: public Chuck_Instr_Branch_Op
1479 Chuck_Instr_Goto( t_CKUINT jmp
) { this->set( jmp
); }
1480 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1486 //-----------------------------------------------------------------------------
1487 // name: struct Chuck_Instr_Reg_Pop_Word
1488 // desc: pop word from reg stack
1489 //-----------------------------------------------------------------------------
1490 struct Chuck_Instr_Reg_Pop_Word
: public Chuck_Instr
1493 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1499 //-----------------------------------------------------------------------------
1500 // name: struct Chuck_Instr_Reg_Pop_Word2
1501 // desc: pop t_CKFLOAT word from reg stack
1502 //-----------------------------------------------------------------------------
1503 struct Chuck_Instr_Reg_Pop_Word2
: public Chuck_Instr
1506 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1512 //-----------------------------------------------------------------------------
1513 // name: struct Chuck_Instr_Reg_Pop_Word3
1514 // desc: pop arbitrary num of word from reg stack
1515 //-----------------------------------------------------------------------------
1516 struct Chuck_Instr_Reg_Pop_Word3
: public Chuck_Instr_Unary_Op
1519 Chuck_Instr_Reg_Pop_Word3( t_CKUINT num
) { this->set( num
); }
1520 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1526 //-----------------------------------------------------------------------------
1527 // name: struct Chuck_Instr_Reg_Pop_Mem
1528 // desc: pop word, and copy it to the mem stack
1529 //-----------------------------------------------------------------------------
1530 struct Chuck_Instr_Reg_Pop_Mem
: public Chuck_Instr_Unary_Op
1533 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1539 //-----------------------------------------------------------------------------
1540 // name: struct Chuck_Instr_Reg_Pop_Mem2
1541 // desc: pop t_CKFLOAT word, and copy it to the mem stack
1542 //-----------------------------------------------------------------------------
1543 struct Chuck_Instr_Reg_Pop_Mem2
: public Chuck_Instr_Unary_Op
1546 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1552 //-----------------------------------------------------------------------------
1553 // name: struct Chuck_Instr_Reg_Push_Imm
1554 // desc: push immediate to reg stack
1555 //-----------------------------------------------------------------------------
1556 struct Chuck_Instr_Reg_Push_Imm
: public Chuck_Instr_Unary_Op
1559 Chuck_Instr_Reg_Push_Imm( t_CKUINT val
)
1560 { this->set( val
); }
1563 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1569 //-----------------------------------------------------------------------------
1570 // name: struct Chuck_Instr_Reg_Push_Imm2
1571 // desc: push t_CKFLOAT immediate to reg stack
1572 //-----------------------------------------------------------------------------
1573 struct Chuck_Instr_Reg_Push_Imm2
: public Chuck_Instr_Unary_Op2
1576 Chuck_Instr_Reg_Push_Imm2( t_CKFLOAT val
)
1577 { this->set( val
); }
1580 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1586 //-----------------------------------------------------------------------------
1587 // name: struct Chuck_Instr_Reg_Push_Imm4
1588 // desc: push t_CKCOMPLEX immediate to reg stack
1589 //-----------------------------------------------------------------------------
1590 struct Chuck_Instr_Reg_Push_Imm4
: public Chuck_Instr_Unary_Op2
1593 Chuck_Instr_Reg_Push_Imm4( t_CKFLOAT x
, t_CKFLOAT y
)
1594 { this->set( x
); m_val2
= y
; }
1597 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1606 //-----------------------------------------------------------------------------
1607 // name: struct Chuck_Instr_Reg_Dup_Last
1608 // desc: duplicate last value on reg stack
1609 //-----------------------------------------------------------------------------
1610 struct Chuck_Instr_Reg_Dup_Last
: public Chuck_Instr
1613 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1619 //-----------------------------------------------------------------------------
1620 // name: struct Chuck_Instr_Reg_Dup_Last2
1621 // desc: duplicate last float on reg stack
1622 //-----------------------------------------------------------------------------
1623 struct Chuck_Instr_Reg_Dup_Last2
: public Chuck_Instr
1626 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1632 //-----------------------------------------------------------------------------
1633 // name: struct Chuck_Instr_Reg_Push_Now
1634 // desc: push value of now to reg stack
1635 //-----------------------------------------------------------------------------
1636 struct Chuck_Instr_Reg_Push_Now
: public Chuck_Instr
1639 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1645 //-----------------------------------------------------------------------------
1646 // name: struct Chuck_Instr_Reg_Push_Me
1647 // desc: push value of me to reg stack
1648 //-----------------------------------------------------------------------------
1649 struct Chuck_Instr_Reg_Push_Me
: public Chuck_Instr
1652 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1658 //-----------------------------------------------------------------------------
1659 // name: struct Chuck_Instr_Reg_Push_This
1660 // desc: push value of now to reg stack
1661 //-----------------------------------------------------------------------------
1662 struct Chuck_Instr_Reg_Push_This
: public Chuck_Instr
1665 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1671 //-----------------------------------------------------------------------------
1672 // name: struct Chuck_Instr_Reg_Push_Start
1673 // desc: push value of start to reg stack
1674 //-----------------------------------------------------------------------------
1675 struct Chuck_Instr_Reg_Push_Start
: public Chuck_Instr
1678 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1684 //-----------------------------------------------------------------------------
1685 // name: struct Chuck_Instr_Reg_Push_Maybe
1686 // desc: push immediate to reg stack
1687 //-----------------------------------------------------------------------------
1688 struct Chuck_Instr_Reg_Push_Maybe
: public Chuck_Instr_Unary_Op
1691 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1697 //-----------------------------------------------------------------------------
1698 // name: struct Chuck_Instr_Reg_Push_Mem
1699 // desc: push a variable from mem stack to reg stack
1700 //-----------------------------------------------------------------------------
1701 struct Chuck_Instr_Reg_Push_Mem
: public Chuck_Instr_Unary_Op
1704 Chuck_Instr_Reg_Push_Mem( t_CKUINT src
, t_CKBOOL use_base
= FALSE
)
1705 { this->set( src
); base
= use_base
; }
1708 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1709 virtual const char * params() const
1710 { static char buffer
[256];
1711 sprintf( buffer
, "src=%ld, base=%ld", m_val
, base
);
1715 // use global stack base
1722 //-----------------------------------------------------------------------------
1723 // name: struct Chuck_Instr_Reg_Push_Mem2
1724 // desc: push a t_CKFLOAT variable from mem stack to reg stack
1725 //-----------------------------------------------------------------------------
1726 struct Chuck_Instr_Reg_Push_Mem2
: public Chuck_Instr_Unary_Op
1729 Chuck_Instr_Reg_Push_Mem2( t_CKUINT src
, t_CKBOOL use_base
= FALSE
)
1730 { this->set( src
); base
= use_base
; }
1733 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1734 virtual const char * params() const
1735 { static char buffer
[256];
1736 sprintf( buffer
, "src=%ld, base=%ld", m_val
, base
);
1740 // use global stack base
1747 //-----------------------------------------------------------------------------
1748 // name: struct Chuck_Instr_Reg_Push_Mem4
1749 // desc: push a t_CKCOMPLEX variable from mem stack to reg stack
1750 //-----------------------------------------------------------------------------
1751 struct Chuck_Instr_Reg_Push_Mem4
: public Chuck_Instr_Unary_Op
1754 Chuck_Instr_Reg_Push_Mem4( t_CKUINT src
, t_CKBOOL use_base
= FALSE
)
1755 { this->set( src
); base
= use_base
; }
1758 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1759 virtual const char * params() const
1760 { static char buffer
[256];
1761 sprintf( buffer
, "src=%ld, base=%ld", m_val
, base
);
1765 // use global stack base
1772 //-----------------------------------------------------------------------------
1773 // name: struct Chuck_Instr_Reg_Push_Mem_Addr
1774 // desc: push addr from mem stack to reg stack
1775 //-----------------------------------------------------------------------------
1776 struct Chuck_Instr_Reg_Push_Mem_Addr
: public Chuck_Instr_Unary_Op
1779 Chuck_Instr_Reg_Push_Mem_Addr( t_CKUINT src
, t_CKBOOL use_base
)
1780 { this->set( src
); base
= use_base
; }
1783 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1784 virtual const char * params() const
1785 { static char buffer
[256];
1786 sprintf( buffer
, "src=%ld, base=%ld", m_val
, base
);
1790 // use global stack base
1797 //-----------------------------------------------------------------------------
1798 // name: struct Chuck_Instr_Reg_Push_Deref
1799 // desc: push value from pointer
1800 //-----------------------------------------------------------------------------
1801 struct Chuck_Instr_Reg_Push_Deref
: public Chuck_Instr_Unary_Op
1804 Chuck_Instr_Reg_Push_Deref( t_CKUINT src
, t_CKUINT size
)
1805 { this->set( src
); m_size
= size
; }
1808 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1815 //-----------------------------------------------------------------------------
1816 // name: struct Chuck_Instr_Reg_Push_Deref
1817 // desc: push a t_CKFLOAT variable from main memory to reg stack
1818 //-----------------------------------------------------------------------------
1819 struct Chuck_Instr_Reg_Push_Deref2
: public Chuck_Instr_Unary_Op2
1822 Chuck_Instr_Reg_Push_Deref2( t_CKFLOAT src
)
1823 { this->set( src
); }
1826 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1832 //-----------------------------------------------------------------------------
1833 // name: struct Chuck_Instr_Mem_Set_Imm
1834 // desc: set a value unto mem stack
1835 //-----------------------------------------------------------------------------
1836 struct Chuck_Instr_Mem_Set_Imm
: public Chuck_Instr
1839 Chuck_Instr_Mem_Set_Imm( t_CKUINT offset
, t_CKUINT val
)
1840 { m_offset
= offset
; m_val
= val
; }
1843 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1844 virtual const char * params() const
1845 { static char buffer
[256];
1846 sprintf( buffer
, "offset=%ld, value=%ld", m_offset
, m_val
);
1857 //-----------------------------------------------------------------------------
1858 // name: struct Chuck_Instr_Mem_Set_Imm2
1859 // desc: set a value unto mem stack
1860 //-----------------------------------------------------------------------------
1861 struct Chuck_Instr_Mem_Set_Imm2
: public Chuck_Instr_Unary_Op
1864 Chuck_Instr_Mem_Set_Imm2( t_CKUINT offset
, t_CKFLOAT val
)
1865 { m_offset
= offset
; m_val
= val
; }
1868 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1869 virtual const char * params() const
1870 { static char buffer
[256];
1871 sprintf( buffer
, "offset=%ld, value=%f", m_offset
, m_val
);
1882 //-----------------------------------------------------------------------------
1883 // name: struct Chuck_Instr_Mem_Push_Imm
1884 // desc: push a value unto mem stack
1885 //-----------------------------------------------------------------------------
1886 struct Chuck_Instr_Mem_Push_Imm
: public Chuck_Instr_Unary_Op
1889 Chuck_Instr_Mem_Push_Imm( t_CKUINT src
)
1890 { this->set( src
); }
1893 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1898 //-----------------------------------------------------------------------------
1899 // name: struct Chuck_Instr_Mem_Push_Imm2
1900 // desc: push a t_CKFLOAT value unto mem stack
1901 //-----------------------------------------------------------------------------
1902 struct Chuck_Instr_Mem_Push_Imm2
: public Chuck_Instr_Unary_Op2
1905 Chuck_Instr_Mem_Push_Imm2( t_CKFLOAT src
)
1906 { this->set( src
); }
1909 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1914 //-----------------------------------------------------------------------------
1915 // name: struct Chuck_Instr_Mem_Pop_Word
1916 // desc: pop a value from mem stack
1917 //-----------------------------------------------------------------------------
1918 struct Chuck_Instr_Mem_Pop_Word
: public Chuck_Instr
1921 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1927 //-----------------------------------------------------------------------------
1928 // name: struct Chuck_Instr_Mem_Pop_Word2
1929 // desc: pop a value from mem stack
1930 //-----------------------------------------------------------------------------
1931 struct Chuck_Instr_Mem_Pop_Word2
: public Chuck_Instr
1934 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1940 //-----------------------------------------------------------------------------
1941 // name: struct Chuck_Instr_Mem_Pop_Word2
1942 // desc: pop a value from mem stack
1943 //-----------------------------------------------------------------------------
1944 struct Chuck_Instr_Mem_Pop_Word3
: public Chuck_Instr_Unary_Op
1947 Chuck_Instr_Mem_Pop_Word3( t_CKUINT num
) { this->set( num
); }
1948 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1954 //-----------------------------------------------------------------------------
1955 // name: struct Chuck_Instr_Nop
1957 //-----------------------------------------------------------------------------
1958 struct Chuck_Instr_Nop
: public Chuck_Instr
1961 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1967 //-----------------------------------------------------------------------------
1968 // name: struct Chuck_Instr_EOC
1970 //-----------------------------------------------------------------------------
1971 struct Chuck_Instr_EOC
: public Chuck_Instr
1974 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1980 //-----------------------------------------------------------------------------
1981 // name: struct Chuck_Instr_Alloc_Word
1982 // desc: alloc local - leaves addr on operand stack
1983 //-----------------------------------------------------------------------------
1984 struct Chuck_Instr_Alloc_Word
: public Chuck_Instr_Unary_Op
1987 Chuck_Instr_Alloc_Word( t_CKUINT offset
)
1988 { this->set( offset
); }
1990 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
1996 //-----------------------------------------------------------------------------
1997 // name: struct Chuck_Instr_Alloc_Word2
1998 // desc: alloc local - leaves addr on operand stack
1999 //-----------------------------------------------------------------------------
2000 struct Chuck_Instr_Alloc_Word2
: public Chuck_Instr_Unary_Op
2003 Chuck_Instr_Alloc_Word2( t_CKUINT offset
)
2004 { this->set( offset
); }
2006 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2012 //-----------------------------------------------------------------------------
2013 // name: struct Chuck_Instr_Alloc_Word4
2014 // desc: alloc local - leaves addr on operand stack
2015 //-----------------------------------------------------------------------------
2016 struct Chuck_Instr_Alloc_Word4
: public Chuck_Instr_Unary_Op
2019 Chuck_Instr_Alloc_Word4( t_CKUINT offset
)
2020 { this->set( offset
); }
2022 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2028 //-----------------------------------------------------------------------------
2029 // name: struct Chuck_Instr_Alloc_Member_Word
2030 // desc: alloc member - leaves addr on operand stack
2031 //-----------------------------------------------------------------------------
2032 struct Chuck_Instr_Alloc_Member_Word
: public Chuck_Instr_Unary_Op
2035 Chuck_Instr_Alloc_Member_Word( t_CKUINT offset
)
2036 { this->set( offset
); }
2038 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2044 //-----------------------------------------------------------------------------
2045 // name: struct Chuck_Instr_Alloc_Member_Word2
2046 // desc: alloc member - leaves addr on operand stack
2047 //-----------------------------------------------------------------------------
2048 struct Chuck_Instr_Alloc_Member_Word2
: public Chuck_Instr_Unary_Op
2051 Chuck_Instr_Alloc_Member_Word2( t_CKUINT offset
)
2052 { this->set( offset
); }
2054 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2060 //-----------------------------------------------------------------------------
2061 // name: struct Chuck_Instr_Alloc_Member_Word4
2062 // desc: alloc member - leaves addr on operand stack
2063 //-----------------------------------------------------------------------------
2064 struct Chuck_Instr_Alloc_Member_Word4
: public Chuck_Instr_Unary_Op
2067 Chuck_Instr_Alloc_Member_Word4( t_CKUINT offset
)
2068 { this->set( offset
); }
2070 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2076 //-----------------------------------------------------------------------------
2077 // name: struct Chuck_Instr_Instantiate_Object
2078 // desc: instantiate object - leaves reference value on operand stack
2079 //-----------------------------------------------------------------------------
2080 struct Chuck_Instr_Instantiate_Object
: public Chuck_Instr
2083 Chuck_Instr_Instantiate_Object( Chuck_Type
* t
)
2086 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2087 virtual const char * params() const;
2096 //-----------------------------------------------------------------------------
2097 // name: struct Chuck_Instr_Pre_Constructor
2098 // desc: preconstruct object
2099 //-----------------------------------------------------------------------------
2100 struct Chuck_Instr_Pre_Constructor
: public Chuck_Instr
2103 Chuck_Instr_Pre_Constructor( Chuck_VM_Code
* pre
, t_CKUINT offset
)
2104 { pre_ctor
= pre
; this->stack_offset
= offset
; }
2106 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2107 // virtual const char * params() const;
2110 Chuck_VM_Code
* pre_ctor
;
2111 t_CKUINT stack_offset
;
2117 //-----------------------------------------------------------------------------
2118 // name: struct Chuck_Instr_Pre_Ctor_Array_Top
2119 // desc: preconstruct object in array (top)
2120 //-----------------------------------------------------------------------------
2121 struct Chuck_Instr_Pre_Ctor_Array_Top
: public Chuck_Instr_Unary_Op
2124 Chuck_Instr_Pre_Ctor_Array_Top( Chuck_Type
* t
)
2127 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2128 virtual const char * params() const;
2137 //-----------------------------------------------------------------------------
2138 // name: struct Chuck_Instr_Pre_Ctor_Array_Bottom
2139 // desc: preconstruct object in array (bottom)
2140 //-----------------------------------------------------------------------------
2141 struct Chuck_Instr_Pre_Ctor_Array_Bottom
: public Chuck_Instr_Unary_Op
2143 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2144 // virtual const char * params() const;
2150 //-----------------------------------------------------------------------------
2151 // name: struct Chuck_Instr_Pre_Ctor_Array_Post
2152 // desc: preconstruct object in array (clean up)
2153 //-----------------------------------------------------------------------------
2154 struct Chuck_Instr_Pre_Ctor_Array_Post
: public Chuck_Instr
2156 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2157 // virtual const char * params() const;
2163 //-----------------------------------------------------------------------------
2164 // name: struct Chuck_Instr_Array_Prepend
2166 //-----------------------------------------------------------------------------
2167 struct Chuck_Instr_Array_Prepend
: public Chuck_Instr_Unary_Op
2169 Chuck_Instr_Array_Prepend( t_CKUINT size
) { set( size
); }
2170 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2171 // virtual const char * params() const;
2177 //-----------------------------------------------------------------------------
2178 // name: struct Chuck_Instr_Array_Append
2180 //-----------------------------------------------------------------------------
2181 struct Chuck_Instr_Array_Append
: public Chuck_Instr_Unary_Op
2183 Chuck_Instr_Array_Append( t_CKUINT size
) { set( size
); }
2184 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2185 // virtual const char * params() const;
2191 //-----------------------------------------------------------------------------
2192 // name: struct Chuck_Instr_Assign_String
2193 // desc: assign primitive (string)
2194 //-----------------------------------------------------------------------------
2195 struct Chuck_Instr_Assign_String
: public Chuck_Instr
2198 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2204 //-----------------------------------------------------------------------------
2205 // name: struct Chuck_Instr_Assign_Primitive
2206 // desc: assign primitive (word)
2207 //-----------------------------------------------------------------------------
2208 struct Chuck_Instr_Assign_Primitive
: public Chuck_Instr
2211 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2217 //-----------------------------------------------------------------------------
2218 // name: struct Chuck_Instr_Assign_Primitive2
2219 // desc: assign primitive (2 word)
2220 //-----------------------------------------------------------------------------
2221 struct Chuck_Instr_Assign_Primitive2
: public Chuck_Instr
2224 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2230 //-----------------------------------------------------------------------------
2231 // name: struct Chuck_Instr_Assign_Primitive4
2232 // desc: assign primitive (4 word)
2233 //-----------------------------------------------------------------------------
2234 struct Chuck_Instr_Assign_Primitive4
: public Chuck_Instr
2237 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2243 //-----------------------------------------------------------------------------
2244 // name: struct Chuck_Instr_Assign_Object
2245 // desc: assign object with reference counting and releasing previous reference
2246 //-----------------------------------------------------------------------------
2247 struct Chuck_Instr_Assign_Object
: public Chuck_Instr
2250 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2256 //-----------------------------------------------------------------------------
2257 // name: struct Chuck_Instr_Assign_Object
2258 // desc: map object with reference counting and releasing previous reference
2259 //-----------------------------------------------------------------------------
2260 struct Chuck_Instr_Assign_Object_To_Map
: public Chuck_Instr_Unary_Op
2263 Chuck_Instr_Assign_Object_To_Map( t_CKUINT size
)
2264 { this->set( size
); }
2267 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2273 //-----------------------------------------------------------------------------
2274 // name: struct Chuck_Instr_Chuck_Release_Object
2276 //-----------------------------------------------------------------------------
2277 struct Chuck_Instr_Chuck_Release_Object
: public Chuck_Instr
2280 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2286 //-----------------------------------------------------------------------------
2287 // name: struct Chuck_Instr_Func_To_Code
2288 // desc: Chuck_Func * to Chuck_VM_Code *
2289 //-----------------------------------------------------------------------------
2290 struct Chuck_Instr_Func_To_Code
: public Chuck_Instr
2293 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2299 //-----------------------------------------------------------------------------
2300 // name: struct Chuck_Instr_Func_Call
2301 // desc: user-defined function call
2302 //-----------------------------------------------------------------------------
2303 struct Chuck_Instr_Func_Call
: public Chuck_Instr
2306 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2312 //-----------------------------------------------------------------------------
2313 // name: struct Chuck_Instr_Func_Call_Member
2314 // desc: imported member function call with return
2315 //-----------------------------------------------------------------------------
2316 struct Chuck_Instr_Func_Call_Member
: public Chuck_Instr_Unary_Op
2319 Chuck_Instr_Func_Call_Member( t_CKUINT ret_size
)
2320 { this->set( ret_size
); }
2323 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2329 //-----------------------------------------------------------------------------
2330 // name: struct Chuck_Instr_Func_Call_Static
2331 // desc: imported static function call with return
2332 //-----------------------------------------------------------------------------
2333 struct Chuck_Instr_Func_Call_Static
: public Chuck_Instr_Unary_Op
2336 Chuck_Instr_Func_Call_Static( t_CKUINT ret_size
)
2337 { this->set( ret_size
); }
2340 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2346 //-----------------------------------------------------------------------------
2347 // name: struct Chuck_Instr_Func_Return
2349 //-----------------------------------------------------------------------------
2350 struct Chuck_Instr_Func_Return
: public Chuck_Instr
2353 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2359 //-----------------------------------------------------------------------------
2360 // name: struct Chuck_Instr_Spork
2362 //-----------------------------------------------------------------------------
2363 struct Chuck_Instr_Spork
: public Chuck_Instr_Unary_Op
2366 Chuck_Instr_Spork( t_CKUINT v
= 0 ) { this->set( v
); }
2368 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2374 //-----------------------------------------------------------------------------
2375 // name: struct Chuck_Instr_Time_Advance
2377 //-----------------------------------------------------------------------------
2378 struct Chuck_Instr_Time_Advance
: public Chuck_Instr
2381 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2387 //-----------------------------------------------------------------------------
2388 // name: struct Chuck_Instr_Event_Wait
2390 //-----------------------------------------------------------------------------
2391 struct Chuck_Instr_Event_Wait
: public Chuck_Instr
2394 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2400 //-----------------------------------------------------------------------------
2401 // name: struct Chuck_Instr_Array_Init
2402 // desc: for [ ... ] values
2403 //-----------------------------------------------------------------------------
2404 struct Chuck_Instr_Array_Init
: public Chuck_Instr
2407 Chuck_Instr_Array_Init( Chuck_Type
* the_type
, t_CKINT length
);
2408 virtual ~Chuck_Instr_Array_Init();
2411 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2412 virtual const char * params() const { return m_param_str
; }
2415 Chuck_Type
* m_type_ref
;
2424 //-----------------------------------------------------------------------------
2425 // name: struct Chuck_Instr_Array_Alloc
2427 //-----------------------------------------------------------------------------
2428 struct Chuck_Instr_Array_Alloc
: public Chuck_Instr
2431 Chuck_Instr_Array_Alloc( t_CKUINT depth
, Chuck_Type
* the_type
,
2432 t_CKUINT offset
, t_CKBOOL ref
);
2433 virtual ~Chuck_Instr_Array_Alloc();
2436 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2437 virtual const char * params() const { return m_param_str
; }
2441 Chuck_Type
* m_type_ref
;
2444 t_CKUINT m_stack_offset
;
2451 //-----------------------------------------------------------------------------
2452 // name: struct Chuck_Instr_Array_Access
2454 //-----------------------------------------------------------------------------
2455 struct Chuck_Instr_Array_Access
: public Chuck_Instr
2458 Chuck_Instr_Array_Access( t_CKUINT size
, t_CKUINT emit_addr
,
2459 t_CKUINT istr
= FALSE
)
2460 { m_size
= size
; m_emit_addr
= emit_addr
; m_istr
= istr
; }
2463 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2464 virtual const char * params() const
2465 { static char buffer
[256];
2466 sprintf( buffer
, "size=%ld, emit_addr=%ld istr=%ld",
2467 m_size
, m_emit_addr
, m_istr
);
2472 t_CKUINT m_emit_addr
;
2479 //-----------------------------------------------------------------------------
2480 // name: struct Chuck_Instr_Array_Map_Access
2482 //-----------------------------------------------------------------------------
2483 struct Chuck_Instr_Array_Map_Access
: public Chuck_Instr
2486 Chuck_Instr_Array_Map_Access( t_CKUINT size
, t_CKUINT emit_addr
)
2487 { m_size
= size
; m_emit_addr
= emit_addr
; }
2490 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2491 virtual const char * params() const
2492 { static char buffer
[256];
2493 sprintf( buffer
, "size=%ld, emit_addr=%ld", m_size
, m_emit_addr
);
2498 t_CKUINT m_emit_addr
;
2504 //-----------------------------------------------------------------------------
2505 // name: struct Chuck_Instr_Array_Access_Multi
2507 //-----------------------------------------------------------------------------
2508 struct Chuck_Instr_Array_Access_Multi
: public Chuck_Instr
2511 Chuck_Instr_Array_Access_Multi( t_CKUINT depth
, t_CKUINT size
, t_CKUINT emit_addr
)
2512 { m_size
= size
; m_depth
= depth
; m_emit_addr
= emit_addr
; }
2515 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2516 virtual const char * params() const
2517 { static char buffer
[256];
2518 sprintf( buffer
, "depth=%ld, size=%ld, emit_addr=%ld", m_depth
, m_size
, m_emit_addr
);
2524 t_CKUINT m_emit_addr
;
2530 //-----------------------------------------------------------------------------
2531 // name: struct Chuck_Instr_Dot_Member_Data
2532 // desc: access the member data of object by offset
2533 //-----------------------------------------------------------------------------
2534 struct Chuck_Instr_Dot_Member_Data
: public Chuck_Instr
2537 Chuck_Instr_Dot_Member_Data( t_CKUINT offset
, t_CKUINT size
, t_CKUINT emit_addr
)
2538 { m_offset
= offset
; m_size
= size
; m_emit_addr
= emit_addr
; }
2541 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2542 virtual const char * params() const
2543 { static char buffer
[256];
2544 sprintf( buffer
, "offset=%ld, size=%ld, emit_addr=%ld", m_offset
, m_size
, m_emit_addr
);
2550 t_CKUINT m_emit_addr
;
2556 //-----------------------------------------------------------------------------
2557 // name: struct Chuck_Instr_Dot_Member_Func
2558 // desc: access the member function of object by offset
2559 //-----------------------------------------------------------------------------
2560 struct Chuck_Instr_Dot_Member_Func
: public Chuck_Instr
2563 Chuck_Instr_Dot_Member_Func( t_CKUINT offset
)
2564 { m_offset
= offset
; }
2567 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2568 virtual const char * params() const
2569 { static char buffer
[256];
2570 sprintf( buffer
, "offset=%ld", m_offset
);
2580 //-----------------------------------------------------------------------------
2581 // name: struct Chuck_Instr_Dot_Static_Data
2582 // desc: access the static data of object by offset
2583 //-----------------------------------------------------------------------------
2584 struct Chuck_Instr_Dot_Static_Data
: public Chuck_Instr
2587 Chuck_Instr_Dot_Static_Data( t_CKUINT offset
, t_CKUINT size
, t_CKUINT emit_addr
)
2588 { m_offset
= offset
; m_size
= size
; m_emit_addr
= emit_addr
; }
2591 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2592 virtual const char * params() const
2593 { static char buffer
[256];
2594 sprintf( buffer
, "offset=%ld, size=%ld, emit_addr=%ld", m_offset
, m_size
, m_emit_addr
);
2600 t_CKUINT m_emit_addr
;
2606 //-----------------------------------------------------------------------------
2607 // name: struct Chuck_Instr_Dot_Static_Import_Data
2608 // desc: access the static data of object by pointer
2609 //-----------------------------------------------------------------------------
2610 struct Chuck_Instr_Dot_Static_Import_Data
: public Chuck_Instr
2613 Chuck_Instr_Dot_Static_Import_Data( void * addr
, t_CKUINT size
, t_CKUINT emit_addr
)
2614 { m_addr
= addr
; m_size
= size
; m_emit_addr
= emit_addr
; }
2617 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2618 virtual const char * params() const
2619 { static char buffer
[256];
2620 sprintf( buffer
, "addr=%ld, size=%ld, emit_addr=%ld", (t_CKUINT
)m_addr
, m_size
, m_emit_addr
);
2626 t_CKUINT m_emit_addr
;
2632 //-----------------------------------------------------------------------------
2633 // name: struct Chuck_Instr_Dot_Static_Func
2634 // desc: access the static function of object
2635 //-----------------------------------------------------------------------------
2636 struct Chuck_Instr_Dot_Static_Func
: public Chuck_Instr
2639 Chuck_Instr_Dot_Static_Func( Chuck_Func
* func
)
2643 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2644 virtual const char * params() const
2645 { static char buffer
[256];
2646 sprintf( buffer
, "func=%ld", (t_CKUINT
)m_func
);
2650 Chuck_Func
* m_func
;
2656 //-----------------------------------------------------------------------------
2657 // name: struct Chuck_Instr_Dot_Cmp_First
2658 // desc: access the complex value's first component
2659 //-----------------------------------------------------------------------------
2660 struct Chuck_Instr_Dot_Cmp_First
: public Chuck_Instr
2663 Chuck_Instr_Dot_Cmp_First( t_CKUINT is_mem
, t_CKUINT emit_addr
)
2664 { m_is_mem
= is_mem
; m_emit_addr
= emit_addr
; }
2667 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2668 virtual const char * params() const
2669 { static char buffer
[256];
2670 sprintf( buffer
, "is_mem=%ld, emit_addr=%ld", m_is_mem
, m_emit_addr
);
2675 t_CKUINT m_emit_addr
;
2681 //-----------------------------------------------------------------------------
2682 // name: struct Chuck_Instr_Dot_Cmp_Second
2683 // desc: access the complex value's second component
2684 //-----------------------------------------------------------------------------
2685 struct Chuck_Instr_Dot_Cmp_Second
: public Chuck_Instr
2688 Chuck_Instr_Dot_Cmp_Second( t_CKUINT is_mem
, t_CKUINT emit_addr
)
2689 { m_is_mem
= is_mem
; m_emit_addr
= emit_addr
; }
2692 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2693 virtual const char * params() const
2694 { static char buffer
[256];
2695 sprintf( buffer
, "is_mem=%ld, emit_addr=%ld", m_is_mem
, m_emit_addr
);
2700 t_CKUINT m_emit_addr
;
2706 //-----------------------------------------------------------------------------
2707 // name: struct Chuck_Instr_ADC
2709 //-----------------------------------------------------------------------------
2710 struct Chuck_Instr_ADC
: public Chuck_Instr
2713 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2719 //-----------------------------------------------------------------------------
2720 // name: struct Chuck_Instr_DAC
2722 //-----------------------------------------------------------------------------
2723 struct Chuck_Instr_DAC
: public Chuck_Instr
2726 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2732 //-----------------------------------------------------------------------------
2733 // name: struct Chuck_Instr_Bunghole
2735 //-----------------------------------------------------------------------------
2736 struct Chuck_Instr_Bunghole
: public Chuck_Instr
2739 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2745 //-----------------------------------------------------------------------------
2746 // name: struct Chuck_Instr_UGen_Link
2748 //-----------------------------------------------------------------------------
2749 struct Chuck_Instr_UGen_Link
: public Chuck_Instr
2752 Chuck_Instr_UGen_Link( t_CKBOOL isUpChuck
= FALSE
);
2755 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2758 t_CKBOOL m_isUpChuck
;
2764 //-----------------------------------------------------------------------------
2765 // name: struct Chuck_Instr_UGen_UnLink
2767 //-----------------------------------------------------------------------------
2768 struct Chuck_Instr_UGen_UnLink
: public Chuck_Instr
2771 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2777 //-----------------------------------------------------------------------------
2778 // name: struct Chuck_Instr_UGen_Ctrl
2780 //-----------------------------------------------------------------------------
2781 struct Chuck_Instr_UGen_Ctrl
: public Chuck_Instr
2784 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2790 //-----------------------------------------------------------------------------
2791 // name: struct Chuck_Instr_UGen_CGet
2793 //-----------------------------------------------------------------------------
2794 struct Chuck_Instr_UGen_CGet
: public Chuck_Instr
2797 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2803 //-----------------------------------------------------------------------------
2804 // name: struct Chuck_Instr_UGen_Ctrl2
2806 //-----------------------------------------------------------------------------
2807 struct Chuck_Instr_UGen_Ctrl2
: public Chuck_Instr
2810 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2816 //-----------------------------------------------------------------------------
2817 // name: struct Chuck_Instr_UGen_CGet2
2819 //-----------------------------------------------------------------------------
2820 struct Chuck_Instr_UGen_CGet2
: public Chuck_Instr
2823 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2829 //-----------------------------------------------------------------------------
2830 // name: struct Chuck_Instr_UGen_PMsg
2832 //-----------------------------------------------------------------------------
2833 struct Chuck_Instr_UGen_PMsg
: public Chuck_Instr
2836 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2842 //-----------------------------------------------------------------------------
2843 // name: struct Chuck_Instr_Cast_double2int
2845 //-----------------------------------------------------------------------------
2846 struct Chuck_Instr_Cast_double2int
: public Chuck_Instr
2849 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2855 //-----------------------------------------------------------------------------
2856 // name: struct Chuck_Instr_Cast_int2double
2858 //-----------------------------------------------------------------------------
2859 struct Chuck_Instr_Cast_int2double
: public Chuck_Instr
2862 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2868 //-----------------------------------------------------------------------------
2869 // name: struct Chuck_Instr_Cast_int2complex
2871 //-----------------------------------------------------------------------------
2872 struct Chuck_Instr_Cast_int2complex
: public Chuck_Instr
2875 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2881 //-----------------------------------------------------------------------------
2882 // name: struct Chuck_Instr_Cast_int2polar
2884 //-----------------------------------------------------------------------------
2885 struct Chuck_Instr_Cast_int2polar
: public Chuck_Instr
2888 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2894 //-----------------------------------------------------------------------------
2895 // name: struct Chuck_Instr_Cast_double2complex
2897 //-----------------------------------------------------------------------------
2898 struct Chuck_Instr_Cast_double2complex
: public Chuck_Instr
2901 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2907 //-----------------------------------------------------------------------------
2908 // name: struct Chuck_Instr_Cast_double2polar
2910 //-----------------------------------------------------------------------------
2911 struct Chuck_Instr_Cast_double2polar
: public Chuck_Instr
2914 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2920 //-----------------------------------------------------------------------------
2921 // name: struct Chuck_Instr_Cast_complex2polar
2923 //-----------------------------------------------------------------------------
2924 struct Chuck_Instr_Cast_complex2polar
: public Chuck_Instr
2927 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2933 //-----------------------------------------------------------------------------
2934 // name: struct Chuck_Instr_Cast_polar2complex
2936 //-----------------------------------------------------------------------------
2937 struct Chuck_Instr_Cast_polar2complex
: public Chuck_Instr
2940 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2946 //-----------------------------------------------------------------------------
2947 // name: struct Chuck_Instr_Cast_object2string
2949 //-----------------------------------------------------------------------------
2950 struct Chuck_Instr_Cast_object2string
: public Chuck_Instr
2953 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2959 //-----------------------------------------------------------------------------
2960 // name: struct Chuck_Instr_Op_string
2962 //-----------------------------------------------------------------------------
2963 struct Chuck_Instr_Op_string
: public Chuck_Instr_Unary_Op
2966 Chuck_Instr_Op_string( t_CKUINT v
) { this->set( v
); }
2969 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2975 //-----------------------------------------------------------------------------
2976 // name: struct Chuck_Instr_Init_Loop_Counter
2978 //-----------------------------------------------------------------------------
2979 struct Chuck_Instr_Init_Loop_Counter
: public Chuck_Instr_Unary_Op
2982 Chuck_Instr_Init_Loop_Counter( t_CKUINT v
)
2986 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
2992 //-----------------------------------------------------------------------------
2993 // name: struct Chuck_Instr_IO_in_int
2995 //-----------------------------------------------------------------------------
2996 struct Chuck_Instr_IO_in_int
: public Chuck_Instr_Binary_Op
2999 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
3005 //-----------------------------------------------------------------------------
3006 // name: struct Chuck_Instr_IO_in_float
3008 //-----------------------------------------------------------------------------
3009 struct Chuck_Instr_IO_in_float
: public Chuck_Instr_Binary_Op
3012 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
3018 //-----------------------------------------------------------------------------
3019 // name: struct Chuck_Instr_IO_in_string
3021 //-----------------------------------------------------------------------------
3022 struct Chuck_Instr_IO_in_string
: public Chuck_Instr_Binary_Op
3025 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
3031 //-----------------------------------------------------------------------------
3032 // name: struct Chuck_Instr_IO_out_int
3034 //-----------------------------------------------------------------------------
3035 struct Chuck_Instr_IO_out_int
: public Chuck_Instr_Binary_Op
3038 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
3044 //-----------------------------------------------------------------------------
3045 // name: struct Chuck_Instr_IO_out_float
3047 //-----------------------------------------------------------------------------
3048 struct Chuck_Instr_IO_out_float
: public Chuck_Instr_Binary_Op
3051 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
3057 //-----------------------------------------------------------------------------
3058 // name: struct Chuck_Instr_IO_out_string
3060 //-----------------------------------------------------------------------------
3061 struct Chuck_Instr_IO_out_string
: public Chuck_Instr_Binary_Op
3064 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
3070 //-----------------------------------------------------------------------------
3071 // name: struct Chuck_Instr_Hack
3073 //-----------------------------------------------------------------------------
3074 struct Chuck_Instr_Hack
: public Chuck_Instr
3077 Chuck_Instr_Hack( Chuck_Type
* type
);
3078 virtual ~Chuck_Instr_Hack();
3079 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
3080 virtual const char * params() const;
3083 Chuck_Type
* m_type_ref
;
3089 //-----------------------------------------------------------------------------
3090 // name: struct Chuck_Instr_Gack
3092 //-----------------------------------------------------------------------------
3093 struct Chuck_Instr_Gack
: public Chuck_Instr
3096 Chuck_Instr_Gack( const std::vector
<Chuck_Type
*> & types
);
3097 virtual ~Chuck_Instr_Gack();
3098 virtual void execute( Chuck_VM
* vm
, Chuck_VM_Shred
* shred
);
3099 virtual const char * params() const;
3102 std::vector
<Chuck_Type
*> m_type_refs
;
3108 // runtime functions
3109 Chuck_Object
* instantiate_and_initialize_object( Chuck_Type
* type
, Chuck_VM_Shred
* shred
);
3110 // initialize object using Type
3111 t_CKBOOL
initialize_object( Chuck_Object
* obj
, Chuck_Type
* type
);
3116 #define push_( sp, val ) *(sp) = (val); (sp)++
3117 #define push_float( sp, val ) *((t_CKFLOAT *&)sp) = (val); ((t_CKFLOAT *&)sp)++
3118 #define push_complex( sp, val ) *((t_CKCOMPLEX *&)sp) = (val); ((t_CKCOMPLEX *&)sp)++
3119 #define pop_( sp, n ) sp -= (n)
3120 #define val_( sp ) *(sp)
3122 // stack overflow detection
3123 #define overflow_( stack ) ( stack->sp > stack->sp_max )
3124 #define underflow_( stack ) ( stack->sp < stack->stack )