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
120120
121121 // convert to 32-bit int
122122 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;
124133 q32 = (q32 >> shift) << shift;
125−
126134 *out = q32 / ((float) INT_MAX);
127135
128136 return TRUE;
Faust/makefile.osx+2−2
@@ -1,9 +1,9 @@
11
2−ARCHS?=x86_64
2+ARCHS?=arm64
33 ARCHOPTS=$(addprefix -arch ,$(ARCHS))
44
55 FLAGS+=-mmacosx-version-min=10.9 -D__MACOSX_CORE__ -I$(CK_SRC_PATH) $(ARCHOPTS) -fPIC -I/usr/local/include
6−LDFLAGS+=-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++
6+LDFLAGS+=-mmacosx-version-min=10.9 -L/usr/local/lib -shared -lc++ $(ARCHOPTS) -lfaust `llvm-config --ldflags --libs all` -lz -lcurses -lc++
77
88 LD=clang++
99 CXX=clang++
chuck/include/chuck.h+2−4
@@ -175,12 +175,10 @@ protected: · 174 unmodified lines
175175 public: // static functions
176176 // chuck version
177177 static const char * version();
178− #ifndef __DISABLE_OTF_SERVER__
179178 // chuck int size (in bits)
180− // (this depends on machine, which depends on OTF, so
181− // disable it if we don't have OTF)
179+ // (this depends on machine, which depends on OTF, so disable it if we don't have OTF)
180+ // 1.5.0.0 (ge) | reinstated for non-OTF, along with parts of machine
182181 static t_CKUINT intSize();
183− #endif
184182 // number of ChucK's
185183 static t_CKUINT numVMs() { return o_numVMs; };
186184 // --poop compatibilty
chuck/include/chuck_compile.h+6−1
@@ -67,7 +67,6 @@ public: // get protected data · 66 unmodified lines
6767 // set carrier
6868 t_CKBOOL setCarrier( Chuck_Carrier * c ) { m_carrier = c; return TRUE; }
6969
70−
7170 public: // data
7271 // emitter
7372 Chuck_Emitter * emitter;
@@ -79,9 +78,15 @@ public: // data · 5 unmodified lines
7978 // recent map
8079 std::map<std::string, Chuck_Context *> m_recent;
8180
81+ // chugins
8282 std::list<Chuck_DLL *> m_dlls;
83+ // libraries (ck code) to import
8384 std::list<std::string> m_cklibs_to_preload;
8485
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+
8590 public: // to all
8691 // contructor
8792 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
154154 #define SAFE_RELEASE(x) do { if(x){ x->release(); x = NULL; } } while(0)
155155 #define SAFE_ADD_REF(x) do { if(x){ x->add_ref(); } } while(0)
156156 #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)
157159 #endif
158160
159161 // max + min
@@ -191,7 +193,12 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 31 unmodified lines
191193
192194 #ifdef __PLATFORM_WIN32__
193195 #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__)
195202 #endif
196203 #pragma warning (disable : 4996) // stdio deprecation
197204 #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
161161 #endif
162162
163163 // calling convention of functions provided by chuck to the dll
164−#if defined(__WINDOWS_DS__)
164+#if defined(__PLATFORM_WIN32__)
165165 #define CK_DLL_CALL _cdecl
166166 #else
167167 #define CK_DLL_CALL
@@ -676,7 +676,7 @@ public: · 508 unmodified lines
676676 {
677677 ObjectApi();
678678
679− // 1.4.2.1 (nshaheed and ge and anonymous pr-lab member) | changed from private to public
679+ // 1.5.0.0 (nshaheed and ge and anonymous pr-lab member) | changed from private to public
680680 // also changed all std::string & in this section to const char *
681681 // intent: this allows for chugins to access member variables and create chuck strings
682682 public:
@@ -724,7 +724,7 @@ private: · 41 unmodified lines
724724
725725 #error ChucK not support on Mac OS X 10.3 or lower
726726
727−#elif defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
727+#elif defined(__PLATFORM_WIN32__)
728728
729729 #ifdef __cplusplus
730730 extern "C" {
chuck/include/chuck_emit.h+3−1
@@ -148,7 +148,9 @@ struct Chuck_Emitter : public Chuck_VM_Object · 147 unmodified lines
148148 // add references to locals on current scope (added 1.3.0.0)
149149 void addref_on_scope();
150150 // 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();
152154
153155 // default durations
154156 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
5353 void EM_newline( );
5454
5555 // levels
56−#define CK_LOG_CRAZY 10 // set this to log everything
56+#define CK_LOG_ALL 10 // set this to log everything
5757 #define CK_LOG_FINEST 9
5858 #define CK_LOG_FINER 8
5959 #define CK_LOG_FINE 7
chuck/include/chuck_frame.h+1−1
@@ -92,7 +92,7 @@ public: · 91 unmodified lines
9292 Chuck_Local * alloc_local( t_CKUINT size, const std::string & name,
9393 t_CKBOOL is_ref, t_CKBOOL is_obj, t_CKBOOL is_global );
9494 // 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;
9696 // pop scope
9797 void pop_scope( std::vector<Chuck_Local *> & out );
9898 };
chuck/include/chuck_instr.h+73−9
@@ -58,7 +58,7 @@ struct Chuck_Instr · 57 unmodified lines
5858 {
5959 public:
6060 Chuck_Instr();
61− virtual ~Chuck_Instr() { }
61+ virtual ~Chuck_Instr() { SAFE_DELETE(m_codestr); }
6262
6363 public:
6464 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) = 0;
@@ -69,8 +69,14 @@ public: · 4 unmodified lines
6969 { return ""; }
7070
7171 public:
72+ // store line position for error messages
7273 void set_linepos( t_CKUINT linepos );
7374 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;
7480 };
7581
7682
@@ -2017,6 +2023,23 @@ protected: · 1940 unmodified lines
20172023
20182024
20192025
2026+//-----------------------------------------------------------------------------
2027+// name: struct Chuck_Instr_Reg_Push_Zero
2028+// desc: push immediate value 0 to reg stack with specific width
2029+//-----------------------------------------------------------------------------
2030+struct Chuck_Instr_Reg_Push_Zero : public Chuck_Instr_Unary_Op
2031+{
2032+public:
2033+ Chuck_Instr_Reg_Push_Zero( t_CKUINT sizeInBytes )
2034+ { this->set( sizeInBytes ); }
2035+
2036+public:
2037+ virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2038+};
2039+
2040+
2041+
2042+
20202043 //-----------------------------------------------------------------------------
20212044 // name: struct Chuck_Instr_Reg_Dup_Last
20222045 // desc: duplicate last value on reg stack
@@ -2960,6 +2983,7 @@ public: · 937 unmodified lines
29602983 //-----------------------------------------------------------------------------
29612984 // name: struct Chuck_Instr_Reg_AddRef_Object3
29622985 // desc: added 1.3.0.0 -- does the ref add in-place
2986+// operates on top of the register stack
29632987 //-----------------------------------------------------------------------------
29642988 struct Chuck_Instr_Reg_AddRef_Object3 : public Chuck_Instr
29652989 {
@@ -2972,7 +2996,7 @@ public: · 6 unmodified lines
29722996
29732997 //-----------------------------------------------------------------------------
29742998 // name: struct Chuck_Instr_Release_Object
2975−// desc: ...
2999+// desc: release object on stack by its offset
29763000 //-----------------------------------------------------------------------------
29773001 struct Chuck_Instr_Release_Object : public Chuck_Instr
29783002 {
@@ -3001,6 +3025,38 @@ public: · 22 unmodified lines
30013025
30023026
30033027
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+//-----------------------------------------------------------------------------
3033+struct Chuck_Instr_Release_Object3_Pop_Word : public Chuck_Instr
3034+{
3035+public:
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+//-----------------------------------------------------------------------------
3047+struct Chuck_Instr_Release_Object4 : public Chuck_Instr_Unary_Op
3048+{
3049+public:
3050+ Chuck_Instr_Release_Object4( t_CKUINT offset )
3051+ { this->set( offset ); }
3052+
3053+public:
3054+ virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3055+};
3056+
3057+
3058+
3059+
30043060 //-----------------------------------------------------------------------------
30053061 // name: struct Chuck_Instr_Func_To_Code
30063062 // desc: Chuck_Func * to Chuck_VM_Code *
@@ -3034,11 +3090,14 @@ public: · 27 unmodified lines
30343090 struct Chuck_Instr_Func_Call_Member : public Chuck_Instr_Unary_Op
30353091 {
30363092 public:
3037− Chuck_Instr_Func_Call_Member( t_CKUINT ret_size )
3038− { this->set( ret_size ); }
3093+ Chuck_Instr_Func_Call_Member( t_CKUINT ret_size, Chuck_Func * func_ref )
3094+ { this->set( ret_size ); m_func_ref = func_ref; }
30393095
30403096 public:
30413097 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3098+
3099+public:
3100+ Chuck_Func * m_func_ref; // 1.5.0.0 (ge) | added for arg list cleanup
30423101 };
30433102
30443103
@@ -3051,11 +3110,14 @@ public: · 6 unmodified lines
30513110 struct Chuck_Instr_Func_Call_Static : public Chuck_Instr_Unary_Op
30523111 {
30533112 public:
3054− Chuck_Instr_Func_Call_Static( t_CKUINT ret_size )
3055− { this->set( ret_size ); }
3113+ Chuck_Instr_Func_Call_Static( t_CKUINT ret_size, Chuck_Func * func_ref )
3114+ { this->set( ret_size ); m_func_ref = func_ref; }
30563115
30573116 public:
30583117 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3118+
3119+public:
3120+ Chuck_Func * m_func_ref; // 1.5.0.0 (ge) | added for arg list cleanup
30593121 };
30603122
30613123
@@ -3162,8 +3224,9 @@ protected: · 100 unmodified lines
31623224 struct Chuck_Instr_Array_Alloc : public Chuck_Instr
31633225 {
31643226 public: // REFACTOR-2017: added env
3165− Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth, Chuck_Type * the_type,
3166− t_CKUINT offset, t_CKBOOL ref );
3227+ Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth,
3228+ Chuck_Type * contentType, t_CKUINT offset, t_CKBOOL ref,
3229+ Chuck_Type * arrayType );
31673230 virtual ~Chuck_Instr_Array_Alloc();
31683231
31693232 public:
@@ -3172,7 +3235,8 @@ public: · 2 unmodified lines
31723235
31733236 protected:
31743237 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
31763240 t_CKBOOL m_is_obj;
31773241 char * m_param_str;
31783242 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
5353 t_CKBOOL init_class_HID( Chuck_Env * env );
5454 #endif
5555 t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type );
56−#ifndef __DISABLE_FILEIO__
56+// #ifndef __DISABLE_FILEIO__
5757 t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type );
58−#endif
58+// #endif
5959 // added 1.3.0.0 -- moved to be full-fledged class
6060 t_CKBOOL init_class_chout( Chuck_Env * env, Chuck_Type * type );
6161 // added 1.3.0.0 -- moved to be full-fledged class
@@ -77,7 +77,7 @@ CK_DLL_SFUN( io_newline ); · 15 unmodified lines
7777 CK_DLL_SFUN( io_openfile );
7878
7979
80−#ifndef __DISABLE_FILEIO__
80+// #ifndef __DISABLE_FILEIO__
8181 //-----------------------------------------------------------------------------
8282 // fileio API
8383 //-----------------------------------------------------------------------------
@@ -99,6 +99,9 @@ CK_DLL_MFUN( fileio_read ); · 15 unmodified lines
9999 CK_DLL_MFUN( fileio_readline );
100100 CK_DLL_MFUN( fileio_readint );
101101 CK_DLL_MFUN( fileio_readintflags );
102+CK_DLL_MFUN( fileio_readint8 );
103+CK_DLL_MFUN( fileio_readint16 );
104+CK_DLL_MFUN( fileio_readint32 );
102105 CK_DLL_MFUN( fileio_readfloat );
103106 CK_DLL_MFUN( fileio_eof );
104107 CK_DLL_MFUN( fileio_more );
@@ -106,7 +109,7 @@ CK_DLL_MFUN( fileio_writestring ); · 1 unmodified line
106109 CK_DLL_MFUN( fileio_writeint );
107110 CK_DLL_MFUN( fileio_writeintflags );
108111 CK_DLL_MFUN( fileio_writefloat );
109−#endif
112+// #endif // __DISABLE_FILEIO__
110113
111114
112115 //-----------------------------------------------------------------------------
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
5858 t_CKBOOL init_class_array( Chuck_Env * env, Chuck_Type * type );
5959 t_CKBOOL init_class_vec3( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3
6060 t_CKBOOL init_class_vec4( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3
61−
61+t_CKBOOL init_class_type( Chuck_Env * env, Chuck_Type * type ); // 1.5.0.0
62+t_CKBOOL init_primitive_types( Chuck_Env * env ); // 1.5.0.0
6263
6364
6465
@@ -69,11 +70,11 @@ t_CKBOOL init_class_vec4( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3 · 4 unmodified lines
6970 CK_DLL_CTOR( object_ctor );
7071 CK_DLL_DTOR( object_dtor );
7172 CK_DLL_MFUN( object_equals );
72−CK_DLL_MFUN( object_getType );
7373 CK_DLL_MFUN( object_hashCode );
7474 CK_DLL_MFUN( object_toString );
7575 CK_DLL_MFUN( object_dump );
7676 CK_DLL_SFUN( object_help );
77+CK_DLL_SFUN( object_typeInfo );
7778
7879
7980 //-----------------------------------------------------------------------------
@@ -187,7 +188,10 @@ CK_DLL_MFUN( array_find ); · 107 unmodified lines
187188 CK_DLL_MFUN( array_erase );
188189 CK_DLL_MFUN( array_clear );
189190 CK_DLL_MFUN( array_reset );
191+CK_DLL_MFUN( array_zero );
190192 CK_DLL_MFUN( array_get_keys );
193+CK_DLL_MFUN( array_reverse );
194+CK_DLL_MFUN( array_shuffle );
191195
192196
193197 //-----------------------------------------------------------------------------
@@ -256,6 +260,37 @@ CK_DLL_MFUN( vec4_magnitude ); · 62 unmodified lines
256260 CK_DLL_MFUN( vec4_normalize );
257261
258262
263+//-----------------------------------------------------------------------------
264+// type API | 1.5.0.0 (ge) added
265+//-----------------------------------------------------------------------------
266+CK_DLL_CTOR( type_ctor );
267+CK_DLL_DTOR( type_dtor );
268+CK_DLL_MFUN( type_equals );
269+CK_DLL_MFUN( type_isa );
270+CK_DLL_MFUN( type_isa_str );
271+CK_DLL_MFUN( type_name );
272+CK_DLL_MFUN( type_parent ); // return parent Type
273+CK_DLL_MFUN( type_children ); // return children Types
274+CK_DLL_MFUN( type_origin ); // built-in, chugin, defined in chuck
275+CK_DLL_MFUN( type_isPrimitive );
276+CK_DLL_MFUN( type_isArray );
277+CK_DLL_MFUN( type_arrayDims );
278+CK_DLL_SFUN( type_findString );
279+CK_DLL_SFUN( type_typeOf_obj ); // Type.typeOf( Object )
280+CK_DLL_SFUN( type_typeOf_int ); // Type.typeOf( int )
281+CK_DLL_SFUN( type_typeOf_float ); // Type.typeOf( float )
282+CK_DLL_SFUN( type_typeOf_time ); // Type.typeOf( time )
283+CK_DLL_SFUN( type_typeOf_dur ); // Type.typeOf( dur )
284+CK_DLL_SFUN( type_typeOf_complex ); // Type.typeOf( complex )
285+CK_DLL_SFUN( type_typeOf_polar ); // Type.typeOf( polar )
286+CK_DLL_SFUN( type_typeOf_vec3 ); // Type.typeOf( vec3 )
287+CK_DLL_SFUN( type_typeOf_vec4 ); // Type.typeOf( vec4 )
288+CK_DLL_SFUN( type_getTypes );
289+CK_DLL_SFUN( type_getTypesAll );
290+
291+
292+
293+
259294 //-----------------------------------------------------------------------------
260295 // name: Data_Exception
261296 // desc: data for base Chuck Exception class
chuck/include/chuck_oo.h+48−13
@@ -98,6 +98,8 @@ public: · 97 unmodified lines
9898 virtual void release();
9999 // lock
100100 virtual void lock();
101+ // unlock | 1.5.0.0 (ge) added
102+ virtual void unlock();
101103
102104 // NOTE: be careful when overriding these, should always
103105 // explicitly call up to ChucK_VM_Object (ge: 2013)
@@ -228,8 +230,14 @@ public: · 124 unmodified lines
228230 virtual t_CKINT find( const std::string & key ) = 0; // find
229231 virtual t_CKINT erase( const std::string & key ) = 0; // erase
230232 virtual void clear( ) = 0; // clear
233+ virtual void zero( t_CKUINT start, t_CKUINT end ) = 0; // zero
234+ virtual void zero() = 0; // zero (all)
231235 // get map keys | added (1.4.2.0) nshaheed
232236 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;
233241
234242 Chuck_Type * m_array_type;
235243 };
@@ -259,6 +267,7 @@ public: · 23 unmodified lines
259267 t_CKINT pop_out( t_CKINT pos );
260268 t_CKINT back( t_CKUINT * val ) const;
261269 void zero( t_CKUINT start, t_CKUINT end );
270+ void zero() { this->zero(0, m_vector.size()); }
262271
263272 virtual void clear( );
264273 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -271,11 +280,18 @@ public: · 6 unmodified lines
271280 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY4_DATAKIND; }
272281 // get map keys | added (1.4.2.0) nshaheed
273282 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();
274287
275288 public:
276289 std::vector<t_CKUINT> m_vector;
277290 std::map<std::string, t_CKUINT> m_map;
278291 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+
279295 // t_CKINT m_size;
280296 // t_CKINT m_capacity;
281297 };
@@ -305,6 +321,7 @@ public: · 23 unmodified lines
305321 t_CKINT pop_out( t_CKINT pos );
306322 t_CKINT back( t_CKFLOAT * val ) const;
307323 void zero( t_CKUINT start, t_CKUINT end );
324+ void zero() { this->zero(0, m_vector.size()); }
308325
309326 virtual void clear( );
310327 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -317,6 +334,10 @@ public: · 6 unmodified lines
317334 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY8_DATAKIND; }
318335 // get map keys | added (1.4.2.0) nshaheed
319336 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();
320341
321342 public:
322343 std::vector<t_CKFLOAT> m_vector;
@@ -350,6 +371,7 @@ public: · 27 unmodified lines
350371 t_CKINT pop_out( t_CKINT pos );
351372 t_CKINT back( t_CKCOMPLEX * val ) const;
352373 void zero( t_CKUINT start, t_CKUINT end );
374+ void zero() { this->zero(0, m_vector.size()); }
353375
354376 virtual void clear( );
355377 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -362,6 +384,10 @@ public: · 6 unmodified lines
362384 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY16_DATAKIND; }
363385 // get map keys | added (1.4.2.0) nshaheed
364386 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();
365391
366392 public:
367393 std::vector<t_CKCOMPLEX> m_vector;
@@ -395,6 +421,7 @@ public: · 27 unmodified lines
395421 t_CKINT pop_out( t_CKUINT pos );
396422 t_CKINT back( t_CKVEC3 * val ) const;
397423 void zero( t_CKUINT start, t_CKUINT end );
424+ void zero() { this->zero(0, m_vector.size()); }
398425
399426 virtual void clear( );
400427 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -407,6 +434,10 @@ public: · 6 unmodified lines
407434 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY24_DATAKIND; }
408435 // get map keys | added (1.4.2.0) nshaheed
409436 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();
410441
411442 public:
412443 std::vector<t_CKVEC3> m_vector;
@@ -438,6 +469,7 @@ public: · 25 unmodified lines
438469 t_CKINT pop_out( t_CKUINT pos );
439470 t_CKINT back( t_CKVEC4 * val ) const;
440471 void zero( t_CKUINT start, t_CKUINT end );
472+ void zero() { this->zero(0, m_vector.size()); }
441473
442474 virtual void clear( );
443475 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -450,6 +482,10 @@ public: · 6 unmodified lines
450482 virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY32_DATAKIND; }
451483 // get map keys | added (1.4.1.2) nshaheed
452484 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();
453489
454490 public:
455491 std::vector<t_CKVEC4> m_vector;
@@ -589,15 +625,23 @@ public: · 133 unmodified lines
589625 virtual void write( t_CKINT val, t_CKINT flags ) = 0;
590626 virtual void write( t_CKFLOAT val ) = 0;
591627
592− // constants
593628 public:
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
594633 static const t_CKINT INT32;
595634 static const t_CKINT INT16;
596635 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;
598641 // asynchronous I/O members
599642 static const t_CKINT MODE_SYNC;
600643 static const t_CKINT MODE_ASYNC;
644+
601645 Chuck_Event * m_asyncEvent;
602646 #ifndef __DISABLE_THREADS__
603647 XThread * m_thread;
@@ -614,7 +658,7 @@ public: · 10 unmodified lines
614658
615659
616660
617−#ifndef __DISABLE_FILEIO__
661+// #ifndef __DISABLE_FILEIO__
618662 //-----------------------------------------------------------------------------
619663 // name: Chuck_IO_File
620664 // desc: Chuck File IO class
@@ -673,15 +717,6 @@ public: · 52 unmodified lines
673717 static THREAD_RETURN ( THREAD_TYPE writeFloat_thread ) ( void *data );
674718 #endif
675719
676−public:
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−
685720 protected:
686721 // open flags
687722 t_CKINT m_flags;
@@ -698,7 +733,7 @@ protected: · 10 unmodified lines
698733 // vm and shred
699734 Chuck_VM * m_vmRef;
700735 };
701−#endif // __DISABLE_FILEIO__
736+// #endif // __DISABLE_FILEIO__
702737
703738
704739
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
6363 // reset the parser
6464 void reset_parse( );
6565
66+// convert abstract syntax expression to string
67+std::string absyn2str( a_Exp exp );
6668
6769 // syntax highlighting tools
6870 #include <vector>
chuck/include/chuck_type.h+77−16
@@ -84,6 +84,22 @@ typedef enum { · 83 unmodified lines
8484
8585
8686
87+//-----------------------------------------------------------------------------
88+// name: enum te_Origin | 1.5.0.0 (ge) added
89+// desc: where something (e.g., a Type) originates
90+//-----------------------------------------------------------------------------
91+typedef 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+
87103 //-----------------------------------------------------------------------------
88104 // name: struct Chuck_Scope
89105 // desc: scoping structure
@@ -199,8 +215,15 @@ public: · 109 unmodified lines
199215 return (T)val;
200216 }
201217
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+
202225 // 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 )
204227 {
205228 assert( scope.size() != 0 );
206229 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
@@ -213,13 +236,16 @@ public: · 6 unmodified lines
213236 // go through map
214237 for( iter = m->begin(); iter != m->end(); iter++ )
215238 {
239+ // check mangled name
240+ if( !includeMangled && is_mangled( std::string(S_name((*iter).first))) )
241+ continue;
216242 // add
217243 out.push_back( (*iter).second );
218244 }
219245 }
220246
221247 // 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 )
223249 {
224250 assert( scope.size() >= level );
225251 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
@@ -232,12 +258,15 @@ public: · 6 unmodified lines
232258 // go through map
233259 for( iter = m->begin(); iter != m->end(); iter++ )
234260 {
261+ // check mangled name
262+ if( !includeMangled && is_mangled( std::string(S_name((*iter).first))) )
263+ continue;
264+
235265 // add
236266 out.push_back( (*iter).second );
237267 }
238268 }
239269
240−
241270 protected:
242271 std::vector<std::map<S_Symbol, Chuck_VM_Object *> *> scope;
243272 std::map<S_Symbol, Chuck_VM_Object *> commit_map;
@@ -324,7 +353,7 @@ struct Chuck_Namespace : public Chuck_VM_Object · 80 unmodified lines
324353 // get top level values
325354 void get_values( std::vector<Chuck_Value *> & out );
326355 // 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 );
328357 };
329358
330359
@@ -398,10 +427,15 @@ public: · 67 unmodified lines
398427 // constructor
399428 Chuck_Env();
400429
430+public:
431+ // initialize
432+ t_CKBOOL init();
433+
401434 // REFACTOR-2017: carrier and accessors
402435 public:
403436 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; }
405439
406440 protected:
407441 Chuck_Carrier * m_carrier;
@@ -533,12 +567,10 @@ public: · 125 unmodified lines
533567 Chuck_Type * t_uanablob;
534568 Chuck_Type * t_shred;
535569 Chuck_Type * t_io;
536− #ifndef __DISABLE_FILEIO__
537570 Chuck_Type * t_fileio;
538− #endif
539571 Chuck_Type * t_chout;
540572 Chuck_Type * t_cherr;
541− Chuck_Type * t_thread;
573+ // Chuck_Type * t_thread;
542574 Chuck_Type * t_class;
543575 Chuck_Type * t_dac;
544576 Chuck_Type * t_adc;
@@ -583,8 +615,9 @@ struct Chuck_UGen_Info : public Chuck_VM_Object · 38 unmodified lines
583615 //-----------------------------------------------------------------------------
584616 // name: struct Chuck_Type
585617 // desc: class containing information about a type
586−//-----------------------------------------------------------------------------_id
587−struct Chuck_Type : public Chuck_VM_Object
618+// note: 1.5.0.0 (ge) Chuck_VM_Object -> Chuck_Object
619+//-----------------------------------------------------------------------------
620+struct Chuck_Type : public Chuck_Object
588621 {
589622 // type id
590623 te_Type xid;
@@ -620,6 +653,8 @@ struct Chuck_Type : public Chuck_VM_Object · 29 unmodified lines
620653 t_CKBOOL has_destructor;
621654 // custom allocator
622655 f_alloc allocator;
656+ // origin hint
657+ te_Origin originHint;
623658
624659 // documentation
625660 std::string doc;
@@ -839,7 +874,10 @@ t_CKBOOL isfunc( Chuck_Env * env, Chuck_Type * type ); · 213 unmodified lines
839874 t_CKBOOL iskindofint( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: this includes int + pointers
840875 t_CKUINT getkindof( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: to get the kindof a type
841876
877+
878+//-----------------------------------------------------------------------------
842879 // import
880+//-----------------------------------------------------------------------------
843881 Chuck_Type * type_engine_import_class_begin( Chuck_Env * env, Chuck_Type * type,
844882 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor = NULL,
845883 const char * doc = NULL );
@@ -884,7 +922,10 @@ t_CKBOOL type_engine_import_class_end( Chuck_Env * env ); · 38 unmodified lines
884922 t_CKBOOL type_engine_register_deprecate( Chuck_Env * env,
885923 const std::string & former, const std::string & latter );
886924
887−// helpers
925+
926+//-----------------------------------------------------------------------------
927+// helper functions
928+//-----------------------------------------------------------------------------
888929 t_CKBOOL type_engine_check_reserved( Chuck_Env * env, const std::string & xid, int pos );
889930 t_CKBOOL type_engine_check_reserved( Chuck_Env * env, S_Symbol xid, int pos );
890931 // 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
893934 t_CKBOOL type_engine_check_const( Chuck_Env * env, a_Exp e, int pos ); // TODO
894935 t_CKBOOL type_engine_compat_func( a_Func_Def lhs, a_Func_Def rhs, int pos, std::string & err, t_CKBOOL print = TRUE );
895936 t_CKBOOL type_engine_get_deprecate( Chuck_Env * env, const std::string & from, std::string & to );
937+t_CKBOOL type_engine_is_base_static( Chuck_Env * env, Chuck_Type * baseType ); // 1.5.0.0 (ge) added
896938 Chuck_Type * type_engine_find_common_anc( Chuck_Type * lhs, Chuck_Type * rhs );
897939 Chuck_Type * type_engine_find_type( Chuck_Env * env, a_Id_List path );
940+Chuck_Type * type_engine_find_type( Chuck_Env * env, const std::string & name ); // 1.5.0.0 (ge) added
898941 Chuck_Value * type_engine_find_value( Chuck_Type * type, const std::string & xid );
899942 Chuck_Value * type_engine_find_value( Chuck_Type * type, S_Symbol xid );
900943 Chuck_Value * type_engine_find_value( Chuck_Env * env, const std::string & xid, t_CKBOOL climb, int linepos = 0 );
901944 Chuck_Namespace * type_engine_find_nspc( Chuck_Env * env, a_Id_List path );
902−/*******************************************************************************
903− * spencer: added this into function to provide the same logic path
904− * for type_engine_check_exp_decl() and ck_add_mvar() when they determine
905− * offsets for mvars -- added 1.3.0.0
906− ******************************************************************************/
945+
946+
947+//-----------------------------------------------------------------------------
948+// spencer: added this into function to provide the same logic path
949+// for type_engine_check_exp_decl() and ck_add_mvar() when they determine
950+// offsets for mvars -- added 1.3.0.0
951+//-----------------------------------------------------------------------------
907952 t_CKUINT type_engine_next_offset( t_CKUINT current_offset, Chuck_Type * type );
908953 // array verify
909954 t_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
914959 // make type | 1.4.1.1 (nshaheed) added
915960 Chuck_Type * new_array_element_type( Chuck_Env * env, Chuck_Type * base_type,
916961 t_CKUINT depth, Chuck_Namespace * owner_nspc);
962+
963+
964+//-----------------------------------------------------------------------------
917965 // conversion
966+//-----------------------------------------------------------------------------
918967 const char * type_path( a_Id_List path );
919968 a_Id_List str2list( const std::string & path );
920969 a_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
922971 t_CKBOOL escape_str( char * str_lit, int linepos );
923972 t_CKINT str2char( const char * char_lit, int linepos );
924973
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)
979+t_CKBOOL same_arg_lists( a_Arg_List lhs, a_Arg_List rhs );
980+// generate a string from an argument list (types only)
981+std::string arglist2string( a_Arg_List list );
982+
983+
984+//-----------------------------------------------------------------------------
925985 // REFACTOR-2017: exile! these default types now stored in env
986+//-----------------------------------------------------------------------------
926987 //extern Chuck_Type t_void;
927988 //extern Chuck_Type t_int;
928989 //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
9595 // versions higher than 4.1.2 and replaced with the variable
9696 // "StkFloat".
9797 //typedef double StkFloat;
98−//#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
98+//#if defined(__PLATFORM_WIN32__) ||
9999 // #pragma deprecated(MY_FLOAT)
100100 //#else
101101 // typedef StkFloat MY_FLOAT __attribute__ ((deprecated));
@@ -250,7 +250,7 @@ typedef double FLOAT64; · 148 unmodified lines
250250 #if defined(__WINDOWS_PTHREAD__)
251251 #define __OS_WINDOWS_CYGWIN__
252252 #define __STK_REALTIME__
253−#elif defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
253+#elif defined(__PLATFORM_WIN32__)
254254 #define __OS_WINDOWS__
255255 #define __STK_REALTIME__
256256 #elif defined(__PLATFORM_LINUX__)
@@ -497,10 +497,9 @@ class Instrmnt : public Stk · 240 unmodified lines
497497 virtual void controlChange(int number, MY_FLOAT value);
498498
499499 public: // SWAP formerly protected
500+ MY_FLOAT lastOutput;
500501 // chuck
501502 t_CKFLOAT m_frequency;
502−
503− MY_FLOAT lastOutput;
504503 };
505504
506505
@@ -1587,7 +1586,6 @@ class FM : public Instrmnt · 1080 unmodified lines
15871586 MY_FLOAT __FM_gains[100];
15881587 MY_FLOAT __FM_susLevels[16];
15891588 MY_FLOAT __FM_attTimes[32];
1590−
15911589 };
15921590
15931591 #endif
@@ -5195,7 +5193,7 @@ class Sitar : public Instrmnt · 3601 unmodified lines
51955193 The user is responsible for checking the values
51965194 returned by the read/write methods. Values
51975195 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.
51995197
52005198 by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
52015199 */
chuck/include/ulib_ai.h+159−19
@@ -24,17 +24,66 @@ · 23 unmodified lines
2424
2525 //-----------------------------------------------------------------------------
2626 // 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)
2828 //
29−// author: Ge Wang (ge@ccrma.stanford.edu)
30−// Yikai Li (yikaili@stanford.edu)
31−// date: Fall 2022
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
3280 //-----------------------------------------------------------------------------
3381 #ifndef __ULIB_AI_H__
3482 #define __ULIB_AI_H__
3583
3684 #include "chuck_dl.h"
3785 #include "chuck_errmsg.h"
86+#include "util_math.h"
3887
3988
4089
@@ -86,7 +135,7 @@ public: · 45 unmodified lines
86135 if( !m_matrix )
87136 {
88137 // 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",
90139 typeid( T ).name(), xDim, yDim );
91140 // bail
92141 return FALSE;
@@ -106,18 +155,22 @@ public: · 13 unmodified lines
106155 if( x < 0 || x >= m_xDim || y < 0 || y >= m_yDim )
107156 {
108157 // 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",
110159 typeid( T ).name(), x, y );
111160 // halt
112161 // TODO: this should throw (a shred-level, probably) exception
113162 assert( FALSE );
114163 }
115164
116− // NOTE: this is NOT bound-checked!!!
117− // NOTE: yet, this is arguably no worse than using c 2d arrays
118165 return m_matrix[x * m_yDim + y];
119166 }
120167
168+ // overloaded operator
169+ T & operator()( t_CKINT x, t_CKINT y )
170+ {
171+ return v( x, y );
172+ }
173+
121174 // get dimensions
122175 t_CKINT xDim() const
123176 { return m_xDim; }
@@ -138,9 +191,6 @@ protected: · 14 unmodified lines
138191 t_CKINT m_yDim;
139192 };
140193
141−
142−
143−
144194 //-----------------------------------------------------------------------------
145195 // name: class ChaiVectorFast | 1.4.2.0 (ge) added
146196 // desc: a templated fast access but not bound-checked 1D array
@@ -185,7 +235,7 @@ public: · 38 unmodified lines
185235 if( !m_vector )
186236 {
187237 // error
188− CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast allocation failure: %s[%d]...",
238+ CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast allocation failure: %s[%d]...\n",
189239 typeid( T ).name(), length );
190240 // bail
191241 return FALSE;
@@ -197,30 +247,69 @@ public: · 5 unmodified lines
197247 return TRUE;
198248 }
199249
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+
200263 t_CKUINT length()
201264 { return m_length; }
202265
203266 t_CKINT size()
204267 { return m_length; }
205268
206− // get element value
207− T & v( t_CKINT i )
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 )
208293 {
209294 // at least do a check
210295 if( i < 0 || i >= m_length )
211296 {
212297 // error
213− CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast out of bound: %s[%d]...",
214− typeid( T ).name(), i );
298+ CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast out of bound: %s[%d] (capacity=%d)...\n",
299+ typeid( T ).name(), i, m_length );
215300 // TODO: this should throw (a shred-level, probably) exception
216301 assert( FALSE );
217302 }
218303
219− // NOTE: this is NOT bound-checked!!!
220− // NOTE: yet, this is arguably no worse than using c arrays
221304 return m_vector[i];
222305 }
223306
307+ // get element value
308+ T & v( t_CKINT i )
309+ {
310+ return ( *this )[i];
311+ }
312+
224313 void cleanup()
225314 {
226315 // reclaim array memory and zero the pointer
@@ -229,9 +318,60 @@ public: · 2 unmodified lines
229318 m_length = 0;
230319 }
231320
232−protected:
321+public:
233322 T * m_vector;
234323 t_CKINT m_length;
235324 };
236325
237326 #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+
338+typedef 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+
346+typedef 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+
355+typedef 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+
370+struct kdtree * kdtree_init( t_CKINT dim );
371+void kdtree_insert( struct kdtree * tree, double * coord );
372+void kdtree_rebuild( struct kdtree * tree );
373+void kdtree_knn_search( struct kdtree * tree, double * coord, t_CKINT k );
374+void kdtree_destroy( struct kdtree * tree );
375+void 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
4242
4343 // query
4444 DLL_QUERY machine_query( Chuck_DL_Query * QUERY );
45+
46+#ifndef __DISABLE_OTF_SERVER__
4547 typedef t_CKUINT (* proc_msg_func)( Chuck_VM *, Chuck_Compiler *,
4648 Net_Msg *, t_CKBOOL, void * );
4749 t_CKBOOL machine_init( Chuck_Compiler * compiler, proc_msg_func func );
4850 // 1.4.0.1: TODO: refactor out of ulib machine; not all platforms have OTF
51+#endif // __DISABLE_OTF_SERVER__
52+
53+// machine exports
4954 t_CKUINT machine_intsize();
5055
5156
52−// exports
53−CK_DLL_SFUN( machine_crash_impl );
54−CK_DLL_SFUN( machine_add_impl );
55−CK_DLL_SFUN( machine_spork_impl );
56−CK_DLL_SFUN( machine_remove_impl );
57−CK_DLL_SFUN( machine_replace_impl );
58−CK_DLL_SFUN( machine_status_impl );
59−CK_DLL_SFUN( machine_intsize_impl );
60−CK_DLL_SFUN( machine_shreds_impl );
61−CK_DLL_SFUN( machine_realtime_impl );
62−CK_DLL_SFUN( machine_silent_impl );
57+// ckdoc query
58+DLL_QUERY ckdoc_query( Chuck_DL_Query * QUERY );
59+
6360
6461
6562 #endif
chuck/include/ulib_math.h+11−0
@@ -90,6 +90,17 @@ CK_DLL_SFUN( srandom_impl ); · 89 unmodified lines
9090
9191 CK_DLL_SFUN( gauss_impl );
9292
93+CK_DLL_SFUN( cossim_impl );
94+CK_DLL_SFUN( cossim3d_impl );
95+CK_DLL_SFUN( cossim4d_impl );
96+
97+CK_DLL_SFUN( euclidean_impl );
98+CK_DLL_SFUN( euclidean3d_impl );
99+CK_DLL_SFUN( euclidean4d_impl );
100+
101+CK_DLL_SFUN( map_impl );
102+CK_DLL_SFUN( map2_impl );
103+
93104
94105
95106
chuck/include/util_hid.h+2−0
@@ -32,6 +32,8 @@ · 31 unmodified lines
3232 #ifndef __UTIL_HID_H__
3333 #define __UTIL_HID_H__
3434
35+#include "chuck_def.h"
36+
3537
3638
3739
chuck/include/util_math.h+2−1
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #define __UTIL_MATH_H__
3535
3636 #include <math.h>
37+#include "chuck_def.h" // 1.4.1.0 (ge) for t_CKINT
3738
3839 #if defined (__cplusplus) || defined(_cplusplus)
3940 extern "C" {
@@ -52,7 +53,7 @@ double ck_remainder( double a, double b ); · 12 unmodified lines
5253
5354
5455 // max for random functions
55−#ifdef __WINDOWS_DS__
56+#ifdef __PLATFORM_WIN32__
5657 #define CK_RANDOM_MAX RAND_MAX
5758 #else
5859 #define CK_RANDOM_MAX 0x7fffffff
chuck/include/util_network.h+1−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
4141 #include <sys/socket.h>
4242 #include <netinet/in.h>
4343 #else
44+#define _WINSOCKAPI_
4445 #include <windows.h>
4546 #endif
4647
chuck/include/util_opsc.h+1−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
4141
4242 // the included files were from the CNMAT OSC-Kit distrib.
4343 #ifdef __PLATFORM_WIN32__
44+#define _WINSOCKAPI_
4445 #include <windows.h>
4546 #endif
4647
chuck/include/util_serial.h+2−0
@@ -32,6 +32,8 @@ · 31 unmodified lines
3232 #ifndef __UTIL_SERIAL_H__
3333 #define __UTIL_SERIAL_H__
3434
35+#include "chuck_def.h"
36+
3537 #include <vector>
3638 #include <string>
3739
chuck/include/util_sndfile.h+7−1
@@ -1748,7 +1748,13 @@ enum · 1747 unmodified lines
17481748 {
17491749 /* keep sorted for wav_w64_format_str() */
17501750 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 */
17521758 WAVE_FORMAT_MS_ADPCM = 0x0002, /* Microsoft ADPCM */
17531759 WAVE_FORMAT_IEEE_FLOAT = 0x0003, /* Micrososft 32 bit float format */
17541760 WAVE_FORMAT_VSELP = 0x0004, /* Compaq Computer Corporation */
chuginate/template/chuck/include/chuck.h+15−17
@@ -1,21 +1,21 @@
11 /*----------------------------------------------------------------------------
22 ChucK Concurrent, On-the-fly Audio Programming Language
33 Compiler and Virtual Machine
4−
4+
55 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.
66 http://chuck.stanford.edu/
77 http://chuck.cs.princeton.edu/
8−
8+
99 This program is free software; you can redistribute it and/or modify
1010 it under the terms of the GNU General Public License as published by
1111 the Free Software Foundation; either version 2 of the License, or
1212 (at your option) any later version.
13−
13+
1414 This program is distributed in the hope that it will be useful,
1515 but WITHOUT ANY WARRANTY; without even the implied warranty of
1616 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1717 GNU General Public License for more details.
18−
18+
1919 You should have received a copy of the GNU General Public License
2020 along with this program; if not, write to the Free Software
2121 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -24,10 +24,10 @@ · 2 unmodified lines
2424
2525 //-----------------------------------------------------------------------------
2626 // file: chuck.h
27−// desc: chuck engine header; VM + compiler + state; no audio I/O
27+// desc: chuck engine header; VM + compiler + state; independent of audio I/O
2828 // REFACTOR-2017
2929 //
30−// author: Ge Wang (http://www.gewang.com/)
30+// author: Ge Wang (https://ccrma.stanford.edu/~ge/)
3131 // date: fall 2017
3232 //
3333 // additional authors:
@@ -99,7 +99,7 @@ public: · 65 unmodified lines
9999 ChucK();
100100 // desctructor
101101 virtual ~ChucK();
102−
102+
103103 public:
104104 // set parameter by name
105105 // -- all params should have reasonable defaults
@@ -115,9 +115,9 @@ public: · 9 unmodified lines
115115
116116 public:
117117 // 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 );
119119 // 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 );
121121
122122 public:
123123 // initialize ChucK (using params)
@@ -127,12 +127,12 @@ public: · 3 unmodified lines
127127
128128 public:
129129 // run engine (call from callback)
130− void run( SAMPLE * input, SAMPLE * output, int numFrames );
130+ void run( SAMPLE * input, SAMPLE * output, t_CKINT numFrames );
131131
132132 public:
133133 // is initialized
134134 bool isInit() { return m_init; }
135−
135+
136136 public:
137137 // additional native chuck bindings/types (use with extra caution)
138138 bool bind( f_ck_query queryFunc, const std::string & name );
@@ -175,12 +175,10 @@ protected: · 36 unmodified lines
175175 public: // static functions
176176 // chuck version
177177 static const char * version();
178− #ifndef __DISABLE_OTF_SERVER__
179178 // chuck int size (in bits)
180− // (this depends on machine, which depends on OTF, so
181− // disable it if we don't have OTF)
179+ // (this depends on machine, which depends on OTF, so disable it if we don't have OTF)
180+ // 1.5.0.0 (ge) | reinstated for non-OTF, along with parts of machine
182181 static t_CKUINT intSize();
183− #endif
184182 // number of ChucK's
185183 static t_CKUINT numVMs() { return o_numVMs; };
186184 // --poop compatibilty
@@ -197,7 +195,7 @@ protected: · 10 unmodified lines
197195 static const char VERSION[];
198196 // number of VMs -- managed from VM constructor/destructors
199197 static t_CKUINT o_numVMs;
200−
198+
201199 protected:
202200 // initialize default params
203201 void initDefaultParams();
@@ -209,7 +207,7 @@ protected: · 5 unmodified lines
209207 bool initChugins();
210208 // init OTF programming system
211209 bool initOTF();
212−
210+
213211 protected:
214212 // core elements: compiler, VM, etc.
215213 Chuck_Carrier * m_carrier;
chuginate/template/chuck/include/chuck.tab.h+1−1
@@ -266,7 +266,7 @@ · 265 unmodified lines
266266
267267 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
268268 typedef union YYSTYPE
269−#line 62 "chuck.y"
269+#line 65 "chuck.y"
270270 {
271271 int pos;
272272 int ival;
chuginate/template/chuck/include/chuck_absyn.h+15−14
@@ -52,7 +52,7 @@ typedef enum { · 51 unmodified lines
5252 ae_op_s_or_chuck, ae_op_s_xor_chuck, ae_op_shift_right_chuck,
5353 ae_op_shift_left_chuck, ae_op_percent_chuck, ae_op_s_chuck,
5454 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,
5656 ae_op_typeof, ae_op_sizeof, ae_op_new, ae_op_arrow_left, ae_op_arrow_right
5757 } ae_Operator;
5858
@@ -118,7 +118,7 @@ typedef struct a_Vec_ * a_Vec; // ge: added 1.3.5.3 · 59 unmodified lines
118118
119119 // forward reference for type
120120 typedef struct Chuck_Type * t_CKTYPE;
121−typedef struct Chuck_Value * t_CKVALUE;
121+typedef struct Chuck_Value * t_CKVALUE;
122122 typedef struct Chuck_Func * t_CKFUNC;
123123 typedef struct Chuck_Namespace * t_CKNSPC;
124124 typedef 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
226226 t_CKTYPE ck_type; int linepos; a_Exp self; };
227227 struct a_Exp_Hack_ { a_Exp exp; int linepos; a_Exp self; };
228228 struct 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];)
229230 struct 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; };
231232 struct a_Type_Decl_ { a_Id_List xid; a_Array_Sub array; int ref; int linepos; /*a_Exp self;*/ };
232−struct a_Array_Sub_ { t_CKUINT depth; a_Exp exp_list; int linepos; a_Exp self;
233+struct a_Array_Sub_ { t_CKUINT depth; a_Exp exp_list; int linepos; a_Exp self;
233234 int err_num; int err_pos; };
234235 struct a_Arg_List_ { a_Type_Decl type_decl; a_Var_Decl var_decl; t_CKTYPE type;
235236 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
238239 struct a_Vec_ { a_Exp args; int numdims; int linepos; a_Exp self; }; // ge: added 1.3.5.3
239240
240241 // enum primary exp type
241−typedef enum { ae_primary_var, ae_primary_num, ae_primary_float,
242+typedef enum { ae_primary_var, ae_primary_num, ae_primary_float,
242243 ae_primary_str, ae_primary_array, ae_primary_exp,
243244 ae_primary_hack, ae_primary_complex, ae_primary_polar,
244245 ae_primary_vec, ae_primary_char, ae_primary_nil
@@ -248,7 +249,7 @@ struct a_Exp_Primary_ · 3 unmodified lines
248249 {
249250 ae_Exp_Primary_Type s_type;
250251 t_CKVALUE value;
251−
252+
252253 union
253254 {
254255 S_Symbol var;
@@ -286,7 +287,7 @@ struct a_Exp_ · 31 unmodified lines
286287 t_CKUINT group_size;
287288 t_CKTYPE cast_to;
288289 t_CKUINT emit_var; // 1 = emit var, 2 = emit var and value
289−
290+
290291 union
291292 {
292293 struct a_Exp_Binary_ binary;
@@ -320,15 +321,15 @@ struct a_Stmt_GotoLabel_ { S_Symbol name; int linepos; a_Stmt self; }; · 27 unmodified lines
320321
321322 // enum values for stmt type
322323 typedef 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,
324325 ae_stmt_continue, ae_stmt_return, ae_stmt_case, ae_stmt_gotolabel
325326 } ae_Stmt_Type;
326−
327+
327328 struct a_Stmt_
328329 {
329330 ae_Stmt_Type s_type;
330331 int skip;
331−
332+
332333 union
333334 {
334335 a_Exp stmt_exp;
@@ -350,7 +351,7 @@ struct a_Stmt_ · 15 unmodified lines
350351 };
351352
352353 struct a_Stmt_List_ { a_Stmt stmt; a_Stmt_List next; int linepos; };
353−struct a_Class_Def_ { ae_Keyword decl; a_Id_List name; a_Class_Ext ext;
354+struct a_Class_Def_ { ae_Keyword decl; a_Id_List name; a_Class_Ext ext;
354355 a_Class_Body body; t_CKTYPE type; int iface; t_CKNSPC home;
355356 int linepos; };
356357 struct 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
363364 // struct t_Func_BuiltIn_ { builtin_func_ptr func_ptr; int linepos; };
364365 struct a_Func_Def_ {
365366 ae_Keyword func_decl;
366− ae_Keyword static_decl;
367+ ae_Keyword static_decl;
367368 a_Type_Decl type_decl;
368369 t_CKTYPE ret_type;
369− S_Symbol name;
370+ S_Symbol name;
370371 a_Arg_List arg_list;
371372 a_Stmt code;
372373 t_CKFUNC ck_func;
@@ -384,7 +385,7 @@ typedef enum { ae_section_stmt, ae_section_func, ae_section_class · 11 unmodified lines
384385 struct a_Section_
385386 {
386387 ae_Section_Type s_type;
387−
388+
388389 union
389390 {
390391 a_Stmt_List stmt_list;
chuginate/template/chuck/include/chuck_carrier.h+8−8
@@ -1,21 +1,21 @@
11 /*----------------------------------------------------------------------------
22 ChucK Concurrent, On-the-fly Audio Programming Language
33 Compiler and Virtual Machine
4−
4+
55 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.
66 http://chuck.stanford.edu/
77 http://chuck.cs.princeton.edu/
8−
8+
99 This program is free software; you can redistribute it and/or modify
1010 it under the terms of the GNU General Public License as published by
1111 the Free Software Foundation; either version 2 of the License, or
1212 (at your option) any later version.
13−
13+
1414 This program is distributed in the hope that it will be useful,
1515 but WITHOUT ANY WARRANTY; without even the implied warranty of
1616 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1717 GNU General Public License for more details.
18−
18+
1919 You should have received a copy of the GNU General Public License
2020 along with this program; if not, write to the Free Software
2121 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -75,20 +75,20 @@ struct Chuck_Carrier · 53 unmodified lines
7575 Chuck_VM * vm;
7676 Chuck_IO_Chout * chout;
7777 Chuck_IO_Cherr * cherr;
78−
78+
7979 #ifndef __DISABLE_OTF_SERVER__
8080 // OTF programming things
8181 ck_socket otf_socket;
8282 t_CKINT otf_port;
8383 CHUCK_THREAD otf_thread;
8484 #endif
85−
85+
8686 // STK-specific
8787 #ifndef __DISABLE_WVOUT__
8888 XWriteThread * stk_writeThread;
8989 std::map<WvOut *, WvOut *> stk_wvOutMap;
9090 #endif
91−
91+
9292 // constructor
9393 Chuck_Carrier() :
9494 chuck(NULL),
@@ -107,7 +107,7 @@ struct Chuck_Carrier · 12 unmodified lines
107107 cherr( NULL )
108108
109109 { }
110−
110+
111111 // get hint: is realtime audio?
112112 t_CKBOOL hintIsRealtimeAudio();
113113 };
chuginate/template/chuck/include/chuck_compile.h+23−11
@@ -56,7 +56,7 @@ struct Chuck_Compiler · 55 unmodified lines
5656 protected: // data
5757 // carrier
5858 Chuck_Carrier * m_carrier;
59−
59+
6060 public: // get protected data
6161 // REFACTOR-2017: get associated, per-compiler environment
6262 Chuck_Env * env() const { return m_carrier->env; }
@@ -67,7 +67,6 @@ public: // get protected data · 4 unmodified lines
6767 // set carrier
6868 t_CKBOOL setCarrier( Chuck_Carrier * c ) { m_carrier = c; return TRUE; }
6969
70−
7170 public: // data
7271 // emitter
7372 Chuck_Emitter * emitter;
@@ -78,10 +77,16 @@ public: // data · 4 unmodified lines
7877 t_CKBOOL m_auto_depend;
7978 // recent map
8079 std::map<std::string, Chuck_Context *> m_recent;
81−
80+
81+ // chugins
8282 std::list<Chuck_DLL *> m_dlls;
83+ // libraries (ck code) to import
8384 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+
8590 public: // to all
8691 // contructor
8792 Chuck_Compiler();
@@ -89,8 +94,7 @@ public: // to all · 1 unmodified line
8994 virtual ~Chuck_Compiler();
9095
9196 // initialize
92− t_CKBOOL initialize( std::list<std::string> & chugin_search_paths,
93− std::list<std::string> & named_dls );
97+ t_CKBOOL initialize();
9498 // shutdown
9599 void shutdown();
96100
@@ -103,22 +107,27 @@ public: // compile · 6 unmodified lines
103107 // set auto depend
104108 void set_auto_depend( t_CKBOOL v );
105109 // 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,
107111 const char * str_src = NULL, const std::string & full_path = "" );
108112 // resolve a type automatically, if auto_depend is on
109113 t_CKBOOL resolve( const std::string & type );
110114 // get the code generated from the last go()
111115 Chuck_VM_Code * output( );
112116
113−public: // replace-dac | added 1.4.1.0 (jack)
117+public: // replace-dac | added 1.4.1.0 (jack)
114118 // sets a "replacement dac": one global UGen is secretly used
115119 // as a stand-in for "dac" for this compilation;
116120 // for example, ChuckSubInstances in Chunity use a global Gain as a
117121 // 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
119123 // of a new sample sucker.
120124 void setReplaceDac( t_CKBOOL shouldReplaceDac, const std::string & replacement );
121125
126+public: // 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+
122131 protected: // internal
123132 // do entire file
124133 t_CKBOOL do_entire_file( Chuck_Context * context );
@@ -127,8 +136,11 @@ protected: // internal · 2 unmodified lines
127136 // do all excect classes
128137 t_CKBOOL do_all_except_classes( Chuck_Context * context );
129138 // do normal compile
130− t_CKBOOL do_normal( const std::string & path, FILE * fd = NULL,
131− const char * str_src = NULL, const std::string & full_path = "" );
139+ t_CKBOOL do_normal_depend( const std::string & path, FILE * fd = NULL,
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 = "" );
132144 // look up in recent
133145 Chuck_Context * find_recent_path( const std::string & path );
134146 // 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
104104
105105 // kinds (added 1.3.1.0 to faciliate 64-bit support)
106106 // to differentiate in case int and float have same size
107−#define kindof_VOID 0
108−#define kindof_INT 1
109−#define kindof_FLOAT 2
110−#define kindof_COMPLEX 3
111−#define kindof_VEC3 4
112−#define kindof_VEC4 5
107+#define kindof_VOID 0
108+#define kindof_INT 1
109+#define kindof_FLOAT 2
110+#define kindof_COMPLEX 3
111+#define kindof_VEC3 4
112+#define kindof_VEC4 5
113113
114114 typedef char * c_str;
115115 typedef const char * c_constr;
@@ -140,6 +140,9 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 24 unmodified lines
140140 #define FALSE 0
141141 #endif
142142
143+// special non-zero value to denote "no value" | added 1.4.2.0 (ge)
144+#define CK_NO_VALUE 0xffffffff
145+
143146 // 3.1415926535897932384626433832795028841971693993751058209749445...
144147 #define ONE_PI (3.14159265358979323846)
145148 #define TWO_PI (2.0 * ONE_PI)
@@ -151,6 +154,8 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 5 unmodified lines
151154 #define SAFE_RELEASE(x) do { if(x){ x->release(); x = NULL; } } while(0)
152155 #define SAFE_ADD_REF(x) do { if(x){ x->add_ref(); } } while(0)
153156 #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)
154159 #endif
155160
156161 // max + min
@@ -188,7 +193,12 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 31 unmodified lines
188193
189194 #ifdef __PLATFORM_WIN32__
190195 #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__)
192202 #endif
193203 #pragma warning (disable : 4996) // stdio deprecation
194204 #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
154154
155155
156156 // chuck dll export linkage and calling convention
157−#if defined (__PLATFORM_WIN32__)
157+#if defined (__PLATFORM_WIN32__)
158158 #define CK_DLL_LINKAGE extern "C" __declspec( dllexport )
159159 #else
160− #define CK_DLL_LINKAGE extern "C"
161−#endif
160+ #define CK_DLL_LINKAGE extern "C"
161+#endif
162162
163163 // calling convention of functions provided by chuck to the dll
164−#if defined(__WINDOWS_DS__)
164+#if defined(__PLATFORM_WIN32__)
165165 #define CK_DLL_CALL _cdecl
166166 #else
167167 #define CK_DLL_CALL
@@ -183,7 +183,7 @@ typedef const Chuck_DL_Api::Api *CK_DL_API; · 15 unmodified lines
183183 // example: CK_DLL_QUERY
184184 #ifndef __CK_DLL_STATIC__
185185 #define CK_DLL_QUERY(name) CK_DLL_DECLVERSION CK_DLL_EXPORT(t_CKBOOL) ck_query( Chuck_DL_Query * QUERY )
186−#else
186+#else
187187 #define CK_DLL_QUERY(name) CK_DLL_QUERY_STATIC(name)
188188 #endif // __CK_DLL_STATIC__
189189 // macro for defining ChucK DLL export allocator
@@ -382,13 +382,13 @@ public: · 192 unmodified lines
382382
383383 // re-added 1.4.0.1
384384 f_create_main_thread_hook create_main_thread_hook;
385−
385+
386386 // NOTE: everything below std::anything cannot be reliably accessed
387387 // by offset between dynamic modules, since std::anything could be variable
388388 // size -- put everything need to be accessed across modules above here!
389389 // discovered by the vigilant and forever traumatized Jack Atherton,
390390 // fixed during REFACTOR-2017; warning by the guilt-ridden Ge Wang
391−
391+
392392 // dll
393393 Chuck_DLL * dll_ref;
394394 // reserved
@@ -410,7 +410,7 @@ public: · 15 unmodified lines
410410 std::vector<Chuck_DL_Class *> classes;
411411 // stack
412412 std::vector<Chuck_DL_Class * >stack;
413−
413+
414414 // constructor
415415 Chuck_DL_Query( Chuck_Carrier * carrier );
416416 // desctructor
@@ -458,12 +458,12 @@ struct Chuck_DL_Class · 41 unmodified lines
458458 std::vector<Chuck_DL_Class *> classes;
459459 // current mvar offset
460460 t_CKUINT current_mvar_offset;
461−
461+
462462 t_CKUINT ugen_num_in, ugen_num_out;
463−
463+
464464 std::string doc;
465465 std::vector<std::string> examples;
466−
466+
467467 // constructor
468468 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; }
469469 // destructor
@@ -515,7 +515,7 @@ struct Chuck_DL_Func · 45 unmodified lines
515515 std::vector<Chuck_DL_Value *> args;
516516 // description
517517 std::string doc;
518−
518+
519519 // constructor
520520 Chuck_DL_Func() { ctor = NULL; }
521521 Chuck_DL_Func( const char * t, const char * n, t_CKUINT a )
@@ -580,7 +580,7 @@ union Chuck_DL_Return · 58 unmodified lines
580580 t_CKVEC4 v_vec4; // ge: added 1.3.5.3
581581 Chuck_Object * v_object;
582582 Chuck_String * v_string;
583−
583+
584584 Chuck_DL_Return() { v_vec4.x = v_vec4.y = v_vec4.z = v_vec4.w = 0; }
585585 };
586586
@@ -595,7 +595,7 @@ struct Chuck_DLL : public Chuck_VM_Object · 8 unmodified lines
595595 {
596596 public:
597597 // load dynamic ckx/dll from filename
598− t_CKBOOL load( const char * filename,
598+ t_CKBOOL load( const char * filename,
599599 const char * func = CK_QUERY_FUNC,
600600 t_CKBOOL lazy = FALSE );
601601 t_CKBOOL load( f_ck_query query_func, t_CKBOOL lazy = FALSE );
@@ -611,7 +611,7 @@ public: · 9 unmodified lines
611611 t_CKBOOL good() const;
612612 // name
613613 const char * name() const;
614−
614+
615615 public:
616616 // constructor
617617 Chuck_DLL( Chuck_Carrier * carrier, const char * xid = NULL )
@@ -644,7 +644,7 @@ public: · 26 unmodified lines
644644 void * bindle, Chuck_Carrier * carrier);
645645 t_CKBOOL (* const activate)(Chuck_DL_MainThreadHook *);
646646 t_CKBOOL (* const deactivate)(Chuck_DL_MainThreadHook *);
647−
647+
648648 Chuck_Carrier * const m_carrier;
649649 f_mainthreadhook const m_hook;
650650 f_mainthreadquit const m_quit;
@@ -665,45 +665,49 @@ struct Api · 14 unmodified lines
665665 public:
666666 static Api g_api;
667667 static inline const Api * instance() { return &g_api; }
668−
668+
669669 struct VMApi
670670 {
671671 VMApi();
672672 t_CKUINT (* const get_srate)( CK_DL_API, Chuck_VM_Shred * );
673673 } * const vm;
674−
674+
675675 struct ObjectApi
676676 {
677677 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:
679683 // 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 );
681685 // function pointer create()
682686 Object (* const create)( CK_DL_API, Chuck_VM_Shred *, Type type );
683687 // 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 );
685689 // function pointers for get_mvar_*()
686− t_CKBOOL (* const get_mvar_int)( CK_DL_API, Object object, std::string &name, t_CKINT &value );
687− t_CKBOOL (* const get_mvar_float)( CK_DL_API, Object object, std::string &name, t_CKFLOAT &value );
688− t_CKBOOL (* const get_mvar_dur)( CK_DL_API, Object object, std::string &name, t_CKDUR &value );
689− t_CKBOOL (* const get_mvar_time)( CK_DL_API, Object object, std::string &name, t_CKTIME &value );
690− t_CKBOOL (* const get_mvar_string)( CK_DL_API, Object object, std::string &name, String &value );
691− t_CKBOOL (* const get_mvar_object)( CK_DL_API, Object object, std::string &name, Object &value );
690+ t_CKBOOL (* const get_mvar_int)( CK_DL_API, Object object, const char * name, t_CKINT & value );
691+ t_CKBOOL (* const get_mvar_float)( CK_DL_API, Object object, const char * name, t_CKFLOAT & value );
692+ t_CKBOOL (* const get_mvar_dur)( CK_DL_API, Object object, const char * name, t_CKDUR & value );
693+ t_CKBOOL (* const get_mvar_time)( CK_DL_API, Object object, const char * name, t_CKTIME & value );
694+ t_CKBOOL (* const get_mvar_string)( CK_DL_API, Object object, const char * name, String & value );
695+ t_CKBOOL (* const get_mvar_object)( CK_DL_API, Object object, const char * name, Object & value );
692696 // 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 );
694698 } * const object;
695−
699+
696700 Api() :
697701 vm(new VMApi),
698702 object(new ObjectApi)
699703 { }
700−
704+
701705 private:
702706 Api( Api & a ) :
703707 vm(a.vm),
704708 object(a.object)
705709 { assert(0); };
706−
710+
707711 Api & operator=( Api & a ) { assert(0); return a; }
708712 };
709713 }
@@ -720,31 +724,33 @@ private: · 10 unmodified lines
720724
721725 #error ChucK not support on Mac OS X 10.3 or lower
722726
723−#elif defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
724−
725− #ifdef __cplusplus
726− extern "C" {
727− #endif
728−
729− #define RTLD_LAZY 0x1
730− #define RTLD_NOW 0x2
731− #define RTLD_LOCAL 0x4
732− #define RTLD_GLOBAL 0x8
733− #define RTLD_NOLOAD 0x10
734− #define RTLD_SHARED 0x20 /* not used, the default */
735− #define RTLD_UNSHARED 0x40
736− #define RTLD_NODELETE 0x80
737− #define RTLD_LAZY_UNDEF 0x100
738−
739− void * dlopen( const char * path, int mode );
740− void * dlsym( void * handle, const char * symbol );
741− const char * dlerror( void );
742− int dlclose( void * handle );
743− static char dlerror_buffer[128];
744−
745− #ifdef __cplusplus
746− }
747− #endif
727+#elif defined(__PLATFORM_WIN32__)
728+
729+ #ifdef __cplusplus
730+ extern "C" {
731+ #endif
732+
733+ #define RTLD_LAZY 0x1
734+ #define RTLD_NOW 0x2
735+ #define RTLD_LOCAL 0x4
736+ #define RTLD_GLOBAL 0x8
737+ #define RTLD_NOLOAD 0x10
738+ #define RTLD_SHARED 0x20 /* not used, the default */
739+ #define RTLD_UNSHARED 0x40
740+ #define RTLD_NODELETE 0x80
741+ #define RTLD_LAZY_UNDEF 0x100
742+
743+ void * dlopen( const char * path, int mode );
744+ void * dlsym( void * handle, const char * symbol );
745+ const char * dlerror( void );
746+ int dlclose( void * handle );
747+ // 1.4.2.0 (ge) | added DLERROR_BUFFER_LENGTH
748+ #define DLERROR_BUFFER_LENGTH 128
749+ static char dlerror_buffer[DLERROR_BUFFER_LENGTH];
750+
751+ #ifdef __cplusplus
752+ }
753+ #endif
748754
749755 #else
750756 #include "dlfcn.h"
chuginate/template/chuck/include/chuck_emit.h+7−5
@@ -74,10 +74,10 @@ public: · 73 unmodified lines
7474 std::vector<Chuck_Instr_Goto *> stack_break;
7575 // return stack
7676 std::vector<Chuck_Instr_Goto *> stack_return;
77−
77+
7878 // filename this code came from (added 1.3.0.0)
7979 std::string filename;
80−
80+
8181 // constructor
8282 Chuck_Code( )
8383 {
@@ -122,7 +122,7 @@ struct Chuck_Emitter : public Chuck_VM_Object · 38 unmodified lines
122122
123123 // constructor
124124 Chuck_Emitter()
125− { env = NULL; code = NULL; context = NULL;
125+ { env = NULL; code = NULL; context = NULL;
126126 nspc = NULL; func = NULL; dump = FALSE;
127127 should_replace_dac = FALSE; }
128128
@@ -148,11 +148,13 @@ struct Chuck_Emitter : public Chuck_VM_Object · 19 unmodified lines
148148 // add references to locals on current scope (added 1.3.0.0)
149149 void addref_on_scope();
150150 // 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();
152154
153155 // default durations
154156 t_CKBOOL find_dur( const std::string & name, t_CKDUR * out );
155−
157+
156158 // post REFACTOR-2017: replace-dac
157159 std::string dac_replacement;
158160 t_CKBOOL should_replace_dac;
chuginate/template/chuck/include/chuck_errmsg.h+9−9
@@ -43,17 +43,17 @@ extern "C" { · 42 unmodified lines
4343
4444
4545 extern t_CKBOOL EM_anyErrors;
46−extern int EM_tokPos;
47−extern int EM_lineNum;
46+extern t_CKINT EM_tokPos;
47+extern t_CKINT EM_lineNum;
4848
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
5050 // with scanner/typechecker (EM_lineNum is not synced with scanner/typechecker)
51−extern int EM_extLineNum;
51+extern t_CKINT EM_extLineNum;
5252
5353 void EM_newline( );
5454
5555 // levels
56−#define CK_LOG_CRAZY 10 // set this to log everything
56+#define CK_LOG_ALL 10 // set this to log everything
5757 #define CK_LOG_FINEST 9
5858 #define CK_LOG_FINER 8
5959 #define CK_LOG_FINE 7
@@ -155,9 +155,9 @@ extern t_CKINT g_loglevel; · 95 unmodified lines
155155 // macro to compare
156156 #define DO_LOG(x) ( x <= g_loglevel )
157157
158−void EM_error( int, c_constr, ... );
159−void EM_error2( int, c_constr, ... );
160−void EM_error2b( int, c_constr, ... );
158+void EM_error( t_CKINT, c_constr, ... );
159+void EM_error2( t_CKINT, c_constr, ... );
160+void EM_error2b( t_CKINT, c_constr, ... );
161161 void EM_error3( c_constr, ... );
162162 void EM_impossible( c_constr, ... );
163163 t_CKBOOL EM_reset( c_constr filename, FILE * fd );
@@ -190,7 +190,7 @@ public: · 26 unmodified lines
190190 {
191191 EM_pushlog();
192192 }
193−
193+
194194 ~SmartPushLog()
195195 {
196196 EM_poplog();
chuginate/template/chuck/include/chuck_frame.h+1−1
@@ -92,7 +92,7 @@ public: · 91 unmodified lines
9292 Chuck_Local * alloc_local( t_CKUINT size, const std::string & name,
9393 t_CKBOOL is_ref, t_CKBOOL is_obj, t_CKBOOL is_global );
9494 // 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;
9696 // pop scope
9797 void pop_scope( std::vector<Chuck_Local *> & out );
9898 };
chuginate/template/chuck/include/chuck_globals.h+21−21
@@ -164,7 +164,7 @@ struct Chuck_Global_Request · 163 unmodified lines
164164 // chuck_msg
165165 Chuck_Execute_Chuck_Msg_Request* executeChuckMsgRequest;
166166 };
167−
167+
168168 Chuck_Global_Request()
169169 {
170170 retries = 0;
@@ -183,7 +183,7 @@ struct Chuck_Globals_Manager · 12 unmodified lines
183183 public:
184184 Chuck_Globals_Manager( Chuck_VM * vm );
185185 ~Chuck_Globals_Manager();
186−
186+
187187 public:
188188 // REFACTOR-2017: externally accessible + global variables.
189189 // use these getters and setters from outside the audio thread
@@ -191,17 +191,17 @@ public: · 1 unmodified line
191191 t_CKBOOL getGlobalInt( const char * name, void (*callback)(const char*, t_CKINT) );
192192 t_CKBOOL getGlobalInt( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, t_CKINT) );
193193 t_CKBOOL setGlobalInt( const char * name, t_CKINT val );
194−
194+
195195 t_CKBOOL getGlobalFloat( const char * name, void (*callback)(t_CKFLOAT) );
196196 t_CKBOOL getGlobalFloat( const char * name, void (*callback)(const char*, t_CKFLOAT) );
197197 t_CKBOOL getGlobalFloat( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, t_CKFLOAT) );
198198 t_CKBOOL setGlobalFloat( const char * name, t_CKFLOAT val );
199−
199+
200200 t_CKBOOL getGlobalString( const char * name, void (*callback)(const char*) );
201201 t_CKBOOL getGlobalString( const char * name, void (*callback)(const char*, const char*) );
202202 t_CKBOOL getGlobalString( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, const char*) );
203203 t_CKBOOL setGlobalString( const char * name, const char * val );
204−
204+
205205 t_CKBOOL signalGlobalEvent( const char * name );
206206 t_CKBOOL broadcastGlobalEvent( const char * name );
207207 t_CKBOOL listenForGlobalEvent( const char * name, void (*callback)(void), t_CKBOOL listen_forever );
@@ -210,9 +210,9 @@ public: · 2 unmodified lines
210210 t_CKBOOL stopListeningForGlobalEvent( const char * name, void (*callback)(void) );
211211 t_CKBOOL stopListeningForGlobalEvent( const char * name, void (*callback)(const char*) );
212212 t_CKBOOL stopListeningForGlobalEvent( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT) );
213−
213+
214214 t_CKBOOL getGlobalUGenSamples( const char * name, SAMPLE* buffer, int numFrames );
215−
215+
216216 t_CKBOOL setGlobalIntArray( const char * name, t_CKINT arrayValues[], t_CKUINT numValues );
217217 t_CKBOOL getGlobalIntArray( const char * name, void (*callback)(t_CKINT[], t_CKUINT) );
218218 t_CKBOOL getGlobalIntArray( const char * name, void (*callback)(const char*, t_CKINT[], t_CKUINT) );
@@ -225,7 +225,7 @@ public: · 6 unmodified lines
225225 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, const char * key, void (*callback)(t_CKINT) );
226226 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, const char * key, void (*callback)(const char*, t_CKINT) );
227227 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, t_CKINT callbackID, const char * key, void (*callback)(t_CKINT, t_CKINT) );
228−
228+
229229 t_CKBOOL setGlobalFloatArray( const char * name, t_CKFLOAT arrayValues[], t_CKUINT numValues );
230230 t_CKBOOL getGlobalFloatArray( const char * name, void (*callback)(t_CKFLOAT[], t_CKUINT) );
231231 t_CKBOOL getGlobalFloatArray( const char * name, void (*callback)(const char*, t_CKFLOAT[], t_CKUINT) );
@@ -238,11 +238,11 @@ public: · 6 unmodified lines
238238 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, const char * key, void (*callback)(t_CKFLOAT) );
239239 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, const char * key, void (*callback)(const char*, t_CKFLOAT) );
240240 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, t_CKINT callbackID, const char * key, void (*callback)(t_CKINT, t_CKFLOAT) );
241−
241+
242242 public:
243243 // run Chuck_Msg in the globals order
244244 t_CKBOOL execute_chuck_msg_with_globals( Chuck_Msg* msg );
245−
245+
246246 public:
247247 // REFACTOR-2017: externally accessible + global variables.
248248 // WARNING: these internal functions are to be used only by other
@@ -250,25 +250,25 @@ public: · 1 unmodified line
250250 t_CKBOOL init_global_int( const std::string & name );
251251 t_CKINT get_global_int_value( const std::string & name );
252252 t_CKINT* get_ptr_to_global_int( const std::string & name );
253−
253+
254254 t_CKBOOL init_global_float( const std::string & name );
255255 t_CKFLOAT get_global_float_value( const std::string & name );
256256 t_CKFLOAT* get_ptr_to_global_float( const std::string & name );
257−
257+
258258 t_CKBOOL init_global_string( const std::string & name );
259259 Chuck_String* get_global_string( const std::string & name );
260260 Chuck_String** get_ptr_to_global_string( const std::string & name );
261−
261+
262262 t_CKBOOL init_global_event( const std::string & name, Chuck_Type* type );
263263 Chuck_Event* get_global_event( const std::string & name );
264264 Chuck_Event** get_ptr_to_global_event( const std::string & name );
265−
265+
266266 t_CKBOOL init_global_ugen( const std::string & name, Chuck_Type* type );
267267 t_CKBOOL is_global_ugen_init( const std::string & name );
268268 t_CKBOOL is_global_ugen_valid( const std::string & name );
269269 Chuck_UGen* get_global_ugen( const std::string & name );
270270 Chuck_UGen** get_ptr_to_global_ugen( const std::string & name );
271−
271+
272272 t_CKBOOL init_global_array( const std::string & name, Chuck_Type* type, te_GlobalType arr_type );
273273 Chuck_Object* get_global_array( const std::string & name );
274274 Chuck_Object** get_ptr_to_global_array( const std::string & name );
@@ -282,24 +282,24 @@ public: · 7 unmodified lines
282282 t_CKBOOL is_global_object_valid( const std::string & name );
283283 Chuck_Object* get_global_object( const std::string & name );
284284 Chuck_Object** get_ptr_to_global_object( const std::string & name );
285−
285+
286286 t_CKBOOL should_call_global_ctor( const std::string & name, te_GlobalType type );
287287 void global_ctor_was_called( const std::string & name, te_GlobalType type );
288−
288+
289289 // global variables -- clean up
290290 void cleanup_global_variables();
291−
291+
292292 public: // these should ever ONLY be called from within the VM
293293 // request queue: add, query for size
294294 t_CKBOOL add_request( Chuck_Global_Request request );
295295 t_CKBOOL more_requests();
296296 // REFACTOR-2017: execute the messages from the global queue
297297 void handle_global_queue_messages();
298−
298+
299299 private:
300300 // ptr to my vm
301301 Chuck_VM * m_vm;
302−
302+
303303 // global variables -- storage
304304 std::map< std::string, Chuck_Global_Int_Container* > m_global_ints;
305305 std::map< std::string, Chuck_Global_Float_Container* > m_global_floats;
@@ -311,7 +311,7 @@ private: · 5 unmodified lines
311311
312312 // global variables -- messages for set, get, etc.
313313 XCircleBuffer< Chuck_Global_Request > m_global_request_queue;
314−
314+
315315 // retry queue: sometimes a request comes through exactly 1 sample
316316 // before the relevant global variable is constructed
317317 // (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
4444 struct Chuck_Type;
4545 struct Chuck_Func;
4646
47+// 1.4.2.0 (ge) | added for switching from snprintf()
48+#define CK_PRINT_BUF_LENGTH 256
49+
4750
4851
4952
@@ -55,19 +58,25 @@ struct Chuck_Instr · 5 unmodified lines
5558 {
5659 public:
5760 Chuck_Instr();
58− virtual ~Chuck_Instr() { }
61+ virtual ~Chuck_Instr() { SAFE_DELETE(m_codestr); }
5962
6063 public:
6164 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) = 0;
6265
6366 public:
6467 virtual const char * name() const;
65− virtual const char * params() const
68+ virtual const char * params() const
6669 { return ""; }
6770
6871 public:
72+ // store line position for error messages
6973 void set_linepos( t_CKUINT linepos );
7074 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;
7180 };
7281
7382
@@ -84,7 +93,7 @@ public: · 10 unmodified lines
8493
8594 public:
8695 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; }
8897
8998 protected:
9099 t_CKUINT m_jmp;
@@ -105,7 +114,7 @@ public: · 14 unmodified lines
105114
106115 public:
107116 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; }
109118
110119 protected:
111120 t_CKUINT m_val;
@@ -126,7 +135,7 @@ public: · 14 unmodified lines
126135
127136 public:
128137 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; }
130139
131140 protected:
132141 t_CKFLOAT m_val;
@@ -2014,6 +2023,23 @@ protected: · 1881 unmodified lines
20142023
20152024
20162025
2026+//-----------------------------------------------------------------------------
2027+// name: struct Chuck_Instr_Reg_Push_Zero
2028+// desc: push immediate value 0 to reg stack with specific width
2029+//-----------------------------------------------------------------------------
2030+struct Chuck_Instr_Reg_Push_Zero : public Chuck_Instr_Unary_Op
2031+{
2032+public:
2033+ Chuck_Instr_Reg_Push_Zero( t_CKUINT sizeInBytes )
2034+ { this->set( sizeInBytes ); }
2035+
2036+public:
2037+ virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2038+};
2039+
2040+
2041+
2042+
20172043 //-----------------------------------------------------------------------------
20182044 // name: struct Chuck_Instr_Reg_Dup_Last
20192045 // desc: duplicate last value on reg stack
@@ -2133,8 +2159,8 @@ public: · 113 unmodified lines
21332159 public:
21342160 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
21352161 virtual const char * params() const
2136− { static char buffer[256];
2137− sprintf( buffer, "src=%ld, base=%ld", m_val, base );
2162+ { static char buffer[CK_PRINT_BUF_LENGTH];
2163+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
21382164 return buffer; }
21392165
21402166 protected:
@@ -2158,8 +2184,8 @@ public: · 17 unmodified lines
21582184 public:
21592185 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
21602186 virtual const char * params() const
2161− { static char buffer[256];
2162− sprintf( buffer, "src=%ld, base=%ld", m_val, base );
2187+ { static char buffer[CK_PRINT_BUF_LENGTH];
2188+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
21632189 return buffer; }
21642190
21652191 protected:
@@ -2183,8 +2209,8 @@ public: · 17 unmodified lines
21832209 public:
21842210 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
21852211 virtual const char * params() const
2186− { static char buffer[256];
2187− sprintf( buffer, "src=%ld, base=%ld", m_val, base );
2212+ { static char buffer[CK_PRINT_BUF_LENGTH];
2213+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
21882214 return buffer; }
21892215
21902216 protected:
@@ -2204,14 +2230,14 @@ struct Chuck_Instr_Reg_Push_Mem_Vec3 : public Chuck_Instr_Unary_Op · 13 unmodified lines
22042230 public:
22052231 Chuck_Instr_Reg_Push_Mem_Vec3( t_CKUINT src, t_CKBOOL use_base = FALSE )
22062232 { this->set( src ); base = use_base; }
2207−
2233+
22082234 public:
22092235 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
22102236 virtual const char * params() const
2211− { static char buffer[256];
2212− sprintf( buffer, "src=%ld, base=%ld", m_val, base );
2237+ { static char buffer[CK_PRINT_BUF_LENGTH];
2238+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
22132239 return buffer; }
2214−
2240+
22152241 protected:
22162242 // use global stack base
22172243 t_CKBOOL base;
@@ -2229,14 +2255,14 @@ struct Chuck_Instr_Reg_Push_Mem_Vec4 : public Chuck_Instr_Unary_Op · 11 unmodified lines
22292255 public:
22302256 Chuck_Instr_Reg_Push_Mem_Vec4( t_CKUINT src, t_CKBOOL use_base = FALSE )
22312257 { this->set( src ); base = use_base; }
2232−
2258+
22332259 public:
22342260 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
22352261 virtual const char * params() const
2236− { static char buffer[256];
2237− sprintf( buffer, "src=%ld, base=%ld", m_val, base );
2262+ { static char buffer[CK_PRINT_BUF_LENGTH];
2263+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
22382264 return buffer; }
2239−
2265+
22402266 protected:
22412267 // use global stack base
22422268 t_CKBOOL base;
@@ -2258,8 +2284,8 @@ public: · 15 unmodified lines
22582284 public:
22592285 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
22602286 virtual const char * params() const
2261− { static char buffer[256];
2262− sprintf( buffer, "name='%s'", m_name.c_str() );
2287+ { static char buffer[CK_PRINT_BUF_LENGTH];
2288+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "name='%s'", m_name.c_str() );
22632289 return buffer; }
22642290
22652291 public:
@@ -2283,8 +2309,8 @@ public: · 17 unmodified lines
22832309 public:
22842310 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
22852311 virtual const char * params() const
2286− { static char buffer[256];
2287− sprintf( buffer, "src=%ld, base=%ld", m_val, base );
2312+ { static char buffer[CK_PRINT_BUF_LENGTH];
2313+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
22882314 return buffer; }
22892315
22902316 protected:
@@ -2308,8 +2334,8 @@ public: · 17 unmodified lines
23082334 public:
23092335 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
23102336 virtual const char * params() const
2311− { static char buffer[256];
2312− sprintf( buffer, "name='%s'", m_name.c_str() );
2337+ { static char buffer[CK_PRINT_BUF_LENGTH];
2338+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "name='%s'", m_name.c_str() );
23132339 return buffer; }
23142340
23152341 protected:
@@ -2364,12 +2390,12 @@ struct Chuck_Instr_Mem_Set_Imm : public Chuck_Instr · 48 unmodified lines
23642390 public:
23652391 Chuck_Instr_Mem_Set_Imm( t_CKUINT offset, t_CKUINT val )
23662392 { m_offset = offset; m_val = val; }
2367−
2393+
23682394 public:
23692395 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
23702396 virtual const char * params() const
2371− { static char buffer[256];
2372− sprintf( buffer, "offset=%ld, value=%ld", m_offset, m_val );
2397+ { static char buffer[CK_PRINT_BUF_LENGTH];
2398+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld, value=%ld", (long)m_offset, (long)m_val );
23732399 return buffer; }
23742400
23752401 protected:
@@ -2389,12 +2415,12 @@ struct Chuck_Instr_Mem_Set_Imm2 : public Chuck_Instr_Unary_Op · 13 unmodified lines
23892415 public:
23902416 Chuck_Instr_Mem_Set_Imm2( t_CKUINT offset, t_CKFLOAT val )
23912417 { m_offset = offset; m_val = val; }
2392−
2418+
23932419 public:
23942420 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
23952421 virtual const char * params() const
2396− { static char buffer[256];
2397− sprintf( buffer, "offset=%ld, value=%f", m_offset, m_val );
2422+ { static char buffer[CK_PRINT_BUF_LENGTH];
2423+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld, value=%f", (long)m_offset, m_val );
23982424 return buffer; }
23992425
24002426 protected:
@@ -2414,7 +2440,7 @@ struct Chuck_Instr_Mem_Push_Imm : public Chuck_Instr_Unary_Op · 13 unmodified lines
24142440 public:
24152441 Chuck_Instr_Mem_Push_Imm( t_CKUINT src )
24162442 { this->set( src ); }
2417−
2443+
24182444 public:
24192445 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
24202446 };
@@ -2430,7 +2456,7 @@ struct Chuck_Instr_Mem_Push_Imm2 : public Chuck_Instr_Unary_Op2 · 9 unmodified lines
24302456 public:
24312457 Chuck_Instr_Mem_Push_Imm2( t_CKFLOAT src )
24322458 { this->set( src ); }
2433−
2459+
24342460 public:
24352461 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
24362462 };
@@ -2513,10 +2539,10 @@ public: · 76 unmodified lines
25132539 // (added 1.3.0.0 -- is_object)
25142540 Chuck_Instr_Alloc_Word( t_CKUINT offset, t_CKBOOL is_object )
25152541 { this->set( offset ); m_is_object = is_object; }
2516−
2542+
25172543 // was this object reference? (added 1.3.0.0)
25182544 t_CKBOOL m_is_object;
2519−
2545+
25202546 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
25212547 };
25222548
@@ -2532,7 +2558,7 @@ struct Chuck_Instr_Alloc_Word2 : public Chuck_Instr_Unary_Op · 9 unmodified lines
25322558 public:
25332559 Chuck_Instr_Alloc_Word2( t_CKUINT offset )
25342560 { this->set( offset ); }
2535−
2561+
25362562 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
25372563 };
25382564
@@ -2564,7 +2590,7 @@ struct Chuck_Instr_Alloc_Vec3 : public Chuck_Instr_Unary_Op · 25 unmodified lines
25642590 public:
25652591 Chuck_Instr_Alloc_Vec3( t_CKUINT offset )
25662592 { this->set( offset ); }
2567−
2593+
25682594 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
25692595 };
25702596
@@ -2580,7 +2606,7 @@ struct Chuck_Instr_Alloc_Vec4 : public Chuck_Instr_Unary_Op · 9 unmodified lines
25802606 public:
25812607 Chuck_Instr_Alloc_Vec4( t_CKUINT offset )
25822608 { this->set( offset ); }
2583−
2609+
25842610 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
25852611 };
25862612
@@ -2644,7 +2670,7 @@ struct Chuck_Instr_Alloc_Member_Vec3 : public Chuck_Instr_Unary_Op · 57 unmodified lines
26442670 public:
26452671 Chuck_Instr_Alloc_Member_Vec3( t_CKUINT offset )
26462672 { this->set( offset ); }
2647−
2673+
26482674 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
26492675 };
26502676
@@ -2660,7 +2686,7 @@ struct Chuck_Instr_Alloc_Member_Vec4 : public Chuck_Instr_Unary_Op · 9 unmodified lines
26602686 public:
26612687 Chuck_Instr_Alloc_Member_Vec4( t_CKUINT offset )
26622688 { this->set( offset ); }
2663−
2689+
26642690 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
26652691 };
26662692
@@ -2678,22 +2704,22 @@ public: · 11 unmodified lines
26782704 Chuck_Instr_Alloc_Word_Global()
26792705 { this->set( 0 ); m_stack_offset = 0; m_chuck_type = NULL;
26802706 m_should_execute_ctors = FALSE; m_is_array = FALSE; }
2681−
2707+
26822708 virtual const char * params() const
2683− { static char buffer[256];
2684− sprintf( buffer, "name='%s'", m_name.c_str() );
2709+ { static char buffer[CK_PRINT_BUF_LENGTH];
2710+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "name='%s'", m_name.c_str() );
26852711 return buffer; }
2686−
2712+
26872713 // global name and type
26882714 std::string m_name;
26892715 te_GlobalType m_type;
26902716 t_CKBOOL m_is_array;
2691−
2717+
26922718 // for objects
26932719 t_CKBOOL m_should_execute_ctors;
26942720 t_CKUINT m_stack_offset;
26952721 Chuck_Type * m_chuck_type;
2696−
2722+
26972723 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
26982724 };
26992725
@@ -2946,7 +2972,7 @@ struct Chuck_Instr_AddRef_Object2 : public Chuck_Instr_Unary_Op · 246 unmodified lines
29462972 public:
29472973 Chuck_Instr_AddRef_Object2( t_CKUINT offset )
29482974 { this->set( offset ); }
2949−
2975+
29502976 public:
29512977 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
29522978 };
@@ -2957,6 +2983,7 @@ public: · 4 unmodified lines
29572983 //-----------------------------------------------------------------------------
29582984 // name: struct Chuck_Instr_Reg_AddRef_Object3
29592985 // desc: added 1.3.0.0 -- does the ref add in-place
2986+// operates on top of the register stack
29602987 //-----------------------------------------------------------------------------
29612988 struct Chuck_Instr_Reg_AddRef_Object3 : public Chuck_Instr
29622989 {
@@ -2969,7 +2996,7 @@ public: · 6 unmodified lines
29692996
29702997 //-----------------------------------------------------------------------------
29712998 // name: struct Chuck_Instr_Release_Object
2972−// desc: ...
2999+// desc: release object on stack by its offset
29733000 //-----------------------------------------------------------------------------
29743001 struct Chuck_Instr_Release_Object : public Chuck_Instr
29753002 {
@@ -2998,6 +3025,38 @@ public: · 22 unmodified lines
29983025
29993026
30003027
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+//-----------------------------------------------------------------------------
3033+struct Chuck_Instr_Release_Object3_Pop_Word : public Chuck_Instr
3034+{
3035+public:
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+//-----------------------------------------------------------------------------
3047+struct Chuck_Instr_Release_Object4 : public Chuck_Instr_Unary_Op
3048+{
3049+public:
3050+ Chuck_Instr_Release_Object4( t_CKUINT offset )
3051+ { this->set( offset ); }
3052+
3053+public:
3054+ virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3055+};
3056+
3057+
3058+
3059+
30013060 //-----------------------------------------------------------------------------
30023061 // name: struct Chuck_Instr_Func_To_Code
30033062 // desc: Chuck_Func * to Chuck_VM_Code *
@@ -3031,11 +3090,14 @@ public: · 27 unmodified lines
30313090 struct Chuck_Instr_Func_Call_Member : public Chuck_Instr_Unary_Op
30323091 {
30333092 public:
3034− Chuck_Instr_Func_Call_Member( t_CKUINT ret_size )
3035− { this->set( ret_size ); }
3093+ Chuck_Instr_Func_Call_Member( t_CKUINT ret_size, Chuck_Func * func_ref )
3094+ { this->set( ret_size ); m_func_ref = func_ref; }
30363095
30373096 public:
30383097 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3098+
3099+public:
3100+ Chuck_Func * m_func_ref; // 1.5.0.0 (ge) | added for arg list cleanup
30393101 };
30403102
30413103
@@ -3048,11 +3110,14 @@ public: · 6 unmodified lines
30483110 struct Chuck_Instr_Func_Call_Static : public Chuck_Instr_Unary_Op
30493111 {
30503112 public:
3051− Chuck_Instr_Func_Call_Static( t_CKUINT ret_size )
3052− { this->set( ret_size ); }
3113+ Chuck_Instr_Func_Call_Static( t_CKUINT ret_size, Chuck_Func * func_ref )
3114+ { this->set( ret_size ); m_func_ref = func_ref; }
30533115
30543116 public:
30553117 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3118+
3119+public:
3120+ Chuck_Func * m_func_ref; // 1.5.0.0 (ge) | added for arg list cleanup
30563121 };
30573122
30583123
@@ -3145,6 +3210,7 @@ protected: · 86 unmodified lines
31453210 Chuck_Type * m_type_ref;
31463211 t_CKINT m_length;
31473212 t_CKBOOL m_is_obj;
3213+ t_CKBOOL m_is_float;
31483214 char * m_param_str;
31493215 };
31503216
@@ -3158,8 +3224,9 @@ protected: · 7 unmodified lines
31583224 struct Chuck_Instr_Array_Alloc : public Chuck_Instr
31593225 {
31603226 public: // REFACTOR-2017: added env
3161− Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth, Chuck_Type * the_type,
3162− t_CKUINT offset, t_CKBOOL ref );
3227+ Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth,
3228+ Chuck_Type * contentType, t_CKUINT offset, t_CKBOOL ref,
3229+ Chuck_Type * arrayType );
31633230 virtual ~Chuck_Instr_Array_Alloc();
31643231
31653232 public:
@@ -3168,7 +3235,8 @@ public: · 2 unmodified lines
31683235
31693236 protected:
31703237 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
31723240 t_CKBOOL m_is_obj;
31733241 char * m_param_str;
31743242 t_CKUINT m_stack_offset;
@@ -3185,16 +3253,16 @@ protected: · 10 unmodified lines
31853253 struct Chuck_Instr_Array_Access : public Chuck_Instr
31863254 {
31873255 public:
3188− Chuck_Instr_Array_Access( t_CKUINT kind, t_CKUINT emit_addr,
3256+ Chuck_Instr_Array_Access( t_CKUINT kind, t_CKUINT emit_addr,
31893257 t_CKUINT istr = FALSE )
31903258 { m_kind = kind; m_emit_addr = emit_addr; m_istr = istr; }
31913259
31923260 public:
31933261 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
31943262 virtual const char * params() const
3195− { static char buffer[256];
3196− sprintf( buffer, "kind=%ld, emit_addr=%ld istr=%ld",
3197− m_kind, m_emit_addr, m_istr );
3263+ { static char buffer[CK_PRINT_BUF_LENGTH];
3264+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "kind=%ld, emit_addr=%p istr=%ld",
3265+ (long)m_kind, (void *)m_emit_addr, (long)m_istr );
31983266 return buffer; }
31993267
32003268 protected:
@@ -3219,8 +3287,8 @@ public: · 18 unmodified lines
32193287 public:
32203288 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
32213289 virtual const char * params() const
3222− { static char buffer[256];
3223− sprintf( buffer, "kind=%ld, emit_addr=%ld", m_kind, m_emit_addr );
3290+ { static char buffer[CK_PRINT_BUF_LENGTH];
3291+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "kind=%ld, emit_addr=%p", (long)m_kind, (void *)m_emit_addr );
32243292 return buffer; }
32253293
32263294 protected:
@@ -3246,15 +3314,15 @@ public: · 19 unmodified lines
32463314 public:
32473315 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
32483316 virtual const char * params() const
3249− { static char buffer[256];
3250− sprintf( buffer, "depth=%ld, kind=%ld, emit_addr=%ld", m_depth, m_kind, m_emit_addr );
3317+ { static char buffer[CK_PRINT_BUF_LENGTH];
3318+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "depth=%ld, kind=%ld, emit_addr=%p", (long)m_depth, (long)m_kind, (void *)m_emit_addr );
32513319 return buffer; }
32523320
32533321 protected:
32543322 t_CKUINT m_depth;
32553323 t_CKUINT m_kind;
32563324 t_CKUINT m_emit_addr;
3257−
3325+
32583326 // 1.3.1.0 list of types of indices
32593327 std::vector<t_CKBOOL> m_indexIsAssociative;
32603328 };
@@ -3275,8 +3343,8 @@ public: · 14 unmodified lines
32753343 public:
32763344 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
32773345 virtual const char * params() const
3278− { static char buffer[256];
3279− sprintf( buffer, "offset=%ld, kind=%ld, emit_addr=%ld", m_offset, m_kind, m_emit_addr );
3346+ { static char buffer[CK_PRINT_BUF_LENGTH];
3347+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld, kind=%ld, emit_addr=%p", (long)m_offset, (long)m_kind, (void *)m_emit_addr );
32803348 return buffer; }
32813349
32823350 protected:
@@ -3301,8 +3369,8 @@ public: · 18 unmodified lines
33013369 public:
33023370 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
33033371 virtual const char * params() const
3304− { static char buffer[256];
3305− sprintf( buffer, "offset=%ld", m_offset );
3372+ { static char buffer[CK_PRINT_BUF_LENGTH];
3373+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld", (long)m_offset );
33063374 return buffer; }
33073375
33083376 protected:
@@ -3321,14 +3389,14 @@ struct Chuck_Instr_Dot_Primitive_Func : public Chuck_Instr · 12 unmodified lines
33213389 public:
33223390 Chuck_Instr_Dot_Primitive_Func( t_CKUINT native_func )
33233391 { m_native_func = native_func; }
3324−
3392+
33253393 public:
33263394 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
33273395 virtual const char * params() const
3328− { static char buffer[256];
3329− sprintf( buffer, "native_func=%ld", m_native_func );
3396+ { static char buffer[CK_PRINT_BUF_LENGTH];
3397+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "native_func=%p", (void *)m_native_func );
33303398 return buffer; }
3331−
3399+
33323400 protected:
33333401 t_CKUINT m_native_func;
33343402 };
@@ -3349,8 +3417,9 @@ public: · 14 unmodified lines
33493417 public:
33503418 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
33513419 virtual const char * params() const
3352− { static char buffer[256];
3353− sprintf( buffer, "offset=%ld, size=%ld, kind=%ld, emit_addr=%ld", m_offset, m_size, m_kind, m_emit_addr );
3420+ { static char buffer[CK_PRINT_BUF_LENGTH];
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 );
33543423 return buffer; }
33553424
33563425 protected:
@@ -3376,8 +3445,9 @@ public: · 19 unmodified lines
33763445 public:
33773446 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
33783447 virtual const char * params() const
3379− { static char buffer[256];
3380− sprintf( buffer, "addr=%ld, kind=%ld, emit_addr=%ld", (t_CKUINT)m_addr, m_kind, m_emit_addr );
3448+ { static char buffer[CK_PRINT_BUF_LENGTH];
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 );
33813451 return buffer; }
33823452
33833453 protected:
@@ -3402,8 +3472,8 @@ public: · 18 unmodified lines
34023472 public:
34033473 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
34043474 virtual const char * params() const
3405− { static char buffer[256];
3406− sprintf( buffer, "func=%ld", (t_CKUINT)m_func );
3475+ { static char buffer[CK_PRINT_BUF_LENGTH];
3476+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "func=%p", (void *)m_func );
34073477 return buffer; }
34083478
34093479 protected:
@@ -3426,8 +3496,8 @@ public: · 16 unmodified lines
34263496 public:
34273497 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
34283498 virtual const char * params() const
3429− { static char buffer[256];
3430− sprintf( buffer, "is_mem=%ld, emit_addr=%ld", m_is_mem, m_emit_addr );
3499+ { static char buffer[CK_PRINT_BUF_LENGTH];
3500+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
34313501 return buffer; }
34323502
34333503 protected:
@@ -3451,8 +3521,8 @@ public: · 17 unmodified lines
34513521 public:
34523522 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
34533523 virtual const char * params() const
3454− { static char buffer[256];
3455− sprintf( buffer, "is_mem=%ld, emit_addr=%ld", m_is_mem, m_emit_addr );
3524+ { static char buffer[CK_PRINT_BUF_LENGTH];
3525+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
34563526 return buffer; }
34573527
34583528 protected:
@@ -3472,14 +3542,14 @@ struct Chuck_Instr_Dot_Cmp_Third : public Chuck_Instr · 13 unmodified lines
34723542 public:
34733543 Chuck_Instr_Dot_Cmp_Third( t_CKUINT is_mem, t_CKUINT emit_addr )
34743544 { m_is_mem = is_mem; m_emit_addr = emit_addr; }
3475−
3545+
34763546 public:
34773547 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
34783548 virtual const char * params() const
3479− { static char buffer[256];
3480− sprintf( buffer, "is_mem=%ld, emit_addr=%ld", m_is_mem, m_emit_addr );
3549+ { static char buffer[CK_PRINT_BUF_LENGTH];
3550+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
34813551 return buffer; }
3482−
3552+
34833553 protected:
34843554 t_CKUINT m_is_mem;
34853555 t_CKUINT m_emit_addr;
@@ -3497,14 +3567,14 @@ struct Chuck_Instr_Dot_Cmp_Fourth : public Chuck_Instr · 11 unmodified lines
34973567 public:
34983568 Chuck_Instr_Dot_Cmp_Fourth( t_CKUINT is_mem, t_CKUINT emit_addr )
34993569 { m_is_mem = is_mem; m_emit_addr = emit_addr; }
3500−
3570+
35013571 public:
35023572 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
35033573 virtual const char * params() const
3504− { static char buffer[256];
3505− sprintf( buffer, "is_mem=%ld, emit_addr=%ld", m_is_mem, m_emit_addr );
3574+ { static char buffer[CK_PRINT_BUF_LENGTH];
3575+ snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
35063576 return buffer; }
3507−
3577+
35083578 protected:
35093579 t_CKUINT m_is_mem;
35103580 t_CKUINT m_emit_addr;
@@ -3586,10 +3656,10 @@ struct Chuck_Instr_UGen_Link : public Chuck_Instr · 75 unmodified lines
35863656 {
35873657 public:
35883658 Chuck_Instr_UGen_Link( t_CKBOOL isUpChuck = FALSE );
3589−
3659+
35903660 public:
35913661 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3592−
3662+
35933663 protected:
35943664 t_CKBOOL m_isUpChuck;
35953665 };
@@ -3609,7 +3679,7 @@ public: · 13 unmodified lines
36093679 { }
36103680
36113681 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3612−
3682+
36133683 protected:
36143684 t_CKBOOL m_srcIsArray, m_dstIsArray;
36153685 };
chuginate/template/chuck/include/chuck_io.h+32−29
@@ -53,9 +53,9 @@ t_CKBOOL init_class_MidiRW( Chuck_Env * env ); · 52 unmodified lines
5353 t_CKBOOL init_class_HID( Chuck_Env * env );
5454 #endif
5555 t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type );
56−#ifndef __DISABLE_FILEIO__
56+// #ifndef __DISABLE_FILEIO__
5757 t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type );
58−#endif
58+// #endif
5959 // added 1.3.0.0 -- moved to be full-fledged class
6060 t_CKBOOL init_class_chout( Chuck_Env * env, Chuck_Type * type );
6161 // added 1.3.0.0 -- moved to be full-fledged class
@@ -77,7 +77,7 @@ CK_DLL_SFUN( io_newline ); · 15 unmodified lines
7777 CK_DLL_SFUN( io_openfile );
7878
7979
80−#ifndef __DISABLE_FILEIO__
80+// #ifndef __DISABLE_FILEIO__
8181 //-----------------------------------------------------------------------------
8282 // fileio API
8383 //-----------------------------------------------------------------------------
@@ -99,6 +99,9 @@ CK_DLL_MFUN( fileio_read ); · 15 unmodified lines
9999 CK_DLL_MFUN( fileio_readline );
100100 CK_DLL_MFUN( fileio_readint );
101101 CK_DLL_MFUN( fileio_readintflags );
102+CK_DLL_MFUN( fileio_readint8 );
103+CK_DLL_MFUN( fileio_readint16 );
104+CK_DLL_MFUN( fileio_readint32 );
102105 CK_DLL_MFUN( fileio_readfloat );
103106 CK_DLL_MFUN( fileio_eof );
104107 CK_DLL_MFUN( fileio_more );
@@ -106,7 +109,7 @@ CK_DLL_MFUN( fileio_writestring ); · 1 unmodified line
106109 CK_DLL_MFUN( fileio_writeint );
107110 CK_DLL_MFUN( fileio_writeintflags );
108111 CK_DLL_MFUN( fileio_writefloat );
109−#endif
112+// #endif // __DISABLE_FILEIO__
110113
111114
112115 //-----------------------------------------------------------------------------
@@ -289,29 +292,29 @@ struct Chuck_IO_Serial : public Chuck_IO · 176 unmodified lines
289292 public:
290293 Chuck_IO_Serial( Chuck_VM * vm );
291294 virtual ~Chuck_IO_Serial();
292−
295+
293296 static void shutdown();
294297
295298 public:
296299 // meta
297300 virtual t_CKBOOL open( const t_CKUINT i, t_CKINT flags, t_CKUINT baud = CK_BAUD_9600 );
298301 virtual t_CKBOOL open( const std::string & path, t_CKINT flags, t_CKUINT baud = CK_BAUD_9600 );
299−
302+
300303 virtual t_CKBOOL can_wait();
301−
304+
302305 virtual t_CKBOOL good();
303306 virtual void close();
304307 virtual void flush();
305308 virtual t_CKINT mode();
306309 virtual void mode( t_CKINT flag );
307−
310+
308311 // reading
309312 virtual Chuck_String * readLine();
310313 virtual t_CKINT readInt( t_CKINT flags );
311314 virtual t_CKFLOAT readFloat();
312315 virtual t_CKBOOL readString( std::string & str );
313316 virtual t_CKBOOL eof();
314−
317+
315318 // writing
316319 virtual void write( const std::string & val );
317320 virtual void write( t_CKINT val );
@@ -322,7 +325,7 @@ public: · 4 unmodified lines
322325 // serial stuff
323326 virtual t_CKBOOL setBaudRate( t_CKUINT rate );
324327 virtual t_CKUINT getBaudRate();
325−
328+
326329 // async reading
327330 virtual t_CKBOOL readAsync( t_CKUINT type, t_CKUINT num );
328331 virtual Chuck_String * getLine();
@@ -331,8 +334,8 @@ public: · 2 unmodified lines
331334 virtual Chuck_Array * getInts();
332335 virtual Chuck_Array * getFloats();
333336 virtual Chuck_String * getString();
334−
335− static const t_CKUINT TYPE_NONE;
337+
338+ static const t_CKUINT TYPE_NONE;
336339 static const t_CKUINT TYPE_BYTE;
337340 static const t_CKUINT TYPE_WORD;
338341 static const t_CKUINT TYPE_INT;
@@ -340,14 +343,14 @@ public: · 1 unmodified line
340343 static const t_CKUINT TYPE_STRING;
341344 static const t_CKUINT TYPE_LINE;
342345 static const t_CKUINT TYPE_WRITE;
343−
346+
344347 struct Request
345348 {
346349 t_CKUINT m_type; // type
347350 t_CKUINT m_num; // how many
348351 t_CKUINT m_status;
349352 t_CKUINT m_val; // ISSUE: 64-bit
350−
353+
351354 enum Status
352355 {
353356 RQ_STATUS_PENDING,
@@ -357,9 +360,9 @@ public: · 3 unmodified lines
357360 RQ_STATUS_EOF,
358361 };
359362 };
360−
363+
361364 virtual t_CKBOOL ready();
362−
365+
363366 // available baud rates
364367 static const t_CKUINT CK_BAUD_2400;
365368 static const t_CKUINT CK_BAUD_4800;
@@ -375,7 +378,7 @@ public: · 9 unmodified lines
375378 static const t_CKUINT CK_BAUD_230400;
376379
377380 protected:
378−
381+
379382 void start_read_thread();
380383 XThread * m_read_thread;
381384 static void *shell_read_cb(void *);
@@ -384,14 +387,14 @@ protected: · 2 unmodified lines
384387 XThread * m_write_thread;
385388 static void *shell_write_cb(void *);
386389 void write_cb();
387−
390+
388391 void close_int();
389392
390393 t_CKBOOL get_buffer(t_CKINT timeout_ms = 1);
391394 t_CKINT peek_buffer();
392395 t_CKINT pull_buffer();
393396 t_CKINT buffer_bytes_to_tmp(t_CKINT num_bytes);
394−
397+
395398 t_CKBOOL handle_line(Request &);
396399 t_CKBOOL handle_string(Request &);
397400 t_CKBOOL handle_float_ascii(Request &);
@@ -399,38 +402,38 @@ protected: · 1 unmodified line
399402 t_CKBOOL handle_byte(Request &);
400403 t_CKBOOL handle_float_binary(Request &);
401404 t_CKBOOL handle_int_binary(Request &);
402−
405+
403406 bool m_do_read_thread;
404407 bool m_do_write_thread;
405−
408+
406409 CircularBuffer<Request> m_asyncRequests;
407410 CircularBuffer<Request> m_asyncResponses;
408411 CBufferSimple * m_event_buffer;
409412
410413 int m_fd;
411414 FILE * m_cfd;
412−
415+
413416 std::string m_path;
414−
417+
415418 unsigned char * m_io_buf;
416419 t_CKUINT m_io_buf_max;
417420 t_CKUINT m_io_buf_available;
418421 t_CKUINT m_io_buf_pos;
419−
422+
420423 unsigned char * m_tmp_buf;
421424 t_CKUINT m_tmp_buf_max;
422−
425+
423426 CircularBuffer<Request> m_asyncWriteRequests;
424427 CircularBuffer<char> m_writeBuffer;
425−
428+
426429 t_CKINT m_flags;
427430 t_CKINT m_iomode; // SYNC or ASYNC
428431 t_CKBOOL m_eof;
429−
432+
430433 t_CKBOOL m_do_exit;
431−
434+
432435 static std::list<Chuck_IO_Serial *> s_serials;
433−
436+
434437 Chuck_VM * m_vmRef;
435438 };
436439 #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
5858 t_CKBOOL init_class_array( Chuck_Env * env, Chuck_Type * type );
5959 t_CKBOOL init_class_vec3( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3
6060 t_CKBOOL init_class_vec4( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3
61−
61+t_CKBOOL init_class_type( Chuck_Env * env, Chuck_Type * type ); // 1.5.0.0
62+t_CKBOOL init_primitive_types( Chuck_Env * env ); // 1.5.0.0
6263
6364
6465
@@ -69,11 +70,11 @@ t_CKBOOL init_class_vec4( Chuck_Env * env, Chuck_Type * type ); // 1.3.5.3 · 4 unmodified lines
6970 CK_DLL_CTOR( object_ctor );
7071 CK_DLL_DTOR( object_dtor );
7172 CK_DLL_MFUN( object_equals );
72−CK_DLL_MFUN( object_getType );
7373 CK_DLL_MFUN( object_hashCode );
7474 CK_DLL_MFUN( object_toString );
7575 CK_DLL_MFUN( object_dump );
76−CK_DLL_SFUN( object_apropos );
76+CK_DLL_SFUN( object_help );
77+CK_DLL_SFUN( object_typeInfo );
7778
7879
7980 //-----------------------------------------------------------------------------
@@ -180,12 +181,17 @@ CK_DLL_MFUN( array_set_size ); · 100 unmodified lines
180181 CK_DLL_MFUN( array_get_size );
181182 CK_DLL_MFUN( array_push_back );
182183 CK_DLL_MFUN( array_pop_back );
184+CK_DLL_MFUN( array_pop_out );
183185 CK_DLL_MFUN( array_push_front );
184186 CK_DLL_MFUN( array_pop_front );
185187 CK_DLL_MFUN( array_find );
186188 CK_DLL_MFUN( array_erase );
187189 CK_DLL_MFUN( array_clear );
188190 CK_DLL_MFUN( array_reset );
191+CK_DLL_MFUN( array_zero );
192+CK_DLL_MFUN( array_get_keys );
193+CK_DLL_MFUN( array_reverse );
194+CK_DLL_MFUN( array_shuffle );
189195
190196
191197 //-----------------------------------------------------------------------------
@@ -254,6 +260,37 @@ CK_DLL_MFUN( vec4_magnitude ); · 62 unmodified lines
254260 CK_DLL_MFUN( vec4_normalize );
255261
256262
263+//-----------------------------------------------------------------------------
264+// type API | 1.5.0.0 (ge) added
265+//-----------------------------------------------------------------------------
266+CK_DLL_CTOR( type_ctor );
267+CK_DLL_DTOR( type_dtor );
268+CK_DLL_MFUN( type_equals );
269+CK_DLL_MFUN( type_isa );
270+CK_DLL_MFUN( type_isa_str );
271+CK_DLL_MFUN( type_name );
272+CK_DLL_MFUN( type_parent ); // return parent Type
273+CK_DLL_MFUN( type_children ); // return children Types
274+CK_DLL_MFUN( type_origin ); // built-in, chugin, defined in chuck
275+CK_DLL_MFUN( type_isPrimitive );
276+CK_DLL_MFUN( type_isArray );
277+CK_DLL_MFUN( type_arrayDims );
278+CK_DLL_SFUN( type_findString );
279+CK_DLL_SFUN( type_typeOf_obj ); // Type.typeOf( Object )
280+CK_DLL_SFUN( type_typeOf_int ); // Type.typeOf( int )
281+CK_DLL_SFUN( type_typeOf_float ); // Type.typeOf( float )
282+CK_DLL_SFUN( type_typeOf_time ); // Type.typeOf( time )
283+CK_DLL_SFUN( type_typeOf_dur ); // Type.typeOf( dur )
284+CK_DLL_SFUN( type_typeOf_complex ); // Type.typeOf( complex )
285+CK_DLL_SFUN( type_typeOf_polar ); // Type.typeOf( polar )
286+CK_DLL_SFUN( type_typeOf_vec3 ); // Type.typeOf( vec3 )
287+CK_DLL_SFUN( type_typeOf_vec4 ); // Type.typeOf( vec4 )
288+CK_DLL_SFUN( type_getTypes );
289+CK_DLL_SFUN( type_getTypesAll );
290+
291+
292+
293+
257294 //-----------------------------------------------------------------------------
258295 // name: Data_Exception
259296 // desc: data for base Chuck Exception class
chuginate/template/chuck/include/chuck_oo.h+93−41
@@ -98,7 +98,9 @@ public: · 97 unmodified lines
9898 virtual void release();
9999 // lock
100100 virtual void lock();
101−
101+ // unlock | 1.5.0.0 (ge) added
102+ virtual void unlock();
103+
102104 // NOTE: be careful when overriding these, should always
103105 // explicitly call up to ChucK_VM_Object (ge: 2013)
104106
@@ -132,7 +134,7 @@ private: · 27 unmodified lines
132134 //{
133135 //public:
134136 // static Chuck_VM_Alloc * instance();
135−//
137+//
136138 //public:
137139 // void add_object( Chuck_VM_Object * obj );
138140 // void free_object( Chuck_VM_Object * obj );
@@ -180,8 +182,8 @@ public: · 41 unmodified lines
180182
181183 public:
182184 // output type info (can be overriden; but probably shouldn't be)
183− virtual void apropos();
184−
185+ virtual void help();
186+
185187 public:
186188 // virtual table
187189 Chuck_VTable * vtable;
@@ -228,7 +230,15 @@ public: · 40 unmodified lines
228230 virtual t_CKINT find( const std::string & key ) = 0; // find
229231 virtual t_CKINT erase( const std::string & key ) = 0; // erase
230232 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+
232242 Chuck_Type * m_array_type;
233243 };
234244
@@ -254,8 +264,10 @@ public: · 19 unmodified lines
254264 t_CKINT set( const std::string & key, t_CKUINT val );
255265 t_CKINT push_back( t_CKUINT val );
256266 t_CKINT pop_back( );
267+ t_CKINT pop_out( t_CKINT pos );
257268 t_CKINT back( t_CKUINT * val ) const;
258269 void zero( t_CKUINT start, t_CKUINT end );
270+ void zero() { this->zero(0, m_vector.size()); }
259271
260272 virtual void clear( );
261273 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -264,13 +276,22 @@ public: · 2 unmodified lines
264276 virtual t_CKINT set_capacity( t_CKINT capacity );
265277 virtual t_CKINT find( const std::string & key );
266278 virtual t_CKINT erase( const std::string & key );
267− virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY4_DATASIZE; }
268− virtual t_CKINT data_type_kind( ) { return CHUCK_ARRAY4_DATAKIND; }
279+ virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY4_DATASIZE; }
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();
269287
270288 public:
271289 std::vector<t_CKUINT> m_vector;
272290 std::map<std::string, t_CKUINT> m_map;
273291 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+
274295 // t_CKINT m_size;
275296 // t_CKINT m_capacity;
276297 };
@@ -297,8 +318,10 @@ public: · 20 unmodified lines
297318 t_CKINT set( const std::string & key, t_CKFLOAT val );
298319 t_CKINT push_back( t_CKFLOAT val );
299320 t_CKINT pop_back( );
321+ t_CKINT pop_out( t_CKINT pos );
300322 t_CKINT back( t_CKFLOAT * val ) const;
301323 void zero( t_CKUINT start, t_CKUINT end );
324+ void zero() { this->zero(0, m_vector.size()); }
302325
303326 virtual void clear( );
304327 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -308,7 +331,13 @@ public: · 3 unmodified lines
308331 virtual t_CKINT find( const std::string & key );
309332 virtual t_CKINT erase( const std::string & key );
310333 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();
312341
313342 public:
314343 std::vector<t_CKFLOAT> m_vector;
@@ -339,8 +368,10 @@ public: · 24 unmodified lines
339368 t_CKINT set( const std::string & key, const t_CKCOMPLEX & val );
340369 t_CKINT push_back( const t_CKCOMPLEX & val );
341370 t_CKINT pop_back( );
371+ t_CKINT pop_out( t_CKINT pos );
342372 t_CKINT back( t_CKCOMPLEX * val ) const;
343373 void zero( t_CKUINT start, t_CKUINT end );
374+ void zero() { this->zero(0, m_vector.size()); }
344375
345376 virtual void clear( );
346377 virtual t_CKINT size( ) { return m_vector.size(); }
@@ -350,7 +381,13 @@ public: · 3 unmodified lines
350381 virtual t_CKINT find( const std::string & key );
351382 virtual t_CKINT erase( const std::string & key );
352383 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();
354391
355392 public:
356393 std::vector<t_CKCOMPLEX> m_vector;
@@ -371,7 +408,7 @@ struct Chuck_Array24 : Chuck_Array · 14 unmodified lines
371408 public:
372409 Chuck_Array24( t_CKINT capacity = 8 );
373410 virtual ~Chuck_Array24();
374−
411+
375412 public:
376413 t_CKUINT addr( t_CKINT i );
377414 t_CKUINT addr( const std::string & key );
@@ -381,9 +418,11 @@ public: · 3 unmodified lines
381418 t_CKINT set( const std::string & key, const t_CKVEC3 & val );
382419 t_CKINT push_back( const t_CKVEC3 & val );
383420 t_CKINT pop_back( );
421+ t_CKINT pop_out( t_CKUINT pos );
384422 t_CKINT back( t_CKVEC3 * val ) const;
385423 void zero( t_CKUINT start, t_CKUINT end );
386−
424+ void zero() { this->zero(0, m_vector.size()); }
425+
387426 virtual void clear( );
388427 virtual t_CKINT size( ) { return m_vector.size(); }
389428 virtual t_CKINT capacity( ) { return m_vector.capacity(); }
@@ -393,7 +432,13 @@ public: · 3 unmodified lines
393432 virtual t_CKINT erase( const std::string & key );
394433 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY24_DATASIZE; }
395434 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+
397442 public:
398443 std::vector<t_CKVEC3> m_vector;
399444 std::map<std::string, t_CKVEC3> m_map;
@@ -411,7 +456,7 @@ struct Chuck_Array32 : Chuck_Array · 11 unmodified lines
411456 public:
412457 Chuck_Array32( t_CKINT capacity = 8 );
413458 virtual ~Chuck_Array32();
414−
459+
415460 public:
416461 t_CKUINT addr( t_CKINT i );
417462 t_CKUINT addr( const std::string & key );
@@ -421,9 +466,11 @@ public: · 3 unmodified lines
421466 t_CKINT set( const std::string & key, const t_CKVEC4 & val );
422467 t_CKINT push_back( const t_CKVEC4 & val );
423468 t_CKINT pop_back( );
469+ t_CKINT pop_out( t_CKUINT pos );
424470 t_CKINT back( t_CKVEC4 * val ) const;
425471 void zero( t_CKUINT start, t_CKUINT end );
426−
472+ void zero() { this->zero(0, m_vector.size()); }
473+
427474 virtual void clear( );
428475 virtual t_CKINT size( ) { return m_vector.size(); }
429476 virtual t_CKINT capacity( ) { return m_vector.capacity(); }
@@ -433,7 +480,13 @@ public: · 3 unmodified lines
433480 virtual t_CKINT erase( const std::string & key );
434481 virtual t_CKINT data_type_size( ) { return CHUCK_ARRAY32_DATASIZE; }
435482 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+
437490 public:
438491 std::vector<t_CKVEC4> m_vector;
439492 std::map<std::string, t_CKVEC4> m_map;
@@ -457,7 +510,7 @@ struct Chuck_Global_Event_Listener · 17 unmodified lines
457510 Chuck_Global_Get_Callback_Type callback_type;
458511 std::string name;
459512 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),
461514 callback_type(ck_get_plain), name(""), id(0) {};
462515 };
463516
@@ -550,7 +603,7 @@ struct Chuck_IO : Chuck_Event · 86 unmodified lines
550603 public:
551604 Chuck_IO();
552605 virtual ~Chuck_IO();
553−
606+
554607 public:
555608 // meta
556609 virtual t_CKBOOL good() = 0;
@@ -558,29 +611,37 @@ public: · 1 unmodified line
558611 virtual void flush() = 0;
559612 virtual t_CKINT mode() = 0;
560613 virtual void mode( t_CKINT flag ) = 0;
561−
614+
562615 // reading
563616 virtual Chuck_String * readLine() = 0;
564617 virtual t_CKINT readInt( t_CKINT flags ) = 0;
565618 virtual t_CKFLOAT readFloat() = 0;
566619 virtual t_CKBOOL readString( std::string & str ) = 0;
567620 virtual t_CKBOOL eof() = 0;
568−
621+
569622 // writing
570623 virtual void write( const std::string & val ) = 0;
571624 virtual void write( t_CKINT val ) = 0;
572625 virtual void write( t_CKINT val, t_CKINT flags ) = 0;
573626 virtual void write( t_CKFLOAT val ) = 0;
574−
575− // constants
627+
576628 public:
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
577633 static const t_CKINT INT32;
578634 static const t_CKINT INT16;
579635 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;
581641 // asynchronous I/O members
582642 static const t_CKINT MODE_SYNC;
583643 static const t_CKINT MODE_ASYNC;
644+
584645 Chuck_Event * m_asyncEvent;
585646 #ifndef __DISABLE_THREADS__
586647 XThread * m_thread;
@@ -597,7 +658,7 @@ public: · 10 unmodified lines
597658
598659
599660
600−#ifndef __DISABLE_FILEIO__
661+// #ifndef __DISABLE_FILEIO__
601662 //-----------------------------------------------------------------------------
602663 // name: Chuck_IO_File
603664 // desc: Chuck File IO class
@@ -608,7 +669,7 @@ public: · 4 unmodified lines
608669 // REFACTOR-2017
609670 Chuck_IO_File( Chuck_VM * vm );
610671 virtual ~Chuck_IO_File();
611−
672+
612673 public:
613674 // meta
614675 virtual t_CKBOOL open( const std::string & path, t_CKINT flags );
@@ -618,15 +679,15 @@ public: · 3 unmodified lines
618679 virtual t_CKINT mode();
619680 virtual void mode( t_CKINT flag );
620681 virtual t_CKINT size();
621−
682+
622683 // seeking
623684 virtual void seek( t_CKINT pos );
624685 virtual t_CKINT tell();
625−
686+
626687 // directories
627688 virtual t_CKINT isDir();
628689 virtual Chuck_Array4 * dirList();
629−
690+
630691 // reading
631692 // virtual Chuck_String * read( t_CKINT length );
632693 virtual Chuck_String * readLine();
@@ -634,7 +695,7 @@ public: · 1 unmodified line
634695 virtual t_CKFLOAT readFloat();
635696 virtual t_CKBOOL readString( std::string & str );
636697 virtual t_CKBOOL eof();
637−
698+
638699 // reading -- async
639700 /* TODO: doesn't look like asynchronous reads will work
640701 static THREAD_RETURN ( THREAD_TYPE read_thread ) ( void *data );
@@ -642,29 +703,20 @@ public: · 1 unmodified line
642703 static THREAD_RETURN ( THREAD_TYPE readInt_thread ) ( void *data );
643704 static THREAD_RETURN ( THREAD_TYPE readFloat_thread ) ( void *data );
644705 */
645−
706+
646707 // writing
647708 virtual void write( const std::string & val );
648709 virtual void write( t_CKINT val );
649710 virtual void write( t_CKINT val, t_CKINT flags );
650711 virtual void write( t_CKFLOAT val );
651−
712+
652713 #ifndef __DISABLE_THREADS__
653714 // writing -- async
654715 static THREAD_RETURN ( THREAD_TYPE writeStr_thread ) ( void *data );
655716 static THREAD_RETURN ( THREAD_TYPE writeInt_thread ) ( void *data );
656717 static THREAD_RETURN ( THREAD_TYPE writeFloat_thread ) ( void *data );
657718 #endif
658−
659−public:
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−
719+
668720 protected:
669721 // open flags
670722 t_CKINT m_flags;
@@ -681,7 +733,7 @@ protected: · 10 unmodified lines
681733 // vm and shred
682734 Chuck_VM * m_vmRef;
683735 };
684−#endif // __DISABLE_FILEIO__
736+// #endif // __DISABLE_FILEIO__
685737
686738
687739
chuginate/template/chuck/include/chuck_otf.h+4−4
@@ -74,15 +74,15 @@ void otf_hton( Net_Msg * msg ); · 73 unmodified lines
7474 void otf_ntoh( Net_Msg * msg );
7575
7676 // process incoming message
77−t_CKUINT otf_process_msg( Chuck_VM * vm, Chuck_Compiler * compiler,
77+t_CKUINT otf_process_msg( Chuck_VM * vm, Chuck_Compiler * compiler,
7878 Net_Msg * msg, t_CKBOOL immediate, void * data );
7979
8080 // send command
81−int otf_send_cmd( int argc, const char ** argv, t_CKINT & i, const char * host, int port, int * is_otf = NULL );
81+t_CKINT otf_send_cmd( t_CKINT argc, const char ** argv, t_CKINT & i, const char * host, t_CKINT port, t_CKINT * is_otf = NULL );
8282 // send file to remote host
83−int otf_send_file( const char * filename, Net_Msg & msg, const char * op, ck_socket sock );
83+t_CKINT otf_send_file( const char * filename, Net_Msg & msg, const char * op, ck_socket sock );
8484 // connect
85−ck_socket otf_send_connect( const char * host, int port );
85+ck_socket otf_send_connect( const char * host, t_CKINT port );
8686
8787 // callback
8888 void * 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
6363 // reset the parser
6464 void reset_parse( );
6565
66+// convert abstract syntax expression to string
67+std::string absyn2str( a_Exp exp );
6668
6769 // syntax highlighting tools
6870 #include <vector>
@@ -103,7 +105,7 @@ struct SyntaxToken · 34 unmodified lines
103105 std::string::size_type begin;
104106 // from the beginning of line
105107 std::string::size_type end;
106−
108+
107109 // constructor
108110 SyntaxToken() : type(0) { }
109111 // copy constructor
@@ -121,7 +123,7 @@ struct SyntaxToken · 11 unmodified lines
121123 struct SyntaxTokenList
122124 {
123125 std::vector<SyntaxToken> list;
124− std::vector<SyntaxToken>::size_type howmany;
126+ std::vector<SyntaxToken>::size_type howmany;
125127 // copy constructor
126128 SyntaxTokenList( const SyntaxTokenList & rhs )
127129 {
@@ -133,9 +135,9 @@ struct SyntaxTokenList · 5 unmodified lines
133135 for( std::vector<SyntaxToken>::size_type i = 0; i < howmany; i++ )
134136 list[i] = rhs.list[i];
135137 }
136− SyntaxTokenList() {
137− howmany = 0;
138− }
138+ SyntaxTokenList() {
139+ howmany = 0;
140+ }
139141 };
140142
141143
chuginate/template/chuck/include/chuck_scan.h+2−2
@@ -38,13 +38,13 @@ · 37 unmodified lines
3838
3939
4040 // scan a program into the env - type discovery scan
41−t_CKBOOL type_engine_scan0_prog( Chuck_Env * env, a_Program prog,
41+t_CKBOOL type_engine_scan0_prog( Chuck_Env * env, a_Program prog,
4242 te_HowMuch val = te_do_all );
4343 // scan a class definition (used by type_engine_add_dll())
4444 t_CKBOOL type_engine_scan0_class_def( Chuck_Env * env, a_Class_Def def );
4545
4646 // scan a program into the env - type resolution scan
47−t_CKBOOL type_engine_scan1_prog( Chuck_Env * env, a_Program prog,
47+t_CKBOOL type_engine_scan1_prog( Chuck_Env * env, a_Program prog,
4848 te_HowMuch val = te_do_all );
4949 // scan a class definition (used by type_engine_add_dll())
5050 t_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
5151
5252 //-----------------------------------------------------------------------------
5353 // 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
5555 // shell mode.
5656 //-----------------------------------------------------------------------------
5757 class Chuck_Shell
@@ -59,7 +59,7 @@ class Chuck_Shell · 1 unmodified line
5959 public:
6060 Chuck_Shell();
6161 virtual ~Chuck_Shell();
62−
62+
6363 t_CKBOOL init( Chuck_VM * process_vm, Chuck_Shell_UI * );
6464 void run();
6565 t_CKBOOL execute( string &, string & );
@@ -79,35 +79,35 @@ public: // HACK-GE: these were moved from protected for win32 · 13 unmodified lines
7979 map < string, string > variables;
8080 map < string, Command * > commands;
8181 vector < Command * > allocated_commands;
82−
83− map < string, string > saved_code;
82+
83+ map < string, string > saved_code;
8484
8585 string code;
8686
87− // helper functions
88− t_CKBOOL do_glob( const string &, string &, vector < string > & );
87+ // helper functions
88+ t_CKBOOL do_glob( const string &, string &, vector < string > & );
8989 void do_code( string &, string &, string command = "+ " );
9090 void do_code_context( string & );
9191
9292 protected:
93− // helper functions
94− void do_aliases();
95− void do_variables();
96−
97− // code helper functions
98− void start_code();
93+ // helper functions
94+ void do_aliases();
95+ void do_variables();
96+
97+ // code helper functions
98+ void start_code();
9999 void continue_code( string & );
100100 void string_hash( string &, string & );
101−
101+
102102 Chuck_Shell_UI * ui;
103−
103+
104104 t_CKBOOL initialized;
105105 t_CKBOOL stop;
106−
106+
107107 string prompt;
108−
108+
109109 string in;
110−
110+
111111 // code entry variables
112112 t_CKBOOL code_entry_active;
113113 t_CKUINT scope;
@@ -127,13 +127,13 @@ public: // HACK-GE: moved from protected for win32 · 13 unmodified lines
127127 public:
128128 virtual t_CKBOOL init( Chuck_Shell * );
129129 virtual t_CKINT execute( vector< string > &, string & ) = 0;
130− virtual string usage();
131− virtual string long_usage();
132−
130+ virtual string usage();
131+ virtual string long_usage();
132+
133133 protected:
134134 Chuck_Shell * caller;
135135 };
136−
136+
137137 //-----------------------------------------------------------------------------
138138 // name: class Chuck_Shell::Command_VM
139139 // desc: ...
@@ -144,8 +144,8 @@ public: // HACK-GE: moved from protected for win32 · 4 unmodified lines
144144 ~Command_VM();
145145 t_CKBOOL init( Chuck_Shell * );
146146 t_CKINT execute( vector< string > &, string & );
147− string usage();
148−
147+ string usage();
148+
149149 protected:
150150 map < string, Command * > commands;
151151 vector < Command * > allocated_commands;
@@ -160,7 +160,7 @@ public: // HACK-GE: moved from protected for win32 · 8 unmodified lines
160160 public:
161161 t_CKINT execute( vector< string > &, string & );
162162 };
163−
163+
164164 //-----------------------------------------------------------------------------
165165 // name: class Chuck_Shell::Command_VM_Remove
166166 // desc: ...
@@ -180,7 +180,7 @@ public: // HACK-GE: moved from protected for win32 · 13 unmodified lines
180180 public:
181181 t_CKINT execute( vector< string > &, string & );
182182 };
183−
183+
184184 //-----------------------------------------------------------------------------
185185 // name: class Chuck_Shell::Command_VM_List
186186 // desc: ...
@@ -190,7 +190,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
190190 public:
191191 t_CKINT execute( vector< string > &, string & );
192192 };
193−
193+
194194 //-----------------------------------------------------------------------------
195195 // name: class Chuck_Shell::Command_VM_Swap
196196 // desc: ...
@@ -200,7 +200,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
200200 public:
201201 t_CKINT execute( vector< string > &, string & );
202202 };
203−
203+
204204 //-----------------------------------------------------------------------------
205205 // name: class Chuck_Shell::Command_VM_AttachAdd
206206 // desc: ...
@@ -210,7 +210,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
210210 public:
211211 t_CKINT execute( vector< string > &, string & );
212212 };
213−
213+
214214 //-----------------------------------------------------------------------------
215215 // name: class Chuck_Shell::Command_Add
216216 // desc: ...
@@ -219,9 +219,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
219219 {
220220 public:
221221 t_CKINT execute( vector < string > &, string & );
222− string usage();
222+ string usage();
223223 };
224−
224+
225225 //-----------------------------------------------------------------------------
226226 // name: class Chuck_Shell::Command_Remove
227227 // desc: ...
@@ -230,9 +230,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
230230 {
231231 public:
232232 t_CKINT execute( vector < string > &, string & );
233− string usage();
233+ string usage();
234234 };
235−
235+
236236 //-----------------------------------------------------------------------------
237237 // name: class Chuck_Shell::Command_Status
238238 // desc: ...
@@ -241,10 +241,10 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
241241 {
242242 public:
243243 t_CKINT execute( vector < string > &, string & );
244− string usage();
244+ string usage();
245245 };
246−
247− //-----------------------------------------------------------------------------
246+
247+ //-----------------------------------------------------------------------------
248248 // name: class Chuck_Shell::Command_Removeall
249249 // desc: ...
250250 //-----------------------------------------------------------------------------
@@ -252,9 +252,9 @@ public: // HACK-GE: moved from protected for win32 · 1 unmodified line
252252 {
253253 public:
254254 t_CKINT execute( vector< string > &, string & );
255− string usage();
255+ string usage();
256256 };
257−
257+
258258 //-----------------------------------------------------------------------------
259259 // name: class Chuck_Shell::Command_Removelast
260260 // desc: ...
@@ -263,9 +263,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
263263 {
264264 public:
265265 t_CKINT execute( vector< string > &, string & );
266− string usage();
266+ string usage();
267267 };
268−
268+
269269 //-----------------------------------------------------------------------------
270270 // name: class Chuck_Shell::Command_Replace
271271 // desc: ...
@@ -274,9 +274,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
274274 {
275275 public:
276276 t_CKINT execute( vector< string > &, string & );
277− string usage();
277+ string usage();
278278 };
279−
279+
280280 //-----------------------------------------------------------------------------
281281 // name: class Chuck_Shell::Command_Kill
282282 // desc: ...
@@ -285,9 +285,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
285285 {
286286 public:
287287 t_CKINT execute( vector< string > &, string & );
288− //string usage();
288+ //string usage();
289289 };
290−
290+
291291 //-----------------------------------------------------------------------------
292292 // name: class Chuck_Shell::Command_Close
293293 // desc: ...
@@ -296,9 +296,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
296296 {
297297 public:
298298 t_CKINT execute( vector< string > &, string & );
299− //string usage();
299+ //string usage();
300300 };
301−
301+
302302 //-----------------------------------------------------------------------------
303303 // name: class Chuck_Shell::Command_Exit
304304 // desc: ...
@@ -307,9 +307,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
307307 {
308308 public:
309309 t_CKINT execute( vector< string > &, string & );
310− //string usage();
310+ //string usage();
311311 };
312−
312+
313313 //-----------------------------------------------------------------------------
314314 // name: class Chuck_Shell::Command_Ls
315315 // desc: ...
@@ -318,9 +318,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
318318 {
319319 public:
320320 t_CKINT execute( vector< string > &, string & );
321− //string usage();
321+ //string usage();
322322 };
323−
323+
324324 //-----------------------------------------------------------------------------
325325 // name: class Chuck_Shell::Command_Cd
326326 // desc: ...
@@ -329,9 +329,9 @@ public: // HACK-GE: moved from protected for win32 · 2 unmodified lines
329329 {
330330 public:
331331 t_CKINT execute( vector< string > &, string & );
332− //string usage();
332+ //string usage();
333333 };
334−
334+
335335 //-----------------------------------------------------------------------------
336336 // name: class Chuck_Shell::Command_Pwd
337337 // desc: ...
@@ -341,7 +341,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
341341 public:
342342 t_CKINT execute( vector< string > &, string & );
343343 };
344−
344+
345345 //-----------------------------------------------------------------------------
346346 // name: class Chuck_Shell::Command_Alias
347347 // desc: ...
@@ -351,7 +351,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
351351 public:
352352 t_CKINT execute( vector< string > &, string & );
353353 };
354−
354+
355355 //-----------------------------------------------------------------------------
356356 // name: class Chuck_Shell::Command_Unalias
357357 // desc: ...
@@ -361,7 +361,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
361361 public:
362362 t_CKINT execute( vector< string > &, string & );
363363 };
364−
364+
365365 //-----------------------------------------------------------------------------
366366 // name: class Chuck_Shell::Command_Source
367367 // desc: ...
@@ -371,7 +371,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
371371 public:
372372 t_CKINT execute( vector< string > &, string & );
373373 };
374−
374+
375375 //-----------------------------------------------------------------------------
376376 // name: class Chuck_Shell::Command_Code
377377 // desc: ...
@@ -382,13 +382,13 @@ public: // HACK-GE: moved from protected for win32 · 4 unmodified lines
382382 ~Command_Code();
383383 t_CKBOOL init( Chuck_Shell * );
384384 t_CKINT execute( vector< string > &, string & );
385− string usage();
386−
385+ string usage();
386+
387387 private:
388388 map < string, Command * > commands;
389389 vector < Command * > allocated_commands;
390390 };
391−
391+
392392 //-----------------------------------------------------------------------------
393393 // name: class Chuck_Shell::Command_CodeContext
394394 // desc: ...
@@ -398,7 +398,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
398398 public:
399399 t_CKINT execute( vector< string > &, string & );
400400 };
401−
401+
402402 //-----------------------------------------------------------------------------
403403 // name: class Chuck_Shell::Command_CodeSave
404404 // desc: ...
@@ -413,22 +413,22 @@ public: // HACK-GE: moved from protected for win32 · 8 unmodified lines
413413 // name: class Chuck_Shell::Command_CodeDelete
414414 // desc: ...
415415 //-----------------------------------------------------------------------------
416− class Command_CodeDelete : public Command
416+ class Command_CodeDelete : public Command
417417 {
418418 public:
419419 t_CKINT execute( vector< string > &, string & );
420420 };
421−
421+
422422 //-----------------------------------------------------------------------------
423423 // name: class Chuck_Shell::Command_CodeAdd
424424 // desc: ...
425425 //-----------------------------------------------------------------------------
426426 class Command_CodeAdd : public Command
427427 {
428− public:
428+ public:
429429 t_CKINT execute( vector< string > &, string & );
430430 };
431−
431+
432432 //-----------------------------------------------------------------------------
433433 // name: class Chuck_Shell::Command_CodeList
434434 // desc: ...
@@ -448,7 +448,7 @@ public: // HACK-GE: moved from protected for win32 · 13 unmodified lines
448448 public:
449449 t_CKINT execute( vector< string > &, string & );
450450 };
451−
451+
452452 //-----------------------------------------------------------------------------
453453 // name: class Chuck_Shell::Command_CodeWrite
454454 // desc: ...
@@ -468,7 +468,7 @@ public: // HACK-GE: moved from protected for win32 · 13 unmodified lines
468468 public:
469469 t_CKINT execute( vector< string > &, string & );
470470 };
471−
471+
472472 //-----------------------------------------------------------------------------
473473 // name: class Chuck_Shell::Command_Help
474474 // desc: ...
@@ -478,7 +478,7 @@ public: // HACK-GE: moved from protected for win32 · 3 unmodified lines
478478 public:
479479 t_CKINT execute( vector< string > &, string & );
480480 };
481−
481+
482482 };
483483
484484
@@ -492,7 +492,7 @@ public: · 7 unmodified lines
492492 virtual ~Chuck_Shell_VM() {}
493493
494494 public:
495− virtual Chuck_Shell_VM * copy()=0;
495+ virtual Chuck_Shell_VM * copy()=0;
496496 virtual t_CKBOOL add_shred( const vector< string > &, string & )=0;
497497 virtual t_CKBOOL remove_shred( const vector< string > &, string & )=0;
498498 virtual t_CKBOOL remove_all( string & )=0;
@@ -511,9 +511,9 @@ class Chuck_Shell_Network_VM : public Chuck_Shell_VM · 12 unmodified lines
511511 {
512512 public:
513513 virtual ~Chuck_Shell_Network_VM() {}
514−
514+
515515 public:
516− Chuck_Shell_VM * copy();
516+ Chuck_Shell_VM * copy();
517517 t_CKBOOL init( const string &, t_CKINT );
518518 t_CKBOOL add_shred( const vector< string > &, string & );
519519 t_CKBOOL remove_shred( const vector< string > &, string & );
@@ -523,9 +523,9 @@ public: · 3 unmodified lines
523523 t_CKBOOL status( string & );
524524 t_CKBOOL kill( string & );
525525 string fullname();
526−
527−private:
528− string hostname;
526+
527+private:
528+ string hostname;
529529 t_CKINT port;
530530 };
531531 /*
@@ -537,9 +537,9 @@ class Chuck_Shell_Process_VM : public Chuck_Shell_VM · 5 unmodified lines
537537 {
538538 public:
539539 virtual ~Chuck_Shell_Process_VM() {}
540−
540+
541541 public:
542− Chuck_Shell_VM * copy();
542+ Chuck_Shell_VM * copy();
543543 t_CKBOOL init( const string &, t_CKINT );
544544 t_CKBOOL add_shred( const vector< string > &, string & );
545545 t_CKBOOL remove_shred( const vector< string > &, string & );
@@ -549,12 +549,12 @@ public: · 3 unmodified lines
549549 t_CKBOOL status( string & );
550550 t_CKBOOL kill( string & );
551551 string fullname();
552−
553− t_CKUINT last_shred_id();
554−
555−private:
556− Chuck_VM * vm;
557− Chuck_Compiler * compiler;
552+
553+ t_CKUINT last_shred_id();
554+
555+private:
556+ Chuck_VM * vm;
557+ Chuck_Compiler * compiler;
558558 };
559559 */
560560 //-----------------------------------------------------------------------------
chuginate/template/chuck/include/chuck_stats.h+10−10
@@ -64,7 +64,7 @@ struct Shred_Activation · 63 unmodified lines
6464 {
6565 t_CKTIME when;
6666 t_CKUINT cycles;
67−
67+
6868 Shred_Activation( t_CKTIME a, t_CKUINT b ) { when = a; cycles = b; }
6969 };
7070
@@ -108,31 +108,31 @@ public: · 37 unmodified lines
108108 std::string owner;
109109 // source
110110 std::string source;
111−
111+
112112 // ctrl rate calculation
113113 std::queue<t_CKDUR> diffs;
114114 // number of diffs
115115 t_CKUINT num_diffs;
116116 // total diffs
117117 t_CKDUR diff_total;
118−
118+
119119 // exe per activation
120120 std::queue<t_CKUINT> act_cycles;
121121 // total
122122 t_CKUINT act_cycles_total;
123123 // last
124124 t_CKUINT last_cycles;
125−
125+
126126 // children
127127 std::vector<Shred_Stat *> children;
128128 void get_sporked( std::vector<Shred_Stat *> & out );
129129
130130 std::vector<Shred_Activation> activationss;
131131 void get_activations( std::vector<Shred_Activation> & out );
132−
132+
133133 // mutex
134134 XMutex mutex;
135−
135+
136136 // audicle info
137137 Shred_Data * data;
138138 Shred_Time * time;
@@ -161,7 +161,7 @@ public: · 22 unmodified lines
161161 static Chuck_Stats * instance();
162162
163163 public:
164− void set_vm_ref( Chuck_VM * _vm ) { vm = _vm; }
164+ void set_vm_ref( Chuck_VM * _vm ) { vm = _vm; }
165165
166166 public:
167167 void add_shred( Chuck_VM_Shred * shred );
@@ -173,16 +173,16 @@ public: · 5 unmodified lines
173173 public:
174174 Shred_Stat * get_shred( t_CKUINT xid )
175175 { 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,
177177 std::map<Shred_Stat *, Shred_Stat *> & d );
178178 static t_CKBOOL activations_yes;
179179
180180 protected:
181181 Chuck_Stats();
182182 ~Chuck_Stats();
183−
183+
184184 static Chuck_Stats * our_instance;
185−
185+
186186 protected:
187187 Chuck_VM * vm;
188188 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
4343
4444 typedef struct S_Symbol_ * S_Symbol;
4545
46−/* Make a unique symbol from a given c_str.
46+/* Make a unique symbol from a given c_str.
4747 * Different calls to make_symbol("foo") will yield the same S_Symbol
4848 * value, even if the "foo" c_str are at different locations. */
4949 S_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
5151 TAB_table TAB_empty3( TAB_eq_func eq, TAB_hash_func hash, unsigned int size );
5252 void TAB_delete( TAB_table t );
5353
54−/* Enter the mapping "key"->"value" into table "t",
54+/* Enter the mapping "key"->"value" into table "t",
5555 * shadowing but not destroying any previous binding for "key". */
5656 void TAB_enter(TAB_table t, void *key, void *value);
5757
@@ -65,7 +65,7 @@ void *TAB_topv(TAB_table t); · 7 unmodified lines
6565
6666
6767 /* 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
6969 * recent binding of any key to the oldest binding in the table */
7070 void TAB_dump(TAB_table t, void (*show)(void *key, void *value));
7171
chuginate/template/chuck/include/chuck_type.h+131−57
@@ -49,8 +49,8 @@ typedef enum { · 48 unmodified lines
4949 // general types
5050 te_none = 0, te_int, te_uint, te_single, te_float, te_double, te_time, te_dur,
5151 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,
53− te_event, te_void, te_stdout, te_stderr, te_adc, te_dac, te_bunghole,
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,
5454 te_uanablob, te_io, te_fileio, te_chout, te_cherr, te_multi,
5555 te_vec3, te_vec4, te_vector // ge: added 1.3.5.3
5656 } te_Type;
@@ -77,13 +77,29 @@ typedef enum { · 20 unmodified lines
7777 // name: enum te_HowMuch
7878 // desc: how much to scan/type check
7979 //-----------------------------------------------------------------------------
80−typedef enum {
80+typedef enum {
8181 te_do_all = 0, te_do_classes_only, te_do_no_classes
8282 } te_HowMuch;
8383
8484
8585
8686
87+//-----------------------------------------------------------------------------
88+// name: enum te_Origin | 1.5.0.0 (ge) added
89+// desc: where something (e.g., a Type) originates
90+//-----------------------------------------------------------------------------
91+typedef 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+
87103 //-----------------------------------------------------------------------------
88104 // name: struct Chuck_Scope
89105 // desc: scoping structure
@@ -111,14 +127,14 @@ public: · 21 unmodified lines
111127 // reset the scope
112128 void reset()
113129 { scope.clear(); this->push(); }
114−
130+
115131 // atomic commit
116132 void commit()
117133 {
118− assert( scope.size() != 0 );
134+ assert( scope.size() != 0 );
119135 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
120136
121− // go through buffer
137+ // go through buffer
122138 for( iter = commit_map.begin(); iter != commit_map.end(); iter++ )
123139 {
124140 // add to front/where
@@ -135,7 +151,7 @@ public: · 10 unmodified lines
135151 assert( scope.size() != 0 );
136152 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
137153
138− // go through buffer
154+ // go through buffer
139155 for( iter = commit_map.begin(); iter != commit_map.end(); iter++ )
140156 {
141157 // release
@@ -175,8 +191,8 @@ public: · 33 unmodified lines
175191 {
176192 val = (*scope.back())[xid];
177193 // look in commit buffer if the back is the front
178− if( !val && scope.back() == scope.front()
179− && (commit_map.find(xid) != commit_map.end()) )
194+ if( !val && scope.back() == scope.front()
195+ && (commit_map.find(xid) != commit_map.end()) )
180196 val = commit_map[xid];
181197 }
182198 else if( climb > 0 )
@@ -199,8 +215,15 @@ public: · 16 unmodified lines
199215 return (T)val;
200216 }
201217
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+
202225 // 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 )
204227 {
205228 assert( scope.size() != 0 );
206229 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
@@ -213,30 +236,36 @@ public: · 6 unmodified lines
213236 // go through map
214237 for( iter = m->begin(); iter != m->end(); iter++ )
215238 {
239+ // check mangled name
240+ if( !includeMangled && is_mangled( std::string(S_name((*iter).first))) )
241+ continue;
216242 // add
217243 out.push_back( (*iter).second );
218244 }
219245 }
220−
246+
221247 // 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 )
223249 {
224250 assert( scope.size() >= level );
225251 std::map<S_Symbol, Chuck_VM_Object *>::iterator iter;
226−
252+
227253 // clear the out
228254 out.clear();
229255 // get the front of the array
230256 std::map<S_Symbol, Chuck_VM_Object *> * m = &commit_map;
231−
257+
232258 // go through map
233259 for( iter = m->begin(); iter != m->end(); iter++ )
234260 {
261+ // check mangled name
262+ if( !includeMangled && is_mangled( std::string(S_name((*iter).first))) )
263+ continue;
264+
235265 // add
236266 out.push_back( (*iter).second );
237267 }
238268 }
239−
240269
241270 protected:
242271 std::vector<std::map<S_Symbol, Chuck_VM_Object *> *> scope;
@@ -288,7 +317,7 @@ struct Chuck_Namespace : public Chuck_VM_Object · 45 unmodified lines
288317 t_CKUINT offset;
289318
290319 // 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;
292321 class_data = NULL; class_data_size = 0; }
293322 // destructor
294323 virtual ~Chuck_Namespace() {
@@ -308,13 +337,13 @@ struct Chuck_Namespace : public Chuck_VM_Object · 13 unmodified lines
308337 Chuck_Func * lookup_func( S_Symbol name, t_CKINT climb = 1 );
309338
310339 // commit the maps
311− void commit() {
340+ void commit() {
312341 EM_log( CK_LOG_FINER, "committing namespace: '%s'...", name.c_str() );
313342 type.commit(); value.commit(); func.commit();
314343 }
315−
344+
316345 // rollback the maps
317− void rollback() {
346+ void rollback() {
318347 EM_log( CK_LOG_FINER, "rolling back namespace: '%s'...", name.c_str() );
319348 type.rollback(); value.rollback(); func.rollback();
320349 }
@@ -324,7 +353,7 @@ struct Chuck_Namespace : public Chuck_VM_Object · 3 unmodified lines
324353 // get top level values
325354 void get_values( std::vector<Chuck_Value *> & out );
326355 // 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 );
328357 };
329358
330359
@@ -334,7 +363,7 @@ struct Chuck_Namespace : public Chuck_VM_Object · 3 unmodified lines
334363 // name: struct Chuck_Context
335364 // desc: runtime type information pertaining to a file
336365 //-----------------------------------------------------------------------------
337−struct Chuck_Context : public Chuck_VM_Object
366+struct Chuck_Context : public Chuck_VM_Object
338367 {
339368 // src_name
340369 std::string filename;
@@ -370,7 +399,7 @@ struct Chuck_Context : public Chuck_VM_Object · 29 unmodified lines
370399 void rollback();
371400
372401 // constructor
373− Chuck_Context() { parse_tree = NULL; nspc = new Chuck_Namespace;
402+ Chuck_Context() { parse_tree = NULL; nspc = new Chuck_Namespace;
374403 public_class_def = NULL; has_error = FALSE;
375404 progress = P_NONE; }
376405 // destructor
@@ -398,10 +427,15 @@ public: · 21 unmodified lines
398427 // constructor
399428 Chuck_Env();
400429
430+public:
431+ // initialize
432+ t_CKBOOL init();
433+
401434 // REFACTOR-2017: carrier and accessors
402435 public:
403436 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; }
405439
406440 protected:
407441 Chuck_Carrier * m_carrier;
@@ -425,7 +459,7 @@ public: · 17 unmodified lines
425459 else
426460 return user_nspc;
427461 }
428−
462+
429463 // namespace stack
430464 std::vector<Chuck_Namespace *> nspc_stack;
431465 // expression namespace
@@ -482,7 +516,7 @@ public: · 50 unmodified lines
482516 // make sure this is 0
483517 class_scope = 0;
484518 }
485−
519+
486520 void load_user_namespace()
487521 {
488522 // user namespace
@@ -492,7 +526,7 @@ public: · 3 unmodified lines
492526 SAFE_ADD_REF(global_nspc);
493527 SAFE_ADD_REF(user_nspc);
494528 }
495−
529+
496530 void clear_user_namespace()
497531 {
498532 if(user_nspc) SAFE_RELEASE(user_nspc->parent);
@@ -506,11 +540,11 @@ public: · 7 unmodified lines
506540 { assert( nspc_stack.size() > 0 ); return nspc_stack.back(); }
507541 Chuck_Type * class_top( )
508542 { assert( class_stack.size() > 0 ); return class_stack.back(); }
509−
543+
510544 // check whether the context is the global context
511545 t_CKBOOL is_global()
512546 { return class_def == NULL && func == NULL && class_scope == 0; }
513−
547+
514548 public:
515549 // REFACTOR-2017: public types
516550 Chuck_Type * t_void;
@@ -533,12 +567,10 @@ public: · 16 unmodified lines
533567 Chuck_Type * t_uanablob;
534568 Chuck_Type * t_shred;
535569 Chuck_Type * t_io;
536− #ifndef __DISABLE_FILEIO__
537570 Chuck_Type * t_fileio;
538− #endif
539571 Chuck_Type * t_chout;
540572 Chuck_Type * t_cherr;
541− Chuck_Type * t_thread;
573+ // Chuck_Type * t_thread;
542574 Chuck_Type * t_class;
543575 Chuck_Type * t_dac;
544576 Chuck_Type * t_adc;
@@ -563,7 +595,7 @@ struct Chuck_UGen_Info : public Chuck_VM_Object · 18 unmodified lines
563595 t_CKUINT num_ins;
564596 // number of outgoing channels
565597 t_CKUINT num_outs;
566−
598+
567599 // for uana, NULL for ugen
568600 f_tock tock;
569601 // number of incoming ana channels
@@ -573,7 +605,7 @@ struct Chuck_UGen_Info : public Chuck_VM_Object · 3 unmodified lines
573605
574606 // constructor
575607 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;
577609 tock = NULL; num_ins_ana = num_outs_ana = 1; }
578610 };
579611
@@ -583,8 +615,9 @@ struct Chuck_UGen_Info : public Chuck_VM_Object · 3 unmodified lines
583615 //-----------------------------------------------------------------------------
584616 // name: struct Chuck_Type
585617 // desc: class containing information about a type
586−//-----------------------------------------------------------------------------_id
587−struct Chuck_Type : public Chuck_VM_Object
618+// note: 1.5.0.0 (ge) Chuck_VM_Object -> Chuck_Object
619+//-----------------------------------------------------------------------------
620+struct Chuck_Type : public Chuck_Object
588621 {
589622 // type id
590623 te_Type xid;
@@ -620,7 +653,9 @@ struct Chuck_Type : public Chuck_VM_Object · 29 unmodified lines
620653 t_CKBOOL has_destructor;
621654 // custom allocator
622655 f_alloc allocator;
623−
656+ // origin hint
657+ te_Origin originHint;
658+
624659 // documentation
625660 std::string doc;
626661 // example files
@@ -650,17 +685,23 @@ public: · 23 unmodified lines
650685 const std::string & str();
651686 // to c string
652687 const char * c_name();
653−
688+
654689 protected:
655690 // this for str() and c_name() use only
656691 std::string ret;
657692
658693 public: // apropos | 1.4.1.0 (ge)
659− // dump info to console
694+ // generate info; output to console
660695 void apropos();
661− // dump info to string
696+ // generate info; output to string
662697 void apropos( std::string & output );
663698
699+public: // 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+
664705 protected: // apropos-related helper function
665706 // dump top level info
666707 void apropos_top( std::string & output, const std::string & prefix );
@@ -711,7 +752,7 @@ struct Chuck_Value : public Chuck_VM_Object · 44 unmodified lines
711752 Chuck_Func * func_ref;
712753 // overloads
713754 t_CKINT func_num_overloads;
714−
755+
715756 // documentation
716757 std::string doc;
717758
@@ -720,7 +761,7 @@ struct Chuck_Value : public Chuck_VM_Object · 2 unmodified lines
720761 t_CKBOOL c = FALSE, t_CKBOOL acc = 0, Chuck_Namespace * o = NULL,
721762 Chuck_Type * oc = NULL, t_CKUINT s = 0 )
722763 { type = t; SAFE_ADD_REF(type); // add reference
723− name = n; offset = s;
764+ name = n; offset = s;
724765 is_const = c; access = acc;
725766 owner = o; SAFE_ADD_REF(o); // add reference
726767 owner_class = oc; SAFE_ADD_REF(oc); // add reference
@@ -772,13 +813,13 @@ struct Chuck_Func : public Chuck_VM_Object · 45 unmodified lines
772813 Chuck_Func * next;
773814 // for overriding
774815 Chuck_Value * up;
775−
816+
776817 // documentation
777818 std::string doc;
778819
779820 // constructor
780821 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;
782823 up = NULL; }
783824
784825 // destructor
@@ -802,7 +843,7 @@ t_CKBOOL type_engine_load_context( Chuck_Env * env, Chuck_Context * context ); · 17 unmodified lines
802843 t_CKBOOL type_engine_unload_context( Chuck_Env * env );
803844
804845 // type check a program into the env
805−t_CKBOOL type_engine_check_prog( Chuck_Env * env, a_Program prog,
846+t_CKBOOL type_engine_check_prog( Chuck_Env * env, a_Program prog,
806847 const std::string & filename );
807848 // make a context
808849 Chuck_Context * type_engine_make_context( a_Program prog,
@@ -833,8 +874,11 @@ t_CKBOOL isfunc( Chuck_Env * env, Chuck_Type * type ); · 24 unmodified lines
833874 t_CKBOOL iskindofint( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: this includes int + pointers
834875 t_CKUINT getkindof( Chuck_Env * env, Chuck_Type * type ); // added 1.3.1.0: to get the kindof a type
835876
877+
878+//-----------------------------------------------------------------------------
836879 // import
837−Chuck_Type * type_engine_import_class_begin( Chuck_Env * env, Chuck_Type * type,
880+//-----------------------------------------------------------------------------
881+Chuck_Type * type_engine_import_class_begin( Chuck_Env * env, Chuck_Type * type,
838882 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor = NULL,
839883 const char * doc = NULL );
840884 Chuck_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
843887 Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name, const char * parent,
844888 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor,
845889 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,
847892 const char * doc = NULL );
848893 Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name, const char * parent,
849894 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor,
850895 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,
852898 const char * doc = NULL );
853899 Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name, const char * parent,
854900 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
856902 Chuck_Type * type_engine_import_uana_begin( Chuck_Env * env, const char * name, const char * parent,
857903 Chuck_Namespace * where, f_ctor pre_ctor, f_dtor dtor,
858904 f_tick tick, f_tock tock, f_pmsg pmsg,
859− t_CKUINT num_ins = 0xffffffff, t_CKUINT num_outs = 0xffffffff,
860− t_CKUINT num_ins_ana = 0xffffffff, t_CKUINT num_outs_ana = 0xffffffff,
905+ t_CKUINT num_ins = CK_NO_VALUE,
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,
861909 const char * doc = NULL );
862910 t_CKBOOL type_engine_import_mfun( Chuck_Env * env, Chuck_DL_Func * mfun );
863911 t_CKBOOL type_engine_import_sfun( Chuck_Env * env, Chuck_DL_Func * sfun );
864−t_CKUINT type_engine_import_mvar( Chuck_Env * env, const char * type,
912+t_CKUINT type_engine_import_mvar( Chuck_Env * env, const char * type,
865913 const char * name, t_CKUINT is_const,
866914 const char * doc = NULL );
867915 t_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
871919 f_ctrl ctrl, t_CKBOOL write, t_CKBOOL read );
872920 t_CKBOOL type_engine_import_add_ex( Chuck_Env * env, const char * ex );
873921 t_CKBOOL type_engine_import_class_end( Chuck_Env * env );
874−t_CKBOOL type_engine_register_deprecate( Chuck_Env * env,
922+t_CKBOOL type_engine_register_deprecate( Chuck_Env * env,
875923 const std::string & former, const std::string & latter );
876924
877−// helpers
925+
926+//-----------------------------------------------------------------------------
927+// helper functions
928+//-----------------------------------------------------------------------------
878929 t_CKBOOL type_engine_check_reserved( Chuck_Env * env, const std::string & xid, int pos );
879930 t_CKBOOL type_engine_check_reserved( Chuck_Env * env, S_Symbol xid, int pos );
880931 // 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
883934 t_CKBOOL type_engine_check_const( Chuck_Env * env, a_Exp e, int pos ); // TODO
884935 t_CKBOOL type_engine_compat_func( a_Func_Def lhs, a_Func_Def rhs, int pos, std::string & err, t_CKBOOL print = TRUE );
885936 t_CKBOOL type_engine_get_deprecate( Chuck_Env * env, const std::string & from, std::string & to );
937+t_CKBOOL type_engine_is_base_static( Chuck_Env * env, Chuck_Type * baseType ); // 1.5.0.0 (ge) added
886938 Chuck_Type * type_engine_find_common_anc( Chuck_Type * lhs, Chuck_Type * rhs );
887939 Chuck_Type * type_engine_find_type( Chuck_Env * env, a_Id_List path );
940+Chuck_Type * type_engine_find_type( Chuck_Env * env, const std::string & name ); // 1.5.0.0 (ge) added
888941 Chuck_Value * type_engine_find_value( Chuck_Type * type, const std::string & xid );
889942 Chuck_Value * type_engine_find_value( Chuck_Type * type, S_Symbol xid );
890943 Chuck_Value * type_engine_find_value( Chuck_Env * env, const std::string & xid, t_CKBOOL climb, int linepos = 0 );
891944 Chuck_Namespace * type_engine_find_nspc( Chuck_Env * env, a_Id_List path );
892−/*******************************************************************************
893− * spencer: added this into function to provide the same logic path
894− * for type_engine_check_exp_decl() and ck_add_mvar() when they determine
895− * offsets for mvars -- added 1.3.0.0
896− ******************************************************************************/
945+
946+
947+//-----------------------------------------------------------------------------
948+// spencer: added this into function to provide the same logic path
949+// for type_engine_check_exp_decl() and ck_add_mvar() when they determine
950+// offsets for mvars -- added 1.3.0.0
951+//-----------------------------------------------------------------------------
897952 t_CKUINT type_engine_next_offset( t_CKUINT current_offset, Chuck_Type * type );
898953 // array verify
899954 t_CKBOOL verify_array( a_Array_Sub array );
@@ -901,7 +956,14 @@ t_CKBOOL verify_array( a_Array_Sub array ); · 1 unmodified line
901956 Chuck_Type * new_array_type( Chuck_Env * env, Chuck_Type * array_parent,
902957 t_CKUINT depth, Chuck_Type * base_type,
903958 Chuck_Namespace * owner_nspc );
959+// make type | 1.4.1.1 (nshaheed) added
960+Chuck_Type * new_array_element_type( Chuck_Env * env, Chuck_Type * base_type,
961+ t_CKUINT depth, Chuck_Namespace * owner_nspc);
962+
963+
964+//-----------------------------------------------------------------------------
904965 // conversion
966+//-----------------------------------------------------------------------------
905967 const char * type_path( a_Id_List path );
906968 a_Id_List str2list( const std::string & path );
907969 a_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
909971 t_CKBOOL escape_str( char * str_lit, int linepos );
910972 t_CKINT str2char( const char * char_lit, int linepos );
911973
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)
979+t_CKBOOL same_arg_lists( a_Arg_List lhs, a_Arg_List rhs );
980+// generate a string from an argument list (types only)
981+std::string arglist2string( a_Arg_List list );
982+
983+
984+//-----------------------------------------------------------------------------
912985 // REFACTOR-2017: exile! these default types now stored in env
986+//-----------------------------------------------------------------------------
913987 //extern Chuck_Type t_void;
914988 //extern Chuck_Type t_int;
915989 //extern Chuck_Type t_float;
chuginate/template/chuck/include/chuck_ugen.h+6−6
@@ -80,7 +80,7 @@ public: // src · 79 unmodified lines
8080 t_CKBOOL alloc_v( t_CKUINT size );
8181 t_CKBOOL set_is_buffered( t_CKBOOL buffered );
8282 void get_buffer( SAMPLE * buffer, t_CKINT num_elem );
83−
83+
8484 Chuck_UGen *src_chan( t_CKUINT chan );
8585 Chuck_UGen *dst_for_src_chan( t_CKUINT chan );
8686
@@ -133,17 +133,17 @@ public: // data · 46 unmodified lines
133133 SAMPLE m_pan;
134134 t_CKINT m_op;
135135 t_CKINT m_max_block_size;
136−
136+
137137 // SPENCERTODO: combine with block processing (added 1.3.0.0)
138138 SAMPLE * m_multi_in_v;
139139 SAMPLE * m_multi_out_v;
140−
140+
141141 // SPENCERTODO: better way to handle this (added 1.3.0.0)
142142 t_CKBOOL m_is_subgraph;
143143 Chuck_UGen * m_inlet, * m_outlet;
144144 Chuck_UGen * inlet();
145145 Chuck_UGen * outlet();
146−
146+
147147 // block processing
148148 SAMPLE * m_sum_v;
149149 SAMPLE * m_current_v;
@@ -154,10 +154,10 @@ public: // data · 4 unmodified lines
154154 Chuck_VM * vm;
155155 // owner
156156 Chuck_UGen * owner;
157−
157+
158158 // what a hack!
159159 t_CKBOOL m_is_uana;
160−
160+
161161 // what a hack! (added some time after REFACTOR-2017)
162162 t_CKBOOL m_is_buffered;
163163 AccumBuffer m_buffer;
chuginate/template/chuck/include/chuck_utils.h+1−1
@@ -49,7 +49,7 @@ struct U_boolList_ · 48 unmodified lines
4949 };
5050
5151
52−void * checked_malloc( int size );
52+void * checked_malloc( t_CKINT size );
5353 c_str cc_str( char * );
5454 U_boolList U_BoolList( t_CKBOOL head, U_boolList tail );
5555
chuginate/template/chuck/include/chuck_vm.h+18−18
@@ -145,7 +145,7 @@ public: · 144 unmodified lines
145145 t_CKUINT native_func;
146146 // is ctor?
147147 t_CKUINT native_func_type;
148−
148+
149149 // filename this code came from (added 1.3.0.0)
150150 std::string filename;
151151
@@ -169,17 +169,17 @@ public: · 17 unmodified lines
169169 Chuck_VM_Shred( );
170170 ~Chuck_VM_Shred( );
171171
172− t_CKBOOL initialize( Chuck_VM_Code * c,
173− t_CKUINT mem_st_size = CVM_MEM_STACK_SIZE,
172+ t_CKBOOL initialize( Chuck_VM_Code * c,
173+ t_CKUINT mem_st_size = CVM_MEM_STACK_SIZE,
174174 t_CKUINT reg_st_size = CVM_REG_STACK_SIZE );
175175 t_CKBOOL shutdown();
176176 t_CKBOOL run( Chuck_VM * vm );
177177 t_CKBOOL add( Chuck_UGen * ugen );
178178 t_CKBOOL remove( Chuck_UGen * ugen );
179−
179+
180180 // add parent object reference (added 1.3.1.2)
181181 t_CKVOID add_parent_ref( Chuck_Object * obj );
182−
182+
183183 #ifndef __DISABLE_SERIAL__
184184 // HACK - spencer (added 1.3.2.0)
185185 // add/remove SerialIO devices to close on shred exit
@@ -187,7 +187,7 @@ public: · 1 unmodified line
187187 t_CKVOID add_serialio( Chuck_IO_Serial * serial );
188188 t_CKVOID remove_serialio( Chuck_IO_Serial * serial );
189189 #endif
190−
190+
191191 //-----------------------------------------------------------------------------
192192 // data
193193 //-----------------------------------------------------------------------------
@@ -252,7 +252,7 @@ public: // ge: 1.3.5.3 · 58 unmodified lines
252252 bool popLoopCounter();
253253 // loop counter pointer stack
254254 std::vector<t_CKUINT *> m_loopCounters;
255−
255+
256256 #ifndef __DISABLE_SERIAL__
257257 private:
258258 std::list<Chuck_IO_Serial *> * m_serials;
@@ -272,7 +272,7 @@ public: · 13 unmodified lines
272272 t_CKUINT xid;
273273 std::string name;
274274 t_CKTIME start;
275− t_CKBOOL has_event;
275+ t_CKBOOL has_event;
276276
277277 public:
278278 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
297297 Chuck_VM_Status();
298298 ~Chuck_VM_Status();
299299 void clear();
300−
300+
301301 public:
302302 // sample rate
303303 t_CKUINT srate;
@@ -308,7 +308,7 @@ public: · 4 unmodified lines
308308 t_CKUINT t_minute;
309309 t_CKUINT t_hour;
310310 // list of shred status
311− std::vector<Chuck_VM_Shred_Status *> list;
311+ std::vector<Chuck_VM_Shred_Status *> list;
312312 };
313313
314314
@@ -374,10 +374,10 @@ public: · 59 unmodified lines
374374 Chuck_UGen * m_bunghole;
375375 t_CKUINT m_num_dac_channels;
376376 t_CKUINT m_num_adc_channels;
377−
377+
378378 // status cache
379379 Chuck_VM_Status m_status;
380−
380+
381381 // max block size for adaptive block processing
382382 t_CKUINT m_max_block_size;
383383 t_CKBOOL m_adaptive;
@@ -446,7 +446,7 @@ public: // running the machine · 62 unmodified lines
446446 t_CKBOOL compute( );
447447 // abort current running shred
448448 t_CKBOOL abort_current_shred( );
449−
449+
450450 public: // invoke functions
451451 t_CKBOOL invoke_static( Chuck_VM_Shred * shred );
452452
@@ -464,7 +464,7 @@ public: // msg · 11 unmodified lines
464464 // added 1.3.0.0 to fix uber-crash
465465 CBufferSimple * create_event_buffer();
466466 void destroy_event_buffer( CBufferSimple * buffer );
467−
467+
468468 public: // get error
469469 const char * last_error() const
470470 { return m_last_error.c_str(); }
@@ -514,7 +514,7 @@ public: · 43 unmodified lines
514514 Chuck_VM_Shred * spork( Chuck_VM_Shred * shred );
515515
516516 protected:
517− t_CKBOOL free( Chuck_VM_Shred * shred, t_CKBOOL cascade,
517+ t_CKBOOL free( Chuck_VM_Shred * shred, t_CKBOOL cascade,
518518 t_CKBOOL dec = TRUE );
519519 void dump( Chuck_VM_Shred * shred );
520520 void release_dump();
@@ -536,7 +536,7 @@ protected: · 15 unmodified lines
536536 CBufferSimple * m_msg_buffer;
537537 CBufferSimple * m_reply_buffer;
538538 CBufferSimple * m_event_buffer;
539−
539+
540540 // TODO: vector? (added 1.3.0.0 to fix uber-crash)
541541 std::list<CBufferSimple *> m_event_buffers;
542542
@@ -597,10 +597,10 @@ struct Chuck_Msg · 54 unmodified lines
597597
598598 Chuck_Msg() : args(NULL) { clear(); }
599599 ~Chuck_Msg() { SAFE_DELETE( args ); }
600−
600+
601601 // added 1.3.0.0
602602 void clear() { SAFE_DELETE( args ); memset( this, 0, sizeof(*this) ); }
603−
603+
604604 void set( const std::vector<std::string> & vargs )
605605 {
606606 SAFE_DELETE(args);
chuginate/template/chuck/include/chuck_win32.h+3−3
@@ -266,13 +266,13 @@ · 265 unmodified lines
266266
267267 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
268268 typedef union YYSTYPE
269−#line 59 "chuck.y"
269+#line 65 "chuck.y"
270270 {
271271 int pos;
272272 int ival;
273273 double fval;
274274 c_str sval;
275−
275+
276276 a_Program program;
277277 a_Section program_section;
278278 a_Stmt_List stmt_list;
@@ -294,7 +294,7 @@ typedef union YYSTYPE · 15 unmodified lines
294294 }
295295 /* Line 1529 of yacc.c. */
296296 #line 297 "chuck.tab.h"
297− YYSTYPE;
297+ YYSTYPE;
298298 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
299299 # define YYSTYPE_IS_DECLARED 1
300300 # define YYSTYPE_IS_TRIVIAL 1
chuginate/template/chuck/include/dirent_win32.h+37−37
@@ -1,8 +1,8 @@
11 /*
22 * dirent.h - dirent API for Microsoft Visual Studio
3− *
3+ *
44 * Copyright (C) 2006 Toni Ronkko
5− *
5+ *
66 * Permission is hereby granted, free of charge, to any person obtaining
77 * a copy of this software and associated documentation files (the
88 * ``Software''), to deal in the Software without restriction, including
@@ -10,10 +10,10 @@ · 1 unmodified line
1010 * distribute, sublicense, and/or sell copies of the Software, and to
1111 * permit persons to whom the Software is furnished to do so, subject to
1212 * the following conditions:
13− *
13+ *
1414 * The above copyright notice and this permission notice shall be included
1515 * in all copies or substantial portions of the Software.
16− *
16+ *
1717 * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
1818 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1919 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -33,13 +33,13 @@ · 13 unmodified lines
3333 * Bug fix: due to the strncpy_s() function this file only compiled in
3434 * Visual Studio 2005. Using the new string functions only when the
3535 * compiler version allows.
36− *
36+ *
3737 * Nov 2, 2006, Toni Ronkko
3838 * Major update: removed support for Watcom C, MS-DOS and Turbo C to
3939 * simplify the file, updated the code to compile cleanly on Visual
4040 * Studio 2005 with both unicode and multi-byte character strings,
4141 * removed rewinddir() as it had a bug.
42− *
42+ *
4343 * Aug 20, 2006, Toni Ronkko
4444 * Removed all remarks about MSVC 1.0, which is antiqued now. Simplified
4545 * comments by removing SGML tags.
@@ -115,11 +115,11 @@ opendir( · 69 unmodified lines
115115 dirp = (DIR*) malloc (sizeof (struct DIR));
116116 if (dirp != NULL) {
117117 char *p;
118−
118+
119119 /* take directory name... */
120120 STRNCPY (dirp->patt, dirname, sizeof(dirp->patt));
121121 dirp->patt[MAX_PATH] = '\0';
122−
122+
123123 /* ... and append search pattern to it */
124124 p = strchr (dirp->patt, '\0');
125125 if (dirp->patt < p && *(p-1) != '\\' && *(p-1) != ':') {
@@ -138,42 +138,42 @@ opendir( · 12 unmodified lines
138138
139139 /* there is an un-processed directory entry in memory now */
140140 dirp->cached = 1;
141−
141+
142142 }
143143 return dirp;
144144 }
145−
146−
147−/*
148− * ge: not a good idea
149− */
150−static void
151−rewinddir(
152− DIR *dirp)
153−{
154− assert( dirp != NULL );
155−
156− /* no cache */
157− dirp->cached = 0;
158−
159− /* open stream and retrieve first file */
160− dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data);
161− if (dirp->search_handle == INVALID_HANDLE_VALUE) {
162− /* invalid search pattern? */
163− return;
164− }
165−
166− /* there is an un-processed directory entry in memory now */
167− dirp->cached = 1;
145+
146+
147+/*
148+ * ge: not a good idea
149+ */
150+static void
151+rewinddir(
152+ DIR *dirp)
153+{
154+ assert( dirp != NULL );
155+
156+ /* no cache */
157+ dirp->cached = 0;
158+
159+ /* open stream and retrieve first file */
160+ dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data);
161+ if (dirp->search_handle == INVALID_HANDLE_VALUE) {
162+ /* invalid search pattern? */
163+ return;
164+ }
165+
166+ /* there is an un-processed directory entry in memory now */
167+ dirp->cached = 1;
168168 }
169−
170−
169+
170+
171171 /*
172172 * Read a directory entry, and return a pointer to a dirent structure
173173 * containing the name of the entry in d_name field. Individual directory
174174 * entries returned by this very function include regular files,
175175 * 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.
177177 */
178178 static struct dirent *
179179 readdir(
@@ -203,7 +203,7 @@ readdir( · 23 unmodified lines
203203 /* copy as a multibyte character string */
204204 STRNCPY (dirp->current.d_name, dirp->current.data.cFileName, sizeof(dirp->current.d_name));
205205 dirp->current.d_name[MAX_PATH] = '\0';
206−
206+
207207 return &dirp->current;
208208 }
209209
@@ -218,7 +218,7 @@ closedir( · 8 unmodified lines
218218 DIR *dirp)
219219 {
220220 assert (dirp != NULL);
221−
221+
222222 /* release search handle */
223223 if (dirp->search_handle != INVALID_HANDLE_VALUE) {
224224 FindClose (dirp->search_handle);
chuginate/template/chuck/include/hidio_sdl.h+4−4
@@ -63,7 +63,7 @@ public: · 62 unmodified lines
6363 t_CKBOOL close();
6464 t_CKBOOL good() { return m_valid; }
6565 t_CKINT num() { return m_valid ? (t_CKINT)m_device_num : -1; }
66−
66+
6767 public:
6868 void set_suppress( t_CKBOOL print_or_not )
6969 { m_suppress_output = print_or_not; }
@@ -131,7 +131,7 @@ public: · 61 unmodified lines
131131 static t_CKBOOL open( HidIn * hin, Chuck_VM * vm, t_CKINT device_type, std::string & device_name );
132132 static t_CKBOOL close( HidIn * hin );
133133 static void cleanup_buffer( Chuck_VM * vm );
134−
134+
135135 static void probeHidIn();
136136 static void probeHidOut();
137137
@@ -142,9 +142,9 @@ public: · 4 unmodified lines
142142 #endif
143143
144144 static void push_message( HidMsg & msg );
145−
145+
146146 static std::map< Chuck_VM *, CBufferSimple * > m_event_buffers;
147−
147+
148148 protected:
149149 static std::vector< std::vector<PhyHidDevIn *> > the_matrix;
150150 static XThread * the_thread;
chuginate/template/chuck/include/midiio_rtmidi.h+46−46
@@ -92,7 +92,7 @@ public: · 91 unmodified lines
9292 t_CKBOOL close();
9393 t_CKBOOL good() { return m_valid; }
9494 t_CKINT num() { return m_valid ? (t_CKINT)m_device_num : -1; }
95−
95+
9696 public:
9797 void set_suppress( t_CKBOOL print_or_not )
9898 { m_suppress_output = print_or_not; }
@@ -187,7 +187,7 @@ public: · 88 unmodified lines
187187 protected:
188188 MidiInManager();
189189 ~MidiInManager();
190−
190+
191191 static t_CKBOOL add_vm( Chuck_VM * vm, t_CKINT device_num, t_CKBOOL suppress_output );
192192
193193 static std::vector<RtMidiIn *> the_mins;
@@ -333,7 +333,7 @@ struct MidiNoteEvent · 139 unmodified lines
333333 MidiNoteEvent * simultaneous;
334334 // link to parent (could be self)
335335 MidiNoteEvent * parent;
336−
336+
337337 // more data
338338 double startTime;
339339 double endTime;
@@ -341,12 +341,12 @@ struct MidiNoteEvent · 1 unmodified line
341341 int bendAmount;
342342 int programChange;
343343 bool phrasemark;
344−
344+
345345 // constructor
346346 MidiNoteEvent() : data1(0), data2(0), data3(0), time(0.0), untilNext(0.0),
347347 simultaneous(NULL), parent(NULL), startTime(0), endTime(0), shouldBend(false),
348348 bendAmount(0), programChange(0), phrasemark(false) { }
349−
349+
350350 // type of message
351351 int type() const { return data1 & 0x70; }
352352 // channel
@@ -367,7 +367,7 @@ struct MidiLyricEvent · 14 unmodified lines
367367 // time data
368368 double time;
369369 double endTime;
370−
370+
371371 // constructor
372372 MidiLyricEvent() : time(0), endTime(0) { }
373373 };
@@ -390,51 +390,51 @@ class MidiScoreReader · 16 unmodified lines
390390 public:
391391 MidiScoreReader();
392392 ~MidiScoreReader();
393−
393+
394394 public:
395395 bool load( const char * filename, float velScale = 0.0f );
396396 void cleanup();
397−
397+
398398 public:
399399 // rewind to beginning
400400 void rewind();
401401 // 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 );
403403 // 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 );
405405 // advance to next event
406− bool seek( long track, long numToAdvance = 1 );
406+ bool seek( t_CKINT track, t_CKINT numToAdvance = 1 );
407407 // advance to next note on
408− bool seekToNoteOn( long track );
408+ bool seekToNoteOn( t_CKINT track );
409409 // 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,
411411 bool includeSimultaneous = false );
412412 // isDone
413− bool isDone( long track, double currTime );
414−
415−
413+ bool isDone( t_CKINT track, double currTime );
414+
415+
416416 public:
417417 // get number of tracks
418− long getNumTracks() const;
418+ t_CKINT getNumTracks() const;
419419 // get number of events per track
420− long getNumEvents( long track ) const;
420+ t_CKINT getNumEvents( t_CKINT track ) const;
421421 // get number of tracks with more than 0 events
422− long getNumTracksNonZero() const;
422+ t_CKINT getNumTracksNonZero() const;
423423 // 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;
425425 // get BPM
426426 double getBPM() const;
427427 // get an entire track's note events
428− const std::vector<MidiNoteEvent *> & getNoteEvents( long track );
428+ const std::vector<MidiNoteEvent *> & getNoteEvents( t_CKINT track );
429429 // get an entire track's lyric events
430− const std::vector<MidiLyricEvent *> & getLyricEvents( long track );
430+ const std::vector<MidiLyricEvent *> & getLyricEvents( t_CKINT track );
431431 // get count
432− long getCount( long track, const std::string & key );
432+ t_CKINT getCount( t_CKINT track, const std::string & key );
433433 // get lowest note for a track
434− long getLowestNote( long track, const MidiNoteEvent *start );
434+ t_CKINT getLowestNote( t_CKINT track, const MidiNoteEvent *start );
435435 // get highest note for a track
436− long getHighestNote( long track, const MidiNoteEvent *start );
437−
436+ t_CKINT getHighestNote( t_CKINT track, const MidiNoteEvent *start );
437+
438438 public: // TODO: these may as well be a separate object
439439 // push a event to remember
440440 void enqueue( const MidiNoteEvent * event );
@@ -444,26 +444,26 @@ public: // TODO: these may as well be a separate object · 3 unmodified lines
444444 void dequeue();
445445 // push to front
446446 void enqueue_front( const MidiNoteEvent * event );
447−
447+
448448 public: // track naming
449449 // sets track name
450− void setTrackName( long track, const std::string & name );
450+ void setTrackName( t_CKINT track, const std::string & name );
451451 // gets track name ("" if not present)
452− std::string getTrackName( long track );
452+ std::string getTrackName( t_CKINT track );
453453 // gets the track with the given name (-1 if not present)
454− long getTrackForName( const std::string & name );
455−
454+ t_CKINT getTrackForName( const std::string & name );
455+
456456 protected: // for use while loading a track
457457 // 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 );
459459 // 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 );
461461 // 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 );
463463 // handle note events, managing m_activeNotes and setting the event's endTime
464− void handleNoteOn( MidiNoteEvent * e, long note );
465− void handleNoteOff( long note, double time );
466−
464+ void handleNoteOn( MidiNoteEvent * e, t_CKINT note );
465+ void handleNoteOff( t_CKINT note, double time );
466+
467467 protected:
468468 // midi
469469 stk::MidiFileIn * m_midiFile;
@@ -472,28 +472,28 @@ protected: · 2 unmodified lines
472472 // vector of tracks of events
473473 std::vector< std::vector<MidiLyricEvent *> > m_lyricEvents;
474474 // vector of indices
475− std::vector<unsigned long> m_indices;
475+ std::vector<t_CKUINT> m_indices;
476476 // stack of events
477477 std::deque<const MidiNoteEvent *> m_queue;
478478 // vector of event
479479 std::vector<const MidiNoteEvent *> m_result;
480480 // search pointer
481− std::vector<unsigned long> m_searchIndices;
481+ std::vector<t_CKUINT> m_searchIndices;
482482 // count map
483− std::vector< std::map< std::string, long > > m_countMaps;
483+ std::vector< std::map< std::string, t_CKINT > > m_countMaps;
484484 // HACK: scale the velocity (0-1)
485485 float m_velocity_scale;
486486 // track names
487− std::map<std::string, long> m_nameToTrack;
488− std::map<long, std::string> m_trackToName;
487+ std::map<std::string, t_CKINT> m_nameToTrack;
488+ std::map<t_CKINT, std::string> m_trackToName;
489489 // number of non-zero tracks
490− long m_numNonZeroTracks;
490+ t_CKINT m_numNonZeroTracks;
491491 // vector of indices of non-zero tracks
492− std::vector<long> m_nonZeroTrackIndices;
493−
492+ std::vector<t_CKINT> m_nonZeroTrackIndices;
493+
494494 private: // used during track loading
495495 // active notes, map from MIDI note to event
496− std::map<long, MidiNoteEvent *> m_activeNotes;
496+ std::map<t_CKINT, MidiNoteEvent *> m_activeNotes;
497497 };
498498
499499
chuginate/template/chuck/include/rtmidi.h+10−10
@@ -38,11 +38,11 @@ · 37 unmodified lines
3838 /************************************************************************/
3939 /*! \class RtMidiError
4040 \brief Exception handling class for RtAudio & RtMidi.
41−
41+
4242 The RtMidiError class is quite simple but it does allow errors to be
4343 "caught" by RtMidiError::Type. See the RtAudio and RtMidi
4444 documentation to know which methods can throw an RtMidiError.
45−
45+
4646 */
4747 /************************************************************************/
4848
@@ -70,26 +70,26 @@ public: · 21 unmodified lines
7070 SYSTEM_ERROR, /*!< A system error occured. */
7171 THREAD_ERROR /*!< A thread error occured. */
7272 };
73−
73+
7474 //! The constructor.
7575 RtMidiError( const std::string& message, Type type = RtMidiError::UNSPECIFIED )
7676 throw() : message_(message), type_(type) {}
77−
77+
7878 //! The destructor.
7979 virtual ~RtMidiError( void ) throw() {}
80−
80+
8181 //! Prints thrown error message to stderr.
8282 virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
8383
8484 //! Returns the thrown error message type.
8585 virtual const Type& getType(void) const throw() { return type_; }
86−
86+
8787 //! Returns the thrown error message string.
8888 virtual const std::string& getMessage(void) const throw() { return message_; }
89−
89+
9090 //! Returns the thrown error message as a c-style string.
9191 virtual const char* what( void ) const throw() { return message_.c_str(); }
92−
92+
9393 protected:
9494 std::string message_;
9595 Type type_;
@@ -253,8 +253,8 @@ class RtMidiIn : public RtMidi · 157 unmodified lines
253253
254254 // A MIDI structure used internally by the class to store incoming
255255 // messages. Each message represents one and only one MIDI message.
256− struct MidiMessage {
257− std::vector<unsigned char> bytes;
256+ struct MidiMessage {
257+ std::vector<unsigned char> bytes;
258258 double timeStamp;
259259
260260 // Default constructor.
chuginate/template/chuck/include/ugen_osc.h+2−2
@@ -66,11 +66,11 @@ CK_DLL_TICK( pulseosc_tick ); · 65 unmodified lines
6666 // triosc
6767 CK_DLL_TICK( triosc_tick );
6868
69−// sawosc
69+// sawosc
7070 CK_DLL_CTOR( sawosc_ctor );
7171 CK_DLL_CTRL( sawosc_ctrl_width );
7272
73−// sqrosc
73+// sqrosc
7474 CK_DLL_CTOR( sqrosc_ctor );
7575 CK_DLL_CTRL( sqrosc_ctrl_width );
7676
chuginate/template/chuck/include/ugen_stk.h+141−143
@@ -47,9 +47,6 @@ struct Chuck_Carrier; · 46 unmodified lines
4747 DLL_QUERY stk_query( Chuck_DL_Query * QUERY );
4848 t_CKBOOL stk_detach( Chuck_Carrier * carrier );
4949
50−
51−
52−
5350 // this determines STK float type and de-denormal method
5451 #ifndef __STK_USE_SINGLE_PRECISION__
5552 #define MY_FLOAT double
@@ -59,6 +56,9 @@ t_CKBOOL stk_detach( Chuck_Carrier * carrier ); · 3 unmodified lines
5956 #define CK_STK_DDN CK_DDN_SINGLE
6057 #endif
6158
59+// 1.4.2.0 (ge) | added as part of switch to snprintf()
60+#define STK_MSG_BUF_LENGTH 256
61+
6262
6363
6464
@@ -88,14 +88,14 @@ t_CKBOOL stk_detach( Chuck_Carrier * carrier ); · 23 unmodified lines
8888 // a "long double" in the future.
8989
9090 //XXX sample is already defined in chuck_def.h!!!
91−#if !defined(SAMPLE)
91+#if !defined(SAMPLE)
9292 typedef SAMPLE MY_FLOAT;
9393 #endif
9494 // The "MY_FLOAT" type will be deprecated in STK
9595 // versions higher than 4.1.2 and replaced with the variable
9696 // "StkFloat".
9797 //typedef double StkFloat;
98−//#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
98+//#if defined(__PLATFORM_WIN32__) ||
9999 // #pragma deprecated(MY_FLOAT)
100100 //#else
101101 // typedef StkFloat MY_FLOAT __attribute__ ((deprecated));
@@ -110,7 +110,7 @@ t_CKBOOL stk_detach( Chuck_Carrier * carrier ); · 8 unmodified lines
110110 class StkError
111111 {
112112 public:
113− enum TYPE {
113+ enum TYPE {
114114 WARNING,
115115 DEBUG_WARNING,
116116 FUNCTION_ARGUMENT,
@@ -126,7 +126,7 @@ public: · 9 unmodified lines
126126 };
127127
128128 public: // SWAP formerly protected
129− char message[256];
129+ char message[STK_MSG_BUF_LENGTH];
130130 TYPE type;
131131
132132 public:
@@ -250,7 +250,7 @@ typedef double FLOAT64; · 117 unmodified lines
250250 #if defined(__WINDOWS_PTHREAD__)
251251 #define __OS_WINDOWS_CYGWIN__
252252 #define __STK_REALTIME__
253−#elif defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
253+#elif defined(__PLATFORM_WIN32__)
254254 #define __OS_WINDOWS__
255255 #define __STK_REALTIME__
256256 #elif defined(__PLATFORM_LINUX__)
@@ -492,15 +492,14 @@ class Instrmnt : public Stk · 235 unmodified lines
492492
493493 //! Computer \e vectorSize outputs and return them in \e vector.
494494 virtual MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
495−
495+
496496 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
497497 virtual void controlChange(int number, MY_FLOAT value);
498498
499499 public: // SWAP formerly protected
500+ MY_FLOAT lastOutput;
500501 // chuck
501502 t_CKFLOAT m_frequency;
502−
503− MY_FLOAT lastOutput;
504503 };
505504
506505
@@ -635,7 +634,7 @@ public: · 128 unmodified lines
635634 Alternatively, the delay and maximum length
636635 can be set during instantiation with an
637636 overloaded constructor.
638−
637+
639638 A non-interpolating delay line is typically
640639 used in fixed delay-length applications, such
641640 as for reverberation.
@@ -748,7 +747,7 @@ public: · 106 unmodified lines
748747 DelayL();
749748
750749 //! Overloaded constructor which specifies the current and maximum delay-line lengths.
751−
750+
752751 DelayL(MY_FLOAT theDelay, long maxDelay);
753752
754753 //! Class destructor.
@@ -770,7 +769,7 @@ public: · 15 unmodified lines
770769 //! Input one sample to the delay-line and return one output.
771770 MY_FLOAT tick(MY_FLOAT sample);
772771
773− public: // SWAP formerly protected
772+ public: // SWAP formerly protected
774773 MY_FLOAT alpha;
775774 MY_FLOAT omAlpha;
776775 MY_FLOAT nextOutput;
@@ -835,7 +834,7 @@ public: · 58 unmodified lines
835834 //! Take \e vectorSize inputs and return the corresponding function values in \e vector.
836835 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
837836
838−public: // SWAP formerly protected
837+public: // SWAP formerly protected
839838 MY_FLOAT offSet;
840839 MY_FLOAT slope;
841840 MY_FLOAT lastOutput;
@@ -962,7 +961,7 @@ public: · 120 unmodified lines
962961 Percussion Instruments", Proceedings of the
963962 1999 International Computer Music Conference.
964963
965− Control Change Numbers:
964+ Control Change Numbers:
966965 - Bow Pressure = 2
967966 - Bow Motion = 4
968967 - Strike Position = 8 (not implemented)
@@ -1018,7 +1017,7 @@ class BandedWG : public Instrmnt · 49 unmodified lines
10181017 void pluck(MY_FLOAT amp);
10191018
10201019 //! 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 ); }
10221021 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
10231022
10241023 //! Stop a note with the given amplitude (speed of decay).
@@ -1085,7 +1084,7 @@ class BandedWG : public Instrmnt · 60 unmodified lines
10851084 WvIn supports multi-channel data in interleaved
10861085 format. It is important to distinguish the
10871086 tick() methods, which return samples produced
1088− by averaging across sample frames, from the
1087+ by averaging across sample frames, from the
10891088 tickFrame() methods, which return pointers to
10901089 multi-channel sample frames. For single-channel
10911090 data, these methods return equivalent values.
@@ -1161,7 +1160,7 @@ public: · 69 unmodified lines
11611160 //! Normalize data to a maximum of \e +-peak.
11621161 /*!
11631162 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
11651164 (\e peak/maximum). For incrementally loaded files with floating-
11661165 point data types, direct scaling by \e peak is performed.
11671166 */
@@ -1255,8 +1254,8 @@ public: // SWAP formerly protected · 87 unmodified lines
12551254 // Get MAT-file header information.
12561255 bool getMatInfo( const char *fileName );
12571256
1258− char msg[256];
1259− // char m_filename[256]; // chuck data
1257+ char msg[STK_MSG_BUF_LENGTH];
1258+ // char m_filename[STK_MSG_BUF_LENGTH]; // chuck data
12601259 Chuck_String str_filename; // chuck data
12611260 FILE *fd;
12621261 MY_FLOAT *data;
@@ -1315,7 +1314,7 @@ public: · 52 unmodified lines
13151314 WaveLoop( );
13161315 //! Class constructor.
13171316 WaveLoop( const char *fileName, bool raw = FALSE, bool generate = true );
1318−
1317+
13191318 virtual void openFile( const char * fileName, bool raw = FALSE, bool n = TRUE );
13201319
13211320 //! Class destructor.
@@ -1458,7 +1457,7 @@ class TwoZero : public FilterStk // formerly protected Filter · 136 unmodified lines
14581457 waves and envelopes, determined via a
14591458 constructor argument.
14601459
1461− Control Change Numbers:
1460+ Control Change Numbers:
14621461 - Control One = 2
14631462 - Control Two = 4
14641463 - LFO Speed = 11
@@ -1529,7 +1528,7 @@ class FM : public Instrmnt · 64 unmodified lines
15291528 MY_FLOAT getFMTableSusLevel(int index); // programming settings
15301529 // 1.4.1.0 (prc): *** END REPAIRATHON2021 BLOCK ***
15311530 /****************************************/
1532−
1531+
15331532 //! Set instrument parameters for a particular frequency.
15341533 virtual void setFrequency(MY_FLOAT frequency);
15351534
@@ -1566,8 +1565,8 @@ class FM : public Instrmnt · 30 unmodified lines
15661565 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
15671566 virtual void controlChange(int number, MY_FLOAT value);
15681567
1569− public: // SWAP formerly protected
1570− ADSR **adsr;
1568+ public: // SWAP formerly protected
1569+ ADSR **adsr;
15711570 WaveLoop **waves;
15721571 WaveLoop *vibrato;
15731572 TwoZero *twozero;
@@ -1587,7 +1586,6 @@ class FM : public Instrmnt · 13 unmodified lines
15871586 MY_FLOAT __FM_gains[100];
15881587 MY_FLOAT __FM_susLevels[16];
15891588 MY_FLOAT __FM_attTimes[32];
1590−
15911589 };
15921590
15931591 #endif
@@ -1612,7 +1610,7 @@ class FM : public Instrmnt · 18 unmodified lines
16121610 4 --
16131611 \endcode
16141612
1615− Control Change Numbers:
1613+ Control Change Numbers:
16161614 - Operator 4 (feedback) Gain = 2
16171615 - Operator 3 Gain = 4
16181616 - LFO Speed = 11
@@ -1691,7 +1689,7 @@ public: · 72 unmodified lines
16911689 //! Take \e vectorSize inputs and return the corresponding function values in \e vector.
16921690 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
16931691
1694−public: // SWAP formerly protected
1692+public: // SWAP formerly protected
16951693 MY_FLOAT lastOutput;
16961694
16971695 };
@@ -1832,7 +1830,7 @@ public: · 134 unmodified lines
18321830 //! Return the last computed value.
18331831 MY_FLOAT lastOut() const;
18341832
1835−public: // SWAP formerly protected
1833+public: // SWAP formerly protected
18361834
18371835 MY_FLOAT lastOutput;
18381836
@@ -1851,7 +1849,7 @@ public: // SWAP formerly protected · 12 unmodified lines
18511849 (biquad filter) with a polynomial jet
18521850 excitation (a la Cook).
18531851
1854− Control Change Numbers:
1852+ Control Change Numbers:
18551853 - Noise Gain = 4
18561854 - Vibrato Frequency = 11
18571855 - Vibrato Gain = 1
@@ -1901,14 +1899,14 @@ class BlowBotl : public Instrmnt · 43 unmodified lines
19011899 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
19021900 void controlChange(int number, MY_FLOAT value);
19031901
1904− public: // SWAP formerly protected
1902+ public: // SWAP formerly protected
19051903 // chuck
19061904 t_CKFLOAT m_rate;
19071905 t_CKFLOAT m_noiseGain;
19081906 t_CKFLOAT m_vibratoFreq;
19091907 t_CKFLOAT m_vibratoGain;
19101908 t_CKFLOAT m_volume;
1911−
1909+
19121910 void setVibratoFreq(MY_FLOAT freq)
19131911 { vibrato->setFrequency( freq ); m_vibratoFreq = vibrato->m_freq; }
19141912 void setVibratoGain(MY_FLOAT gain)
@@ -1994,7 +1992,7 @@ public: · 79 unmodified lines
19941992 //! Take \e vectorSize inputs and return the corresponding function values in \e vector.
19951993 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
19961994
1997−public: // SWAP formerly protected
1995+public: // SWAP formerly protected
19981996 MY_FLOAT offSet;
19991997 MY_FLOAT slope;
20001998 MY_FLOAT lastOutput;
@@ -2104,7 +2102,7 @@ class OneZero : public FilterStk // formerly protected Filter · 103 unmodified lines
21042102 use possibly subject to patents held by Stanford
21052103 University, Yamaha, and others.
21062104
2107− Control Change Numbers:
2105+ Control Change Numbers:
21082106 - Reed Stiffness = 2
21092107 - Noise Gain = 4
21102108 - Tonehole State = 11
@@ -2162,7 +2160,7 @@ class BlowHole : public Instrmnt · 51 unmodified lines
21622160 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
21632161 void controlChange(int number, MY_FLOAT value);
21642162
2165− public: // SWAP formerly protected
2163+ public: // SWAP formerly protected
21662164
21672165 // CHUCK
21682166 t_CKFLOAT m_reed;
@@ -2283,7 +2281,7 @@ public: · 114 unmodified lines
22832281 use possibly subject to patents held by
22842282 Stanford University, Yamaha, and others.
22852283
2286− Control Change Numbers:
2284+ Control Change Numbers:
22872285 - Bow Pressure = 2
22882286 - Bow Position = 4
22892287 - Vibrato Frequency = 11
@@ -2323,7 +2321,7 @@ class Bowed : public Instrmnt · 33 unmodified lines
23232321 //! Decrease breath pressure with given rate of decrease.
23242322 void stopBowing(MY_FLOAT rate);
23252323
2326− void noteOn(MY_FLOAT amplitude) { noteOn ( m_frequency, amplitude ); }
2324+ void noteOn(MY_FLOAT amplitude) { noteOn ( m_frequency, amplitude ); }
23272325 //! Start a note with the given frequency and amplitude.
23282326 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
23292327
@@ -2406,7 +2404,7 @@ public: · 76 unmodified lines
24062404 DelayA();
24072405
24082406 //! Overloaded constructor which specifies the current and maximum delay-line lengths.
2409−
2407+
24102408 DelayA(MY_FLOAT theDelay, long maxDelay);
24112409
24122410 //! Class destructor.
@@ -2431,7 +2429,7 @@ public: · 18 unmodified lines
24312429 //! Input one sample to the delay-line and return one output.
24322430 MY_FLOAT tick(MY_FLOAT sample);
24332431
2434−public: // SWAP formerly protected
2432+public: // SWAP formerly protected
24352433 MY_FLOAT alpha;
24362434 MY_FLOAT coeff;
24372435 MY_FLOAT apInput;
@@ -2455,7 +2453,7 @@ public: // SWAP formerly protected · 17 unmodified lines
24552453 use possibly subject to patents held by
24562454 Stanford University, Yamaha, and others.
24572455
2458− Control Change Numbers:
2456+ Control Change Numbers:
24592457 - Lip Tension = 2
24602458 - Slide Length = 4
24612459 - Vibrato Frequency = 11
@@ -2506,7 +2504,7 @@ class Brass: public Instrmnt · 44 unmodified lines
25062504 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
25072505 void controlChange(int number, MY_FLOAT value);
25082506
2509− public: // SWAP formerly protected
2507+ public: // SWAP formerly protected
25102508
25112509 // CHUCK
25122510 t_CKFLOAT m_rate;
@@ -2576,7 +2574,7 @@ class Chorus : public Stk · 63 unmodified lines
25762574 //! Set modulation frequency.
25772575 void setModFrequency(MY_FLOAT frequency);
25782576
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).
25802578 void setEffectMix(MY_FLOAT mix);
25812579
25822580 //! Return the last output value.
@@ -2594,7 +2592,7 @@ class Chorus : public Stk · 11 unmodified lines
25942592 //! Take \e vectorSize inputs, compute the same number of outputs and return them in \e vector.
25952593 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
25962594
2597− public: // SWAP formerly protected
2595+ public: // SWAP formerly protected
25982596 DelayL *delayLine[2];
25992597 WaveLoop *mods[2];
26002598 MY_FLOAT baseLength;
@@ -2623,7 +2621,7 @@ class Chorus : public Stk · 22 unmodified lines
26232621 use possibly subject to patents held by Stanford
26242622 University, Yamaha, and others.
26252623
2626− Control Change Numbers:
2624+ Control Change Numbers:
26272625 - Reed Stiffness = 2
26282626 - Noise Gain = 4
26292627 - Vibrato Frequency = 11
@@ -2753,7 +2751,7 @@ class Drummer : public Instrmnt · 123 unmodified lines
27532751 //! Compute one output sample.
27542752 MY_FLOAT tick();
27552753
2756− public: // SWAP formerly protected
2754+ public: // SWAP formerly protected
27572755 WvIn *waves[DRUM_POLYPHONY];
27582756 OnePole *filters[DRUM_POLYPHONY];
27592757 int sounding[DRUM_POLYPHONY];
@@ -2797,7 +2795,7 @@ public: · 37 unmodified lines
27972795 void set(MY_FLOAT max);
27982796 MY_FLOAT getDelay();
27992797
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).
28012799 void setEffectMix(MY_FLOAT mix);
28022800
28032801 //! Return the last output value.
@@ -2838,7 +2836,7 @@ public: · 34 unmodified lines
28382836 \->3 -/
28392837 \endcode
28402838
2841− Control Change Numbers:
2839+ Control Change Numbers:
28422840 - Vowel = 2
28432841 - Spectral Tilt = 4
28442842 - LFO Speed = 11
@@ -2905,7 +2903,7 @@ class FMVoices : public FM · 60 unmodified lines
29052903 use possibly subject to patents held by Stanford
29062904 University, Yamaha, and others.
29072905
2908− Control Change Numbers:
2906+ Control Change Numbers:
29092907 - Jet Delay = 2
29102908 - Noise Gain = 4
29112909 - Vibrato Frequency = 11
@@ -2973,14 +2971,14 @@ public: // SWAP formerly protected · 61 unmodified lines
29732971 t_CKFLOAT m_vibratoGain;
29742972 t_CKFLOAT m_pressure;
29752973 t_CKFLOAT m_rate;
2976−
2974+
29772975 void setVibratoFreq(MY_FLOAT freq)
29782976 { vibrato->setFrequency( freq ); m_vibratoFreq = vibrato->m_freq; }
29792977 void setVibratoGain(MY_FLOAT gain)
29802978 { vibratoGain = gain; m_vibratoGain = vibratoGain; }
29812979 void setNoiseGain(MY_FLOAT gain)
29822980 { noiseGain = gain; m_noiseGain = gain; }
2983−
2981+
29842982 DelayL *jetDelay;
29852983 DelayL *boreDelay;
29862984 JetTabl *jetTable;
@@ -3061,7 +3059,7 @@ class FormSwep : public BiQuad · 74 unmodified lines
30613059 A sweep rate of 1.0 will produce an immediate change in
30623060 resonance parameters from their current values to the
30633061 target values. A sweep rate of 0.0 will produce no
3064− change in resonance parameters.
3062+ change in resonance parameters.
30653063 */
30663064 void setSweepRate(MY_FLOAT aRate);
30673065
@@ -3079,7 +3077,7 @@ class FormSwep : public BiQuad · 11 unmodified lines
30793077 //! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.
30803078 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
30813079
3082− public: // SWAP formerly protected
3080+ public: // SWAP formerly protected
30833081 bool dirty;
30843082 MY_FLOAT frequency;
30853083 MY_FLOAT radius;
@@ -3115,7 +3113,7 @@ class FormSwep : public BiQuad · 29 unmodified lines
31153113 3-->2-- + -->1-->Out
31163114 \endcode
31173115
3118− Control Change Numbers:
3116+ Control Change Numbers:
31193117 - Total Modulator Index = 2
31203118 - Modulator Crossfade = 4
31213119 - LFO Speed = 11
@@ -3163,27 +3161,27 @@ class HevyMetl : public FM · 41 unmodified lines
31633161 /***************************************************/
31643162 /*! \class HnkyTonk
31653163 \brief STK Honkey Tonk Piano FM synthesis instrument.
3166−
3164+
31673165 This class implements 4 cascade operators with
31683166 feedback modulation on the master modulator,
31693167 also referred to as algorithm 1 of the TX81Z.
3170−
3168+
31713169 Algorithm 1 is :
31723170 4-->3-->2-->1-->Out
3173−
3171+
31743172 Control Change Numbers:
31753173 - Total Modulator Index = 2
31763174 - Modulator Crossfade = 4
31773175 - LFO Speed = 11
31783176 - LFO Depth = 1
31793177 - ADSR 2 & 4 Target = 128
3180−
3178+
31813179 The basic Chowning/Stanford FM patent expired
31823180 in 1995, but there exist follow-on patents,
31833181 mostly assigned to Yamaha. If you are of the
31843182 type who should worry about this (making
31853183 money) worry away.
3186−
3184+
31873185 by Perry R. Cook, 2021.
31883186 */
31893187 /***************************************************/
@@ -3196,14 +3194,14 @@ class HnkyTonk : public FM · 6 unmodified lines
31963194 public:
31973195 //! Class constructor.
31983196 HnkyTonk();
3199−
3197+
32003198 //! Class destructor.
32013199 ~HnkyTonk();
3202−
3200+
32033201 //! Start a note with the given frequency and amplitude.
32043202 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
32053203 void noteOn( MY_FLOAT amplitude) { noteOn(baseFrequency, amplitude); }
3206−
3204+
32073205 //! Compute one output sample.
32083206 MY_FLOAT tick();
32093207 };
@@ -3215,27 +3213,27 @@ public: · 5 unmodified lines
32153213 /***************************************************/
32163214 /*! \class FrencHrn
32173215 \brief NEW STK-style French Horn FM synthesis instrument.
3218−
3216+
32193217 This class implements 3 cascade operators with
32203218 feedback modulation, also referred to as
32213219 algorithm 3 of the TX81Z.
3222−
3220+
32233221 Algorithm 3 is : 4--\
32243222 3-->2-- + -->1-->Out
3225−
3223+
32263224 Control Change Numbers:
32273225 - Total Modulator Index = 2
32283226 - Modulator Crossfade = 4
32293227 - LFO Speed = 11
32303228 - LFO Depth = 1
32313229 - ADSR 2 & 4 Target = 128
3232−
3230+
32333231 The basic Chowning/Stanford FM patent expired
32343232 in 1995, but there exist follow-on patents,
32353233 mostly assigned to Yamaha. If you are of the
32363234 type who should worry about this (making
32373235 money) worry away.
3238−
3236+
32393237 by Perry R. Cook, 2021.
32403238 */
32413239 /***************************************************/
@@ -3248,14 +3246,14 @@ class FrencHrn : public FM · 6 unmodified lines
32483246 public:
32493247 //! Class constructor.
32503248 FrencHrn();
3251−
3249+
32523250 //! Class destructor.
32533251 ~FrencHrn();
3254−
3252+
32553253 //! Start a note with the given frequency and amplitude.
32563254 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
32573255 void noteOn( MY_FLOAT amplitude) { noteOn(baseFrequency, amplitude); }
3258−
3256+
32593257 //! Compute one output sample.
32603258 MY_FLOAT tick();
32613259 };
@@ -3268,28 +3266,28 @@ public: · 6 unmodified lines
32683266 /***************************************************/
32693267 /*! \class KrstlChr
32703268 \brief New STK-style Crystal Choir FM synthesis instrument.
3271−
3269+
32723270 This class implements 3 parallel operators with
32733271 one modulated, by one with feedback modulation,
32743272 also referred to as algorithm 7 of the TX81Z.
3275−
3273+
32763274 Algorithm 3 is : 4-->3-->\
32773275 2--> + -->Out
32783276 1-->/
3279−
3277+
32803278 Control Change Numbers:
32813279 - Total Modulator Index = 2
32823280 - Modulator Crossfade = 4
32833281 - LFO Speed = 11
32843282 - LFO Depth = 1
32853283 - ADSR 2 & 4 Target = 128
3286−
3284+
32873285 The basic Chowning/Stanford FM patent expired
32883286 in 1995, but there exist follow-on patents,
32893287 mostly assigned to Yamaha. If you are of the
32903288 type who should worry about this (making
32913289 money) worry away.
3292−
3290+
32933291 by Perry R. Cook, 2021.
32943292 */
32953293 /***************************************************/
@@ -3302,14 +3300,14 @@ class KrstlChr : public FM · 6 unmodified lines
33023300 public:
33033301 //! Class constructor.
33043302 KrstlChr();
3305−
3303+
33063304 //! Class destructor.
33073305 ~KrstlChr();
3308−
3306+
33093307 //! Start a note with the given frequency and amplitude.
33103308 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
33113309 void noteOn( MY_FLOAT amplitude) { noteOn(baseFrequency, amplitude); }
3312−
3310+
33133311 //! Compute one output sample.
33143312 MY_FLOAT tick();
33153313 };
@@ -3348,7 +3346,7 @@ class Reverb : public Stk · 32 unmodified lines
33483346 //! Reset and clear all internal state.
33493347 virtual void clear() = 0;
33503348
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).
33523350 void setEffectMix(MY_FLOAT mix);
33533351
33543352 //! Return the last output value.
@@ -3495,7 +3493,7 @@ class PluckTwo : public Instrmnt · 140 unmodified lines
34953493 //! Virtual (abstract) tick function is implemented by subclasses.
34963494 virtual MY_FLOAT tick() = 0;
34973495
3498− public: // SWAP formerly protected
3496+ public: // SWAP formerly protected
34993497 DelayA *delayLine;
35003498 DelayA *delayLine2;
35013499 DelayL *combDelay;
@@ -3535,7 +3533,7 @@ class PluckTwo : public Instrmnt · 33 unmodified lines
35353533 information, contact the Office of Technology
35363534 Licensing, Stanford University.
35373535
3538− Control Change Numbers:
3536+ Control Change Numbers:
35393537 - Body Size = 2
35403538 - Pluck Position = 4
35413539 - String Sustain = 11
@@ -3580,7 +3578,7 @@ class Mandolin : public PluckTwo · 38 unmodified lines
35803578 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
35813579 virtual void controlChange(int number, MY_FLOAT value);
35823580
3583− public: // SWAP formerly protected
3581+ public: // SWAP formerly protected
35843582 WvIn *soundfile[12];
35853583 MY_FLOAT directBody;
35863584 int mic;
@@ -3611,7 +3609,7 @@ class Mandolin : public PluckTwo · 24 unmodified lines
36113609 use possibly subject to patents held by Stanford
36123610 University, Yamaha, and others.
36133611
3614− Control Change Numbers:
3612+ Control Change Numbers:
36153613 - X Dimension = 2
36163614 - Y Dimension = 4
36173615 - Mesh Decay = 11
@@ -3639,7 +3637,7 @@ class Mesh2D : public Instrmnt · 21 unmodified lines
36393637 ~Mesh2D();
36403638
36413639 //! Reset and clear all internal state.
3642− void clear();
3640+ void clear();
36433641
36443642 //! Set the x dimension size in samples.
36453643 void setNX(short lenX);
@@ -3769,7 +3767,7 @@ public: // SWAP formerly protected · 123 unmodified lines
37693767 t_CKFLOAT m_vibratoFreq;
37703768 t_CKFLOAT m_volume;
37713769
3772− Envelope *envelope;
3770+ Envelope *envelope;
37733771 WvIn *wave;
37743772 BiQuad **filters;
37753773 OnePole *onepole;
@@ -3799,7 +3797,7 @@ public: // SWAP formerly protected · 23 unmodified lines
37993797 struck bar instruments. It inherits from the
38003798 Modal class.
38013799
3802− Control Change Numbers:
3800+ Control Change Numbers:
38033801 - Stick Hardness = 2
38043802 - Stick Position = 4
38053803 - Vibrato Gain = 11
@@ -3889,7 +3887,7 @@ class SubNoise : public Noise · 83 unmodified lines
38893887 //! Return a sub-sampled random number between -1.0 and 1.0.
38903888 MY_FLOAT tick();
38913889
3892− public: // SWAP formerly protected
3890+ public: // SWAP formerly protected
38933891 int counter;
38943892 int rate;
38953893
@@ -4006,8 +4004,8 @@ class Sampler : public Instrmnt · 110 unmodified lines
40064004 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
40074005 virtual void controlChange(int number, MY_FLOAT value) = 0;
40084006
4009− public: // SWAP formerly protected
4010− ADSR *adsr;
4007+ public: // SWAP formerly protected
4008+ ADSR *adsr;
40114009 WvIn *attacks[5];
40124010 WaveLoop *loops[5];
40134011 OnePole *filter;
@@ -4034,7 +4032,7 @@ class Sampler : public Instrmnt · 20 unmodified lines
40344032 from the Sampler class) and adds two sweepable
40354033 formant (FormSwep) filters.
40364034
4037− Control Change Numbers:
4035+ Control Change Numbers:
40384036 - Filter Q = 2
40394037 - Filter Sweep Rate = 4
40404038 - Vibrato Frequency = 11
@@ -4132,7 +4130,7 @@ class NRev : public Reverb · 91 unmodified lines
41324130 //! Compute one output sample.
41334131 MY_FLOAT tick(MY_FLOAT input);
41344132
4135− public: // SWAP formerly protected
4133+ public: // SWAP formerly protected
41364134 Delay *allpassDelays[8];
41374135 Delay *combDelays[6];
41384136 MY_FLOAT allpassCoefficient;
@@ -4182,7 +4180,7 @@ public: · 43 unmodified lines
41824180 //! Compute one output sample.
41834181 MY_FLOAT tick(MY_FLOAT input);
41844182
4185−public: // SWAP formerly protected
4183+public: // SWAP formerly protected
41864184 Delay *allpassDelays[2];
41874185 Delay *combDelays[2];
41884186 MY_FLOAT allpassCoefficient;
@@ -4207,7 +4205,7 @@ public: // SWAP formerly protected · 18 unmodified lines
42074205 2-- + -->1-->Out
42084206 \endcode
42094207
4210− Control Change Numbers:
4208+ Control Change Numbers:
42114209 - Total Modulator Index = 2
42124210 - Modulator Crossfade = 4
42134211 - LFO Speed = 11
@@ -4337,7 +4335,7 @@ class PitShift : public Stk · 123 unmodified lines
43374335 //! Set the pitch shift factor (1.0 produces no shift).
43384336 void setShift(MY_FLOAT shift);
43394337
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).
43414339 void setEffectMix(MY_FLOAT mix);
43424340
43434341 //! Return the last output value.
@@ -4349,7 +4347,7 @@ class PitShift : public Stk · 5 unmodified lines
43494347 //! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.
43504348 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
43514349
4352− public: // SWAP formerly protected
4350+ public: // SWAP formerly protected
43534351 //chuck
43544352 t_CKFLOAT m_vibratoGain;
43554353 t_CKFLOAT m_vibratoFreq;
@@ -4420,7 +4418,7 @@ class Plucked : public Instrmnt · 64 unmodified lines
44204418 //! Compute one output sample.
44214419 virtual MY_FLOAT tick();
44224420
4423− public: // SWAP formerly protected
4421+ public: // SWAP formerly protected
44244422 DelayA *delayLine;
44254423 OneZero *loopFilter;
44264424 OnePole *pickFilter;
@@ -4498,7 +4496,7 @@ class Resonate : public Instrmnt · 71 unmodified lines
44984496 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
44994497 virtual void controlChange(int number, MY_FLOAT value);
45004498
4501− public: // SWAP formerly protected
4499+ public: // SWAP formerly protected
45024500 ADSR *adsr;
45034501 BiQuad *filter;
45044502 Noise *noise;
@@ -4529,7 +4527,7 @@ class Resonate : public Instrmnt · 24 unmodified lines
45294527 2->1--/
45304528 \endcode
45314529
4532− Control Change Numbers:
4530+ Control Change Numbers:
45334531 - Modulator Index One = 2
45344532 - Crossfade of Outputs = 4
45354533 - LFO Speed = 11
@@ -4564,7 +4562,7 @@ class Rhodey : public FM · 28 unmodified lines
45644562
45654563 //! Start a note with the given frequency and amplitude.
45664564 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 ); }
45684566
45694567 //! Compute one output sample.
45704568 MY_FLOAT tick();
@@ -4729,7 +4727,7 @@ static const double Midi2Pitch[129] = { · 158 unmodified lines
47294727 use possibly subject to patents held by Stanford
47304728 University, Yamaha, and others.
47314729
4732− Control Change Numbers:
4730+ Control Change Numbers:
47334731 - Reed Stiffness = 2
47344732 - Reed Aperture = 26
47354733 - Noise Gain = 4
@@ -4829,7 +4827,7 @@ class Saxofony : public Instrmnt · 93 unmodified lines
48294827 breaking sticks, crunchy snow (or not), a
48304828 wrench, sandpaper, and more.
48314829
4832− Control Change Numbers:
4830+ Control Change Numbers:
48334831 - Shake Energy = 2
48344832 - System Decay = 4
48354833 - Number Of Objects = 11
@@ -4885,7 +4883,7 @@ class Shakers : public Instrmnt · 49 unmodified lines
48854883 Use the instrument numbers above, converted to frequency values
48864884 as if MIDI note numbers, to select a particular instrument.
48874885 */
4888− virtual void ck_noteOn(MY_FLOAT amplitude ); // chuck single arg call
4886+ virtual void ck_noteOn(MY_FLOAT amplitude ); // chuck single arg call
48894887 virtual void noteOn(MY_FLOAT instrument, MY_FLOAT amplitude);
48904888
48914889 //! Stop a note with the given amplitude (speed of decay).
@@ -4957,7 +4955,7 @@ class Shakers : public Instrmnt · 65 unmodified lines
49574955 a one-pole filter, and an ADSR envelope
49584956 to create some interesting sounds.
49594957
4960− Control Change Numbers:
4958+ Control Change Numbers:
49614959 - Filter Pole Position = 2
49624960 - Noise/Pitched Cross-Fade = 4
49634961 - Envelope Rate = 11
@@ -5004,8 +5002,8 @@ class Simple : public Instrmnt · 40 unmodified lines
50045002 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
50055003 virtual void controlChange(int number, MY_FLOAT value);
50065004
5007− public: // SWAP formerly protected
5008− ADSR *adsr;
5005+ public: // SWAP formerly protected
5006+ ADSR *adsr;
50095007 WaveLoop *loop;
50105008 OnePole *filter;
50115009 BiQuad *biquad;
@@ -5162,7 +5160,7 @@ class Sitar : public Instrmnt · 150 unmodified lines
51625160 //! Compute one output sample.
51635161 MY_FLOAT tick();
51645162
5165− public: // SWAP formerly protected
5163+ public: // SWAP formerly protected
51665164 DelayA *delayLine;
51675165 OneZero *loopFilter;
51685166 Noise *noise;
@@ -5195,7 +5193,7 @@ class Sitar : public Instrmnt · 26 unmodified lines
51955193 The user is responsible for checking the values
51965194 returned by the read/write methods. Values
51975195 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.
51995197
52005198 by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
52015199 */
@@ -5275,7 +5273,7 @@ class Socket : public Stk · 73 unmodified lines
52755273
52765274 public: // SWAP formerly protected
52775275
5278− char msg[256];
5276+ char msg[STK_MSG_BUF_LENGTH];
52795277 int soket;
52805278 int poort;
52815279 bool server;
@@ -5403,7 +5401,7 @@ public: · 121 unmodified lines
54035401
54045402 //! Move the sphere for the given time increment.
54055403 void tick(double timeIncrement);
5406−
5404+
54075405 public: // SWAP formerly private
54085406 Vector3D *myPosition;
54095407 Vector3D *myVelocity;
@@ -5558,7 +5556,7 @@ public: · 148 unmodified lines
55585556 //! Take \e vectorSize index positions and return the corresponding table values in \e vector.
55595557 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize);
55605558
5561−public: // SWAP formerly protected
5559+public: // SWAP formerly protected
55625560 long length;
55635561 MY_FLOAT *data;
55645562 MY_FLOAT lastOutput;
@@ -5635,7 +5633,7 @@ class WvOut : public Stk · 70 unmodified lines
56355633 int fflush(FILE *stream);
56365634 int fclose(FILE *stream);
56375635 size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
5638−
5636+
56395637 //! Default constructor.
56405638 WvOut();
56415639
@@ -5716,7 +5714,7 @@ class WvOut : public Stk · 74 unmodified lines
57165714 // Close MAT-file, updating the header.
57175715 void closeMatFile( void );
57185716
5719− char msg[256];
5717+ char msg[STK_MSG_BUF_LENGTH];
57205718 FILE *fd;
57215719 MY_FLOAT *data;
57225720 FILE_TYPE fileType;
@@ -5732,7 +5730,7 @@ class WvOut : public Stk · 9 unmodified lines
57325730 Chuck_String autoPrefix;
57335731 t_CKUINT flush;
57345732 t_CKFLOAT fileGain;
5735−
5733+
57365734 // spencer: for data asynch write
57375735 t_CKBOOL asyncIO;
57385736 XWriteThread * asyncWriteThread;
@@ -5759,7 +5757,7 @@ class WvOut : public Stk · 20 unmodified lines
57595757 2->1--/
57605758 \endcode
57615759
5762− Control Change Numbers:
5760+ Control Change Numbers:
57635761 - Modulator Index One = 2
57645762 - Crossfade of Outputs = 4
57655763 - LFO Speed = 11
@@ -5862,9 +5860,9 @@ class TwoPole : public FilterStk // formerly protected Filter · 96 unmodified lines
58625860 MY_FLOAT m_resFreq;
58635861 MY_FLOAT m_resRad;
58645862
5865− 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); }
5867− void ck_setResRad( MY_FLOAT n ) { m_resRad = n; setResonance(m_resFreq, m_resRad, m_resNorm); }
5863+ void ck_setResNorm( bool n ) { m_resNorm = 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); }
5865+ void ck_setResRad( MY_FLOAT n ) { m_resRad = n; setResonance(m_resFreq, m_resRad, m_resNorm); }
58685866 //! Set the filter gain.
58695867 /*!
58705868 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
59065904 cascade synthesis is the most natural so
59075905 that's what you'll find here.
59085906
5909− Control Change Numbers:
5907+ Control Change Numbers:
59105908 - Voiced/Unvoiced Mix = 2
59115909 - Vowel/Phoneme Selection = 4
59125910 - Vibrato Frequency = 11
@@ -6143,7 +6141,7 @@ public: // SWAP formerly protected · 230 unmodified lines
61436141 This class implements a hybrid physical/spectral
61446142 model of a police whistle (a la Cook).
61456143
6146− Control Change Numbers:
6144+ Control Change Numbers:
61476145 - Noise Gain = 4
61486146 - Fipple Modulation Frequency = 11
61496147 - Fipple Modulation Gain = 1
@@ -6191,7 +6189,7 @@ public: · 41 unmodified lines
61916189 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
61926190 void controlChange(int number, MY_FLOAT value);
61936191
6194−public: // SWAP formerly protected
6192+public: // SWAP formerly protected
61956193 Vector3D *tempVectorP;
61966194 Vector3D *tempVector;
61976195 OnePole onepole;
@@ -6233,7 +6231,7 @@ public: // SWAP formerly protected · 35 unmodified lines
62336231 2->1--/
62346232 \endcode
62356233
6236− Control Change Numbers:
6234+ Control Change Numbers:
62376235 - Modulator Index One = 2
62386236 - Crossfade of Outputs = 4
62396237 - LFO Speed = 11
@@ -6269,7 +6267,7 @@ class Wurley : public FM · 29 unmodified lines
62696267 //! Start a note with the given frequency and amplitude.
62706268 void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
62716269 void noteOn(MY_FLOAT amplitude) { noteOn ( baseFrequency, amplitude ); }
6272−
6270+
62736271 // CHUCK HACK:
62746272 virtual void controlChange( int which, MY_FLOAT value );
62756273
@@ -6432,7 +6430,7 @@ class BlitSaw : public BLT · 156 unmodified lines
64326430 Set the phase of the signal, in the range 0 to 1.
64336431 */
64346432 virtual void setPhase( MY_FLOAT phase ) { phase_ = ONE_PI * phase; }
6435−
6433+
64366434 //! Set the sawtooth oscillator rate in terms of a frequency in Hz.
64376435 virtual void setFrequency( MY_FLOAT frequency );
64386436
@@ -6580,11 +6578,11 @@ class BlitSquare : public BLT · 141 unmodified lines
65806578 #include <sstream>
65816579
65826580 namespace stk {
6583−
6581+
65846582 /**********************************************************************/
65856583 /*! \class MidiFileIn
65866584 \brief A standard MIDI file reading/parsing class.
6587−
6585+
65886586 This class can be used to read events from a standard MIDI file.
65896587 Event bytes are copied to a C++ vector and must be subsequently
65906588 interpreted by the user. The function getNextMidiEvent() skips
@@ -6593,7 +6591,7 @@ namespace stk { · 2 unmodified lines
65936591 function is provided to determine the current "seconds per tick".
65946592 Tempo changes are internally tracked by the class and reflected in
65956593 the values returned by the function getTickSeconds().
6596−
6594+
65976595 by Gary P. Scavone, 2003 - 2010.
65986596 */
65996597 /**********************************************************************/
@@ -6607,16 +6605,16 @@ public: · 7 unmodified lines
66076605 StkError exception will be thrown.
66086606 */
66096607 MidiFileIn( std::string fileName );
6610−
6608+
66116609 //! Class destructor.
66126610 ~MidiFileIn();
6613−
6611+
66146612 //! Return the MIDI file format (0, 1, or 2).
66156613 int getFileFormat() const;
6616−
6614+
66176615 //! Return the number of tracks in the MIDI file.
66186616 unsigned int getNumberOfTracks() const;
6619−
6617+
66206618 //! Return the MIDI file division value from the file header.
66216619 /*!
66226620 Note that this value must be "parsed" in accordance with the
@@ -6624,14 +6622,14 @@ public: · 1 unmodified line
66246622 file uses time-code representations for delta-time values.
66256623 */
66266624 int getDivision() const;
6627−
6625+
66286626 //! Move the specified track event reader to the beginning of its track.
66296627 /*!
66306628 The relevant track tempo value is reset as well. If an invalid
66316629 track number is specified, an StkError exception will be thrown.
66326630 */
66336631 void rewindTrack( unsigned int track = 0 );
6634−
6632+
66356633 //! Get the current value, in seconds, of delta-time ticks for the specified track.
66366634 /*!
66376635 This value can change as events are read (via "Set Tempo"
@@ -6641,7 +6639,7 @@ public: · 3 unmodified lines
66416639 thrown.
66426640 */
66436641 double getTickSeconds( unsigned int track = 0 );
6644−
6642+
66456643 //! Fill the user-provided vector with the next event in the specified track and return the event delta-time in ticks.
66466644 /*!
66476645 MIDI File events consist of a delta time and a sequence of event
@@ -6656,7 +6654,7 @@ public: · 8 unmodified lines
66566654 file, an StkError exception will be thrown.
66576655 */
66586656 unsigned long getNextEvent( std::vector<unsigned char> *event, unsigned int track = 0 );
6659−
6657+
66606658 //! Fill the user-provided vector with the next MIDI channel event in the specified track and return the event delta time in ticks.
66616659 /*!
66626660 All returned MIDI events are complete ... a status byte is
@@ -6669,23 +6667,23 @@ public: · 6 unmodified lines
66696667 StkError exception will be thrown.
66706668 */
66716669 unsigned long getNextMidiEvent( std::vector<unsigned char> *midiEvent, unsigned int track = 0 );
6672−
6670+
66736671 //! ge: get the current BPM (I think)
66746672 /*!
66756673 This value can change as events are read... hmm pretty much
66766674 what it says above for getTickSeconds()
66776675 */
66786676 double getBPM();
6679−
6677+
66806678 protected:
6681−
6679+
66826680 // This protected class function is used for reading variable-length
66836681 // MIDI file values. It is assumed that this function is called with
66846682 // the file read pointer positioned at the start of a
66856683 // variable-length value. The function returns true if the value is
66866684 // successfully parsed. Otherwise, it returns false.
66876685 bool readVariableLength( unsigned long *value );
6688−
6686+
66896687 std::ifstream file_;
66906688 unsigned int nTracks_;
66916689 int format_;
@@ -6698,11 +6696,11 @@ protected: · 6 unmodified lines
66986696 std::vector<char> trackStatus_;
66996697 // ge:
67006698 double bpm_;
6701−
6699+
67026700 // This structure and the following variables are used to save and
67036701 // keep track of a format 1 tempo map (and the initial tickSeconds
67046702 // parameter for formats 0 and 2).
6705− struct TempoChange {
6703+ struct TempoChange {
67066704 unsigned long count;
67076705 double tickSeconds;
67086706 };
@@ -6710,7 +6708,7 @@ protected: · 1 unmodified line
67106708 std::vector<unsigned long> trackCounters_;
67116709 std::vector<unsigned int> trackTempoIndex_;
67126710 };
6713−
6711+
67146712 } // stk namespace
67156713
67166714 #endif
@@ -6767,7 +6765,7 @@ protected: · 50 unmodified lines
67676765 #define __SK_Pan_ 10
67686766 #define __SK_Sustain_ 64
67696767 #define __SK_Damper_ __SK_Sustain_
6770−#define __SK_Expression_ 11
6768+#define __SK_Expression_ 11
67716769
67726770 #define __SK_AfterTouch_Cont_ 128
67736771 #define __SK_ModFrequency_ __SK_Expression_
@@ -6812,7 +6810,7 @@ protected: · 38 unmodified lines
68126810 #define __SK_FilterFreq_ 1062
68136811 #define __SK_FilterSweepRate_ __SK_FootControl_
68146812
6815−#define __SK_ShakerInst_ 1071
6813+#define __SK_ShakerInst_ 1071
68166814 #define __SK_ShakerEnergy_ __SK_Breath_
68176815 #define __SK_ShakerDamping_ __SK_ModFrequency_
68186816 #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
92+DLL_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+//-----------------------------------------------------------------------------
101+template<class T>
102+class ChaiMatrixFast
103+{
104+public:
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+
188+protected:
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+//-----------------------------------------------------------------------------
201+template<class T>
202+class ChaiVectorFast
203+{
204+public:
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+
321+public:
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+
338+typedef 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+
346+typedef 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+
355+typedef 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+
370+struct kdtree * kdtree_init( t_CKINT dim );
371+void kdtree_insert( struct kdtree * tree, double * coord );
372+void kdtree_rebuild( struct kdtree * tree );
373+void kdtree_knn_search( struct kdtree * tree, double * coord, t_CKINT k );
374+void kdtree_destroy( struct kdtree * tree );
375+void 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
4242
4343 // query
4444 DLL_QUERY machine_query( Chuck_DL_Query * QUERY );
45−typedef t_CKUINT (* proc_msg_func)( Chuck_VM *, Chuck_Compiler *,
45+
46+#ifndef __DISABLE_OTF_SERVER__
47+typedef t_CKUINT (* proc_msg_func)( Chuck_VM *, Chuck_Compiler *,
4648 Net_Msg *, t_CKBOOL, void * );
4749 t_CKBOOL machine_init( Chuck_Compiler * compiler, proc_msg_func func );
4850 // 1.4.0.1: TODO: refactor out of ulib machine; not all platforms have OTF
51+#endif // __DISABLE_OTF_SERVER__
52+
53+// machine exports
4954 t_CKUINT machine_intsize();
5055
5156
52−// exports
53−CK_DLL_SFUN( machine_crash_impl );
54−CK_DLL_SFUN( machine_add_impl );
55−CK_DLL_SFUN( machine_spork_impl );
56−CK_DLL_SFUN( machine_remove_impl );
57−CK_DLL_SFUN( machine_replace_impl );
58−CK_DLL_SFUN( machine_status_impl );
59−CK_DLL_SFUN( machine_intsize_impl );
60−CK_DLL_SFUN( machine_shreds_impl );
57+// ckdoc query
58+DLL_QUERY ckdoc_query( Chuck_DL_Query * QUERY );
59+
6160
6261
6362 #endif
chuginate/template/chuck/include/ulib_math.h+12−6
@@ -68,6 +68,7 @@ CK_DLL_SFUN( min_impl ); · 67 unmodified lines
6868 CK_DLL_SFUN( max_impl );
6969 CK_DLL_SFUN( isinf_impl );
7070 CK_DLL_SFUN( isnan_impl );
71+CK_DLL_SFUN( equal_impl );
7172 CK_DLL_SFUN( floatMax_impl );
7273 CK_DLL_SFUN( intMax_impl );
7374
@@ -89,12 +90,17 @@ CK_DLL_SFUN( srandom_impl ); · 15 unmodified lines
8990
9091 CK_DLL_SFUN( gauss_impl );
9192
92−// max for random functions
93−#ifdef __WINDOWS_DS__
94−#define CK_RANDOM_MAX RAND_MAX
95−#else
96−#define CK_RANDOM_MAX 0x7fffffff
97−#endif
93+CK_DLL_SFUN( cossim_impl );
94+CK_DLL_SFUN( cossim3d_impl );
95+CK_DLL_SFUN( cossim4d_impl );
96+
97+CK_DLL_SFUN( euclidean_impl );
98+CK_DLL_SFUN( euclidean3d_impl );
99+CK_DLL_SFUN( euclidean4d_impl );
100+
101+CK_DLL_SFUN( map_impl );
102+CK_DLL_SFUN( map2_impl );
103+
98104
99105
100106
chuginate/template/chuck/include/ulib_regex.h+4−4
@@ -1,21 +1,21 @@
11 /*----------------------------------------------------------------------------
22 ChucK Concurrent, On-the-fly Audio Programming Language
33 Compiler and Virtual Machine
4−
4+
55 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.
66 http://chuck.stanford.edu/
77 http://chuck.cs.princeton.edu/
8−
8+
99 This program is free software; you can redistribute it and/or modify
1010 it under the terms of the GNU General Public License as published by
1111 the Free Software Foundation; either version 2 of the License, or
1212 (at your option) any later version.
13−
13+
1414 This program is distributed in the hope that it will be useful,
1515 but WITHOUT ANY WARRANTY; without even the implied warranty of
1616 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1717 GNU General Public License for more details.
18−
18+
1919 You should have received a copy of the GNU General Public License
2020 along with this program; if not, write to the Free Software
2121 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
4343 #include <queue>
4444 #include <iostream>
4545
46−#define DWORD__ unsigned long
47−#define SINT__ long
46+#define DWORD__ t_CKUINT
47+#define SINT__ t_CKINT
4848 #define UINT__ DWORD__
4949 #define BOOL__ DWORD__
5050 #define BYTE__ unsigned char
@@ -103,7 +103,7 @@ protected: · 52 unmodified lines
103103 #ifndef __DISABLE_THREADS__
104104 XMutex m_mutex;
105105 #endif
106−
106+
107107 CBufferSimple * m_event_buffer;
108108 };
109109
@@ -203,7 +203,7 @@ template<typename T> · 93 unmodified lines
203203 class CircularBuffer
204204 {
205205 public:
206−
206+
207207 CircularBuffer(size_t numElements) :
208208 m_read(0),
209209 m_write(0),
@@ -211,7 +211,7 @@ public: · 1 unmodified line
211211 {
212212 m_elements = new T[m_numElements];
213213 }
214−
214+
215215 ~CircularBuffer()
216216 {
217217 if(m_elements != NULL)
@@ -220,7 +220,7 @@ public: · 2 unmodified lines
220220 m_elements = NULL;
221221 }
222222 }
223−
223+
224224 // put one element
225225 // returns number of elements successfully put
226226 size_t put(T element)
@@ -230,14 +230,14 @@ public: · 3 unmodified lines
230230 // no space
231231 return 0;
232232 }
233−
233+
234234 m_elements[m_write] = element;
235−
235+
236236 m_write = (m_write+1)%m_numElements;
237−
237+
238238 return 1;
239239 }
240−
240+
241241 // get one element
242242 // returns number of elements successfully got
243243 size_t get(T &element)
@@ -247,14 +247,14 @@ public: · 3 unmodified lines
247247 // nothing to get
248248 return 0;
249249 }
250−
250+
251251 element = m_elements[m_read];
252−
252+
253253 m_read = (m_read+1)%m_numElements;
254−
254+
255255 return 1;
256256 }
257−
257+
258258 // peek at element i without removing it
259259 // i = 1 would correspond to the least recently put element;
260260 // i = -1 would correspond to the most recent (not implemented)
@@ -263,24 +263,24 @@ public: · 2 unmodified lines
263263 {
264264 if(i == 0)
265265 return 0;
266−
266+
267267 if(i > 0 && i <= numElements())
268268 {
269269 element = m_elements[(m_read+(i-1))%m_numElements];
270270 return 1;
271271 }
272−
272+
273273 return 0;
274274 }
275−
275+
276276 void clear() { m_write = m_read; }
277−
277+
278278 // return maximum number of elements that can be held
279279 size_t maxElements() { return m_numElements-1; }
280−
280+
281281 // return if buffer is full
282282 bool atMaximum() { return (m_write + 1)%m_numElements == m_read; }
283−
283+
284284 // return number of valid elements in the buffer
285285 size_t numElements()
286286 {
@@ -291,7 +291,7 @@ public: · 4 unmodified lines
291291 else
292292 return m_numElements - m_read + m_write;
293293 }
294−
294+
295295 private:
296296 T * m_elements;
297297 size_t m_read, m_write;
@@ -311,17 +311,17 @@ class FastCircularBuffer · 13 unmodified lines
311311 public:
312312 FastCircularBuffer();
313313 ~FastCircularBuffer();
314−
314+
315315 public:
316316 t_CKUINT initialize( t_CKUINT num_elem, t_CKUINT width );
317317 void cleanup();
318−
318+
319319 public:
320320 t_CKUINT get( void * data, t_CKUINT num_elem );
321321 t_CKUINT put( void * data, t_CKUINT num_elem );
322322 inline bool hasMore() { return (m_read_offset != m_write_offset); }
323323 inline void clear() { m_read_offset = m_write_offset = 0; }
324−
324+
325325 protected:
326326 t_CKBYTE * m_data;
327327 t_CKUINT m_data_width;
@@ -343,7 +343,7 @@ class XCircleBuffer · 15 unmodified lines
343343 public:
344344 XCircleBuffer( long length = 0 );
345345 ~XCircleBuffer();
346−
346+
347347 public:
348348 // reset length of buffer (capacity)
349349 void init( long length );
@@ -351,7 +351,7 @@ public: · 1 unmodified line
351351 long length() const;
352352 // clear (does no explicit memory management)
353353 void clear();
354−
354+
355355 public:
356356 // put an element into the buffer - the item will be copied
357357 // NOTE: if over-capacity, will discard least recently put item
@@ -366,11 +366,11 @@ public: · 8 unmodified lines
366366 long peek( T * array, long numItems, unsigned long stride = 0 );
367367 // pop
368368 long pop( long numItems = 1 );
369−
369+
370370 protected: // helper functions
371371 inline void advanceWrite();
372372 inline void advanceRead();
373−
373+
374374 protected:
375375 // the buffer
376376 T * m_buffer;
@@ -397,7 +397,7 @@ XCircleBuffer<T>::XCircleBuffer( long length ) · 20 unmodified lines
397397 // zero out first
398398 m_buffer = NULL;
399399 m_length = m_readIndex = m_writeIndex = m_numElements = 0;
400−
400+
401401 // call init
402402 this->init( length );
403403 }
@@ -412,7 +412,7 @@ XCircleBuffer<T>::XCircleBuffer( long length ) · 8 unmodified lines
412412 template <typename T>
413413 XCircleBuffer<T>::~XCircleBuffer()
414414 {
415−
415+
416416 }
417417
418418
@@ -433,20 +433,20 @@ void XCircleBuffer<T>::init( long length ) · 14 unmodified lines
433433 // zero out
434434 m_length = m_readIndex = m_writeIndex = m_numElements = 0;
435435 }
436−
436+
437437 // sanity check
438438 if( length < 0 )
439439 {
440440 // doh
441441 std::cerr << "[XCircleBuffer]: error invalid length '"
442442 << length << "' requested" << std::endl;
443−
443+
444444 return;
445445 }
446−
446+
447447 // check for zero length
448448 if( length == 0 ) return;
449−
449+
450450 // allocate
451451 m_buffer = new T[length];
452452 // check
@@ -455,10 +455,10 @@ void XCircleBuffer<T>::init( long length ) · 2 unmodified lines
455455 // doh
456456 std::cerr << "[XCircleBuffer]: failed to allocate buffer of length '"
457457 << length << "'..." << std::endl;
458−
458+
459459 return;
460460 }
461−
461+
462462 // save
463463 m_length = length;
464464 // zero out
@@ -504,14 +504,14 @@ void XCircleBuffer<T>::advanceWrite() · 39 unmodified lines
504504 {
505505 // increment
506506 m_writeIndex++;
507−
507+
508508 // check for bounds
509509 if( m_writeIndex >= m_length )
510510 {
511511 // wrap
512512 m_writeIndex -= m_length;
513513 }
514−
514+
515515 // increment count
516516 m_numElements++;
517517 }
@@ -528,14 +528,14 @@ void XCircleBuffer<T>::advanceRead() · 10 unmodified lines
528528 {
529529 // increment
530530 m_readIndex++;
531−
531+
532532 // check for bounds
533533 if( m_readIndex >= m_length )
534534 {
535535 // wrap
536536 m_readIndex -= m_length;
537537 }
538−
538+
539539 // decrement count
540540 m_numElements--;
541541 }
@@ -553,13 +553,13 @@ void XCircleBuffer<T>::put( const T & item ) · 11 unmodified lines
553553 {
554554 // sanity check
555555 if( m_buffer == NULL ) return;
556−
556+
557557 // copy it
558558 m_buffer[m_writeIndex] = item;
559−
559+
560560 // advance write index
561561 advanceWrite();
562−
562+
563563 // if read and write pointer are the same, over-capacity
564564 if( m_writeIndex == m_readIndex )
565565 {
@@ -609,19 +609,19 @@ long XCircleBuffer<T>::peek( T * array, long numItems, unsigned long stride ) · 43 unmodified lines
609609 {
610610 // sanity check
611611 if( m_buffer == NULL ) return 0;
612−
612+
613613 // sanity check (so the wrap can be sure to land inbounds)
614614 if( stride >= m_length ) return 0;
615−
615+
616616 // count
617617 long count = 0;
618618 // actual count, taking stride out of the equation
619619 long actualCount = 0;
620−
620+
621621 // starting index
622622 long index = m_writeIndex - 1;
623623 if( index < 0 ) index += m_length;
624−
624+
625625 // while need more but haven't reached write index...
626626 while( (count < numItems) && (count < m_numElements) )
627627 {
@@ -636,7 +636,7 @@ long XCircleBuffer<T>::peek( T * array, long numItems, unsigned long stride ) · 8 unmodified lines
636636 // wrap
637637 if( index < 0 ) index += m_length;
638638 }
639−
639+
640640 // reverse contents
641641 for( int i = 0; i < actualCount/2; i++ )
642642 {
@@ -644,7 +644,7 @@ long XCircleBuffer<T>::peek( T * array, long numItems, unsigned long stride ) · 1 unmodified line
644644 array[i] = array[actualCount-1-i];
645645 array[actualCount-1-i] = v;
646646 }
647−
647+
648648 return actualCount;
649649 }
650650
@@ -660,10 +660,10 @@ long XCircleBuffer<T>::pop( long numItems ) · 9 unmodified lines
660660 {
661661 // sanity check
662662 if( m_buffer == NULL ) return 0;
663−
663+
664664 // count
665665 long count = 0;
666−
666+
667667 // while there is more to pop and need to pop more
668668 while( more() && count < numItems )
669669 {
@@ -672,7 +672,7 @@ long XCircleBuffer<T>::pop( long numItems ) · 2 unmodified lines
672672 // increment count
673673 count++;
674674 }
675−
675+
676676 return count;
677677 }
678678
@@ -688,12 +688,12 @@ bool XCircleBuffer<T>::get( T * result ) · 9 unmodified lines
688688 {
689689 // sanity check
690690 if( m_buffer == NULL || m_readIndex == m_writeIndex ) return false;
691−
691+
692692 // get item to read
693693 *result = m_buffer[m_readIndex];
694694 // advance read
695695 advanceRead();
696−
696+
697697 return true;
698698 }
699699
chuginate/template/chuck/include/util_hid.h+4−2
@@ -32,6 +32,8 @@ · 31 unmodified lines
3232 #ifndef __UTIL_HID_H__
3333 #define __UTIL_HID_H__
3434
35+#include "chuck_def.h"
36+
3537
3638
3739
@@ -50,7 +52,7 @@ struct HidMsg · 12 unmodified lines
5052 t_CKINT idata[4]; // int data
5153 #endif
5254 t_CKFLOAT fdata[4]; // float data
53−
55+
5456 #ifdef __cplusplus
5557 HidMsg()
5658 { this->clear(); }
@@ -161,7 +163,7 @@ extern const char * Mouse_name( int m ); · 104 unmodified lines
161163 extern int Mouse_buttons( int m );
162164 extern int Mouse_start_cursor_track();
163165 extern int Mouse_stop_cursor_track();
164−
166+
165167 extern void Keyboard_init();
166168 extern void Keyboard_poll();
167169 extern void Keyboard_quit();
chuginate/template/chuck/include/util_math.h+23−7
@@ -34,21 +34,36 @@ · 33 unmodified lines
3434 #define __UTIL_MATH_H__
3535
3636 #include <math.h>
37+#include "chuck_def.h" // 1.4.1.0 (ge) for t_CKINT
3738
38−#if defined (__cplusplus) || defined(_cplusplus)
39+#if defined (__cplusplus) || defined(_cplusplus)
3940 extern "C" {
40−#endif
41+#endif
4142
43+// 1.4.1.1 (ge) removed -- seems no longer needed on more modern windows
4244 #ifdef __PLATFORM_WIN32__
43−
45+#ifdef __CK_MATH_DEFINE_ROUND_TRUNC__
4446 double round( double a );
4547 double trunc( double a );
46−#ifndef __WINDOWS_MODERN__
47− double remainder( long a, long b );
4848 #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)
52+double ck_remainder( double a, double b );
53+
4954
55+// max for random functions
56+#ifdef __PLATFORM_WIN32__
57+#define CK_RANDOM_MAX RAND_MAX
58+#else
59+#define CK_RANDOM_MAX 0x7fffffff
5060 #endif
5161
62+// chuck random wrapper
63+long ck_random();
64+// chuck srandom wrapper
65+void ck_srandom( unsigned seed );
66+
5267 // mtof
5368 double mtof( double f );
5469 // ftom
@@ -66,10 +81,11 @@ unsigned long nextpow2( unsigned long i ); · 11 unmodified lines
6681 // ensurepow2
6782 unsigned long ensurepow2( unsigned long i );
6883
69−#if defined (__cplusplus) || defined(_cplusplus)
84+#if defined (__cplusplus) || defined(_cplusplus)
7085 }
7186 #endif
7287
7388
7489
75−#endif
90+
91+#endif
chuginate/template/chuck/include/util_network.h+1−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
4141 #include <sys/socket.h>
4242 #include <netinet/in.h>
4343 #else
44+#define _WINSOCKAPI_
4445 #include <windows.h>
4546 #endif
4647
chuginate/template/chuck/include/util_opsc.h+52−51
@@ -35,12 +35,13 @@ · 34 unmodified lines
3535
3636
3737 // 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.
3939 // keep that bubble gum in your hair.
4040
4141
42−// the included files were from the CNMAT OSC-Kit distrib.
42+// the included files were from the CNMAT OSC-Kit distrib.
4343 #ifdef __PLATFORM_WIN32__
44+#define _WINSOCKAPI_
4445 #include <windows.h>
4546 #endif
4647
@@ -48,7 +49,7 @@ · 1 unmodified line
4849 // OSC-pattern-match.h
4950
5051 /*
51−Copyright � 1998. The Regents of the University of California (Regents).
52+Copyright � 1998. The Regents of the University of California (Regents).
5253 All Rights Reserved.
5354
5455 Written 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
7172 HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
7273 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
7374
74−The OpenSound Control WWW page is
75+The OpenSound Control WWW page is
7576 http://www.cnmat.berkeley.edu/OpenSoundControl
7677 */
7778
@@ -94,7 +95,7 @@ bool PatternMatch (const char *pattern, const char *test); · 16 unmodified lines
9495
9596 // - end OSC-pattern-match.h
9697
97−//#inclue OSC-TimeTag.h
98+//#inclue OSC-TimeTag.h
9899
99100 /*
100101 Copyright (c) 1998. The Regents of the University of California (Regents).
@@ -123,7 +124,7 @@ University of California, Berkeley. · 22 unmodified lines
123124 REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
124125 ENHANCEMENTS, OR MODIFICATIONS.
125126
126−The OpenSound Control WWW page is
127+The OpenSound Control WWW page is
127128 http://www.cnmat.berkeley.edu/OpenSoundControl
128129 */
129130
@@ -134,10 +135,10 @@ The OpenSound Control WWW page is · 4 unmodified lines
134135 Time tags in OSC have the same format as in NTP: 64 bit fixed point, with the
135136 top 32 bits giving number of seconds sinve midnight 1/1/1900 and the bottom
136137 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.
138139
139140 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.
141142 */
142143
143144 #ifndef OSC_TIMETAG
@@ -151,7 +152,7 @@ The OpenSound Control WWW page is · 7 unmodified lines
151152 typedef unsigned long long uint64;
152153 typedef unsigned long uint32;
153154 #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
155156 aren't 32 bits. */
156157 typedef unsigned int uint32;
157158 #endif
@@ -192,7 +193,7 @@ int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right); · 34 unmodified lines
192193
193194
194195 //#include "OSC-client.h"
195−// OSC-client.h
196+// OSC-client.h
196197 /*
197198 Copyright (c) 1996,1997. The Regents of the University of California (Regents).
198199 All Rights Reserved.
@@ -221,7 +222,7 @@ University of California, Berkeley. · 22 unmodified lines
221222 ENHANCEMENTS, OR MODIFICATIONS.
222223 */
223224
224−/*
225+/*
225226
226227 OSC-client.h: library for constructing OpenSoundControl messages.
227228 Derived from SynthControl.h
@@ -269,7 +270,7 @@ University of California, Berkeley. · 41 unmodified lines
269270 #endif
270271
271272 /* 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
273274 get an error message. */
274275 #define MAX_BUNDLE_NESTING 32
275276
@@ -284,7 +285,7 @@ typedef struct OSCbuf_struct { · 8 unmodified lines
284285 int size; /* Size of the buffer */
285286 char *bufptr; /* Current position as we fill the buffer */
286287 int state; /* State of partially-constructed message */
287− int4byte *thisMsgSize; /* Pointer to count field before
288+ int4byte *thisMsgSize; /* Pointer to count field before
288289 currently-being-written message */
289290 int4byte *prevCounts[MAX_BUNDLE_NESTING];
290291 /* Pointers to count field before each currently
@@ -334,12 +335,12 @@ int OSC_packetSize(OSCbuf *buf); · 43 unmodified lines
334335
335336 - Make sure the OSCbuf has been initialized with OSC_initBuffer().
336337
337− - To open a bundle, call OSC_openBundle(). You can then write
338+ - To open a bundle, call OSC_openBundle(). You can then write
338339 messages or open new bundles within the bundle you opened.
339340 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
341342 single message.
342−
343+
343344
344345 - For each message you want to send:
345346
@@ -350,7 +351,7 @@ int OSC_packetSize(OSCbuf *buf); · 4 unmodified lines
350351 - Alternately, call OSC_writeAddressAndTypes() with the name of
351352 your message and with a type string listing the types of all the
352353 arguments you will be putting in this message.
353−
354+
354355 - Now write each of the arguments into the buffer, by calling one of:
355356 OSC_writeFloatArg()
356357 OSC_writeFloatArgs()
@@ -376,7 +377,7 @@ extern const char * OSC_errorMessage; · 19 unmodified lines
376377
377378 /* How many bytes will be needed in the OSC format to hold the given
378379 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. */
380381 int OSC_effectiveStringLength(char *string);
381382
382383 // end OSC-client.h
@@ -390,11 +391,11 @@ int OSC_effectiveStringLength(char *string); · 7 unmodified lines
390391
391392 class OSC_Address_Space;
392393 class UDP_Transmitter;
393−class UDP_Receiver;
394+class UDP_Receiver;
394395
395396 class OSC_Transmitter
396397 {
397−protected:
398+protected:
398399 char _buffer[2048];
399400 OSCbuf _osc;
400401 UDP_Transmitter * _out;
@@ -408,10 +409,10 @@ public: · 7 unmodified lines
408409 void init();
409410 void setHost( char * host, int port);
410411 void addMessage( char * address, char * args, ...);
411−
412+
412413 void openBundle( OSCTimeTag t);
413414 void closeBundle();
414−
415+
415416 void startMessage( char * spec );
416417 void startMessage( char * address, char * args );
417418 void addInt( int4byte i ); // gewang: changed from int
@@ -423,7 +424,7 @@ public: · 5 unmodified lines
423424 void kickMessage();
424425
425426 void presend( char * buffer , int size );
426−
427+
427428 };
428429
429430 #define OSCINBUFSIZE 8192
@@ -434,7 +435,7 @@ public: · 4 unmodified lines
434435 //maximum size for the array ( ~2mb is enough, no )
435436 #define OSCINBOXMAX 256
436437
437−struct OSCMesg {
438+struct OSCMesg {
438439 char *address;
439440 char *types;
440441 char *data;
@@ -453,10 +454,10 @@ public: · 12 unmodified lines
453454 virtual ~UDP_Subscriber() {}
454455
455456 public:
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.
457458 virtual void onReceive( char * mesg, int mesgLen ) = 0;
458459
459−protected:
460+protected:
460461 virtual bool subscribe( int port );
461462 virtual bool unsubscribe();
462463 };
@@ -474,12 +475,12 @@ protected: · 11 unmodified lines
474475 // int _mesglen;
475476
476477 protected:
477− void onReceive( char * mesg, int mesgLen);
478− int & port();
478+ void onReceive( char * mesg, int mesgLen);
479+ int & port();
479480
480481 protected:
481− int _port;
482− int _tmp_port;
482+ int _port;
483+ int _tmp_port;
483484 XMutex * _io_mutex;
484485 XMutex * _address_mutex;
485486 // XThread * _io_thread;
@@ -493,37 +494,37 @@ protected: · 7 unmodified lines
493494 OSC_Address_Space ** _address_space;
494495 int _address_size;
495496 int _address_num;
496−
497+
497498 CBufferSimple * m_event_buffer;
498−
499+
499500 // REFACTOR-2017: VM ref
500501 Chuck_VM * m_vmRef;
501−
502+
502503 public:
503504 OSC_Receiver( Chuck_VM * vm );
504505 OSC_Receiver( Chuck_VM * vm, UDP_Receiver * in );
505506 virtual ~OSC_Receiver();
506−
507+
507508 //setup //takedown
508509 void init();
509510 void bind_to_port(int port = 0);
510511 void close_sock();
511−
512+
512513 void recv_mesg();
513514
514− bool listen( int port );
515+ bool listen( int port );
515516 bool listen();
516− void stopListening(); //unsubscribe;
517+ void stopListening(); //unsubscribe;
517518
518519 void parse(char *, int len);
519520 void handle_mesg(char *, int len);
520521 void handle_bundle(char *, int len);
521522 void set_mesg(OSCMesg *m, char * buf, int len );
522−
523+
523524 OSCMesg *write() { return _inbox + _in_write;}
524525 void next_write();
525−
526− OSCMesg *read() { return _inbox + _in_read;}
526+
527+ OSCMesg *read() { return _inbox + _in_read;}
527528 OSCMesg *next_read();
528529
529530
@@ -531,7 +532,7 @@ public: · 1 unmodified line
531532 bool get_mesg(OSCMesg* bucket);
532533
533534 void add_address ( OSC_Address_Space * o );
534− void remove_address ( OSC_Address_Space * o );
535+ void remove_address ( OSC_Address_Space * o );
535536 OSC_Address_Space * new_event ( char * spec );
536537 OSC_Address_Space * new_event ( char * addr, char * type );
537538 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
541542
542543 struct opsc_data
543544 {
544− osc_datatype t;
545+ osc_datatype t;
545546 OSCTimeTag timetag;
546547
547− union {
548− int4byte i; // gewang: changed from int
549− unsigned long u; // gewang: changed from unsigned int
550− float f;
551− };
548+ union {
549+ int4byte i; // gewang: changed from int
550+ unsigned long u; // gewang: changed from unsigned int
551+ float f;
552+ };
552553
553554 char * s;
554555
555− opsc_data() {
556+ opsc_data() {
556557 t = OSC_UNTYPED;
557558 s = NULL;
558559 }
559− ~opsc_data() {
560+ ~opsc_data() {
560561 s = NULL;
561562 }
562563 };
@@ -590,10 +591,10 @@ protected: · 27 unmodified lines
590591 void resizeData(int n);
591592 void resizeQueue(int n);
592593 void parseSpec();
593− void scanSpec();
594+ void scanSpec();
594595
595596 public:
596− Chuck_Object * SELF;
597+ Chuck_Object * SELF;
597598 Chuck_String p_str;
598599 OSC_Address_Space();
599600 OSC_Address_Space( const char * spec );
chuginate/template/chuck/include/util_platforms.h+9−10
@@ -1,21 +1,21 @@
11 /*----------------------------------------------------------------------------
22 ChucK Concurrent, On-the-fly Audio Programming Language
33 Compiler and Virtual Machine
4−
4+
55 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.
66 http://chuck.stanford.edu/
77 http://chuck.cs.princeton.edu/
8−
8+
99 This program is free software; you can redistribute it and/or modify
1010 it under the terms of the GNU General Public License as published by
1111 the Free Software Foundation; either version 2 of the License, or
1212 (at your option) any later version.
13−
13+
1414 This program is distributed in the hope that it will be useful,
1515 but WITHOUT ANY WARRANTY; without even the implied warranty of
1616 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1717 GNU General Public License for more details.
18−
18+
1919 You should have received a copy of the GNU General Public License
2020 along with this program; if not, write to the Free Software
2121 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -42,16 +42,15 @@ · 20 unmodified lines
4242 #include <jni.h>
4343 #include <stdio.h>
4444
45−
4645 //-----------------------------------------------------------------------------
47−// name: class ChuckAndroid
46+// name: namespace ChuckAndroid
4847 // desc: android specific ChucK utilities
4948 //-----------------------------------------------------------------------------
50−class ChuckAndroid
49+namespace ChuckAndroid
5150 {
52−public:
53− static JavaVM * getJVM();
54− static FILE * getTemporaryFile();
51+ JavaVM * getJVM();
52+ FILE * getTemporaryFile() noexcept;
53+ bool copyJARURLFileToTemporary(const char * jar_url, int * fd) noexcept;
5554 };
5655
5756 #endif // __ANDROID__
chuginate/template/chuck/include/util_serial.h+5−4
@@ -32,9 +32,10 @@ · 31 unmodified lines
3232 #ifndef __UTIL_SERIAL_H__
3333 #define __UTIL_SERIAL_H__
3434
35+#include "chuck_def.h"
36+
3537 #include <vector>
3638 #include <string>
37−using namespace std;
3839
3940
4041
@@ -46,10 +47,10 @@ using namespace std; · 5 unmodified lines
4647 class SerialIOManager
4748 {
4849 public:
49− static vector<string> availableSerialDevices();
50−
50+ static std::vector<std::string> availableSerialDevices();
51+
5152 private:
52− static vector<string> s_availableSerialDevices;
53+ static std::vector<std::string> s_availableSerialDevices;
5354 };
5455
5556
chuginate/template/chuck/include/util_sndfile.h+103−99
@@ -57,7 +57,7 @@ · 56 unmodified lines
5757
5858
5959 // XXX philipd this might break things?
60−// these defines were placed after the machine-dependent
60+// these defines were placed after the machine-dependent
6161 // checks below...i'm not sure why
6262
6363 #define COMPILER_IS_GCC 1
@@ -163,7 +163,7 @@ · 99 unmodified lines
163163 #endif
164164
165165 #ifdef __LINUX_ALSA__
166−#define HAVE_ALSA_ASOUNDLIB_H
166+#define HAVE_ALSA_ASOUNDLIB_H
167167 #endif
168168
169169 #if defined(__PLATFORM_LINUX__)
@@ -201,11 +201,11 @@ · 31 unmodified lines
201201
202202 // XXX 'inline' is necessary for C compilation
203203 // in the microsoft vc6 compiler...
204−// and other ms win32 specialteez.
204+// and other ms win32 specialteez.
205205
206206 #ifdef __PLATFORM_WIN32__
207207
208−#define C_INLINE __inline
208+#define C_INLINE __inline
209209 #define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFF
210210
211211 #else
@@ -421,7 +421,7 @@ typedef struct SNDFILE_tag SNDFILE ; · 209 unmodified lines
421421
422422
423423 /* 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),
425425 ** off64_t (Solaris), __int64_t (Win32) etc.
426426 */
427427
@@ -1284,53 +1284,53 @@ int sf_dither_double (const SF_DITHER_INFO *dither, const double *in, double · 856 unmodified lines
12841284 */
12851285 /*
12861286 ** Copyright (C) 1999-2001 Erik de Castro Lopo <erikd@mega-nerd.com>
1287−**
1287+**
12881288 ** This program is free software; you can redistribute it and/or modify
12891289 ** it under the terms of the GNU Lesser General Public License as published by
12901290 ** the Free Software Foundation; either version 2.1 of the License, or
12911291 ** (at your option) any later version.
1292−**
1292+**
12931293 ** This program is distributed in the hope that it will be useful,
12941294 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12951295 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12961296 ** GNU Lesser General Public License for more details.
1297−**
1297+**
12981298 ** 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
13001300 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
13011301 */
13021302
13031303 /*
13041304 ** 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
13061306 ** of this name have been moved to private.h.
1307−*/
1307+*/
13081308
13091309 #ifndef G72X_HEADER_FILE
13101310 #define G72X_HEADER_FILE
13111311
1312−/*
1313−** Number of samples per block to process.
1312+/*
1313+** Number of samples per block to process.
13141314 ** Must be a common multiple of possible bits per sample : 2, 3, 4, 5 and 8.
13151315 */
1316−#define G72x_BLOCK_SIZE (3*5*8)
1316+#define G72x_BLOCK_SIZE (3*5*8)
13171317
1318−/*
1318+/*
13191319 ** Identifiers for the differing kinds of G72x ADPCM codecs.
13201320 ** The identifiers also define the number of encoded bits per sample.
13211321 */
13221322
13231323 enum
13241324 { G723_16_BITS_PER_SAMPLE = 2,
1325− G723_24_BITS_PER_SAMPLE = 3,
1326− G723_40_BITS_PER_SAMPLE = 5,
1325+ G723_24_BITS_PER_SAMPLE = 3,
1326+ G723_40_BITS_PER_SAMPLE = 5,
13271327
13281328 G721_32_BITS_PER_SAMPLE = 4,
13291329 G721_40_BITS_PER_SAMPLE = 5,
13301330
13311331 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),
1333− G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_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),
13341334
13351335 G721_32_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
13361336 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
13411341
13421342 G721_32_BYTES_PER_BLOCK = (G721_32_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
13431343 G721_40_BYTES_PER_BLOCK = (G721_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8
1344−} ;
1344+} ;
13451345
1346−/*
1346+/*
13471347 ** This is the public structure for passing data between the caller and
1348−** the G72x encoder and decoder.
1348+** the G72x encoder and decoder.
13491349 ** The private array is used by the encoder and decoder for internal
13501350 ** state information and should not be changed in any way by the caller.
13511351 ** When decoding or encoding a stream, the same instance of this struct
@@ -1353,9 +1353,9 @@ enum · 1 unmodified line
13531353 ** correct state data between calls.
13541354 */
13551355
1356−typedef struct
1356+typedef struct
13571357 { /* Private data. Don't mess with it. */
1358− unsigned long sprivateo [256 / sizeof (long)] ;
1358+ unsigned long sprivateo [256 / sizeof (long)] ;
13591359
13601360 /* Public data. Read only. */
13611361 int blocksize, max_bytes, samplesperblock, bytesperblock ;
@@ -1377,23 +1377,23 @@ int g72x_writer_init (G72x_DATA *data, int codec) ; · 15 unmodified lines
13771377
13781378 int g72x_decode_block (G72x_DATA *data) ;
13791379 /*
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
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
13821382 ** data->blocksize and be <= data->max_bytes.
1383−** When it returns, the caller can read out data->samples samples.
1384−*/
1383+** When it returns, the caller can read out data->samples samples.
1384+*/
13851385
13861386 int g72x_encode_block (G72x_DATA *data) ;
1387−/*
1387+/*
13881388 ** The caller fills state->samples some integer multiple data->samples_per_block
13891389 ** (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.
13911391 */
13921392
13931393 #endif /* !G72X_HEADER_FILE */
13941394 /*
13951395 ** 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
13971397 ** revision control system.
13981398 **
13991399 ** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d921621
@@ -1432,10 +1432,10 @@ int g72x_encode_block (G72x_DATA *data) ; · 32 unmodified lines
14321432 /*
14331433 ** The following is the definition of the state structure used by the
14341434 ** G.721/G.723 encoder and decoder to preserve their internal state
1435−** between successive calls. The meanings of the majority of the state
1436−** structure fields are explained in detail in the CCITT Recommendation
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
1435+** between successive calls. The meanings of the majority of the state
1436+** structure fields are explained in detail in the CCITT Recommendation
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
14391439 ** Recommendation.
14401440 */
14411441
@@ -1463,19 +1463,19 @@ typedef struct private_g72x · 21 unmodified lines
14631463 ** format.
14641464 */
14651465 char td; /* delayed tone detect, new in 1988 version */
1466−
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
1469− ** which is slow on architectures like Intel x86. For libsndfile, this
1466+
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
1469+ ** which is slow on architectures like Intel x86. For libsndfile, this
14701470 ** was changed so that the encoding and decoding routines could work on
14711471 ** a block of samples at a time to reduce the function call overhead.
14721472 */
14731473 int (*encoder) (int, struct private_g72x* state) ;
14741474 int (*decoder) (int, struct private_g72x* state) ;
1475−
1475+
14761476 int codec_bits ;
14771477 int byte_index, sample_index ;
1478−
1478+
14791479 } G72x_STATE ;
14801480
14811481
@@ -1512,7 +1512,7 @@ void private_init_state (G72x_STATE *state_ptr) ; · 30 unmodified lines
15121512 #endif /* G72X_PRIVATE_H */
15131513 /*
15141514 ** 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
15161516 ** revision control system.
15171517 **
15181518 ** arch-tag: d9ad4da7-0fa3-471d-8020-720b5cfb5e5b
@@ -1615,7 +1615,7 @@ void endswap_long_copy (long *dest, long *src, int len) ; · 96 unmodified lines
16151615
16161616 /*
16171617 ** 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
16191619 ** revision control system.
16201620 **
16211621 ** arch-tag: f0c5cd54-42d3-4237-90ec-11fe24995de7
@@ -1655,9 +1655,9 @@ typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */ · 33 unmodified lines
16551655 gsm gsm_create (void);
16561656
16571657 /* Added for libsndfile : May 6, 2002 */
1658−void gsm_init (gsm);
1658+void gsm_init (gsm);
16591659
1660−void gsm_destroy (gsm);
1660+void gsm_destroy (gsm);
16611661
16621662 int gsm_print (FILE *, gsm, gsm_byte *);
16631663 int gsm_option (gsm, int, int *);
@@ -1671,7 +1671,7 @@ void gsm_implode (gsm, gsm_signal *, gsm_byte *); · 7 unmodified lines
16711671 #endif /* GSM_H */
16721672 /*
16731673 ** 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
16751675 ** revision control system.
16761676 **
16771677 ** arch-tag: 8cfc7698-5433-4b6f-aeca-967c6fda4dec
@@ -1679,19 +1679,19 @@ void gsm_implode (gsm, gsm_signal *, gsm_byte *); · 1 unmodified line
16791679
16801680 /*
16811681 ** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
1682−**
1682+**
16831683 ** This program is free software; you can redistribute it and/or modify
16841684 ** it under the terms of the GNU Lesser General Public License as published by
16851685 ** the Free Software Foundation; either version 2.1 of the License, or
16861686 ** (at your option) any later version.
1687−**
1687+**
16881688 ** This program is distributed in the hope that it will be useful,
16891689 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16901690 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16911691 ** GNU Lesser General Public License for more details.
1692−**
1692+**
16931693 ** 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
16951695 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16961696 */
16971697
@@ -1711,7 +1711,7 @@ int au_g72x_writer_init (SF_PRIVATE *psf, int codec) ; · 13 unmodified lines
17111711 #endif /* AU_HEADER_FILE */
17121712 /*
17131713 ** 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
17151715 ** revision control system.
17161716 **
17171717 ** arch-tag: 63affc81-e204-4468-9705-60abe4d10689
@@ -1748,9 +1748,13 @@ enum · 30 unmodified lines
17481748 {
17491749 /* keep sorted for wav_w64_format_str() */
17501750 WAVE_FORMAT_UNKNOWN = 0x0000, /* Microsoft Corporation */
1751−#ifndef WAVE_FORMAT_PCM
1752− WAVE_FORMAT_PCM = 0x0001, /* Microsoft PCM format */
1753−#endif
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 */
17541758 WAVE_FORMAT_MS_ADPCM = 0x0002, /* Microsoft ADPCM */
17551759 WAVE_FORMAT_IEEE_FLOAT = 0x0003, /* Micrososft 32 bit float format */
17561760 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
19951999 #endif
19962000 /*
19972001 ** 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
19992003 ** revision control system.
20002004 **
20012005 ** arch-tag: 877fde12-9be3-4a31-8a5a-fdae39958613
20022006 */
20032007 /*
20042008 ** Copyright (C) 1999-2001 Erik de Castro Lopo <erikd@mega-nerd.com>
2005−**
2009+**
20062010 ** This program is free software; you can redistribute it and/or modify
20072011 ** it under the terms of the GNU Lesser General Public License as published by
20082012 ** the Free Software Foundation; either version 2.1 of the License, or
20092013 ** (at your option) any later version.
2010−**
2014+**
20112015 ** This program is distributed in the hope that it will be useful,
20122016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20132017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20142018 ** GNU Lesser General Public License for more details.
2015−**
2019+**
20162020 ** 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
20182022 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20192023 */
20202024
20212025 /*
20222026 ** 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
20242028 ** of this name have been moved to private.h.
2025−*/
2029+*/
20262030
20272031 #ifndef G72X_HEADER_FILE
20282032 #define G72X_HEADER_FILE
20292033
2030−/*
2031−** Number of samples per block to process.
2034+/*
2035+** Number of samples per block to process.
20322036 ** Must be a common multiple of possible bits per sample : 2, 3, 4, 5 and 8.
20332037 */
2034−#define G72x_BLOCK_SIZE (3*5*8)
2038+#define G72x_BLOCK_SIZE (3*5*8)
20352039
2036−/*
2040+/*
20372041 ** Identifiers for the differing kinds of G72x ADPCM codecs.
20382042 ** The identifiers also define the number of encoded bits per sample.
20392043 */
20402044
20412045 enum
20422046 { G723_16_BITS_PER_SAMPLE = 2,
2043− G723_24_BITS_PER_SAMPLE = 3,
2044− G723_40_BITS_PER_SAMPLE = 5,
2047+ G723_24_BITS_PER_SAMPLE = 3,
2048+ G723_40_BITS_PER_SAMPLE = 5,
20452049
20462050 G721_32_BITS_PER_SAMPLE = 4,
20472051 G721_40_BITS_PER_SAMPLE = 5,
20482052
20492053 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),
2051− G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE),
2054+ G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE),
2055+ G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE),
20522056
20532057 G721_32_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
20542058 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
20592063
20602064 G721_32_BYTES_PER_BLOCK = (G721_32_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
20612065 G721_40_BYTES_PER_BLOCK = (G721_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8
2062−} ;
2066+} ;
20632067
2064−/*
2068+/*
20652069 ** This is the public structure for passing data between the caller and
2066−** the G72x encoder and decoder.
2070+** the G72x encoder and decoder.
20672071 ** The private array is used by the encoder and decoder for internal
20682072 ** state information and should not be changed in any way by the caller.
20692073 ** When decoding or encoding a stream, the same instance of this struct
@@ -2071,9 +2075,9 @@ enum · 1 unmodified line
20712075 ** correct state data between calls.
20722076 */
20732077
2074−typedef struct
2078+typedef struct
20752079 { /* Private data. Don't mess with it. */
2076− unsigned long sprivateo [256 / sizeof (long)] ;
2080+ unsigned long sprivateo [256 / sizeof (long)] ;
20772081
20782082 /* Public data. Read only. */
20792083 int blocksize, max_bytes, samplesperblock, bytesperblock ;
@@ -2095,23 +2099,23 @@ int g72x_writer_init (G72x_DATA *data, int codec) ; · 15 unmodified lines
20952099
20962100 int g72x_decode_block (G72x_DATA *data) ;
20972101 /*
2098−** The caller fills data->block with data->bytes bytes before calling the
2099−** function. The value data->bytes must be an integer multiple of
2102+** The caller fills data->block with data->bytes bytes before calling the
2103+** function. The value data->bytes must be an integer multiple of
21002104 ** data->blocksize and be <= data->max_bytes.
2101−** When it returns, the caller can read out data->samples samples.
2102−*/
2105+** When it returns, the caller can read out data->samples samples.
2106+*/
21032107
21042108 int g72x_encode_block (G72x_DATA *data) ;
2105−/*
2109+/*
21062110 ** The caller fills state->samples some integer multiple data->samples_per_block
21072111 ** (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.
21092113 */
21102114
21112115 #endif /* !G72X_HEADER_FILE */
21122116 /*
21132117 ** 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
21152119 ** revision control system.
21162120 **
21172121 ** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d921621
@@ -2129,7 +2133,7 @@ int g72x_encode_block (G72x_DATA *data) ; · 11 unmodified lines
21292133 /* Added by Erik de Castro Lopo */
21302134 #define USE_FLOAT_MUL
21312135 #define FAST
2132−#define WAV49
2136+#define WAV49
21332137 /* Added by Erik de Castro Lopo */
21342138
21352139
@@ -2140,7 +2144,7 @@ typedef int longword; /* 32 bit signed int */ · 4 unmodified lines
21402144 typedef unsigned short uword; /* unsigned word */
21412145 typedef unsigned int ulongword; /* unsigned longword */
21422146
2143−struct gsm_state
2147+struct gsm_state
21442148 { word dp0[ 280 ] ;
21452149
21462150 word z1; /* preprocessing.c, Offset_com. */
@@ -2212,7 +2216,7 @@ longword gsm_L_asr (longword a, int n) ; · 65 unmodified lines
22122216 word gsm_asr (word a, int n) ;
22132217
22142218 /*
2215− * Inlined functions from add.h
2219+ * Inlined functions from add.h
22162220 */
22172221
22182222 static C_INLINE longword
@@ -2233,17 +2237,17 @@ GSM_L_MULT (word a, word b) · 14 unmodified lines
22332237 static C_INLINE longword
22342238 GSM_L_ADD (longword a, longword b)
22352239 { ulongword utmp ;
2236−
2240+
22372241 if (a < 0 && b < 0)
22382242 { utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1) ;
22392243 return (utmp >= (ulongword) MAX_LONGWORD) ? MIN_LONGWORD : -(longword)utmp-2 ;
22402244 } ;
2241−
2245+
22422246 if (a > 0 && b > 0)
22432247 { utmp = (ulongword) a + (ulongword) b ;
22442248 return (utmp >= (ulongword) MAX_LONGWORD) ? MAX_LONGWORD : utmp ;
22452249 } ;
2246−
2250+
22472251 return a + b ;
22482252 } /* GSM_L_ADD */
22492253
@@ -2266,12 +2270,12 @@ GSM_SUB (word a, word b) · 16 unmodified lines
22662270 { longword ltmp ;
22672271
22682272 ltmp = ((longword) a) - ((longword) b) ;
2269−
2273+
22702274 if (ltmp >= MAX_WORD)
22712275 ltmp = MAX_WORD ;
22722276 else if (ltmp <= MIN_WORD)
22732277 ltmp = MIN_WORD ;
2274−
2278+
22752279 return ltmp ;
22762280 } /* GSM_SUB */
22772281
@@ -2319,10 +2323,10 @@ void Gsm_Preprocess ( · 41 unmodified lines
23192323
23202324 void Gsm_Encoding (
23212325 struct gsm_state * S,
2322− word * e,
2323− word * ep,
2326+ word * e,
2327+ word * ep,
23242328 word * xmaxc,
2325− word * Mc,
2329+ word * Mc,
23262330 word * xMc) ;
23272331
23282332 void Gsm_Short_Term_Analysis_Filter (
@@ -2415,7 +2419,7 @@ extern word gsm_FAC [8] ; · 86 unmodified lines
24152419 #endif /* PRIVATE_H */
24162420 /*
24172421 ** 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
24192423 ** revision control system.
24202424 **
24212425 ** arch-tag: 8bc5fdf2-e8c8-4686-9bd7-a30b512bef0c
@@ -2582,8 +2586,8 @@ extern word gsm_FAC [8] ; · 160 unmodified lines
25822586 { int res [2] ;
25832587
25842588 __asm__ __volatile__
2585− ( "fctiw %1, %1\n\t"
2586− "stfd %1, %0"
2589+ ( "fctiw %1, %1\n\t"
2590+ "stfd %1, %0"
25872591 : "=m" (res) /* Output */
25882592 : "f" (in) /* Input */
25892593 : "memory"
@@ -2597,8 +2601,8 @@ extern word gsm_FAC [8] ; · 7 unmodified lines
25972601 { int res [2] ;
25982602
25992603 __asm__ __volatile__
2600− ( "fctiw %1, %1\n\t"
2601− "stfd %1, %0"
2604+ ( "fctiw %1, %1\n\t"
2605+ "stfd %1, %0"
26022606 : "=m" (res) /* Output */
26032607 : "f" (in) /* Input */
26042608 : "memory"
@@ -2623,7 +2627,7 @@ extern word gsm_FAC [8] ; · 18 unmodified lines
26232627
26242628 /*
26252629 ** 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
26272631 ** revision control system.
26282632 **
26292633 ** arch-tag: 42db1693-ff61-4051-bac1-e4d24c4e30b7
@@ -2712,7 +2716,7 @@ extern word gsm_FAC [8] ; · 82 unmodified lines
27122716 */
27132717 /*
27142718 ** 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
27162720 ** revision control system.
27172721 **
27182722 ** 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
5555 std::string rtrim( const std::string & val );
5656
5757 // argument extraction
58−t_CKBOOL extract_args( const std::string & token,
58+t_CKBOOL extract_args( const std::string & token,
5959 std::string & filename,
6060 std::vector<std::string> & args );
6161
@@ -66,8 +66,9 @@ std::string dir_go_up( const std::string & dir, t_CKINT numUp ); · 4 unmodified lines
6666 std::string get_full_path( const std::string & fp );
6767
6868 // currently just expands ~ to HOME and ~user to user's home directory
69−std::string expand_filepath( std::string & fp );
69+std::string expand_filepath( std::string & fp, t_CKBOOL ensurePathExists = TRUE );
7070
71+// get directory portion of a filepath (minus the file itself)
7172 std::string extract_filepath_dir(std::string &filepath);
7273
7374 // convert \ to / (on Windows)
@@ -75,7 +76,10 @@ std::string normalize_directory_separator(const std::string &filepath); · 1 unmodified line
7576
7677 // determine if the last characters of str match end exactly
7778 // e.g. to test file extension
78−int str_endsin(const char *str, const char *end);
79+t_CKBOOL str_endsin(const char *str, const char *end);
80+
81+// check if path is absolute on the underlying platform
82+t_CKBOOL is_absolute_path( const std::string & path );
7983
8084 //-----------------------------------------------------------------------------
8185 // name: parse_path_list()
chuginate/template/chuck/include/util_thread.h+18−18
@@ -148,47 +148,47 @@ protected: · 147 unmodified lines
148148 //-----------------------------------------------------------------------------
149149 // name: XWriteThread()
150150 // desc: utility class for scheduling writes to be executed on a separate
151−// thread.
151+// thread.
152152 //-----------------------------------------------------------------------------
153153 class XWriteThread
154154 {
155155 public:
156− // get the shared instance
156+ // get the shared instance
157157 static XWriteThread * shared();
158158 // static buffer size
159159 const static size_t PRODUCER_BUFFER_SIZE;
160160
161161 public:
162− // constructor
162+ // constructor
163163 XWriteThread( size_t data_buffer_size = 4096, size_t msg_buffer_size = 32 );
164−
164+
165165 public:
166166 size_t fwrite( const void * ptr, size_t size, size_t nitems, FILE * stream );
167167 int fseek( FILE * stream, long offset, int whence );
168168 int fflush( FILE * stream );
169169 int fclose( FILE * stream );
170−
170+
171171 // DO NOT DELETE INSTANCES OF XWriteThread
172172 // instead call shutdown and they will be cleaned up in the background
173173 void shutdown();
174174
175−private:
175+private:
176176 // DO NOT DELETE INSTANCES OF XWriteThread
177177 // instead call shutdown and they will be cleaned up in the background
178178 ~XWriteThread();
179179
180− // flush
180+ // flush
181181 void flush_data_buffer();
182182
183− // callback
183+ // callback
184184 #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) )
185185 static void * write_cb( void * _thiss );
186186 #elif defined(__PLATFORM_WIN32__)
187187 static unsigned THREAD_TYPE write_cb( void * _thiss );
188188 #endif
189189
190− // shared instance
191− static XWriteThread * o_defaultWriteThread;
190+ // shared instance
191+ static XWriteThread * o_defaultWriteThread;
192192
193193 private:
194194 t_CKBOOL m_thread_exit;
@@ -198,10 +198,10 @@ private: · 3 unmodified lines
198198 t_CKBYTE * m_thread_buffer;
199199 FILE * m_stream;
200200
201− // internal message format
201+ // internal message format
202202 struct Message
203203 {
204− // operation type
204+ // operation type
205205 enum
206206 {
207207 WRITE,
@@ -210,18 +210,18 @@ private: · 2 unmodified lines
210210 CLOSE,
211211 SHUTDOWN
212212 } operation;
213−
214− // file pointer
213+
214+ // file pointer
215215 FILE * file;
216−
217− // size / offset
216+
217+ // size / offset
218218 union
219219 {
220220 struct
221221 {
222222 size_t data_size;
223223 } write;
224−
224+
225225 struct
226226 {
227227 long offset;
@@ -233,7 +233,7 @@ private: · 5 unmodified lines
233233 Message() : file(NULL) { }
234234 };
235235
236− // circular buffer
236+ // circular buffer
237237 CircularBuffer<Message> * m_msg_buffer;
238238 };
239239

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