Showing the changes to src/core/ulib_std.cpp (1 of 9 files). Show all
Unified · Split
| @@ -395,8 +395,8 @@ DLL_QUERY libstd_query( Chuck_DL_Query * QUERY ) · 394 unmodified lines | |||
| 395 | #ifndef __DISABLE_PROMPTER__ | 395 | #ifndef __DISABLE_PROMPTER__ |
| 396 | // begin class (Skot) | 396 | // begin class (Skot) |
| 397 | if( !type_engine_import_class_begin( env, "ConsoleInput", "Event", | 397 | if( !type_engine_import_class_begin( env, "ConsoleInput", "Event", |
| 398 | env->global(), Skot_ctor, | 398 | env->global(), Skot_ctor, Skot_dtor, |
| 399 | Skot_dtor ) ) | 399 | "(Terminal only) a utility for prompting user input on the command line." ) ) |
| 400 | return FALSE; | 400 | return FALSE; |
| 401 | 401 | ||
| 402 | // add member variable | 402 | // add member variable |
| @@ -405,25 +405,35 @@ DLL_QUERY libstd_query( Chuck_DL_Query * QUERY ) · 2 unmodified lines | |||
| 405 | 405 | ||
| 406 | // add prompt() | 406 | // add prompt() |
| 407 | func = make_new_mfun( "Event", "prompt", Skot_prompt ); | 407 | func = make_new_mfun( "Event", "prompt", Skot_prompt ); |
| 408 | func->doc = "Return an Event to wait on."; | ||
| 408 | if( !type_engine_import_mfun( env, func ) ) goto error; | 409 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 409 | 410 | ||
| 410 | // add prompt() | 411 | // add prompt() |
| 411 | func = make_new_mfun( "Event", "prompt", Skot_prompt2 ); | 412 | func = make_new_mfun( "Event", "prompt", Skot_prompt2 ); |
| 412 | func->add_arg( "string", "what" ); | 413 | func->add_arg( "string", "what" ); |
| 414 | func->doc = "Print a prompt text and return an Event to wait on."; | ||
| 413 | if( !type_engine_import_mfun( env, func ) ) goto error; | 415 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 414 | 416 | ||
| 415 | // add ready() | 417 | // add more() |
| 416 | func = make_new_mfun( "int", "more", Skot_more ); | 418 | func = make_new_mfun( "int", "more", Skot_more ); |
| 419 | func->doc = "Return whether there is more input to read."; | ||
| 417 | if( !type_engine_import_mfun( env, func ) ) goto error; | 420 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 418 | 421 | ||
| 419 | // add getString() | 422 | // add getString() |
| 420 | func = make_new_mfun( "string", "getLine", Skot_getLine ); | 423 | func = make_new_mfun( "string", "getLine", Skot_getLine ); |
| 424 | func->doc = "Return the next line of input as a string."; | ||
| 421 | if( !type_engine_import_mfun( env, func ) ) goto error; | 425 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 422 | 426 | ||
| 423 | // add can_wait() | 427 | // add can_wait() |
| 424 | func = make_new_mfun( "int", "can_wait", Skot_can_wait ); | 428 | func = make_new_mfun( "int", "can_wait", Skot_can_wait ); |
| 429 | func->doc = "(internal) used by virtual machine for synthronization."; | ||
| 425 | if( !type_engine_import_mfun( env, func ) ) goto error; | 430 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 426 | 431 | ||
| 432 | // add examples | ||
| 433 | if( !type_engine_import_add_ex( env, "string/readline.ck" ) ) goto error; | ||
| 434 | if( !type_engine_import_add_ex( env, "ai/word2vec/word2vec-prompt.ck" ) ) goto error; | ||
| 435 | if( !type_engine_import_add_ex( env, "ai/word2vec/poem-ungenerate.ck" ) ) goto error; | ||
| 436 | |||
| 427 | // end class | 437 | // end class |
| 428 | type_engine_import_class_end( env ); | 438 | type_engine_import_class_end( env ); |
| 429 | #endif // __DISABLE_PROMPTER__ | 439 | #endif // __DISABLE_PROMPTER__ |