History

Merge branch 'main' of https://github.com/terryzfeng/chuck

terry feng committed 3 years ago

Commit 872364e2 parents c9bf4e6 c0ac2ff8 files · +220 −59Browse files

Unified · Split

8 files
  1. src/core/chuck_dl.cpp +1 −1
  2. src/core/chuck_io.cpp +128 −41
  3. src/core/chuck_lang.cpp +1 −1
  4. src/core/chuck_type.cpp +17 −0
  5. src/core/hidio_sdl.cpp +1 −1
  6. src/core/ugen_stk.cpp +27 −5
  7. src/core/ulib_opsc.cpp +37 −9
  8. src/core/ulib_std.cpp +8 −1
src/core/chuck_dl.cpp+1−1
@@ -540,7 +540,7 @@ t_CKBOOL CK_DLL_CALL ck_end_class( Chuck_DL_Query * query ) · 539 unmodified lines
540540 {
541541 if( !type_engine_add_class_from_dl( query->env(), query->curr_class ) )
542542 {
543− EM_log(CK_LOG_SEVERE, "[chuck](DL): error importing class '%s' into type engine",
543+ EM_log(CK_LOG_SEVERE, "error importing class '%s' into type engine",
544544 query->curr_class->name.c_str());
545545
546546 // pop
src/core/chuck_io.cpp+128−41
@@ -106,24 +106,28 @@ t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type ) · 105 unmodified lines
106106
107107 // add good()
108108 func = make_new_mfun( "int", "good", io_dummy );
109− func->doc = "_";
109+ func->doc = "Returns whether IO is ready for reading.";
110110 if( !type_engine_import_mfun( env, func ) ) goto error;
111111
112112 // add close()
113113 func = make_new_mfun( "void", "close", io_dummy );
114+ func->doc = "Close the currently open IO.";
114115 if( !type_engine_import_mfun( env, func ) ) goto error;
115116
116117 // add flush()
117118 func = make_new_mfun( "void", "flush", io_dummy );
119+ func->doc = "Write any buffered output.";
118120 if( !type_engine_import_mfun( env, func ) ) goto error;
119121
120122 // add mode(int)
121123 func = make_new_mfun( "int", "mode", io_dummy );
122124 func->add_arg( "int", "flag" );
125+ func->doc = "Set the current IO mode; either IO.MODE_ASYNC or IO.MODE_SYNC.";
123126 if( !type_engine_import_mfun( env, func ) ) goto error;
124127
125128 // add mode()
126129 func = make_new_mfun( "int", "mode", io_dummy );
130+ func->doc = "Get the current IO mode; either IO.MODE_ASYNC or IO.MODE_SYNC.";
127131 if( !type_engine_import_mfun( env, func ) ) goto error;
128132
129133 // TODO: add this later?
@@ -134,11 +138,13 @@ t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type ) · 4 unmodified lines
134138
135139 // add readLine()
136140 func = make_new_mfun( "string", "readLine", io_dummy );
141+ func->doc = "Read until an end-of-line character.";
137142 if( !type_engine_import_mfun( env, func ) ) goto error;
138143
139144 // add readInt()
140145 func = make_new_mfun( "int", "readInt", io_dummy );
141146 func->add_arg( "int", "flags" );
147+ func->doc = "Read and return the next integer (binary mode); 'flags' denotes the bit-size of int (IO.INT8, IO.INT16, or IO.INT32).";
142148 if( !type_engine_import_mfun( env, func ) ) goto error;
143149
144150 /*
@@ -164,81 +170,92 @@ t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type ) · 19 unmodified lines
164170
165171 // add eof()
166172 func = make_new_mfun( "int", "eof", io_dummy );
173+ func->doc = "Return whether end-of-file has been reached; the opposite of .more().";
167174 if( !type_engine_import_mfun( env, func ) ) goto error;
168175
169176 // add more()
170177 func = make_new_mfun( "int", "more", io_dummy );
178+ func->doc = "Return whether there is more to read; the opposite of .eof().";
171179 if( !type_engine_import_mfun( env, func ) ) goto error;
172180
173181 // add write(string)
174182 func = make_new_mfun( "void", "write", io_dummy );
175183 func->add_arg( "string", "val" );
184+ func->doc = "Write string 'val'.";
176185 if( !type_engine_import_mfun( env, func ) ) goto error;
177186
178187 // add write(int)
179188 func = make_new_mfun( "void", "write", io_dummy );
180189 func->add_arg( "int", "val" );
190+ func->doc = "Write integer 'val'.";
181191 if( !type_engine_import_mfun( env, func ) ) goto error;
182192
183193 // add write(float)
184194 func = make_new_mfun( "void", "write", io_dummy );
185195 func->add_arg( "float", "val" );
196+ func->doc = "Write floating point number 'val'.";
186197 if( !type_engine_import_mfun( env, func ) ) goto error;
187198
188199 // add newline
189200 func = make_new_sfun( "string", "newline", io_newline );
201+ func->doc = "newline character; same as IO.nl().";
190202 if( !type_engine_import_sfun( env, func ) ) goto error;
203+ // add nl
191204 func = make_new_sfun( "string", "nl", io_newline );
205+ func->doc = "newline character; same as IO.newline().";
192206 if( !type_engine_import_sfun( env, func ) ) goto error;
193− func = make_new_sfun( "string", "newlineEx2VistaHWNDVisualFoxProA", io_newline );
194− if( !type_engine_import_sfun( env, func ) ) goto error;
207+ // hmm
208+ // func = make_new_sfun( "string", "newlineEx2VistaHWNDVisualFoxProA", io_newline );
209+ // func->doc = "_";
210+ // if( !type_engine_import_sfun( env, func ) ) goto error;
211+ // new line string
195212 initialize_object( g_newline, env->t_string );
196213 g_newline->set( "\n" );
197214
198215 // add TYPE_ASCII
199216 if( !type_engine_import_svar( env, "int", "ASCII",
200− TRUE, (t_CKUINT)&Chuck_IO::TYPE_ASCII ) ) goto error;
217+ TRUE, (t_CKUINT)&Chuck_IO::TYPE_ASCII, "Flag denoting ASCII IO mode." ) ) goto error;
201218 // add TYPE_BINARY
202219 if( !type_engine_import_svar( env, "int", "BINARY",
203− TRUE, (t_CKUINT)&Chuck_IO::TYPE_BINARY ) ) goto error;
220+ TRUE, (t_CKUINT)&Chuck_IO::TYPE_BINARY, "Flag denoting binary IO mode." ) ) goto error;
204221 // add INT8
205222 if( !type_engine_import_svar( env, "int", "INT8",
206− TRUE, (t_CKUINT)&Chuck_IO::INT8 ) ) goto error;
223+ TRUE, (t_CKUINT)&Chuck_IO::INT8, "Flag denoting 8-bit integer type." ) ) goto error;
207224 // add INT16
208225 if( !type_engine_import_svar( env, "int", "INT16",
209− TRUE, (t_CKUINT)&Chuck_IO::INT16 ) ) goto error;
226+ TRUE, (t_CKUINT)&Chuck_IO::INT16, "Flag denoting 16-bit integer type." ) ) goto error;
210227 // add INT32
211228 if( !type_engine_import_svar( env, "int", "INT32",
212− TRUE, (t_CKUINT)&Chuck_IO::INT32 ) ) goto error;
213− // add READ_INT8
214− if( !type_engine_import_svar( env, "int", "READ_INT8",
215− TRUE, (t_CKUINT)&Chuck_IO::INT8 ) ) goto error;
216− // add READ_INT16
217− if( !type_engine_import_svar( env, "int", "READ_INT16",
218− TRUE, (t_CKUINT)&Chuck_IO::INT16 ) ) goto error;
219− // add READ_INT32
220− if( !type_engine_import_svar( env, "int", "READ_INT32",
221− TRUE, (t_CKUINT)&Chuck_IO::INT32 ) ) goto error;
229+ TRUE, (t_CKUINT)&Chuck_IO::INT32, "Flag denoting 32-bit integer type." ) ) goto error;
230+// // add READ_INT8
231+// if( !type_engine_import_svar( env, "int", "READ_INT8",
232+// TRUE, (t_CKUINT)&Chuck_IO::INT8, "Flag denoting 8-bit integer type (same as INT8)." ) ) goto error;
233+// // add READ_INT16
234+// if( !type_engine_import_svar( env, "int", "READ_INT16",
235+// TRUE, (t_CKUINT)&Chuck_IO::INT16, "Flag denoting 16-bit integer type (same as INT16)." ) ) goto error;
236+// // add READ_INT32
237+// if( !type_engine_import_svar( env, "int", "READ_INT32",
238+// TRUE, (t_CKUINT)&Chuck_IO::INT32, "Flag denoting 32-bit integer type (same as INT32)." ) ) goto error;
222239 // add MODE_SYNC
223240 if( !type_engine_import_svar( env, "int", "MODE_SYNC",
224− TRUE, (t_CKUINT)&Chuck_IO::MODE_SYNC ) ) goto error;
241+ TRUE, (t_CKUINT)&Chuck_IO::MODE_SYNC, "Flag denoting synchronous IO." ) ) goto error;
225242 #ifndef __DISABLE_FILEIO__
226243 // add MODE_ASYNC
227244 if( !type_engine_import_svar( env, "int", "MODE_ASYNC",
228− TRUE, (t_CKUINT)&Chuck_IO::MODE_ASYNC ) ) goto error;
245+ TRUE, (t_CKUINT)&Chuck_IO::MODE_ASYNC, "Flag denoting asychronous IO." ) ) goto error;
229246 #endif
230247 // add FLAG_READONLY
231248 if( !type_engine_import_svar( env, "int", "READ",
232− TRUE, (t_CKUINT)&Chuck_IO::FLAG_READONLY ) ) goto error;
249+ TRUE, (t_CKUINT)&Chuck_IO::FLAG_READONLY, "Flag denoting read mode." ) ) goto error;
233250 // add FLAG_WRITEONLY
234251 if( !type_engine_import_svar( env, "int", "WRITE",
235− TRUE, (t_CKUINT)&Chuck_IO::FLAG_WRITEONLY ) ) goto error;
252+ TRUE, (t_CKUINT)&Chuck_IO::FLAG_WRITEONLY, "Flag denoting write mode." ) ) goto error;
236253 // add FLAG_APPEND
237254 if( !type_engine_import_svar( env, "int", "APPEND",
238− TRUE, (t_CKUINT)&Chuck_IO::FLAG_APPEND ) ) goto error;
255+ TRUE, (t_CKUINT)&Chuck_IO::FLAG_APPEND, "Flag denoting append mode." ) ) goto error;
239256 // add FLAG_READ_WRITE
240257 if( !type_engine_import_svar( env, "int", "READ_WRITE",
241− TRUE, (t_CKUINT)&Chuck_IO::FLAG_READ_WRITE ) ) goto error;
258+ TRUE, (t_CKUINT)&Chuck_IO::FLAG_READ_WRITE, "Flag denoting read/write mode." ) ) goto error;
242259
243260 // end the class import
244261 type_engine_import_class_end( env );
@@ -273,60 +290,72 @@ t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ) · 28 unmodified lines
273290 // TODO: ctor/dtor?
274291 // TODO: replace dummy with pure function
275292 if( !type_engine_import_class_begin( env, type, env->global(), fileio_ctor, fileio_dtor,
276− "Helper class doing file-related operations such as reading, writing, seeking, etc. See examples for usage." ) )
293+ "File input and output utilities for reading, writing, seeking, etc. See examples for usage." ) )
277294 return FALSE;
278295
279296 // add open(string)
280297 func = make_new_mfun( "int", "open", fileio_open );
281298 func->add_arg( "string", "path" );
299+ func->doc = "Open a file by name (and by default in ASCII mode).";
282300 if( !type_engine_import_mfun( env, func ) ) goto error;
283301
284302 // add open(string, flags)
285303 func = make_new_mfun( "int", "open", fileio_openflags );
286304 func->add_arg( "string", "path" );
287305 func->add_arg( "int", "flags" );
306+ func->doc = "Open a file by name with flags (bitwise combinations of IO.READ, IO.WRITE, IO.READ_WRITE, IO_APPEND, IO.ASCII, IO.BINARY).";
288307 if( !type_engine_import_mfun( env, func ) ) goto error;
289308
290309 // add good()
291310 func = make_new_mfun( "int", "good", fileio_good );
311+ func->doc = "Returns whether the file is ready for reading.";
292312 if( !type_engine_import_mfun( env, func ) ) goto error;
293313
294314 // add close()
295315 func = make_new_mfun( "void", "close", fileio_close );
316+ func->doc = "Close (and flush) the currently open file.";
296317 if( !type_engine_import_mfun( env, func ) ) goto error;
297318
298319 // add flush()
299320 func = make_new_mfun( "void", "flush", fileio_flush );
321+ func->doc = "Write any buffered output to file.";
300322 if( !type_engine_import_mfun( env, func ) ) goto error;
301323
302324 // add mode()
303325 func = make_new_mfun( "int", "mode", fileio_getmode );
326+ func->doc = "Get file IO mode (IO.MODE_SYNC or IO.MODE_ASYNC).";
304327 if( !type_engine_import_mfun( env, func ) ) goto error;
305328
306329 // add mode(int)
307330 func = make_new_mfun( "int", "mode", fileio_setmode );
308331 func->add_arg( "int", "flag" );
332+ func->doc = "Set file IO mode (IO.MODE_SYNC or IO.MODE_ASYNC).";
309333 if( !type_engine_import_mfun( env, func ) ) goto error;
310334
311335 // add size()
312336 func = make_new_mfun( "int", "size", fileio_size );
337+ func->doc = "Return the size of the file in bytes, or -1 if no file is opened or if a directory is opened.";
313338 if( !type_engine_import_mfun( env, func ) ) goto error;
314339
315340 // add seek(int)
316341 func = make_new_mfun( "void", "seek", fileio_seek );
317342 func->add_arg( "int", "pos" );
343+ func->doc = "Seek to a specified byte offset in file.";
318344 if( !type_engine_import_mfun( env, func ) ) goto error;
319345
320346 // add tell()
321347 func = make_new_mfun( "int", "tell", fileio_tell );
348+ func->doc = "Return the byte read offset of the file, or -1 if no file is opened.";
322349 if( !type_engine_import_mfun( env, func ) ) goto error;
323350
324351 // add isDir()
325352 func = make_new_mfun( "int", "isDir", fileio_isdir );
353+ func->doc = "Return if the open file is a directory.";
326354 if( !type_engine_import_mfun( env, func ) ) goto error;
327355
328356 // add dirList()
329357 func = make_new_mfun( "string[]", "dirList", fileio_dirlist );
358+ func->doc = "Get an array of file names in an open directory.";
330359 if( !type_engine_import_mfun( env, func ) ) goto error;
331360
332361 // add read()
@@ -336,6 +365,7 @@ t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ) · 3 unmodified lines
336365
337366 // add readLine()
338367 func = make_new_mfun( "string", "readLine", fileio_readline );
368+ func->doc = "Read and return the next line from file.";
339369 if( !type_engine_import_mfun( env, func ) ) goto error;
340370
341371 // add readInt()
@@ -345,6 +375,7 @@ t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ) · 3 unmodified lines
345375 // add readInt(int)
346376 func = make_new_mfun( "int", "readInt", fileio_readintflags );
347377 func->add_arg( "int", "flags" );
378+ func->doc = "Read and return an integer by size (binary mode) as specified in 'flags' (IO.INT8, IO.INT16, IO.INT32).";
348379 if( !type_engine_import_mfun( env, func ) ) goto error;
349380
350381 /*
@@ -375,31 +406,37 @@ t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ) · 24 unmodified lines
375406
376407 // add eof()
377408 func = make_new_mfun( "int", "eof", fileio_eof );
409+ func->doc = "Return whether end-of-file has been reached; the opposite of .more().";
378410 if( !type_engine_import_mfun( env, func ) ) goto error;
379411
380412 // add more()
381413 func = make_new_mfun( "int", "more", fileio_more );
414+ func->doc = "Return whether there is more to read; the opposite of .eof().";
382415 if( !type_engine_import_mfun( env, func ) ) goto error;
383416
384417 // add write(string)
385418 func = make_new_mfun( "void", "write", fileio_writestring );
386419 func->add_arg( "string", "val" );
420+ func->doc = "Write a string to file.";
387421 if( !type_engine_import_mfun( env, func ) ) goto error;
388422
389423 // add write(int)
390424 func = make_new_mfun( "void", "write", fileio_writeint );
391425 func->add_arg( "int", "val" );
426+ func->doc = "Write an integer to file.";
392427 if( !type_engine_import_mfun( env, func ) ) goto error;
393428
394429 // add write(int,flags)
395430 func = make_new_mfun( "void", "write", fileio_writeintflags );
396431 func->add_arg( "int", "val" );
397432 func->add_arg( "int", "flags" );
433+ func->doc = "Write integer to file (binary mode) by size as specified by 'flags' (IO.INT8, IO.INT16, IO.INT32).";
398434 if( !type_engine_import_mfun( env, func ) ) goto error;
399435
400436 // add write(float)
401437 func = make_new_mfun( "void", "write", fileio_writefloat );
402438 func->add_arg( "float", "val" );
439+ func->doc = "Write integer to file.";
403440 if( !type_engine_import_mfun( env, func ) ) goto error;
404441
405442 // add examples
@@ -445,7 +482,7 @@ t_CKBOOL init_class_chout( Chuck_Env * env, Chuck_Type * type ) · 39 unmodified lines
445482 EM_log( CK_LOG_SEVERE, "class 'chout'" );
446483
447484 // TODO: ctor/dtor?
448− if( !type_engine_import_class_begin( env, type, env->global(), NULL, NULL, "Do not instantiate this class directly! Use `chout` instead." ) )
485+ if( !type_engine_import_class_begin( env, type, env->global(), NULL, NULL, "Do not instantiate this class directly! Use 'chout' instead." ) )
449486 return FALSE;
450487
451488 // add good()
@@ -538,7 +575,7 @@ t_CKBOOL init_class_cherr( Chuck_Env * env, Chuck_Type * type ) · 86 unmodified lines
538575 EM_log( CK_LOG_SEVERE, "class 'cherr'" );
539576
540577 // TODO: ctor/dtor?
541− if( !type_engine_import_class_begin( env, type, env->global(), NULL, NULL, "Do not instantiate this class directly! Use `cherr` instead." ) )
578+ if( !type_engine_import_class_begin( env, type, env->global(), NULL, NULL, "Do not instantiate this class directly! Use 'cherr' instead." ) )
542579 return FALSE;
543580
544581 // add good()
@@ -698,7 +735,7 @@ t_CKBOOL init_class_Midi( Chuck_Env * env ) · 153 unmodified lines
698735
699736 // add good()
700737 func = make_new_mfun( "int", "good", MidiIn_good );
701− func->doc = "Return 1 if a device has been opened for this instance and there was no error connecting to it. Return 0 if a device has not been opened or there was an error opening a device.";
738+ func->doc = "Return true (1) if a device has been opened for this instance and there was no error connecting to it. Return false (0) if a device has not been opened or there was an error opening a device.";
702739 if( !type_engine_import_mfun( env, func ) ) goto error;
703740
704741 // add num()
@@ -725,7 +762,8 @@ t_CKBOOL init_class_Midi( Chuck_Env * env ) · 20 unmodified lines
725762
726763 // add can_wait()
727764 func = make_new_mfun( "int", "can_wait", MidiIn_can_wait );
728− func->doc = "Return 1 if the device has no more messages in its queue from the device, 0 if it has more messages.";
765+ func->doc = "(internal) used by virtual machine for synthronization.";
766+ // func->doc = "Return 1 if the device has no more messages in its queue from the device, 0 if it has more messages.";
729767 if( !type_engine_import_mfun( env, func ) ) goto error;
730768
731769 // add member variable
@@ -762,7 +800,7 @@ t_CKBOOL init_class_Midi( Chuck_Env * env ) · 30 unmodified lines
762800
763801 // add good()
764802 func = make_new_mfun( "int", "good", MidiOut_good );
765− func->doc = "Return 1 if a device has been opened for this instance and there was no error connecting to it. Return 0 if a device has not been opened or there was an error opening a device.";
803+ func->doc = "Return true (1) if a device has been opened for this instance and there was no error connecting to it. Return false (0) if a device has not been opened or there was an error opening a device.";
766804 if( !type_engine_import_mfun( env, func ) ) goto error;
767805
768806 // add num()
@@ -854,7 +892,7 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 85 unmodified lines
854892 std::string doc;
855893
856894 // doc string
857− doc = "Creates a message for receiving HID information.";
895+ doc = "Helper class for receiving HID information; e.g., which key was pressed, joystick position, etc.";
858896
859897 // init base class
860898 if( !type_engine_import_class_begin( env, "HidMsg", "Object",
@@ -872,11 +910,13 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 11 unmodified lines
872910 if( HidMsg_offset_device_num == CK_INVALID_OFFSET ) goto error;
873911
874912 // add member variable
875− HidMsg_offset_type = type_engine_import_mvar( env, "int", "type", FALSE );
913+ doc = "A number representing the message type.";
914+ HidMsg_offset_type = type_engine_import_mvar( env, "int", "type", FALSE, doc.c_str() );
876915 if( HidMsg_offset_type == CK_INVALID_OFFSET ) goto error;
877916
878917 // add member variable
879− HidMsg_offset_which = type_engine_import_mvar( env, "int", "which", FALSE );
918+ doc = "Code (platform dependent) associated with a keyboard key.";
919+ HidMsg_offset_which = type_engine_import_mvar( env, "int", "which", FALSE, doc.c_str() );
880920 if( HidMsg_offset_which == CK_INVALID_OFFSET ) goto error;
881921
882922 // add member variable
@@ -950,27 +990,33 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 67 unmodified lines
950990 if( HidMsg_offset_touchy == CK_INVALID_OFFSET ) goto error;
951991
952992 // add member variable (added 1.3.0.0)
953− HidMsg_offset_touchsize = type_engine_import_mvar( env, "float", "touchSize", FALSE );
993+ doc = "Multi-touch size.";
994+ HidMsg_offset_touchsize = type_engine_import_mvar( env, "float", "touchSize", FALSE, doc.c_str() );
954995 if( HidMsg_offset_touchsize == CK_INVALID_OFFSET ) goto error;
955996
956997 // add member variable
957− HidMsg_offset_axis_position = type_engine_import_mvar( env, "int", "axis_position", FALSE );
998+ doc = "Joystick axis position (int).";
999+ HidMsg_offset_axis_position = type_engine_import_mvar( env, "int", "axis_position", FALSE, doc.c_str() );
9581000 if( HidMsg_offset_axis_position == CK_INVALID_OFFSET ) goto error;
9591001
9601002 // add member variable
961− HidMsg_offset_axis_position2 = type_engine_import_mvar( env, "float", "axisPosition", FALSE );
1003+ doc = "Joystick axis position (float).";
1004+ HidMsg_offset_axis_position2 = type_engine_import_mvar( env, "float", "axisPosition", FALSE, doc.c_str() );
9621005 if( HidMsg_offset_axis_position2 == CK_INVALID_OFFSET ) goto error;
9631006
9641007 // add member variable
965− HidMsg_offset_hat_position = type_engine_import_mvar( env, "int", "hatPosition", FALSE );
1008+ doc = "Joystick hat position.";
1009+ HidMsg_offset_hat_position = type_engine_import_mvar( env, "int", "hatPosition", FALSE, doc.c_str() );
9661010 if( HidMsg_offset_hat_position == CK_INVALID_OFFSET ) goto error;
9671011
9681012 // add member variable
969− HidMsg_offset_ascii = type_engine_import_mvar( env, "int", "ascii", FALSE );
1013+ doc = "ASCII value associated with a keyboard key.";
1014+ HidMsg_offset_ascii = type_engine_import_mvar( env, "int", "ascii", FALSE, doc.c_str() );
9701015 if( HidMsg_offset_ascii == CK_INVALID_OFFSET ) goto error;
9711016
9721017 // add member variable
973− HidMsg_offset_key = type_engine_import_mvar( env, "int", "key", FALSE );
1018+ doc = "Code (USB) for a keyboard key.";
1019+ HidMsg_offset_key = type_engine_import_mvar( env, "int", "key", FALSE, doc.c_str() );
9741020 if( HidMsg_offset_key == CK_INVALID_OFFSET ) goto error;
9751021
9761022 // add member variable
@@ -980,48 +1026,70 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 3 unmodified lines
9801026
9811027 // add is_axis_motion()
9821028 func = make_new_mfun( "int", "is_axis_motion", HidMsg_is_axis_motion ); // deprecated
1029+ func->doc = "(Deprecated; use .isAxisMotion() instead).";
9831030 if( !type_engine_import_mfun( env, func ) ) goto error;
9841031
9851032 // add isAxisMotion()
9861033 func = make_new_mfun( "int", "isAxisMotion", HidMsg_is_axis_motion );
1034+ func->doc = "Return whether this message is an axis-motion event.";
9871035 if( !type_engine_import_mfun( env, func ) ) goto error;
9881036
9891037 // add is_button_down()
9901038 func = make_new_mfun( "int", "is_button_down", HidMsg_is_button_down ); // deprecated
1039+ func->doc = "(Deprecated; use .isButtonDown() instead).";
9911040 if( !type_engine_import_mfun( env, func ) ) goto error;
9921041
9931042 // add isButtonDown()
9941043 func = make_new_mfun( "int", "isButtonDown", HidMsg_is_button_down );
1044+ func->doc = "Return whether this message is a button-down event.";
9951045 if( !type_engine_import_mfun( env, func ) ) goto error;
9961046
9971047 // add is_button_up()
9981048 func = make_new_mfun( "int", "is_button_up", HidMsg_is_button_up ); // deprecated
1049+ func->doc = "(Deprecated; use .isButtonUp() instead).";
9991050 if( !type_engine_import_mfun( env, func ) ) goto error;
10001051
10011052 // add isButtonUp()
10021053 func = make_new_mfun( "int", "isButtonUp", HidMsg_is_button_up );
1054+ func->doc = "Return whether this message is a button-up event.";
10031055 if( !type_engine_import_mfun( env, func ) ) goto error;
10041056
10051057 // add is_mouse_motion()
10061058 func = make_new_mfun( "int", "is_mouse_motion", HidMsg_is_mouse_motion ); // deprecated
1059+ func->doc = "(Deprecated; use .isMouseMotion() instead).";
10071060 if( !type_engine_import_mfun( env, func ) ) goto error;
10081061
10091062 // add isMouseMotion()
10101063 func = make_new_mfun( "int", "isMouseMotion", HidMsg_is_mouse_motion );
1064+ func->doc = "Return whether this message is a mouse-motion event.";
10111065 if( !type_engine_import_mfun( env, func ) ) goto error;
10121066
10131067 // add is_hat_motion()
10141068 func = make_new_mfun( "int", "is_hat_motion", HidMsg_is_hat_motion ); // deprecated
1069+ func->doc = "(Deprecated; use .isHatMotion() instead).";
10151070 if( !type_engine_import_mfun( env, func ) ) goto error;
10161071
10171072 // add isHatMotion()
10181073 func = make_new_mfun( "int", "isHatMotion", HidMsg_is_hat_motion );
1074+ func->doc = "Return whether this message is a hat-motion event.";
10191075 if( !type_engine_import_mfun( env, func ) ) goto error;
10201076
10211077 // add isWheelMotion()
10221078 func = make_new_mfun( "int", "isWheelMotion", HidMsg_is_wheel_motion );
1079+ func->doc = "Return whether this message is a wheel-motion event.";
10231080 if( !type_engine_import_mfun( env, func ) ) goto error;
10241081
1082+ // add examples
1083+ if( !type_engine_import_add_ex( env, "hid/kb.ck" ) ) goto error;
1084+ if( !type_engine_import_add_ex( env, "hid/keyboard-organ.ck" ) ) goto error;
1085+ if( !type_engine_import_add_ex( env, "hid/mouse.ck" ) ) goto error;
1086+ if( !type_engine_import_add_ex( env, "hid/mouse-abs.ck" ) ) goto error;
1087+ if( !type_engine_import_add_ex( env, "hid/mouse-fm.ck" ) ) goto error;
1088+ if( !type_engine_import_add_ex( env, "hid/joy.ck" ) ) goto error;
1089+ if( !type_engine_import_add_ex( env, "hid/joy-fm.ck" ) ) goto error;
1090+ if( !type_engine_import_add_ex( env, "hid/joy-noise.ck" ) ) goto error;
1091+ if( !type_engine_import_add_ex( env, "hid/joy-shake.ck" ) ) goto error;
1092+
10251093 // end the class import
10261094 type_engine_import_class_end( env );
10271095
@@ -1031,7 +1099,7 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 3 unmodified lines
10311099
10321100 // init base class Hid (copy of HidIn + constants)
10331101 if( !type_engine_import_class_begin( env, "Hid", "Event",
1034− env->global(), HidIn_ctor, HidIn_dtor ) )
1102+ env->global(), HidIn_ctor, HidIn_dtor, "Class for interacting with human-interface devices (HIDs) such as keyboards, mice, gamepads, joysticks, etc." ) )
10351103 return FALSE;
10361104
10371105 // add examples
@@ -1049,52 +1117,63 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 11 unmodified lines
10491117 func = make_new_mfun( "int", "open", HidIn_open );
10501118 func->add_arg( "int", "type" );
10511119 func->add_arg( "int", "num" );
1120+ func->doc = "Open a HID device by device number ('num') and type ('type'). See static member variables for possible types.";
10521121 if( !type_engine_import_mfun( env, func ) ) goto error;
10531122
10541123 // add open()
10551124 func = make_new_mfun( "int", "open", HidIn_open_named );
10561125 func->add_arg( "string", "name" );
1126+ func->doc = "Open a HID device by name.";
10571127 if( !type_engine_import_mfun( env, func ) ) goto error;
10581128
10591129 // add openJoystick()
10601130 func = make_new_mfun( "int", "openJoystick", HidIn_open_joystick );
10611131 func->add_arg( "int", "num" );
1132+ func->doc = "Open a joystick/gamepad by device number.";
10621133 if( !type_engine_import_mfun( env, func ) ) goto error;
10631134
10641135 // add openMouse()
10651136 func = make_new_mfun( "int", "openMouse", HidIn_open_mouse );
10661137 func->add_arg( "int", "num" );
1138+ func->doc = "Open a mouse/trackpad by device number.";
10671139 if( !type_engine_import_mfun( env, func ) ) goto error;
10681140
10691141 // add openKeyboard()
10701142 func = make_new_mfun( "int", "openKeyboard", HidIn_open_keyboard );
10711143 func->add_arg( "int", "num" );
1144+ func->doc = "Open a keyboard by device number.";
10721145 if( !type_engine_import_mfun( env, func ) ) goto error;
10731146
10741147 // add openTiltSensor()
10751148 func = make_new_mfun( "int", "openTiltSensor", HidIn_open_tiltsensor );
1149+ func->doc = "Open a tilt-sensor by device number.";
10761150 if( !type_engine_import_mfun( env, func ) ) goto error;
10771151
10781152 // add good()
10791153 func = make_new_mfun( "int", "good", HidIn_good );
1154+ func->doc = "Get whether a device has been successfully opened on this HID instance.";
10801155 if( !type_engine_import_mfun( env, func ) ) goto error;
10811156
10821157 // add num()
10831158 func = make_new_mfun( "int", "num", HidIn_num );
1159+ func->doc = "Get the number of the currently open device; returns -1 if no device is open on this HID instance.";
10841160 if( !type_engine_import_mfun( env, func ) ) goto error;
10851161
10861162 // add name()
10871163 func = make_new_mfun( "string", "name", HidIn_name );
1164+ func->doc = "Get the name of the currently open device; return empty string (\"\") if no device is open on this HID instance.";
10881165 if( !type_engine_import_mfun( env, func ) ) goto error;
10891166
10901167 // add printerr()
10911168 func = make_new_mfun( "void", "printerr", HidIn_printerr );
1092− func->add_arg( "int", "print_or_not" );
1169+ func->add_arg( "int", "toPrintOrNot" );
1170+ func->doc = "Set whether to print errors (default is YES).";
10931171 if( !type_engine_import_mfun( env, func ) ) goto error;
10941172
10951173 // add recv()
10961174 func = make_new_mfun( "int", "recv", HidIn_recv );
10971175 func->add_arg( "HidMsg", "msg" );
1176+ func->doc = "Receive the next available HidMsg.";
10981177 if( !type_engine_import_mfun( env, func ) ) goto error;
10991178
11001179 // add read()
@@ -1102,36 +1181,44 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 1 unmodified line
11021181 func->add_arg( "int", "type" );
11031182 func->add_arg( "int", "which" );
11041183 func->add_arg( "HidMsg", "msg" );
1184+ func->doc = "Read the next HidMsg from device of type 'type' with device id 'which'.";
11051185 if( !type_engine_import_mfun( env, func ) ) goto error;
11061186
11071187 // add send()
11081188 func = make_new_mfun( "int", "send", HidIn_send );
11091189 func->add_arg( "HidMsg", "msg" );
1190+ func->doc = "Send a HidMsg to device; return whether the operation was successful.";
11101191 if( !type_engine_import_mfun( env, func ) ) goto error;
11111192
11121193 // add can_wait()
11131194 func = make_new_mfun( "int", "can_wait", HidIn_can_wait );
1195+ func->doc = "(internal) used by virtual machine for synthronization.";
11141196 if( !type_engine_import_mfun( env, func ) ) goto error;
11151197
11161198 // add readTiltSensor()
11171199 func = make_new_sfun( "int[]", "readTiltSensor", HidIn_read_tilt_sensor );
1200+ func->doc = "Read tilt-sensor and return as an int array.";
11181201 if( !type_engine_import_sfun( env, func ) ) goto error;
11191202
11201203 // add globalTiltPollRate()
11211204 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_ctrl_tiltPollRate );
11221205 func->add_arg( "dur", "d" );
1206+ func->doc = "Set tilt-sensor poll rate.";
11231207 if( !type_engine_import_sfun( env, func ) ) goto error;
11241208
11251209 // add globalTiltPollRate()
11261210 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_cget_tiltPollRate );
1211+ func->doc = "Get tilt-sensor poll rate.";
11271212 if( !type_engine_import_sfun( env, func ) ) goto error;
11281213
11291214 // add startCursorTrack()
11301215 func = make_new_sfun( "int", "startCursorTrack", HidIn_start_cursor_track );
1216+ func->doc = "Start cursor tracking; return whether the request was successful.";
11311217 if( !type_engine_import_sfun( env, func ) ) goto error;
11321218
11331219 // add stopCursorTrack()
11341220 func = make_new_sfun( "int", "stopCursorTrack", HidIn_stop_cursor_track );
1221+ func->doc = "Stop cursor tracking; return whether the request was successful.";
11351222 if( !type_engine_import_sfun( env, func ) ) goto error;
11361223
11371224 // add member variable
@@ -4390,7 +4477,7 @@ t_CKBOOL init_class_serialio( Chuck_Env * env ) · 3252 unmodified lines
43904477
43914478 // add can_wait
43924479 // func = make_new_mfun("int", "can_wait", serialio_canWait);
4393− // func->doc = "";
4480+ // func->doc = "(internal) used by virtual machine for synthronization.";
43944481 // if( !type_engine_import_mfun( env, func ) ) goto error;
43954482
43964483 // add file modes (moved into IO | 1.5.0.0 (ge))
src/core/chuck_lang.cpp+1−1
@@ -412,7 +412,7 @@ t_CKBOOL init_class_event( Chuck_Env * env, Chuck_Type * type ) · 411 unmodified lines
412412
413413 // add can_wait()
414414 func = make_new_mfun( "int", "can_wait", event_can_wait );
415− func->doc = "can the event can be waited on? Currently always returns true.";
415+ func->doc = "can the event can be waited on? Internally used by virtual machine for synthronization.";
416416 if( !type_engine_import_mfun( env, func ) ) goto error;
417417
418418 // add examples
src/core/chuck_type.cpp+17−0
@@ -6559,6 +6559,23 @@ t_CKBOOL type_engine_add_dll2( Chuck_Env * env, Chuck_DLL * dll, · 6558 unmodified lines
65596559 t_CKBOOL type_engine_add_class_from_dl( Chuck_Env * env, Chuck_DL_Class * c )
65606560 {
65616561 Chuck_DL_Func * ctor = NULL, * dtor = c->dtor;
6562+
6563+ // check for duplicates | 1.5.0.0 (ge) added
6564+ if( type_engine_find_type( env, c->name ) )
6565+ {
6566+ EM_log( CK_LOG_SYSTEM,
6567+ "** error importing class '%s'...",
6568+ c->name.c_str() );
6569+ EM_pushlog();
6570+ EM_log( CK_LOG_SYSTEM,
6571+ "type with the same name already exists" );
6572+ EM_poplog();
6573+
6574+ // before ugen begin, can just return
6575+ return FALSE;
6576+ }
6577+
6578+ // check constructor(s)
65626579 if(c->ctors.size() > 0)
65636580 ctor = c->ctors[0]; // TODO: uh, is more than one possible?
65646581
src/core/hidio_sdl.cpp+1−1
@@ -956,7 +956,7 @@ std::string HidIn::name() · 955 unmodified lines
956956 {
957957 if( m_valid && phin )
958958 return phin->name();
959− return " ";
959+ return "";
960960 }
961961
962962 //-----------------------------------------------------------------------------
src/core/ugen_stk.cpp+27−5
@@ -1269,6 +1269,7 @@ CK_DLL_MFUN( MidiFileIn_numTracks ); · 1268 unmodified lines
12691269 CK_DLL_MFUN( MidiFileIn_read );
12701270 CK_DLL_MFUN( MidiFileIn_readTrack );
12711271 CK_DLL_MFUN( MidiFileIn_rewind );
1272+CK_DLL_MFUN( MidiFileIn_rewindTrack );
12721273
12731274
12741275
@@ -5018,8 +5019,9 @@ Modified algorithm code by Gary Scavone, 2005."; · 3743 unmodified lines
50185019 // end the class import
50195020 type_engine_import_class_end( env );
50205021
5021−
5022− if(!type_engine_import_class_begin( env, "MidiFileIn", "Object", env->global(), MidiFileIn_ctor, MidiFileIn_dtor ))
5022+ // MidiFileIn
5023+ if(!type_engine_import_class_begin( env, "MidiFileIn", "Object", env->global(), MidiFileIn_ctor, MidiFileIn_dtor,
5024+ "Class for reading data from a MIDI file." ) )
50235025 return FALSE;
50245026
50255027 MidiFileIn_offset_data = type_engine_import_mvar ( env, "int", "@MidiFileIn_data", FALSE );
@@ -5027,26 +5029,41 @@ Modified algorithm code by Gary Scavone, 2005."; · 1 unmodified line
50275029
50285030 func = make_new_mfun( "int", "open", MidiFileIn_open );
50295031 func->add_arg( "string", "path" );
5032+ func->doc = "Open a MIDI file.";
50305033 if( !type_engine_import_mfun( env, func ) ) goto error;
50315034
50325035 func = make_new_mfun( "void", "close", MidiFileIn_close );
5036+ func->doc = "Close the MIDI file.";
50335037 if( !type_engine_import_mfun( env, func ) ) goto error;
50345038
50355039 func = make_new_mfun( "int", "read", MidiFileIn_read );
50365040 func->add_arg( "MidiMsg", "msg" );
5041+ func->doc = "Read next MIDI Event (on default track 0); return contents in 'msg'.";
50375042 if( !type_engine_import_mfun( env, func ) ) goto error;
50385043
50395044 func = make_new_mfun( "int", "read", MidiFileIn_readTrack );
50405045 func->add_arg( "MidiMsg", "msg" );
50415046 func->add_arg( "int", "track" );
5047+ func->doc = "Read next MIDI Event on track 'track'; return contents in 'msg'.";
50425048 if( !type_engine_import_mfun( env, func ) ) goto error;
50435049
50445050 func = make_new_mfun( "int", "numTracks", MidiFileIn_numTracks );
5051+ func->doc = "Get the number of tracks in the open MIDI file.";
50455052 if( !type_engine_import_mfun( env, func ) ) goto error;
50465053
50475054 func = make_new_mfun( "void", "rewind", MidiFileIn_rewind );
5055+ func->doc = "Rewind MIDI reader to beginning of default track 0.";
50485056 if( !type_engine_import_mfun( env, func ) ) goto error;
50495057
5058+ func = make_new_mfun( "void", "rewind", MidiFileIn_rewindTrack );
5059+ func->add_arg( "int", "track" );
5060+ func->doc = "Rewind MIDI reader to beginning of track 'track'.";
5061+ if( !type_engine_import_mfun( env, func ) ) goto error;
5062+
5063+ // add examples | 1.5.0.0
5064+ type_engine_import_add_ex( env, "examples/midi/midiplay-play.ck" );
5065+ type_engine_import_add_ex( env, "examples/midi/bwv772.mid" );
5066+
50505067 // end the class import
50515068 type_engine_import_class_end( env );
50525069
@@ -28976,11 +28993,16 @@ CK_DLL_MFUN( MidiFileIn_readTrack ) · 23923 unmodified lines
2897628993 CK_DLL_MFUN( MidiFileIn_rewind )
2897728994 {
2897828995 stk::MidiFileIn *f = (stk::MidiFileIn *) OBJ_MEMBER_UINT(SELF, MidiFileIn_offset_data);
28979−
28980− if(f)
28981− f->rewindTrack();
28996+ if(f) f->rewindTrack(); // default track (0)
2898228997 }
2898328998
28999+// 1.5.0.0 (ge) added
29000+CK_DLL_MFUN( MidiFileIn_rewindTrack )
29001+{
29002+ stk::MidiFileIn *f = (stk::MidiFileIn *) OBJ_MEMBER_UINT(SELF, MidiFileIn_offset_data);
29003+ t_CKINT track = GET_NEXT_INT(ARGS);
29004+ if( f ) f->rewindTrack( track );
29005+}
2898429006
2898529007
2898629008
src/core/ulib_opsc.cpp+37−9
@@ -1082,40 +1082,50 @@ static t_CKUINT osc_address_offset_data = 0; · 1081 unmodified lines
10821082 static Chuck_Type * osc_addr_type_ptr = 0;
10831083
10841084
1085−DLL_QUERY opensoundcontrol_query ( Chuck_DL_Query * query ) {
1086−
1085+DLL_QUERY opensoundcontrol_query ( Chuck_DL_Query * query )
1086+{
10871087 /*** OscOut ***/
1088−
10891088 query->begin_class(query, "OscOut", "Object");
1090− query->doc_class(query, "Class for sending OSC messages. ");
1091−
1089+ query->doc_class(query, "Class for sending Open Sound Control (OSC) messages. See examples for usage.");
10921090 oscout_offset_data = query->add_mvar(query, "int", "@OscOut_data", FALSE);
10931091
10941092 query->add_ctor(query, oscout_ctor);
10951093 query->add_dtor(query, oscout_dtor);
10961094
10971095 query->add_mfun(query, oscout_dest, "OscOut", "dest");
1098− query->add_arg(query, "string", "host");
1096+ query->add_arg(query, "string", "hostname");
10991097 query->add_arg(query, "int", "port");
1098+ query->doc_func(query, "Set the destination hostname and port for sending OSC message.");
11001099
11011100 query->add_mfun(query, oscout_start, "OscOut", "start");
1102− query->add_arg(query, "string", "method");
1101+ query->add_arg(query, "string", "address");
1102+ query->doc_func(query, "Start an OSC message with a particular address.");
11031103
11041104 query->add_mfun(query, oscout_startDest, "OscOut", "start");
1105− query->add_arg(query, "string", "method");
1105+ query->add_arg(query, "string", "address");
11061106 query->add_arg(query, "string", "host");
11071107 query->add_arg(query, "int", "port");
1108+ query->doc_func(query, "Start an OSC message with a particular address, aimed at a destination host and port.");
11081109
11091110 query->add_mfun(query, oscout_addInt, "OscOut", "add");
11101111 query->add_arg(query, "int", "i");
1112+ query->doc_func(query, "Add an integer value to an OSC message.");
11111113
11121114 query->add_mfun(query, oscout_addFloat, "OscOut", "add");
11131115 query->add_arg(query, "float", "f");
1116+ query->doc_func(query, "Add a floating-point value to an OSC message.");
11141117
11151118 query->add_mfun(query, oscout_addString, "OscOut", "add");
11161119 query->add_arg(query, "string", "s");
1120+ query->doc_func(query, "Add an string value to an OSC message.");
11171121
11181122 query->add_mfun(query, oscout_send, "OscOut", "send");
1123+ query->doc_func(query, "Send the current OSC message.");
1124+
1125+ // add examples | 1.5.0.0 (ge) added
1126+ query->add_ex( query, "osc/s.ck" );
1127+ query->add_ex( query, "osc/r.ck" );
1128+ query->add_ex( query, "osc/osc-dump.ck" );
11191129
11201130 query->end_class(query);
11211131
@@ -1138,27 +1148,36 @@ DLL_QUERY opensoundcontrol_query ( Chuck_DL_Query * query ) { · 16 unmodified lines
11381148 /*** OscMsg ***/
11391149
11401150 query->begin_class(query, "OscMsg", "Object");
1151+ query->doc_class(query, "Helper class for receiving the contents of an OSC message.");
11411152
11421153 oscmsg_offset_address = query->add_mvar(query, "string", "address", FALSE);
1154+ query->doc_var(query, "The OSC address string (e.g., \"/foo/param\")." );
11431155 oscmsg_offset_typetag = query->add_mvar(query, "string", "typetag", FALSE);
1156+ query->doc_var(query, "The OSC type tag string (e.g., \"iif\" for int, int, float).");
11441157 oscmsg_offset_args = query->add_mvar(query, "OscArg[]", "args", FALSE);
1158+ query->doc_var(query, "Array of OscArgs contained in this message.");
11451159
11461160 query->add_mfun(query, oscmsg_numArgs, "int", "numArgs");
1161+ query->doc_func(query, "Get the number of arguments contained in this OscMsg.");
11471162
11481163 query->add_mfun(query, oscmsg_getInt, "int", "getInt");
11491164 query->add_arg(query, "int", "i");
1165+ query->doc_func(query, "Get argument (at index 'i') as an integer.");
11501166
11511167 query->add_mfun(query, oscmsg_getFloat, "float", "getFloat");
11521168 query->add_arg(query, "int", "i");
1169+ query->doc_func(query, "Get argument (at index 'i') as a float.");
11531170
11541171 query->add_mfun(query, oscmsg_getString, "string", "getString");
11551172 query->add_arg(query, "int", "i");
1173+ query->doc_func(query, "Get argument (at index 'i') as a string.");
11561174
11571175 query->add_ctor(query, oscmsg_ctor);
11581176 query->add_dtor(query, oscmsg_dtor);
11591177
11601178 // add examples | 1.5.0.0 (ge) added
11611179 query->add_ex( query, "osc/r.ck" );
1180+ query->add_ex( query, "osc/s.ck" );
11621181 query->add_ex( query, "osc/osc-dump.ck" );
11631182 query->add_ex( query, "multi-msg/r-multi-msg.ck" );
11641183
@@ -1168,7 +1187,8 @@ DLL_QUERY opensoundcontrol_query ( Chuck_DL_Query * query ) { · 3 unmodified lines
11681187 /*** OscIn ***/
11691188
11701189 // begin class
1171− query->begin_class(query, "OscIn", "Event");
1190+ query->begin_class( query, "OscIn", "Event" );
1191+ query->doc_class( query, "Class for receiving Open Sound Control (OSC) messages. See examples for usage." );
11721192
11731193 // add member reference
11741194 oscin_offset_data = query->add_mvar(query, "int", "@OscOut_data", FALSE);
@@ -1178,24 +1198,31 @@ DLL_QUERY opensoundcontrol_query ( Chuck_DL_Query * query ) { · 3 unmodified lines
11781198
11791199 // get port
11801200 query->add_mfun(query, oscin_getport, "int", "port");
1201+ query->doc_func(query, "Get which port to listen on.");
11811202 // set port
11821203 query->add_mfun(query, oscin_setport, "int", "port");
11831204 query->add_arg(query, "int", "p");
1205+ query->doc_func(query, "Set which port to listen on.");
11841206
11851207 // add address
11861208 query->add_mfun(query, oscin_addAddress, "void", "addAddress");
11871209 query->add_arg(query, "string", "address");
1210+ query->doc_func(query, "Add an OSC address to receive messages from.");
11881211 // remove address
11891212 query->add_mfun(query, oscin_removeAddress, "void", "removeAddress");
11901213 query->add_arg(query, "string", "address");
1214+ query->doc_func(query, "Stop listening on a particular OSC address.");
11911215 // remove all addresses
11921216 query->add_mfun(query, oscin_removeAllAddresses, "void", "removeAllAddresses");
1217+ query->doc_func(query, "Stop listening on all OSC addresses.");
11931218
11941219 // listenAll()
11951220 query->add_mfun(query, oscin_listenAll, "void", "listenAll");
1221+ query->doc_func(query, "Set OscIn to receive messages of any OSC address.");
11961222 // recv
11971223 query->add_mfun(query, oscin_recv, "int", "recv");
11981224 query->add_arg(query, "OscMsg", "msg");
1225+ query->doc_func(query, "Receive the next queued incoming OSC message, returning its contents in `msg`.");
11991226
12001227 // add examples | 1.5.0.0 (ge) added
12011228 query->add_ex( query, "osc/r.ck" );
@@ -1298,6 +1325,7 @@ DLL_QUERY opensoundcontrol_query ( Chuck_DL_Query * query ) { · 96 unmodified lines
12981325 if( !type_engine_import_mfun( env, func ) ) goto error;
12991326
13001327 func = make_new_mfun( "int", "can_wait", osc_address_can_wait );
1328+ func->doc = "(internal) used by virtual machine for synthronization.";
13011329 if( !type_engine_import_mfun( env, func ) ) goto error;
13021330
13031331 type_engine_import_class_end( env );
src/core/ulib_std.cpp+8−1
@@ -334,7 +334,7 @@ DLL_QUERY libstd_query( Chuck_DL_Query * QUERY ) · 333 unmodified lines
334334
335335 #ifndef __DISABLE_KBHIT__
336336 // doc string
337− string doc = "KBHit (terminal only) is a simple mechanism for capturing keyboard input (for a more flexible mechanism, see HID).";
337+ string doc = "KBHit (terminal only) is a simple mechanism for capturing keyboard input; for a more flexible mechanism, see HID. (On Linux, KBHit does not require granting device permissions; it works out of the box.)";
338338
339339 // begin class (KBHit)
340340 if( !type_engine_import_class_begin( env, "KBHit", "Event",
@@ -355,30 +355,37 @@ DLL_QUERY libstd_query( Chuck_DL_Query * QUERY ) · 14 unmodified lines
355355
356356 // add on()
357357 func = make_new_mfun( "void", "on", KBHit_on );
358+ func->doc = "Enable the KBHit.";
358359 if( !type_engine_import_mfun( env, func ) ) goto error;
359360
360361 // add off()
361362 func = make_new_mfun( "void", "off", KBHit_off );
363+ func->doc = "Disable the KBHit.";
362364 if( !type_engine_import_mfun( env, func ) ) goto error;
363365
364366 // add state()
365367 func = make_new_mfun( "void", "state", KBHit_state );
368+ func->doc = "Get whether the KBHit is currently enabled.";
366369 if( !type_engine_import_mfun( env, func ) ) goto error;
367370
368371 // add hit()
369372 func = make_new_mfun( "Event", "hit", KBHit_hit );
373+ func->doc = "Return itself as an Event to wait on; this is largely unnecessary as the KBHit instance can be directly => to 'now'.";
370374 if( !type_engine_import_mfun( env, func ) ) goto error;
371375
372376 // add more()
373377 func = make_new_mfun( "int", "more", KBHit_more );
378+ func->doc = "Return whether there are unprocessed KBHit events (e.g., if a user presses multiple keys at once).";
374379 if( !type_engine_import_mfun( env, func ) ) goto error;
375380
376381 // add getchar()
377382 func = make_new_mfun( "int", "getchar", KBHit_getchar );
383+ func->doc = "Get the ASCII value of the last keyboard press.";
378384 if( !type_engine_import_mfun( env, func ) ) goto error;
379385
380386 // add can_wait()
381387 func = make_new_mfun( "int", "can_wait", KBHit_can_wait );
388+ func->doc = "(internal) used by virtual machine for synthronization.";
382389 if( !type_engine_import_mfun( env, func ) ) goto error;
383390
384391 // end class

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