History

aligning headers with 1.5-beta; Bitcrusher crushing a bit better; removing Faust osx -lcrypto dependency

Ge Wang committed 3 years ago

Commit 6e4b6fc1 parent 01c8ae472 files · +2167 −1113Browse files

Unified · Split

72 files
  1. Bitcrusher/Bitcrusher.cpp +10 −2
  2. Faust/makefile.osx +2 −2
  3. chuck/include/chuck.h +2 −4
  4. chuck/include/chuck_compile.h +6 −1
  5. chuck/include/chuck_def.h +8 −1
  6. chuck/include/chuck_dl.h +3 −3
  7. chuck/include/chuck_emit.h +3 −1
  8. chuck/include/chuck_errmsg.h +1 −1
  9. chuck/include/chuck_frame.h +1 −1
  10. chuck/include/chuck_instr.h +73 −9
  11. chuck/include/chuck_io.h +7 −4
  12. chuck/include/chuck_lang.h +37 −2
  13. chuck/include/chuck_oo.h +48 −13
  14. chuck/include/chuck_parse.h +2 −0
  15. chuck/include/chuck_type.h +77 −16
  16. chuck/include/ugen_stk.h +4 −6
  17. chuck/include/ulib_ai.h +159 −19
  18. chuck/include/ulib_machine.h +8 −11
  19. chuck/include/ulib_math.h +11 −0
  20. chuck/include/util_hid.h +2 −0
  21. chuck/include/util_math.h +2 −1
  22. chuck/include/util_network.h +1 −0
  23. chuck/include/util_opsc.h +1 −0
  24. chuck/include/util_serial.h +2 −0
  25. chuck/include/util_sndfile.h +7 −1
  26. chuginate/template/chuck/include/chuck.h +15 −17
  27. chuginate/template/chuck/include/chuck.tab.h +1 −1
  28. chuginate/template/chuck/include/chuck_absyn.h +15 −14
  29. chuginate/template/chuck/include/chuck_carrier.h +8 −8
  30. chuginate/template/chuck/include/chuck_compile.h +23 −11
  31. chuginate/template/chuck/include/chuck_def.h +17 −7
  32. chuginate/template/chuck/include/chuck_dl.h +62 −56
  33. chuginate/template/chuck/include/chuck_emit.h +7 −5
  34. chuginate/template/chuck/include/chuck_errmsg.h +9 −9
  35. chuginate/template/chuck/include/chuck_frame.h +1 −1
  36. chuginate/template/chuck/include/chuck_globals.h +21 −21
  37. chuginate/template/chuck/include/chuck_instr.h +163 −93
  38. chuginate/template/chuck/include/chuck_io.h +32 −29
  39. chuginate/template/chuck/include/chuck_lang.h +40 −3
  40. chuginate/template/chuck/include/chuck_oo.h +93 −41
  41. chuginate/template/chuck/include/chuck_otf.h +4 −4
  42. chuginate/template/chuck/include/chuck_parse.h +7 −5
  43. chuginate/template/chuck/include/chuck_scan.h +2 −2
  44. chuginate/template/chuck/include/chuck_shell.h +80 −80
  45. chuginate/template/chuck/include/chuck_stats.h +10 −10
  46. chuginate/template/chuck/include/chuck_symbol.h +1 −1
  47. chuginate/template/chuck/include/chuck_table.h +2 −2
  48. chuginate/template/chuck/include/chuck_type.h +131 −57
  49. chuginate/template/chuck/include/chuck_ugen.h +6 −6
  50. chuginate/template/chuck/include/chuck_utils.h +1 −1
  51. chuginate/template/chuck/include/chuck_vm.h +18 −18
  52. chuginate/template/chuck/include/chuck_win32.h +3 −3
  53. chuginate/template/chuck/include/dirent_win32.h +37 −37
  54. chuginate/template/chuck/include/hidio_sdl.h +4 −4
  55. chuginate/template/chuck/include/midiio_rtmidi.h +46 −46
  56. chuginate/template/chuck/include/rtmidi.h +10 −10
  57. chuginate/template/chuck/include/ugen_osc.h +2 −2
  58. chuginate/template/chuck/include/ugen_stk.h +141 −143
  59. chuginate/template/chuck/include/ulib_ai.h +377 −0
  60. chuginate/template/chuck/include/ulib_machine.h +9 −10
  61. chuginate/template/chuck/include/ulib_math.h +12 −6
  62. chuginate/template/chuck/include/ulib_regex.h +4 −4
  63. chuginate/template/chuck/include/util_buffers.h +54 −54
  64. chuginate/template/chuck/include/util_hid.h +4 −2
  65. chuginate/template/chuck/include/util_math.h +23 −7
  66. chuginate/template/chuck/include/util_network.h +1 −0
  67. chuginate/template/chuck/include/util_opsc.h +52 −51
  68. chuginate/template/chuck/include/util_platforms.h +9 −10
  69. chuginate/template/chuck/include/util_serial.h +5 −4
  70. chuginate/template/chuck/include/util_sndfile.h +103 −99
  71. chuginate/template/chuck/include/util_string.h +7 −3
  72. chuginate/template/chuck/include/util_thread.h +18 −18
Bitcrusher/Bitcrusher.cpp+10−2
@@ -120,9 +120,17 @@ CK_DLL_TICK(bitcrusher_tick) · 119 unmodified lines
120 120
121 // convert to 32-bit int121 // convert to 32-bit int
122 t_CKINT shift = 32-bcdata->bits;122 t_CKINT shift = 32-bcdata->bits;
123 int q32 = theSample * INT_MAX;123 // cast to double for avoid floating point precision warning/error | (ge) 2023.4.14
124 // "implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648"
125 // https://stackoverflow.com/questions/23420783/convert-int-max-to-float-and-then-back-to-integer
126 // for example...
127 // int i = ((float)(INT_MAX)); // on mac (intel and arm64) seem to produce arbitrary and different values
128 // int i = ((float)(INT_MAX)-64); // on mac appears stable
129 // int i = ((double)(INT_MAX)); // on mac appears stable
130 // int i = ((double)(INT_MAX)+.1); // on mac appears stable
131 // int i = ((double)(INT_MAX)+1); // on mac not stable
132 int q32 = ((double)theSample) * INT_MAX;
124 q32 = (q32 >> shift) << shift;133 q32 = (q32 >> shift) << shift;
125
126 *out = q32 / ((float) INT_MAX);134 *out = q32 / ((float) INT_MAX);
127 135
128 return TRUE;136 return TRUE;
Faust/makefile.osx+2−2
@@ -1,9 +1,9 @@
1 1
2ARCHS?=x86_642ARCHS?=arm64
3ARCHOPTS=$(addprefix -arch ,$(ARCHS))3ARCHOPTS=$(addprefix -arch ,$(ARCHS))
4 4
5FLAGS+=-mmacosx-version-min=10.9 -D__MACOSX_CORE__ -I$(CK_SRC_PATH) $(ARCHOPTS) -fPIC -I/usr/local/include 5FLAGS+=-mmacosx-version-min=10.9 -D__MACOSX_CORE__ -I$(CK_SRC_PATH) $(ARCHOPTS) -fPIC -I/usr/local/include
6LDFLAGS+=-mmacosx-version-min=10.9 -L/usr/local/lib -shared -lc++ $(ARCHOPTS) -lfaust `llvm-config-mp-3.5 --ldflags --libs all` -lcrypto -lz -lcurses -lc++6LDFLAGS+=-mmacosx-version-min=10.9 -L/usr/local/lib -shared -lc++ $(ARCHOPTS) -lfaust `llvm-config --ldflags --libs all` -lz -lcurses -lc++
7 7
8LD=clang++8LD=clang++
9CXX=clang++9CXX=clang++
chuck/include/chuck.h+2−4
@@ -175,12 +175,10 @@ protected: · 174 unmodified lines
175public: // static functions175public: // static functions
176 // chuck version176 // chuck version
177 static const char * version();177 static const char * version();
178 #ifndef __DISABLE_OTF_SERVER__
179 // chuck int size (in bits)178 // chuck int size (in bits)
180 // (this depends on machine, which depends on OTF, so179 // (this depends on machine, which depends on OTF, so disable it if we don't have OTF)
181 // disable it if we don't have OTF)180 // 1.5.0.0 (ge) | reinstated for non-OTF, along with parts of machine
182 static t_CKUINT intSize();181 static t_CKUINT intSize();
183 #endif
184 // number of ChucK's182 // number of ChucK's
185 static t_CKUINT numVMs() { return o_numVMs; };183 static t_CKUINT numVMs() { return o_numVMs; };
186 // --poop compatibilty184 // --poop compatibilty
chuck/include/chuck_compile.h+6−1
@@ -67,7 +67,6 @@ public: // get protected data · 66 unmodified lines
67 // set carrier67 // set carrier
68 t_CKBOOL setCarrier( Chuck_Carrier * c ) { m_carrier = c; return TRUE; }68 t_CKBOOL setCarrier( Chuck_Carrier * c ) { m_carrier = c; return TRUE; }
69 69
70
71public: // data70public: // data
72 // emitter71 // emitter
73 Chuck_Emitter * emitter;72 Chuck_Emitter * emitter;
@@ -79,9 +78,15 @@ public: // data · 5 unmodified lines
79 // recent map78 // recent map
80 std::map<std::string, Chuck_Context *> m_recent;79 std::map<std::string, Chuck_Context *> m_recent;
81 80
81 // chugins
82 std::list<Chuck_DLL *> m_dlls;82 std::list<Chuck_DLL *> m_dlls;
83 // libraries (ck code) to import
83 std::list<std::string> m_cklibs_to_preload;84 std::list<std::string> m_cklibs_to_preload;
84 85
86 // origin hint; this flag is set to different te_Origin values
87 // to denote where new entities originate | 1.5.0.0 (ge) added
88 te_Origin m_originHint;
89
85public: // to all90public: // to all
86 // contructor91 // contructor
87 Chuck_Compiler();92 Chuck_Compiler();
chuck/include/chuck_def.h+8−1
@@ -154,6 +154,8 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 153 unmodified lines
154#define SAFE_RELEASE(x) do { if(x){ x->release(); x = NULL; } } while(0)154#define SAFE_RELEASE(x) do { if(x){ x->release(); x = NULL; } } while(0)
155#define SAFE_ADD_REF(x) do { if(x){ x->add_ref(); } } while(0)155#define SAFE_ADD_REF(x) do { if(x){ x->add_ref(); } } while(0)
156#define SAFE_REF_ASSIGN(lhs,rhs) do { SAFE_RELEASE(lhs); (lhs) = (rhs); SAFE_ADD_REF(lhs); } while(0)156#define SAFE_REF_ASSIGN(lhs,rhs) do { SAFE_RELEASE(lhs); (lhs) = (rhs); SAFE_ADD_REF(lhs); } while(0)
157#define SAFE_FREE(x) do { if(x){ free(x); x = NULL; } } while(0)
158#define SAFE_UNLOCK_DELETE(x) do { if(x){ x->unlock(); delete x; x = NULL; } } while(0)
157#endif159#endif
158 160
159// max + min161// max + min
@@ -191,7 +193,12 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 31 unmodified lines
191 193
192#ifdef __PLATFORM_WIN32__194#ifdef __PLATFORM_WIN32__
193#ifndef usleep195#ifndef usleep
194#define usleep(x) Sleep( (x / 1000 <= 0 ? 1 : x / 1000) )196 #define usleep(x) Sleep( (x / 1000 <= 0 ? 1 : x / 1000) )
197#endif
198// 1.4.2.0 (ge and spencer) | added for legacy windows, as part of switch to snprintf
199// https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
200#if defined(_MSC_VER) && _MSC_VER < 1900
201 #define snprintf(buf,len, format,...) _snprintf_s(buf, len,len, format, __VA_ARGS__)
195#endif202#endif
196#pragma warning (disable : 4996) // stdio deprecation203#pragma warning (disable : 4996) // stdio deprecation
197#pragma warning (disable : 4786) // stl debug info204#pragma warning (disable : 4786) // stl debug info
chuck/include/chuck_dl.h+3−3
@@ -161,7 +161,7 @@ namespace Chuck_DL_Api { struct Api; } · 160 unmodified lines
161#endif161#endif
162 162
163// calling convention of functions provided by chuck to the dll163// calling convention of functions provided by chuck to the dll
164#if defined(__WINDOWS_DS__)164#if defined(__PLATFORM_WIN32__)
165 #define CK_DLL_CALL _cdecl165 #define CK_DLL_CALL _cdecl
166#else166#else
167 #define CK_DLL_CALL167 #define CK_DLL_CALL
@@ -676,7 +676,7 @@ public: · 508 unmodified lines
676 {676 {
677 ObjectApi();677 ObjectApi();
678 678
679 // 1.4.2.1 (nshaheed and ge and anonymous pr-lab member) | changed from private to public679 // 1.5.0.0 (nshaheed and ge and anonymous pr-lab member) | changed from private to public
680 // also changed all std::string & in this section to const char *680 // also changed all std::string & in this section to const char *
681 // intent: this allows for chugins to access member variables and create chuck strings681 // intent: this allows for chugins to access member variables and create chuck strings
682 public:682 public:
@@ -724,7 +724,7 @@ private: · 41 unmodified lines
724 724
725#error ChucK not support on Mac OS X 10.3 or lower725#error ChucK not support on Mac OS X 10.3 or lower
726 726
727#elif defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)727#elif defined(__PLATFORM_WIN32__)
728 728
729 #ifdef __cplusplus729 #ifdef __cplusplus
730 extern "C" {730 extern "C" {
chuck/include/chuck_emit.h+3−1
@@ -148,7 +148,9 @@ struct Chuck_Emitter : public Chuck_VM_Object · 147 unmodified lines
148 // add references to locals on current scope (added 1.3.0.0)148 // add references to locals on current scope (added 1.3.0.0)
149 void addref_on_scope();149 void addref_on_scope();
150 // pop scope150 // pop scope
151 void pop_scope( );151 void pop_scope();
152 // traverse scope on jumps such as 'return' 'break' 'continue' | 1.5.0.0 (ge)
153 void traverse_scope_on_jump();
152 154
153 // default durations155 // default durations
154 t_CKBOOL find_dur( const std::string & name, t_CKDUR * out );156 t_CKBOOL find_dur( const std::string & name, t_CKDUR * out );
chuck/include/chuck_errmsg.h+1−1
@@ -53,7 +53,7 @@ extern t_CKINT EM_extLineNum; · 52 unmodified lines
53void EM_newline( );53void EM_newline( );
54 54
55// levels55// levels
56#define CK_LOG_CRAZY 10 // set this to log everything56#define CK_LOG_ALL 10 // set this to log everything
57#define CK_LOG_FINEST 957#define CK_LOG_FINEST 9
58#define CK_LOG_FINER 858#define CK_LOG_FINER 8
59#define CK_LOG_FINE 759#define CK_LOG_FINE 7
chuck/include/chuck_frame.h+1−1
@@ -92,7 +92,7 @@ public: · 91 unmodified lines
92 Chuck_Local * alloc_local( t_CKUINT size, const std::string & name,92 Chuck_Local * alloc_local( t_CKUINT size, const std::string & name,
93 t_CKBOOL is_ref, t_CKBOOL is_obj, t_CKBOOL is_global );93 t_CKBOOL is_ref, t_CKBOOL is_obj, t_CKBOOL is_global );
94 // get the current scope (added 1.3.0.0)94 // get the current scope (added 1.3.0.0)
95 void get_scope( std::vector<Chuck_Local *> & out ) const;95 void get_scope( std::vector<Chuck_Local *> & out, bool localOnly = true ) const;
96 // pop scope96 // pop scope
97 void pop_scope( std::vector<Chuck_Local *> & out );97 void pop_scope( std::vector<Chuck_Local *> & out );
98};98};
chuck/include/chuck_instr.h+73−9
@@ -58,7 +58,7 @@ struct Chuck_Instr · 57 unmodified lines
58{58{
59public:59public:
60 Chuck_Instr();60 Chuck_Instr();
61 virtual ~Chuck_Instr() { }61 virtual ~Chuck_Instr() { SAFE_DELETE(m_codestr); }
62 62
63public:63public:
64 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) = 0;64 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) = 0;
@@ -69,8 +69,14 @@ public: · 4 unmodified lines
69 { return ""; }69 { return ""; }
70 70
71public:71public:
72 // store line position for error messages
72 void set_linepos( t_CKUINT linepos );73 void set_linepos( t_CKUINT linepos );
73 t_CKUINT m_linepos;74 t_CKUINT m_linepos;
75
76 // set codestr associated with this instruction
77 void set_codestr( const std::string & str );
78 // (used in instruction dump) | 1.5.0.0 (ge) added
79 std::string * m_codestr;
74};80};
75 81
76 82
@@ -2017,6 +2023,23 @@ protected: · 1940 unmodified lines
2017 2023
2018 2024
2019 2025
2026//-----------------------------------------------------------------------------
2027// name: struct Chuck_Instr_Reg_Push_Zero
2028// desc: push immediate value 0 to reg stack with specific width
2029//-----------------------------------------------------------------------------
2030struct Chuck_Instr_Reg_Push_Zero : public Chuck_Instr_Unary_Op
2031{
2032public:
2033 Chuck_Instr_Reg_Push_Zero( t_CKUINT sizeInBytes )
2034 { this->set( sizeInBytes ); }
2035
2036public:
2037 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2038};
2039
2040
2041
2042
2020//-----------------------------------------------------------------------------2043//-----------------------------------------------------------------------------
2021// name: struct Chuck_Instr_Reg_Dup_Last2044// name: struct Chuck_Instr_Reg_Dup_Last
2022// desc: duplicate last value on reg stack2045// desc: duplicate last value on reg stack
@@ -2960,6 +2983,7 @@ public: · 937 unmodified lines
2960//-----------------------------------------------------------------------------2983//-----------------------------------------------------------------------------
2961// name: struct Chuck_Instr_Reg_AddRef_Object32984// name: struct Chuck_Instr_Reg_AddRef_Object3
2962// desc: added 1.3.0.0 -- does the ref add in-place2985// desc: added 1.3.0.0 -- does the ref add in-place
2986// operates on top of the register stack
2963//-----------------------------------------------------------------------------2987//-----------------------------------------------------------------------------
2964struct Chuck_Instr_Reg_AddRef_Object3 : public Chuck_Instr2988struct Chuck_Instr_Reg_AddRef_Object3 : public Chuck_Instr
2965{2989{
@@ -2972,7 +2996,7 @@ public: · 6 unmodified lines
2972 2996
2973//-----------------------------------------------------------------------------2997//-----------------------------------------------------------------------------
2974// name: struct Chuck_Instr_Release_Object2998// name: struct Chuck_Instr_Release_Object
2975// desc: ...2999// desc: release object on stack by its offset
2976//-----------------------------------------------------------------------------3000//-----------------------------------------------------------------------------
2977struct Chuck_Instr_Release_Object : public Chuck_Instr3001struct Chuck_Instr_Release_Object : public Chuck_Instr
2978{3002{
@@ -3001,6 +3025,38 @@ public: · 22 unmodified lines
3001 3025
3002 3026
3003 3027
3028//-----------------------------------------------------------------------------
3029// name: struct Chuck_Instr_Release_Object3_Pop_Word
3030// desc: release object reference + pop from reg stack | 1.5.0.0 (ge) added
3031// the variant assumes object pointer directly on stack (not offset)
3032//-----------------------------------------------------------------------------
3033struct Chuck_Instr_Release_Object3_Pop_Word : public Chuck_Instr
3034{
3035public:
3036 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3037};
3038
3039
3040
3041
3042//-----------------------------------------------------------------------------
3043// name: struct Chuck_Instr_Release_Object4
3044// desc: release object reference from reg stack (no pop) | 1.5.0.0 (ge) added
3045// the variant assumes object pointer directly on stack (not offset)
3046//-----------------------------------------------------------------------------
3047struct Chuck_Instr_Release_Object4 : public Chuck_Instr_Unary_Op
3048{
3049public:
3050 Chuck_Instr_Release_Object4( t_CKUINT offset )
3051 { this->set( offset ); }
3052
3053public:
3054 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3055};
3056
3057
3058
3059
3004//-----------------------------------------------------------------------------3060//-----------------------------------------------------------------------------
3005// name: struct Chuck_Instr_Func_To_Code3061// name: struct Chuck_Instr_Func_To_Code
3006// desc: Chuck_Func * to Chuck_VM_Code *3062// desc: Chuck_Func * to Chuck_VM_Code *
@@ -3034,11 +3090,14 @@ public: · 27 unmodified lines
3034struct Chuck_Instr_Func_Call_Member : public Chuck_Instr_Unary_Op3090struct Chuck_Instr_Func_Call_Member : public Chuck_Instr_Unary_Op
3035{3091{
3036public:3092public:
3037 Chuck_Instr_Func_Call_Member( t_CKUINT ret_size )3093 Chuck_Instr_Func_Call_Member( t_CKUINT ret_size, Chuck_Func * func_ref )
3038 { this->set( ret_size ); }3094 { this->set( ret_size ); m_func_ref = func_ref; }
3039 3095
3040public:3096public:
3041 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3097 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3098
3099public:
3100 Chuck_Func * m_func_ref; // 1.5.0.0 (ge) | added for arg list cleanup
3042};3101};
3043 3102
3044 3103
@@ -3051,11 +3110,14 @@ public: · 6 unmodified lines
3051struct Chuck_Instr_Func_Call_Static : public Chuck_Instr_Unary_Op3110struct Chuck_Instr_Func_Call_Static : public Chuck_Instr_Unary_Op
3052{3111{
3053public:3112public:
3054 Chuck_Instr_Func_Call_Static( t_CKUINT ret_size )3113 Chuck_Instr_Func_Call_Static( t_CKUINT ret_size, Chuck_Func * func_ref )
3055 { this->set( ret_size ); }3114 { this->set( ret_size ); m_func_ref = func_ref; }
3056 3115
3057public:3116public:
3058 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3117 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3118
3119public:
3120 Chuck_Func * m_func_ref; // 1.5.0.0 (ge) | added for arg list cleanup
3059};3121};
3060 3122
3061 3123
@@ -3162,8 +3224,9 @@ protected: · 100 unmodified lines
3162struct Chuck_Instr_Array_Alloc : public Chuck_Instr3224struct Chuck_Instr_Array_Alloc : public Chuck_Instr
3163{3225{
3164public: // REFACTOR-2017: added env3226public: // REFACTOR-2017: added env
3165 Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth, Chuck_Type * the_type,3227 Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth,
3166 t_CKUINT offset, t_CKBOOL ref );3228 Chuck_Type * contentType, t_CKUINT offset, t_CKBOOL ref,
3229 Chuck_Type * arrayType );
3167 virtual ~Chuck_Instr_Array_Alloc();3230 virtual ~Chuck_Instr_Array_Alloc();
3168 3231
3169public:3232public:
@@ -3172,7 +3235,8 @@ public: · 2 unmodified lines
3172 3235
3173protected:3236protected:
3174 t_CKUINT m_depth;3237 t_CKUINT m_depth;
3175 Chuck_Type * m_type_ref;3238 Chuck_Type * m_type_ref_content;
3239 Chuck_Type * m_type_ref_array; // 1.5.0.0 (ge) added
3176 t_CKBOOL m_is_obj;3240 t_CKBOOL m_is_obj;
3177 char * m_param_str;3241 char * m_param_str;
3178 t_CKUINT m_stack_offset;3242 t_CKUINT m_stack_offset;
chuck/include/chuck_io.h+7−4
@@ -53,9 +53,9 @@ t_CKBOOL init_class_MidiRW( Chuck_Env * env ); · 52 unmodified lines
53t_CKBOOL init_class_HID( Chuck_Env * env );53t_CKBOOL init_class_HID( Chuck_Env * env );
54#endif54#endif
55t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type );55t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type );
56#ifndef __DISABLE_FILEIO__56// #ifndef __DISABLE_FILEIO__
57t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type );57t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type );
58#endif58// #endif
59// added 1.3.0.0 -- moved to be full-fledged class59// added 1.3.0.0 -- moved to be full-fledged class
60t_CKBOOL init_class_chout( Chuck_Env * env, Chuck_Type * type );60t_CKBOOL init_class_chout( Chuck_Env * env, Chuck_Type * type );
61// added 1.3.0.0 -- moved to be full-fledged class61// added 1.3.0.0 -- moved to be full-fledged class
@@ -77,7 +77,7 @@ CK_DLL_SFUN( io_newline ); · 15 unmodified lines
77CK_DLL_SFUN( io_openfile );77CK_DLL_SFUN( io_openfile );
78 78
79 79
80#ifndef __DISABLE_FILEIO__80// #ifndef __DISABLE_FILEIO__
81//-----------------------------------------------------------------------------81//-----------------------------------------------------------------------------
82// fileio API82// fileio API
83//-----------------------------------------------------------------------------83//-----------------------------------------------------------------------------
@@ -99,6 +99,9 @@ CK_DLL_MFUN( fileio_read ); · 15 unmodified lines
99CK_DLL_MFUN( fileio_readline );99CK_DLL_MFUN( fileio_readline );
100CK_DLL_MFUN( fileio_readint );100CK_DLL_MFUN( fileio_readint );
101CK_DLL_MFUN( fileio_readintflags );101CK_DLL_MFUN( fileio_readintflags );
102CK_DLL_MFUN( fileio_readint8 );
103CK_DLL_MFUN( fileio_readint16 );
104CK_DLL_MFUN( fileio_readint32 );
102CK_DLL_MFUN( fileio_readfloat );105CK_DLL_MFUN( fileio_readfloat );
103CK_DLL_MFUN( fileio_eof );106CK_DLL_MFUN( fileio_eof );
104CK_DLL_MFUN( fileio_more );107CK_DLL_MFUN( fileio_more );
@@ -106,7 +109,7 @@ CK_DLL_MFUN( fileio_writestring ); · 1 unmodified line
106CK_DLL_MFUN( fileio_writeint );109CK_DLL_MFUN( fileio_writeint );
107CK_DLL_MFUN( fileio_writeintflags );110CK_DLL_MFUN( fileio_writeintflags );
108CK_DLL_MFUN( fileio_writefloat );111CK_DLL_MFUN( fileio_writefloat );
109#endif112// #endif // __DISABLE_FILEIO__
110 113
111 114
112//-----------------------------------------------------------------------------115//-----------------------------------------------------------------------------
chuck/include/chuck_lang.h+37−2
@@ -58,7 +58,8 @@ t_CKBOOL init_class_string( Chuck_Env * env, Chuck_Type * type ); · 57 unmodified lines
58t_CKBOOL init_class_array( Chuck_Env * env, Chuck_Type * type );58t_CKBOOL init_class_array( Chuck_Env * env, Chuck_Type * type );
59t_CKBOOL init_class_vec3( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.359t_CKBOOL init_class_vec3( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3
60t_CKBOOL init_class_vec4( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.360t_CKBOOL init_class_vec4( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3
61 61t_CKBOOL init_class_type( Chuck_Env * env, Chuck_Type * type ); // 1.5.0.0
62t_CKBOOL init_primitive_types( Chuck_Env * env ); // 1.5.0.0
62 63
63 64
64 65
@@ -69,11 +70,11 @@ t_CKBOOL init_class_vec4( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3 · 4 unmodified lines
69CK_DLL_CTOR( object_ctor );70CK_DLL_CTOR( object_ctor );
70CK_DLL_DTOR( object_dtor );71CK_DLL_DTOR( object_dtor );
71CK_DLL_MFUN( object_equals );72CK_DLL_MFUN( object_equals );
72CK_DLL_MFUN( object_getType );
73CK_DLL_MFUN( object_hashCode );73CK_DLL_MFUN( object_hashCode );
74CK_DLL_MFUN( object_toString );74CK_DLL_MFUN( object_toString );
75CK_DLL_MFUN( object_dump );75CK_DLL_MFUN( object_dump );
76CK_DLL_SFUN( object_help );76CK_DLL_SFUN( object_help );
77CK_DLL_SFUN( object_typeInfo );
77 78
78 79
79//-----------------------------------------------------------------------------80//-----------------------------------------------------------------------------
@@ -187,7 +188,10 @@ CK_DLL_MFUN( array_find ); · 107 unmodified lines
187CK_DLL_MFUN( array_erase );188CK_DLL_MFUN( array_erase );
188CK_DLL_MFUN( array_clear );189CK_DLL_MFUN( array_clear );
189CK_DLL_MFUN( array_reset );190CK_DLL_MFUN( array_reset );
191CK_DLL_MFUN( array_zero );
190CK_DLL_MFUN( array_get_keys );192CK_DLL_MFUN( array_get_keys );
193CK_DLL_MFUN( array_reverse );
194CK_DLL_MFUN( array_shuffle );
191 195
192 196
193//-----------------------------------------------------------------------------197//-----------------------------------------------------------------------------
@@ -256,6 +260,37 @@ CK_DLL_MFUN( vec4_magnitude ); · 62 unmodified lines
256CK_DLL_MFUN( vec4_normalize );260CK_DLL_MFUN( vec4_normalize );
257 261
258 262
263//-----------------------------------------------------------------------------
264// type API | 1.5.0.0 (ge) added
265//-----------------------------------------------------------------------------
266CK_DLL_CTOR( type_ctor );
267CK_DLL_DTOR( type_dtor );
268CK_DLL_MFUN( type_equals );
269CK_DLL_MFUN( type_isa );
270CK_DLL_MFUN( type_isa_str );
271CK_DLL_MFUN( type_name );
272CK_DLL_MFUN( type_parent ); // return parent Type
273CK_DLL_MFUN( type_children ); // return children Types
274CK_DLL_MFUN( type_origin ); // built-in, chugin, defined in chuck
275CK_DLL_MFUN( type_isPrimitive );
276CK_DLL_MFUN( type_isArray );
277CK_DLL_MFUN( type_arrayDims );
278CK_DLL_SFUN( type_findString );
279CK_DLL_SFUN( type_typeOf_obj ); // Type.typeOf( Object )
280CK_DLL_SFUN( type_typeOf_int ); // Type.typeOf( int )
281CK_DLL_SFUN( type_typeOf_float ); // Type.typeOf( float )
282CK_DLL_SFUN( type_typeOf_time ); // Type.typeOf( time )
283CK_DLL_SFUN( type_typeOf_dur ); // Type.typeOf( dur )
284CK_DLL_SFUN( type_typeOf_complex ); // Type.typeOf( complex )
285CK_DLL_SFUN( type_typeOf_polar ); // Type.typeOf( polar )
286CK_DLL_SFUN( type_typeOf_vec3 ); // Type.typeOf( vec3 )
287CK_DLL_SFUN( type_typeOf_vec4 ); // Type.typeOf( vec4 )
288CK_DLL_SFUN( type_getTypes );
289CK_DLL_SFUN( type_getTypesAll );
290
291
292
293
259//-----------------------------------------------------------------------------294//-----------------------------------------------------------------------------
260// name: Data_Exception295// name: Data_Exception
261// desc: data for base Chuck Exception class296// desc: data for base Chuck Exception class
chuck/include/chuck_oo.h+48−13
@@ -98,6 +98,8 @@ public: · 97 unmodified lines
98 virtual void release();98 virtual void release();
99 // lock99 // lock
100 virtual void lock();100 virtual void lock();
101 // unlock | 1.5.0.0 (ge) added
102 virtual void unlock();
101 103
102 // NOTE: be careful when overriding these, should always104 // NOTE: be careful when overriding these, should always
103 // explicitly call up to ChucK_VM_Object (ge: 2013)105 // explicitly call up to ChucK_VM_Object (ge: 2013)
@@ -228,8 +230,14 @@ public: · 124 unmodified lines
228 virtual t_CKINT find( const std::string & key ) = 0; // find230 virtual t_CKINT find( const std::string & key ) = 0; // find
229 virtual t_CKINT erase( const std::string & key ) = 0; // erase231 virtual t_CKINT erase( const std::string & key ) = 0; // erase
230 virtual void clear( ) = 0; // clear232 virtual void clear( ) = 0; // clear
233 virtual void zero( t_CKUINT start, t_CKUINT end ) = 0; // zero
234 virtual void zero() = 0; // zero (all)
231 // get map keys | added (1.4.2.0) nshaheed235 // get map keys | added (1.4.2.0) nshaheed
232 virtual void get_keys( std::vector<std::string> & keys ) = 0;236 virtual void get_keys( std::vector<std::string> & keys ) = 0;
237 // reverse array order | added (1.5.0.0) azaday
238 virtual void reverse() = 0;
239 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
240 virtual void shuffle() = 0;
233 241
234 Chuck_Type * m_array_type;242 Chuck_Type * m_array_type;
235};243};
@@ -259,6 +267,7 @@ public: · 23 unmodified lines
259 t_CKINT pop_out( t_CKINT pos );267 t_CKINT pop_out( t_CKINT pos );
260 t_CKINT back( t_CKUINT * val ) const;268 t_CKINT back( t_CKUINT * val ) const;
261 void zero( t_CKUINT start, t_CKUINT end );269 void zero( t_CKUINT start, t_CKUINT end );
270 void zero() { this->zero(0, m_vector.size()); }
262 271
263 virtual void clear( );272 virtual void clear( );
264 virtual t_CKINT size( ) { return m_vector.size(); }273 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -271,11 +280,18 @@ public: · 6 unmodified lines
271 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY4_DATAKIND; }280 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY4_DATAKIND; }
272 // get map keys | added (1.4.2.0) nshaheed281 // get map keys | added (1.4.2.0) nshaheed
273 virtual void get_keys( std::vector<std::string> & keys );282 virtual void get_keys( std::vector<std::string> & keys );
283 // reverse array order | added (1.5.0.0) azaday
284 virtual void reverse();
285 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
286 virtual void shuffle();
274 287
275public:288public:
276 std::vector<t_CKUINT> m_vector;289 std::vector<t_CKUINT> m_vector;
277 std::map<std::string, t_CKUINT> m_map;290 std::map<std::string, t_CKUINT> m_map;
278 t_CKBOOL m_is_obj;291 t_CKBOOL m_is_obj;
292
293 // TODO: may need additional information here for set_size, if this is part of a multi-dim array
294
279 // t_CKINT m_size;295 // t_CKINT m_size;
280 // t_CKINT m_capacity;296 // t_CKINT m_capacity;
281};297};
@@ -305,6 +321,7 @@ public: · 23 unmodified lines
305 t_CKINT pop_out( t_CKINT pos );321 t_CKINT pop_out( t_CKINT pos );
306 t_CKINT back( t_CKFLOAT * val ) const;322 t_CKINT back( t_CKFLOAT * val ) const;
307 void zero( t_CKUINT start, t_CKUINT end );323 void zero( t_CKUINT start, t_CKUINT end );
324 void zero() { this->zero(0, m_vector.size()); }
308 325
309 virtual void clear( );326 virtual void clear( );
310 virtual t_CKINT size( ) { return m_vector.size(); }327 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -317,6 +334,10 @@ public: · 6 unmodified lines
317 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY8_DATAKIND; }334 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY8_DATAKIND; }
318 // get map keys | added (1.4.2.0) nshaheed335 // get map keys | added (1.4.2.0) nshaheed
319 virtual void get_keys( std::vector<std::string> & keys );336 virtual void get_keys( std::vector<std::string> & keys );
337 // reverse array order | added (1.5.0.0) azaday
338 virtual void reverse();
339 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
340 virtual void shuffle();
320 341
321public:342public:
322 std::vector<t_CKFLOAT> m_vector;343 std::vector<t_CKFLOAT> m_vector;
@@ -350,6 +371,7 @@ public: · 27 unmodified lines
350 t_CKINT pop_out( t_CKINT pos );371 t_CKINT pop_out( t_CKINT pos );
351 t_CKINT back( t_CKCOMPLEX * val ) const;372 t_CKINT back( t_CKCOMPLEX * val ) const;
352 void zero( t_CKUINT start, t_CKUINT end );373 void zero( t_CKUINT start, t_CKUINT end );
374 void zero() { this->zero(0, m_vector.size()); }
353 375
354 virtual void clear( );376 virtual void clear( );
355 virtual t_CKINT size( ) { return m_vector.size(); }377 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -362,6 +384,10 @@ public: · 6 unmodified lines
362 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY16_DATAKIND; }384 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY16_DATAKIND; }
363 // get map keys | added (1.4.2.0) nshaheed385 // get map keys | added (1.4.2.0) nshaheed
364 virtual void get_keys( std::vector<std::string> & keys );386 virtual void get_keys( std::vector<std::string> & keys );
387 // reverse array order | added (1.5.0.0) azaday
388 virtual void reverse();
389 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
390 virtual void shuffle();
365 391
366public:392public:
367 std::vector<t_CKCOMPLEX> m_vector;393 std::vector<t_CKCOMPLEX> m_vector;
@@ -395,6 +421,7 @@ public: · 27 unmodified lines
395 t_CKINT pop_out( t_CKUINT pos );421 t_CKINT pop_out( t_CKUINT pos );
396 t_CKINT back( t_CKVEC3 * val ) const;422 t_CKINT back( t_CKVEC3 * val ) const;
397 void zero( t_CKUINT start, t_CKUINT end );423 void zero( t_CKUINT start, t_CKUINT end );
424 void zero() { this->zero(0, m_vector.size()); }
398 425
399 virtual void clear( );426 virtual void clear( );
400 virtual t_CKINT size( ) { return m_vector.size(); }427 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -407,6 +434,10 @@ public: · 6 unmodified lines
407 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY24_DATAKIND; }434 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY24_DATAKIND; }
408 // get map keys | added (1.4.2.0) nshaheed435 // get map keys | added (1.4.2.0) nshaheed
409 virtual void get_keys( std::vector<std::string> & keys );436 virtual void get_keys( std::vector<std::string> & keys );
437 // reverse array order | added (1.5.0.0) azaday
438 virtual void reverse();
439 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
440 virtual void shuffle();
410 441
411public:442public:
412 std::vector<t_CKVEC3> m_vector;443 std::vector<t_CKVEC3> m_vector;
@@ -438,6 +469,7 @@ public: · 25 unmodified lines
438 t_CKINT pop_out( t_CKUINT pos );469 t_CKINT pop_out( t_CKUINT pos );
439 t_CKINT back( t_CKVEC4 * val ) const;470 t_CKINT back( t_CKVEC4 * val ) const;
440 void zero( t_CKUINT start, t_CKUINT end );471 void zero( t_CKUINT start, t_CKUINT end );
472 void zero() { this->zero(0, m_vector.size()); }
441 473
442 virtual void clear( );474 virtual void clear( );
443 virtual t_CKINT size( ) { return m_vector.size(); }475 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -450,6 +482,10 @@ public: · 6 unmodified lines
450 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY32_DATAKIND; }482 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY32_DATAKIND; }
451 // get map keys | added (1.4.1.2) nshaheed483 // get map keys | added (1.4.1.2) nshaheed
452 virtual void get_keys( std::vector<std::string> & keys );484 virtual void get_keys( std::vector<std::string> & keys );
485 // reverse array order | added (1.5.0.0) azaday
486 virtual void reverse();
487 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
488 virtual void shuffle();
453 489
454public:490public:
455 std::vector<t_CKVEC4> m_vector;491 std::vector<t_CKVEC4> m_vector;
@@ -589,15 +625,23 @@ public: · 133 unmodified lines
589 virtual void write( t_CKINT val, t_CKINT flags ) = 0;625 virtual void write( t_CKINT val, t_CKINT flags ) = 0;
590 virtual void write( t_CKFLOAT val ) = 0;626 virtual void write( t_CKFLOAT val ) = 0;
591 627
592 // constants
593public:628public:
629 // type | moved to IO in 1.5.0.0 (ge)
630 static const t_CKINT TYPE_ASCII;
631 static const t_CKINT TYPE_BINARY;
632 // datatype
594 static const t_CKINT INT32;633 static const t_CKINT INT32;
595 static const t_CKINT INT16;634 static const t_CKINT INT16;
596 static const t_CKINT INT8;635 static const t_CKINT INT8;
597 636 // flags | moved to IO in 1.5.0.0 (ge)
637 static const t_CKINT FLAG_READ_WRITE;
638 static const t_CKINT FLAG_READONLY;
639 static const t_CKINT FLAG_WRITEONLY;
640 static const t_CKINT FLAG_APPEND;
598 // asynchronous I/O members641 // asynchronous I/O members
599 static const t_CKINT MODE_SYNC;642 static const t_CKINT MODE_SYNC;
600 static const t_CKINT MODE_ASYNC;643 static const t_CKINT MODE_ASYNC;
644
601 Chuck_Event * m_asyncEvent;645 Chuck_Event * m_asyncEvent;
602 #ifndef __DISABLE_THREADS__646 #ifndef __DISABLE_THREADS__
603 XThread * m_thread;647 XThread * m_thread;
@@ -614,7 +658,7 @@ public: · 10 unmodified lines
614 658
615 659
616 660
617#ifndef __DISABLE_FILEIO__661// #ifndef __DISABLE_FILEIO__
618//-----------------------------------------------------------------------------662//-----------------------------------------------------------------------------
619// name: Chuck_IO_File663// name: Chuck_IO_File
620// desc: Chuck File IO class664// desc: Chuck File IO class
@@ -673,15 +717,6 @@ public: · 52 unmodified lines
673 static THREAD_RETURN ( THREAD_TYPE writeFloat_thread ) ( void *data );717 static THREAD_RETURN ( THREAD_TYPE writeFloat_thread ) ( void *data );
674 #endif718 #endif
675 719
676public:
677 // constants
678 static const t_CKINT FLAG_READ_WRITE;
679 static const t_CKINT FLAG_READONLY;
680 static const t_CKINT FLAG_WRITEONLY;
681 static const t_CKINT FLAG_APPEND;
682 static const t_CKINT TYPE_ASCII;
683 static const t_CKINT TYPE_BINARY;
684
685protected:720protected:
686 // open flags721 // open flags
687 t_CKINT m_flags;722 t_CKINT m_flags;
@@ -698,7 +733,7 @@ protected: · 10 unmodified lines
698 // vm and shred733 // vm and shred
699 Chuck_VM * m_vmRef;734 Chuck_VM * m_vmRef;
700};735};
701#endif // __DISABLE_FILEIO__736// #endif // __DISABLE_FILEIO__
702 737
703 738
704 739
chuck/include/chuck_parse.h+2−0
@@ -63,6 +63,8 @@ t_CKBOOL chuck_parse( c_constr fname, FILE * fd = NULL, c_constr code = NULL ); · 62 unmodified lines
63// reset the parser63// reset the parser
64void reset_parse( );64void reset_parse( );
65 65
66// convert abstract syntax expression to string
67std::string absyn2str( a_Exp exp );
66 68
67// syntax highlighting tools69// syntax highlighting tools
68#include <vector>70#include <vector>
chuck/include/chuck_type.h+77−16
@@ -84,6 +84,22 @@ typedef enum { · 83 unmodified lines
84 84
85 85
86 86
87//-----------------------------------------------------------------------------
88// name: enum te_Origin | 1.5.0.0 (ge) added
89// desc: where something (e.g., a Type) originates
90//-----------------------------------------------------------------------------
91typedef enum {
92 te_originUnknown = 0,
93 te_originBuiltin, // in core
94 te_originChugin, // in imported chugin
95 te_originImport, // library CK code
96 te_originUserDefined, // in user chuck code
97 te_originGenerated // generated (e.g., array types like int[][][][])
98} te_Origin;
99
100
101
102
87//-----------------------------------------------------------------------------103//-----------------------------------------------------------------------------
88// name: struct Chuck_Scope104// name: struct Chuck_Scope
89// desc: scoping structure105// desc: scoping structure
@@ -199,8 +215,15 @@ public: · 109 unmodified lines
199 return (T)val;215 return (T)val;
200 }216 }
201 217
218 // test if a name has been "mangled", e.g., "toString@0@Object"
219 static t_CKBOOL is_mangled( const std::string & name )
220 {
221 // check for @ in the name, which would not be possible for names in language
222 return ( name.find("@") != std::string::npos );
223 }
224
202 // get list of top level225 // get list of top level
203 void get_toplevel( std::vector<Chuck_VM_Object *> & out )226 void get_toplevel( std::vector<Chuck_VM_Object *> & out, t_CKBOOL includeMangled = TRUE )
204 {227 {
205 assert( scope.size() != 0 );228 assert( scope.size() != 0 );
206 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;229 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
@@ -213,13 +236,16 @@ public: · 6 unmodified lines
213 // go through map236 // go through map
214 for( iter = m->begin(); iter != m->end(); iter++ )237 for( iter = m->begin(); iter != m->end(); iter++ )
215 {238 {
239 // check mangled name
240 if( !includeMangled && is_mangled( std::string(S_name((*iter).first))) )
241 continue;
216 // add242 // add
217 out.push_back( (*iter).second );243 out.push_back( (*iter).second );
218 }244 }
219 }245 }
220 246
221 // get list of top level247 // get list of top level
222 void get_level( int level, std::vector<Chuck_VM_Object *> & out )248 void get_level( int level, std::vector<Chuck_VM_Object *> & out, t_CKBOOL includeMangled = TRUE )
223 {249 {
224 assert( scope.size() >= level );250 assert( scope.size() >= level );
225 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;251 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
@@ -232,12 +258,15 @@ public: · 6 unmodified lines
232 // go through map258 // go through map
233 for( iter = m->begin(); iter != m->end(); iter++ )259 for( iter = m->begin(); iter != m->end(); iter++ )
234 {260 {
261 // check mangled name
262 if( !includeMangled && is_mangled( std::string(S_name((*iter).first))) )
263 continue;
264
235 // add265 // add
236 out.push_back( (*iter).second );266 out.push_back( (*iter).second );
237 }267 }
238 }268 }
239 269
240
241protected:270protected:
242 std::vector<std::map<S_Symbol, Chuck_VM_Object *> *> scope;271 std::vector<std::map<S_Symbol, Chuck_VM_Object *> *> scope;
243 std::map<S_Symbol, Chuck_VM_Object *> commit_map;272 std::map<S_Symbol, Chuck_VM_Object *> commit_map;
@@ -324,7 +353,7 @@ struct Chuck_Namespace : public Chuck_VM_Object · 80 unmodified lines
324 // get top level values353 // get top level values
325 void get_values( std::vector<Chuck_Value *> & out );354 void get_values( std::vector<Chuck_Value *> & out );
326 // get top level functions355 // get top level functions
327 void get_funcs( std::vector<Chuck_Func *> & out );356 void get_funcs( std::vector<Chuck_Func *> & out, t_CKBOOL includeManged = TRUE );
328};357};
329 358
330 359
@@ -398,10 +427,15 @@ public: · 67 unmodified lines
398 // constructor427 // constructor
399 Chuck_Env();428 Chuck_Env();
400 429
430public:
431 // initialize
432 t_CKBOOL init();
433
401// REFACTOR-2017: carrier and accessors434// REFACTOR-2017: carrier and accessors
402public:435public:
403 void set_carrier( Chuck_Carrier * carrier ) { m_carrier = carrier; }436 void set_carrier( Chuck_Carrier * carrier ) { m_carrier = carrier; }
404 Chuck_VM * vm() { return m_carrier->vm; }437 Chuck_VM * vm() { return m_carrier ? m_carrier->vm : NULL; }
438 Chuck_Compiler * compiler() { return m_carrier ? m_carrier->compiler : NULL; }
405 439
406protected:440protected:
407 Chuck_Carrier * m_carrier;441 Chuck_Carrier * m_carrier;
@@ -533,12 +567,10 @@ public: · 125 unmodified lines
533 Chuck_Type * t_uanablob;567 Chuck_Type * t_uanablob;
534 Chuck_Type * t_shred;568 Chuck_Type * t_shred;
535 Chuck_Type * t_io;569 Chuck_Type * t_io;
536 #ifndef __DISABLE_FILEIO__
537 Chuck_Type * t_fileio;570 Chuck_Type * t_fileio;
538 #endif
539 Chuck_Type * t_chout;571 Chuck_Type * t_chout;
540 Chuck_Type * t_cherr;572 Chuck_Type * t_cherr;
541 Chuck_Type * t_thread;573 // Chuck_Type * t_thread;
542 Chuck_Type * t_class;574 Chuck_Type * t_class;
543 Chuck_Type * t_dac;575 Chuck_Type * t_dac;
544 Chuck_Type * t_adc;576 Chuck_Type * t_adc;
@@ -583,8 +615,9 @@ struct Chuck_UGen_Info : public Chuck_VM_Object · 38 unmodified lines
583//-----------------------------------------------------------------------------615//-----------------------------------------------------------------------------
584// name: struct Chuck_Type616// name: struct Chuck_Type
585// desc: class containing information about a type617// desc: class containing information about a type
586//-----------------------------------------------------------------------------_id618// note: 1.5.0.0 (ge) Chuck_VM_Object -> Chuck_Object
587struct Chuck_Type : public Chuck_VM_Object619//-----------------------------------------------------------------------------
620struct Chuck_Type : public Chuck_Object
588{621{
589 // type id622 // type id
590 te_Type xid;623 te_Type xid;
@@ -620,6 +653,8 @@ struct Chuck_Type : public Chuck_VM_Object · 29 unmodified lines
620 t_CKBOOL has_destructor;653 t_CKBOOL has_destructor;
621 // custom allocator654 // custom allocator
622 f_alloc allocator;655 f_alloc allocator;
656 // origin hint
657 te_Origin originHint;
623 658
624 // documentation659 // documentation
625 std::string doc;660 std::string doc;
@@ -839,7 +874,10 @@ t_CKBOOL isfunc( Chuck_Env * env, Chuck_Type * type ); · 213 unmodified lines
839t_CKBOOL iskindofint( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: this includes int + pointers874t_CKBOOL iskindofint( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: this includes int + pointers
840t_CKUINT getkindof( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: to get the kindof a type875t_CKUINT getkindof( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: to get the kindof a type
841 876
877
878//-----------------------------------------------------------------------------
842// import879// import
880//-----------------------------------------------------------------------------
843Chuck_Type * type_engine_import_class_begin( Chuck_Env * env, Chuck_Type * type,881Chuck_Type * type_engine_import_class_begin( Chuck_Env * env, Chuck_Type * type,
844 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor = NULL,882 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor = NULL,
845 const char * doc = NULL );883 const char * doc = NULL );
@@ -884,7 +922,10 @@ t_CKBOOL type_engine_import_class_end( Chuck_Env * env ); · 38 unmodified lines
884t_CKBOOL type_engine_register_deprecate( Chuck_Env * env,922t_CKBOOL type_engine_register_deprecate( Chuck_Env * env,
885 const std::string & former, const std::string & latter );923 const std::string & former, const std::string & latter );
886 924
887// helpers925
926//-----------------------------------------------------------------------------
927// helper functions
928//-----------------------------------------------------------------------------
888t_CKBOOL type_engine_check_reserved( Chuck_Env * env, const std::string & xid, int pos );929t_CKBOOL type_engine_check_reserved( Chuck_Env * env, const std::string & xid, int pos );
889t_CKBOOL type_engine_check_reserved( Chuck_Env * env, S_Symbol xid, int pos );930t_CKBOOL type_engine_check_reserved( Chuck_Env * env, S_Symbol xid, int pos );
890// 1.4.1.0 (ge): abilty to toggle reserved words for special cases, such as Math.pi co-existing with pi (use with care!)931// 1.4.1.0 (ge): abilty to toggle reserved words for special cases, such as Math.pi co-existing with pi (use with care!)
@@ -893,17 +934,21 @@ t_CKBOOL type_engine_check_primitive( Chuck_Env * env, Chuck_Type * type ); · 2 unmodified lines
893t_CKBOOL type_engine_check_const( Chuck_Env * env, a_Exp e, int pos ); // TODO934t_CKBOOL type_engine_check_const( Chuck_Env * env, a_Exp e, int pos ); // TODO
894t_CKBOOL type_engine_compat_func( a_Func_Def lhs, a_Func_Def rhs, int pos, std::string & err, t_CKBOOL print = TRUE );935t_CKBOOL type_engine_compat_func( a_Func_Def lhs, a_Func_Def rhs, int pos, std::string & err, t_CKBOOL print = TRUE );
895t_CKBOOL type_engine_get_deprecate( Chuck_Env * env, const std::string & from, std::string & to );936t_CKBOOL type_engine_get_deprecate( Chuck_Env * env, const std::string & from, std::string & to );
937t_CKBOOL type_engine_is_base_static( Chuck_Env * env, Chuck_Type * baseType ); // 1.5.0.0 (ge) added
896Chuck_Type * type_engine_find_common_anc( Chuck_Type * lhs, Chuck_Type * rhs );938Chuck_Type * type_engine_find_common_anc( Chuck_Type * lhs, Chuck_Type * rhs );
897Chuck_Type * type_engine_find_type( Chuck_Env * env, a_Id_List path );939Chuck_Type * type_engine_find_type( Chuck_Env * env, a_Id_List path );
940Chuck_Type * type_engine_find_type( Chuck_Env * env, const std::string & name ); // 1.5.0.0 (ge) added
898Chuck_Value * type_engine_find_value( Chuck_Type * type, const std::string & xid );941Chuck_Value * type_engine_find_value( Chuck_Type * type, const std::string & xid );
899Chuck_Value * type_engine_find_value( Chuck_Type * type, S_Symbol xid );942Chuck_Value * type_engine_find_value( Chuck_Type * type, S_Symbol xid );
900Chuck_Value * type_engine_find_value( Chuck_Env * env, const std::string & xid, t_CKBOOL climb, int linepos = 0 );943Chuck_Value * type_engine_find_value( Chuck_Env * env, const std::string & xid, t_CKBOOL climb, int linepos = 0 );
901Chuck_Namespace * type_engine_find_nspc( Chuck_Env * env, a_Id_List path );944Chuck_Namespace * type_engine_find_nspc( Chuck_Env * env, a_Id_List path );
902/*******************************************************************************945
903 * spencer: added this into function to provide the same logic path946
904 * for type_engine_check_exp_decl() and ck_add_mvar() when they determine947//-----------------------------------------------------------------------------
905 * offsets for mvars -- added 1.3.0.0948// spencer: added this into function to provide the same logic path
906 ******************************************************************************/949// for type_engine_check_exp_decl() and ck_add_mvar() when they determine
950// offsets for mvars -- added 1.3.0.0
951//-----------------------------------------------------------------------------
907t_CKUINT type_engine_next_offset( t_CKUINT current_offset, Chuck_Type * type );952t_CKUINT type_engine_next_offset( t_CKUINT current_offset, Chuck_Type * type );
908// array verify953// array verify
909t_CKBOOL verify_array( a_Array_Sub array );954t_CKBOOL verify_array( a_Array_Sub array );
@@ -914,7 +959,11 @@ Chuck_Type * new_array_type( Chuck_Env * env, Chuck_Type * array_parent, · 4 unmodified lines
914// make type | 1.4.1.1 (nshaheed) added959// make type | 1.4.1.1 (nshaheed) added
915Chuck_Type * new_array_element_type( Chuck_Env * env, Chuck_Type * base_type,960Chuck_Type * new_array_element_type( Chuck_Env * env, Chuck_Type * base_type,
916 t_CKUINT depth, Chuck_Namespace * owner_nspc);961 t_CKUINT depth, Chuck_Namespace * owner_nspc);
962
963
964//-----------------------------------------------------------------------------
917// conversion965// conversion
966//-----------------------------------------------------------------------------
918const char * type_path( a_Id_List path );967const char * type_path( a_Id_List path );
919a_Id_List str2list( const std::string & path );968a_Id_List str2list( const std::string & path );
920a_Id_List str2list( const std::string & path, t_CKBOOL & is_array );969a_Id_List str2list( const std::string & path, t_CKBOOL & is_array );
@@ -922,7 +971,19 @@ const char * howmuch2str( te_HowMuch how_much ); · 1 unmodified line
922t_CKBOOL escape_str( char * str_lit, int linepos );971t_CKBOOL escape_str( char * str_lit, int linepos );
923t_CKINT str2char( const char * char_lit, int linepos );972t_CKINT str2char( const char * char_lit, int linepos );
924 973
974
975//-----------------------------------------------------------------------------
976// more helper functions for type scan and checking | 1.5.0.0 (ge) added
977//-----------------------------------------------------------------------------
978// compare two argument lists to see if they are the same (sequence of types)
979t_CKBOOL same_arg_lists( a_Arg_List lhs, a_Arg_List rhs );
980// generate a string from an argument list (types only)
981std::string arglist2string( a_Arg_List list );
982
983
984//-----------------------------------------------------------------------------
925// REFACTOR-2017: exile! these default types now stored in env985// REFACTOR-2017: exile! these default types now stored in env
986//-----------------------------------------------------------------------------
926//extern Chuck_Type t_void;987//extern Chuck_Type t_void;
927//extern Chuck_Type t_int;988//extern Chuck_Type t_int;
928//extern Chuck_Type t_float;989//extern Chuck_Type t_float;
chuck/include/ugen_stk.h+4−6
@@ -95,7 +95,7 @@ t_CKBOOL stk_detach( Chuck_Carrier * carrier ); · 94 unmodified lines
95// versions higher than 4.1.2 and replaced with the variable95// versions higher than 4.1.2 and replaced with the variable
96// "StkFloat".96// "StkFloat".
97//typedef double StkFloat;97//typedef double StkFloat;
98//#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)98//#if defined(__PLATFORM_WIN32__) ||
99// #pragma deprecated(MY_FLOAT)99// #pragma deprecated(MY_FLOAT)
100//#else100//#else
101// typedef StkFloat MY_FLOAT __attribute__ ((deprecated));101// typedef StkFloat MY_FLOAT __attribute__ ((deprecated));
@@ -250,7 +250,7 @@ typedef double FLOAT64; · 148 unmodified lines
250#if defined(__WINDOWS_PTHREAD__)250#if defined(__WINDOWS_PTHREAD__)
251 #define __OS_WINDOWS_CYGWIN__251 #define __OS_WINDOWS_CYGWIN__
252 #define __STK_REALTIME__252 #define __STK_REALTIME__
253#elif defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)253#elif defined(__PLATFORM_WIN32__)
254 #define __OS_WINDOWS__254 #define __OS_WINDOWS__
255 #define __STK_REALTIME__255 #define __STK_REALTIME__
256#elif defined(__PLATFORM_LINUX__)256#elif defined(__PLATFORM_LINUX__)
@@ -497,10 +497,9 @@ class Instrmnt : public Stk · 240 unmodified lines
497 virtual void controlChange(int number, MY_FLOAT value);497 virtual void controlChange(int number, MY_FLOAT value);
498 498
499public: // SWAP formerly protected499public: // SWAP formerly protected
500 MY_FLOAT lastOutput;
500 // chuck501 // chuck
501 t_CKFLOAT m_frequency;502 t_CKFLOAT m_frequency;
502
503 MY_FLOAT lastOutput;
504};503};
505 504
506 505
@@ -1587,7 +1586,6 @@ class FM : public Instrmnt · 1080 unmodified lines
1587 MY_FLOAT __FM_gains[100];1586 MY_FLOAT __FM_gains[100];
1588 MY_FLOAT __FM_susLevels[16];1587 MY_FLOAT __FM_susLevels[16];
1589 MY_FLOAT __FM_attTimes[32];1588 MY_FLOAT __FM_attTimes[32];
1590
1591};1589};
1592 1590
1593#endif1591#endif
@@ -5195,7 +5193,7 @@ class Sitar : public Instrmnt · 3601 unmodified lines
5195 The user is responsible for checking the values5193 The user is responsible for checking the values
5196 returned by the read/write methods. Values5194 returned by the read/write methods. Values
5197 less than or equal to zero indicate a closed5195 less than or equal to zero indicate a closed
5198 or lost connection or the occurence of an error.5196 or lost connection or the occurrence of an error.
5199 5197
5200 by Perry R. Cook and Gary P. Scavone, 1995 - 2002.5198 by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
5201*/5199*/
chuck/include/ulib_ai.h+159−19
@@ -24,17 +24,66 @@ · 23 unmodified lines
24 24
25//-----------------------------------------------------------------------------25//-----------------------------------------------------------------------------
26// file: ulib_ai.h26// file: ulib_ai.h
27// desc: class library for libAI -- part of ChAI (ChucK for AI)27// desc: Music and AI class library; part of ChAI (ChucK for AI)
28//28//
29// author: Ge Wang (ge@ccrma.stanford.edu)29// date: Fall 2022 -- present
30// Yikai Li (yikaili@stanford.edu)30// authors: Ge Wang (ge@ccrma.stanford.edu)
31// date: Fall 202231// Yikai Li (yikaili@stanford.edu)
32//
33// (HISTORICAL NOTE)
34// Much of ChAI and its ways of thinking and doing can be foundationally
35// attributed to the work of Dr. Rebecca Fiebrink, her landmark Ph.D. Thesis,
36// /Real-time Human Interaction With Supervised Learning Algorithms for Music
37// Composition and Performance/ (2011) [1], the Wekinator framework [2], her
38// teaching at the intersections of AI, HCI, and Music [3], as well as earlier
39// collaborations between Rebecca and Ge [4,5] including SMIRK [6] (Small Musical
40// Information Retrieval toolKit; 2008; MARSYAS and the MIR work of Dr. George
41// Tzanetakis; early efforts in on-the-fly learning), the unit analyzer
42// framework [7] (2007; afford real-time audio feature extraction). All of
43// these have directly or indirectly contributed the creation of ChAI.
44// Additionally, ChAI benefitted from the teaching and design philosophy of
45// Dr. Perry R. Cook (Ph.D. advisor to Rebecca, George, and Ge at Princeton,
46// and ChucK co-author), who argued for real-time human interaction, parametric
47// sound synthesis, and the importance of play in the design of musical tools.
48//
49// [1] Fiebrink, Rebecca. 2011. /Real-time Human Interaction With Supervised
50// Learning Algorithms for Music Composition and Performance/ Ph.D. Thesis.
51// Princeton University. https://www.cs.princeton.edu/techreports/2010/891.pdf
52//
53// [2] http://www.wekinator.org/
54// Wekinator | Software for real-time, interactive machine learning
55//
56// [3] Fiebrink, Rebecca. "Machine Learning for Musicians and Artists" MOOC
57// https://www.kadenze.com/courses/machine-learning-for-musicians-and-artists/info
58//
59// [4] Fiebrink, R., G. Wang, P. R. Cook. 2008. "Foundations for On-the-fly
60// Learning in the ChucK Programming Language." /International Computer Music
61// Conference/. https://mcd.stanford.edu/publish/files/2008-icmc-learning.pdf
62//
63// [5] Fiebrink, R., G. Wang, P. R. Cook. 2008. "Support for Music Information
64// Retrieval in the ChucK Programming Language." /International Conference
65// on Music Information Retrieval/ (ISMIR).
66// https://mcd.stanford.edu/publish/files/2008-ismir-proto.pdf
67//
68// [6] http://smirk.cs.princeton.edu/
69// sMIRk | Small Music Information Retrieval toolKit
70//
71// [7] Tzanetakis, G. and P. R. Cook. 2000 "MARSYAS: A Framework for Audio
72// Analysis." Organised Sound. 4:(3)
73//
74// [8] Tzanetakis, G. and P. R. Cook. 2002 "Musical Genre Classification of
75// Audio Signals." IEEE Transaction on Speech and Audio Processing. 10(5).
76//
77// [9] Wang, G., R. Fiebrink, P. R. Cook. 2007. "Combining Analysis and
78// Synthesis in the ChucK Programming Language." /International Computer
79// Music Conference/. https://mcd.stanford.edu/publish/files/2007-icmc-uana.pdf
32//-----------------------------------------------------------------------------80//-----------------------------------------------------------------------------
33#ifndef __ULIB_AI_H__81#ifndef __ULIB_AI_H__
34#define __ULIB_AI_H__82#define __ULIB_AI_H__
35 83
36#include "chuck_dl.h"84#include "chuck_dl.h"
37#include "chuck_errmsg.h"85#include "chuck_errmsg.h"
86#include "util_math.h"
38 87
39 88
40 89
@@ -86,7 +135,7 @@ public: · 45 unmodified lines
86 if( !m_matrix )135 if( !m_matrix )
87 {136 {
88 // error137 // error
89 CK_FPRINTF_STDERR( "[chuck]: ChaiMatrixFast allocation failure: %s, %d x %d...",138 CK_FPRINTF_STDERR( "[chuck]: ChaiMatrixFast allocation failure: %s, %d x %d...\n",
90 typeid( T ).name(), xDim, yDim );139 typeid( T ).name(), xDim, yDim );
91 // bail140 // bail
92 return FALSE;141 return FALSE;
@@ -106,18 +155,22 @@ public: · 13 unmodified lines
106 if( x < 0 || x >= m_xDim || y < 0 || y >= m_yDim )155 if( x < 0 || x >= m_xDim || y < 0 || y >= m_yDim )
107 {156 {
108 // error157 // error
109 CK_FPRINTF_STDERR( "[chuck]: ChaiMatrixFast out of bound: %s[%d][%d]...",158 CK_FPRINTF_STDERR( "[chuck]: ChaiMatrixFast out of bound: %s[%d][%d]...\n",
110 typeid( T ).name(), x, y );159 typeid( T ).name(), x, y );
111 // halt160 // halt
112 // TODO: this should throw (a shred-level, probably) exception161 // TODO: this should throw (a shred-level, probably) exception
113 assert( FALSE );162 assert( FALSE );
114 }163 }
115 164
116 // NOTE: this is NOT bound-checked!!!
117 // NOTE: yet, this is arguably no worse than using c 2d arrays
118 return m_matrix[x * m_yDim + y];165 return m_matrix[x * m_yDim + y];
119 }166 }
120 167
168 // overloaded operator
169 T & operator()( t_CKINT x, t_CKINT y )
170 {
171 return v( x, y );
172 }
173
121 // get dimensions174 // get dimensions
122 t_CKINT xDim() const175 t_CKINT xDim() const
123 { return m_xDim; }176 { return m_xDim; }
@@ -138,9 +191,6 @@ protected: · 14 unmodified lines
138 t_CKINT m_yDim;191 t_CKINT m_yDim;
139};192};
140 193
141
142
143
144//-----------------------------------------------------------------------------194//-----------------------------------------------------------------------------
145// name: class ChaiVectorFast | 1.4.2.0 (ge) added195// name: class ChaiVectorFast | 1.4.2.0 (ge) added
146// desc: a templated fast access but not bound-checked 1D array196// desc: a templated fast access but not bound-checked 1D array
@@ -185,7 +235,7 @@ public: · 38 unmodified lines
185 if( !m_vector )235 if( !m_vector )
186 {236 {
187 // error237 // error
188 CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast allocation failure: %s[%d]...",238 CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast allocation failure: %s[%d]...\n",
189 typeid( T ).name(), length );239 typeid( T ).name(), length );
190 // bail240 // bail
191 return FALSE;241 return FALSE;
@@ -197,30 +247,69 @@ public: · 5 unmodified lines
197 return TRUE;247 return TRUE;
198 }248 }
199 249
250 void shuffle()
251 {
252 T temp;
253 t_CKINT j;
254 for( t_CKINT i = m_length - 1; i > 0; i-- )
255 {
256 j = ck_random() % ( i + 1 );
257 temp = m_vector[i];
258 m_vector[i] = m_vector[j];
259 m_vector[j] = temp;
260 }
261 }
262
200 t_CKUINT length()263 t_CKUINT length()
201 { return m_length; }264 { return m_length; }
202 265
203 t_CKINT size()266 t_CKINT size()
204 { return m_length; }267 { return m_length; }
205 268
206 // get element value269 T getMax()
207 T & v( t_CKINT i )270 {
271 T max = m_vector[0];
272 for( t_CKINT i = 1; i < m_length; i++ )
273 {
274 if( m_vector[i] > max )
275 {
276 max = m_vector[i];
277 }
278 }
279 return max;
280 }
281
282 void setAll( T value )
283 {
284 // iterate
285 for( t_CKINT i = 0; i < m_length; i++ )
286 {
287 // set to value
288 m_vector[i] = value;
289 }
290 }
291
292 T & operator[]( t_CKINT i )
208 {293 {
209 // at least do a check294 // at least do a check
210 if( i < 0 || i >= m_length )295 if( i < 0 || i >= m_length )
211 {296 {
212 // error297 // error
213 CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast out of bound: %s[%d]...",298 CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast out of bound: %s[%d] (capacity=%d)...\n",
214 typeid( T ).name(), i );299 typeid( T ).name(), i, m_length );
215 // TODO: this should throw (a shred-level, probably) exception300 // TODO: this should throw (a shred-level, probably) exception
216 assert( FALSE );301 assert( FALSE );
217 }302 }
218 303
219 // NOTE: this is NOT bound-checked!!!
220 // NOTE: yet, this is arguably no worse than using c arrays
221 return m_vector[i];304 return m_vector[i];
222 }305 }
223 306
307 // get element value
308 T & v( t_CKINT i )
309 {
310 return ( *this )[i];
311 }
312
224 void cleanup()313 void cleanup()
225 {314 {
226 // reclaim array memory and zero the pointer315 // reclaim array memory and zero the pointer
@@ -229,9 +318,60 @@ public: · 2 unmodified lines
229 m_length = 0;318 m_length = 0;
230 }319 }
231 320
232protected:321public:
233 T * m_vector;322 T * m_vector;
234 t_CKINT m_length;323 t_CKINT m_length;
235};324};
236 325
237#endif326#endif
327
328#ifndef _KD_TREE_H
329#define _KD_TREE_H
330
331#include <float.h>
332// #define DBL_EPSILON 2.2204460492503131e-16
333
334#define KDTREE_MAX_LEVEL 64
335#define KDTREE_LEFT_INDEX 0
336#define KDTREE_RIGHT_INDEX 1
337
338typedef struct knn_list
339{
340 struct kdnode * node;
341 double distance;
342 struct knn_list * prev;
343 struct knn_list * next;
344} knn_list_t;
345
346typedef struct kdnode
347{
348 long coord_index;
349 double * coord;
350 struct kdnode * left;
351 struct kdnode * right;
352 t_CKINT r;
353} kdnode_t;
354
355typedef struct kdtree
356{
357 struct kdnode * root;
358 size_t count;
359 size_t capacity;
360 double * coords;
361 double ** coord_table;
362 long * coord_indexes;
363 unsigned char * coord_deleted;
364 unsigned char * coord_passed;
365 struct knn_list knn_list_head;
366 t_CKINT dim;
367 t_CKINT knn_num;
368} kdtree_t;
369
370struct kdtree * kdtree_init( t_CKINT dim );
371void kdtree_insert( struct kdtree * tree, double * coord );
372void kdtree_rebuild( struct kdtree * tree );
373void kdtree_knn_search( struct kdtree * tree, double * coord, t_CKINT k );
374void kdtree_destroy( struct kdtree * tree );
375void kdtree_dump( struct kdtree * tree );
376
377#endif /* _KD_TREE_H */
chuck/include/ulib_machine.h+8−11
@@ -42,24 +42,21 @@ struct Chuck_Compiler; · 41 unmodified lines
42 42
43// query43// query
44DLL_QUERY machine_query( Chuck_DL_Query * QUERY );44DLL_QUERY machine_query( Chuck_DL_Query * QUERY );
45
46#ifndef __DISABLE_OTF_SERVER__
45typedef t_CKUINT (* proc_msg_func)( Chuck_VM *, Chuck_Compiler *,47typedef t_CKUINT (* proc_msg_func)( Chuck_VM *, Chuck_Compiler *,
46 Net_Msg *, t_CKBOOL, void * );48 Net_Msg *, t_CKBOOL, void * );
47t_CKBOOL machine_init( Chuck_Compiler * compiler, proc_msg_func func );49t_CKBOOL machine_init( Chuck_Compiler * compiler, proc_msg_func func );
48// 1.4.0.1: TODO: refactor out of ulib machine; not all platforms have OTF50// 1.4.0.1: TODO: refactor out of ulib machine; not all platforms have OTF
51#endif // __DISABLE_OTF_SERVER__
52
53// machine exports
49t_CKUINT machine_intsize();54t_CKUINT machine_intsize();
50 55
51 56
52// exports57// ckdoc query
53CK_DLL_SFUN( machine_crash_impl );58DLL_QUERY ckdoc_query( Chuck_DL_Query * QUERY );
54CK_DLL_SFUN( machine_add_impl );59
55CK_DLL_SFUN( machine_spork_impl );
56CK_DLL_SFUN( machine_remove_impl );
57CK_DLL_SFUN( machine_replace_impl );
58CK_DLL_SFUN( machine_status_impl );
59CK_DLL_SFUN( machine_intsize_impl );
60CK_DLL_SFUN( machine_shreds_impl );
61CK_DLL_SFUN( machine_realtime_impl );
62CK_DLL_SFUN( machine_silent_impl );
63 60
64 61
65#endif62#endif
chuck/include/ulib_math.h+11−0
@@ -90,6 +90,17 @@ CK_DLL_SFUN( srandom_impl ); · 89 unmodified lines
90 90
91CK_DLL_SFUN( gauss_impl );91CK_DLL_SFUN( gauss_impl );
92 92
93CK_DLL_SFUN( cossim_impl );
94CK_DLL_SFUN( cossim3d_impl );
95CK_DLL_SFUN( cossim4d_impl );
96
97CK_DLL_SFUN( euclidean_impl );
98CK_DLL_SFUN( euclidean3d_impl );
99CK_DLL_SFUN( euclidean4d_impl );
100
101CK_DLL_SFUN( map_impl );
102CK_DLL_SFUN( map2_impl );
103
93 104
94 105
95 106
chuck/include/util_hid.h+2−0
@@ -32,6 +32,8 @@ · 31 unmodified lines
32#ifndef __UTIL_HID_H__32#ifndef __UTIL_HID_H__
33#define __UTIL_HID_H__33#define __UTIL_HID_H__
34 34
35#include "chuck_def.h"
36
35 37
36 38
37 39
chuck/include/util_math.h+2−1
@@ -34,6 +34,7 @@ · 33 unmodified lines
34#define __UTIL_MATH_H__34#define __UTIL_MATH_H__
35 35
36#include <math.h>36#include <math.h>
37#include "chuck_def.h" // 1.4.1.0 (ge) for t_CKINT
37 38
38#if defined (__cplusplus) || defined(_cplusplus)39#if defined (__cplusplus) || defined(_cplusplus)
39extern "C" {40extern "C" {
@@ -52,7 +53,7 @@ double ck_remainder( double a, double b ); · 12 unmodified lines
52 53
53 54
54// max for random functions55// max for random functions
55#ifdef __WINDOWS_DS__56#ifdef __PLATFORM_WIN32__
56#define CK_RANDOM_MAX RAND_MAX57#define CK_RANDOM_MAX RAND_MAX
57#else58#else
58#define CK_RANDOM_MAX 0x7fffffff59#define CK_RANDOM_MAX 0x7fffffff
chuck/include/util_network.h+1−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
41#include <sys/socket.h>41#include <sys/socket.h>
42#include <netinet/in.h>42#include <netinet/in.h>
43#else43#else
44#define _WINSOCKAPI_
44#include <windows.h>45#include <windows.h>
45#endif46#endif
46 47
chuck/include/util_opsc.h+1−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
41 41
42// the included files were from the CNMAT OSC-Kit distrib.42// the included files were from the CNMAT OSC-Kit distrib.
43#ifdef __PLATFORM_WIN32__43#ifdef __PLATFORM_WIN32__
44#define _WINSOCKAPI_
44#include <windows.h>45#include <windows.h>
45#endif46#endif
46 47
chuck/include/util_serial.h+2−0
@@ -32,6 +32,8 @@ · 31 unmodified lines
32#ifndef __UTIL_SERIAL_H__32#ifndef __UTIL_SERIAL_H__
33#define __UTIL_SERIAL_H__33#define __UTIL_SERIAL_H__
34 34
35#include "chuck_def.h"
36
35#include <vector>37#include <vector>
36#include <string>38#include <string>
37 39
chuck/include/util_sndfile.h+7−1
@@ -1748,7 +1748,13 @@ enum · 1747 unmodified lines
1748{1748{
1749 /* keep sorted for wav_w64_format_str() */1749 /* keep sorted for wav_w64_format_str() */
1750 WAVE_FORMAT_UNKNOWN = 0x0000, /* Microsoft Corporation */1750 WAVE_FORMAT_UNKNOWN = 0x0000, /* Microsoft Corporation */
1751 WAVE_FORMAT_PCM = 0x0001, /* Microsoft PCM format */1751 WAVE_FORMAT_MS_PCM = 0x0001, /* Microsoft PCM format */
1752 /* -------------------------------------------------------------------------
1753 creating and using WAVE_FORMAT_MS_PCM in this module, as WAVE_FORMAT_PCM may
1754 be defined by windows, e.g., in mmeapi.h -- which breaks the build...thanks
1755 important: WAVE_FORMAT_MS_PCM must be 1, as WAV format tag | 1.5.0.0 (ge)
1756 ------------------------------------------------------------------------- */
1757 /* WAVE_FORMAT_PCM = 0x0001, */ /* Microsoft PCM format */
1752 WAVE_FORMAT_MS_ADPCM = 0x0002, /* Microsoft ADPCM */1758 WAVE_FORMAT_MS_ADPCM = 0x0002, /* Microsoft ADPCM */
1753 WAVE_FORMAT_IEEE_FLOAT = 0x0003, /* Micrososft 32 bit float format */1759 WAVE_FORMAT_IEEE_FLOAT = 0x0003, /* Micrososft 32 bit float format */
1754 WAVE_FORMAT_VSELP = 0x0004, /* Compaq Computer Corporation */1760 WAVE_FORMAT_VSELP = 0x0004, /* Compaq Computer Corporation */
chuginate/template/chuck/include/chuck.h+15−17
@@ -1,21 +1,21 @@
1/*----------------------------------------------------------------------------1/*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine3 Compiler and Virtual Machine
4 4
5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.stanford.edu/6 http://chuck.stanford.edu/
7 http://chuck.cs.princeton.edu/7 http://chuck.cs.princeton.edu/
8 8
9 This program is free software; you can redistribute it and/or modify9 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 by10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful,14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-130721 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -24,10 +24,10 @@ · 2 unmodified lines
24 24
25//-----------------------------------------------------------------------------25//-----------------------------------------------------------------------------
26// file: chuck.h26// file: chuck.h
27// desc: chuck engine header; VM + compiler + state; no audio I/O27// desc: chuck engine header; VM + compiler + state; independent of audio I/O
28// REFACTOR-201728// REFACTOR-2017
29//29//
30// author: Ge Wang (http://www.gewang.com/)30// author: Ge Wang (https://ccrma.stanford.edu/~ge/)
31// date: fall 201731// date: fall 2017
32//32//
33// additional authors:33// additional authors:
@@ -99,7 +99,7 @@ public: · 65 unmodified lines
99 ChucK();99 ChucK();
100 // desctructor100 // desctructor
101 virtual ~ChucK();101 virtual ~ChucK();
102 102
103public:103public:
104 // set parameter by name104 // set parameter by name
105 // -- all params should have reasonable defaults105 // -- all params should have reasonable defaults
@@ -115,9 +115,9 @@ public: · 9 unmodified lines
115 115
116public:116public:
117 // compile a file (can be called anytime)117 // compile a file (can be called anytime)
118 bool compileFile( const std::string & path, const std::string & argsTogether, int count = 1 );118 bool compileFile( const std::string & path, const std::string & argsTogether, t_CKINT count = 1 );
119 // compile code directly119 // compile code directly
120 bool compileCode( const std::string & code, const std::string & argsTogether, int count = 1 );120 bool compileCode( const std::string & code, const std::string & argsTogether, t_CKINT count = 1 );
121 121
122public:122public:
123 // initialize ChucK (using params)123 // initialize ChucK (using params)
@@ -127,12 +127,12 @@ public: · 3 unmodified lines
127 127
128public:128public:
129 // run engine (call from callback)129 // run engine (call from callback)
130 void run( SAMPLE * input, SAMPLE * output, int numFrames );130 void run( SAMPLE * input, SAMPLE * output, t_CKINT numFrames );
131 131
132public:132public:
133 // is initialized133 // is initialized
134 bool isInit() { return m_init; }134 bool isInit() { return m_init; }
135 135
136public:136public:
137 // additional native chuck bindings/types (use with extra caution)137 // additional native chuck bindings/types (use with extra caution)
138 bool bind( f_ck_query queryFunc, const std::string & name );138 bool bind( f_ck_query queryFunc, const std::string & name );
@@ -175,12 +175,10 @@ protected: · 36 unmodified lines
175public: // static functions175public: // static functions
176 // chuck version176 // chuck version
177 static const char * version();177 static const char * version();
178 #ifndef __DISABLE_OTF_SERVER__
179 // chuck int size (in bits)178 // chuck int size (in bits)
180 // (this depends on machine, which depends on OTF, so179 // (this depends on machine, which depends on OTF, so disable it if we don't have OTF)
181 // disable it if we don't have OTF)180 // 1.5.0.0 (ge) | reinstated for non-OTF, along with parts of machine
182 static t_CKUINT intSize();181 static t_CKUINT intSize();
183 #endif
184 // number of ChucK's182 // number of ChucK's
185 static t_CKUINT numVMs() { return o_numVMs; };183 static t_CKUINT numVMs() { return o_numVMs; };
186 // --poop compatibilty184 // --poop compatibilty
@@ -197,7 +195,7 @@ protected: · 10 unmodified lines
197 static const char VERSION[];195 static const char VERSION[];
198 // number of VMs -- managed from VM constructor/destructors196 // number of VMs -- managed from VM constructor/destructors
199 static t_CKUINT o_numVMs;197 static t_CKUINT o_numVMs;
200 198
201protected:199protected:
202 // initialize default params200 // initialize default params
203 void initDefaultParams();201 void initDefaultParams();
@@ -209,7 +207,7 @@ protected: · 5 unmodified lines
209 bool initChugins();207 bool initChugins();
210 // init OTF programming system208 // init OTF programming system
211 bool initOTF();209 bool initOTF();
212 210
213protected:211protected:
214 // core elements: compiler, VM, etc.212 // core elements: compiler, VM, etc.
215 Chuck_Carrier * m_carrier;213 Chuck_Carrier * m_carrier;
chuginate/template/chuck/include/chuck.tab.h+1−1
@@ -266,7 +266,7 @@ · 265 unmodified lines
266 266
267#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED267#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
268typedef union YYSTYPE268typedef union YYSTYPE
269#line 62 "chuck.y"269#line 65 "chuck.y"
270{270{
271 int pos;271 int pos;
272 int ival;272 int ival;
chuginate/template/chuck/include/chuck_absyn.h+15−14
@@ -52,7 +52,7 @@ typedef enum { · 51 unmodified lines
52 ae_op_s_or_chuck, ae_op_s_xor_chuck, ae_op_shift_right_chuck,52 ae_op_s_or_chuck, ae_op_s_xor_chuck, ae_op_shift_right_chuck,
53 ae_op_shift_left_chuck, ae_op_percent_chuck, ae_op_s_chuck,53 ae_op_shift_left_chuck, ae_op_percent_chuck, ae_op_s_chuck,
54 ae_op_plusplus, ae_op_minusminus, ae_op_tilda, ae_op_exclamation,54 ae_op_plusplus, ae_op_minusminus, ae_op_tilda, ae_op_exclamation,
55 ae_op_at_chuck, ae_op_unchuck, ae_op_upchuck, ae_op_spork, 55 ae_op_at_chuck, ae_op_unchuck, ae_op_upchuck, ae_op_spork,
56 ae_op_typeof, ae_op_sizeof, ae_op_new, ae_op_arrow_left, ae_op_arrow_right56 ae_op_typeof, ae_op_sizeof, ae_op_new, ae_op_arrow_left, ae_op_arrow_right
57} ae_Operator;57} ae_Operator;
58 58
@@ -118,7 +118,7 @@ typedef struct a_Vec_ * a_Vec; // ge: added 1.3.5.3 · 59 unmodified lines
118 118
119// forward reference for type119// forward reference for type
120typedef struct Chuck_Type * t_CKTYPE;120typedef struct Chuck_Type * t_CKTYPE;
121typedef struct Chuck_Value * t_CKVALUE; 121typedef struct Chuck_Value * t_CKVALUE;
122typedef struct Chuck_Func * t_CKFUNC;122typedef struct Chuck_Func * t_CKFUNC;
123typedef struct Chuck_Namespace * t_CKNSPC;123typedef struct Chuck_Namespace * t_CKNSPC;
124typedef struct Chuck_VM_Code * t_CKVMCODE;124typedef struct Chuck_VM_Code * t_CKVMCODE;
@@ -226,10 +226,11 @@ struct a_Exp_Decl_ { a_Type_Decl type; a_Var_Decl_List var_decl_list; int num_va · 101 unmodified lines
226 t_CKTYPE ck_type; int linepos; a_Exp self; };226 t_CKTYPE ck_type; int linepos; a_Exp self; };
227struct a_Exp_Hack_ { a_Exp exp; int linepos; a_Exp self; };227struct a_Exp_Hack_ { a_Exp exp; int linepos; a_Exp self; };
228struct a_Var_Decl_List_ { a_Var_Decl var_decl; a_Var_Decl_List next; int linepos; a_Exp self; };228struct a_Var_Decl_List_ { a_Var_Decl var_decl; a_Var_Decl_List next; int linepos; a_Exp self; };
229// 1.4.2.0 (ge) added ck_type and ref, to handle multiple array decl (e.g., int x, y[], z[1];)
229struct a_Var_Decl_ { S_Symbol xid; a_Var_Decl var_decl; a_Array_Sub array; t_CKVALUE value;230struct a_Var_Decl_ { S_Symbol xid; a_Var_Decl var_decl; a_Array_Sub array; t_CKVALUE value;
230 void * addr; int linepos; a_Exp self; };231 void * addr; t_CKTYPE ck_type; int ref; int linepos; a_Exp self; };
231struct a_Type_Decl_ { a_Id_List xid; a_Array_Sub array; int ref; int linepos; /*a_Exp self;*/ };232struct a_Type_Decl_ { a_Id_List xid; a_Array_Sub array; int ref; int linepos; /*a_Exp self;*/ };
232struct a_Array_Sub_ { t_CKUINT depth; a_Exp exp_list; int linepos; a_Exp self; 233struct a_Array_Sub_ { t_CKUINT depth; a_Exp exp_list; int linepos; a_Exp self;
233 int err_num; int err_pos; };234 int err_num; int err_pos; };
234struct a_Arg_List_ { a_Type_Decl type_decl; a_Var_Decl var_decl; t_CKTYPE type;235struct a_Arg_List_ { a_Type_Decl type_decl; a_Var_Decl var_decl; t_CKTYPE type;
235 a_Arg_List next; int linepos; a_Exp self; };236 a_Arg_List next; int linepos; a_Exp self; };
@@ -238,7 +239,7 @@ struct a_Polar_ { a_Exp mod; a_Exp phase; int linepos; a_Exp self; }; · 2 unmodified lines
238struct a_Vec_ { a_Exp args; int numdims; int linepos; a_Exp self; }; // ge: added 1.3.5.3239struct a_Vec_ { a_Exp args; int numdims; int linepos; a_Exp self; }; // ge: added 1.3.5.3
239 240
240// enum primary exp type241// enum primary exp type
241typedef enum { ae_primary_var, ae_primary_num, ae_primary_float, 242typedef enum { ae_primary_var, ae_primary_num, ae_primary_float,
242 ae_primary_str, ae_primary_array, ae_primary_exp,243 ae_primary_str, ae_primary_array, ae_primary_exp,
243 ae_primary_hack, ae_primary_complex, ae_primary_polar,244 ae_primary_hack, ae_primary_complex, ae_primary_polar,
244 ae_primary_vec, ae_primary_char, ae_primary_nil245 ae_primary_vec, ae_primary_char, ae_primary_nil
@@ -248,7 +249,7 @@ struct a_Exp_Primary_ · 3 unmodified lines
248{249{
249 ae_Exp_Primary_Type s_type;250 ae_Exp_Primary_Type s_type;
250 t_CKVALUE value;251 t_CKVALUE value;
251 252
252 union253 union
253 {254 {
254 S_Symbol var;255 S_Symbol var;
@@ -286,7 +287,7 @@ struct a_Exp_ · 31 unmodified lines
286 t_CKUINT group_size;287 t_CKUINT group_size;
287 t_CKTYPE cast_to;288 t_CKTYPE cast_to;
288 t_CKUINT emit_var; // 1 = emit var, 2 = emit var and value289 t_CKUINT emit_var; // 1 = emit var, 2 = emit var and value
289 290
290 union291 union
291 {292 {
292 struct a_Exp_Binary_ binary;293 struct a_Exp_Binary_ binary;
@@ -320,15 +321,15 @@ struct a_Stmt_GotoLabel_ { S_Symbol name; int linepos; a_Stmt self; }; · 27 unmodified lines
320 321
321// enum values for stmt type322// enum values for stmt type
322typedef enum { ae_stmt_exp, ae_stmt_while, ae_stmt_until, ae_stmt_for, ae_stmt_loop,323typedef enum { ae_stmt_exp, ae_stmt_while, ae_stmt_until, ae_stmt_for, ae_stmt_loop,
323 ae_stmt_if, ae_stmt_code, ae_stmt_switch, ae_stmt_break, 324 ae_stmt_if, ae_stmt_code, ae_stmt_switch, ae_stmt_break,
324 ae_stmt_continue, ae_stmt_return, ae_stmt_case, ae_stmt_gotolabel325 ae_stmt_continue, ae_stmt_return, ae_stmt_case, ae_stmt_gotolabel
325 } ae_Stmt_Type;326 } ae_Stmt_Type;
326 327
327struct a_Stmt_328struct a_Stmt_
328{329{
329 ae_Stmt_Type s_type;330 ae_Stmt_Type s_type;
330 int skip;331 int skip;
331 332
332 union333 union
333 {334 {
334 a_Exp stmt_exp;335 a_Exp stmt_exp;
@@ -350,7 +351,7 @@ struct a_Stmt_ · 15 unmodified lines
350};351};
351 352
352struct a_Stmt_List_ { a_Stmt stmt; a_Stmt_List next; int linepos; };353struct a_Stmt_List_ { a_Stmt stmt; a_Stmt_List next; int linepos; };
353struct a_Class_Def_ { ae_Keyword decl; a_Id_List name; a_Class_Ext ext; 354struct a_Class_Def_ { ae_Keyword decl; a_Id_List name; a_Class_Ext ext;
354 a_Class_Body body; t_CKTYPE type; int iface; t_CKNSPC home;355 a_Class_Body body; t_CKTYPE type; int iface; t_CKNSPC home;
355 int linepos; };356 int linepos; };
356struct a_Class_Ext_ { a_Id_List extend_id; a_Id_List impl_list; int linepos; };357struct a_Class_Ext_ { a_Id_List extend_id; a_Id_List impl_list; int linepos; };
@@ -363,10 +364,10 @@ typedef enum { ae_func_user, ae_func_builtin } ae_Func_Type; · 6 unmodified lines
363// struct t_Func_BuiltIn_ { builtin_func_ptr func_ptr; int linepos; };364// struct t_Func_BuiltIn_ { builtin_func_ptr func_ptr; int linepos; };
364struct a_Func_Def_ {365struct a_Func_Def_ {
365 ae_Keyword func_decl;366 ae_Keyword func_decl;
366 ae_Keyword static_decl; 367 ae_Keyword static_decl;
367 a_Type_Decl type_decl;368 a_Type_Decl type_decl;
368 t_CKTYPE ret_type;369 t_CKTYPE ret_type;
369 S_Symbol name; 370 S_Symbol name;
370 a_Arg_List arg_list;371 a_Arg_List arg_list;
371 a_Stmt code;372 a_Stmt code;
372 t_CKFUNC ck_func;373 t_CKFUNC ck_func;
@@ -384,7 +385,7 @@ typedef enum { ae_section_stmt, ae_section_func, ae_section_class · 11 unmodified lines
384struct a_Section_385struct a_Section_
385{386{
386 ae_Section_Type s_type;387 ae_Section_Type s_type;
387 388
388 union389 union
389 {390 {
390 a_Stmt_List stmt_list;391 a_Stmt_List stmt_list;
chuginate/template/chuck/include/chuck_carrier.h+8−8
@@ -1,21 +1,21 @@
1/*----------------------------------------------------------------------------1/*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine3 Compiler and Virtual Machine
4 4
5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.stanford.edu/6 http://chuck.stanford.edu/
7 http://chuck.cs.princeton.edu/7 http://chuck.cs.princeton.edu/
8 8
9 This program is free software; you can redistribute it and/or modify9 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 by10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful,14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-130721 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -75,20 +75,20 @@ struct Chuck_Carrier · 53 unmodified lines
75 Chuck_VM * vm;75 Chuck_VM * vm;
76 Chuck_IO_Chout * chout;76 Chuck_IO_Chout * chout;
77 Chuck_IO_Cherr * cherr;77 Chuck_IO_Cherr * cherr;
78 78
79 #ifndef __DISABLE_OTF_SERVER__79 #ifndef __DISABLE_OTF_SERVER__
80 // OTF programming things80 // OTF programming things
81 ck_socket otf_socket;81 ck_socket otf_socket;
82 t_CKINT otf_port;82 t_CKINT otf_port;
83 CHUCK_THREAD otf_thread;83 CHUCK_THREAD otf_thread;
84 #endif84 #endif
85 85
86 // STK-specific86 // STK-specific
87 #ifndef __DISABLE_WVOUT__87 #ifndef __DISABLE_WVOUT__
88 XWriteThread * stk_writeThread;88 XWriteThread * stk_writeThread;
89 std::map<WvOut *, WvOut *> stk_wvOutMap;89 std::map<WvOut *, WvOut *> stk_wvOutMap;
90 #endif90 #endif
91 91
92 // constructor92 // constructor
93 Chuck_Carrier() :93 Chuck_Carrier() :
94 chuck(NULL),94 chuck(NULL),
@@ -107,7 +107,7 @@ struct Chuck_Carrier · 12 unmodified lines
107 cherr( NULL )107 cherr( NULL )
108 108
109 { }109 { }
110 110
111 // get hint: is realtime audio?111 // get hint: is realtime audio?
112 t_CKBOOL hintIsRealtimeAudio();112 t_CKBOOL hintIsRealtimeAudio();
113};113};
chuginate/template/chuck/include/chuck_compile.h+23−11
@@ -56,7 +56,7 @@ struct Chuck_Compiler · 55 unmodified lines
56protected: // data56protected: // data
57 // carrier57 // carrier
58 Chuck_Carrier * m_carrier;58 Chuck_Carrier * m_carrier;
59 59
60public: // get protected data60public: // get protected data
61 // REFACTOR-2017: get associated, per-compiler environment61 // REFACTOR-2017: get associated, per-compiler environment
62 Chuck_Env * env() const { return m_carrier->env; }62 Chuck_Env * env() const { return m_carrier->env; }
@@ -67,7 +67,6 @@ public: // get protected data · 4 unmodified lines
67 // set carrier67 // set carrier
68 t_CKBOOL setCarrier( Chuck_Carrier * c ) { m_carrier = c; return TRUE; }68 t_CKBOOL setCarrier( Chuck_Carrier * c ) { m_carrier = c; return TRUE; }
69 69
70
71public: // data70public: // data
72 // emitter71 // emitter
73 Chuck_Emitter * emitter;72 Chuck_Emitter * emitter;
@@ -78,10 +77,16 @@ public: // data · 4 unmodified lines
78 t_CKBOOL m_auto_depend;77 t_CKBOOL m_auto_depend;
79 // recent map78 // recent map
80 std::map<std::string, Chuck_Context *> m_recent;79 std::map<std::string, Chuck_Context *> m_recent;
81 80
81 // chugins
82 std::list<Chuck_DLL *> m_dlls;82 std::list<Chuck_DLL *> m_dlls;
83 // libraries (ck code) to import
83 std::list<std::string> m_cklibs_to_preload;84 std::list<std::string> m_cklibs_to_preload;
84 85
86 // origin hint; this flag is set to different te_Origin values
87 // to denote where new entities originate | 1.5.0.0 (ge) added
88 te_Origin m_originHint;
89
85public: // to all90public: // to all
86 // contructor91 // contructor
87 Chuck_Compiler();92 Chuck_Compiler();
@@ -89,8 +94,7 @@ public: // to all · 1 unmodified line
89 virtual ~Chuck_Compiler();94 virtual ~Chuck_Compiler();
90 95
91 // initialize96 // initialize
92 t_CKBOOL initialize( std::list<std::string> & chugin_search_paths,97 t_CKBOOL initialize();
93 std::list<std::string> & named_dls );
94 // shutdown98 // shutdown
95 void shutdown();99 void shutdown();
96 100
@@ -103,22 +107,27 @@ public: // compile · 6 unmodified lines
103 // set auto depend107 // set auto depend
104 void set_auto_depend( t_CKBOOL v );108 void set_auto_depend( t_CKBOOL v );
105 // parse, type-check, and emit a program109 // parse, type-check, and emit a program
106 t_CKBOOL go( const std::string & filename, FILE * fd = NULL, 110 t_CKBOOL go( const std::string & filename, FILE * fd = NULL,
107 const char * str_src = NULL, const std::string & full_path = "" );111 const char * str_src = NULL, const std::string & full_path = "" );
108 // resolve a type automatically, if auto_depend is on112 // resolve a type automatically, if auto_depend is on
109 t_CKBOOL resolve( const std::string & type );113 t_CKBOOL resolve( const std::string & type );
110 // get the code generated from the last go()114 // get the code generated from the last go()
111 Chuck_VM_Code * output( );115 Chuck_VM_Code * output( );
112 116
113public: // replace-dac | added 1.4.1.0 (jack) 117public: // replace-dac | added 1.4.1.0 (jack)
114 // sets a "replacement dac": one global UGen is secretly used118 // sets a "replacement dac": one global UGen is secretly used
115 // as a stand-in for "dac" for this compilation;119 // as a stand-in for "dac" for this compilation;
116 // for example, ChuckSubInstances in Chunity use a global Gain as a120 // for example, ChuckSubInstances in Chunity use a global Gain as a
117 // replacement dac, then use the global getUGenSamples() function to121 // replacement dac, then use the global getUGenSamples() function to
118 // get the samples of the gain. this enables the creation 122 // get the samples of the gain. this enables the creation
119 // of a new sample sucker.123 // of a new sample sucker.
120 void setReplaceDac( t_CKBOOL shouldReplaceDac, const std::string & replacement );124 void setReplaceDac( t_CKBOOL shouldReplaceDac, const std::string & replacement );
121 125
126public: // chugin load | refactored 1.4.1.0 (ge)
127 t_CKBOOL load_external_modules( const char * extension,
128 std::list<std::string> & chugin_search_paths,
129 std::list<std::string> & named_dls );
130
122protected: // internal131protected: // internal
123 // do entire file132 // do entire file
124 t_CKBOOL do_entire_file( Chuck_Context * context );133 t_CKBOOL do_entire_file( Chuck_Context * context );
@@ -127,8 +136,11 @@ protected: // internal · 2 unmodified lines
127 // do all excect classes136 // do all excect classes
128 t_CKBOOL do_all_except_classes( Chuck_Context * context );137 t_CKBOOL do_all_except_classes( Chuck_Context * context );
129 // do normal compile138 // do normal compile
130 t_CKBOOL do_normal( const std::string & path, FILE * fd = NULL, 139 t_CKBOOL do_normal_depend( const std::string & path, FILE * fd = NULL,
131 const char * str_src = NULL, const std::string & full_path = "" );140 const char * str_src = NULL, const std::string & full_path = "" );
141 // do auto-depend compile
142 t_CKBOOL do_auto_depend( const std::string & path, FILE * fd = NULL,
143 const char * str_src = NULL, const std::string & full_path = "" );
132 // look up in recent144 // look up in recent
133 Chuck_Context * find_recent_path( const std::string & path );145 Chuck_Context * find_recent_path( const std::string & path );
134 // look up in recent146 // look up in recent
chuginate/template/chuck/include/chuck_def.h+17−7
@@ -104,12 +104,12 @@ typedef struct { t_CKUINT N ; t_CKFLOAT * values ; } t_CKVECTOR; · 103 unmodified lines
104 104
105// kinds (added 1.3.1.0 to faciliate 64-bit support)105// kinds (added 1.3.1.0 to faciliate 64-bit support)
106// to differentiate in case int and float have same size106// to differentiate in case int and float have same size
107#define kindof_VOID 0107#define kindof_VOID 0
108#define kindof_INT 1108#define kindof_INT 1
109#define kindof_FLOAT 2109#define kindof_FLOAT 2
110#define kindof_COMPLEX 3110#define kindof_COMPLEX 3
111#define kindof_VEC3 4111#define kindof_VEC3 4
112#define kindof_VEC4 5112#define kindof_VEC4 5
113 113
114typedef char * c_str;114typedef char * c_str;
115typedef const char * c_constr;115typedef const char * c_constr;
@@ -140,6 +140,9 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 24 unmodified lines
140#define FALSE 0140#define FALSE 0
141#endif141#endif
142 142
143// special non-zero value to denote "no value" | added 1.4.2.0 (ge)
144#define CK_NO_VALUE 0xffffffff
145
143// 3.1415926535897932384626433832795028841971693993751058209749445...146// 3.1415926535897932384626433832795028841971693993751058209749445...
144#define ONE_PI (3.14159265358979323846)147#define ONE_PI (3.14159265358979323846)
145#define TWO_PI (2.0 * ONE_PI)148#define TWO_PI (2.0 * ONE_PI)
@@ -151,6 +154,8 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 5 unmodified lines
151#define SAFE_RELEASE(x) do { if(x){ x->release(); x = NULL; } } while(0)154#define SAFE_RELEASE(x) do { if(x){ x->release(); x = NULL; } } while(0)
152#define SAFE_ADD_REF(x) do { if(x){ x->add_ref(); } } while(0)155#define SAFE_ADD_REF(x) do { if(x){ x->add_ref(); } } while(0)
153#define SAFE_REF_ASSIGN(lhs,rhs) do { SAFE_RELEASE(lhs); (lhs) = (rhs); SAFE_ADD_REF(lhs); } while(0)156#define SAFE_REF_ASSIGN(lhs,rhs) do { SAFE_RELEASE(lhs); (lhs) = (rhs); SAFE_ADD_REF(lhs); } while(0)
157#define SAFE_FREE(x) do { if(x){ free(x); x = NULL; } } while(0)
158#define SAFE_UNLOCK_DELETE(x) do { if(x){ x->unlock(); delete x; x = NULL; } } while(0)
154#endif159#endif
155 160
156// max + min161// max + min
@@ -188,7 +193,12 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 31 unmodified lines
188 193
189#ifdef __PLATFORM_WIN32__194#ifdef __PLATFORM_WIN32__
190#ifndef usleep195#ifndef usleep
191#define usleep(x) Sleep( (x / 1000 <= 0 ? 1 : x / 1000) )196 #define usleep(x) Sleep( (x / 1000 <= 0 ? 1 : x / 1000) )
197#endif
198// 1.4.2.0 (ge and spencer) | added for legacy windows, as part of switch to snprintf
199// https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
200#if defined(_MSC_VER) && _MSC_VER < 1900
201 #define snprintf(buf,len, format,...) _snprintf_s(buf, len,len, format, __VA_ARGS__)
192#endif202#endif
193#pragma warning (disable : 4996) // stdio deprecation203#pragma warning (disable : 4996) // stdio deprecation
194#pragma warning (disable : 4786) // stl debug info204#pragma warning (disable : 4786) // stl debug info
chuginate/template/chuck/include/chuck_dl.h+62−56
@@ -154,14 +154,14 @@ namespace Chuck_DL_Api { struct Api; } · 153 unmodified lines
154 154
155 155
156// chuck dll export linkage and calling convention156// chuck dll export linkage and calling convention
157#if defined (__PLATFORM_WIN32__) 157#if defined (__PLATFORM_WIN32__)
158 #define CK_DLL_LINKAGE extern "C" __declspec( dllexport )158 #define CK_DLL_LINKAGE extern "C" __declspec( dllexport )
159#else159#else
160 #define CK_DLL_LINKAGE extern "C" 160 #define CK_DLL_LINKAGE extern "C"
161#endif 161#endif
162 162
163// calling convention of functions provided by chuck to the dll163// calling convention of functions provided by chuck to the dll
164#if defined(__WINDOWS_DS__)164#if defined(__PLATFORM_WIN32__)
165 #define CK_DLL_CALL _cdecl165 #define CK_DLL_CALL _cdecl
166#else166#else
167 #define CK_DLL_CALL167 #define CK_DLL_CALL
@@ -183,7 +183,7 @@ typedef const Chuck_DL_Api::Api *CK_DL_API; · 15 unmodified lines
183// example: CK_DLL_QUERY183// example: CK_DLL_QUERY
184#ifndef __CK_DLL_STATIC__184#ifndef __CK_DLL_STATIC__
185#define CK_DLL_QUERY(name) CK_DLL_DECLVERSION CK_DLL_EXPORT(t_CKBOOL) ck_query( Chuck_DL_Query * QUERY )185#define CK_DLL_QUERY(name) CK_DLL_DECLVERSION CK_DLL_EXPORT(t_CKBOOL) ck_query( Chuck_DL_Query * QUERY )
186#else 186#else
187#define CK_DLL_QUERY(name) CK_DLL_QUERY_STATIC(name)187#define CK_DLL_QUERY(name) CK_DLL_QUERY_STATIC(name)
188#endif // __CK_DLL_STATIC__188#endif // __CK_DLL_STATIC__
189// macro for defining ChucK DLL export allocator189// macro for defining ChucK DLL export allocator
@@ -382,13 +382,13 @@ public: · 192 unmodified lines
382 382
383 // re-added 1.4.0.1383 // re-added 1.4.0.1
384 f_create_main_thread_hook create_main_thread_hook;384 f_create_main_thread_hook create_main_thread_hook;
385 385
386 // NOTE: everything below std::anything cannot be reliably accessed386 // NOTE: everything below std::anything cannot be reliably accessed
387 // by offset between dynamic modules, since std::anything could be variable387 // by offset between dynamic modules, since std::anything could be variable
388 // size -- put everything need to be accessed across modules above here!388 // size -- put everything need to be accessed across modules above here!
389 // discovered by the vigilant and forever traumatized Jack Atherton,389 // discovered by the vigilant and forever traumatized Jack Atherton,
390 // fixed during REFACTOR-2017; warning by the guilt-ridden Ge Wang390 // fixed during REFACTOR-2017; warning by the guilt-ridden Ge Wang
391 391
392 // dll392 // dll
393 Chuck_DLL * dll_ref;393 Chuck_DLL * dll_ref;
394 // reserved394 // reserved
@@ -410,7 +410,7 @@ public: · 15 unmodified lines
410 std::vector<Chuck_DL_Class *> classes;410 std::vector<Chuck_DL_Class *> classes;
411 // stack411 // stack
412 std::vector<Chuck_DL_Class * >stack;412 std::vector<Chuck_DL_Class * >stack;
413 413
414 // constructor414 // constructor
415 Chuck_DL_Query( Chuck_Carrier * carrier );415 Chuck_DL_Query( Chuck_Carrier * carrier );
416 // desctructor416 // desctructor
@@ -458,12 +458,12 @@ struct Chuck_DL_Class · 41 unmodified lines
458 std::vector<Chuck_DL_Class *> classes;458 std::vector<Chuck_DL_Class *> classes;
459 // current mvar offset459 // current mvar offset
460 t_CKUINT current_mvar_offset;460 t_CKUINT current_mvar_offset;
461 461
462 t_CKUINT ugen_num_in, ugen_num_out;462 t_CKUINT ugen_num_in, ugen_num_out;
463 463
464 std::string doc;464 std::string doc;
465 std::vector<std::string> examples;465 std::vector<std::string> examples;
466 466
467 // constructor467 // constructor
468 Chuck_DL_Class() { dtor = NULL; ugen_tick = NULL; ugen_tickf = NULL; ugen_pmsg = NULL; uana_tock = NULL; ugen_pmsg = NULL; current_mvar_offset = 0; ugen_num_in = ugen_num_out = 0; }468 Chuck_DL_Class() { dtor = NULL; ugen_tick = NULL; ugen_tickf = NULL; ugen_pmsg = NULL; uana_tock = NULL; ugen_pmsg = NULL; current_mvar_offset = 0; ugen_num_in = ugen_num_out = 0; }
469 // destructor469 // destructor
@@ -515,7 +515,7 @@ struct Chuck_DL_Func · 45 unmodified lines
515 std::vector<Chuck_DL_Value *> args;515 std::vector<Chuck_DL_Value *> args;
516 // description516 // description
517 std::string doc;517 std::string doc;
518 518
519 // constructor519 // constructor
520 Chuck_DL_Func() { ctor = NULL; }520 Chuck_DL_Func() { ctor = NULL; }
521 Chuck_DL_Func( const char * t, const char * n, t_CKUINT a )521 Chuck_DL_Func( const char * t, const char * n, t_CKUINT a )
@@ -580,7 +580,7 @@ union Chuck_DL_Return · 58 unmodified lines
580 t_CKVEC4 v_vec4; // ge: added 1.3.5.3580 t_CKVEC4 v_vec4; // ge: added 1.3.5.3
581 Chuck_Object * v_object;581 Chuck_Object * v_object;
582 Chuck_String * v_string;582 Chuck_String * v_string;
583 583
584 Chuck_DL_Return() { v_vec4.x = v_vec4.y = v_vec4.z = v_vec4.w = 0; }584 Chuck_DL_Return() { v_vec4.x = v_vec4.y = v_vec4.z = v_vec4.w = 0; }
585};585};
586 586
@@ -595,7 +595,7 @@ struct Chuck_DLL : public Chuck_VM_Object · 8 unmodified lines
595{595{
596public:596public:
597 // load dynamic ckx/dll from filename597 // load dynamic ckx/dll from filename
598 t_CKBOOL load( const char * filename, 598 t_CKBOOL load( const char * filename,
599 const char * func = CK_QUERY_FUNC,599 const char * func = CK_QUERY_FUNC,
600 t_CKBOOL lazy = FALSE );600 t_CKBOOL lazy = FALSE );
601 t_CKBOOL load( f_ck_query query_func, t_CKBOOL lazy = FALSE );601 t_CKBOOL load( f_ck_query query_func, t_CKBOOL lazy = FALSE );
@@ -611,7 +611,7 @@ public: · 9 unmodified lines
611 t_CKBOOL good() const;611 t_CKBOOL good() const;
612 // name612 // name
613 const char * name() const;613 const char * name() const;
614 614
615public:615public:
616 // constructor616 // constructor
617 Chuck_DLL( Chuck_Carrier * carrier, const char * xid = NULL )617 Chuck_DLL( Chuck_Carrier * carrier, const char * xid = NULL )
@@ -644,7 +644,7 @@ public: · 26 unmodified lines
644 void * bindle, Chuck_Carrier * carrier);644 void * bindle, Chuck_Carrier * carrier);
645 t_CKBOOL (* const activate)(Chuck_DL_MainThreadHook *);645 t_CKBOOL (* const activate)(Chuck_DL_MainThreadHook *);
646 t_CKBOOL (* const deactivate)(Chuck_DL_MainThreadHook *);646 t_CKBOOL (* const deactivate)(Chuck_DL_MainThreadHook *);
647 647
648 Chuck_Carrier * const m_carrier;648 Chuck_Carrier * const m_carrier;
649 f_mainthreadhook const m_hook;649 f_mainthreadhook const m_hook;
650 f_mainthreadquit const m_quit;650 f_mainthreadquit const m_quit;
@@ -665,45 +665,49 @@ struct Api · 14 unmodified lines
665public:665public:
666 static Api g_api;666 static Api g_api;
667 static inline const Api * instance() { return &g_api; }667 static inline const Api * instance() { return &g_api; }
668 668
669 struct VMApi669 struct VMApi
670 {670 {
671 VMApi();671 VMApi();
672 t_CKUINT (* const get_srate)( CK_DL_API, Chuck_VM_Shred * );672 t_CKUINT (* const get_srate)( CK_DL_API, Chuck_VM_Shred * );
673 } * const vm;673 } * const vm;
674 674
675 struct ObjectApi675 struct ObjectApi
676 {676 {
677 ObjectApi();677 ObjectApi();
678 private:678
679 // 1.5.0.0 (nshaheed and ge and anonymous pr-lab member) | changed from private to public
680 // also changed all std::string & in this section to const char *
681 // intent: this allows for chugins to access member variables and create chuck strings
682 public:
679 // function pointer get_type()683 // function pointer get_type()
680 Type (* const get_type)( CK_DL_API, Chuck_VM_Shred *, std::string &name );684 Type (* const get_type)( CK_DL_API, Chuck_VM_Shred *, const char * name );
681 // function pointer create()685 // function pointer create()
682 Object (* const create)( CK_DL_API, Chuck_VM_Shred *, Type type );686 Object (* const create)( CK_DL_API, Chuck_VM_Shred *, Type type );
683 // function pointer create_string()687 // function pointer create_string()
684 String (* const create_string)( CK_DL_API, Chuck_VM_Shred *, std::string &value );688 String (* const create_string)( CK_DL_API, Chuck_VM_Shred *, const char * value );
685 // function pointers for get_mvar_*()689 // function pointers for get_mvar_*()
686 t_CKBOOL (* const get_mvar_int)( CK_DL_API, Object object, std::string &name, t_CKINT &value );690 t_CKBOOL (* const get_mvar_int)( CK_DL_API, Object object, const char * name, t_CKINT & value );
687 t_CKBOOL (* const get_mvar_float)( CK_DL_API, Object object, std::string &name, t_CKFLOAT &value );691 t_CKBOOL (* const get_mvar_float)( CK_DL_API, Object object, const char * name, t_CKFLOAT & value );
688 t_CKBOOL (* const get_mvar_dur)( CK_DL_API, Object object, std::string &name, t_CKDUR &value );692 t_CKBOOL (* const get_mvar_dur)( CK_DL_API, Object object, const char * name, t_CKDUR & value );
689 t_CKBOOL (* const get_mvar_time)( CK_DL_API, Object object, std::string &name, t_CKTIME &value );693 t_CKBOOL (* const get_mvar_time)( CK_DL_API, Object object, const char * name, t_CKTIME & value );
690 t_CKBOOL (* const get_mvar_string)( CK_DL_API, Object object, std::string &name, String &value );694 t_CKBOOL (* const get_mvar_string)( CK_DL_API, Object object, const char * name, String & value );
691 t_CKBOOL (* const get_mvar_object)( CK_DL_API, Object object, std::string &name, Object &value );695 t_CKBOOL (* const get_mvar_object)( CK_DL_API, Object object, const char * name, Object & value );
692 // function pointer for set_string()696 // function pointer for set_string()
693 t_CKBOOL (* const set_string)( CK_DL_API, String string, std::string &value );697 t_CKBOOL (* const set_string)( CK_DL_API, String string, const char * value );
694 } * const object;698 } * const object;
695 699
696 Api() :700 Api() :
697 vm(new VMApi),701 vm(new VMApi),
698 object(new ObjectApi)702 object(new ObjectApi)
699 { }703 { }
700 704
701private:705private:
702 Api( Api & a ) :706 Api( Api & a ) :
703 vm(a.vm),707 vm(a.vm),
704 object(a.object)708 object(a.object)
705 { assert(0); };709 { assert(0); };
706 710
707 Api & operator=( Api & a ) { assert(0); return a; }711 Api & operator=( Api & a ) { assert(0); return a; }
708};712};
709}713}
@@ -720,31 +724,33 @@ private: · 10 unmodified lines
720 724
721#error ChucK not support on Mac OS X 10.3 or lower725#error ChucK not support on Mac OS X 10.3 or lower
722 726
723#elif defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) 727#elif defined(__PLATFORM_WIN32__)
724 728
725 #ifdef __cplusplus 729 #ifdef __cplusplus
726 extern "C" { 730 extern "C" {
727 #endif 731 #endif
728 732
729 #define RTLD_LAZY 0x1 733 #define RTLD_LAZY 0x1
730 #define RTLD_NOW 0x2 734 #define RTLD_NOW 0x2
731 #define RTLD_LOCAL 0x4 735 #define RTLD_LOCAL 0x4
732 #define RTLD_GLOBAL 0x8 736 #define RTLD_GLOBAL 0x8
733 #define RTLD_NOLOAD 0x10 737 #define RTLD_NOLOAD 0x10
734 #define RTLD_SHARED 0x20 /* not used, the default */ 738 #define RTLD_SHARED 0x20 /* not used, the default */
735 #define RTLD_UNSHARED 0x40 739 #define RTLD_UNSHARED 0x40
736 #define RTLD_NODELETE 0x80 740 #define RTLD_NODELETE 0x80
737 #define RTLD_LAZY_UNDEF 0x100 741 #define RTLD_LAZY_UNDEF 0x100
738 742
739 void * dlopen( const char * path, int mode ); 743 void * dlopen( const char * path, int mode );
740 void * dlsym( void * handle, const char * symbol ); 744 void * dlsym( void * handle, const char * symbol );
741 const char * dlerror( void ); 745 const char * dlerror( void );
742 int dlclose( void * handle ); 746 int dlclose( void * handle );
743 static char dlerror_buffer[128]; 747 // 1.4.2.0 (ge) | added DLERROR_BUFFER_LENGTH
744 748 #define DLERROR_BUFFER_LENGTH 128
745 #ifdef __cplusplus 749 static char dlerror_buffer[DLERROR_BUFFER_LENGTH];
746 } 750
747 #endif 751 #ifdef __cplusplus
752 }
753 #endif
748 754
749#else755#else
750 #include "dlfcn.h"756 #include "dlfcn.h"
chuginate/template/chuck/include/chuck_emit.h+7−5
@@ -74,10 +74,10 @@ public: · 73 unmodified lines
74 std::vector<Chuck_Instr_Goto *> stack_break;74 std::vector<Chuck_Instr_Goto *> stack_break;
75 // return stack75 // return stack
76 std::vector<Chuck_Instr_Goto *> stack_return;76 std::vector<Chuck_Instr_Goto *> stack_return;
77 77
78 // filename this code came from (added 1.3.0.0)78 // filename this code came from (added 1.3.0.0)
79 std::string filename;79 std::string filename;
80 80
81 // constructor81 // constructor
82 Chuck_Code( )82 Chuck_Code( )
83 {83 {
@@ -122,7 +122,7 @@ struct Chuck_Emitter : public Chuck_VM_Object · 38 unmodified lines
122 122
123 // constructor123 // constructor
124 Chuck_Emitter()124 Chuck_Emitter()
125 { env = NULL; code = NULL; context = NULL; 125 { env = NULL; code = NULL; context = NULL;
126 nspc = NULL; func = NULL; dump = FALSE;126 nspc = NULL; func = NULL; dump = FALSE;
127 should_replace_dac = FALSE; }127 should_replace_dac = FALSE; }
128 128
@@ -148,11 +148,13 @@ struct Chuck_Emitter : public Chuck_VM_Object · 19 unmodified lines
148 // add references to locals on current scope (added 1.3.0.0)148 // add references to locals on current scope (added 1.3.0.0)
149 void addref_on_scope();149 void addref_on_scope();
150 // pop scope150 // pop scope
151 void pop_scope( );151 void pop_scope();
152 // traverse scope on jumps such as 'return' 'break' 'continue' | 1.5.0.0 (ge)
153 void traverse_scope_on_jump();
152 154
153 // default durations155 // default durations
154 t_CKBOOL find_dur( const std::string & name, t_CKDUR * out );156 t_CKBOOL find_dur( const std::string & name, t_CKDUR * out );
155 157
156 // post REFACTOR-2017: replace-dac158 // post REFACTOR-2017: replace-dac
157 std::string dac_replacement;159 std::string dac_replacement;
158 t_CKBOOL should_replace_dac;160 t_CKBOOL should_replace_dac;
chuginate/template/chuck/include/chuck_errmsg.h+9−9
@@ -43,17 +43,17 @@ extern "C" { · 42 unmodified lines
43 43
44 44
45extern t_CKBOOL EM_anyErrors;45extern t_CKBOOL EM_anyErrors;
46extern int EM_tokPos;46extern t_CKINT EM_tokPos;
47extern int EM_lineNum;47extern t_CKINT EM_lineNum;
48 48
49// EM_extLineNum is synced with EM_lineNum in lexer/parser phase, then synced 49// EM_extLineNum is synced with EM_lineNum in lexer/parser phase, then synced
50// with scanner/typechecker (EM_lineNum is not synced with scanner/typechecker)50// with scanner/typechecker (EM_lineNum is not synced with scanner/typechecker)
51extern int EM_extLineNum; 51extern t_CKINT EM_extLineNum;
52 52
53void EM_newline( );53void EM_newline( );
54 54
55// levels55// levels
56#define CK_LOG_CRAZY 10 // set this to log everything56#define CK_LOG_ALL 10 // set this to log everything
57#define CK_LOG_FINEST 957#define CK_LOG_FINEST 9
58#define CK_LOG_FINER 858#define CK_LOG_FINER 8
59#define CK_LOG_FINE 759#define CK_LOG_FINE 7
@@ -155,9 +155,9 @@ extern t_CKINT g_loglevel; · 95 unmodified lines
155// macro to compare155// macro to compare
156#define DO_LOG(x) ( x <= g_loglevel )156#define DO_LOG(x) ( x <= g_loglevel )
157 157
158void EM_error( int, c_constr, ... );158void EM_error( t_CKINT, c_constr, ... );
159void EM_error2( int, c_constr, ... );159void EM_error2( t_CKINT, c_constr, ... );
160void EM_error2b( int, c_constr, ... );160void EM_error2b( t_CKINT, c_constr, ... );
161void EM_error3( c_constr, ... );161void EM_error3( c_constr, ... );
162void EM_impossible( c_constr, ... );162void EM_impossible( c_constr, ... );
163t_CKBOOL EM_reset( c_constr filename, FILE * fd );163t_CKBOOL EM_reset( c_constr filename, FILE * fd );
@@ -190,7 +190,7 @@ public: · 26 unmodified lines
190 {190 {
191 EM_pushlog();191 EM_pushlog();
192 }192 }
193 193
194 ~SmartPushLog()194 ~SmartPushLog()
195 {195 {
196 EM_poplog();196 EM_poplog();
chuginate/template/chuck/include/chuck_frame.h+1−1
@@ -92,7 +92,7 @@ public: · 91 unmodified lines
92 Chuck_Local * alloc_local( t_CKUINT size, const std::string & name,92 Chuck_Local * alloc_local( t_CKUINT size, const std::string & name,
93 t_CKBOOL is_ref, t_CKBOOL is_obj, t_CKBOOL is_global );93 t_CKBOOL is_ref, t_CKBOOL is_obj, t_CKBOOL is_global );
94 // get the current scope (added 1.3.0.0)94 // get the current scope (added 1.3.0.0)
95 void get_scope( std::vector<Chuck_Local *> & out ) const;95 void get_scope( std::vector<Chuck_Local *> & out, bool localOnly = true ) const;
96 // pop scope96 // pop scope
97 void pop_scope( std::vector<Chuck_Local *> & out );97 void pop_scope( std::vector<Chuck_Local *> & out );
98};98};
chuginate/template/chuck/include/chuck_globals.h+21−21
@@ -164,7 +164,7 @@ struct Chuck_Global_Request · 163 unmodified lines
164 // chuck_msg164 // chuck_msg
165 Chuck_Execute_Chuck_Msg_Request* executeChuckMsgRequest;165 Chuck_Execute_Chuck_Msg_Request* executeChuckMsgRequest;
166 };166 };
167 167
168 Chuck_Global_Request()168 Chuck_Global_Request()
169 {169 {
170 retries = 0;170 retries = 0;
@@ -183,7 +183,7 @@ struct Chuck_Globals_Manager · 12 unmodified lines
183public:183public:
184 Chuck_Globals_Manager( Chuck_VM * vm );184 Chuck_Globals_Manager( Chuck_VM * vm );
185 ~Chuck_Globals_Manager();185 ~Chuck_Globals_Manager();
186 186
187public:187public:
188 // REFACTOR-2017: externally accessible + global variables.188 // REFACTOR-2017: externally accessible + global variables.
189 // use these getters and setters from outside the audio thread189 // use these getters and setters from outside the audio thread
@@ -191,17 +191,17 @@ public: · 1 unmodified line
191 t_CKBOOL getGlobalInt( const char * name, void (*callback)(const char*, t_CKINT) );191 t_CKBOOL getGlobalInt( const char * name, void (*callback)(const char*, t_CKINT) );
192 t_CKBOOL getGlobalInt( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, t_CKINT) );192 t_CKBOOL getGlobalInt( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, t_CKINT) );
193 t_CKBOOL setGlobalInt( const char * name, t_CKINT val );193 t_CKBOOL setGlobalInt( const char * name, t_CKINT val );
194 194
195 t_CKBOOL getGlobalFloat( const char * name, void (*callback)(t_CKFLOAT) );195 t_CKBOOL getGlobalFloat( const char * name, void (*callback)(t_CKFLOAT) );
196 t_CKBOOL getGlobalFloat( const char * name, void (*callback)(const char*, t_CKFLOAT) );196 t_CKBOOL getGlobalFloat( const char * name, void (*callback)(const char*, t_CKFLOAT) );
197 t_CKBOOL getGlobalFloat( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, t_CKFLOAT) );197 t_CKBOOL getGlobalFloat( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, t_CKFLOAT) );
198 t_CKBOOL setGlobalFloat( const char * name, t_CKFLOAT val );198 t_CKBOOL setGlobalFloat( const char * name, t_CKFLOAT val );
199 199
200 t_CKBOOL getGlobalString( const char * name, void (*callback)(const char*) );200 t_CKBOOL getGlobalString( const char * name, void (*callback)(const char*) );
201 t_CKBOOL getGlobalString( const char * name, void (*callback)(const char*, const char*) );201 t_CKBOOL getGlobalString( const char * name, void (*callback)(const char*, const char*) );
202 t_CKBOOL getGlobalString( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, const char*) );202 t_CKBOOL getGlobalString( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, const char*) );
203 t_CKBOOL setGlobalString( const char * name, const char * val );203 t_CKBOOL setGlobalString( const char * name, const char * val );
204 204
205 t_CKBOOL signalGlobalEvent( const char * name );205 t_CKBOOL signalGlobalEvent( const char * name );
206 t_CKBOOL broadcastGlobalEvent( const char * name );206 t_CKBOOL broadcastGlobalEvent( const char * name );
207 t_CKBOOL listenForGlobalEvent( const char * name, void (*callback)(void), t_CKBOOL listen_forever );207 t_CKBOOL listenForGlobalEvent( const char * name, void (*callback)(void), t_CKBOOL listen_forever );
@@ -210,9 +210,9 @@ public: · 2 unmodified lines
210 t_CKBOOL stopListeningForGlobalEvent( const char * name, void (*callback)(void) );210 t_CKBOOL stopListeningForGlobalEvent( const char * name, void (*callback)(void) );
211 t_CKBOOL stopListeningForGlobalEvent( const char * name, void (*callback)(const char*) );211 t_CKBOOL stopListeningForGlobalEvent( const char * name, void (*callback)(const char*) );
212 t_CKBOOL stopListeningForGlobalEvent( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT) );212 t_CKBOOL stopListeningForGlobalEvent( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT) );
213 213
214 t_CKBOOL getGlobalUGenSamples( const char * name, SAMPLE* buffer, int numFrames );214 t_CKBOOL getGlobalUGenSamples( const char * name, SAMPLE* buffer, int numFrames );
215 215
216 t_CKBOOL setGlobalIntArray( const char * name, t_CKINT arrayValues[], t_CKUINT numValues );216 t_CKBOOL setGlobalIntArray( const char * name, t_CKINT arrayValues[], t_CKUINT numValues );
217 t_CKBOOL getGlobalIntArray( const char * name, void (*callback)(t_CKINT[], t_CKUINT) );217 t_CKBOOL getGlobalIntArray( const char * name, void (*callback)(t_CKINT[], t_CKUINT) );
218 t_CKBOOL getGlobalIntArray( const char * name, void (*callback)(const char*, t_CKINT[], t_CKUINT) );218 t_CKBOOL getGlobalIntArray( const char * name, void (*callback)(const char*, t_CKINT[], t_CKUINT) );
@@ -225,7 +225,7 @@ public: · 6 unmodified lines
225 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, const char * key, void (*callback)(t_CKINT) );225 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, const char * key, void (*callback)(t_CKINT) );
226 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, const char * key, void (*callback)(const char*, t_CKINT) );226 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, const char * key, void (*callback)(const char*, t_CKINT) );
227 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, t_CKINT callbackID, const char * key, void (*callback)(t_CKINT, t_CKINT) );227 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, t_CKINT callbackID, const char * key, void (*callback)(t_CKINT, t_CKINT) );
228 228
229 t_CKBOOL setGlobalFloatArray( const char * name, t_CKFLOAT arrayValues[], t_CKUINT numValues );229 t_CKBOOL setGlobalFloatArray( const char * name, t_CKFLOAT arrayValues[], t_CKUINT numValues );
230 t_CKBOOL getGlobalFloatArray( const char * name, void (*callback)(t_CKFLOAT[], t_CKUINT) );230 t_CKBOOL getGlobalFloatArray( const char * name, void (*callback)(t_CKFLOAT[], t_CKUINT) );
231 t_CKBOOL getGlobalFloatArray( const char * name, void (*callback)(const char*, t_CKFLOAT[], t_CKUINT) );231 t_CKBOOL getGlobalFloatArray( const char * name, void (*callback)(const char*, t_CKFLOAT[], t_CKUINT) );
@@ -238,11 +238,11 @@ public: · 6 unmodified lines
238 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, const char * key, void (*callback)(t_CKFLOAT) );238 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, const char * key, void (*callback)(t_CKFLOAT) );
239 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, const char * key, void (*callback)(const char*, t_CKFLOAT) );239 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, const char * key, void (*callback)(const char*, t_CKFLOAT) );
240 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, t_CKINT callbackID, const char * key, void (*callback)(t_CKINT, t_CKFLOAT) );240 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, t_CKINT callbackID, const char * key, void (*callback)(t_CKINT, t_CKFLOAT) );
241 241
242public:242public:
243 // run Chuck_Msg in the globals order243 // run Chuck_Msg in the globals order
244 t_CKBOOL execute_chuck_msg_with_globals( Chuck_Msg* msg );244 t_CKBOOL execute_chuck_msg_with_globals( Chuck_Msg* msg );
245 245
246public:246public:
247 // REFACTOR-2017: externally accessible + global variables.247 // REFACTOR-2017: externally accessible + global variables.
248 // WARNING: these internal functions are to be used only by other248 // WARNING: these internal functions are to be used only by other
@@ -250,25 +250,25 @@ public: · 1 unmodified line
250 t_CKBOOL init_global_int( const std::string & name );250 t_CKBOOL init_global_int( const std::string & name );
251 t_CKINT get_global_int_value( const std::string & name );251 t_CKINT get_global_int_value( const std::string & name );
252 t_CKINT* get_ptr_to_global_int( const std::string & name );252 t_CKINT* get_ptr_to_global_int( const std::string & name );
253 253
254 t_CKBOOL init_global_float( const std::string & name );254 t_CKBOOL init_global_float( const std::string & name );
255 t_CKFLOAT get_global_float_value( const std::string & name );255 t_CKFLOAT get_global_float_value( const std::string & name );
256 t_CKFLOAT* get_ptr_to_global_float( const std::string & name );256 t_CKFLOAT* get_ptr_to_global_float( const std::string & name );
257 257
258 t_CKBOOL init_global_string( const std::string & name );258 t_CKBOOL init_global_string( const std::string & name );
259 Chuck_String* get_global_string( const std::string & name );259 Chuck_String* get_global_string( const std::string & name );
260 Chuck_String** get_ptr_to_global_string( const std::string & name );260 Chuck_String** get_ptr_to_global_string( const std::string & name );
261 261
262 t_CKBOOL init_global_event( const std::string & name, Chuck_Type* type );262 t_CKBOOL init_global_event( const std::string & name, Chuck_Type* type );
263 Chuck_Event* get_global_event( const std::string & name );263 Chuck_Event* get_global_event( const std::string & name );
264 Chuck_Event** get_ptr_to_global_event( const std::string & name );264 Chuck_Event** get_ptr_to_global_event( const std::string & name );
265 265
266 t_CKBOOL init_global_ugen( const std::string & name, Chuck_Type* type );266 t_CKBOOL init_global_ugen( const std::string & name, Chuck_Type* type );
267 t_CKBOOL is_global_ugen_init( const std::string & name );267 t_CKBOOL is_global_ugen_init( const std::string & name );
268 t_CKBOOL is_global_ugen_valid( const std::string & name );268 t_CKBOOL is_global_ugen_valid( const std::string & name );
269 Chuck_UGen* get_global_ugen( const std::string & name );269 Chuck_UGen* get_global_ugen( const std::string & name );
270 Chuck_UGen** get_ptr_to_global_ugen( const std::string & name );270 Chuck_UGen** get_ptr_to_global_ugen( const std::string & name );
271 271
272 t_CKBOOL init_global_array( const std::string & name, Chuck_Type* type, te_GlobalType arr_type );272 t_CKBOOL init_global_array( const std::string & name, Chuck_Type* type, te_GlobalType arr_type );
273 Chuck_Object* get_global_array( const std::string & name );273 Chuck_Object* get_global_array( const std::string & name );
274 Chuck_Object** get_ptr_to_global_array( const std::string & name );274 Chuck_Object** get_ptr_to_global_array( const std::string & name );
@@ -282,24 +282,24 @@ public: · 7 unmodified lines
282 t_CKBOOL is_global_object_valid( const std::string & name );282 t_CKBOOL is_global_object_valid( const std::string & name );
283 Chuck_Object* get_global_object( const std::string & name );283 Chuck_Object* get_global_object( const std::string & name );
284 Chuck_Object** get_ptr_to_global_object( const std::string & name );284 Chuck_Object** get_ptr_to_global_object( const std::string & name );
285 285
286 t_CKBOOL should_call_global_ctor( const std::string & name, te_GlobalType type );286 t_CKBOOL should_call_global_ctor( const std::string & name, te_GlobalType type );
287 void global_ctor_was_called( const std::string & name, te_GlobalType type );287 void global_ctor_was_called( const std::string & name, te_GlobalType type );
288 288
289 // global variables -- clean up289 // global variables -- clean up
290 void cleanup_global_variables();290 void cleanup_global_variables();
291 291
292public: // these should ever ONLY be called from within the VM292public: // these should ever ONLY be called from within the VM
293 // request queue: add, query for size293 // request queue: add, query for size
294 t_CKBOOL add_request( Chuck_Global_Request request );294 t_CKBOOL add_request( Chuck_Global_Request request );
295 t_CKBOOL more_requests();295 t_CKBOOL more_requests();
296 // REFACTOR-2017: execute the messages from the global queue296 // REFACTOR-2017: execute the messages from the global queue
297 void handle_global_queue_messages();297 void handle_global_queue_messages();
298 298
299private:299private:
300 // ptr to my vm300 // ptr to my vm
301 Chuck_VM * m_vm;301 Chuck_VM * m_vm;
302 302
303 // global variables -- storage303 // global variables -- storage
304 std::map< std::string, Chuck_Global_Int_Container* > m_global_ints;304 std::map< std::string, Chuck_Global_Int_Container* > m_global_ints;
305 std::map< std::string, Chuck_Global_Float_Container* > m_global_floats;305 std::map< std::string, Chuck_Global_Float_Container* > m_global_floats;
@@ -311,7 +311,7 @@ private: · 5 unmodified lines
311 311
312 // global variables -- messages for set, get, etc.312 // global variables -- messages for set, get, etc.
313 XCircleBuffer< Chuck_Global_Request > m_global_request_queue;313 XCircleBuffer< Chuck_Global_Request > m_global_request_queue;
314 314
315 // retry queue: sometimes a request comes through exactly 1 sample315 // retry queue: sometimes a request comes through exactly 1 sample
316 // before the relevant global variable is constructed316 // before the relevant global variable is constructed
317 // (e.g. signalEvent before the compileCode that would construct the event)317 // (e.g. signalEvent before the compileCode that would construct the event)
chuginate/template/chuck/include/chuck_instr.h+163−93
@@ -44,6 +44,9 @@ struct Chuck_VM_Shred; · 43 unmodified lines
44struct Chuck_Type;44struct Chuck_Type;
45struct Chuck_Func;45struct Chuck_Func;
46 46
47// 1.4.2.0 (ge) | added for switching from snprintf()
48#define CK_PRINT_BUF_LENGTH 256
49
47 50
48 51
49 52
@@ -55,19 +58,25 @@ struct Chuck_Instr · 5 unmodified lines
55{58{
56public:59public:
57 Chuck_Instr();60 Chuck_Instr();
58 virtual ~Chuck_Instr() { }61 virtual ~Chuck_Instr() { SAFE_DELETE(m_codestr); }
59 62
60public:63public:
61 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) = 0;64 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) = 0;
62 65
63public:66public:
64 virtual const char * name() const;67 virtual const char * name() const;
65 virtual const char * params() const 68 virtual const char * params() const
66 { return ""; }69 { return ""; }
67 70
68public:71public:
72 // store line position for error messages
69 void set_linepos( t_CKUINT linepos );73 void set_linepos( t_CKUINT linepos );
70 t_CKUINT m_linepos;74 t_CKUINT m_linepos;
75
76 // set codestr associated with this instruction
77 void set_codestr( const std::string & str );
78 // (used in instruction dump) | 1.5.0.0 (ge) added
79 std::string * m_codestr;
71};80};
72 81
73 82
@@ -84,7 +93,7 @@ public: · 10 unmodified lines
84 93
85public:94public:
86 virtual const char * params() const95 virtual const char * params() const
87 { static char buffer[256]; sprintf( buffer, "%ld", m_jmp ); return buffer; }96 { static char buffer[CK_PRINT_BUF_LENGTH]; snprintf( buffer, CK_PRINT_BUF_LENGTH, "%ld", (long)m_jmp ); return buffer; }
88 97
89protected:98protected:
90 t_CKUINT m_jmp;99 t_CKUINT m_jmp;
@@ -105,7 +114,7 @@ public: · 14 unmodified lines
105 114
106public:115public:
107 virtual const char * params() const116 virtual const char * params() const
108 { static char buffer[256]; sprintf( buffer, "%ld", m_val ); return buffer; }117 { static char buffer[CK_PRINT_BUF_LENGTH]; snprintf( buffer, CK_PRINT_BUF_LENGTH, "%ld", (long)m_val ); return buffer; }
109 118
110protected:119protected:
111 t_CKUINT m_val;120 t_CKUINT m_val;
@@ -126,7 +135,7 @@ public: · 14 unmodified lines
126 135
127public:136public:
128 virtual const char * params() const137 virtual const char * params() const
129 { static char buffer[256]; sprintf( buffer, "%.6f", m_val ); return buffer; }138 { static char buffer[CK_PRINT_BUF_LENGTH]; snprintf( buffer, CK_PRINT_BUF_LENGTH, "%.6f", m_val ); return buffer; }
130 139
131protected:140protected:
132 t_CKFLOAT m_val;141 t_CKFLOAT m_val;
@@ -2014,6 +2023,23 @@ protected: · 1881 unmodified lines
2014 2023
2015 2024
2016 2025
2026//-----------------------------------------------------------------------------
2027// name: struct Chuck_Instr_Reg_Push_Zero
2028// desc: push immediate value 0 to reg stack with specific width
2029//-----------------------------------------------------------------------------
2030struct Chuck_Instr_Reg_Push_Zero : public Chuck_Instr_Unary_Op
2031{
2032public:
2033 Chuck_Instr_Reg_Push_Zero( t_CKUINT sizeInBytes )
2034 { this->set( sizeInBytes ); }
2035
2036public:
2037 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2038};
2039
2040
2041
2042
2017//-----------------------------------------------------------------------------2043//-----------------------------------------------------------------------------
2018// name: struct Chuck_Instr_Reg_Dup_Last2044// name: struct Chuck_Instr_Reg_Dup_Last
2019// desc: duplicate last value on reg stack2045// desc: duplicate last value on reg stack
@@ -2133,8 +2159,8 @@ public: · 113 unmodified lines
2133public:2159public:
2134 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2160 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2135 virtual const char * params() const2161 virtual const char * params() const
2136 { static char buffer[256];2162 { static char buffer[CK_PRINT_BUF_LENGTH];
2137 sprintf( buffer, "src=%ld, base=%ld", m_val, base );2163 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2138 return buffer; }2164 return buffer; }
2139 2165
2140protected:2166protected:
@@ -2158,8 +2184,8 @@ public: · 17 unmodified lines
2158public:2184public:
2159 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2185 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2160 virtual const char * params() const2186 virtual const char * params() const
2161 { static char buffer[256];2187 { static char buffer[CK_PRINT_BUF_LENGTH];
2162 sprintf( buffer, "src=%ld, base=%ld", m_val, base );2188 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2163 return buffer; }2189 return buffer; }
2164 2190
2165protected:2191protected:
@@ -2183,8 +2209,8 @@ public: · 17 unmodified lines
2183public:2209public:
2184 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2210 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2185 virtual const char * params() const2211 virtual const char * params() const
2186 { static char buffer[256];2212 { static char buffer[CK_PRINT_BUF_LENGTH];
2187 sprintf( buffer, "src=%ld, base=%ld", m_val, base );2213 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2188 return buffer; }2214 return buffer; }
2189 2215
2190protected:2216protected:
@@ -2204,14 +2230,14 @@ struct Chuck_Instr_Reg_Push_Mem_Vec3 : public Chuck_Instr_Unary_Op · 13 unmodified lines
2204public:2230public:
2205 Chuck_Instr_Reg_Push_Mem_Vec3( t_CKUINT src, t_CKBOOL use_base = FALSE )2231 Chuck_Instr_Reg_Push_Mem_Vec3( t_CKUINT src, t_CKBOOL use_base = FALSE )
2206 { this->set( src ); base = use_base; }2232 { this->set( src ); base = use_base; }
2207 2233
2208public:2234public:
2209 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2235 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2210 virtual const char * params() const2236 virtual const char * params() const
2211 { static char buffer[256];2237 { static char buffer[CK_PRINT_BUF_LENGTH];
2212 sprintf( buffer, "src=%ld, base=%ld", m_val, base );2238 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2213 return buffer; }2239 return buffer; }
2214 2240
2215protected:2241protected:
2216 // use global stack base2242 // use global stack base
2217 t_CKBOOL base;2243 t_CKBOOL base;
@@ -2229,14 +2255,14 @@ struct Chuck_Instr_Reg_Push_Mem_Vec4 : public Chuck_Instr_Unary_Op · 11 unmodified lines
2229public:2255public:
2230 Chuck_Instr_Reg_Push_Mem_Vec4( t_CKUINT src, t_CKBOOL use_base = FALSE )2256 Chuck_Instr_Reg_Push_Mem_Vec4( t_CKUINT src, t_CKBOOL use_base = FALSE )
2231 { this->set( src ); base = use_base; }2257 { this->set( src ); base = use_base; }
2232 2258
2233public:2259public:
2234 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2260 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2235 virtual const char * params() const2261 virtual const char * params() const
2236 { static char buffer[256];2262 { static char buffer[CK_PRINT_BUF_LENGTH];
2237 sprintf( buffer, "src=%ld, base=%ld", m_val, base );2263 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2238 return buffer; }2264 return buffer; }
2239 2265
2240protected:2266protected:
2241 // use global stack base2267 // use global stack base
2242 t_CKBOOL base;2268 t_CKBOOL base;
@@ -2258,8 +2284,8 @@ public: · 15 unmodified lines
2258public:2284public:
2259 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2285 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2260 virtual const char * params() const2286 virtual const char * params() const
2261 { static char buffer[256];2287 { static char buffer[CK_PRINT_BUF_LENGTH];
2262 sprintf( buffer, "name='%s'", m_name.c_str() );2288 snprintf( buffer, CK_PRINT_BUF_LENGTH, "name='%s'", m_name.c_str() );
2263 return buffer; }2289 return buffer; }
2264 2290
2265public:2291public:
@@ -2283,8 +2309,8 @@ public: · 17 unmodified lines
2283public:2309public:
2284 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2310 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2285 virtual const char * params() const2311 virtual const char * params() const
2286 { static char buffer[256];2312 { static char buffer[CK_PRINT_BUF_LENGTH];
2287 sprintf( buffer, "src=%ld, base=%ld", m_val, base );2313 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2288 return buffer; }2314 return buffer; }
2289 2315
2290protected:2316protected:
@@ -2308,8 +2334,8 @@ public: · 17 unmodified lines
2308public:2334public:
2309 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2335 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2310 virtual const char * params() const2336 virtual const char * params() const
2311 { static char buffer[256];2337 { static char buffer[CK_PRINT_BUF_LENGTH];
2312 sprintf( buffer, "name='%s'", m_name.c_str() );2338 snprintf( buffer, CK_PRINT_BUF_LENGTH, "name='%s'", m_name.c_str() );
2313 return buffer; }2339 return buffer; }
2314 2340
2315protected:2341protected:
@@ -2364,12 +2390,12 @@ struct Chuck_Instr_Mem_Set_Imm : public Chuck_Instr · 48 unmodified lines
2364public:2390public:
2365 Chuck_Instr_Mem_Set_Imm( t_CKUINT offset, t_CKUINT val )2391 Chuck_Instr_Mem_Set_Imm( t_CKUINT offset, t_CKUINT val )
2366 { m_offset = offset; m_val = val; }2392 { m_offset = offset; m_val = val; }
2367 2393
2368public:2394public:
2369 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2395 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2370 virtual const char * params() const2396 virtual const char * params() const
2371 { static char buffer[256];2397 { static char buffer[CK_PRINT_BUF_LENGTH];
2372 sprintf( buffer, "offset=%ld, value=%ld", m_offset, m_val );2398 snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld, value=%ld", (long)m_offset, (long)m_val );
2373 return buffer; }2399 return buffer; }
2374 2400
2375protected:2401protected:
@@ -2389,12 +2415,12 @@ struct Chuck_Instr_Mem_Set_Imm2 : public Chuck_Instr_Unary_Op · 13 unmodified lines
2389public:2415public:
2390 Chuck_Instr_Mem_Set_Imm2( t_CKUINT offset, t_CKFLOAT val )2416 Chuck_Instr_Mem_Set_Imm2( t_CKUINT offset, t_CKFLOAT val )
2391 { m_offset = offset; m_val = val; }2417 { m_offset = offset; m_val = val; }
2392 2418
2393public:2419public:
2394 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2420 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2395 virtual const char * params() const2421 virtual const char * params() const
2396 { static char buffer[256];2422 { static char buffer[CK_PRINT_BUF_LENGTH];
2397 sprintf( buffer, "offset=%ld, value=%f", m_offset, m_val );2423 snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld, value=%f", (long)m_offset, m_val );
2398 return buffer; }2424 return buffer; }
2399 2425
2400protected:2426protected:
@@ -2414,7 +2440,7 @@ struct Chuck_Instr_Mem_Push_Imm : public Chuck_Instr_Unary_Op · 13 unmodified lines
2414public:2440public:
2415 Chuck_Instr_Mem_Push_Imm( t_CKUINT src )2441 Chuck_Instr_Mem_Push_Imm( t_CKUINT src )
2416 { this->set( src ); }2442 { this->set( src ); }
2417 2443
2418public:2444public:
2419 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2445 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2420};2446};
@@ -2430,7 +2456,7 @@ struct Chuck_Instr_Mem_Push_Imm2 : public Chuck_Instr_Unary_Op2 · 9 unmodified lines
2430public:2456public:
2431 Chuck_Instr_Mem_Push_Imm2( t_CKFLOAT src )2457 Chuck_Instr_Mem_Push_Imm2( t_CKFLOAT src )
2432 { this->set( src ); }2458 { this->set( src ); }
2433 2459
2434public:2460public:
2435 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2461 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2436};2462};
@@ -2513,10 +2539,10 @@ public: · 76 unmodified lines
2513 // (added 1.3.0.0 -- is_object)2539 // (added 1.3.0.0 -- is_object)
2514 Chuck_Instr_Alloc_Word( t_CKUINT offset, t_CKBOOL is_object )2540 Chuck_Instr_Alloc_Word( t_CKUINT offset, t_CKBOOL is_object )
2515 { this->set( offset ); m_is_object = is_object; }2541 { this->set( offset ); m_is_object = is_object; }
2516 2542
2517 // was this object reference? (added 1.3.0.0)2543 // was this object reference? (added 1.3.0.0)
2518 t_CKBOOL m_is_object;2544 t_CKBOOL m_is_object;
2519 2545
2520 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2546 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2521};2547};
2522 2548
@@ -2532,7 +2558,7 @@ struct Chuck_Instr_Alloc_Word2 : public Chuck_Instr_Unary_Op · 9 unmodified lines
2532public:2558public:
2533 Chuck_Instr_Alloc_Word2( t_CKUINT offset )2559 Chuck_Instr_Alloc_Word2( t_CKUINT offset )
2534 { this->set( offset ); }2560 { this->set( offset ); }
2535 2561
2536 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2562 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2537};2563};
2538 2564
@@ -2564,7 +2590,7 @@ struct Chuck_Instr_Alloc_Vec3 : public Chuck_Instr_Unary_Op · 25 unmodified lines
2564public:2590public:
2565 Chuck_Instr_Alloc_Vec3( t_CKUINT offset )2591 Chuck_Instr_Alloc_Vec3( t_CKUINT offset )
2566 { this->set( offset ); }2592 { this->set( offset ); }
2567 2593
2568 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2594 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2569};2595};
2570 2596
@@ -2580,7 +2606,7 @@ struct Chuck_Instr_Alloc_Vec4 : public Chuck_Instr_Unary_Op · 9 unmodified lines
2580public:2606public:
2581 Chuck_Instr_Alloc_Vec4( t_CKUINT offset )2607 Chuck_Instr_Alloc_Vec4( t_CKUINT offset )
2582 { this->set( offset ); }2608 { this->set( offset ); }
2583 2609
2584 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2610 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2585};2611};
2586 2612
@@ -2644,7 +2670,7 @@ struct Chuck_Instr_Alloc_Member_Vec3 : public Chuck_Instr_Unary_Op · 57 unmodified lines
2644public:2670public:
2645 Chuck_Instr_Alloc_Member_Vec3( t_CKUINT offset )2671 Chuck_Instr_Alloc_Member_Vec3( t_CKUINT offset )
2646 { this->set( offset ); }2672 { this->set( offset ); }
2647 2673
2648 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2674 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2649};2675};
2650 2676
@@ -2660,7 +2686,7 @@ struct Chuck_Instr_Alloc_Member_Vec4 : public Chuck_Instr_Unary_Op · 9 unmodified lines
2660public:2686public:
2661 Chuck_Instr_Alloc_Member_Vec4( t_CKUINT offset )2687 Chuck_Instr_Alloc_Member_Vec4( t_CKUINT offset )
2662 { this->set( offset ); }2688 { this->set( offset ); }
2663 2689
2664 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2690 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2665};2691};
2666 2692
@@ -2678,22 +2704,22 @@ public: · 11 unmodified lines
2678 Chuck_Instr_Alloc_Word_Global()2704 Chuck_Instr_Alloc_Word_Global()
2679 { this->set( 0 ); m_stack_offset = 0; m_chuck_type = NULL;2705 { this->set( 0 ); m_stack_offset = 0; m_chuck_type = NULL;
2680 m_should_execute_ctors = FALSE; m_is_array = FALSE; }2706 m_should_execute_ctors = FALSE; m_is_array = FALSE; }
2681 2707
2682 virtual const char * params() const2708 virtual const char * params() const
2683 { static char buffer[256];2709 { static char buffer[CK_PRINT_BUF_LENGTH];
2684 sprintf( buffer, "name='%s'", m_name.c_str() );2710 snprintf( buffer, CK_PRINT_BUF_LENGTH, "name='%s'", m_name.c_str() );
2685 return buffer; }2711 return buffer; }
2686 2712
2687 // global name and type2713 // global name and type
2688 std::string m_name;2714 std::string m_name;
2689 te_GlobalType m_type;2715 te_GlobalType m_type;
2690 t_CKBOOL m_is_array;2716 t_CKBOOL m_is_array;
2691 2717
2692 // for objects2718 // for objects
2693 t_CKBOOL m_should_execute_ctors;2719 t_CKBOOL m_should_execute_ctors;
2694 t_CKUINT m_stack_offset;2720 t_CKUINT m_stack_offset;
2695 Chuck_Type * m_chuck_type;2721 Chuck_Type * m_chuck_type;
2696 2722
2697 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2723 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2698};2724};
2699 2725
@@ -2946,7 +2972,7 @@ struct Chuck_Instr_AddRef_Object2 : public Chuck_Instr_Unary_Op · 246 unmodified lines
2946public:2972public:
2947 Chuck_Instr_AddRef_Object2( t_CKUINT offset )2973 Chuck_Instr_AddRef_Object2( t_CKUINT offset )
2948 { this->set( offset ); }2974 { this->set( offset ); }
2949 2975
2950public:2976public:
2951 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2977 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2952};2978};
@@ -2957,6 +2983,7 @@ public: · 4 unmodified lines
2957//-----------------------------------------------------------------------------2983//-----------------------------------------------------------------------------
2958// name: struct Chuck_Instr_Reg_AddRef_Object32984// name: struct Chuck_Instr_Reg_AddRef_Object3
2959// desc: added 1.3.0.0 -- does the ref add in-place2985// desc: added 1.3.0.0 -- does the ref add in-place
2986// operates on top of the register stack
2960//-----------------------------------------------------------------------------2987//-----------------------------------------------------------------------------
2961struct Chuck_Instr_Reg_AddRef_Object3 : public Chuck_Instr2988struct Chuck_Instr_Reg_AddRef_Object3 : public Chuck_Instr
2962{2989{
@@ -2969,7 +2996,7 @@ public: · 6 unmodified lines
2969 2996
2970//-----------------------------------------------------------------------------2997//-----------------------------------------------------------------------------
2971// name: struct Chuck_Instr_Release_Object2998// name: struct Chuck_Instr_Release_Object
2972// desc: ...2999// desc: release object on stack by its offset
2973//-----------------------------------------------------------------------------3000//-----------------------------------------------------------------------------
2974struct Chuck_Instr_Release_Object : public Chuck_Instr3001struct Chuck_Instr_Release_Object : public Chuck_Instr
2975{3002{
@@ -2998,6 +3025,38 @@ public: · 22 unmodified lines
2998 3025
2999 3026
3000 3027
3028//-----------------------------------------------------------------------------
3029// name: struct Chuck_Instr_Release_Object3_Pop_Word
3030// desc: release object reference + pop from reg stack | 1.5.0.0 (ge) added
3031// the variant assumes object pointer directly on stack (not offset)
3032//-----------------------------------------------------------------------------
3033struct Chuck_Instr_Release_Object3_Pop_Word : public Chuck_Instr
3034{
3035public:
3036 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3037};
3038
3039
3040
3041
3042//-----------------------------------------------------------------------------
3043// name: struct Chuck_Instr_Release_Object4
3044// desc: release object reference from reg stack (no pop) | 1.5.0.0 (ge) added
3045// the variant assumes object pointer directly on stack (not offset)
3046//-----------------------------------------------------------------------------
3047struct Chuck_Instr_Release_Object4 : public Chuck_Instr_Unary_Op
3048{
3049public:
3050 Chuck_Instr_Release_Object4( t_CKUINT offset )
3051 { this->set( offset ); }
3052
3053public:
3054 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3055};
3056
3057
3058
3059
3001//-----------------------------------------------------------------------------3060//-----------------------------------------------------------------------------
3002// name: struct Chuck_Instr_Func_To_Code3061// name: struct Chuck_Instr_Func_To_Code
3003// desc: Chuck_Func * to Chuck_VM_Code *3062// desc: Chuck_Func * to Chuck_VM_Code *
@@ -3031,11 +3090,14 @@ public: · 27 unmodified lines
3031struct Chuck_Instr_Func_Call_Member : public Chuck_Instr_Unary_Op3090struct Chuck_Instr_Func_Call_Member : public Chuck_Instr_Unary_Op
3032{3091{
3033public:3092public:
3034 Chuck_Instr_Func_Call_Member( t_CKUINT ret_size )3093 Chuck_Instr_Func_Call_Member( t_CKUINT ret_size, Chuck_Func * func_ref )
3035 { this->set( ret_size ); }3094 { this->set( ret_size ); m_func_ref = func_ref; }
3036 3095
3037public:3096public:
3038 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3097 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3098
3099public:
3100 Chuck_Func * m_func_ref; // 1.5.0.0 (ge) | added for arg list cleanup
3039};3101};
3040 3102
3041 3103
@@ -3048,11 +3110,14 @@ public: · 6 unmodified lines
3048struct Chuck_Instr_Func_Call_Static : public Chuck_Instr_Unary_Op3110struct Chuck_Instr_Func_Call_Static : public Chuck_Instr_Unary_Op
3049{3111{
3050public:3112public:
3051 Chuck_Instr_Func_Call_Static( t_CKUINT ret_size )3113 Chuck_Instr_Func_Call_Static( t_CKUINT ret_size, Chuck_Func * func_ref )
3052 { this->set( ret_size ); }3114 { this->set( ret_size ); m_func_ref = func_ref; }
3053 3115
3054public:3116public:
3055 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3117 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3118
3119public:
3120 Chuck_Func * m_func_ref; // 1.5.0.0 (ge) | added for arg list cleanup
3056};3121};
3057 3122
3058 3123
@@ -3145,6 +3210,7 @@ protected: · 86 unmodified lines
3145 Chuck_Type * m_type_ref;3210 Chuck_Type * m_type_ref;
3146 t_CKINT m_length;3211 t_CKINT m_length;
3147 t_CKBOOL m_is_obj;3212 t_CKBOOL m_is_obj;
3213 t_CKBOOL m_is_float;
3148 char * m_param_str;3214 char * m_param_str;
3149};3215};
3150 3216
@@ -3158,8 +3224,9 @@ protected: · 7 unmodified lines
3158struct Chuck_Instr_Array_Alloc : public Chuck_Instr3224struct Chuck_Instr_Array_Alloc : public Chuck_Instr
3159{3225{
3160public: // REFACTOR-2017: added env3226public: // REFACTOR-2017: added env
3161 Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth, Chuck_Type * the_type,3227 Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth,
3162 t_CKUINT offset, t_CKBOOL ref );3228 Chuck_Type * contentType, t_CKUINT offset, t_CKBOOL ref,
3229 Chuck_Type * arrayType );
3163 virtual ~Chuck_Instr_Array_Alloc();3230 virtual ~Chuck_Instr_Array_Alloc();
3164 3231
3165public:3232public:
@@ -3168,7 +3235,8 @@ public: · 2 unmodified lines
3168 3235
3169protected:3236protected:
3170 t_CKUINT m_depth;3237 t_CKUINT m_depth;
3171 Chuck_Type * m_type_ref;3238 Chuck_Type * m_type_ref_content;
3239 Chuck_Type * m_type_ref_array; // 1.5.0.0 (ge) added
3172 t_CKBOOL m_is_obj;3240 t_CKBOOL m_is_obj;
3173 char * m_param_str;3241 char * m_param_str;
3174 t_CKUINT m_stack_offset;3242 t_CKUINT m_stack_offset;
@@ -3185,16 +3253,16 @@ protected: · 10 unmodified lines
3185struct Chuck_Instr_Array_Access : public Chuck_Instr3253struct Chuck_Instr_Array_Access : public Chuck_Instr
3186{3254{
3187public:3255public:
3188 Chuck_Instr_Array_Access( t_CKUINT kind, t_CKUINT emit_addr, 3256 Chuck_Instr_Array_Access( t_CKUINT kind, t_CKUINT emit_addr,
3189 t_CKUINT istr = FALSE )3257 t_CKUINT istr = FALSE )
3190 { m_kind = kind; m_emit_addr = emit_addr; m_istr = istr; }3258 { m_kind = kind; m_emit_addr = emit_addr; m_istr = istr; }
3191 3259
3192public:3260public:
3193 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3261 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3194 virtual const char * params() const3262 virtual const char * params() const
3195 { static char buffer[256];3263 { static char buffer[CK_PRINT_BUF_LENGTH];
3196 sprintf( buffer, "kind=%ld, emit_addr=%ld istr=%ld", 3264 snprintf( buffer, CK_PRINT_BUF_LENGTH, "kind=%ld, emit_addr=%p istr=%ld",
3197 m_kind, m_emit_addr, m_istr );3265 (long)m_kind, (void *)m_emit_addr, (long)m_istr );
3198 return buffer; }3266 return buffer; }
3199 3267
3200protected:3268protected:
@@ -3219,8 +3287,8 @@ public: · 18 unmodified lines
3219public:3287public:
3220 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3288 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3221 virtual const char * params() const3289 virtual const char * params() const
3222 { static char buffer[256];3290 { static char buffer[CK_PRINT_BUF_LENGTH];
3223 sprintf( buffer, "kind=%ld, emit_addr=%ld", m_kind, m_emit_addr );3291 snprintf( buffer, CK_PRINT_BUF_LENGTH, "kind=%ld, emit_addr=%p", (long)m_kind, (void *)m_emit_addr );
3224 return buffer; }3292 return buffer; }
3225 3293
3226protected:3294protected:
@@ -3246,15 +3314,15 @@ public: · 19 unmodified lines
3246public:3314public:
3247 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3315 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3248 virtual const char * params() const3316 virtual const char * params() const
3249 { static char buffer[256];3317 { static char buffer[CK_PRINT_BUF_LENGTH];
3250 sprintf( buffer, "depth=%ld, kind=%ld, emit_addr=%ld", m_depth, m_kind, m_emit_addr );3318 snprintf( buffer, CK_PRINT_BUF_LENGTH, "depth=%ld, kind=%ld, emit_addr=%p", (long)m_depth, (long)m_kind, (void *)m_emit_addr );
3251 return buffer; }3319 return buffer; }
3252 3320
3253protected:3321protected:
3254 t_CKUINT m_depth;3322 t_CKUINT m_depth;
3255 t_CKUINT m_kind;3323 t_CKUINT m_kind;
3256 t_CKUINT m_emit_addr;3324 t_CKUINT m_emit_addr;
3257 3325
3258 // 1.3.1.0 list of types of indices3326 // 1.3.1.0 list of types of indices
3259 std::vector<t_CKBOOL> m_indexIsAssociative;3327 std::vector<t_CKBOOL> m_indexIsAssociative;
3260};3328};
@@ -3275,8 +3343,8 @@ public: · 14 unmodified lines
3275public:3343public:
3276 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3344 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3277 virtual const char * params() const3345 virtual const char * params() const
3278 { static char buffer[256];3346 { static char buffer[CK_PRINT_BUF_LENGTH];
3279 sprintf( buffer, "offset=%ld, kind=%ld, emit_addr=%ld", m_offset, m_kind, m_emit_addr );3347 snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld, kind=%ld, emit_addr=%p", (long)m_offset, (long)m_kind, (void *)m_emit_addr );
3280 return buffer; }3348 return buffer; }
3281 3349
3282protected:3350protected:
@@ -3301,8 +3369,8 @@ public: · 18 unmodified lines
3301public:3369public:
3302 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3370 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3303 virtual const char * params() const3371 virtual const char * params() const
3304 { static char buffer[256];3372 { static char buffer[CK_PRINT_BUF_LENGTH];
3305 sprintf( buffer, "offset=%ld", m_offset );3373 snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld", (long)m_offset );
3306 return buffer; }3374 return buffer; }
3307 3375
3308protected:3376protected:
@@ -3321,14 +3389,14 @@ struct Chuck_Instr_Dot_Primitive_Func : public Chuck_Instr · 12 unmodified lines
3321public:3389public:
3322 Chuck_Instr_Dot_Primitive_Func( t_CKUINT native_func )3390 Chuck_Instr_Dot_Primitive_Func( t_CKUINT native_func )
3323 { m_native_func = native_func; }3391 { m_native_func = native_func; }
3324 3392
3325public:3393public:
3326 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3394 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3327 virtual const char * params() const3395 virtual const char * params() const
3328 { static char buffer[256];3396 { static char buffer[CK_PRINT_BUF_LENGTH];
3329 sprintf( buffer, "native_func=%ld", m_native_func );3397 snprintf( buffer, CK_PRINT_BUF_LENGTH, "native_func=%p", (void *)m_native_func );
3330 return buffer; }3398 return buffer; }
3331 3399
3332protected:3400protected:
3333 t_CKUINT m_native_func;3401 t_CKUINT m_native_func;
3334};3402};
@@ -3349,8 +3417,9 @@ public: · 14 unmodified lines
3349public:3417public:
3350 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3418 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3351 virtual const char * params() const3419 virtual const char * params() const
3352 { static char buffer[256];3420 { static char buffer[CK_PRINT_BUF_LENGTH];
3353 sprintf( buffer, "offset=%ld, size=%ld, kind=%ld, emit_addr=%ld", m_offset, m_size, m_kind, m_emit_addr );3421 snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld, size=%ld, kind=%ld, emit_addr=%p",
3422 (long)m_offset, (long)m_size, (long)m_kind, (void *)m_emit_addr );
3354 return buffer; }3423 return buffer; }
3355 3424
3356protected:3425protected:
@@ -3376,8 +3445,9 @@ public: · 19 unmodified lines
3376public:3445public:
3377 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3446 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3378 virtual const char * params() const3447 virtual const char * params() const
3379 { static char buffer[256];3448 { static char buffer[CK_PRINT_BUF_LENGTH];
3380 sprintf( buffer, "addr=%ld, kind=%ld, emit_addr=%ld", (t_CKUINT)m_addr, m_kind, m_emit_addr );3449 snprintf( buffer, CK_PRINT_BUF_LENGTH, "addr=%p, kind=%ld, emit_addr=%p",
3450 (void *)m_addr, (long)m_kind, (void *)m_emit_addr );
3381 return buffer; }3451 return buffer; }
3382 3452
3383protected:3453protected:
@@ -3402,8 +3472,8 @@ public: · 18 unmodified lines
3402public:3472public:
3403 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3473 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3404 virtual const char * params() const3474 virtual const char * params() const
3405 { static char buffer[256];3475 { static char buffer[CK_PRINT_BUF_LENGTH];
3406 sprintf( buffer, "func=%ld", (t_CKUINT)m_func );3476 snprintf( buffer, CK_PRINT_BUF_LENGTH, "func=%p", (void *)m_func );
3407 return buffer; }3477 return buffer; }
3408 3478
3409protected:3479protected:
@@ -3426,8 +3496,8 @@ public: · 16 unmodified lines
3426public:3496public:
3427 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3497 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3428 virtual const char * params() const3498 virtual const char * params() const
3429 { static char buffer[256];3499 { static char buffer[CK_PRINT_BUF_LENGTH];
3430 sprintf( buffer, "is_mem=%ld, emit_addr=%ld", m_is_mem, m_emit_addr );3500 snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
3431 return buffer; }3501 return buffer; }
3432 3502
3433protected:3503protected:
@@ -3451,8 +3521,8 @@ public: · 17 unmodified lines
3451public:3521public:
3452 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3522 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3453 virtual const char * params() const3523 virtual const char * params() const
3454 { static char buffer[256];3524 { static char buffer[CK_PRINT_BUF_LENGTH];
3455 sprintf( buffer, "is_mem=%ld, emit_addr=%ld", m_is_mem, m_emit_addr );3525 snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
3456 return buffer; }3526 return buffer; }
3457 3527
3458protected:3528protected:
@@ -3472,14 +3542,14 @@ struct Chuck_Instr_Dot_Cmp_Third : public Chuck_Instr · 13 unmodified lines
3472public:3542public:
3473 Chuck_Instr_Dot_Cmp_Third( t_CKUINT is_mem, t_CKUINT emit_addr )3543 Chuck_Instr_Dot_Cmp_Third( t_CKUINT is_mem, t_CKUINT emit_addr )
3474 { m_is_mem = is_mem; m_emit_addr = emit_addr; }3544 { m_is_mem = is_mem; m_emit_addr = emit_addr; }
3475 3545
3476public:3546public:
3477 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3547 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3478 virtual const char * params() const3548 virtual const char * params() const
3479 { static char buffer[256];3549 { static char buffer[CK_PRINT_BUF_LENGTH];
3480 sprintf( buffer, "is_mem=%ld, emit_addr=%ld", m_is_mem, m_emit_addr );3550 snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
3481 return buffer; }3551 return buffer; }
3482 3552
3483protected:3553protected:
3484 t_CKUINT m_is_mem;3554 t_CKUINT m_is_mem;
3485 t_CKUINT m_emit_addr;3555 t_CKUINT m_emit_addr;
@@ -3497,14 +3567,14 @@ struct Chuck_Instr_Dot_Cmp_Fourth : public Chuck_Instr · 11 unmodified lines
3497public:3567public:
3498 Chuck_Instr_Dot_Cmp_Fourth( t_CKUINT is_mem, t_CKUINT emit_addr )3568 Chuck_Instr_Dot_Cmp_Fourth( t_CKUINT is_mem, t_CKUINT emit_addr )
3499 { m_is_mem = is_mem; m_emit_addr = emit_addr; }3569 { m_is_mem = is_mem; m_emit_addr = emit_addr; }
3500 3570
3501public:3571public:
3502 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3572 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3503 virtual const char * params() const3573 virtual const char * params() const
3504 { static char buffer[256];3574 { static char buffer[CK_PRINT_BUF_LENGTH];
3505 sprintf( buffer, "is_mem=%ld, emit_addr=%ld", m_is_mem, m_emit_addr );3575 snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
3506 return buffer; }3576 return buffer; }
3507 3577
3508protected:3578protected:
3509 t_CKUINT m_is_mem;3579 t_CKUINT m_is_mem;
3510 t_CKUINT m_emit_addr;3580 t_CKUINT m_emit_addr;
@@ -3586,10 +3656,10 @@ struct Chuck_Instr_UGen_Link : public Chuck_Instr · 75 unmodified lines
3586{3656{
3587public:3657public:
3588 Chuck_Instr_UGen_Link( t_CKBOOL isUpChuck = FALSE );3658 Chuck_Instr_UGen_Link( t_CKBOOL isUpChuck = FALSE );
3589 3659
3590public:3660public:
3591 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3661 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3592 3662
3593protected:3663protected:
3594 t_CKBOOL m_isUpChuck;3664 t_CKBOOL m_isUpChuck;
3595};3665};
@@ -3609,7 +3679,7 @@ public: · 13 unmodified lines
3609 { }3679 { }
3610 3680
3611 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3681 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3612 3682
3613protected:3683protected:
3614 t_CKBOOL m_srcIsArray, m_dstIsArray;3684 t_CKBOOL m_srcIsArray, m_dstIsArray;
3615};3685};
chuginate/template/chuck/include/chuck_io.h+32−29
@@ -53,9 +53,9 @@ t_CKBOOL init_class_MidiRW( Chuck_Env * env ); · 52 unmodified lines
53t_CKBOOL init_class_HID( Chuck_Env * env );53t_CKBOOL init_class_HID( Chuck_Env * env );
54#endif54#endif
55t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type );55t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type );
56#ifndef __DISABLE_FILEIO__56// #ifndef __DISABLE_FILEIO__
57t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type );57t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type );
58#endif58// #endif
59// added 1.3.0.0 -- moved to be full-fledged class59// added 1.3.0.0 -- moved to be full-fledged class
60t_CKBOOL init_class_chout( Chuck_Env * env, Chuck_Type * type );60t_CKBOOL init_class_chout( Chuck_Env * env, Chuck_Type * type );
61// added 1.3.0.0 -- moved to be full-fledged class61// added 1.3.0.0 -- moved to be full-fledged class
@@ -77,7 +77,7 @@ CK_DLL_SFUN( io_newline ); · 15 unmodified lines
77CK_DLL_SFUN( io_openfile );77CK_DLL_SFUN( io_openfile );
78 78
79 79
80#ifndef __DISABLE_FILEIO__80// #ifndef __DISABLE_FILEIO__
81//-----------------------------------------------------------------------------81//-----------------------------------------------------------------------------
82// fileio API82// fileio API
83//-----------------------------------------------------------------------------83//-----------------------------------------------------------------------------
@@ -99,6 +99,9 @@ CK_DLL_MFUN( fileio_read ); · 15 unmodified lines
99CK_DLL_MFUN( fileio_readline );99CK_DLL_MFUN( fileio_readline );
100CK_DLL_MFUN( fileio_readint );100CK_DLL_MFUN( fileio_readint );
101CK_DLL_MFUN( fileio_readintflags );101CK_DLL_MFUN( fileio_readintflags );
102CK_DLL_MFUN( fileio_readint8 );
103CK_DLL_MFUN( fileio_readint16 );
104CK_DLL_MFUN( fileio_readint32 );
102CK_DLL_MFUN( fileio_readfloat );105CK_DLL_MFUN( fileio_readfloat );
103CK_DLL_MFUN( fileio_eof );106CK_DLL_MFUN( fileio_eof );
104CK_DLL_MFUN( fileio_more );107CK_DLL_MFUN( fileio_more );
@@ -106,7 +109,7 @@ CK_DLL_MFUN( fileio_writestring ); · 1 unmodified line
106CK_DLL_MFUN( fileio_writeint );109CK_DLL_MFUN( fileio_writeint );
107CK_DLL_MFUN( fileio_writeintflags );110CK_DLL_MFUN( fileio_writeintflags );
108CK_DLL_MFUN( fileio_writefloat );111CK_DLL_MFUN( fileio_writefloat );
109#endif112// #endif // __DISABLE_FILEIO__
110 113
111 114
112//-----------------------------------------------------------------------------115//-----------------------------------------------------------------------------
@@ -289,29 +292,29 @@ struct Chuck_IO_Serial : public Chuck_IO · 176 unmodified lines
289public:292public:
290 Chuck_IO_Serial( Chuck_VM * vm );293 Chuck_IO_Serial( Chuck_VM * vm );
291 virtual ~Chuck_IO_Serial();294 virtual ~Chuck_IO_Serial();
292 295
293 static void shutdown();296 static void shutdown();
294 297
295public:298public:
296 // meta299 // meta
297 virtual t_CKBOOL open( const t_CKUINT i, t_CKINT flags, t_CKUINT baud = CK_BAUD_9600 );300 virtual t_CKBOOL open( const t_CKUINT i, t_CKINT flags, t_CKUINT baud = CK_BAUD_9600 );
298 virtual t_CKBOOL open( const std::string & path, t_CKINT flags, t_CKUINT baud = CK_BAUD_9600 );301 virtual t_CKBOOL open( const std::string & path, t_CKINT flags, t_CKUINT baud = CK_BAUD_9600 );
299 302
300 virtual t_CKBOOL can_wait();303 virtual t_CKBOOL can_wait();
301 304
302 virtual t_CKBOOL good();305 virtual t_CKBOOL good();
303 virtual void close();306 virtual void close();
304 virtual void flush();307 virtual void flush();
305 virtual t_CKINT mode();308 virtual t_CKINT mode();
306 virtual void mode( t_CKINT flag );309 virtual void mode( t_CKINT flag );
307 310
308 // reading311 // reading
309 virtual Chuck_String * readLine();312 virtual Chuck_String * readLine();
310 virtual t_CKINT readInt( t_CKINT flags );313 virtual t_CKINT readInt( t_CKINT flags );
311 virtual t_CKFLOAT readFloat();314 virtual t_CKFLOAT readFloat();
312 virtual t_CKBOOL readString( std::string & str );315 virtual t_CKBOOL readString( std::string & str );
313 virtual t_CKBOOL eof();316 virtual t_CKBOOL eof();
314 317
315 // writing318 // writing
316 virtual void write( const std::string & val );319 virtual void write( const std::string & val );
317 virtual void write( t_CKINT val );320 virtual void write( t_CKINT val );
@@ -322,7 +325,7 @@ public: · 4 unmodified lines
322 // serial stuff325 // serial stuff
323 virtual t_CKBOOL setBaudRate( t_CKUINT rate );326 virtual t_CKBOOL setBaudRate( t_CKUINT rate );
324 virtual t_CKUINT getBaudRate();327 virtual t_CKUINT getBaudRate();
325 328
326 // async reading329 // async reading
327 virtual t_CKBOOL readAsync( t_CKUINT type, t_CKUINT num );330 virtual t_CKBOOL readAsync( t_CKUINT type, t_CKUINT num );
328 virtual Chuck_String * getLine();331 virtual Chuck_String * getLine();
@@ -331,8 +334,8 @@ public: · 2 unmodified lines
331 virtual Chuck_Array * getInts();334 virtual Chuck_Array * getInts();
332 virtual Chuck_Array * getFloats();335 virtual Chuck_Array * getFloats();
333 virtual Chuck_String * getString();336 virtual Chuck_String * getString();
334 337
335 static const t_CKUINT TYPE_NONE; 338 static const t_CKUINT TYPE_NONE;
336 static const t_CKUINT TYPE_BYTE;339 static const t_CKUINT TYPE_BYTE;
337 static const t_CKUINT TYPE_WORD;340 static const t_CKUINT TYPE_WORD;
338 static const t_CKUINT TYPE_INT;341 static const t_CKUINT TYPE_INT;
@@ -340,14 +343,14 @@ public: · 1 unmodified line
340 static const t_CKUINT TYPE_STRING;343 static const t_CKUINT TYPE_STRING;
341 static const t_CKUINT TYPE_LINE;344 static const t_CKUINT TYPE_LINE;
342 static const t_CKUINT TYPE_WRITE;345 static const t_CKUINT TYPE_WRITE;
343 346
344 struct Request347 struct Request
345 {348 {
346 t_CKUINT m_type; // type349 t_CKUINT m_type; // type
347 t_CKUINT m_num; // how many350 t_CKUINT m_num; // how many
348 t_CKUINT m_status;351 t_CKUINT m_status;
349 t_CKUINT m_val; // ISSUE: 64-bit352 t_CKUINT m_val; // ISSUE: 64-bit
350 353
351 enum Status354 enum Status
352 {355 {
353 RQ_STATUS_PENDING,356 RQ_STATUS_PENDING,
@@ -357,9 +360,9 @@ public: · 3 unmodified lines
357 RQ_STATUS_EOF,360 RQ_STATUS_EOF,
358 };361 };
359 };362 };
360 363
361 virtual t_CKBOOL ready();364 virtual t_CKBOOL ready();
362 365
363 // available baud rates366 // available baud rates
364 static const t_CKUINT CK_BAUD_2400;367 static const t_CKUINT CK_BAUD_2400;
365 static const t_CKUINT CK_BAUD_4800;368 static const t_CKUINT CK_BAUD_4800;
@@ -375,7 +378,7 @@ public: · 9 unmodified lines
375 static const t_CKUINT CK_BAUD_230400;378 static const t_CKUINT CK_BAUD_230400;
376 379
377protected:380protected:
378 381
379 void start_read_thread();382 void start_read_thread();
380 XThread * m_read_thread;383 XThread * m_read_thread;
381 static void *shell_read_cb(void *);384 static void *shell_read_cb(void *);
@@ -384,14 +387,14 @@ protected: · 2 unmodified lines
384 XThread * m_write_thread;387 XThread * m_write_thread;
385 static void *shell_write_cb(void *);388 static void *shell_write_cb(void *);
386 void write_cb();389 void write_cb();
387 390
388 void close_int();391 void close_int();
389 392
390 t_CKBOOL get_buffer(t_CKINT timeout_ms = 1);393 t_CKBOOL get_buffer(t_CKINT timeout_ms = 1);
391 t_CKINT peek_buffer();394 t_CKINT peek_buffer();
392 t_CKINT pull_buffer();395 t_CKINT pull_buffer();
393 t_CKINT buffer_bytes_to_tmp(t_CKINT num_bytes);396 t_CKINT buffer_bytes_to_tmp(t_CKINT num_bytes);
394 397
395 t_CKBOOL handle_line(Request &);398 t_CKBOOL handle_line(Request &);
396 t_CKBOOL handle_string(Request &);399 t_CKBOOL handle_string(Request &);
397 t_CKBOOL handle_float_ascii(Request &);400 t_CKBOOL handle_float_ascii(Request &);
@@ -399,38 +402,38 @@ protected: · 1 unmodified line
399 t_CKBOOL handle_byte(Request &);402 t_CKBOOL handle_byte(Request &);
400 t_CKBOOL handle_float_binary(Request &);403 t_CKBOOL handle_float_binary(Request &);
401 t_CKBOOL handle_int_binary(Request &);404 t_CKBOOL handle_int_binary(Request &);
402 405
403 bool m_do_read_thread;406 bool m_do_read_thread;
404 bool m_do_write_thread;407 bool m_do_write_thread;
405 408
406 CircularBuffer<Request> m_asyncRequests;409 CircularBuffer<Request> m_asyncRequests;
407 CircularBuffer<Request> m_asyncResponses;410 CircularBuffer<Request> m_asyncResponses;
408 CBufferSimple * m_event_buffer;411 CBufferSimple * m_event_buffer;
409 412
410 int m_fd;413 int m_fd;
411 FILE * m_cfd;414 FILE * m_cfd;
412 415
413 std::string m_path;416 std::string m_path;
414 417
415 unsigned char * m_io_buf;418 unsigned char * m_io_buf;
416 t_CKUINT m_io_buf_max;419 t_CKUINT m_io_buf_max;
417 t_CKUINT m_io_buf_available;420 t_CKUINT m_io_buf_available;
418 t_CKUINT m_io_buf_pos;421 t_CKUINT m_io_buf_pos;
419 422
420 unsigned char * m_tmp_buf;423 unsigned char * m_tmp_buf;
421 t_CKUINT m_tmp_buf_max;424 t_CKUINT m_tmp_buf_max;
422 425
423 CircularBuffer<Request> m_asyncWriteRequests;426 CircularBuffer<Request> m_asyncWriteRequests;
424 CircularBuffer<char> m_writeBuffer;427 CircularBuffer<char> m_writeBuffer;
425 428
426 t_CKINT m_flags;429 t_CKINT m_flags;
427 t_CKINT m_iomode; // SYNC or ASYNC430 t_CKINT m_iomode; // SYNC or ASYNC
428 t_CKBOOL m_eof;431 t_CKBOOL m_eof;
429 432
430 t_CKBOOL m_do_exit;433 t_CKBOOL m_do_exit;
431 434
432 static std::list<Chuck_IO_Serial *> s_serials;435 static std::list<Chuck_IO_Serial *> s_serials;
433 436
434 Chuck_VM * m_vmRef;437 Chuck_VM * m_vmRef;
435};438};
436#endif // __DISABLE_SERIAL__439#endif // __DISABLE_SERIAL__
chuginate/template/chuck/include/chuck_lang.h+40−3
@@ -58,7 +58,8 @@ t_CKBOOL init_class_string( Chuck_Env * env, Chuck_Type * type ); · 57 unmodified lines
58t_CKBOOL init_class_array( Chuck_Env * env, Chuck_Type * type );58t_CKBOOL init_class_array( Chuck_Env * env, Chuck_Type * type );
59t_CKBOOL init_class_vec3( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.359t_CKBOOL init_class_vec3( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3
60t_CKBOOL init_class_vec4( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.360t_CKBOOL init_class_vec4( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3
61 61t_CKBOOL init_class_type( Chuck_Env * env, Chuck_Type * type ); // 1.5.0.0
62t_CKBOOL init_primitive_types( Chuck_Env * env ); // 1.5.0.0
62 63
63 64
64 65
@@ -69,11 +70,11 @@ t_CKBOOL init_class_vec4( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3 · 4 unmodified lines
69CK_DLL_CTOR( object_ctor );70CK_DLL_CTOR( object_ctor );
70CK_DLL_DTOR( object_dtor );71CK_DLL_DTOR( object_dtor );
71CK_DLL_MFUN( object_equals );72CK_DLL_MFUN( object_equals );
72CK_DLL_MFUN( object_getType );
73CK_DLL_MFUN( object_hashCode );73CK_DLL_MFUN( object_hashCode );
74CK_DLL_MFUN( object_toString );74CK_DLL_MFUN( object_toString );
75CK_DLL_MFUN( object_dump );75CK_DLL_MFUN( object_dump );
76CK_DLL_SFUN( object_apropos );76CK_DLL_SFUN( object_help );
77CK_DLL_SFUN( object_typeInfo );
77 78
78 79
79//-----------------------------------------------------------------------------80//-----------------------------------------------------------------------------
@@ -180,12 +181,17 @@ CK_DLL_MFUN( array_set_size ); · 100 unmodified lines
180CK_DLL_MFUN( array_get_size );181CK_DLL_MFUN( array_get_size );
181CK_DLL_MFUN( array_push_back );182CK_DLL_MFUN( array_push_back );
182CK_DLL_MFUN( array_pop_back );183CK_DLL_MFUN( array_pop_back );
184CK_DLL_MFUN( array_pop_out );
183CK_DLL_MFUN( array_push_front );185CK_DLL_MFUN( array_push_front );
184CK_DLL_MFUN( array_pop_front );186CK_DLL_MFUN( array_pop_front );
185CK_DLL_MFUN( array_find );187CK_DLL_MFUN( array_find );
186CK_DLL_MFUN( array_erase );188CK_DLL_MFUN( array_erase );
187CK_DLL_MFUN( array_clear );189CK_DLL_MFUN( array_clear );
188CK_DLL_MFUN( array_reset );190CK_DLL_MFUN( array_reset );
191CK_DLL_MFUN( array_zero );
192CK_DLL_MFUN( array_get_keys );
193CK_DLL_MFUN( array_reverse );
194CK_DLL_MFUN( array_shuffle );
189 195
190 196
191//-----------------------------------------------------------------------------197//-----------------------------------------------------------------------------
@@ -254,6 +260,37 @@ CK_DLL_MFUN( vec4_magnitude ); · 62 unmodified lines
254CK_DLL_MFUN( vec4_normalize );260CK_DLL_MFUN( vec4_normalize );
255 261
256 262
263//-----------------------------------------------------------------------------
264// type API | 1.5.0.0 (ge) added
265//-----------------------------------------------------------------------------
266CK_DLL_CTOR( type_ctor );
267CK_DLL_DTOR( type_dtor );
268CK_DLL_MFUN( type_equals );
269CK_DLL_MFUN( type_isa );
270CK_DLL_MFUN( type_isa_str );
271CK_DLL_MFUN( type_name );
272CK_DLL_MFUN( type_parent ); // return parent Type
273CK_DLL_MFUN( type_children ); // return children Types
274CK_DLL_MFUN( type_origin ); // built-in, chugin, defined in chuck
275CK_DLL_MFUN( type_isPrimitive );
276CK_DLL_MFUN( type_isArray );
277CK_DLL_MFUN( type_arrayDims );
278CK_DLL_SFUN( type_findString );
279CK_DLL_SFUN( type_typeOf_obj ); // Type.typeOf( Object )
280CK_DLL_SFUN( type_typeOf_int ); // Type.typeOf( int )
281CK_DLL_SFUN( type_typeOf_float ); // Type.typeOf( float )
282CK_DLL_SFUN( type_typeOf_time ); // Type.typeOf( time )
283CK_DLL_SFUN( type_typeOf_dur ); // Type.typeOf( dur )
284CK_DLL_SFUN( type_typeOf_complex ); // Type.typeOf( complex )
285CK_DLL_SFUN( type_typeOf_polar ); // Type.typeOf( polar )
286CK_DLL_SFUN( type_typeOf_vec3 ); // Type.typeOf( vec3 )
287CK_DLL_SFUN( type_typeOf_vec4 ); // Type.typeOf( vec4 )
288CK_DLL_SFUN( type_getTypes );
289CK_DLL_SFUN( type_getTypesAll );
290
291
292
293
257//-----------------------------------------------------------------------------294//-----------------------------------------------------------------------------
258// name: Data_Exception295// name: Data_Exception
259// desc: data for base Chuck Exception class296// desc: data for base Chuck Exception class
chuginate/template/chuck/include/chuck_oo.h+93−41
@@ -98,7 +98,9 @@ public: · 97 unmodified lines
98 virtual void release();98 virtual void release();
99 // lock99 // lock
100 virtual void lock();100 virtual void lock();
101 101 // unlock | 1.5.0.0 (ge) added
102 virtual void unlock();
103
102 // NOTE: be careful when overriding these, should always104 // NOTE: be careful when overriding these, should always
103 // explicitly call up to ChucK_VM_Object (ge: 2013)105 // explicitly call up to ChucK_VM_Object (ge: 2013)
104 106
@@ -132,7 +134,7 @@ private: · 27 unmodified lines
132//{134//{
133//public:135//public:
134// static Chuck_VM_Alloc * instance();136// static Chuck_VM_Alloc * instance();
135// 137//
136//public:138//public:
137// void add_object( Chuck_VM_Object * obj );139// void add_object( Chuck_VM_Object * obj );
138// void free_object( Chuck_VM_Object * obj );140// void free_object( Chuck_VM_Object * obj );
@@ -180,8 +182,8 @@ public: · 41 unmodified lines
180 182
181public:183public:
182 // output type info (can be overriden; but probably shouldn't be)184 // output type info (can be overriden; but probably shouldn't be)
183 virtual void apropos();185 virtual void help();
184 186
185public:187public:
186 // virtual table188 // virtual table
187 Chuck_VTable * vtable;189 Chuck_VTable * vtable;
@@ -228,7 +230,15 @@ public: · 40 unmodified lines
228 virtual t_CKINT find( const std::string & key ) = 0; // find230 virtual t_CKINT find( const std::string & key ) = 0; // find
229 virtual t_CKINT erase( const std::string & key ) = 0; // erase231 virtual t_CKINT erase( const std::string & key ) = 0; // erase
230 virtual void clear( ) = 0; // clear232 virtual void clear( ) = 0; // clear
231 233 virtual void zero( t_CKUINT start, t_CKUINT end ) = 0; // zero
234 virtual void zero() = 0; // zero (all)
235 // get map keys | added (1.4.2.0) nshaheed
236 virtual void get_keys( std::vector<std::string> & keys ) = 0;
237 // reverse array order | added (1.5.0.0) azaday
238 virtual void reverse() = 0;
239 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
240 virtual void shuffle() = 0;
241
232 Chuck_Type * m_array_type;242 Chuck_Type * m_array_type;
233};243};
234 244
@@ -254,8 +264,10 @@ public: · 19 unmodified lines
254 t_CKINT set( const std::string & key, t_CKUINT val );264 t_CKINT set( const std::string & key, t_CKUINT val );
255 t_CKINT push_back( t_CKUINT val );265 t_CKINT push_back( t_CKUINT val );
256 t_CKINT pop_back( );266 t_CKINT pop_back( );
267 t_CKINT pop_out( t_CKINT pos );
257 t_CKINT back( t_CKUINT * val ) const;268 t_CKINT back( t_CKUINT * val ) const;
258 void zero( t_CKUINT start, t_CKUINT end );269 void zero( t_CKUINT start, t_CKUINT end );
270 void zero() { this->zero(0, m_vector.size()); }
259 271
260 virtual void clear( );272 virtual void clear( );
261 virtual t_CKINT size( ) { return m_vector.size(); }273 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -264,13 +276,22 @@ public: · 2 unmodified lines
264 virtual t_CKINT set_capacity( t_CKINT capacity );276 virtual t_CKINT set_capacity( t_CKINT capacity );
265 virtual t_CKINT find( const std::string & key );277 virtual t_CKINT find( const std::string & key );
266 virtual t_CKINT erase( const std::string & key );278 virtual t_CKINT erase( const std::string & key );
267 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY4_DATASIZE; } 279 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY4_DATASIZE; }
268 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY4_DATAKIND; } 280 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY4_DATAKIND; }
281 // get map keys | added (1.4.2.0) nshaheed
282 virtual void get_keys( std::vector<std::string> & keys );
283 // reverse array order | added (1.5.0.0) azaday
284 virtual void reverse();
285 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
286 virtual void shuffle();
269 287
270public:288public:
271 std::vector<t_CKUINT> m_vector;289 std::vector<t_CKUINT> m_vector;
272 std::map<std::string, t_CKUINT> m_map;290 std::map<std::string, t_CKUINT> m_map;
273 t_CKBOOL m_is_obj;291 t_CKBOOL m_is_obj;
292
293 // TODO: may need additional information here for set_size, if this is part of a multi-dim array
294
274 // t_CKINT m_size;295 // t_CKINT m_size;
275 // t_CKINT m_capacity;296 // t_CKINT m_capacity;
276};297};
@@ -297,8 +318,10 @@ public: · 20 unmodified lines
297 t_CKINT set( const std::string & key, t_CKFLOAT val );318 t_CKINT set( const std::string & key, t_CKFLOAT val );
298 t_CKINT push_back( t_CKFLOAT val );319 t_CKINT push_back( t_CKFLOAT val );
299 t_CKINT pop_back( );320 t_CKINT pop_back( );
321 t_CKINT pop_out( t_CKINT pos );
300 t_CKINT back( t_CKFLOAT * val ) const;322 t_CKINT back( t_CKFLOAT * val ) const;
301 void zero( t_CKUINT start, t_CKUINT end );323 void zero( t_CKUINT start, t_CKUINT end );
324 void zero() { this->zero(0, m_vector.size()); }
302 325
303 virtual void clear( );326 virtual void clear( );
304 virtual t_CKINT size( ) { return m_vector.size(); }327 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -308,7 +331,13 @@ public: · 3 unmodified lines
308 virtual t_CKINT find( const std::string & key );331 virtual t_CKINT find( const std::string & key );
309 virtual t_CKINT erase( const std::string & key );332 virtual t_CKINT erase( const std::string & key );
310 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY8_DATASIZE; }333 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY8_DATASIZE; }
311 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY8_DATAKIND; } 334 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY8_DATAKIND; }
335 // get map keys | added (1.4.2.0) nshaheed
336 virtual void get_keys( std::vector<std::string> & keys );
337 // reverse array order | added (1.5.0.0) azaday
338 virtual void reverse();
339 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
340 virtual void shuffle();
312 341
313public:342public:
314 std::vector<t_CKFLOAT> m_vector;343 std::vector<t_CKFLOAT> m_vector;
@@ -339,8 +368,10 @@ public: · 24 unmodified lines
339 t_CKINT set( const std::string & key, const t_CKCOMPLEX & val );368 t_CKINT set( const std::string & key, const t_CKCOMPLEX & val );
340 t_CKINT push_back( const t_CKCOMPLEX & val );369 t_CKINT push_back( const t_CKCOMPLEX & val );
341 t_CKINT pop_back( );370 t_CKINT pop_back( );
371 t_CKINT pop_out( t_CKINT pos );
342 t_CKINT back( t_CKCOMPLEX * val ) const;372 t_CKINT back( t_CKCOMPLEX * val ) const;
343 void zero( t_CKUINT start, t_CKUINT end );373 void zero( t_CKUINT start, t_CKUINT end );
374 void zero() { this->zero(0, m_vector.size()); }
344 375
345 virtual void clear( );376 virtual void clear( );
346 virtual t_CKINT size( ) { return m_vector.size(); }377 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -350,7 +381,13 @@ public: · 3 unmodified lines
350 virtual t_CKINT find( const std::string & key );381 virtual t_CKINT find( const std::string & key );
351 virtual t_CKINT erase( const std::string & key );382 virtual t_CKINT erase( const std::string & key );
352 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY16_DATASIZE; }383 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY16_DATASIZE; }
353 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY16_DATAKIND; } 384 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY16_DATAKIND; }
385 // get map keys | added (1.4.2.0) nshaheed
386 virtual void get_keys( std::vector<std::string> & keys );
387 // reverse array order | added (1.5.0.0) azaday
388 virtual void reverse();
389 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
390 virtual void shuffle();
354 391
355public:392public:
356 std::vector<t_CKCOMPLEX> m_vector;393 std::vector<t_CKCOMPLEX> m_vector;
@@ -371,7 +408,7 @@ struct Chuck_Array24 : Chuck_Array · 14 unmodified lines
371public:408public:
372 Chuck_Array24( t_CKINT capacity = 8 );409 Chuck_Array24( t_CKINT capacity = 8 );
373 virtual ~Chuck_Array24();410 virtual ~Chuck_Array24();
374 411
375public:412public:
376 t_CKUINT addr( t_CKINT i );413 t_CKUINT addr( t_CKINT i );
377 t_CKUINT addr( const std::string & key );414 t_CKUINT addr( const std::string & key );
@@ -381,9 +418,11 @@ public: · 3 unmodified lines
381 t_CKINT set( const std::string & key, const t_CKVEC3 & val );418 t_CKINT set( const std::string & key, const t_CKVEC3 & val );
382 t_CKINT push_back( const t_CKVEC3 & val );419 t_CKINT push_back( const t_CKVEC3 & val );
383 t_CKINT pop_back( );420 t_CKINT pop_back( );
421 t_CKINT pop_out( t_CKUINT pos );
384 t_CKINT back( t_CKVEC3 * val ) const;422 t_CKINT back( t_CKVEC3 * val ) const;
385 void zero( t_CKUINT start, t_CKUINT end );423 void zero( t_CKUINT start, t_CKUINT end );
386 424 void zero() { this->zero(0, m_vector.size()); }
425
387 virtual void clear( );426 virtual void clear( );
388 virtual t_CKINT size( ) { return m_vector.size(); }427 virtual t_CKINT size( ) { return m_vector.size(); }
389 virtual t_CKINT capacity( ) { return m_vector.capacity(); }428 virtual t_CKINT capacity( ) { return m_vector.capacity(); }
@@ -393,7 +432,13 @@ public: · 3 unmodified lines
393 virtual t_CKINT erase( const std::string & key );432 virtual t_CKINT erase( const std::string & key );
394 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY24_DATASIZE; }433 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY24_DATASIZE; }
395 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY24_DATAKIND; }434 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY24_DATAKIND; }
396 435 // get map keys | added (1.4.2.0) nshaheed
436 virtual void get_keys( std::vector<std::string> & keys );
437 // reverse array order | added (1.5.0.0) azaday
438 virtual void reverse();
439 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
440 virtual void shuffle();
441
397public:442public:
398 std::vector<t_CKVEC3> m_vector;443 std::vector<t_CKVEC3> m_vector;
399 std::map<std::string, t_CKVEC3> m_map;444 std::map<std::string, t_CKVEC3> m_map;
@@ -411,7 +456,7 @@ struct Chuck_Array32 : Chuck_Array · 11 unmodified lines
411public:456public:
412 Chuck_Array32( t_CKINT capacity = 8 );457 Chuck_Array32( t_CKINT capacity = 8 );
413 virtual ~Chuck_Array32();458 virtual ~Chuck_Array32();
414 459
415public:460public:
416 t_CKUINT addr( t_CKINT i );461 t_CKUINT addr( t_CKINT i );
417 t_CKUINT addr( const std::string & key );462 t_CKUINT addr( const std::string & key );
@@ -421,9 +466,11 @@ public: · 3 unmodified lines
421 t_CKINT set( const std::string & key, const t_CKVEC4 & val );466 t_CKINT set( const std::string & key, const t_CKVEC4 & val );
422 t_CKINT push_back( const t_CKVEC4 & val );467 t_CKINT push_back( const t_CKVEC4 & val );
423 t_CKINT pop_back( );468 t_CKINT pop_back( );
469 t_CKINT pop_out( t_CKUINT pos );
424 t_CKINT back( t_CKVEC4 * val ) const;470 t_CKINT back( t_CKVEC4 * val ) const;
425 void zero( t_CKUINT start, t_CKUINT end );471 void zero( t_CKUINT start, t_CKUINT end );
426 472 void zero() { this->zero(0, m_vector.size()); }
473
427 virtual void clear( );474 virtual void clear( );
428 virtual t_CKINT size( ) { return m_vector.size(); }475 virtual t_CKINT size( ) { return m_vector.size(); }
429 virtual t_CKINT capacity( ) { return m_vector.capacity(); }476 virtual t_CKINT capacity( ) { return m_vector.capacity(); }
@@ -433,7 +480,13 @@ public: · 3 unmodified lines
433 virtual t_CKINT erase( const std::string & key );480 virtual t_CKINT erase( const std::string & key );
434 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY32_DATASIZE; }481 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY32_DATASIZE; }
435 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY32_DATAKIND; }482 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY32_DATAKIND; }
436 483 // get map keys | added (1.4.1.2) nshaheed
484 virtual void get_keys( std::vector<std::string> & keys );
485 // reverse array order | added (1.5.0.0) azaday
486 virtual void reverse();
487 // reverse array order | added (1.5.0.0) kunwoo, nshaheed, azaday, ge
488 virtual void shuffle();
489
437public:490public:
438 std::vector<t_CKVEC4> m_vector;491 std::vector<t_CKVEC4> m_vector;
439 std::map<std::string, t_CKVEC4> m_map;492 std::map<std::string, t_CKVEC4> m_map;
@@ -457,7 +510,7 @@ struct Chuck_Global_Event_Listener · 17 unmodified lines
457 Chuck_Global_Get_Callback_Type callback_type;510 Chuck_Global_Get_Callback_Type callback_type;
458 std::string name;511 std::string name;
459 t_CKINT id;512 t_CKINT id;
460 Chuck_Global_Event_Listener() : void_callback(NULL), listen_forever(FALSE), 513 Chuck_Global_Event_Listener() : void_callback(NULL), listen_forever(FALSE),
461 callback_type(ck_get_plain), name(""), id(0) {};514 callback_type(ck_get_plain), name(""), id(0) {};
462};515};
463 516
@@ -550,7 +603,7 @@ struct Chuck_IO : Chuck_Event · 86 unmodified lines
550public:603public:
551 Chuck_IO();604 Chuck_IO();
552 virtual ~Chuck_IO();605 virtual ~Chuck_IO();
553 606
554public:607public:
555 // meta608 // meta
556 virtual t_CKBOOL good() = 0;609 virtual t_CKBOOL good() = 0;
@@ -558,29 +611,37 @@ public: · 1 unmodified line
558 virtual void flush() = 0;611 virtual void flush() = 0;
559 virtual t_CKINT mode() = 0;612 virtual t_CKINT mode() = 0;
560 virtual void mode( t_CKINT flag ) = 0;613 virtual void mode( t_CKINT flag ) = 0;
561 614
562 // reading615 // reading
563 virtual Chuck_String * readLine() = 0;616 virtual Chuck_String * readLine() = 0;
564 virtual t_CKINT readInt( t_CKINT flags ) = 0;617 virtual t_CKINT readInt( t_CKINT flags ) = 0;
565 virtual t_CKFLOAT readFloat() = 0;618 virtual t_CKFLOAT readFloat() = 0;
566 virtual t_CKBOOL readString( std::string & str ) = 0;619 virtual t_CKBOOL readString( std::string & str ) = 0;
567 virtual t_CKBOOL eof() = 0;620 virtual t_CKBOOL eof() = 0;
568 621
569 // writing622 // writing
570 virtual void write( const std::string & val ) = 0;623 virtual void write( const std::string & val ) = 0;
571 virtual void write( t_CKINT val ) = 0;624 virtual void write( t_CKINT val ) = 0;
572 virtual void write( t_CKINT val, t_CKINT flags ) = 0;625 virtual void write( t_CKINT val, t_CKINT flags ) = 0;
573 virtual void write( t_CKFLOAT val ) = 0;626 virtual void write( t_CKFLOAT val ) = 0;
574 627
575 // constants
576public:628public:
629 // type | moved to IO in 1.5.0.0 (ge)
630 static const t_CKINT TYPE_ASCII;
631 static const t_CKINT TYPE_BINARY;
632 // datatype
577 static const t_CKINT INT32;633 static const t_CKINT INT32;
578 static const t_CKINT INT16;634 static const t_CKINT INT16;
579 static const t_CKINT INT8;635 static const t_CKINT INT8;
580 636 // flags | moved to IO in 1.5.0.0 (ge)
637 static const t_CKINT FLAG_READ_WRITE;
638 static const t_CKINT FLAG_READONLY;
639 static const t_CKINT FLAG_WRITEONLY;
640 static const t_CKINT FLAG_APPEND;
581 // asynchronous I/O members641 // asynchronous I/O members
582 static const t_CKINT MODE_SYNC;642 static const t_CKINT MODE_SYNC;
583 static const t_CKINT MODE_ASYNC;643 static const t_CKINT MODE_ASYNC;
644
584 Chuck_Event * m_asyncEvent;645 Chuck_Event * m_asyncEvent;
585 #ifndef __DISABLE_THREADS__646 #ifndef __DISABLE_THREADS__
586 XThread * m_thread;647 XThread * m_thread;
@@ -597,7 +658,7 @@ public: · 10 unmodified lines
597 658
598 659
599 660
600#ifndef __DISABLE_FILEIO__661// #ifndef __DISABLE_FILEIO__
601//-----------------------------------------------------------------------------662//-----------------------------------------------------------------------------
602// name: Chuck_IO_File663// name: Chuck_IO_File
603// desc: Chuck File IO class664// desc: Chuck File IO class
@@ -608,7 +669,7 @@ public: · 4 unmodified lines
608 // REFACTOR-2017669 // REFACTOR-2017
609 Chuck_IO_File( Chuck_VM * vm );670 Chuck_IO_File( Chuck_VM * vm );
610 virtual ~Chuck_IO_File();671 virtual ~Chuck_IO_File();
611 672
612public:673public:
613 // meta674 // meta
614 virtual t_CKBOOL open( const std::string & path, t_CKINT flags );675 virtual t_CKBOOL open( const std::string & path, t_CKINT flags );
@@ -618,15 +679,15 @@ public: · 3 unmodified lines
618 virtual t_CKINT mode();679 virtual t_CKINT mode();
619 virtual void mode( t_CKINT flag );680 virtual void mode( t_CKINT flag );
620 virtual t_CKINT size();681 virtual t_CKINT size();
621 682
622 // seeking683 // seeking
623 virtual void seek( t_CKINT pos );684 virtual void seek( t_CKINT pos );
624 virtual t_CKINT tell();685 virtual t_CKINT tell();
625 686
626 // directories687 // directories
627 virtual t_CKINT isDir();688 virtual t_CKINT isDir();
628 virtual Chuck_Array4 * dirList();689 virtual Chuck_Array4 * dirList();
629 690
630 // reading691 // reading
631 // virtual Chuck_String * read( t_CKINT length );692 // virtual Chuck_String * read( t_CKINT length );
632 virtual Chuck_String * readLine();693 virtual Chuck_String * readLine();
@@ -634,7 +695,7 @@ public: · 1 unmodified line
634 virtual t_CKFLOAT readFloat();695 virtual t_CKFLOAT readFloat();
635 virtual t_CKBOOL readString( std::string & str );696 virtual t_CKBOOL readString( std::string & str );
636 virtual t_CKBOOL eof();697 virtual t_CKBOOL eof();
637 698
638 // reading -- async699 // reading -- async
639 /* TODO: doesn't look like asynchronous reads will work700 /* TODO: doesn't look like asynchronous reads will work
640 static THREAD_RETURN ( THREAD_TYPE read_thread ) ( void *data );701 static THREAD_RETURN ( THREAD_TYPE read_thread ) ( void *data );
@@ -642,29 +703,20 @@ public: · 1 unmodified line
642 static THREAD_RETURN ( THREAD_TYPE readInt_thread ) ( void *data );703 static THREAD_RETURN ( THREAD_TYPE readInt_thread ) ( void *data );
643 static THREAD_RETURN ( THREAD_TYPE readFloat_thread ) ( void *data );704 static THREAD_RETURN ( THREAD_TYPE readFloat_thread ) ( void *data );
644 */705 */
645 706
646 // writing707 // writing
647 virtual void write( const std::string & val );708 virtual void write( const std::string & val );
648 virtual void write( t_CKINT val );709 virtual void write( t_CKINT val );
649 virtual void write( t_CKINT val, t_CKINT flags );710 virtual void write( t_CKINT val, t_CKINT flags );
650 virtual void write( t_CKFLOAT val );711 virtual void write( t_CKFLOAT val );
651 712
652 #ifndef __DISABLE_THREADS__713 #ifndef __DISABLE_THREADS__
653 // writing -- async714 // writing -- async
654 static THREAD_RETURN ( THREAD_TYPE writeStr_thread ) ( void *data );715 static THREAD_RETURN ( THREAD_TYPE writeStr_thread ) ( void *data );
655 static THREAD_RETURN ( THREAD_TYPE writeInt_thread ) ( void *data );716 static THREAD_RETURN ( THREAD_TYPE writeInt_thread ) ( void *data );
656 static THREAD_RETURN ( THREAD_TYPE writeFloat_thread ) ( void *data );717 static THREAD_RETURN ( THREAD_TYPE writeFloat_thread ) ( void *data );
657 #endif718 #endif
658 719
659public:
660 // constants
661 static const t_CKINT FLAG_READ_WRITE;
662 static const t_CKINT FLAG_READONLY;
663 static const t_CKINT FLAG_WRITEONLY;
664 static const t_CKINT FLAG_APPEND;
665 static const t_CKINT TYPE_ASCII;
666 static const t_CKINT TYPE_BINARY;
667
668protected:720protected:
669 // open flags721 // open flags
670 t_CKINT m_flags;722 t_CKINT m_flags;
@@ -681,7 +733,7 @@ protected: · 10 unmodified lines
681 // vm and shred733 // vm and shred
682 Chuck_VM * m_vmRef;734 Chuck_VM * m_vmRef;
683};735};
684#endif // __DISABLE_FILEIO__736// #endif // __DISABLE_FILEIO__
685 737
686 738
687 739
chuginate/template/chuck/include/chuck_otf.h+4−4
@@ -74,15 +74,15 @@ void otf_hton( Net_Msg * msg ); · 73 unmodified lines
74void otf_ntoh( Net_Msg * msg );74void otf_ntoh( Net_Msg * msg );
75 75
76// process incoming message76// process incoming message
77t_CKUINT otf_process_msg( Chuck_VM * vm, Chuck_Compiler * compiler, 77t_CKUINT otf_process_msg( Chuck_VM * vm, Chuck_Compiler * compiler,
78 Net_Msg * msg, t_CKBOOL immediate, void * data );78 Net_Msg * msg, t_CKBOOL immediate, void * data );
79 79
80// send command80// send command
81int otf_send_cmd( int argc, const char ** argv, t_CKINT & i, const char * host, int port, int * is_otf = NULL );81t_CKINT otf_send_cmd( t_CKINT argc, const char ** argv, t_CKINT & i, const char * host, t_CKINT port, t_CKINT * is_otf = NULL );
82// send file to remote host82// send file to remote host
83int otf_send_file( const char * filename, Net_Msg & msg, const char * op, ck_socket sock );83t_CKINT otf_send_file( const char * filename, Net_Msg & msg, const char * op, ck_socket sock );
84// connect84// connect
85ck_socket otf_send_connect( const char * host, int port );85ck_socket otf_send_connect( const char * host, t_CKINT port );
86 86
87// callback87// callback
88void * otf_cb( void * p );88void * otf_cb( void * p );
chuginate/template/chuck/include/chuck_parse.h+7−5
@@ -63,6 +63,8 @@ t_CKBOOL chuck_parse( c_constr fname, FILE * fd = NULL, c_constr code = NULL ); · 62 unmodified lines
63// reset the parser63// reset the parser
64void reset_parse( );64void reset_parse( );
65 65
66// convert abstract syntax expression to string
67std::string absyn2str( a_Exp exp );
66 68
67// syntax highlighting tools69// syntax highlighting tools
68#include <vector>70#include <vector>
@@ -103,7 +105,7 @@ struct SyntaxToken · 34 unmodified lines
103 std::string::size_type begin;105 std::string::size_type begin;
104 // from the beginning of line106 // from the beginning of line
105 std::string::size_type end;107 std::string::size_type end;
106 108
107 // constructor109 // constructor
108 SyntaxToken() : type(0) { }110 SyntaxToken() : type(0) { }
109 // copy constructor111 // copy constructor
@@ -121,7 +123,7 @@ struct SyntaxToken · 11 unmodified lines
121struct SyntaxTokenList123struct SyntaxTokenList
122{124{
123 std::vector<SyntaxToken> list;125 std::vector<SyntaxToken> list;
124 std::vector<SyntaxToken>::size_type howmany; 126 std::vector<SyntaxToken>::size_type howmany;
125 // copy constructor127 // copy constructor
126 SyntaxTokenList( const SyntaxTokenList & rhs )128 SyntaxTokenList( const SyntaxTokenList & rhs )
127 {129 {
@@ -133,9 +135,9 @@ struct SyntaxTokenList · 5 unmodified lines
133 for( std::vector<SyntaxToken>::size_type i = 0; i < howmany; i++ )135 for( std::vector<SyntaxToken>::size_type i = 0; i < howmany; i++ )
134 list[i] = rhs.list[i];136 list[i] = rhs.list[i];
135 }137 }
136 SyntaxTokenList() { 138 SyntaxTokenList() {
137 howmany = 0;139 howmany = 0;
138 }140 }
139};141};
140 142
141 143
chuginate/template/chuck/include/chuck_scan.h+2−2
@@ -38,13 +38,13 @@ · 37 unmodified lines
38 38
39 39
40// scan a program into the env - type discovery scan40// scan a program into the env - type discovery scan
41t_CKBOOL type_engine_scan0_prog( Chuck_Env * env, a_Program prog, 41t_CKBOOL type_engine_scan0_prog( Chuck_Env * env, a_Program prog,
42 te_HowMuch val = te_do_all );42 te_HowMuch val = te_do_all );
43// scan a class definition (used by type_engine_add_dll())43// scan a class definition (used by type_engine_add_dll())
44t_CKBOOL type_engine_scan0_class_def( Chuck_Env * env, a_Class_Def def );44t_CKBOOL type_engine_scan0_class_def( Chuck_Env * env, a_Class_Def def );
45 45
46// scan a program into the env - type resolution scan46// scan a program into the env - type resolution scan
47t_CKBOOL type_engine_scan1_prog( Chuck_Env * env, a_Program prog, 47t_CKBOOL type_engine_scan1_prog( Chuck_Env * env, a_Program prog,
48 te_HowMuch val = te_do_all );48 te_HowMuch val = te_do_all );
49// scan a class definition (used by type_engine_add_dll())49// scan a class definition (used by type_engine_add_dll())
50t_CKBOOL type_engine_scan1_class_def( Chuck_Env * env, a_Class_Def def );50t_CKBOOL type_engine_scan1_class_def( Chuck_Env * env, a_Class_Def def );
chuginate/template/chuck/include/chuck_shell.h+80−80
@@ -51,7 +51,7 @@ typedef string Chuck_Shell_Response; · 50 unmodified lines
51 51
52//-----------------------------------------------------------------------------52//-----------------------------------------------------------------------------
53// name: class Chuck_Shell53// name: class Chuck_Shell
54// desc: controller class for facilitating interaction between a shell UI and a 54// desc: controller class for facilitating interaction between a shell UI and a
55// shell mode.55// shell mode.
56//-----------------------------------------------------------------------------56//-----------------------------------------------------------------------------
57class Chuck_Shell57class Chuck_Shell
@@ -59,7 +59,7 @@ class Chuck_Shell · 1 unmodified line
59public:59public:
60 Chuck_Shell();60 Chuck_Shell();
61 virtual ~Chuck_Shell();61 virtual ~Chuck_Shell();
62 62
63 t_CKBOOL init( Chuck_VM * process_vm, Chuck_Shell_UI * );63 t_CKBOOL init( Chuck_VM * process_vm, Chuck_Shell_UI * );
64 void run();64 void run();
65 t_CKBOOL execute( string &, string & );65 t_CKBOOL execute( string &, string & );
@@ -79,35 +79,35 @@ public: // HACK-GE: these were moved from protected for win32 · 13 unmodified lines
79 map < string, string > variables;79 map < string, string > variables;
80 map < string, Command * > commands;80 map < string, Command * > commands;
81 vector < Command * > allocated_commands;81 vector < Command * > allocated_commands;
82 82
83 map < string, string > saved_code;83 map < string, string > saved_code;
84 84
85 string code;85 string code;
86 86
87 // helper functions87 // helper functions
88 t_CKBOOL do_glob( const string &, string &, vector < string > & );88 t_CKBOOL do_glob( const string &, string &, vector < string > & );
89 void do_code( string &, string &, string command = "+ " );89 void do_code( string &, string &, string command = "+ " );
90 void do_code_context( string & );90 void do_code_context( string & );
91 91
92protected:92protected:
93 // helper functions93 // helper functions
94 void do_aliases();94 void do_aliases();
95 void do_variables();95 void do_variables();
96 96
97 // code helper functions97 // code helper functions
98 void start_code();98 void start_code();
99 void continue_code( string & );99 void continue_code( string & );
100 void string_hash( string &, string & );100 void string_hash( string &, string & );
101 101
102 Chuck_Shell_UI * ui;102 Chuck_Shell_UI * ui;
103 103
104 t_CKBOOL initialized;104 t_CKBOOL initialized;
105 t_CKBOOL stop;105 t_CKBOOL stop;
106 106
107 string prompt;107 string prompt;
108 108
109 string in;109 string in;
110 110
111 // code entry variables111 // code entry variables
112 t_CKBOOL code_entry_active;112 t_CKBOOL code_entry_active;
113 t_CKUINT scope;113 t_CKUINT scope;
@@ -127,13 +127,13 @@ public: // HACK-GE: moved from protected for win32 · 13 unmodified lines
127 public:127 public:
128 virtual t_CKBOOL init( Chuck_Shell * );128 virtual t_CKBOOL init( Chuck_Shell * );
129 virtual t_CKINT execute( vector< string > &, string & ) = 0;129 virtual t_CKINT execute( vector< string > &, string & ) = 0;
130 virtual string usage();130 virtual string usage();
131 virtual string long_usage();131 virtual string long_usage();
132 132
133 protected:133 protected:
134 Chuck_Shell * caller;134 Chuck_Shell * caller;
135 };135 };
136 136
137//-----------------------------------------------------------------------------137//-----------------------------------------------------------------------------
138// name: class Chuck_Shell::Command_VM138// name: class Chuck_Shell::Command_VM
139// desc: ...139// desc: ...
@@ -144,8 +144,8 @@ public: // HACK-GE: moved from protected for win32 · 4 unmodified lines
144 ~Command_VM();144 ~Command_VM();
145 t_CKBOOL init( Chuck_Shell * );145 t_CKBOOL init( Chuck_Shell * );
146 t_CKINT execute( vector< string > &, string & );146 t_CKINT execute( vector< string > &, string & );
147 string usage();147 string usage();
148 148
149 protected:149 protected:
150 map < string, Command * > commands;150 map < string, Command * > commands;
151 vector < Command * > allocated_commands;151 vector < Command * > allocated_commands;
@@ -160,7 +160,7 @@ public: // HACK-GE: moved from protected for win32 · 8 unmodified lines
160 public:160 public:
161 t_CKINT execute( vector< string > &, string & );161 t_CKINT execute( vector< string > &, string & );
162 };162 };
163 163
164//-----------------------------------------------------------------------------164//-----------------------------------------------------------------------------
165// name: class Chuck_Shell::Command_VM_Remove165// name: class Chuck_Shell::Command_VM_Remove
166// desc: ...166// desc: ...
@@ -180,7 +180,7 @@ public: // HACK-GE: moved from protected for win32 · 13 unmodified lines
180 public:180 public:
181 t_CKINT execute( vector< string > &, string & );181 t_CKINT execute( vector< string > &, string & );
182 };182 };
183 183
184//-----------------------------------------------------------------------------184//-----------------------------------------------------------------------------
185// name: class Chuck_Shell::Command_VM_List185// name: class Chuck_Shell::Command_VM_List
186// desc: ...186// desc: ...
@@ -190,7 +190,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
190 public:190 public:
191 t_CKINT execute( vector< string > &, string & );191 t_CKINT execute( vector< string > &, string & );
192 };192 };
193 193
194//-----------------------------------------------------------------------------194//-----------------------------------------------------------------------------
195// name: class Chuck_Shell::Command_VM_Swap195// name: class Chuck_Shell::Command_VM_Swap
196// desc: ...196// desc: ...
@@ -200,7 +200,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
200 public:200 public:
201 t_CKINT execute( vector< string > &, string & );201 t_CKINT execute( vector< string > &, string & );
202 };202 };
203 203
204//-----------------------------------------------------------------------------204//-----------------------------------------------------------------------------
205// name: class Chuck_Shell::Command_VM_AttachAdd205// name: class Chuck_Shell::Command_VM_AttachAdd
206// desc: ...206// desc: ...
@@ -210,7 +210,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
210 public:210 public:
211 t_CKINT execute( vector< string > &, string & );211 t_CKINT execute( vector< string > &, string & );
212 };212 };
213 213
214//-----------------------------------------------------------------------------214//-----------------------------------------------------------------------------
215// name: class Chuck_Shell::Command_Add215// name: class Chuck_Shell::Command_Add
216// desc: ...216// desc: ...
@@ -219,9 +219,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
219 {219 {
220 public:220 public:
221 t_CKINT execute( vector < string > &, string & );221 t_CKINT execute( vector < string > &, string & );
222 string usage();222 string usage();
223 };223 };
224 224
225//-----------------------------------------------------------------------------225//-----------------------------------------------------------------------------
226// name: class Chuck_Shell::Command_Remove226// name: class Chuck_Shell::Command_Remove
227// desc: ...227// desc: ...
@@ -230,9 +230,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
230 {230 {
231 public:231 public:
232 t_CKINT execute( vector < string > &, string & );232 t_CKINT execute( vector < string > &, string & );
233 string usage();233 string usage();
234 };234 };
235 235
236//-----------------------------------------------------------------------------236//-----------------------------------------------------------------------------
237// name: class Chuck_Shell::Command_Status237// name: class Chuck_Shell::Command_Status
238// desc: ...238// desc: ...
@@ -241,10 +241,10 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
241 {241 {
242 public:242 public:
243 t_CKINT execute( vector < string > &, string & );243 t_CKINT execute( vector < string > &, string & );
244 string usage();244 string usage();
245 };245 };
246 246
247 //-----------------------------------------------------------------------------247 //-----------------------------------------------------------------------------
248// name: class Chuck_Shell::Command_Removeall248// name: class Chuck_Shell::Command_Removeall
249// desc: ...249// desc: ...
250//-----------------------------------------------------------------------------250//-----------------------------------------------------------------------------
@@ -252,9 +252,9 @@ public: // HACK-GE: moved from protected for win32 · 1 unmodified line
252 {252 {
253 public:253 public:
254 t_CKINT execute( vector< string > &, string & );254 t_CKINT execute( vector< string > &, string & );
255 string usage();255 string usage();
256 };256 };
257 257
258//-----------------------------------------------------------------------------258//-----------------------------------------------------------------------------
259// name: class Chuck_Shell::Command_Removelast259// name: class Chuck_Shell::Command_Removelast
260// desc: ...260// desc: ...
@@ -263,9 +263,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
263 {263 {
264 public:264 public:
265 t_CKINT execute( vector< string > &, string & );265 t_CKINT execute( vector< string > &, string & );
266 string usage();266 string usage();
267 };267 };
268 268
269//-----------------------------------------------------------------------------269//-----------------------------------------------------------------------------
270// name: class Chuck_Shell::Command_Replace270// name: class Chuck_Shell::Command_Replace
271// desc: ...271// desc: ...
@@ -274,9 +274,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
274 {274 {
275 public:275 public:
276 t_CKINT execute( vector< string > &, string & );276 t_CKINT execute( vector< string > &, string & );
277 string usage();277 string usage();
278 };278 };
279 279
280//-----------------------------------------------------------------------------280//-----------------------------------------------------------------------------
281// name: class Chuck_Shell::Command_Kill281// name: class Chuck_Shell::Command_Kill
282// desc: ...282// desc: ...
@@ -285,9 +285,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
285 {285 {
286 public:286 public:
287 t_CKINT execute( vector< string > &, string & );287 t_CKINT execute( vector< string > &, string & );
288 //string usage();288 //string usage();
289 };289 };
290 290
291//-----------------------------------------------------------------------------291//-----------------------------------------------------------------------------
292// name: class Chuck_Shell::Command_Close292// name: class Chuck_Shell::Command_Close
293// desc: ...293// desc: ...
@@ -296,9 +296,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
296 {296 {
297 public:297 public:
298 t_CKINT execute( vector< string > &, string & );298 t_CKINT execute( vector< string > &, string & );
299 //string usage();299 //string usage();
300 };300 };
301 301
302//-----------------------------------------------------------------------------302//-----------------------------------------------------------------------------
303// name: class Chuck_Shell::Command_Exit303// name: class Chuck_Shell::Command_Exit
304// desc: ...304// desc: ...
@@ -307,9 +307,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
307 {307 {
308 public:308 public:
309 t_CKINT execute( vector< string > &, string & );309 t_CKINT execute( vector< string > &, string & );
310 //string usage();310 //string usage();
311 };311 };
312 312
313//-----------------------------------------------------------------------------313//-----------------------------------------------------------------------------
314// name: class Chuck_Shell::Command_Ls314// name: class Chuck_Shell::Command_Ls
315// desc: ...315// desc: ...
@@ -318,9 +318,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
318 {318 {
319 public:319 public:
320 t_CKINT execute( vector< string > &, string & );320 t_CKINT execute( vector< string > &, string & );
321 //string usage();321 //string usage();
322 };322 };
323 323
324//-----------------------------------------------------------------------------324//-----------------------------------------------------------------------------
325// name: class Chuck_Shell::Command_Cd325// name: class Chuck_Shell::Command_Cd
326// desc: ...326// desc: ...
@@ -329,9 +329,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
329 {329 {
330 public:330 public:
331 t_CKINT execute( vector< string > &, string & );331 t_CKINT execute( vector< string > &, string & );
332 //string usage();332 //string usage();
333 };333 };
334 334
335//-----------------------------------------------------------------------------335//-----------------------------------------------------------------------------
336// name: class Chuck_Shell::Command_Pwd336// name: class Chuck_Shell::Command_Pwd
337// desc: ...337// desc: ...
@@ -341,7 +341,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
341 public:341 public:
342 t_CKINT execute( vector< string > &, string & );342 t_CKINT execute( vector< string > &, string & );
343 };343 };
344 344
345//-----------------------------------------------------------------------------345//-----------------------------------------------------------------------------
346// name: class Chuck_Shell::Command_Alias346// name: class Chuck_Shell::Command_Alias
347// desc: ...347// desc: ...
@@ -351,7 +351,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
351 public:351 public:
352 t_CKINT execute( vector< string > &, string & );352 t_CKINT execute( vector< string > &, string & );
353 };353 };
354 354
355//-----------------------------------------------------------------------------355//-----------------------------------------------------------------------------
356// name: class Chuck_Shell::Command_Unalias356// name: class Chuck_Shell::Command_Unalias
357// desc: ...357// desc: ...
@@ -361,7 +361,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
361 public:361 public:
362 t_CKINT execute( vector< string > &, string & );362 t_CKINT execute( vector< string > &, string & );
363 };363 };
364 364
365//-----------------------------------------------------------------------------365//-----------------------------------------------------------------------------
366// name: class Chuck_Shell::Command_Source366// name: class Chuck_Shell::Command_Source
367// desc: ...367// desc: ...
@@ -371,7 +371,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
371 public:371 public:
372 t_CKINT execute( vector< string > &, string & );372 t_CKINT execute( vector< string > &, string & );
373 };373 };
374 374
375//-----------------------------------------------------------------------------375//-----------------------------------------------------------------------------
376// name: class Chuck_Shell::Command_Code376// name: class Chuck_Shell::Command_Code
377// desc: ...377// desc: ...
@@ -382,13 +382,13 @@ public: // HACK-GE: moved from protected for win32 · 4 unmodified lines
382 ~Command_Code();382 ~Command_Code();
383 t_CKBOOL init( Chuck_Shell * );383 t_CKBOOL init( Chuck_Shell * );
384 t_CKINT execute( vector< string > &, string & );384 t_CKINT execute( vector< string > &, string & );
385 string usage();385 string usage();
386 386
387 private:387 private:
388 map < string, Command * > commands;388 map < string, Command * > commands;
389 vector < Command * > allocated_commands;389 vector < Command * > allocated_commands;
390 };390 };
391 391
392//-----------------------------------------------------------------------------392//-----------------------------------------------------------------------------
393// name: class Chuck_Shell::Command_CodeContext393// name: class Chuck_Shell::Command_CodeContext
394// desc: ...394// desc: ...
@@ -398,7 +398,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
398 public:398 public:
399 t_CKINT execute( vector< string > &, string & );399 t_CKINT execute( vector< string > &, string & );
400 };400 };
401 401
402//-----------------------------------------------------------------------------402//-----------------------------------------------------------------------------
403// name: class Chuck_Shell::Command_CodeSave403// name: class Chuck_Shell::Command_CodeSave
404// desc: ...404// desc: ...
@@ -413,22 +413,22 @@ public: // HACK-GE: moved from protected for win32 · 8 unmodified lines
413// name: class Chuck_Shell::Command_CodeDelete413// name: class Chuck_Shell::Command_CodeDelete
414// desc: ...414// desc: ...
415//-----------------------------------------------------------------------------415//-----------------------------------------------------------------------------
416 class Command_CodeDelete : public Command416 class Command_CodeDelete : public Command
417 {417 {
418 public:418 public:
419 t_CKINT execute( vector< string > &, string & );419 t_CKINT execute( vector< string > &, string & );
420 };420 };
421 421
422//-----------------------------------------------------------------------------422//-----------------------------------------------------------------------------
423// name: class Chuck_Shell::Command_CodeAdd423// name: class Chuck_Shell::Command_CodeAdd
424// desc: ...424// desc: ...
425//-----------------------------------------------------------------------------425//-----------------------------------------------------------------------------
426 class Command_CodeAdd : public Command426 class Command_CodeAdd : public Command
427 {427 {
428 public:428 public:
429 t_CKINT execute( vector< string > &, string & );429 t_CKINT execute( vector< string > &, string & );
430 };430 };
431 431
432//-----------------------------------------------------------------------------432//-----------------------------------------------------------------------------
433// name: class Chuck_Shell::Command_CodeList433// name: class Chuck_Shell::Command_CodeList
434// desc: ...434// desc: ...
@@ -448,7 +448,7 @@ public: // HACK-GE: moved from protected for win32 · 13 unmodified lines
448 public:448 public:
449 t_CKINT execute( vector< string > &, string & );449 t_CKINT execute( vector< string > &, string & );
450 };450 };
451 451
452//-----------------------------------------------------------------------------452//-----------------------------------------------------------------------------
453// name: class Chuck_Shell::Command_CodeWrite453// name: class Chuck_Shell::Command_CodeWrite
454// desc: ...454// desc: ...
@@ -468,7 +468,7 @@ public: // HACK-GE: moved from protected for win32 · 13 unmodified lines
468 public:468 public:
469 t_CKINT execute( vector< string > &, string & );469 t_CKINT execute( vector< string > &, string & );
470 };470 };
471 471
472//-----------------------------------------------------------------------------472//-----------------------------------------------------------------------------
473// name: class Chuck_Shell::Command_Help473// name: class Chuck_Shell::Command_Help
474// desc: ...474// desc: ...
@@ -478,7 +478,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
478 public:478 public:
479 t_CKINT execute( vector< string > &, string & );479 t_CKINT execute( vector< string > &, string & );
480 };480 };
481 481
482};482};
483 483
484 484
@@ -492,7 +492,7 @@ public: · 7 unmodified lines
492 virtual ~Chuck_Shell_VM() {}492 virtual ~Chuck_Shell_VM() {}
493 493
494public:494public:
495 virtual Chuck_Shell_VM * copy()=0;495 virtual Chuck_Shell_VM * copy()=0;
496 virtual t_CKBOOL add_shred( const vector< string > &, string & )=0;496 virtual t_CKBOOL add_shred( const vector< string > &, string & )=0;
497 virtual t_CKBOOL remove_shred( const vector< string > &, string & )=0;497 virtual t_CKBOOL remove_shred( const vector< string > &, string & )=0;
498 virtual t_CKBOOL remove_all( string & )=0;498 virtual t_CKBOOL remove_all( string & )=0;
@@ -511,9 +511,9 @@ class Chuck_Shell_Network_VM : public Chuck_Shell_VM · 12 unmodified lines
511{511{
512public:512public:
513 virtual ~Chuck_Shell_Network_VM() {}513 virtual ~Chuck_Shell_Network_VM() {}
514 514
515public:515public:
516 Chuck_Shell_VM * copy();516 Chuck_Shell_VM * copy();
517 t_CKBOOL init( const string &, t_CKINT );517 t_CKBOOL init( const string &, t_CKINT );
518 t_CKBOOL add_shred( const vector< string > &, string & );518 t_CKBOOL add_shred( const vector< string > &, string & );
519 t_CKBOOL remove_shred( const vector< string > &, string & );519 t_CKBOOL remove_shred( const vector< string > &, string & );
@@ -523,9 +523,9 @@ public: · 3 unmodified lines
523 t_CKBOOL status( string & );523 t_CKBOOL status( string & );
524 t_CKBOOL kill( string & );524 t_CKBOOL kill( string & );
525 string fullname();525 string fullname();
526 526
527private: 527private:
528 string hostname;528 string hostname;
529 t_CKINT port;529 t_CKINT port;
530};530};
531/*531/*
@@ -537,9 +537,9 @@ class Chuck_Shell_Process_VM : public Chuck_Shell_VM · 5 unmodified lines
537{537{
538public:538public:
539 virtual ~Chuck_Shell_Process_VM() {}539 virtual ~Chuck_Shell_Process_VM() {}
540 540
541public:541public:
542 Chuck_Shell_VM * copy();542 Chuck_Shell_VM * copy();
543 t_CKBOOL init( const string &, t_CKINT );543 t_CKBOOL init( const string &, t_CKINT );
544 t_CKBOOL add_shred( const vector< string > &, string & );544 t_CKBOOL add_shred( const vector< string > &, string & );
545 t_CKBOOL remove_shred( const vector< string > &, string & );545 t_CKBOOL remove_shred( const vector< string > &, string & );
@@ -549,12 +549,12 @@ public: · 3 unmodified lines
549 t_CKBOOL status( string & );549 t_CKBOOL status( string & );
550 t_CKBOOL kill( string & );550 t_CKBOOL kill( string & );
551 string fullname();551 string fullname();
552 552
553 t_CKUINT last_shred_id();553 t_CKUINT last_shred_id();
554 554
555private: 555private:
556 Chuck_VM * vm;556 Chuck_VM * vm;
557 Chuck_Compiler * compiler;557 Chuck_Compiler * compiler;
558};558};
559*/559*/
560//-----------------------------------------------------------------------------560//-----------------------------------------------------------------------------
chuginate/template/chuck/include/chuck_stats.h+10−10
@@ -64,7 +64,7 @@ struct Shred_Activation · 63 unmodified lines
64{64{
65 t_CKTIME when;65 t_CKTIME when;
66 t_CKUINT cycles;66 t_CKUINT cycles;
67 67
68 Shred_Activation( t_CKTIME a, t_CKUINT b ) { when = a; cycles = b; }68 Shred_Activation( t_CKTIME a, t_CKUINT b ) { when = a; cycles = b; }
69};69};
70 70
@@ -108,31 +108,31 @@ public: · 37 unmodified lines
108 std::string owner;108 std::string owner;
109 // source109 // source
110 std::string source;110 std::string source;
111 111
112 // ctrl rate calculation112 // ctrl rate calculation
113 std::queue<t_CKDUR> diffs;113 std::queue<t_CKDUR> diffs;
114 // number of diffs114 // number of diffs
115 t_CKUINT num_diffs;115 t_CKUINT num_diffs;
116 // total diffs116 // total diffs
117 t_CKDUR diff_total;117 t_CKDUR diff_total;
118 118
119 // exe per activation119 // exe per activation
120 std::queue<t_CKUINT> act_cycles;120 std::queue<t_CKUINT> act_cycles;
121 // total121 // total
122 t_CKUINT act_cycles_total;122 t_CKUINT act_cycles_total;
123 // last123 // last
124 t_CKUINT last_cycles;124 t_CKUINT last_cycles;
125 125
126 // children126 // children
127 std::vector<Shred_Stat *> children;127 std::vector<Shred_Stat *> children;
128 void get_sporked( std::vector<Shred_Stat *> & out );128 void get_sporked( std::vector<Shred_Stat *> & out );
129 129
130 std::vector<Shred_Activation> activationss;130 std::vector<Shred_Activation> activationss;
131 void get_activations( std::vector<Shred_Activation> & out );131 void get_activations( std::vector<Shred_Activation> & out );
132 132
133 // mutex133 // mutex
134 XMutex mutex;134 XMutex mutex;
135 135
136 // audicle info136 // audicle info
137 Shred_Data * data;137 Shred_Data * data;
138 Shred_Time * time;138 Shred_Time * time;
@@ -161,7 +161,7 @@ public: · 22 unmodified lines
161 static Chuck_Stats * instance();161 static Chuck_Stats * instance();
162 162
163public:163public:
164 void set_vm_ref( Chuck_VM * _vm ) { vm = _vm; } 164 void set_vm_ref( Chuck_VM * _vm ) { vm = _vm; }
165 165
166public:166public:
167 void add_shred( Chuck_VM_Shred * shred );167 void add_shred( Chuck_VM_Shred * shred );
@@ -173,16 +173,16 @@ public: · 5 unmodified lines
173public:173public:
174 Shred_Stat * get_shred( t_CKUINT xid )174 Shred_Stat * get_shred( t_CKUINT xid )
175 { mutex.acquire(); Shred_Stat * s = shreds[xid]; mutex.release(); return s; }175 { mutex.acquire(); Shred_Stat * s = shreds[xid]; mutex.release(); return s; }
176 void get_shreds( std::vector<Shred_Stat *> & out, 176 void get_shreds( std::vector<Shred_Stat *> & out,
177 std::map<Shred_Stat *, Shred_Stat *> & d );177 std::map<Shred_Stat *, Shred_Stat *> & d );
178 static t_CKBOOL activations_yes;178 static t_CKBOOL activations_yes;
179 179
180protected:180protected:
181 Chuck_Stats();181 Chuck_Stats();
182 ~Chuck_Stats();182 ~Chuck_Stats();
183 183
184 static Chuck_Stats * our_instance;184 static Chuck_Stats * our_instance;
185 185
186protected:186protected:
187 Chuck_VM * vm;187 Chuck_VM * vm;
188 std::map<t_CKUINT, Shred_Stat *> shreds;188 std::map<t_CKUINT, Shred_Stat *> shreds;
chuginate/template/chuck/include/chuck_symbol.h+1−1
@@ -43,7 +43,7 @@ extern "C" { · 42 unmodified lines
43 43
44typedef struct S_Symbol_ * S_Symbol;44typedef struct S_Symbol_ * S_Symbol;
45 45
46/* Make a unique symbol from a given c_str. 46/* Make a unique symbol from a given c_str.
47 * Different calls to make_symbol("foo") will yield the same S_Symbol47 * Different calls to make_symbol("foo") will yield the same S_Symbol
48 * value, even if the "foo" c_str are at different locations. */48 * value, even if the "foo" c_str are at different locations. */
49S_Symbol insert_symbol( c_constr );49S_Symbol insert_symbol( c_constr );
chuginate/template/chuck/include/chuck_table.h+2−2
@@ -51,7 +51,7 @@ TAB_table TAB_empty2(unsigned long size); · 50 unmodified lines
51TAB_table TAB_empty3( TAB_eq_func eq, TAB_hash_func hash, unsigned int size );51TAB_table TAB_empty3( TAB_eq_func eq, TAB_hash_func hash, unsigned int size );
52void TAB_delete( TAB_table t );52void TAB_delete( TAB_table t );
53 53
54/* Enter the mapping "key"->"value" into table "t", 54/* Enter the mapping "key"->"value" into table "t",
55 * shadowing but not destroying any previous binding for "key". */55 * shadowing but not destroying any previous binding for "key". */
56void TAB_enter(TAB_table t, void *key, void *value);56void TAB_enter(TAB_table t, void *key, void *value);
57 57
@@ -65,7 +65,7 @@ void *TAB_topv(TAB_table t); · 7 unmodified lines
65 65
66 66
67/* Call "show" on every "key"->"value" pair in the table,67/* Call "show" on every "key"->"value" pair in the table,
68 * including shadowed bindings, in order from the most 68 * including shadowed bindings, in order from the most
69 * recent binding of any key to the oldest binding in the table */69 * recent binding of any key to the oldest binding in the table */
70void TAB_dump(TAB_table t, void (*show)(void *key, void *value));70void TAB_dump(TAB_table t, void (*show)(void *key, void *value));
71 71
chuginate/template/chuck/include/chuck_type.h+131−57
@@ -49,8 +49,8 @@ typedef enum { · 48 unmodified lines
49 // general types49 // general types
50 te_none = 0, te_int, te_uint, te_single, te_float, te_double, te_time, te_dur,50 te_none = 0, te_int, te_uint, te_single, te_float, te_double, te_time, te_dur,
51 te_complex, te_polar, te_string, te_thread, te_shred, te_class,51 te_complex, te_polar, te_string, te_thread, te_shred, te_class,
52 te_function, te_object, te_user, te_array, te_null, te_ugen, te_uana, 52 te_function, te_object, te_user, te_array, te_null, te_ugen, te_uana,
53 te_event, te_void, te_stdout, te_stderr, te_adc, te_dac, te_bunghole, 53 te_event, te_void, te_stdout, te_stderr, te_adc, te_dac, te_bunghole,
54 te_uanablob, te_io, te_fileio, te_chout, te_cherr, te_multi,54 te_uanablob, te_io, te_fileio, te_chout, te_cherr, te_multi,
55 te_vec3, te_vec4, te_vector // ge: added 1.3.5.355 te_vec3, te_vec4, te_vector // ge: added 1.3.5.3
56} te_Type;56} te_Type;
@@ -77,13 +77,29 @@ typedef enum { · 20 unmodified lines
77// name: enum te_HowMuch77// name: enum te_HowMuch
78// desc: how much to scan/type check78// desc: how much to scan/type check
79//-----------------------------------------------------------------------------79//-----------------------------------------------------------------------------
80typedef enum { 80typedef enum {
81 te_do_all = 0, te_do_classes_only, te_do_no_classes81 te_do_all = 0, te_do_classes_only, te_do_no_classes
82} te_HowMuch;82} te_HowMuch;
83 83
84 84
85 85
86 86
87//-----------------------------------------------------------------------------
88// name: enum te_Origin | 1.5.0.0 (ge) added
89// desc: where something (e.g., a Type) originates
90//-----------------------------------------------------------------------------
91typedef enum {
92 te_originUnknown = 0,
93 te_originBuiltin, // in core
94 te_originChugin, // in imported chugin
95 te_originImport, // library CK code
96 te_originUserDefined, // in user chuck code
97 te_originGenerated // generated (e.g., array types like int[][][][])
98} te_Origin;
99
100
101
102
87//-----------------------------------------------------------------------------103//-----------------------------------------------------------------------------
88// name: struct Chuck_Scope104// name: struct Chuck_Scope
89// desc: scoping structure105// desc: scoping structure
@@ -111,14 +127,14 @@ public: · 21 unmodified lines
111 // reset the scope127 // reset the scope
112 void reset()128 void reset()
113 { scope.clear(); this->push(); }129 { scope.clear(); this->push(); }
114 130
115 // atomic commit131 // atomic commit
116 void commit()132 void commit()
117 {133 {
118 assert( scope.size() != 0 ); 134 assert( scope.size() != 0 );
119 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;135 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
120 136
121 // go through buffer 137 // go through buffer
122 for( iter = commit_map.begin(); iter != commit_map.end(); iter++ )138 for( iter = commit_map.begin(); iter != commit_map.end(); iter++ )
123 {139 {
124 // add to front/where140 // add to front/where
@@ -135,7 +151,7 @@ public: · 10 unmodified lines
135 assert( scope.size() != 0 );151 assert( scope.size() != 0 );
136 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;152 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
137 153
138 // go through buffer 154 // go through buffer
139 for( iter = commit_map.begin(); iter != commit_map.end(); iter++ )155 for( iter = commit_map.begin(); iter != commit_map.end(); iter++ )
140 {156 {
141 // release157 // release
@@ -175,8 +191,8 @@ public: · 33 unmodified lines
175 {191 {
176 val = (*scope.back())[xid];192 val = (*scope.back())[xid];
177 // look in commit buffer if the back is the front193 // look in commit buffer if the back is the front
178 if( !val && scope.back() == scope.front() 194 if( !val && scope.back() == scope.front()
179 && (commit_map.find(xid) != commit_map.end()) ) 195 && (commit_map.find(xid) != commit_map.end()) )
180 val = commit_map[xid];196 val = commit_map[xid];
181 }197 }
182 else if( climb > 0 )198 else if( climb > 0 )
@@ -199,8 +215,15 @@ public: · 16 unmodified lines
199 return (T)val;215 return (T)val;
200 }216 }
201 217
218 // test if a name has been "mangled", e.g., "toString@0@Object"
219 static t_CKBOOL is_mangled( const std::string & name )
220 {
221 // check for @ in the name, which would not be possible for names in language
222 return ( name.find("@") != std::string::npos );
223 }
224
202 // get list of top level225 // get list of top level
203 void get_toplevel( std::vector<Chuck_VM_Object *> & out )226 void get_toplevel( std::vector<Chuck_VM_Object *> & out, t_CKBOOL includeMangled = TRUE )
204 {227 {
205 assert( scope.size() != 0 );228 assert( scope.size() != 0 );
206 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;229 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
@@ -213,30 +236,36 @@ public: · 6 unmodified lines
213 // go through map236 // go through map
214 for( iter = m->begin(); iter != m->end(); iter++ )237 for( iter = m->begin(); iter != m->end(); iter++ )
215 {238 {
239 // check mangled name
240 if( !includeMangled && is_mangled( std::string(S_name((*iter).first))) )
241 continue;
216 // add242 // add
217 out.push_back( (*iter).second );243 out.push_back( (*iter).second );
218 }244 }
219 }245 }
220 246
221 // get list of top level247 // get list of top level
222 void get_level( int level, std::vector<Chuck_VM_Object *> & out )248 void get_level( int level, std::vector<Chuck_VM_Object *> & out, t_CKBOOL includeMangled = TRUE )
223 {249 {
224 assert( scope.size() >= level );250 assert( scope.size() >= level );
225 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;251 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
226 252
227 // clear the out253 // clear the out
228 out.clear();254 out.clear();
229 // get the front of the array255 // get the front of the array
230 std::map<S_Symbol, Chuck_VM_Object *> * m = &commit_map;256 std::map<S_Symbol, Chuck_VM_Object *> * m = &commit_map;
231 257
232 // go through map258 // go through map
233 for( iter = m->begin(); iter != m->end(); iter++ )259 for( iter = m->begin(); iter != m->end(); iter++ )
234 {260 {
261 // check mangled name
262 if( !includeMangled && is_mangled( std::string(S_name((*iter).first))) )
263 continue;
264
235 // add265 // add
236 out.push_back( (*iter).second );266 out.push_back( (*iter).second );
237 }267 }
238 }268 }
239
240 269
241protected:270protected:
242 std::vector<std::map<S_Symbol, Chuck_VM_Object *> *> scope;271 std::vector<std::map<S_Symbol, Chuck_VM_Object *> *> scope;
@@ -288,7 +317,7 @@ struct Chuck_Namespace : public Chuck_VM_Object · 45 unmodified lines
288 t_CKUINT offset;317 t_CKUINT offset;
289 318
290 // constructor319 // constructor
291 Chuck_Namespace() { pre_ctor = NULL; dtor = NULL; parent = NULL; offset = 0; 320 Chuck_Namespace() { pre_ctor = NULL; dtor = NULL; parent = NULL; offset = 0;
292 class_data = NULL; class_data_size = 0; }321 class_data = NULL; class_data_size = 0; }
293 // destructor322 // destructor
294 virtual ~Chuck_Namespace() {323 virtual ~Chuck_Namespace() {
@@ -308,13 +337,13 @@ struct Chuck_Namespace : public Chuck_VM_Object · 13 unmodified lines
308 Chuck_Func * lookup_func( S_Symbol name, t_CKINT climb = 1 );337 Chuck_Func * lookup_func( S_Symbol name, t_CKINT climb = 1 );
309 338
310 // commit the maps339 // commit the maps
311 void commit() { 340 void commit() {
312 EM_log( CK_LOG_FINER, "committing namespace: '%s'...", name.c_str() );341 EM_log( CK_LOG_FINER, "committing namespace: '%s'...", name.c_str() );
313 type.commit(); value.commit(); func.commit();342 type.commit(); value.commit(); func.commit();
314 }343 }
315 344
316 // rollback the maps345 // rollback the maps
317 void rollback() { 346 void rollback() {
318 EM_log( CK_LOG_FINER, "rolling back namespace: '%s'...", name.c_str() );347 EM_log( CK_LOG_FINER, "rolling back namespace: '%s'...", name.c_str() );
319 type.rollback(); value.rollback(); func.rollback();348 type.rollback(); value.rollback(); func.rollback();
320 }349 }
@@ -324,7 +353,7 @@ struct Chuck_Namespace : public Chuck_VM_Object · 3 unmodified lines
324 // get top level values353 // get top level values
325 void get_values( std::vector<Chuck_Value *> & out );354 void get_values( std::vector<Chuck_Value *> & out );
326 // get top level functions355 // get top level functions
327 void get_funcs( std::vector<Chuck_Func *> & out );356 void get_funcs( std::vector<Chuck_Func *> & out, t_CKBOOL includeManged = TRUE );
328};357};
329 358
330 359
@@ -334,7 +363,7 @@ struct Chuck_Namespace : public Chuck_VM_Object · 3 unmodified lines
334// name: struct Chuck_Context363// name: struct Chuck_Context
335// desc: runtime type information pertaining to a file364// desc: runtime type information pertaining to a file
336//-----------------------------------------------------------------------------365//-----------------------------------------------------------------------------
337struct Chuck_Context : public Chuck_VM_Object 366struct Chuck_Context : public Chuck_VM_Object
338{367{
339 // src_name368 // src_name
340 std::string filename;369 std::string filename;
@@ -370,7 +399,7 @@ struct Chuck_Context : public Chuck_VM_Object · 29 unmodified lines
370 void rollback();399 void rollback();
371 400
372 // constructor401 // constructor
373 Chuck_Context() { parse_tree = NULL; nspc = new Chuck_Namespace; 402 Chuck_Context() { parse_tree = NULL; nspc = new Chuck_Namespace;
374 public_class_def = NULL; has_error = FALSE;403 public_class_def = NULL; has_error = FALSE;
375 progress = P_NONE; }404 progress = P_NONE; }
376 // destructor405 // destructor
@@ -398,10 +427,15 @@ public: · 21 unmodified lines
398 // constructor427 // constructor
399 Chuck_Env();428 Chuck_Env();
400 429
430public:
431 // initialize
432 t_CKBOOL init();
433
401// REFACTOR-2017: carrier and accessors434// REFACTOR-2017: carrier and accessors
402public:435public:
403 void set_carrier( Chuck_Carrier * carrier ) { m_carrier = carrier; }436 void set_carrier( Chuck_Carrier * carrier ) { m_carrier = carrier; }
404 Chuck_VM * vm() { return m_carrier->vm; }437 Chuck_VM * vm() { return m_carrier ? m_carrier->vm : NULL; }
438 Chuck_Compiler * compiler() { return m_carrier ? m_carrier->compiler : NULL; }
405 439
406protected:440protected:
407 Chuck_Carrier * m_carrier;441 Chuck_Carrier * m_carrier;
@@ -425,7 +459,7 @@ public: · 17 unmodified lines
425 else459 else
426 return user_nspc;460 return user_nspc;
427 }461 }
428 462
429 // namespace stack463 // namespace stack
430 std::vector<Chuck_Namespace *> nspc_stack;464 std::vector<Chuck_Namespace *> nspc_stack;
431 // expression namespace465 // expression namespace
@@ -482,7 +516,7 @@ public: · 50 unmodified lines
482 // make sure this is 0516 // make sure this is 0
483 class_scope = 0;517 class_scope = 0;
484 }518 }
485 519
486 void load_user_namespace()520 void load_user_namespace()
487 {521 {
488 // user namespace522 // user namespace
@@ -492,7 +526,7 @@ public: · 3 unmodified lines
492 SAFE_ADD_REF(global_nspc);526 SAFE_ADD_REF(global_nspc);
493 SAFE_ADD_REF(user_nspc);527 SAFE_ADD_REF(user_nspc);
494 }528 }
495 529
496 void clear_user_namespace()530 void clear_user_namespace()
497 {531 {
498 if(user_nspc) SAFE_RELEASE(user_nspc->parent);532 if(user_nspc) SAFE_RELEASE(user_nspc->parent);
@@ -506,11 +540,11 @@ public: · 7 unmodified lines
506 { assert( nspc_stack.size() > 0 ); return nspc_stack.back(); }540 { assert( nspc_stack.size() > 0 ); return nspc_stack.back(); }
507 Chuck_Type * class_top( )541 Chuck_Type * class_top( )
508 { assert( class_stack.size() > 0 ); return class_stack.back(); }542 { assert( class_stack.size() > 0 ); return class_stack.back(); }
509 543
510 // check whether the context is the global context544 // check whether the context is the global context
511 t_CKBOOL is_global()545 t_CKBOOL is_global()
512 { return class_def == NULL && func == NULL && class_scope == 0; }546 { return class_def == NULL && func == NULL && class_scope == 0; }
513 547
514public:548public:
515 // REFACTOR-2017: public types549 // REFACTOR-2017: public types
516 Chuck_Type * t_void;550 Chuck_Type * t_void;
@@ -533,12 +567,10 @@ public: · 16 unmodified lines
533 Chuck_Type * t_uanablob;567 Chuck_Type * t_uanablob;
534 Chuck_Type * t_shred;568 Chuck_Type * t_shred;
535 Chuck_Type * t_io;569 Chuck_Type * t_io;
536 #ifndef __DISABLE_FILEIO__
537 Chuck_Type * t_fileio;570 Chuck_Type * t_fileio;
538 #endif
539 Chuck_Type * t_chout;571 Chuck_Type * t_chout;
540 Chuck_Type * t_cherr;572 Chuck_Type * t_cherr;
541 Chuck_Type * t_thread;573 // Chuck_Type * t_thread;
542 Chuck_Type * t_class;574 Chuck_Type * t_class;
543 Chuck_Type * t_dac;575 Chuck_Type * t_dac;
544 Chuck_Type * t_adc;576 Chuck_Type * t_adc;
@@ -563,7 +595,7 @@ struct Chuck_UGen_Info : public Chuck_VM_Object · 18 unmodified lines
563 t_CKUINT num_ins;595 t_CKUINT num_ins;
564 // number of outgoing channels596 // number of outgoing channels
565 t_CKUINT num_outs;597 t_CKUINT num_outs;
566 598
567 // for uana, NULL for ugen599 // for uana, NULL for ugen
568 f_tock tock;600 f_tock tock;
569 // number of incoming ana channels601 // number of incoming ana channels
@@ -573,7 +605,7 @@ struct Chuck_UGen_Info : public Chuck_VM_Object · 3 unmodified lines
573 605
574 // constructor606 // constructor
575 Chuck_UGen_Info()607 Chuck_UGen_Info()
576 { tick = NULL; tickf = NULL; pmsg = NULL; num_ins = num_outs = 1; 608 { tick = NULL; tickf = NULL; pmsg = NULL; num_ins = num_outs = 1;
577 tock = NULL; num_ins_ana = num_outs_ana = 1; }609 tock = NULL; num_ins_ana = num_outs_ana = 1; }
578};610};
579 611
@@ -583,8 +615,9 @@ struct Chuck_UGen_Info : public Chuck_VM_Object · 3 unmodified lines
583//-----------------------------------------------------------------------------615//-----------------------------------------------------------------------------
584// name: struct Chuck_Type616// name: struct Chuck_Type
585// desc: class containing information about a type617// desc: class containing information about a type
586//-----------------------------------------------------------------------------_id618// note: 1.5.0.0 (ge) Chuck_VM_Object -> Chuck_Object
587struct Chuck_Type : public Chuck_VM_Object619//-----------------------------------------------------------------------------
620struct Chuck_Type : public Chuck_Object
588{621{
589 // type id622 // type id
590 te_Type xid;623 te_Type xid;
@@ -620,7 +653,9 @@ struct Chuck_Type : public Chuck_VM_Object · 29 unmodified lines
620 t_CKBOOL has_destructor;653 t_CKBOOL has_destructor;
621 // custom allocator654 // custom allocator
622 f_alloc allocator;655 f_alloc allocator;
623 656 // origin hint
657 te_Origin originHint;
658
624 // documentation659 // documentation
625 std::string doc;660 std::string doc;
626 // example files661 // example files
@@ -650,17 +685,23 @@ public: · 23 unmodified lines
650 const std::string & str();685 const std::string & str();
651 // to c string686 // to c string
652 const char * c_name();687 const char * c_name();
653 688
654protected:689protected:
655 // this for str() and c_name() use only690 // this for str() and c_name() use only
656 std::string ret;691 std::string ret;
657 692
658public: // apropos | 1.4.1.0 (ge)693public: // apropos | 1.4.1.0 (ge)
659 // dump info to console694 // generate info; output to console
660 void apropos();695 void apropos();
661 // dump info to string696 // generate info; output to string
662 void apropos( std::string & output );697 void apropos( std::string & output );
663 698
699public: // dump | 1.4.1.1 (ge)
700 // generate object state; output to console
701 void dump( Chuck_Object * obj );
702 // generate object state; output to string
703 void dump( Chuck_Object * obj, std::string & output );
704
664protected: // apropos-related helper function705protected: // apropos-related helper function
665 // dump top level info706 // dump top level info
666 void apropos_top( std::string & output, const std::string & prefix );707 void apropos_top( std::string & output, const std::string & prefix );
@@ -711,7 +752,7 @@ struct Chuck_Value : public Chuck_VM_Object · 44 unmodified lines
711 Chuck_Func * func_ref;752 Chuck_Func * func_ref;
712 // overloads753 // overloads
713 t_CKINT func_num_overloads;754 t_CKINT func_num_overloads;
714 755
715 // documentation756 // documentation
716 std::string doc;757 std::string doc;
717 758
@@ -720,7 +761,7 @@ struct Chuck_Value : public Chuck_VM_Object · 2 unmodified lines
720 t_CKBOOL c = FALSE, t_CKBOOL acc = 0, Chuck_Namespace * o = NULL,761 t_CKBOOL c = FALSE, t_CKBOOL acc = 0, Chuck_Namespace * o = NULL,
721 Chuck_Type * oc = NULL, t_CKUINT s = 0 )762 Chuck_Type * oc = NULL, t_CKUINT s = 0 )
722 { type = t; SAFE_ADD_REF(type); // add reference763 { type = t; SAFE_ADD_REF(type); // add reference
723 name = n; offset = s; 764 name = n; offset = s;
724 is_const = c; access = acc;765 is_const = c; access = acc;
725 owner = o; SAFE_ADD_REF(o); // add reference766 owner = o; SAFE_ADD_REF(o); // add reference
726 owner_class = oc; SAFE_ADD_REF(oc); // add reference767 owner_class = oc; SAFE_ADD_REF(oc); // add reference
@@ -772,13 +813,13 @@ struct Chuck_Func : public Chuck_VM_Object · 45 unmodified lines
772 Chuck_Func * next;813 Chuck_Func * next;
773 // for overriding814 // for overriding
774 Chuck_Value * up;815 Chuck_Value * up;
775 816
776 // documentation817 // documentation
777 std::string doc;818 std::string doc;
778 819
779 // constructor820 // constructor
780 Chuck_Func() { def = NULL; code = NULL; is_member = FALSE; is_static = FALSE,821 Chuck_Func() { def = NULL; code = NULL; is_member = FALSE; is_static = FALSE,
781 vt_index = 0xffffffff; value_ref = NULL; /*dl_code = NULL;*/ next = NULL;822 vt_index = CK_NO_VALUE; value_ref = NULL; /*dl_code = NULL;*/ next = NULL;
782 up = NULL; }823 up = NULL; }
783 824
784 // destructor825 // destructor
@@ -802,7 +843,7 @@ t_CKBOOL type_engine_load_context( Chuck_Env * env, Chuck_Context * context ); · 17 unmodified lines
802t_CKBOOL type_engine_unload_context( Chuck_Env * env );843t_CKBOOL type_engine_unload_context( Chuck_Env * env );
803 844
804// type check a program into the env845// type check a program into the env
805t_CKBOOL type_engine_check_prog( Chuck_Env * env, a_Program prog, 846t_CKBOOL type_engine_check_prog( Chuck_Env * env, a_Program prog,
806 const std::string & filename );847 const std::string & filename );
807// make a context848// make a context
808Chuck_Context * type_engine_make_context( a_Program prog,849Chuck_Context * type_engine_make_context( a_Program prog,
@@ -833,8 +874,11 @@ t_CKBOOL isfunc( Chuck_Env * env, Chuck_Type * type ); · 24 unmodified lines
833t_CKBOOL iskindofint( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: this includes int + pointers874t_CKBOOL iskindofint( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: this includes int + pointers
834t_CKUINT getkindof( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: to get the kindof a type875t_CKUINT getkindof( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: to get the kindof a type
835 876
877
878//-----------------------------------------------------------------------------
836// import879// import
837Chuck_Type * type_engine_import_class_begin( Chuck_Env * env, Chuck_Type * type, 880//-----------------------------------------------------------------------------
881Chuck_Type * type_engine_import_class_begin( Chuck_Env * env, Chuck_Type * type,
838 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor = NULL,882 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor = NULL,
839 const char * doc = NULL );883 const char * doc = NULL );
840Chuck_Type * type_engine_import_class_begin( Chuck_Env * env, const char * name, const char * parent,884Chuck_Type * type_engine_import_class_begin( Chuck_Env * env, const char * name, const char * parent,
@@ -843,12 +887,14 @@ Chuck_Type * type_engine_import_class_begin( Chuck_Env * env, const char * name, · 2 unmodified lines
843Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name, const char * parent,887Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name, const char * parent,
844 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor,888 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor,
845 f_tick tick, f_tickf tickf, f_pmsg pmsg, // (tickf added 1.3.0.0)889 f_tick tick, f_tickf tickf, f_pmsg pmsg, // (tickf added 1.3.0.0)
846 t_CKUINT num_ins = 0xffffffff, t_CKUINT num_outs = 0xffffffff,890 t_CKUINT num_ins = CK_NO_VALUE,
891 t_CKUINT num_outs = CK_NO_VALUE,
847 const char * doc = NULL );892 const char * doc = NULL );
848Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name, const char * parent,893Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name, const char * parent,
849 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor,894 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor,
850 f_tick tick, f_pmsg pmsg,895 f_tick tick, f_pmsg pmsg,
851 t_CKUINT num_ins = 0xffffffff, t_CKUINT num_outs = 0xffffffff,896 t_CKUINT num_ins = CK_NO_VALUE,
897 t_CKUINT num_outs = CK_NO_VALUE,
852 const char * doc = NULL );898 const char * doc = NULL );
853Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name, const char * parent,899Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name, const char * parent,
854 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor,900 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor,
@@ -856,12 +902,14 @@ Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name, · 1 unmodified line
856Chuck_Type * type_engine_import_uana_begin( Chuck_Env * env, const char * name, const char * parent,902Chuck_Type * type_engine_import_uana_begin( Chuck_Env * env, const char * name, const char * parent,
857 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor,903 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor,
858 f_tick tick, f_tock tock, f_pmsg pmsg,904 f_tick tick, f_tock tock, f_pmsg pmsg,
859 t_CKUINT num_ins = 0xffffffff, t_CKUINT num_outs = 0xffffffff,905 t_CKUINT num_ins = CK_NO_VALUE,
860 t_CKUINT num_ins_ana = 0xffffffff, t_CKUINT num_outs_ana = 0xffffffff,906 t_CKUINT num_outs = CK_NO_VALUE,
907 t_CKUINT num_ins_ana = CK_NO_VALUE,
908 t_CKUINT num_outs_ana = CK_NO_VALUE,
861 const char * doc = NULL );909 const char * doc = NULL );
862t_CKBOOL type_engine_import_mfun( Chuck_Env * env, Chuck_DL_Func * mfun );910t_CKBOOL type_engine_import_mfun( Chuck_Env * env, Chuck_DL_Func * mfun );
863t_CKBOOL type_engine_import_sfun( Chuck_Env * env, Chuck_DL_Func * sfun );911t_CKBOOL type_engine_import_sfun( Chuck_Env * env, Chuck_DL_Func * sfun );
864t_CKUINT type_engine_import_mvar( Chuck_Env * env, const char * type, 912t_CKUINT type_engine_import_mvar( Chuck_Env * env, const char * type,
865 const char * name, t_CKUINT is_const,913 const char * name, t_CKUINT is_const,
866 const char * doc = NULL );914 const char * doc = NULL );
867t_CKBOOL type_engine_import_svar( Chuck_Env * env, const char * type,915t_CKBOOL type_engine_import_svar( Chuck_Env * env, const char * type,
@@ -871,10 +919,13 @@ t_CKBOOL type_engine_import_ugen_ctrl( Chuck_Env * env, const char * type, const · 3 unmodified lines
871 f_ctrl ctrl, t_CKBOOL write, t_CKBOOL read );919 f_ctrl ctrl, t_CKBOOL write, t_CKBOOL read );
872t_CKBOOL type_engine_import_add_ex( Chuck_Env * env, const char * ex );920t_CKBOOL type_engine_import_add_ex( Chuck_Env * env, const char * ex );
873t_CKBOOL type_engine_import_class_end( Chuck_Env * env );921t_CKBOOL type_engine_import_class_end( Chuck_Env * env );
874t_CKBOOL type_engine_register_deprecate( Chuck_Env * env, 922t_CKBOOL type_engine_register_deprecate( Chuck_Env * env,
875 const std::string & former, const std::string & latter );923 const std::string & former, const std::string & latter );
876 924
877// helpers925
926//-----------------------------------------------------------------------------
927// helper functions
928//-----------------------------------------------------------------------------
878t_CKBOOL type_engine_check_reserved( Chuck_Env * env, const std::string & xid, int pos );929t_CKBOOL type_engine_check_reserved( Chuck_Env * env, const std::string & xid, int pos );
879t_CKBOOL type_engine_check_reserved( Chuck_Env * env, S_Symbol xid, int pos );930t_CKBOOL type_engine_check_reserved( Chuck_Env * env, S_Symbol xid, int pos );
880// 1.4.1.0 (ge): abilty to toggle reserved words for special cases, such as Math.pi co-existing with pi (use with care!)931// 1.4.1.0 (ge): abilty to toggle reserved words for special cases, such as Math.pi co-existing with pi (use with care!)
@@ -883,17 +934,21 @@ t_CKBOOL type_engine_check_primitive( Chuck_Env * env, Chuck_Type * type ); · 2 unmodified lines
883t_CKBOOL type_engine_check_const( Chuck_Env * env, a_Exp e, int pos ); // TODO934t_CKBOOL type_engine_check_const( Chuck_Env * env, a_Exp e, int pos ); // TODO
884t_CKBOOL type_engine_compat_func( a_Func_Def lhs, a_Func_Def rhs, int pos, std::string & err, t_CKBOOL print = TRUE );935t_CKBOOL type_engine_compat_func( a_Func_Def lhs, a_Func_Def rhs, int pos, std::string & err, t_CKBOOL print = TRUE );
885t_CKBOOL type_engine_get_deprecate( Chuck_Env * env, const std::string & from, std::string & to );936t_CKBOOL type_engine_get_deprecate( Chuck_Env * env, const std::string & from, std::string & to );
937t_CKBOOL type_engine_is_base_static( Chuck_Env * env, Chuck_Type * baseType ); // 1.5.0.0 (ge) added
886Chuck_Type * type_engine_find_common_anc( Chuck_Type * lhs, Chuck_Type * rhs );938Chuck_Type * type_engine_find_common_anc( Chuck_Type * lhs, Chuck_Type * rhs );
887Chuck_Type * type_engine_find_type( Chuck_Env * env, a_Id_List path );939Chuck_Type * type_engine_find_type( Chuck_Env * env, a_Id_List path );
940Chuck_Type * type_engine_find_type( Chuck_Env * env, const std::string & name ); // 1.5.0.0 (ge) added
888Chuck_Value * type_engine_find_value( Chuck_Type * type, const std::string & xid );941Chuck_Value * type_engine_find_value( Chuck_Type * type, const std::string & xid );
889Chuck_Value * type_engine_find_value( Chuck_Type * type, S_Symbol xid );942Chuck_Value * type_engine_find_value( Chuck_Type * type, S_Symbol xid );
890Chuck_Value * type_engine_find_value( Chuck_Env * env, const std::string & xid, t_CKBOOL climb, int linepos = 0 );943Chuck_Value * type_engine_find_value( Chuck_Env * env, const std::string & xid, t_CKBOOL climb, int linepos = 0 );
891Chuck_Namespace * type_engine_find_nspc( Chuck_Env * env, a_Id_List path );944Chuck_Namespace * type_engine_find_nspc( Chuck_Env * env, a_Id_List path );
892/*******************************************************************************945
893 * spencer: added this into function to provide the same logic path946
894 * for type_engine_check_exp_decl() and ck_add_mvar() when they determine947//-----------------------------------------------------------------------------
895 * offsets for mvars -- added 1.3.0.0948// spencer: added this into function to provide the same logic path
896 ******************************************************************************/949// for type_engine_check_exp_decl() and ck_add_mvar() when they determine
950// offsets for mvars -- added 1.3.0.0
951//-----------------------------------------------------------------------------
897t_CKUINT type_engine_next_offset( t_CKUINT current_offset, Chuck_Type * type );952t_CKUINT type_engine_next_offset( t_CKUINT current_offset, Chuck_Type * type );
898// array verify953// array verify
899t_CKBOOL verify_array( a_Array_Sub array );954t_CKBOOL verify_array( a_Array_Sub array );
@@ -901,7 +956,14 @@ t_CKBOOL verify_array( a_Array_Sub array ); · 1 unmodified line
901Chuck_Type * new_array_type( Chuck_Env * env, Chuck_Type * array_parent,956Chuck_Type * new_array_type( Chuck_Env * env, Chuck_Type * array_parent,
902 t_CKUINT depth, Chuck_Type * base_type,957 t_CKUINT depth, Chuck_Type * base_type,
903 Chuck_Namespace * owner_nspc );958 Chuck_Namespace * owner_nspc );
959// make type | 1.4.1.1 (nshaheed) added
960Chuck_Type * new_array_element_type( Chuck_Env * env, Chuck_Type * base_type,
961 t_CKUINT depth, Chuck_Namespace * owner_nspc);
962
963
964//-----------------------------------------------------------------------------
904// conversion965// conversion
966//-----------------------------------------------------------------------------
905const char * type_path( a_Id_List path );967const char * type_path( a_Id_List path );
906a_Id_List str2list( const std::string & path );968a_Id_List str2list( const std::string & path );
907a_Id_List str2list( const std::string & path, t_CKBOOL & is_array );969a_Id_List str2list( const std::string & path, t_CKBOOL & is_array );
@@ -909,7 +971,19 @@ const char * howmuch2str( te_HowMuch how_much ); · 1 unmodified line
909t_CKBOOL escape_str( char * str_lit, int linepos );971t_CKBOOL escape_str( char * str_lit, int linepos );
910t_CKINT str2char( const char * char_lit, int linepos );972t_CKINT str2char( const char * char_lit, int linepos );
911 973
974
975//-----------------------------------------------------------------------------
976// more helper functions for type scan and checking | 1.5.0.0 (ge) added
977//-----------------------------------------------------------------------------
978// compare two argument lists to see if they are the same (sequence of types)
979t_CKBOOL same_arg_lists( a_Arg_List lhs, a_Arg_List rhs );
980// generate a string from an argument list (types only)
981std::string arglist2string( a_Arg_List list );
982
983
984//-----------------------------------------------------------------------------
912// REFACTOR-2017: exile! these default types now stored in env985// REFACTOR-2017: exile! these default types now stored in env
986//-----------------------------------------------------------------------------
913//extern Chuck_Type t_void;987//extern Chuck_Type t_void;
914//extern Chuck_Type t_int;988//extern Chuck_Type t_int;
915//extern Chuck_Type t_float;989//extern Chuck_Type t_float;
chuginate/template/chuck/include/chuck_ugen.h+6−6
@@ -80,7 +80,7 @@ public: // src · 79 unmodified lines
80 t_CKBOOL alloc_v( t_CKUINT size );80 t_CKBOOL alloc_v( t_CKUINT size );
81 t_CKBOOL set_is_buffered( t_CKBOOL buffered );81 t_CKBOOL set_is_buffered( t_CKBOOL buffered );
82 void get_buffer( SAMPLE * buffer, t_CKINT num_elem );82 void get_buffer( SAMPLE * buffer, t_CKINT num_elem );
83 83
84 Chuck_UGen *src_chan( t_CKUINT chan );84 Chuck_UGen *src_chan( t_CKUINT chan );
85 Chuck_UGen *dst_for_src_chan( t_CKUINT chan );85 Chuck_UGen *dst_for_src_chan( t_CKUINT chan );
86 86
@@ -133,17 +133,17 @@ public: // data · 46 unmodified lines
133 SAMPLE m_pan;133 SAMPLE m_pan;
134 t_CKINT m_op;134 t_CKINT m_op;
135 t_CKINT m_max_block_size;135 t_CKINT m_max_block_size;
136 136
137 // SPENCERTODO: combine with block processing (added 1.3.0.0)137 // SPENCERTODO: combine with block processing (added 1.3.0.0)
138 SAMPLE * m_multi_in_v;138 SAMPLE * m_multi_in_v;
139 SAMPLE * m_multi_out_v;139 SAMPLE * m_multi_out_v;
140 140
141 // SPENCERTODO: better way to handle this (added 1.3.0.0)141 // SPENCERTODO: better way to handle this (added 1.3.0.0)
142 t_CKBOOL m_is_subgraph;142 t_CKBOOL m_is_subgraph;
143 Chuck_UGen * m_inlet, * m_outlet;143 Chuck_UGen * m_inlet, * m_outlet;
144 Chuck_UGen * inlet();144 Chuck_UGen * inlet();
145 Chuck_UGen * outlet();145 Chuck_UGen * outlet();
146 146
147 // block processing147 // block processing
148 SAMPLE * m_sum_v;148 SAMPLE * m_sum_v;
149 SAMPLE * m_current_v;149 SAMPLE * m_current_v;
@@ -154,10 +154,10 @@ public: // data · 4 unmodified lines
154 Chuck_VM * vm;154 Chuck_VM * vm;
155 // owner155 // owner
156 Chuck_UGen * owner;156 Chuck_UGen * owner;
157 157
158 // what a hack!158 // what a hack!
159 t_CKBOOL m_is_uana;159 t_CKBOOL m_is_uana;
160 160
161 // what a hack! (added some time after REFACTOR-2017)161 // what a hack! (added some time after REFACTOR-2017)
162 t_CKBOOL m_is_buffered;162 t_CKBOOL m_is_buffered;
163 AccumBuffer m_buffer;163 AccumBuffer m_buffer;
chuginate/template/chuck/include/chuck_utils.h+1−1
@@ -49,7 +49,7 @@ struct U_boolList_ · 48 unmodified lines
49};49};
50 50
51 51
52void * checked_malloc( int size );52void * checked_malloc( t_CKINT size );
53c_str cc_str( char * );53c_str cc_str( char * );
54U_boolList U_BoolList( t_CKBOOL head, U_boolList tail );54U_boolList U_BoolList( t_CKBOOL head, U_boolList tail );
55 55
chuginate/template/chuck/include/chuck_vm.h+18−18
@@ -145,7 +145,7 @@ public: · 144 unmodified lines
145 t_CKUINT native_func;145 t_CKUINT native_func;
146 // is ctor?146 // is ctor?
147 t_CKUINT native_func_type;147 t_CKUINT native_func_type;
148 148
149 // filename this code came from (added 1.3.0.0)149 // filename this code came from (added 1.3.0.0)
150 std::string filename;150 std::string filename;
151 151
@@ -169,17 +169,17 @@ public: · 17 unmodified lines
169 Chuck_VM_Shred( );169 Chuck_VM_Shred( );
170 ~Chuck_VM_Shred( );170 ~Chuck_VM_Shred( );
171 171
172 t_CKBOOL initialize( Chuck_VM_Code * c, 172 t_CKBOOL initialize( Chuck_VM_Code * c,
173 t_CKUINT mem_st_size = CVM_MEM_STACK_SIZE, 173 t_CKUINT mem_st_size = CVM_MEM_STACK_SIZE,
174 t_CKUINT reg_st_size = CVM_REG_STACK_SIZE );174 t_CKUINT reg_st_size = CVM_REG_STACK_SIZE );
175 t_CKBOOL shutdown();175 t_CKBOOL shutdown();
176 t_CKBOOL run( Chuck_VM * vm );176 t_CKBOOL run( Chuck_VM * vm );
177 t_CKBOOL add( Chuck_UGen * ugen );177 t_CKBOOL add( Chuck_UGen * ugen );
178 t_CKBOOL remove( Chuck_UGen * ugen );178 t_CKBOOL remove( Chuck_UGen * ugen );
179 179
180 // add parent object reference (added 1.3.1.2)180 // add parent object reference (added 1.3.1.2)
181 t_CKVOID add_parent_ref( Chuck_Object * obj );181 t_CKVOID add_parent_ref( Chuck_Object * obj );
182 182
183 #ifndef __DISABLE_SERIAL__183 #ifndef __DISABLE_SERIAL__
184 // HACK - spencer (added 1.3.2.0)184 // HACK - spencer (added 1.3.2.0)
185 // add/remove SerialIO devices to close on shred exit185 // add/remove SerialIO devices to close on shred exit
@@ -187,7 +187,7 @@ public: · 1 unmodified line
187 t_CKVOID add_serialio( Chuck_IO_Serial * serial );187 t_CKVOID add_serialio( Chuck_IO_Serial * serial );
188 t_CKVOID remove_serialio( Chuck_IO_Serial * serial );188 t_CKVOID remove_serialio( Chuck_IO_Serial * serial );
189 #endif189 #endif
190 190
191//-----------------------------------------------------------------------------191//-----------------------------------------------------------------------------
192// data192// data
193//-----------------------------------------------------------------------------193//-----------------------------------------------------------------------------
@@ -252,7 +252,7 @@ public: // ge: 1.3.5.3 · 58 unmodified lines
252 bool popLoopCounter();252 bool popLoopCounter();
253 // loop counter pointer stack253 // loop counter pointer stack
254 std::vector<t_CKUINT *> m_loopCounters;254 std::vector<t_CKUINT *> m_loopCounters;
255 255
256#ifndef __DISABLE_SERIAL__256#ifndef __DISABLE_SERIAL__
257private:257private:
258 std::list<Chuck_IO_Serial *> * m_serials;258 std::list<Chuck_IO_Serial *> * m_serials;
@@ -272,7 +272,7 @@ public: · 13 unmodified lines
272 t_CKUINT xid;272 t_CKUINT xid;
273 std::string name;273 std::string name;
274 t_CKTIME start;274 t_CKTIME start;
275 t_CKBOOL has_event; 275 t_CKBOOL has_event;
276 276
277public:277public:
278 Chuck_VM_Shred_Status( t_CKUINT _id, const std::string & n, t_CKTIME _start, t_CKBOOL e )278 Chuck_VM_Shred_Status( t_CKUINT _id, const std::string & n, t_CKTIME _start, t_CKBOOL e )
@@ -297,7 +297,7 @@ public: · 18 unmodified lines
297 Chuck_VM_Status();297 Chuck_VM_Status();
298 ~Chuck_VM_Status();298 ~Chuck_VM_Status();
299 void clear();299 void clear();
300 300
301public:301public:
302 // sample rate302 // sample rate
303 t_CKUINT srate;303 t_CKUINT srate;
@@ -308,7 +308,7 @@ public: · 4 unmodified lines
308 t_CKUINT t_minute;308 t_CKUINT t_minute;
309 t_CKUINT t_hour;309 t_CKUINT t_hour;
310 // list of shred status310 // list of shred status
311 std::vector<Chuck_VM_Shred_Status *> list;311 std::vector<Chuck_VM_Shred_Status *> list;
312};312};
313 313
314 314
@@ -374,10 +374,10 @@ public: · 59 unmodified lines
374 Chuck_UGen * m_bunghole;374 Chuck_UGen * m_bunghole;
375 t_CKUINT m_num_dac_channels;375 t_CKUINT m_num_dac_channels;
376 t_CKUINT m_num_adc_channels;376 t_CKUINT m_num_adc_channels;
377 377
378 // status cache378 // status cache
379 Chuck_VM_Status m_status;379 Chuck_VM_Status m_status;
380 380
381 // max block size for adaptive block processing381 // max block size for adaptive block processing
382 t_CKUINT m_max_block_size;382 t_CKUINT m_max_block_size;
383 t_CKBOOL m_adaptive;383 t_CKBOOL m_adaptive;
@@ -446,7 +446,7 @@ public: // running the machine · 62 unmodified lines
446 t_CKBOOL compute( );446 t_CKBOOL compute( );
447 // abort current running shred447 // abort current running shred
448 t_CKBOOL abort_current_shred( );448 t_CKBOOL abort_current_shred( );
449 449
450public: // invoke functions450public: // invoke functions
451 t_CKBOOL invoke_static( Chuck_VM_Shred * shred );451 t_CKBOOL invoke_static( Chuck_VM_Shred * shred );
452 452
@@ -464,7 +464,7 @@ public: // msg · 11 unmodified lines
464 // added 1.3.0.0 to fix uber-crash464 // added 1.3.0.0 to fix uber-crash
465 CBufferSimple * create_event_buffer();465 CBufferSimple * create_event_buffer();
466 void destroy_event_buffer( CBufferSimple * buffer );466 void destroy_event_buffer( CBufferSimple * buffer );
467 467
468public: // get error468public: // get error
469 const char * last_error() const469 const char * last_error() const
470 { return m_last_error.c_str(); }470 { return m_last_error.c_str(); }
@@ -514,7 +514,7 @@ public: · 43 unmodified lines
514 Chuck_VM_Shred * spork( Chuck_VM_Shred * shred );514 Chuck_VM_Shred * spork( Chuck_VM_Shred * shred );
515 515
516protected:516protected:
517 t_CKBOOL free( Chuck_VM_Shred * shred, t_CKBOOL cascade, 517 t_CKBOOL free( Chuck_VM_Shred * shred, t_CKBOOL cascade,
518 t_CKBOOL dec = TRUE );518 t_CKBOOL dec = TRUE );
519 void dump( Chuck_VM_Shred * shred );519 void dump( Chuck_VM_Shred * shred );
520 void release_dump();520 void release_dump();
@@ -536,7 +536,7 @@ protected: · 15 unmodified lines
536 CBufferSimple * m_msg_buffer;536 CBufferSimple * m_msg_buffer;
537 CBufferSimple * m_reply_buffer;537 CBufferSimple * m_reply_buffer;
538 CBufferSimple * m_event_buffer;538 CBufferSimple * m_event_buffer;
539 539
540 // TODO: vector? (added 1.3.0.0 to fix uber-crash)540 // TODO: vector? (added 1.3.0.0 to fix uber-crash)
541 std::list<CBufferSimple *> m_event_buffers;541 std::list<CBufferSimple *> m_event_buffers;
542 542
@@ -597,10 +597,10 @@ struct Chuck_Msg · 54 unmodified lines
597 597
598 Chuck_Msg() : args(NULL) { clear(); }598 Chuck_Msg() : args(NULL) { clear(); }
599 ~Chuck_Msg() { SAFE_DELETE( args ); }599 ~Chuck_Msg() { SAFE_DELETE( args ); }
600 600
601 // added 1.3.0.0601 // added 1.3.0.0
602 void clear() { SAFE_DELETE( args ); memset( this, 0, sizeof(*this) ); }602 void clear() { SAFE_DELETE( args ); memset( this, 0, sizeof(*this) ); }
603 603
604 void set( const std::vector<std::string> & vargs )604 void set( const std::vector<std::string> & vargs )
605 {605 {
606 SAFE_DELETE(args);606 SAFE_DELETE(args);
chuginate/template/chuck/include/chuck_win32.h+3−3
@@ -266,13 +266,13 @@ · 265 unmodified lines
266 266
267#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED267#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
268typedef union YYSTYPE268typedef union YYSTYPE
269#line 59 "chuck.y"269#line 65 "chuck.y"
270{270{
271 int pos;271 int pos;
272 int ival;272 int ival;
273 double fval;273 double fval;
274 c_str sval;274 c_str sval;
275 275
276 a_Program program;276 a_Program program;
277 a_Section program_section;277 a_Section program_section;
278 a_Stmt_List stmt_list;278 a_Stmt_List stmt_list;
@@ -294,7 +294,7 @@ typedef union YYSTYPE · 15 unmodified lines
294}294}
295/* Line 1529 of yacc.c. */295/* Line 1529 of yacc.c. */
296#line 297 "chuck.tab.h"296#line 297 "chuck.tab.h"
297 YYSTYPE;297 YYSTYPE;
298# define yystype YYSTYPE /* obsolescent; will be withdrawn */298# define yystype YYSTYPE /* obsolescent; will be withdrawn */
299# define YYSTYPE_IS_DECLARED 1299# define YYSTYPE_IS_DECLARED 1
300# define YYSTYPE_IS_TRIVIAL 1300# define YYSTYPE_IS_TRIVIAL 1
chuginate/template/chuck/include/dirent_win32.h+37−37
@@ -1,8 +1,8 @@
1/*1/*
2 * dirent.h - dirent API for Microsoft Visual Studio2 * dirent.h - dirent API for Microsoft Visual Studio
3 * 3 *
4 * Copyright (C) 2006 Toni Ronkko4 * Copyright (C) 2006 Toni Ronkko
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the7 * a copy of this software and associated documentation files (the
8 * ``Software''), to deal in the Software without restriction, including8 * ``Software''), to deal in the Software without restriction, including
@@ -10,10 +10,10 @@ · 1 unmodified line
10 * distribute, sublicense, and/or sell copies of the Software, and to10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:12 * the following conditions:
13 * 13 *
14 * The above copyright notice and this permission notice shall be included14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.15 * in all copies or substantial portions of the Software.
16 * 16 *
17 * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS17 * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -33,13 +33,13 @@ · 13 unmodified lines
33 * Bug fix: due to the strncpy_s() function this file only compiled in33 * Bug fix: due to the strncpy_s() function this file only compiled in
34 * Visual Studio 2005. Using the new string functions only when the34 * Visual Studio 2005. Using the new string functions only when the
35 * compiler version allows.35 * compiler version allows.
36 * 36 *
37 * Nov 2, 2006, Toni Ronkko37 * Nov 2, 2006, Toni Ronkko
38 * Major update: removed support for Watcom C, MS-DOS and Turbo C to38 * Major update: removed support for Watcom C, MS-DOS and Turbo C to
39 * simplify the file, updated the code to compile cleanly on Visual39 * simplify the file, updated the code to compile cleanly on Visual
40 * Studio 2005 with both unicode and multi-byte character strings,40 * Studio 2005 with both unicode and multi-byte character strings,
41 * removed rewinddir() as it had a bug.41 * removed rewinddir() as it had a bug.
42 * 42 *
43 * Aug 20, 2006, Toni Ronkko43 * Aug 20, 2006, Toni Ronkko
44 * Removed all remarks about MSVC 1.0, which is antiqued now. Simplified44 * Removed all remarks about MSVC 1.0, which is antiqued now. Simplified
45 * comments by removing SGML tags.45 * comments by removing SGML tags.
@@ -115,11 +115,11 @@ opendir( · 69 unmodified lines
115 dirp = (DIR*) malloc (sizeof (struct DIR));115 dirp = (DIR*) malloc (sizeof (struct DIR));
116 if (dirp != NULL) {116 if (dirp != NULL) {
117 char *p;117 char *p;
118 118
119 /* take directory name... */119 /* take directory name... */
120 STRNCPY (dirp->patt, dirname, sizeof(dirp->patt));120 STRNCPY (dirp->patt, dirname, sizeof(dirp->patt));
121 dirp->patt[MAX_PATH] = '\0';121 dirp->patt[MAX_PATH] = '\0';
122 122
123 /* ... and append search pattern to it */123 /* ... and append search pattern to it */
124 p = strchr (dirp->patt, '\0');124 p = strchr (dirp->patt, '\0');
125 if (dirp->patt < p && *(p-1) != '\\' && *(p-1) != ':') {125 if (dirp->patt < p && *(p-1) != '\\' && *(p-1) != ':') {
@@ -138,42 +138,42 @@ opendir( · 12 unmodified lines
138 138
139 /* there is an un-processed directory entry in memory now */139 /* there is an un-processed directory entry in memory now */
140 dirp->cached = 1;140 dirp->cached = 1;
141 141
142 }142 }
143 return dirp;143 return dirp;
144}144}
145 145
146 146
147/*147/*
148 * ge: not a good idea148 * ge: not a good idea
149 */149 */
150static void150static void
151rewinddir(151rewinddir(
152 DIR *dirp)152 DIR *dirp)
153{153{
154 assert( dirp != NULL );154 assert( dirp != NULL );
155 155
156 /* no cache */156 /* no cache */
157 dirp->cached = 0;157 dirp->cached = 0;
158 158
159 /* open stream and retrieve first file */159 /* open stream and retrieve first file */
160 dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data);160 dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data);
161 if (dirp->search_handle == INVALID_HANDLE_VALUE) {161 if (dirp->search_handle == INVALID_HANDLE_VALUE) {
162 /* invalid search pattern? */162 /* invalid search pattern? */
163 return;163 return;
164 }164 }
165 165
166 /* there is an un-processed directory entry in memory now */166 /* there is an un-processed directory entry in memory now */
167 dirp->cached = 1;167 dirp->cached = 1;
168}168}
169 169
170 170
171/*171/*
172 * Read a directory entry, and return a pointer to a dirent structure172 * Read a directory entry, and return a pointer to a dirent structure
173 * containing the name of the entry in d_name field. Individual directory173 * containing the name of the entry in d_name field. Individual directory
174 * entries returned by this very function include regular files,174 * entries returned by this very function include regular files,
175 * sub-directories, pseudo-directories "." and "..", but also volume labels,175 * sub-directories, pseudo-directories "." and "..", but also volume labels,
176 * hidden files and system files may be returned. 176 * hidden files and system files may be returned.
177 */177 */
178static struct dirent *178static struct dirent *
179readdir(179readdir(
@@ -203,7 +203,7 @@ readdir( · 23 unmodified lines
203 /* copy as a multibyte character string */203 /* copy as a multibyte character string */
204 STRNCPY (dirp->current.d_name, dirp->current.data.cFileName, sizeof(dirp->current.d_name));204 STRNCPY (dirp->current.d_name, dirp->current.data.cFileName, sizeof(dirp->current.d_name));
205 dirp->current.d_name[MAX_PATH] = '\0';205 dirp->current.d_name[MAX_PATH] = '\0';
206 206
207 return &dirp->current;207 return &dirp->current;
208}208}
209 209
@@ -218,7 +218,7 @@ closedir( · 8 unmodified lines
218 DIR *dirp)218 DIR *dirp)
219{219{
220 assert (dirp != NULL);220 assert (dirp != NULL);
221 221
222 /* release search handle */222 /* release search handle */
223 if (dirp->search_handle != INVALID_HANDLE_VALUE) {223 if (dirp->search_handle != INVALID_HANDLE_VALUE) {
224 FindClose (dirp->search_handle);224 FindClose (dirp->search_handle);
chuginate/template/chuck/include/hidio_sdl.h+4−4
@@ -63,7 +63,7 @@ public: · 62 unmodified lines
63 t_CKBOOL close();63 t_CKBOOL close();
64 t_CKBOOL good() { return m_valid; }64 t_CKBOOL good() { return m_valid; }
65 t_CKINT num() { return m_valid ? (t_CKINT)m_device_num : -1; }65 t_CKINT num() { return m_valid ? (t_CKINT)m_device_num : -1; }
66 66
67public:67public:
68 void set_suppress( t_CKBOOL print_or_not )68 void set_suppress( t_CKBOOL print_or_not )
69 { m_suppress_output = print_or_not; }69 { m_suppress_output = print_or_not; }
@@ -131,7 +131,7 @@ public: · 61 unmodified lines
131 static t_CKBOOL open( HidIn * hin, Chuck_VM * vm, t_CKINT device_type, std::string & device_name );131 static t_CKBOOL open( HidIn * hin, Chuck_VM * vm, t_CKINT device_type, std::string & device_name );
132 static t_CKBOOL close( HidIn * hin );132 static t_CKBOOL close( HidIn * hin );
133 static void cleanup_buffer( Chuck_VM * vm );133 static void cleanup_buffer( Chuck_VM * vm );
134 134
135 static void probeHidIn();135 static void probeHidIn();
136 static void probeHidOut();136 static void probeHidOut();
137 137
@@ -142,9 +142,9 @@ public: · 4 unmodified lines
142#endif142#endif
143 143
144 static void push_message( HidMsg & msg );144 static void push_message( HidMsg & msg );
145 145
146 static std::map< Chuck_VM *, CBufferSimple * > m_event_buffers;146 static std::map< Chuck_VM *, CBufferSimple * > m_event_buffers;
147 147
148protected:148protected:
149 static std::vector< std::vector<PhyHidDevIn *> > the_matrix;149 static std::vector< std::vector<PhyHidDevIn *> > the_matrix;
150 static XThread * the_thread;150 static XThread * the_thread;
chuginate/template/chuck/include/midiio_rtmidi.h+46−46
@@ -92,7 +92,7 @@ public: · 91 unmodified lines
92 t_CKBOOL close();92 t_CKBOOL close();
93 t_CKBOOL good() { return m_valid; }93 t_CKBOOL good() { return m_valid; }
94 t_CKINT num() { return m_valid ? (t_CKINT)m_device_num : -1; }94 t_CKINT num() { return m_valid ? (t_CKINT)m_device_num : -1; }
95 95
96public:96public:
97 void set_suppress( t_CKBOOL print_or_not )97 void set_suppress( t_CKBOOL print_or_not )
98 { m_suppress_output = print_or_not; }98 { m_suppress_output = print_or_not; }
@@ -187,7 +187,7 @@ public: · 88 unmodified lines
187protected:187protected:
188 MidiInManager();188 MidiInManager();
189 ~MidiInManager();189 ~MidiInManager();
190 190
191 static t_CKBOOL add_vm( Chuck_VM * vm, t_CKINT device_num, t_CKBOOL suppress_output );191 static t_CKBOOL add_vm( Chuck_VM * vm, t_CKINT device_num, t_CKBOOL suppress_output );
192 192
193 static std::vector<RtMidiIn *> the_mins;193 static std::vector<RtMidiIn *> the_mins;
@@ -333,7 +333,7 @@ struct MidiNoteEvent · 139 unmodified lines
333 MidiNoteEvent * simultaneous;333 MidiNoteEvent * simultaneous;
334 // link to parent (could be self)334 // link to parent (could be self)
335 MidiNoteEvent * parent;335 MidiNoteEvent * parent;
336 336
337 // more data337 // more data
338 double startTime;338 double startTime;
339 double endTime;339 double endTime;
@@ -341,12 +341,12 @@ struct MidiNoteEvent · 1 unmodified line
341 int bendAmount;341 int bendAmount;
342 int programChange;342 int programChange;
343 bool phrasemark;343 bool phrasemark;
344 344
345 // constructor345 // constructor
346 MidiNoteEvent() : data1(0), data2(0), data3(0), time(0.0), untilNext(0.0),346 MidiNoteEvent() : data1(0), data2(0), data3(0), time(0.0), untilNext(0.0),
347 simultaneous(NULL), parent(NULL), startTime(0), endTime(0), shouldBend(false),347 simultaneous(NULL), parent(NULL), startTime(0), endTime(0), shouldBend(false),
348 bendAmount(0), programChange(0), phrasemark(false) { }348 bendAmount(0), programChange(0), phrasemark(false) { }
349 349
350 // type of message350 // type of message
351 int type() const { return data1 & 0x70; }351 int type() const { return data1 & 0x70; }
352 // channel352 // channel
@@ -367,7 +367,7 @@ struct MidiLyricEvent · 14 unmodified lines
367 // time data367 // time data
368 double time;368 double time;
369 double endTime;369 double endTime;
370 370
371 // constructor371 // constructor
372 MidiLyricEvent() : time(0), endTime(0) { }372 MidiLyricEvent() : time(0), endTime(0) { }
373};373};
@@ -390,51 +390,51 @@ class MidiScoreReader · 16 unmodified lines
390public:390public:
391 MidiScoreReader();391 MidiScoreReader();
392 ~MidiScoreReader();392 ~MidiScoreReader();
393 393
394public:394public:
395 bool load( const char * filename, float velScale = 0.0f );395 bool load( const char * filename, float velScale = 0.0f );
396 void cleanup();396 void cleanup();
397 397
398public:398public:
399 // rewind to beginning399 // rewind to beginning
400 void rewind();400 void rewind();
401 // get current top event (NO simultaneous)401 // get current top event (NO simultaneous)
402 const MidiNoteEvent * getTopEvent( long track, long offset = 0 );402 const MidiNoteEvent * getTopEvent( t_CKINT track, t_CKINT offset = 0 );
403 // get current event (YES simultaneous) + move to next403 // get current event (YES simultaneous) + move to next
404 const MidiNoteEvent * scanEvent( long track, bool & isNewSet );404 const MidiNoteEvent * scanEvent( t_CKINT track, bool & isNewSet );
405 // advance to next event405 // advance to next event
406 bool seek( long track, long numToAdvance = 1 );406 bool seek( t_CKINT track, t_CKINT numToAdvance = 1 );
407 // advance to next note on407 // advance to next note on
408 bool seekToNoteOn( long track );408 bool seekToNoteOn( t_CKINT track );
409 // get notes in a time window409 // get notes in a time window
410 void getEvents( long track, double startTime, double endTime, std::vector<const MidiNoteEvent *> & result,410 void getEvents( t_CKINT track, double startTime, double endTime, std::vector<const MidiNoteEvent *> & result,
411 bool includeSimultaneous = false );411 bool includeSimultaneous = false );
412 // isDone412 // isDone
413 bool isDone( long track, double currTime );413 bool isDone( t_CKINT track, double currTime );
414 414
415 415
416public:416public:
417 // get number of tracks417 // get number of tracks
418 long getNumTracks() const;418 t_CKINT getNumTracks() const;
419 // get number of events per track419 // get number of events per track
420 long getNumEvents( long track ) const;420 t_CKINT getNumEvents( t_CKINT track ) const;
421 // get number of tracks with more than 0 events421 // get number of tracks with more than 0 events
422 long getNumTracksNonZero() const;422 t_CKINT getNumTracksNonZero() const;
423 // get a vector of tracks indices that have more than 0 events423 // get a vector of tracks indices that have more than 0 events
424 const std::vector<long> & getTracksNonZero() const;424 const std::vector<t_CKINT> & getTracksNonZero() const;
425 // get BPM425 // get BPM
426 double getBPM() const;426 double getBPM() const;
427 // get an entire track's note events427 // get an entire track's note events
428 const std::vector<MidiNoteEvent *> & getNoteEvents( long track );428 const std::vector<MidiNoteEvent *> & getNoteEvents( t_CKINT track );
429 // get an entire track's lyric events429 // get an entire track's lyric events
430 const std::vector<MidiLyricEvent *> & getLyricEvents( long track );430 const std::vector<MidiLyricEvent *> & getLyricEvents( t_CKINT track );
431 // get count431 // get count
432 long getCount( long track, const std::string & key );432 t_CKINT getCount( t_CKINT track, const std::string & key );
433 // get lowest note for a track433 // get lowest note for a track
434 long getLowestNote( long track, const MidiNoteEvent *start );434 t_CKINT getLowestNote( t_CKINT track, const MidiNoteEvent *start );
435 // get highest note for a track435 // get highest note for a track
436 long getHighestNote( long track, const MidiNoteEvent *start );436 t_CKINT getHighestNote( t_CKINT track, const MidiNoteEvent *start );
437 437
438public: // TODO: these may as well be a separate object438public: // TODO: these may as well be a separate object
439 // push a event to remember439 // push a event to remember
440 void enqueue( const MidiNoteEvent * event );440 void enqueue( const MidiNoteEvent * event );
@@ -444,26 +444,26 @@ public: // TODO: these may as well be a separate object · 3 unmodified lines
444 void dequeue();444 void dequeue();
445 // push to front445 // push to front
446 void enqueue_front( const MidiNoteEvent * event );446 void enqueue_front( const MidiNoteEvent * event );
447 447
448public: // track naming448public: // track naming
449 // sets track name449 // sets track name
450 void setTrackName( long track, const std::string & name );450 void setTrackName( t_CKINT track, const std::string & name );
451 // gets track name ("" if not present)451 // gets track name ("" if not present)
452 std::string getTrackName( long track );452 std::string getTrackName( t_CKINT track );
453 // gets the track with the given name (-1 if not present)453 // gets the track with the given name (-1 if not present)
454 long getTrackForName( const std::string & name );454 t_CKINT getTrackForName( const std::string & name );
455 455
456protected: // for use while loading a track456protected: // for use while loading a track
457 // load a track457 // load a track
458 bool loadTrack( long track, std::vector<MidiNoteEvent *> & data, std::vector<MidiLyricEvent *> & lyricData );458 bool loadTrack( t_CKINT track, std::vector<MidiNoteEvent *> & data, std::vector<MidiLyricEvent *> & lyricData );
459 // apply control to existing event459 // apply control to existing event
460 bool applyControl( long track, long data2, long data3, MidiNoteEvent * e );460 bool applyControl( t_CKINT track, t_CKINT data2, t_CKINT data3, MidiNoteEvent * e );
461 // increment count for the given key (used for counting the number of notes, glissandi, etc)461 // increment count for the given key (used for counting the number of notes, glissandi, etc)
462 void incrementCount( long track, const std::string & key );462 void incrementCount( t_CKINT track, const std::string & key );
463 // handle note events, managing m_activeNotes and setting the event's endTime463 // handle note events, managing m_activeNotes and setting the event's endTime
464 void handleNoteOn( MidiNoteEvent * e, long note );464 void handleNoteOn( MidiNoteEvent * e, t_CKINT note );
465 void handleNoteOff( long note, double time );465 void handleNoteOff( t_CKINT note, double time );
466 466
467protected:467protected:
468 // midi468 // midi
469 stk::MidiFileIn * m_midiFile;469 stk::MidiFileIn * m_midiFile;
@@ -472,28 +472,28 @@ protected: · 2 unmodified lines
472 // vector of tracks of events472 // vector of tracks of events
473 std::vector< std::vector<MidiLyricEvent *> > m_lyricEvents;473 std::vector< std::vector<MidiLyricEvent *> > m_lyricEvents;
474 // vector of indices474 // vector of indices
475 std::vector<unsigned long> m_indices;475 std::vector<t_CKUINT> m_indices;
476 // stack of events476 // stack of events
477 std::deque<const MidiNoteEvent *> m_queue;477 std::deque<const MidiNoteEvent *> m_queue;
478 // vector of event478 // vector of event
479 std::vector<const MidiNoteEvent *> m_result;479 std::vector<const MidiNoteEvent *> m_result;
480 // search pointer480 // search pointer
481 std::vector<unsigned long> m_searchIndices;481 std::vector<t_CKUINT> m_searchIndices;
482 // count map482 // count map
483 std::vector< std::map< std::string, long > > m_countMaps;483 std::vector< std::map< std::string, t_CKINT > > m_countMaps;
484 // HACK: scale the velocity (0-1)484 // HACK: scale the velocity (0-1)
485 float m_velocity_scale;485 float m_velocity_scale;
486 // track names486 // track names
487 std::map<std::string, long> m_nameToTrack;487 std::map<std::string, t_CKINT> m_nameToTrack;
488 std::map<long, std::string> m_trackToName;488 std::map<t_CKINT, std::string> m_trackToName;
489 // number of non-zero tracks489 // number of non-zero tracks
490 long m_numNonZeroTracks;490 t_CKINT m_numNonZeroTracks;
491 // vector of indices of non-zero tracks491 // vector of indices of non-zero tracks
492 std::vector<long> m_nonZeroTrackIndices;492 std::vector<t_CKINT> m_nonZeroTrackIndices;
493 493
494private: // used during track loading494private: // used during track loading
495 // active notes, map from MIDI note to event495 // active notes, map from MIDI note to event
496 std::map<long, MidiNoteEvent *> m_activeNotes;496 std::map<t_CKINT, MidiNoteEvent *> m_activeNotes;
497};497};
498 498
499 499
chuginate/template/chuck/include/rtmidi.h+10−10
@@ -38,11 +38,11 @@ · 37 unmodified lines
38/************************************************************************/38/************************************************************************/
39/*! \class RtMidiError39/*! \class RtMidiError
40 \brief Exception handling class for RtAudio & RtMidi.40 \brief Exception handling class for RtAudio & RtMidi.
41 41
42 The RtMidiError class is quite simple but it does allow errors to be42 The RtMidiError class is quite simple but it does allow errors to be
43 "caught" by RtMidiError::Type. See the RtAudio and RtMidi43 "caught" by RtMidiError::Type. See the RtAudio and RtMidi
44 documentation to know which methods can throw an RtMidiError.44 documentation to know which methods can throw an RtMidiError.
45 45
46 */46 */
47/************************************************************************/47/************************************************************************/
48 48
@@ -70,26 +70,26 @@ public: · 21 unmodified lines
70 SYSTEM_ERROR, /*!< A system error occured. */70 SYSTEM_ERROR, /*!< A system error occured. */
71 THREAD_ERROR /*!< A thread error occured. */71 THREAD_ERROR /*!< A thread error occured. */
72 };72 };
73 73
74 //! The constructor.74 //! The constructor.
75 RtMidiError( const std::string& message, Type type = RtMidiError::UNSPECIFIED )75 RtMidiError( const std::string& message, Type type = RtMidiError::UNSPECIFIED )
76 throw() : message_(message), type_(type) {}76 throw() : message_(message), type_(type) {}
77 77
78 //! The destructor.78 //! The destructor.
79 virtual ~RtMidiError( void ) throw() {}79 virtual ~RtMidiError( void ) throw() {}
80 80
81 //! Prints thrown error message to stderr.81 //! Prints thrown error message to stderr.
82 virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }82 virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
83 83
84 //! Returns the thrown error message type.84 //! Returns the thrown error message type.
85 virtual const Type& getType(void) const throw() { return type_; }85 virtual const Type& getType(void) const throw() { return type_; }
86 86
87 //! Returns the thrown error message string.87 //! Returns the thrown error message string.
88 virtual const std::string& getMessage(void) const throw() { return message_; }88 virtual const std::string& getMessage(void) const throw() { return message_; }
89 89
90 //! Returns the thrown error message as a c-style string.90 //! Returns the thrown error message as a c-style string.
91 virtual const char* what( void ) const throw() { return message_.c_str(); }91 virtual const char* what( void ) const throw() { return message_.c_str(); }
92 92
93protected:93protected:
94 std::string message_;94 std::string message_;
95 Type type_;95 Type type_;
@@ -253,8 +253,8 @@ class RtMidiIn : public RtMidi · 157 unmodified lines
253 253
254 // A MIDI structure used internally by the class to store incoming254 // A MIDI structure used internally by the class to store incoming
255 // messages. Each message represents one and only one MIDI message.255 // messages. Each message represents one and only one MIDI message.
256 struct MidiMessage { 256 struct MidiMessage {
257 std::vector<unsigned char> bytes; 257 std::vector<unsigned char> bytes;
258 double timeStamp;258 double timeStamp;
259 259
260 // Default constructor.260 // Default constructor.
chuginate/template/chuck/include/ugen_osc.h+2−2
@@ -66,11 +66,11 @@ CK_DLL_TICK( pulseosc_tick ); · 65 unmodified lines
66// triosc66// triosc
67CK_DLL_TICK( triosc_tick );67CK_DLL_TICK( triosc_tick );
68 68
69// sawosc 69// sawosc
70CK_DLL_CTOR( sawosc_ctor );70CK_DLL_CTOR( sawosc_ctor );
71CK_DLL_CTRL( sawosc_ctrl_width );71CK_DLL_CTRL( sawosc_ctrl_width );
72 72
73// sqrosc 73// sqrosc
74CK_DLL_CTOR( sqrosc_ctor );74CK_DLL_CTOR( sqrosc_ctor );
75CK_DLL_CTRL( sqrosc_ctrl_width );75CK_DLL_CTRL( sqrosc_ctrl_width );
76 76
chuginate/template/chuck/include/ugen_stk.h+141−143
@@ -47,9 +47,6 @@ struct Chuck_Carrier; · 46 unmodified lines
47DLL_QUERY stk_query( Chuck_DL_Query * QUERY );47DLL_QUERY stk_query( Chuck_DL_Query * QUERY );
48t_CKBOOL stk_detach( Chuck_Carrier * carrier );48t_CKBOOL stk_detach( Chuck_Carrier * carrier );
49 49
50
51
52
53// this determines STK float type and de-denormal method50// this determines STK float type and de-denormal method
54#ifndef __STK_USE_SINGLE_PRECISION__51#ifndef __STK_USE_SINGLE_PRECISION__
55#define MY_FLOAT double52#define MY_FLOAT double
@@ -59,6 +56,9 @@ t_CKBOOL stk_detach( Chuck_Carrier * carrier ); · 3 unmodified lines
59#define CK_STK_DDN CK_DDN_SINGLE56#define CK_STK_DDN CK_DDN_SINGLE
60#endif57#endif
61 58
59// 1.4.2.0 (ge) | added as part of switch to snprintf()
60#define STK_MSG_BUF_LENGTH 256
61
62 62
63 63
64 64
@@ -88,14 +88,14 @@ t_CKBOOL stk_detach( Chuck_Carrier * carrier ); · 23 unmodified lines
88// a "long double" in the future.88// a "long double" in the future.
89 89
90//XXX sample is already defined in chuck_def.h!!!90//XXX sample is already defined in chuck_def.h!!!
91#if !defined(SAMPLE) 91#if !defined(SAMPLE)
92 typedef SAMPLE MY_FLOAT;92 typedef SAMPLE MY_FLOAT;
93#endif93#endif
94// The "MY_FLOAT" type will be deprecated in STK94// The "MY_FLOAT" type will be deprecated in STK
95// versions higher than 4.1.2 and replaced with the variable95// versions higher than 4.1.2 and replaced with the variable
96// "StkFloat".96// "StkFloat".
97//typedef double StkFloat;97//typedef double StkFloat;
98//#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)98//#if defined(__PLATFORM_WIN32__) ||
99// #pragma deprecated(MY_FLOAT)99// #pragma deprecated(MY_FLOAT)
100//#else100//#else
101// typedef StkFloat MY_FLOAT __attribute__ ((deprecated));101// typedef StkFloat MY_FLOAT __attribute__ ((deprecated));
@@ -110,7 +110,7 @@ t_CKBOOL stk_detach( Chuck_Carrier * carrier ); · 8 unmodified lines
110class StkError110class StkError
111{111{
112public:112public:
113 enum TYPE { 113 enum TYPE {
114 WARNING,114 WARNING,
115 DEBUG_WARNING,115 DEBUG_WARNING,
116 FUNCTION_ARGUMENT,116 FUNCTION_ARGUMENT,
@@ -126,7 +126,7 @@ public: · 9 unmodified lines
126 };126 };
127 127
128public: // SWAP formerly protected128public: // SWAP formerly protected
129 char message[256];129 char message[STK_MSG_BUF_LENGTH];
130 TYPE type;130 TYPE type;
131 131
132public:132public:
@@ -250,7 +250,7 @@ typedef double FLOAT64; · 117 unmodified lines
250#if defined(__WINDOWS_PTHREAD__)250#if defined(__WINDOWS_PTHREAD__)
251 #define __OS_WINDOWS_CYGWIN__251 #define __OS_WINDOWS_CYGWIN__
252 #define __STK_REALTIME__252 #define __STK_REALTIME__
253#elif defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)253#elif defined(__PLATFORM_WIN32__)
254 #define __OS_WINDOWS__254 #define __OS_WINDOWS__
255 #define __STK_REALTIME__255 #define __STK_REALTIME__
256#elif defined(__PLATFORM_LINUX__)256#elif defined(__PLATFORM_LINUX__)
@@ -492,15 +492,14 @@ class Instrmnt : public Stk · 235 unmodified lines
492 492
493 //! Computer \e vectorSize outputs and return them in \e vector.493 //! Computer \e vectorSize outputs and return them in \e vector.
494 virtual MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);494 virtual MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
495 495
496 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).496 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
497 virtual void controlChange(int number, MY_FLOAT value);497 virtual void controlChange(int number, MY_FLOAT value);
498 498
499public: // SWAP formerly protected499public: // SWAP formerly protected
500 MY_FLOAT lastOutput;
500 // chuck501 // chuck
501 t_CKFLOAT m_frequency;502 t_CKFLOAT m_frequency;
502
503 MY_FLOAT lastOutput;
504};503};
505 504
506 505
@@ -635,7 +634,7 @@ public: · 128 unmodified lines
635 Alternatively, the delay and maximum length634 Alternatively, the delay and maximum length
636 can be set during instantiation with an635 can be set during instantiation with an
637 overloaded constructor.636 overloaded constructor.
638 637
639 A non-interpolating delay line is typically638 A non-interpolating delay line is typically
640 used in fixed delay-length applications, such639 used in fixed delay-length applications, such
641 as for reverberation.640 as for reverberation.
@@ -748,7 +747,7 @@ public: · 106 unmodified lines
748 DelayL();747 DelayL();
749 748
750 //! Overloaded constructor which specifies the current and maximum delay-line lengths.749 //! Overloaded constructor which specifies the current and maximum delay-line lengths.
751 750
752 DelayL(MY_FLOAT theDelay, long maxDelay);751 DelayL(MY_FLOAT theDelay, long maxDelay);
753 752
754 //! Class destructor.753 //! Class destructor.
@@ -770,7 +769,7 @@ public: · 15 unmodified lines
770 //! Input one sample to the delay-line and return one output.769 //! Input one sample to the delay-line and return one output.
771 MY_FLOAT tick(MY_FLOAT sample);770 MY_FLOAT tick(MY_FLOAT sample);
772 771
773 public: // SWAP formerly protected 772 public: // SWAP formerly protected
774 MY_FLOAT alpha;773 MY_FLOAT alpha;
775 MY_FLOAT omAlpha;774 MY_FLOAT omAlpha;
776 MY_FLOAT nextOutput;775 MY_FLOAT nextOutput;
@@ -835,7 +834,7 @@ public: · 58 unmodified lines
835 //! Take \e vectorSize inputs and return the corresponding function values in \e vector.834 //! Take \e vectorSize inputs and return the corresponding function values in \e vector.
836 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);835 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
837 836
838public: // SWAP formerly protected 837public: // SWAP formerly protected
839 MY_FLOAT offSet;838 MY_FLOAT offSet;
840 MY_FLOAT slope;839 MY_FLOAT slope;
841 MY_FLOAT lastOutput;840 MY_FLOAT lastOutput;
@@ -962,7 +961,7 @@ public: · 120 unmodified lines
962 Percussion Instruments", Proceedings of the961 Percussion Instruments", Proceedings of the
963 1999 International Computer Music Conference.962 1999 International Computer Music Conference.
964 963
965 Control Change Numbers: 964 Control Change Numbers:
966 - Bow Pressure = 2965 - Bow Pressure = 2
967 - Bow Motion = 4966 - Bow Motion = 4
968 - Strike Position = 8 (not implemented)967 - Strike Position = 8 (not implemented)
@@ -1018,7 +1017,7 @@ class BandedWG : public Instrmnt · 49 unmodified lines
1018 void pluck(MY_FLOAT amp);1017 void pluck(MY_FLOAT amp);
1019 1018
1020 //! Start a note with the given frequency and amplitude.1019 //! Start a note with the given frequency and amplitude.
1021 void noteOn(MY_FLOAT amplitude) { noteOn ( freakency, amplitude ); } 1020 void noteOn(MY_FLOAT amplitude) { noteOn ( freakency, amplitude ); }
1022 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);1021 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
1023 1022
1024 //! Stop a note with the given amplitude (speed of decay).1023 //! Stop a note with the given amplitude (speed of decay).
@@ -1085,7 +1084,7 @@ class BandedWG : public Instrmnt · 60 unmodified lines
1085 WvIn supports multi-channel data in interleaved1084 WvIn supports multi-channel data in interleaved
1086 format. It is important to distinguish the1085 format. It is important to distinguish the
1087 tick() methods, which return samples produced1086 tick() methods, which return samples produced
1088 by averaging across sample frames, from the 1087 by averaging across sample frames, from the
1089 tickFrame() methods, which return pointers to1088 tickFrame() methods, which return pointers to
1090 multi-channel sample frames. For single-channel1089 multi-channel sample frames. For single-channel
1091 data, these methods return equivalent values.1090 data, these methods return equivalent values.
@@ -1161,7 +1160,7 @@ public: · 69 unmodified lines
1161 //! Normalize data to a maximum of \e +-peak.1160 //! Normalize data to a maximum of \e +-peak.
1162 /*!1161 /*!
1163 For large, incrementally loaded files with integer data types,1162 For large, incrementally loaded files with integer data types,
1164 normalization is computed relative to the data type maximum 1163 normalization is computed relative to the data type maximum
1165 (\e peak/maximum). For incrementally loaded files with floating-1164 (\e peak/maximum). For incrementally loaded files with floating-
1166 point data types, direct scaling by \e peak is performed.1165 point data types, direct scaling by \e peak is performed.
1167 */1166 */
@@ -1255,8 +1254,8 @@ public: // SWAP formerly protected · 87 unmodified lines
1255 // Get MAT-file header information.1254 // Get MAT-file header information.
1256 bool getMatInfo( const char *fileName );1255 bool getMatInfo( const char *fileName );
1257 1256
1258 char msg[256];1257 char msg[STK_MSG_BUF_LENGTH];
1259 // char m_filename[256]; // chuck data1258 // char m_filename[STK_MSG_BUF_LENGTH]; // chuck data
1260 Chuck_String str_filename; // chuck data1259 Chuck_String str_filename; // chuck data
1261 FILE *fd;1260 FILE *fd;
1262 MY_FLOAT *data;1261 MY_FLOAT *data;
@@ -1315,7 +1314,7 @@ public: · 52 unmodified lines
1315 WaveLoop( );1314 WaveLoop( );
1316 //! Class constructor.1315 //! Class constructor.
1317 WaveLoop( const char *fileName, bool raw = FALSE, bool generate = true );1316 WaveLoop( const char *fileName, bool raw = FALSE, bool generate = true );
1318 1317
1319 virtual void openFile( const char * fileName, bool raw = FALSE, bool n = TRUE );1318 virtual void openFile( const char * fileName, bool raw = FALSE, bool n = TRUE );
1320 1319
1321 //! Class destructor.1320 //! Class destructor.
@@ -1458,7 +1457,7 @@ class TwoZero : public FilterStk // formerly protected Filter · 136 unmodified lines
1458 waves and envelopes, determined via a1457 waves and envelopes, determined via a
1459 constructor argument.1458 constructor argument.
1460 1459
1461 Control Change Numbers: 1460 Control Change Numbers:
1462 - Control One = 21461 - Control One = 2
1463 - Control Two = 41462 - Control Two = 4
1464 - LFO Speed = 111463 - LFO Speed = 11
@@ -1529,7 +1528,7 @@ class FM : public Instrmnt · 64 unmodified lines
1529 MY_FLOAT getFMTableSusLevel(int index); // programming settings1528 MY_FLOAT getFMTableSusLevel(int index); // programming settings
1530 // 1.4.1.0 (prc): *** END REPAIRATHON2021 BLOCK ***1529 // 1.4.1.0 (prc): *** END REPAIRATHON2021 BLOCK ***
1531 /****************************************/1530 /****************************************/
1532 1531
1533 //! Set instrument parameters for a particular frequency.1532 //! Set instrument parameters for a particular frequency.
1534 virtual void setFrequency(MY_FLOAT frequency);1533 virtual void setFrequency(MY_FLOAT frequency);
1535 1534
@@ -1566,8 +1565,8 @@ class FM : public Instrmnt · 30 unmodified lines
1566 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).1565 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
1567 virtual void controlChange(int number, MY_FLOAT value);1566 virtual void controlChange(int number, MY_FLOAT value);
1568 1567
1569 public: // SWAP formerly protected 1568 public: // SWAP formerly protected
1570 ADSR **adsr; 1569 ADSR **adsr;
1571 WaveLoop **waves;1570 WaveLoop **waves;
1572 WaveLoop *vibrato;1571 WaveLoop *vibrato;
1573 TwoZero *twozero;1572 TwoZero *twozero;
@@ -1587,7 +1586,6 @@ class FM : public Instrmnt · 13 unmodified lines
1587 MY_FLOAT __FM_gains[100];1586 MY_FLOAT __FM_gains[100];
1588 MY_FLOAT __FM_susLevels[16];1587 MY_FLOAT __FM_susLevels[16];
1589 MY_FLOAT __FM_attTimes[32];1588 MY_FLOAT __FM_attTimes[32];
1590
1591};1589};
1592 1590
1593#endif1591#endif
@@ -1612,7 +1610,7 @@ class FM : public Instrmnt · 18 unmodified lines
1612 4 --1610 4 --
1613 \endcode1611 \endcode
1614 1612
1615 Control Change Numbers: 1613 Control Change Numbers:
1616 - Operator 4 (feedback) Gain = 21614 - Operator 4 (feedback) Gain = 2
1617 - Operator 3 Gain = 41615 - Operator 3 Gain = 4
1618 - LFO Speed = 111616 - LFO Speed = 11
@@ -1691,7 +1689,7 @@ public: · 72 unmodified lines
1691 //! Take \e vectorSize inputs and return the corresponding function values in \e vector.1689 //! Take \e vectorSize inputs and return the corresponding function values in \e vector.
1692 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);1690 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
1693 1691
1694public: // SWAP formerly protected 1692public: // SWAP formerly protected
1695 MY_FLOAT lastOutput;1693 MY_FLOAT lastOutput;
1696 1694
1697};1695};
@@ -1832,7 +1830,7 @@ public: · 134 unmodified lines
1832 //! Return the last computed value.1830 //! Return the last computed value.
1833 MY_FLOAT lastOut() const;1831 MY_FLOAT lastOut() const;
1834 1832
1835public: // SWAP formerly protected 1833public: // SWAP formerly protected
1836 1834
1837 MY_FLOAT lastOutput;1835 MY_FLOAT lastOutput;
1838 1836
@@ -1851,7 +1849,7 @@ public: // SWAP formerly protected · 12 unmodified lines
1851 (biquad filter) with a polynomial jet1849 (biquad filter) with a polynomial jet
1852 excitation (a la Cook).1850 excitation (a la Cook).
1853 1851
1854 Control Change Numbers: 1852 Control Change Numbers:
1855 - Noise Gain = 41853 - Noise Gain = 4
1856 - Vibrato Frequency = 111854 - Vibrato Frequency = 11
1857 - Vibrato Gain = 11855 - Vibrato Gain = 1
@@ -1901,14 +1899,14 @@ class BlowBotl : public Instrmnt · 43 unmodified lines
1901 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).1899 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
1902 void controlChange(int number, MY_FLOAT value);1900 void controlChange(int number, MY_FLOAT value);
1903 1901
1904 public: // SWAP formerly protected 1902 public: // SWAP formerly protected
1905 // chuck1903 // chuck
1906 t_CKFLOAT m_rate;1904 t_CKFLOAT m_rate;
1907 t_CKFLOAT m_noiseGain;1905 t_CKFLOAT m_noiseGain;
1908 t_CKFLOAT m_vibratoFreq;1906 t_CKFLOAT m_vibratoFreq;
1909 t_CKFLOAT m_vibratoGain;1907 t_CKFLOAT m_vibratoGain;
1910 t_CKFLOAT m_volume;1908 t_CKFLOAT m_volume;
1911 1909
1912 void setVibratoFreq(MY_FLOAT freq)1910 void setVibratoFreq(MY_FLOAT freq)
1913 { vibrato->setFrequency( freq ); m_vibratoFreq = vibrato->m_freq; }1911 { vibrato->setFrequency( freq ); m_vibratoFreq = vibrato->m_freq; }
1914 void setVibratoGain(MY_FLOAT gain)1912 void setVibratoGain(MY_FLOAT gain)
@@ -1994,7 +1992,7 @@ public: · 79 unmodified lines
1994 //! Take \e vectorSize inputs and return the corresponding function values in \e vector.1992 //! Take \e vectorSize inputs and return the corresponding function values in \e vector.
1995 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);1993 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
1996 1994
1997public: // SWAP formerly protected 1995public: // SWAP formerly protected
1998 MY_FLOAT offSet;1996 MY_FLOAT offSet;
1999 MY_FLOAT slope;1997 MY_FLOAT slope;
2000 MY_FLOAT lastOutput;1998 MY_FLOAT lastOutput;
@@ -2104,7 +2102,7 @@ class OneZero : public FilterStk // formerly protected Filter · 103 unmodified lines
2104 use possibly subject to patents held by Stanford2102 use possibly subject to patents held by Stanford
2105 University, Yamaha, and others.2103 University, Yamaha, and others.
2106 2104
2107 Control Change Numbers: 2105 Control Change Numbers:
2108 - Reed Stiffness = 22106 - Reed Stiffness = 2
2109 - Noise Gain = 42107 - Noise Gain = 4
2110 - Tonehole State = 112108 - Tonehole State = 11
@@ -2162,7 +2160,7 @@ class BlowHole : public Instrmnt · 51 unmodified lines
2162 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).2160 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
2163 void controlChange(int number, MY_FLOAT value);2161 void controlChange(int number, MY_FLOAT value);
2164 2162
2165 public: // SWAP formerly protected 2163 public: // SWAP formerly protected
2166 2164
2167 // CHUCK2165 // CHUCK
2168 t_CKFLOAT m_reed;2166 t_CKFLOAT m_reed;
@@ -2283,7 +2281,7 @@ public: · 114 unmodified lines
2283 use possibly subject to patents held by2281 use possibly subject to patents held by
2284 Stanford University, Yamaha, and others.2282 Stanford University, Yamaha, and others.
2285 2283
2286 Control Change Numbers: 2284 Control Change Numbers:
2287 - Bow Pressure = 22285 - Bow Pressure = 2
2288 - Bow Position = 42286 - Bow Position = 4
2289 - Vibrato Frequency = 112287 - Vibrato Frequency = 11
@@ -2323,7 +2321,7 @@ class Bowed : public Instrmnt · 33 unmodified lines
2323 //! Decrease breath pressure with given rate of decrease.2321 //! Decrease breath pressure with given rate of decrease.
2324 void stopBowing(MY_FLOAT rate);2322 void stopBowing(MY_FLOAT rate);
2325 2323
2326 void noteOn(MY_FLOAT amplitude) { noteOn ( m_frequency, amplitude ); } 2324 void noteOn(MY_FLOAT amplitude) { noteOn ( m_frequency, amplitude ); }
2327 //! Start a note with the given frequency and amplitude.2325 //! Start a note with the given frequency and amplitude.
2328 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);2326 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
2329 2327
@@ -2406,7 +2404,7 @@ public: · 76 unmodified lines
2406 DelayA();2404 DelayA();
2407 2405
2408 //! Overloaded constructor which specifies the current and maximum delay-line lengths.2406 //! Overloaded constructor which specifies the current and maximum delay-line lengths.
2409 2407
2410 DelayA(MY_FLOAT theDelay, long maxDelay);2408 DelayA(MY_FLOAT theDelay, long maxDelay);
2411 2409
2412 //! Class destructor.2410 //! Class destructor.
@@ -2431,7 +2429,7 @@ public: · 18 unmodified lines
2431 //! Input one sample to the delay-line and return one output.2429 //! Input one sample to the delay-line and return one output.
2432 MY_FLOAT tick(MY_FLOAT sample);2430 MY_FLOAT tick(MY_FLOAT sample);
2433 2431
2434public: // SWAP formerly protected 2432public: // SWAP formerly protected
2435 MY_FLOAT alpha;2433 MY_FLOAT alpha;
2436 MY_FLOAT coeff;2434 MY_FLOAT coeff;
2437 MY_FLOAT apInput;2435 MY_FLOAT apInput;
@@ -2455,7 +2453,7 @@ public: // SWAP formerly protected · 17 unmodified lines
2455 use possibly subject to patents held by2453 use possibly subject to patents held by
2456 Stanford University, Yamaha, and others.2454 Stanford University, Yamaha, and others.
2457 2455
2458 Control Change Numbers: 2456 Control Change Numbers:
2459 - Lip Tension = 22457 - Lip Tension = 2
2460 - Slide Length = 42458 - Slide Length = 4
2461 - Vibrato Frequency = 112459 - Vibrato Frequency = 11
@@ -2506,7 +2504,7 @@ class Brass: public Instrmnt · 44 unmodified lines
2506 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).2504 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
2507 void controlChange(int number, MY_FLOAT value);2505 void controlChange(int number, MY_FLOAT value);
2508 2506
2509 public: // SWAP formerly protected 2507 public: // SWAP formerly protected
2510 2508
2511 // CHUCK2509 // CHUCK
2512 t_CKFLOAT m_rate;2510 t_CKFLOAT m_rate;
@@ -2576,7 +2574,7 @@ class Chorus : public Stk · 63 unmodified lines
2576 //! Set modulation frequency.2574 //! Set modulation frequency.
2577 void setModFrequency(MY_FLOAT frequency);2575 void setModFrequency(MY_FLOAT frequency);
2578 2576
2579 //! Set the mixture of input and processed levels in the output (0.0 = input only, 1.0 = processed only). 2577 //! Set the mixture of input and processed levels in the output (0.0 = input only, 1.0 = processed only).
2580 void setEffectMix(MY_FLOAT mix);2578 void setEffectMix(MY_FLOAT mix);
2581 2579
2582 //! Return the last output value.2580 //! Return the last output value.
@@ -2594,7 +2592,7 @@ class Chorus : public Stk · 11 unmodified lines
2594 //! Take \e vectorSize inputs, compute the same number of outputs and return them in \e vector.2592 //! Take \e vectorSize inputs, compute the same number of outputs and return them in \e vector.
2595 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);2593 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
2596 2594
2597 public: // SWAP formerly protected 2595 public: // SWAP formerly protected
2598 DelayL *delayLine[2];2596 DelayL *delayLine[2];
2599 WaveLoop *mods[2];2597 WaveLoop *mods[2];
2600 MY_FLOAT baseLength;2598 MY_FLOAT baseLength;
@@ -2623,7 +2621,7 @@ class Chorus : public Stk · 22 unmodified lines
2623 use possibly subject to patents held by Stanford2621 use possibly subject to patents held by Stanford
2624 University, Yamaha, and others.2622 University, Yamaha, and others.
2625 2623
2626 Control Change Numbers: 2624 Control Change Numbers:
2627 - Reed Stiffness = 22625 - Reed Stiffness = 2
2628 - Noise Gain = 42626 - Noise Gain = 4
2629 - Vibrato Frequency = 112627 - Vibrato Frequency = 11
@@ -2753,7 +2751,7 @@ class Drummer : public Instrmnt · 123 unmodified lines
2753 //! Compute one output sample.2751 //! Compute one output sample.
2754 MY_FLOAT tick();2752 MY_FLOAT tick();
2755 2753
2756 public: // SWAP formerly protected 2754 public: // SWAP formerly protected
2757 WvIn *waves[DRUM_POLYPHONY];2755 WvIn *waves[DRUM_POLYPHONY];
2758 OnePole *filters[DRUM_POLYPHONY];2756 OnePole *filters[DRUM_POLYPHONY];
2759 int sounding[DRUM_POLYPHONY];2757 int sounding[DRUM_POLYPHONY];
@@ -2797,7 +2795,7 @@ public: · 37 unmodified lines
2797 void set(MY_FLOAT max);2795 void set(MY_FLOAT max);
2798 MY_FLOAT getDelay();2796 MY_FLOAT getDelay();
2799 2797
2800 //! Set the mixture of input and processed levels in the output (0.0 = input only, 1.0 = processed only). 2798 //! Set the mixture of input and processed levels in the output (0.0 = input only, 1.0 = processed only).
2801 void setEffectMix(MY_FLOAT mix);2799 void setEffectMix(MY_FLOAT mix);
2802 2800
2803 //! Return the last output value.2801 //! Return the last output value.
@@ -2838,7 +2836,7 @@ public: · 34 unmodified lines
2838 \->3 -/2836 \->3 -/
2839 \endcode2837 \endcode
2840 2838
2841 Control Change Numbers: 2839 Control Change Numbers:
2842 - Vowel = 22840 - Vowel = 2
2843 - Spectral Tilt = 42841 - Spectral Tilt = 4
2844 - LFO Speed = 112842 - LFO Speed = 11
@@ -2905,7 +2903,7 @@ class FMVoices : public FM · 60 unmodified lines
2905 use possibly subject to patents held by Stanford2903 use possibly subject to patents held by Stanford
2906 University, Yamaha, and others.2904 University, Yamaha, and others.
2907 2905
2908 Control Change Numbers: 2906 Control Change Numbers:
2909 - Jet Delay = 22907 - Jet Delay = 2
2910 - Noise Gain = 42908 - Noise Gain = 4
2911 - Vibrato Frequency = 112909 - Vibrato Frequency = 11
@@ -2973,14 +2971,14 @@ public: // SWAP formerly protected · 61 unmodified lines
2973 t_CKFLOAT m_vibratoGain;2971 t_CKFLOAT m_vibratoGain;
2974 t_CKFLOAT m_pressure;2972 t_CKFLOAT m_pressure;
2975 t_CKFLOAT m_rate;2973 t_CKFLOAT m_rate;
2976 2974
2977 void setVibratoFreq(MY_FLOAT freq)2975 void setVibratoFreq(MY_FLOAT freq)
2978 { vibrato->setFrequency( freq ); m_vibratoFreq = vibrato->m_freq; }2976 { vibrato->setFrequency( freq ); m_vibratoFreq = vibrato->m_freq; }
2979 void setVibratoGain(MY_FLOAT gain)2977 void setVibratoGain(MY_FLOAT gain)
2980 { vibratoGain = gain; m_vibratoGain = vibratoGain; }2978 { vibratoGain = gain; m_vibratoGain = vibratoGain; }
2981 void setNoiseGain(MY_FLOAT gain)2979 void setNoiseGain(MY_FLOAT gain)
2982 { noiseGain = gain; m_noiseGain = gain; }2980 { noiseGain = gain; m_noiseGain = gain; }
2983 2981
2984 DelayL *jetDelay;2982 DelayL *jetDelay;
2985 DelayL *boreDelay;2983 DelayL *boreDelay;
2986 JetTabl *jetTable;2984 JetTabl *jetTable;
@@ -3061,7 +3059,7 @@ class FormSwep : public BiQuad · 74 unmodified lines
3061 A sweep rate of 1.0 will produce an immediate change in3059 A sweep rate of 1.0 will produce an immediate change in
3062 resonance parameters from their current values to the3060 resonance parameters from their current values to the
3063 target values. A sweep rate of 0.0 will produce no3061 target values. A sweep rate of 0.0 will produce no
3064 change in resonance parameters. 3062 change in resonance parameters.
3065 */3063 */
3066 void setSweepRate(MY_FLOAT aRate);3064 void setSweepRate(MY_FLOAT aRate);
3067 3065
@@ -3079,7 +3077,7 @@ class FormSwep : public BiQuad · 11 unmodified lines
3079 //! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.3077 //! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.
3080 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);3078 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
3081 3079
3082 public: // SWAP formerly protected 3080 public: // SWAP formerly protected
3083 bool dirty;3081 bool dirty;
3084 MY_FLOAT frequency;3082 MY_FLOAT frequency;
3085 MY_FLOAT radius;3083 MY_FLOAT radius;
@@ -3115,7 +3113,7 @@ class FormSwep : public BiQuad · 29 unmodified lines
3115 3-->2-- + -->1-->Out3113 3-->2-- + -->1-->Out
3116 \endcode3114 \endcode
3117 3115
3118 Control Change Numbers: 3116 Control Change Numbers:
3119 - Total Modulator Index = 23117 - Total Modulator Index = 2
3120 - Modulator Crossfade = 43118 - Modulator Crossfade = 4
3121 - LFO Speed = 113119 - LFO Speed = 11
@@ -3163,27 +3161,27 @@ class HevyMetl : public FM · 41 unmodified lines
3163/***************************************************/3161/***************************************************/
3164/*! \class HnkyTonk3162/*! \class HnkyTonk
3165 \brief STK Honkey Tonk Piano FM synthesis instrument.3163 \brief STK Honkey Tonk Piano FM synthesis instrument.
3166 3164
3167 This class implements 4 cascade operators with3165 This class implements 4 cascade operators with
3168 feedback modulation on the master modulator,3166 feedback modulation on the master modulator,
3169 also referred to as algorithm 1 of the TX81Z.3167 also referred to as algorithm 1 of the TX81Z.
3170 3168
3171 Algorithm 1 is :3169 Algorithm 1 is :
3172 4-->3-->2-->1-->Out3170 4-->3-->2-->1-->Out
3173 3171
3174 Control Change Numbers:3172 Control Change Numbers:
3175 - Total Modulator Index = 23173 - Total Modulator Index = 2
3176 - Modulator Crossfade = 43174 - Modulator Crossfade = 4
3177 - LFO Speed = 113175 - LFO Speed = 11
3178 - LFO Depth = 13176 - LFO Depth = 1
3179 - ADSR 2 & 4 Target = 1283177 - ADSR 2 & 4 Target = 128
3180 3178
3181 The basic Chowning/Stanford FM patent expired3179 The basic Chowning/Stanford FM patent expired
3182 in 1995, but there exist follow-on patents,3180 in 1995, but there exist follow-on patents,
3183 mostly assigned to Yamaha. If you are of the3181 mostly assigned to Yamaha. If you are of the
3184 type who should worry about this (making3182 type who should worry about this (making
3185 money) worry away.3183 money) worry away.
3186 3184
3187 by Perry R. Cook, 2021.3185 by Perry R. Cook, 2021.
3188 */3186 */
3189/***************************************************/3187/***************************************************/
@@ -3196,14 +3194,14 @@ class HnkyTonk : public FM · 6 unmodified lines
3196public:3194public:
3197 //! Class constructor.3195 //! Class constructor.
3198 HnkyTonk();3196 HnkyTonk();
3199 3197
3200 //! Class destructor.3198 //! Class destructor.
3201 ~HnkyTonk();3199 ~HnkyTonk();
3202 3200
3203 //! Start a note with the given frequency and amplitude.3201 //! Start a note with the given frequency and amplitude.
3204 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);3202 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
3205 void noteOn( MY_FLOAT amplitude) { noteOn(baseFrequency, amplitude); }3203 void noteOn( MY_FLOAT amplitude) { noteOn(baseFrequency, amplitude); }
3206 3204
3207 //! Compute one output sample.3205 //! Compute one output sample.
3208 MY_FLOAT tick();3206 MY_FLOAT tick();
3209};3207};
@@ -3215,27 +3213,27 @@ public: · 5 unmodified lines
3215/***************************************************/3213/***************************************************/
3216/*! \class FrencHrn3214/*! \class FrencHrn
3217 \brief NEW STK-style French Horn FM synthesis instrument.3215 \brief NEW STK-style French Horn FM synthesis instrument.
3218 3216
3219 This class implements 3 cascade operators with3217 This class implements 3 cascade operators with
3220 feedback modulation, also referred to as3218 feedback modulation, also referred to as
3221 algorithm 3 of the TX81Z.3219 algorithm 3 of the TX81Z.
3222 3220
3223 Algorithm 3 is : 4--\3221 Algorithm 3 is : 4--\
3224 3-->2-- + -->1-->Out3222 3-->2-- + -->1-->Out
3225 3223
3226 Control Change Numbers:3224 Control Change Numbers:
3227 - Total Modulator Index = 23225 - Total Modulator Index = 2
3228 - Modulator Crossfade = 43226 - Modulator Crossfade = 4
3229 - LFO Speed = 113227 - LFO Speed = 11
3230 - LFO Depth = 13228 - LFO Depth = 1
3231 - ADSR 2 & 4 Target = 1283229 - ADSR 2 & 4 Target = 128
3232 3230
3233 The basic Chowning/Stanford FM patent expired3231 The basic Chowning/Stanford FM patent expired
3234 in 1995, but there exist follow-on patents,3232 in 1995, but there exist follow-on patents,
3235 mostly assigned to Yamaha. If you are of the3233 mostly assigned to Yamaha. If you are of the
3236 type who should worry about this (making3234 type who should worry about this (making
3237 money) worry away.3235 money) worry away.
3238 3236
3239 by Perry R. Cook, 2021.3237 by Perry R. Cook, 2021.
3240 */3238 */
3241/***************************************************/3239/***************************************************/
@@ -3248,14 +3246,14 @@ class FrencHrn : public FM · 6 unmodified lines
3248public:3246public:
3249 //! Class constructor.3247 //! Class constructor.
3250 FrencHrn();3248 FrencHrn();
3251 3249
3252 //! Class destructor.3250 //! Class destructor.
3253 ~FrencHrn();3251 ~FrencHrn();
3254 3252
3255 //! Start a note with the given frequency and amplitude.3253 //! Start a note with the given frequency and amplitude.
3256 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);3254 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
3257 void noteOn( MY_FLOAT amplitude) { noteOn(baseFrequency, amplitude); }3255 void noteOn( MY_FLOAT amplitude) { noteOn(baseFrequency, amplitude); }
3258 3256
3259 //! Compute one output sample.3257 //! Compute one output sample.
3260 MY_FLOAT tick();3258 MY_FLOAT tick();
3261};3259};
@@ -3268,28 +3266,28 @@ public: · 6 unmodified lines
3268/***************************************************/3266/***************************************************/
3269/*! \class KrstlChr3267/*! \class KrstlChr
3270 \brief New STK-style Crystal Choir FM synthesis instrument.3268 \brief New STK-style Crystal Choir FM synthesis instrument.
3271 3269
3272 This class implements 3 parallel operators with3270 This class implements 3 parallel operators with
3273 one modulated, by one with feedback modulation,3271 one modulated, by one with feedback modulation,
3274 also referred to as algorithm 7 of the TX81Z.3272 also referred to as algorithm 7 of the TX81Z.
3275 3273
3276 Algorithm 3 is : 4-->3-->\3274 Algorithm 3 is : 4-->3-->\
3277 2--> + -->Out3275 2--> + -->Out
3278 1-->/3276 1-->/
3279 3277
3280 Control Change Numbers:3278 Control Change Numbers:
3281 - Total Modulator Index = 23279 - Total Modulator Index = 2
3282 - Modulator Crossfade = 43280 - Modulator Crossfade = 4
3283 - LFO Speed = 113281 - LFO Speed = 11
3284 - LFO Depth = 13282 - LFO Depth = 1
3285 - ADSR 2 & 4 Target = 1283283 - ADSR 2 & 4 Target = 128
3286 3284
3287 The basic Chowning/Stanford FM patent expired3285 The basic Chowning/Stanford FM patent expired
3288 in 1995, but there exist follow-on patents,3286 in 1995, but there exist follow-on patents,
3289 mostly assigned to Yamaha. If you are of the3287 mostly assigned to Yamaha. If you are of the
3290 type who should worry about this (making3288 type who should worry about this (making
3291 money) worry away.3289 money) worry away.
3292 3290
3293 by Perry R. Cook, 2021.3291 by Perry R. Cook, 2021.
3294 */3292 */
3295/***************************************************/3293/***************************************************/
@@ -3302,14 +3300,14 @@ class KrstlChr : public FM · 6 unmodified lines
3302public:3300public:
3303 //! Class constructor.3301 //! Class constructor.
3304 KrstlChr();3302 KrstlChr();
3305 3303
3306 //! Class destructor.3304 //! Class destructor.
3307 ~KrstlChr();3305 ~KrstlChr();
3308 3306
3309 //! Start a note with the given frequency and amplitude.3307 //! Start a note with the given frequency and amplitude.
3310 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);3308 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
3311 void noteOn( MY_FLOAT amplitude) { noteOn(baseFrequency, amplitude); }3309 void noteOn( MY_FLOAT amplitude) { noteOn(baseFrequency, amplitude); }
3312 3310
3313 //! Compute one output sample.3311 //! Compute one output sample.
3314 MY_FLOAT tick();3312 MY_FLOAT tick();
3315};3313};
@@ -3348,7 +3346,7 @@ class Reverb : public Stk · 32 unmodified lines
3348 //! Reset and clear all internal state.3346 //! Reset and clear all internal state.
3349 virtual void clear() = 0;3347 virtual void clear() = 0;
3350 3348
3351 //! Set the mixture of input and "reverberated" levels in the output (0.0 = input only, 1.0 = reverb only). 3349 //! Set the mixture of input and "reverberated" levels in the output (0.0 = input only, 1.0 = reverb only).
3352 void setEffectMix(MY_FLOAT mix);3350 void setEffectMix(MY_FLOAT mix);
3353 3351
3354 //! Return the last output value.3352 //! Return the last output value.
@@ -3495,7 +3493,7 @@ class PluckTwo : public Instrmnt · 140 unmodified lines
3495 //! Virtual (abstract) tick function is implemented by subclasses.3493 //! Virtual (abstract) tick function is implemented by subclasses.
3496 virtual MY_FLOAT tick() = 0;3494 virtual MY_FLOAT tick() = 0;
3497 3495
3498 public: // SWAP formerly protected 3496 public: // SWAP formerly protected
3499 DelayA *delayLine;3497 DelayA *delayLine;
3500 DelayA *delayLine2;3498 DelayA *delayLine2;
3501 DelayL *combDelay;3499 DelayL *combDelay;
@@ -3535,7 +3533,7 @@ class PluckTwo : public Instrmnt · 33 unmodified lines
3535 information, contact the Office of Technology3533 information, contact the Office of Technology
3536 Licensing, Stanford University.3534 Licensing, Stanford University.
3537 3535
3538 Control Change Numbers: 3536 Control Change Numbers:
3539 - Body Size = 23537 - Body Size = 2
3540 - Pluck Position = 43538 - Pluck Position = 4
3541 - String Sustain = 113539 - String Sustain = 11
@@ -3580,7 +3578,7 @@ class Mandolin : public PluckTwo · 38 unmodified lines
3580 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).3578 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
3581 virtual void controlChange(int number, MY_FLOAT value);3579 virtual void controlChange(int number, MY_FLOAT value);
3582 3580
3583 public: // SWAP formerly protected 3581 public: // SWAP formerly protected
3584 WvIn *soundfile[12];3582 WvIn *soundfile[12];
3585 MY_FLOAT directBody;3583 MY_FLOAT directBody;
3586 int mic;3584 int mic;
@@ -3611,7 +3609,7 @@ class Mandolin : public PluckTwo · 24 unmodified lines
3611 use possibly subject to patents held by Stanford3609 use possibly subject to patents held by Stanford
3612 University, Yamaha, and others.3610 University, Yamaha, and others.
3613 3611
3614 Control Change Numbers: 3612 Control Change Numbers:
3615 - X Dimension = 23613 - X Dimension = 2
3616 - Y Dimension = 43614 - Y Dimension = 4
3617 - Mesh Decay = 113615 - Mesh Decay = 11
@@ -3639,7 +3637,7 @@ class Mesh2D : public Instrmnt · 21 unmodified lines
3639 ~Mesh2D();3637 ~Mesh2D();
3640 3638
3641 //! Reset and clear all internal state.3639 //! Reset and clear all internal state.
3642 void clear(); 3640 void clear();
3643 3641
3644 //! Set the x dimension size in samples.3642 //! Set the x dimension size in samples.
3645 void setNX(short lenX);3643 void setNX(short lenX);
@@ -3769,7 +3767,7 @@ public: // SWAP formerly protected · 123 unmodified lines
3769 t_CKFLOAT m_vibratoFreq;3767 t_CKFLOAT m_vibratoFreq;
3770 t_CKFLOAT m_volume;3768 t_CKFLOAT m_volume;
3771 3769
3772 Envelope *envelope; 3770 Envelope *envelope;
3773 WvIn *wave;3771 WvIn *wave;
3774 BiQuad **filters;3772 BiQuad **filters;
3775 OnePole *onepole;3773 OnePole *onepole;
@@ -3799,7 +3797,7 @@ public: // SWAP formerly protected · 23 unmodified lines
3799 struck bar instruments. It inherits from the3797 struck bar instruments. It inherits from the
3800 Modal class.3798 Modal class.
3801 3799
3802 Control Change Numbers: 3800 Control Change Numbers:
3803 - Stick Hardness = 23801 - Stick Hardness = 2
3804 - Stick Position = 43802 - Stick Position = 4
3805 - Vibrato Gain = 113803 - Vibrato Gain = 11
@@ -3889,7 +3887,7 @@ class SubNoise : public Noise · 83 unmodified lines
3889 //! Return a sub-sampled random number between -1.0 and 1.0.3887 //! Return a sub-sampled random number between -1.0 and 1.0.
3890 MY_FLOAT tick();3888 MY_FLOAT tick();
3891 3889
3892 public: // SWAP formerly protected 3890 public: // SWAP formerly protected
3893 int counter;3891 int counter;
3894 int rate;3892 int rate;
3895 3893
@@ -4006,8 +4004,8 @@ class Sampler : public Instrmnt · 110 unmodified lines
4006 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).4004 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
4007 virtual void controlChange(int number, MY_FLOAT value) = 0;4005 virtual void controlChange(int number, MY_FLOAT value) = 0;
4008 4006
4009 public: // SWAP formerly protected 4007 public: // SWAP formerly protected
4010 ADSR *adsr; 4008 ADSR *adsr;
4011 WvIn *attacks[5];4009 WvIn *attacks[5];
4012 WaveLoop *loops[5];4010 WaveLoop *loops[5];
4013 OnePole *filter;4011 OnePole *filter;
@@ -4034,7 +4032,7 @@ class Sampler : public Instrmnt · 20 unmodified lines
4034 from the Sampler class) and adds two sweepable4032 from the Sampler class) and adds two sweepable
4035 formant (FormSwep) filters.4033 formant (FormSwep) filters.
4036 4034
4037 Control Change Numbers: 4035 Control Change Numbers:
4038 - Filter Q = 24036 - Filter Q = 2
4039 - Filter Sweep Rate = 44037 - Filter Sweep Rate = 4
4040 - Vibrato Frequency = 114038 - Vibrato Frequency = 11
@@ -4132,7 +4130,7 @@ class NRev : public Reverb · 91 unmodified lines
4132 //! Compute one output sample.4130 //! Compute one output sample.
4133 MY_FLOAT tick(MY_FLOAT input);4131 MY_FLOAT tick(MY_FLOAT input);
4134 4132
4135 public: // SWAP formerly protected 4133 public: // SWAP formerly protected
4136 Delay *allpassDelays[8];4134 Delay *allpassDelays[8];
4137 Delay *combDelays[6];4135 Delay *combDelays[6];
4138 MY_FLOAT allpassCoefficient;4136 MY_FLOAT allpassCoefficient;
@@ -4182,7 +4180,7 @@ public: · 43 unmodified lines
4182 //! Compute one output sample.4180 //! Compute one output sample.
4183 MY_FLOAT tick(MY_FLOAT input);4181 MY_FLOAT tick(MY_FLOAT input);
4184 4182
4185public: // SWAP formerly protected 4183public: // SWAP formerly protected
4186 Delay *allpassDelays[2];4184 Delay *allpassDelays[2];
4187 Delay *combDelays[2];4185 Delay *combDelays[2];
4188 MY_FLOAT allpassCoefficient;4186 MY_FLOAT allpassCoefficient;
@@ -4207,7 +4205,7 @@ public: // SWAP formerly protected · 18 unmodified lines
4207 2-- + -->1-->Out4205 2-- + -->1-->Out
4208 \endcode4206 \endcode
4209 4207
4210 Control Change Numbers: 4208 Control Change Numbers:
4211 - Total Modulator Index = 24209 - Total Modulator Index = 2
4212 - Modulator Crossfade = 44210 - Modulator Crossfade = 4
4213 - LFO Speed = 114211 - LFO Speed = 11
@@ -4337,7 +4335,7 @@ class PitShift : public Stk · 123 unmodified lines
4337 //! Set the pitch shift factor (1.0 produces no shift).4335 //! Set the pitch shift factor (1.0 produces no shift).
4338 void setShift(MY_FLOAT shift);4336 void setShift(MY_FLOAT shift);
4339 4337
4340 //! Set the mixture of input and processed levels in the output (0.0 = input only, 1.0 = processed only). 4338 //! Set the mixture of input and processed levels in the output (0.0 = input only, 1.0 = processed only).
4341 void setEffectMix(MY_FLOAT mix);4339 void setEffectMix(MY_FLOAT mix);
4342 4340
4343 //! Return the last output value.4341 //! Return the last output value.
@@ -4349,7 +4347,7 @@ class PitShift : public Stk · 5 unmodified lines
4349 //! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.4347 //! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.
4350 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);4348 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
4351 4349
4352 public: // SWAP formerly protected 4350 public: // SWAP formerly protected
4353 //chuck4351 //chuck
4354 t_CKFLOAT m_vibratoGain;4352 t_CKFLOAT m_vibratoGain;
4355 t_CKFLOAT m_vibratoFreq;4353 t_CKFLOAT m_vibratoFreq;
@@ -4420,7 +4418,7 @@ class Plucked : public Instrmnt · 64 unmodified lines
4420 //! Compute one output sample.4418 //! Compute one output sample.
4421 virtual MY_FLOAT tick();4419 virtual MY_FLOAT tick();
4422 4420
4423 public: // SWAP formerly protected 4421 public: // SWAP formerly protected
4424 DelayA *delayLine;4422 DelayA *delayLine;
4425 OneZero *loopFilter;4423 OneZero *loopFilter;
4426 OnePole *pickFilter;4424 OnePole *pickFilter;
@@ -4498,7 +4496,7 @@ class Resonate : public Instrmnt · 71 unmodified lines
4498 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).4496 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
4499 virtual void controlChange(int number, MY_FLOAT value);4497 virtual void controlChange(int number, MY_FLOAT value);
4500 4498
4501 public: // SWAP formerly protected 4499 public: // SWAP formerly protected
4502 ADSR *adsr;4500 ADSR *adsr;
4503 BiQuad *filter;4501 BiQuad *filter;
4504 Noise *noise;4502 Noise *noise;
@@ -4529,7 +4527,7 @@ class Resonate : public Instrmnt · 24 unmodified lines
4529 2->1--/4527 2->1--/
4530 \endcode4528 \endcode
4531 4529
4532 Control Change Numbers: 4530 Control Change Numbers:
4533 - Modulator Index One = 24531 - Modulator Index One = 2
4534 - Crossfade of Outputs = 44532 - Crossfade of Outputs = 4
4535 - LFO Speed = 114533 - LFO Speed = 11
@@ -4564,7 +4562,7 @@ class Rhodey : public FM · 28 unmodified lines
4564 4562
4565 //! Start a note with the given frequency and amplitude.4563 //! Start a note with the given frequency and amplitude.
4566 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);4564 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
4567 void noteOn(MY_FLOAT amplitude) { noteOn(baseFrequency * 0.5, amplitude ); } 4565 void noteOn(MY_FLOAT amplitude) { noteOn(baseFrequency * 0.5, amplitude ); }
4568 4566
4569 //! Compute one output sample.4567 //! Compute one output sample.
4570 MY_FLOAT tick();4568 MY_FLOAT tick();
@@ -4729,7 +4727,7 @@ static const double Midi2Pitch[129] = { · 158 unmodified lines
4729 use possibly subject to patents held by Stanford4727 use possibly subject to patents held by Stanford
4730 University, Yamaha, and others.4728 University, Yamaha, and others.
4731 4729
4732 Control Change Numbers: 4730 Control Change Numbers:
4733 - Reed Stiffness = 24731 - Reed Stiffness = 2
4734 - Reed Aperture = 264732 - Reed Aperture = 26
4735 - Noise Gain = 44733 - Noise Gain = 4
@@ -4829,7 +4827,7 @@ class Saxofony : public Instrmnt · 93 unmodified lines
4829 breaking sticks, crunchy snow (or not), a4827 breaking sticks, crunchy snow (or not), a
4830 wrench, sandpaper, and more.4828 wrench, sandpaper, and more.
4831 4829
4832 Control Change Numbers: 4830 Control Change Numbers:
4833 - Shake Energy = 24831 - Shake Energy = 2
4834 - System Decay = 44832 - System Decay = 4
4835 - Number Of Objects = 114833 - Number Of Objects = 11
@@ -4885,7 +4883,7 @@ class Shakers : public Instrmnt · 49 unmodified lines
4885 Use the instrument numbers above, converted to frequency values4883 Use the instrument numbers above, converted to frequency values
4886 as if MIDI note numbers, to select a particular instrument.4884 as if MIDI note numbers, to select a particular instrument.
4887 */4885 */
4888 virtual void ck_noteOn(MY_FLOAT amplitude ); // chuck single arg call 4886 virtual void ck_noteOn(MY_FLOAT amplitude ); // chuck single arg call
4889 virtual void noteOn(MY_FLOAT instrument, MY_FLOAT amplitude);4887 virtual void noteOn(MY_FLOAT instrument, MY_FLOAT amplitude);
4890 4888
4891 //! Stop a note with the given amplitude (speed of decay).4889 //! Stop a note with the given amplitude (speed of decay).
@@ -4957,7 +4955,7 @@ class Shakers : public Instrmnt · 65 unmodified lines
4957 a one-pole filter, and an ADSR envelope4955 a one-pole filter, and an ADSR envelope
4958 to create some interesting sounds.4956 to create some interesting sounds.
4959 4957
4960 Control Change Numbers: 4958 Control Change Numbers:
4961 - Filter Pole Position = 24959 - Filter Pole Position = 2
4962 - Noise/Pitched Cross-Fade = 44960 - Noise/Pitched Cross-Fade = 4
4963 - Envelope Rate = 114961 - Envelope Rate = 11
@@ -5004,8 +5002,8 @@ class Simple : public Instrmnt · 40 unmodified lines
5004 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).5002 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
5005 virtual void controlChange(int number, MY_FLOAT value);5003 virtual void controlChange(int number, MY_FLOAT value);
5006 5004
5007 public: // SWAP formerly protected 5005 public: // SWAP formerly protected
5008 ADSR *adsr; 5006 ADSR *adsr;
5009 WaveLoop *loop;5007 WaveLoop *loop;
5010 OnePole *filter;5008 OnePole *filter;
5011 BiQuad *biquad;5009 BiQuad *biquad;
@@ -5162,7 +5160,7 @@ class Sitar : public Instrmnt · 150 unmodified lines
5162 //! Compute one output sample.5160 //! Compute one output sample.
5163 MY_FLOAT tick();5161 MY_FLOAT tick();
5164 5162
5165 public: // SWAP formerly protected 5163 public: // SWAP formerly protected
5166 DelayA *delayLine;5164 DelayA *delayLine;
5167 OneZero *loopFilter;5165 OneZero *loopFilter;
5168 Noise *noise;5166 Noise *noise;
@@ -5195,7 +5193,7 @@ class Sitar : public Instrmnt · 26 unmodified lines
5195 The user is responsible for checking the values5193 The user is responsible for checking the values
5196 returned by the read/write methods. Values5194 returned by the read/write methods. Values
5197 less than or equal to zero indicate a closed5195 less than or equal to zero indicate a closed
5198 or lost connection or the occurence of an error.5196 or lost connection or the occurrence of an error.
5199 5197
5200 by Perry R. Cook and Gary P. Scavone, 1995 - 2002.5198 by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
5201*/5199*/
@@ -5275,7 +5273,7 @@ class Socket : public Stk · 73 unmodified lines
5275 5273
5276 public: // SWAP formerly protected5274 public: // SWAP formerly protected
5277 5275
5278 char msg[256];5276 char msg[STK_MSG_BUF_LENGTH];
5279 int soket;5277 int soket;
5280 int poort;5278 int poort;
5281 bool server;5279 bool server;
@@ -5403,7 +5401,7 @@ public: · 121 unmodified lines
5403 5401
5404 //! Move the sphere for the given time increment.5402 //! Move the sphere for the given time increment.
5405 void tick(double timeIncrement);5403 void tick(double timeIncrement);
5406 5404
5407public: // SWAP formerly private5405public: // SWAP formerly private
5408 Vector3D *myPosition;5406 Vector3D *myPosition;
5409 Vector3D *myVelocity;5407 Vector3D *myVelocity;
@@ -5558,7 +5556,7 @@ public: · 148 unmodified lines
5558 //! Take \e vectorSize index positions and return the corresponding table values in \e vector.5556 //! Take \e vectorSize index positions and return the corresponding table values in \e vector.
5559 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);5557 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
5560 5558
5561public: // SWAP formerly protected 5559public: // SWAP formerly protected
5562 long length;5560 long length;
5563 MY_FLOAT *data;5561 MY_FLOAT *data;
5564 MY_FLOAT lastOutput;5562 MY_FLOAT lastOutput;
@@ -5635,7 +5633,7 @@ class WvOut : public Stk · 70 unmodified lines
5635 int fflush(FILE *stream);5633 int fflush(FILE *stream);
5636 int fclose(FILE *stream);5634 int fclose(FILE *stream);
5637 size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);5635 size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
5638 5636
5639 //! Default constructor.5637 //! Default constructor.
5640 WvOut();5638 WvOut();
5641 5639
@@ -5716,7 +5714,7 @@ class WvOut : public Stk · 74 unmodified lines
5716 // Close MAT-file, updating the header.5714 // Close MAT-file, updating the header.
5717 void closeMatFile( void );5715 void closeMatFile( void );
5718 5716
5719 char msg[256];5717 char msg[STK_MSG_BUF_LENGTH];
5720 FILE *fd;5718 FILE *fd;
5721 MY_FLOAT *data;5719 MY_FLOAT *data;
5722 FILE_TYPE fileType;5720 FILE_TYPE fileType;
@@ -5732,7 +5730,7 @@ class WvOut : public Stk · 9 unmodified lines
5732 Chuck_String autoPrefix;5730 Chuck_String autoPrefix;
5733 t_CKUINT flush;5731 t_CKUINT flush;
5734 t_CKFLOAT fileGain;5732 t_CKFLOAT fileGain;
5735 5733
5736 // spencer: for data asynch write5734 // spencer: for data asynch write
5737 t_CKBOOL asyncIO;5735 t_CKBOOL asyncIO;
5738 XWriteThread * asyncWriteThread;5736 XWriteThread * asyncWriteThread;
@@ -5759,7 +5757,7 @@ class WvOut : public Stk · 20 unmodified lines
5759 2->1--/5757 2->1--/
5760 \endcode5758 \endcode
5761 5759
5762 Control Change Numbers: 5760 Control Change Numbers:
5763 - Modulator Index One = 25761 - Modulator Index One = 2
5764 - Crossfade of Outputs = 45762 - Crossfade of Outputs = 4
5765 - LFO Speed = 115763 - LFO Speed = 11
@@ -5862,9 +5860,9 @@ class TwoPole : public FilterStk // formerly protected Filter · 96 unmodified lines
5862 MY_FLOAT m_resFreq;5860 MY_FLOAT m_resFreq;
5863 MY_FLOAT m_resRad;5861 MY_FLOAT m_resRad;
5864 5862
5865 void ck_setResNorm( bool n ) { m_resNorm = n; setResonance(m_resFreq, m_resRad, m_resNorm); } 5863 void ck_setResNorm( bool n ) { m_resNorm = n; setResonance(m_resFreq, m_resRad, m_resNorm); }
5866 void ck_setResFreq( MY_FLOAT n ) { m_resFreq = n; setResonance(m_resFreq, m_resRad, m_resNorm); } 5864 void ck_setResFreq( MY_FLOAT n ) { m_resFreq = n; setResonance(m_resFreq, m_resRad, m_resNorm); }
5867 void ck_setResRad( MY_FLOAT n ) { m_resRad = n; setResonance(m_resFreq, m_resRad, m_resNorm); } 5865 void ck_setResRad( MY_FLOAT n ) { m_resRad = n; setResonance(m_resFreq, m_resRad, m_resNorm); }
5868 //! Set the filter gain.5866 //! Set the filter gain.
5869 /*!5867 /*!
5870 The gain is applied at the filter input and does not affect the5868 The gain is applied at the filter input and does not affect the
@@ -5906,7 +5904,7 @@ class TwoPole : public FilterStk // formerly protected Filter · 35 unmodified lines
5906 cascade synthesis is the most natural so5904 cascade synthesis is the most natural so
5907 that's what you'll find here.5905 that's what you'll find here.
5908 5906
5909 Control Change Numbers: 5907 Control Change Numbers:
5910 - Voiced/Unvoiced Mix = 25908 - Voiced/Unvoiced Mix = 2
5911 - Vowel/Phoneme Selection = 45909 - Vowel/Phoneme Selection = 4
5912 - Vibrato Frequency = 115910 - Vibrato Frequency = 11
@@ -6143,7 +6141,7 @@ public: // SWAP formerly protected · 230 unmodified lines
6143 This class implements a hybrid physical/spectral6141 This class implements a hybrid physical/spectral
6144 model of a police whistle (a la Cook).6142 model of a police whistle (a la Cook).
6145 6143
6146 Control Change Numbers: 6144 Control Change Numbers:
6147 - Noise Gain = 46145 - Noise Gain = 4
6148 - Fipple Modulation Frequency = 116146 - Fipple Modulation Frequency = 11
6149 - Fipple Modulation Gain = 16147 - Fipple Modulation Gain = 1
@@ -6191,7 +6189,7 @@ public: · 41 unmodified lines
6191 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).6189 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
6192 void controlChange(int number, MY_FLOAT value);6190 void controlChange(int number, MY_FLOAT value);
6193 6191
6194public: // SWAP formerly protected 6192public: // SWAP formerly protected
6195 Vector3D *tempVectorP;6193 Vector3D *tempVectorP;
6196 Vector3D *tempVector;6194 Vector3D *tempVector;
6197 OnePole onepole;6195 OnePole onepole;
@@ -6233,7 +6231,7 @@ public: // SWAP formerly protected · 35 unmodified lines
6233 2->1--/6231 2->1--/
6234 \endcode6232 \endcode
6235 6233
6236 Control Change Numbers: 6234 Control Change Numbers:
6237 - Modulator Index One = 26235 - Modulator Index One = 2
6238 - Crossfade of Outputs = 46236 - Crossfade of Outputs = 4
6239 - LFO Speed = 116237 - LFO Speed = 11
@@ -6269,7 +6267,7 @@ class Wurley : public FM · 29 unmodified lines
6269 //! Start a note with the given frequency and amplitude.6267 //! Start a note with the given frequency and amplitude.
6270 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);6268 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
6271 void noteOn(MY_FLOAT amplitude) { noteOn ( baseFrequency, amplitude ); }6269 void noteOn(MY_FLOAT amplitude) { noteOn ( baseFrequency, amplitude ); }
6272 6270
6273 // CHUCK HACK:6271 // CHUCK HACK:
6274 virtual void controlChange( int which, MY_FLOAT value );6272 virtual void controlChange( int which, MY_FLOAT value );
6275 6273
@@ -6432,7 +6430,7 @@ class BlitSaw : public BLT · 156 unmodified lines
6432 Set the phase of the signal, in the range 0 to 1.6430 Set the phase of the signal, in the range 0 to 1.
6433 */6431 */
6434 virtual void setPhase( MY_FLOAT phase ) { phase_ = ONE_PI * phase; }6432 virtual void setPhase( MY_FLOAT phase ) { phase_ = ONE_PI * phase; }
6435 6433
6436 //! Set the sawtooth oscillator rate in terms of a frequency in Hz.6434 //! Set the sawtooth oscillator rate in terms of a frequency in Hz.
6437 virtual void setFrequency( MY_FLOAT frequency );6435 virtual void setFrequency( MY_FLOAT frequency );
6438 6436
@@ -6580,11 +6578,11 @@ class BlitSquare : public BLT · 141 unmodified lines
6580#include <sstream>6578#include <sstream>
6581 6579
6582namespace stk {6580namespace stk {
6583 6581
6584/**********************************************************************/6582/**********************************************************************/
6585/*! \class MidiFileIn6583/*! \class MidiFileIn
6586 \brief A standard MIDI file reading/parsing class.6584 \brief A standard MIDI file reading/parsing class.
6587 6585
6588 This class can be used to read events from a standard MIDI file.6586 This class can be used to read events from a standard MIDI file.
6589 Event bytes are copied to a C++ vector and must be subsequently6587 Event bytes are copied to a C++ vector and must be subsequently
6590 interpreted by the user. The function getNextMidiEvent() skips6588 interpreted by the user. The function getNextMidiEvent() skips
@@ -6593,7 +6591,7 @@ namespace stk { · 2 unmodified lines
6593 function is provided to determine the current "seconds per tick".6591 function is provided to determine the current "seconds per tick".
6594 Tempo changes are internally tracked by the class and reflected in6592 Tempo changes are internally tracked by the class and reflected in
6595 the values returned by the function getTickSeconds().6593 the values returned by the function getTickSeconds().
6596 6594
6597 by Gary P. Scavone, 2003 - 2010.6595 by Gary P. Scavone, 2003 - 2010.
6598 */6596 */
6599/**********************************************************************/6597/**********************************************************************/
@@ -6607,16 +6605,16 @@ public: · 7 unmodified lines
6607 StkError exception will be thrown.6605 StkError exception will be thrown.
6608 */6606 */
6609 MidiFileIn( std::string fileName );6607 MidiFileIn( std::string fileName );
6610 6608
6611 //! Class destructor.6609 //! Class destructor.
6612 ~MidiFileIn();6610 ~MidiFileIn();
6613 6611
6614 //! Return the MIDI file format (0, 1, or 2).6612 //! Return the MIDI file format (0, 1, or 2).
6615 int getFileFormat() const;6613 int getFileFormat() const;
6616 6614
6617 //! Return the number of tracks in the MIDI file.6615 //! Return the number of tracks in the MIDI file.
6618 unsigned int getNumberOfTracks() const;6616 unsigned int getNumberOfTracks() const;
6619 6617
6620 //! Return the MIDI file division value from the file header.6618 //! Return the MIDI file division value from the file header.
6621 /*!6619 /*!
6622 Note that this value must be "parsed" in accordance with the6620 Note that this value must be "parsed" in accordance with the
@@ -6624,14 +6622,14 @@ public: · 1 unmodified line
6624 file uses time-code representations for delta-time values.6622 file uses time-code representations for delta-time values.
6625 */6623 */
6626 int getDivision() const;6624 int getDivision() const;
6627 6625
6628 //! Move the specified track event reader to the beginning of its track.6626 //! Move the specified track event reader to the beginning of its track.
6629 /*!6627 /*!
6630 The relevant track tempo value is reset as well. If an invalid6628 The relevant track tempo value is reset as well. If an invalid
6631 track number is specified, an StkError exception will be thrown.6629 track number is specified, an StkError exception will be thrown.
6632 */6630 */
6633 void rewindTrack( unsigned int track = 0 );6631 void rewindTrack( unsigned int track = 0 );
6634 6632
6635 //! Get the current value, in seconds, of delta-time ticks for the specified track.6633 //! Get the current value, in seconds, of delta-time ticks for the specified track.
6636 /*!6634 /*!
6637 This value can change as events are read (via "Set Tempo"6635 This value can change as events are read (via "Set Tempo"
@@ -6641,7 +6639,7 @@ public: · 3 unmodified lines
6641 thrown.6639 thrown.
6642 */6640 */
6643 double getTickSeconds( unsigned int track = 0 );6641 double getTickSeconds( unsigned int track = 0 );
6644 6642
6645 //! Fill the user-provided vector with the next event in the specified track and return the event delta-time in ticks.6643 //! Fill the user-provided vector with the next event in the specified track and return the event delta-time in ticks.
6646 /*!6644 /*!
6647 MIDI File events consist of a delta time and a sequence of event6645 MIDI File events consist of a delta time and a sequence of event
@@ -6656,7 +6654,7 @@ public: · 8 unmodified lines
6656 file, an StkError exception will be thrown.6654 file, an StkError exception will be thrown.
6657 */6655 */
6658 unsigned long getNextEvent( std::vector<unsigned char> *event, unsigned int track = 0 );6656 unsigned long getNextEvent( std::vector<unsigned char> *event, unsigned int track = 0 );
6659 6657
6660 //! Fill the user-provided vector with the next MIDI channel event in the specified track and return the event delta time in ticks.6658 //! Fill the user-provided vector with the next MIDI channel event in the specified track and return the event delta time in ticks.
6661 /*!6659 /*!
6662 All returned MIDI events are complete ... a status byte is6660 All returned MIDI events are complete ... a status byte is
@@ -6669,23 +6667,23 @@ public: · 6 unmodified lines
6669 StkError exception will be thrown.6667 StkError exception will be thrown.
6670 */6668 */
6671 unsigned long getNextMidiEvent( std::vector<unsigned char> *midiEvent, unsigned int track = 0 );6669 unsigned long getNextMidiEvent( std::vector<unsigned char> *midiEvent, unsigned int track = 0 );
6672 6670
6673 //! ge: get the current BPM (I think)6671 //! ge: get the current BPM (I think)
6674 /*!6672 /*!
6675 This value can change as events are read... hmm pretty much6673 This value can change as events are read... hmm pretty much
6676 what it says above for getTickSeconds()6674 what it says above for getTickSeconds()
6677 */6675 */
6678 double getBPM();6676 double getBPM();
6679 6677
6680protected:6678protected:
6681 6679
6682 // This protected class function is used for reading variable-length6680 // This protected class function is used for reading variable-length
6683 // MIDI file values. It is assumed that this function is called with6681 // MIDI file values. It is assumed that this function is called with
6684 // the file read pointer positioned at the start of a6682 // the file read pointer positioned at the start of a
6685 // variable-length value. The function returns true if the value is6683 // variable-length value. The function returns true if the value is
6686 // successfully parsed. Otherwise, it returns false.6684 // successfully parsed. Otherwise, it returns false.
6687 bool readVariableLength( unsigned long *value );6685 bool readVariableLength( unsigned long *value );
6688 6686
6689 std::ifstream file_;6687 std::ifstream file_;
6690 unsigned int nTracks_;6688 unsigned int nTracks_;
6691 int format_;6689 int format_;
@@ -6698,11 +6696,11 @@ protected: · 6 unmodified lines
6698 std::vector<char> trackStatus_;6696 std::vector<char> trackStatus_;
6699 // ge:6697 // ge:
6700 double bpm_;6698 double bpm_;
6701 6699
6702 // This structure and the following variables are used to save and6700 // This structure and the following variables are used to save and
6703 // keep track of a format 1 tempo map (and the initial tickSeconds6701 // keep track of a format 1 tempo map (and the initial tickSeconds
6704 // parameter for formats 0 and 2).6702 // parameter for formats 0 and 2).
6705 struct TempoChange { 6703 struct TempoChange {
6706 unsigned long count;6704 unsigned long count;
6707 double tickSeconds;6705 double tickSeconds;
6708 };6706 };
@@ -6710,7 +6708,7 @@ protected: · 1 unmodified line
6710 std::vector<unsigned long> trackCounters_;6708 std::vector<unsigned long> trackCounters_;
6711 std::vector<unsigned int> trackTempoIndex_;6709 std::vector<unsigned int> trackTempoIndex_;
6712};6710};
6713 6711
6714} // stk namespace6712} // stk namespace
6715 6713
6716#endif6714#endif
@@ -6767,7 +6765,7 @@ protected: · 50 unmodified lines
6767#define __SK_Pan_ 106765#define __SK_Pan_ 10
6768#define __SK_Sustain_ 646766#define __SK_Sustain_ 64
6769#define __SK_Damper_ __SK_Sustain_6767#define __SK_Damper_ __SK_Sustain_
6770#define __SK_Expression_ 11 6768#define __SK_Expression_ 11
6771 6769
6772#define __SK_AfterTouch_Cont_ 1286770#define __SK_AfterTouch_Cont_ 128
6773#define __SK_ModFrequency_ __SK_Expression_6771#define __SK_ModFrequency_ __SK_Expression_
@@ -6812,7 +6810,7 @@ protected: · 38 unmodified lines
6812#define __SK_FilterFreq_ 10626810#define __SK_FilterFreq_ 1062
6813#define __SK_FilterSweepRate_ __SK_FootControl_6811#define __SK_FilterSweepRate_ __SK_FootControl_
6814 6812
6815#define __SK_ShakerInst_ 1071 6813#define __SK_ShakerInst_ 1071
6816#define __SK_ShakerEnergy_ __SK_Breath_6814#define __SK_ShakerEnergy_ __SK_Breath_
6817#define __SK_ShakerDamping_ __SK_ModFrequency_6815#define __SK_ShakerDamping_ __SK_ModFrequency_
6818#define __SK_ShakerNumObjects_ __SK_FootControl_6816#define __SK_ShakerNumObjects_ __SK_FootControl_
chuginate/template/chuck/include/ulib_ai.h+377−0
@@ -0,0 +1,377 @@
1/*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine
4
5 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.stanford.edu/
7 http://chuck.cs.princeton.edu/
8
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.
13
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.
18
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-----------------------------------------------------------------------------*/
24
25//-----------------------------------------------------------------------------
26// file: ulib_ai.h
27// desc: Music and AI class library; part of ChAI (ChucK for AI)
28//
29// date: Fall 2022 -- present
30// authors: Ge Wang (ge@ccrma.stanford.edu)
31// Yikai Li (yikaili@stanford.edu)
32//
33// (HISTORICAL NOTE)
34// Much of ChAI and its ways of thinking and doing can be foundationally
35// attributed to the work of Dr. Rebecca Fiebrink, her landmark Ph.D. Thesis,
36// /Real-time Human Interaction With Supervised Learning Algorithms for Music
37// Composition and Performance/ (2011) [1], the Wekinator framework [2], her
38// teaching at the intersections of AI, HCI, and Music [3], as well as earlier
39// collaborations between Rebecca and Ge [4,5] including SMIRK [6] (Small Musical
40// Information Retrieval toolKit; 2008; MARSYAS and the MIR work of Dr. George
41// Tzanetakis; early efforts in on-the-fly learning), the unit analyzer
42// framework [7] (2007; afford real-time audio feature extraction). All of
43// these have directly or indirectly contributed the creation of ChAI.
44// Additionally, ChAI benefitted from the teaching and design philosophy of
45// Dr. Perry R. Cook (Ph.D. advisor to Rebecca, George, and Ge at Princeton,
46// and ChucK co-author), who argued for real-time human interaction, parametric
47// sound synthesis, and the importance of play in the design of musical tools.
48//
49// [1] Fiebrink, Rebecca. 2011. /Real-time Human Interaction With Supervised
50// Learning Algorithms for Music Composition and Performance/ Ph.D. Thesis.
51// Princeton University. https://www.cs.princeton.edu/techreports/2010/891.pdf
52//
53// [2] http://www.wekinator.org/
54// Wekinator | Software for real-time, interactive machine learning
55//
56// [3] Fiebrink, Rebecca. "Machine Learning for Musicians and Artists" MOOC
57// https://www.kadenze.com/courses/machine-learning-for-musicians-and-artists/info
58//
59// [4] Fiebrink, R., G. Wang, P. R. Cook. 2008. "Foundations for On-the-fly
60// Learning in the ChucK Programming Language." /International Computer Music
61// Conference/. https://mcd.stanford.edu/publish/files/2008-icmc-learning.pdf
62//
63// [5] Fiebrink, R., G. Wang, P. R. Cook. 2008. "Support for Music Information
64// Retrieval in the ChucK Programming Language." /International Conference
65// on Music Information Retrieval/ (ISMIR).
66// https://mcd.stanford.edu/publish/files/2008-ismir-proto.pdf
67//
68// [6] http://smirk.cs.princeton.edu/
69// sMIRk | Small Music Information Retrieval toolKit
70//
71// [7] Tzanetakis, G. and P. R. Cook. 2000 "MARSYAS: A Framework for Audio
72// Analysis." Organised Sound. 4:(3)
73//
74// [8] Tzanetakis, G. and P. R. Cook. 2002 "Musical Genre Classification of
75// Audio Signals." IEEE Transaction on Speech and Audio Processing. 10(5).
76//
77// [9] Wang, G., R. Fiebrink, P. R. Cook. 2007. "Combining Analysis and
78// Synthesis in the ChucK Programming Language." /International Computer
79// Music Conference/. https://mcd.stanford.edu/publish/files/2007-icmc-uana.pdf
80//-----------------------------------------------------------------------------
81#ifndef __ULIB_AI_H__
82#define __ULIB_AI_H__
83
84#include "chuck_dl.h"
85#include "chuck_errmsg.h"
86#include "util_math.h"
87
88
89
90
91// query
92DLL_QUERY libai_query( Chuck_DL_Query * QUERY );
93
94//-----------------------------------------------------------------------------
95// name: class ChaiMatrixFast | 1.4.2.0 (ge) added
96// desc: a templated fast access but not bound-checked 2D matrix
97// allows arbitrary 2D arrays of arbitrary and non-constant dimensions
98// to be allocated locally, e.g., int matrix[xDim][yDim] -- which is not
99// valid syntax with some compilers.
100//-----------------------------------------------------------------------------
101template<class T>
102class ChaiMatrixFast
103{
104public:
105 ChaiMatrixFast()
106 {
107 // zero out
108 m_matrix = NULL;
109 // zero out
110 m_xDim = m_yDim = 0;
111 }
112
113 ChaiMatrixFast( t_CKINT xDim, t_CKINT yDim )
114 {
115 // zero out
116 m_matrix = NULL;
117 // allocate
118 allocate( xDim, yDim );
119 }
120
121 ~ChaiMatrixFast()
122 {
123 // deallocate
124 cleanup();
125 }
126
127 t_CKBOOL allocate( t_CKINT xDim, t_CKINT yDim )
128 {
129 // delete if necessary
130 if( m_matrix != NULL ) cleanup();
131
132 // allocate
133 m_matrix = new T[xDim * yDim];
134 // check
135 if( !m_matrix )
136 {
137 // error
138 CK_FPRINTF_STDERR( "[chuck]: ChaiMatrixFast allocation failure: %s, %d x %d...\n",
139 typeid( T ).name(), xDim, yDim );
140 // bail
141 return FALSE;
142 }
143 // remember
144 m_xDim = xDim;
145 m_yDim = yDim;
146
147 // done
148 return TRUE;
149 }
150
151 // get element value
152 T & v( t_CKINT x, t_CKINT y )
153 {
154 // at least do a check
155 if( x < 0 || x >= m_xDim || y < 0 || y >= m_yDim )
156 {
157 // error
158 CK_FPRINTF_STDERR( "[chuck]: ChaiMatrixFast out of bound: %s[%d][%d]...\n",
159 typeid( T ).name(), x, y );
160 // halt
161 // TODO: this should throw (a shred-level, probably) exception
162 assert( FALSE );
163 }
164
165 return m_matrix[x * m_yDim + y];
166 }
167
168 // overloaded operator
169 T & operator()( t_CKINT x, t_CKINT y )
170 {
171 return v( x, y );
172 }
173
174 // get dimensions
175 t_CKINT xDim() const
176 { return m_xDim; }
177 t_CKINT yDim() const
178 { return m_yDim; }
179
180 void cleanup()
181 {
182 // reclaim array memory and zero the pointer
183 SAFE_DELETE_ARRAY( m_matrix );
184 // zero out
185 m_xDim = m_yDim = 0;
186 }
187
188protected:
189 T * m_matrix;
190 t_CKINT m_xDim;
191 t_CKINT m_yDim;
192};
193
194//-----------------------------------------------------------------------------
195// name: class ChaiVectorFast | 1.4.2.0 (ge) added
196// desc: a templated fast access but not bound-checked 1D array
197// allows arbitrary arrays of arbitrary and non-constant dimension
198// to be allocated locally, e.g., int array[dim] -- which is not
199// valid syntax with some compilers.
200//-----------------------------------------------------------------------------
201template<class T>
202class ChaiVectorFast
203{
204public:
205 ChaiVectorFast()
206 {
207 // zero out
208 m_vector = NULL;
209 // zero out
210 m_length = 0;
211 }
212
213 ChaiVectorFast( t_CKINT length )
214 {
215 // zero out
216 m_vector = NULL;
217 // allocate
218 allocate( length );
219 }
220
221 ~ChaiVectorFast()
222 {
223 // deallocate
224 cleanup();
225 }
226
227 t_CKBOOL allocate( t_CKINT length )
228 {
229 // delete if necessary
230 if( m_vector != NULL ) cleanup();
231
232 // allocate
233 m_vector = new T[length];
234 // check
235 if( !m_vector )
236 {
237 // error
238 CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast allocation failure: %s[%d]...\n",
239 typeid( T ).name(), length );
240 // bail
241 return FALSE;
242 }
243 // remember
244 m_length = length;
245
246 // done
247 return TRUE;
248 }
249
250 void shuffle()
251 {
252 T temp;
253 t_CKINT j;
254 for( t_CKINT i = m_length - 1; i > 0; i-- )
255 {
256 j = ck_random() % ( i + 1 );
257 temp = m_vector[i];
258 m_vector[i] = m_vector[j];
259 m_vector[j] = temp;
260 }
261 }
262
263 t_CKUINT length()
264 { return m_length; }
265
266 t_CKINT size()
267 { return m_length; }
268
269 T getMax()
270 {
271 T max = m_vector[0];
272 for( t_CKINT i = 1; i < m_length; i++ )
273 {
274 if( m_vector[i] > max )
275 {
276 max = m_vector[i];
277 }
278 }
279 return max;
280 }
281
282 void setAll( T value )
283 {
284 // iterate
285 for( t_CKINT i = 0; i < m_length; i++ )
286 {
287 // set to value
288 m_vector[i] = value;
289 }
290 }
291
292 T & operator[]( t_CKINT i )
293 {
294 // at least do a check
295 if( i < 0 || i >= m_length )
296 {
297 // error
298 CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast out of bound: %s[%d] (capacity=%d)...\n",
299 typeid( T ).name(), i, m_length );
300 // TODO: this should throw (a shred-level, probably) exception
301 assert( FALSE );
302 }
303
304 return m_vector[i];
305 }
306
307 // get element value
308 T & v( t_CKINT i )
309 {
310 return ( *this )[i];
311 }
312
313 void cleanup()
314 {
315 // reclaim array memory and zero the pointer
316 SAFE_DELETE_ARRAY( m_vector );
317 // zero out
318 m_length = 0;
319 }
320
321public:
322 T * m_vector;
323 t_CKINT m_length;
324};
325
326#endif
327
328#ifndef _KD_TREE_H
329#define _KD_TREE_H
330
331#include <float.h>
332// #define DBL_EPSILON 2.2204460492503131e-16
333
334#define KDTREE_MAX_LEVEL 64
335#define KDTREE_LEFT_INDEX 0
336#define KDTREE_RIGHT_INDEX 1
337
338typedef struct knn_list
339{
340 struct kdnode * node;
341 double distance;
342 struct knn_list * prev;
343 struct knn_list * next;
344} knn_list_t;
345
346typedef struct kdnode
347{
348 long coord_index;
349 double * coord;
350 struct kdnode * left;
351 struct kdnode * right;
352 t_CKINT r;
353} kdnode_t;
354
355typedef struct kdtree
356{
357 struct kdnode * root;
358 size_t count;
359 size_t capacity;
360 double * coords;
361 double ** coord_table;
362 long * coord_indexes;
363 unsigned char * coord_deleted;
364 unsigned char * coord_passed;
365 struct knn_list knn_list_head;
366 t_CKINT dim;
367 t_CKINT knn_num;
368} kdtree_t;
369
370struct kdtree * kdtree_init( t_CKINT dim );
371void kdtree_insert( struct kdtree * tree, double * coord );
372void kdtree_rebuild( struct kdtree * tree );
373void kdtree_knn_search( struct kdtree * tree, double * coord, t_CKINT k );
374void kdtree_destroy( struct kdtree * tree );
375void kdtree_dump( struct kdtree * tree );
376
377#endif /* _KD_TREE_H */
chuginate/template/chuck/include/ulib_machine.h+9−10
@@ -42,22 +42,21 @@ struct Chuck_Compiler; · 41 unmodified lines
42 42
43// query43// query
44DLL_QUERY machine_query( Chuck_DL_Query * QUERY );44DLL_QUERY machine_query( Chuck_DL_Query * QUERY );
45typedef t_CKUINT (* proc_msg_func)( Chuck_VM *, Chuck_Compiler *, 45
46#ifndef __DISABLE_OTF_SERVER__
47typedef t_CKUINT (* proc_msg_func)( Chuck_VM *, Chuck_Compiler *,
46 Net_Msg *, t_CKBOOL, void * );48 Net_Msg *, t_CKBOOL, void * );
47t_CKBOOL machine_init( Chuck_Compiler * compiler, proc_msg_func func );49t_CKBOOL machine_init( Chuck_Compiler * compiler, proc_msg_func func );
48// 1.4.0.1: TODO: refactor out of ulib machine; not all platforms have OTF50// 1.4.0.1: TODO: refactor out of ulib machine; not all platforms have OTF
51#endif // __DISABLE_OTF_SERVER__
52
53// machine exports
49t_CKUINT machine_intsize();54t_CKUINT machine_intsize();
50 55
51 56
52// exports57// ckdoc query
53CK_DLL_SFUN( machine_crash_impl );58DLL_QUERY ckdoc_query( Chuck_DL_Query * QUERY );
54CK_DLL_SFUN( machine_add_impl );59
55CK_DLL_SFUN( machine_spork_impl );
56CK_DLL_SFUN( machine_remove_impl );
57CK_DLL_SFUN( machine_replace_impl );
58CK_DLL_SFUN( machine_status_impl );
59CK_DLL_SFUN( machine_intsize_impl );
60CK_DLL_SFUN( machine_shreds_impl );
61 60
62 61
63#endif62#endif
chuginate/template/chuck/include/ulib_math.h+12−6
@@ -68,6 +68,7 @@ CK_DLL_SFUN( min_impl ); · 67 unmodified lines
68CK_DLL_SFUN( max_impl );68CK_DLL_SFUN( max_impl );
69CK_DLL_SFUN( isinf_impl );69CK_DLL_SFUN( isinf_impl );
70CK_DLL_SFUN( isnan_impl );70CK_DLL_SFUN( isnan_impl );
71CK_DLL_SFUN( equal_impl );
71CK_DLL_SFUN( floatMax_impl );72CK_DLL_SFUN( floatMax_impl );
72CK_DLL_SFUN( intMax_impl );73CK_DLL_SFUN( intMax_impl );
73 74
@@ -89,12 +90,17 @@ CK_DLL_SFUN( srandom_impl ); · 15 unmodified lines
89 90
90CK_DLL_SFUN( gauss_impl );91CK_DLL_SFUN( gauss_impl );
91 92
92// max for random functions93CK_DLL_SFUN( cossim_impl );
93#ifdef __WINDOWS_DS__94CK_DLL_SFUN( cossim3d_impl );
94#define CK_RANDOM_MAX RAND_MAX95CK_DLL_SFUN( cossim4d_impl );
95#else96
96#define CK_RANDOM_MAX 0x7fffffff97CK_DLL_SFUN( euclidean_impl );
97#endif98CK_DLL_SFUN( euclidean3d_impl );
99CK_DLL_SFUN( euclidean4d_impl );
100
101CK_DLL_SFUN( map_impl );
102CK_DLL_SFUN( map2_impl );
103
98 104
99 105
100 106
chuginate/template/chuck/include/ulib_regex.h+4−4
@@ -1,21 +1,21 @@
1/*----------------------------------------------------------------------------1/*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine3 Compiler and Virtual Machine
4 4
5 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.5 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.stanford.edu/6 http://chuck.stanford.edu/
7 http://chuck.cs.princeton.edu/7 http://chuck.cs.princeton.edu/
8 8
9 This program is free software; you can redistribute it and/or modify9 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 by10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful,14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-130721 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
chuginate/template/chuck/include/util_buffers.h+54−54
@@ -43,8 +43,8 @@ · 42 unmodified lines
43#include <queue>43#include <queue>
44#include <iostream>44#include <iostream>
45 45
46#define DWORD__ unsigned long46#define DWORD__ t_CKUINT
47#define SINT__ long47#define SINT__ t_CKINT
48#define UINT__ DWORD__48#define UINT__ DWORD__
49#define BOOL__ DWORD__49#define BOOL__ DWORD__
50#define BYTE__ unsigned char50#define BYTE__ unsigned char
@@ -103,7 +103,7 @@ protected: · 52 unmodified lines
103 #ifndef __DISABLE_THREADS__103 #ifndef __DISABLE_THREADS__
104 XMutex m_mutex;104 XMutex m_mutex;
105 #endif105 #endif
106 106
107 CBufferSimple * m_event_buffer;107 CBufferSimple * m_event_buffer;
108};108};
109 109
@@ -203,7 +203,7 @@ template<typename T> · 93 unmodified lines
203class CircularBuffer203class CircularBuffer
204{204{
205public:205public:
206 206
207 CircularBuffer(size_t numElements) :207 CircularBuffer(size_t numElements) :
208 m_read(0),208 m_read(0),
209 m_write(0),209 m_write(0),
@@ -211,7 +211,7 @@ public: · 1 unmodified line
211 {211 {
212 m_elements = new T[m_numElements];212 m_elements = new T[m_numElements];
213 }213 }
214 214
215 ~CircularBuffer()215 ~CircularBuffer()
216 {216 {
217 if(m_elements != NULL)217 if(m_elements != NULL)
@@ -220,7 +220,7 @@ public: · 2 unmodified lines
220 m_elements = NULL;220 m_elements = NULL;
221 }221 }
222 }222 }
223 223
224 // put one element224 // put one element
225 // returns number of elements successfully put225 // returns number of elements successfully put
226 size_t put(T element)226 size_t put(T element)
@@ -230,14 +230,14 @@ public: · 3 unmodified lines
230 // no space230 // no space
231 return 0;231 return 0;
232 }232 }
233 233
234 m_elements[m_write] = element;234 m_elements[m_write] = element;
235 235
236 m_write = (m_write+1)%m_numElements;236 m_write = (m_write+1)%m_numElements;
237 237
238 return 1;238 return 1;
239 }239 }
240 240
241 // get one element241 // get one element
242 // returns number of elements successfully got242 // returns number of elements successfully got
243 size_t get(T &element)243 size_t get(T &element)
@@ -247,14 +247,14 @@ public: · 3 unmodified lines
247 // nothing to get247 // nothing to get
248 return 0;248 return 0;
249 }249 }
250 250
251 element = m_elements[m_read];251 element = m_elements[m_read];
252 252
253 m_read = (m_read+1)%m_numElements;253 m_read = (m_read+1)%m_numElements;
254 254
255 return 1;255 return 1;
256 }256 }
257 257
258 // peek at element i without removing it258 // peek at element i without removing it
259 // i = 1 would correspond to the least recently put element;259 // i = 1 would correspond to the least recently put element;
260 // i = -1 would correspond to the most recent (not implemented)260 // i = -1 would correspond to the most recent (not implemented)
@@ -263,24 +263,24 @@ public: · 2 unmodified lines
263 {263 {
264 if(i == 0)264 if(i == 0)
265 return 0;265 return 0;
266 266
267 if(i > 0 && i <= numElements())267 if(i > 0 && i <= numElements())
268 {268 {
269 element = m_elements[(m_read+(i-1))%m_numElements];269 element = m_elements[(m_read+(i-1))%m_numElements];
270 return 1;270 return 1;
271 }271 }
272 272
273 return 0;273 return 0;
274 }274 }
275 275
276 void clear() { m_write = m_read; }276 void clear() { m_write = m_read; }
277 277
278 // return maximum number of elements that can be held278 // return maximum number of elements that can be held
279 size_t maxElements() { return m_numElements-1; }279 size_t maxElements() { return m_numElements-1; }
280 280
281 // return if buffer is full281 // return if buffer is full
282 bool atMaximum() { return (m_write + 1)%m_numElements == m_read; }282 bool atMaximum() { return (m_write + 1)%m_numElements == m_read; }
283 283
284 // return number of valid elements in the buffer284 // return number of valid elements in the buffer
285 size_t numElements()285 size_t numElements()
286 {286 {
@@ -291,7 +291,7 @@ public: · 4 unmodified lines
291 else291 else
292 return m_numElements - m_read + m_write;292 return m_numElements - m_read + m_write;
293 }293 }
294 294
295private:295private:
296 T * m_elements;296 T * m_elements;
297 size_t m_read, m_write;297 size_t m_read, m_write;
@@ -311,17 +311,17 @@ class FastCircularBuffer · 13 unmodified lines
311public:311public:
312 FastCircularBuffer();312 FastCircularBuffer();
313 ~FastCircularBuffer();313 ~FastCircularBuffer();
314 314
315public:315public:
316 t_CKUINT initialize( t_CKUINT num_elem, t_CKUINT width );316 t_CKUINT initialize( t_CKUINT num_elem, t_CKUINT width );
317 void cleanup();317 void cleanup();
318 318
319public:319public:
320 t_CKUINT get( void * data, t_CKUINT num_elem );320 t_CKUINT get( void * data, t_CKUINT num_elem );
321 t_CKUINT put( void * data, t_CKUINT num_elem );321 t_CKUINT put( void * data, t_CKUINT num_elem );
322 inline bool hasMore() { return (m_read_offset != m_write_offset); }322 inline bool hasMore() { return (m_read_offset != m_write_offset); }
323 inline void clear() { m_read_offset = m_write_offset = 0; }323 inline void clear() { m_read_offset = m_write_offset = 0; }
324 324
325protected:325protected:
326 t_CKBYTE * m_data;326 t_CKBYTE * m_data;
327 t_CKUINT m_data_width;327 t_CKUINT m_data_width;
@@ -343,7 +343,7 @@ class XCircleBuffer · 15 unmodified lines
343public:343public:
344 XCircleBuffer( long length = 0 );344 XCircleBuffer( long length = 0 );
345 ~XCircleBuffer();345 ~XCircleBuffer();
346 346
347public:347public:
348 // reset length of buffer (capacity)348 // reset length of buffer (capacity)
349 void init( long length );349 void init( long length );
@@ -351,7 +351,7 @@ public: · 1 unmodified line
351 long length() const;351 long length() const;
352 // clear (does no explicit memory management)352 // clear (does no explicit memory management)
353 void clear();353 void clear();
354 354
355public:355public:
356 // put an element into the buffer - the item will be copied356 // put an element into the buffer - the item will be copied
357 // NOTE: if over-capacity, will discard least recently put item357 // NOTE: if over-capacity, will discard least recently put item
@@ -366,11 +366,11 @@ public: · 8 unmodified lines
366 long peek( T * array, long numItems, unsigned long stride = 0 );366 long peek( T * array, long numItems, unsigned long stride = 0 );
367 // pop367 // pop
368 long pop( long numItems = 1 );368 long pop( long numItems = 1 );
369 369
370protected: // helper functions370protected: // helper functions
371 inline void advanceWrite();371 inline void advanceWrite();
372 inline void advanceRead();372 inline void advanceRead();
373 373
374protected:374protected:
375 // the buffer375 // the buffer
376 T * m_buffer;376 T * m_buffer;
@@ -397,7 +397,7 @@ XCircleBuffer<T>::XCircleBuffer( long length ) · 20 unmodified lines
397 // zero out first397 // zero out first
398 m_buffer = NULL;398 m_buffer = NULL;
399 m_length = m_readIndex = m_writeIndex = m_numElements = 0;399 m_length = m_readIndex = m_writeIndex = m_numElements = 0;
400 400
401 // call init401 // call init
402 this->init( length );402 this->init( length );
403}403}
@@ -412,7 +412,7 @@ XCircleBuffer<T>::XCircleBuffer( long length ) · 8 unmodified lines
412template <typename T>412template <typename T>
413XCircleBuffer<T>::~XCircleBuffer()413XCircleBuffer<T>::~XCircleBuffer()
414{414{
415 415
416}416}
417 417
418 418
@@ -433,20 +433,20 @@ void XCircleBuffer<T>::init( long length ) · 14 unmodified lines
433 // zero out433 // zero out
434 m_length = m_readIndex = m_writeIndex = m_numElements = 0;434 m_length = m_readIndex = m_writeIndex = m_numElements = 0;
435 }435 }
436 436
437 // sanity check437 // sanity check
438 if( length < 0 )438 if( length < 0 )
439 {439 {
440 // doh440 // doh
441 std::cerr << "[XCircleBuffer]: error invalid length '"441 std::cerr << "[XCircleBuffer]: error invalid length '"
442 << length << "' requested" << std::endl;442 << length << "' requested" << std::endl;
443 443
444 return;444 return;
445 }445 }
446 446
447 // check for zero length447 // check for zero length
448 if( length == 0 ) return;448 if( length == 0 ) return;
449 449
450 // allocate450 // allocate
451 m_buffer = new T[length];451 m_buffer = new T[length];
452 // check452 // check
@@ -455,10 +455,10 @@ void XCircleBuffer<T>::init( long length ) · 2 unmodified lines
455 // doh455 // doh
456 std::cerr << "[XCircleBuffer]: failed to allocate buffer of length '"456 std::cerr << "[XCircleBuffer]: failed to allocate buffer of length '"
457 << length << "'..." << std::endl;457 << length << "'..." << std::endl;
458 458
459 return;459 return;
460 }460 }
461 461
462 // save462 // save
463 m_length = length;463 m_length = length;
464 // zero out464 // zero out
@@ -504,14 +504,14 @@ void XCircleBuffer<T>::advanceWrite() · 39 unmodified lines
504{504{
505 // increment505 // increment
506 m_writeIndex++;506 m_writeIndex++;
507 507
508 // check for bounds508 // check for bounds
509 if( m_writeIndex >= m_length )509 if( m_writeIndex >= m_length )
510 {510 {
511 // wrap511 // wrap
512 m_writeIndex -= m_length;512 m_writeIndex -= m_length;
513 }513 }
514 514
515 // increment count515 // increment count
516 m_numElements++;516 m_numElements++;
517}517}
@@ -528,14 +528,14 @@ void XCircleBuffer<T>::advanceRead() · 10 unmodified lines
528{528{
529 // increment529 // increment
530 m_readIndex++;530 m_readIndex++;
531 531
532 // check for bounds532 // check for bounds
533 if( m_readIndex >= m_length )533 if( m_readIndex >= m_length )
534 {534 {
535 // wrap535 // wrap
536 m_readIndex -= m_length;536 m_readIndex -= m_length;
537 }537 }
538 538
539 // decrement count539 // decrement count
540 m_numElements--;540 m_numElements--;
541}541}
@@ -553,13 +553,13 @@ void XCircleBuffer<T>::put( const T & item ) · 11 unmodified lines
553{553{
554 // sanity check554 // sanity check
555 if( m_buffer == NULL ) return;555 if( m_buffer == NULL ) return;
556 556
557 // copy it557 // copy it
558 m_buffer[m_writeIndex] = item;558 m_buffer[m_writeIndex] = item;
559 559
560 // advance write index560 // advance write index
561 advanceWrite();561 advanceWrite();
562 562
563 // if read and write pointer are the same, over-capacity563 // if read and write pointer are the same, over-capacity
564 if( m_writeIndex == m_readIndex )564 if( m_writeIndex == m_readIndex )
565 {565 {
@@ -609,19 +609,19 @@ long XCircleBuffer<T>::peek( T * array, long numItems, unsigned long stride ) · 43 unmodified lines
609{609{
610 // sanity check610 // sanity check
611 if( m_buffer == NULL ) return 0;611 if( m_buffer == NULL ) return 0;
612 612
613 // sanity check (so the wrap can be sure to land inbounds)613 // sanity check (so the wrap can be sure to land inbounds)
614 if( stride >= m_length ) return 0;614 if( stride >= m_length ) return 0;
615 615
616 // count616 // count
617 long count = 0;617 long count = 0;
618 // actual count, taking stride out of the equation618 // actual count, taking stride out of the equation
619 long actualCount = 0;619 long actualCount = 0;
620 620
621 // starting index621 // starting index
622 long index = m_writeIndex - 1;622 long index = m_writeIndex - 1;
623 if( index < 0 ) index += m_length;623 if( index < 0 ) index += m_length;
624 624
625 // while need more but haven't reached write index...625 // while need more but haven't reached write index...
626 while( (count < numItems) && (count < m_numElements) )626 while( (count < numItems) && (count < m_numElements) )
627 {627 {
@@ -636,7 +636,7 @@ long XCircleBuffer<T>::peek( T * array, long numItems, unsigned long stride ) · 8 unmodified lines
636 // wrap636 // wrap
637 if( index < 0 ) index += m_length;637 if( index < 0 ) index += m_length;
638 }638 }
639 639
640 // reverse contents640 // reverse contents
641 for( int i = 0; i < actualCount/2; i++ )641 for( int i = 0; i < actualCount/2; i++ )
642 {642 {
@@ -644,7 +644,7 @@ long XCircleBuffer<T>::peek( T * array, long numItems, unsigned long stride ) · 1 unmodified line
644 array[i] = array[actualCount-1-i];644 array[i] = array[actualCount-1-i];
645 array[actualCount-1-i] = v;645 array[actualCount-1-i] = v;
646 }646 }
647 647
648 return actualCount;648 return actualCount;
649}649}
650 650
@@ -660,10 +660,10 @@ long XCircleBuffer<T>::pop( long numItems ) · 9 unmodified lines
660{660{
661 // sanity check661 // sanity check
662 if( m_buffer == NULL ) return 0;662 if( m_buffer == NULL ) return 0;
663 663
664 // count664 // count
665 long count = 0;665 long count = 0;
666 666
667 // while there is more to pop and need to pop more667 // while there is more to pop and need to pop more
668 while( more() && count < numItems )668 while( more() && count < numItems )
669 {669 {
@@ -672,7 +672,7 @@ long XCircleBuffer<T>::pop( long numItems ) · 2 unmodified lines
672 // increment count672 // increment count
673 count++;673 count++;
674 }674 }
675 675
676 return count;676 return count;
677}677}
678 678
@@ -688,12 +688,12 @@ bool XCircleBuffer<T>::get( T * result ) · 9 unmodified lines
688{688{
689 // sanity check689 // sanity check
690 if( m_buffer == NULL || m_readIndex == m_writeIndex ) return false;690 if( m_buffer == NULL || m_readIndex == m_writeIndex ) return false;
691 691
692 // get item to read692 // get item to read
693 *result = m_buffer[m_readIndex];693 *result = m_buffer[m_readIndex];
694 // advance read694 // advance read
695 advanceRead();695 advanceRead();
696 696
697 return true;697 return true;
698}698}
699 699
chuginate/template/chuck/include/util_hid.h+4−2
@@ -32,6 +32,8 @@ · 31 unmodified lines
32#ifndef __UTIL_HID_H__32#ifndef __UTIL_HID_H__
33#define __UTIL_HID_H__33#define __UTIL_HID_H__
34 34
35#include "chuck_def.h"
36
35 37
36 38
37 39
@@ -50,7 +52,7 @@ struct HidMsg · 12 unmodified lines
50 t_CKINT idata[4]; // int data52 t_CKINT idata[4]; // int data
51#endif53#endif
52 t_CKFLOAT fdata[4]; // float data54 t_CKFLOAT fdata[4]; // float data
53 55
54#ifdef __cplusplus56#ifdef __cplusplus
55 HidMsg()57 HidMsg()
56 { this->clear(); }58 { this->clear(); }
@@ -161,7 +163,7 @@ extern const char * Mouse_name( int m ); · 104 unmodified lines
161extern int Mouse_buttons( int m );163extern int Mouse_buttons( int m );
162extern int Mouse_start_cursor_track();164extern int Mouse_start_cursor_track();
163extern int Mouse_stop_cursor_track();165extern int Mouse_stop_cursor_track();
164 166
165extern void Keyboard_init();167extern void Keyboard_init();
166extern void Keyboard_poll();168extern void Keyboard_poll();
167extern void Keyboard_quit();169extern void Keyboard_quit();
chuginate/template/chuck/include/util_math.h+23−7
@@ -34,21 +34,36 @@ · 33 unmodified lines
34#define __UTIL_MATH_H__34#define __UTIL_MATH_H__
35 35
36#include <math.h>36#include <math.h>
37#include "chuck_def.h" // 1.4.1.0 (ge) for t_CKINT
37 38
38#if defined (__cplusplus) || defined(_cplusplus) 39#if defined (__cplusplus) || defined(_cplusplus)
39extern "C" {40extern "C" {
40#endif 41#endif
41 42
43// 1.4.1.1 (ge) removed -- seems no longer needed on more modern windows
42#ifdef __PLATFORM_WIN32__44#ifdef __PLATFORM_WIN32__
43 45#ifdef __CK_MATH_DEFINE_ROUND_TRUNC__
44 double round( double a );46 double round( double a );
45 double trunc( double a );47 double trunc( double a );
46#ifndef __WINDOWS_MODERN__
47 double remainder( long a, long b );
48#endif48#endif
49#endif
50
51// 1.4.1.0 (ge) need this since __WINDOWS_MODERN__ can be defined but remainder still not found (VC++ 2010)
52double ck_remainder( double a, double b );
53
49 54
55// max for random functions
56#ifdef __PLATFORM_WIN32__
57#define CK_RANDOM_MAX RAND_MAX
58#else
59#define CK_RANDOM_MAX 0x7fffffff
50#endif60#endif
51 61
62// chuck random wrapper
63long ck_random();
64// chuck srandom wrapper
65void ck_srandom( unsigned seed );
66
52// mtof67// mtof
53double mtof( double f );68double mtof( double f );
54// ftom69// ftom
@@ -66,10 +81,11 @@ unsigned long nextpow2( unsigned long i ); · 11 unmodified lines
66// ensurepow281// ensurepow2
67unsigned long ensurepow2( unsigned long i );82unsigned long ensurepow2( unsigned long i );
68 83
69#if defined (__cplusplus) || defined(_cplusplus) 84#if defined (__cplusplus) || defined(_cplusplus)
70}85}
71#endif86#endif
72 87
73 88
74 89
75#endif 90
91#endif
chuginate/template/chuck/include/util_network.h+1−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
41#include <sys/socket.h>41#include <sys/socket.h>
42#include <netinet/in.h>42#include <netinet/in.h>
43#else43#else
44#define _WINSOCKAPI_
44#include <windows.h>45#include <windows.h>
45#endif46#endif
46 47
chuginate/template/chuck/include/util_opsc.h+52−51
@@ -35,12 +35,13 @@ · 34 unmodified lines
35 35
36 36
37// chuck high-style artistry37// chuck high-style artistry
38// let's just cat included files into an enormous code-wad. 38// let's just cat included files into an enormous code-wad.
39// keep that bubble gum in your hair.39// keep that bubble gum in your hair.
40 40
41 41
42// the included files were from the CNMAT OSC-Kit distrib. 42// the included files were from the CNMAT OSC-Kit distrib.
43#ifdef __PLATFORM_WIN32__43#ifdef __PLATFORM_WIN32__
44#define _WINSOCKAPI_
44#include <windows.h>45#include <windows.h>
45#endif46#endif
46 47
@@ -48,7 +49,7 @@ · 1 unmodified line
48// OSC-pattern-match.h49// OSC-pattern-match.h
49 50
50/*51/*
51Copyright � 1998. The Regents of the University of California (Regents). 52Copyright � 1998. The Regents of the University of California (Regents).
52All Rights Reserved.53All Rights Reserved.
53 54
54Written by Matt Wright, The Center for New Music and Audio Technologies,55Written by Matt Wright, The Center for New Music and Audio Technologies,
@@ -71,7 +72,7 @@ PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED · 16 unmodified lines
71HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE72HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
72MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.73MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
73 74
74The OpenSound Control WWW page is 75The OpenSound Control WWW page is
75 http://www.cnmat.berkeley.edu/OpenSoundControl76 http://www.cnmat.berkeley.edu/OpenSoundControl
76*/77*/
77 78
@@ -94,7 +95,7 @@ bool PatternMatch (const char *pattern, const char *test); · 16 unmodified lines
94 95
95// - end OSC-pattern-match.h96// - end OSC-pattern-match.h
96 97
97//#inclue OSC-TimeTag.h 98//#inclue OSC-TimeTag.h
98 99
99/*100/*
100Copyright (c) 1998. The Regents of the University of California (Regents).101Copyright (c) 1998. The Regents of the University of California (Regents).
@@ -123,7 +124,7 @@ University of California, Berkeley. · 22 unmodified lines
123 REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,124 REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
124 ENHANCEMENTS, OR MODIFICATIONS.125 ENHANCEMENTS, OR MODIFICATIONS.
125 126
126The OpenSound Control WWW page is 127The OpenSound Control WWW page is
127 http://www.cnmat.berkeley.edu/OpenSoundControl128 http://www.cnmat.berkeley.edu/OpenSoundControl
128*/129*/
129 130
@@ -134,10 +135,10 @@ The OpenSound Control WWW page is · 4 unmodified lines
134 Time tags in OSC have the same format as in NTP: 64 bit fixed point, with the135 Time tags in OSC have the same format as in NTP: 64 bit fixed point, with the
135 top 32 bits giving number of seconds sinve midnight 1/1/1900 and the bottom136 top 32 bits giving number of seconds sinve midnight 1/1/1900 and the bottom
136 32 bits giving fractional parts of a second. We represent this by a 64-bit137 32 bits giving fractional parts of a second. We represent this by a 64-bit
137 unsigned long if possible, or else a struct. 138 unsigned long if possible, or else a struct.
138 139
139 NB: On many architectures with 64-bit ints, it's illegal (like maybe a bus error)140 NB: On many architectures with 64-bit ints, it's illegal (like maybe a bus error)
140 to dereference a pointer to a 64-bit int that's not 64-bit aligned. 141 to dereference a pointer to a 64-bit int that's not 64-bit aligned.
141*/142*/
142 143
143#ifndef OSC_TIMETAG144#ifndef OSC_TIMETAG
@@ -151,7 +152,7 @@ The OpenSound Control WWW page is · 7 unmodified lines
151 typedef unsigned long long uint64;152 typedef unsigned long long uint64;
152 typedef unsigned long uint32;153 typedef unsigned long uint32;
153#else154#else
154 /* You may have to redefine this typedef if ints on your system 155 /* You may have to redefine this typedef if ints on your system
155 aren't 32 bits. */156 aren't 32 bits. */
156 typedef unsigned int uint32;157 typedef unsigned int uint32;
157#endif158#endif
@@ -192,7 +193,7 @@ int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right); · 34 unmodified lines
192 193
193 194
194//#include "OSC-client.h"195//#include "OSC-client.h"
195// OSC-client.h 196// OSC-client.h
196/*197/*
197Copyright (c) 1996,1997. The Regents of the University of California (Regents).198Copyright (c) 1996,1997. The Regents of the University of California (Regents).
198All Rights Reserved.199All Rights Reserved.
@@ -221,7 +222,7 @@ University of California, Berkeley. · 22 unmodified lines
221 ENHANCEMENTS, OR MODIFICATIONS.222 ENHANCEMENTS, OR MODIFICATIONS.
222*/223*/
223 224
224/* 225/*
225 226
226 OSC-client.h: library for constructing OpenSoundControl messages.227 OSC-client.h: library for constructing OpenSoundControl messages.
227 Derived from SynthControl.h228 Derived from SynthControl.h
@@ -269,7 +270,7 @@ University of California, Berkeley. · 41 unmodified lines
269#endif270#endif
270 271
271/* The maximum depth of bundles within bundles within bundles within...272/* The maximum depth of bundles within bundles within bundles within...
272 This is the size of a static array. If you exceed this limit you'll 273 This is the size of a static array. If you exceed this limit you'll
273 get an error message. */274 get an error message. */
274#define MAX_BUNDLE_NESTING 32275#define MAX_BUNDLE_NESTING 32
275 276
@@ -284,7 +285,7 @@ typedef struct OSCbuf_struct { · 8 unmodified lines
284 int size; /* Size of the buffer */285 int size; /* Size of the buffer */
285 char *bufptr; /* Current position as we fill the buffer */286 char *bufptr; /* Current position as we fill the buffer */
286 int state; /* State of partially-constructed message */287 int state; /* State of partially-constructed message */
287 int4byte *thisMsgSize; /* Pointer to count field before 288 int4byte *thisMsgSize; /* Pointer to count field before
288 currently-being-written message */289 currently-being-written message */
289 int4byte *prevCounts[MAX_BUNDLE_NESTING];290 int4byte *prevCounts[MAX_BUNDLE_NESTING];
290 /* Pointers to count field before each currently291 /* Pointers to count field before each currently
@@ -334,12 +335,12 @@ int OSC_packetSize(OSCbuf *buf); · 43 unmodified lines
334 335
335 - Make sure the OSCbuf has been initialized with OSC_initBuffer().336 - Make sure the OSCbuf has been initialized with OSC_initBuffer().
336 337
337 - To open a bundle, call OSC_openBundle(). You can then write 338 - To open a bundle, call OSC_openBundle(). You can then write
338 messages or open new bundles within the bundle you opened.339 messages or open new bundles within the bundle you opened.
339 Call OSC_closeBundle() to close the bundle. Note that a packet340 Call OSC_closeBundle() to close the bundle. Note that a packet
340 does not have to have a bundle; it can instead consist of just a 341 does not have to have a bundle; it can instead consist of just a
341 single message.342 single message.
342 343
343 344
344 - For each message you want to send:345 - For each message you want to send:
345 346
@@ -350,7 +351,7 @@ int OSC_packetSize(OSCbuf *buf); · 4 unmodified lines
350 - Alternately, call OSC_writeAddressAndTypes() with the name of351 - Alternately, call OSC_writeAddressAndTypes() with the name of
351 your message and with a type string listing the types of all the352 your message and with a type string listing the types of all the
352 arguments you will be putting in this message.353 arguments you will be putting in this message.
353 354
354 - Now write each of the arguments into the buffer, by calling one of:355 - Now write each of the arguments into the buffer, by calling one of:
355 OSC_writeFloatArg()356 OSC_writeFloatArg()
356 OSC_writeFloatArgs()357 OSC_writeFloatArgs()
@@ -376,7 +377,7 @@ extern const char * OSC_errorMessage; · 19 unmodified lines
376 377
377/* How many bytes will be needed in the OSC format to hold the given378/* How many bytes will be needed in the OSC format to hold the given
378 string? The length of the string, plus the null char, plus any padding379 string? The length of the string, plus the null char, plus any padding
379 needed for 4-byte alignment. */ 380 needed for 4-byte alignment. */
380int OSC_effectiveStringLength(char *string);381int OSC_effectiveStringLength(char *string);
381 382
382// end OSC-client.h383// end OSC-client.h
@@ -390,11 +391,11 @@ int OSC_effectiveStringLength(char *string); · 7 unmodified lines
390 391
391class OSC_Address_Space;392class OSC_Address_Space;
392class UDP_Transmitter;393class UDP_Transmitter;
393class UDP_Receiver; 394class UDP_Receiver;
394 395
395class OSC_Transmitter396class OSC_Transmitter
396{397{
397protected: 398protected:
398 char _buffer[2048];399 char _buffer[2048];
399 OSCbuf _osc;400 OSCbuf _osc;
400 UDP_Transmitter * _out;401 UDP_Transmitter * _out;
@@ -408,10 +409,10 @@ public: · 7 unmodified lines
408 void init();409 void init();
409 void setHost( char * host, int port);410 void setHost( char * host, int port);
410 void addMessage( char * address, char * args, ...);411 void addMessage( char * address, char * args, ...);
411 412
412 void openBundle( OSCTimeTag t);413 void openBundle( OSCTimeTag t);
413 void closeBundle();414 void closeBundle();
414 415
415 void startMessage( char * spec );416 void startMessage( char * spec );
416 void startMessage( char * address, char * args );417 void startMessage( char * address, char * args );
417 void addInt( int4byte i ); // gewang: changed from int418 void addInt( int4byte i ); // gewang: changed from int
@@ -423,7 +424,7 @@ public: · 5 unmodified lines
423 void kickMessage();424 void kickMessage();
424 425
425 void presend( char * buffer , int size );426 void presend( char * buffer , int size );
426 427
427};428};
428 429
429#define OSCINBUFSIZE 8192430#define OSCINBUFSIZE 8192
@@ -434,7 +435,7 @@ public: · 4 unmodified lines
434//maximum size for the array ( ~2mb is enough, no )435//maximum size for the array ( ~2mb is enough, no )
435#define OSCINBOXMAX 256436#define OSCINBOXMAX 256
436 437
437struct OSCMesg { 438struct OSCMesg {
438 char *address;439 char *address;
439 char *types;440 char *types;
440 char *data;441 char *data;
@@ -453,10 +454,10 @@ public: · 12 unmodified lines
453 virtual ~UDP_Subscriber() {}454 virtual ~UDP_Subscriber() {}
454 455
455public:456public:
456 virtual int& port() = 0; // get/set the value of the subscriber's current port. 457 virtual int& port() = 0; // get/set the value of the subscriber's current port.
457 virtual void onReceive( char * mesg, int mesgLen ) = 0;458 virtual void onReceive( char * mesg, int mesgLen ) = 0;
458 459
459protected: 460protected:
460 virtual bool subscribe( int port );461 virtual bool subscribe( int port );
461 virtual bool unsubscribe();462 virtual bool unsubscribe();
462};463};
@@ -474,12 +475,12 @@ protected: · 11 unmodified lines
474 // int _mesglen;475 // int _mesglen;
475 476
476protected:477protected:
477 void onReceive( char * mesg, int mesgLen);478 void onReceive( char * mesg, int mesgLen);
478 int & port();479 int & port();
479 480
480protected:481protected:
481 int _port;482 int _port;
482 int _tmp_port;483 int _tmp_port;
483 XMutex * _io_mutex;484 XMutex * _io_mutex;
484 XMutex * _address_mutex;485 XMutex * _address_mutex;
485 // XThread * _io_thread;486 // XThread * _io_thread;
@@ -493,37 +494,37 @@ protected: · 7 unmodified lines
493 OSC_Address_Space ** _address_space;494 OSC_Address_Space ** _address_space;
494 int _address_size;495 int _address_size;
495 int _address_num;496 int _address_num;
496 497
497 CBufferSimple * m_event_buffer;498 CBufferSimple * m_event_buffer;
498 499
499 // REFACTOR-2017: VM ref500 // REFACTOR-2017: VM ref
500 Chuck_VM * m_vmRef;501 Chuck_VM * m_vmRef;
501 502
502public:503public:
503 OSC_Receiver( Chuck_VM * vm );504 OSC_Receiver( Chuck_VM * vm );
504 OSC_Receiver( Chuck_VM * vm, UDP_Receiver * in );505 OSC_Receiver( Chuck_VM * vm, UDP_Receiver * in );
505 virtual ~OSC_Receiver();506 virtual ~OSC_Receiver();
506 507
507 //setup //takedown508 //setup //takedown
508 void init();509 void init();
509 void bind_to_port(int port = 0);510 void bind_to_port(int port = 0);
510 void close_sock();511 void close_sock();
511 512
512 void recv_mesg();513 void recv_mesg();
513 514
514 bool listen( int port );515 bool listen( int port );
515 bool listen();516 bool listen();
516 void stopListening(); //unsubscribe;517 void stopListening(); //unsubscribe;
517 518
518 void parse(char *, int len);519 void parse(char *, int len);
519 void handle_mesg(char *, int len);520 void handle_mesg(char *, int len);
520 void handle_bundle(char *, int len);521 void handle_bundle(char *, int len);
521 void set_mesg(OSCMesg *m, char * buf, int len );522 void set_mesg(OSCMesg *m, char * buf, int len );
522 523
523 OSCMesg *write() { return _inbox + _in_write;}524 OSCMesg *write() { return _inbox + _in_write;}
524 void next_write();525 void next_write();
525 526
526 OSCMesg *read() { return _inbox + _in_read;} 527 OSCMesg *read() { return _inbox + _in_read;}
527 OSCMesg *next_read();528 OSCMesg *next_read();
528 529
529 530
@@ -531,7 +532,7 @@ public: · 1 unmodified line
531 bool get_mesg(OSCMesg* bucket);532 bool get_mesg(OSCMesg* bucket);
532 533
533 void add_address ( OSC_Address_Space * o );534 void add_address ( OSC_Address_Space * o );
534 void remove_address ( OSC_Address_Space * o ); 535 void remove_address ( OSC_Address_Space * o );
535 OSC_Address_Space * new_event ( char * spec );536 OSC_Address_Space * new_event ( char * spec );
536 OSC_Address_Space * new_event ( char * addr, char * type );537 OSC_Address_Space * new_event ( char * addr, char * type );
537 void distribute_message( OSCMesg * msg);538 void distribute_message( OSCMesg * msg);
@@ -541,22 +542,22 @@ enum osc_datatype { OSC_UNTYPED, OSC_NOARGS, OSC_INT, OSC_FLOAT, OSC_STRING, OSC · 3 unmodified lines
541 542
542struct opsc_data543struct opsc_data
543{544{
544 osc_datatype t; 545 osc_datatype t;
545 OSCTimeTag timetag;546 OSCTimeTag timetag;
546 547
547 union {548 union {
548 int4byte i; // gewang: changed from int549 int4byte i; // gewang: changed from int
549 unsigned long u; // gewang: changed from unsigned int550 unsigned long u; // gewang: changed from unsigned int
550 float f;551 float f;
551 };552 };
552 553
553 char * s;554 char * s;
554 555
555 opsc_data() { 556 opsc_data() {
556 t = OSC_UNTYPED;557 t = OSC_UNTYPED;
557 s = NULL;558 s = NULL;
558 }559 }
559 ~opsc_data() { 560 ~opsc_data() {
560 s = NULL;561 s = NULL;
561 }562 }
562};563};
@@ -590,10 +591,10 @@ protected: · 27 unmodified lines
590 void resizeData(int n);591 void resizeData(int n);
591 void resizeQueue(int n);592 void resizeQueue(int n);
592 void parseSpec();593 void parseSpec();
593 void scanSpec();594 void scanSpec();
594 595
595public:596public:
596 Chuck_Object * SELF; 597 Chuck_Object * SELF;
597 Chuck_String p_str;598 Chuck_String p_str;
598 OSC_Address_Space();599 OSC_Address_Space();
599 OSC_Address_Space( const char * spec );600 OSC_Address_Space( const char * spec );
chuginate/template/chuck/include/util_platforms.h+9−10
@@ -1,21 +1,21 @@
1/*----------------------------------------------------------------------------1/*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine3 Compiler and Virtual Machine
4 4
5 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.5 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.stanford.edu/6 http://chuck.stanford.edu/
7 http://chuck.cs.princeton.edu/7 http://chuck.cs.princeton.edu/
8 8
9 This program is free software; you can redistribute it and/or modify9 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 by10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful,14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-130721 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -42,16 +42,15 @@ · 20 unmodified lines
42#include <jni.h>42#include <jni.h>
43#include <stdio.h>43#include <stdio.h>
44 44
45
46//-----------------------------------------------------------------------------45//-----------------------------------------------------------------------------
47// name: class ChuckAndroid46// name: namespace ChuckAndroid
48// desc: android specific ChucK utilities47// desc: android specific ChucK utilities
49//-----------------------------------------------------------------------------48//-----------------------------------------------------------------------------
50class ChuckAndroid49namespace ChuckAndroid
51{50{
52public:51 JavaVM * getJVM();
53 static JavaVM * getJVM();52 FILE * getTemporaryFile() noexcept;
54 static FILE * getTemporaryFile();53 bool copyJARURLFileToTemporary(const char * jar_url, int * fd) noexcept;
55};54};
56 55
57#endif // __ANDROID__56#endif // __ANDROID__
chuginate/template/chuck/include/util_serial.h+5−4
@@ -32,9 +32,10 @@ · 31 unmodified lines
32#ifndef __UTIL_SERIAL_H__32#ifndef __UTIL_SERIAL_H__
33#define __UTIL_SERIAL_H__33#define __UTIL_SERIAL_H__
34 34
35#include "chuck_def.h"
36
35#include <vector>37#include <vector>
36#include <string>38#include <string>
37using namespace std;
38 39
39 40
40 41
@@ -46,10 +47,10 @@ using namespace std; · 5 unmodified lines
46class SerialIOManager47class SerialIOManager
47{48{
48public:49public:
49 static vector<string> availableSerialDevices();50 static std::vector<std::string> availableSerialDevices();
50 51
51private:52private:
52 static vector<string> s_availableSerialDevices;53 static std::vector<std::string> s_availableSerialDevices;
53};54};
54 55
55 56
chuginate/template/chuck/include/util_sndfile.h+103−99
@@ -57,7 +57,7 @@ · 56 unmodified lines
57 57
58 58
59// XXX philipd this might break things?59// XXX philipd this might break things?
60// these defines were placed after the machine-dependent 60// these defines were placed after the machine-dependent
61// checks below...i'm not sure why61// checks below...i'm not sure why
62 62
63#define COMPILER_IS_GCC 163#define COMPILER_IS_GCC 1
@@ -163,7 +163,7 @@ · 99 unmodified lines
163#endif163#endif
164 164
165#ifdef __LINUX_ALSA__165#ifdef __LINUX_ALSA__
166#define HAVE_ALSA_ASOUNDLIB_H 166#define HAVE_ALSA_ASOUNDLIB_H
167#endif167#endif
168 168
169#if defined(__PLATFORM_LINUX__)169#if defined(__PLATFORM_LINUX__)
@@ -201,11 +201,11 @@ · 31 unmodified lines
201 201
202// XXX 'inline' is necessary for C compilation202// XXX 'inline' is necessary for C compilation
203// in the microsoft vc6 compiler...203// in the microsoft vc6 compiler...
204// and other ms win32 specialteez. 204// and other ms win32 specialteez.
205 205
206#ifdef __PLATFORM_WIN32__206#ifdef __PLATFORM_WIN32__
207 207
208#define C_INLINE __inline 208#define C_INLINE __inline
209#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFF209#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFF
210 210
211#else211#else
@@ -421,7 +421,7 @@ typedef struct SNDFILE_tag SNDFILE ; · 209 unmodified lines
421 421
422 422
423/* The following typedef is system specific and is defined when libsndfile is.423/* The following typedef is system specific and is defined when libsndfile is.
424** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD), 424** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD),
425** off64_t (Solaris), __int64_t (Win32) etc.425** off64_t (Solaris), __int64_t (Win32) etc.
426*/426*/
427 427
@@ -1284,53 +1284,53 @@ int sf_dither_double (const SF_DITHER_INFO *dither, const double *in, double · 856 unmodified lines
1284*/1284*/
1285/*1285/*
1286** Copyright (C) 1999-2001 Erik de Castro Lopo <erikd@mega-nerd.com>1286** Copyright (C) 1999-2001 Erik de Castro Lopo <erikd@mega-nerd.com>
1287** 1287**
1288** This program is free software; you can redistribute it and/or modify1288** This program is free software; you can redistribute it and/or modify
1289** it under the terms of the GNU Lesser General Public License as published by1289** it under the terms of the GNU Lesser General Public License as published by
1290** the Free Software Foundation; either version 2.1 of the License, or1290** the Free Software Foundation; either version 2.1 of the License, or
1291** (at your option) any later version.1291** (at your option) any later version.
1292** 1292**
1293** This program is distributed in the hope that it will be useful,1293** This program is distributed in the hope that it will be useful,
1294** but WITHOUT ANY WARRANTY; without even the implied warranty of1294** but WITHOUT ANY WARRANTY; without even the implied warranty of
1295** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1295** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1296** GNU Lesser General Public License for more details.1296** GNU Lesser General Public License for more details.
1297** 1297**
1298** You should have received a copy of the GNU Lesser General Public License1298** You should have received a copy of the GNU Lesser General Public License
1299** along with this program; if not, write to the Free Software 1299** along with this program; if not, write to the Free Software
1300** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.1300** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1301*/1301*/
1302 1302
1303/*1303/*
1304** This file is not the same as the original file from Sun Microsystems. Nearly1304** This file is not the same as the original file from Sun Microsystems. Nearly
1305** all the original definitions and function prototypes that were in the file 1305** all the original definitions and function prototypes that were in the file
1306** of this name have been moved to private.h.1306** of this name have been moved to private.h.
1307*/ 1307*/
1308 1308
1309#ifndef G72X_HEADER_FILE1309#ifndef G72X_HEADER_FILE
1310#define G72X_HEADER_FILE1310#define G72X_HEADER_FILE
1311 1311
1312/* 1312/*
1313** Number of samples per block to process. 1313** Number of samples per block to process.
1314** Must be a common multiple of possible bits per sample : 2, 3, 4, 5 and 8.1314** Must be a common multiple of possible bits per sample : 2, 3, 4, 5 and 8.
1315*/1315*/
1316#define G72x_BLOCK_SIZE (3*5*8) 1316#define G72x_BLOCK_SIZE (3*5*8)
1317 1317
1318/* 1318/*
1319** Identifiers for the differing kinds of G72x ADPCM codecs.1319** Identifiers for the differing kinds of G72x ADPCM codecs.
1320** The identifiers also define the number of encoded bits per sample.1320** The identifiers also define the number of encoded bits per sample.
1321*/1321*/
1322 1322
1323enum1323enum
1324{ G723_16_BITS_PER_SAMPLE = 2,1324{ G723_16_BITS_PER_SAMPLE = 2,
1325 G723_24_BITS_PER_SAMPLE = 3, 1325 G723_24_BITS_PER_SAMPLE = 3,
1326 G723_40_BITS_PER_SAMPLE = 5, 1326 G723_40_BITS_PER_SAMPLE = 5,
1327 1327
1328 G721_32_BITS_PER_SAMPLE = 4,1328 G721_32_BITS_PER_SAMPLE = 4,
1329 G721_40_BITS_PER_SAMPLE = 5,1329 G721_40_BITS_PER_SAMPLE = 5,
1330 1330
1331 G723_16_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,1331 G723_16_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
1332 G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE), 1332 G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE),
1333 G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE), 1333 G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE),
1334 1334
1335 G721_32_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,1335 G721_32_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
1336 G721_40_SAMPLES_PER_BLOCK = G721_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G721_40_BITS_PER_SAMPLE),1336 G721_40_SAMPLES_PER_BLOCK = G721_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G721_40_BITS_PER_SAMPLE),
@@ -1341,11 +1341,11 @@ enum · 4 unmodified lines
1341 1341
1342 G721_32_BYTES_PER_BLOCK = (G721_32_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,1342 G721_32_BYTES_PER_BLOCK = (G721_32_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
1343 G721_40_BYTES_PER_BLOCK = (G721_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 81343 G721_40_BYTES_PER_BLOCK = (G721_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8
1344} ; 1344} ;
1345 1345
1346/* 1346/*
1347** This is the public structure for passing data between the caller and1347** This is the public structure for passing data between the caller and
1348** the G72x encoder and decoder. 1348** the G72x encoder and decoder.
1349** The private array is used by the encoder and decoder for internal1349** The private array is used by the encoder and decoder for internal
1350** state information and should not be changed in any way by the caller.1350** state information and should not be changed in any way by the caller.
1351** When decoding or encoding a stream, the same instance of this struct1351** When decoding or encoding a stream, the same instance of this struct
@@ -1353,9 +1353,9 @@ enum · 1 unmodified line
1353** correct state data between calls.1353** correct state data between calls.
1354*/1354*/
1355 1355
1356typedef struct 1356typedef struct
1357{ /* Private data. Don't mess with it. */1357{ /* Private data. Don't mess with it. */
1358 unsigned long sprivateo [256 / sizeof (long)] ; 1358 unsigned long sprivateo [256 / sizeof (long)] ;
1359 1359
1360 /* Public data. Read only. */1360 /* Public data. Read only. */
1361 int blocksize, max_bytes, samplesperblock, bytesperblock ;1361 int blocksize, max_bytes, samplesperblock, bytesperblock ;
@@ -1377,23 +1377,23 @@ int g72x_writer_init (G72x_DATA *data, int codec) ; · 15 unmodified lines
1377 1377
1378int g72x_decode_block (G72x_DATA *data) ;1378int g72x_decode_block (G72x_DATA *data) ;
1379/*1379/*
1380** The caller fills data->block with data->bytes bytes before calling the 1380** The caller fills data->block with data->bytes bytes before calling the
1381** function. The value data->bytes must be an integer multiple of 1381** function. The value data->bytes must be an integer multiple of
1382** data->blocksize and be <= data->max_bytes.1382** data->blocksize and be <= data->max_bytes.
1383** When it returns, the caller can read out data->samples samples. 1383** When it returns, the caller can read out data->samples samples.
1384*/ 1384*/
1385 1385
1386int g72x_encode_block (G72x_DATA *data) ;1386int g72x_encode_block (G72x_DATA *data) ;
1387/* 1387/*
1388** The caller fills state->samples some integer multiple data->samples_per_block1388** The caller fills state->samples some integer multiple data->samples_per_block
1389** (up to G72x_BLOCK_SIZE) samples before calling the function.1389** (up to G72x_BLOCK_SIZE) samples before calling the function.
1390** When it returns, the caller can read out bytes encoded bytes. 1390** When it returns, the caller can read out bytes encoded bytes.
1391*/1391*/
1392 1392
1393#endif /* !G72X_HEADER_FILE */1393#endif /* !G72X_HEADER_FILE */
1394/*1394/*
1395** Do not edit or modify anything in this comment block.1395** Do not edit or modify anything in this comment block.
1396** The arch-tag line is a file identity tag for the GNU Arch 1396** The arch-tag line is a file identity tag for the GNU Arch
1397** revision control system.1397** revision control system.
1398**1398**
1399** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d9216211399** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d921621
@@ -1432,10 +1432,10 @@ int g72x_encode_block (G72x_DATA *data) ; · 32 unmodified lines
1432/*1432/*
1433** The following is the definition of the state structure used by the1433** The following is the definition of the state structure used by the
1434** G.721/G.723 encoder and decoder to preserve their internal state1434** G.721/G.723 encoder and decoder to preserve their internal state
1435** between successive calls. The meanings of the majority of the state 1435** between successive calls. The meanings of the majority of the state
1436** structure fields are explained in detail in the CCITT Recommendation 1436** structure fields are explained in detail in the CCITT Recommendation
1437** G.721. The field names are essentially identical to variable names 1437** G.721. The field names are essentially identical to variable names
1438** in the bit level description of the coding algorithm included in this 1438** in the bit level description of the coding algorithm included in this
1439** Recommendation.1439** Recommendation.
1440*/1440*/
1441 1441
@@ -1463,19 +1463,19 @@ typedef struct private_g72x · 21 unmodified lines
1463 ** format.1463 ** format.
1464 */1464 */
1465 char td; /* delayed tone detect, new in 1988 version */1465 char td; /* delayed tone detect, new in 1988 version */
1466 1466
1467 /* The following struct members were added for libsndfile. The original 1467 /* The following struct members were added for libsndfile. The original
1468 ** code worked by calling a set of functions on a sample by sample basis 1468 ** code worked by calling a set of functions on a sample by sample basis
1469 ** which is slow on architectures like Intel x86. For libsndfile, this 1469 ** which is slow on architectures like Intel x86. For libsndfile, this
1470 ** was changed so that the encoding and decoding routines could work on1470 ** was changed so that the encoding and decoding routines could work on
1471 ** a block of samples at a time to reduce the function call overhead.1471 ** a block of samples at a time to reduce the function call overhead.
1472 */1472 */
1473 int (*encoder) (int, struct private_g72x* state) ;1473 int (*encoder) (int, struct private_g72x* state) ;
1474 int (*decoder) (int, struct private_g72x* state) ;1474 int (*decoder) (int, struct private_g72x* state) ;
1475 1475
1476 int codec_bits ;1476 int codec_bits ;
1477 int byte_index, sample_index ;1477 int byte_index, sample_index ;
1478 1478
1479} G72x_STATE ;1479} G72x_STATE ;
1480 1480
1481 1481
@@ -1512,7 +1512,7 @@ void private_init_state (G72x_STATE *state_ptr) ; · 30 unmodified lines
1512#endif /* G72X_PRIVATE_H */1512#endif /* G72X_PRIVATE_H */
1513/*1513/*
1514** Do not edit or modify anything in this comment block.1514** Do not edit or modify anything in this comment block.
1515** The arch-tag line is a file identity tag for the GNU Arch 1515** The arch-tag line is a file identity tag for the GNU Arch
1516** revision control system.1516** revision control system.
1517**1517**
1518** arch-tag: d9ad4da7-0fa3-471d-8020-720b5cfb5e5b1518** arch-tag: d9ad4da7-0fa3-471d-8020-720b5cfb5e5b
@@ -1615,7 +1615,7 @@ void endswap_long_copy (long *dest, long *src, int len) ; · 96 unmodified lines
1615 1615
1616/*1616/*
1617** Do not edit or modify anything in this comment block.1617** Do not edit or modify anything in this comment block.
1618** The arch-tag line is a file identity tag for the GNU Arch 1618** The arch-tag line is a file identity tag for the GNU Arch
1619** revision control system.1619** revision control system.
1620**1620**
1621** arch-tag: f0c5cd54-42d3-4237-90ec-11fe24995de71621** arch-tag: f0c5cd54-42d3-4237-90ec-11fe24995de7
@@ -1655,9 +1655,9 @@ typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */ · 33 unmodified lines
1655gsm gsm_create (void);1655gsm gsm_create (void);
1656 1656
1657/* Added for libsndfile : May 6, 2002 */1657/* Added for libsndfile : May 6, 2002 */
1658void gsm_init (gsm); 1658void gsm_init (gsm);
1659 1659
1660void gsm_destroy (gsm); 1660void gsm_destroy (gsm);
1661 1661
1662int gsm_print (FILE *, gsm, gsm_byte *);1662int gsm_print (FILE *, gsm, gsm_byte *);
1663int gsm_option (gsm, int, int *);1663int gsm_option (gsm, int, int *);
@@ -1671,7 +1671,7 @@ void gsm_implode (gsm, gsm_signal *, gsm_byte *); · 7 unmodified lines
1671#endif /* GSM_H */1671#endif /* GSM_H */
1672/*1672/*
1673** Do not edit or modify anything in this comment block.1673** Do not edit or modify anything in this comment block.
1674** The arch-tag line is a file identity tag for the GNU Arch 1674** The arch-tag line is a file identity tag for the GNU Arch
1675** revision control system.1675** revision control system.
1676**1676**
1677** arch-tag: 8cfc7698-5433-4b6f-aeca-967c6fda4dec1677** arch-tag: 8cfc7698-5433-4b6f-aeca-967c6fda4dec
@@ -1679,19 +1679,19 @@ void gsm_implode (gsm, gsm_signal *, gsm_byte *); · 1 unmodified line
1679 1679
1680/*1680/*
1681** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>1681** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
1682** 1682**
1683** This program is free software; you can redistribute it and/or modify1683** This program is free software; you can redistribute it and/or modify
1684** it under the terms of the GNU Lesser General Public License as published by1684** it under the terms of the GNU Lesser General Public License as published by
1685** the Free Software Foundation; either version 2.1 of the License, or1685** the Free Software Foundation; either version 2.1 of the License, or
1686** (at your option) any later version.1686** (at your option) any later version.
1687** 1687**
1688** This program is distributed in the hope that it will be useful,1688** This program is distributed in the hope that it will be useful,
1689** but WITHOUT ANY WARRANTY; without even the implied warranty of1689** but WITHOUT ANY WARRANTY; without even the implied warranty of
1690** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1690** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1691** GNU Lesser General Public License for more details.1691** GNU Lesser General Public License for more details.
1692** 1692**
1693** You should have received a copy of the GNU Lesser General Public License1693** You should have received a copy of the GNU Lesser General Public License
1694** along with this program; if not, write to the Free Software 1694** along with this program; if not, write to the Free Software
1695** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.1695** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1696*/1696*/
1697 1697
@@ -1711,7 +1711,7 @@ int au_g72x_writer_init (SF_PRIVATE *psf, int codec) ; · 13 unmodified lines
1711#endif /* AU_HEADER_FILE */1711#endif /* AU_HEADER_FILE */
1712/*1712/*
1713** Do not edit or modify anything in this comment block.1713** Do not edit or modify anything in this comment block.
1714** The arch-tag line is a file identity tag for the GNU Arch 1714** The arch-tag line is a file identity tag for the GNU Arch
1715** revision control system.1715** revision control system.
1716**1716**
1717** arch-tag: 63affc81-e204-4468-9705-60abe4d106891717** arch-tag: 63affc81-e204-4468-9705-60abe4d10689
@@ -1748,9 +1748,13 @@ enum · 30 unmodified lines
1748{1748{
1749 /* keep sorted for wav_w64_format_str() */1749 /* keep sorted for wav_w64_format_str() */
1750 WAVE_FORMAT_UNKNOWN = 0x0000, /* Microsoft Corporation */1750 WAVE_FORMAT_UNKNOWN = 0x0000, /* Microsoft Corporation */
1751#ifndef WAVE_FORMAT_PCM1751 WAVE_FORMAT_MS_PCM = 0x0001, /* Microsoft PCM format */
1752 WAVE_FORMAT_PCM = 0x0001, /* Microsoft PCM format */1752 /* -------------------------------------------------------------------------
1753#endif1753 creating and using WAVE_FORMAT_MS_PCM in this module, as WAVE_FORMAT_PCM may
1754 be defined by windows, e.g., in mmeapi.h -- which breaks the build...thanks
1755 important: WAVE_FORMAT_MS_PCM must be 1, as WAV format tag | 1.5.0.0 (ge)
1756 ------------------------------------------------------------------------- */
1757 /* WAVE_FORMAT_PCM = 0x0001, */ /* Microsoft PCM format */
1754 WAVE_FORMAT_MS_ADPCM = 0x0002, /* Microsoft ADPCM */1758 WAVE_FORMAT_MS_ADPCM = 0x0002, /* Microsoft ADPCM */
1755 WAVE_FORMAT_IEEE_FLOAT = 0x0003, /* Micrososft 32 bit float format */1759 WAVE_FORMAT_IEEE_FLOAT = 0x0003, /* Micrososft 32 bit float format */
1756 WAVE_FORMAT_VSELP = 0x0004, /* Compaq Computer Corporation */1760 WAVE_FORMAT_VSELP = 0x0004, /* Compaq Computer Corporation */
@@ -1995,60 +1999,60 @@ int wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsiz · 238 unmodified lines
1995#endif1999#endif
1996/*2000/*
1997** Do not edit or modify anything in this comment block.2001** Do not edit or modify anything in this comment block.
1998** The arch-tag line is a file identity tag for the GNU Arch 2002** The arch-tag line is a file identity tag for the GNU Arch
1999** revision control system.2003** revision control system.
2000**2004**
2001** arch-tag: 877fde12-9be3-4a31-8a5a-fdae399586132005** arch-tag: 877fde12-9be3-4a31-8a5a-fdae39958613
2002*/2006*/
2003/*2007/*
2004** Copyright (C) 1999-2001 Erik de Castro Lopo <erikd@mega-nerd.com>2008** Copyright (C) 1999-2001 Erik de Castro Lopo <erikd@mega-nerd.com>
2005** 2009**
2006** This program is free software; you can redistribute it and/or modify2010** This program is free software; you can redistribute it and/or modify
2007** it under the terms of the GNU Lesser General Public License as published by2011** it under the terms of the GNU Lesser General Public License as published by
2008** the Free Software Foundation; either version 2.1 of the License, or2012** the Free Software Foundation; either version 2.1 of the License, or
2009** (at your option) any later version.2013** (at your option) any later version.
2010** 2014**
2011** This program is distributed in the hope that it will be useful,2015** This program is distributed in the hope that it will be useful,
2012** but WITHOUT ANY WARRANTY; without even the implied warranty of2016** but WITHOUT ANY WARRANTY; without even the implied warranty of
2013** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2017** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2014** GNU Lesser General Public License for more details.2018** GNU Lesser General Public License for more details.
2015** 2019**
2016** You should have received a copy of the GNU Lesser General Public License2020** You should have received a copy of the GNU Lesser General Public License
2017** along with this program; if not, write to the Free Software 2021** along with this program; if not, write to the Free Software
2018** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.2022** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2019*/2023*/
2020 2024
2021/*2025/*
2022** This file is not the same as the original file from Sun Microsystems. Nearly2026** This file is not the same as the original file from Sun Microsystems. Nearly
2023** all the original definitions and function prototypes that were in the file 2027** all the original definitions and function prototypes that were in the file
2024** of this name have been moved to private.h.2028** of this name have been moved to private.h.
2025*/ 2029*/
2026 2030
2027#ifndef G72X_HEADER_FILE2031#ifndef G72X_HEADER_FILE
2028#define G72X_HEADER_FILE2032#define G72X_HEADER_FILE
2029 2033
2030/* 2034/*
2031** Number of samples per block to process. 2035** Number of samples per block to process.
2032** Must be a common multiple of possible bits per sample : 2, 3, 4, 5 and 8.2036** Must be a common multiple of possible bits per sample : 2, 3, 4, 5 and 8.
2033*/2037*/
2034#define G72x_BLOCK_SIZE (3*5*8) 2038#define G72x_BLOCK_SIZE (3*5*8)
2035 2039
2036/* 2040/*
2037** Identifiers for the differing kinds of G72x ADPCM codecs.2041** Identifiers for the differing kinds of G72x ADPCM codecs.
2038** The identifiers also define the number of encoded bits per sample.2042** The identifiers also define the number of encoded bits per sample.
2039*/2043*/
2040 2044
2041enum2045enum
2042{ G723_16_BITS_PER_SAMPLE = 2,2046{ G723_16_BITS_PER_SAMPLE = 2,
2043 G723_24_BITS_PER_SAMPLE = 3, 2047 G723_24_BITS_PER_SAMPLE = 3,
2044 G723_40_BITS_PER_SAMPLE = 5, 2048 G723_40_BITS_PER_SAMPLE = 5,
2045 2049
2046 G721_32_BITS_PER_SAMPLE = 4,2050 G721_32_BITS_PER_SAMPLE = 4,
2047 G721_40_BITS_PER_SAMPLE = 5,2051 G721_40_BITS_PER_SAMPLE = 5,
2048 2052
2049 G723_16_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,2053 G723_16_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
2050 G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE), 2054 G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE),
2051 G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE), 2055 G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE),
2052 2056
2053 G721_32_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,2057 G721_32_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
2054 G721_40_SAMPLES_PER_BLOCK = G721_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G721_40_BITS_PER_SAMPLE),2058 G721_40_SAMPLES_PER_BLOCK = G721_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G721_40_BITS_PER_SAMPLE),
@@ -2059,11 +2063,11 @@ enum · 4 unmodified lines
2059 2063
2060 G721_32_BYTES_PER_BLOCK = (G721_32_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,2064 G721_32_BYTES_PER_BLOCK = (G721_32_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
2061 G721_40_BYTES_PER_BLOCK = (G721_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 82065 G721_40_BYTES_PER_BLOCK = (G721_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8
2062} ; 2066} ;
2063 2067
2064/* 2068/*
2065** This is the public structure for passing data between the caller and2069** This is the public structure for passing data between the caller and
2066** the G72x encoder and decoder. 2070** the G72x encoder and decoder.
2067** The private array is used by the encoder and decoder for internal2071** The private array is used by the encoder and decoder for internal
2068** state information and should not be changed in any way by the caller.2072** state information and should not be changed in any way by the caller.
2069** When decoding or encoding a stream, the same instance of this struct2073** When decoding or encoding a stream, the same instance of this struct
@@ -2071,9 +2075,9 @@ enum · 1 unmodified line
2071** correct state data between calls.2075** correct state data between calls.
2072*/2076*/
2073 2077
2074typedef struct 2078typedef struct
2075{ /* Private data. Don't mess with it. */2079{ /* Private data. Don't mess with it. */
2076 unsigned long sprivateo [256 / sizeof (long)] ; 2080 unsigned long sprivateo [256 / sizeof (long)] ;
2077 2081
2078 /* Public data. Read only. */2082 /* Public data. Read only. */
2079 int blocksize, max_bytes, samplesperblock, bytesperblock ;2083 int blocksize, max_bytes, samplesperblock, bytesperblock ;
@@ -2095,23 +2099,23 @@ int g72x_writer_init (G72x_DATA *data, int codec) ; · 15 unmodified lines
2095 2099
2096int g72x_decode_block (G72x_DATA *data) ;2100int g72x_decode_block (G72x_DATA *data) ;
2097/*2101/*
2098** The caller fills data->block with data->bytes bytes before calling the 2102** The caller fills data->block with data->bytes bytes before calling the
2099** function. The value data->bytes must be an integer multiple of 2103** function. The value data->bytes must be an integer multiple of
2100** data->blocksize and be <= data->max_bytes.2104** data->blocksize and be <= data->max_bytes.
2101** When it returns, the caller can read out data->samples samples. 2105** When it returns, the caller can read out data->samples samples.
2102*/ 2106*/
2103 2107
2104int g72x_encode_block (G72x_DATA *data) ;2108int g72x_encode_block (G72x_DATA *data) ;
2105/* 2109/*
2106** The caller fills state->samples some integer multiple data->samples_per_block2110** The caller fills state->samples some integer multiple data->samples_per_block
2107** (up to G72x_BLOCK_SIZE) samples before calling the function.2111** (up to G72x_BLOCK_SIZE) samples before calling the function.
2108** When it returns, the caller can read out bytes encoded bytes. 2112** When it returns, the caller can read out bytes encoded bytes.
2109*/2113*/
2110 2114
2111#endif /* !G72X_HEADER_FILE */2115#endif /* !G72X_HEADER_FILE */
2112/*2116/*
2113** Do not edit or modify anything in this comment block.2117** Do not edit or modify anything in this comment block.
2114** The arch-tag line is a file identity tag for the GNU Arch 2118** The arch-tag line is a file identity tag for the GNU Arch
2115** revision control system.2119** revision control system.
2116**2120**
2117** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d9216212121** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d921621
@@ -2129,7 +2133,7 @@ int g72x_encode_block (G72x_DATA *data) ; · 11 unmodified lines
2129/* Added by Erik de Castro Lopo */2133/* Added by Erik de Castro Lopo */
2130#define USE_FLOAT_MUL2134#define USE_FLOAT_MUL
2131#define FAST2135#define FAST
2132#define WAV49 2136#define WAV49
2133/* Added by Erik de Castro Lopo */2137/* Added by Erik de Castro Lopo */
2134 2138
2135 2139
@@ -2140,7 +2144,7 @@ typedef int longword; /* 32 bit signed int */ · 4 unmodified lines
2140typedef unsigned short uword; /* unsigned word */2144typedef unsigned short uword; /* unsigned word */
2141typedef unsigned int ulongword; /* unsigned longword */2145typedef unsigned int ulongword; /* unsigned longword */
2142 2146
2143struct gsm_state 2147struct gsm_state
2144{ word dp0[ 280 ] ;2148{ word dp0[ 280 ] ;
2145 2149
2146 word z1; /* preprocessing.c, Offset_com. */2150 word z1; /* preprocessing.c, Offset_com. */
@@ -2212,7 +2216,7 @@ longword gsm_L_asr (longword a, int n) ; · 65 unmodified lines
2212word gsm_asr (word a, int n) ;2216word gsm_asr (word a, int n) ;
2213 2217
2214/*2218/*
2215 * Inlined functions from add.h 2219 * Inlined functions from add.h
2216 */2220 */
2217 2221
2218static C_INLINE longword2222static C_INLINE longword
@@ -2233,17 +2237,17 @@ GSM_L_MULT (word a, word b) · 14 unmodified lines
2233static C_INLINE longword2237static C_INLINE longword
2234GSM_L_ADD (longword a, longword b)2238GSM_L_ADD (longword a, longword b)
2235{ ulongword utmp ;2239{ ulongword utmp ;
2236 2240
2237 if (a < 0 && b < 0)2241 if (a < 0 && b < 0)
2238 { utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1) ;2242 { utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1) ;
2239 return (utmp >= (ulongword) MAX_LONGWORD) ? MIN_LONGWORD : -(longword)utmp-2 ;2243 return (utmp >= (ulongword) MAX_LONGWORD) ? MIN_LONGWORD : -(longword)utmp-2 ;
2240 } ;2244 } ;
2241 2245
2242 if (a > 0 && b > 0)2246 if (a > 0 && b > 0)
2243 { utmp = (ulongword) a + (ulongword) b ;2247 { utmp = (ulongword) a + (ulongword) b ;
2244 return (utmp >= (ulongword) MAX_LONGWORD) ? MAX_LONGWORD : utmp ;2248 return (utmp >= (ulongword) MAX_LONGWORD) ? MAX_LONGWORD : utmp ;
2245 } ;2249 } ;
2246 2250
2247 return a + b ;2251 return a + b ;
2248} /* GSM_L_ADD */2252} /* GSM_L_ADD */
2249 2253
@@ -2266,12 +2270,12 @@ GSM_SUB (word a, word b) · 16 unmodified lines
2266{ longword ltmp ;2270{ longword ltmp ;
2267 2271
2268 ltmp = ((longword) a) - ((longword) b) ;2272 ltmp = ((longword) a) - ((longword) b) ;
2269 2273
2270 if (ltmp >= MAX_WORD)2274 if (ltmp >= MAX_WORD)
2271 ltmp = MAX_WORD ;2275 ltmp = MAX_WORD ;
2272 else if (ltmp <= MIN_WORD)2276 else if (ltmp <= MIN_WORD)
2273 ltmp = MIN_WORD ;2277 ltmp = MIN_WORD ;
2274 2278
2275 return ltmp ;2279 return ltmp ;
2276} /* GSM_SUB */2280} /* GSM_SUB */
2277 2281
@@ -2319,10 +2323,10 @@ void Gsm_Preprocess ( · 41 unmodified lines
2319 2323
2320void Gsm_Encoding (2324void Gsm_Encoding (
2321 struct gsm_state * S,2325 struct gsm_state * S,
2322 word * e, 2326 word * e,
2323 word * ep, 2327 word * ep,
2324 word * xmaxc,2328 word * xmaxc,
2325 word * Mc, 2329 word * Mc,
2326 word * xMc) ;2330 word * xMc) ;
2327 2331
2328void Gsm_Short_Term_Analysis_Filter (2332void Gsm_Short_Term_Analysis_Filter (
@@ -2415,7 +2419,7 @@ extern word gsm_FAC [8] ; · 86 unmodified lines
2415#endif /* PRIVATE_H */2419#endif /* PRIVATE_H */
2416/*2420/*
2417** Do not edit or modify anything in this comment block.2421** Do not edit or modify anything in this comment block.
2418** The arch-tag line is a file identity tag for the GNU Arch 2422** The arch-tag line is a file identity tag for the GNU Arch
2419** revision control system.2423** revision control system.
2420**2424**
2421** arch-tag: 8bc5fdf2-e8c8-4686-9bd7-a30b512bef0c2425** arch-tag: 8bc5fdf2-e8c8-4686-9bd7-a30b512bef0c
@@ -2582,8 +2586,8 @@ extern word gsm_FAC [8] ; · 160 unmodified lines
2582 { int res [2] ;2586 { int res [2] ;
2583 2587
2584 __asm__ __volatile__2588 __asm__ __volatile__
2585 ( "fctiw %1, %1\n\t"2589 ( "fctiw %1, %1\n\t"
2586 "stfd %1, %0"2590 "stfd %1, %0"
2587 : "=m" (res) /* Output */2591 : "=m" (res) /* Output */
2588 : "f" (in) /* Input */2592 : "f" (in) /* Input */
2589 : "memory"2593 : "memory"
@@ -2597,8 +2601,8 @@ extern word gsm_FAC [8] ; · 7 unmodified lines
2597 { int res [2] ;2601 { int res [2] ;
2598 2602
2599 __asm__ __volatile__2603 __asm__ __volatile__
2600 ( "fctiw %1, %1\n\t"2604 ( "fctiw %1, %1\n\t"
2601 "stfd %1, %0"2605 "stfd %1, %0"
2602 : "=m" (res) /* Output */2606 : "=m" (res) /* Output */
2603 : "f" (in) /* Input */2607 : "f" (in) /* Input */
2604 : "memory"2608 : "memory"
@@ -2623,7 +2627,7 @@ extern word gsm_FAC [8] ; · 18 unmodified lines
2623 2627
2624/*2628/*
2625** Do not edit or modify anything in this comment block.2629** Do not edit or modify anything in this comment block.
2626** The arch-tag line is a file identity tag for the GNU Arch 2630** The arch-tag line is a file identity tag for the GNU Arch
2627** revision control system.2631** revision control system.
2628**2632**
2629** arch-tag: 42db1693-ff61-4051-bac1-e4d24c4e30b72633** arch-tag: 42db1693-ff61-4051-bac1-e4d24c4e30b7
@@ -2712,7 +2716,7 @@ extern word gsm_FAC [8] ; · 82 unmodified lines
2712*/2716*/
2713/*2717/*
2714** Do not edit or modify anything in this comment block.2718** Do not edit or modify anything in this comment block.
2715** The arch-tag line is a file identity tag for the GNU Arch 2719** The arch-tag line is a file identity tag for the GNU Arch
2716** revision control system.2720** revision control system.
2717**2721**
2718** arch-tag: 253aea6d-6299-46fd-8d06-bc5f6224c8fe2722** arch-tag: 253aea6d-6299-46fd-8d06-bc5f6224c8fe
chuginate/template/chuck/include/util_string.h+7−3
@@ -55,7 +55,7 @@ std::string ltrim( const std::string & val ); · 54 unmodified lines
55std::string rtrim( const std::string & val );55std::string rtrim( const std::string & val );
56 56
57// argument extraction57// argument extraction
58t_CKBOOL extract_args( const std::string & token, 58t_CKBOOL extract_args( const std::string & token,
59 std::string & filename,59 std::string & filename,
60 std::vector<std::string> & args );60 std::vector<std::string> & args );
61 61
@@ -66,8 +66,9 @@ std::string dir_go_up( const std::string & dir, t_CKINT numUp ); · 4 unmodified lines
66std::string get_full_path( const std::string & fp );66std::string get_full_path( const std::string & fp );
67 67
68// currently just expands ~ to HOME and ~user to user's home directory68// currently just expands ~ to HOME and ~user to user's home directory
69std::string expand_filepath( std::string & fp );69std::string expand_filepath( std::string & fp, t_CKBOOL ensurePathExists = TRUE );
70 70
71// get directory portion of a filepath (minus the file itself)
71std::string extract_filepath_dir(std::string &filepath);72std::string extract_filepath_dir(std::string &filepath);
72 73
73// convert \ to / (on Windows)74// convert \ to / (on Windows)
@@ -75,7 +76,10 @@ std::string normalize_directory_separator(const std::string &filepath); · 1 unmodified line
75 76
76// determine if the last characters of str match end exactly77// determine if the last characters of str match end exactly
77// e.g. to test file extension78// e.g. to test file extension
78int str_endsin(const char *str, const char *end);79t_CKBOOL str_endsin(const char *str, const char *end);
80
81// check if path is absolute on the underlying platform
82t_CKBOOL is_absolute_path( const std::string & path );
79 83
80//-----------------------------------------------------------------------------84//-----------------------------------------------------------------------------
81// name: parse_path_list()85// name: parse_path_list()
chuginate/template/chuck/include/util_thread.h+18−18
@@ -148,47 +148,47 @@ protected: · 147 unmodified lines
148//-----------------------------------------------------------------------------148//-----------------------------------------------------------------------------
149// name: XWriteThread()149// name: XWriteThread()
150// desc: utility class for scheduling writes to be executed on a separate150// desc: utility class for scheduling writes to be executed on a separate
151// thread. 151// thread.
152//-----------------------------------------------------------------------------152//-----------------------------------------------------------------------------
153class XWriteThread153class XWriteThread
154{154{
155public:155public:
156 // get the shared instance156 // get the shared instance
157 static XWriteThread * shared();157 static XWriteThread * shared();
158 // static buffer size158 // static buffer size
159 const static size_t PRODUCER_BUFFER_SIZE;159 const static size_t PRODUCER_BUFFER_SIZE;
160 160
161public:161public:
162 // constructor162 // constructor
163 XWriteThread( size_t data_buffer_size = 4096, size_t msg_buffer_size = 32 );163 XWriteThread( size_t data_buffer_size = 4096, size_t msg_buffer_size = 32 );
164 164
165public:165public:
166 size_t fwrite( const void * ptr, size_t size, size_t nitems, FILE * stream );166 size_t fwrite( const void * ptr, size_t size, size_t nitems, FILE * stream );
167 int fseek( FILE * stream, long offset, int whence );167 int fseek( FILE * stream, long offset, int whence );
168 int fflush( FILE * stream );168 int fflush( FILE * stream );
169 int fclose( FILE * stream );169 int fclose( FILE * stream );
170 170
171 // DO NOT DELETE INSTANCES OF XWriteThread171 // DO NOT DELETE INSTANCES OF XWriteThread
172 // instead call shutdown and they will be cleaned up in the background172 // instead call shutdown and they will be cleaned up in the background
173 void shutdown();173 void shutdown();
174 174
175private: 175private:
176 // DO NOT DELETE INSTANCES OF XWriteThread176 // DO NOT DELETE INSTANCES OF XWriteThread
177 // instead call shutdown and they will be cleaned up in the background177 // instead call shutdown and they will be cleaned up in the background
178 ~XWriteThread();178 ~XWriteThread();
179 179
180 // flush180 // flush
181 void flush_data_buffer();181 void flush_data_buffer();
182 182
183 // callback183 // callback
184#if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) )184#if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) )
185 static void * write_cb( void * _thiss );185 static void * write_cb( void * _thiss );
186#elif defined(__PLATFORM_WIN32__)186#elif defined(__PLATFORM_WIN32__)
187 static unsigned THREAD_TYPE write_cb( void * _thiss );187 static unsigned THREAD_TYPE write_cb( void * _thiss );
188#endif188#endif
189 189
190 // shared instance190 // shared instance
191 static XWriteThread * o_defaultWriteThread;191 static XWriteThread * o_defaultWriteThread;
192 192
193private:193private:
194 t_CKBOOL m_thread_exit;194 t_CKBOOL m_thread_exit;
@@ -198,10 +198,10 @@ private: · 3 unmodified lines
198 t_CKBYTE * m_thread_buffer;198 t_CKBYTE * m_thread_buffer;
199 FILE * m_stream;199 FILE * m_stream;
200 200
201 // internal message format201 // internal message format
202 struct Message202 struct Message
203 {203 {
204 // operation type204 // operation type
205 enum205 enum
206 {206 {
207 WRITE,207 WRITE,
@@ -210,18 +210,18 @@ private: · 2 unmodified lines
210 CLOSE,210 CLOSE,
211 SHUTDOWN211 SHUTDOWN
212 } operation;212 } operation;
213 213
214 // file pointer214 // file pointer
215 FILE * file;215 FILE * file;
216 216
217 // size / offset217 // size / offset
218 union218 union
219 {219 {
220 struct220 struct
221 {221 {
222 size_t data_size;222 size_t data_size;
223 } write;223 } write;
224 224
225 struct225 struct
226 {226 {
227 long offset;227 long offset;
@@ -233,7 +233,7 @@ private: · 5 unmodified lines
233 Message() : file(NULL) { }233 Message() : file(NULL) { }
234 };234 };
235 235
236 // circular buffer236 // circular buffer
237 CircularBuffer<Message> * m_msg_buffer;237 CircularBuffer<Message> * m_msg_buffer;
238};238};
239 239

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t