*** empty log message ***
[chuck-blob.git] / v2 / chuck_instr.h
blob6c5b50bbf1bcf0b9f2d111c2483f083180ffbbbf
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
22 U.S.A.
23 -----------------------------------------------------------------------------*/
25 //-----------------------------------------------------------------------------
26 // file: chuck_instr.h
27 // desc: ...
29 // author: Ge Wang (gewang@cs.princeton.edu)
30 // Perry R. Cook (prc@cs.princeton.edu)
31 // date: Autumn 2002
32 //-----------------------------------------------------------------------------
33 #ifndef __CHUCK_INSTR_H__
34 #define __CHUCK_INSTR_H__
36 #include <stdio.h>
37 #include "chuck_def.h"
38 #include <vector>
41 // forward reference
42 struct Chuck_VM;
43 struct Chuck_VM_Shred;
44 struct Chuck_Type;
45 struct Chuck_Func;
50 //-----------------------------------------------------------------------------
51 // name: struct Chuck_Instr
52 // desc: ...
53 //-----------------------------------------------------------------------------
54 struct Chuck_Instr
56 public:
57 virtual ~Chuck_Instr() { }
59 public:
60 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) = 0;
62 public:
63 virtual const char * name() const;
64 virtual const char * params() const
65 { return ""; }
71 //-----------------------------------------------------------------------------
72 // name: struct Chuck_Instr_Branch_Op
73 // desc: ...
74 //-----------------------------------------------------------------------------
75 struct Chuck_Instr_Branch_Op : public Chuck_Instr
77 public:
78 inline void set( t_CKUINT jmp ) { m_jmp = jmp; }
80 public:
81 virtual const char * params() const
82 { static char buffer[256]; sprintf( buffer, "%ld", m_jmp ); return buffer; }
84 protected:
85 t_CKUINT m_jmp;
91 //-----------------------------------------------------------------------------
92 // name: struct Chuck_Instr_Unary_Op
93 // desc: ...
94 //-----------------------------------------------------------------------------
95 struct Chuck_Instr_Unary_Op : public Chuck_Instr
97 public:
98 inline void set( t_CKUINT val ) { m_val = val; }
99 inline t_CKUINT get() { return m_val; }
101 public:
102 virtual const char * params() const
103 { static char buffer[256]; sprintf( buffer, "%ld", m_val ); return buffer; }
105 protected:
106 t_CKUINT m_val;
112 //-----------------------------------------------------------------------------
113 // name: struct Chuck_Instr_Unary_Op2
114 // desc: ...
115 //-----------------------------------------------------------------------------
116 struct Chuck_Instr_Unary_Op2 : public Chuck_Instr
118 public:
119 inline void set( t_CKFLOAT val ) { m_val = val; }
120 inline t_CKFLOAT get() { return m_val; }
122 public:
123 virtual const char * params() const
124 { static char buffer[256]; sprintf( buffer, "%.6f", m_val ); return buffer; }
126 protected:
127 t_CKFLOAT m_val;
133 //-----------------------------------------------------------------------------
134 // name: struct Chuck_Instr_Binary_Op
135 // desc: ...
136 //-----------------------------------------------------------------------------
137 struct Chuck_Instr_Binary_Op : public Chuck_Instr
138 { };
143 //-----------------------------------------------------------------------------
144 // name: struct Chuck_Instr_Add_int
145 // desc: ...
146 //-----------------------------------------------------------------------------
147 struct Chuck_Instr_Add_int : public Chuck_Instr_Binary_Op
149 public:
150 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
156 //-----------------------------------------------------------------------------
157 // name: struct Chuck_Instr_PreInc_int
158 // desc: ...
159 //-----------------------------------------------------------------------------
160 struct Chuck_Instr_PreInc_int : public Chuck_Instr
162 public:
163 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
169 //-----------------------------------------------------------------------------
170 // name: struct Chuck_Instr_PostInc_int
171 // desc: ...
172 //-----------------------------------------------------------------------------
173 struct Chuck_Instr_PostInc_int : public Chuck_Instr
175 public:
176 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
182 //-----------------------------------------------------------------------------
183 // name: struct Chuck_Instr_PreDec_int
184 // desc: ...
185 //-----------------------------------------------------------------------------
186 struct Chuck_Instr_PreDec_int : public Chuck_Instr
188 public:
189 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
195 //-----------------------------------------------------------------------------
196 // name: struct Chuck_Instr_PostDec_int
197 // desc: ...
198 //-----------------------------------------------------------------------------
199 struct Chuck_Instr_PostDec_int : public Chuck_Instr
201 public:
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
214 public:
215 Chuck_Instr_Dec_int_Addr( t_CKUINT src )
216 { this->set( src ); }
218 public:
219 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
225 //-----------------------------------------------------------------------------
226 // name: struct Chuck_Instr_Complement_int
227 // desc: ...
228 //-----------------------------------------------------------------------------
229 struct Chuck_Instr_Complement_int : public Chuck_Instr
231 public:
232 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
238 //-----------------------------------------------------------------------------
239 // name: struct Chuck_Instr_Mod_int
240 // desc: ...
241 //-----------------------------------------------------------------------------
242 struct Chuck_Instr_Mod_int : public Chuck_Instr_Binary_Op
244 public:
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
257 public:
258 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
264 //-----------------------------------------------------------------------------
265 // name: struct Chuck_Instr_Minus_int
266 // desc: ...
267 //-----------------------------------------------------------------------------
268 struct Chuck_Instr_Minus_int : public Chuck_Instr_Binary_Op
270 public:
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
283 public:
284 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
290 //-----------------------------------------------------------------------------
291 // name: struct Chuck_Instr_Times_int
292 // desc: ...
293 //-----------------------------------------------------------------------------
294 struct Chuck_Instr_Times_int : public Chuck_Instr_Binary_Op
296 public:
297 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
303 //-----------------------------------------------------------------------------
304 // name: struct Chuck_Instr_Divide_int
305 // desc: ...
306 //-----------------------------------------------------------------------------
307 struct Chuck_Instr_Divide_int : public Chuck_Instr_Binary_Op
309 public:
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
322 public:
323 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
329 //-----------------------------------------------------------------------------
330 // name: struct Chuck_Instr_Add_double
331 // desc: ...
332 //-----------------------------------------------------------------------------
333 struct Chuck_Instr_Add_double : public Chuck_Instr_Binary_Op
335 public:
336 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
342 //-----------------------------------------------------------------------------
343 // name: struct Chuck_Instr_Minus_double
344 // desc: ...
345 //-----------------------------------------------------------------------------
346 struct Chuck_Instr_Minus_double : public Chuck_Instr_Binary_Op
348 public:
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
361 public:
362 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
368 //-----------------------------------------------------------------------------
369 // name: struct Chuck_Instr_Times_double
370 // desc: ...
371 //-----------------------------------------------------------------------------
372 struct Chuck_Instr_Times_double : public Chuck_Instr_Binary_Op
374 public:
375 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
381 //-----------------------------------------------------------------------------
382 // name: struct Chuck_Instr_Divide_double
383 // desc: ...
384 //-----------------------------------------------------------------------------
385 struct Chuck_Instr_Divide_double : public Chuck_Instr_Binary_Op
387 public:
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
400 public:
401 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
407 //-----------------------------------------------------------------------------
408 // name: struct Chuck_Instr_Mod_double
409 // desc: ...
410 //-----------------------------------------------------------------------------
411 struct Chuck_Instr_Mod_double : public Chuck_Instr_Binary_Op
413 public:
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
426 public:
427 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
433 //-----------------------------------------------------------------------------
434 // name: struct Chuck_Instr_Add_complex
435 // desc: ...
436 //-----------------------------------------------------------------------------
437 struct Chuck_Instr_Add_complex : public Chuck_Instr_Binary_Op
439 public:
440 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
446 //-----------------------------------------------------------------------------
447 // name: struct Chuck_Instr_Minus_complex
448 // desc: ...
449 //-----------------------------------------------------------------------------
450 struct Chuck_Instr_Minus_complex : public Chuck_Instr_Binary_Op
452 public:
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
465 public:
466 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
472 //-----------------------------------------------------------------------------
473 // name: struct Chuck_Instr_Times_complex
474 // desc: ...
475 //-----------------------------------------------------------------------------
476 struct Chuck_Instr_Times_complex : public Chuck_Instr_Binary_Op
478 public:
479 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
485 //-----------------------------------------------------------------------------
486 // name: struct Chuck_Instr_Divide_complex
487 // desc: ...
488 //-----------------------------------------------------------------------------
489 struct Chuck_Instr_Divide_complex : public Chuck_Instr_Binary_Op
491 public:
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
504 public:
505 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
511 //-----------------------------------------------------------------------------
512 // name: struct Chuck_Instr_Add_polar
513 // desc: ...
514 //-----------------------------------------------------------------------------
515 struct Chuck_Instr_Add_polar : public Chuck_Instr_Binary_Op
517 public:
518 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
524 //-----------------------------------------------------------------------------
525 // name: struct Chuck_Instr_Minus_polar
526 // desc: ...
527 //-----------------------------------------------------------------------------
528 struct Chuck_Instr_Minus_polar : public Chuck_Instr_Binary_Op
530 public:
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
543 public:
544 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
550 //-----------------------------------------------------------------------------
551 // name: struct Chuck_Instr_Times_polar
552 // desc: ...
553 //-----------------------------------------------------------------------------
554 struct Chuck_Instr_Times_polar : public Chuck_Instr_Binary_Op
556 public:
557 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
563 //-----------------------------------------------------------------------------
564 // name: struct Chuck_Instr_Divide_polar
565 // desc: ...
566 //-----------------------------------------------------------------------------
567 struct Chuck_Instr_Divide_polar : public Chuck_Instr_Binary_Op
569 public:
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
582 public:
583 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
589 //-----------------------------------------------------------------------------
590 // name: struct Chuck_Instr_Add_int_Assign
591 // desc: ...
592 //-----------------------------------------------------------------------------
593 struct Chuck_Instr_Add_int_Assign : public Chuck_Instr_Binary_Op
595 public:
596 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
602 //-----------------------------------------------------------------------------
603 // name: struct Chuck_Instr_Mod_int_Assign
604 // desc: ...
605 //-----------------------------------------------------------------------------
606 struct Chuck_Instr_Mod_int_Assign : public Chuck_Instr_Binary_Op
608 public:
609 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
615 //-----------------------------------------------------------------------------
616 // name: struct Chuck_Instr_Minus_int_Assign
617 // desc: ...
618 //-----------------------------------------------------------------------------
619 struct Chuck_Instr_Minus_int_Assign : public Chuck_Instr_Binary_Op
621 public:
622 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
628 //-----------------------------------------------------------------------------
629 // name: struct Chuck_Instr_Times_int_Assign
630 // desc: ...
631 //-----------------------------------------------------------------------------
632 struct Chuck_Instr_Times_int_Assign : public Chuck_Instr_Binary_Op
634 public:
635 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
641 //-----------------------------------------------------------------------------
642 // name: struct Chuck_Instr_Divide_int_Assign
643 // desc: ...
644 //-----------------------------------------------------------------------------
645 struct Chuck_Instr_Divide_int_Assign : public Chuck_Instr_Binary_Op
647 public:
648 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
654 //-----------------------------------------------------------------------------
655 // name: struct Chuck_Instr_Add_double_Assign
656 // desc: ...
657 //-----------------------------------------------------------------------------
658 struct Chuck_Instr_Add_double_Assign : public Chuck_Instr_Binary_Op
660 public:
661 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
667 //-----------------------------------------------------------------------------
668 // name: struct Chuck_Instr_Minus_double_Assign
669 // desc: ...
670 //-----------------------------------------------------------------------------
671 struct Chuck_Instr_Minus_double_Assign : public Chuck_Instr_Binary_Op
673 public:
674 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
680 //-----------------------------------------------------------------------------
681 // name: struct Chuck_Instr_Times_double_Assign
682 // desc: ...
683 //-----------------------------------------------------------------------------
684 struct Chuck_Instr_Times_double_Assign : public Chuck_Instr_Binary_Op
686 public:
687 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
693 //-----------------------------------------------------------------------------
694 // name: struct Chuck_Instr_Divide_double_Assign
695 // desc: ...
696 //-----------------------------------------------------------------------------
697 struct Chuck_Instr_Divide_double_Assign : public Chuck_Instr_Binary_Op
699 public:
700 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
706 //-----------------------------------------------------------------------------
707 // name: struct Chuck_Instr_Mod_double_Assign
708 // desc: ...
709 //-----------------------------------------------------------------------------
710 struct Chuck_Instr_Mod_double_Assign : public Chuck_Instr_Binary_Op
712 public:
713 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
719 //-----------------------------------------------------------------------------
720 // name: struct Chuck_Instr_Add_complex_Assign
721 // desc: ...
722 //-----------------------------------------------------------------------------
723 struct Chuck_Instr_Add_complex_Assign : public Chuck_Instr_Binary_Op
725 public:
726 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
732 //-----------------------------------------------------------------------------
733 // name: struct Chuck_Instr_Minus_complex_Assign
734 // desc: ...
735 //-----------------------------------------------------------------------------
736 struct Chuck_Instr_Minus_complex_Assign : public Chuck_Instr_Binary_Op
738 public:
739 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
745 //-----------------------------------------------------------------------------
746 // name: struct Chuck_Instr_Times_complex_Assign
747 // desc: ...
748 //-----------------------------------------------------------------------------
749 struct Chuck_Instr_Times_complex_Assign : public Chuck_Instr_Binary_Op
751 public:
752 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
758 //-----------------------------------------------------------------------------
759 // name: struct Chuck_Instr_Divide_complex_Assign
760 // desc: ...
761 //-----------------------------------------------------------------------------
762 struct Chuck_Instr_Divide_complex_Assign : public Chuck_Instr_Binary_Op
764 public:
765 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
771 //-----------------------------------------------------------------------------
772 // name: struct Chuck_Instr_Add_polar_Assign
773 // desc: ...
774 //-----------------------------------------------------------------------------
775 struct Chuck_Instr_Add_polar_Assign : public Chuck_Instr_Binary_Op
777 public:
778 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
784 //-----------------------------------------------------------------------------
785 // name: struct Chuck_Instr_Minus_polar_Assign
786 // desc: ...
787 //-----------------------------------------------------------------------------
788 struct Chuck_Instr_Minus_polar_Assign : public Chuck_Instr_Binary_Op
790 public:
791 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
797 //-----------------------------------------------------------------------------
798 // name: struct Chuck_Instr_Times_polar_Assign
799 // desc: ...
800 //-----------------------------------------------------------------------------
801 struct Chuck_Instr_Times_polar_Assign : public Chuck_Instr_Binary_Op
803 public:
804 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
810 //-----------------------------------------------------------------------------
811 // name: struct Chuck_Instr_Divide_polar_Assign
812 // desc: ...
813 //-----------------------------------------------------------------------------
814 struct Chuck_Instr_Divide_polar_Assign : public Chuck_Instr_Binary_Op
816 public:
817 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
823 //-----------------------------------------------------------------------------
824 // name: struct Chuck_Instr_Add_string
825 // desc: ...
826 //-----------------------------------------------------------------------------
827 struct Chuck_Instr_Add_string : public Chuck_Instr_Binary_Op
829 public:
830 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
836 //-----------------------------------------------------------------------------
837 // name: struct Chuck_Instr_Add_string_Assign
838 // desc: ...
839 //-----------------------------------------------------------------------------
840 struct Chuck_Instr_Add_string_Assign : public Chuck_Instr_Binary_Op
842 public:
843 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
849 //-----------------------------------------------------------------------------
850 // name: struct Chuck_Instr_Add_string_int
851 // desc: ...
852 //-----------------------------------------------------------------------------
853 struct Chuck_Instr_Add_string_int : public Chuck_Instr_Binary_Op
855 public:
856 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
862 //-----------------------------------------------------------------------------
863 // name: struct Chuck_Instr_Add_string_float
864 // desc: ...
865 //-----------------------------------------------------------------------------
866 struct Chuck_Instr_Add_string_float : public Chuck_Instr_Binary_Op
868 public:
869 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
875 //-----------------------------------------------------------------------------
876 // name: struct Chuck_Instr_Add_int_string
877 // desc: ...
878 //-----------------------------------------------------------------------------
879 struct Chuck_Instr_Add_int_string : public Chuck_Instr_Binary_Op
881 public:
882 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
888 //-----------------------------------------------------------------------------
889 // name: struct Chuck_Instr_Add_float_string
890 // desc: ...
891 //-----------------------------------------------------------------------------
892 struct Chuck_Instr_Add_float_string : public Chuck_Instr_Binary_Op
894 public:
895 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
901 //-----------------------------------------------------------------------------
902 // name: struct Chuck_Instr_Add_int_string_Assign
903 // desc: ...
904 //-----------------------------------------------------------------------------
905 struct Chuck_Instr_Add_int_string_Assign : public Chuck_Instr_Binary_Op
907 public:
908 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
914 //-----------------------------------------------------------------------------
915 // name: struct Chuck_Instr_Add_float_string_Assign
916 // desc: ...
917 //-----------------------------------------------------------------------------
918 struct Chuck_Instr_Add_float_string_Assign : public Chuck_Instr_Binary_Op
920 public:
921 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
927 //-----------------------------------------------------------------------------
928 // name: struct Chuck_Instr_Branch_Lt_int
929 // desc: ...
930 //-----------------------------------------------------------------------------
931 struct Chuck_Instr_Branch_Lt_int : public Chuck_Instr_Branch_Op
933 public:
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
943 // desc: ...
944 //-----------------------------------------------------------------------------
945 struct Chuck_Instr_Branch_Gt_int : public Chuck_Instr_Branch_Op
947 public:
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
957 // desc: ...
958 //-----------------------------------------------------------------------------
959 struct Chuck_Instr_Branch_Le_int : public Chuck_Instr_Branch_Op
961 public:
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
971 // desc: ...
972 //-----------------------------------------------------------------------------
973 struct Chuck_Instr_Branch_Ge_int : public Chuck_Instr_Branch_Op
975 public:
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
985 // desc: ...
986 //-----------------------------------------------------------------------------
987 struct Chuck_Instr_Branch_Eq_int : public Chuck_Instr_Branch_Op
989 public:
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
999 // desc: ...
1000 //-----------------------------------------------------------------------------
1001 struct Chuck_Instr_Branch_Neq_int : public Chuck_Instr_Branch_Op
1003 public:
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
1013 // desc: ...
1014 //-----------------------------------------------------------------------------
1015 struct Chuck_Instr_Branch_Lt_double : public Chuck_Instr_Branch_Op
1017 public:
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
1027 // desc: ...
1028 //-----------------------------------------------------------------------------
1029 struct Chuck_Instr_Branch_Gt_double : public Chuck_Instr_Branch_Op
1031 public:
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
1041 // desc: ...
1042 //-----------------------------------------------------------------------------
1043 struct Chuck_Instr_Branch_Le_double : public Chuck_Instr_Branch_Op
1045 public:
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
1055 // desc: ...
1056 //-----------------------------------------------------------------------------
1057 struct Chuck_Instr_Branch_Ge_double : public Chuck_Instr_Branch_Op
1059 public:
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
1069 // desc: ...
1070 //-----------------------------------------------------------------------------
1071 struct Chuck_Instr_Branch_Eq_double : public Chuck_Instr_Branch_Op
1073 public:
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
1083 // desc: ...
1084 //-----------------------------------------------------------------------------
1085 struct Chuck_Instr_Branch_Neq_double : public Chuck_Instr_Branch_Op
1087 public:
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
1097 // desc: ...
1098 //-----------------------------------------------------------------------------
1099 struct Chuck_Instr_Lt_int : public Chuck_Instr_Binary_Op
1101 public:
1102 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1108 //-----------------------------------------------------------------------------
1109 // name: struct Chuck_Instr_Gt_int
1110 // desc: ...
1111 //-----------------------------------------------------------------------------
1112 struct Chuck_Instr_Gt_int : public Chuck_Instr_Binary_Op
1114 public:
1115 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1121 //-----------------------------------------------------------------------------
1122 // name: struct Chuck_Instr_Le_int
1123 // desc: ...
1124 //-----------------------------------------------------------------------------
1125 struct Chuck_Instr_Le_int : public Chuck_Instr_Binary_Op
1127 public:
1128 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1134 //-----------------------------------------------------------------------------
1135 // name: struct Chuck_Instr_Ge_int
1136 // desc: ...
1137 //-----------------------------------------------------------------------------
1138 struct Chuck_Instr_Ge_int : public Chuck_Instr_Binary_Op
1140 public:
1141 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1147 //-----------------------------------------------------------------------------
1148 // name: struct Chuck_Instr_Eq_int
1149 // desc: ...
1150 //-----------------------------------------------------------------------------
1151 struct Chuck_Instr_Eq_int : public Chuck_Instr_Binary_Op
1153 public:
1154 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1160 //-----------------------------------------------------------------------------
1161 // name: struct Chuck_Instr_Neq_int
1162 // desc: ...
1163 //-----------------------------------------------------------------------------
1164 struct Chuck_Instr_Neq_int : public Chuck_Instr_Binary_Op
1166 public:
1167 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1173 //-----------------------------------------------------------------------------
1174 // name: struct Chuck_Instr_Not_int
1175 // desc: ...
1176 //-----------------------------------------------------------------------------
1177 struct Chuck_Instr_Not_int : public Chuck_Instr
1179 public:
1180 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1186 //-----------------------------------------------------------------------------
1187 // name: struct Chuck_Instr_Negate_int
1188 // desc: ...
1189 //-----------------------------------------------------------------------------
1190 struct Chuck_Instr_Negate_int : public Chuck_Instr
1192 public:
1193 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1199 //-----------------------------------------------------------------------------
1200 // name: struct Chuck_Instr_Negate_double
1201 // desc: ...
1202 //-----------------------------------------------------------------------------
1203 struct Chuck_Instr_Negate_double : public Chuck_Instr
1205 public:
1206 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1212 //-----------------------------------------------------------------------------
1213 // name: struct Chuck_Instr_Lt_double
1214 // desc: ...
1215 //-----------------------------------------------------------------------------
1216 struct Chuck_Instr_Lt_double : public Chuck_Instr_Binary_Op
1218 public:
1219 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1225 //-----------------------------------------------------------------------------
1226 // name: struct Chuck_Instr_Gt_double
1227 // desc: ...
1228 //-----------------------------------------------------------------------------
1229 struct Chuck_Instr_Gt_double : public Chuck_Instr_Binary_Op
1231 public:
1232 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1238 //-----------------------------------------------------------------------------
1239 // name: struct Chuck_Instr_Le_double
1240 // desc: ...
1241 //-----------------------------------------------------------------------------
1242 struct Chuck_Instr_Le_double : public Chuck_Instr_Binary_Op
1244 public:
1245 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1251 //-----------------------------------------------------------------------------
1252 // name: struct Chuck_Instr_Ge_double
1253 // desc: ...
1254 //-----------------------------------------------------------------------------
1255 struct Chuck_Instr_Ge_double : public Chuck_Instr_Binary_Op
1257 public:
1258 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1264 //-----------------------------------------------------------------------------
1265 // name: struct Chuck_Instr_Eq_double
1266 // desc: ...
1267 //-----------------------------------------------------------------------------
1268 struct Chuck_Instr_Eq_double : public Chuck_Instr_Binary_Op
1270 public:
1271 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1277 //-----------------------------------------------------------------------------
1278 // name: struct Chuck_Instr_Neq_double
1279 // desc: ...
1280 //-----------------------------------------------------------------------------
1281 struct Chuck_Instr_Neq_double : public Chuck_Instr_Binary_Op
1283 public:
1284 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1290 //-----------------------------------------------------------------------------
1291 // name: struct Chuck_Instr_Binary_And
1292 // desc: ...
1293 //-----------------------------------------------------------------------------
1294 struct Chuck_Instr_Binary_And : public Chuck_Instr_Binary_Op
1296 public:
1297 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1303 //-----------------------------------------------------------------------------
1304 // name: struct Chuck_Instr_Binary_Or
1305 // desc: ...
1306 //-----------------------------------------------------------------------------
1307 struct Chuck_Instr_Binary_Or : public Chuck_Instr_Binary_Op
1309 public:
1310 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1316 //-----------------------------------------------------------------------------
1317 // name: struct Chuck_Instr_Binary_Xor
1318 // desc: ...
1319 //-----------------------------------------------------------------------------
1320 struct Chuck_Instr_Binary_Xor : public Chuck_Instr_Binary_Op
1322 public:
1323 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1329 //-----------------------------------------------------------------------------
1330 // name: struct Chuck_Instr_Binary_Shift_Right
1331 // desc: ...
1332 //-----------------------------------------------------------------------------
1333 struct Chuck_Instr_Binary_Shift_Right : public Chuck_Instr_Binary_Op
1335 public:
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
1348 public:
1349 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1355 //-----------------------------------------------------------------------------
1356 // name: struct Chuck_Instr_Binary_Shift_Left
1357 // desc: ...
1358 //-----------------------------------------------------------------------------
1359 struct Chuck_Instr_Binary_Shift_Left : public Chuck_Instr_Binary_Op
1361 public:
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
1374 public:
1375 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1381 //-----------------------------------------------------------------------------
1382 // name: struct Chuck_Instr_Binary_And_Assign
1383 // desc: ...
1384 //-----------------------------------------------------------------------------
1385 struct Chuck_Instr_Binary_And_Assign : public Chuck_Instr_Binary_Op
1387 public:
1388 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1394 //-----------------------------------------------------------------------------
1395 // name: struct Chuck_Instr_Binary_Or_Assign
1396 // desc: ...
1397 //-----------------------------------------------------------------------------
1398 struct Chuck_Instr_Binary_Or_Assign : public Chuck_Instr_Binary_Op
1400 public:
1401 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1407 //-----------------------------------------------------------------------------
1408 // name: struct Chuck_Instr_Binary_Xor_Assign
1409 // desc: ...
1410 //-----------------------------------------------------------------------------
1411 struct Chuck_Instr_Binary_Xor_Assign : public Chuck_Instr_Binary_Op
1413 public:
1414 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1420 //-----------------------------------------------------------------------------
1421 // name: struct Chuck_Instr_Binary_Shift_Right_Assign
1422 // desc: ...
1423 //-----------------------------------------------------------------------------
1424 struct Chuck_Instr_Binary_Shift_Right_Assign : public Chuck_Instr_Binary_Op
1426 public:
1427 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1433 //-----------------------------------------------------------------------------
1434 // name: struct Chuck_Instr_Binary_Shift_Left_Assign
1435 // desc: ...
1436 //-----------------------------------------------------------------------------
1437 struct Chuck_Instr_Binary_Shift_Left_Assign : public Chuck_Instr_Binary_Op
1439 public:
1440 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1446 //-----------------------------------------------------------------------------
1447 // name: struct Chuck_Instr_And
1448 // desc: ...
1449 //-----------------------------------------------------------------------------
1450 struct Chuck_Instr_And : public Chuck_Instr_Binary_Op
1452 public:
1453 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1459 //-----------------------------------------------------------------------------
1460 // name: struct Chuck_Instr_Or
1461 // desc: ...
1462 //-----------------------------------------------------------------------------
1463 struct Chuck_Instr_Or : public Chuck_Instr_Binary_Op
1465 public:
1466 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1472 //-----------------------------------------------------------------------------
1473 // name: struct Chuck_Instr_Goto
1474 // desc: ...
1475 //-----------------------------------------------------------------------------
1476 struct Chuck_Instr_Goto : public Chuck_Instr_Branch_Op
1478 public:
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
1492 public:
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
1505 public:
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
1518 public:
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
1532 public:
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
1545 public:
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
1558 public:
1559 Chuck_Instr_Reg_Push_Imm( t_CKUINT val )
1560 { this->set( val ); }
1562 public:
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
1575 public:
1576 Chuck_Instr_Reg_Push_Imm2( t_CKFLOAT val )
1577 { this->set( val ); }
1579 public:
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
1592 public:
1593 Chuck_Instr_Reg_Push_Imm4( t_CKFLOAT x, t_CKFLOAT y )
1594 { this->set( x ); m_val2 = y; }
1596 public:
1597 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1599 protected:
1600 t_CKFLOAT m_val2;
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
1612 public:
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
1625 public:
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
1638 public:
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
1651 public:
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
1664 public:
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
1677 public:
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
1690 public:
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
1703 public:
1704 Chuck_Instr_Reg_Push_Mem( t_CKUINT src, t_CKBOOL use_base = FALSE )
1705 { this->set( src ); base = use_base; }
1707 public:
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 );
1712 return buffer; }
1714 protected:
1715 // use global stack base
1716 t_CKBOOL 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
1728 public:
1729 Chuck_Instr_Reg_Push_Mem2( t_CKUINT src, t_CKBOOL use_base = FALSE )
1730 { this->set( src ); base = use_base; }
1732 public:
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 );
1737 return buffer; }
1739 protected:
1740 // use global stack base
1741 t_CKBOOL 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
1753 public:
1754 Chuck_Instr_Reg_Push_Mem4( t_CKUINT src, t_CKBOOL use_base = FALSE )
1755 { this->set( src ); base = use_base; }
1757 public:
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 );
1762 return buffer; }
1764 protected:
1765 // use global stack base
1766 t_CKBOOL 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
1778 public:
1779 Chuck_Instr_Reg_Push_Mem_Addr( t_CKUINT src, t_CKBOOL use_base )
1780 { this->set( src ); base = use_base; }
1782 public:
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 );
1787 return buffer; }
1789 protected:
1790 // use global stack base
1791 t_CKBOOL 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
1803 public:
1804 Chuck_Instr_Reg_Push_Deref( t_CKUINT src, t_CKUINT size )
1805 { this->set( src ); m_size = size; }
1807 public:
1808 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1809 t_CKUINT m_size;
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
1821 public:
1822 Chuck_Instr_Reg_Push_Deref2( t_CKFLOAT src )
1823 { this->set( src ); }
1825 public:
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
1838 public:
1839 Chuck_Instr_Mem_Set_Imm( t_CKUINT offset, t_CKUINT val )
1840 { m_offset = offset; m_val = val; }
1842 public:
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 );
1847 return buffer; }
1849 protected:
1850 t_CKUINT m_offset;
1851 t_CKUINT 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
1863 public:
1864 Chuck_Instr_Mem_Set_Imm2( t_CKUINT offset, t_CKFLOAT val )
1865 { m_offset = offset; m_val = val; }
1867 public:
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 );
1872 return buffer; }
1874 protected:
1875 t_CKUINT m_offset;
1876 t_CKFLOAT 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
1888 public:
1889 Chuck_Instr_Mem_Push_Imm( t_CKUINT src )
1890 { this->set( src ); }
1892 public:
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
1904 public:
1905 Chuck_Instr_Mem_Push_Imm2( t_CKFLOAT src )
1906 { this->set( src ); }
1908 public:
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
1920 public:
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
1933 public:
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
1946 public:
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
1956 // desc: no op
1957 //-----------------------------------------------------------------------------
1958 struct Chuck_Instr_Nop : public Chuck_Instr
1960 public:
1961 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
1967 //-----------------------------------------------------------------------------
1968 // name: struct Chuck_Instr_EOC
1969 // desc: ...
1970 //-----------------------------------------------------------------------------
1971 struct Chuck_Instr_EOC : public Chuck_Instr
1973 public:
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
1986 public:
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
2002 public:
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
2018 public:
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
2034 public:
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
2050 public:
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
2066 public:
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
2082 public:
2083 Chuck_Instr_Instantiate_Object( Chuck_Type * t )
2084 { this->type = t; }
2086 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2087 virtual const char * params() const;
2089 public:
2090 Chuck_Type * type;
2096 //-----------------------------------------------------------------------------
2097 // name: struct Chuck_Instr_Pre_Constructor
2098 // desc: preconstruct object
2099 //-----------------------------------------------------------------------------
2100 struct Chuck_Instr_Pre_Constructor : public Chuck_Instr
2102 public:
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;
2109 public:
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
2123 public:
2124 Chuck_Instr_Pre_Ctor_Array_Top( Chuck_Type * t )
2125 { this->type = t; }
2127 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2128 virtual const char * params() const;
2130 public:
2131 Chuck_Type * type;
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
2165 // desc: ...
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
2179 // desc: ...
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
2197 public:
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
2210 public:
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
2223 public:
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
2236 public:
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
2249 public:
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
2262 public:
2263 Chuck_Instr_Assign_Object_To_Map( t_CKUINT size )
2264 { this->set( size ); }
2266 public:
2267 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2273 //-----------------------------------------------------------------------------
2274 // name: struct Chuck_Instr_Chuck_Release_Object
2275 // desc: ...
2276 //-----------------------------------------------------------------------------
2277 struct Chuck_Instr_Chuck_Release_Object : public Chuck_Instr
2279 public:
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
2292 public:
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
2305 public:
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
2318 public:
2319 Chuck_Instr_Func_Call_Member( t_CKUINT ret_size )
2320 { this->set( ret_size ); }
2322 public:
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
2335 public:
2336 Chuck_Instr_Func_Call_Static( t_CKUINT ret_size )
2337 { this->set( ret_size ); }
2339 public:
2340 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2346 //-----------------------------------------------------------------------------
2347 // name: struct Chuck_Instr_Func_Return
2348 // desc: ...
2349 //-----------------------------------------------------------------------------
2350 struct Chuck_Instr_Func_Return : public Chuck_Instr
2352 public:
2353 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2359 //-----------------------------------------------------------------------------
2360 // name: struct Chuck_Instr_Spork
2361 // desc: ...
2362 //-----------------------------------------------------------------------------
2363 struct Chuck_Instr_Spork : public Chuck_Instr_Unary_Op
2365 public:
2366 Chuck_Instr_Spork( t_CKUINT v = 0 ) { this->set( v ); }
2367 public:
2368 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2374 //-----------------------------------------------------------------------------
2375 // name: struct Chuck_Instr_Time_Advance
2376 // desc: ...
2377 //-----------------------------------------------------------------------------
2378 struct Chuck_Instr_Time_Advance : public Chuck_Instr
2380 public:
2381 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2387 //-----------------------------------------------------------------------------
2388 // name: struct Chuck_Instr_Event_Wait
2389 // desc: ...
2390 //-----------------------------------------------------------------------------
2391 struct Chuck_Instr_Event_Wait : public Chuck_Instr
2393 public:
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
2406 public:
2407 Chuck_Instr_Array_Init( Chuck_Type * the_type, t_CKINT length );
2408 virtual ~Chuck_Instr_Array_Init();
2410 public:
2411 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2412 virtual const char * params() const { return m_param_str; }
2414 protected:
2415 Chuck_Type * m_type_ref;
2416 t_CKINT m_length;
2417 t_CKBOOL m_is_obj;
2418 char * m_param_str;
2424 //-----------------------------------------------------------------------------
2425 // name: struct Chuck_Instr_Array_Alloc
2426 // desc: ...
2427 //-----------------------------------------------------------------------------
2428 struct Chuck_Instr_Array_Alloc : public Chuck_Instr
2430 public:
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();
2435 public:
2436 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2437 virtual const char * params() const { return m_param_str; }
2439 protected:
2440 t_CKUINT m_depth;
2441 Chuck_Type * m_type_ref;
2442 t_CKBOOL m_is_obj;
2443 char * m_param_str;
2444 t_CKUINT m_stack_offset;
2445 t_CKBOOL m_is_ref;
2451 //-----------------------------------------------------------------------------
2452 // name: struct Chuck_Instr_Array_Access
2453 // desc: ...
2454 //-----------------------------------------------------------------------------
2455 struct Chuck_Instr_Array_Access : public Chuck_Instr
2457 public:
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; }
2462 public:
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 );
2468 return buffer; }
2470 protected:
2471 t_CKUINT m_size;
2472 t_CKUINT m_emit_addr;
2473 t_CKUINT m_istr;
2479 //-----------------------------------------------------------------------------
2480 // name: struct Chuck_Instr_Array_Map_Access
2481 // desc: ...
2482 //-----------------------------------------------------------------------------
2483 struct Chuck_Instr_Array_Map_Access : public Chuck_Instr
2485 public:
2486 Chuck_Instr_Array_Map_Access( t_CKUINT size, t_CKUINT emit_addr )
2487 { m_size = size; m_emit_addr = emit_addr; }
2489 public:
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 );
2494 return buffer; }
2496 protected:
2497 t_CKUINT m_size;
2498 t_CKUINT m_emit_addr;
2504 //-----------------------------------------------------------------------------
2505 // name: struct Chuck_Instr_Array_Access_Multi
2506 // desc: ...
2507 //-----------------------------------------------------------------------------
2508 struct Chuck_Instr_Array_Access_Multi : public Chuck_Instr
2510 public:
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; }
2514 public:
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 );
2519 return buffer; }
2521 protected:
2522 t_CKUINT m_depth;
2523 t_CKUINT m_size;
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
2536 public:
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; }
2540 public:
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 );
2545 return buffer; }
2547 protected:
2548 t_CKUINT m_offset;
2549 t_CKUINT m_size;
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
2562 public:
2563 Chuck_Instr_Dot_Member_Func( t_CKUINT offset )
2564 { m_offset = offset; }
2566 public:
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 );
2571 return buffer; }
2573 protected:
2574 t_CKUINT 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
2586 public:
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; }
2590 public:
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 );
2595 return buffer; }
2597 protected:
2598 t_CKUINT m_offset;
2599 t_CKUINT m_size;
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
2612 public:
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; }
2616 public:
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 );
2621 return buffer; }
2623 protected:
2624 void * m_addr;
2625 t_CKUINT m_size;
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
2638 public:
2639 Chuck_Instr_Dot_Static_Func( Chuck_Func * func )
2640 { m_func = func; }
2642 public:
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 );
2647 return buffer; }
2649 protected:
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
2662 public:
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; }
2666 public:
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 );
2671 return buffer; }
2673 protected:
2674 t_CKUINT m_is_mem;
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
2687 public:
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; }
2691 public:
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 );
2696 return buffer; }
2698 protected:
2699 t_CKUINT m_is_mem;
2700 t_CKUINT m_emit_addr;
2706 //-----------------------------------------------------------------------------
2707 // name: struct Chuck_Instr_ADC
2708 // desc: ...
2709 //-----------------------------------------------------------------------------
2710 struct Chuck_Instr_ADC : public Chuck_Instr
2712 public:
2713 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2719 //-----------------------------------------------------------------------------
2720 // name: struct Chuck_Instr_DAC
2721 // desc: ...
2722 //-----------------------------------------------------------------------------
2723 struct Chuck_Instr_DAC : public Chuck_Instr
2725 public:
2726 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2732 //-----------------------------------------------------------------------------
2733 // name: struct Chuck_Instr_Bunghole
2734 // desc: ...
2735 //-----------------------------------------------------------------------------
2736 struct Chuck_Instr_Bunghole : public Chuck_Instr
2738 public:
2739 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2745 //-----------------------------------------------------------------------------
2746 // name: struct Chuck_Instr_UGen_Link
2747 // desc: ...
2748 //-----------------------------------------------------------------------------
2749 struct Chuck_Instr_UGen_Link : public Chuck_Instr
2751 public:
2752 Chuck_Instr_UGen_Link( t_CKBOOL isUpChuck = FALSE );
2754 public:
2755 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2757 protected:
2758 t_CKBOOL m_isUpChuck;
2764 //-----------------------------------------------------------------------------
2765 // name: struct Chuck_Instr_UGen_UnLink
2766 // desc: ...
2767 //-----------------------------------------------------------------------------
2768 struct Chuck_Instr_UGen_UnLink : public Chuck_Instr
2770 public:
2771 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2777 //-----------------------------------------------------------------------------
2778 // name: struct Chuck_Instr_UGen_Ctrl
2779 // desc: ...
2780 //-----------------------------------------------------------------------------
2781 struct Chuck_Instr_UGen_Ctrl : public Chuck_Instr
2783 public:
2784 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2790 //-----------------------------------------------------------------------------
2791 // name: struct Chuck_Instr_UGen_CGet
2792 // desc: ...
2793 //-----------------------------------------------------------------------------
2794 struct Chuck_Instr_UGen_CGet : public Chuck_Instr
2796 public:
2797 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2803 //-----------------------------------------------------------------------------
2804 // name: struct Chuck_Instr_UGen_Ctrl2
2805 // desc: ...
2806 //-----------------------------------------------------------------------------
2807 struct Chuck_Instr_UGen_Ctrl2 : public Chuck_Instr
2809 public:
2810 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2816 //-----------------------------------------------------------------------------
2817 // name: struct Chuck_Instr_UGen_CGet2
2818 // desc: ...
2819 //-----------------------------------------------------------------------------
2820 struct Chuck_Instr_UGen_CGet2 : public Chuck_Instr
2822 public:
2823 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2829 //-----------------------------------------------------------------------------
2830 // name: struct Chuck_Instr_UGen_PMsg
2831 // desc: ...
2832 //-----------------------------------------------------------------------------
2833 struct Chuck_Instr_UGen_PMsg : public Chuck_Instr
2835 public:
2836 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2842 //-----------------------------------------------------------------------------
2843 // name: struct Chuck_Instr_Cast_double2int
2844 // desc: ...
2845 //-----------------------------------------------------------------------------
2846 struct Chuck_Instr_Cast_double2int : public Chuck_Instr
2848 public:
2849 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2855 //-----------------------------------------------------------------------------
2856 // name: struct Chuck_Instr_Cast_int2double
2857 // desc: ...
2858 //-----------------------------------------------------------------------------
2859 struct Chuck_Instr_Cast_int2double : public Chuck_Instr
2861 public:
2862 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2868 //-----------------------------------------------------------------------------
2869 // name: struct Chuck_Instr_Cast_int2complex
2870 // desc: ...
2871 //-----------------------------------------------------------------------------
2872 struct Chuck_Instr_Cast_int2complex : public Chuck_Instr
2874 public:
2875 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2881 //-----------------------------------------------------------------------------
2882 // name: struct Chuck_Instr_Cast_int2polar
2883 // desc: ...
2884 //-----------------------------------------------------------------------------
2885 struct Chuck_Instr_Cast_int2polar : public Chuck_Instr
2887 public:
2888 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2894 //-----------------------------------------------------------------------------
2895 // name: struct Chuck_Instr_Cast_double2complex
2896 // desc: ...
2897 //-----------------------------------------------------------------------------
2898 struct Chuck_Instr_Cast_double2complex : public Chuck_Instr
2900 public:
2901 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2907 //-----------------------------------------------------------------------------
2908 // name: struct Chuck_Instr_Cast_double2polar
2909 // desc: ...
2910 //-----------------------------------------------------------------------------
2911 struct Chuck_Instr_Cast_double2polar : public Chuck_Instr
2913 public:
2914 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2920 //-----------------------------------------------------------------------------
2921 // name: struct Chuck_Instr_Cast_complex2polar
2922 // desc: ...
2923 //-----------------------------------------------------------------------------
2924 struct Chuck_Instr_Cast_complex2polar : public Chuck_Instr
2926 public:
2927 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2933 //-----------------------------------------------------------------------------
2934 // name: struct Chuck_Instr_Cast_polar2complex
2935 // desc: ...
2936 //-----------------------------------------------------------------------------
2937 struct Chuck_Instr_Cast_polar2complex : public Chuck_Instr
2939 public:
2940 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2946 //-----------------------------------------------------------------------------
2947 // name: struct Chuck_Instr_Cast_object2string
2948 // desc: ...
2949 //-----------------------------------------------------------------------------
2950 struct Chuck_Instr_Cast_object2string : public Chuck_Instr
2952 public:
2953 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2959 //-----------------------------------------------------------------------------
2960 // name: struct Chuck_Instr_Op_string
2961 // desc: ...
2962 //-----------------------------------------------------------------------------
2963 struct Chuck_Instr_Op_string : public Chuck_Instr_Unary_Op
2965 public:
2966 Chuck_Instr_Op_string( t_CKUINT v ) { this->set( v ); }
2968 public:
2969 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2975 //-----------------------------------------------------------------------------
2976 // name: struct Chuck_Instr_Init_Loop_Counter
2977 // desc: ...
2978 //-----------------------------------------------------------------------------
2979 struct Chuck_Instr_Init_Loop_Counter : public Chuck_Instr_Unary_Op
2981 public:
2982 Chuck_Instr_Init_Loop_Counter( t_CKUINT v )
2983 { this->set( v ); }
2985 public:
2986 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2992 //-----------------------------------------------------------------------------
2993 // name: struct Chuck_Instr_IO_in_int
2994 // desc: ...
2995 //-----------------------------------------------------------------------------
2996 struct Chuck_Instr_IO_in_int : public Chuck_Instr_Binary_Op
2998 public:
2999 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3005 //-----------------------------------------------------------------------------
3006 // name: struct Chuck_Instr_IO_in_float
3007 // desc: ...
3008 //-----------------------------------------------------------------------------
3009 struct Chuck_Instr_IO_in_float : public Chuck_Instr_Binary_Op
3011 public:
3012 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3018 //-----------------------------------------------------------------------------
3019 // name: struct Chuck_Instr_IO_in_string
3020 // desc: ...
3021 //-----------------------------------------------------------------------------
3022 struct Chuck_Instr_IO_in_string : public Chuck_Instr_Binary_Op
3024 public:
3025 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3031 //-----------------------------------------------------------------------------
3032 // name: struct Chuck_Instr_IO_out_int
3033 // desc: ...
3034 //-----------------------------------------------------------------------------
3035 struct Chuck_Instr_IO_out_int : public Chuck_Instr_Binary_Op
3037 public:
3038 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3044 //-----------------------------------------------------------------------------
3045 // name: struct Chuck_Instr_IO_out_float
3046 // desc: ...
3047 //-----------------------------------------------------------------------------
3048 struct Chuck_Instr_IO_out_float : public Chuck_Instr_Binary_Op
3050 public:
3051 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3057 //-----------------------------------------------------------------------------
3058 // name: struct Chuck_Instr_IO_out_string
3059 // desc: ...
3060 //-----------------------------------------------------------------------------
3061 struct Chuck_Instr_IO_out_string : public Chuck_Instr_Binary_Op
3063 public:
3064 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3070 //-----------------------------------------------------------------------------
3071 // name: struct Chuck_Instr_Hack
3072 // desc: ...
3073 //-----------------------------------------------------------------------------
3074 struct Chuck_Instr_Hack : public Chuck_Instr
3076 public:
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;
3082 protected:
3083 Chuck_Type * m_type_ref;
3089 //-----------------------------------------------------------------------------
3090 // name: struct Chuck_Instr_Gack
3091 // desc: ...
3092 //-----------------------------------------------------------------------------
3093 struct Chuck_Instr_Gack : public Chuck_Instr
3095 public:
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;
3101 protected:
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 );
3115 // define SP offset
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 )
3129 #endif