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
540 {540 {
541 if( !type_engine_add_class_from_dl( query->env(), query->curr_class ) )541 if( !type_engine_add_class_from_dl( query->env(), query->curr_class ) )
542 {542 {
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",
544 query->curr_class->name.c_str());544 query->curr_class->name.c_str());
545 545
546 // pop546 // 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
106 106
107 // add good()107 // add good()
108 func = make_new_mfun( "int", "good", io_dummy );108 func = make_new_mfun( "int", "good", io_dummy );
109 func->doc = "_";109 func->doc = "Returns whether IO is ready for reading.";
110 if( !type_engine_import_mfun( env, func ) ) goto error;110 if( !type_engine_import_mfun( env, func ) ) goto error;
111 111
112 // add close()112 // add close()
113 func = make_new_mfun( "void", "close", io_dummy );113 func = make_new_mfun( "void", "close", io_dummy );
114 func->doc = "Close the currently open IO.";
114 if( !type_engine_import_mfun( env, func ) ) goto error;115 if( !type_engine_import_mfun( env, func ) ) goto error;
115 116
116 // add flush()117 // add flush()
117 func = make_new_mfun( "void", "flush", io_dummy );118 func = make_new_mfun( "void", "flush", io_dummy );
119 func->doc = "Write any buffered output.";
118 if( !type_engine_import_mfun( env, func ) ) goto error;120 if( !type_engine_import_mfun( env, func ) ) goto error;
119 121
120 // add mode(int)122 // add mode(int)
121 func = make_new_mfun( "int", "mode", io_dummy );123 func = make_new_mfun( "int", "mode", io_dummy );
122 func->add_arg( "int", "flag" );124 func->add_arg( "int", "flag" );
125 func->doc = "Set the current IO mode; either IO.MODE_ASYNC or IO.MODE_SYNC.";
123 if( !type_engine_import_mfun( env, func ) ) goto error;126 if( !type_engine_import_mfun( env, func ) ) goto error;
124 127
125 // add mode()128 // add mode()
126 func = make_new_mfun( "int", "mode", io_dummy );129 func = make_new_mfun( "int", "mode", io_dummy );
130 func->doc = "Get the current IO mode; either IO.MODE_ASYNC or IO.MODE_SYNC.";
127 if( !type_engine_import_mfun( env, func ) ) goto error;131 if( !type_engine_import_mfun( env, func ) ) goto error;
128 132
129 // TODO: add this later?133 // TODO: add this later?
@@ -134,11 +138,13 @@ t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type ) · 4 unmodified lines
134 138
135 // add readLine()139 // add readLine()
136 func = make_new_mfun( "string", "readLine", io_dummy );140 func = make_new_mfun( "string", "readLine", io_dummy );
141 func->doc = "Read until an end-of-line character.";
137 if( !type_engine_import_mfun( env, func ) ) goto error;142 if( !type_engine_import_mfun( env, func ) ) goto error;
138 143
139 // add readInt()144 // add readInt()
140 func = make_new_mfun( "int", "readInt", io_dummy );145 func = make_new_mfun( "int", "readInt", io_dummy );
141 func->add_arg( "int", "flags" );146 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).";
142 if( !type_engine_import_mfun( env, func ) ) goto error;148 if( !type_engine_import_mfun( env, func ) ) goto error;
143 149
144 /*150 /*
@@ -164,81 +170,92 @@ t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type ) · 19 unmodified lines
164 170
165 // add eof()171 // add eof()
166 func = make_new_mfun( "int", "eof", io_dummy );172 func = make_new_mfun( "int", "eof", io_dummy );
173 func->doc = "Return whether end-of-file has been reached; the opposite of .more().";
167 if( !type_engine_import_mfun( env, func ) ) goto error;174 if( !type_engine_import_mfun( env, func ) ) goto error;
168 175
169 // add more()176 // add more()
170 func = make_new_mfun( "int", "more", io_dummy );177 func = make_new_mfun( "int", "more", io_dummy );
178 func->doc = "Return whether there is more to read; the opposite of .eof().";
171 if( !type_engine_import_mfun( env, func ) ) goto error;179 if( !type_engine_import_mfun( env, func ) ) goto error;
172 180
173 // add write(string)181 // add write(string)
174 func = make_new_mfun( "void", "write", io_dummy );182 func = make_new_mfun( "void", "write", io_dummy );
175 func->add_arg( "string", "val" );183 func->add_arg( "string", "val" );
184 func->doc = "Write string 'val'.";
176 if( !type_engine_import_mfun( env, func ) ) goto error;185 if( !type_engine_import_mfun( env, func ) ) goto error;
177 186
178 // add write(int)187 // add write(int)
179 func = make_new_mfun( "void", "write", io_dummy );188 func = make_new_mfun( "void", "write", io_dummy );
180 func->add_arg( "int", "val" );189 func->add_arg( "int", "val" );
190 func->doc = "Write integer 'val'.";
181 if( !type_engine_import_mfun( env, func ) ) goto error;191 if( !type_engine_import_mfun( env, func ) ) goto error;
182 192
183 // add write(float)193 // add write(float)
184 func = make_new_mfun( "void", "write", io_dummy );194 func = make_new_mfun( "void", "write", io_dummy );
185 func->add_arg( "float", "val" );195 func->add_arg( "float", "val" );
196 func->doc = "Write floating point number 'val'.";
186 if( !type_engine_import_mfun( env, func ) ) goto error;197 if( !type_engine_import_mfun( env, func ) ) goto error;
187 198
188 // add newline199 // add newline
189 func = make_new_sfun( "string", "newline", io_newline );200 func = make_new_sfun( "string", "newline", io_newline );
201 func->doc = "newline character; same as IO.nl().";
190 if( !type_engine_import_sfun( env, func ) ) goto error;202 if( !type_engine_import_sfun( env, func ) ) goto error;
203 // add nl
191 func = make_new_sfun( "string", "nl", io_newline );204 func = make_new_sfun( "string", "nl", io_newline );
205 func->doc = "newline character; same as IO.newline().";
192 if( !type_engine_import_sfun( env, func ) ) goto error;206 if( !type_engine_import_sfun( env, func ) ) goto error;
193 func = make_new_sfun( "string", "newlineEx2VistaHWNDVisualFoxProA", io_newline );207 // hmm
194 if( !type_engine_import_sfun( env, func ) ) goto error;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
195 initialize_object( g_newline, env->t_string );212 initialize_object( g_newline, env->t_string );
196 g_newline->set( "\n" );213 g_newline->set( "\n" );
197 214
198 // add TYPE_ASCII215 // add TYPE_ASCII
199 if( !type_engine_import_svar( env, "int", "ASCII",216 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;
201 // add TYPE_BINARY218 // add TYPE_BINARY
202 if( !type_engine_import_svar( env, "int", "BINARY",219 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;
204 // add INT8221 // add INT8
205 if( !type_engine_import_svar( env, "int", "INT8",222 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;
207 // add INT16224 // add INT16
208 if( !type_engine_import_svar( env, "int", "INT16",225 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;
210 // add INT32227 // add INT32
211 if( !type_engine_import_svar( env, "int", "INT32",228 if( !type_engine_import_svar( env, "int", "INT32",
212 TRUE, (t_CKUINT)&Chuck_IO::INT32 ) ) goto error;229 TRUE, (t_CKUINT)&Chuck_IO::INT32, "Flag denoting 32-bit integer type." ) ) goto error;
213 // add READ_INT8230// // add READ_INT8
214 if( !type_engine_import_svar( env, "int", "READ_INT8",231// if( !type_engine_import_svar( env, "int", "READ_INT8",
215 TRUE, (t_CKUINT)&Chuck_IO::INT8 ) ) goto error;232// TRUE, (t_CKUINT)&Chuck_IO::INT8, "Flag denoting 8-bit integer type (same as INT8)." ) ) goto error;
216 // add READ_INT16233// // add READ_INT16
217 if( !type_engine_import_svar( env, "int", "READ_INT16",234// if( !type_engine_import_svar( env, "int", "READ_INT16",
218 TRUE, (t_CKUINT)&Chuck_IO::INT16 ) ) goto error;235// TRUE, (t_CKUINT)&Chuck_IO::INT16, "Flag denoting 16-bit integer type (same as INT16)." ) ) goto error;
219 // add READ_INT32236// // add READ_INT32
220 if( !type_engine_import_svar( env, "int", "READ_INT32",237// if( !type_engine_import_svar( env, "int", "READ_INT32",
221 TRUE, (t_CKUINT)&Chuck_IO::INT32 ) ) goto error;238// TRUE, (t_CKUINT)&Chuck_IO::INT32, "Flag denoting 32-bit integer type (same as INT32)." ) ) goto error;
222 // add MODE_SYNC239 // add MODE_SYNC
223 if( !type_engine_import_svar( env, "int", "MODE_SYNC",240 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;
225#ifndef __DISABLE_FILEIO__242#ifndef __DISABLE_FILEIO__
226 // add MODE_ASYNC243 // add MODE_ASYNC
227 if( !type_engine_import_svar( env, "int", "MODE_ASYNC",244 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;
229#endif246#endif
230 // add FLAG_READONLY247 // add FLAG_READONLY
231 if( !type_engine_import_svar( env, "int", "READ",248 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;
233 // add FLAG_WRITEONLY250 // add FLAG_WRITEONLY
234 if( !type_engine_import_svar( env, "int", "WRITE",251 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;
236 // add FLAG_APPEND253 // add FLAG_APPEND
237 if( !type_engine_import_svar( env, "int", "APPEND",254 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;
239 // add FLAG_READ_WRITE256 // add FLAG_READ_WRITE
240 if( !type_engine_import_svar( env, "int", "READ_WRITE",257 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;
242 259
243 // end the class import260 // end the class import
244 type_engine_import_class_end( env );261 type_engine_import_class_end( env );
@@ -273,60 +290,72 @@ t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ) · 28 unmodified lines
273 // TODO: ctor/dtor?290 // TODO: ctor/dtor?
274 // TODO: replace dummy with pure function291 // TODO: replace dummy with pure function
275 if( !type_engine_import_class_begin( env, type, env->global(), fileio_ctor, fileio_dtor,292 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." ) )
277 return FALSE;294 return FALSE;
278 295
279 // add open(string)296 // add open(string)
280 func = make_new_mfun( "int", "open", fileio_open );297 func = make_new_mfun( "int", "open", fileio_open );
281 func->add_arg( "string", "path" );298 func->add_arg( "string", "path" );
299 func->doc = "Open a file by name (and by default in ASCII mode).";
282 if( !type_engine_import_mfun( env, func ) ) goto error;300 if( !type_engine_import_mfun( env, func ) ) goto error;
283 301
284 // add open(string, flags)302 // add open(string, flags)
285 func = make_new_mfun( "int", "open", fileio_openflags );303 func = make_new_mfun( "int", "open", fileio_openflags );
286 func->add_arg( "string", "path" );304 func->add_arg( "string", "path" );
287 func->add_arg( "int", "flags" );305 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).";
288 if( !type_engine_import_mfun( env, func ) ) goto error;307 if( !type_engine_import_mfun( env, func ) ) goto error;
289 308
290 // add good()309 // add good()
291 func = make_new_mfun( "int", "good", fileio_good );310 func = make_new_mfun( "int", "good", fileio_good );
311 func->doc = "Returns whether the file is ready for reading.";
292 if( !type_engine_import_mfun( env, func ) ) goto error;312 if( !type_engine_import_mfun( env, func ) ) goto error;
293 313
294 // add close()314 // add close()
295 func = make_new_mfun( "void", "close", fileio_close );315 func = make_new_mfun( "void", "close", fileio_close );
316 func->doc = "Close (and flush) the currently open file.";
296 if( !type_engine_import_mfun( env, func ) ) goto error;317 if( !type_engine_import_mfun( env, func ) ) goto error;
297 318
298 // add flush()319 // add flush()
299 func = make_new_mfun( "void", "flush", fileio_flush );320 func = make_new_mfun( "void", "flush", fileio_flush );
321 func->doc = "Write any buffered output to file.";
300 if( !type_engine_import_mfun( env, func ) ) goto error;322 if( !type_engine_import_mfun( env, func ) ) goto error;
301 323
302 // add mode()324 // add mode()
303 func = make_new_mfun( "int", "mode", fileio_getmode );325 func = make_new_mfun( "int", "mode", fileio_getmode );
326 func->doc = "Get file IO mode (IO.MODE_SYNC or IO.MODE_ASYNC).";
304 if( !type_engine_import_mfun( env, func ) ) goto error;327 if( !type_engine_import_mfun( env, func ) ) goto error;
305 328
306 // add mode(int)329 // add mode(int)
307 func = make_new_mfun( "int", "mode", fileio_setmode );330 func = make_new_mfun( "int", "mode", fileio_setmode );
308 func->add_arg( "int", "flag" );331 func->add_arg( "int", "flag" );
332 func->doc = "Set file IO mode (IO.MODE_SYNC or IO.MODE_ASYNC).";
309 if( !type_engine_import_mfun( env, func ) ) goto error;333 if( !type_engine_import_mfun( env, func ) ) goto error;
310 334
311 // add size()335 // add size()
312 func = make_new_mfun( "int", "size", fileio_size );336 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.";
313 if( !type_engine_import_mfun( env, func ) ) goto error;338 if( !type_engine_import_mfun( env, func ) ) goto error;
314 339
315 // add seek(int)340 // add seek(int)
316 func = make_new_mfun( "void", "seek", fileio_seek );341 func = make_new_mfun( "void", "seek", fileio_seek );
317 func->add_arg( "int", "pos" );342 func->add_arg( "int", "pos" );
343 func->doc = "Seek to a specified byte offset in file.";
318 if( !type_engine_import_mfun( env, func ) ) goto error;344 if( !type_engine_import_mfun( env, func ) ) goto error;
319 345
320 // add tell()346 // add tell()
321 func = make_new_mfun( "int", "tell", fileio_tell );347 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.";
322 if( !type_engine_import_mfun( env, func ) ) goto error;349 if( !type_engine_import_mfun( env, func ) ) goto error;
323 350
324 // add isDir()351 // add isDir()
325 func = make_new_mfun( "int", "isDir", fileio_isdir );352 func = make_new_mfun( "int", "isDir", fileio_isdir );
353 func->doc = "Return if the open file is a directory.";
326 if( !type_engine_import_mfun( env, func ) ) goto error;354 if( !type_engine_import_mfun( env, func ) ) goto error;
327 355
328 // add dirList()356 // add dirList()
329 func = make_new_mfun( "string[]", "dirList", fileio_dirlist );357 func = make_new_mfun( "string[]", "dirList", fileio_dirlist );
358 func->doc = "Get an array of file names in an open directory.";
330 if( !type_engine_import_mfun( env, func ) ) goto error;359 if( !type_engine_import_mfun( env, func ) ) goto error;
331 360
332 // add read()361 // add read()
@@ -336,6 +365,7 @@ t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ) · 3 unmodified lines
336 365
337 // add readLine()366 // add readLine()
338 func = make_new_mfun( "string", "readLine", fileio_readline );367 func = make_new_mfun( "string", "readLine", fileio_readline );
368 func->doc = "Read and return the next line from file.";
339 if( !type_engine_import_mfun( env, func ) ) goto error;369 if( !type_engine_import_mfun( env, func ) ) goto error;
340 370
341 // add readInt()371 // add readInt()
@@ -345,6 +375,7 @@ t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ) · 3 unmodified lines
345 // add readInt(int)375 // add readInt(int)
346 func = make_new_mfun( "int", "readInt", fileio_readintflags );376 func = make_new_mfun( "int", "readInt", fileio_readintflags );
347 func->add_arg( "int", "flags" );377 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).";
348 if( !type_engine_import_mfun( env, func ) ) goto error;379 if( !type_engine_import_mfun( env, func ) ) goto error;
349 380
350 /*381 /*
@@ -375,31 +406,37 @@ t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ) · 24 unmodified lines
375 406
376 // add eof()407 // add eof()
377 func = make_new_mfun( "int", "eof", fileio_eof );408 func = make_new_mfun( "int", "eof", fileio_eof );
409 func->doc = "Return whether end-of-file has been reached; the opposite of .more().";
378 if( !type_engine_import_mfun( env, func ) ) goto error;410 if( !type_engine_import_mfun( env, func ) ) goto error;
379 411
380 // add more()412 // add more()
381 func = make_new_mfun( "int", "more", fileio_more );413 func = make_new_mfun( "int", "more", fileio_more );
414 func->doc = "Return whether there is more to read; the opposite of .eof().";
382 if( !type_engine_import_mfun( env, func ) ) goto error;415 if( !type_engine_import_mfun( env, func ) ) goto error;
383 416
384 // add write(string)417 // add write(string)
385 func = make_new_mfun( "void", "write", fileio_writestring );418 func = make_new_mfun( "void", "write", fileio_writestring );
386 func->add_arg( "string", "val" );419 func->add_arg( "string", "val" );
420 func->doc = "Write a string to file.";
387 if( !type_engine_import_mfun( env, func ) ) goto error;421 if( !type_engine_import_mfun( env, func ) ) goto error;
388 422
389 // add write(int)423 // add write(int)
390 func = make_new_mfun( "void", "write", fileio_writeint );424 func = make_new_mfun( "void", "write", fileio_writeint );
391 func->add_arg( "int", "val" );425 func->add_arg( "int", "val" );
426 func->doc = "Write an integer to file.";
392 if( !type_engine_import_mfun( env, func ) ) goto error;427 if( !type_engine_import_mfun( env, func ) ) goto error;
393 428
394 // add write(int,flags)429 // add write(int,flags)
395 func = make_new_mfun( "void", "write", fileio_writeintflags );430 func = make_new_mfun( "void", "write", fileio_writeintflags );
396 func->add_arg( "int", "val" );431 func->add_arg( "int", "val" );
397 func->add_arg( "int", "flags" );432 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).";
398 if( !type_engine_import_mfun( env, func ) ) goto error;434 if( !type_engine_import_mfun( env, func ) ) goto error;
399 435
400 // add write(float)436 // add write(float)
401 func = make_new_mfun( "void", "write", fileio_writefloat );437 func = make_new_mfun( "void", "write", fileio_writefloat );
402 func->add_arg( "float", "val" );438 func->add_arg( "float", "val" );
439 func->doc = "Write integer to file.";
403 if( !type_engine_import_mfun( env, func ) ) goto error;440 if( !type_engine_import_mfun( env, func ) ) goto error;
404 441
405 // add examples442 // add examples
@@ -445,7 +482,7 @@ t_CKBOOL init_class_chout( Chuck_Env * env, Chuck_Type * type ) · 39 unmodified lines
445 EM_log( CK_LOG_SEVERE, "class 'chout'" );482 EM_log( CK_LOG_SEVERE, "class 'chout'" );
446 483
447 // TODO: ctor/dtor?484 // 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." ) )
449 return FALSE;486 return FALSE;
450 487
451 // add good()488 // add good()
@@ -538,7 +575,7 @@ t_CKBOOL init_class_cherr( Chuck_Env * env, Chuck_Type * type ) · 86 unmodified lines
538 EM_log( CK_LOG_SEVERE, "class 'cherr'" );575 EM_log( CK_LOG_SEVERE, "class 'cherr'" );
539 576
540 // TODO: ctor/dtor?577 // 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." ) )
542 return FALSE;579 return FALSE;
543 580
544 // add good()581 // add good()
@@ -698,7 +735,7 @@ t_CKBOOL init_class_Midi( Chuck_Env * env ) · 153 unmodified lines
698 735
699 // add good()736 // add good()
700 func = make_new_mfun( "int", "good", MidiIn_good );737 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.";
702 if( !type_engine_import_mfun( env, func ) ) goto error;739 if( !type_engine_import_mfun( env, func ) ) goto error;
703 740
704 // add num()741 // add num()
@@ -725,7 +762,8 @@ t_CKBOOL init_class_Midi( Chuck_Env * env ) · 20 unmodified lines
725 762
726 // add can_wait()763 // add can_wait()
727 func = make_new_mfun( "int", "can_wait", MidiIn_can_wait );764 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.";
729 if( !type_engine_import_mfun( env, func ) ) goto error;767 if( !type_engine_import_mfun( env, func ) ) goto error;
730 768
731 // add member variable769 // add member variable
@@ -762,7 +800,7 @@ t_CKBOOL init_class_Midi( Chuck_Env * env ) · 30 unmodified lines
762 800
763 // add good()801 // add good()
764 func = make_new_mfun( "int", "good", MidiOut_good );802 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.";
766 if( !type_engine_import_mfun( env, func ) ) goto error;804 if( !type_engine_import_mfun( env, func ) ) goto error;
767 805
768 // add num()806 // add num()
@@ -854,7 +892,7 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 85 unmodified lines
854 std::string doc;892 std::string doc;
855 893
856 // doc string894 // 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.";
858 896
859 // init base class897 // init base class
860 if( !type_engine_import_class_begin( env, "HidMsg", "Object",898 if( !type_engine_import_class_begin( env, "HidMsg", "Object",
@@ -872,11 +910,13 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 11 unmodified lines
872 if( HidMsg_offset_device_num == CK_INVALID_OFFSET ) goto error;910 if( HidMsg_offset_device_num == CK_INVALID_OFFSET ) goto error;
873 911
874 // add member variable912 // 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() );
876 if( HidMsg_offset_type == CK_INVALID_OFFSET ) goto error;915 if( HidMsg_offset_type == CK_INVALID_OFFSET ) goto error;
877 916
878 // add member variable917 // 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() );
880 if( HidMsg_offset_which == CK_INVALID_OFFSET ) goto error;920 if( HidMsg_offset_which == CK_INVALID_OFFSET ) goto error;
881 921
882 // add member variable922 // add member variable
@@ -950,27 +990,33 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 67 unmodified lines
950 if( HidMsg_offset_touchy == CK_INVALID_OFFSET ) goto error;990 if( HidMsg_offset_touchy == CK_INVALID_OFFSET ) goto error;
951 991
952 // add member variable (added 1.3.0.0)992 // 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() );
954 if( HidMsg_offset_touchsize == CK_INVALID_OFFSET ) goto error;995 if( HidMsg_offset_touchsize == CK_INVALID_OFFSET ) goto error;
955 996
956 // add member variable997 // 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() );
958 if( HidMsg_offset_axis_position == CK_INVALID_OFFSET ) goto error;1000 if( HidMsg_offset_axis_position == CK_INVALID_OFFSET ) goto error;
959 1001
960 // add member variable1002 // 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() );
962 if( HidMsg_offset_axis_position2 == CK_INVALID_OFFSET ) goto error;1005 if( HidMsg_offset_axis_position2 == CK_INVALID_OFFSET ) goto error;
963 1006
964 // add member variable1007 // 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() );
966 if( HidMsg_offset_hat_position == CK_INVALID_OFFSET ) goto error;1010 if( HidMsg_offset_hat_position == CK_INVALID_OFFSET ) goto error;
967 1011
968 // add member variable1012 // 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() );
970 if( HidMsg_offset_ascii == CK_INVALID_OFFSET ) goto error;1015 if( HidMsg_offset_ascii == CK_INVALID_OFFSET ) goto error;
971 1016
972 // add member variable1017 // 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() );
974 if( HidMsg_offset_key == CK_INVALID_OFFSET ) goto error;1020 if( HidMsg_offset_key == CK_INVALID_OFFSET ) goto error;
975 1021
976 // add member variable1022 // add member variable
@@ -980,48 +1026,70 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 3 unmodified lines
980 1026
981 // add is_axis_motion()1027 // add is_axis_motion()
982 func = make_new_mfun( "int", "is_axis_motion", HidMsg_is_axis_motion ); // deprecated1028 func = make_new_mfun( "int", "is_axis_motion", HidMsg_is_axis_motion ); // deprecated
1029 func->doc = "(Deprecated; use .isAxisMotion() instead).";
983 if( !type_engine_import_mfun( env, func ) ) goto error;1030 if( !type_engine_import_mfun( env, func ) ) goto error;
984 1031
985 // add isAxisMotion()1032 // add isAxisMotion()
986 func = make_new_mfun( "int", "isAxisMotion", HidMsg_is_axis_motion );1033 func = make_new_mfun( "int", "isAxisMotion", HidMsg_is_axis_motion );
1034 func->doc = "Return whether this message is an axis-motion event.";
987 if( !type_engine_import_mfun( env, func ) ) goto error;1035 if( !type_engine_import_mfun( env, func ) ) goto error;
988 1036
989 // add is_button_down()1037 // add is_button_down()
990 func = make_new_mfun( "int", "is_button_down", HidMsg_is_button_down ); // deprecated1038 func = make_new_mfun( "int", "is_button_down", HidMsg_is_button_down ); // deprecated
1039 func->doc = "(Deprecated; use .isButtonDown() instead).";
991 if( !type_engine_import_mfun( env, func ) ) goto error;1040 if( !type_engine_import_mfun( env, func ) ) goto error;
992 1041
993 // add isButtonDown()1042 // add isButtonDown()
994 func = make_new_mfun( "int", "isButtonDown", HidMsg_is_button_down );1043 func = make_new_mfun( "int", "isButtonDown", HidMsg_is_button_down );
1044 func->doc = "Return whether this message is a button-down event.";
995 if( !type_engine_import_mfun( env, func ) ) goto error;1045 if( !type_engine_import_mfun( env, func ) ) goto error;
996 1046
997 // add is_button_up()1047 // add is_button_up()
998 func = make_new_mfun( "int", "is_button_up", HidMsg_is_button_up ); // deprecated1048 func = make_new_mfun( "int", "is_button_up", HidMsg_is_button_up ); // deprecated
1049 func->doc = "(Deprecated; use .isButtonUp() instead).";
999 if( !type_engine_import_mfun( env, func ) ) goto error;1050 if( !type_engine_import_mfun( env, func ) ) goto error;
1000 1051
1001 // add isButtonUp()1052 // add isButtonUp()
1002 func = make_new_mfun( "int", "isButtonUp", HidMsg_is_button_up );1053 func = make_new_mfun( "int", "isButtonUp", HidMsg_is_button_up );
1054 func->doc = "Return whether this message is a button-up event.";
1003 if( !type_engine_import_mfun( env, func ) ) goto error;1055 if( !type_engine_import_mfun( env, func ) ) goto error;
1004 1056
1005 // add is_mouse_motion()1057 // add is_mouse_motion()
1006 func = make_new_mfun( "int", "is_mouse_motion", HidMsg_is_mouse_motion ); // deprecated1058 func = make_new_mfun( "int", "is_mouse_motion", HidMsg_is_mouse_motion ); // deprecated
1059 func->doc = "(Deprecated; use .isMouseMotion() instead).";
1007 if( !type_engine_import_mfun( env, func ) ) goto error;1060 if( !type_engine_import_mfun( env, func ) ) goto error;
1008 1061
1009 // add isMouseMotion()1062 // add isMouseMotion()
1010 func = make_new_mfun( "int", "isMouseMotion", HidMsg_is_mouse_motion );1063 func = make_new_mfun( "int", "isMouseMotion", HidMsg_is_mouse_motion );
1064 func->doc = "Return whether this message is a mouse-motion event.";
1011 if( !type_engine_import_mfun( env, func ) ) goto error;1065 if( !type_engine_import_mfun( env, func ) ) goto error;
1012 1066
1013 // add is_hat_motion()1067 // add is_hat_motion()
1014 func = make_new_mfun( "int", "is_hat_motion", HidMsg_is_hat_motion ); // deprecated1068 func = make_new_mfun( "int", "is_hat_motion", HidMsg_is_hat_motion ); // deprecated
1069 func->doc = "(Deprecated; use .isHatMotion() instead).";
1015 if( !type_engine_import_mfun( env, func ) ) goto error;1070 if( !type_engine_import_mfun( env, func ) ) goto error;
1016 1071
1017 // add isHatMotion()1072 // add isHatMotion()
1018 func = make_new_mfun( "int", "isHatMotion", HidMsg_is_hat_motion );1073 func = make_new_mfun( "int", "isHatMotion", HidMsg_is_hat_motion );
1074 func->doc = "Return whether this message is a hat-motion event.";
1019 if( !type_engine_import_mfun( env, func ) ) goto error;1075 if( !type_engine_import_mfun( env, func ) ) goto error;
1020 1076
1021 // add isWheelMotion()1077 // add isWheelMotion()
1022 func = make_new_mfun( "int", "isWheelMotion", HidMsg_is_wheel_motion );1078 func = make_new_mfun( "int", "isWheelMotion", HidMsg_is_wheel_motion );
1079 func->doc = "Return whether this message is a wheel-motion event.";
1023 if( !type_engine_import_mfun( env, func ) ) goto error;1080 if( !type_engine_import_mfun( env, func ) ) goto error;
1024 1081
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
1025 // end the class import1093 // end the class import
1026 type_engine_import_class_end( env );1094 type_engine_import_class_end( env );
1027 1095
@@ -1031,7 +1099,7 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 3 unmodified lines
1031 1099
1032 // init base class Hid (copy of HidIn + constants)1100 // init base class Hid (copy of HidIn + constants)
1033 if( !type_engine_import_class_begin( env, "Hid", "Event",1101 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." ) )
1035 return FALSE;1103 return FALSE;
1036 1104
1037 // add examples1105 // add examples
@@ -1049,52 +1117,63 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 11 unmodified lines
1049 func = make_new_mfun( "int", "open", HidIn_open );1117 func = make_new_mfun( "int", "open", HidIn_open );
1050 func->add_arg( "int", "type" );1118 func->add_arg( "int", "type" );
1051 func->add_arg( "int", "num" );1119 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.";
1052 if( !type_engine_import_mfun( env, func ) ) goto error;1121 if( !type_engine_import_mfun( env, func ) ) goto error;
1053 1122
1054 // add open()1123 // add open()
1055 func = make_new_mfun( "int", "open", HidIn_open_named );1124 func = make_new_mfun( "int", "open", HidIn_open_named );
1056 func->add_arg( "string", "name" );1125 func->add_arg( "string", "name" );
1126 func->doc = "Open a HID device by name.";
1057 if( !type_engine_import_mfun( env, func ) ) goto error;1127 if( !type_engine_import_mfun( env, func ) ) goto error;
1058 1128
1059 // add openJoystick()1129 // add openJoystick()
1060 func = make_new_mfun( "int", "openJoystick", HidIn_open_joystick );1130 func = make_new_mfun( "int", "openJoystick", HidIn_open_joystick );
1061 func->add_arg( "int", "num" );1131 func->add_arg( "int", "num" );
1132 func->doc = "Open a joystick/gamepad by device number.";
1062 if( !type_engine_import_mfun( env, func ) ) goto error;1133 if( !type_engine_import_mfun( env, func ) ) goto error;
1063 1134
1064 // add openMouse()1135 // add openMouse()
1065 func = make_new_mfun( "int", "openMouse", HidIn_open_mouse );1136 func = make_new_mfun( "int", "openMouse", HidIn_open_mouse );
1066 func->add_arg( "int", "num" );1137 func->add_arg( "int", "num" );
1138 func->doc = "Open a mouse/trackpad by device number.";
1067 if( !type_engine_import_mfun( env, func ) ) goto error;1139 if( !type_engine_import_mfun( env, func ) ) goto error;
1068 1140
1069 // add openKeyboard()1141 // add openKeyboard()
1070 func = make_new_mfun( "int", "openKeyboard", HidIn_open_keyboard );1142 func = make_new_mfun( "int", "openKeyboard", HidIn_open_keyboard );
1071 func->add_arg( "int", "num" );1143 func->add_arg( "int", "num" );
1144 func->doc = "Open a keyboard by device number.";
1072 if( !type_engine_import_mfun( env, func ) ) goto error;1145 if( !type_engine_import_mfun( env, func ) ) goto error;
1073 1146
1074 // add openTiltSensor()1147 // add openTiltSensor()
1075 func = make_new_mfun( "int", "openTiltSensor", HidIn_open_tiltsensor );1148 func = make_new_mfun( "int", "openTiltSensor", HidIn_open_tiltsensor );
1149 func->doc = "Open a tilt-sensor by device number.";
1076 if( !type_engine_import_mfun( env, func ) ) goto error;1150 if( !type_engine_import_mfun( env, func ) ) goto error;
1077 1151
1078 // add good()1152 // add good()
1079 func = make_new_mfun( "int", "good", HidIn_good );1153 func = make_new_mfun( "int", "good", HidIn_good );
1154 func->doc = "Get whether a device has been successfully opened on this HID instance.";
1080 if( !type_engine_import_mfun( env, func ) ) goto error;1155 if( !type_engine_import_mfun( env, func ) ) goto error;
1081 1156
1082 // add num()1157 // add num()
1083 func = make_new_mfun( "int", "num", HidIn_num );1158 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.";
1084 if( !type_engine_import_mfun( env, func ) ) goto error;1160 if( !type_engine_import_mfun( env, func ) ) goto error;
1085 1161
1086 // add name()1162 // add name()
1087 func = make_new_mfun( "string", "name", HidIn_name );1163 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.";
1088 if( !type_engine_import_mfun( env, func ) ) goto error;1165 if( !type_engine_import_mfun( env, func ) ) goto error;
1089 1166
1090 // add printerr()1167 // add printerr()
1091 func = make_new_mfun( "void", "printerr", HidIn_printerr );1168 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).";
1093 if( !type_engine_import_mfun( env, func ) ) goto error;1171 if( !type_engine_import_mfun( env, func ) ) goto error;
1094 1172
1095 // add recv()1173 // add recv()
1096 func = make_new_mfun( "int", "recv", HidIn_recv );1174 func = make_new_mfun( "int", "recv", HidIn_recv );
1097 func->add_arg( "HidMsg", "msg" );1175 func->add_arg( "HidMsg", "msg" );
1176 func->doc = "Receive the next available HidMsg.";
1098 if( !type_engine_import_mfun( env, func ) ) goto error;1177 if( !type_engine_import_mfun( env, func ) ) goto error;
1099 1178
1100 // add read()1179 // add read()
@@ -1102,36 +1181,44 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) · 1 unmodified line
1102 func->add_arg( "int", "type" );1181 func->add_arg( "int", "type" );
1103 func->add_arg( "int", "which" );1182 func->add_arg( "int", "which" );
1104 func->add_arg( "HidMsg", "msg" );1183 func->add_arg( "HidMsg", "msg" );
1184 func->doc = "Read the next HidMsg from device of type 'type' with device id 'which'.";
1105 if( !type_engine_import_mfun( env, func ) ) goto error;1185 if( !type_engine_import_mfun( env, func ) ) goto error;
1106 1186
1107 // add send()1187 // add send()
1108 func = make_new_mfun( "int", "send", HidIn_send );1188 func = make_new_mfun( "int", "send", HidIn_send );
1109 func->add_arg( "HidMsg", "msg" );1189 func->add_arg( "HidMsg", "msg" );
1190 func->doc = "Send a HidMsg to device; return whether the operation was successful.";
1110 if( !type_engine_import_mfun( env, func ) ) goto error;1191 if( !type_engine_import_mfun( env, func ) ) goto error;
1111 1192
1112 // add can_wait()1193 // add can_wait()
1113 func = make_new_mfun( "int", "can_wait", HidIn_can_wait );1194 func = make_new_mfun( "int", "can_wait", HidIn_can_wait );
1195 func->doc = "(internal) used by virtual machine for synthronization.";
1114 if( !type_engine_import_mfun( env, func ) ) goto error;1196 if( !type_engine_import_mfun( env, func ) ) goto error;
1115 1197
1116 // add readTiltSensor()1198 // add readTiltSensor()
1117 func = make_new_sfun( "int[]", "readTiltSensor", HidIn_read_tilt_sensor );1199 func = make_new_sfun( "int[]", "readTiltSensor", HidIn_read_tilt_sensor );
1200 func->doc = "Read tilt-sensor and return as an int array.";
1118 if( !type_engine_import_sfun( env, func ) ) goto error;1201 if( !type_engine_import_sfun( env, func ) ) goto error;
1119 1202
1120 // add globalTiltPollRate()1203 // add globalTiltPollRate()
1121 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_ctrl_tiltPollRate );1204 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_ctrl_tiltPollRate );
1122 func->add_arg( "dur", "d" );1205 func->add_arg( "dur", "d" );
1206 func->doc = "Set tilt-sensor poll rate.";
1123 if( !type_engine_import_sfun( env, func ) ) goto error;1207 if( !type_engine_import_sfun( env, func ) ) goto error;
1124 1208
1125 // add globalTiltPollRate()1209 // add globalTiltPollRate()
1126 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_cget_tiltPollRate );1210 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_cget_tiltPollRate );
1211 func->doc = "Get tilt-sensor poll rate.";
1127 if( !type_engine_import_sfun( env, func ) ) goto error;1212 if( !type_engine_import_sfun( env, func ) ) goto error;
1128 1213
1129 // add startCursorTrack()1214 // add startCursorTrack()
1130 func = make_new_sfun( "int", "startCursorTrack", HidIn_start_cursor_track );1215 func = make_new_sfun( "int", "startCursorTrack", HidIn_start_cursor_track );
1216 func->doc = "Start cursor tracking; return whether the request was successful.";
1131 if( !type_engine_import_sfun( env, func ) ) goto error;1217 if( !type_engine_import_sfun( env, func ) ) goto error;
1132 1218
1133 // add stopCursorTrack()1219 // add stopCursorTrack()
1134 func = make_new_sfun( "int", "stopCursorTrack", HidIn_stop_cursor_track );1220 func = make_new_sfun( "int", "stopCursorTrack", HidIn_stop_cursor_track );
1221 func->doc = "Stop cursor tracking; return whether the request was successful.";
1135 if( !type_engine_import_sfun( env, func ) ) goto error;1222 if( !type_engine_import_sfun( env, func ) ) goto error;
1136 1223
1137 // add member variable1224 // add member variable
@@ -4390,7 +4477,7 @@ t_CKBOOL init_class_serialio( Chuck_Env * env ) · 3252 unmodified lines
4390 4477
4391 // add can_wait4478 // add can_wait
4392 // func = make_new_mfun("int", "can_wait", serialio_canWait);4479 // func = make_new_mfun("int", "can_wait", serialio_canWait);
4393 // func->doc = "";4480 // func->doc = "(internal) used by virtual machine for synthronization.";
4394 // if( !type_engine_import_mfun( env, func ) ) goto error;4481 // if( !type_engine_import_mfun( env, func ) ) goto error;
4395 4482
4396 // add file modes (moved into IO | 1.5.0.0 (ge))4483 // 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
412 412
413 // add can_wait()413 // add can_wait()
414 func = make_new_mfun( "int", "can_wait", event_can_wait );414 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.";
416 if( !type_engine_import_mfun( env, func ) ) goto error;416 if( !type_engine_import_mfun( env, func ) ) goto error;
417 417
418 // add examples418 // 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
6559t_CKBOOL type_engine_add_class_from_dl( Chuck_Env * env, Chuck_DL_Class * c )6559t_CKBOOL type_engine_add_class_from_dl( Chuck_Env * env, Chuck_DL_Class * c )
6560{6560{
6561 Chuck_DL_Func * ctor = NULL, * dtor = c->dtor;6561 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)
6562 if(c->ctors.size() > 0)6579 if(c->ctors.size() > 0)
6563 ctor = c->ctors[0]; // TODO: uh, is more than one possible?6580 ctor = c->ctors[0]; // TODO: uh, is more than one possible?
6564 6581
src/core/hidio_sdl.cpp+1−1
@@ -956,7 +956,7 @@ std::string HidIn::name() · 955 unmodified lines
956{956{
957 if( m_valid && phin )957 if( m_valid && phin )
958 return phin->name();958 return phin->name();
959 return " ";959 return "";
960}960}
961 961
962//-----------------------------------------------------------------------------962//-----------------------------------------------------------------------------
src/core/ugen_stk.cpp+27−5
@@ -1269,6 +1269,7 @@ CK_DLL_MFUN( MidiFileIn_numTracks ); · 1268 unmodified lines
1269CK_DLL_MFUN( MidiFileIn_read );1269CK_DLL_MFUN( MidiFileIn_read );
1270CK_DLL_MFUN( MidiFileIn_readTrack );1270CK_DLL_MFUN( MidiFileIn_readTrack );
1271CK_DLL_MFUN( MidiFileIn_rewind );1271CK_DLL_MFUN( MidiFileIn_rewind );
1272CK_DLL_MFUN( MidiFileIn_rewindTrack );
1272 1273
1273 1274
1274 1275
@@ -5018,8 +5019,9 @@ Modified algorithm code by Gary Scavone, 2005."; · 3743 unmodified lines
5018 // end the class import5019 // end the class import
5019 type_engine_import_class_end( env );5020 type_engine_import_class_end( env );
5020 5021
5021 5022 // MidiFileIn
5022 if(!type_engine_import_class_begin( env, "MidiFileIn", "Object", env->global(), MidiFileIn_ctor, MidiFileIn_dtor ))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." ) )
5023 return FALSE;5025 return FALSE;
5024 5026
5025 MidiFileIn_offset_data = type_engine_import_mvar ( env, "int", "@MidiFileIn_data", FALSE );5027 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
5027 5029
5028 func = make_new_mfun( "int", "open", MidiFileIn_open );5030 func = make_new_mfun( "int", "open", MidiFileIn_open );
5029 func->add_arg( "string", "path" );5031 func->add_arg( "string", "path" );
5032 func->doc = "Open a MIDI file.";
5030 if( !type_engine_import_mfun( env, func ) ) goto error;5033 if( !type_engine_import_mfun( env, func ) ) goto error;
5031 5034
5032 func = make_new_mfun( "void", "close", MidiFileIn_close );5035 func = make_new_mfun( "void", "close", MidiFileIn_close );
5036 func->doc = "Close the MIDI file.";
5033 if( !type_engine_import_mfun( env, func ) ) goto error;5037 if( !type_engine_import_mfun( env, func ) ) goto error;
5034 5038
5035 func = make_new_mfun( "int", "read", MidiFileIn_read );5039 func = make_new_mfun( "int", "read", MidiFileIn_read );
5036 func->add_arg( "MidiMsg", "msg" );5040 func->add_arg( "MidiMsg", "msg" );
5041 func->doc = "Read next MIDI Event (on default track 0); return contents in 'msg'.";
5037 if( !type_engine_import_mfun( env, func ) ) goto error;5042 if( !type_engine_import_mfun( env, func ) ) goto error;
5038 5043
5039 func = make_new_mfun( "int", "read", MidiFileIn_readTrack );5044 func = make_new_mfun( "int", "read", MidiFileIn_readTrack );
5040 func->add_arg( "MidiMsg", "msg" );5045 func->add_arg( "MidiMsg", "msg" );
5041 func->add_arg( "int", "track" );5046 func->add_arg( "int", "track" );
5047 func->doc = "Read next MIDI Event on track 'track'; return contents in 'msg'.";
5042 if( !type_engine_import_mfun( env, func ) ) goto error;5048 if( !type_engine_import_mfun( env, func ) ) goto error;
5043 5049
5044 func = make_new_mfun( "int", "numTracks", MidiFileIn_numTracks );5050 func = make_new_mfun( "int", "numTracks", MidiFileIn_numTracks );
5051 func->doc = "Get the number of tracks in the open MIDI file.";
5045 if( !type_engine_import_mfun( env, func ) ) goto error;5052 if( !type_engine_import_mfun( env, func ) ) goto error;
5046 5053
5047 func = make_new_mfun( "void", "rewind", MidiFileIn_rewind );5054 func = make_new_mfun( "void", "rewind", MidiFileIn_rewind );
5055 func->doc = "Rewind MIDI reader to beginning of default track 0.";
5048 if( !type_engine_import_mfun( env, func ) ) goto error;5056 if( !type_engine_import_mfun( env, func ) ) goto error;
5049 5057
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
5050 // end the class import5067 // end the class import
5051 type_engine_import_class_end( env );5068 type_engine_import_class_end( env );
5052 5069
@@ -28976,11 +28993,16 @@ CK_DLL_MFUN( MidiFileIn_readTrack ) · 23923 unmodified lines
28976CK_DLL_MFUN( MidiFileIn_rewind )28993CK_DLL_MFUN( MidiFileIn_rewind )
28977{28994{
28978 stk::MidiFileIn *f = (stk::MidiFileIn *) OBJ_MEMBER_UINT(SELF, MidiFileIn_offset_data);28995 stk::MidiFileIn *f = (stk::MidiFileIn *) OBJ_MEMBER_UINT(SELF, MidiFileIn_offset_data);
28979 28996 if(f) f->rewindTrack(); // default track (0)
28980 if(f)
28981 f->rewindTrack();
28982}28997}
28983 28998
28999// 1.5.0.0 (ge) added
29000CK_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}
28984 29006
28985 29007
28986 29008
src/core/ulib_opsc.cpp+37−9
@@ -1082,40 +1082,50 @@ static t_CKUINT osc_address_offset_data = 0; · 1081 unmodified lines
1082static Chuck_Type * osc_addr_type_ptr = 0;1082static Chuck_Type * osc_addr_type_ptr = 0;
1083 1083
1084 1084
1085DLL_QUERY opensoundcontrol_query ( Chuck_DL_Query * query ) {1085DLL_QUERY opensoundcontrol_query ( Chuck_DL_Query * query )
1086 1086{
1087 /*** OscOut ***/1087 /*** OscOut ***/
1088
1089 query->begin_class(query, "OscOut", "Object");1088 query->begin_class(query, "OscOut", "Object");
1090 query->doc_class(query, "Class for sending OSC messages. ");1089 query->doc_class(query, "Class for sending Open Sound Control (OSC) messages. See examples for usage.");
1091
1092 oscout_offset_data = query->add_mvar(query, "int", "@OscOut_data", FALSE);1090 oscout_offset_data = query->add_mvar(query, "int", "@OscOut_data", FALSE);
1093 1091
1094 query->add_ctor(query, oscout_ctor);1092 query->add_ctor(query, oscout_ctor);
1095 query->add_dtor(query, oscout_dtor);1093 query->add_dtor(query, oscout_dtor);
1096 1094
1097 query->add_mfun(query, oscout_dest, "OscOut", "dest");1095 query->add_mfun(query, oscout_dest, "OscOut", "dest");
1098 query->add_arg(query, "string", "host");1096 query->add_arg(query, "string", "hostname");
1099 query->add_arg(query, "int", "port");1097 query->add_arg(query, "int", "port");
1098 query->doc_func(query, "Set the destination hostname and port for sending OSC message.");
1100 1099
1101 query->add_mfun(query, oscout_start, "OscOut", "start");1100 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.");
1103 1103
1104 query->add_mfun(query, oscout_startDest, "OscOut", "start");1104 query->add_mfun(query, oscout_startDest, "OscOut", "start");
1105 query->add_arg(query, "string", "method");1105 query->add_arg(query, "string", "address");
1106 query->add_arg(query, "string", "host");1106 query->add_arg(query, "string", "host");
1107 query->add_arg(query, "int", "port");1107 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.");
1108 1109
1109 query->add_mfun(query, oscout_addInt, "OscOut", "add");1110 query->add_mfun(query, oscout_addInt, "OscOut", "add");
1110 query->add_arg(query, "int", "i");1111 query->add_arg(query, "int", "i");
1112 query->doc_func(query, "Add an integer value to an OSC message.");
1111 1113
1112 query->add_mfun(query, oscout_addFloat, "OscOut", "add");1114 query->add_mfun(query, oscout_addFloat, "OscOut", "add");
1113 query->add_arg(query, "float", "f");1115 query->add_arg(query, "float", "f");
1116 query->doc_func(query, "Add a floating-point value to an OSC message.");
1114 1117
1115 query->add_mfun(query, oscout_addString, "OscOut", "add");1118 query->add_mfun(query, oscout_addString, "OscOut", "add");
1116 query->add_arg(query, "string", "s");1119 query->add_arg(query, "string", "s");
1120 query->doc_func(query, "Add an string value to an OSC message.");
1117 1121
1118 query->add_mfun(query, oscout_send, "OscOut", "send");1122 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" );
1119 1129
1120 query->end_class(query);1130 query->end_class(query);
1121 1131
@@ -1138,27 +1148,36 @@ DLL_QUERY opensoundcontrol_query ( Chuck_DL_Query * query ) { · 16 unmodified lines
1138 /*** OscMsg ***/1148 /*** OscMsg ***/
1139 1149
1140 query->begin_class(query, "OscMsg", "Object");1150 query->begin_class(query, "OscMsg", "Object");
1151 query->doc_class(query, "Helper class for receiving the contents of an OSC message.");
1141 1152
1142 oscmsg_offset_address = query->add_mvar(query, "string", "address", FALSE);1153 oscmsg_offset_address = query->add_mvar(query, "string", "address", FALSE);
1154 query->doc_var(query, "The OSC address string (e.g., \"/foo/param\")." );
1143 oscmsg_offset_typetag = query->add_mvar(query, "string", "typetag", FALSE);1155 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).");
1144 oscmsg_offset_args = query->add_mvar(query, "OscArg[]", "args", FALSE);1157 oscmsg_offset_args = query->add_mvar(query, "OscArg[]", "args", FALSE);
1158 query->doc_var(query, "Array of OscArgs contained in this message.");
1145 1159
1146 query->add_mfun(query, oscmsg_numArgs, "int", "numArgs");1160 query->add_mfun(query, oscmsg_numArgs, "int", "numArgs");
1161 query->doc_func(query, "Get the number of arguments contained in this OscMsg.");
1147 1162
1148 query->add_mfun(query, oscmsg_getInt, "int", "getInt");1163 query->add_mfun(query, oscmsg_getInt, "int", "getInt");
1149 query->add_arg(query, "int", "i");1164 query->add_arg(query, "int", "i");
1165 query->doc_func(query, "Get argument (at index 'i') as an integer.");
1150 1166
1151 query->add_mfun(query, oscmsg_getFloat, "float", "getFloat");1167 query->add_mfun(query, oscmsg_getFloat, "float", "getFloat");
1152 query->add_arg(query, "int", "i");1168 query->add_arg(query, "int", "i");
1169 query->doc_func(query, "Get argument (at index 'i') as a float.");
1153 1170
1154 query->add_mfun(query, oscmsg_getString, "string", "getString");1171 query->add_mfun(query, oscmsg_getString, "string", "getString");
1155 query->add_arg(query, "int", "i");1172 query->add_arg(query, "int", "i");
1173 query->doc_func(query, "Get argument (at index 'i') as a string.");
1156 1174
1157 query->add_ctor(query, oscmsg_ctor);1175 query->add_ctor(query, oscmsg_ctor);
1158 query->add_dtor(query, oscmsg_dtor);1176 query->add_dtor(query, oscmsg_dtor);
1159 1177
1160 // add examples | 1.5.0.0 (ge) added1178 // add examples | 1.5.0.0 (ge) added
1161 query->add_ex( query, "osc/r.ck" );1179 query->add_ex( query, "osc/r.ck" );
1180 query->add_ex( query, "osc/s.ck" );
1162 query->add_ex( query, "osc/osc-dump.ck" );1181 query->add_ex( query, "osc/osc-dump.ck" );
1163 query->add_ex( query, "multi-msg/r-multi-msg.ck" );1182 query->add_ex( query, "multi-msg/r-multi-msg.ck" );
1164 1183
@@ -1168,7 +1187,8 @@ DLL_QUERY opensoundcontrol_query ( Chuck_DL_Query * query ) { · 3 unmodified lines
1168 /*** OscIn ***/1187 /*** OscIn ***/
1169 1188
1170 // begin class1189 // 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." );
1172 1192
1173 // add member reference1193 // add member reference
1174 oscin_offset_data = query->add_mvar(query, "int", "@OscOut_data", FALSE);1194 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
1178 1198
1179 // get port1199 // get port
1180 query->add_mfun(query, oscin_getport, "int", "port");1200 query->add_mfun(query, oscin_getport, "int", "port");
1201 query->doc_func(query, "Get which port to listen on.");
1181 // set port1202 // set port
1182 query->add_mfun(query, oscin_setport, "int", "port");1203 query->add_mfun(query, oscin_setport, "int", "port");
1183 query->add_arg(query, "int", "p");1204 query->add_arg(query, "int", "p");
1205 query->doc_func(query, "Set which port to listen on.");
1184 1206
1185 // add address1207 // add address
1186 query->add_mfun(query, oscin_addAddress, "void", "addAddress");1208 query->add_mfun(query, oscin_addAddress, "void", "addAddress");
1187 query->add_arg(query, "string", "address");1209 query->add_arg(query, "string", "address");
1210 query->doc_func(query, "Add an OSC address to receive messages from.");
1188 // remove address1211 // remove address
1189 query->add_mfun(query, oscin_removeAddress, "void", "removeAddress");1212 query->add_mfun(query, oscin_removeAddress, "void", "removeAddress");
1190 query->add_arg(query, "string", "address");1213 query->add_arg(query, "string", "address");
1214 query->doc_func(query, "Stop listening on a particular OSC address.");
1191 // remove all addresses1215 // remove all addresses
1192 query->add_mfun(query, oscin_removeAllAddresses, "void", "removeAllAddresses");1216 query->add_mfun(query, oscin_removeAllAddresses, "void", "removeAllAddresses");
1217 query->doc_func(query, "Stop listening on all OSC addresses.");
1193 1218
1194 // listenAll()1219 // listenAll()
1195 query->add_mfun(query, oscin_listenAll, "void", "listenAll");1220 query->add_mfun(query, oscin_listenAll, "void", "listenAll");
1221 query->doc_func(query, "Set OscIn to receive messages of any OSC address.");
1196 // recv1222 // recv
1197 query->add_mfun(query, oscin_recv, "int", "recv");1223 query->add_mfun(query, oscin_recv, "int", "recv");
1198 query->add_arg(query, "OscMsg", "msg");1224 query->add_arg(query, "OscMsg", "msg");
1225 query->doc_func(query, "Receive the next queued incoming OSC message, returning its contents in `msg`.");
1199 1226
1200 // add examples | 1.5.0.0 (ge) added1227 // add examples | 1.5.0.0 (ge) added
1201 query->add_ex( query, "osc/r.ck" );1228 query->add_ex( query, "osc/r.ck" );
@@ -1298,6 +1325,7 @@ DLL_QUERY opensoundcontrol_query ( Chuck_DL_Query * query ) { · 96 unmodified lines
1298 if( !type_engine_import_mfun( env, func ) ) goto error;1325 if( !type_engine_import_mfun( env, func ) ) goto error;
1299 1326
1300 func = make_new_mfun( "int", "can_wait", osc_address_can_wait );1327 func = make_new_mfun( "int", "can_wait", osc_address_can_wait );
1328 func->doc = "(internal) used by virtual machine for synthronization.";
1301 if( !type_engine_import_mfun( env, func ) ) goto error;1329 if( !type_engine_import_mfun( env, func ) ) goto error;
1302 1330
1303 type_engine_import_class_end( env );1331 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
334 334
335#ifndef __DISABLE_KBHIT__335#ifndef __DISABLE_KBHIT__
336 // doc string336 // 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.)";
338 338
339 // begin class (KBHit)339 // begin class (KBHit)
340 if( !type_engine_import_class_begin( env, "KBHit", "Event",340 if( !type_engine_import_class_begin( env, "KBHit", "Event",
@@ -355,30 +355,37 @@ DLL_QUERY libstd_query( Chuck_DL_Query * QUERY ) · 14 unmodified lines
355 355
356 // add on()356 // add on()
357 func = make_new_mfun( "void", "on", KBHit_on );357 func = make_new_mfun( "void", "on", KBHit_on );
358 func->doc = "Enable the KBHit.";
358 if( !type_engine_import_mfun( env, func ) ) goto error;359 if( !type_engine_import_mfun( env, func ) ) goto error;
359 360
360 // add off()361 // add off()
361 func = make_new_mfun( "void", "off", KBHit_off );362 func = make_new_mfun( "void", "off", KBHit_off );
363 func->doc = "Disable the KBHit.";
362 if( !type_engine_import_mfun( env, func ) ) goto error;364 if( !type_engine_import_mfun( env, func ) ) goto error;
363 365
364 // add state()366 // add state()
365 func = make_new_mfun( "void", "state", KBHit_state );367 func = make_new_mfun( "void", "state", KBHit_state );
368 func->doc = "Get whether the KBHit is currently enabled.";
366 if( !type_engine_import_mfun( env, func ) ) goto error;369 if( !type_engine_import_mfun( env, func ) ) goto error;
367 370
368 // add hit()371 // add hit()
369 func = make_new_mfun( "Event", "hit", KBHit_hit );372 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'.";
370 if( !type_engine_import_mfun( env, func ) ) goto error;374 if( !type_engine_import_mfun( env, func ) ) goto error;
371 375
372 // add more()376 // add more()
373 func = make_new_mfun( "int", "more", KBHit_more );377 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).";
374 if( !type_engine_import_mfun( env, func ) ) goto error;379 if( !type_engine_import_mfun( env, func ) ) goto error;
375 380
376 // add getchar()381 // add getchar()
377 func = make_new_mfun( "int", "getchar", KBHit_getchar );382 func = make_new_mfun( "int", "getchar", KBHit_getchar );
383 func->doc = "Get the ASCII value of the last keyboard press.";
378 if( !type_engine_import_mfun( env, func ) ) goto error;384 if( !type_engine_import_mfun( env, func ) ) goto error;
379 385
380 // add can_wait()386 // add can_wait()
381 func = make_new_mfun( "int", "can_wait", KBHit_can_wait );387 func = make_new_mfun( "int", "can_wait", KBHit_can_wait );
388 func->doc = "(internal) used by virtual machine for synthronization.";
382 if( !type_engine_import_mfun( env, func ) ) goto error;389 if( !type_engine_import_mfun( env, func ) ) goto error;
383 390
384 // end class391 // 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