Unified · Split
| @@ -36,10 +36,20 @@ · 35 unmodified lines | |||
| 36 | //----------------------------------------------------------------------------- | 36 | //----------------------------------------------------------------------------- |
| 37 | #include "chuck.h" | 37 | #include "chuck.h" |
| 38 | #include "chuck_errmsg.h" | 38 | #include "chuck_errmsg.h" |
| 39 | //#include "chuck_io.h" | 39 | |
| 40 | //#include "chuck_otf.h" | 40 | #ifndef __DISABLE_SERIAL__ |
| 41 | //#include "ulib_machine.h" | 41 | #include "chuck_io.h" |
| 42 | //#include "util_network.h" | 42 | #endif |
| 43 | |||
| 44 | #ifndef __DISABLE_OTF_SERVER__ | ||
| 45 | #include "chuck_otf.h" | ||
| 46 | #include "ulib_machine.h" | ||
| 47 | #endif | ||
| 48 | |||
| 49 | #ifndef __DISABLE_NETWORK__ | ||
| 50 | #include "util_network.h" | ||
| 51 | #endif | ||
| 52 | |||
| 43 | #include "util_string.h" | 53 | #include "util_string.h" |
| 44 | #include "ugen_stk.h" | 54 | #include "ugen_stk.h" |
| 45 | 55 | ||
| @@ -100,14 +110,16 @@ const char * ChucK::version() · 54 unmodified lines | |||
| 100 | 110 | ||
| 101 | 111 | ||
| 102 | 112 | ||
| 103 | ////----------------------------------------------------------------------------- | 113 | #ifndef __DISABLE_OTF_SERVER__ |
| 104 | //// name: intSize() | 114 | //----------------------------------------------------------------------------- |
| 105 | //// desc: get chuck int size (in bits) | 115 | // name: intSize() |
| 106 | ////----------------------------------------------------------------------------- | 116 | // desc: get chuck int size (in bits) |
| 107 | //t_CKUINT ChucK::intSize() | 117 | //----------------------------------------------------------------------------- |
| 108 | //{ | 118 | t_CKUINT ChucK::intSize() |
| 109 | // return machine_intsize(); | 119 | { |
| 110 | //} | 120 | return machine_intsize(); |
| 121 | } | ||
| 122 | #endif | ||
| 111 | 123 | ||
| 112 | 124 | ||
| 113 | 125 | ||
| @@ -1322,8 +1334,10 @@ void ChucK::globalCleanup() · 1208 unmodified lines | |||
| 1322 | HidInManager::cleanup(); | 1334 | HidInManager::cleanup(); |
| 1323 | #endif // __ALTER_HID__ | 1335 | #endif // __ALTER_HID__ |
| 1324 | 1336 | ||
| 1337 | #ifndef __DISABLE_SERIAL__ | ||
| 1325 | // shutdown serial | 1338 | // shutdown serial |
| 1326 | // Chuck_IO_Serial::shutdown(); | 1339 | Chuck_IO_Serial::shutdown(); |
| 1340 | #endif | ||
| 1327 | 1341 | ||
| 1328 | #ifndef __DISABLE_KBHIT__ | 1342 | #ifndef __DISABLE_KBHIT__ |
| 1329 | // shutdown kb loop | 1343 | // shutdown kb loop |
| @@ -1368,5 +1382,7 @@ t_CKINT ChucK::getLogLevel() · 38 unmodified lines | |||
| 1368 | //----------------------------------------------------------------------------- | 1382 | //----------------------------------------------------------------------------- |
| 1369 | void ChucK::poop() | 1383 | void ChucK::poop() |
| 1370 | { | 1384 | { |
| 1371 | // ::uh(); | 1385 | #ifndef __DISABLE_OTF_SERVER__ |
| 1386 | ::uh(); | ||
| 1387 | #endif | ||
| 1372 | } | 1388 | } |
| @@ -40,13 +40,27 @@ · 39 unmodified lines | |||
| 40 | #include "chuck_compile.h" | 40 | #include "chuck_compile.h" |
| 41 | #include "chuck_dl.h" | 41 | #include "chuck_dl.h" |
| 42 | #include "chuck_vm.h" | 42 | #include "chuck_vm.h" |
| 43 | //#include "chuck_shell.h" | 43 | |
| 44 | #ifndef __DISABLE_SHELL__ | ||
| 45 | #include "chuck_shell.h" | ||
| 46 | #endif | ||
| 47 | |||
| 44 | #include "chuck_carrier.h" | 48 | #include "chuck_carrier.h" |
| 45 | //#include "ulib_machine.h" | 49 | #ifndef __DISABLE_OTF_SERVER |
| 50 | #include "ulib_machine.h" | ||
| 51 | #endif | ||
| 52 | |||
| 46 | #include "util_math.h" | 53 | #include "util_math.h" |
| 47 | #include "util_string.h" | 54 | #include "util_string.h" |
| 48 | //#include "hidio_sdl.h" | 55 | |
| 49 | //#include "midiio_rtmidi.h" | 56 | #ifndef __DISABLE_HID__ |
| 57 | #include "hidio_sdl.h" | ||
| 58 | #endif | ||
| 59 | |||
| 60 | #ifndef __DISABLE_MIDI__ | ||
| 61 | #include "midiio_rtmidi.h" | ||
| 62 | #endif | ||
| 63 | |||
| 50 | #include <string> | 64 | #include <string> |
| 51 | #include <map> | 65 | #include <map> |
| 52 | 66 | ||
| @@ -180,8 +194,12 @@ protected: · 127 unmodified lines | |||
| 180 | public: // static functions | 194 | public: // static functions |
| 181 | // chuck version | 195 | // chuck version |
| 182 | static const char * version(); | 196 | static const char * version(); |
| 197 | #ifndef __DISABLE_OTF_SERVER__ | ||
| 183 | // chuck int size (in bits) | 198 | // chuck int size (in bits) |
| 184 | // static t_CKUINT intSize(); | 199 | // (this depends on machine, which depends on OTF, so |
| 200 | // disable it if we don't have OTF) | ||
| 201 | static t_CKUINT intSize(); | ||
| 202 | #endif | ||
| 185 | // number of ChucK's | 203 | // number of ChucK's |
| 186 | static t_CKUINT numVMs() { return o_numVMs; }; | 204 | static t_CKUINT numVMs() { return o_numVMs; }; |
| 187 | // --poop compatibilty | 205 | // --poop compatibilty |
| @@ -46,6 +46,7 @@ IS (u|U|l|L)* · 45 unmodified lines | |||
| 46 | 46 | ||
| 47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
| 48 | #include <string.h> | 48 | #include <string.h> |
| 49 | #include <unistd.h> | ||
| 49 | #include "chuck_utils.h" | 50 | #include "chuck_utils.h" |
| 50 | #include "chuck_absyn.h" | 51 | #include "chuck_absyn.h" |
| 51 | #include "chuck_errmsg.h" | 52 | #include "chuck_errmsg.h" |
| @@ -38,6 +38,7 @@ · 37 unmodified lines | |||
| 38 | #include <stdio.h> | 38 | #include <stdio.h> |
| 39 | #include <string.h> | 39 | #include <string.h> |
| 40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
| 41 | #include <unistd.h> | ||
| 41 | #include "chuck_utils.h" | 42 | #include "chuck_utils.h" |
| 42 | #include "chuck_errmsg.h" | 43 | #include "chuck_errmsg.h" |
| 43 | #include "chuck_absyn.h" | 44 | #include "chuck_absyn.h" |
| @@ -36,7 +36,9 @@ · 35 unmodified lines | |||
| 36 | #define __CHUCK_CARRIER_H__ | 36 | #define __CHUCK_CARRIER_H__ |
| 37 | 37 | ||
| 38 | #include "chuck_def.h" | 38 | #include "chuck_def.h" |
| 39 | //#include "util_thread.h" | 39 | #ifndef __DISABLE_OTF_SERVER__ |
| 40 | #include "util_thread.h" | ||
| 41 | #endif | ||
| 40 | #include <map> | 42 | #include <map> |
| 41 | 43 | ||
| 42 | 44 | ||
| @@ -74,14 +76,18 @@ struct Chuck_Carrier · 31 unmodified lines | |||
| 74 | Chuck_IO_Chout * chout; | 76 | Chuck_IO_Chout * chout; |
| 75 | Chuck_IO_Cherr * cherr; | 77 | Chuck_IO_Cherr * cherr; |
| 76 | 78 | ||
| 77 | // // OTF programming things | 79 | #ifndef __DISABLE_OTF_SERVER__ |
| 78 | // ck_socket otf_socket; | 80 | // OTF programming things |
| 79 | // t_CKINT otf_port; | 81 | ck_socket otf_socket; |
| 80 | // CHUCK_THREAD otf_thread; | 82 | t_CKINT otf_port; |
| 83 | CHUCK_THREAD otf_thread; | ||
| 84 | #endif | ||
| 81 | 85 | ||
| 82 | // STK-specific | 86 | // STK-specific |
| 83 | // XWriteThread * stk_writeThread; | 87 | #ifndef __DISABLE_WVOUT__ |
| 84 | // std::map<WvOut *, WvOut *> stk_wvOutMap; | 88 | XWriteThread * stk_writeThread; |
| 89 | std::map<WvOut *, WvOut *> stk_wvOutMap; | ||
| 90 | #endif | ||
| 85 | 91 | ||
| 86 | // constructor | 92 | // constructor |
| 87 | Chuck_Carrier() : | 93 | Chuck_Carrier() : |
| @@ -89,12 +95,17 @@ struct Chuck_Carrier · 1 unmodified line | |||
| 89 | compiler( NULL ), | 95 | compiler( NULL ), |
| 90 | env( NULL ), | 96 | env( NULL ), |
| 91 | vm( NULL ), | 97 | vm( NULL ), |
| 98 | #ifndef __DISABLE_OTF_SERVER__ | ||
| 99 | otf_socket( NULL ), | ||
| 100 | otf_port( 0 ), | ||
| 101 | otf_thread( 0 ), | ||
| 102 | #endif | ||
| 103 | #ifndef __DISABLE_WVOUT__ | ||
| 104 | stk_writeThread( NULL ), | ||
| 105 | #endif | ||
| 92 | chout( NULL ), | 106 | chout( NULL ), |
| 93 | cherr( NULL ) | 107 | cherr( NULL ) |
| 94 | // otf_socket( NULL ), | 108 | |
| 95 | // otf_port( 0 ), | ||
| 96 | // otf_thread( 0 ), | ||
| 97 | // stk_writeThread( NULL ) | ||
| 98 | { } | 109 | { } |
| 99 | 110 | ||
| 100 | // get hint: is realtime audio? | 111 | // get hint: is realtime audio? |
| @@ -32,7 +32,9 @@ · 31 unmodified lines | |||
| 32 | #include "chuck_compile.h" | 32 | #include "chuck_compile.h" |
| 33 | #include "chuck_lang.h" | 33 | #include "chuck_lang.h" |
| 34 | #include "chuck_errmsg.h" | 34 | #include "chuck_errmsg.h" |
| 35 | //#include "chuck_otf.h" | 35 | #ifndef __DISABLE_OTF_SERVER__ |
| 36 | #include "chuck_otf.h" | ||
| 37 | #endif | ||
| 36 | 38 | ||
| 37 | #include "ugen_osc.h" | 39 | #include "ugen_osc.h" |
| 38 | #include "ugen_xxx.h" | 40 | #include "ugen_xxx.h" |
| @@ -40,12 +42,23 @@ · 1 unmodified line | |||
| 40 | #include "ugen_stk.h" | 42 | #include "ugen_stk.h" |
| 41 | #include "uana_xform.h" | 43 | #include "uana_xform.h" |
| 42 | #include "uana_extract.h" | 44 | #include "uana_extract.h" |
| 43 | //#include "ulib_machine.h" | 45 | |
| 46 | #ifndef __DISABLE_OTF_SERVER__ | ||
| 47 | #include "ulib_machine.h" | ||
| 48 | #endif | ||
| 49 | |||
| 44 | #include "ulib_math.h" | 50 | #include "ulib_math.h" |
| 45 | #include "ulib_std.h" | 51 | #include "ulib_std.h" |
| 46 | //#include "ulib_opsc.h" | 52 | |
| 53 | #ifndef __DISABLE_NETWORK__ | ||
| 54 | #include "ulib_opsc.h" | ||
| 55 | #endif | ||
| 56 | |||
| 47 | #include "ulib_regex.h" | 57 | #include "ulib_regex.h" |
| 48 | //#include "chuck_io.h" | 58 | |
| 59 | #ifndef __DISABLE_SERIAL__ | ||
| 60 | #include "chuck_io.h" | ||
| 61 | #endif | ||
| 49 | 62 | ||
| 50 | #if defined(__PLATFORM_WIN32__) | 63 | #if defined(__PLATFORM_WIN32__) |
| 51 | #include "dirent_win32.h" | 64 | #include "dirent_win32.h" |
| @@ -649,22 +662,35 @@ t_CKBOOL load_internal_modules( Chuck_Compiler * compiler ) · 597 unmodified lines | |||
| 649 | load_module( compiler, env, extract_query, "extract", "global" ); | 662 | load_module( compiler, env, extract_query, "extract", "global" ); |
| 650 | 663 | ||
| 651 | // load | 664 | // load |
| 665 | #ifndef __DISABLE_OTF_SERVER__ | ||
| 652 | EM_log( CK_LOG_SEVERE, "class 'machine'..." ); | 666 | EM_log( CK_LOG_SEVERE, "class 'machine'..." ); |
| 653 | // if( !load_module( compiler, env, machine_query, "Machine", "global" ) ) goto error; | 667 | if( !load_module( compiler, env, machine_query, "Machine", "global" ) ) goto error; |
| 654 | // machine_init( compiler, otf_process_msg ); | 668 | machine_init( compiler, otf_process_msg ); |
| 669 | #endif | ||
| 670 | |||
| 655 | EM_log( CK_LOG_SEVERE, "class 'std'..." ); | 671 | EM_log( CK_LOG_SEVERE, "class 'std'..." ); |
| 656 | if( !load_module( compiler, env, libstd_query, "Std", "global" ) ) goto error; | 672 | if( !load_module( compiler, env, libstd_query, "Std", "global" ) ) goto error; |
| 657 | EM_log( CK_LOG_SEVERE, "class 'math'..." ); | 673 | EM_log( CK_LOG_SEVERE, "class 'math'..." ); |
| 658 | if( !load_module( compiler, env, libmath_query, "Math", "global" ) ) goto error; | 674 | if( !load_module( compiler, env, libmath_query, "Math", "global" ) ) goto error; |
| 659 | 675 | ||
| 660 | // EM_log( CK_LOG_SEVERE, "class 'opsc'..." ); | 676 | #ifndef __DISABLE_NETWORK__ |
| 661 | // if( !load_module( compiler, env, opensoundcontrol_query, "opsc", "global" ) ) goto error; | 677 | EM_log( CK_LOG_SEVERE, "class 'opsc'..." ); |
| 678 | if( !load_module( compiler, env, opensoundcontrol_query, "opsc", "global" ) ) goto error; | ||
| 679 | #endif | ||
| 680 | |||
| 662 | EM_log( CK_LOG_SEVERE, "class 'RegEx'..." ); | 681 | EM_log( CK_LOG_SEVERE, "class 'RegEx'..." ); |
| 663 | if( !load_module( compiler, env, regex_query, "RegEx", "global" ) ) goto error; | 682 | if( !load_module( compiler, env, regex_query, "RegEx", "global" ) ) goto error; |
| 683 | |||
| 684 | // Deprecated: | ||
| 664 | // if( !load_module( compiler, env, net_query, "net", "global" ) ) goto error; | 685 | // if( !load_module( compiler, env, net_query, "net", "global" ) ) goto error; |
| 665 | 686 | ||
| 666 | // if( !init_class_HID( env ) ) goto error; | 687 | #ifndef __DISABLE_HID__ |
| 667 | // if( !init_class_serialio( env ) ) goto error; | 688 | if( !init_class_HID( env ) ) goto error; |
| 689 | #endif | ||
| 690 | |||
| 691 | #ifndef __DISABLE_SERIAL__ | ||
| 692 | if( !init_class_serialio( env ) ) goto error; | ||
| 693 | #endif | ||
| 668 | 694 | ||
| 669 | // clear context | 695 | // clear context |
| 670 | type_engine_unload_context( env ); | 696 | type_engine_unload_context( env ); |
| @@ -38,8 +38,9 @@ · 37 unmodified lines | |||
| 38 | #include <iostream> | 38 | #include <iostream> |
| 39 | #include "chuck_utils.h" | 39 | #include "chuck_utils.h" |
| 40 | #include "chuck_errmsg.h" | 40 | #include "chuck_errmsg.h" |
| 41 | //#include "util_thread.h" | 41 | #ifndef __DISABLE_THREADS__ |
| 42 | 42 | #include "util_thread.h" | |
| 43 | #endif | ||
| 43 | 44 | ||
| 44 | // global | 45 | // global |
| 45 | int EM_tokPos = 0; | 46 | int EM_tokPos = 0; |
| @@ -57,7 +58,9 @@ static size_t g_lasterrorIndex = strlen(g_lasterror); · 11 unmodified lines | |||
| 57 | // log globals | 58 | // log globals |
| 58 | t_CKINT g_loglevel = CK_LOG_CORE; | 59 | t_CKINT g_loglevel = CK_LOG_CORE; |
| 59 | t_CKINT g_logstack = 0; | 60 | t_CKINT g_logstack = 0; |
| 60 | //XMutex g_logmutex; | 61 | #ifndef __DISABLE_THREADS__ |
| 62 | XMutex g_logmutex; | ||
| 63 | #endif | ||
| 61 | 64 | ||
| 62 | // more local globals | 65 | // more local globals |
| 63 | static const size_t g_buffer2_size = 1024; | 66 | static const size_t g_buffer2_size = 1024; |
| @@ -574,7 +577,9 @@ void EM_log( t_CKINT level, const char * message, ... ) · 510 unmodified lines | |||
| 574 | // check level | 577 | // check level |
| 575 | if( level > g_loglevel ) return; | 578 | if( level > g_loglevel ) return; |
| 576 | 579 | ||
| 577 | // g_logmutex.acquire(); | 580 | #ifndef __DISABLE_THREADS__ |
| 581 | g_logmutex.acquire(); | ||
| 582 | #endif | ||
| 578 | CK_FPRINTF_STDERR( "[chuck]:" ); | 583 | CK_FPRINTF_STDERR( "[chuck]:" ); |
| 579 | CK_FPRINTF_STDERR( "(%i:%s): ", level, g_str[level] ); | 584 | CK_FPRINTF_STDERR( "(%i:%s): ", level, g_str[level] ); |
| 580 | 585 | ||
| @@ -588,7 +593,9 @@ void EM_log( t_CKINT level, const char * message, ... ) · 7 unmodified lines | |||
| 588 | 593 | ||
| 589 | CK_FPRINTF_STDERR( "\n" ); | 594 | CK_FPRINTF_STDERR( "\n" ); |
| 590 | CK_FFLUSH_STDERR(); | 595 | CK_FFLUSH_STDERR(); |
| 591 | // g_logmutex.release(); | 596 | #ifndef __DISABLE_THREADS__ |
| 597 | g_logmutex.release(); | ||
| 598 | #endif | ||
| 592 | } | 599 | } |
| 593 | 600 | ||
| 594 | 601 | ||
| @@ -3902,7 +3902,9 @@ Chuck_Object * instantiate_and_initialize_object( Chuck_Type * type, Chuck_VM_Sh · 3901 unmodified lines | |||
| 3902 | // check type TODO: make this faster | 3902 | // check type TODO: make this faster |
| 3903 | if( type->allocator ) | 3903 | if( type->allocator ) |
| 3904 | object = type->allocator( vm, shred, Chuck_DL_Api::Api::instance() ); | 3904 | object = type->allocator( vm, shred, Chuck_DL_Api::Api::instance() ); |
| 3905 | // else if( isa( type, vm->env()->t_fileio ) ) object = new Chuck_IO_File( vm ); | 3905 | #ifndef __DISABLE_FILEIO__ |
| 3906 | else if( isa( type, vm->env()->t_fileio ) ) object = new Chuck_IO_File( vm ); | ||
| 3907 | #endif | ||
| 3906 | else if( isa( type, vm->env()->t_event ) ) object = new Chuck_Event; | 3908 | else if( isa( type, vm->env()->t_event ) ) object = new Chuck_Event; |
| 3907 | else if( isa( type, vm->env()->t_string ) ) object = new Chuck_String; | 3909 | else if( isa( type, vm->env()->t_string ) ) object = new Chuck_String; |
| 3908 | // TODO: is this ok? | 3910 | // TODO: is this ok? |
| @@ -38,9 +38,16 @@ · 37 unmodified lines | |||
| 38 | #include "chuck_vm.h" | 38 | #include "chuck_vm.h" |
| 39 | #include "chuck_errmsg.h" | 39 | #include "chuck_errmsg.h" |
| 40 | #include "chuck_ugen.h" | 40 | #include "chuck_ugen.h" |
| 41 | //#include "hidio_sdl.h" | 41 | |
| 42 | #ifndef __DISABLE_HID__ | ||
| 43 | #include "hidio_sdl.h" | ||
| 44 | #endif | ||
| 45 | |||
| 42 | #include "util_string.h" | 46 | #include "util_string.h" |
| 43 | //#include "util_serial.h" | 47 | |
| 48 | #ifndef __DISABLE_SERIAL__ | ||
| 49 | #include "util_serial.h" | ||
| 50 | #endif | ||
| 44 | 51 | ||
| 45 | #ifndef __DISABLE_MIDI__ | 52 | #ifndef __DISABLE_MIDI__ |
| 46 | #include "midiio_rtmidi.h" | 53 | #include "midiio_rtmidi.h" |
| @@ -839,164 +846,166 @@ error: · 792 unmodified lines | |||
| 839 | 846 | ||
| 840 | 847 | ||
| 841 | 848 | ||
| 849 | #ifndef __DISABLE_FILEIO__ | ||
| 842 | //----------------------------------------------------------------------------- | 850 | //----------------------------------------------------------------------------- |
| 843 | // name: init_class_fileio() | 851 | // name: init_class_fileio() |
| 844 | // desc: ... | 852 | // desc: ... |
| 845 | //----------------------------------------------------------------------------- | 853 | //----------------------------------------------------------------------------- |
| 846 | //t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ) | 854 | t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ) |
| 847 | //{ | 855 | { |
| 848 | // // init as base class | 856 | // init as base class |
| 849 | // Chuck_DL_Func * func = NULL; | 857 | Chuck_DL_Func * func = NULL; |
| 850 | // | 858 | |
| 851 | // // log | 859 | // log |
| 852 | // EM_log( CK_LOG_SEVERE, "class 'fileio'" ); | 860 | EM_log( CK_LOG_SEVERE, "class 'fileio'" ); |
| 853 | // | 861 | |
| 854 | // // init as base class | 862 | // init as base class |
| 855 | // // TODO: ctor/dtor? | 863 | // TODO: ctor/dtor? |
| 856 | // // TODO: replace dummy with pure function | 864 | // TODO: replace dummy with pure function |
| 857 | // if( !type_engine_import_class_begin( env, type, env->global(), fileio_ctor, fileio_dtor ) ) | 865 | if( !type_engine_import_class_begin( env, type, env->global(), fileio_ctor, fileio_dtor ) ) |
| 858 | // return FALSE; | 866 | return FALSE; |
| 859 | // | 867 | |
| 860 | // // add open(string) | 868 | // add open(string) |
| 861 | // func = make_new_mfun( "int", "open", fileio_open ); | 869 | func = make_new_mfun( "int", "open", fileio_open ); |
| 862 | // func->add_arg( "string", "path" ); | 870 | func->add_arg( "string", "path" ); |
| 863 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 871 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 864 | // | 872 | |
| 865 | // // add open(string, flags) | 873 | // add open(string, flags) |
| 866 | // func = make_new_mfun( "int", "open", fileio_openflags ); | 874 | func = make_new_mfun( "int", "open", fileio_openflags ); |
| 867 | // func->add_arg( "string", "path" ); | 875 | func->add_arg( "string", "path" ); |
| 868 | // func->add_arg( "int", "flags" ); | 876 | func->add_arg( "int", "flags" ); |
| 869 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 877 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 870 | // | 878 | |
| 871 | // // add good() | 879 | // add good() |
| 872 | // func = make_new_mfun( "int", "good", fileio_good ); | 880 | func = make_new_mfun( "int", "good", fileio_good ); |
| 873 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 881 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 874 | // | 882 | |
| 875 | // // add close() | 883 | // add close() |
| 876 | // func = make_new_mfun( "void", "close", fileio_close ); | 884 | func = make_new_mfun( "void", "close", fileio_close ); |
| 877 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 885 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 878 | // | 886 | |
| 879 | // // add flush() | 887 | // add flush() |
| 880 | // func = make_new_mfun( "void", "flush", fileio_flush ); | 888 | func = make_new_mfun( "void", "flush", fileio_flush ); |
| 881 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 889 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 882 | // | 890 | |
| 883 | // // add mode() | 891 | // add mode() |
| 884 | // func = make_new_mfun( "int", "mode", fileio_getmode ); | 892 | func = make_new_mfun( "int", "mode", fileio_getmode ); |
| 885 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 893 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 886 | // | 894 | |
| 887 | // // add mode(int) | 895 | // add mode(int) |
| 888 | // func = make_new_mfun( "int", "mode", fileio_setmode ); | 896 | func = make_new_mfun( "int", "mode", fileio_setmode ); |
| 889 | // func->add_arg( "int", "flag" ); | 897 | func->add_arg( "int", "flag" ); |
| 890 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 898 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 891 | // | 899 | |
| 892 | // // add size() | 900 | // add size() |
| 893 | // func = make_new_mfun( "int", "size", fileio_size ); | 901 | func = make_new_mfun( "int", "size", fileio_size ); |
| 894 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 902 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 895 | // | 903 | |
| 896 | // // add seek(int) | 904 | // add seek(int) |
| 897 | // func = make_new_mfun( "void", "seek", fileio_seek ); | 905 | func = make_new_mfun( "void", "seek", fileio_seek ); |
| 898 | // func->add_arg( "int", "pos" ); | 906 | func->add_arg( "int", "pos" ); |
| 899 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 907 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 900 | // | 908 | |
| 901 | // // add tell() | 909 | // add tell() |
| 902 | // func = make_new_mfun( "int", "tell", fileio_tell ); | 910 | func = make_new_mfun( "int", "tell", fileio_tell ); |
| 903 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 911 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 904 | // | 912 | |
| 905 | // // add isDir() | 913 | // add isDir() |
| 906 | // func = make_new_mfun( "int", "isDir", fileio_isdir ); | 914 | func = make_new_mfun( "int", "isDir", fileio_isdir ); |
| 907 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 915 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 908 | // | 916 | |
| 909 | // // add dirList() | 917 | // add dirList() |
| 910 | // func = make_new_mfun( "string[]", "dirList", fileio_dirlist ); | 918 | func = make_new_mfun( "string[]", "dirList", fileio_dirlist ); |
| 911 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 919 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 912 | // | 920 | |
| 913 | // // add read() | 921 | // add read() |
| 914 | // // func = make_new_mfun( "string", "read", fileio_read ); | 922 | // func = make_new_mfun( "string", "read", fileio_read ); |
| 915 | // // func->add_arg( "int", "length" ); | 923 | // func->add_arg( "int", "length" ); |
| 916 | // // if( !type_engine_import_mfun( env, func ) ) goto error; | 924 | // if( !type_engine_import_mfun( env, func ) ) goto error; |
| 917 | // | 925 | |
| 918 | // // add readLine() | 926 | // add readLine() |
| 919 | // func = make_new_mfun( "string", "readLine", fileio_readline ); | 927 | func = make_new_mfun( "string", "readLine", fileio_readline ); |
| 920 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 928 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 921 | // | 929 | |
| 922 | // // add readInt() | 930 | // add readInt() |
| 923 | // // func = make_new_mfun( "int", "readInt", fileio_readint ); | 931 | // func = make_new_mfun( "int", "readInt", fileio_readint ); |
| 924 | // // if( !type_engine_import_mfun( env, func ) ) goto error; | 932 | // if( !type_engine_import_mfun( env, func ) ) goto error; |
| 925 | // | 933 | |
| 926 | // // add readInt(int) | 934 | // add readInt(int) |
| 927 | // func = make_new_mfun( "int", "readInt", fileio_readintflags ); | 935 | func = make_new_mfun( "int", "readInt", fileio_readintflags ); |
| 928 | // func->add_arg( "int", "flags" ); | 936 | func->add_arg( "int", "flags" ); |
| 929 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 937 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 930 | // | 938 | |
| 931 | // // add readFloat() | 939 | // add readFloat() |
| 932 | // // func = make_new_mfun( "float", "readFloat", fileio_readfloat ); | 940 | // func = make_new_mfun( "float", "readFloat", fileio_readfloat ); |
| 933 | // // if( !type_engine_import_mfun( env, func ) ) goto error; | 941 | // if( !type_engine_import_mfun( env, func ) ) goto error; |
| 934 | // | 942 | |
| 935 | // // add eof() | 943 | // add eof() |
| 936 | // func = make_new_mfun( "int", "eof", fileio_eof ); | 944 | func = make_new_mfun( "int", "eof", fileio_eof ); |
| 937 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 945 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 938 | // | 946 | |
| 939 | // // add more() | 947 | // add more() |
| 940 | // func = make_new_mfun( "int", "more", fileio_more ); | 948 | func = make_new_mfun( "int", "more", fileio_more ); |
| 941 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 949 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 942 | // | 950 | |
| 943 | // // add write(string) | 951 | // add write(string) |
| 944 | // func = make_new_mfun( "void", "write", fileio_writestring ); | 952 | func = make_new_mfun( "void", "write", fileio_writestring ); |
| 945 | // func->add_arg( "string", "val" ); | 953 | func->add_arg( "string", "val" ); |
| 946 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 954 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 947 | // | 955 | |
| 948 | // // add write(int) | 956 | // add write(int) |
| 949 | // func = make_new_mfun( "void", "write", fileio_writeint ); | 957 | func = make_new_mfun( "void", "write", fileio_writeint ); |
| 950 | // func->add_arg( "int", "val" ); | 958 | func->add_arg( "int", "val" ); |
| 951 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 959 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 952 | // | 960 | |
| 953 | // // add write(int,flags) | 961 | // add write(int,flags) |
| 954 | // func = make_new_mfun( "void", "write", fileio_writeintflags ); | 962 | func = make_new_mfun( "void", "write", fileio_writeintflags ); |
| 955 | // func->add_arg( "int", "val" ); | 963 | func->add_arg( "int", "val" ); |
| 956 | // func->add_arg( "int", "flags" ); | 964 | func->add_arg( "int", "flags" ); |
| 957 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 965 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 958 | // | 966 | |
| 959 | // // add write(float) | 967 | // add write(float) |
| 960 | // func = make_new_mfun( "void", "write", fileio_writefloat ); | 968 | func = make_new_mfun( "void", "write", fileio_writefloat ); |
| 961 | // func->add_arg( "float", "val" ); | 969 | func->add_arg( "float", "val" ); |
| 962 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 970 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 963 | // | 971 | |
| 964 | // // add FLAG_READ_WRITE | 972 | // add FLAG_READ_WRITE |
| 965 | // if( !type_engine_import_svar( env, "int", "READ_WRITE", | 973 | if( !type_engine_import_svar( env, "int", "READ_WRITE", |
| 966 | // TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_READ_WRITE ) ) goto error; | 974 | TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_READ_WRITE ) ) goto error; |
| 967 | // | 975 | |
| 968 | // // add FLAG_READONLY | 976 | // add FLAG_READONLY |
| 969 | // if( !type_engine_import_svar( env, "int", "READ", | 977 | if( !type_engine_import_svar( env, "int", "READ", |
| 970 | // TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_READONLY ) ) goto error; | 978 | TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_READONLY ) ) goto error; |
| 971 | // | 979 | |
| 972 | // // add FLAG_WRITEONLY | 980 | // add FLAG_WRITEONLY |
| 973 | // if( !type_engine_import_svar( env, "int", "WRITE", | 981 | if( !type_engine_import_svar( env, "int", "WRITE", |
| 974 | // TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_WRITEONLY ) ) goto error; | 982 | TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_WRITEONLY ) ) goto error; |
| 975 | // | 983 | |
| 976 | // // add FLAG_APPEND | 984 | // add FLAG_APPEND |
| 977 | // if( !type_engine_import_svar( env, "int", "APPEND", | 985 | if( !type_engine_import_svar( env, "int", "APPEND", |
| 978 | // TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_APPEND ) ) goto error; | 986 | TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_APPEND ) ) goto error; |
| 979 | // | 987 | |
| 980 | // // add TYPE_ASCII | 988 | // add TYPE_ASCII |
| 981 | // if( !type_engine_import_svar( env, "int", "ASCII", | 989 | if( !type_engine_import_svar( env, "int", "ASCII", |
| 982 | // TRUE, (t_CKUINT)&Chuck_IO_File::TYPE_ASCII ) ) goto error; | 990 | TRUE, (t_CKUINT)&Chuck_IO_File::TYPE_ASCII ) ) goto error; |
| 983 | // | 991 | |
| 984 | // // add TYPE_BINARY | 992 | // add TYPE_BINARY |
| 985 | // if( !type_engine_import_svar( env, "int", "BINARY", | 993 | if( !type_engine_import_svar( env, "int", "BINARY", |
| 986 | // TRUE, (t_CKUINT)&Chuck_IO_File::TYPE_BINARY ) ) goto error; | 994 | TRUE, (t_CKUINT)&Chuck_IO_File::TYPE_BINARY ) ) goto error; |
| 987 | // | 995 | |
| 988 | // // end the class import | 996 | // end the class import |
| 989 | // type_engine_import_class_end( env ); | 997 | type_engine_import_class_end( env ); |
| 990 | // | 998 | |
| 991 | // return TRUE; | 999 | return TRUE; |
| 992 | // | 1000 | |
| 993 | //error: | 1001 | error: |
| 994 | // | 1002 | |
| 995 | // // end the class import | 1003 | // end the class import |
| 996 | // type_engine_import_class_end( env ); | 1004 | type_engine_import_class_end( env ); |
| 997 | // | 1005 | |
| 998 | // return FALSE; | 1006 | return FALSE; |
| 999 | //} | 1007 | } |
| 1008 | #endif | ||
| 1000 | 1009 | ||
| 1001 | 1010 | ||
| 1002 | 1011 | ||
| @@ -1633,442 +1642,443 @@ error: · 630 unmodified lines | |||
| 1633 | 1642 | ||
| 1634 | 1643 | ||
| 1635 | 1644 | ||
| 1636 | //// static | 1645 | #ifndef __DISABLE_HID__ |
| 1637 | //static t_CKUINT HidIn_offset_data = 0; | 1646 | // static |
| 1638 | // | 1647 | static t_CKUINT HidIn_offset_data = 0; |
| 1639 | //static t_CKUINT HidMsg_offset_device_type = 0; | 1648 | |
| 1640 | //static t_CKUINT HidMsg_offset_device_num = 0; | 1649 | static t_CKUINT HidMsg_offset_device_type = 0; |
| 1641 | //static t_CKUINT HidMsg_offset_type = 0; | 1650 | static t_CKUINT HidMsg_offset_device_num = 0; |
| 1642 | //static t_CKUINT HidMsg_offset_which = 0; | 1651 | static t_CKUINT HidMsg_offset_type = 0; |
| 1643 | //static t_CKUINT HidMsg_offset_idata = 0; | 1652 | static t_CKUINT HidMsg_offset_which = 0; |
| 1644 | //static t_CKUINT HidMsg_offset_fdata = 0; | 1653 | static t_CKUINT HidMsg_offset_idata = 0; |
| 1645 | //static t_CKUINT HidMsg_offset_when = 0; | 1654 | static t_CKUINT HidMsg_offset_fdata = 0; |
| 1646 | //static t_CKUINT HidMsg_offset_deltax = 0; | 1655 | static t_CKUINT HidMsg_offset_when = 0; |
| 1647 | //static t_CKUINT HidMsg_offset_deltay = 0; | 1656 | static t_CKUINT HidMsg_offset_deltax = 0; |
| 1648 | //static t_CKUINT HidMsg_offset_axis_position = 0; // deprecated | 1657 | static t_CKUINT HidMsg_offset_deltay = 0; |
| 1649 | //static t_CKUINT HidMsg_offset_axis_position2 = 0; | 1658 | static t_CKUINT HidMsg_offset_axis_position = 0; // deprecated |
| 1650 | //static t_CKUINT HidMsg_offset_scaled_axis_position = 0; // deprecated | 1659 | static t_CKUINT HidMsg_offset_axis_position2 = 0; |
| 1651 | //static t_CKUINT HidMsg_offset_hat_position = 0; | 1660 | static t_CKUINT HidMsg_offset_scaled_axis_position = 0; // deprecated |
| 1652 | //static t_CKUINT HidMsg_offset_cursorx = 0; | 1661 | static t_CKUINT HidMsg_offset_hat_position = 0; |
| 1653 | //static t_CKUINT HidMsg_offset_cursory = 0; | 1662 | static t_CKUINT HidMsg_offset_cursorx = 0; |
| 1654 | //static t_CKUINT HidMsg_offset_scaledcursorx = 0; | 1663 | static t_CKUINT HidMsg_offset_cursory = 0; |
| 1655 | //static t_CKUINT HidMsg_offset_scaledcursory = 0; | 1664 | static t_CKUINT HidMsg_offset_scaledcursorx = 0; |
| 1656 | //static t_CKUINT HidMsg_offset_x = 0; | 1665 | static t_CKUINT HidMsg_offset_scaledcursory = 0; |
| 1657 | //static t_CKUINT HidMsg_offset_y = 0; | 1666 | static t_CKUINT HidMsg_offset_x = 0; |
| 1658 | //static t_CKUINT HidMsg_offset_z = 0; | 1667 | static t_CKUINT HidMsg_offset_y = 0; |
| 1659 | //static t_CKUINT HidMsg_offset_touchx = 0; // added 1.3.0.0 | 1668 | static t_CKUINT HidMsg_offset_z = 0; |
| 1660 | //static t_CKUINT HidMsg_offset_touchy = 0; // added 1.3.0.0 | 1669 | static t_CKUINT HidMsg_offset_touchx = 0; // added 1.3.0.0 |
| 1661 | //static t_CKUINT HidMsg_offset_touchsize = 0; // added 1.3.0.0 | 1670 | static t_CKUINT HidMsg_offset_touchy = 0; // added 1.3.0.0 |
| 1662 | //static t_CKUINT HidMsg_offset_ascii = 0; | 1671 | static t_CKUINT HidMsg_offset_touchsize = 0; // added 1.3.0.0 |
| 1663 | //static t_CKUINT HidMsg_offset_key = 0; | 1672 | static t_CKUINT HidMsg_offset_ascii = 0; |
| 1664 | // | 1673 | static t_CKUINT HidMsg_offset_key = 0; |
| 1665 | //static t_CKUINT HidOut_offset_data = 0; | 1674 | |
| 1666 | 1675 | static t_CKUINT HidOut_offset_data = 0; | |
| 1667 | ////----------------------------------------------------------------------------- | 1676 | |
| 1668 | //// name: init_class_HID() | 1677 | //----------------------------------------------------------------------------- |
| 1669 | //// desc: ... | 1678 | // name: init_class_HID() |
| 1670 | ////----------------------------------------------------------------------------- | 1679 | // desc: ... |
| 1671 | //t_CKBOOL init_class_HID( Chuck_Env * env ) | 1680 | //----------------------------------------------------------------------------- |
| 1672 | //{ | 1681 | t_CKBOOL init_class_HID( Chuck_Env * env ) |
| 1673 | // Chuck_DL_Func * func = NULL; | 1682 | { |
| 1674 | // | 1683 | Chuck_DL_Func * func = NULL; |
| 1675 | // // init base class | 1684 | |
| 1676 | // if( !type_engine_import_class_begin( env, "HidMsg", "Object", | 1685 | // init base class |
| 1677 | // env->global(), NULL, NULL ) ) | 1686 | if( !type_engine_import_class_begin( env, "HidMsg", "Object", |
| 1678 | // return FALSE; | 1687 | env->global(), NULL, NULL ) ) |
| 1679 | // | 1688 | return FALSE; |
| 1680 | // // add member variable | 1689 | |
| 1681 | // HidMsg_offset_device_type = type_engine_import_mvar( env, "int", "deviceType", FALSE ); | 1690 | // add member variable |
| 1682 | // if( HidMsg_offset_device_type == CK_INVALID_OFFSET ) goto error; | 1691 | HidMsg_offset_device_type = type_engine_import_mvar( env, "int", "deviceType", FALSE ); |
| 1683 | // | 1692 | if( HidMsg_offset_device_type == CK_INVALID_OFFSET ) goto error; |
| 1684 | // // add member variable | 1693 | |
| 1685 | // HidMsg_offset_device_num = type_engine_import_mvar( env, "int", "deviceNum", FALSE ); | 1694 | // add member variable |
| 1686 | // if( HidMsg_offset_device_num == CK_INVALID_OFFSET ) goto error; | 1695 | HidMsg_offset_device_num = type_engine_import_mvar( env, "int", "deviceNum", FALSE ); |
| 1687 | // | 1696 | if( HidMsg_offset_device_num == CK_INVALID_OFFSET ) goto error; |
| 1688 | // // add member variable | 1697 | |
| 1689 | // HidMsg_offset_type = type_engine_import_mvar( env, "int", "type", FALSE ); | 1698 | // add member variable |
| 1690 | // if( HidMsg_offset_type == CK_INVALID_OFFSET ) goto error; | 1699 | HidMsg_offset_type = type_engine_import_mvar( env, "int", "type", FALSE ); |
| 1691 | // | 1700 | if( HidMsg_offset_type == CK_INVALID_OFFSET ) goto error; |
| 1692 | // // add member variable | 1701 | |
| 1693 | // HidMsg_offset_which = type_engine_import_mvar( env, "int", "which", FALSE ); | 1702 | // add member variable |
| 1694 | // if( HidMsg_offset_which == CK_INVALID_OFFSET ) goto error; | 1703 | HidMsg_offset_which = type_engine_import_mvar( env, "int", "which", FALSE ); |
| 1695 | // | 1704 | if( HidMsg_offset_which == CK_INVALID_OFFSET ) goto error; |
| 1696 | // // add member variable | 1705 | |
| 1697 | // HidMsg_offset_idata = type_engine_import_mvar( env, "int", "idata", FALSE ); | 1706 | // add member variable |
| 1698 | // if( HidMsg_offset_idata == CK_INVALID_OFFSET ) goto error; | 1707 | HidMsg_offset_idata = type_engine_import_mvar( env, "int", "idata", FALSE ); |
| 1699 | // | 1708 | if( HidMsg_offset_idata == CK_INVALID_OFFSET ) goto error; |
| 1700 | // // add member variable | 1709 | |
| 1701 | // HidMsg_offset_fdata = type_engine_import_mvar( env, "float", "fdata", FALSE ); | 1710 | // add member variable |
| 1702 | // if( HidMsg_offset_fdata == CK_INVALID_OFFSET ) goto error; | 1711 | HidMsg_offset_fdata = type_engine_import_mvar( env, "float", "fdata", FALSE ); |
| 1703 | // | 1712 | if( HidMsg_offset_fdata == CK_INVALID_OFFSET ) goto error; |
| 1704 | // // add member variable | 1713 | |
| 1705 | // HidMsg_offset_when = type_engine_import_mvar( env, "time", "when", FALSE ); | 1714 | // add member variable |
| 1706 | // if( HidMsg_offset_when == CK_INVALID_OFFSET ) goto error; | 1715 | HidMsg_offset_when = type_engine_import_mvar( env, "time", "when", FALSE ); |
| 1707 | // | 1716 | if( HidMsg_offset_when == CK_INVALID_OFFSET ) goto error; |
| 1708 | // // add member variable | 1717 | |
| 1709 | // HidMsg_offset_deltax = type_engine_import_mvar( env, "int", "deltaX", FALSE ); | 1718 | // add member variable |
| 1710 | // if( HidMsg_offset_deltax == CK_INVALID_OFFSET ) goto error; | 1719 | HidMsg_offset_deltax = type_engine_import_mvar( env, "int", "deltaX", FALSE ); |
| 1711 | // | 1720 | if( HidMsg_offset_deltax == CK_INVALID_OFFSET ) goto error; |
| 1712 | // // add member variable | 1721 | |
| 1713 | // HidMsg_offset_deltay = type_engine_import_mvar( env, "int", "deltaY", FALSE ); | 1722 | // add member variable |
| 1714 | // if( HidMsg_offset_deltay == CK_INVALID_OFFSET ) goto error; | 1723 | HidMsg_offset_deltay = type_engine_import_mvar( env, "int", "deltaY", FALSE ); |
| 1715 | // | 1724 | if( HidMsg_offset_deltay == CK_INVALID_OFFSET ) goto error; |
| 1716 | // // add member variable | 1725 | |
| 1717 | // HidMsg_offset_cursorx = type_engine_import_mvar( env, "int", "cursorX", FALSE ); | 1726 | // add member variable |
| 1718 | // if( HidMsg_offset_cursorx == CK_INVALID_OFFSET ) goto error; | 1727 | HidMsg_offset_cursorx = type_engine_import_mvar( env, "int", "cursorX", FALSE ); |
| 1719 | // | 1728 | if( HidMsg_offset_cursorx == CK_INVALID_OFFSET ) goto error; |
| 1720 | // // add member variable | 1729 | |
| 1721 | // HidMsg_offset_cursory = type_engine_import_mvar( env, "int", "cursorY", FALSE ); | 1730 | // add member variable |
| 1722 | // if( HidMsg_offset_cursory == CK_INVALID_OFFSET ) goto error; | 1731 | HidMsg_offset_cursory = type_engine_import_mvar( env, "int", "cursorY", FALSE ); |
| 1723 | // | 1732 | if( HidMsg_offset_cursory == CK_INVALID_OFFSET ) goto error; |
| 1724 | // // add member variable | 1733 | |
| 1725 | // HidMsg_offset_scaledcursorx = type_engine_import_mvar( env, "float", "scaledCursorX", FALSE ); | 1734 | // add member variable |
| 1726 | // if( HidMsg_offset_scaledcursorx == CK_INVALID_OFFSET ) goto error; | 1735 | HidMsg_offset_scaledcursorx = type_engine_import_mvar( env, "float", "scaledCursorX", FALSE ); |
| 1727 | // | 1736 | if( HidMsg_offset_scaledcursorx == CK_INVALID_OFFSET ) goto error; |
| 1728 | // // add member variable | 1737 | |
| 1729 | // HidMsg_offset_scaledcursory = type_engine_import_mvar( env, "float", "scaledCursorY", FALSE ); | 1738 | // add member variable |
| 1730 | // if( HidMsg_offset_scaledcursory == CK_INVALID_OFFSET ) goto error; | 1739 | HidMsg_offset_scaledcursory = type_engine_import_mvar( env, "float", "scaledCursorY", FALSE ); |
| 1731 | // | 1740 | if( HidMsg_offset_scaledcursory == CK_INVALID_OFFSET ) goto error; |
| 1732 | // // add member variable | 1741 | |
| 1733 | // HidMsg_offset_x = type_engine_import_mvar( env, "int", "x", FALSE ); | 1742 | // add member variable |
| 1734 | // if( HidMsg_offset_x == CK_INVALID_OFFSET ) goto error; | 1743 | HidMsg_offset_x = type_engine_import_mvar( env, "int", "x", FALSE ); |
| 1735 | // | 1744 | if( HidMsg_offset_x == CK_INVALID_OFFSET ) goto error; |
| 1736 | // // add member variable | 1745 | |
| 1737 | // HidMsg_offset_y = type_engine_import_mvar( env, "int", "y", FALSE ); | 1746 | // add member variable |
| 1738 | // if( HidMsg_offset_y == CK_INVALID_OFFSET ) goto error; | 1747 | HidMsg_offset_y = type_engine_import_mvar( env, "int", "y", FALSE ); |
| 1739 | // | 1748 | if( HidMsg_offset_y == CK_INVALID_OFFSET ) goto error; |
| 1740 | // // add member variable | 1749 | |
| 1741 | // HidMsg_offset_z = type_engine_import_mvar( env, "int", "z", FALSE ); | 1750 | // add member variable |
| 1742 | // if( HidMsg_offset_z == CK_INVALID_OFFSET ) goto error; | 1751 | HidMsg_offset_z = type_engine_import_mvar( env, "int", "z", FALSE ); |
| 1743 | // | 1752 | if( HidMsg_offset_z == CK_INVALID_OFFSET ) goto error; |
| 1744 | // // add member variable (added 1.3.0.0) | 1753 | |
| 1745 | // HidMsg_offset_touchx = type_engine_import_mvar( env, "float", "touchX", FALSE ); | 1754 | // add member variable (added 1.3.0.0) |
| 1746 | // if( HidMsg_offset_touchx == CK_INVALID_OFFSET ) goto error; | 1755 | HidMsg_offset_touchx = type_engine_import_mvar( env, "float", "touchX", FALSE ); |
| 1747 | // | 1756 | if( HidMsg_offset_touchx == CK_INVALID_OFFSET ) goto error; |
| 1748 | // // add member variable (added 1.3.0.0) | 1757 | |
| 1749 | // HidMsg_offset_touchy = type_engine_import_mvar( env, "float", "touchY", FALSE ); | 1758 | // add member variable (added 1.3.0.0) |
| 1750 | // if( HidMsg_offset_touchy == CK_INVALID_OFFSET ) goto error; | 1759 | HidMsg_offset_touchy = type_engine_import_mvar( env, "float", "touchY", FALSE ); |
| 1751 | // | 1760 | if( HidMsg_offset_touchy == CK_INVALID_OFFSET ) goto error; |
| 1752 | // // add member variable (added 1.3.0.0) | 1761 | |
| 1753 | // HidMsg_offset_touchsize = type_engine_import_mvar( env, "float", "touchSize", FALSE ); | 1762 | // add member variable (added 1.3.0.0) |
| 1754 | // if( HidMsg_offset_touchsize == CK_INVALID_OFFSET ) goto error; | 1763 | HidMsg_offset_touchsize = type_engine_import_mvar( env, "float", "touchSize", FALSE ); |
| 1755 | // | 1764 | if( HidMsg_offset_touchsize == CK_INVALID_OFFSET ) goto error; |
| 1756 | // // add member variable | 1765 | |
| 1757 | // HidMsg_offset_axis_position = type_engine_import_mvar( env, "int", "axis_position", FALSE ); | 1766 | // add member variable |
| 1758 | // if( HidMsg_offset_axis_position == CK_INVALID_OFFSET ) goto error; | 1767 | HidMsg_offset_axis_position = type_engine_import_mvar( env, "int", "axis_position", FALSE ); |
| 1759 | // | 1768 | if( HidMsg_offset_axis_position == CK_INVALID_OFFSET ) goto error; |
| 1760 | // // add member variable | 1769 | |
| 1761 | // HidMsg_offset_axis_position2 = type_engine_import_mvar( env, "float", "axisPosition", FALSE ); | 1770 | // add member variable |
| 1762 | // if( HidMsg_offset_axis_position2 == CK_INVALID_OFFSET ) goto error; | 1771 | HidMsg_offset_axis_position2 = type_engine_import_mvar( env, "float", "axisPosition", FALSE ); |
| 1763 | // | 1772 | if( HidMsg_offset_axis_position2 == CK_INVALID_OFFSET ) goto error; |
| 1764 | // // add member variable | 1773 | |
| 1765 | // HidMsg_offset_hat_position = type_engine_import_mvar( env, "int", "hatPosition", FALSE ); | 1774 | // add member variable |
| 1766 | // if( HidMsg_offset_hat_position == CK_INVALID_OFFSET ) goto error; | 1775 | HidMsg_offset_hat_position = type_engine_import_mvar( env, "int", "hatPosition", FALSE ); |
| 1767 | // | 1776 | if( HidMsg_offset_hat_position == CK_INVALID_OFFSET ) goto error; |
| 1768 | // // add member variable | 1777 | |
| 1769 | // HidMsg_offset_ascii = type_engine_import_mvar( env, "int", "ascii", FALSE ); | 1778 | // add member variable |
| 1770 | // if( HidMsg_offset_ascii == CK_INVALID_OFFSET ) goto error; | 1779 | HidMsg_offset_ascii = type_engine_import_mvar( env, "int", "ascii", FALSE ); |
| 1771 | // | 1780 | if( HidMsg_offset_ascii == CK_INVALID_OFFSET ) goto error; |
| 1772 | // // add member variable | 1781 | |
| 1773 | // HidMsg_offset_key = type_engine_import_mvar( env, "int", "key", FALSE ); | 1782 | // add member variable |
| 1774 | // if( HidMsg_offset_key == CK_INVALID_OFFSET ) goto error; | 1783 | HidMsg_offset_key = type_engine_import_mvar( env, "int", "key", FALSE ); |
| 1775 | // | 1784 | if( HidMsg_offset_key == CK_INVALID_OFFSET ) goto error; |
| 1776 | // // add member variable | 1785 | |
| 1777 | // HidMsg_offset_scaled_axis_position = type_engine_import_mvar( env, "float", "scaled_axis_position", FALSE ); | 1786 | // add member variable |
| 1778 | // if( HidMsg_offset_scaled_axis_position == CK_INVALID_OFFSET ) goto error; | 1787 | HidMsg_offset_scaled_axis_position = type_engine_import_mvar( env, "float", "scaled_axis_position", FALSE ); |
| 1779 | // | 1788 | if( HidMsg_offset_scaled_axis_position == CK_INVALID_OFFSET ) goto error; |
| 1780 | // // add is_axis_motion() | 1789 | |
| 1781 | // func = make_new_mfun( "int", "is_axis_motion", HidMsg_is_axis_motion ); // deprecated | 1790 | // add is_axis_motion() |
| 1782 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1791 | func = make_new_mfun( "int", "is_axis_motion", HidMsg_is_axis_motion ); // deprecated |
| 1783 | // | 1792 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1784 | // // add isAxisMotion() | 1793 | |
| 1785 | // func = make_new_mfun( "int", "isAxisMotion", HidMsg_is_axis_motion ); | 1794 | // add isAxisMotion() |
| 1786 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1795 | func = make_new_mfun( "int", "isAxisMotion", HidMsg_is_axis_motion ); |
| 1787 | // | 1796 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1788 | // // add is_button_down() | 1797 | |
| 1789 | // func = make_new_mfun( "int", "is_button_down", HidMsg_is_button_down ); // deprecated | 1798 | // add is_button_down() |
| 1790 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1799 | func = make_new_mfun( "int", "is_button_down", HidMsg_is_button_down ); // deprecated |
| 1791 | // | 1800 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1792 | // // add isButtonDown() | 1801 | |
| 1793 | // func = make_new_mfun( "int", "isButtonDown", HidMsg_is_button_down ); | 1802 | // add isButtonDown() |
| 1794 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1803 | func = make_new_mfun( "int", "isButtonDown", HidMsg_is_button_down ); |
| 1795 | // | 1804 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1796 | // // add is_button_up() | 1805 | |
| 1797 | // func = make_new_mfun( "int", "is_button_up", HidMsg_is_button_up ); // deprecated | 1806 | // add is_button_up() |
| 1798 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1807 | func = make_new_mfun( "int", "is_button_up", HidMsg_is_button_up ); // deprecated |
| 1799 | // | 1808 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1800 | // // add isButtonUp() | 1809 | |
| 1801 | // func = make_new_mfun( "int", "isButtonUp", HidMsg_is_button_up ); | 1810 | // add isButtonUp() |
| 1802 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1811 | func = make_new_mfun( "int", "isButtonUp", HidMsg_is_button_up ); |
| 1803 | // | 1812 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1804 | // // add is_mouse_motion() | 1813 | |
| 1805 | // func = make_new_mfun( "int", "is_mouse_motion", HidMsg_is_mouse_motion ); // deprecated | 1814 | // add is_mouse_motion() |
| 1806 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1815 | func = make_new_mfun( "int", "is_mouse_motion", HidMsg_is_mouse_motion ); // deprecated |
| 1807 | // | 1816 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1808 | // // add isMouseMotion() | 1817 | |
| 1809 | // func = make_new_mfun( "int", "isMouseMotion", HidMsg_is_mouse_motion ); | 1818 | // add isMouseMotion() |
| 1810 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1819 | func = make_new_mfun( "int", "isMouseMotion", HidMsg_is_mouse_motion ); |
| 1811 | // | 1820 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1812 | // // add is_hat_motion() | 1821 | |
| 1813 | // func = make_new_mfun( "int", "is_hat_motion", HidMsg_is_hat_motion ); // deprecated | 1822 | // add is_hat_motion() |
| 1814 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1823 | func = make_new_mfun( "int", "is_hat_motion", HidMsg_is_hat_motion ); // deprecated |
| 1815 | // | 1824 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1816 | // // add isHatMotion() | 1825 | |
| 1817 | // func = make_new_mfun( "int", "isHatMotion", HidMsg_is_hat_motion ); | 1826 | // add isHatMotion() |
| 1818 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1827 | func = make_new_mfun( "int", "isHatMotion", HidMsg_is_hat_motion ); |
| 1819 | // | 1828 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1820 | // // add isWheelMotion() | 1829 | |
| 1821 | // func = make_new_mfun( "int", "isWheelMotion", HidMsg_is_wheel_motion ); | 1830 | // add isWheelMotion() |
| 1822 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1831 | func = make_new_mfun( "int", "isWheelMotion", HidMsg_is_wheel_motion ); |
| 1823 | // | 1832 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1824 | // // end the class import | 1833 | |
| 1825 | // type_engine_import_class_end( env ); | 1834 | // end the class import |
| 1826 | // | 1835 | type_engine_import_class_end( env ); |
| 1827 | // | 1836 | |
| 1828 | // // register deprecate | 1837 | |
| 1829 | // type_engine_register_deprecate( env, "HidIn", "Hid" ); | 1838 | // register deprecate |
| 1830 | // | 1839 | type_engine_register_deprecate( env, "HidIn", "Hid" ); |
| 1831 | // // init base class Hid (copy of HidIn + constants) | 1840 | |
| 1832 | // if( !type_engine_import_class_begin( env, "Hid", "Event", | 1841 | // init base class Hid (copy of HidIn + constants) |
| 1833 | // env->global(), HidIn_ctor, HidIn_dtor ) ) | 1842 | if( !type_engine_import_class_begin( env, "Hid", "Event", |
| 1834 | // return FALSE; | 1843 | env->global(), HidIn_ctor, HidIn_dtor ) ) |
| 1835 | // | 1844 | return FALSE; |
| 1836 | // // add open() | 1845 | |
| 1837 | // func = make_new_mfun( "int", "open", HidIn_open ); | 1846 | // add open() |
| 1838 | // func->add_arg( "int", "type" ); | 1847 | func = make_new_mfun( "int", "open", HidIn_open ); |
| 1839 | // func->add_arg( "int", "num" ); | 1848 | func->add_arg( "int", "type" ); |
| 1840 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1849 | func->add_arg( "int", "num" ); |
| 1841 | // | 1850 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1842 | // // add open() | 1851 | |
| 1843 | // func = make_new_mfun( "int", "open", HidIn_open_named ); | 1852 | // add open() |
| 1844 | // func->add_arg( "string", "name" ); | 1853 | func = make_new_mfun( "int", "open", HidIn_open_named ); |
| 1845 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1854 | func->add_arg( "string", "name" ); |
| 1846 | // | 1855 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1847 | // // add openJoystick() | 1856 | |
| 1848 | // func = make_new_mfun( "int", "openJoystick", HidIn_open_joystick ); | 1857 | // add openJoystick() |
| 1849 | // func->add_arg( "int", "num" ); | 1858 | func = make_new_mfun( "int", "openJoystick", HidIn_open_joystick ); |
| 1850 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 1859 | func->add_arg( "int", "num" ); |
| 1851 | // | 1860 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 1852 | // // add openMouse() | ||
| 1853 | // func = make_new_mfun( "int", "openMouse", HidIn_open_mouse ); | ||
| 1854 | // func->add_arg( "int", "num" ); | ||
| 1855 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1856 | // | ||
| 1857 | // // add openKeyboard() | ||
| 1858 | // func = make_new_mfun( "int", "openKeyboard", HidIn_open_keyboard ); | ||
| 1859 | // func->add_arg( "int", "num" ); | ||
| 1860 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1861 | // | ||
| 1862 | // // add openTiltSensor() | ||
| 1863 | // func = make_new_mfun( "int", "openTiltSensor", HidIn_open_tiltsensor ); | ||
| 1864 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1865 | // | ||
| 1866 | // // add good() | ||
| 1867 | // func = make_new_mfun( "int", "good", HidIn_good ); | ||
| 1868 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1869 | // | ||
| 1870 | // // add num() | ||
| 1871 | // func = make_new_mfun( "int", "num", HidIn_num ); | ||
| 1872 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1873 | // | ||
| 1874 | // // add name() | ||
| 1875 | // func = make_new_mfun( "string", "name", HidIn_name ); | ||
| 1876 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1877 | // | ||
| 1878 | // // add printerr() | ||
| 1879 | // func = make_new_mfun( "void", "printerr", HidIn_printerr ); | ||
| 1880 | // func->add_arg( "int", "print_or_not" ); | ||
| 1881 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1882 | // | ||
| 1883 | // // add recv() | ||
| 1884 | // func = make_new_mfun( "int", "recv", HidIn_recv ); | ||
| 1885 | // func->add_arg( "HidMsg", "msg" ); | ||
| 1886 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1887 | // | ||
| 1888 | // // add read() | ||
| 1889 | // func = make_new_mfun( "int", "read", HidIn_read ); | ||
| 1890 | // func->add_arg( "int", "type" ); | ||
| 1891 | // func->add_arg( "int", "which" ); | ||
| 1892 | // func->add_arg( "HidMsg", "msg" ); | ||
| 1893 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1894 | // | ||
| 1895 | // // add send() | ||
| 1896 | // func = make_new_mfun( "int", "send", HidIn_send ); | ||
| 1897 | // func->add_arg( "HidMsg", "msg" ); | ||
| 1898 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1899 | // | ||
| 1900 | // // add can_wait() | ||
| 1901 | // func = make_new_mfun( "int", "can_wait", HidIn_can_wait ); | ||
| 1902 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1903 | // | ||
| 1904 | // // add readTiltSensor() | ||
| 1905 | // func = make_new_sfun( "int[]", "readTiltSensor", HidIn_read_tilt_sensor ); | ||
| 1906 | // if( !type_engine_import_sfun( env, func ) ) goto error; | ||
| 1907 | // | ||
| 1908 | // // add globalTiltPollRate() | ||
| 1909 | // func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_ctrl_tiltPollRate ); | ||
| 1910 | // func->add_arg( "dur", "d" ); | ||
| 1911 | // if( !type_engine_import_sfun( env, func ) ) goto error; | ||
| 1912 | // | ||
| 1913 | // // add globalTiltPollRate() | ||
| 1914 | // func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_cget_tiltPollRate ); | ||
| 1915 | // if( !type_engine_import_sfun( env, func ) ) goto error; | ||
| 1916 | // | ||
| 1917 | // // add startCursorTrack() | ||
| 1918 | // func = make_new_sfun( "int", "startCursorTrack", HidIn_start_cursor_track ); | ||
| 1919 | // if( !type_engine_import_sfun( env, func ) ) goto error; | ||
| 1920 | // | ||
| 1921 | // // add stopCursorTrack() | ||
| 1922 | // func = make_new_sfun( "int", "stopCursorTrack", HidIn_stop_cursor_track ); | ||
| 1923 | // if( !type_engine_import_sfun( env, func ) ) goto error; | ||
| 1924 | // | ||
| 1925 | // // add member variable | ||
| 1926 | // HidIn_offset_data = type_engine_import_mvar( env, "int", "@Hid_data", FALSE ); | ||
| 1927 | // if( HidIn_offset_data == CK_INVALID_OFFSET ) goto error; | ||
| 1928 | // | ||
| 1929 | // // add static member variable joystick | ||
| 1930 | // if( type_engine_import_svar( env, "int", "JOYSTICK", TRUE, | ||
| 1931 | // ( t_CKUINT ) &CK_HID_DEV_JOYSTICK ) == FALSE ) | ||
| 1932 | // goto error; | ||
| 1933 | // | ||
| 1934 | // // add static member variable keyboard | ||
| 1935 | // if( type_engine_import_svar( env, "int", "KEYBOARD", TRUE, | ||
| 1936 | // ( t_CKUINT ) &CK_HID_DEV_KEYBOARD ) == FALSE ) | ||
| 1937 | // goto error; | ||
| 1938 | // | ||
| 1939 | // // add static member variable mouse | ||
| 1940 | // if( type_engine_import_svar( env, "int", "MOUSE", TRUE, | ||
| 1941 | // ( t_CKUINT ) &CK_HID_DEV_MOUSE ) == FALSE ) | ||
| 1942 | // goto error; | ||
| 1943 | // | ||
| 1944 | // // add static member variable wii_remote | ||
| 1945 | // if( type_engine_import_svar( env, "int", "WII_REMOTE", TRUE, | ||
| 1946 | // ( t_CKUINT ) &CK_HID_DEV_WIIREMOTE ) == FALSE ) | ||
| 1947 | // goto error; | ||
| 1948 | // | ||
| 1949 | // // add static member variable wii_remote | ||
| 1950 | // if( type_engine_import_svar( env, "int", "TILT_SENSOR", TRUE, | ||
| 1951 | // ( t_CKUINT ) &CK_HID_DEV_TILTSENSOR ) == FALSE ) | ||
| 1952 | // goto error; | ||
| 1953 | // | ||
| 1954 | // // add static member variable tablet | ||
| 1955 | // if( type_engine_import_svar( env, "int", "TABLET", TRUE, | ||
| 1956 | // ( t_CKUINT ) &CK_HID_DEV_TABLET ) == FALSE ) | ||
| 1957 | // goto error; | ||
| 1958 | // | ||
| 1959 | // // add static member variable axisMotion | ||
| 1960 | // if( type_engine_import_svar( env, "int", "AXIS_MOTION", TRUE, | ||
| 1961 | // ( t_CKUINT ) &CK_HID_JOYSTICK_AXIS ) == FALSE ) | ||
| 1962 | // goto error; | ||
| 1963 | // | ||
| 1964 | // // add static member variable buttonDown | ||
| 1965 | // if( type_engine_import_svar( env, "int", "BUTTON_DOWN", TRUE, | ||
| 1966 | // ( t_CKUINT ) &CK_HID_BUTTON_DOWN ) == FALSE ) | ||
| 1967 | // goto error; | ||
| 1968 | // | ||
| 1969 | // // add static member variable buttonUp | ||
| 1970 | // if( type_engine_import_svar( env, "int", "BUTTON_UP", TRUE, | ||
| 1971 | // ( t_CKUINT ) &CK_HID_BUTTON_UP ) == FALSE ) | ||
| 1972 | // goto error; | ||
| 1973 | // | ||
| 1974 | // // add static member variable joystickHat | ||
| 1975 | // if( type_engine_import_svar( env, "int", "JOYSTICK_HAT", TRUE, | ||
| 1976 | // ( t_CKUINT ) &CK_HID_JOYSTICK_HAT ) == FALSE ) | ||
| 1977 | // goto error; | ||
| 1978 | // | ||
| 1979 | // // add static member variable JOYSTICK_BALL | ||
| 1980 | // if( type_engine_import_svar( env, "int", "JOYSTICK_BALL", TRUE, | ||
| 1981 | // ( t_CKUINT ) &CK_HID_JOYSTICK_BALL ) == FALSE ) | ||
| 1982 | // goto error; | ||
| 1983 | // | ||
| 1984 | // // add static member variable mouseMotion | ||
| 1985 | // if( type_engine_import_svar( env, "int", "MOUSE_MOTION", TRUE, | ||
| 1986 | // ( t_CKUINT ) &CK_HID_MOUSE_MOTION ) == FALSE ) | ||
| 1987 | // goto error; | ||
| 1988 | // | ||
| 1989 | // // add static member variable mouseWheel | ||
| 1990 | // if( type_engine_import_svar( env, "int", "MOUSE_WHEEL", TRUE, | ||
| 1991 | // ( t_CKUINT ) &CK_HID_MOUSE_WHEEL ) == FALSE ) | ||
| 1992 | // goto error; | ||
| 1993 | // | ||
| 1994 | // // add static member variable DEVICE_CONNECTED | ||
| 1995 | // if( type_engine_import_svar( env, "int", "DEVICE_CONNECTED", TRUE, | ||
| 1996 | // ( t_CKUINT ) &CK_HID_DEVICE_CONNECTED ) == FALSE ) | ||
| 1997 | // goto error; | ||
| 1998 | // | ||
| 1999 | // // add static member variable DEVICE_DISCONNECTED | ||
| 2000 | // if( type_engine_import_svar( env, "int", "DEVICE_DISCONNECTED", TRUE, | ||
| 2001 | // ( t_CKUINT ) &CK_HID_DEVICE_DISCONNECTED ) == FALSE ) | ||
| 2002 | // goto error; | ||
| 2003 | // | ||
| 2004 | // // add static member variable ACCELEROMETER | ||
| 2005 | // if( type_engine_import_svar( env, "int", "ACCELEROMETER", TRUE, | ||
| 2006 | // ( t_CKUINT ) &CK_HID_ACCELEROMETER ) == FALSE ) | ||
| 2007 | // goto error; | ||
| 2008 | // | ||
| 2009 | // // add static member variable LED | ||
| 2010 | // if( type_engine_import_svar( env, "int", "LED", TRUE, | ||
| 2011 | // ( t_CKUINT ) &CK_HID_LED ) == FALSE ) | ||
| 2012 | // goto error; | ||
| 2013 | // | ||
| 2014 | // // add static member variable LED | ||
| 2015 | // if( type_engine_import_svar( env, "int", "FORCE_FEEDBACK", TRUE, | ||
| 2016 | // ( t_CKUINT ) &CK_HID_FORCE_FEEDBACK ) == FALSE ) | ||
| 2017 | // goto error; | ||
| 2018 | // | ||
| 2019 | // // end the class import | ||
| 2020 | // type_engine_import_class_end( env ); | ||
| 2021 | // | ||
| 2022 | // /* | ||
| 2023 | // // init base class | ||
| 2024 | // if( !type_engine_import_class_begin( env, "HidOut", "Object", | ||
| 2025 | // env->global(), HidOut_ctor ) ) | ||
| 2026 | // return FALSE; | ||
| 2027 | // | ||
| 2028 | // // add open() | ||
| 2029 | // func = make_new_mfun( "int", "open", HidOut_open ); | ||
| 2030 | // func->add_arg( "int", "port" ); | ||
| 2031 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2032 | // | ||
| 2033 | // // add good() | ||
| 2034 | // func = make_new_mfun( "int", "good", HidOut_good ); | ||
| 2035 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2036 | // | ||
| 2037 | // // add num() | ||
| 2038 | // func = make_new_mfun( "int", "num", HidOut_num ); | ||
| 2039 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2040 | // | ||
| 2041 | // // add name() | ||
| 2042 | // func = make_new_mfun( "string", "name", HidOut_name ); | ||
| 2043 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2044 | // | ||
| 2045 | // // add printerr() | ||
| 2046 | // func = make_new_mfun( "void", "printerr", HidOut_printerr ); | ||
| 2047 | // func->add_arg( "int", "print_or_not" ); | ||
| 2048 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2049 | // | ||
| 2050 | // // add send() | ||
| 2051 | // func = make_new_mfun( "int", "send", HidOut_send ); | ||
| 2052 | // func->add_arg( "HidMsg", "msg" ); | ||
| 2053 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2054 | // | ||
| 2055 | // // add member variable | ||
| 2056 | // HidOut_offset_data = type_engine_import_mvar( env, "int", "@HidOut_data", FALSE ); | ||
| 2057 | // if( HidOut_offset_data == CK_INVALID_OFFSET ) goto error; | ||
| 2058 | // | ||
| 2059 | // // end the class import | ||
| 2060 | // type_engine_import_class_end( env ); | ||
| 2061 | // */ | ||
| 2062 | // return TRUE; | ||
| 2063 | // | ||
| 2064 | //error: | ||
| 2065 | // | ||
| 2066 | // // end the class import | ||
| 2067 | // type_engine_import_class_end( env ); | ||
| 2068 | // | ||
| 2069 | // return FALSE; | ||
| 2070 | //} | ||
| 2071 | 1861 | ||
| 1862 | // add openMouse() | ||
| 1863 | func = make_new_mfun( "int", "openMouse", HidIn_open_mouse ); | ||
| 1864 | func->add_arg( "int", "num" ); | ||
| 1865 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1866 | |||
| 1867 | // add openKeyboard() | ||
| 1868 | func = make_new_mfun( "int", "openKeyboard", HidIn_open_keyboard ); | ||
| 1869 | func->add_arg( "int", "num" ); | ||
| 1870 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1871 | |||
| 1872 | // add openTiltSensor() | ||
| 1873 | func = make_new_mfun( "int", "openTiltSensor", HidIn_open_tiltsensor ); | ||
| 1874 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1875 | |||
| 1876 | // add good() | ||
| 1877 | func = make_new_mfun( "int", "good", HidIn_good ); | ||
| 1878 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1879 | |||
| 1880 | // add num() | ||
| 1881 | func = make_new_mfun( "int", "num", HidIn_num ); | ||
| 1882 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1883 | |||
| 1884 | // add name() | ||
| 1885 | func = make_new_mfun( "string", "name", HidIn_name ); | ||
| 1886 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1887 | |||
| 1888 | // add printerr() | ||
| 1889 | func = make_new_mfun( "void", "printerr", HidIn_printerr ); | ||
| 1890 | func->add_arg( "int", "print_or_not" ); | ||
| 1891 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1892 | |||
| 1893 | // add recv() | ||
| 1894 | func = make_new_mfun( "int", "recv", HidIn_recv ); | ||
| 1895 | func->add_arg( "HidMsg", "msg" ); | ||
| 1896 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1897 | |||
| 1898 | // add read() | ||
| 1899 | func = make_new_mfun( "int", "read", HidIn_read ); | ||
| 1900 | func->add_arg( "int", "type" ); | ||
| 1901 | func->add_arg( "int", "which" ); | ||
| 1902 | func->add_arg( "HidMsg", "msg" ); | ||
| 1903 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1904 | |||
| 1905 | // add send() | ||
| 1906 | func = make_new_mfun( "int", "send", HidIn_send ); | ||
| 1907 | func->add_arg( "HidMsg", "msg" ); | ||
| 1908 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1909 | |||
| 1910 | // add can_wait() | ||
| 1911 | func = make_new_mfun( "int", "can_wait", HidIn_can_wait ); | ||
| 1912 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 1913 | |||
| 1914 | // add readTiltSensor() | ||
| 1915 | func = make_new_sfun( "int[]", "readTiltSensor", HidIn_read_tilt_sensor ); | ||
| 1916 | if( !type_engine_import_sfun( env, func ) ) goto error; | ||
| 1917 | |||
| 1918 | // add globalTiltPollRate() | ||
| 1919 | func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_ctrl_tiltPollRate ); | ||
| 1920 | func->add_arg( "dur", "d" ); | ||
| 1921 | if( !type_engine_import_sfun( env, func ) ) goto error; | ||
| 1922 | |||
| 1923 | // add globalTiltPollRate() | ||
| 1924 | func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_cget_tiltPollRate ); | ||
| 1925 | if( !type_engine_import_sfun( env, func ) ) goto error; | ||
| 1926 | |||
| 1927 | // add startCursorTrack() | ||
| 1928 | func = make_new_sfun( "int", "startCursorTrack", HidIn_start_cursor_track ); | ||
| 1929 | if( !type_engine_import_sfun( env, func ) ) goto error; | ||
| 1930 | |||
| 1931 | // add stopCursorTrack() | ||
| 1932 | func = make_new_sfun( "int", "stopCursorTrack", HidIn_stop_cursor_track ); | ||
| 1933 | if( !type_engine_import_sfun( env, func ) ) goto error; | ||
| 1934 | |||
| 1935 | // add member variable | ||
| 1936 | HidIn_offset_data = type_engine_import_mvar( env, "int", "@Hid_data", FALSE ); | ||
| 1937 | if( HidIn_offset_data == CK_INVALID_OFFSET ) goto error; | ||
| 1938 | |||
| 1939 | // add static member variable joystick | ||
| 1940 | if( type_engine_import_svar( env, "int", "JOYSTICK", TRUE, | ||
| 1941 | ( t_CKUINT ) &CK_HID_DEV_JOYSTICK ) == FALSE ) | ||
| 1942 | goto error; | ||
| 1943 | |||
| 1944 | // add static member variable keyboard | ||
| 1945 | if( type_engine_import_svar( env, "int", "KEYBOARD", TRUE, | ||
| 1946 | ( t_CKUINT ) &CK_HID_DEV_KEYBOARD ) == FALSE ) | ||
| 1947 | goto error; | ||
| 1948 | |||
| 1949 | // add static member variable mouse | ||
| 1950 | if( type_engine_import_svar( env, "int", "MOUSE", TRUE, | ||
| 1951 | ( t_CKUINT ) &CK_HID_DEV_MOUSE ) == FALSE ) | ||
| 1952 | goto error; | ||
| 1953 | |||
| 1954 | // add static member variable wii_remote | ||
| 1955 | if( type_engine_import_svar( env, "int", "WII_REMOTE", TRUE, | ||
| 1956 | ( t_CKUINT ) &CK_HID_DEV_WIIREMOTE ) == FALSE ) | ||
| 1957 | goto error; | ||
| 1958 | |||
| 1959 | // add static member variable wii_remote | ||
| 1960 | if( type_engine_import_svar( env, "int", "TILT_SENSOR", TRUE, | ||
| 1961 | ( t_CKUINT ) &CK_HID_DEV_TILTSENSOR ) == FALSE ) | ||
| 1962 | goto error; | ||
| 1963 | |||
| 1964 | // add static member variable tablet | ||
| 1965 | if( type_engine_import_svar( env, "int", "TABLET", TRUE, | ||
| 1966 | ( t_CKUINT ) &CK_HID_DEV_TABLET ) == FALSE ) | ||
| 1967 | goto error; | ||
| 1968 | |||
| 1969 | // add static member variable axisMotion | ||
| 1970 | if( type_engine_import_svar( env, "int", "AXIS_MOTION", TRUE, | ||
| 1971 | ( t_CKUINT ) &CK_HID_JOYSTICK_AXIS ) == FALSE ) | ||
| 1972 | goto error; | ||
| 1973 | |||
| 1974 | // add static member variable buttonDown | ||
| 1975 | if( type_engine_import_svar( env, "int", "BUTTON_DOWN", TRUE, | ||
| 1976 | ( t_CKUINT ) &CK_HID_BUTTON_DOWN ) == FALSE ) | ||
| 1977 | goto error; | ||
| 1978 | |||
| 1979 | // add static member variable buttonUp | ||
| 1980 | if( type_engine_import_svar( env, "int", "BUTTON_UP", TRUE, | ||
| 1981 | ( t_CKUINT ) &CK_HID_BUTTON_UP ) == FALSE ) | ||
| 1982 | goto error; | ||
| 1983 | |||
| 1984 | // add static member variable joystickHat | ||
| 1985 | if( type_engine_import_svar( env, "int", "JOYSTICK_HAT", TRUE, | ||
| 1986 | ( t_CKUINT ) &CK_HID_JOYSTICK_HAT ) == FALSE ) | ||
| 1987 | goto error; | ||
| 1988 | |||
| 1989 | // add static member variable JOYSTICK_BALL | ||
| 1990 | if( type_engine_import_svar( env, "int", "JOYSTICK_BALL", TRUE, | ||
| 1991 | ( t_CKUINT ) &CK_HID_JOYSTICK_BALL ) == FALSE ) | ||
| 1992 | goto error; | ||
| 1993 | |||
| 1994 | // add static member variable mouseMotion | ||
| 1995 | if( type_engine_import_svar( env, "int", "MOUSE_MOTION", TRUE, | ||
| 1996 | ( t_CKUINT ) &CK_HID_MOUSE_MOTION ) == FALSE ) | ||
| 1997 | goto error; | ||
| 1998 | |||
| 1999 | // add static member variable mouseWheel | ||
| 2000 | if( type_engine_import_svar( env, "int", "MOUSE_WHEEL", TRUE, | ||
| 2001 | ( t_CKUINT ) &CK_HID_MOUSE_WHEEL ) == FALSE ) | ||
| 2002 | goto error; | ||
| 2003 | |||
| 2004 | // add static member variable DEVICE_CONNECTED | ||
| 2005 | if( type_engine_import_svar( env, "int", "DEVICE_CONNECTED", TRUE, | ||
| 2006 | ( t_CKUINT ) &CK_HID_DEVICE_CONNECTED ) == FALSE ) | ||
| 2007 | goto error; | ||
| 2008 | |||
| 2009 | // add static member variable DEVICE_DISCONNECTED | ||
| 2010 | if( type_engine_import_svar( env, "int", "DEVICE_DISCONNECTED", TRUE, | ||
| 2011 | ( t_CKUINT ) &CK_HID_DEVICE_DISCONNECTED ) == FALSE ) | ||
| 2012 | goto error; | ||
| 2013 | |||
| 2014 | // add static member variable ACCELEROMETER | ||
| 2015 | if( type_engine_import_svar( env, "int", "ACCELEROMETER", TRUE, | ||
| 2016 | ( t_CKUINT ) &CK_HID_ACCELEROMETER ) == FALSE ) | ||
| 2017 | goto error; | ||
| 2018 | |||
| 2019 | // add static member variable LED | ||
| 2020 | if( type_engine_import_svar( env, "int", "LED", TRUE, | ||
| 2021 | ( t_CKUINT ) &CK_HID_LED ) == FALSE ) | ||
| 2022 | goto error; | ||
| 2023 | |||
| 2024 | // add static member variable LED | ||
| 2025 | if( type_engine_import_svar( env, "int", "FORCE_FEEDBACK", TRUE, | ||
| 2026 | ( t_CKUINT ) &CK_HID_FORCE_FEEDBACK ) == FALSE ) | ||
| 2027 | goto error; | ||
| 2028 | |||
| 2029 | // end the class import | ||
| 2030 | type_engine_import_class_end( env ); | ||
| 2031 | |||
| 2032 | /* | ||
| 2033 | // init base class | ||
| 2034 | if( !type_engine_import_class_begin( env, "HidOut", "Object", | ||
| 2035 | env->global(), HidOut_ctor ) ) | ||
| 2036 | return FALSE; | ||
| 2037 | |||
| 2038 | // add open() | ||
| 2039 | func = make_new_mfun( "int", "open", HidOut_open ); | ||
| 2040 | func->add_arg( "int", "port" ); | ||
| 2041 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2042 | |||
| 2043 | // add good() | ||
| 2044 | func = make_new_mfun( "int", "good", HidOut_good ); | ||
| 2045 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2046 | |||
| 2047 | // add num() | ||
| 2048 | func = make_new_mfun( "int", "num", HidOut_num ); | ||
| 2049 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2050 | |||
| 2051 | // add name() | ||
| 2052 | func = make_new_mfun( "string", "name", HidOut_name ); | ||
| 2053 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2054 | |||
| 2055 | // add printerr() | ||
| 2056 | func = make_new_mfun( "void", "printerr", HidOut_printerr ); | ||
| 2057 | func->add_arg( "int", "print_or_not" ); | ||
| 2058 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2059 | |||
| 2060 | // add send() | ||
| 2061 | func = make_new_mfun( "int", "send", HidOut_send ); | ||
| 2062 | func->add_arg( "HidMsg", "msg" ); | ||
| 2063 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 2064 | |||
| 2065 | // add member variable | ||
| 2066 | HidOut_offset_data = type_engine_import_mvar( env, "int", "@HidOut_data", FALSE ); | ||
| 2067 | if( HidOut_offset_data == CK_INVALID_OFFSET ) goto error; | ||
| 2068 | |||
| 2069 | // end the class import | ||
| 2070 | type_engine_import_class_end( env ); | ||
| 2071 | */ | ||
| 2072 | return TRUE; | ||
| 2073 | |||
| 2074 | error: | ||
| 2075 | |||
| 2076 | // end the class import | ||
| 2077 | type_engine_import_class_end( env ); | ||
| 2078 | |||
| 2079 | return FALSE; | ||
| 2080 | } | ||
| 2081 | #endif | ||
| 2072 | 2082 | ||
| 2073 | 2083 | ||
| 2074 | 2084 | ||
| @@ -2962,313 +2972,319 @@ CK_DLL_SFUN( io_newline ) · 887 unmodified lines | |||
| 2962 | } | 2972 | } |
| 2963 | 2973 | ||
| 2964 | 2974 | ||
| 2975 | |||
| 2976 | |||
| 2977 | #ifndef __DISABLE_FILEIO__ | ||
| 2965 | //----------------------------------------------------------------------------- | 2978 | //----------------------------------------------------------------------------- |
| 2966 | // FileIO API | 2979 | // FileIO API |
| 2967 | //----------------------------------------------------------------------------- | 2980 | //----------------------------------------------------------------------------- |
| 2968 | //CK_DLL_CTOR( fileio_ctor ) | 2981 | CK_DLL_CTOR( fileio_ctor ) |
| 2969 | //{ } | 2982 | { } |
| 2970 | // | 2983 | |
| 2971 | //CK_DLL_DTOR( fileio_dtor ) | 2984 | CK_DLL_DTOR( fileio_dtor ) |
| 2972 | //{ } | 2985 | { } |
| 2973 | // | 2986 | |
| 2974 | //CK_DLL_MFUN( fileio_open ) | 2987 | CK_DLL_MFUN( fileio_open ) |
| 2975 | //{ | 2988 | { |
| 2976 | // std::string filename = GET_NEXT_STRING(ARGS)->str(); | 2989 | std::string filename = GET_NEXT_STRING(ARGS)->str(); |
| 2977 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 2990 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 2978 | // t_CKINT default_flags = | 2991 | t_CKINT default_flags = |
| 2979 | // Chuck_IO_File::FLAG_READ_WRITE | Chuck_IO_File::TYPE_ASCII; | 2992 | Chuck_IO_File::FLAG_READ_WRITE | Chuck_IO_File::TYPE_ASCII; |
| 2980 | // | 2993 | |
| 2981 | // RETURN->v_int = f->open(filename, default_flags); | 2994 | RETURN->v_int = f->open(filename, default_flags); |
| 2982 | //} | 2995 | } |
| 2983 | // | 2996 | |
| 2984 | //CK_DLL_MFUN( fileio_openflags ) | 2997 | CK_DLL_MFUN( fileio_openflags ) |
| 2985 | //{ | 2998 | { |
| 2986 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 2999 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 2987 | // std::string filename = GET_NEXT_STRING(ARGS)->str(); | 3000 | std::string filename = GET_NEXT_STRING(ARGS)->str(); |
| 2988 | // t_CKINT flags = GET_NEXT_INT(ARGS); | 3001 | t_CKINT flags = GET_NEXT_INT(ARGS); |
| 2989 | // | 3002 | |
| 2990 | // RETURN->v_int = f->open(filename, flags); | 3003 | RETURN->v_int = f->open(filename, flags); |
| 2991 | //} | 3004 | } |
| 2992 | // | 3005 | |
| 2993 | //CK_DLL_MFUN( fileio_close ) | 3006 | CK_DLL_MFUN( fileio_close ) |
| 2994 | //{ | 3007 | { |
| 2995 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3008 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 2996 | // f->close(); | 3009 | f->close(); |
| 2997 | //} | 3010 | } |
| 2998 | // | 3011 | |
| 2999 | //CK_DLL_MFUN( fileio_good ) | 3012 | CK_DLL_MFUN( fileio_good ) |
| 3000 | //{ | 3013 | { |
| 3001 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3014 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3002 | // RETURN->v_int = f->good(); | 3015 | RETURN->v_int = f->good(); |
| 3003 | //} | 3016 | } |
| 3004 | // | 3017 | |
| 3005 | //CK_DLL_MFUN( fileio_flush ) | 3018 | CK_DLL_MFUN( fileio_flush ) |
| 3006 | //{ | 3019 | { |
| 3007 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3020 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3008 | // f->flush(); | 3021 | f->flush(); |
| 3009 | //} | 3022 | } |
| 3010 | // | 3023 | |
| 3011 | //CK_DLL_MFUN( fileio_getmode ) | 3024 | CK_DLL_MFUN( fileio_getmode ) |
| 3012 | //{ | 3025 | { |
| 3013 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3026 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3014 | // RETURN->v_int = f->mode(); | 3027 | RETURN->v_int = f->mode(); |
| 3015 | //} | 3028 | } |
| 3016 | // | 3029 | |
| 3017 | //CK_DLL_MFUN( fileio_setmode ) | 3030 | CK_DLL_MFUN( fileio_setmode ) |
| 3018 | //{ | 3031 | { |
| 3019 | // t_CKINT flag = GET_NEXT_INT(ARGS); | 3032 | t_CKINT flag = GET_NEXT_INT(ARGS); |
| 3020 | // | 3033 | |
| 3021 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3034 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3022 | // f->mode( flag ); | 3035 | f->mode( flag ); |
| 3023 | // RETURN->v_int = 0; | 3036 | RETURN->v_int = 0; |
| 3024 | //} | 3037 | } |
| 3025 | // | 3038 | |
| 3026 | //CK_DLL_MFUN( fileio_size ) | 3039 | CK_DLL_MFUN( fileio_size ) |
| 3027 | //{ | 3040 | { |
| 3028 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3041 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3029 | // RETURN->v_int = f->size(); | 3042 | RETURN->v_int = f->size(); |
| 3030 | //} | 3043 | } |
| 3031 | // | 3044 | |
| 3032 | //CK_DLL_MFUN( fileio_seek ) | 3045 | CK_DLL_MFUN( fileio_seek ) |
| 3033 | //{ | 3046 | { |
| 3034 | // t_CKINT pos = GET_NEXT_INT(ARGS); | 3047 | t_CKINT pos = GET_NEXT_INT(ARGS); |
| 3035 | // | 3048 | |
| 3036 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3049 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3037 | // f->seek(pos); | 3050 | f->seek(pos); |
| 3038 | //} | 3051 | } |
| 3039 | // | 3052 | |
| 3040 | //CK_DLL_MFUN( fileio_tell ) | 3053 | CK_DLL_MFUN( fileio_tell ) |
| 3041 | //{ | 3054 | { |
| 3042 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3055 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3043 | // RETURN->v_int = f->tell(); | 3056 | RETURN->v_int = f->tell(); |
| 3044 | //} | 3057 | } |
| 3045 | // | 3058 | |
| 3046 | //CK_DLL_MFUN( fileio_isdir ) | 3059 | CK_DLL_MFUN( fileio_isdir ) |
| 3047 | //{ | 3060 | { |
| 3048 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3061 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3049 | // RETURN->v_int = f->isDir(); | 3062 | RETURN->v_int = f->isDir(); |
| 3050 | //} | 3063 | } |
| 3051 | // | 3064 | |
| 3052 | //CK_DLL_MFUN( fileio_dirlist ) | 3065 | CK_DLL_MFUN( fileio_dirlist ) |
| 3053 | //{ | 3066 | { |
| 3054 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3067 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3055 | // Chuck_Array4 * a = f->dirList(); | 3068 | Chuck_Array4 * a = f->dirList(); |
| 3056 | // RETURN->v_object = a; | 3069 | RETURN->v_object = a; |
| 3057 | //} | 3070 | } |
| 3058 | // | 3071 | |
| 3059 | ///* | 3072 | /* |
| 3060 | //CK_DLL_MFUN( fileio_read ) | 3073 | CK_DLL_MFUN( fileio_read ) |
| 3061 | //{ | 3074 | { |
| 3062 | // t_CKINT len = GET_NEXT_INT(ARGS); | 3075 | t_CKINT len = GET_NEXT_INT(ARGS); |
| 3063 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3076 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3064 | // | 3077 | |
| 3065 | // Chuck_String * s = f->read( len ); | 3078 | Chuck_String * s = f->read( len ); |
| 3066 | // RETURN->v_object = s; | 3079 | RETURN->v_object = s; |
| 3067 | //} | 3080 | } |
| 3068 | //*/ | 3081 | */ |
| 3069 | // | 3082 | |
| 3070 | //CK_DLL_MFUN( fileio_readline ) | 3083 | CK_DLL_MFUN( fileio_readline ) |
| 3071 | //{ | 3084 | { |
| 3072 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3085 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3073 | // Chuck_String * ret = f->readLine(); | 3086 | Chuck_String * ret = f->readLine(); |
| 3074 | // RETURN->v_object = ret; | 3087 | RETURN->v_object = ret; |
| 3075 | //} | 3088 | } |
| 3076 | // | 3089 | |
| 3077 | //CK_DLL_MFUN( fileio_readint ) | 3090 | CK_DLL_MFUN( fileio_readint ) |
| 3078 | //{ | 3091 | { |
| 3079 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3092 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3080 | // t_CKINT defaultflags = Chuck_IO::INT32; | 3093 | t_CKINT defaultflags = Chuck_IO::INT32; |
| 3081 | // | 3094 | |
| 3082 | // /* (ATODO: doesn't look like asynchronous reading will work) | 3095 | /* (ATODO: doesn't look like asynchronous reading will work) |
| 3083 | // if (f->mode() == Chuck_IO::MODE_ASYNC) | 3096 | if (f->mode() == Chuck_IO::MODE_ASYNC) |
| 3084 | // { | 3097 | { |
| 3085 | // // set up arguments | 3098 | // set up arguments |
| 3086 | // Chuck_IO::async_args *args = new Chuck_IO::async_args; | 3099 | Chuck_IO::async_args *args = new Chuck_IO::async_args; |
| 3087 | // args->RETURN = (void *)RETURN; | 3100 | args->RETURN = (void *)RETURN; |
| 3088 | // args->fileio_obj = f; | 3101 | args->fileio_obj = f; |
| 3089 | // args->intArg = defaultflags; | 3102 | args->intArg = defaultflags; |
| 3090 | // // set shred to wait for I/O completion | 3103 | // set shred to wait for I/O completion |
| 3091 | // f->m_asyncEvent->wait( SHRED, SHRED->vm_ref ); | 3104 | f->m_asyncEvent->wait( SHRED, SHRED->vm_ref ); |
| 3092 | // // start thread | 3105 | // start thread |
| 3093 | // bool ret = f->m_thread->start( f->readInt_thread, (void *)args ); | 3106 | bool ret = f->m_thread->start( f->readInt_thread, (void *)args ); |
| 3094 | // if (!ret) { | 3107 | if (!ret) { |
| 3095 | // cerr << "m_thread->start failed; recreating m_thread" << endl; | 3108 | cerr << "m_thread->start failed; recreating m_thread" << endl; |
| 3096 | // delete f->m_thread; | 3109 | delete f->m_thread; |
| 3097 | // f->m_thread = new XThread; | 3110 | f->m_thread = new XThread; |
| 3098 | // ret = f->m_thread->start( f->readInt_thread, (void *)args ); | 3111 | ret = f->m_thread->start( f->readInt_thread, (void *)args ); |
| 3099 | // if (!ret) { | 3112 | if (!ret) { |
| 3100 | // EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" ); | 3113 | EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" ); |
| 3101 | // } | 3114 | } |
| 3102 | // } | 3115 | } |
| 3103 | // } else {*/ | 3116 | } else {*/ |
| 3104 | // t_CKINT ret = f->readInt( defaultflags ); | 3117 | t_CKINT ret = f->readInt( defaultflags ); |
| 3105 | // RETURN->v_int = ret; | 3118 | RETURN->v_int = ret; |
| 3106 | // //} | 3119 | //} |
| 3107 | // // ATODO: Debug | 3120 | // ATODO: Debug |
| 3108 | // //sleep(1); | 3121 | //sleep(1); |
| 3109 | // //cerr << "fileio_readint exiting" << endl; | 3122 | //cerr << "fileio_readint exiting" << endl; |
| 3110 | //} | 3123 | } |
| 3111 | // | 3124 | |
| 3112 | //CK_DLL_MFUN( fileio_readintflags ) | 3125 | CK_DLL_MFUN( fileio_readintflags ) |
| 3113 | //{ | 3126 | { |
| 3114 | // t_CKINT flags = GET_NEXT_INT(ARGS); | 3127 | t_CKINT flags = GET_NEXT_INT(ARGS); |
| 3115 | // | 3128 | |
| 3116 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3129 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3117 | // t_CKINT ret = f->readInt( flags ); | 3130 | t_CKINT ret = f->readInt( flags ); |
| 3118 | // | 3131 | |
| 3119 | // RETURN->v_int = ret; | 3132 | RETURN->v_int = ret; |
| 3120 | //} | 3133 | } |
| 3121 | // | 3134 | |
| 3122 | //CK_DLL_MFUN( fileio_readfloat ) | 3135 | CK_DLL_MFUN( fileio_readfloat ) |
| 3123 | //{ | 3136 | { |
| 3124 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3137 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3125 | // t_CKFLOAT ret = f->readFloat(); | 3138 | t_CKFLOAT ret = f->readFloat(); |
| 3126 | // RETURN->v_float = ret; | 3139 | RETURN->v_float = ret; |
| 3127 | //} | 3140 | } |
| 3128 | // | 3141 | |
| 3129 | //CK_DLL_MFUN( fileio_eof ) | 3142 | CK_DLL_MFUN( fileio_eof ) |
| 3130 | //{ | 3143 | { |
| 3131 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3144 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3132 | // t_CKBOOL ret = f->eof(); | 3145 | t_CKBOOL ret = f->eof(); |
| 3133 | // RETURN->v_int = ret; | 3146 | RETURN->v_int = ret; |
| 3134 | //} | 3147 | } |
| 3135 | // | 3148 | |
| 3136 | //CK_DLL_MFUN( fileio_more ) | 3149 | CK_DLL_MFUN( fileio_more ) |
| 3137 | //{ | 3150 | { |
| 3138 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3151 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3139 | // t_CKBOOL ret = !f->eof(); | 3152 | t_CKBOOL ret = !f->eof(); |
| 3140 | // RETURN->v_int = ret; | 3153 | RETURN->v_int = ret; |
| 3141 | //} | 3154 | } |
| 3142 | // | 3155 | |
| 3143 | //CK_DLL_MFUN( fileio_writestring ) | 3156 | CK_DLL_MFUN( fileio_writestring ) |
| 3144 | //{ | 3157 | { |
| 3145 | // std::string val = GET_NEXT_STRING(ARGS)->str(); | 3158 | std::string val = GET_NEXT_STRING(ARGS)->str(); |
| 3146 | // | 3159 | |
| 3147 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3160 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3148 | // if (f->mode() == Chuck_IO::MODE_ASYNC) | 3161 | if (f->mode() == Chuck_IO::MODE_ASYNC) |
| 3149 | // { | 3162 | { |
| 3150 | // // set up arguments | 3163 | // set up arguments |
| 3151 | // Chuck_IO::async_args *args = new Chuck_IO::async_args; | 3164 | Chuck_IO::async_args *args = new Chuck_IO::async_args; |
| 3152 | // args->RETURN = (void *)RETURN; | 3165 | args->RETURN = (void *)RETURN; |
| 3153 | // args->fileio_obj = f; | 3166 | args->fileio_obj = f; |
| 3154 | // args->stringArg = std::string(val); | 3167 | args->stringArg = std::string(val); |
| 3155 | // // set shred to wait for I/O completion | 3168 | // set shred to wait for I/O completion |
| 3156 | // assert( SHRED != NULL ); | 3169 | assert( SHRED != NULL ); |
| 3157 | // f->m_asyncEvent->wait( SHRED, SHRED->vm_ref ); | 3170 | f->m_asyncEvent->wait( SHRED, SHRED->vm_ref ); |
| 3158 | // // start thread | 3171 | // start thread |
| 3159 | // bool ret = f->m_thread->start( f->writeStr_thread, (void *)args ); | 3172 | bool ret = f->m_thread->start( f->writeStr_thread, (void *)args ); |
| 3160 | // if (!ret) { | 3173 | if (!ret) { |
| 3161 | // // for some reason, the XThread object needs to be | 3174 | // for some reason, the XThread object needs to be |
| 3162 | // // deleted and reconstructed every time after call #375 | 3175 | // deleted and reconstructed every time after call #375 |
| 3163 | // delete f->m_thread; | 3176 | delete f->m_thread; |
| 3164 | // f->m_thread = new XThread; | 3177 | f->m_thread = new XThread; |
| 3165 | // ret = f->m_thread->start( f->writeStr_thread, (void *)args ); | 3178 | ret = f->m_thread->start( f->writeStr_thread, (void *)args ); |
| 3166 | // if (!ret) { | 3179 | if (!ret) { |
| 3167 | // EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" ); | 3180 | EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" ); |
| 3168 | // } | 3181 | } |
| 3169 | // } | 3182 | } |
| 3170 | // } else { | 3183 | } else { |
| 3171 | // f->write(val); | 3184 | f->write(val); |
| 3172 | // } | 3185 | } |
| 3173 | //} | 3186 | } |
| 3174 | // | 3187 | |
| 3175 | //CK_DLL_MFUN( fileio_writeint ) | 3188 | CK_DLL_MFUN( fileio_writeint ) |
| 3176 | //{ | 3189 | { |
| 3177 | // t_CKINT val = GET_NEXT_INT(ARGS); | 3190 | t_CKINT val = GET_NEXT_INT(ARGS); |
| 3178 | // | 3191 | |
| 3179 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3192 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3180 | // if (f->mode() == Chuck_IO::MODE_ASYNC) | 3193 | if (f->mode() == Chuck_IO::MODE_ASYNC) |
| 3181 | // { | 3194 | { |
| 3182 | // // set up arguments | 3195 | // set up arguments |
| 3183 | // Chuck_IO::async_args *args = new Chuck_IO::async_args; | 3196 | Chuck_IO::async_args *args = new Chuck_IO::async_args; |
| 3184 | // args->RETURN = (void *)RETURN; | 3197 | args->RETURN = (void *)RETURN; |
| 3185 | // args->fileio_obj = f; | 3198 | args->fileio_obj = f; |
| 3186 | // args->intArg = val; | 3199 | args->intArg = val; |
| 3187 | // // set shred to wait for I/O completion | 3200 | // set shred to wait for I/O completion |
| 3188 | // assert( SHRED != NULL ); | 3201 | assert( SHRED != NULL ); |
| 3189 | // f->m_asyncEvent->wait( SHRED, SHRED->vm_ref ); | 3202 | f->m_asyncEvent->wait( SHRED, SHRED->vm_ref ); |
| 3190 | // // start thread | 3203 | // start thread |
| 3191 | // bool ret = f->m_thread->start( f->writeInt_thread, (void *)args ); | 3204 | bool ret = f->m_thread->start( f->writeInt_thread, (void *)args ); |
| 3192 | // if (!ret) { | 3205 | if (!ret) { |
| 3193 | // // for some reason, the XThread object needs to be | 3206 | // for some reason, the XThread object needs to be |
| 3194 | // // deleted and reconstructed every time after call #375 | 3207 | // deleted and reconstructed every time after call #375 |
| 3195 | // delete f->m_thread; | 3208 | delete f->m_thread; |
| 3196 | // f->m_thread = new XThread; | 3209 | f->m_thread = new XThread; |
| 3197 | // ret = f->m_thread->start( f->writeInt_thread, (void *)args ); | 3210 | ret = f->m_thread->start( f->writeInt_thread, (void *)args ); |
| 3198 | // if (!ret) { | 3211 | if (!ret) { |
| 3199 | // EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" ); | 3212 | EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" ); |
| 3200 | // } | 3213 | } |
| 3201 | // } | 3214 | } |
| 3202 | // } else { | 3215 | } else { |
| 3203 | // f->write(val); | 3216 | f->write(val); |
| 3204 | // } | 3217 | } |
| 3205 | //} | 3218 | } |
| 3206 | // | 3219 | |
| 3207 | //CK_DLL_MFUN( fileio_writeintflags ) | 3220 | CK_DLL_MFUN( fileio_writeintflags ) |
| 3208 | //{ | 3221 | { |
| 3209 | // t_CKINT val = GET_NEXT_INT(ARGS); | 3222 | t_CKINT val = GET_NEXT_INT(ARGS); |
| 3210 | // t_CKINT flags = GET_NEXT_INT(ARGS); | 3223 | t_CKINT flags = GET_NEXT_INT(ARGS); |
| 3211 | // | 3224 | |
| 3212 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3225 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3213 | // if (f->mode() == Chuck_IO::MODE_ASYNC) | 3226 | if (f->mode() == Chuck_IO::MODE_ASYNC) |
| 3214 | // { | 3227 | { |
| 3215 | // // TODO: pass flags in args | 3228 | // TODO: pass flags in args |
| 3216 | // // set up arguments | 3229 | // set up arguments |
| 3217 | // Chuck_IO::async_args *args = new Chuck_IO::async_args; | 3230 | Chuck_IO::async_args *args = new Chuck_IO::async_args; |
| 3218 | // args->RETURN = (void *)RETURN; | 3231 | args->RETURN = (void *)RETURN; |
| 3219 | // args->fileio_obj = f; | 3232 | args->fileio_obj = f; |
| 3220 | // args->intArg = val; | 3233 | args->intArg = val; |
| 3221 | // // set shred to wait for I/O completion | 3234 | // set shred to wait for I/O completion |
| 3222 | // assert( SHRED != NULL ); | 3235 | assert( SHRED != NULL ); |
| 3223 | // f->m_asyncEvent->wait( SHRED, SHRED->vm_ref ); | 3236 | f->m_asyncEvent->wait( SHRED, SHRED->vm_ref ); |
| 3224 | // // start thread | 3237 | // start thread |
| 3225 | // bool ret = f->m_thread->start( f->writeInt_thread, (void *)args ); | 3238 | bool ret = f->m_thread->start( f->writeInt_thread, (void *)args ); |
| 3226 | // if (!ret) { | 3239 | if (!ret) { |
| 3227 | // // for some reason, the XThread object needs to be | 3240 | // for some reason, the XThread object needs to be |
| 3228 | // // deleted and reconstructed every time after call #375 | 3241 | // deleted and reconstructed every time after call #375 |
| 3229 | // delete f->m_thread; | 3242 | delete f->m_thread; |
| 3230 | // f->m_thread = new XThread; | 3243 | f->m_thread = new XThread; |
| 3231 | // ret = f->m_thread->start( f->writeInt_thread, (void *)args ); | 3244 | ret = f->m_thread->start( f->writeInt_thread, (void *)args ); |
| 3232 | // if (!ret) { | 3245 | if (!ret) { |
| 3233 | // EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" ); | 3246 | EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" ); |
| 3234 | // } | 3247 | } |
| 3235 | // } | 3248 | } |
| 3236 | // } else { | 3249 | } else { |
| 3237 | // f->write(val, flags); | 3250 | f->write(val, flags); |
| 3238 | // } | 3251 | } |
| 3239 | //} | 3252 | } |
| 3240 | // | 3253 | |
| 3241 | //CK_DLL_MFUN( fileio_writefloat ) | 3254 | CK_DLL_MFUN( fileio_writefloat ) |
| 3242 | //{ | 3255 | { |
| 3243 | // t_CKFLOAT val = GET_NEXT_FLOAT(ARGS); | 3256 | t_CKFLOAT val = GET_NEXT_FLOAT(ARGS); |
| 3244 | // | 3257 | |
| 3245 | // Chuck_IO_File * f = (Chuck_IO_File *)SELF; | 3258 | Chuck_IO_File * f = (Chuck_IO_File *)SELF; |
| 3246 | // if (f->mode() == Chuck_IO::MODE_ASYNC) | 3259 | if (f->mode() == Chuck_IO::MODE_ASYNC) |
| 3247 | // { | 3260 | { |
| 3248 | // // set up arguments | 3261 | // set up arguments |
| 3249 | // Chuck_IO::async_args *args = new Chuck_IO::async_args; | 3262 | Chuck_IO::async_args *args = new Chuck_IO::async_args; |
| 3250 | // args->RETURN = (void *)RETURN; | 3263 | args->RETURN = (void *)RETURN; |
| 3251 | // args->fileio_obj = f; | 3264 | args->fileio_obj = f; |
| 3252 | // args->floatArg = val; | 3265 | args->floatArg = val; |
| 3253 | // // set shred to wait for I/O completion | 3266 | // set shred to wait for I/O completion |
| 3254 | // assert( SHRED != NULL ); | 3267 | assert( SHRED != NULL ); |
| 3255 | // f->m_asyncEvent->wait( SHRED, SHRED->vm_ref ); | 3268 | f->m_asyncEvent->wait( SHRED, SHRED->vm_ref ); |
| 3256 | // // start thread | 3269 | // start thread |
| 3257 | // bool ret = f->m_thread->start( f->writeFloat_thread, (void *)args ); | 3270 | bool ret = f->m_thread->start( f->writeFloat_thread, (void *)args ); |
| 3258 | // if (!ret) { | 3271 | if (!ret) { |
| 3259 | // // for some reason, the XThread object needs to be | 3272 | // for some reason, the XThread object needs to be |
| 3260 | // // deleted and reconstructed every time after call #375 | 3273 | // deleted and reconstructed every time after call #375 |
| 3261 | // delete f->m_thread; | 3274 | delete f->m_thread; |
| 3262 | // f->m_thread = new XThread; | 3275 | f->m_thread = new XThread; |
| 3263 | // ret = f->m_thread->start( f->writeFloat_thread, (void *)args ); | 3276 | ret = f->m_thread->start( f->writeFloat_thread, (void *)args ); |
| 3264 | // if (!ret) { | 3277 | if (!ret) { |
| 3265 | // EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" ); | 3278 | EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" ); |
| 3266 | // } | 3279 | } |
| 3267 | // } | 3280 | } |
| 3268 | // } else { | 3281 | } else { |
| 3269 | // f->write(val); | 3282 | f->write(val); |
| 3270 | // } | 3283 | } |
| 3271 | //} | 3284 | } |
| 3285 | #endif | ||
| 3286 | |||
| 3287 | |||
| 3272 | 3288 | ||
| 3273 | 3289 | ||
| 3274 | //----------------------------------------------------------------------------- | 3290 | //----------------------------------------------------------------------------- |
| @@ -4336,403 +4352,409 @@ CK_DLL_MFUN( MidiOut_send ) · 1061 unmodified lines | |||
| 4336 | #endif // __DISABLE_MIDI__ | 4352 | #endif // __DISABLE_MIDI__ |
| 4337 | 4353 | ||
| 4338 | 4354 | ||
| 4339 | ////----------------------------------------------------------------------------- | 4355 | |
| 4340 | //// HidMsg API | 4356 | |
| 4341 | ////----------------------------------------------------------------------------- | 4357 | #ifndef __DISABLE_HID__ |
| 4342 | //CK_DLL_MFUN( HidMsg_is_axis_motion ) | 4358 | //----------------------------------------------------------------------------- |
| 4343 | //{ | 4359 | // HidMsg API |
| 4344 | // RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == | 4360 | //----------------------------------------------------------------------------- |
| 4345 | // CK_HID_JOYSTICK_AXIS ? 1 : 0 ); | 4361 | CK_DLL_MFUN( HidMsg_is_axis_motion ) |
| 4346 | //} | 4362 | { |
| 4347 | // | 4363 | RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == |
| 4348 | //CK_DLL_MFUN( HidMsg_is_button_down ) | 4364 | CK_HID_JOYSTICK_AXIS ? 1 : 0 ); |
| 4349 | //{ | 4365 | } |
| 4350 | // RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == | 4366 | |
| 4351 | // CK_HID_BUTTON_DOWN ? 1 : 0 ); | 4367 | CK_DLL_MFUN( HidMsg_is_button_down ) |
| 4352 | //} | 4368 | { |
| 4353 | // | 4369 | RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == |
| 4354 | //CK_DLL_MFUN( HidMsg_is_button_up ) | 4370 | CK_HID_BUTTON_DOWN ? 1 : 0 ); |
| 4355 | //{ | 4371 | } |
| 4356 | // RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == | 4372 | |
| 4357 | // CK_HID_BUTTON_UP ? 1 : 0 ); | 4373 | CK_DLL_MFUN( HidMsg_is_button_up ) |
| 4358 | //} | 4374 | { |
| 4359 | // | 4375 | RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == |
| 4360 | //CK_DLL_MFUN( HidMsg_is_mouse_motion ) | 4376 | CK_HID_BUTTON_UP ? 1 : 0 ); |
| 4361 | //{ | 4377 | } |
| 4362 | // RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == | 4378 | |
| 4363 | // CK_HID_MOUSE_MOTION ? 1 : 0 ); | 4379 | CK_DLL_MFUN( HidMsg_is_mouse_motion ) |
| 4364 | //} | 4380 | { |
| 4365 | // | 4381 | RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == |
| 4366 | //CK_DLL_MFUN( HidMsg_is_hat_motion ) | 4382 | CK_HID_MOUSE_MOTION ? 1 : 0 ); |
| 4367 | //{ | 4383 | } |
| 4368 | // RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == | 4384 | |
| 4369 | // CK_HID_JOYSTICK_HAT ? 1 : 0 ); | 4385 | CK_DLL_MFUN( HidMsg_is_hat_motion ) |
| 4370 | //} | 4386 | { |
| 4371 | // | 4387 | RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == |
| 4372 | //CK_DLL_MFUN( HidMsg_is_wheel_motion ) | 4388 | CK_HID_JOYSTICK_HAT ? 1 : 0 ); |
| 4373 | //{ | 4389 | } |
| 4374 | // RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == | 4390 | |
| 4375 | // CK_HID_MOUSE_WHEEL ? 1 : 0 ); | 4391 | CK_DLL_MFUN( HidMsg_is_wheel_motion ) |
| 4376 | //} | 4392 | { |
| 4377 | // | 4393 | RETURN->v_int = ( ( t_CKINT ) OBJ_MEMBER_INT( SELF, HidMsg_offset_type ) == |
| 4378 | ////----------------------------------------------------------------------------- | 4394 | CK_HID_MOUSE_WHEEL ? 1 : 0 ); |
| 4379 | //// HidIn API | 4395 | } |
| 4380 | ////----------------------------------------------------------------------------- | 4396 | |
| 4381 | //CK_DLL_CTOR( HidIn_ctor ) | 4397 | //----------------------------------------------------------------------------- |
| 4382 | //{ | 4398 | // HidIn API |
| 4383 | // HidIn * min = new HidIn; | 4399 | //----------------------------------------------------------------------------- |
| 4384 | // min->SELF = SELF; | 4400 | CK_DLL_CTOR( HidIn_ctor ) |
| 4385 | // OBJ_MEMBER_INT(SELF, HidIn_offset_data) = (t_CKINT)min; | 4401 | { |
| 4386 | //} | 4402 | HidIn * min = new HidIn; |
| 4387 | // | 4403 | min->SELF = SELF; |
| 4388 | //CK_DLL_DTOR( HidIn_dtor ) | 4404 | OBJ_MEMBER_INT(SELF, HidIn_offset_data) = (t_CKINT)min; |
| 4389 | //{ | 4405 | } |
| 4390 | // delete (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4406 | |
| 4391 | // OBJ_MEMBER_INT(SELF, HidIn_offset_data) = 0; | 4407 | CK_DLL_DTOR( HidIn_dtor ) |
| 4392 | //} | 4408 | { |
| 4393 | // | 4409 | delete (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4394 | //CK_DLL_MFUN( HidIn_open ) | 4410 | OBJ_MEMBER_INT(SELF, HidIn_offset_data) = 0; |
| 4395 | //{ | 4411 | } |
| 4396 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4412 | |
| 4397 | // t_CKINT type = GET_NEXT_INT(ARGS); | 4413 | CK_DLL_MFUN( HidIn_open ) |
| 4398 | // t_CKINT num = GET_NEXT_INT(ARGS); | 4414 | { |
| 4399 | // // CK_FPRINTF_STDERR( "HidIn_open %li %li\n", type, num ); | 4415 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4400 | // RETURN->v_int = min->open( SHRED->vm_ref, type, num ); | 4416 | t_CKINT type = GET_NEXT_INT(ARGS); |
| 4401 | //} | 4417 | t_CKINT num = GET_NEXT_INT(ARGS); |
| 4402 | // | 4418 | // CK_FPRINTF_STDERR( "HidIn_open %li %li\n", type, num ); |
| 4403 | //CK_DLL_MFUN( HidIn_open_named ) | 4419 | RETURN->v_int = min->open( SHRED->vm_ref, type, num ); |
| 4404 | //{ | 4420 | } |
| 4405 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4421 | |
| 4406 | // Chuck_String * name = GET_NEXT_STRING(ARGS); | 4422 | CK_DLL_MFUN( HidIn_open_named ) |
| 4407 | // std::string s = name->str(); | 4423 | { |
| 4408 | // RETURN->v_int = min->open( SHRED->vm_ref, s ); | 4424 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4409 | //} | 4425 | Chuck_String * name = GET_NEXT_STRING(ARGS); |
| 4410 | // | 4426 | std::string s = name->str(); |
| 4411 | //CK_DLL_MFUN( HidIn_open_joystick ) | 4427 | RETURN->v_int = min->open( SHRED->vm_ref, s ); |
| 4412 | //{ | 4428 | } |
| 4413 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4429 | |
| 4414 | // t_CKINT num = GET_NEXT_INT(ARGS); | 4430 | CK_DLL_MFUN( HidIn_open_joystick ) |
| 4415 | // RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_JOYSTICK, num ); | 4431 | { |
| 4416 | //} | 4432 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4417 | // | 4433 | t_CKINT num = GET_NEXT_INT(ARGS); |
| 4418 | //CK_DLL_MFUN( HidIn_open_mouse ) | 4434 | RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_JOYSTICK, num ); |
| 4419 | //{ | 4435 | } |
| 4420 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4436 | |
| 4421 | // t_CKINT num = GET_NEXT_INT(ARGS); | 4437 | CK_DLL_MFUN( HidIn_open_mouse ) |
| 4422 | // RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_MOUSE, num ); | 4438 | { |
| 4423 | //} | 4439 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4424 | // | 4440 | t_CKINT num = GET_NEXT_INT(ARGS); |
| 4425 | //CK_DLL_MFUN( HidIn_open_keyboard ) | 4441 | RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_MOUSE, num ); |
| 4426 | //{ | 4442 | } |
| 4427 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4443 | |
| 4428 | // t_CKINT num = GET_NEXT_INT(ARGS); | 4444 | CK_DLL_MFUN( HidIn_open_keyboard ) |
| 4429 | // RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_KEYBOARD, num ); | 4445 | { |
| 4430 | //} | 4446 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4431 | // | 4447 | t_CKINT num = GET_NEXT_INT(ARGS); |
| 4432 | //CK_DLL_MFUN( HidIn_open_tiltsensor ) | 4448 | RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_KEYBOARD, num ); |
| 4433 | //{ | 4449 | } |
| 4434 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4450 | |
| 4435 | // RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_TILTSENSOR, 0 ); | 4451 | CK_DLL_MFUN( HidIn_open_tiltsensor ) |
| 4436 | //} | 4452 | { |
| 4437 | // | 4453 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4438 | //CK_DLL_MFUN( HidIn_good ) | 4454 | RETURN->v_int = min->open( SHRED->vm_ref, CK_HID_DEV_TILTSENSOR, 0 ); |
| 4439 | //{ | 4455 | } |
| 4440 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4456 | |
| 4441 | // RETURN->v_int = (t_CKINT)min->good(); | 4457 | CK_DLL_MFUN( HidIn_good ) |
| 4442 | //} | 4458 | { |
| 4443 | // | 4459 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4444 | //CK_DLL_MFUN( HidIn_num ) | 4460 | RETURN->v_int = (t_CKINT)min->good(); |
| 4445 | //{ | 4461 | } |
| 4446 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4462 | |
| 4447 | // RETURN->v_int = min->num(); | 4463 | CK_DLL_MFUN( HidIn_num ) |
| 4448 | //} | 4464 | { |
| 4449 | // | 4465 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4450 | //CK_DLL_MFUN( HidIn_printerr ) | 4466 | RETURN->v_int = min->num(); |
| 4451 | //{ | 4467 | } |
| 4452 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4468 | |
| 4453 | // t_CKINT print_or_not = GET_CK_INT(ARGS); | 4469 | CK_DLL_MFUN( HidIn_printerr ) |
| 4454 | // min->set_suppress( !print_or_not ); | 4470 | { |
| 4455 | //} | 4471 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4456 | // | 4472 | t_CKINT print_or_not = GET_CK_INT(ARGS); |
| 4457 | //CK_DLL_MFUN( HidIn_name ) | 4473 | min->set_suppress( !print_or_not ); |
| 4458 | //{ | 4474 | } |
| 4459 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4475 | |
| 4460 | // // TODO: memory leak, please fix, Thanks. | 4476 | CK_DLL_MFUN( HidIn_name ) |
| 4461 | // // Chuck_String * a = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED ); | 4477 | { |
| 4462 | // // only if valid | 4478 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4463 | // // if( min->good() ) | 4479 | // TODO: memory leak, please fix, Thanks. |
| 4464 | // // a->str = min->phin->getPortName( min->num() ); | 4480 | // Chuck_String * a = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED ); |
| 4465 | // // TODO: is null problem? | 4481 | // only if valid |
| 4466 | // RETURN->v_string = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED ); | 4482 | // if( min->good() ) |
| 4467 | // RETURN->v_string->set( min->name() ); | 4483 | // a->str = min->phin->getPortName( min->num() ); |
| 4468 | //} | 4484 | // TODO: is null problem? |
| 4469 | // | 4485 | RETURN->v_string = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED ); |
| 4470 | //CK_DLL_MFUN( HidIn_recv ) | 4486 | RETURN->v_string->set( min->name() ); |
| 4471 | //{ | 4487 | } |
| 4472 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4488 | |
| 4473 | // Chuck_Object * fake_msg = GET_CK_OBJECT(ARGS); | 4489 | CK_DLL_MFUN( HidIn_recv ) |
| 4474 | // HidMsg the_msg; | 4490 | { |
| 4475 | // RETURN->v_int = min->recv( &the_msg ); | 4491 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4476 | // if( RETURN->v_int ) | 4492 | Chuck_Object * fake_msg = GET_CK_OBJECT(ARGS); |
| 4477 | // { | 4493 | HidMsg the_msg; |
| 4478 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_type) = the_msg.device_type; | 4494 | RETURN->v_int = min->recv( &the_msg ); |
| 4479 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_num) = the_msg.device_num; | 4495 | if( RETURN->v_int ) |
| 4480 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_type) = the_msg.type; | 4496 | { |
| 4481 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid; | 4497 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_type) = the_msg.device_type; |
| 4482 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0]; | 4498 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_num) = the_msg.device_num; |
| 4483 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0]; | 4499 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_type) = the_msg.type; |
| 4484 | // | 4500 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid; |
| 4485 | // // mouse motion specific member variables | 4501 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0]; |
| 4486 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0]; | 4502 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0]; |
| 4487 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1]; | 4503 | |
| 4488 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursorx) = the_msg.idata[2]; | 4504 | // mouse motion specific member variables |
| 4489 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3]; | 4505 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0]; |
| 4490 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0]; | 4506 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1]; |
| 4491 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1]; | 4507 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursorx) = the_msg.idata[2]; |
| 4492 | // | 4508 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3]; |
| 4493 | // // axis motion specific member variables | 4509 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0]; |
| 4494 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0]; | 4510 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1]; |
| 4495 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0]; | 4511 | |
| 4496 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0]; | 4512 | // axis motion specific member variables |
| 4497 | // | 4513 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0]; |
| 4498 | // // hat motion specific variables | 4514 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0]; |
| 4499 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0]; | 4515 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0]; |
| 4500 | // | 4516 | |
| 4501 | // // keyboard specific variables | 4517 | // hat motion specific variables |
| 4502 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1]; | 4518 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0]; |
| 4503 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2]; | 4519 | |
| 4504 | // | 4520 | // keyboard specific variables |
| 4505 | // // accelerometer (tilt sensor, wii remote) specific members | 4521 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1]; |
| 4506 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0]; | 4522 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2]; |
| 4507 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1]; | 4523 | |
| 4508 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_z) = the_msg.idata[2]; | 4524 | // accelerometer (tilt sensor, wii remote) specific members |
| 4509 | // | 4525 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0]; |
| 4510 | // // multitouch stuff - added 1.3.0.0 | 4526 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1]; |
| 4511 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchx) = the_msg.fdata[0]; | 4527 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_z) = the_msg.idata[2]; |
| 4512 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchy) = the_msg.fdata[1]; | 4528 | |
| 4513 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchsize) = the_msg.fdata[2]; | 4529 | // multitouch stuff - added 1.3.0.0 |
| 4514 | // } | 4530 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchx) = the_msg.fdata[0]; |
| 4515 | //} | 4531 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchy) = the_msg.fdata[1]; |
| 4516 | // | 4532 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchsize) = the_msg.fdata[2]; |
| 4517 | //CK_DLL_MFUN( HidIn_read ) | 4533 | } |
| 4518 | //{ | 4534 | } |
| 4519 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4535 | |
| 4520 | // t_CKINT type = GET_NEXT_INT(ARGS); | 4536 | CK_DLL_MFUN( HidIn_read ) |
| 4521 | // t_CKINT num = GET_NEXT_INT(ARGS); | 4537 | { |
| 4522 | // Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS); | 4538 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4523 | // | 4539 | t_CKINT type = GET_NEXT_INT(ARGS); |
| 4524 | // HidMsg the_msg; | 4540 | t_CKINT num = GET_NEXT_INT(ARGS); |
| 4525 | // | 4541 | Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS); |
| 4526 | // RETURN->v_int = min->read( type, num, &the_msg ); | 4542 | |
| 4527 | // | 4543 | HidMsg the_msg; |
| 4528 | // if( RETURN->v_int ) | 4544 | |
| 4529 | // { | 4545 | RETURN->v_int = min->read( type, num, &the_msg ); |
| 4530 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_type) = the_msg.device_type; | 4546 | |
| 4531 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_num) = the_msg.device_num; | 4547 | if( RETURN->v_int ) |
| 4532 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_type) = the_msg.type; | 4548 | { |
| 4533 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid; | 4549 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_type) = the_msg.device_type; |
| 4534 | // | 4550 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_num) = the_msg.device_num; |
| 4535 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0]; | 4551 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_type) = the_msg.type; |
| 4536 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0]; | 4552 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid; |
| 4537 | // | 4553 | |
| 4538 | // // mouse motion specific member members | 4554 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0]; |
| 4539 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0]; | 4555 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0]; |
| 4540 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1]; | 4556 | |
| 4541 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursorx) = the_msg.idata[2]; | 4557 | // mouse motion specific member members |
| 4542 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3]; | 4558 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0]; |
| 4543 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0]; | 4559 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1]; |
| 4544 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1]; | 4560 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursorx) = the_msg.idata[2]; |
| 4545 | // | 4561 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3]; |
| 4546 | // // joystick axis specific member members | 4562 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0]; |
| 4547 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0]; | 4563 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1]; |
| 4548 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0]; | 4564 | |
| 4549 | // OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0]; | 4565 | // joystick axis specific member members |
| 4550 | // | 4566 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0]; |
| 4551 | // // joystick hat specific member members | 4567 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0]; |
| 4552 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0]; | 4568 | OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0]; |
| 4553 | // | 4569 | |
| 4554 | // // keyboard specific members | 4570 | // joystick hat specific member members |
| 4555 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1]; | 4571 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0]; |
| 4556 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2]; | 4572 | |
| 4557 | // | 4573 | // keyboard specific members |
| 4558 | // // accelerometer (tilt sensor, wii remote) specific members | 4574 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1]; |
| 4559 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0]; | 4575 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2]; |
| 4560 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1]; | 4576 | |
| 4561 | // OBJ_MEMBER_INT(fake_msg, HidMsg_offset_z) = the_msg.idata[2]; | 4577 | // accelerometer (tilt sensor, wii remote) specific members |
| 4562 | // } | 4578 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0]; |
| 4563 | //} | 4579 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1]; |
| 4564 | // | 4580 | OBJ_MEMBER_INT(fake_msg, HidMsg_offset_z) = the_msg.idata[2]; |
| 4565 | //CK_DLL_MFUN( HidIn_send ) | 4581 | } |
| 4566 | //{ | 4582 | } |
| 4567 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4583 | |
| 4568 | // Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS); | 4584 | CK_DLL_MFUN( HidIn_send ) |
| 4569 | // | 4585 | { |
| 4570 | // HidMsg the_msg; | 4586 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4571 | // the_msg.device_type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_type ); | 4587 | Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS); |
| 4572 | // the_msg.device_num = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_num ); | 4588 | |
| 4573 | // the_msg.type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_type ); | 4589 | HidMsg the_msg; |
| 4574 | // the_msg.eid = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_which ); | 4590 | the_msg.device_type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_type ); |
| 4575 | // the_msg.idata[0] = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_idata ); | 4591 | the_msg.device_num = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_num ); |
| 4576 | // | 4592 | the_msg.type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_type ); |
| 4577 | // RETURN->v_int = min->send( &the_msg ); | 4593 | the_msg.eid = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_which ); |
| 4578 | //} | 4594 | the_msg.idata[0] = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_idata ); |
| 4579 | // | 4595 | |
| 4580 | //CK_DLL_MFUN( HidIn_can_wait ) | 4596 | RETURN->v_int = min->send( &the_msg ); |
| 4581 | //{ | 4597 | } |
| 4582 | // HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); | 4598 | |
| 4583 | // RETURN->v_int = min->empty(); | 4599 | CK_DLL_MFUN( HidIn_can_wait ) |
| 4584 | //} | 4600 | { |
| 4585 | // | 4601 | HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data); |
| 4586 | //CK_DLL_SFUN( HidIn_read_tilt_sensor ) | 4602 | RETURN->v_int = min->empty(); |
| 4587 | //{ | 4603 | } |
| 4588 | // static HidIn * hi; | 4604 | |
| 4589 | // static t_CKBOOL hi_good = TRUE; | 4605 | CK_DLL_SFUN( HidIn_read_tilt_sensor ) |
| 4590 | // | 4606 | { |
| 4591 | // Chuck_Array4 * array = new Chuck_Array4( FALSE, 3 ); | 4607 | static HidIn * hi; |
| 4592 | // array->set( 0, 0 ); | 4608 | static t_CKBOOL hi_good = TRUE; |
| 4593 | // array->set( 1, 0 ); | 4609 | |
| 4594 | // array->set( 2, 0 ); | 4610 | Chuck_Array4 * array = new Chuck_Array4( FALSE, 3 ); |
| 4595 | // | 4611 | array->set( 0, 0 ); |
| 4596 | // // TODO: reference count? | 4612 | array->set( 1, 0 ); |
| 4597 | // array->add_ref(); | 4613 | array->set( 2, 0 ); |
| 4598 | // RETURN->v_object = array; | 4614 | |
| 4599 | // | 4615 | // TODO: reference count? |
| 4600 | // if( hi_good == FALSE ) | 4616 | array->add_ref(); |
| 4601 | // return; | 4617 | RETURN->v_object = array; |
| 4602 | // | 4618 | |
| 4603 | // if( !hi ) | 4619 | if( hi_good == FALSE ) |
| 4604 | // { | 4620 | return; |
| 4605 | // hi = new HidIn; | 4621 | |
| 4606 | // if( !hi->open( SHRED->vm_ref, CK_HID_DEV_TILTSENSOR, 0 ) ) | 4622 | if( !hi ) |
| 4607 | // { | 4623 | { |
| 4608 | // hi_good = FALSE; | 4624 | hi = new HidIn; |
| 4609 | // return; | 4625 | if( !hi->open( SHRED->vm_ref, CK_HID_DEV_TILTSENSOR, 0 ) ) |
| 4610 | // } | 4626 | { |
| 4611 | // } | 4627 | hi_good = FALSE; |
| 4612 | // | 4628 | return; |
| 4613 | // HidMsg msg; | 4629 | } |
| 4614 | // | 4630 | } |
| 4615 | // if( !hi->read( CK_HID_ACCELEROMETER, 0, &msg ) ) | 4631 | |
| 4616 | // { | 4632 | HidMsg msg; |
| 4617 | // return; | 4633 | |
| 4618 | // } | 4634 | if( !hi->read( CK_HID_ACCELEROMETER, 0, &msg ) ) |
| 4619 | // | 4635 | { |
| 4620 | // array->set( 0, msg.idata[0] ); | 4636 | return; |
| 4621 | // array->set( 1, msg.idata[1] ); | 4637 | } |
| 4622 | // array->set( 2, msg.idata[2] ); | 4638 | |
| 4623 | //} | 4639 | array->set( 0, msg.idata[0] ); |
| 4624 | // | 4640 | array->set( 1, msg.idata[1] ); |
| 4625 | //CK_DLL_SFUN( HidIn_ctrl_tiltPollRate ) | 4641 | array->set( 2, msg.idata[2] ); |
| 4626 | //{ | 4642 | } |
| 4627 | // // get srate | 4643 | |
| 4628 | // if( !SHRED || !SHRED->vm_ref ) | 4644 | CK_DLL_SFUN( HidIn_ctrl_tiltPollRate ) |
| 4629 | // { | 4645 | { |
| 4630 | // // problem | 4646 | // get srate |
| 4631 | // CK_FPRINTF_STDERR( "[chuck](via HID): can't set tiltPollRate on NULL shred/VM...\n" ); | 4647 | if( !SHRED || !SHRED->vm_ref ) |
| 4632 | // RETURN->v_dur = 0; | 4648 | { |
| 4633 | // return; | 4649 | // problem |
| 4634 | // } | 4650 | CK_FPRINTF_STDERR( "[chuck](via HID): can't set tiltPollRate on NULL shred/VM...\n" ); |
| 4635 | // t_CKFLOAT srate = SHRED->vm_ref->srate(); | 4651 | RETURN->v_dur = 0; |
| 4636 | // | 4652 | return; |
| 4637 | // // get arg | 4653 | } |
| 4638 | // t_CKDUR v = GET_NEXT_DUR( ARGS ); | 4654 | t_CKFLOAT srate = SHRED->vm_ref->srate(); |
| 4639 | // | 4655 | |
| 4640 | // // get in microseconds | 4656 | // get arg |
| 4641 | // t_CKINT usec = (t_CKINT)( v / srate * 1000000 ); | 4657 | t_CKDUR v = GET_NEXT_DUR( ARGS ); |
| 4642 | // | 4658 | |
| 4643 | // // make sure it's nonnegative | 4659 | // get in microseconds |
| 4644 | // if( usec < 0 ) usec = 0; | 4660 | t_CKINT usec = (t_CKINT)( v / srate * 1000000 ); |
| 4645 | // | 4661 | |
| 4646 | // // go | 4662 | // make sure it's nonnegative |
| 4647 | // RETURN->v_dur = TiltSensor_setPollRate( usec ) * srate / 1000000; | 4663 | if( usec < 0 ) usec = 0; |
| 4648 | //} | 4664 | |
| 4649 | // | 4665 | // go |
| 4650 | //CK_DLL_SFUN( HidIn_cget_tiltPollRate ) | 4666 | RETURN->v_dur = TiltSensor_setPollRate( usec ) * srate / 1000000; |
| 4651 | //{ | 4667 | } |
| 4652 | // // get srate | 4668 | |
| 4653 | // if( !SHRED || !SHRED->vm_ref ) | 4669 | CK_DLL_SFUN( HidIn_cget_tiltPollRate ) |
| 4654 | // { | 4670 | { |
| 4655 | // // problem | 4671 | // get srate |
| 4656 | // CK_FPRINTF_STDERR( "[chuck](via HID): can't get tiltPollRate on NULL shred/VM...\n" ); | 4672 | if( !SHRED || !SHRED->vm_ref ) |
| 4657 | // RETURN->v_dur = 0; | 4673 | { |
| 4658 | // return; | 4674 | // problem |
| 4659 | // } | 4675 | CK_FPRINTF_STDERR( "[chuck](via HID): can't get tiltPollRate on NULL shred/VM...\n" ); |
| 4660 | // t_CKFLOAT srate = SHRED->vm_ref->srate(); | 4676 | RETURN->v_dur = 0; |
| 4661 | // | 4677 | return; |
| 4662 | // RETURN->v_dur = TiltSensor_getPollRate() * srate / 1000000; | 4678 | } |
| 4663 | //} | 4679 | t_CKFLOAT srate = SHRED->vm_ref->srate(); |
| 4664 | // | 4680 | |
| 4665 | //CK_DLL_SFUN( HidIn_start_cursor_track ) | 4681 | RETURN->v_dur = TiltSensor_getPollRate() * srate / 1000000; |
| 4666 | //{ | 4682 | } |
| 4667 | // RETURN->v_int = !Mouse_start_cursor_track(); | 4683 | |
| 4668 | //} | 4684 | CK_DLL_SFUN( HidIn_start_cursor_track ) |
| 4669 | // | 4685 | { |
| 4670 | //CK_DLL_SFUN( HidIn_stop_cursor_track ) | 4686 | RETURN->v_int = !Mouse_start_cursor_track(); |
| 4671 | //{ | 4687 | } |
| 4672 | // RETURN->v_int = !Mouse_stop_cursor_track(); | 4688 | |
| 4673 | //} | 4689 | CK_DLL_SFUN( HidIn_stop_cursor_track ) |
| 4674 | // | 4690 | { |
| 4675 | ////----------------------------------------------------------------------------- | 4691 | RETURN->v_int = !Mouse_stop_cursor_track(); |
| 4676 | //// HidOut API | 4692 | } |
| 4677 | ////----------------------------------------------------------------------------- | 4693 | |
| 4678 | //CK_DLL_CTOR( HidOut_ctor ) | 4694 | //----------------------------------------------------------------------------- |
| 4679 | //{ | 4695 | // HidOut API |
| 4680 | // OBJ_MEMBER_INT(SELF, HidOut_offset_data) = (t_CKUINT)new HidOut; | 4696 | //----------------------------------------------------------------------------- |
| 4681 | //} | 4697 | CK_DLL_CTOR( HidOut_ctor ) |
| 4682 | // | 4698 | { |
| 4683 | //CK_DLL_DTOR( HidOut_dtor ) | 4699 | OBJ_MEMBER_INT(SELF, HidOut_offset_data) = (t_CKUINT)new HidOut; |
| 4684 | //{ | 4700 | } |
| 4685 | // delete (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); | 4701 | |
| 4686 | // OBJ_MEMBER_INT(SELF, HidOut_offset_data) = 0; | 4702 | CK_DLL_DTOR( HidOut_dtor ) |
| 4687 | //} | 4703 | { |
| 4688 | // | 4704 | delete (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); |
| 4689 | //CK_DLL_MFUN( HidOut_open ) | 4705 | OBJ_MEMBER_INT(SELF, HidOut_offset_data) = 0; |
| 4690 | //{ | 4706 | } |
| 4691 | // HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); | 4707 | |
| 4692 | // t_CKINT num = GET_CK_INT(ARGS); | 4708 | CK_DLL_MFUN( HidOut_open ) |
| 4693 | // RETURN->v_int = mout->open( num ); | 4709 | { |
| 4694 | //} | 4710 | HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); |
| 4695 | // | 4711 | t_CKINT num = GET_CK_INT(ARGS); |
| 4696 | //CK_DLL_MFUN( HidOut_good ) | 4712 | RETURN->v_int = mout->open( num ); |
| 4697 | //{ | 4713 | } |
| 4698 | // HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); | 4714 | |
| 4699 | // RETURN->v_int = (t_CKINT)mout->good(); | 4715 | CK_DLL_MFUN( HidOut_good ) |
| 4700 | //} | 4716 | { |
| 4701 | // | 4717 | HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); |
| 4702 | //CK_DLL_MFUN( HidOut_num ) | 4718 | RETURN->v_int = (t_CKINT)mout->good(); |
| 4703 | //{ | 4719 | } |
| 4704 | // HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); | 4720 | |
| 4705 | // RETURN->v_int = mout->num(); | 4721 | CK_DLL_MFUN( HidOut_num ) |
| 4706 | //} | 4722 | { |
| 4707 | // | 4723 | HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); |
| 4708 | //CK_DLL_MFUN( HidOut_name ) | 4724 | RETURN->v_int = mout->num(); |
| 4709 | //{ | 4725 | } |
| 4710 | // // HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); | 4726 | |
| 4711 | // // TODO: memory leak, please fix, Thanks. | 4727 | CK_DLL_MFUN( HidOut_name ) |
| 4712 | // Chuck_String * a = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED ); | 4728 | { |
| 4713 | // // only if valid | 4729 | // HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); |
| 4714 | // // if( mout->good() ) | 4730 | // TODO: memory leak, please fix, Thanks. |
| 4715 | // // a->str = mout->mout->getPortName( mout->num() ); | 4731 | Chuck_String * a = (Chuck_String *)instantiate_and_initialize_object( SHRED->vm_ref->env()->t_string, SHRED ); |
| 4716 | // RETURN->v_string = a; | 4732 | // only if valid |
| 4717 | //} | 4733 | // if( mout->good() ) |
| 4718 | // | 4734 | // a->str = mout->mout->getPortName( mout->num() ); |
| 4719 | //CK_DLL_MFUN( HidOut_printerr ) | 4735 | RETURN->v_string = a; |
| 4720 | //{ | 4736 | } |
| 4721 | // HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); | 4737 | |
| 4722 | // t_CKINT print_or_not = GET_CK_INT(ARGS); | 4738 | CK_DLL_MFUN( HidOut_printerr ) |
| 4723 | // mout->set_suppress( !print_or_not ); | 4739 | { |
| 4724 | //} | 4740 | HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); |
| 4725 | // | 4741 | t_CKINT print_or_not = GET_CK_INT(ARGS); |
| 4726 | //CK_DLL_MFUN( HidOut_send ) | 4742 | mout->set_suppress( !print_or_not ); |
| 4727 | //{ | 4743 | } |
| 4728 | // HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); | 4744 | |
| 4729 | // // Chuck_Object * fake_msg = GET_CK_OBJECT(ARGS); | 4745 | CK_DLL_MFUN( HidOut_send ) |
| 4730 | // HidMsg the_msg; | 4746 | { |
| 4731 | // // the_msg.data[0] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data1); | 4747 | HidOut * mout = (HidOut *)OBJ_MEMBER_INT(SELF, HidOut_offset_data); |
| 4732 | // // the_msg.data[1] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data2); | 4748 | // Chuck_Object * fake_msg = GET_CK_OBJECT(ARGS); |
| 4733 | // // the_msg.data[2] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data3); | 4749 | HidMsg the_msg; |
| 4734 | // RETURN->v_int = mout->send( &the_msg ); | 4750 | // the_msg.data[0] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data1); |
| 4735 | //} | 4751 | // the_msg.data[1] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data2); |
| 4752 | // the_msg.data[2] = (t_CKBYTE)OBJ_MEMBER_INT(fake_msg, HidMsg_offset_data3); | ||
| 4753 | RETURN->v_int = mout->send( &the_msg ); | ||
| 4754 | } | ||
| 4755 | #endif //__DISABLE_HID__ | ||
| 4756 | |||
| 4757 | |||
| 4736 | 4758 | ||
| 4737 | 4759 | ||
| 4738 | //----------------------------------------------------------------------------- | 4760 | //----------------------------------------------------------------------------- |
| @@ -63,7 +63,9 @@ t_CKBOOL init_class_Midi( Chuck_Env * env ); · 62 unmodified lines | |||
| 63 | t_CKBOOL init_class_MidiRW( Chuck_Env * env ); | 63 | t_CKBOOL init_class_MidiRW( Chuck_Env * env ); |
| 64 | t_CKBOOL init_class_HID( Chuck_Env * env ); | 64 | t_CKBOOL init_class_HID( Chuck_Env * env ); |
| 65 | t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type ); | 65 | t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type ); |
| 66 | //t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ); | 66 | #ifndef __DISABLE_FILEIO__ |
| 67 | t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ); | ||
| 68 | #endif | ||
| 67 | // added 1.3.0.0 -- moved to be full-fledged class | 69 | // added 1.3.0.0 -- moved to be full-fledged class |
| 68 | t_CKBOOL init_class_chout( Chuck_Env * env, Chuck_Type * type ); | 70 | t_CKBOOL init_class_chout( Chuck_Env * env, Chuck_Type * type ); |
| 69 | // added 1.3.0.0 -- moved to be full-fledged class | 71 | // added 1.3.0.0 -- moved to be full-fledged class |
| @@ -214,34 +216,36 @@ CK_DLL_SFUN( io_newline ); · 144 unmodified lines | |||
| 214 | CK_DLL_SFUN( io_openfile ); | 216 | CK_DLL_SFUN( io_openfile ); |
| 215 | 217 | ||
| 216 | 218 | ||
| 217 | ////----------------------------------------------------------------------------- | 219 | #ifndef __DISABLE_FILEIO__ |
| 218 | //// fileio API | 220 | //----------------------------------------------------------------------------- |
| 219 | ////----------------------------------------------------------------------------- | 221 | // fileio API |
| 220 | //CK_DLL_CTOR( fileio_ctor ); | 222 | //----------------------------------------------------------------------------- |
| 221 | //CK_DLL_DTOR( fileio_dtor ); | 223 | CK_DLL_CTOR( fileio_ctor ); |
| 222 | //CK_DLL_MFUN( fileio_open ); | 224 | CK_DLL_DTOR( fileio_dtor ); |
| 223 | //CK_DLL_MFUN( fileio_openflags ); | 225 | CK_DLL_MFUN( fileio_open ); |
| 224 | //CK_DLL_MFUN( fileio_good ); | 226 | CK_DLL_MFUN( fileio_openflags ); |
| 225 | //CK_DLL_MFUN( fileio_close ); | 227 | CK_DLL_MFUN( fileio_good ); |
| 226 | //CK_DLL_MFUN( fileio_flush ); | 228 | CK_DLL_MFUN( fileio_close ); |
| 227 | //CK_DLL_MFUN( fileio_getmode ); | 229 | CK_DLL_MFUN( fileio_flush ); |
| 228 | //CK_DLL_MFUN( fileio_setmode ); | 230 | CK_DLL_MFUN( fileio_getmode ); |
| 229 | //CK_DLL_MFUN( fileio_size ); | 231 | CK_DLL_MFUN( fileio_setmode ); |
| 230 | //CK_DLL_MFUN( fileio_seek ); | 232 | CK_DLL_MFUN( fileio_size ); |
| 231 | //CK_DLL_MFUN( fileio_tell ); | 233 | CK_DLL_MFUN( fileio_seek ); |
| 232 | //CK_DLL_MFUN( fileio_isdir ); | 234 | CK_DLL_MFUN( fileio_tell ); |
| 233 | //CK_DLL_MFUN( fileio_dirlist ); | 235 | CK_DLL_MFUN( fileio_isdir ); |
| 234 | //CK_DLL_MFUN( fileio_read ); | 236 | CK_DLL_MFUN( fileio_dirlist ); |
| 235 | //CK_DLL_MFUN( fileio_readline ); | 237 | CK_DLL_MFUN( fileio_read ); |
| 236 | //CK_DLL_MFUN( fileio_readint ); | 238 | CK_DLL_MFUN( fileio_readline ); |
| 237 | //CK_DLL_MFUN( fileio_readintflags ); | 239 | CK_DLL_MFUN( fileio_readint ); |
| 238 | //CK_DLL_MFUN( fileio_readfloat ); | 240 | CK_DLL_MFUN( fileio_readintflags ); |
| 239 | //CK_DLL_MFUN( fileio_eof ); | 241 | CK_DLL_MFUN( fileio_readfloat ); |
| 240 | //CK_DLL_MFUN( fileio_more ); | 242 | CK_DLL_MFUN( fileio_eof ); |
| 241 | //CK_DLL_MFUN( fileio_writestring ); | 243 | CK_DLL_MFUN( fileio_more ); |
| 242 | //CK_DLL_MFUN( fileio_writeint ); | 244 | CK_DLL_MFUN( fileio_writestring ); |
| 243 | //CK_DLL_MFUN( fileio_writeintflags ); | 245 | CK_DLL_MFUN( fileio_writeint ); |
| 244 | //CK_DLL_MFUN( fileio_writefloat ); | 246 | CK_DLL_MFUN( fileio_writeintflags ); |
| 247 | CK_DLL_MFUN( fileio_writefloat ); | ||
| 248 | #endif | ||
| 245 | 249 | ||
| 246 | 250 | ||
| 247 | //----------------------------------------------------------------------------- | 251 | //----------------------------------------------------------------------------- |
| @@ -428,54 +432,56 @@ CK_DLL_MFUN( MidiOut_printerr ); · 180 unmodified lines | |||
| 428 | CK_DLL_MFUN( MidiOut_send ); | 432 | CK_DLL_MFUN( MidiOut_send ); |
| 429 | 433 | ||
| 430 | 434 | ||
| 431 | ////----------------------------------------------------------------------------- | 435 | #ifndef __DISABLE_HID__ |
| 432 | //// HidMsg API | 436 | //----------------------------------------------------------------------------- |
| 433 | ////----------------------------------------------------------------------------- | 437 | // HidMsg API |
| 434 | //CK_DLL_MFUN( HidMsg_is_axis_motion ); | 438 | //----------------------------------------------------------------------------- |
| 435 | //CK_DLL_MFUN( HidMsg_is_button_down ); | 439 | CK_DLL_MFUN( HidMsg_is_axis_motion ); |
| 436 | //CK_DLL_MFUN( HidMsg_is_button_up ); | 440 | CK_DLL_MFUN( HidMsg_is_button_down ); |
| 437 | //CK_DLL_MFUN( HidMsg_is_mouse_motion ); | 441 | CK_DLL_MFUN( HidMsg_is_button_up ); |
| 438 | //CK_DLL_MFUN( HidMsg_is_hat_motion ); | 442 | CK_DLL_MFUN( HidMsg_is_mouse_motion ); |
| 439 | //CK_DLL_MFUN( HidMsg_is_wheel_motion ); | 443 | CK_DLL_MFUN( HidMsg_is_hat_motion ); |
| 440 | // | 444 | CK_DLL_MFUN( HidMsg_is_wheel_motion ); |
| 441 | ////----------------------------------------------------------------------------- | 445 | |
| 442 | //// HidIn API | 446 | //----------------------------------------------------------------------------- |
| 443 | ////----------------------------------------------------------------------------- | 447 | // HidIn API |
| 444 | //CK_DLL_CTOR( HidIn_ctor ); | 448 | //----------------------------------------------------------------------------- |
| 445 | //CK_DLL_DTOR( HidIn_dtor ); | 449 | CK_DLL_CTOR( HidIn_ctor ); |
| 446 | //CK_DLL_MFUN( HidIn_open ); | 450 | CK_DLL_DTOR( HidIn_dtor ); |
| 447 | //CK_DLL_MFUN( HidIn_open_named ); | 451 | CK_DLL_MFUN( HidIn_open ); |
| 448 | //CK_DLL_MFUN( HidIn_open_named_i ); // added 1.3.0.0 | 452 | CK_DLL_MFUN( HidIn_open_named ); |
| 449 | //CK_DLL_MFUN( HidIn_open_joystick ); | 453 | CK_DLL_MFUN( HidIn_open_named_i ); // added 1.3.0.0 |
| 450 | //CK_DLL_MFUN( HidIn_open_mouse ); | 454 | CK_DLL_MFUN( HidIn_open_joystick ); |
| 451 | //CK_DLL_MFUN( HidIn_open_keyboard ); | 455 | CK_DLL_MFUN( HidIn_open_mouse ); |
| 452 | //CK_DLL_MFUN( HidIn_open_tiltsensor ); | 456 | CK_DLL_MFUN( HidIn_open_keyboard ); |
| 453 | //CK_DLL_MFUN( HidIn_good ); | 457 | CK_DLL_MFUN( HidIn_open_tiltsensor ); |
| 454 | //CK_DLL_MFUN( HidIn_num ); | 458 | CK_DLL_MFUN( HidIn_good ); |
| 455 | //CK_DLL_MFUN( HidIn_name ); | 459 | CK_DLL_MFUN( HidIn_num ); |
| 456 | //CK_DLL_MFUN( HidIn_printerr ); | 460 | CK_DLL_MFUN( HidIn_name ); |
| 457 | //CK_DLL_MFUN( HidIn_recv ); | 461 | CK_DLL_MFUN( HidIn_printerr ); |
| 458 | //CK_DLL_MFUN( HidIn_read ); | 462 | CK_DLL_MFUN( HidIn_recv ); |
| 459 | //CK_DLL_MFUN( HidIn_send ); | 463 | CK_DLL_MFUN( HidIn_read ); |
| 460 | //CK_DLL_MFUN( HidIn_can_wait ); | 464 | CK_DLL_MFUN( HidIn_send ); |
| 461 | //CK_DLL_SFUN( HidIn_read_tilt_sensor ); | 465 | CK_DLL_MFUN( HidIn_can_wait ); |
| 462 | //CK_DLL_SFUN( HidIn_ctrl_tiltPollRate ); | 466 | CK_DLL_SFUN( HidIn_read_tilt_sensor ); |
| 463 | //CK_DLL_SFUN( HidIn_cget_tiltPollRate ); | 467 | CK_DLL_SFUN( HidIn_ctrl_tiltPollRate ); |
| 464 | //CK_DLL_SFUN( HidIn_start_cursor_track ); | 468 | CK_DLL_SFUN( HidIn_cget_tiltPollRate ); |
| 465 | //CK_DLL_SFUN( HidIn_stop_cursor_track ); | 469 | CK_DLL_SFUN( HidIn_start_cursor_track ); |
| 466 | // | 470 | CK_DLL_SFUN( HidIn_stop_cursor_track ); |
| 467 | // | 471 | |
| 468 | ////----------------------------------------------------------------------------- | 472 | |
| 469 | //// HidOut API | 473 | //----------------------------------------------------------------------------- |
| 470 | ////----------------------------------------------------------------------------- | 474 | // HidOut API |
| 471 | //CK_DLL_CTOR( HidOut_ctor ); | 475 | //----------------------------------------------------------------------------- |
| 472 | //CK_DLL_DTOR( HidOut_dtor ); | 476 | CK_DLL_CTOR( HidOut_ctor ); |
| 473 | //CK_DLL_MFUN( HidOut_open ); | 477 | CK_DLL_DTOR( HidOut_dtor ); |
| 474 | //CK_DLL_MFUN( HidOut_good ); | 478 | CK_DLL_MFUN( HidOut_open ); |
| 475 | //CK_DLL_MFUN( HidOut_num ); | 479 | CK_DLL_MFUN( HidOut_good ); |
| 476 | //CK_DLL_MFUN( HidOut_name ); | 480 | CK_DLL_MFUN( HidOut_num ); |
| 477 | //CK_DLL_MFUN( HidOut_printerr ); | 481 | CK_DLL_MFUN( HidOut_name ); |
| 478 | //CK_DLL_MFUN( HidOut_send ); | 482 | CK_DLL_MFUN( HidOut_printerr ); |
| 483 | CK_DLL_MFUN( HidOut_send ); | ||
| 484 | #endif | ||
| 479 | 485 | ||
| 480 | 486 | ||
| 481 | 487 | ||
| @@ -56,12 +56,14 @@ const t_CKINT Chuck_IO::INT16 = 0x2; · 55 unmodified lines | |||
| 56 | const t_CKINT Chuck_IO::INT8 = 0x4; | 56 | const t_CKINT Chuck_IO::INT8 = 0x4; |
| 57 | const t_CKINT Chuck_IO::MODE_SYNC = 0; | 57 | const t_CKINT Chuck_IO::MODE_SYNC = 0; |
| 58 | const t_CKINT Chuck_IO::MODE_ASYNC = 1; | 58 | const t_CKINT Chuck_IO::MODE_ASYNC = 1; |
| 59 | //const t_CKINT Chuck_IO_File::FLAG_READ_WRITE = 0x8; | 59 | #ifndef __DISABLE_FILEIO__ |
| 60 | //const t_CKINT Chuck_IO_File::FLAG_READONLY = 0x10; | 60 | const t_CKINT Chuck_IO_File::FLAG_READ_WRITE = 0x8; |
| 61 | //const t_CKINT Chuck_IO_File::FLAG_WRITEONLY = 0x20; | 61 | const t_CKINT Chuck_IO_File::FLAG_READONLY = 0x10; |
| 62 | //const t_CKINT Chuck_IO_File::FLAG_APPEND = 0x40; | 62 | const t_CKINT Chuck_IO_File::FLAG_WRITEONLY = 0x20; |
| 63 | //const t_CKINT Chuck_IO_File::TYPE_ASCII = 0x80; | 63 | const t_CKINT Chuck_IO_File::FLAG_APPEND = 0x40; |
| 64 | //const t_CKINT Chuck_IO_File::TYPE_BINARY = 0x100; | 64 | const t_CKINT Chuck_IO_File::TYPE_ASCII = 0x80; |
| 65 | const t_CKINT Chuck_IO_File::TYPE_BINARY = 0x100; | ||
| 66 | #endif | ||
| 65 | 67 | ||
| 66 | 68 | ||
| 67 | 69 | ||
| @@ -1967,7 +1969,9 @@ t_CKUINT Chuck_Event::our_can_wait = 0; · 1899 unmodified lines | |||
| 1967 | //----------------------------------------------------------------------------- | 1969 | //----------------------------------------------------------------------------- |
| 1968 | void Chuck_Event::signal() | 1970 | void Chuck_Event::signal() |
| 1969 | { | 1971 | { |
| 1970 | // m_queue_lock.acquire(); | 1972 | #ifndef __DISABLE_THREADS__ |
| 1973 | m_queue_lock.acquire(); | ||
| 1974 | #endif | ||
| 1971 | if( !m_queue.empty() ) | 1975 | if( !m_queue.empty() ) |
| 1972 | { | 1976 | { |
| 1973 | // get the shred on top of the queue | 1977 | // get the shred on top of the queue |
| @@ -1975,7 +1979,9 @@ void Chuck_Event::signal() · 1 unmodified line | |||
| 1975 | // pop the top | 1979 | // pop the top |
| 1976 | m_queue.pop(); | 1980 | m_queue.pop(); |
| 1977 | // release it! | 1981 | // release it! |
| 1978 | // m_queue_lock.release(); | 1982 | #ifndef __DISABLE_THREADS__ |
| 1983 | m_queue_lock.release(); | ||
| 1984 | #endif | ||
| 1979 | // REFACTOR-2017: BUG-FIX | 1985 | // REFACTOR-2017: BUG-FIX |
| 1980 | // release the extra ref we added when we started waiting for this event | 1986 | // release the extra ref we added when we started waiting for this event |
| 1981 | SAFE_RELEASE( shred->event ); | 1987 | SAFE_RELEASE( shred->event ); |
| @@ -1991,7 +1997,9 @@ void Chuck_Event::signal() · 9 unmodified lines | |||
| 1991 | } | 1997 | } |
| 1992 | else | 1998 | else |
| 1993 | { | 1999 | { |
| 1994 | // m_queue_lock.release(); | 2000 | #ifndef __DISABLE_THREADS__ |
| 2001 | m_queue_lock.release(); | ||
| 2002 | #endif | ||
| 1995 | } | 2003 | } |
| 1996 | } | 2004 | } |
| 1997 | 2005 | ||
| @@ -2008,7 +2016,9 @@ t_CKBOOL Chuck_Event::remove( Chuck_VM_Shred * shred ) · 10 unmodified lines | |||
| 2008 | t_CKBOOL removed = FALSE; | 2016 | t_CKBOOL removed = FALSE; |
| 2009 | 2017 | ||
| 2010 | // lock | 2018 | // lock |
| 2011 | // m_queue_lock.acquire(); | 2019 | #ifndef __DISABLE_THREADS__ |
| 2020 | m_queue_lock.acquire(); | ||
| 2021 | #endif | ||
| 2012 | // while something in queue | 2022 | // while something in queue |
| 2013 | while( !m_queue.empty() ) | 2023 | while( !m_queue.empty() ) |
| 2014 | { | 2024 | { |
| @@ -2038,7 +2048,9 @@ t_CKBOOL Chuck_Event::remove( Chuck_VM_Shred * shred ) · 23 unmodified lines | |||
| 2038 | // copy temp back to queue | 2048 | // copy temp back to queue |
| 2039 | m_queue = temp; | 2049 | m_queue = temp; |
| 2040 | // release lock | 2050 | // release lock |
| 2041 | // m_queue_lock.release(); | 2051 | #ifndef __DISABLE_THREADS__ |
| 2052 | m_queue_lock.release(); | ||
| 2053 | #endif | ||
| 2042 | 2054 | ||
| 2043 | return removed; | 2055 | return removed; |
| 2044 | } | 2056 | } |
| @@ -2077,7 +2089,9 @@ t_CKBOOL Chuck_Event::remove_listen( void (* cb)(void) ) · 32 unmodified lines | |||
| 2077 | t_CKBOOL removed = FALSE; | 2089 | t_CKBOOL removed = FALSE; |
| 2078 | 2090 | ||
| 2079 | // lock | 2091 | // lock |
| 2080 | // m_queue_lock.acquire(); | 2092 | #ifndef __DISABLE_THREADS__ |
| 2093 | m_queue_lock.acquire(); | ||
| 2094 | #endif | ||
| 2081 | // while something in queue | 2095 | // while something in queue |
| 2082 | while( !m_global_queue.empty() ) | 2096 | while( !m_global_queue.empty() ) |
| 2083 | { | 2097 | { |
| @@ -2100,7 +2114,9 @@ t_CKBOOL Chuck_Event::remove_listen( void (* cb)(void) ) · 16 unmodified lines | |||
| 2100 | // copy temp back to queue | 2114 | // copy temp back to queue |
| 2101 | m_global_queue = temp; | 2115 | m_global_queue = temp; |
| 2102 | // release lock | 2116 | // release lock |
| 2103 | // m_queue_lock.release(); | 2117 | #ifndef __DISABLE_THREADS__ |
| 2118 | m_queue_lock.release(); | ||
| 2119 | #endif | ||
| 2104 | 2120 | ||
| 2105 | return removed; | 2121 | return removed; |
| 2106 | } | 2122 | } |
| @@ -2114,7 +2130,9 @@ t_CKBOOL Chuck_Event::remove_listen( void (* cb)(void) ) · 7 unmodified lines | |||
| 2114 | //----------------------------------------------------------------------------- | 2130 | //----------------------------------------------------------------------------- |
| 2115 | void Chuck_Event::signal_global() | 2131 | void Chuck_Event::signal_global() |
| 2116 | { | 2132 | { |
| 2117 | // m_queue_lock.acquire(); | 2133 | #ifndef __DISABLE_THREADS__ |
| 2134 | m_queue_lock.acquire(); | ||
| 2135 | #endif | ||
| 2118 | 2136 | ||
| 2119 | if( !m_global_queue.empty() ) | 2137 | if( !m_global_queue.empty() ) |
| 2120 | { | 2138 | { |
| @@ -2134,7 +2152,9 @@ void Chuck_Event::signal_global() · 13 unmodified lines | |||
| 2134 | } | 2152 | } |
| 2135 | } | 2153 | } |
| 2136 | 2154 | ||
| 2137 | // m_queue_lock.release(); | 2155 | #ifndef __DISABLE_THREADS__ |
| 2156 | m_queue_lock.release(); | ||
| 2157 | #endif | ||
| 2138 | } | 2158 | } |
| 2139 | 2159 | ||
| 2140 | 2160 | ||
| @@ -2146,7 +2166,9 @@ void Chuck_Event::signal_global() · 5 unmodified lines | |||
| 2146 | //----------------------------------------------------------------------------- | 2166 | //----------------------------------------------------------------------------- |
| 2147 | void Chuck_Event::broadcast_global() | 2167 | void Chuck_Event::broadcast_global() |
| 2148 | { | 2168 | { |
| 2149 | // m_queue_lock.acquire(); | 2169 | #ifndef __DISABLE_THREADS__ |
| 2170 | m_queue_lock.acquire(); | ||
| 2171 | #endif | ||
| 2150 | std::queue< Chuck_Global_Event_Listener > call_again; | 2172 | std::queue< Chuck_Global_Event_Listener > call_again; |
| 2151 | 2173 | ||
| 2152 | while( !m_global_queue.empty() ) | 2174 | while( !m_global_queue.empty() ) |
| @@ -2169,8 +2191,10 @@ void Chuck_Event::broadcast_global() · 16 unmodified lines | |||
| 2169 | 2191 | ||
| 2170 | // for those that should be called again, store them again | 2192 | // for those that should be called again, store them again |
| 2171 | m_global_queue = call_again; | 2193 | m_global_queue = call_again; |
| 2172 | 2194 | ||
| 2173 | // m_queue_lock.release(); | 2195 | #ifndef __DISABLE_THREADS__ |
| 2196 | m_queue_lock.release(); | ||
| 2197 | #endif | ||
| 2174 | } | 2198 | } |
| 2175 | 2199 | ||
| 2176 | 2200 | ||
| @@ -2185,19 +2209,25 @@ void Chuck_Event::broadcast_global() · 8 unmodified lines | |||
| 2185 | void Chuck_Event::queue_broadcast( CBufferSimple * event_buffer ) | 2209 | void Chuck_Event::queue_broadcast( CBufferSimple * event_buffer ) |
| 2186 | { | 2210 | { |
| 2187 | // TODO: handle multiple VM | 2211 | // TODO: handle multiple VM |
| 2188 | // m_queue_lock.acquire(); | 2212 | #ifndef __DISABLE_THREADS__ |
| 2213 | m_queue_lock.acquire(); | ||
| 2214 | #endif | ||
| 2189 | if( !m_queue.empty() ) | 2215 | if( !m_queue.empty() ) |
| 2190 | { | 2216 | { |
| 2191 | // get shred (only to get the VM ref) | 2217 | // get shred (only to get the VM ref) |
| 2192 | Chuck_VM_Shred * shred = m_queue.front(); | 2218 | Chuck_VM_Shred * shred = m_queue.front(); |
| 2193 | // release lock | 2219 | // release lock |
| 2194 | // m_queue_lock.release(); | 2220 | #ifndef __DISABLE_THREADS__ |
| 2221 | m_queue_lock.release(); | ||
| 2222 | #endif | ||
| 2195 | // queue the event on the vm (added 1.3.0.0: event_buffer) | 2223 | // queue the event on the vm (added 1.3.0.0: event_buffer) |
| 2196 | shred->vm_ref->queue_event( this, 1, event_buffer ); | 2224 | shred->vm_ref->queue_event( this, 1, event_buffer ); |
| 2197 | } | 2225 | } |
| 2198 | else | 2226 | else |
| 2199 | { | 2227 | { |
| 2200 | // m_queue_lock.release(); | 2228 | #ifndef __DISABLE_THREADS__ |
| 2229 | m_queue_lock.release(); | ||
| 2230 | #endif | ||
| 2201 | } | 2231 | } |
| 2202 | } | 2232 | } |
| 2203 | 2233 | ||
| @@ -2211,19 +2241,27 @@ void Chuck_Event::queue_broadcast( CBufferSimple * event_buffer ) · 7 unmodified lines | |||
| 2211 | void Chuck_Event::broadcast() | 2241 | void Chuck_Event::broadcast() |
| 2212 | { | 2242 | { |
| 2213 | // lock queue | 2243 | // lock queue |
| 2214 | // m_queue_lock.acquire(); | 2244 | #ifndef __DISABLE_THREADS__ |
| 2245 | m_queue_lock.acquire(); | ||
| 2246 | #endif | ||
| 2215 | // while not empty | 2247 | // while not empty |
| 2216 | while( !m_queue.empty() ) | 2248 | while( !m_queue.empty() ) |
| 2217 | { | 2249 | { |
| 2218 | // release first | 2250 | // release first |
| 2219 | // m_queue_lock.release(); | 2251 | #ifndef __DISABLE_THREADS__ |
| 2252 | m_queue_lock.release(); | ||
| 2253 | #endif | ||
| 2220 | // signal the next shred | 2254 | // signal the next shred |
| 2221 | this->signal(); | 2255 | this->signal(); |
| 2222 | // lock again | 2256 | // lock again |
| 2223 | // m_queue_lock.acquire(); | 2257 | #ifndef __DISABLE_THREADS__ |
| 2258 | m_queue_lock.acquire(); | ||
| 2259 | #endif | ||
| 2224 | } | 2260 | } |
| 2225 | // release | 2261 | // release |
| 2226 | // m_queue_lock.release(); | 2262 | #ifndef __DISABLE_THREADS__ |
| 2263 | m_queue_lock.release(); | ||
| 2264 | #endif | ||
| 2227 | } | 2265 | } |
| 2228 | 2266 | ||
| 2229 | 2267 | ||
| @@ -2255,9 +2293,13 @@ void Chuck_Event::wait( Chuck_VM_Shred * shred, Chuck_VM * vm ) · 25 unmodified lines | |||
| 2255 | shred->is_running = FALSE; | 2293 | shred->is_running = FALSE; |
| 2256 | 2294 | ||
| 2257 | // add to waiting list | 2295 | // add to waiting list |
| 2258 | // m_queue_lock.acquire(); | 2296 | #ifndef __DISABLE_THREADS__ |
| 2297 | m_queue_lock.acquire(); | ||
| 2298 | #endif | ||
| 2259 | m_queue.push( shred ); | 2299 | m_queue.push( shred ); |
| 2260 | // m_queue_lock.release(); | 2300 | #ifndef __DISABLE_THREADS__ |
| 2301 | m_queue_lock.release(); | ||
| 2302 | #endif | ||
| 2261 | 2303 | ||
| 2262 | // add event to shred | 2304 | // add event to shred |
| 2263 | assert( shred->event == NULL ); | 2305 | assert( shred->event == NULL ); |
| @@ -2302,677 +2344,678 @@ Chuck_IO::~Chuck_IO() · 38 unmodified lines | |||
| 2302 | 2344 | ||
| 2303 | 2345 | ||
| 2304 | 2346 | ||
| 2305 | ////----------------------------------------------------------------------------- | 2347 | #ifndef __DISABLE_FILEIO__ |
| 2306 | //// name: Chuck_IO_File() | 2348 | //----------------------------------------------------------------------------- |
| 2307 | //// desc: constructor | 2349 | // name: Chuck_IO_File() |
| 2308 | ////----------------------------------------------------------------------------- | 2350 | // desc: constructor |
| 2309 | //Chuck_IO_File::Chuck_IO_File( Chuck_VM * vm ) | 2351 | //----------------------------------------------------------------------------- |
| 2310 | //{ | 2352 | Chuck_IO_File::Chuck_IO_File( Chuck_VM * vm ) |
| 2311 | // m_vmRef = vm; | 2353 | { |
| 2312 | // // zero things out | 2354 | m_vmRef = vm; |
| 2313 | // m_flags = 0; | 2355 | // zero things out |
| 2314 | // m_iomode = MODE_SYNC; | 2356 | m_flags = 0; |
| 2315 | // m_path = ""; | 2357 | m_iomode = MODE_SYNC; |
| 2316 | // m_dir = NULL; | 2358 | m_path = ""; |
| 2317 | // m_dir_start = 0; | 2359 | m_dir = NULL; |
| 2318 | // m_asyncEvent = new Chuck_Event; | 2360 | m_dir_start = 0; |
| 2319 | // initialize_object( m_asyncEvent, vm->env()->t_event ); | 2361 | m_asyncEvent = new Chuck_Event; |
| 2320 | // m_thread = new XThread; | 2362 | initialize_object( m_asyncEvent, vm->env()->t_event ); |
| 2321 | //} | 2363 | m_thread = new XThread; |
| 2322 | // | 2364 | } |
| 2323 | // | ||
| 2324 | // | ||
| 2325 | // | ||
| 2326 | ////----------------------------------------------------------------------------- | ||
| 2327 | //// name: ~Chuck_IO_File() | ||
| 2328 | //// desc: destructor | ||
| 2329 | ////----------------------------------------------------------------------------- | ||
| 2330 | //Chuck_IO_File::~Chuck_IO_File() | ||
| 2331 | //{ | ||
| 2332 | // // clean up | ||
| 2333 | // this->close(); | ||
| 2334 | // delete m_asyncEvent; | ||
| 2335 | // delete m_thread; | ||
| 2336 | //} | ||
| 2337 | // | ||
| 2338 | // | ||
| 2339 | // | ||
| 2340 | // | ||
| 2341 | ////----------------------------------------------------------------------------- | ||
| 2342 | //// name: open | ||
| 2343 | //// desc: open file from disk | ||
| 2344 | ////----------------------------------------------------------------------------- | ||
| 2345 | //t_CKBOOL Chuck_IO_File::open( const string & path, t_CKINT flags ) | ||
| 2346 | //{ | ||
| 2347 | // // log | ||
| 2348 | // EM_log( CK_LOG_INFO, "FileIO: opening file from disk..." ); | ||
| 2349 | // EM_log( CK_LOG_INFO, "FileIO: path: %s", path.c_str() ); | ||
| 2350 | // EM_pushlog(); | ||
| 2351 | // | ||
| 2352 | // // if no flag specified, make it READ by default | ||
| 2353 | // if( !(flags & FLAG_READ_WRITE) && | ||
| 2354 | // !(flags & FLAG_READONLY) && | ||
| 2355 | // !(flags & FLAG_WRITEONLY) && | ||
| 2356 | // !(flags & FLAG_APPEND) ) | ||
| 2357 | // { | ||
| 2358 | // flags |= FLAG_READONLY; | ||
| 2359 | // } | ||
| 2360 | // | ||
| 2361 | // // if both read and write, enable read and write | ||
| 2362 | // if( flags & FLAG_READONLY && flags & FLAG_WRITEONLY ) | ||
| 2363 | // { | ||
| 2364 | // flags ^= FLAG_READONLY; | ||
| 2365 | // flags ^= FLAG_WRITEONLY; | ||
| 2366 | // flags |= FLAG_READ_WRITE; | ||
| 2367 | // } | ||
| 2368 | // | ||
| 2369 | // // check flags for errors | ||
| 2370 | // if ((flags & TYPE_ASCII) && | ||
| 2371 | // (flags & TYPE_BINARY)) | ||
| 2372 | // { | ||
| 2373 | // EM_error3( "[chuck](via FileIO): cannot open file in both ASCII and binary mode" ); | ||
| 2374 | // goto error; | ||
| 2375 | // } | ||
| 2376 | // | ||
| 2377 | // if ((flags & FLAG_READ_WRITE) && | ||
| 2378 | // (flags & FLAG_READONLY)) | ||
| 2379 | // { | ||
| 2380 | // EM_error3( "[chuck](via FileIO): conflicting flags: READ_WRITE and READ" ); | ||
| 2381 | // goto error; | ||
| 2382 | // } | ||
| 2383 | // | ||
| 2384 | // if ((flags & FLAG_READ_WRITE) && | ||
| 2385 | // (flags & FLAG_WRITEONLY)) | ||
| 2386 | // { | ||
| 2387 | // EM_error3( "[chuck](via FileIO): conflicting flags: READ_WRITE and WRITE" ); | ||
| 2388 | // goto error; | ||
| 2389 | // } | ||
| 2390 | // | ||
| 2391 | // if ((flags & FLAG_READ_WRITE) && | ||
| 2392 | // (flags & FLAG_APPEND)) | ||
| 2393 | // { | ||
| 2394 | // EM_error3( "[chuck](via FileIO): conflicting flags: READ_WRITE and APPEND" ); | ||
| 2395 | // goto error; | ||
| 2396 | // } | ||
| 2397 | // | ||
| 2398 | // if ((flags & FLAG_WRITEONLY) && | ||
| 2399 | // (flags & FLAG_READONLY)) | ||
| 2400 | // { | ||
| 2401 | // EM_error3( "[chuck](via FileIO): conflicting flags: WRITE and READ" ); | ||
| 2402 | // goto error; | ||
| 2403 | // } | ||
| 2404 | // | ||
| 2405 | // if ((flags & FLAG_APPEND) && | ||
| 2406 | // (flags & FLAG_READONLY)) | ||
| 2407 | // { | ||
| 2408 | // EM_error3( "[chuck](via FileIO): conflicting flags: APPEND and FLAG_READ" ); | ||
| 2409 | // goto error; | ||
| 2410 | // } | ||
| 2411 | // | ||
| 2412 | // // set open flags | ||
| 2413 | // ios_base::openmode mode; | ||
| 2414 | // | ||
| 2415 | // if (flags & FLAG_READ_WRITE) | ||
| 2416 | // mode = ios_base::in | ios_base::out; | ||
| 2417 | // else if (flags & FLAG_READONLY) | ||
| 2418 | // mode = ios_base::in; | ||
| 2419 | // else if (flags & FLAG_APPEND) | ||
| 2420 | // mode = ios_base::out | ios_base::app; | ||
| 2421 | // else if (flags & FLAG_WRITEONLY) | ||
| 2422 | // mode = ios_base::out | ios_base::trunc; | ||
| 2423 | // | ||
| 2424 | // if (flags & TYPE_BINARY) | ||
| 2425 | // mode |= ios_base::binary; | ||
| 2426 | // | ||
| 2427 | // // close first | ||
| 2428 | // if (m_io.is_open()) | ||
| 2429 | // this->close(); | ||
| 2430 | // | ||
| 2431 | // // try to open as a dir first (fixed 1.3.0.0 removed warning) | ||
| 2432 | // if( (m_dir = opendir( path.c_str() )) ) | ||
| 2433 | // { | ||
| 2434 | // EM_poplog(); | ||
| 2435 | // return TRUE; | ||
| 2436 | // } | ||
| 2437 | // | ||
| 2438 | // // not a dir, create file if it does not exist unless flag is | ||
| 2439 | // // readonly | ||
| 2440 | // if ( !(flags & FLAG_READONLY) ) | ||
| 2441 | // { | ||
| 2442 | // m_io.open( path.c_str(), ios_base::in ); | ||
| 2443 | // if ( m_io.fail() ) | ||
| 2444 | // { | ||
| 2445 | // m_io.clear(); | ||
| 2446 | // m_io.open( path.c_str(), ios_base::out | ios_base::trunc ); | ||
| 2447 | // m_io.close(); | ||
| 2448 | // } | ||
| 2449 | // else | ||
| 2450 | // m_io.close(); | ||
| 2451 | // } | ||
| 2452 | // | ||
| 2453 | // //open file | ||
| 2454 | // m_io.open( path.c_str(), mode ); | ||
| 2455 | // | ||
| 2456 | // // seek to beginning if necessary | ||
| 2457 | // if (flags & FLAG_READ_WRITE) | ||
| 2458 | // { | ||
| 2459 | // m_io.seekp(0); | ||
| 2460 | // m_io.seekg(0); | ||
| 2461 | // } | ||
| 2462 | // | ||
| 2463 | // /* ATODO: Ge's code | ||
| 2464 | // // windows sucks for being creative in the wrong places | ||
| 2465 | // #ifdef __PLATFORM_WIN32__ | ||
| 2466 | // // if( flags ^ Chuck_IO::TRUNCATE && flags | Chuck_IO::READ ) nMode |= ios::nocreate; | ||
| 2467 | // m_io.open( path.c_str(), nMode ); | ||
| 2468 | // #else | ||
| 2469 | // m_io.open( path.c_str(), (_Ios_Openmode)nMode ); | ||
| 2470 | // #endif | ||
| 2471 | // */ | ||
| 2472 | // | ||
| 2473 | // // check for error | ||
| 2474 | // if( !(m_io.is_open()) ) | ||
| 2475 | // { | ||
| 2476 | // // EM_error3( "[chuck](via FileIO): cannot open file: '%s'", path.c_str() ); | ||
| 2477 | // goto error; | ||
| 2478 | // } | ||
| 2479 | // | ||
| 2480 | // // set path | ||
| 2481 | // m_path = path; | ||
| 2482 | // // set flags | ||
| 2483 | // m_flags = flags; | ||
| 2484 | // if (!(flags & TYPE_BINARY)) | ||
| 2485 | // m_flags |= Chuck_IO_File::TYPE_ASCII; // ASCII is default | ||
| 2486 | // // set mode | ||
| 2487 | // m_iomode = MODE_SYNC; | ||
| 2488 | // | ||
| 2489 | // // pop | ||
| 2490 | // EM_poplog(); | ||
| 2491 | // | ||
| 2492 | // return TRUE; | ||
| 2493 | // | ||
| 2494 | //error: | ||
| 2495 | // | ||
| 2496 | // // pop | ||
| 2497 | // EM_poplog(); | ||
| 2498 | // | ||
| 2499 | // // reset | ||
| 2500 | // m_path = ""; | ||
| 2501 | // m_flags = 0; | ||
| 2502 | // m_iomode = MODE_SYNC; | ||
| 2503 | // m_io.clear(); | ||
| 2504 | // m_io.close(); | ||
| 2505 | // | ||
| 2506 | // return FALSE; | ||
| 2507 | //} | ||
| 2508 | // | ||
| 2509 | // | ||
| 2510 | // | ||
| 2511 | // | ||
| 2512 | ////----------------------------------------------------------------------------- | ||
| 2513 | //// name: close | ||
| 2514 | //// desc: close file | ||
| 2515 | ////----------------------------------------------------------------------------- | ||
| 2516 | //void Chuck_IO_File::close() | ||
| 2517 | //{ | ||
| 2518 | // // log | ||
| 2519 | // EM_log( CK_LOG_INFO, "FileIO: closing file '%s'...", m_path.c_str() ); | ||
| 2520 | // // close it | ||
| 2521 | // m_io.close(); | ||
| 2522 | // m_flags = 0; | ||
| 2523 | // m_path = ""; | ||
| 2524 | // m_iomode = Chuck_IO::MODE_SYNC; | ||
| 2525 | // if ( m_dir ) { | ||
| 2526 | // closedir( m_dir ); | ||
| 2527 | // m_dir = NULL; | ||
| 2528 | // m_dir_start = 0; | ||
| 2529 | // } | ||
| 2530 | //} | ||
| 2531 | // | ||
| 2532 | // | ||
| 2533 | // | ||
| 2534 | // | ||
| 2535 | ////----------------------------------------------------------------------------- | ||
| 2536 | //// name: good() | ||
| 2537 | //// desc: ... | ||
| 2538 | ////----------------------------------------------------------------------------- | ||
| 2539 | //t_CKBOOL Chuck_IO_File::good() | ||
| 2540 | //{ | ||
| 2541 | // return m_dir || m_io.is_open(); | ||
| 2542 | // // return (!m_dir) && (!m_io.is_open()); | ||
| 2543 | //} | ||
| 2544 | // | ||
| 2545 | // | ||
| 2546 | // | ||
| 2547 | // | ||
| 2548 | ////----------------------------------------------------------------------------- | ||
| 2549 | //// name: flush() | ||
| 2550 | //// desc: ... | ||
| 2551 | ////----------------------------------------------------------------------------- | ||
| 2552 | //void Chuck_IO_File::flush() | ||
| 2553 | //{ | ||
| 2554 | // // sanity | ||
| 2555 | // if ( m_dir ) | ||
| 2556 | // { | ||
| 2557 | // EM_error3( "[chuck](via FileIO): cannot flush on directory" ); | ||
| 2558 | // return; | ||
| 2559 | // } | ||
| 2560 | // m_io.flush(); | ||
| 2561 | //} | ||
| 2562 | // | ||
| 2563 | // | ||
| 2564 | // | ||
| 2565 | // | ||
| 2566 | ////----------------------------------------------------------------------------- | ||
| 2567 | //// name: mode() | ||
| 2568 | //// desc: ... | ||
| 2569 | ////----------------------------------------------------------------------------- | ||
| 2570 | //t_CKINT Chuck_IO_File::mode() | ||
| 2571 | //{ | ||
| 2572 | // // sanity | ||
| 2573 | // if ( m_dir ) | ||
| 2574 | // { | ||
| 2575 | // EM_error3( "[chuck](via FileIO): cannot get mode on directory" ); | ||
| 2576 | // return -1; | ||
| 2577 | // } | ||
| 2578 | // return m_iomode; | ||
| 2579 | //} | ||
| 2580 | // | ||
| 2581 | // | ||
| 2582 | // | ||
| 2583 | // | ||
| 2584 | ////----------------------------------------------------------------------------- | ||
| 2585 | //// name: mode( t_CKINT flag ) | ||
| 2586 | //// desc: ... | ||
| 2587 | ////----------------------------------------------------------------------------- | ||
| 2588 | //void Chuck_IO_File::mode( t_CKINT flag ) | ||
| 2589 | //{ | ||
| 2590 | // // sanity | ||
| 2591 | // if ( m_dir ) | ||
| 2592 | // { | ||
| 2593 | // EM_error3( "[chuck](via FileIO): cannot set mode on directory" ); | ||
| 2594 | // return; | ||
| 2595 | // } | ||
| 2596 | // if ( (flag != Chuck_IO::MODE_ASYNC) && (flag != Chuck_IO::MODE_SYNC) ) | ||
| 2597 | // { | ||
| 2598 | // EM_error3( "[chuck](via FileIO): invalid mode flag" ); | ||
| 2599 | // return; | ||
| 2600 | // } | ||
| 2601 | // | ||
| 2602 | // m_iomode = flag; | ||
| 2603 | //} | ||
| 2604 | // | ||
| 2605 | // | ||
| 2606 | // | ||
| 2607 | // | ||
| 2608 | ////----------------------------------------------------------------------------- | ||
| 2609 | //// name: size() | ||
| 2610 | //// desc: Returns the size of the file in bytes, or -1 if no file is opened or | ||
| 2611 | //// if a directory is opened. | ||
| 2612 | ////----------------------------------------------------------------------------- | ||
| 2613 | //t_CKINT Chuck_IO_File::size() | ||
| 2614 | //{ | ||
| 2615 | // if (!(m_io.is_open())) return -1; | ||
| 2616 | // if ( m_dir ) | ||
| 2617 | // { | ||
| 2618 | // EM_error3( "[chuck](via FileIO): cannot get size on a directory" ); | ||
| 2619 | // return -1; | ||
| 2620 | // } | ||
| 2621 | // | ||
| 2622 | // // no easy way to find file size in C++ | ||
| 2623 | // // have to seek to end, report position | ||
| 2624 | // FILE * stream = fopen( m_path.c_str(), "r" ); | ||
| 2625 | // fseek( stream, 0L, SEEK_END ); | ||
| 2626 | // int endPos = ftell( stream ); | ||
| 2627 | // fclose( stream ); | ||
| 2628 | // return endPos; | ||
| 2629 | //} | ||
| 2630 | // | ||
| 2631 | // | ||
| 2632 | // | ||
| 2633 | // | ||
| 2634 | ////----------------------------------------------------------------------------- | ||
| 2635 | //// name: seek( t_CKINT pos ) | ||
| 2636 | //// desc: Seeks to the specified byte offset in the file. | ||
| 2637 | ////----------------------------------------------------------------------------- | ||
| 2638 | //void Chuck_IO_File::seek( t_CKINT pos ) | ||
| 2639 | //{ | ||
| 2640 | // if ( !(m_io.is_open()) ) | ||
| 2641 | // { | ||
| 2642 | // EM_error3( "[chuck](via FileIO): cannot seek: no file is open" ); | ||
| 2643 | // return; | ||
| 2644 | // } | ||
| 2645 | // if ( m_dir ) | ||
| 2646 | // { | ||
| 2647 | // EM_error3( "[chuck](via FileIO): cannot seek on a directory" ); | ||
| 2648 | // return; | ||
| 2649 | // } | ||
| 2650 | // m_io.seekg( pos ); | ||
| 2651 | // m_io.seekp( pos ); | ||
| 2652 | //} | ||
| 2653 | // | ||
| 2654 | // | ||
| 2655 | // | ||
| 2656 | // | ||
| 2657 | ////----------------------------------------------------------------------------- | ||
| 2658 | //// name: tell() | ||
| 2659 | //// desc: Returns the byte offset into the file, or -1 if no file is opened. | ||
| 2660 | ////----------------------------------------------------------------------------- | ||
| 2661 | //t_CKINT Chuck_IO_File::tell() | ||
| 2662 | //{ | ||
| 2663 | // if (!(m_io.is_open())) | ||
| 2664 | // return -1; | ||
| 2665 | // if ( m_dir ) | ||
| 2666 | // { | ||
| 2667 | // EM_error3( "[chuck](via FileIO): cannot tell on directory" ); | ||
| 2668 | // return -1; | ||
| 2669 | // } | ||
| 2670 | // | ||
| 2671 | // return m_io.tellg(); | ||
| 2672 | //} | ||
| 2673 | // | ||
| 2674 | // | ||
| 2675 | // | ||
| 2676 | // | ||
| 2677 | ////----------------------------------------------------------------------------- | ||
| 2678 | //// name: isDir() | ||
| 2679 | //// desc: ... | ||
| 2680 | ////----------------------------------------------------------------------------- | ||
| 2681 | //t_CKINT Chuck_IO_File::isDir() | ||
| 2682 | //{ | ||
| 2683 | // return m_dir != NULL; | ||
| 2684 | //} | ||
| 2685 | // | ||
| 2686 | // | ||
| 2687 | // | ||
| 2688 | // | ||
| 2689 | ////----------------------------------------------------------------------------- | ||
| 2690 | //// name: dirList() | ||
| 2691 | //// desc: ... | ||
| 2692 | ////----------------------------------------------------------------------------- | ||
| 2693 | //Chuck_Array4 * Chuck_IO_File::dirList() | ||
| 2694 | //{ | ||
| 2695 | // // sanity | ||
| 2696 | // if ( !m_dir ) | ||
| 2697 | // { | ||
| 2698 | // EM_error3( "[chuck](via FileIO): cannot get list: no directory open" ); | ||
| 2699 | // Chuck_Array4 *ret = new Chuck_Array4( TRUE, 0 ); | ||
| 2700 | // initialize_object( ret, m_vmRef->env()->t_array ); | ||
| 2701 | // return ret; | ||
| 2702 | // } | ||
| 2703 | // | ||
| 2704 | // // fill vector with entry names | ||
| 2705 | // rewinddir( m_dir ); | ||
| 2706 | // std::vector<Chuck_String *> entrylist; | ||
| 2707 | // struct dirent *ent; | ||
| 2708 | // while( (ent = readdir( m_dir )) ) // fixed 1.3.0.0: removed warning | ||
| 2709 | // { | ||
| 2710 | // // pass NULL as shred ref | ||
| 2711 | // Chuck_String *s = (Chuck_String *)instantiate_and_initialize_object( m_vmRef->env()->t_string, NULL, m_vmRef ); | ||
| 2712 | // s->set( std::string( ent->d_name ) ); | ||
| 2713 | // if ( s->str() != ".." && s->str() != "." ) | ||
| 2714 | // { | ||
| 2715 | // // don't include .. and . in the list | ||
| 2716 | // entrylist.push_back( s ); | ||
| 2717 | // } | ||
| 2718 | // } | ||
| 2719 | // | ||
| 2720 | // // make array | ||
| 2721 | // Chuck_Array4 *array = new Chuck_Array4( true, entrylist.size() ); | ||
| 2722 | // initialize_object( array, m_vmRef->env()->t_array ); | ||
| 2723 | // for ( int i = 0; i < entrylist.size(); i++ ) | ||
| 2724 | // array->set( i, (t_CKUINT) entrylist[i] ); | ||
| 2725 | // return array; | ||
| 2726 | //} | ||
| 2727 | 2365 | ||
| 2728 | 2366 | ||
| 2729 | 2367 | ||
| 2730 | 2368 | ||
| 2731 | //----------------------------------------------------------------------------- | 2369 | //----------------------------------------------------------------------------- |
| 2732 | // name: read( t_CKINT length ) | 2370 | // name: ~Chuck_IO_File() |
| 2733 | // desc: ... | 2371 | // desc: destructor |
| 2734 | //----------------------------------------------------------------------------- | 2372 | //----------------------------------------------------------------------------- |
| 2735 | /*Chuck_String * Chuck_IO_File::read( t_CKINT length ) | 2373 | Chuck_IO_File::~Chuck_IO_File() |
| 2736 | { | 2374 | { |
| 2737 | // sanity | 2375 | // clean up |
| 2738 | if (!(m_io.is_open())) { | 2376 | this->close(); |
| 2739 | EM_error3( "[chuck](via FileIO): cannot read: no file open" ); | 2377 | delete m_asyncEvent; |
| 2740 | return new Chuck_String( "" ); | 2378 | delete m_thread; |
| 2379 | } | ||
| 2380 | |||
| 2381 | |||
| 2382 | |||
| 2383 | |||
| 2384 | //----------------------------------------------------------------------------- | ||
| 2385 | // name: open | ||
| 2386 | // desc: open file from disk | ||
| 2387 | //----------------------------------------------------------------------------- | ||
| 2388 | t_CKBOOL Chuck_IO_File::open( const string & path, t_CKINT flags ) | ||
| 2389 | { | ||
| 2390 | // log | ||
| 2391 | EM_log( CK_LOG_INFO, "FileIO: opening file from disk..." ); | ||
| 2392 | EM_log( CK_LOG_INFO, "FileIO: path: %s", path.c_str() ); | ||
| 2393 | EM_pushlog(); | ||
| 2394 | |||
| 2395 | // if no flag specified, make it READ by default | ||
| 2396 | if( !(flags & FLAG_READ_WRITE) && | ||
| 2397 | !(flags & FLAG_READONLY) && | ||
| 2398 | !(flags & FLAG_WRITEONLY) && | ||
| 2399 | !(flags & FLAG_APPEND) ) | ||
| 2400 | { | ||
| 2401 | flags |= FLAG_READONLY; | ||
| 2741 | } | 2402 | } |
| 2742 | 2403 | ||
| 2743 | if (m_io.fail()) { | 2404 | // if both read and write, enable read and write |
| 2744 | EM_error3( "[chuck](via FileIO): cannot read: I/O stream failed" ); | 2405 | if( flags & FLAG_READONLY && flags & FLAG_WRITEONLY ) |
| 2745 | return new Chuck_String( "" ); | 2406 | { |
| 2407 | flags ^= FLAG_READONLY; | ||
| 2408 | flags ^= FLAG_WRITEONLY; | ||
| 2409 | flags |= FLAG_READ_WRITE; | ||
| 2746 | } | 2410 | } |
| 2747 | 2411 | ||
| 2748 | if ( m_dir ) | 2412 | // check flags for errors |
| 2413 | if ((flags & TYPE_ASCII) && | ||
| 2414 | (flags & TYPE_BINARY)) | ||
| 2749 | { | 2415 | { |
| 2750 | EM_error3( "[chuck](via FileIO): cannot read on a directory" ); | 2416 | EM_error3( "[chuck](via FileIO): cannot open file in both ASCII and binary mode" ); |
| 2751 | return new Chuck_String( "" ); | 2417 | goto error; |
| 2752 | } | 2418 | } |
| 2753 | |||
| 2754 | char buf[length+1]; | ||
| 2755 | m_io.read( buf, length ); | ||
| 2756 | buf[m_io.gcount()] = '\0'; | ||
| 2757 | string s( buf ); | ||
| 2758 | return new Chuck_String( s ); | ||
| 2759 | }*/ | ||
| 2760 | 2419 | ||
| 2420 | if ((flags & FLAG_READ_WRITE) && | ||
| 2421 | (flags & FLAG_READONLY)) | ||
| 2422 | { | ||
| 2423 | EM_error3( "[chuck](via FileIO): conflicting flags: READ_WRITE and READ" ); | ||
| 2424 | goto error; | ||
| 2425 | } | ||
| 2761 | 2426 | ||
| 2427 | if ((flags & FLAG_READ_WRITE) && | ||
| 2428 | (flags & FLAG_WRITEONLY)) | ||
| 2429 | { | ||
| 2430 | EM_error3( "[chuck](via FileIO): conflicting flags: READ_WRITE and WRITE" ); | ||
| 2431 | goto error; | ||
| 2432 | } | ||
| 2762 | 2433 | ||
| 2434 | if ((flags & FLAG_READ_WRITE) && | ||
| 2435 | (flags & FLAG_APPEND)) | ||
| 2436 | { | ||
| 2437 | EM_error3( "[chuck](via FileIO): conflicting flags: READ_WRITE and APPEND" ); | ||
| 2438 | goto error; | ||
| 2439 | } | ||
| 2763 | 2440 | ||
| 2764 | //----------------------------------------------------------------------------- | 2441 | if ((flags & FLAG_WRITEONLY) && |
| 2765 | // name: readLine() | 2442 | (flags & FLAG_READONLY)) |
| 2766 | // desc: read line | 2443 | { |
| 2767 | //----------------------------------------------------------------------------- | 2444 | EM_error3( "[chuck](via FileIO): conflicting flags: WRITE and READ" ); |
| 2768 | //Chuck_String * Chuck_IO_File::readLine() | 2445 | goto error; |
| 2769 | //{ | 2446 | } |
| 2770 | // // sanity | 2447 | |
| 2771 | // if (!(m_io.is_open())) { | 2448 | if ((flags & FLAG_APPEND) && |
| 2772 | // EM_error3( "[chuck](via FileIO): cannot readLine: no file open" ); | 2449 | (flags & FLAG_READONLY)) |
| 2773 | // return new Chuck_String( "" ); | 2450 | { |
| 2774 | // } | 2451 | EM_error3( "[chuck](via FileIO): conflicting flags: APPEND and FLAG_READ" ); |
| 2775 | // | 2452 | goto error; |
| 2776 | // if (m_io.fail()) { | 2453 | } |
| 2777 | // EM_error3( "[chuck](via FileIO): cannot readLine: I/O stream failed" ); | 2454 | |
| 2778 | // return new Chuck_String( "" ); | 2455 | // set open flags |
| 2779 | // } | 2456 | ios_base::openmode mode; |
| 2780 | // | 2457 | |
| 2781 | // if ( m_dir ) | 2458 | if (flags & FLAG_READ_WRITE) |
| 2782 | // { | 2459 | mode = ios_base::in | ios_base::out; |
| 2783 | // EM_error3( "[chuck](via FileIO): cannot readLine on directory" ); | 2460 | else if (flags & FLAG_READONLY) |
| 2784 | // return new Chuck_String( "" ); | 2461 | mode = ios_base::in; |
| 2785 | // } | 2462 | else if (flags & FLAG_APPEND) |
| 2786 | // | 2463 | mode = ios_base::out | ios_base::app; |
| 2787 | // string s; | 2464 | else if (flags & FLAG_WRITEONLY) |
| 2788 | // getline( m_io, s ); | 2465 | mode = ios_base::out | ios_base::trunc; |
| 2789 | // return new Chuck_String( s ); | 2466 | |
| 2790 | //} | 2467 | if (flags & TYPE_BINARY) |
| 2791 | // | 2468 | mode |= ios_base::binary; |
| 2792 | // | 2469 | |
| 2793 | // | 2470 | // close first |
| 2794 | // | 2471 | if (m_io.is_open()) |
| 2795 | ////----------------------------------------------------------------------------- | 2472 | this->close(); |
| 2796 | //// name: readInt( t_CKINT flags ) | 2473 | |
| 2797 | //// desc: ... | 2474 | // try to open as a dir first (fixed 1.3.0.0 removed warning) |
| 2798 | ////----------------------------------------------------------------------------- | 2475 | if( (m_dir = opendir( path.c_str() )) ) |
| 2799 | //t_CKINT Chuck_IO_File::readInt( t_CKINT flags ) | 2476 | { |
| 2800 | //{ | 2477 | EM_poplog(); |
| 2801 | // // sanity | 2478 | return TRUE; |
| 2802 | // if (!(m_io.is_open())) { | 2479 | } |
| 2803 | // EM_error3( "[chuck](via FileIO): cannot readInt: no file open" ); | 2480 | |
| 2804 | // return 0; | 2481 | // not a dir, create file if it does not exist unless flag is |
| 2805 | // } | 2482 | // readonly |
| 2806 | // | 2483 | if ( !(flags & FLAG_READONLY) ) |
| 2807 | // if (m_io.eof()) { | 2484 | { |
| 2808 | // EM_error3( "[chuck](via FileIO): cannot readInt: EOF reached" ); | 2485 | m_io.open( path.c_str(), ios_base::in ); |
| 2809 | // return 0; | 2486 | if ( m_io.fail() ) |
| 2810 | // } | 2487 | { |
| 2811 | // | 2488 | m_io.clear(); |
| 2812 | // if ( m_dir ) | 2489 | m_io.open( path.c_str(), ios_base::out | ios_base::trunc ); |
| 2813 | // { | 2490 | m_io.close(); |
| 2814 | // EM_error3( "[chuck](via FileIO): cannot read on directory" ); | 2491 | } |
| 2815 | // return 0; | 2492 | else |
| 2816 | // } | 2493 | m_io.close(); |
| 2817 | // | 2494 | } |
| 2818 | // if (m_io.fail()) { | 2495 | |
| 2819 | // EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | 2496 | //open file |
| 2820 | // return 0; | 2497 | m_io.open( path.c_str(), mode ); |
| 2821 | // } | 2498 | |
| 2822 | // | 2499 | // seek to beginning if necessary |
| 2823 | // if (m_flags & TYPE_ASCII) { | 2500 | if (flags & FLAG_READ_WRITE) |
| 2824 | // // ASCII | 2501 | { |
| 2825 | // t_CKINT val = 0; | 2502 | m_io.seekp(0); |
| 2826 | // m_io >> val; | 2503 | m_io.seekg(0); |
| 2827 | // // if (m_io.fail()) | 2504 | } |
| 2828 | // // EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | 2505 | |
| 2829 | // return val; | 2506 | /* ATODO: Ge's code |
| 2830 | // | 2507 | // windows sucks for being creative in the wrong places |
| 2831 | // } else if (m_flags & TYPE_BINARY) { | 2508 | #ifdef __PLATFORM_WIN32__ |
| 2832 | // // binary | 2509 | // if( flags ^ Chuck_IO::TRUNCATE && flags | Chuck_IO::READ ) nMode |= ios::nocreate; |
| 2833 | // if (flags & Chuck_IO::INT32) { | 2510 | m_io.open( path.c_str(), nMode ); |
| 2834 | // // 32-bit | 2511 | #else |
| 2835 | // t_CKINT i; | 2512 | m_io.open( path.c_str(), (_Ios_Openmode)nMode ); |
| 2836 | // m_io.read( (char *)&i, 4 ); | 2513 | #endif |
| 2837 | // if (m_io.gcount() != 4) | 2514 | */ |
| 2838 | // EM_error3( "[chuck](via FileIO): cannot readInt: not enough bytes left" ); | 2515 | |
| 2839 | // else if (m_io.fail()) | 2516 | // check for error |
| 2840 | // EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | 2517 | if( !(m_io.is_open()) ) |
| 2841 | // return i; | 2518 | { |
| 2842 | // } else if (flags & Chuck_IO::INT16) { | 2519 | // EM_error3( "[chuck](via FileIO): cannot open file: '%s'", path.c_str() ); |
| 2843 | // // 16-bit | 2520 | goto error; |
| 2844 | // // int16_t i; | 2521 | } |
| 2845 | // // issue: 64-bit | 2522 | |
| 2846 | // short i; | 2523 | // set path |
| 2847 | // m_io.read( (char *)&i, 2 ); | 2524 | m_path = path; |
| 2848 | // if (m_io.gcount() != 2) | 2525 | // set flags |
| 2849 | // EM_error3( "[chuck](via FileIO): cannot readInt: not enough bytes left" ); | 2526 | m_flags = flags; |
| 2850 | // else if (m_io.fail()) | 2527 | if (!(flags & TYPE_BINARY)) |
| 2851 | // EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | 2528 | m_flags |= Chuck_IO_File::TYPE_ASCII; // ASCII is default |
| 2852 | // return (t_CKINT) i; | 2529 | // set mode |
| 2853 | // } else if (flags & Chuck_IO::INT8) { | 2530 | m_iomode = MODE_SYNC; |
| 2854 | // // 8-bit | 2531 | |
| 2855 | // // int8_t i; | 2532 | // pop |
| 2856 | // // issue: 64-bit | 2533 | EM_poplog(); |
| 2857 | // char i; | 2534 | |
| 2858 | // m_io.read( (char *)&i, 1 ); | 2535 | return TRUE; |
| 2859 | // if (m_io.gcount() != 1) | 2536 | |
| 2860 | // EM_error3( "[chuck](via FileIO): cannot readInt: not enough bytes left" ); | 2537 | error: |
| 2861 | // else if (m_io.fail()) | 2538 | |
| 2862 | // EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | 2539 | // pop |
| 2863 | // return (t_CKINT) i; | 2540 | EM_poplog(); |
| 2864 | // } else { | 2541 | |
| 2865 | // EM_error3( "[chuck](via FileIO): readInt error: invalid int size flag" ); | 2542 | // reset |
| 2866 | // return 0; | 2543 | m_path = ""; |
| 2867 | // } | 2544 | m_flags = 0; |
| 2868 | // | 2545 | m_iomode = MODE_SYNC; |
| 2869 | // } else { | 2546 | m_io.clear(); |
| 2870 | // EM_error3( "[chuck](via FileIO): readInt error: invalid ASCII/binary flag" ); | 2547 | m_io.close(); |
| 2871 | // return 0; | 2548 | |
| 2872 | // } | 2549 | return FALSE; |
| 2873 | //} | 2550 | } |
| 2874 | // | 2551 | |
| 2875 | // | 2552 | |
| 2876 | // | 2553 | |
| 2877 | // | 2554 | |
| 2878 | ////----------------------------------------------------------------------------- | 2555 | //----------------------------------------------------------------------------- |
| 2879 | //// name: readFloat() | 2556 | // name: close |
| 2880 | //// desc: read next as (ascii) floating point value | 2557 | // desc: close file |
| 2881 | ////----------------------------------------------------------------------------- | 2558 | //----------------------------------------------------------------------------- |
| 2882 | //t_CKFLOAT Chuck_IO_File::readFloat() | 2559 | void Chuck_IO_File::close() |
| 2883 | //{ | 2560 | { |
| 2884 | // // sanity | 2561 | // log |
| 2885 | // if (!(m_io.is_open())) { | 2562 | EM_log( CK_LOG_INFO, "FileIO: closing file '%s'...", m_path.c_str() ); |
| 2886 | // EM_error3( "[chuck](via FileIO): cannot readFloat: no file open" ); | 2563 | // close it |
| 2887 | // return 0; | 2564 | m_io.close(); |
| 2888 | // } | 2565 | m_flags = 0; |
| 2889 | // | 2566 | m_path = ""; |
| 2890 | // if (m_io.eof()) { | 2567 | m_iomode = Chuck_IO::MODE_SYNC; |
| 2891 | // EM_error3( "[chuck](via FileIO): cannot readFloat: EOF reached" ); | 2568 | if ( m_dir ) { |
| 2892 | // return 0; | 2569 | closedir( m_dir ); |
| 2893 | // } | 2570 | m_dir = NULL; |
| 2894 | // | 2571 | m_dir_start = 0; |
| 2895 | // if (m_io.fail()) { | 2572 | } |
| 2896 | // EM_error3( "[chuck](via FileIO): cannot readFloat: I/O stream failed" ); | 2573 | } |
| 2897 | // return 0; | 2574 | |
| 2898 | // } | 2575 | |
| 2899 | // | 2576 | |
| 2900 | // if ( m_dir ) | 2577 | |
| 2901 | // { | 2578 | //----------------------------------------------------------------------------- |
| 2902 | // EM_error3( "[chuck](via FileIO): cannot read a directory" ); | 2579 | // name: good() |
| 2903 | // return 0; | 2580 | // desc: ... |
| 2904 | // } | 2581 | //----------------------------------------------------------------------------- |
| 2905 | // | 2582 | t_CKBOOL Chuck_IO_File::good() |
| 2906 | // if (m_flags & TYPE_ASCII) { | 2583 | { |
| 2907 | // // ASCII | 2584 | return m_dir || m_io.is_open(); |
| 2908 | // t_CKFLOAT val = 0; | 2585 | // return (!m_dir) && (!m_io.is_open()); |
| 2909 | // m_io >> val; | 2586 | } |
| 2910 | // // if (m_io.fail()) | 2587 | |
| 2911 | // // EM_error3( "[chuck](via FileIO): cannot readFloat: I/O stream failed" ); | 2588 | |
| 2912 | // return val; | 2589 | |
| 2913 | // | 2590 | |
| 2914 | // } else if (m_flags & TYPE_BINARY) { | 2591 | //----------------------------------------------------------------------------- |
| 2915 | // // binary | 2592 | // name: flush() |
| 2916 | // t_CKFLOAT i; | 2593 | // desc: ... |
| 2917 | // m_io.read( (char *)&i, sizeof(t_CKFLOAT) ); | 2594 | //----------------------------------------------------------------------------- |
| 2918 | // if (m_io.gcount() != sizeof(t_CKFLOAT) ) | 2595 | void Chuck_IO_File::flush() |
| 2919 | // EM_error3( "[chuck](via FileIO): cannot readFloat: not enough bytes left" ); | 2596 | { |
| 2920 | // else if (m_io.fail()) | 2597 | // sanity |
| 2921 | // EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | 2598 | if ( m_dir ) |
| 2922 | // return i; | 2599 | { |
| 2923 | // | 2600 | EM_error3( "[chuck](via FileIO): cannot flush on directory" ); |
| 2924 | // } else { | 2601 | return; |
| 2925 | // EM_error3( "[chuck](via FileIO): readFloat error: invalid ASCII/binary flag" ); | 2602 | } |
| 2926 | // return 0; | 2603 | m_io.flush(); |
| 2927 | // } | 2604 | } |
| 2928 | //} | 2605 | |
| 2929 | // | 2606 | |
| 2930 | // | 2607 | |
| 2931 | // | 2608 | |
| 2932 | // | 2609 | //----------------------------------------------------------------------------- |
| 2933 | ////----------------------------------------------------------------------------- | 2610 | // name: mode() |
| 2934 | //// name: readString() | 2611 | // desc: ... |
| 2935 | //// desc: ... | 2612 | //----------------------------------------------------------------------------- |
| 2936 | ////----------------------------------------------------------------------------- | 2613 | t_CKINT Chuck_IO_File::mode() |
| 2937 | //t_CKBOOL Chuck_IO_File::readString( std::string & str ) | 2614 | { |
| 2938 | //{ | 2615 | // sanity |
| 2939 | // // set | 2616 | if ( m_dir ) |
| 2940 | // str = ""; | 2617 | { |
| 2941 | // | 2618 | EM_error3( "[chuck](via FileIO): cannot get mode on directory" ); |
| 2942 | // // sanity | 2619 | return -1; |
| 2943 | // if (!(m_io.is_open())) { | 2620 | } |
| 2944 | // EM_error3( "[chuck](via FileIO): cannot readString: no file open" ); | 2621 | return m_iomode; |
| 2945 | // return FALSE; | 2622 | } |
| 2946 | // } | 2623 | |
| 2947 | // | 2624 | |
| 2948 | // if (m_io.eof()) { | 2625 | |
| 2949 | // EM_error3( "[chuck](via FileIO): cannot readString: EOF reached" ); | 2626 | |
| 2950 | // return FALSE; | 2627 | //----------------------------------------------------------------------------- |
| 2951 | // } | 2628 | // name: mode( t_CKINT flag ) |
| 2952 | // | 2629 | // desc: ... |
| 2953 | // if ( m_dir ) | 2630 | //----------------------------------------------------------------------------- |
| 2954 | // { | 2631 | void Chuck_IO_File::mode( t_CKINT flag ) |
| 2955 | // EM_error3( "[chuck](via FileIO): cannot read on directory" ); | 2632 | { |
| 2956 | // return FALSE; | 2633 | // sanity |
| 2957 | // } | 2634 | if ( m_dir ) |
| 2958 | // | 2635 | { |
| 2959 | // if (m_io.fail()) { | 2636 | EM_error3( "[chuck](via FileIO): cannot set mode on directory" ); |
| 2960 | // EM_error3( "[chuck](via FileIO): cannot readString: I/O stream failed" ); | 2637 | return; |
| 2961 | // return FALSE; | 2638 | } |
| 2962 | // } | 2639 | if ( (flag != Chuck_IO::MODE_ASYNC) && (flag != Chuck_IO::MODE_SYNC) ) |
| 2963 | // | 2640 | { |
| 2964 | // if (m_flags & TYPE_ASCII) { | 2641 | EM_error3( "[chuck](via FileIO): invalid mode flag" ); |
| 2965 | // // ASCII | 2642 | return; |
| 2966 | // m_io >> str; | 2643 | } |
| 2967 | // return TRUE; | 2644 | |
| 2968 | // } else if (m_flags & TYPE_BINARY) { | 2645 | m_iomode = flag; |
| 2969 | // EM_error3( "[chuck](via FileIO): readString not supported for binary mode" ); | 2646 | } |
| 2970 | // return FALSE; | 2647 | |
| 2971 | // } else { | 2648 | |
| 2972 | // EM_error3( "[chuck](via FileIO): readInt error: invalid ASCII/binary flag" ); | 2649 | |
| 2973 | // return FALSE; | 2650 | |
| 2974 | // } | 2651 | //----------------------------------------------------------------------------- |
| 2975 | //} | 2652 | // name: size() |
| 2653 | // desc: Returns the size of the file in bytes, or -1 if no file is opened or | ||
| 2654 | // if a directory is opened. | ||
| 2655 | //----------------------------------------------------------------------------- | ||
| 2656 | t_CKINT Chuck_IO_File::size() | ||
| 2657 | { | ||
| 2658 | if (!(m_io.is_open())) return -1; | ||
| 2659 | if ( m_dir ) | ||
| 2660 | { | ||
| 2661 | EM_error3( "[chuck](via FileIO): cannot get size on a directory" ); | ||
| 2662 | return -1; | ||
| 2663 | } | ||
| 2664 | |||
| 2665 | // no easy way to find file size in C++ | ||
| 2666 | // have to seek to end, report position | ||
| 2667 | FILE * stream = fopen( m_path.c_str(), "r" ); | ||
| 2668 | fseek( stream, 0L, SEEK_END ); | ||
| 2669 | int endPos = ftell( stream ); | ||
| 2670 | fclose( stream ); | ||
| 2671 | return endPos; | ||
| 2672 | } | ||
| 2673 | |||
| 2674 | |||
| 2675 | |||
| 2676 | |||
| 2677 | //----------------------------------------------------------------------------- | ||
| 2678 | // name: seek( t_CKINT pos ) | ||
| 2679 | // desc: Seeks to the specified byte offset in the file. | ||
| 2680 | //----------------------------------------------------------------------------- | ||
| 2681 | void Chuck_IO_File::seek( t_CKINT pos ) | ||
| 2682 | { | ||
| 2683 | if ( !(m_io.is_open()) ) | ||
| 2684 | { | ||
| 2685 | EM_error3( "[chuck](via FileIO): cannot seek: no file is open" ); | ||
| 2686 | return; | ||
| 2687 | } | ||
| 2688 | if ( m_dir ) | ||
| 2689 | { | ||
| 2690 | EM_error3( "[chuck](via FileIO): cannot seek on a directory" ); | ||
| 2691 | return; | ||
| 2692 | } | ||
| 2693 | m_io.seekg( pos ); | ||
| 2694 | m_io.seekp( pos ); | ||
| 2695 | } | ||
| 2696 | |||
| 2697 | |||
| 2698 | |||
| 2699 | |||
| 2700 | //----------------------------------------------------------------------------- | ||
| 2701 | // name: tell() | ||
| 2702 | // desc: Returns the byte offset into the file, or -1 if no file is opened. | ||
| 2703 | //----------------------------------------------------------------------------- | ||
| 2704 | t_CKINT Chuck_IO_File::tell() | ||
| 2705 | { | ||
| 2706 | if (!(m_io.is_open())) | ||
| 2707 | return -1; | ||
| 2708 | if ( m_dir ) | ||
| 2709 | { | ||
| 2710 | EM_error3( "[chuck](via FileIO): cannot tell on directory" ); | ||
| 2711 | return -1; | ||
| 2712 | } | ||
| 2713 | |||
| 2714 | return m_io.tellg(); | ||
| 2715 | } | ||
| 2716 | |||
| 2717 | |||
| 2718 | |||
| 2719 | |||
| 2720 | //----------------------------------------------------------------------------- | ||
| 2721 | // name: isDir() | ||
| 2722 | // desc: ... | ||
| 2723 | //----------------------------------------------------------------------------- | ||
| 2724 | t_CKINT Chuck_IO_File::isDir() | ||
| 2725 | { | ||
| 2726 | return m_dir != NULL; | ||
| 2727 | } | ||
| 2728 | |||
| 2729 | |||
| 2730 | |||
| 2731 | |||
| 2732 | //----------------------------------------------------------------------------- | ||
| 2733 | // name: dirList() | ||
| 2734 | // desc: ... | ||
| 2735 | //----------------------------------------------------------------------------- | ||
| 2736 | Chuck_Array4 * Chuck_IO_File::dirList() | ||
| 2737 | { | ||
| 2738 | // sanity | ||
| 2739 | if ( !m_dir ) | ||
| 2740 | { | ||
| 2741 | EM_error3( "[chuck](via FileIO): cannot get list: no directory open" ); | ||
| 2742 | Chuck_Array4 *ret = new Chuck_Array4( TRUE, 0 ); | ||
| 2743 | initialize_object( ret, m_vmRef->env()->t_array ); | ||
| 2744 | return ret; | ||
| 2745 | } | ||
| 2746 | |||
| 2747 | // fill vector with entry names | ||
| 2748 | rewinddir( m_dir ); | ||
| 2749 | std::vector<Chuck_String *> entrylist; | ||
| 2750 | struct dirent *ent; | ||
| 2751 | while( (ent = readdir( m_dir )) ) // fixed 1.3.0.0: removed warning | ||
| 2752 | { | ||
| 2753 | // pass NULL as shred ref | ||
| 2754 | Chuck_String *s = (Chuck_String *)instantiate_and_initialize_object( m_vmRef->env()->t_string, NULL, m_vmRef ); | ||
| 2755 | s->set( std::string( ent->d_name ) ); | ||
| 2756 | if ( s->str() != ".." && s->str() != "." ) | ||
| 2757 | { | ||
| 2758 | // don't include .. and . in the list | ||
| 2759 | entrylist.push_back( s ); | ||
| 2760 | } | ||
| 2761 | } | ||
| 2762 | |||
| 2763 | // make array | ||
| 2764 | Chuck_Array4 *array = new Chuck_Array4( true, entrylist.size() ); | ||
| 2765 | initialize_object( array, m_vmRef->env()->t_array ); | ||
| 2766 | for ( int i = 0; i < entrylist.size(); i++ ) | ||
| 2767 | array->set( i, (t_CKUINT) entrylist[i] ); | ||
| 2768 | return array; | ||
| 2769 | } | ||
| 2770 | |||
| 2771 | |||
| 2772 | |||
| 2773 | |||
| 2774 | //----------------------------------------------------------------------------- | ||
| 2775 | // name: read( t_CKINT length ) | ||
| 2776 | // desc: ... | ||
| 2777 | //----------------------------------------------------------------------------- | ||
| 2778 | /*Chuck_String * Chuck_IO_File::read( t_CKINT length ) | ||
| 2779 | { | ||
| 2780 | // sanity | ||
| 2781 | if (!(m_io.is_open())) { | ||
| 2782 | EM_error3( "[chuck](via FileIO): cannot read: no file open" ); | ||
| 2783 | return new Chuck_String( "" ); | ||
| 2784 | } | ||
| 2785 | |||
| 2786 | if (m_io.fail()) { | ||
| 2787 | EM_error3( "[chuck](via FileIO): cannot read: I/O stream failed" ); | ||
| 2788 | return new Chuck_String( "" ); | ||
| 2789 | } | ||
| 2790 | |||
| 2791 | if ( m_dir ) | ||
| 2792 | { | ||
| 2793 | EM_error3( "[chuck](via FileIO): cannot read on a directory" ); | ||
| 2794 | return new Chuck_String( "" ); | ||
| 2795 | } | ||
| 2796 | |||
| 2797 | char buf[length+1]; | ||
| 2798 | m_io.read( buf, length ); | ||
| 2799 | buf[m_io.gcount()] = '\0'; | ||
| 2800 | string s( buf ); | ||
| 2801 | return new Chuck_String( s ); | ||
| 2802 | }*/ | ||
| 2803 | |||
| 2804 | |||
| 2805 | |||
| 2806 | |||
| 2807 | //----------------------------------------------------------------------------- | ||
| 2808 | // name: readLine() | ||
| 2809 | // desc: read line | ||
| 2810 | //----------------------------------------------------------------------------- | ||
| 2811 | Chuck_String * Chuck_IO_File::readLine() | ||
| 2812 | { | ||
| 2813 | // sanity | ||
| 2814 | if (!(m_io.is_open())) { | ||
| 2815 | EM_error3( "[chuck](via FileIO): cannot readLine: no file open" ); | ||
| 2816 | return new Chuck_String( "" ); | ||
| 2817 | } | ||
| 2818 | |||
| 2819 | if (m_io.fail()) { | ||
| 2820 | EM_error3( "[chuck](via FileIO): cannot readLine: I/O stream failed" ); | ||
| 2821 | return new Chuck_String( "" ); | ||
| 2822 | } | ||
| 2823 | |||
| 2824 | if ( m_dir ) | ||
| 2825 | { | ||
| 2826 | EM_error3( "[chuck](via FileIO): cannot readLine on directory" ); | ||
| 2827 | return new Chuck_String( "" ); | ||
| 2828 | } | ||
| 2829 | |||
| 2830 | string s; | ||
| 2831 | getline( m_io, s ); | ||
| 2832 | return new Chuck_String( s ); | ||
| 2833 | } | ||
| 2834 | |||
| 2835 | |||
| 2836 | |||
| 2837 | |||
| 2838 | //----------------------------------------------------------------------------- | ||
| 2839 | // name: readInt( t_CKINT flags ) | ||
| 2840 | // desc: ... | ||
| 2841 | //----------------------------------------------------------------------------- | ||
| 2842 | t_CKINT Chuck_IO_File::readInt( t_CKINT flags ) | ||
| 2843 | { | ||
| 2844 | // sanity | ||
| 2845 | if (!(m_io.is_open())) { | ||
| 2846 | EM_error3( "[chuck](via FileIO): cannot readInt: no file open" ); | ||
| 2847 | return 0; | ||
| 2848 | } | ||
| 2849 | |||
| 2850 | if (m_io.eof()) { | ||
| 2851 | EM_error3( "[chuck](via FileIO): cannot readInt: EOF reached" ); | ||
| 2852 | return 0; | ||
| 2853 | } | ||
| 2854 | |||
| 2855 | if ( m_dir ) | ||
| 2856 | { | ||
| 2857 | EM_error3( "[chuck](via FileIO): cannot read on directory" ); | ||
| 2858 | return 0; | ||
| 2859 | } | ||
| 2860 | |||
| 2861 | if (m_io.fail()) { | ||
| 2862 | EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | ||
| 2863 | return 0; | ||
| 2864 | } | ||
| 2865 | |||
| 2866 | if (m_flags & TYPE_ASCII) { | ||
| 2867 | // ASCII | ||
| 2868 | t_CKINT val = 0; | ||
| 2869 | m_io >> val; | ||
| 2870 | // if (m_io.fail()) | ||
| 2871 | // EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | ||
| 2872 | return val; | ||
| 2873 | |||
| 2874 | } else if (m_flags & TYPE_BINARY) { | ||
| 2875 | // binary | ||
| 2876 | if (flags & Chuck_IO::INT32) { | ||
| 2877 | // 32-bit | ||
| 2878 | t_CKINT i; | ||
| 2879 | m_io.read( (char *)&i, 4 ); | ||
| 2880 | if (m_io.gcount() != 4) | ||
| 2881 | EM_error3( "[chuck](via FileIO): cannot readInt: not enough bytes left" ); | ||
| 2882 | else if (m_io.fail()) | ||
| 2883 | EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | ||
| 2884 | return i; | ||
| 2885 | } else if (flags & Chuck_IO::INT16) { | ||
| 2886 | // 16-bit | ||
| 2887 | // int16_t i; | ||
| 2888 | // issue: 64-bit | ||
| 2889 | short i; | ||
| 2890 | m_io.read( (char *)&i, 2 ); | ||
| 2891 | if (m_io.gcount() != 2) | ||
| 2892 | EM_error3( "[chuck](via FileIO): cannot readInt: not enough bytes left" ); | ||
| 2893 | else if (m_io.fail()) | ||
| 2894 | EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | ||
| 2895 | return (t_CKINT) i; | ||
| 2896 | } else if (flags & Chuck_IO::INT8) { | ||
| 2897 | // 8-bit | ||
| 2898 | // int8_t i; | ||
| 2899 | // issue: 64-bit | ||
| 2900 | char i; | ||
| 2901 | m_io.read( (char *)&i, 1 ); | ||
| 2902 | if (m_io.gcount() != 1) | ||
| 2903 | EM_error3( "[chuck](via FileIO): cannot readInt: not enough bytes left" ); | ||
| 2904 | else if (m_io.fail()) | ||
| 2905 | EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | ||
| 2906 | return (t_CKINT) i; | ||
| 2907 | } else { | ||
| 2908 | EM_error3( "[chuck](via FileIO): readInt error: invalid int size flag" ); | ||
| 2909 | return 0; | ||
| 2910 | } | ||
| 2911 | |||
| 2912 | } else { | ||
| 2913 | EM_error3( "[chuck](via FileIO): readInt error: invalid ASCII/binary flag" ); | ||
| 2914 | return 0; | ||
| 2915 | } | ||
| 2916 | } | ||
| 2917 | |||
| 2918 | |||
| 2919 | |||
| 2920 | |||
| 2921 | //----------------------------------------------------------------------------- | ||
| 2922 | // name: readFloat() | ||
| 2923 | // desc: read next as (ascii) floating point value | ||
| 2924 | //----------------------------------------------------------------------------- | ||
| 2925 | t_CKFLOAT Chuck_IO_File::readFloat() | ||
| 2926 | { | ||
| 2927 | // sanity | ||
| 2928 | if (!(m_io.is_open())) { | ||
| 2929 | EM_error3( "[chuck](via FileIO): cannot readFloat: no file open" ); | ||
| 2930 | return 0; | ||
| 2931 | } | ||
| 2932 | |||
| 2933 | if (m_io.eof()) { | ||
| 2934 | EM_error3( "[chuck](via FileIO): cannot readFloat: EOF reached" ); | ||
| 2935 | return 0; | ||
| 2936 | } | ||
| 2937 | |||
| 2938 | if (m_io.fail()) { | ||
| 2939 | EM_error3( "[chuck](via FileIO): cannot readFloat: I/O stream failed" ); | ||
| 2940 | return 0; | ||
| 2941 | } | ||
| 2942 | |||
| 2943 | if ( m_dir ) | ||
| 2944 | { | ||
| 2945 | EM_error3( "[chuck](via FileIO): cannot read a directory" ); | ||
| 2946 | return 0; | ||
| 2947 | } | ||
| 2948 | |||
| 2949 | if (m_flags & TYPE_ASCII) { | ||
| 2950 | // ASCII | ||
| 2951 | t_CKFLOAT val = 0; | ||
| 2952 | m_io >> val; | ||
| 2953 | // if (m_io.fail()) | ||
| 2954 | // EM_error3( "[chuck](via FileIO): cannot readFloat: I/O stream failed" ); | ||
| 2955 | return val; | ||
| 2956 | |||
| 2957 | } else if (m_flags & TYPE_BINARY) { | ||
| 2958 | // binary | ||
| 2959 | t_CKFLOAT i; | ||
| 2960 | m_io.read( (char *)&i, sizeof(t_CKFLOAT) ); | ||
| 2961 | if (m_io.gcount() != sizeof(t_CKFLOAT) ) | ||
| 2962 | EM_error3( "[chuck](via FileIO): cannot readFloat: not enough bytes left" ); | ||
| 2963 | else if (m_io.fail()) | ||
| 2964 | EM_error3( "[chuck](via FileIO): cannot readInt: I/O stream failed" ); | ||
| 2965 | return i; | ||
| 2966 | |||
| 2967 | } else { | ||
| 2968 | EM_error3( "[chuck](via FileIO): readFloat error: invalid ASCII/binary flag" ); | ||
| 2969 | return 0; | ||
| 2970 | } | ||
| 2971 | } | ||
| 2972 | |||
| 2973 | |||
| 2974 | |||
| 2975 | |||
| 2976 | //----------------------------------------------------------------------------- | ||
| 2977 | // name: readString() | ||
| 2978 | // desc: ... | ||
| 2979 | //----------------------------------------------------------------------------- | ||
| 2980 | t_CKBOOL Chuck_IO_File::readString( std::string & str ) | ||
| 2981 | { | ||
| 2982 | // set | ||
| 2983 | str = ""; | ||
| 2984 | |||
| 2985 | // sanity | ||
| 2986 | if (!(m_io.is_open())) { | ||
| 2987 | EM_error3( "[chuck](via FileIO): cannot readString: no file open" ); | ||
| 2988 | return FALSE; | ||
| 2989 | } | ||
| 2990 | |||
| 2991 | if (m_io.eof()) { | ||
| 2992 | EM_error3( "[chuck](via FileIO): cannot readString: EOF reached" ); | ||
| 2993 | return FALSE; | ||
| 2994 | } | ||
| 2995 | |||
| 2996 | if ( m_dir ) | ||
| 2997 | { | ||
| 2998 | EM_error3( "[chuck](via FileIO): cannot read on directory" ); | ||
| 2999 | return FALSE; | ||
| 3000 | } | ||
| 3001 | |||
| 3002 | if (m_io.fail()) { | ||
| 3003 | EM_error3( "[chuck](via FileIO): cannot readString: I/O stream failed" ); | ||
| 3004 | return FALSE; | ||
| 3005 | } | ||
| 3006 | |||
| 3007 | if (m_flags & TYPE_ASCII) { | ||
| 3008 | // ASCII | ||
| 3009 | m_io >> str; | ||
| 3010 | return TRUE; | ||
| 3011 | } else if (m_flags & TYPE_BINARY) { | ||
| 3012 | EM_error3( "[chuck](via FileIO): readString not supported for binary mode" ); | ||
| 3013 | return FALSE; | ||
| 3014 | } else { | ||
| 3015 | EM_error3( "[chuck](via FileIO): readInt error: invalid ASCII/binary flag" ); | ||
| 3016 | return FALSE; | ||
| 3017 | } | ||
| 3018 | } | ||
| 2976 | 3019 | ||
| 2977 | 3020 | ||
| 2978 | 3021 | ||
| @@ -2981,13 +3024,13 @@ Chuck_IO::~Chuck_IO() · 2 unmodified lines | |||
| 2981 | 3024 | ||
| 2982 | THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::read_thread ) ( void *data ) | 3025 | THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::read_thread ) ( void *data ) |
| 2983 | { | 3026 | { |
| 2984 | // (ATODO: test this) | 3027 | (ATODO: test this) |
| 2985 | cerr << "In thread" << endl; | 3028 | cerr << "In thread" << endl; |
| 2986 | async_args *args = (async_args *)data; | 3029 | async_args *args = (async_args *)data; |
| 2987 | Chuck_String *ret = (Chuck_String *)(args->RETURN); | 3030 | Chuck_String *ret = (Chuck_String *)(args->RETURN); |
| 2988 | ret = args->fileio_obj->read( args->intArg ); | 3031 | ret = args->fileio_obj->read( args->intArg ); |
| 2989 | cerr << "Called FileIO.read(int)" << endl; | 3032 | cerr << "Called FileIO.read(int)" << endl; |
| 2990 | args->fileio_obj->m_asyncEvent->broadcast(); // wake up | 3033 | args->fileio_obj->m_asyncEvent->broadcast(); wake up |
| 2991 | cerr << "Broadcasted on event" << endl; | 3034 | cerr << "Broadcasted on event" << endl; |
| 2992 | cerr << "Sleeping" << endl; | 3035 | cerr << "Sleeping" << endl; |
| 2993 | sleep(5); | 3036 | sleep(5); |
| @@ -3000,18 +3043,18 @@ Chuck_IO::~Chuck_IO() · 6 unmodified lines | |||
| 3000 | 3043 | ||
| 3001 | THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::readLine_thread ) ( void *data ) | 3044 | THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::readLine_thread ) ( void *data ) |
| 3002 | { | 3045 | { |
| 3003 | // not yet implemented | 3046 | not yet implemented |
| 3004 | return NULL; | 3047 | return NULL; |
| 3005 | } | 3048 | } |
| 3006 | 3049 | ||
| 3007 | THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::readInt_thread ) ( void *data ) | 3050 | THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::readInt_thread ) ( void *data ) |
| 3008 | { | 3051 | { |
| 3009 | // (ATODO: test this) | 3052 | (ATODO: test this) |
| 3010 | async_args *args = (async_args *)data; | 3053 | async_args *args = (async_args *)data; |
| 3011 | Chuck_DL_Return *ret = (Chuck_DL_Return *)(args->RETURN); | 3054 | Chuck_DL_Return *ret = (Chuck_DL_Return *)(args->RETURN); |
| 3012 | ret->v_int = args->fileio_obj->readInt( args->intArg ); | 3055 | ret->v_int = args->fileio_obj->readInt( args->intArg ); |
| 3013 | cerr << "Called readInt, set ret->v_int to " << ret->v_int << endl; | 3056 | cerr << "Called readInt, set ret->v_int to " << ret->v_int << endl; |
| 3014 | args->fileio_obj->m_asyncEvent->broadcast(); // wake up | 3057 | args->fileio_obj->m_asyncEvent->broadcast(); wake up |
| 3015 | cerr << "Called broadcast" << endl; | 3058 | cerr << "Called broadcast" << endl; |
| 3016 | delete args; | 3059 | delete args; |
| 3017 | 3060 | ||
| @@ -3020,7 +3063,7 @@ Chuck_IO::~Chuck_IO() · 2 unmodified lines | |||
| 3020 | 3063 | ||
| 3021 | THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::readFloat_thread ) ( void *data ) | 3064 | THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::readFloat_thread ) ( void *data ) |
| 3022 | { | 3065 | { |
| 3023 | // not yet implemented | 3066 | not yet implemented |
| 3024 | return NULL; | 3067 | return NULL; |
| 3025 | } | 3068 | } |
| 3026 | */ | 3069 | */ |
| @@ -3029,213 +3072,217 @@ Chuck_IO::~Chuck_IO() · 2 unmodified lines | |||
| 3029 | // name: eof() | 3072 | // name: eof() |
| 3030 | // desc: end of file? | 3073 | // desc: end of file? |
| 3031 | //----------------------------------------------------------------------------- | 3074 | //----------------------------------------------------------------------------- |
| 3032 | //t_CKBOOL Chuck_IO_File::eof() | 3075 | t_CKBOOL Chuck_IO_File::eof() |
| 3033 | //{ | 3076 | { |
| 3034 | // if( !m_io.is_open() ) | 3077 | if( !m_io.is_open() ) |
| 3035 | // { | 3078 | { |
| 3036 | // // EM_error3( "[chuck](via FileIO): cannot check eof: no file open" ); | 3079 | // EM_error3( "[chuck](via FileIO): cannot check eof: no file open" ); |
| 3037 | // return TRUE; | 3080 | return TRUE; |
| 3038 | // } | 3081 | } |
| 3039 | // if( m_dir ) | 3082 | if( m_dir ) |
| 3040 | // { | 3083 | { |
| 3041 | // EM_error3( "[chuck](via FileIO): cannot check eof on directory" ); | 3084 | EM_error3( "[chuck](via FileIO): cannot check eof on directory" ); |
| 3042 | // return TRUE; | 3085 | return TRUE; |
| 3043 | // } | 3086 | } |
| 3044 | // | 3087 | |
| 3045 | // return m_io.eof() || m_io.fail(); | 3088 | return m_io.eof() || m_io.fail(); |
| 3046 | //} | 3089 | } |
| 3047 | // | 3090 | |
| 3048 | // | 3091 | |
| 3049 | // | 3092 | |
| 3050 | // | 3093 | |
| 3051 | ////----------------------------------------------------------------------------- | 3094 | //----------------------------------------------------------------------------- |
| 3052 | //// name: write( const std::string & val ) | 3095 | // name: write( const std::string & val ) |
| 3053 | //// desc: ... | 3096 | // desc: ... |
| 3054 | ////----------------------------------------------------------------------------- | 3097 | //----------------------------------------------------------------------------- |
| 3055 | //void Chuck_IO_File::write( const std::string & val ) | 3098 | void Chuck_IO_File::write( const std::string & val ) |
| 3056 | //{ | 3099 | { |
| 3057 | // // sanity | 3100 | // sanity |
| 3058 | // if (!(m_io.is_open())) { | 3101 | if (!(m_io.is_open())) { |
| 3059 | // EM_error3( "[chuck](via FileIO): cannot write: no file open" ); | 3102 | EM_error3( "[chuck](via FileIO): cannot write: no file open" ); |
| 3060 | // return; | 3103 | return; |
| 3061 | // } | 3104 | } |
| 3062 | // | 3105 | |
| 3063 | // if (m_io.fail()) { | 3106 | if (m_io.fail()) { |
| 3064 | // EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); | 3107 | EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); |
| 3065 | // return; | 3108 | return; |
| 3066 | // } | 3109 | } |
| 3067 | // | 3110 | |
| 3068 | // if ( m_dir ) | 3111 | if ( m_dir ) |
| 3069 | // { | 3112 | { |
| 3070 | // EM_error3( "[chuck](via FileIO): cannot write to a directory" ); | 3113 | EM_error3( "[chuck](via FileIO): cannot write to a directory" ); |
| 3071 | // return; | 3114 | return; |
| 3072 | // } | 3115 | } |
| 3073 | // | 3116 | |
| 3074 | // m_io.write( val.c_str(), val.size() ); | 3117 | m_io.write( val.c_str(), val.size() ); |
| 3075 | // | 3118 | |
| 3076 | // if (m_io.fail()) { // check both before and after write if stream is ok | 3119 | if (m_io.fail()) { // check both before and after write if stream is ok |
| 3077 | // EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); | 3120 | EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); |
| 3078 | // } | 3121 | } |
| 3079 | //} | 3122 | } |
| 3080 | // | 3123 | |
| 3081 | // | 3124 | |
| 3082 | // | 3125 | |
| 3083 | // | 3126 | |
| 3084 | ////----------------------------------------------------------------------------- | 3127 | //----------------------------------------------------------------------------- |
| 3085 | //// name: write( t_CKINT val ) | 3128 | // name: write( t_CKINT val ) |
| 3086 | //// desc: ... | 3129 | // desc: ... |
| 3087 | ////----------------------------------------------------------------------------- | 3130 | //----------------------------------------------------------------------------- |
| 3088 | //void Chuck_IO_File::write( t_CKINT val ) | 3131 | void Chuck_IO_File::write( t_CKINT val ) |
| 3089 | //{ | 3132 | { |
| 3090 | // // sanity | 3133 | // sanity |
| 3091 | // if (!(m_io.is_open())) { | 3134 | if (!(m_io.is_open())) { |
| 3092 | // EM_error3( "[chuck](via FileIO): cannot write: no file open" ); | 3135 | EM_error3( "[chuck](via FileIO): cannot write: no file open" ); |
| 3093 | // return; | 3136 | return; |
| 3094 | // } | 3137 | } |
| 3095 | // | 3138 | |
| 3096 | // if (m_io.fail()) { | 3139 | if (m_io.fail()) { |
| 3097 | // EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); | 3140 | EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); |
| 3098 | // return; | 3141 | return; |
| 3099 | // } | 3142 | } |
| 3100 | // | 3143 | |
| 3101 | // if ( m_dir ) | 3144 | if ( m_dir ) |
| 3102 | // { | 3145 | { |
| 3103 | // EM_error3( "[chuck](via FileIO): cannot write on directory" ); | 3146 | EM_error3( "[chuck](via FileIO): cannot write on directory" ); |
| 3104 | // return; | 3147 | return; |
| 3105 | // } | 3148 | } |
| 3106 | // | 3149 | |
| 3107 | // if (m_flags & TYPE_ASCII) { | 3150 | if (m_flags & TYPE_ASCII) { |
| 3108 | // m_io << val; | 3151 | m_io << val; |
| 3109 | // } else if (m_flags & TYPE_BINARY) { | 3152 | } else if (m_flags & TYPE_BINARY) { |
| 3110 | // m_io.write( (char *)&val, sizeof(t_CKINT) ); | 3153 | m_io.write( (char *)&val, sizeof(t_CKINT) ); |
| 3111 | // } else { | 3154 | } else { |
| 3112 | // EM_error3( "[chuck](via FileIO): write error: invalid ASCII/binary flag" ); | 3155 | EM_error3( "[chuck](via FileIO): write error: invalid ASCII/binary flag" ); |
| 3113 | // } | 3156 | } |
| 3114 | // | 3157 | |
| 3115 | // if (m_io.fail()) { // check both before and after write if stream is ok | 3158 | if (m_io.fail()) { // check both before and after write if stream is ok |
| 3116 | // EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); | 3159 | EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); |
| 3117 | // } | 3160 | } |
| 3118 | //} | 3161 | } |
| 3119 | // | 3162 | |
| 3120 | // | 3163 | |
| 3121 | // | 3164 | |
| 3122 | // | 3165 | |
| 3123 | ////----------------------------------------------------------------------------- | 3166 | //----------------------------------------------------------------------------- |
| 3124 | //// name: write( t_CKINT val ) | 3167 | // name: write( t_CKINT val ) |
| 3125 | //// desc: ... | 3168 | // desc: ... |
| 3126 | ////----------------------------------------------------------------------------- | 3169 | //----------------------------------------------------------------------------- |
| 3127 | //void Chuck_IO_File::write( t_CKINT val, t_CKINT flags ) | 3170 | void Chuck_IO_File::write( t_CKINT val, t_CKINT flags ) |
| 3128 | //{ | 3171 | { |
| 3129 | // // sanity | 3172 | // sanity |
| 3130 | // if (!(m_io.is_open())) { | 3173 | if (!(m_io.is_open())) { |
| 3131 | // EM_error3( "[chuck](via FileIO): cannot write: no file open" ); | 3174 | EM_error3( "[chuck](via FileIO): cannot write: no file open" ); |
| 3132 | // return; | 3175 | return; |
| 3133 | // } | 3176 | } |
| 3134 | // | 3177 | |
| 3135 | // if (m_io.fail()) { | 3178 | if (m_io.fail()) { |
| 3136 | // EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); | 3179 | EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); |
| 3137 | // return; | 3180 | return; |
| 3138 | // } | 3181 | } |
| 3139 | // | 3182 | |
| 3140 | // if ( m_dir ) | 3183 | if ( m_dir ) |
| 3141 | // { | 3184 | { |
| 3142 | // EM_error3( "[chuck](via FileIO): cannot write on directory" ); | 3185 | EM_error3( "[chuck](via FileIO): cannot write on directory" ); |
| 3143 | // return; | 3186 | return; |
| 3144 | // } | 3187 | } |
| 3145 | // | 3188 | |
| 3146 | // if (m_flags & TYPE_ASCII) { | 3189 | if (m_flags & TYPE_ASCII) { |
| 3147 | // m_io << val; | 3190 | m_io << val; |
| 3148 | // } else if (m_flags & TYPE_BINARY) { | 3191 | } else if (m_flags & TYPE_BINARY) { |
| 3149 | // int nBytes = 4; | 3192 | int nBytes = 4; |
| 3150 | // if(flags & INT8) nBytes = 1; | 3193 | if(flags & INT8) nBytes = 1; |
| 3151 | // else if(flags & INT16) nBytes = 2; | 3194 | else if(flags & INT16) nBytes = 2; |
| 3152 | // else if(flags & INT32) nBytes = 4; | 3195 | else if(flags & INT32) nBytes = 4; |
| 3153 | // m_io.write( (char *)&val, nBytes ); | 3196 | m_io.write( (char *)&val, nBytes ); |
| 3154 | // } else { | 3197 | } else { |
| 3155 | // EM_error3( "[chuck](via FileIO): write error: invalid ASCII/binary flag" ); | 3198 | EM_error3( "[chuck](via FileIO): write error: invalid ASCII/binary flag" ); |
| 3156 | // } | 3199 | } |
| 3157 | // | 3200 | |
| 3158 | // if (m_io.fail()) { // check both before and after write if stream is ok | 3201 | if (m_io.fail()) { // check both before and after write if stream is ok |
| 3159 | // EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); | 3202 | EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); |
| 3160 | // } | 3203 | } |
| 3161 | //} | 3204 | } |
| 3162 | // | 3205 | |
| 3163 | // | 3206 | |
| 3164 | // | 3207 | |
| 3165 | // | 3208 | |
| 3166 | ////----------------------------------------------------------------------------- | 3209 | //----------------------------------------------------------------------------- |
| 3167 | //// name: write( t_CKFLOAT val ) | 3210 | // name: write( t_CKFLOAT val ) |
| 3168 | //// desc: ... | 3211 | // desc: ... |
| 3169 | ////----------------------------------------------------------------------------- | 3212 | //----------------------------------------------------------------------------- |
| 3170 | //void Chuck_IO_File::write( t_CKFLOAT val ) | 3213 | void Chuck_IO_File::write( t_CKFLOAT val ) |
| 3171 | //{ | 3214 | { |
| 3172 | // // sanity | 3215 | // sanity |
| 3173 | // if (!(m_io.is_open())) { | 3216 | if (!(m_io.is_open())) { |
| 3174 | // EM_error3( "[chuck](via FileIO): cannot write: no file open" ); | 3217 | EM_error3( "[chuck](via FileIO): cannot write: no file open" ); |
| 3175 | // return; | 3218 | return; |
| 3176 | // } | 3219 | } |
| 3177 | // | 3220 | |
| 3178 | // if (m_io.fail()) { | 3221 | if (m_io.fail()) { |
| 3179 | // EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); | 3222 | EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); |
| 3180 | // return; | 3223 | return; |
| 3181 | // } | 3224 | } |
| 3182 | // | 3225 | |
| 3183 | // if ( m_dir ) | 3226 | if ( m_dir ) |
| 3184 | // { | 3227 | { |
| 3185 | // EM_error3( "[chuck](via FileIO): cannot write to a directory" ); | 3228 | EM_error3( "[chuck](via FileIO): cannot write to a directory" ); |
| 3186 | // return; | 3229 | return; |
| 3187 | // } | 3230 | } |
| 3188 | // | 3231 | |
| 3189 | // if (m_flags & TYPE_ASCII) { | 3232 | if (m_flags & TYPE_ASCII) { |
| 3190 | // m_io << val; | 3233 | m_io << val; |
| 3191 | // } else if (m_flags & TYPE_BINARY) { | 3234 | } else if (m_flags & TYPE_BINARY) { |
| 3192 | // m_io.write( (char *)&val, sizeof(t_CKFLOAT) ); | 3235 | m_io.write( (char *)&val, sizeof(t_CKFLOAT) ); |
| 3193 | // } else { | 3236 | } else { |
| 3194 | // EM_error3( "[chuck](via FileIO): write error: invalid ASCII/binary flag" ); | 3237 | EM_error3( "[chuck](via FileIO): write error: invalid ASCII/binary flag" ); |
| 3195 | // } | 3238 | } |
| 3196 | // | 3239 | |
| 3197 | // if (m_io.fail()) { // check both before and after write if stream is ok | 3240 | if (m_io.fail()) { // check both before and after write if stream is ok |
| 3198 | // EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); | 3241 | EM_error3( "[chuck](via FileIO): cannot write: I/O stream failed" ); |
| 3199 | // } | 3242 | } |
| 3200 | //} | 3243 | } |
| 3201 | // | 3244 | |
| 3202 | // | 3245 | |
| 3203 | // | 3246 | |
| 3204 | // | 3247 | |
| 3205 | //// static helper functions for writing asynchronously | 3248 | // static helper functions for writing asynchronously |
| 3206 | //THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::writeStr_thread ) ( void *data ) | 3249 | THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::writeStr_thread ) ( void *data ) |
| 3207 | //{ | 3250 | { |
| 3208 | // async_args *args = (async_args *)data; | 3251 | async_args *args = (async_args *)data; |
| 3209 | // args->fileio_obj->write ( args->stringArg ); | 3252 | args->fileio_obj->write ( args->stringArg ); |
| 3210 | // Chuck_Event *e = args->fileio_obj->m_asyncEvent; | 3253 | Chuck_Event *e = args->fileio_obj->m_asyncEvent; |
| 3211 | // delete args; | 3254 | delete args; |
| 3212 | // e->broadcast(); // wake up | 3255 | e->broadcast(); // wake up |
| 3213 | // e->broadcast_global(); | 3256 | e->broadcast_global(); |
| 3214 | // | 3257 | |
| 3215 | // return (THREAD_RETURN)0; | 3258 | return (THREAD_RETURN)0; |
| 3216 | //} | 3259 | } |
| 3217 | // | 3260 | |
| 3218 | //THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::writeInt_thread ) ( void *data ) | 3261 | THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::writeInt_thread ) ( void *data ) |
| 3219 | //{ | 3262 | { |
| 3220 | // async_args *args = (async_args *)data; | 3263 | async_args *args = (async_args *)data; |
| 3221 | // args->fileio_obj->write ( args->intArg ); | 3264 | args->fileio_obj->write ( args->intArg ); |
| 3222 | // args->fileio_obj->m_asyncEvent->broadcast(); // wake up | 3265 | args->fileio_obj->m_asyncEvent->broadcast(); // wake up |
| 3223 | // args->fileio_obj->m_asyncEvent->broadcast_global(); | 3266 | args->fileio_obj->m_asyncEvent->broadcast_global(); |
| 3224 | // delete args; | 3267 | delete args; |
| 3225 | // | 3268 | |
| 3226 | // return (THREAD_RETURN)0; | 3269 | return (THREAD_RETURN)0; |
| 3227 | //} | 3270 | } |
| 3228 | // | 3271 | |
| 3229 | //THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::writeFloat_thread ) ( void *data ) | 3272 | THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::writeFloat_thread ) ( void *data ) |
| 3230 | //{ | 3273 | { |
| 3231 | // async_args *args = (async_args *)data; | 3274 | async_args *args = (async_args *)data; |
| 3232 | // args->fileio_obj->write ( args->floatArg ); | 3275 | args->fileio_obj->write ( args->floatArg ); |
| 3233 | // args->fileio_obj->m_asyncEvent->broadcast(); // wake up | 3276 | args->fileio_obj->m_asyncEvent->broadcast(); // wake up |
| 3234 | // args->fileio_obj->m_asyncEvent->broadcast_global(); | 3277 | args->fileio_obj->m_asyncEvent->broadcast_global(); |
| 3235 | // delete args; | 3278 | delete args; |
| 3236 | // | 3279 | |
| 3237 | // return (THREAD_RETURN)0; | 3280 | return (THREAD_RETURN)0; |
| 3238 | //} | 3281 | } |
| 3282 | #endif // __DISABLE_FILEIO__ | ||
| 3283 | |||
| 3284 | |||
| 3285 | |||
| 3239 | 3286 | ||
| 3240 | Chuck_IO_Chout::Chuck_IO_Chout( Chuck_Carrier * carrier ) { | 3287 | Chuck_IO_Chout::Chuck_IO_Chout( Chuck_Carrier * carrier ) { |
| 3241 | // store | 3288 | // store |
| @@ -42,7 +42,9 @@ · 41 unmodified lines | |||
| 42 | #include <queue> | 42 | #include <queue> |
| 43 | #include <fstream> | 43 | #include <fstream> |
| 44 | #include <sstream> // REFACTOR-2017: for custom output | 44 | #include <sstream> // REFACTOR-2017: for custom output |
| 45 | //#include "util_thread.h" // added 1.3.0.0 | 45 | #ifndef __DISABLE_THREADS__ |
| 46 | #include "util_thread.h" // added 1.3.0.0 | ||
| 47 | #endif | ||
| 46 | 48 | ||
| 47 | 49 | ||
| 48 | 50 | ||
| @@ -460,7 +462,9 @@ public: · 411 unmodified lines | |||
| 460 | 462 | ||
| 461 | protected: | 463 | protected: |
| 462 | std::queue<Chuck_VM_Shred *> m_queue; | 464 | std::queue<Chuck_VM_Shred *> m_queue; |
| 463 | // XMutex m_queue_lock; | 465 | #ifndef __DISABLE_THREADS__ |
| 466 | XMutex m_queue_lock; | ||
| 467 | #endif | ||
| 464 | std::queue<Chuck_Global_Event_Listener> m_global_queue; | 468 | std::queue<Chuck_Global_Event_Listener> m_global_queue; |
| 465 | }; | 469 | }; |
| 466 | 470 | ||
| @@ -537,7 +541,9 @@ public: · 70 unmodified lines | |||
| 537 | static const t_CKINT MODE_SYNC; | 541 | static const t_CKINT MODE_SYNC; |
| 538 | static const t_CKINT MODE_ASYNC; | 542 | static const t_CKINT MODE_ASYNC; |
| 539 | Chuck_Event * m_asyncEvent; | 543 | Chuck_Event * m_asyncEvent; |
| 540 | // XThread * m_thread; | 544 | #ifndef __DISABLE_THREADS__ |
| 545 | XThread * m_thread; | ||
| 546 | #endif | ||
| 541 | struct async_args | 547 | struct async_args |
| 542 | { | 548 | { |
| 543 | Chuck_IO_File * fileio_obj; | 549 | Chuck_IO_File * fileio_obj; |
| @@ -549,88 +555,91 @@ public: · 5 unmodified lines | |||
| 549 | }; | 555 | }; |
| 550 | 556 | ||
| 551 | 557 | ||
| 558 | |||
| 559 | #ifndef __DISABLE_FILEIO__ | ||
| 552 | //----------------------------------------------------------------------------- | 560 | //----------------------------------------------------------------------------- |
| 553 | // name: Chuck_IO_File | 561 | // name: Chuck_IO_File |
| 554 | // desc: Chuck File IO class | 562 | // desc: Chuck File IO class |
| 555 | //----------------------------------------------------------------------------- | 563 | //----------------------------------------------------------------------------- |
| 556 | //struct Chuck_IO_File : Chuck_IO | 564 | struct Chuck_IO_File : Chuck_IO |
| 557 | //{ | 565 | { |
| 558 | //public: | 566 | public: |
| 559 | // // REFACTOR-2017 | 567 | // REFACTOR-2017 |
| 560 | // Chuck_IO_File( Chuck_VM * vm ); | 568 | Chuck_IO_File( Chuck_VM * vm ); |
| 561 | // virtual ~Chuck_IO_File(); | 569 | virtual ~Chuck_IO_File(); |
| 562 | // | 570 | |
| 563 | //public: | 571 | public: |
| 564 | // // meta | 572 | // meta |
| 565 | // virtual t_CKBOOL open( const std::string & path, t_CKINT flags ); | 573 | virtual t_CKBOOL open( const std::string & path, t_CKINT flags ); |
| 566 | // virtual t_CKBOOL good(); | 574 | virtual t_CKBOOL good(); |
| 567 | // virtual void close(); | 575 | virtual void close(); |
| 568 | // virtual void flush(); | 576 | virtual void flush(); |
| 569 | // virtual t_CKINT mode(); | 577 | virtual t_CKINT mode(); |
| 570 | // virtual void mode( t_CKINT flag ); | 578 | virtual void mode( t_CKINT flag ); |
| 571 | // virtual t_CKINT size(); | 579 | virtual t_CKINT size(); |
| 572 | // | 580 | |
| 573 | // // seeking | 581 | // seeking |
| 574 | // virtual void seek( t_CKINT pos ); | 582 | virtual void seek( t_CKINT pos ); |
| 575 | // virtual t_CKINT tell(); | 583 | virtual t_CKINT tell(); |
| 576 | // | 584 | |
| 577 | // // directories | 585 | // directories |
| 578 | // virtual t_CKINT isDir(); | 586 | virtual t_CKINT isDir(); |
| 579 | // virtual Chuck_Array4 * dirList(); | 587 | virtual Chuck_Array4 * dirList(); |
| 580 | // | 588 | |
| 581 | // // reading | 589 | // reading |
| 582 | // // virtual Chuck_String * read( t_CKINT length ); | 590 | // virtual Chuck_String * read( t_CKINT length ); |
| 583 | // virtual Chuck_String * readLine(); | 591 | virtual Chuck_String * readLine(); |
| 584 | // virtual t_CKINT readInt( t_CKINT flags ); | 592 | virtual t_CKINT readInt( t_CKINT flags ); |
| 585 | // virtual t_CKFLOAT readFloat(); | 593 | virtual t_CKFLOAT readFloat(); |
| 586 | // virtual t_CKBOOL readString( std::string & str ); | 594 | virtual t_CKBOOL readString( std::string & str ); |
| 587 | // virtual t_CKBOOL eof(); | 595 | virtual t_CKBOOL eof(); |
| 588 | // | 596 | |
| 589 | // // reading -- async | 597 | // reading -- async |
| 590 | // /* TODO: doesn't look like asynchronous reads will work | 598 | /* TODO: doesn't look like asynchronous reads will work |
| 591 | // static THREAD_RETURN ( THREAD_TYPE read_thread ) ( void *data ); | 599 | static THREAD_RETURN ( THREAD_TYPE read_thread ) ( void *data ); |
| 592 | // static THREAD_RETURN ( THREAD_TYPE readLine_thread ) ( void *data ); | 600 | static THREAD_RETURN ( THREAD_TYPE readLine_thread ) ( void *data ); |
| 593 | // static THREAD_RETURN ( THREAD_TYPE readInt_thread ) ( void *data ); | 601 | static THREAD_RETURN ( THREAD_TYPE readInt_thread ) ( void *data ); |
| 594 | // static THREAD_RETURN ( THREAD_TYPE readFloat_thread ) ( void *data ); | 602 | static THREAD_RETURN ( THREAD_TYPE readFloat_thread ) ( void *data ); |
| 595 | // */ | 603 | */ |
| 596 | // | 604 | |
| 597 | // // writing | 605 | // writing |
| 598 | // virtual void write( const std::string & val ); | 606 | virtual void write( const std::string & val ); |
| 599 | // virtual void write( t_CKINT val ); | 607 | virtual void write( t_CKINT val ); |
| 600 | // virtual void write( t_CKINT val, t_CKINT flags ); | 608 | virtual void write( t_CKINT val, t_CKINT flags ); |
| 601 | // virtual void write( t_CKFLOAT val ); | 609 | virtual void write( t_CKFLOAT val ); |
| 602 | // | 610 | |
| 603 | // // writing -- async | 611 | // writing -- async |
| 604 | // static THREAD_RETURN ( THREAD_TYPE writeStr_thread ) ( void *data ); | 612 | static THREAD_RETURN ( THREAD_TYPE writeStr_thread ) ( void *data ); |
| 605 | // static THREAD_RETURN ( THREAD_TYPE writeInt_thread ) ( void *data ); | 613 | static THREAD_RETURN ( THREAD_TYPE writeInt_thread ) ( void *data ); |
| 606 | // static THREAD_RETURN ( THREAD_TYPE writeFloat_thread ) ( void *data ); | 614 | static THREAD_RETURN ( THREAD_TYPE writeFloat_thread ) ( void *data ); |
| 607 | // | 615 | |
| 608 | //public: | 616 | public: |
| 609 | // // constants | 617 | // constants |
| 610 | // static const t_CKINT FLAG_READ_WRITE; | 618 | static const t_CKINT FLAG_READ_WRITE; |
| 611 | // static const t_CKINT FLAG_READONLY; | 619 | static const t_CKINT FLAG_READONLY; |
| 612 | // static const t_CKINT FLAG_WRITEONLY; | 620 | static const t_CKINT FLAG_WRITEONLY; |
| 613 | // static const t_CKINT FLAG_APPEND; | 621 | static const t_CKINT FLAG_APPEND; |
| 614 | // static const t_CKINT TYPE_ASCII; | 622 | static const t_CKINT TYPE_ASCII; |
| 615 | // static const t_CKINT TYPE_BINARY; | 623 | static const t_CKINT TYPE_BINARY; |
| 616 | // | 624 | |
| 617 | //protected: | 625 | protected: |
| 618 | // // open flags | 626 | // open flags |
| 619 | // t_CKINT m_flags; | 627 | t_CKINT m_flags; |
| 620 | // // I/O mode | 628 | // I/O mode |
| 621 | // t_CKINT m_iomode; | 629 | t_CKINT m_iomode; |
| 622 | // // file stream | 630 | // file stream |
| 623 | // std::fstream m_io; | 631 | std::fstream m_io; |
| 624 | // // directory pointer | 632 | // directory pointer |
| 625 | // DIR * m_dir; | 633 | DIR * m_dir; |
| 626 | // // directory location | 634 | // directory location |
| 627 | // long m_dir_start; | 635 | long m_dir_start; |
| 628 | // // path | 636 | // path |
| 629 | // std::string m_path; | 637 | std::string m_path; |
| 630 | // // vm and shred | 638 | // vm and shred |
| 631 | // Chuck_VM * m_vmRef; | 639 | Chuck_VM * m_vmRef; |
| 632 | //}; | 640 | }; |
| 633 | // | 641 | #endif // __DISABLE_FILEIO__ |
| 642 | |||
| 634 | 643 | ||
| 635 | 644 | ||
| 636 | 645 | ||
| @@ -186,7 +186,9 @@ Chuck_Env::Chuck_Env( ) · 185 unmodified lines | |||
| 186 | t_uanablob = new Chuck_Type( this, te_uanablob, "UAnaBlob", t_object, sizeof(void *) ); | 186 | t_uanablob = new Chuck_Type( this, te_uanablob, "UAnaBlob", t_object, sizeof(void *) ); |
| 187 | t_shred = new Chuck_Type( this, te_shred, "Shred", t_object, sizeof(void *) ); | 187 | t_shred = new Chuck_Type( this, te_shred, "Shred", t_object, sizeof(void *) ); |
| 188 | t_io = new Chuck_Type( this, te_io, "IO", t_event, sizeof(void *) ); | 188 | t_io = new Chuck_Type( this, te_io, "IO", t_event, sizeof(void *) ); |
| 189 | // t_fileio = new Chuck_Type( this, te_fileio, "FileIO", t_io, sizeof(void *) ); | 189 | #ifndef __DISABLE_FILEIO__ |
| 190 | t_fileio = new Chuck_Type( this, te_fileio, "FileIO", t_io, sizeof(void *) ); | ||
| 191 | #endif | ||
| 190 | t_chout = new Chuck_Type( this, te_chout, "StdOut", t_io, sizeof(void *) ); | 192 | t_chout = new Chuck_Type( this, te_chout, "StdOut", t_io, sizeof(void *) ); |
| 191 | t_cherr = new Chuck_Type( this, te_cherr, "StdErr", t_io, sizeof(void *) ); | 193 | t_cherr = new Chuck_Type( this, te_cherr, "StdErr", t_io, sizeof(void *) ); |
| 192 | t_thread = new Chuck_Type( this, te_thread, "Thread", t_object, sizeof(void *) ); | 194 | t_thread = new Chuck_Type( this, te_thread, "Thread", t_object, sizeof(void *) ); |
| @@ -217,7 +219,9 @@ Chuck_Env::~Chuck_Env() · 24 unmodified lines | |||
| 217 | SAFE_RELEASE( t_class->info ); | 219 | SAFE_RELEASE( t_class->info ); |
| 218 | SAFE_RELEASE( t_thread->info ); | 220 | SAFE_RELEASE( t_thread->info ); |
| 219 | SAFE_RELEASE( t_io->info ); | 221 | SAFE_RELEASE( t_io->info ); |
| 220 | // SAFE_RELEASE( t_fileio->info ); | 222 | #ifndef __DISABLE_FILEIO__ |
| 223 | SAFE_RELEASE( t_fileio->info ); | ||
| 224 | #endif | ||
| 221 | SAFE_RELEASE( t_chout->info ); // added 1.3.0.0 | 225 | SAFE_RELEASE( t_chout->info ); // added 1.3.0.0 |
| 222 | SAFE_RELEASE( t_cherr->info ); // added 1.3.0.0 | 226 | SAFE_RELEASE( t_cherr->info ); // added 1.3.0.0 |
| 223 | SAFE_RELEASE( t_vec3->info ); // added 1.3.5.3 | 227 | SAFE_RELEASE( t_vec3->info ); // added 1.3.5.3 |
| @@ -236,7 +240,9 @@ Chuck_Env::~Chuck_Env() · 12 unmodified lines | |||
| 236 | SAFE_DELETE( t_class ); | 240 | SAFE_DELETE( t_class ); |
| 237 | SAFE_DELETE( t_thread ); | 241 | SAFE_DELETE( t_thread ); |
| 238 | SAFE_DELETE( t_io ); | 242 | SAFE_DELETE( t_io ); |
| 239 | // SAFE_DELETE( t_fileio ); | 243 | #ifndef __DISABLE_FILEIO__ |
| 244 | SAFE_DELETE( t_fileio ); | ||
| 245 | #endif | ||
| 240 | SAFE_DELETE( t_chout ); // added 1.3.0.0 | 246 | SAFE_DELETE( t_chout ); // added 1.3.0.0 |
| 241 | SAFE_DELETE( t_cherr ); // added 1.3.0.0 | 247 | SAFE_DELETE( t_cherr ); // added 1.3.0.0 |
| 242 | SAFE_DELETE( t_vec3 ); // added 1.3.5.3 | 248 | SAFE_DELETE( t_vec3 ); // added 1.3.5.3 |
| @@ -293,7 +299,9 @@ Chuck_Env * type_engine_init( Chuck_Carrier * carrier ) · 50 unmodified lines | |||
| 293 | env->global()->type.add( env->t_array->name, env->t_array ); env->t_array->lock(); | 299 | env->global()->type.add( env->t_array->name, env->t_array ); env->t_array->lock(); |
| 294 | env->global()->type.add( env->t_event->name, env->t_event ); env->t_event->lock(); | 300 | env->global()->type.add( env->t_event->name, env->t_event ); env->t_event->lock(); |
| 295 | env->global()->type.add( env->t_io->name, env->t_io ); env->t_io->lock(); | 301 | env->global()->type.add( env->t_io->name, env->t_io ); env->t_io->lock(); |
| 296 | // env->global()->type.add( env->t_fileio->name, env->t_fileio ); env->t_fileio->lock(); | 302 | #ifndef __DISABLE_FILEIO__ |
| 303 | env->global()->type.add( env->t_fileio->name, env->t_fileio ); env->t_fileio->lock(); | ||
| 304 | #endif | ||
| 297 | env->global()->type.add( env->t_chout->name, env->t_chout ); env->t_chout->lock(); | 305 | env->global()->type.add( env->t_chout->name, env->t_chout ); env->t_chout->lock(); |
| 298 | env->global()->type.add( env->t_cherr->name, env->t_cherr ); env->t_cherr->lock(); | 306 | env->global()->type.add( env->t_cherr->name, env->t_cherr ); env->t_cherr->lock(); |
| 299 | 307 | ||
| @@ -320,7 +328,9 @@ Chuck_Env * type_engine_init( Chuck_Carrier * carrier ) · 20 unmodified lines | |||
| 320 | init_class_shred( env, env->t_shred ); | 328 | init_class_shred( env, env->t_shred ); |
| 321 | init_class_event( env, env->t_event ); | 329 | init_class_event( env, env->t_event ); |
| 322 | init_class_io( env, env->t_io ); | 330 | init_class_io( env, env->t_io ); |
| 323 | // init_class_fileio( env, env->t_fileio ); | 331 | #ifndef __DISABLE_FILEIO__ |
| 332 | init_class_fileio( env, env->t_fileio ); | ||
| 333 | #endif | ||
| 324 | init_class_chout( env, env->t_chout ); // 1.3.0.0 | 334 | init_class_chout( env, env->t_chout ); // 1.3.0.0 |
| 325 | init_class_cherr( env, env->t_cherr ); // 1.3.0.0 | 335 | init_class_cherr( env, env->t_cherr ); // 1.3.0.0 |
| 326 | init_class_vec3( env, env->t_vec3 ); // 1.3.5.3 | 336 | init_class_vec3( env, env->t_vec3 ); // 1.3.5.3 |
| @@ -533,7 +533,9 @@ public: · 532 unmodified lines | |||
| 533 | Chuck_Type * t_uanablob; | 533 | Chuck_Type * t_uanablob; |
| 534 | Chuck_Type * t_shred; | 534 | Chuck_Type * t_shred; |
| 535 | Chuck_Type * t_io; | 535 | Chuck_Type * t_io; |
| 536 | // Chuck_Type * t_fileio; | 536 | #ifndef __DISABLE_FILEIO__ |
| 537 | Chuck_Type * t_fileio; | ||
| 538 | #endif | ||
| 537 | Chuck_Type * t_chout; | 539 | Chuck_Type * t_chout; |
| 538 | Chuck_Type * t_cherr; | 540 | Chuck_Type * t_cherr; |
| 539 | Chuck_Type * t_thread; | 541 | Chuck_Type * t_thread; |
| @@ -34,10 +34,18 @@ · 33 unmodified lines | |||
| 34 | #include "chuck_lang.h" | 34 | #include "chuck_lang.h" |
| 35 | #include "chuck_type.h" | 35 | #include "chuck_type.h" |
| 36 | #include "chuck_dl.h" | 36 | #include "chuck_dl.h" |
| 37 | //#include "chuck_io.h" | 37 | |
| 38 | #ifndef __DISABLE_SERIAL__ | ||
| 39 | #include "chuck_io.h" | ||
| 40 | #endif | ||
| 41 | |||
| 38 | #include "chuck_errmsg.h" | 42 | #include "chuck_errmsg.h" |
| 39 | #include "ugen_xxx.h" | 43 | #include "ugen_xxx.h" |
| 40 | //#include "hidio_sdl.h" // 1.4.0.0 | 44 | |
| 45 | #ifndef __DISABLE_HID__ | ||
| 46 | #include "hidio_sdl.h" // 1.4.0.0 | ||
| 47 | #endif | ||
| 48 | |||
| 41 | #ifndef __DISABLE_MIDI__ | 49 | #ifndef __DISABLE_MIDI__ |
| 42 | #include "midiio_rtmidi.h" // 1.4.0.1 | 50 | #include "midiio_rtmidi.h" // 1.4.0.1 |
| 43 | #endif | 51 | #endif |
| @@ -341,14 +349,17 @@ t_CKBOOL Chuck_VM::shutdown() · 297 unmodified lines | |||
| 341 | // free the shreduler | 349 | // free the shreduler |
| 342 | SAFE_DELETE( m_shreduler ); | 350 | SAFE_DELETE( m_shreduler ); |
| 343 | 351 | ||
| 352 | #ifndef __DISABLE_HID__ | ||
| 344 | // log | 353 | // log |
| 345 | EM_log( CK_LOG_SYSTEM, "unregistering VM from HID manager..." ); | 354 | EM_log( CK_LOG_SYSTEM, "unregistering VM from HID manager..." ); |
| 346 | // clean up this vm | 355 | // clean up this vm |
| 347 | // HidInManager::cleanup_buffer( this ); | 356 | HidInManager::cleanup_buffer( this ); |
| 357 | #endif | ||
| 358 | |||
| 359 | #ifndef __DISABLE_MIDI__ | ||
| 348 | EM_log( CK_LOG_SYSTEM, "unregistering VM from MIDI manager..." ); | 360 | EM_log( CK_LOG_SYSTEM, "unregistering VM from MIDI manager..." ); |
| 349 | #ifndef __DISABLE_MIDI__ | ||
| 350 | MidiInManager::cleanup_buffer( this ); | 361 | MidiInManager::cleanup_buffer( this ); |
| 351 | #endif | 362 | #endif |
| 352 | 363 | ||
| 353 | // log | 364 | // log |
| 354 | EM_log( CK_LOG_SYSTEM, "freeing msg/reply/event buffers..." ); | 365 | EM_log( CK_LOG_SYSTEM, "freeing msg/reply/event buffers..." ); |
| @@ -3559,7 +3570,9 @@ Chuck_VM_Shred::Chuck_VM_Shred() · 3204 unmodified lines | |||
| 3559 | vm_ref = NULL; | 3570 | vm_ref = NULL; |
| 3560 | event = NULL; | 3571 | event = NULL; |
| 3561 | xid = 0; | 3572 | xid = 0; |
| 3562 | // m_serials = NULL; | 3573 | #ifndef __DISABLE_SERIAL__ |
| 3574 | m_serials = NULL; | ||
| 3575 | #endif | ||
| 3563 | 3576 | ||
| 3564 | // set | 3577 | // set |
| 3565 | CK_TRACK( stat = NULL ); | 3578 | CK_TRACK( stat = NULL ); |
| @@ -3692,18 +3705,20 @@ t_CKBOOL Chuck_VM_Shred::shutdown() · 126 unmodified lines | |||
| 3692 | // clear it | 3705 | // clear it |
| 3693 | code_orig = code = NULL; | 3706 | code_orig = code = NULL; |
| 3694 | 3707 | ||
| 3708 | #ifndef __DISABLE_SERIAL__ | ||
| 3695 | // HACK (added 1.3.2.0): close serial devices | 3709 | // HACK (added 1.3.2.0): close serial devices |
| 3696 | // if(m_serials != NULL) | 3710 | if(m_serials != NULL) |
| 3697 | // { | 3711 | { |
| 3698 | // for(list<Chuck_IO_Serial *>::iterator i = m_serials->begin(); i != m_serials->end(); i++) | 3712 | for(list<Chuck_IO_Serial *>::iterator i = m_serials->begin(); i != m_serials->end(); i++) |
| 3699 | // { | 3713 | { |
| 3700 | // (*i)->release(); | 3714 | (*i)->release(); |
| 3701 | // (*i)->close(); | 3715 | (*i)->close(); |
| 3702 | // } | 3716 | } |
| 3703 | // | 3717 | |
| 3704 | // m_serials->clear(); | 3718 | m_serials->clear(); |
| 3705 | // SAFE_DELETE(m_serials); | 3719 | SAFE_DELETE(m_serials); |
| 3706 | // } | 3720 | } |
| 3721 | #endif | ||
| 3707 | 3722 | ||
| 3708 | // 1.3.5.3 pop all loop counters | 3723 | // 1.3.5.3 pop all loop counters |
| 3709 | while( this->popLoopCounter() ); | 3724 | while( this->popLoopCounter() ); |
| @@ -3835,31 +3850,33 @@ CK_VM_DEBUG(CK_FPRINTF_STDERR( "CK_VM_DEBUG reg sp in: 0x%08lx out: 0x%08lx\n", · 125 unmodified lines | |||
| 3835 | 3850 | ||
| 3836 | 3851 | ||
| 3837 | 3852 | ||
| 3838 | ////----------------------------------------------------------------------------- | 3853 | #ifndef __DISABLE_SERIAL__ |
| 3839 | //// name: add_serialio() | 3854 | //----------------------------------------------------------------------------- |
| 3840 | //// desc: ... | 3855 | // name: add_serialio() |
| 3841 | ////----------------------------------------------------------------------------- | 3856 | // desc: ... |
| 3842 | //t_CKVOID Chuck_VM_Shred::add_serialio( Chuck_IO_Serial * serial ) | 3857 | //----------------------------------------------------------------------------- |
| 3843 | //{ | 3858 | t_CKVOID Chuck_VM_Shred::add_serialio( Chuck_IO_Serial * serial ) |
| 3844 | // if(m_serials == NULL) | 3859 | { |
| 3845 | // m_serials = new list<Chuck_IO_Serial *>; | 3860 | if(m_serials == NULL) |
| 3846 | // serial->add_ref(); | 3861 | m_serials = new list<Chuck_IO_Serial *>; |
| 3847 | // m_serials->push_back( serial ); | 3862 | serial->add_ref(); |
| 3848 | //} | 3863 | m_serials->push_back( serial ); |
| 3849 | // | 3864 | } |
| 3850 | // | 3865 | |
| 3851 | // | 3866 | |
| 3852 | ////----------------------------------------------------------------------------- | 3867 | |
| 3853 | //// name: add_serialio() | 3868 | //----------------------------------------------------------------------------- |
| 3854 | //// desc: ... | 3869 | // name: add_serialio() |
| 3855 | ////----------------------------------------------------------------------------- | 3870 | // desc: ... |
| 3856 | //t_CKVOID Chuck_VM_Shred::remove_serialio( Chuck_IO_Serial * serial ) | 3871 | //----------------------------------------------------------------------------- |
| 3857 | //{ | 3872 | t_CKVOID Chuck_VM_Shred::remove_serialio( Chuck_IO_Serial * serial ) |
| 3858 | // if(m_serials == NULL) | 3873 | { |
| 3859 | // return; | 3874 | if(m_serials == NULL) |
| 3860 | // m_serials->remove( serial ); | 3875 | return; |
| 3861 | // serial->release(); | 3876 | m_serials->remove( serial ); |
| 3862 | //} | 3877 | serial->release(); |
| 3878 | } | ||
| 3879 | #endif | ||
| 3863 | 3880 | ||
| 3864 | 3881 | ||
| 3865 | 3882 | ||
| @@ -72,8 +72,10 @@ struct Chuck_VM; · 71 unmodified lines | |||
| 72 | struct Chuck_VM_Func; | 72 | struct Chuck_VM_Func; |
| 73 | struct Chuck_VM_FTable; | 73 | struct Chuck_VM_FTable; |
| 74 | struct Chuck_Msg; | 74 | struct Chuck_Msg; |
| 75 | #ifndef __DISABLE_SERIAL__ | ||
| 75 | // hack: spencer? | 76 | // hack: spencer? |
| 76 | //struct Chuck_IO_Serial; | 77 | struct Chuck_IO_Serial; |
| 78 | #endif | ||
| 77 | 79 | ||
| 78 | class CBufferSimple; | 80 | class CBufferSimple; |
| 79 | //XXXclass BBQ; | 81 | //XXXclass BBQ; |
| @@ -179,11 +181,13 @@ public: · 99 unmodified lines | |||
| 179 | // add parent object reference (added 1.3.1.2) | 181 | // add parent object reference (added 1.3.1.2) |
| 180 | t_CKVOID add_parent_ref( Chuck_Object * obj ); | 182 | t_CKVOID add_parent_ref( Chuck_Object * obj ); |
| 181 | 183 | ||
| 184 | #ifndef __DISABLE_SERIAL__ | ||
| 182 | // HACK - spencer (added 1.3.2.0) | 185 | // HACK - spencer (added 1.3.2.0) |
| 183 | // add/remove SerialIO devices to close on shred exit | 186 | // add/remove SerialIO devices to close on shred exit |
| 184 | // REFACTOR-2017: TODO -- remove | 187 | // REFACTOR-2017: TODO -- remove |
| 185 | // t_CKVOID add_serialio( Chuck_IO_Serial * serial ); | 188 | t_CKVOID add_serialio( Chuck_IO_Serial * serial ); |
| 186 | // t_CKVOID remove_serialio( Chuck_IO_Serial * serial ); | 189 | t_CKVOID remove_serialio( Chuck_IO_Serial * serial ); |
| 190 | #endif | ||
| 187 | 191 | ||
| 188 | //----------------------------------------------------------------------------- | 192 | //----------------------------------------------------------------------------- |
| 189 | // data | 193 | // data |
| @@ -250,8 +254,10 @@ public: // ge: 1.3.5.3 · 60 unmodified lines | |||
| 250 | // loop counter pointer stack | 254 | // loop counter pointer stack |
| 251 | std::vector<t_CKUINT *> m_loopCounters; | 255 | std::vector<t_CKUINT *> m_loopCounters; |
| 252 | 256 | ||
| 257 | #ifndef __DISABLE_SERIAL__ | ||
| 253 | private: | 258 | private: |
| 254 | // std::list<Chuck_IO_Serial *> * m_serials; | 259 | std::list<Chuck_IO_Serial *> * m_serials; |
| 260 | #endif | ||
| 255 | }; | 261 | }; |
| 256 | 262 | ||
| 257 | 263 | ||
| @@ -1,8 +1,8 @@ | |||
| 1 | /* A Bison parser, made by GNU Bison 3.0.4. */ | 1 | /* A Bison parser, made by GNU Bison 3.1. */ |
| 2 | 2 | ||
| 3 | /* Bison implementation for Yacc-like parsers in C | 3 | /* Bison implementation for Yacc-like parsers in C |
| 4 | 4 | ||
| 5 | Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. | 5 | Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc. |
| 6 | 6 | ||
| 7 | This program is free software: you can redistribute it and/or modify | 7 | This program is free software: you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
| @@ -44,7 +44,7 @@ · 35 unmodified lines | |||
| 44 | #define YYBISON 1 | 44 | #define YYBISON 1 |
| 45 | 45 | ||
| 46 | /* Bison version. */ | 46 | /* Bison version. */ |
| 47 | #define YYBISON_VERSION "3.0.4" | 47 | #define YYBISON_VERSION "3.1" |
| 48 | 48 | ||
| 49 | /* Skeleton name. */ | 49 | /* Skeleton name. */ |
| 50 | #define YYSKELETON_NAME "yacc.c" | 50 | #define YYSKELETON_NAME "yacc.c" |
| @@ -119,7 +119,7 @@ void yyerror( char *s ) · 68 unmodified lines | |||
| 119 | a_Program g_program = NULL; | 119 | a_Program g_program = NULL; |
| 120 | 120 | ||
| 121 | 121 | ||
| 122 | #line 122 "chuck.tab.c" /* yacc.c:339 */ | 122 | #line 123 "chuck.tab.c" /* yacc.c:339 */ |
| 123 | 123 | ||
| 124 | # ifndef YY_NULLPTR | 124 | # ifndef YY_NULLPTR |
| 125 | # if defined __cplusplus && 201103L <= __cplusplus | 125 | # if defined __cplusplus && 201103L <= __cplusplus |
| @@ -271,7 +271,7 @@ extern int yydebug; · 145 unmodified lines | |||
| 271 | 271 | ||
| 272 | union YYSTYPE | 272 | union YYSTYPE |
| 273 | { | 273 | { |
| 274 | #line 59 "chuck.y" /* yacc.c:355 */ | 274 | #line 60 "chuck.y" /* yacc.c:355 */ |
| 275 | 275 | ||
| 276 | int pos; | 276 | int pos; |
| 277 | int ival; | 277 | int ival; |
| @@ -297,7 +297,7 @@ union YYSTYPE · 19 unmodified lines | |||
| 297 | a_Polar polar_exp; | 297 | a_Polar polar_exp; |
| 298 | a_Vec vec_exp; // ge: added 1.3.5.3 | 298 | a_Vec vec_exp; // ge: added 1.3.5.3 |
| 299 | 299 | ||
| 300 | #line 300 "chuck.tab.c" /* yacc.c:355 */ | 300 | #line 301 "chuck.tab.c" /* yacc.c:355 */ |
| 301 | }; | 301 | }; |
| 302 | 302 | ||
| 303 | typedef union YYSTYPE YYSTYPE; | 303 | typedef union YYSTYPE YYSTYPE; |
| @@ -314,7 +314,7 @@ int yyparse (void); · 10 unmodified lines | |||
| 314 | 314 | ||
| 315 | /* Copy the second part of user declarations. */ | 315 | /* Copy the second part of user declarations. */ |
| 316 | 316 | ||
| 317 | #line 317 "chuck.tab.c" /* yacc.c:358 */ | 317 | #line 318 "chuck.tab.c" /* yacc.c:358 */ |
| 318 | 318 | ||
| 319 | #ifdef short | 319 | #ifdef short |
| 320 | # undef short | 320 | # undef short |
| @@ -335,13 +335,13 @@ typedef signed char yytype_int8; · 14 unmodified lines | |||
| 335 | #ifdef YYTYPE_UINT16 | 335 | #ifdef YYTYPE_UINT16 |
| 336 | typedef YYTYPE_UINT16 yytype_uint16; | 336 | typedef YYTYPE_UINT16 yytype_uint16; |
| 337 | #else | 337 | #else |
| 338 | typedef unsigned short int yytype_uint16; | 338 | typedef unsigned short yytype_uint16; |
| 339 | #endif | 339 | #endif |
| 340 | 340 | ||
| 341 | #ifdef YYTYPE_INT16 | 341 | #ifdef YYTYPE_INT16 |
| 342 | typedef YYTYPE_INT16 yytype_int16; | 342 | typedef YYTYPE_INT16 yytype_int16; |
| 343 | #else | 343 | #else |
| 344 | typedef short int yytype_int16; | 344 | typedef short yytype_int16; |
| 345 | #endif | 345 | #endif |
| 346 | 346 | ||
| 347 | #ifndef YYSIZE_T | 347 | #ifndef YYSIZE_T |
| @@ -353,7 +353,7 @@ typedef short int yytype_int16; · 5 unmodified lines | |||
| 353 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | 353 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 354 | # define YYSIZE_T size_t | 354 | # define YYSIZE_T size_t |
| 355 | # else | 355 | # else |
| 356 | # define YYSIZE_T unsigned int | 356 | # define YYSIZE_T unsigned |
| 357 | # endif | 357 | # endif |
| 358 | #endif | 358 | #endif |
| 359 | 359 | ||
| @@ -405,7 +405,7 @@ typedef short int yytype_int16; · 45 unmodified lines | |||
| 405 | # define YYUSE(E) /* empty */ | 405 | # define YYUSE(E) /* empty */ |
| 406 | #endif | 406 | #endif |
| 407 | 407 | ||
| 408 | #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ | 408 | #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ |
| 409 | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ | 409 | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
| 410 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ | 410 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
| 411 | _Pragma ("GCC diagnostic push") \ | 411 | _Pragma ("GCC diagnostic push") \ |
| @@ -573,7 +573,7 @@ union yyalloc · 161 unmodified lines | |||
| 573 | #define YYMAXUTOK 366 | 573 | #define YYMAXUTOK 366 |
| 574 | 574 | ||
| 575 | #define YYTRANSLATE(YYX) \ | 575 | #define YYTRANSLATE(YYX) \ |
| 576 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | 576 | ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 577 | 577 | ||
| 578 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM | 578 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
| 579 | as returned by yylex, without out-of-bounds checking. */ | 579 | as returned by yylex, without out-of-bounds checking. */ |
| @@ -622,25 +622,25 @@ static const yytype_uint8 yytranslate[] = · 42 unmodified lines | |||
| 622 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ | 622 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
| 623 | static const yytype_uint16 yyrline[] = | 623 | static const yytype_uint16 yyrline[] = |
| 624 | { | 624 | { |
| 625 | 0, 183, 183, 184, 188, 189, 190, 194, 196, 198, | 625 | 0, 184, 184, 185, 189, 190, 191, 195, 197, 199, |
| 626 | 200, 205, 206, 207, 208, 212, 213, 217, 218, 223, | 626 | 201, 206, 207, 208, 209, 213, 214, 218, 219, 224, |
| 627 | 224, 225, 229, 233, 234, 238, 239, 243, 245, 247, | 627 | 225, 226, 230, 234, 235, 239, 240, 244, 246, 248, |
| 628 | 249, 254, 255, 256, 260, 261, 262, 263, 267, 268, | 628 | 250, 255, 256, 257, 261, 262, 263, 264, 268, 269, |
| 629 | 269, 273, 274, 278, 279, 288, 289, 294, 295, 299, | 629 | 270, 274, 275, 279, 280, 289, 290, 295, 296, 300, |
| 630 | 300, 304, 305, 309, 310, 311, 312, 314, 318, 319, | 630 | 301, 305, 306, 310, 311, 312, 313, 315, 319, 320, |
| 631 | 320, 321, 325, 327, 332, 334, 336, 338, 340, 342, | 631 | 321, 322, 326, 328, 333, 335, 337, 339, 341, 343, |
| 632 | 344, 349, 350, 354, 355, 359, 360, 364, 365, 370, | 632 | 345, 350, 351, 355, 356, 360, 361, 365, 366, 371, |
| 633 | 371, 376, 377, 382, 383, 387, 388, 389, 390, 391, | 633 | 372, 377, 378, 383, 384, 388, 389, 390, 391, 392, |
| 634 | 392, 393, 397, 398, 402, 403, 404, 408, 413, 418, | 634 | 393, 394, 398, 399, 403, 404, 405, 409, 414, 419, |
| 635 | 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, | 635 | 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, |
| 636 | 433, 434, 435, 436, 440, 441, 445, 446, 451, 452, | 636 | 434, 435, 436, 437, 441, 442, 446, 447, 452, 453, |
| 637 | 457, 458, 463, 464, 469, 470, 475, 476, 481, 482, | 637 | 458, 459, 464, 465, 470, 471, 476, 477, 482, 483, |
| 638 | 484, 489, 490, 492, 494, 496, 501, 502, 504, 509, | 638 | 485, 490, 491, 493, 495, 497, 502, 503, 505, 510, |
| 639 | 510, 512, 517, 518, 520, 522, 527, 528, 533, 534, | 639 | 511, 513, 518, 519, 521, 523, 528, 529, 534, 535, |
| 640 | 539, 540, 542, 544, 546, 548, 550, 552, 559, 560, | 640 | 540, 541, 543, 545, 547, 549, 551, 553, 560, 561, |
| 641 | 561, 562, 563, 564, 569, 570, 575, 576, 578, 580, | 641 | 562, 563, 564, 565, 570, 571, 576, 577, 579, 581, |
| 642 | 582, 584, 586, 592, 593, 594, 595, 596, 597, 598, | 642 | 583, 585, 587, 593, 594, 595, 596, 597, 598, 599, |
| 643 | 599, 600, 601, 602, 603 | 643 | 600, 601, 602, 603, 604 |
| 644 | }; | 644 | }; |
| 645 | #endif | 645 | #endif |
| 646 | 646 | ||
| @@ -1281,7 +1281,7 @@ do { \ · 634 unmodified lines | |||
| 1281 | static void | 1281 | static void |
| 1282 | yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) | 1282 | yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) |
| 1283 | { | 1283 | { |
| 1284 | unsigned long int yylno = yyrline[yyrule]; | 1284 | unsigned long yylno = yyrline[yyrule]; |
| 1285 | int yynrhs = yyr2[yyrule]; | 1285 | int yynrhs = yyr2[yyrule]; |
| 1286 | int yyi; | 1286 | int yyi; |
| 1287 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", | 1287 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
| @@ -1507,6 +1507,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, · 219 unmodified lines | |||
| 1507 | case N: \ | 1507 | case N: \ |
| 1508 | yyformat = S; \ | 1508 | yyformat = S; \ |
| 1509 | break | 1509 | break |
| 1510 | default: /* Avoid compiler warnings. */ | ||
| 1510 | YYCASE_(0, YY_("syntax error")); | 1511 | YYCASE_(0, YY_("syntax error")); |
| 1511 | YYCASE_(1, YY_("syntax error, unexpected %s")); | 1512 | YYCASE_(1, YY_("syntax error, unexpected %s")); |
| 1512 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); | 1513 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
| @@ -1712,7 +1713,7 @@ yyparse (void) · 199 unmodified lines | |||
| 1712 | yyvsp = yyvs + yysize - 1; | 1713 | yyvsp = yyvs + yysize - 1; |
| 1713 | 1714 | ||
| 1714 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | 1715 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 1715 | (unsigned long int) yystacksize)); | 1716 | (unsigned long) yystacksize)); |
| 1716 | 1717 | ||
| 1717 | if (yyss + yystacksize - 1 <= yyssp) | 1718 | if (yyss + yystacksize - 1 <= yyssp) |
| 1718 | YYABORT; | 1719 | YYABORT; |
| @@ -1823,1099 +1824,1099 @@ yyreduce: · 104 unmodified lines | |||
| 1823 | switch (yyn) | 1824 | switch (yyn) |
| 1824 | { | 1825 | { |
| 1825 | case 2: | 1826 | case 2: |
| 1826 | #line 183 "chuck.y" /* yacc.c:1646 */ | 1827 | #line 184 "chuck.y" /* yacc.c:1651 */ |
| 1827 | { (yyval.program) = g_program = new_program( (yyvsp[0].program_section), EM_lineNum ); } | 1828 | { (yyval.program) = g_program = new_program( (yyvsp[0].program_section), EM_lineNum ); } |
| 1828 | #line 1828 "chuck.tab.c" /* yacc.c:1646 */ | 1829 | #line 1830 "chuck.tab.c" /* yacc.c:1651 */ |
| 1829 | break; | 1830 | break; |
| 1830 | 1831 | ||
| 1831 | case 3: | 1832 | case 3: |
| 1832 | #line 184 "chuck.y" /* yacc.c:1646 */ | 1833 | #line 185 "chuck.y" /* yacc.c:1651 */ |
| 1833 | { (yyval.program) = g_program = prepend_program( (yyvsp[-1].program_section), (yyvsp[0].program), EM_lineNum ); } | 1834 | { (yyval.program) = g_program = prepend_program( (yyvsp[-1].program_section), (yyvsp[0].program), EM_lineNum ); } |
| 1834 | #line 1834 "chuck.tab.c" /* yacc.c:1646 */ | 1835 | #line 1836 "chuck.tab.c" /* yacc.c:1651 */ |
| 1835 | break; | 1836 | break; |
| 1836 | 1837 | ||
| 1837 | case 4: | 1838 | case 4: |
| 1838 | #line 188 "chuck.y" /* yacc.c:1646 */ | 1839 | #line 189 "chuck.y" /* yacc.c:1651 */ |
| 1839 | { (yyval.program_section) = new_section_stmt( (yyvsp[0].stmt_list), EM_lineNum ); } | 1840 | { (yyval.program_section) = new_section_stmt( (yyvsp[0].stmt_list), EM_lineNum ); } |
| 1840 | #line 1840 "chuck.tab.c" /* yacc.c:1646 */ | 1841 | #line 1842 "chuck.tab.c" /* yacc.c:1651 */ |
| 1841 | break; | 1842 | break; |
| 1842 | 1843 | ||
| 1843 | case 5: | 1844 | case 5: |
| 1844 | #line 189 "chuck.y" /* yacc.c:1646 */ | 1845 | #line 190 "chuck.y" /* yacc.c:1651 */ |
| 1845 | { (yyval.program_section) = new_section_func_def( (yyvsp[0].func_def), EM_lineNum ); } | 1846 | { (yyval.program_section) = new_section_func_def( (yyvsp[0].func_def), EM_lineNum ); } |
| 1846 | #line 1846 "chuck.tab.c" /* yacc.c:1646 */ | 1847 | #line 1848 "chuck.tab.c" /* yacc.c:1651 */ |
| 1847 | break; | 1848 | break; |
| 1848 | 1849 | ||
| 1849 | case 6: | 1850 | case 6: |
| 1850 | #line 190 "chuck.y" /* yacc.c:1646 */ | 1851 | #line 191 "chuck.y" /* yacc.c:1651 */ |
| 1851 | { (yyval.program_section) = new_section_class_def( (yyvsp[0].class_def), EM_lineNum ); } | 1852 | { (yyval.program_section) = new_section_class_def( (yyvsp[0].class_def), EM_lineNum ); } |
| 1852 | #line 1852 "chuck.tab.c" /* yacc.c:1646 */ | 1853 | #line 1854 "chuck.tab.c" /* yacc.c:1651 */ |
| 1853 | break; | 1854 | break; |
| 1854 | 1855 | ||
| 1855 | case 7: | 1856 | case 7: |
| 1856 | #line 195 "chuck.y" /* yacc.c:1646 */ | 1857 | #line 196 "chuck.y" /* yacc.c:1651 */ |
| 1857 | { (yyval.class_def) = new_class_def( (yyvsp[-5].ival), (yyvsp[-3].id_list), NULL, (yyvsp[-1].class_body), EM_lineNum ); } | 1858 | { (yyval.class_def) = new_class_def( (yyvsp[-5].ival), (yyvsp[-3].id_list), NULL, (yyvsp[-1].class_body), EM_lineNum ); } |
| 1858 | #line 1858 "chuck.tab.c" /* yacc.c:1646 */ | 1859 | #line 1860 "chuck.tab.c" /* yacc.c:1651 */ |
| 1859 | break; | 1860 | break; |
| 1860 | 1861 | ||
| 1861 | case 8: | 1862 | case 8: |
| 1862 | #line 197 "chuck.y" /* yacc.c:1646 */ | 1863 | #line 198 "chuck.y" /* yacc.c:1651 */ |
| 1863 | { (yyval.class_def) = new_class_def( (yyvsp[-6].ival), (yyvsp[-4].id_list), (yyvsp[-3].class_ext), (yyvsp[-1].class_body), EM_lineNum ); } | 1864 | { (yyval.class_def) = new_class_def( (yyvsp[-6].ival), (yyvsp[-4].id_list), (yyvsp[-3].class_ext), (yyvsp[-1].class_body), EM_lineNum ); } |
| 1864 | #line 1864 "chuck.tab.c" /* yacc.c:1646 */ | 1865 | #line 1866 "chuck.tab.c" /* yacc.c:1651 */ |
| 1865 | break; | 1866 | break; |
| 1866 | 1867 | ||
| 1867 | case 9: | 1868 | case 9: |
| 1868 | #line 199 "chuck.y" /* yacc.c:1646 */ | 1869 | #line 200 "chuck.y" /* yacc.c:1651 */ |
| 1869 | { (yyval.class_def) = new_iface_def( (yyvsp[-5].ival), (yyvsp[-3].id_list), NULL, (yyvsp[-1].class_body), EM_lineNum ); } | 1870 | { (yyval.class_def) = new_iface_def( (yyvsp[-5].ival), (yyvsp[-3].id_list), NULL, (yyvsp[-1].class_body), EM_lineNum ); } |
| 1870 | #line 1870 "chuck.tab.c" /* yacc.c:1646 */ | 1871 | #line 1872 "chuck.tab.c" /* yacc.c:1651 */ |
| 1871 | break; | 1872 | break; |
| 1872 | 1873 | ||
| 1873 | case 10: | 1874 | case 10: |
| 1874 | #line 201 "chuck.y" /* yacc.c:1646 */ | 1875 | #line 202 "chuck.y" /* yacc.c:1651 */ |
| 1875 | { (yyval.class_def) = new_iface_def( (yyvsp[-6].ival), (yyvsp[-4].id_list), (yyvsp[-3].class_ext), (yyvsp[-1].class_body), EM_lineNum ); } | 1876 | { (yyval.class_def) = new_iface_def( (yyvsp[-6].ival), (yyvsp[-4].id_list), (yyvsp[-3].class_ext), (yyvsp[-1].class_body), EM_lineNum ); } |
| 1876 | #line 1876 "chuck.tab.c" /* yacc.c:1646 */ | 1877 | #line 1878 "chuck.tab.c" /* yacc.c:1651 */ |
| 1877 | break; | 1878 | break; |
| 1878 | 1879 | ||
| 1879 | case 11: | 1880 | case 11: |
| 1880 | #line 205 "chuck.y" /* yacc.c:1646 */ | 1881 | #line 206 "chuck.y" /* yacc.c:1651 */ |
| 1881 | { (yyval.class_ext) = new_class_ext( NULL, (yyvsp[0].id_list), EM_lineNum ); } | 1882 | { (yyval.class_ext) = new_class_ext( NULL, (yyvsp[0].id_list), EM_lineNum ); } |
| 1882 | #line 1882 "chuck.tab.c" /* yacc.c:1646 */ | 1883 | #line 1884 "chuck.tab.c" /* yacc.c:1651 */ |
| 1883 | break; | 1884 | break; |
| 1884 | 1885 | ||
| 1885 | case 12: | 1886 | case 12: |
| 1886 | #line 206 "chuck.y" /* yacc.c:1646 */ | 1887 | #line 207 "chuck.y" /* yacc.c:1651 */ |
| 1887 | { (yyval.class_ext) = new_class_ext( (yyvsp[0].id_list), (yyvsp[-2].id_list), EM_lineNum ); } | 1888 | { (yyval.class_ext) = new_class_ext( (yyvsp[0].id_list), (yyvsp[-2].id_list), EM_lineNum ); } |
| 1888 | #line 1888 "chuck.tab.c" /* yacc.c:1646 */ | 1889 | #line 1890 "chuck.tab.c" /* yacc.c:1651 */ |
| 1889 | break; | 1890 | break; |
| 1890 | 1891 | ||
| 1891 | case 13: | 1892 | case 13: |
| 1892 | #line 207 "chuck.y" /* yacc.c:1646 */ | 1893 | #line 208 "chuck.y" /* yacc.c:1651 */ |
| 1893 | { (yyval.class_ext) = new_class_ext( (yyvsp[0].id_list), NULL, EM_lineNum ); } | 1894 | { (yyval.class_ext) = new_class_ext( (yyvsp[0].id_list), NULL, EM_lineNum ); } |
| 1894 | #line 1894 "chuck.tab.c" /* yacc.c:1646 */ | 1895 | #line 1896 "chuck.tab.c" /* yacc.c:1651 */ |
| 1895 | break; | 1896 | break; |
| 1896 | 1897 | ||
| 1897 | case 14: | 1898 | case 14: |
| 1898 | #line 208 "chuck.y" /* yacc.c:1646 */ | 1899 | #line 209 "chuck.y" /* yacc.c:1651 */ |
| 1899 | { (yyval.class_ext) = new_class_ext( (yyvsp[-2].id_list), (yyvsp[0].id_list), EM_lineNum ); } | 1900 | { (yyval.class_ext) = new_class_ext( (yyvsp[-2].id_list), (yyvsp[0].id_list), EM_lineNum ); } |
| 1900 | #line 1900 "chuck.tab.c" /* yacc.c:1646 */ | 1901 | #line 1902 "chuck.tab.c" /* yacc.c:1651 */ |
| 1901 | break; | 1902 | break; |
| 1902 | 1903 | ||
| 1903 | case 15: | 1904 | case 15: |
| 1904 | #line 212 "chuck.y" /* yacc.c:1646 */ | 1905 | #line 213 "chuck.y" /* yacc.c:1651 */ |
| 1905 | { (yyval.class_body) = (yyvsp[0].class_body); } | 1906 | { (yyval.class_body) = (yyvsp[0].class_body); } |
| 1906 | #line 1906 "chuck.tab.c" /* yacc.c:1646 */ | 1907 | #line 1908 "chuck.tab.c" /* yacc.c:1651 */ |
| 1907 | break; | 1908 | break; |
| 1908 | 1909 | ||
| 1909 | case 16: | 1910 | case 16: |
| 1910 | #line 213 "chuck.y" /* yacc.c:1646 */ | 1911 | #line 214 "chuck.y" /* yacc.c:1651 */ |
| 1911 | { (yyval.class_body) = NULL; } | 1912 | { (yyval.class_body) = NULL; } |
| 1912 | #line 1912 "chuck.tab.c" /* yacc.c:1646 */ | 1913 | #line 1914 "chuck.tab.c" /* yacc.c:1651 */ |
| 1913 | break; | 1914 | break; |
| 1914 | 1915 | ||
| 1915 | case 17: | 1916 | case 17: |
| 1916 | #line 217 "chuck.y" /* yacc.c:1646 */ | 1917 | #line 218 "chuck.y" /* yacc.c:1651 */ |
| 1917 | { (yyval.class_body) = new_class_body( (yyvsp[0].program_section), EM_lineNum ); } | 1918 | { (yyval.class_body) = new_class_body( (yyvsp[0].program_section), EM_lineNum ); } |
| 1918 | #line 1918 "chuck.tab.c" /* yacc.c:1646 */ | 1919 | #line 1920 "chuck.tab.c" /* yacc.c:1651 */ |
| 1919 | break; | 1920 | break; |
| 1920 | 1921 | ||
| 1921 | case 18: | 1922 | case 18: |
| 1922 | #line 218 "chuck.y" /* yacc.c:1646 */ | 1923 | #line 219 "chuck.y" /* yacc.c:1651 */ |
| 1923 | { (yyval.class_body) = prepend_class_body( (yyvsp[-1].program_section), (yyvsp[0].class_body), EM_lineNum ); } | 1924 | { (yyval.class_body) = prepend_class_body( (yyvsp[-1].program_section), (yyvsp[0].class_body), EM_lineNum ); } |
| 1924 | #line 1924 "chuck.tab.c" /* yacc.c:1646 */ | 1925 | #line 1926 "chuck.tab.c" /* yacc.c:1651 */ |
| 1925 | break; | 1926 | break; |
| 1926 | 1927 | ||
| 1927 | case 19: | 1928 | case 19: |
| 1928 | #line 223 "chuck.y" /* yacc.c:1646 */ | 1929 | #line 224 "chuck.y" /* yacc.c:1651 */ |
| 1929 | { (yyval.program_section) = new_section_stmt( (yyvsp[0].stmt_list), EM_lineNum ); } | 1930 | { (yyval.program_section) = new_section_stmt( (yyvsp[0].stmt_list), EM_lineNum ); } |
| 1930 | #line 1930 "chuck.tab.c" /* yacc.c:1646 */ | 1931 | #line 1932 "chuck.tab.c" /* yacc.c:1651 */ |
| 1931 | break; | 1932 | break; |
| 1932 | 1933 | ||
| 1933 | case 20: | 1934 | case 20: |
| 1934 | #line 224 "chuck.y" /* yacc.c:1646 */ | 1935 | #line 225 "chuck.y" /* yacc.c:1651 */ |
| 1935 | { (yyval.program_section) = new_section_func_def( (yyvsp[0].func_def), EM_lineNum ); } | 1936 | { (yyval.program_section) = new_section_func_def( (yyvsp[0].func_def), EM_lineNum ); } |
| 1936 | #line 1936 "chuck.tab.c" /* yacc.c:1646 */ | 1937 | #line 1938 "chuck.tab.c" /* yacc.c:1651 */ |
| 1937 | break; | 1938 | break; |
| 1938 | 1939 | ||
| 1939 | case 21: | 1940 | case 21: |
| 1940 | #line 225 "chuck.y" /* yacc.c:1646 */ | 1941 | #line 226 "chuck.y" /* yacc.c:1651 */ |
| 1941 | { (yyval.program_section) = new_section_class_def( (yyvsp[0].class_def), EM_lineNum ); } | 1942 | { (yyval.program_section) = new_section_class_def( (yyvsp[0].class_def), EM_lineNum ); } |
| 1942 | #line 1942 "chuck.tab.c" /* yacc.c:1646 */ | 1943 | #line 1944 "chuck.tab.c" /* yacc.c:1651 */ |
| 1943 | break; | 1944 | break; |
| 1944 | 1945 | ||
| 1945 | case 22: | 1946 | case 22: |
| 1946 | #line 229 "chuck.y" /* yacc.c:1646 */ | 1947 | #line 230 "chuck.y" /* yacc.c:1651 */ |
| 1947 | { (yyval.class_ext) = new_class_ext( NULL, (yyvsp[0].id_list), EM_lineNum ); } | 1948 | { (yyval.class_ext) = new_class_ext( NULL, (yyvsp[0].id_list), EM_lineNum ); } |
| 1948 | #line 1948 "chuck.tab.c" /* yacc.c:1646 */ | 1949 | #line 1950 "chuck.tab.c" /* yacc.c:1651 */ |
| 1949 | break; | 1950 | break; |
| 1950 | 1951 | ||
| 1951 | case 23: | 1952 | case 23: |
| 1952 | #line 233 "chuck.y" /* yacc.c:1646 */ | 1953 | #line 234 "chuck.y" /* yacc.c:1651 */ |
| 1953 | { (yyval.id_list) = new_id_list( (yyvsp[0].sval), EM_lineNum ); } | 1954 | { (yyval.id_list) = new_id_list( (yyvsp[0].sval), EM_lineNum ); } |
| 1954 | #line 1954 "chuck.tab.c" /* yacc.c:1646 */ | 1955 | #line 1956 "chuck.tab.c" /* yacc.c:1651 */ |
| 1955 | break; | 1956 | break; |
| 1956 | 1957 | ||
| 1957 | case 24: | 1958 | case 24: |
| 1958 | #line 234 "chuck.y" /* yacc.c:1646 */ | 1959 | #line 235 "chuck.y" /* yacc.c:1651 */ |
| 1959 | { (yyval.id_list) = prepend_id_list( (yyvsp[-2].sval), (yyvsp[0].id_list), EM_lineNum ); } | 1960 | { (yyval.id_list) = prepend_id_list( (yyvsp[-2].sval), (yyvsp[0].id_list), EM_lineNum ); } |
| 1960 | #line 1960 "chuck.tab.c" /* yacc.c:1646 */ | 1961 | #line 1962 "chuck.tab.c" /* yacc.c:1651 */ |
| 1961 | break; | 1962 | break; |
| 1962 | 1963 | ||
| 1963 | case 25: | 1964 | case 25: |
| 1964 | #line 238 "chuck.y" /* yacc.c:1646 */ | 1965 | #line 239 "chuck.y" /* yacc.c:1651 */ |
| 1965 | { (yyval.id_list) = new_id_list( (yyvsp[0].sval), EM_lineNum ); } | 1966 | { (yyval.id_list) = new_id_list( (yyvsp[0].sval), EM_lineNum ); } |
| 1966 | #line 1966 "chuck.tab.c" /* yacc.c:1646 */ | 1967 | #line 1968 "chuck.tab.c" /* yacc.c:1651 */ |
| 1967 | break; | 1968 | break; |
| 1968 | 1969 | ||
| 1969 | case 26: | 1970 | case 26: |
| 1970 | #line 239 "chuck.y" /* yacc.c:1646 */ | 1971 | #line 240 "chuck.y" /* yacc.c:1651 */ |
| 1971 | { (yyval.id_list) = prepend_id_list( (yyvsp[-2].sval), (yyvsp[0].id_list), EM_lineNum ); } | 1972 | { (yyval.id_list) = prepend_id_list( (yyvsp[-2].sval), (yyvsp[0].id_list), EM_lineNum ); } |
| 1972 | #line 1972 "chuck.tab.c" /* yacc.c:1646 */ | 1973 | #line 1974 "chuck.tab.c" /* yacc.c:1651 */ |
| 1973 | break; | 1974 | break; |
| 1974 | 1975 | ||
| 1975 | case 27: | 1976 | case 27: |
| 1976 | #line 244 "chuck.y" /* yacc.c:1646 */ | 1977 | #line 245 "chuck.y" /* yacc.c:1651 */ |
| 1977 | { (yyval.func_def) = new_func_def( (yyvsp[-7].ival), (yyvsp[-6].ival), (yyvsp[-5].type_decl), (yyvsp[-4].sval), (yyvsp[-2].arg_list), (yyvsp[0].stmt), EM_lineNum ); } | 1978 | { (yyval.func_def) = new_func_def( (yyvsp[-7].ival), (yyvsp[-6].ival), (yyvsp[-5].type_decl), (yyvsp[-4].sval), (yyvsp[-2].arg_list), (yyvsp[0].stmt), EM_lineNum ); } |
| 1978 | #line 1978 "chuck.tab.c" /* yacc.c:1646 */ | 1979 | #line 1980 "chuck.tab.c" /* yacc.c:1651 */ |
| 1979 | break; | 1980 | break; |
| 1980 | 1981 | ||
| 1981 | case 28: | 1982 | case 28: |
| 1982 | #line 246 "chuck.y" /* yacc.c:1646 */ | 1983 | #line 247 "chuck.y" /* yacc.c:1651 */ |
| 1983 | { (yyval.func_def) = new_func_def( (yyvsp[-6].ival), (yyvsp[-5].ival), (yyvsp[-4].type_decl), (yyvsp[-3].sval), NULL, (yyvsp[0].stmt), EM_lineNum ); } | 1984 | { (yyval.func_def) = new_func_def( (yyvsp[-6].ival), (yyvsp[-5].ival), (yyvsp[-4].type_decl), (yyvsp[-3].sval), NULL, (yyvsp[0].stmt), EM_lineNum ); } |
| 1984 | #line 1984 "chuck.tab.c" /* yacc.c:1646 */ | 1985 | #line 1986 "chuck.tab.c" /* yacc.c:1651 */ |
| 1985 | break; | 1986 | break; |
| 1986 | 1987 | ||
| 1987 | case 29: | 1988 | case 29: |
| 1988 | #line 248 "chuck.y" /* yacc.c:1646 */ | 1989 | #line 249 "chuck.y" /* yacc.c:1651 */ |
| 1989 | { (yyval.func_def) = new_func_def( (yyvsp[-7].ival), (yyvsp[-6].ival), (yyvsp[-5].type_decl), (yyvsp[-4].sval), (yyvsp[-2].arg_list), NULL, EM_lineNum ); } | 1990 | { (yyval.func_def) = new_func_def( (yyvsp[-7].ival), (yyvsp[-6].ival), (yyvsp[-5].type_decl), (yyvsp[-4].sval), (yyvsp[-2].arg_list), NULL, EM_lineNum ); } |
| 1990 | #line 1990 "chuck.tab.c" /* yacc.c:1646 */ | 1991 | #line 1992 "chuck.tab.c" /* yacc.c:1651 */ |
| 1991 | break; | 1992 | break; |
| 1992 | 1993 | ||
| 1993 | case 30: | 1994 | case 30: |
| 1994 | #line 250 "chuck.y" /* yacc.c:1646 */ | 1995 | #line 251 "chuck.y" /* yacc.c:1651 */ |
| 1995 | { (yyval.func_def) = new_func_def( (yyvsp[-6].ival), (yyvsp[-5].ival), (yyvsp[-4].type_decl), (yyvsp[-3].sval), NULL, NULL, EM_lineNum ); } | 1996 | { (yyval.func_def) = new_func_def( (yyvsp[-6].ival), (yyvsp[-5].ival), (yyvsp[-4].type_decl), (yyvsp[-3].sval), NULL, NULL, EM_lineNum ); } |
| 1996 | #line 1996 "chuck.tab.c" /* yacc.c:1646 */ | 1997 | #line 1998 "chuck.tab.c" /* yacc.c:1651 */ |
| 1997 | break; | 1998 | break; |
| 1998 | 1999 | ||
| 1999 | case 31: | 2000 | case 31: |
| 2000 | #line 254 "chuck.y" /* yacc.c:1646 */ | 2001 | #line 255 "chuck.y" /* yacc.c:1651 */ |
| 2001 | { (yyval.ival) = ae_key_public; } | 2002 | { (yyval.ival) = ae_key_public; } |
| 2002 | #line 2002 "chuck.tab.c" /* yacc.c:1646 */ | 2003 | #line 2004 "chuck.tab.c" /* yacc.c:1651 */ |
| 2003 | break; | 2004 | break; |
| 2004 | 2005 | ||
| 2005 | case 32: | 2006 | case 32: |
| 2006 | #line 255 "chuck.y" /* yacc.c:1646 */ | 2007 | #line 256 "chuck.y" /* yacc.c:1651 */ |
| 2007 | { (yyval.ival) = ae_key_private; } | 2008 | { (yyval.ival) = ae_key_private; } |
| 2008 | #line 2008 "chuck.tab.c" /* yacc.c:1646 */ | 2009 | #line 2010 "chuck.tab.c" /* yacc.c:1651 */ |
| 2009 | break; | 2010 | break; |
| 2010 | 2011 | ||
| 2011 | case 33: | 2012 | case 33: |
| 2012 | #line 256 "chuck.y" /* yacc.c:1646 */ | 2013 | #line 257 "chuck.y" /* yacc.c:1651 */ |
| 2013 | { (yyval.ival) = ae_key_private; } | 2014 | { (yyval.ival) = ae_key_private; } |
| 2014 | #line 2014 "chuck.tab.c" /* yacc.c:1646 */ | 2015 | #line 2016 "chuck.tab.c" /* yacc.c:1651 */ |
| 2015 | break; | 2016 | break; |
| 2016 | 2017 | ||
| 2017 | case 34: | 2018 | case 34: |
| 2018 | #line 260 "chuck.y" /* yacc.c:1646 */ | 2019 | #line 261 "chuck.y" /* yacc.c:1651 */ |
| 2019 | { (yyval.ival) = ae_key_func; } | 2020 | { (yyval.ival) = ae_key_func; } |
| 2020 | #line 2020 "chuck.tab.c" /* yacc.c:1646 */ | 2021 | #line 2022 "chuck.tab.c" /* yacc.c:1651 */ |
| 2021 | break; | 2022 | break; |
| 2022 | 2023 | ||
| 2023 | case 35: | 2024 | case 35: |
| 2024 | #line 261 "chuck.y" /* yacc.c:1646 */ | 2025 | #line 262 "chuck.y" /* yacc.c:1651 */ |
| 2025 | { (yyval.ival) = ae_key_public; } | 2026 | { (yyval.ival) = ae_key_public; } |
| 2026 | #line 2026 "chuck.tab.c" /* yacc.c:1646 */ | 2027 | #line 2028 "chuck.tab.c" /* yacc.c:1651 */ |
| 2027 | break; | 2028 | break; |
| 2028 | 2029 | ||
| 2029 | case 36: | 2030 | case 36: |
| 2030 | #line 262 "chuck.y" /* yacc.c:1646 */ | 2031 | #line 263 "chuck.y" /* yacc.c:1651 */ |
| 2031 | { (yyval.ival) = ae_key_protected; } | 2032 | { (yyval.ival) = ae_key_protected; } |
| 2032 | #line 2032 "chuck.tab.c" /* yacc.c:1646 */ | 2033 | #line 2034 "chuck.tab.c" /* yacc.c:1651 */ |
| 2033 | break; | 2034 | break; |
| 2034 | 2035 | ||
| 2035 | case 37: | 2036 | case 37: |
| 2036 | #line 263 "chuck.y" /* yacc.c:1646 */ | 2037 | #line 264 "chuck.y" /* yacc.c:1651 */ |
| 2037 | { (yyval.ival) = ae_key_private; } | 2038 | { (yyval.ival) = ae_key_private; } |
| 2038 | #line 2038 "chuck.tab.c" /* yacc.c:1646 */ | 2039 | #line 2040 "chuck.tab.c" /* yacc.c:1651 */ |
| 2039 | break; | 2040 | break; |
| 2040 | 2041 | ||
| 2041 | case 38: | 2042 | case 38: |
| 2042 | #line 267 "chuck.y" /* yacc.c:1646 */ | 2043 | #line 268 "chuck.y" /* yacc.c:1651 */ |
| 2043 | { (yyval.ival) = ae_key_static; } | 2044 | { (yyval.ival) = ae_key_static; } |
| 2044 | #line 2044 "chuck.tab.c" /* yacc.c:1646 */ | 2045 | #line 2046 "chuck.tab.c" /* yacc.c:1651 */ |
| 2045 | break; | 2046 | break; |
| 2046 | 2047 | ||
| 2047 | case 39: | 2048 | case 39: |
| 2048 | #line 268 "chuck.y" /* yacc.c:1646 */ | 2049 | #line 269 "chuck.y" /* yacc.c:1651 */ |
| 2049 | { (yyval.ival) = ae_key_abstract; } | 2050 | { (yyval.ival) = ae_key_abstract; } |
| 2050 | #line 2050 "chuck.tab.c" /* yacc.c:1646 */ | 2051 | #line 2052 "chuck.tab.c" /* yacc.c:1651 */ |
| 2051 | break; | 2052 | break; |
| 2052 | 2053 | ||
| 2053 | case 40: | 2054 | case 40: |
| 2054 | #line 269 "chuck.y" /* yacc.c:1646 */ | 2055 | #line 270 "chuck.y" /* yacc.c:1651 */ |
| 2055 | { (yyval.ival) = ae_key_instance; } | 2056 | { (yyval.ival) = ae_key_instance; } |
| 2056 | #line 2056 "chuck.tab.c" /* yacc.c:1646 */ | 2057 | #line 2058 "chuck.tab.c" /* yacc.c:1651 */ |
| 2057 | break; | 2058 | break; |
| 2058 | 2059 | ||
| 2059 | case 41: | 2060 | case 41: |
| 2060 | #line 273 "chuck.y" /* yacc.c:1646 */ | 2061 | #line 274 "chuck.y" /* yacc.c:1651 */ |
| 2061 | { (yyval.type_decl) = new_type_decl( new_id_list( (yyvsp[0].sval), EM_lineNum ), 0, EM_lineNum ); } | 2062 | { (yyval.type_decl) = new_type_decl( new_id_list( (yyvsp[0].sval), EM_lineNum ), 0, EM_lineNum ); } |
| 2062 | #line 2062 "chuck.tab.c" /* yacc.c:1646 */ | 2063 | #line 2064 "chuck.tab.c" /* yacc.c:1651 */ |
| 2063 | break; | 2064 | break; |
| 2064 | 2065 | ||
| 2065 | case 42: | 2066 | case 42: |
| 2066 | #line 274 "chuck.y" /* yacc.c:1646 */ | 2067 | #line 275 "chuck.y" /* yacc.c:1651 */ |
| 2067 | { (yyval.type_decl) = new_type_decl( new_id_list( (yyvsp[-1].sval), EM_lineNum ), 1, EM_lineNum ); } | 2068 | { (yyval.type_decl) = new_type_decl( new_id_list( (yyvsp[-1].sval), EM_lineNum ), 1, EM_lineNum ); } |
| 2068 | #line 2068 "chuck.tab.c" /* yacc.c:1646 */ | 2069 | #line 2070 "chuck.tab.c" /* yacc.c:1651 */ |
| 2069 | break; | 2070 | break; |
| 2070 | 2071 | ||
| 2071 | case 43: | 2072 | case 43: |
| 2072 | #line 278 "chuck.y" /* yacc.c:1646 */ | 2073 | #line 279 "chuck.y" /* yacc.c:1651 */ |
| 2073 | { (yyval.type_decl) = new_type_decl( (yyvsp[-1].id_list), 0, EM_lineNum ); } | 2074 | { (yyval.type_decl) = new_type_decl( (yyvsp[-1].id_list), 0, EM_lineNum ); } |
| 2074 | #line 2074 "chuck.tab.c" /* yacc.c:1646 */ | 2075 | #line 2076 "chuck.tab.c" /* yacc.c:1651 */ |
| 2075 | break; | 2076 | break; |
| 2076 | 2077 | ||
| 2077 | case 44: | 2078 | case 44: |
| 2078 | #line 279 "chuck.y" /* yacc.c:1646 */ | 2079 | #line 280 "chuck.y" /* yacc.c:1651 */ |
| 2079 | { (yyval.type_decl) = new_type_decl( (yyvsp[-2].id_list), 1, EM_lineNum ); } | 2080 | { (yyval.type_decl) = new_type_decl( (yyvsp[-2].id_list), 1, EM_lineNum ); } |
| 2080 | #line 2080 "chuck.tab.c" /* yacc.c:1646 */ | 2081 | #line 2082 "chuck.tab.c" /* yacc.c:1651 */ |
| 2081 | break; | 2082 | break; |
| 2082 | 2083 | ||
| 2083 | case 45: | 2084 | case 45: |
| 2084 | #line 288 "chuck.y" /* yacc.c:1646 */ | 2085 | #line 289 "chuck.y" /* yacc.c:1651 */ |
| 2085 | { (yyval.type_decl) = (yyvsp[0].type_decl); } | 2086 | { (yyval.type_decl) = (yyvsp[0].type_decl); } |
| 2086 | #line 2086 "chuck.tab.c" /* yacc.c:1646 */ | 2087 | #line 2088 "chuck.tab.c" /* yacc.c:1651 */ |
| 2087 | break; | 2088 | break; |
| 2088 | 2089 | ||
| 2089 | case 46: | 2090 | case 46: |
| 2090 | #line 289 "chuck.y" /* yacc.c:1646 */ | 2091 | #line 290 "chuck.y" /* yacc.c:1651 */ |
| 2091 | { (yyval.type_decl) = (yyvsp[0].type_decl); } | 2092 | { (yyval.type_decl) = (yyvsp[0].type_decl); } |
| 2092 | #line 2092 "chuck.tab.c" /* yacc.c:1646 */ | 2093 | #line 2094 "chuck.tab.c" /* yacc.c:1651 */ |
| 2093 | break; | 2094 | break; |
| 2094 | 2095 | ||
| 2095 | case 47: | 2096 | case 47: |
| 2096 | #line 294 "chuck.y" /* yacc.c:1646 */ | 2097 | #line 295 "chuck.y" /* yacc.c:1651 */ |
| 2097 | { (yyval.type_decl) = (yyvsp[0].type_decl); } | 2098 | { (yyval.type_decl) = (yyvsp[0].type_decl); } |
| 2098 | #line 2098 "chuck.tab.c" /* yacc.c:1646 */ | 2099 | #line 2100 "chuck.tab.c" /* yacc.c:1651 */ |
| 2099 | break; | 2100 | break; |
| 2100 | 2101 | ||
| 2101 | case 48: | 2102 | case 48: |
| 2102 | #line 295 "chuck.y" /* yacc.c:1646 */ | 2103 | #line 296 "chuck.y" /* yacc.c:1651 */ |
| 2103 | { (yyval.type_decl) = add_type_decl_array( (yyvsp[-1].type_decl), (yyvsp[0].array_sub), EM_lineNum ); } | 2104 | { (yyval.type_decl) = add_type_decl_array( (yyvsp[-1].type_decl), (yyvsp[0].array_sub), EM_lineNum ); } |
| 2104 | #line 2104 "chuck.tab.c" /* yacc.c:1646 */ | 2105 | #line 2106 "chuck.tab.c" /* yacc.c:1651 */ |
| 2105 | break; | 2106 | break; |
| 2106 | 2107 | ||
| 2107 | case 49: | 2108 | case 49: |
| 2108 | #line 299 "chuck.y" /* yacc.c:1646 */ | 2109 | #line 300 "chuck.y" /* yacc.c:1651 */ |
| 2109 | { (yyval.arg_list) = new_arg_list( (yyvsp[-1].type_decl), (yyvsp[0].var_decl), EM_lineNum ); } | 2110 | { (yyval.arg_list) = new_arg_list( (yyvsp[-1].type_decl), (yyvsp[0].var_decl), EM_lineNum ); } |
| 2110 | #line 2110 "chuck.tab.c" /* yacc.c:1646 */ | 2111 | #line 2112 "chuck.tab.c" /* yacc.c:1651 */ |
| 2111 | break; | 2112 | break; |
| 2112 | 2113 | ||
| 2113 | case 50: | 2114 | case 50: |
| 2114 | #line 300 "chuck.y" /* yacc.c:1646 */ | 2115 | #line 301 "chuck.y" /* yacc.c:1651 */ |
| 2115 | { (yyval.arg_list) = prepend_arg_list( (yyvsp[-3].type_decl), (yyvsp[-2].var_decl), (yyvsp[0].arg_list), EM_lineNum ); } | 2116 | { (yyval.arg_list) = prepend_arg_list( (yyvsp[-3].type_decl), (yyvsp[-2].var_decl), (yyvsp[0].arg_list), EM_lineNum ); } |
| 2116 | #line 2116 "chuck.tab.c" /* yacc.c:1646 */ | 2117 | #line 2118 "chuck.tab.c" /* yacc.c:1651 */ |
| 2117 | break; | 2118 | break; |
| 2118 | 2119 | ||
| 2119 | case 51: | 2120 | case 51: |
| 2120 | #line 304 "chuck.y" /* yacc.c:1646 */ | 2121 | #line 305 "chuck.y" /* yacc.c:1651 */ |
| 2121 | { (yyval.stmt_list) = new_stmt_list( (yyvsp[0].stmt), EM_lineNum ); } | 2122 | { (yyval.stmt_list) = new_stmt_list( (yyvsp[0].stmt), EM_lineNum ); } |
| 2122 | #line 2122 "chuck.tab.c" /* yacc.c:1646 */ | 2123 | #line 2124 "chuck.tab.c" /* yacc.c:1651 */ |
| 2123 | break; | 2124 | break; |
| 2124 | 2125 | ||
| 2125 | case 52: | 2126 | case 52: |
| 2126 | #line 305 "chuck.y" /* yacc.c:1646 */ | 2127 | #line 306 "chuck.y" /* yacc.c:1651 */ |
| 2127 | { (yyval.stmt_list) = prepend_stmt_list( (yyvsp[-1].stmt), (yyvsp[0].stmt_list), EM_lineNum ); } | 2128 | { (yyval.stmt_list) = prepend_stmt_list( (yyvsp[-1].stmt), (yyvsp[0].stmt_list), EM_lineNum ); } |
| 2128 | #line 2128 "chuck.tab.c" /* yacc.c:1646 */ | 2129 | #line 2130 "chuck.tab.c" /* yacc.c:1651 */ |
| 2129 | break; | 2130 | break; |
| 2130 | 2131 | ||
| 2131 | case 53: | 2132 | case 53: |
| 2132 | #line 309 "chuck.y" /* yacc.c:1646 */ | 2133 | #line 310 "chuck.y" /* yacc.c:1651 */ |
| 2133 | { (yyval.stmt) = (yyvsp[0].stmt); } | 2134 | { (yyval.stmt) = (yyvsp[0].stmt); } |
| 2134 | #line 2134 "chuck.tab.c" /* yacc.c:1646 */ | 2135 | #line 2136 "chuck.tab.c" /* yacc.c:1651 */ |
| 2135 | break; | 2136 | break; |
| 2136 | 2137 | ||
| 2137 | case 54: | 2138 | case 54: |
| 2138 | #line 310 "chuck.y" /* yacc.c:1646 */ | 2139 | #line 311 "chuck.y" /* yacc.c:1651 */ |
| 2139 | { (yyval.stmt) = (yyvsp[0].stmt); } | 2140 | { (yyval.stmt) = (yyvsp[0].stmt); } |
| 2140 | #line 2140 "chuck.tab.c" /* yacc.c:1646 */ | 2141 | #line 2142 "chuck.tab.c" /* yacc.c:1651 */ |
| 2141 | break; | 2142 | break; |
| 2142 | 2143 | ||
| 2143 | case 55: | 2144 | case 55: |
| 2144 | #line 311 "chuck.y" /* yacc.c:1646 */ | 2145 | #line 312 "chuck.y" /* yacc.c:1651 */ |
| 2145 | { (yyval.stmt) = (yyvsp[0].stmt); } | 2146 | { (yyval.stmt) = (yyvsp[0].stmt); } |
| 2146 | #line 2146 "chuck.tab.c" /* yacc.c:1646 */ | 2147 | #line 2148 "chuck.tab.c" /* yacc.c:1651 */ |
| 2147 | break; | 2148 | break; |
| 2148 | 2149 | ||
| 2149 | case 56: | 2150 | case 56: |
| 2150 | #line 312 "chuck.y" /* yacc.c:1646 */ | 2151 | #line 313 "chuck.y" /* yacc.c:1651 */ |
| 2151 | { (yyval.stmt) = (yyvsp[0].stmt); } | 2152 | { (yyval.stmt) = (yyvsp[0].stmt); } |
| 2152 | #line 2152 "chuck.tab.c" /* yacc.c:1646 */ | 2153 | #line 2154 "chuck.tab.c" /* yacc.c:1651 */ |
| 2153 | break; | 2154 | break; |
| 2154 | 2155 | ||
| 2155 | case 57: | 2156 | case 57: |
| 2156 | #line 314 "chuck.y" /* yacc.c:1646 */ | 2157 | #line 315 "chuck.y" /* yacc.c:1651 */ |
| 2157 | { (yyval.stmt) = (yyvsp[0].stmt); } | 2158 | { (yyval.stmt) = (yyvsp[0].stmt); } |
| 2158 | #line 2158 "chuck.tab.c" /* yacc.c:1646 */ | 2159 | #line 2160 "chuck.tab.c" /* yacc.c:1651 */ |
| 2159 | break; | 2160 | break; |
| 2160 | 2161 | ||
| 2161 | case 58: | 2162 | case 58: |
| 2162 | #line 318 "chuck.y" /* yacc.c:1646 */ | 2163 | #line 319 "chuck.y" /* yacc.c:1651 */ |
| 2163 | { (yyval.stmt) = new_stmt_from_return( NULL, EM_lineNum ); } | 2164 | { (yyval.stmt) = new_stmt_from_return( NULL, EM_lineNum ); } |
| 2164 | #line 2164 "chuck.tab.c" /* yacc.c:1646 */ | 2165 | #line 2166 "chuck.tab.c" /* yacc.c:1651 */ |
| 2165 | break; | 2166 | break; |
| 2166 | 2167 | ||
| 2167 | case 59: | 2168 | case 59: |
| 2168 | #line 319 "chuck.y" /* yacc.c:1646 */ | 2169 | #line 320 "chuck.y" /* yacc.c:1651 */ |
| 2169 | { (yyval.stmt) = new_stmt_from_return( (yyvsp[-1].exp), EM_lineNum ); } | 2170 | { (yyval.stmt) = new_stmt_from_return( (yyvsp[-1].exp), EM_lineNum ); } |
| 2170 | #line 2170 "chuck.tab.c" /* yacc.c:1646 */ | 2171 | #line 2172 "chuck.tab.c" /* yacc.c:1651 */ |
| 2171 | break; | 2172 | break; |
| 2172 | 2173 | ||
| 2173 | case 60: | 2174 | case 60: |
| 2174 | #line 320 "chuck.y" /* yacc.c:1646 */ | 2175 | #line 321 "chuck.y" /* yacc.c:1651 */ |
| 2175 | { (yyval.stmt) = new_stmt_from_break( EM_lineNum ); } | 2176 | { (yyval.stmt) = new_stmt_from_break( EM_lineNum ); } |
| 2176 | #line 2176 "chuck.tab.c" /* yacc.c:1646 */ | 2177 | #line 2178 "chuck.tab.c" /* yacc.c:1651 */ |
| 2177 | break; | 2178 | break; |
| 2178 | 2179 | ||
| 2179 | case 61: | 2180 | case 61: |
| 2180 | #line 321 "chuck.y" /* yacc.c:1646 */ | 2181 | #line 322 "chuck.y" /* yacc.c:1651 */ |
| 2181 | { (yyval.stmt) = new_stmt_from_continue( EM_lineNum ); } | 2182 | { (yyval.stmt) = new_stmt_from_continue( EM_lineNum ); } |
| 2182 | #line 2182 "chuck.tab.c" /* yacc.c:1646 */ | 2183 | #line 2184 "chuck.tab.c" /* yacc.c:1651 */ |
| 2183 | break; | 2184 | break; |
| 2184 | 2185 | ||
| 2185 | case 62: | 2186 | case 62: |
| 2186 | #line 326 "chuck.y" /* yacc.c:1646 */ | 2187 | #line 327 "chuck.y" /* yacc.c:1651 */ |
| 2187 | { (yyval.stmt) = new_stmt_from_if( (yyvsp[-2].exp), (yyvsp[0].stmt), NULL, EM_lineNum ); } | 2188 | { (yyval.stmt) = new_stmt_from_if( (yyvsp[-2].exp), (yyvsp[0].stmt), NULL, EM_lineNum ); } |
| 2188 | #line 2188 "chuck.tab.c" /* yacc.c:1646 */ | 2189 | #line 2190 "chuck.tab.c" /* yacc.c:1651 */ |
| 2189 | break; | 2190 | break; |
| 2190 | 2191 | ||
| 2191 | case 63: | 2192 | case 63: |
| 2192 | #line 328 "chuck.y" /* yacc.c:1646 */ | 2193 | #line 329 "chuck.y" /* yacc.c:1651 */ |
| 2193 | { (yyval.stmt) = new_stmt_from_if( (yyvsp[-4].exp), (yyvsp[-2].stmt), (yyvsp[0].stmt), EM_lineNum ); } | 2194 | { (yyval.stmt) = new_stmt_from_if( (yyvsp[-4].exp), (yyvsp[-2].stmt), (yyvsp[0].stmt), EM_lineNum ); } |
| 2194 | #line 2194 "chuck.tab.c" /* yacc.c:1646 */ | 2195 | #line 2196 "chuck.tab.c" /* yacc.c:1651 */ |
| 2195 | break; | 2196 | break; |
| 2196 | 2197 | ||
| 2197 | case 64: | 2198 | case 64: |
| 2198 | #line 333 "chuck.y" /* yacc.c:1646 */ | 2199 | #line 334 "chuck.y" /* yacc.c:1651 */ |
| 2199 | { (yyval.stmt) = new_stmt_from_while( (yyvsp[-2].exp), (yyvsp[0].stmt), EM_lineNum ); } | 2200 | { (yyval.stmt) = new_stmt_from_while( (yyvsp[-2].exp), (yyvsp[0].stmt), EM_lineNum ); } |
| 2200 | #line 2200 "chuck.tab.c" /* yacc.c:1646 */ | 2201 | #line 2202 "chuck.tab.c" /* yacc.c:1651 */ |
| 2201 | break; | 2202 | break; |
| 2202 | 2203 | ||
| 2203 | case 65: | 2204 | case 65: |
| 2204 | #line 335 "chuck.y" /* yacc.c:1646 */ | 2205 | #line 336 "chuck.y" /* yacc.c:1651 */ |
| 2205 | { (yyval.stmt) = new_stmt_from_do_while( (yyvsp[-2].exp), (yyvsp[-5].stmt), EM_lineNum ); } | 2206 | { (yyval.stmt) = new_stmt_from_do_while( (yyvsp[-2].exp), (yyvsp[-5].stmt), EM_lineNum ); } |
| 2206 | #line 2206 "chuck.tab.c" /* yacc.c:1646 */ | 2207 | #line 2208 "chuck.tab.c" /* yacc.c:1651 */ |
| 2207 | break; | 2208 | break; |
| 2208 | 2209 | ||
| 2209 | case 66: | 2210 | case 66: |
| 2210 | #line 337 "chuck.y" /* yacc.c:1646 */ | 2211 | #line 338 "chuck.y" /* yacc.c:1651 */ |
| 2211 | { (yyval.stmt) = new_stmt_from_for( (yyvsp[-3].stmt), (yyvsp[-2].stmt), NULL, (yyvsp[0].stmt), EM_lineNum ); } | 2212 | { (yyval.stmt) = new_stmt_from_for( (yyvsp[-3].stmt), (yyvsp[-2].stmt), NULL, (yyvsp[0].stmt), EM_lineNum ); } |
| 2212 | #line 2212 "chuck.tab.c" /* yacc.c:1646 */ | 2213 | #line 2214 "chuck.tab.c" /* yacc.c:1651 */ |
| 2213 | break; | 2214 | break; |
| 2214 | 2215 | ||
| 2215 | case 67: | 2216 | case 67: |
| 2216 | #line 339 "chuck.y" /* yacc.c:1646 */ | 2217 | #line 340 "chuck.y" /* yacc.c:1651 */ |
| 2217 | { (yyval.stmt) = new_stmt_from_for( (yyvsp[-4].stmt), (yyvsp[-3].stmt), (yyvsp[-2].exp), (yyvsp[0].stmt), EM_lineNum ); } | 2218 | { (yyval.stmt) = new_stmt_from_for( (yyvsp[-4].stmt), (yyvsp[-3].stmt), (yyvsp[-2].exp), (yyvsp[0].stmt), EM_lineNum ); } |
| 2218 | #line 2218 "chuck.tab.c" /* yacc.c:1646 */ | 2219 | #line 2220 "chuck.tab.c" /* yacc.c:1651 */ |
| 2219 | break; | 2220 | break; |
| 2220 | 2221 | ||
| 2221 | case 68: | 2222 | case 68: |
| 2222 | #line 341 "chuck.y" /* yacc.c:1646 */ | 2223 | #line 342 "chuck.y" /* yacc.c:1651 */ |
| 2223 | { (yyval.stmt) = new_stmt_from_until( (yyvsp[-2].exp), (yyvsp[0].stmt), EM_lineNum ); } | 2224 | { (yyval.stmt) = new_stmt_from_until( (yyvsp[-2].exp), (yyvsp[0].stmt), EM_lineNum ); } |
| 2224 | #line 2224 "chuck.tab.c" /* yacc.c:1646 */ | 2225 | #line 2226 "chuck.tab.c" /* yacc.c:1651 */ |
| 2225 | break; | 2226 | break; |
| 2226 | 2227 | ||
| 2227 | case 69: | 2228 | case 69: |
| 2228 | #line 343 "chuck.y" /* yacc.c:1646 */ | 2229 | #line 344 "chuck.y" /* yacc.c:1651 */ |
| 2229 | { (yyval.stmt) = new_stmt_from_do_until( (yyvsp[-2].exp), (yyvsp[-5].stmt), EM_lineNum ); } | 2230 | { (yyval.stmt) = new_stmt_from_do_until( (yyvsp[-2].exp), (yyvsp[-5].stmt), EM_lineNum ); } |
| 2230 | #line 2230 "chuck.tab.c" /* yacc.c:1646 */ | 2231 | #line 2232 "chuck.tab.c" /* yacc.c:1651 */ |
| 2231 | break; | 2232 | break; |
| 2232 | 2233 | ||
| 2233 | case 70: | 2234 | case 70: |
| 2234 | #line 345 "chuck.y" /* yacc.c:1646 */ | 2235 | #line 346 "chuck.y" /* yacc.c:1651 */ |
| 2235 | { (yyval.stmt) = new_stmt_from_loop( (yyvsp[-2].exp), (yyvsp[0].stmt), EM_lineNum ); } | 2236 | { (yyval.stmt) = new_stmt_from_loop( (yyvsp[-2].exp), (yyvsp[0].stmt), EM_lineNum ); } |
| 2236 | #line 2236 "chuck.tab.c" /* yacc.c:1646 */ | 2237 | #line 2238 "chuck.tab.c" /* yacc.c:1651 */ |
| 2237 | break; | 2238 | break; |
| 2238 | 2239 | ||
| 2239 | case 71: | 2240 | case 71: |
| 2240 | #line 349 "chuck.y" /* yacc.c:1646 */ | 2241 | #line 350 "chuck.y" /* yacc.c:1651 */ |
| 2241 | { (yyval.stmt) = new_stmt_from_code( NULL, EM_lineNum ); } | 2242 | { (yyval.stmt) = new_stmt_from_code( NULL, EM_lineNum ); } |
| 2242 | #line 2242 "chuck.tab.c" /* yacc.c:1646 */ | 2243 | #line 2244 "chuck.tab.c" /* yacc.c:1651 */ |
| 2243 | break; | 2244 | break; |
| 2244 | 2245 | ||
| 2245 | case 72: | 2246 | case 72: |
| 2246 | #line 350 "chuck.y" /* yacc.c:1646 */ | 2247 | #line 351 "chuck.y" /* yacc.c:1651 */ |
| 2247 | { (yyval.stmt) = new_stmt_from_code( (yyvsp[-1].stmt_list), EM_lineNum ); } | 2248 | { (yyval.stmt) = new_stmt_from_code( (yyvsp[-1].stmt_list), EM_lineNum ); } |
| 2248 | #line 2248 "chuck.tab.c" /* yacc.c:1646 */ | 2249 | #line 2250 "chuck.tab.c" /* yacc.c:1651 */ |
| 2249 | break; | 2250 | break; |
| 2250 | 2251 | ||
| 2251 | case 73: | 2252 | case 73: |
| 2252 | #line 354 "chuck.y" /* yacc.c:1646 */ | 2253 | #line 355 "chuck.y" /* yacc.c:1651 */ |
| 2253 | { (yyval.stmt) = NULL; } | 2254 | { (yyval.stmt) = NULL; } |
| 2254 | #line 2254 "chuck.tab.c" /* yacc.c:1646 */ | 2255 | #line 2256 "chuck.tab.c" /* yacc.c:1651 */ |
| 2255 | break; | 2256 | break; |
| 2256 | 2257 | ||
| 2257 | case 74: | 2258 | case 74: |
| 2258 | #line 355 "chuck.y" /* yacc.c:1646 */ | 2259 | #line 356 "chuck.y" /* yacc.c:1651 */ |
| 2259 | { (yyval.stmt) = new_stmt_from_expression( (yyvsp[-1].exp), EM_lineNum ); } | 2260 | { (yyval.stmt) = new_stmt_from_expression( (yyvsp[-1].exp), EM_lineNum ); } |
| 2260 | #line 2260 "chuck.tab.c" /* yacc.c:1646 */ | 2261 | #line 2262 "chuck.tab.c" /* yacc.c:1651 */ |
| 2261 | break; | 2262 | break; |
| 2262 | 2263 | ||
| 2263 | case 75: | 2264 | case 75: |
| 2264 | #line 359 "chuck.y" /* yacc.c:1646 */ | 2265 | #line 360 "chuck.y" /* yacc.c:1651 */ |
| 2265 | { (yyval.exp) = (yyvsp[0].exp); } | 2266 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2266 | #line 2266 "chuck.tab.c" /* yacc.c:1646 */ | 2267 | #line 2268 "chuck.tab.c" /* yacc.c:1651 */ |
| 2267 | break; | 2268 | break; |
| 2268 | 2269 | ||
| 2269 | case 76: | 2270 | case 76: |
| 2270 | #line 360 "chuck.y" /* yacc.c:1646 */ | 2271 | #line 361 "chuck.y" /* yacc.c:1651 */ |
| 2271 | { (yyval.exp) = prepend_expression( (yyvsp[-2].exp), (yyvsp[0].exp), EM_lineNum ); } | 2272 | { (yyval.exp) = prepend_expression( (yyvsp[-2].exp), (yyvsp[0].exp), EM_lineNum ); } |
| 2272 | #line 2272 "chuck.tab.c" /* yacc.c:1646 */ | 2273 | #line 2274 "chuck.tab.c" /* yacc.c:1651 */ |
| 2273 | break; | 2274 | break; |
| 2274 | 2275 | ||
| 2275 | case 77: | 2276 | case 77: |
| 2276 | #line 364 "chuck.y" /* yacc.c:1646 */ | 2277 | #line 365 "chuck.y" /* yacc.c:1651 */ |
| 2277 | { (yyval.exp) = (yyvsp[0].exp); } | 2278 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2278 | #line 2278 "chuck.tab.c" /* yacc.c:1646 */ | 2279 | #line 2280 "chuck.tab.c" /* yacc.c:1651 */ |
| 2279 | break; | 2280 | break; |
| 2280 | 2281 | ||
| 2281 | case 78: | 2282 | case 78: |
| 2282 | #line 366 "chuck.y" /* yacc.c:1646 */ | 2283 | #line 367 "chuck.y" /* yacc.c:1651 */ |
| 2283 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), (yyvsp[-1].ival), (yyvsp[0].exp), EM_lineNum ); } | 2284 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), (yyvsp[-1].ival), (yyvsp[0].exp), EM_lineNum ); } |
| 2284 | #line 2284 "chuck.tab.c" /* yacc.c:1646 */ | 2285 | #line 2286 "chuck.tab.c" /* yacc.c:1651 */ |
| 2285 | break; | 2286 | break; |
| 2286 | 2287 | ||
| 2287 | case 79: | 2288 | case 79: |
| 2288 | #line 370 "chuck.y" /* yacc.c:1646 */ | 2289 | #line 371 "chuck.y" /* yacc.c:1651 */ |
| 2289 | { (yyval.exp) = (yyvsp[0].exp); } | 2290 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2290 | #line 2290 "chuck.tab.c" /* yacc.c:1646 */ | 2291 | #line 2292 "chuck.tab.c" /* yacc.c:1651 */ |
| 2291 | break; | 2292 | break; |
| 2292 | 2293 | ||
| 2293 | case 80: | 2294 | case 80: |
| 2294 | #line 372 "chuck.y" /* yacc.c:1646 */ | 2295 | #line 373 "chuck.y" /* yacc.c:1651 */ |
| 2295 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), (yyvsp[-1].ival), (yyvsp[0].exp), EM_lineNum ); } | 2296 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), (yyvsp[-1].ival), (yyvsp[0].exp), EM_lineNum ); } |
| 2296 | #line 2296 "chuck.tab.c" /* yacc.c:1646 */ | 2297 | #line 2298 "chuck.tab.c" /* yacc.c:1651 */ |
| 2297 | break; | 2298 | break; |
| 2298 | 2299 | ||
| 2299 | case 81: | 2300 | case 81: |
| 2300 | #line 376 "chuck.y" /* yacc.c:1646 */ | 2301 | #line 377 "chuck.y" /* yacc.c:1651 */ |
| 2301 | { (yyval.array_sub) = new_array_sub( (yyvsp[-1].exp), EM_lineNum ); } | 2302 | { (yyval.array_sub) = new_array_sub( (yyvsp[-1].exp), EM_lineNum ); } |
| 2302 | #line 2302 "chuck.tab.c" /* yacc.c:1646 */ | 2303 | #line 2304 "chuck.tab.c" /* yacc.c:1651 */ |
| 2303 | break; | 2304 | break; |
| 2304 | 2305 | ||
| 2305 | case 82: | 2306 | case 82: |
| 2306 | #line 378 "chuck.y" /* yacc.c:1646 */ | 2307 | #line 379 "chuck.y" /* yacc.c:1651 */ |
| 2307 | { (yyval.array_sub) = prepend_array_sub( (yyvsp[0].array_sub), (yyvsp[-2].exp), EM_lineNum ); } | 2308 | { (yyval.array_sub) = prepend_array_sub( (yyvsp[0].array_sub), (yyvsp[-2].exp), EM_lineNum ); } |
| 2308 | #line 2308 "chuck.tab.c" /* yacc.c:1646 */ | 2309 | #line 2310 "chuck.tab.c" /* yacc.c:1651 */ |
| 2309 | break; | 2310 | break; |
| 2310 | 2311 | ||
| 2311 | case 83: | 2312 | case 83: |
| 2312 | #line 382 "chuck.y" /* yacc.c:1646 */ | 2313 | #line 383 "chuck.y" /* yacc.c:1651 */ |
| 2313 | { (yyval.array_sub) = new_array_sub( NULL, EM_lineNum ); } | 2314 | { (yyval.array_sub) = new_array_sub( NULL, EM_lineNum ); } |
| 2314 | #line 2314 "chuck.tab.c" /* yacc.c:1646 */ | 2315 | #line 2316 "chuck.tab.c" /* yacc.c:1651 */ |
| 2315 | break; | 2316 | break; |
| 2316 | 2317 | ||
| 2317 | case 84: | 2318 | case 84: |
| 2318 | #line 383 "chuck.y" /* yacc.c:1646 */ | 2319 | #line 384 "chuck.y" /* yacc.c:1651 */ |
| 2319 | { (yyval.array_sub) = prepend_array_sub( (yyvsp[-2].array_sub), NULL, EM_lineNum ); } | 2320 | { (yyval.array_sub) = prepend_array_sub( (yyvsp[-2].array_sub), NULL, EM_lineNum ); } |
| 2320 | #line 2320 "chuck.tab.c" /* yacc.c:1646 */ | 2321 | #line 2322 "chuck.tab.c" /* yacc.c:1651 */ |
| 2321 | break; | 2322 | break; |
| 2322 | 2323 | ||
| 2323 | case 85: | 2324 | case 85: |
| 2324 | #line 387 "chuck.y" /* yacc.c:1646 */ | 2325 | #line 388 "chuck.y" /* yacc.c:1651 */ |
| 2325 | { (yyval.exp) = (yyvsp[0].exp); } | 2326 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2326 | #line 2326 "chuck.tab.c" /* yacc.c:1646 */ | 2327 | #line 2328 "chuck.tab.c" /* yacc.c:1651 */ |
| 2327 | break; | 2328 | break; |
| 2328 | 2329 | ||
| 2329 | case 86: | 2330 | case 86: |
| 2330 | #line 388 "chuck.y" /* yacc.c:1646 */ | 2331 | #line 389 "chuck.y" /* yacc.c:1651 */ |
| 2331 | { (yyval.exp) = new_exp_decl( (yyvsp[-1].type_decl), (yyvsp[0].var_decl_list), 0, EM_lineNum ); } | 2332 | { (yyval.exp) = new_exp_decl( (yyvsp[-1].type_decl), (yyvsp[0].var_decl_list), 0, EM_lineNum ); } |
| 2332 | #line 2332 "chuck.tab.c" /* yacc.c:1646 */ | 2333 | #line 2334 "chuck.tab.c" /* yacc.c:1651 */ |
| 2333 | break; | 2334 | break; |
| 2334 | 2335 | ||
| 2335 | case 87: | 2336 | case 87: |
| 2336 | #line 389 "chuck.y" /* yacc.c:1646 */ | 2337 | #line 390 "chuck.y" /* yacc.c:1651 */ |
| 2337 | { (yyval.exp) = new_exp_decl_external( (yyvsp[-1].type_decl), (yyvsp[0].var_decl_list), 0, EM_lineNum ); } | 2338 | { (yyval.exp) = new_exp_decl_external( (yyvsp[-1].type_decl), (yyvsp[0].var_decl_list), 0, EM_lineNum ); } |
| 2338 | #line 2338 "chuck.tab.c" /* yacc.c:1646 */ | 2339 | #line 2340 "chuck.tab.c" /* yacc.c:1651 */ |
| 2339 | break; | 2340 | break; |
| 2340 | 2341 | ||
| 2341 | case 88: | 2342 | case 88: |
| 2342 | #line 390 "chuck.y" /* yacc.c:1646 */ | 2343 | #line 391 "chuck.y" /* yacc.c:1651 */ |
| 2343 | { (yyval.exp) = new_exp_decl_global( (yyvsp[-1].type_decl), (yyvsp[0].var_decl_list), 0, EM_lineNum ); } | 2344 | { (yyval.exp) = new_exp_decl_global( (yyvsp[-1].type_decl), (yyvsp[0].var_decl_list), 0, EM_lineNum ); } |
| 2344 | #line 2344 "chuck.tab.c" /* yacc.c:1646 */ | 2345 | #line 2346 "chuck.tab.c" /* yacc.c:1651 */ |
| 2345 | break; | 2346 | break; |
| 2346 | 2347 | ||
| 2347 | case 89: | 2348 | case 89: |
| 2348 | #line 391 "chuck.y" /* yacc.c:1646 */ | 2349 | #line 392 "chuck.y" /* yacc.c:1651 */ |
| 2349 | { (yyval.exp) = new_exp_decl( (yyvsp[-1].type_decl), (yyvsp[0].var_decl_list), 1, EM_lineNum ); } | 2350 | { (yyval.exp) = new_exp_decl( (yyvsp[-1].type_decl), (yyvsp[0].var_decl_list), 1, EM_lineNum ); } |
| 2350 | #line 2350 "chuck.tab.c" /* yacc.c:1646 */ | 2351 | #line 2352 "chuck.tab.c" /* yacc.c:1651 */ |
| 2351 | break; | 2352 | break; |
| 2352 | 2353 | ||
| 2353 | case 90: | 2354 | case 90: |
| 2354 | #line 392 "chuck.y" /* yacc.c:1646 */ | 2355 | #line 393 "chuck.y" /* yacc.c:1651 */ |
| 2355 | { (yyval.exp) = new_exp_decl( NULL, (yyvsp[0].var_decl_list), 0, EM_lineNum ); } | 2356 | { (yyval.exp) = new_exp_decl( NULL, (yyvsp[0].var_decl_list), 0, EM_lineNum ); } |
| 2356 | #line 2356 "chuck.tab.c" /* yacc.c:1646 */ | 2357 | #line 2358 "chuck.tab.c" /* yacc.c:1651 */ |
| 2357 | break; | 2358 | break; |
| 2358 | 2359 | ||
| 2359 | case 91: | 2360 | case 91: |
| 2360 | #line 393 "chuck.y" /* yacc.c:1646 */ | 2361 | #line 394 "chuck.y" /* yacc.c:1651 */ |
| 2361 | { (yyval.exp) = new_exp_decl( NULL, (yyvsp[0].var_decl_list), 1, EM_lineNum ); } | 2362 | { (yyval.exp) = new_exp_decl( NULL, (yyvsp[0].var_decl_list), 1, EM_lineNum ); } |
| 2362 | #line 2362 "chuck.tab.c" /* yacc.c:1646 */ | 2363 | #line 2364 "chuck.tab.c" /* yacc.c:1651 */ |
| 2363 | break; | 2364 | break; |
| 2364 | 2365 | ||
| 2365 | case 92: | 2366 | case 92: |
| 2366 | #line 397 "chuck.y" /* yacc.c:1646 */ | 2367 | #line 398 "chuck.y" /* yacc.c:1651 */ |
| 2367 | { (yyval.var_decl_list) = new_var_decl_list( (yyvsp[0].var_decl), EM_lineNum ); } | 2368 | { (yyval.var_decl_list) = new_var_decl_list( (yyvsp[0].var_decl), EM_lineNum ); } |
| 2368 | #line 2368 "chuck.tab.c" /* yacc.c:1646 */ | 2369 | #line 2370 "chuck.tab.c" /* yacc.c:1651 */ |
| 2369 | break; | 2370 | break; |
| 2370 | 2371 | ||
| 2371 | case 93: | 2372 | case 93: |
| 2372 | #line 398 "chuck.y" /* yacc.c:1646 */ | 2373 | #line 399 "chuck.y" /* yacc.c:1651 */ |
| 2373 | { (yyval.var_decl_list) = prepend_var_decl_list( (yyvsp[-2].var_decl), (yyvsp[0].var_decl_list), EM_lineNum ); } | 2374 | { (yyval.var_decl_list) = prepend_var_decl_list( (yyvsp[-2].var_decl), (yyvsp[0].var_decl_list), EM_lineNum ); } |
| 2374 | #line 2374 "chuck.tab.c" /* yacc.c:1646 */ | 2375 | #line 2376 "chuck.tab.c" /* yacc.c:1651 */ |
| 2375 | break; | 2376 | break; |
| 2376 | 2377 | ||
| 2377 | case 94: | 2378 | case 94: |
| 2378 | #line 402 "chuck.y" /* yacc.c:1646 */ | 2379 | #line 403 "chuck.y" /* yacc.c:1651 */ |
| 2379 | { (yyval.var_decl) = new_var_decl( (yyvsp[0].sval), NULL, EM_lineNum ); } | 2380 | { (yyval.var_decl) = new_var_decl( (yyvsp[0].sval), NULL, EM_lineNum ); } |
| 2380 | #line 2380 "chuck.tab.c" /* yacc.c:1646 */ | 2381 | #line 2382 "chuck.tab.c" /* yacc.c:1651 */ |
| 2381 | break; | 2382 | break; |
| 2382 | 2383 | ||
| 2383 | case 95: | 2384 | case 95: |
| 2384 | #line 403 "chuck.y" /* yacc.c:1646 */ | 2385 | #line 404 "chuck.y" /* yacc.c:1651 */ |
| 2385 | { (yyval.var_decl) = new_var_decl( (yyvsp[-1].sval), (yyvsp[0].array_sub), EM_lineNum ); } | 2386 | { (yyval.var_decl) = new_var_decl( (yyvsp[-1].sval), (yyvsp[0].array_sub), EM_lineNum ); } |
| 2386 | #line 2386 "chuck.tab.c" /* yacc.c:1646 */ | 2387 | #line 2388 "chuck.tab.c" /* yacc.c:1651 */ |
| 2387 | break; | 2388 | break; |
| 2388 | 2389 | ||
| 2389 | case 96: | 2390 | case 96: |
| 2390 | #line 404 "chuck.y" /* yacc.c:1646 */ | 2391 | #line 405 "chuck.y" /* yacc.c:1651 */ |
| 2391 | { (yyval.var_decl) = new_var_decl( (yyvsp[-1].sval), (yyvsp[0].array_sub), EM_lineNum ); } | 2392 | { (yyval.var_decl) = new_var_decl( (yyvsp[-1].sval), (yyvsp[0].array_sub), EM_lineNum ); } |
| 2392 | #line 2392 "chuck.tab.c" /* yacc.c:1646 */ | 2393 | #line 2394 "chuck.tab.c" /* yacc.c:1651 */ |
| 2393 | break; | 2394 | break; |
| 2394 | 2395 | ||
| 2395 | case 97: | 2396 | case 97: |
| 2396 | #line 409 "chuck.y" /* yacc.c:1646 */ | 2397 | #line 410 "chuck.y" /* yacc.c:1651 */ |
| 2397 | { (yyval.complex_exp) = new_complex( (yyvsp[-1].exp), EM_lineNum ); } | 2398 | { (yyval.complex_exp) = new_complex( (yyvsp[-1].exp), EM_lineNum ); } |
| 2398 | #line 2398 "chuck.tab.c" /* yacc.c:1646 */ | 2399 | #line 2400 "chuck.tab.c" /* yacc.c:1651 */ |
| 2399 | break; | 2400 | break; |
| 2400 | 2401 | ||
| 2401 | case 98: | 2402 | case 98: |
| 2402 | #line 414 "chuck.y" /* yacc.c:1646 */ | 2403 | #line 415 "chuck.y" /* yacc.c:1651 */ |
| 2403 | { (yyval.polar_exp) = new_polar( (yyvsp[-1].exp), EM_lineNum ); } | 2404 | { (yyval.polar_exp) = new_polar( (yyvsp[-1].exp), EM_lineNum ); } |
| 2404 | #line 2404 "chuck.tab.c" /* yacc.c:1646 */ | 2405 | #line 2406 "chuck.tab.c" /* yacc.c:1651 */ |
| 2405 | break; | 2406 | break; |
| 2406 | 2407 | ||
| 2407 | case 99: | 2408 | case 99: |
| 2408 | #line 419 "chuck.y" /* yacc.c:1646 */ | 2409 | #line 420 "chuck.y" /* yacc.c:1651 */ |
| 2409 | { (yyval.vec_exp) = new_vec( (yyvsp[-1].exp), EM_lineNum ); } | 2410 | { (yyval.vec_exp) = new_vec( (yyvsp[-1].exp), EM_lineNum ); } |
| 2410 | #line 2410 "chuck.tab.c" /* yacc.c:1646 */ | 2411 | #line 2412 "chuck.tab.c" /* yacc.c:1651 */ |
| 2411 | break; | 2412 | break; |
| 2412 | 2413 | ||
| 2413 | case 100: | 2414 | case 100: |
| 2414 | #line 423 "chuck.y" /* yacc.c:1646 */ | 2415 | #line 424 "chuck.y" /* yacc.c:1651 */ |
| 2415 | { (yyval.ival) = ae_op_chuck; } | 2416 | { (yyval.ival) = ae_op_chuck; } |
| 2416 | #line 2416 "chuck.tab.c" /* yacc.c:1646 */ | 2417 | #line 2418 "chuck.tab.c" /* yacc.c:1651 */ |
| 2417 | break; | 2418 | break; |
| 2418 | 2419 | ||
| 2419 | case 101: | 2420 | case 101: |
| 2420 | #line 424 "chuck.y" /* yacc.c:1646 */ | 2421 | #line 425 "chuck.y" /* yacc.c:1651 */ |
| 2421 | { (yyval.ival) = ae_op_at_chuck; } | 2422 | { (yyval.ival) = ae_op_at_chuck; } |
| 2422 | #line 2422 "chuck.tab.c" /* yacc.c:1646 */ | 2423 | #line 2424 "chuck.tab.c" /* yacc.c:1651 */ |
| 2423 | break; | 2424 | break; |
| 2424 | 2425 | ||
| 2425 | case 102: | 2426 | case 102: |
| 2426 | #line 425 "chuck.y" /* yacc.c:1646 */ | 2427 | #line 426 "chuck.y" /* yacc.c:1651 */ |
| 2427 | { (yyval.ival) = ae_op_plus_chuck; } | 2428 | { (yyval.ival) = ae_op_plus_chuck; } |
| 2428 | #line 2428 "chuck.tab.c" /* yacc.c:1646 */ | 2429 | #line 2430 "chuck.tab.c" /* yacc.c:1651 */ |
| 2429 | break; | 2430 | break; |
| 2430 | 2431 | ||
| 2431 | case 103: | 2432 | case 103: |
| 2432 | #line 426 "chuck.y" /* yacc.c:1646 */ | 2433 | #line 427 "chuck.y" /* yacc.c:1651 */ |
| 2433 | { (yyval.ival) = ae_op_minus_chuck; } | 2434 | { (yyval.ival) = ae_op_minus_chuck; } |
| 2434 | #line 2434 "chuck.tab.c" /* yacc.c:1646 */ | 2435 | #line 2436 "chuck.tab.c" /* yacc.c:1651 */ |
| 2435 | break; | 2436 | break; |
| 2436 | 2437 | ||
| 2437 | case 104: | 2438 | case 104: |
| 2438 | #line 427 "chuck.y" /* yacc.c:1646 */ | 2439 | #line 428 "chuck.y" /* yacc.c:1651 */ |
| 2439 | { (yyval.ival) = ae_op_times_chuck; } | 2440 | { (yyval.ival) = ae_op_times_chuck; } |
| 2440 | #line 2440 "chuck.tab.c" /* yacc.c:1646 */ | 2441 | #line 2442 "chuck.tab.c" /* yacc.c:1651 */ |
| 2441 | break; | 2442 | break; |
| 2442 | 2443 | ||
| 2443 | case 105: | 2444 | case 105: |
| 2444 | #line 428 "chuck.y" /* yacc.c:1646 */ | 2445 | #line 429 "chuck.y" /* yacc.c:1651 */ |
| 2445 | { (yyval.ival) = ae_op_divide_chuck; } | 2446 | { (yyval.ival) = ae_op_divide_chuck; } |
| 2446 | #line 2446 "chuck.tab.c" /* yacc.c:1646 */ | 2447 | #line 2448 "chuck.tab.c" /* yacc.c:1651 */ |
| 2447 | break; | 2448 | break; |
| 2448 | 2449 | ||
| 2449 | case 106: | 2450 | case 106: |
| 2450 | #line 429 "chuck.y" /* yacc.c:1646 */ | 2451 | #line 430 "chuck.y" /* yacc.c:1651 */ |
| 2451 | { (yyval.ival) = ae_op_shift_right_chuck; } | 2452 | { (yyval.ival) = ae_op_shift_right_chuck; } |
| 2452 | #line 2452 "chuck.tab.c" /* yacc.c:1646 */ | 2453 | #line 2454 "chuck.tab.c" /* yacc.c:1651 */ |
| 2453 | break; | 2454 | break; |
| 2454 | 2455 | ||
| 2455 | case 107: | 2456 | case 107: |
| 2456 | #line 430 "chuck.y" /* yacc.c:1646 */ | 2457 | #line 431 "chuck.y" /* yacc.c:1651 */ |
| 2457 | { (yyval.ival) = ae_op_shift_left_chuck; } | 2458 | { (yyval.ival) = ae_op_shift_left_chuck; } |
| 2458 | #line 2458 "chuck.tab.c" /* yacc.c:1646 */ | 2459 | #line 2460 "chuck.tab.c" /* yacc.c:1651 */ |
| 2459 | break; | 2460 | break; |
| 2460 | 2461 | ||
| 2461 | case 108: | 2462 | case 108: |
| 2462 | #line 431 "chuck.y" /* yacc.c:1646 */ | 2463 | #line 432 "chuck.y" /* yacc.c:1651 */ |
| 2463 | { (yyval.ival) = ae_op_percent_chuck; } | 2464 | { (yyval.ival) = ae_op_percent_chuck; } |
| 2464 | #line 2464 "chuck.tab.c" /* yacc.c:1646 */ | 2465 | #line 2466 "chuck.tab.c" /* yacc.c:1651 */ |
| 2465 | break; | 2466 | break; |
| 2466 | 2467 | ||
| 2467 | case 109: | 2468 | case 109: |
| 2468 | #line 432 "chuck.y" /* yacc.c:1646 */ | 2469 | #line 433 "chuck.y" /* yacc.c:1651 */ |
| 2469 | { (yyval.ival) = ae_op_unchuck; } | 2470 | { (yyval.ival) = ae_op_unchuck; } |
| 2470 | #line 2470 "chuck.tab.c" /* yacc.c:1646 */ | 2471 | #line 2472 "chuck.tab.c" /* yacc.c:1651 */ |
| 2471 | break; | 2472 | break; |
| 2472 | 2473 | ||
| 2473 | case 110: | 2474 | case 110: |
| 2474 | #line 433 "chuck.y" /* yacc.c:1646 */ | 2475 | #line 434 "chuck.y" /* yacc.c:1651 */ |
| 2475 | { (yyval.ival) = ae_op_upchuck; } | 2476 | { (yyval.ival) = ae_op_upchuck; } |
| 2476 | #line 2476 "chuck.tab.c" /* yacc.c:1646 */ | 2477 | #line 2478 "chuck.tab.c" /* yacc.c:1651 */ |
| 2477 | break; | 2478 | break; |
| 2478 | 2479 | ||
| 2479 | case 111: | 2480 | case 111: |
| 2480 | #line 434 "chuck.y" /* yacc.c:1646 */ | 2481 | #line 435 "chuck.y" /* yacc.c:1651 */ |
| 2481 | { (yyval.ival) = ae_op_s_and_chuck; } | 2482 | { (yyval.ival) = ae_op_s_and_chuck; } |
| 2482 | #line 2482 "chuck.tab.c" /* yacc.c:1646 */ | 2483 | #line 2484 "chuck.tab.c" /* yacc.c:1651 */ |
| 2483 | break; | 2484 | break; |
| 2484 | 2485 | ||
| 2485 | case 112: | 2486 | case 112: |
| 2486 | #line 435 "chuck.y" /* yacc.c:1646 */ | 2487 | #line 436 "chuck.y" /* yacc.c:1651 */ |
| 2487 | { (yyval.ival) = ae_op_s_or_chuck; } | 2488 | { (yyval.ival) = ae_op_s_or_chuck; } |
| 2488 | #line 2488 "chuck.tab.c" /* yacc.c:1646 */ | 2489 | #line 2490 "chuck.tab.c" /* yacc.c:1651 */ |
| 2489 | break; | 2490 | break; |
| 2490 | 2491 | ||
| 2491 | case 113: | 2492 | case 113: |
| 2492 | #line 436 "chuck.y" /* yacc.c:1646 */ | 2493 | #line 437 "chuck.y" /* yacc.c:1651 */ |
| 2493 | { (yyval.ival) = ae_op_s_xor_chuck; } | 2494 | { (yyval.ival) = ae_op_s_xor_chuck; } |
| 2494 | #line 2494 "chuck.tab.c" /* yacc.c:1646 */ | 2495 | #line 2496 "chuck.tab.c" /* yacc.c:1651 */ |
| 2495 | break; | 2496 | break; |
| 2496 | 2497 | ||
| 2497 | case 114: | 2498 | case 114: |
| 2498 | #line 440 "chuck.y" /* yacc.c:1646 */ | 2499 | #line 441 "chuck.y" /* yacc.c:1651 */ |
| 2499 | { (yyval.ival) = ae_op_arrow_left; } | 2500 | { (yyval.ival) = ae_op_arrow_left; } |
| 2500 | #line 2500 "chuck.tab.c" /* yacc.c:1646 */ | 2501 | #line 2502 "chuck.tab.c" /* yacc.c:1651 */ |
| 2501 | break; | 2502 | break; |
| 2502 | 2503 | ||
| 2503 | case 115: | 2504 | case 115: |
| 2504 | #line 441 "chuck.y" /* yacc.c:1646 */ | 2505 | #line 442 "chuck.y" /* yacc.c:1651 */ |
| 2505 | { (yyval.ival) = ae_op_arrow_right; } | 2506 | { (yyval.ival) = ae_op_arrow_right; } |
| 2506 | #line 2506 "chuck.tab.c" /* yacc.c:1646 */ | 2507 | #line 2508 "chuck.tab.c" /* yacc.c:1651 */ |
| 2507 | break; | 2508 | break; |
| 2508 | 2509 | ||
| 2509 | case 116: | 2510 | case 116: |
| 2510 | #line 445 "chuck.y" /* yacc.c:1646 */ | 2511 | #line 446 "chuck.y" /* yacc.c:1651 */ |
| 2511 | { (yyval.exp) = (yyvsp[0].exp); } | 2512 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2512 | #line 2512 "chuck.tab.c" /* yacc.c:1646 */ | 2513 | #line 2514 "chuck.tab.c" /* yacc.c:1651 */ |
| 2513 | break; | 2514 | break; |
| 2514 | 2515 | ||
| 2515 | case 117: | 2516 | case 117: |
| 2516 | #line 447 "chuck.y" /* yacc.c:1646 */ | 2517 | #line 448 "chuck.y" /* yacc.c:1651 */ |
| 2517 | { (yyval.exp) = new_exp_from_if( (yyvsp[-4].exp), (yyvsp[-2].exp), (yyvsp[0].exp), EM_lineNum ); } | 2518 | { (yyval.exp) = new_exp_from_if( (yyvsp[-4].exp), (yyvsp[-2].exp), (yyvsp[0].exp), EM_lineNum ); } |
| 2518 | #line 2518 "chuck.tab.c" /* yacc.c:1646 */ | 2519 | #line 2520 "chuck.tab.c" /* yacc.c:1651 */ |
| 2519 | break; | 2520 | break; |
| 2520 | 2521 | ||
| 2521 | case 118: | 2522 | case 118: |
| 2522 | #line 451 "chuck.y" /* yacc.c:1646 */ | 2523 | #line 452 "chuck.y" /* yacc.c:1651 */ |
| 2523 | { (yyval.exp) = (yyvsp[0].exp); } | 2524 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2524 | #line 2524 "chuck.tab.c" /* yacc.c:1646 */ | 2525 | #line 2526 "chuck.tab.c" /* yacc.c:1651 */ |
| 2525 | break; | 2526 | break; |
| 2526 | 2527 | ||
| 2527 | case 119: | 2528 | case 119: |
| 2528 | #line 453 "chuck.y" /* yacc.c:1646 */ | 2529 | #line 454 "chuck.y" /* yacc.c:1651 */ |
| 2529 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_or, (yyvsp[0].exp), EM_lineNum ); } | 2530 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_or, (yyvsp[0].exp), EM_lineNum ); } |
| 2530 | #line 2530 "chuck.tab.c" /* yacc.c:1646 */ | 2531 | #line 2532 "chuck.tab.c" /* yacc.c:1651 */ |
| 2531 | break; | 2532 | break; |
| 2532 | 2533 | ||
| 2533 | case 120: | 2534 | case 120: |
| 2534 | #line 457 "chuck.y" /* yacc.c:1646 */ | 2535 | #line 458 "chuck.y" /* yacc.c:1651 */ |
| 2535 | { (yyval.exp) = (yyvsp[0].exp); } | 2536 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2536 | #line 2536 "chuck.tab.c" /* yacc.c:1646 */ | 2537 | #line 2538 "chuck.tab.c" /* yacc.c:1651 */ |
| 2537 | break; | 2538 | break; |
| 2538 | 2539 | ||
| 2539 | case 121: | 2540 | case 121: |
| 2540 | #line 459 "chuck.y" /* yacc.c:1646 */ | 2541 | #line 460 "chuck.y" /* yacc.c:1651 */ |
| 2541 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_and, (yyvsp[0].exp), EM_lineNum ); } | 2542 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_and, (yyvsp[0].exp), EM_lineNum ); } |
| 2542 | #line 2542 "chuck.tab.c" /* yacc.c:1646 */ | 2543 | #line 2544 "chuck.tab.c" /* yacc.c:1651 */ |
| 2543 | break; | 2544 | break; |
| 2544 | 2545 | ||
| 2545 | case 122: | 2546 | case 122: |
| 2546 | #line 463 "chuck.y" /* yacc.c:1646 */ | 2547 | #line 464 "chuck.y" /* yacc.c:1651 */ |
| 2547 | { (yyval.exp) = (yyvsp[0].exp); } | 2548 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2548 | #line 2548 "chuck.tab.c" /* yacc.c:1646 */ | 2549 | #line 2550 "chuck.tab.c" /* yacc.c:1651 */ |
| 2549 | break; | 2550 | break; |
| 2550 | 2551 | ||
| 2551 | case 123: | 2552 | case 123: |
| 2552 | #line 465 "chuck.y" /* yacc.c:1646 */ | 2553 | #line 466 "chuck.y" /* yacc.c:1651 */ |
| 2553 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_s_or, (yyvsp[0].exp), EM_lineNum ); } | 2554 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_s_or, (yyvsp[0].exp), EM_lineNum ); } |
| 2554 | #line 2554 "chuck.tab.c" /* yacc.c:1646 */ | 2555 | #line 2556 "chuck.tab.c" /* yacc.c:1651 */ |
| 2555 | break; | 2556 | break; |
| 2556 | 2557 | ||
| 2557 | case 124: | 2558 | case 124: |
| 2558 | #line 469 "chuck.y" /* yacc.c:1646 */ | 2559 | #line 470 "chuck.y" /* yacc.c:1651 */ |
| 2559 | { (yyval.exp) = (yyvsp[0].exp); } | 2560 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2560 | #line 2560 "chuck.tab.c" /* yacc.c:1646 */ | 2561 | #line 2562 "chuck.tab.c" /* yacc.c:1651 */ |
| 2561 | break; | 2562 | break; |
| 2562 | 2563 | ||
| 2563 | case 125: | 2564 | case 125: |
| 2564 | #line 471 "chuck.y" /* yacc.c:1646 */ | 2565 | #line 472 "chuck.y" /* yacc.c:1651 */ |
| 2565 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_s_xor, (yyvsp[0].exp), EM_lineNum ); } | 2566 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_s_xor, (yyvsp[0].exp), EM_lineNum ); } |
| 2566 | #line 2566 "chuck.tab.c" /* yacc.c:1646 */ | 2567 | #line 2568 "chuck.tab.c" /* yacc.c:1651 */ |
| 2567 | break; | 2568 | break; |
| 2568 | 2569 | ||
| 2569 | case 126: | 2570 | case 126: |
| 2570 | #line 475 "chuck.y" /* yacc.c:1646 */ | 2571 | #line 476 "chuck.y" /* yacc.c:1651 */ |
| 2571 | { (yyval.exp) = (yyvsp[0].exp); } | 2572 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2572 | #line 2572 "chuck.tab.c" /* yacc.c:1646 */ | 2573 | #line 2574 "chuck.tab.c" /* yacc.c:1651 */ |
| 2573 | break; | 2574 | break; |
| 2574 | 2575 | ||
| 2575 | case 127: | 2576 | case 127: |
| 2576 | #line 477 "chuck.y" /* yacc.c:1646 */ | 2577 | #line 478 "chuck.y" /* yacc.c:1651 */ |
| 2577 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_s_and, (yyvsp[0].exp), EM_lineNum ); } | 2578 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_s_and, (yyvsp[0].exp), EM_lineNum ); } |
| 2578 | #line 2578 "chuck.tab.c" /* yacc.c:1646 */ | 2579 | #line 2580 "chuck.tab.c" /* yacc.c:1651 */ |
| 2579 | break; | 2580 | break; |
| 2580 | 2581 | ||
| 2581 | case 128: | 2582 | case 128: |
| 2582 | #line 481 "chuck.y" /* yacc.c:1646 */ | 2583 | #line 482 "chuck.y" /* yacc.c:1651 */ |
| 2583 | { (yyval.exp) = (yyvsp[0].exp); } | 2584 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2584 | #line 2584 "chuck.tab.c" /* yacc.c:1646 */ | 2585 | #line 2586 "chuck.tab.c" /* yacc.c:1651 */ |
| 2585 | break; | 2586 | break; |
| 2586 | 2587 | ||
| 2587 | case 129: | 2588 | case 129: |
| 2588 | #line 483 "chuck.y" /* yacc.c:1646 */ | 2589 | #line 484 "chuck.y" /* yacc.c:1651 */ |
| 2589 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_eq, (yyvsp[0].exp), EM_lineNum ); } | 2590 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_eq, (yyvsp[0].exp), EM_lineNum ); } |
| 2590 | #line 2590 "chuck.tab.c" /* yacc.c:1646 */ | 2591 | #line 2592 "chuck.tab.c" /* yacc.c:1651 */ |
| 2591 | break; | 2592 | break; |
| 2592 | 2593 | ||
| 2593 | case 130: | 2594 | case 130: |
| 2594 | #line 485 "chuck.y" /* yacc.c:1646 */ | 2595 | #line 486 "chuck.y" /* yacc.c:1651 */ |
| 2595 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_neq, (yyvsp[0].exp), EM_lineNum ); } | 2596 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_neq, (yyvsp[0].exp), EM_lineNum ); } |
| 2596 | #line 2596 "chuck.tab.c" /* yacc.c:1646 */ | 2597 | #line 2598 "chuck.tab.c" /* yacc.c:1651 */ |
| 2597 | break; | 2598 | break; |
| 2598 | 2599 | ||
| 2599 | case 131: | 2600 | case 131: |
| 2600 | #line 489 "chuck.y" /* yacc.c:1646 */ | 2601 | #line 490 "chuck.y" /* yacc.c:1651 */ |
| 2601 | { (yyval.exp) = (yyvsp[0].exp); } | 2602 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2602 | #line 2602 "chuck.tab.c" /* yacc.c:1646 */ | 2603 | #line 2604 "chuck.tab.c" /* yacc.c:1651 */ |
| 2603 | break; | 2604 | break; |
| 2604 | 2605 | ||
| 2605 | case 132: | 2606 | case 132: |
| 2606 | #line 491 "chuck.y" /* yacc.c:1646 */ | 2607 | #line 492 "chuck.y" /* yacc.c:1651 */ |
| 2607 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_lt, (yyvsp[0].exp), EM_lineNum ); } | 2608 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_lt, (yyvsp[0].exp), EM_lineNum ); } |
| 2608 | #line 2608 "chuck.tab.c" /* yacc.c:1646 */ | 2609 | #line 2610 "chuck.tab.c" /* yacc.c:1651 */ |
| 2609 | break; | 2610 | break; |
| 2610 | 2611 | ||
| 2611 | case 133: | 2612 | case 133: |
| 2612 | #line 493 "chuck.y" /* yacc.c:1646 */ | 2613 | #line 494 "chuck.y" /* yacc.c:1651 */ |
| 2613 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_gt, (yyvsp[0].exp), EM_lineNum ); } | 2614 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_gt, (yyvsp[0].exp), EM_lineNum ); } |
| 2614 | #line 2614 "chuck.tab.c" /* yacc.c:1646 */ | 2615 | #line 2616 "chuck.tab.c" /* yacc.c:1651 */ |
| 2615 | break; | 2616 | break; |
| 2616 | 2617 | ||
| 2617 | case 134: | 2618 | case 134: |
| 2618 | #line 495 "chuck.y" /* yacc.c:1646 */ | 2619 | #line 496 "chuck.y" /* yacc.c:1651 */ |
| 2619 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_le, (yyvsp[0].exp), EM_lineNum ); } | 2620 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_le, (yyvsp[0].exp), EM_lineNum ); } |
| 2620 | #line 2620 "chuck.tab.c" /* yacc.c:1646 */ | 2621 | #line 2622 "chuck.tab.c" /* yacc.c:1651 */ |
| 2621 | break; | 2622 | break; |
| 2622 | 2623 | ||
| 2623 | case 135: | 2624 | case 135: |
| 2624 | #line 497 "chuck.y" /* yacc.c:1646 */ | 2625 | #line 498 "chuck.y" /* yacc.c:1651 */ |
| 2625 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_ge, (yyvsp[0].exp), EM_lineNum ); } | 2626 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_ge, (yyvsp[0].exp), EM_lineNum ); } |
| 2626 | #line 2626 "chuck.tab.c" /* yacc.c:1646 */ | 2627 | #line 2628 "chuck.tab.c" /* yacc.c:1651 */ |
| 2627 | break; | 2628 | break; |
| 2628 | 2629 | ||
| 2629 | case 136: | 2630 | case 136: |
| 2630 | #line 501 "chuck.y" /* yacc.c:1646 */ | 2631 | #line 502 "chuck.y" /* yacc.c:1651 */ |
| 2631 | { (yyval.exp) = (yyvsp[0].exp); } | 2632 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2632 | #line 2632 "chuck.tab.c" /* yacc.c:1646 */ | 2633 | #line 2634 "chuck.tab.c" /* yacc.c:1651 */ |
| 2633 | break; | 2634 | break; |
| 2634 | 2635 | ||
| 2635 | case 137: | 2636 | case 137: |
| 2636 | #line 503 "chuck.y" /* yacc.c:1646 */ | 2637 | #line 504 "chuck.y" /* yacc.c:1651 */ |
| 2637 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_shift_left, (yyvsp[0].exp), EM_lineNum ); } | 2638 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_shift_left, (yyvsp[0].exp), EM_lineNum ); } |
| 2638 | #line 2638 "chuck.tab.c" /* yacc.c:1646 */ | 2639 | #line 2640 "chuck.tab.c" /* yacc.c:1651 */ |
| 2639 | break; | 2640 | break; |
| 2640 | 2641 | ||
| 2641 | case 138: | 2642 | case 138: |
| 2642 | #line 505 "chuck.y" /* yacc.c:1646 */ | 2643 | #line 506 "chuck.y" /* yacc.c:1651 */ |
| 2643 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_shift_right, (yyvsp[0].exp), EM_lineNum ); } | 2644 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_shift_right, (yyvsp[0].exp), EM_lineNum ); } |
| 2644 | #line 2644 "chuck.tab.c" /* yacc.c:1646 */ | 2645 | #line 2646 "chuck.tab.c" /* yacc.c:1651 */ |
| 2645 | break; | 2646 | break; |
| 2646 | 2647 | ||
| 2647 | case 139: | 2648 | case 139: |
| 2648 | #line 509 "chuck.y" /* yacc.c:1646 */ | 2649 | #line 510 "chuck.y" /* yacc.c:1651 */ |
| 2649 | { (yyval.exp) = (yyvsp[0].exp); } | 2650 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2650 | #line 2650 "chuck.tab.c" /* yacc.c:1646 */ | 2651 | #line 2652 "chuck.tab.c" /* yacc.c:1651 */ |
| 2651 | break; | 2652 | break; |
| 2652 | 2653 | ||
| 2653 | case 140: | 2654 | case 140: |
| 2654 | #line 511 "chuck.y" /* yacc.c:1646 */ | 2655 | #line 512 "chuck.y" /* yacc.c:1651 */ |
| 2655 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_plus, (yyvsp[0].exp), EM_lineNum ); } | 2656 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_plus, (yyvsp[0].exp), EM_lineNum ); } |
| 2656 | #line 2656 "chuck.tab.c" /* yacc.c:1646 */ | 2657 | #line 2658 "chuck.tab.c" /* yacc.c:1651 */ |
| 2657 | break; | 2658 | break; |
| 2658 | 2659 | ||
| 2659 | case 141: | 2660 | case 141: |
| 2660 | #line 513 "chuck.y" /* yacc.c:1646 */ | 2661 | #line 514 "chuck.y" /* yacc.c:1651 */ |
| 2661 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_minus, (yyvsp[0].exp), EM_lineNum ); } | 2662 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_minus, (yyvsp[0].exp), EM_lineNum ); } |
| 2662 | #line 2662 "chuck.tab.c" /* yacc.c:1646 */ | 2663 | #line 2664 "chuck.tab.c" /* yacc.c:1651 */ |
| 2663 | break; | 2664 | break; |
| 2664 | 2665 | ||
| 2665 | case 142: | 2666 | case 142: |
| 2666 | #line 517 "chuck.y" /* yacc.c:1646 */ | 2667 | #line 518 "chuck.y" /* yacc.c:1651 */ |
| 2667 | { (yyval.exp) = (yyvsp[0].exp); } | 2668 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2668 | #line 2668 "chuck.tab.c" /* yacc.c:1646 */ | 2669 | #line 2670 "chuck.tab.c" /* yacc.c:1651 */ |
| 2669 | break; | 2670 | break; |
| 2670 | 2671 | ||
| 2671 | case 143: | 2672 | case 143: |
| 2672 | #line 519 "chuck.y" /* yacc.c:1646 */ | 2673 | #line 520 "chuck.y" /* yacc.c:1651 */ |
| 2673 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_times, (yyvsp[0].exp), EM_lineNum ); } | 2674 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_times, (yyvsp[0].exp), EM_lineNum ); } |
| 2674 | #line 2674 "chuck.tab.c" /* yacc.c:1646 */ | 2675 | #line 2676 "chuck.tab.c" /* yacc.c:1651 */ |
| 2675 | break; | 2676 | break; |
| 2676 | 2677 | ||
| 2677 | case 144: | 2678 | case 144: |
| 2678 | #line 521 "chuck.y" /* yacc.c:1646 */ | 2679 | #line 522 "chuck.y" /* yacc.c:1651 */ |
| 2679 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_divide, (yyvsp[0].exp), EM_lineNum ); } | 2680 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_divide, (yyvsp[0].exp), EM_lineNum ); } |
| 2680 | #line 2680 "chuck.tab.c" /* yacc.c:1646 */ | 2681 | #line 2682 "chuck.tab.c" /* yacc.c:1651 */ |
| 2681 | break; | 2682 | break; |
| 2682 | 2683 | ||
| 2683 | case 145: | 2684 | case 145: |
| 2684 | #line 523 "chuck.y" /* yacc.c:1646 */ | 2685 | #line 524 "chuck.y" /* yacc.c:1651 */ |
| 2685 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_percent, (yyvsp[0].exp), EM_lineNum ); } | 2686 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_percent, (yyvsp[0].exp), EM_lineNum ); } |
| 2686 | #line 2686 "chuck.tab.c" /* yacc.c:1646 */ | 2687 | #line 2688 "chuck.tab.c" /* yacc.c:1651 */ |
| 2687 | break; | 2688 | break; |
| 2688 | 2689 | ||
| 2689 | case 146: | 2690 | case 146: |
| 2690 | #line 527 "chuck.y" /* yacc.c:1646 */ | 2691 | #line 528 "chuck.y" /* yacc.c:1651 */ |
| 2691 | { (yyval.exp) = (yyvsp[0].exp); } | 2692 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2692 | #line 2692 "chuck.tab.c" /* yacc.c:1646 */ | 2693 | #line 2694 "chuck.tab.c" /* yacc.c:1651 */ |
| 2693 | break; | 2694 | break; |
| 2694 | 2695 | ||
| 2695 | case 147: | 2696 | case 147: |
| 2696 | #line 529 "chuck.y" /* yacc.c:1646 */ | 2697 | #line 530 "chuck.y" /* yacc.c:1651 */ |
| 2697 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_tilda, (yyvsp[0].exp), EM_lineNum ); } | 2698 | { (yyval.exp) = new_exp_from_binary( (yyvsp[-2].exp), ae_op_tilda, (yyvsp[0].exp), EM_lineNum ); } |
| 2698 | #line 2698 "chuck.tab.c" /* yacc.c:1646 */ | 2699 | #line 2700 "chuck.tab.c" /* yacc.c:1651 */ |
| 2699 | break; | 2700 | break; |
| 2700 | 2701 | ||
| 2701 | case 148: | 2702 | case 148: |
| 2702 | #line 533 "chuck.y" /* yacc.c:1646 */ | 2703 | #line 534 "chuck.y" /* yacc.c:1651 */ |
| 2703 | { (yyval.exp) = (yyvsp[0].exp); } | 2704 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2704 | #line 2704 "chuck.tab.c" /* yacc.c:1646 */ | 2705 | #line 2706 "chuck.tab.c" /* yacc.c:1651 */ |
| 2705 | break; | 2706 | break; |
| 2706 | 2707 | ||
| 2707 | case 149: | 2708 | case 149: |
| 2708 | #line 535 "chuck.y" /* yacc.c:1646 */ | 2709 | #line 536 "chuck.y" /* yacc.c:1651 */ |
| 2709 | { (yyval.exp) = new_exp_from_cast( (yyvsp[0].type_decl), (yyvsp[-2].exp), EM_lineNum ); } | 2710 | { (yyval.exp) = new_exp_from_cast( (yyvsp[0].type_decl), (yyvsp[-2].exp), EM_lineNum ); } |
| 2710 | #line 2710 "chuck.tab.c" /* yacc.c:1646 */ | 2711 | #line 2712 "chuck.tab.c" /* yacc.c:1651 */ |
| 2711 | break; | 2712 | break; |
| 2712 | 2713 | ||
| 2713 | case 150: | 2714 | case 150: |
| 2714 | #line 539 "chuck.y" /* yacc.c:1646 */ | 2715 | #line 540 "chuck.y" /* yacc.c:1651 */ |
| 2715 | { (yyval.exp) = (yyvsp[0].exp); } | 2716 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2716 | #line 2716 "chuck.tab.c" /* yacc.c:1646 */ | 2717 | #line 2718 "chuck.tab.c" /* yacc.c:1651 */ |
| 2717 | break; | 2718 | break; |
| 2718 | 2719 | ||
| 2719 | case 151: | 2720 | case 151: |
| 2720 | #line 541 "chuck.y" /* yacc.c:1646 */ | 2721 | #line 542 "chuck.y" /* yacc.c:1651 */ |
| 2721 | { (yyval.exp) = new_exp_from_unary( ae_op_plusplus, (yyvsp[0].exp), EM_lineNum ); } | 2722 | { (yyval.exp) = new_exp_from_unary( ae_op_plusplus, (yyvsp[0].exp), EM_lineNum ); } |
| 2722 | #line 2722 "chuck.tab.c" /* yacc.c:1646 */ | 2723 | #line 2724 "chuck.tab.c" /* yacc.c:1651 */ |
| 2723 | break; | 2724 | break; |
| 2724 | 2725 | ||
| 2725 | case 152: | 2726 | case 152: |
| 2726 | #line 543 "chuck.y" /* yacc.c:1646 */ | 2727 | #line 544 "chuck.y" /* yacc.c:1651 */ |
| 2727 | { (yyval.exp) = new_exp_from_unary( ae_op_minusminus, (yyvsp[0].exp), EM_lineNum ); } | 2728 | { (yyval.exp) = new_exp_from_unary( ae_op_minusminus, (yyvsp[0].exp), EM_lineNum ); } |
| 2728 | #line 2728 "chuck.tab.c" /* yacc.c:1646 */ | 2729 | #line 2730 "chuck.tab.c" /* yacc.c:1651 */ |
| 2729 | break; | 2730 | break; |
| 2730 | 2731 | ||
| 2731 | case 153: | 2732 | case 153: |
| 2732 | #line 545 "chuck.y" /* yacc.c:1646 */ | 2733 | #line 546 "chuck.y" /* yacc.c:1651 */ |
| 2733 | { (yyval.exp) = new_exp_from_unary( (yyvsp[-1].ival), (yyvsp[0].exp), EM_lineNum ); } | 2734 | { (yyval.exp) = new_exp_from_unary( (yyvsp[-1].ival), (yyvsp[0].exp), EM_lineNum ); } |
| 2734 | #line 2734 "chuck.tab.c" /* yacc.c:1646 */ | 2735 | #line 2736 "chuck.tab.c" /* yacc.c:1651 */ |
| 2735 | break; | 2736 | break; |
| 2736 | 2737 | ||
| 2737 | case 154: | 2738 | case 154: |
| 2738 | #line 547 "chuck.y" /* yacc.c:1646 */ | 2739 | #line 548 "chuck.y" /* yacc.c:1651 */ |
| 2739 | { (yyval.exp) = new_exp_from_unary( ae_op_typeof, (yyvsp[0].exp), EM_lineNum ); } | 2740 | { (yyval.exp) = new_exp_from_unary( ae_op_typeof, (yyvsp[0].exp), EM_lineNum ); } |
| 2740 | #line 2740 "chuck.tab.c" /* yacc.c:1646 */ | 2741 | #line 2742 "chuck.tab.c" /* yacc.c:1651 */ |
| 2741 | break; | 2742 | break; |
| 2742 | 2743 | ||
| 2743 | case 155: | 2744 | case 155: |
| 2744 | #line 549 "chuck.y" /* yacc.c:1646 */ | 2745 | #line 550 "chuck.y" /* yacc.c:1651 */ |
| 2745 | { (yyval.exp) = new_exp_from_unary( ae_op_sizeof, (yyvsp[0].exp), EM_lineNum ); } | 2746 | { (yyval.exp) = new_exp_from_unary( ae_op_sizeof, (yyvsp[0].exp), EM_lineNum ); } |
| 2746 | #line 2746 "chuck.tab.c" /* yacc.c:1646 */ | 2747 | #line 2748 "chuck.tab.c" /* yacc.c:1651 */ |
| 2747 | break; | 2748 | break; |
| 2748 | 2749 | ||
| 2749 | case 156: | 2750 | case 156: |
| 2750 | #line 551 "chuck.y" /* yacc.c:1646 */ | 2751 | #line 552 "chuck.y" /* yacc.c:1651 */ |
| 2751 | { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[0].type_decl), NULL, EM_lineNum ); } | 2752 | { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[0].type_decl), NULL, EM_lineNum ); } |
| 2752 | #line 2752 "chuck.tab.c" /* yacc.c:1646 */ | 2753 | #line 2754 "chuck.tab.c" /* yacc.c:1651 */ |
| 2753 | break; | 2754 | break; |
| 2754 | 2755 | ||
| 2755 | case 157: | 2756 | case 157: |
| 2756 | #line 553 "chuck.y" /* yacc.c:1646 */ | 2757 | #line 554 "chuck.y" /* yacc.c:1651 */ |
| 2757 | { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[-1].type_decl), (yyvsp[0].array_sub), EM_lineNum ); } | 2758 | { (yyval.exp) = new_exp_from_unary2( ae_op_new, (yyvsp[-1].type_decl), (yyvsp[0].array_sub), EM_lineNum ); } |
| 2758 | #line 2758 "chuck.tab.c" /* yacc.c:1646 */ | 2759 | #line 2760 "chuck.tab.c" /* yacc.c:1651 */ |
| 2759 | break; | 2760 | break; |
| 2760 | 2761 | ||
| 2761 | case 158: | 2762 | case 158: |
| 2762 | #line 559 "chuck.y" /* yacc.c:1646 */ | 2763 | #line 560 "chuck.y" /* yacc.c:1651 */ |
| 2763 | { (yyval.ival) = ae_op_plus; } | 2764 | { (yyval.ival) = ae_op_plus; } |
| 2764 | #line 2764 "chuck.tab.c" /* yacc.c:1646 */ | 2765 | #line 2766 "chuck.tab.c" /* yacc.c:1651 */ |
| 2765 | break; | 2766 | break; |
| 2766 | 2767 | ||
| 2767 | case 159: | 2768 | case 159: |
| 2768 | #line 560 "chuck.y" /* yacc.c:1646 */ | 2769 | #line 561 "chuck.y" /* yacc.c:1651 */ |
| 2769 | { (yyval.ival) = ae_op_minus; } | 2770 | { (yyval.ival) = ae_op_minus; } |
| 2770 | #line 2770 "chuck.tab.c" /* yacc.c:1646 */ | 2771 | #line 2772 "chuck.tab.c" /* yacc.c:1651 */ |
| 2771 | break; | 2772 | break; |
| 2772 | 2773 | ||
| 2773 | case 160: | 2774 | case 160: |
| 2774 | #line 561 "chuck.y" /* yacc.c:1646 */ | 2775 | #line 562 "chuck.y" /* yacc.c:1651 */ |
| 2775 | { (yyval.ival) = ae_op_tilda; } | 2776 | { (yyval.ival) = ae_op_tilda; } |
| 2776 | #line 2776 "chuck.tab.c" /* yacc.c:1646 */ | 2777 | #line 2778 "chuck.tab.c" /* yacc.c:1651 */ |
| 2777 | break; | 2778 | break; |
| 2778 | 2779 | ||
| 2779 | case 161: | 2780 | case 161: |
| 2780 | #line 562 "chuck.y" /* yacc.c:1646 */ | 2781 | #line 563 "chuck.y" /* yacc.c:1651 */ |
| 2781 | { (yyval.ival) = ae_op_exclamation; } | 2782 | { (yyval.ival) = ae_op_exclamation; } |
| 2782 | #line 2782 "chuck.tab.c" /* yacc.c:1646 */ | 2783 | #line 2784 "chuck.tab.c" /* yacc.c:1651 */ |
| 2783 | break; | 2784 | break; |
| 2784 | 2785 | ||
| 2785 | case 162: | 2786 | case 162: |
| 2786 | #line 563 "chuck.y" /* yacc.c:1646 */ | 2787 | #line 564 "chuck.y" /* yacc.c:1651 */ |
| 2787 | { (yyval.ival) = ae_op_times; } | 2788 | { (yyval.ival) = ae_op_times; } |
| 2788 | #line 2788 "chuck.tab.c" /* yacc.c:1646 */ | 2789 | #line 2790 "chuck.tab.c" /* yacc.c:1651 */ |
| 2789 | break; | 2790 | break; |
| 2790 | 2791 | ||
| 2791 | case 163: | 2792 | case 163: |
| 2792 | #line 564 "chuck.y" /* yacc.c:1646 */ | 2793 | #line 565 "chuck.y" /* yacc.c:1651 */ |
| 2793 | { (yyval.ival) = ae_op_spork; } | 2794 | { (yyval.ival) = ae_op_spork; } |
| 2794 | #line 2794 "chuck.tab.c" /* yacc.c:1646 */ | 2795 | #line 2796 "chuck.tab.c" /* yacc.c:1651 */ |
| 2795 | break; | 2796 | break; |
| 2796 | 2797 | ||
| 2797 | case 165: | 2798 | case 165: |
| 2798 | #line 571 "chuck.y" /* yacc.c:1646 */ | 2799 | #line 572 "chuck.y" /* yacc.c:1651 */ |
| 2799 | { (yyval.exp) = new_exp_from_dur( (yyvsp[-2].exp), (yyvsp[0].exp), EM_lineNum ); } | 2800 | { (yyval.exp) = new_exp_from_dur( (yyvsp[-2].exp), (yyvsp[0].exp), EM_lineNum ); } |
| 2800 | #line 2800 "chuck.tab.c" /* yacc.c:1646 */ | 2801 | #line 2802 "chuck.tab.c" /* yacc.c:1651 */ |
| 2801 | break; | 2802 | break; |
| 2802 | 2803 | ||
| 2803 | case 166: | 2804 | case 166: |
| 2804 | #line 575 "chuck.y" /* yacc.c:1646 */ | 2805 | #line 576 "chuck.y" /* yacc.c:1651 */ |
| 2805 | { (yyval.exp) = (yyvsp[0].exp); } | 2806 | { (yyval.exp) = (yyvsp[0].exp); } |
| 2806 | #line 2806 "chuck.tab.c" /* yacc.c:1646 */ | 2807 | #line 2808 "chuck.tab.c" /* yacc.c:1651 */ |
| 2807 | break; | 2808 | break; |
| 2808 | 2809 | ||
| 2809 | case 167: | 2810 | case 167: |
| 2810 | #line 577 "chuck.y" /* yacc.c:1646 */ | 2811 | #line 578 "chuck.y" /* yacc.c:1651 */ |
| 2811 | { (yyval.exp) = new_exp_from_array( (yyvsp[-1].exp), (yyvsp[0].array_sub), EM_lineNum ); } | 2812 | { (yyval.exp) = new_exp_from_array( (yyvsp[-1].exp), (yyvsp[0].array_sub), EM_lineNum ); } |
| 2812 | #line 2812 "chuck.tab.c" /* yacc.c:1646 */ | 2813 | #line 2814 "chuck.tab.c" /* yacc.c:1651 */ |
| 2813 | break; | 2814 | break; |
| 2814 | 2815 | ||
| 2815 | case 168: | 2816 | case 168: |
| 2816 | #line 579 "chuck.y" /* yacc.c:1646 */ | 2817 | #line 580 "chuck.y" /* yacc.c:1651 */ |
| 2817 | { (yyval.exp) = new_exp_from_func_call( (yyvsp[-2].exp), NULL, EM_lineNum ); } | 2818 | { (yyval.exp) = new_exp_from_func_call( (yyvsp[-2].exp), NULL, EM_lineNum ); } |
| 2818 | #line 2818 "chuck.tab.c" /* yacc.c:1646 */ | 2819 | #line 2820 "chuck.tab.c" /* yacc.c:1651 */ |
| 2819 | break; | 2820 | break; |
| 2820 | 2821 | ||
| 2821 | case 169: | 2822 | case 169: |
| 2822 | #line 581 "chuck.y" /* yacc.c:1646 */ | 2823 | #line 582 "chuck.y" /* yacc.c:1651 */ |
| 2823 | { (yyval.exp) = new_exp_from_func_call( (yyvsp[-3].exp), (yyvsp[-1].exp), EM_lineNum ); } | 2824 | { (yyval.exp) = new_exp_from_func_call( (yyvsp[-3].exp), (yyvsp[-1].exp), EM_lineNum ); } |
| 2824 | #line 2824 "chuck.tab.c" /* yacc.c:1646 */ | 2825 | #line 2826 "chuck.tab.c" /* yacc.c:1651 */ |
| 2825 | break; | 2826 | break; |
| 2826 | 2827 | ||
| 2827 | case 170: | 2828 | case 170: |
| 2828 | #line 583 "chuck.y" /* yacc.c:1646 */ | 2829 | #line 584 "chuck.y" /* yacc.c:1651 */ |
| 2829 | { (yyval.exp) = new_exp_from_member_dot( (yyvsp[-2].exp), (yyvsp[0].sval), EM_lineNum ); } | 2830 | { (yyval.exp) = new_exp_from_member_dot( (yyvsp[-2].exp), (yyvsp[0].sval), EM_lineNum ); } |
| 2830 | #line 2830 "chuck.tab.c" /* yacc.c:1646 */ | 2831 | #line 2832 "chuck.tab.c" /* yacc.c:1651 */ |
| 2831 | break; | 2832 | break; |
| 2832 | 2833 | ||
| 2833 | case 171: | 2834 | case 171: |
| 2834 | #line 585 "chuck.y" /* yacc.c:1646 */ | 2835 | #line 586 "chuck.y" /* yacc.c:1651 */ |
| 2835 | { (yyval.exp) = new_exp_from_postfix( (yyvsp[-1].exp), ae_op_plusplus, EM_lineNum ); } | 2836 | { (yyval.exp) = new_exp_from_postfix( (yyvsp[-1].exp), ae_op_plusplus, EM_lineNum ); } |
| 2836 | #line 2836 "chuck.tab.c" /* yacc.c:1646 */ | 2837 | #line 2838 "chuck.tab.c" /* yacc.c:1651 */ |
| 2837 | break; | 2838 | break; |
| 2838 | 2839 | ||
| 2839 | case 172: | 2840 | case 172: |
| 2840 | #line 587 "chuck.y" /* yacc.c:1646 */ | 2841 | #line 588 "chuck.y" /* yacc.c:1651 */ |
| 2841 | { (yyval.exp) = new_exp_from_postfix( (yyvsp[-1].exp), ae_op_minusminus, EM_lineNum ); } | 2842 | { (yyval.exp) = new_exp_from_postfix( (yyvsp[-1].exp), ae_op_minusminus, EM_lineNum ); } |
| 2842 | #line 2842 "chuck.tab.c" /* yacc.c:1646 */ | 2843 | #line 2844 "chuck.tab.c" /* yacc.c:1651 */ |
| 2843 | break; | 2844 | break; |
| 2844 | 2845 | ||
| 2845 | case 173: | 2846 | case 173: |
| 2846 | #line 592 "chuck.y" /* yacc.c:1646 */ | 2847 | #line 593 "chuck.y" /* yacc.c:1651 */ |
| 2847 | { (yyval.exp) = new_exp_from_id( (yyvsp[0].sval), EM_lineNum ); } | 2848 | { (yyval.exp) = new_exp_from_id( (yyvsp[0].sval), EM_lineNum ); } |
| 2848 | #line 2848 "chuck.tab.c" /* yacc.c:1646 */ | 2849 | #line 2850 "chuck.tab.c" /* yacc.c:1651 */ |
| 2849 | break; | 2850 | break; |
| 2850 | 2851 | ||
| 2851 | case 174: | 2852 | case 174: |
| 2852 | #line 593 "chuck.y" /* yacc.c:1646 */ | 2853 | #line 594 "chuck.y" /* yacc.c:1651 */ |
| 2853 | { (yyval.exp) = new_exp_from_int( (yyvsp[0].ival), EM_lineNum ); } | 2854 | { (yyval.exp) = new_exp_from_int( (yyvsp[0].ival), EM_lineNum ); } |
| 2854 | #line 2854 "chuck.tab.c" /* yacc.c:1646 */ | 2855 | #line 2856 "chuck.tab.c" /* yacc.c:1651 */ |
| 2855 | break; | 2856 | break; |
| 2856 | 2857 | ||
| 2857 | case 175: | 2858 | case 175: |
| 2858 | #line 594 "chuck.y" /* yacc.c:1646 */ | 2859 | #line 595 "chuck.y" /* yacc.c:1651 */ |
| 2859 | { (yyval.exp) = new_exp_from_float( (yyvsp[0].fval), EM_lineNum ); } | 2860 | { (yyval.exp) = new_exp_from_float( (yyvsp[0].fval), EM_lineNum ); } |
| 2860 | #line 2860 "chuck.tab.c" /* yacc.c:1646 */ | 2861 | #line 2862 "chuck.tab.c" /* yacc.c:1651 */ |
| 2861 | break; | 2862 | break; |
| 2862 | 2863 | ||
| 2863 | case 176: | 2864 | case 176: |
| 2864 | #line 595 "chuck.y" /* yacc.c:1646 */ | 2865 | #line 596 "chuck.y" /* yacc.c:1651 */ |
| 2865 | { (yyval.exp) = new_exp_from_str( (yyvsp[0].sval), EM_lineNum ); } | 2866 | { (yyval.exp) = new_exp_from_str( (yyvsp[0].sval), EM_lineNum ); } |
| 2866 | #line 2866 "chuck.tab.c" /* yacc.c:1646 */ | 2867 | #line 2868 "chuck.tab.c" /* yacc.c:1651 */ |
| 2867 | break; | 2868 | break; |
| 2868 | 2869 | ||
| 2869 | case 177: | 2870 | case 177: |
| 2870 | #line 596 "chuck.y" /* yacc.c:1646 */ | 2871 | #line 597 "chuck.y" /* yacc.c:1651 */ |
| 2871 | { (yyval.exp) = new_exp_from_char( (yyvsp[0].sval), EM_lineNum ); } | 2872 | { (yyval.exp) = new_exp_from_char( (yyvsp[0].sval), EM_lineNum ); } |
| 2872 | #line 2872 "chuck.tab.c" /* yacc.c:1646 */ | 2873 | #line 2874 "chuck.tab.c" /* yacc.c:1651 */ |
| 2873 | break; | 2874 | break; |
| 2874 | 2875 | ||
| 2875 | case 178: | 2876 | case 178: |
| 2876 | #line 597 "chuck.y" /* yacc.c:1646 */ | 2877 | #line 598 "chuck.y" /* yacc.c:1651 */ |
| 2877 | { (yyval.exp) = new_exp_from_array_lit( (yyvsp[0].array_sub), EM_lineNum ); } | 2878 | { (yyval.exp) = new_exp_from_array_lit( (yyvsp[0].array_sub), EM_lineNum ); } |
| 2878 | #line 2878 "chuck.tab.c" /* yacc.c:1646 */ | 2879 | #line 2880 "chuck.tab.c" /* yacc.c:1651 */ |
| 2879 | break; | 2880 | break; |
| 2880 | 2881 | ||
| 2881 | case 179: | 2882 | case 179: |
| 2882 | #line 598 "chuck.y" /* yacc.c:1646 */ | 2883 | #line 599 "chuck.y" /* yacc.c:1651 */ |
| 2883 | { (yyval.exp) = new_exp_from_complex( (yyvsp[0].complex_exp), EM_lineNum ); } | 2884 | { (yyval.exp) = new_exp_from_complex( (yyvsp[0].complex_exp), EM_lineNum ); } |
| 2884 | #line 2884 "chuck.tab.c" /* yacc.c:1646 */ | 2885 | #line 2886 "chuck.tab.c" /* yacc.c:1651 */ |
| 2885 | break; | 2886 | break; |
| 2886 | 2887 | ||
| 2887 | case 180: | 2888 | case 180: |
| 2888 | #line 599 "chuck.y" /* yacc.c:1646 */ | 2889 | #line 600 "chuck.y" /* yacc.c:1651 */ |
| 2889 | { (yyval.exp) = new_exp_from_polar( (yyvsp[0].polar_exp), EM_lineNum ); } | 2890 | { (yyval.exp) = new_exp_from_polar( (yyvsp[0].polar_exp), EM_lineNum ); } |
| 2890 | #line 2890 "chuck.tab.c" /* yacc.c:1646 */ | 2891 | #line 2892 "chuck.tab.c" /* yacc.c:1651 */ |
| 2891 | break; | 2892 | break; |
| 2892 | 2893 | ||
| 2893 | case 181: | 2894 | case 181: |
| 2894 | #line 600 "chuck.y" /* yacc.c:1646 */ | 2895 | #line 601 "chuck.y" /* yacc.c:1651 */ |
| 2895 | { (yyval.exp) = new_exp_from_vec( (yyvsp[0].vec_exp), EM_lineNum ); } | 2896 | { (yyval.exp) = new_exp_from_vec( (yyvsp[0].vec_exp), EM_lineNum ); } |
| 2896 | #line 2896 "chuck.tab.c" /* yacc.c:1646 */ | 2897 | #line 2898 "chuck.tab.c" /* yacc.c:1651 */ |
| 2897 | break; | 2898 | break; |
| 2898 | 2899 | ||
| 2899 | case 182: | 2900 | case 182: |
| 2900 | #line 601 "chuck.y" /* yacc.c:1646 */ | 2901 | #line 602 "chuck.y" /* yacc.c:1651 */ |
| 2901 | { (yyval.exp) = new_exp_from_hack( (yyvsp[-1].exp), EM_lineNum ); } | 2902 | { (yyval.exp) = new_exp_from_hack( (yyvsp[-1].exp), EM_lineNum ); } |
| 2902 | #line 2902 "chuck.tab.c" /* yacc.c:1646 */ | 2903 | #line 2904 "chuck.tab.c" /* yacc.c:1651 */ |
| 2903 | break; | 2904 | break; |
| 2904 | 2905 | ||
| 2905 | case 183: | 2906 | case 183: |
| 2906 | #line 602 "chuck.y" /* yacc.c:1646 */ | 2907 | #line 603 "chuck.y" /* yacc.c:1651 */ |
| 2907 | { (yyval.exp) = (yyvsp[-1].exp); } | 2908 | { (yyval.exp) = (yyvsp[-1].exp); } |
| 2908 | #line 2908 "chuck.tab.c" /* yacc.c:1646 */ | 2909 | #line 2910 "chuck.tab.c" /* yacc.c:1651 */ |
| 2909 | break; | 2910 | break; |
| 2910 | 2911 | ||
| 2911 | case 184: | 2912 | case 184: |
| 2912 | #line 603 "chuck.y" /* yacc.c:1646 */ | 2913 | #line 604 "chuck.y" /* yacc.c:1651 */ |
| 2913 | { (yyval.exp) = new_exp_from_nil( EM_lineNum ); } | 2914 | { (yyval.exp) = new_exp_from_nil( EM_lineNum ); } |
| 2914 | #line 2914 "chuck.tab.c" /* yacc.c:1646 */ | 2915 | #line 2916 "chuck.tab.c" /* yacc.c:1651 */ |
| 2915 | break; | 2916 | break; |
| 2916 | 2917 | ||
| 2917 | 2918 | ||
| 2918 | #line 2918 "chuck.tab.c" /* yacc.c:1646 */ | 2919 | #line 2920 "chuck.tab.c" /* yacc.c:1651 */ |
| 2919 | default: break; | 2920 | default: break; |
| 2920 | } | 2921 | } |
| 2921 | /* User semantic actions sometimes alter yychar, and that requires | 2922 | /* User semantic actions sometimes alter yychar, and that requires |
| @@ -3792,6 +3793,7 @@ char *yytext; · 870 unmodified lines | |||
| 3792 | 3793 | ||
| 3793 | #include <stdlib.h> | 3794 | #include <stdlib.h> |
| 3794 | #include <string.h> | 3795 | #include <string.h> |
| 3796 | #include <unistd.h> | ||
| 3795 | #include "chuck_utils.h" | 3797 | #include "chuck_utils.h" |
| 3796 | #include "chuck_absyn.h" | 3798 | #include "chuck_absyn.h" |
| 3797 | #include "chuck_errmsg.h" | 3799 | #include "chuck_errmsg.h" |
| @@ -3913,8 +3915,8 @@ long htol( c_str str ) · 115 unmodified lines | |||
| 3913 | 3915 | ||
| 3914 | // .*\-\-> { adjust(); continue; } | 3916 | // .*\-\-> { adjust(); continue; } |
| 3915 | 3917 | ||
| 3916 | #line 771 "core/chuck.yy.c" | ||
| 3917 | #line 772 "core/chuck.yy.c" | 3918 | #line 772 "core/chuck.yy.c" |
| 3919 | #line 773 "core/chuck.yy.c" | ||
| 3918 | 3920 | ||
| 3919 | #define INITIAL 0 | 3921 | #define INITIAL 0 |
| 3920 | 3922 | ||
| @@ -4123,10 +4125,10 @@ YY_DECL · 202 unmodified lines | |||
| 4123 | } | 4125 | } |
| 4124 | 4126 | ||
| 4125 | { | 4127 | { |
| 4126 | #line 172 "core/chuck.lex" | 4128 | #line 173 "core/chuck.lex" |
| 4127 | 4129 | ||
| 4128 | 4130 | ||
| 4129 | #line 984 "core/chuck.yy.c" | 4131 | #line 985 "core/chuck.yy.c" |
| 4130 | 4132 | ||
| 4131 | while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ | 4133 | while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ |
| 4132 | { | 4134 | { |
| @@ -4185,535 +4187,535 @@ do_action: /* This label is used only to access EOF actions. */ · 52 unmodified lines | |||
| 4185 | 4187 | ||
| 4186 | case 1: | 4188 | case 1: |
| 4187 | YY_RULE_SETUP | 4189 | YY_RULE_SETUP |
| 4188 | #line 174 "core/chuck.lex" | 4190 | #line 175 "core/chuck.lex" |
| 4189 | { char c; adjust(); comment_hack; continue; } | 4191 | { char c; adjust(); comment_hack; continue; } |
| 4190 | YY_BREAK | 4192 | YY_BREAK |
| 4191 | case 2: | 4193 | case 2: |
| 4192 | YY_RULE_SETUP | 4194 | YY_RULE_SETUP |
| 4193 | #line 175 "core/chuck.lex" | 4195 | #line 176 "core/chuck.lex" |
| 4194 | { char c; adjust(); comment_hack; continue; } | 4196 | { char c; adjust(); comment_hack; continue; } |
| 4195 | YY_BREAK | 4197 | YY_BREAK |
| 4196 | case 3: | 4198 | case 3: |
| 4197 | YY_RULE_SETUP | 4199 | YY_RULE_SETUP |
| 4198 | #line 176 "core/chuck.lex" | 4200 | #line 177 "core/chuck.lex" |
| 4199 | { char c, c1; adjust(); block_comment_hack; continue; } | 4201 | { char c, c1; adjust(); block_comment_hack; continue; } |
| 4200 | YY_BREAK | 4202 | YY_BREAK |
| 4201 | case 4: | 4203 | case 4: |
| 4202 | YY_RULE_SETUP | 4204 | YY_RULE_SETUP |
| 4203 | #line 177 "core/chuck.lex" | 4205 | #line 178 "core/chuck.lex" |
| 4204 | { adjust(); continue; } | 4206 | { adjust(); continue; } |
| 4205 | YY_BREAK | 4207 | YY_BREAK |
| 4206 | case 5: | 4208 | case 5: |
| 4207 | YY_RULE_SETUP | 4209 | YY_RULE_SETUP |
| 4208 | #line 178 "core/chuck.lex" | 4210 | #line 179 "core/chuck.lex" |
| 4209 | { adjust(); continue; } | 4211 | { adjust(); continue; } |
| 4210 | YY_BREAK | 4212 | YY_BREAK |
| 4211 | case 6: | 4213 | case 6: |
| 4212 | /* rule 6 can match eol */ | 4214 | /* rule 6 can match eol */ |
| 4213 | YY_RULE_SETUP | 4215 | YY_RULE_SETUP |
| 4214 | #line 179 "core/chuck.lex" | 4216 | #line 180 "core/chuck.lex" |
| 4215 | { adjust(); EM_newline(); continue; } | 4217 | { adjust(); EM_newline(); continue; } |
| 4216 | YY_BREAK | 4218 | YY_BREAK |
| 4217 | case 7: | 4219 | case 7: |
| 4218 | /* rule 7 can match eol */ | 4220 | /* rule 7 can match eol */ |
| 4219 | YY_RULE_SETUP | 4221 | YY_RULE_SETUP |
| 4220 | #line 180 "core/chuck.lex" | 4222 | #line 181 "core/chuck.lex" |
| 4221 | { adjust(); EM_newline(); continue; } | 4223 | { adjust(); EM_newline(); continue; } |
| 4222 | YY_BREAK | 4224 | YY_BREAK |
| 4223 | case 8: | 4225 | case 8: |
| 4224 | YY_RULE_SETUP | 4226 | YY_RULE_SETUP |
| 4225 | #line 182 "core/chuck.lex" | 4227 | #line 183 "core/chuck.lex" |
| 4226 | { adjust(); return PLUSPLUS; } | 4228 | { adjust(); return PLUSPLUS; } |
| 4227 | YY_BREAK | 4229 | YY_BREAK |
| 4228 | case 9: | 4230 | case 9: |
| 4229 | YY_RULE_SETUP | 4231 | YY_RULE_SETUP |
| 4230 | #line 183 "core/chuck.lex" | 4232 | #line 184 "core/chuck.lex" |
| 4231 | { adjust(); return MINUSMINUS; } | 4233 | { adjust(); return MINUSMINUS; } |
| 4232 | YY_BREAK | 4234 | YY_BREAK |
| 4233 | case 10: | 4235 | case 10: |
| 4234 | YY_RULE_SETUP | 4236 | YY_RULE_SETUP |
| 4235 | #line 184 "core/chuck.lex" | 4237 | #line 185 "core/chuck.lex" |
| 4236 | { adjust(); return POUNDPAREN; } | 4238 | { adjust(); return POUNDPAREN; } |
| 4237 | YY_BREAK | 4239 | YY_BREAK |
| 4238 | case 11: | 4240 | case 11: |
| 4239 | YY_RULE_SETUP | 4241 | YY_RULE_SETUP |
| 4240 | #line 185 "core/chuck.lex" | 4242 | #line 186 "core/chuck.lex" |
| 4241 | { adjust(); return PERCENTPAREN; } | 4243 | { adjust(); return PERCENTPAREN; } |
| 4242 | YY_BREAK | 4244 | YY_BREAK |
| 4243 | case 12: | 4245 | case 12: |
| 4244 | YY_RULE_SETUP | 4246 | YY_RULE_SETUP |
| 4245 | #line 186 "core/chuck.lex" | 4247 | #line 187 "core/chuck.lex" |
| 4246 | { adjust(); return ATPAREN; } | 4248 | { adjust(); return ATPAREN; } |
| 4247 | YY_BREAK | 4249 | YY_BREAK |
| 4248 | case 13: | 4250 | case 13: |
| 4249 | YY_RULE_SETUP | 4251 | YY_RULE_SETUP |
| 4250 | #line 188 "core/chuck.lex" | 4252 | #line 189 "core/chuck.lex" |
| 4251 | { adjust(); return COMMA; } | 4253 | { adjust(); return COMMA; } |
| 4252 | YY_BREAK | 4254 | YY_BREAK |
| 4253 | case 14: | 4255 | case 14: |
| 4254 | YY_RULE_SETUP | 4256 | YY_RULE_SETUP |
| 4255 | #line 189 "core/chuck.lex" | 4257 | #line 190 "core/chuck.lex" |
| 4256 | { adjust(); return COLON; } | 4258 | { adjust(); return COLON; } |
| 4257 | YY_BREAK | 4259 | YY_BREAK |
| 4258 | case 15: | 4260 | case 15: |
| 4259 | YY_RULE_SETUP | 4261 | YY_RULE_SETUP |
| 4260 | #line 190 "core/chuck.lex" | 4262 | #line 191 "core/chuck.lex" |
| 4261 | { adjust(); return DOT; } | 4263 | { adjust(); return DOT; } |
| 4262 | YY_BREAK | 4264 | YY_BREAK |
| 4263 | case 16: | 4265 | case 16: |
| 4264 | YY_RULE_SETUP | 4266 | YY_RULE_SETUP |
| 4265 | #line 191 "core/chuck.lex" | 4267 | #line 192 "core/chuck.lex" |
| 4266 | { adjust(); return PLUS; } | 4268 | { adjust(); return PLUS; } |
| 4267 | YY_BREAK | 4269 | YY_BREAK |
| 4268 | case 17: | 4270 | case 17: |
| 4269 | YY_RULE_SETUP | 4271 | YY_RULE_SETUP |
| 4270 | #line 192 "core/chuck.lex" | 4272 | #line 193 "core/chuck.lex" |
| 4271 | { adjust(); return MINUS; } | 4273 | { adjust(); return MINUS; } |
| 4272 | YY_BREAK | 4274 | YY_BREAK |
| 4273 | case 18: | 4275 | case 18: |
| 4274 | YY_RULE_SETUP | 4276 | YY_RULE_SETUP |
| 4275 | #line 193 "core/chuck.lex" | 4277 | #line 194 "core/chuck.lex" |
| 4276 | { adjust(); return TIMES; } | 4278 | { adjust(); return TIMES; } |
| 4277 | YY_BREAK | 4279 | YY_BREAK |
| 4278 | case 19: | 4280 | case 19: |
| 4279 | YY_RULE_SETUP | 4281 | YY_RULE_SETUP |
| 4280 | #line 194 "core/chuck.lex" | 4282 | #line 195 "core/chuck.lex" |
| 4281 | { adjust(); return DIVIDE; } | 4283 | { adjust(); return DIVIDE; } |
| 4282 | YY_BREAK | 4284 | YY_BREAK |
| 4283 | case 20: | 4285 | case 20: |
| 4284 | YY_RULE_SETUP | 4286 | YY_RULE_SETUP |
| 4285 | #line 195 "core/chuck.lex" | 4287 | #line 196 "core/chuck.lex" |
| 4286 | { adjust(); return PERCENT; } | 4288 | { adjust(); return PERCENT; } |
| 4287 | YY_BREAK | 4289 | YY_BREAK |
| 4288 | case 21: | 4290 | case 21: |
| 4289 | YY_RULE_SETUP | 4291 | YY_RULE_SETUP |
| 4290 | #line 196 "core/chuck.lex" | 4292 | #line 197 "core/chuck.lex" |
| 4291 | { adjust(); return POUND; } | 4293 | { adjust(); return POUND; } |
| 4292 | YY_BREAK | 4294 | YY_BREAK |
| 4293 | case 22: | 4295 | case 22: |
| 4294 | YY_RULE_SETUP | 4296 | YY_RULE_SETUP |
| 4295 | #line 197 "core/chuck.lex" | 4297 | #line 198 "core/chuck.lex" |
| 4296 | { adjust(); return DOLLAR; } | 4298 | { adjust(); return DOLLAR; } |
| 4297 | YY_BREAK | 4299 | YY_BREAK |
| 4298 | case 23: | 4300 | case 23: |
| 4299 | YY_RULE_SETUP | 4301 | YY_RULE_SETUP |
| 4300 | #line 199 "core/chuck.lex" | 4302 | #line 200 "core/chuck.lex" |
| 4301 | { adjust(); return COLONCOLON; } | 4303 | { adjust(); return COLONCOLON; } |
| 4302 | YY_BREAK | 4304 | YY_BREAK |
| 4303 | case 24: | 4305 | case 24: |
| 4304 | YY_RULE_SETUP | 4306 | YY_RULE_SETUP |
| 4305 | #line 200 "core/chuck.lex" | 4307 | #line 201 "core/chuck.lex" |
| 4306 | { adjust(); return EQ; } | 4308 | { adjust(); return EQ; } |
| 4307 | YY_BREAK | 4309 | YY_BREAK |
| 4308 | case 25: | 4310 | case 25: |
| 4309 | YY_RULE_SETUP | 4311 | YY_RULE_SETUP |
| 4310 | #line 201 "core/chuck.lex" | 4312 | #line 202 "core/chuck.lex" |
| 4311 | { adjust(); return NEQ; } | 4313 | { adjust(); return NEQ; } |
| 4312 | YY_BREAK | 4314 | YY_BREAK |
| 4313 | case 26: | 4315 | case 26: |
| 4314 | YY_RULE_SETUP | 4316 | YY_RULE_SETUP |
| 4315 | #line 202 "core/chuck.lex" | 4317 | #line 203 "core/chuck.lex" |
| 4316 | { adjust(); return LT; } | 4318 | { adjust(); return LT; } |
| 4317 | YY_BREAK | 4319 | YY_BREAK |
| 4318 | case 27: | 4320 | case 27: |
| 4319 | YY_RULE_SETUP | 4321 | YY_RULE_SETUP |
| 4320 | #line 203 "core/chuck.lex" | 4322 | #line 204 "core/chuck.lex" |
| 4321 | { adjust(); return GT; } | 4323 | { adjust(); return GT; } |
| 4322 | YY_BREAK | 4324 | YY_BREAK |
| 4323 | case 28: | 4325 | case 28: |
| 4324 | YY_RULE_SETUP | 4326 | YY_RULE_SETUP |
| 4325 | #line 204 "core/chuck.lex" | 4327 | #line 205 "core/chuck.lex" |
| 4326 | { adjust(); return LE; } | 4328 | { adjust(); return LE; } |
| 4327 | YY_BREAK | 4329 | YY_BREAK |
| 4328 | case 29: | 4330 | case 29: |
| 4329 | YY_RULE_SETUP | 4331 | YY_RULE_SETUP |
| 4330 | #line 205 "core/chuck.lex" | 4332 | #line 206 "core/chuck.lex" |
| 4331 | { adjust(); return GE; } | 4333 | { adjust(); return GE; } |
| 4332 | YY_BREAK | 4334 | YY_BREAK |
| 4333 | case 30: | 4335 | case 30: |
| 4334 | YY_RULE_SETUP | 4336 | YY_RULE_SETUP |
| 4335 | #line 206 "core/chuck.lex" | 4337 | #line 207 "core/chuck.lex" |
| 4336 | { adjust(); return AND; } | 4338 | { adjust(); return AND; } |
| 4337 | YY_BREAK | 4339 | YY_BREAK |
| 4338 | case 31: | 4340 | case 31: |
| 4339 | YY_RULE_SETUP | 4341 | YY_RULE_SETUP |
| 4340 | #line 207 "core/chuck.lex" | 4342 | #line 208 "core/chuck.lex" |
| 4341 | { adjust(); return OR; } | 4343 | { adjust(); return OR; } |
| 4342 | YY_BREAK | 4344 | YY_BREAK |
| 4343 | case 32: | 4345 | case 32: |
| 4344 | YY_RULE_SETUP | 4346 | YY_RULE_SETUP |
| 4345 | #line 208 "core/chuck.lex" | 4347 | #line 209 "core/chuck.lex" |
| 4346 | { adjust(); return S_AND; } | 4348 | { adjust(); return S_AND; } |
| 4347 | YY_BREAK | 4349 | YY_BREAK |
| 4348 | case 33: | 4350 | case 33: |
| 4349 | YY_RULE_SETUP | 4351 | YY_RULE_SETUP |
| 4350 | #line 209 "core/chuck.lex" | 4352 | #line 210 "core/chuck.lex" |
| 4351 | { adjust(); return S_OR; } | 4353 | { adjust(); return S_OR; } |
| 4352 | YY_BREAK | 4354 | YY_BREAK |
| 4353 | case 34: | 4355 | case 34: |
| 4354 | YY_RULE_SETUP | 4356 | YY_RULE_SETUP |
| 4355 | #line 210 "core/chuck.lex" | 4357 | #line 211 "core/chuck.lex" |
| 4356 | { adjust(); return S_XOR; } | 4358 | { adjust(); return S_XOR; } |
| 4357 | YY_BREAK | 4359 | YY_BREAK |
| 4358 | case 35: | 4360 | case 35: |
| 4359 | YY_RULE_SETUP | 4361 | YY_RULE_SETUP |
| 4360 | #line 211 "core/chuck.lex" | 4362 | #line 212 "core/chuck.lex" |
| 4361 | { adjust(); return SHIFT_RIGHT; } | 4363 | { adjust(); return SHIFT_RIGHT; } |
| 4362 | YY_BREAK | 4364 | YY_BREAK |
| 4363 | case 36: | 4365 | case 36: |
| 4364 | YY_RULE_SETUP | 4366 | YY_RULE_SETUP |
| 4365 | #line 212 "core/chuck.lex" | 4367 | #line 213 "core/chuck.lex" |
| 4366 | { adjust(); return SHIFT_LEFT; } | 4368 | { adjust(); return SHIFT_LEFT; } |
| 4367 | YY_BREAK | 4369 | YY_BREAK |
| 4368 | case 37: | 4370 | case 37: |
| 4369 | YY_RULE_SETUP | 4371 | YY_RULE_SETUP |
| 4370 | #line 213 "core/chuck.lex" | 4372 | #line 214 "core/chuck.lex" |
| 4371 | { adjust(); return ASSIGN; } | 4373 | { adjust(); return ASSIGN; } |
| 4372 | YY_BREAK | 4374 | YY_BREAK |
| 4373 | case 38: | 4375 | case 38: |
| 4374 | YY_RULE_SETUP | 4376 | YY_RULE_SETUP |
| 4375 | #line 214 "core/chuck.lex" | 4377 | #line 215 "core/chuck.lex" |
| 4376 | { adjust(); return LPAREN; } | 4378 | { adjust(); return LPAREN; } |
| 4377 | YY_BREAK | 4379 | YY_BREAK |
| 4378 | case 39: | 4380 | case 39: |
| 4379 | YY_RULE_SETUP | 4381 | YY_RULE_SETUP |
| 4380 | #line 215 "core/chuck.lex" | 4382 | #line 216 "core/chuck.lex" |
| 4381 | { adjust(); return RPAREN; } | 4383 | { adjust(); return RPAREN; } |
| 4382 | YY_BREAK | 4384 | YY_BREAK |
| 4383 | case 40: | 4385 | case 40: |
| 4384 | YY_RULE_SETUP | 4386 | YY_RULE_SETUP |
| 4385 | #line 216 "core/chuck.lex" | 4387 | #line 217 "core/chuck.lex" |
| 4386 | { adjust(); return LBRACK; } | 4388 | { adjust(); return LBRACK; } |
| 4387 | YY_BREAK | 4389 | YY_BREAK |
| 4388 | case 41: | 4390 | case 41: |
| 4389 | YY_RULE_SETUP | 4391 | YY_RULE_SETUP |
| 4390 | #line 217 "core/chuck.lex" | 4392 | #line 218 "core/chuck.lex" |
| 4391 | { adjust(); return RBRACK; } | 4393 | { adjust(); return RBRACK; } |
| 4392 | YY_BREAK | 4394 | YY_BREAK |
| 4393 | case 42: | 4395 | case 42: |
| 4394 | YY_RULE_SETUP | 4396 | YY_RULE_SETUP |
| 4395 | #line 218 "core/chuck.lex" | 4397 | #line 219 "core/chuck.lex" |
| 4396 | { adjust(); return LBRACE; } | 4398 | { adjust(); return LBRACE; } |
| 4397 | YY_BREAK | 4399 | YY_BREAK |
| 4398 | case 43: | 4400 | case 43: |
| 4399 | YY_RULE_SETUP | 4401 | YY_RULE_SETUP |
| 4400 | #line 219 "core/chuck.lex" | 4402 | #line 220 "core/chuck.lex" |
| 4401 | { adjust(); return RBRACE; } | 4403 | { adjust(); return RBRACE; } |
| 4402 | YY_BREAK | 4404 | YY_BREAK |
| 4403 | case 44: | 4405 | case 44: |
| 4404 | YY_RULE_SETUP | 4406 | YY_RULE_SETUP |
| 4405 | #line 220 "core/chuck.lex" | 4407 | #line 221 "core/chuck.lex" |
| 4406 | { adjust(); return SEMICOLON; } | 4408 | { adjust(); return SEMICOLON; } |
| 4407 | YY_BREAK | 4409 | YY_BREAK |
| 4408 | case 45: | 4410 | case 45: |
| 4409 | YY_RULE_SETUP | 4411 | YY_RULE_SETUP |
| 4410 | #line 221 "core/chuck.lex" | 4412 | #line 222 "core/chuck.lex" |
| 4411 | { adjust(); return QUESTION; } | 4413 | { adjust(); return QUESTION; } |
| 4412 | YY_BREAK | 4414 | YY_BREAK |
| 4413 | case 46: | 4415 | case 46: |
| 4414 | YY_RULE_SETUP | 4416 | YY_RULE_SETUP |
| 4415 | #line 222 "core/chuck.lex" | 4417 | #line 223 "core/chuck.lex" |
| 4416 | { adjust(); return EXCLAMATION; } | 4418 | { adjust(); return EXCLAMATION; } |
| 4417 | YY_BREAK | 4419 | YY_BREAK |
| 4418 | case 47: | 4420 | case 47: |
| 4419 | YY_RULE_SETUP | 4421 | YY_RULE_SETUP |
| 4420 | #line 223 "core/chuck.lex" | 4422 | #line 224 "core/chuck.lex" |
| 4421 | { adjust(); return TILDA; } | 4423 | { adjust(); return TILDA; } |
| 4422 | YY_BREAK | 4424 | YY_BREAK |
| 4423 | case 48: | 4425 | case 48: |
| 4424 | YY_RULE_SETUP | 4426 | YY_RULE_SETUP |
| 4425 | #line 224 "core/chuck.lex" | 4427 | #line 225 "core/chuck.lex" |
| 4426 | { adjust(); return FOR; } | 4428 | { adjust(); return FOR; } |
| 4427 | YY_BREAK | 4429 | YY_BREAK |
| 4428 | case 49: | 4430 | case 49: |
| 4429 | YY_RULE_SETUP | 4431 | YY_RULE_SETUP |
| 4430 | #line 225 "core/chuck.lex" | 4432 | #line 226 "core/chuck.lex" |
| 4431 | { adjust(); return WHILE; } | 4433 | { adjust(); return WHILE; } |
| 4432 | YY_BREAK | 4434 | YY_BREAK |
| 4433 | case 50: | 4435 | case 50: |
| 4434 | YY_RULE_SETUP | 4436 | YY_RULE_SETUP |
| 4435 | #line 226 "core/chuck.lex" | 4437 | #line 227 "core/chuck.lex" |
| 4436 | { adjust(); return UNTIL; } | 4438 | { adjust(); return UNTIL; } |
| 4437 | YY_BREAK | 4439 | YY_BREAK |
| 4438 | case 51: | 4440 | case 51: |
| 4439 | YY_RULE_SETUP | 4441 | YY_RULE_SETUP |
| 4440 | #line 227 "core/chuck.lex" | 4442 | #line 228 "core/chuck.lex" |
| 4441 | { adjust(); return LOOP; } | 4443 | { adjust(); return LOOP; } |
| 4442 | YY_BREAK | 4444 | YY_BREAK |
| 4443 | case 52: | 4445 | case 52: |
| 4444 | YY_RULE_SETUP | 4446 | YY_RULE_SETUP |
| 4445 | #line 228 "core/chuck.lex" | 4447 | #line 229 "core/chuck.lex" |
| 4446 | { adjust(); return CONTINUE; } | 4448 | { adjust(); return CONTINUE; } |
| 4447 | YY_BREAK | 4449 | YY_BREAK |
| 4448 | case 53: | 4450 | case 53: |
| 4449 | YY_RULE_SETUP | 4451 | YY_RULE_SETUP |
| 4450 | #line 229 "core/chuck.lex" | 4452 | #line 230 "core/chuck.lex" |
| 4451 | { adjust(); return BREAK; } | 4453 | { adjust(); return BREAK; } |
| 4452 | YY_BREAK | 4454 | YY_BREAK |
| 4453 | case 54: | 4455 | case 54: |
| 4454 | YY_RULE_SETUP | 4456 | YY_RULE_SETUP |
| 4455 | #line 230 "core/chuck.lex" | 4457 | #line 231 "core/chuck.lex" |
| 4456 | { adjust(); return IF; } | 4458 | { adjust(); return IF; } |
| 4457 | YY_BREAK | 4459 | YY_BREAK |
| 4458 | case 55: | 4460 | case 55: |
| 4459 | YY_RULE_SETUP | 4461 | YY_RULE_SETUP |
| 4460 | #line 231 "core/chuck.lex" | 4462 | #line 232 "core/chuck.lex" |
| 4461 | { adjust(); return ELSE; } | 4463 | { adjust(); return ELSE; } |
| 4462 | YY_BREAK | 4464 | YY_BREAK |
| 4463 | case 56: | 4465 | case 56: |
| 4464 | YY_RULE_SETUP | 4466 | YY_RULE_SETUP |
| 4465 | #line 232 "core/chuck.lex" | 4467 | #line 233 "core/chuck.lex" |
| 4466 | { adjust(); return DO; } | 4468 | { adjust(); return DO; } |
| 4467 | YY_BREAK | 4469 | YY_BREAK |
| 4468 | case 57: | 4470 | case 57: |
| 4469 | YY_RULE_SETUP | 4471 | YY_RULE_SETUP |
| 4470 | #line 233 "core/chuck.lex" | 4472 | #line 234 "core/chuck.lex" |
| 4471 | { adjust(); return L_HACK; } | 4473 | { adjust(); return L_HACK; } |
| 4472 | YY_BREAK | 4474 | YY_BREAK |
| 4473 | case 58: | 4475 | case 58: |
| 4474 | YY_RULE_SETUP | 4476 | YY_RULE_SETUP |
| 4475 | #line 234 "core/chuck.lex" | 4477 | #line 235 "core/chuck.lex" |
| 4476 | { adjust(); return R_HACK; } | 4478 | { adjust(); return R_HACK; } |
| 4477 | YY_BREAK | 4479 | YY_BREAK |
| 4478 | case 59: | 4480 | case 59: |
| 4479 | YY_RULE_SETUP | 4481 | YY_RULE_SETUP |
| 4480 | #line 236 "core/chuck.lex" | 4482 | #line 237 "core/chuck.lex" |
| 4481 | { adjust(); return RETURN; } | 4483 | { adjust(); return RETURN; } |
| 4482 | YY_BREAK | 4484 | YY_BREAK |
| 4483 | case 60: | 4485 | case 60: |
| 4484 | YY_RULE_SETUP | 4486 | YY_RULE_SETUP |
| 4485 | #line 238 "core/chuck.lex" | 4487 | #line 239 "core/chuck.lex" |
| 4486 | { adjust(); return FUNCTION; } | 4488 | { adjust(); return FUNCTION; } |
| 4487 | YY_BREAK | 4489 | YY_BREAK |
| 4488 | case 61: | 4490 | case 61: |
| 4489 | YY_RULE_SETUP | 4491 | YY_RULE_SETUP |
| 4490 | #line 239 "core/chuck.lex" | 4492 | #line 240 "core/chuck.lex" |
| 4491 | { adjust(); return FUNCTION; } | 4493 | { adjust(); return FUNCTION; } |
| 4492 | YY_BREAK | 4494 | YY_BREAK |
| 4493 | case 62: | 4495 | case 62: |
| 4494 | YY_RULE_SETUP | 4496 | YY_RULE_SETUP |
| 4495 | #line 240 "core/chuck.lex" | 4497 | #line 241 "core/chuck.lex" |
| 4496 | { adjust(); return NEW; } | 4498 | { adjust(); return NEW; } |
| 4497 | YY_BREAK | 4499 | YY_BREAK |
| 4498 | case 63: | 4500 | case 63: |
| 4499 | YY_RULE_SETUP | 4501 | YY_RULE_SETUP |
| 4500 | #line 241 "core/chuck.lex" | 4502 | #line 242 "core/chuck.lex" |
| 4501 | { adjust(); return CLASS; } | 4503 | { adjust(); return CLASS; } |
| 4502 | YY_BREAK | 4504 | YY_BREAK |
| 4503 | case 64: | 4505 | case 64: |
| 4504 | YY_RULE_SETUP | 4506 | YY_RULE_SETUP |
| 4505 | #line 242 "core/chuck.lex" | 4507 | #line 243 "core/chuck.lex" |
| 4506 | { adjust(); return INTERFACE; } | 4508 | { adjust(); return INTERFACE; } |
| 4507 | YY_BREAK | 4509 | YY_BREAK |
| 4508 | case 65: | 4510 | case 65: |
| 4509 | YY_RULE_SETUP | 4511 | YY_RULE_SETUP |
| 4510 | #line 243 "core/chuck.lex" | 4512 | #line 244 "core/chuck.lex" |
| 4511 | { adjust(); return EXTENDS; } | 4513 | { adjust(); return EXTENDS; } |
| 4512 | YY_BREAK | 4514 | YY_BREAK |
| 4513 | case 66: | 4515 | case 66: |
| 4514 | YY_RULE_SETUP | 4516 | YY_RULE_SETUP |
| 4515 | #line 244 "core/chuck.lex" | 4517 | #line 245 "core/chuck.lex" |
| 4516 | { adjust(); return IMPLEMENTS; } | 4518 | { adjust(); return IMPLEMENTS; } |
| 4517 | YY_BREAK | 4519 | YY_BREAK |
| 4518 | case 67: | 4520 | case 67: |
| 4519 | YY_RULE_SETUP | 4521 | YY_RULE_SETUP |
| 4520 | #line 245 "core/chuck.lex" | 4522 | #line 246 "core/chuck.lex" |
| 4521 | { adjust(); return PUBLIC; } | 4523 | { adjust(); return PUBLIC; } |
| 4522 | YY_BREAK | 4524 | YY_BREAK |
| 4523 | case 68: | 4525 | case 68: |
| 4524 | YY_RULE_SETUP | 4526 | YY_RULE_SETUP |
| 4525 | #line 246 "core/chuck.lex" | 4527 | #line 247 "core/chuck.lex" |
| 4526 | { adjust(); return PROTECTED; } | 4528 | { adjust(); return PROTECTED; } |
| 4527 | YY_BREAK | 4529 | YY_BREAK |
| 4528 | case 69: | 4530 | case 69: |
| 4529 | YY_RULE_SETUP | 4531 | YY_RULE_SETUP |
| 4530 | #line 247 "core/chuck.lex" | 4532 | #line 248 "core/chuck.lex" |
| 4531 | { adjust(); return PRIVATE; } | 4533 | { adjust(); return PRIVATE; } |
| 4532 | YY_BREAK | 4534 | YY_BREAK |
| 4533 | case 70: | 4535 | case 70: |
| 4534 | YY_RULE_SETUP | 4536 | YY_RULE_SETUP |
| 4535 | #line 248 "core/chuck.lex" | 4537 | #line 249 "core/chuck.lex" |
| 4536 | { adjust(); return STATIC; } | 4538 | { adjust(); return STATIC; } |
| 4537 | YY_BREAK | 4539 | YY_BREAK |
| 4538 | case 71: | 4540 | case 71: |
| 4539 | YY_RULE_SETUP | 4541 | YY_RULE_SETUP |
| 4540 | #line 249 "core/chuck.lex" | 4542 | #line 250 "core/chuck.lex" |
| 4541 | { adjust(); return ABSTRACT; } | 4543 | { adjust(); return ABSTRACT; } |
| 4542 | YY_BREAK | 4544 | YY_BREAK |
| 4543 | case 72: | 4545 | case 72: |
| 4544 | YY_RULE_SETUP | 4546 | YY_RULE_SETUP |
| 4545 | #line 250 "core/chuck.lex" | 4547 | #line 251 "core/chuck.lex" |
| 4546 | { adjust(); return CONST; } | 4548 | { adjust(); return CONST; } |
| 4547 | YY_BREAK | 4549 | YY_BREAK |
| 4548 | case 73: | 4550 | case 73: |
| 4549 | YY_RULE_SETUP | 4551 | YY_RULE_SETUP |
| 4550 | #line 251 "core/chuck.lex" | 4552 | #line 252 "core/chuck.lex" |
| 4551 | { adjust(); return SPORK; } | 4553 | { adjust(); return SPORK; } |
| 4552 | YY_BREAK | 4554 | YY_BREAK |
| 4553 | case 74: | 4555 | case 74: |
| 4554 | YY_RULE_SETUP | 4556 | YY_RULE_SETUP |
| 4555 | #line 252 "core/chuck.lex" | 4557 | #line 253 "core/chuck.lex" |
| 4556 | { adjust(); return TYPEOF; } | 4558 | { adjust(); return TYPEOF; } |
| 4557 | YY_BREAK | 4559 | YY_BREAK |
| 4558 | case 75: | 4560 | case 75: |
| 4559 | YY_RULE_SETUP | 4561 | YY_RULE_SETUP |
| 4560 | #line 253 "core/chuck.lex" | 4562 | #line 254 "core/chuck.lex" |
| 4561 | { adjust(); return EXTERNAL; } | 4563 | { adjust(); return EXTERNAL; } |
| 4562 | YY_BREAK | 4564 | YY_BREAK |
| 4563 | case 76: | 4565 | case 76: |
| 4564 | YY_RULE_SETUP | 4566 | YY_RULE_SETUP |
| 4565 | #line 254 "core/chuck.lex" | 4567 | #line 255 "core/chuck.lex" |
| 4566 | { adjust(); return GLOBAL; } | 4568 | { adjust(); return GLOBAL; } |
| 4567 | YY_BREAK | 4569 | YY_BREAK |
| 4568 | case 77: | 4570 | case 77: |
| 4569 | YY_RULE_SETUP | 4571 | YY_RULE_SETUP |
| 4570 | #line 256 "core/chuck.lex" | 4572 | #line 257 "core/chuck.lex" |
| 4571 | { adjust(); return CHUCK; } | 4573 | { adjust(); return CHUCK; } |
| 4572 | YY_BREAK | 4574 | YY_BREAK |
| 4573 | case 78: | 4575 | case 78: |
| 4574 | YY_RULE_SETUP | 4576 | YY_RULE_SETUP |
| 4575 | #line 257 "core/chuck.lex" | 4577 | #line 258 "core/chuck.lex" |
| 4576 | { adjust(); return UNCHUCK; } | 4578 | { adjust(); return UNCHUCK; } |
| 4577 | YY_BREAK | 4579 | YY_BREAK |
| 4578 | case 79: | 4580 | case 79: |
| 4579 | YY_RULE_SETUP | 4581 | YY_RULE_SETUP |
| 4580 | #line 258 "core/chuck.lex" | 4582 | #line 259 "core/chuck.lex" |
| 4581 | { adjust(); return UNCHUCK; } | 4583 | { adjust(); return UNCHUCK; } |
| 4582 | YY_BREAK | 4584 | YY_BREAK |
| 4583 | case 80: | 4585 | case 80: |
| 4584 | YY_RULE_SETUP | 4586 | YY_RULE_SETUP |
| 4585 | #line 259 "core/chuck.lex" | 4587 | #line 260 "core/chuck.lex" |
| 4586 | { adjust(); return UPCHUCK; } | 4588 | { adjust(); return UPCHUCK; } |
| 4587 | YY_BREAK | 4589 | YY_BREAK |
| 4588 | case 81: | 4590 | case 81: |
| 4589 | YY_RULE_SETUP | 4591 | YY_RULE_SETUP |
| 4590 | #line 260 "core/chuck.lex" | 4592 | #line 261 "core/chuck.lex" |
| 4591 | { adjust(); return AT_CHUCK; } | 4593 | { adjust(); return AT_CHUCK; } |
| 4592 | YY_BREAK | 4594 | YY_BREAK |
| 4593 | case 82: | 4595 | case 82: |
| 4594 | YY_RULE_SETUP | 4596 | YY_RULE_SETUP |
| 4595 | #line 261 "core/chuck.lex" | 4597 | #line 262 "core/chuck.lex" |
| 4596 | { adjust(); return PLUS_CHUCK; } | 4598 | { adjust(); return PLUS_CHUCK; } |
| 4597 | YY_BREAK | 4599 | YY_BREAK |
| 4598 | case 83: | 4600 | case 83: |
| 4599 | YY_RULE_SETUP | 4601 | YY_RULE_SETUP |
| 4600 | #line 262 "core/chuck.lex" | 4602 | #line 263 "core/chuck.lex" |
| 4601 | { adjust(); return MINUS_CHUCK; } | 4603 | { adjust(); return MINUS_CHUCK; } |
| 4602 | YY_BREAK | 4604 | YY_BREAK |
| 4603 | case 84: | 4605 | case 84: |
| 4604 | YY_RULE_SETUP | 4606 | YY_RULE_SETUP |
| 4605 | #line 263 "core/chuck.lex" | 4607 | #line 264 "core/chuck.lex" |
| 4606 | { adjust(); return TIMES_CHUCK; } | 4608 | { adjust(); return TIMES_CHUCK; } |
| 4607 | YY_BREAK | 4609 | YY_BREAK |
| 4608 | case 85: | 4610 | case 85: |
| 4609 | YY_RULE_SETUP | 4611 | YY_RULE_SETUP |
| 4610 | #line 264 "core/chuck.lex" | 4612 | #line 265 "core/chuck.lex" |
| 4611 | { adjust(); return DIVIDE_CHUCK; } | 4613 | { adjust(); return DIVIDE_CHUCK; } |
| 4612 | YY_BREAK | 4614 | YY_BREAK |
| 4613 | case 86: | 4615 | case 86: |
| 4614 | YY_RULE_SETUP | 4616 | YY_RULE_SETUP |
| 4615 | #line 265 "core/chuck.lex" | 4617 | #line 266 "core/chuck.lex" |
| 4616 | { adjust(); return S_AND_CHUCK; } | 4618 | { adjust(); return S_AND_CHUCK; } |
| 4617 | YY_BREAK | 4619 | YY_BREAK |
| 4618 | case 87: | 4620 | case 87: |
| 4619 | YY_RULE_SETUP | 4621 | YY_RULE_SETUP |
| 4620 | #line 266 "core/chuck.lex" | 4622 | #line 267 "core/chuck.lex" |
| 4621 | { adjust(); return S_OR_CHUCK; } | 4623 | { adjust(); return S_OR_CHUCK; } |
| 4622 | YY_BREAK | 4624 | YY_BREAK |
| 4623 | case 88: | 4625 | case 88: |
| 4624 | YY_RULE_SETUP | 4626 | YY_RULE_SETUP |
| 4625 | #line 267 "core/chuck.lex" | 4627 | #line 268 "core/chuck.lex" |
| 4626 | { adjust(); return S_XOR_CHUCK; } | 4628 | { adjust(); return S_XOR_CHUCK; } |
| 4627 | YY_BREAK | 4629 | YY_BREAK |
| 4628 | case 89: | 4630 | case 89: |
| 4629 | YY_RULE_SETUP | 4631 | YY_RULE_SETUP |
| 4630 | #line 268 "core/chuck.lex" | 4632 | #line 269 "core/chuck.lex" |
| 4631 | { adjust(); return SHIFT_RIGHT_CHUCK; } | 4633 | { adjust(); return SHIFT_RIGHT_CHUCK; } |
| 4632 | YY_BREAK | 4634 | YY_BREAK |
| 4633 | case 90: | 4635 | case 90: |
| 4634 | YY_RULE_SETUP | 4636 | YY_RULE_SETUP |
| 4635 | #line 269 "core/chuck.lex" | 4637 | #line 270 "core/chuck.lex" |
| 4636 | { adjust(); return SHIFT_LEFT_CHUCK; } | 4638 | { adjust(); return SHIFT_LEFT_CHUCK; } |
| 4637 | YY_BREAK | 4639 | YY_BREAK |
| 4638 | case 91: | 4640 | case 91: |
| 4639 | YY_RULE_SETUP | 4641 | YY_RULE_SETUP |
| 4640 | #line 270 "core/chuck.lex" | 4642 | #line 271 "core/chuck.lex" |
| 4641 | { adjust(); return PERCENT_CHUCK; } | 4643 | { adjust(); return PERCENT_CHUCK; } |
| 4642 | YY_BREAK | 4644 | YY_BREAK |
| 4643 | case 92: | 4645 | case 92: |
| 4644 | YY_RULE_SETUP | 4646 | YY_RULE_SETUP |
| 4645 | #line 271 "core/chuck.lex" | 4647 | #line 272 "core/chuck.lex" |
| 4646 | { adjust(); return AT_SYM; } | 4648 | { adjust(); return AT_SYM; } |
| 4647 | YY_BREAK | 4649 | YY_BREAK |
| 4648 | case 93: | 4650 | case 93: |
| 4649 | YY_RULE_SETUP | 4651 | YY_RULE_SETUP |
| 4650 | #line 272 "core/chuck.lex" | 4652 | #line 273 "core/chuck.lex" |
| 4651 | { adjust(); return ATAT_SYM; } | 4653 | { adjust(); return ATAT_SYM; } |
| 4652 | YY_BREAK | 4654 | YY_BREAK |
| 4653 | case 94: | 4655 | case 94: |
| 4654 | YY_RULE_SETUP | 4656 | YY_RULE_SETUP |
| 4655 | #line 273 "core/chuck.lex" | 4657 | #line 274 "core/chuck.lex" |
| 4656 | { adjust(); return ARROW_RIGHT; } | 4658 | { adjust(); return ARROW_RIGHT; } |
| 4657 | YY_BREAK | 4659 | YY_BREAK |
| 4658 | case 95: | 4660 | case 95: |
| 4659 | YY_RULE_SETUP | 4661 | YY_RULE_SETUP |
| 4660 | #line 274 "core/chuck.lex" | 4662 | #line 275 "core/chuck.lex" |
| 4661 | { adjust(); return ARROW_LEFT; } | 4663 | { adjust(); return ARROW_LEFT; } |
| 4662 | YY_BREAK | 4664 | YY_BREAK |
| 4663 | case 96: | 4665 | case 96: |
| 4664 | YY_RULE_SETUP | 4666 | YY_RULE_SETUP |
| 4665 | #line 276 "core/chuck.lex" | 4667 | #line 277 "core/chuck.lex" |
| 4666 | { adjust(); yylval.ival=htol(yytext); return NUM; } | 4668 | { adjust(); yylval.ival=htol(yytext); return NUM; } |
| 4667 | YY_BREAK | 4669 | YY_BREAK |
| 4668 | case 97: | 4670 | case 97: |
| 4669 | YY_RULE_SETUP | 4671 | YY_RULE_SETUP |
| 4670 | #line 277 "core/chuck.lex" | 4672 | #line 278 "core/chuck.lex" |
| 4671 | { adjust(); yylval.ival=atoi(yytext); return NUM; } | 4673 | { adjust(); yylval.ival=atoi(yytext); return NUM; } |
| 4672 | YY_BREAK | 4674 | YY_BREAK |
| 4673 | case 98: | 4675 | case 98: |
| 4674 | YY_RULE_SETUP | 4676 | YY_RULE_SETUP |
| 4675 | #line 278 "core/chuck.lex" | 4677 | #line 279 "core/chuck.lex" |
| 4676 | { adjust(); yylval.ival=atoi(yytext); return NUM; } | 4678 | { adjust(); yylval.ival=atoi(yytext); return NUM; } |
| 4677 | YY_BREAK | 4679 | YY_BREAK |
| 4678 | case 99: | 4680 | case 99: |
| 4679 | YY_RULE_SETUP | 4681 | YY_RULE_SETUP |
| 4680 | #line 279 "core/chuck.lex" | 4682 | #line 280 "core/chuck.lex" |
| 4681 | { adjust(); yylval.fval=atof(yytext); return FLOAT; } | 4683 | { adjust(); yylval.fval=atof(yytext); return FLOAT; } |
| 4682 | YY_BREAK | 4684 | YY_BREAK |
| 4683 | case 100: | 4685 | case 100: |
| 4684 | YY_RULE_SETUP | 4686 | YY_RULE_SETUP |
| 4685 | #line 280 "core/chuck.lex" | 4687 | #line 281 "core/chuck.lex" |
| 4686 | { adjust(); yylval.sval=alloc_str(yytext); return ID; } | 4688 | { adjust(); yylval.sval=alloc_str(yytext); return ID; } |
| 4687 | YY_BREAK | 4689 | YY_BREAK |
| 4688 | case 101: | 4690 | case 101: |
| 4689 | /* rule 101 can match eol */ | 4691 | /* rule 101 can match eol */ |
| 4690 | YY_RULE_SETUP | 4692 | YY_RULE_SETUP |
| 4691 | #line 281 "core/chuck.lex" | 4693 | #line 282 "core/chuck.lex" |
| 4692 | { adjust(); yylval.sval=alloc_str(strip_lit(yytext)); return STRING_LIT; } | 4694 | { adjust(); yylval.sval=alloc_str(strip_lit(yytext)); return STRING_LIT; } |
| 4693 | YY_BREAK | 4695 | YY_BREAK |
| 4694 | case 102: | 4696 | case 102: |
| 4695 | /* rule 102 can match eol */ | 4697 | /* rule 102 can match eol */ |
| 4696 | YY_RULE_SETUP | 4698 | YY_RULE_SETUP |
| 4697 | #line 282 "core/chuck.lex" | 4699 | #line 283 "core/chuck.lex" |
| 4698 | { adjust(); yylval.sval=alloc_str(strip_lit(yytext)); return STRING_LIT; } | 4700 | { adjust(); yylval.sval=alloc_str(strip_lit(yytext)); return STRING_LIT; } |
| 4699 | YY_BREAK | 4701 | YY_BREAK |
| 4700 | case 103: | 4702 | case 103: |
| 4701 | /* rule 103 can match eol */ | 4703 | /* rule 103 can match eol */ |
| 4702 | YY_RULE_SETUP | 4704 | YY_RULE_SETUP |
| 4703 | #line 283 "core/chuck.lex" | 4705 | #line 284 "core/chuck.lex" |
| 4704 | { adjust(); yylval.sval=alloc_str(strip_lit(yytext)); return CHAR_LIT; } | 4706 | { adjust(); yylval.sval=alloc_str(strip_lit(yytext)); return CHAR_LIT; } |
| 4705 | YY_BREAK | 4707 | YY_BREAK |
| 4706 | case 104: | 4708 | case 104: |
| 4707 | YY_RULE_SETUP | 4709 | YY_RULE_SETUP |
| 4708 | #line 285 "core/chuck.lex" | 4710 | #line 286 "core/chuck.lex" |
| 4709 | { adjust(); EM_error( EM_tokPos, "illegal token" ); } | 4711 | { adjust(); EM_error( EM_tokPos, "illegal token" ); } |
| 4710 | YY_BREAK | 4712 | YY_BREAK |
| 4711 | case 105: | 4713 | case 105: |
| 4712 | YY_RULE_SETUP | 4714 | YY_RULE_SETUP |
| 4713 | #line 287 "core/chuck.lex" | 4715 | #line 288 "core/chuck.lex" |
| 4714 | ECHO; | 4716 | ECHO; |
| 4715 | YY_BREAK | 4717 | YY_BREAK |
| 4716 | #line 1571 "core/chuck.yy.c" | 4718 | #line 1572 "core/chuck.yy.c" |
| 4717 | case YY_STATE_EOF(INITIAL): | 4719 | case YY_STATE_EOF(INITIAL): |
| 4718 | yyterminate(); | 4720 | yyterminate(); |
| 4719 | 4721 | ||
| @@ -5718,7 +5720,7 @@ void yyfree (void * ptr ) · 998 unmodified lines | |||
| 5718 | 5720 | ||
| 5719 | #define YYTABLES_NAME "yytables" | 5721 | #define YYTABLES_NAME "yytables" |
| 5720 | 5722 | ||
| 5721 | #line 287 "core/chuck.lex" | 5723 | #line 288 "core/chuck.lex" |
| 5722 | 5724 | ||
| 5723 | 5725 | ||
| 5724 | /* | 5726 | /* |
| @@ -443,31 +443,33 @@ CK_DLL_CTRL( WvIn_ctrl_path ); · 442 unmodified lines | |||
| 443 | CK_DLL_CGET( WvIn_cget_rate ); | 443 | CK_DLL_CGET( WvIn_cget_rate ); |
| 444 | CK_DLL_CGET( WvIn_cget_path ); | 444 | CK_DLL_CGET( WvIn_cget_path ); |
| 445 | 445 | ||
| 446 | #ifndef __DISABLE_WVOUT__ | ||
| 446 | // WvOut | 447 | // WvOut |
| 447 | //CK_DLL_CTOR( WvOut_ctor ); | 448 | CK_DLL_CTOR( WvOut_ctor ); |
| 448 | //CK_DLL_DTOR( WvOut_dtor ); | 449 | CK_DLL_DTOR( WvOut_dtor ); |
| 449 | //CK_DLL_TICK( WvOut_tick ); | 450 | CK_DLL_TICK( WvOut_tick ); |
| 450 | //CK_DLL_TICKF( WvOut2_tickf ); | 451 | CK_DLL_TICKF( WvOut2_tickf ); |
| 451 | //CK_DLL_PMSG( WvOut_pmsg ); | 452 | CK_DLL_PMSG( WvOut_pmsg ); |
| 452 | //CK_DLL_CTRL( WvOut_ctrl_filename ); | 453 | CK_DLL_CTRL( WvOut_ctrl_filename ); |
| 453 | //CK_DLL_CTRL( WvOut_ctrl_matFilename ); | 454 | CK_DLL_CTRL( WvOut_ctrl_matFilename ); |
| 454 | //CK_DLL_CTRL( WvOut2_ctrl_matFilename ); | 455 | CK_DLL_CTRL( WvOut2_ctrl_matFilename ); |
| 455 | //CK_DLL_CTRL( WvOut_ctrl_sndFilename ); | 456 | CK_DLL_CTRL( WvOut_ctrl_sndFilename ); |
| 456 | //CK_DLL_CTRL( WvOut2_ctrl_sndFilename ); | 457 | CK_DLL_CTRL( WvOut2_ctrl_sndFilename ); |
| 457 | //CK_DLL_CTRL( WvOut_ctrl_wavFilename ); | 458 | CK_DLL_CTRL( WvOut_ctrl_wavFilename ); |
| 458 | //CK_DLL_CTRL( WvOut2_ctrl_wavFilename ); | 459 | CK_DLL_CTRL( WvOut2_ctrl_wavFilename ); |
| 459 | //CK_DLL_CTRL( WvOut_ctrl_rawFilename ); | 460 | CK_DLL_CTRL( WvOut_ctrl_rawFilename ); |
| 460 | //CK_DLL_CTRL( WvOut2_ctrl_rawFilename ); | 461 | CK_DLL_CTRL( WvOut2_ctrl_rawFilename ); |
| 461 | //CK_DLL_CTRL( WvOut_ctrl_aifFilename ); | 462 | CK_DLL_CTRL( WvOut_ctrl_aifFilename ); |
| 462 | //CK_DLL_CTRL( WvOut2_ctrl_aifFilename ); | 463 | CK_DLL_CTRL( WvOut2_ctrl_aifFilename ); |
| 463 | //CK_DLL_CTRL( WvOut_ctrl_closeFile ); | 464 | CK_DLL_CTRL( WvOut_ctrl_closeFile ); |
| 464 | //CK_DLL_CTRL( WvOut_ctrl_record ); | 465 | CK_DLL_CTRL( WvOut_ctrl_record ); |
| 465 | //CK_DLL_CTRL( WvOut_ctrl_autoPrefix ); | 466 | CK_DLL_CTRL( WvOut_ctrl_autoPrefix ); |
| 466 | //CK_DLL_CGET( WvOut_cget_filename ); | 467 | CK_DLL_CGET( WvOut_cget_filename ); |
| 467 | //CK_DLL_CGET( WvOut_cget_record ); | 468 | CK_DLL_CGET( WvOut_cget_record ); |
| 468 | //CK_DLL_CGET( WvOut_cget_autoPrefix ); | 469 | CK_DLL_CGET( WvOut_cget_autoPrefix ); |
| 469 | //CK_DLL_CTRL( WvOut_ctrl_fileGain ); | 470 | CK_DLL_CTRL( WvOut_ctrl_fileGain ); |
| 470 | //CK_DLL_CGET( WvOut_cget_fileGain ); | 471 | CK_DLL_CGET( WvOut_cget_fileGain ); |
| 472 | #endif | ||
| 471 | 473 | ||
| 472 | 474 | ||
| 473 | // FM | 475 | // FM |
| @@ -4375,125 +4377,127 @@ by Perry R. Cook and Gary P. Scavone, 1995 - 2002."; · 3901 unmodified lines | |||
| 4375 | // end the class import | 4377 | // end the class import |
| 4376 | type_engine_import_class_end( env ); | 4378 | type_engine_import_class_end( env ); |
| 4377 | 4379 | ||
| 4378 | 4380 | ||
| 4381 | #ifndef __DISABLE_WVOUT__ | ||
| 4379 | //------------------------------------------------------------------------ | 4382 | //------------------------------------------------------------------------ |
| 4380 | // begin WvOut ugen | 4383 | // begin WvOut ugen |
| 4381 | //------------------------------------------------------------------------ | 4384 | //------------------------------------------------------------------------ |
| 4382 | // | 4385 | |
| 4383 | // doc = "This class provides output support for various audio file formats. It also serves as a base class for 'realtime' streaming subclasses.\n\ | 4386 | doc = "This class provides output support for various audio file formats. It also serves as a base class for 'realtime' streaming subclasses.\n\ |
| 4384 | //\n\ | 4387 | \n\ |
| 4385 | //WvOut writes samples to an audio file. It supports multi-channel data in interleaved format. It is important to distinguish the `tick()` methods, which output single samples to all channels in a sample frame, from the `tickFrame()` method, which takes a pointer to multi-channel sample frame data.\n\ | 4388 | WvOut writes samples to an audio file. It supports multi-channel data in interleaved format. It is important to distinguish the `tick()` methods, which output single samples to all channels in a sample frame, from the `tickFrame()` method, which takes a pointer to multi-channel sample frame data.\n\ |
| 4386 | //\n\ | 4389 | \n\ |
| 4387 | //WvOut currently supports WAV, AIFF, AIFC, SND (AU), MAT-file (Matlab), and STK RAW file formats. Signed integer (8-, 16-, and 32-bit) and floating- point (32- and 64-bit) data types are supported. STK RAW files use 16-bit integers by definition. MAT-files will always be written as 64-bit floats. If a data type specification does not match the specified file type, the data type will automatically be modified. Uncompressed data types are not supported.\n\ | 4390 | WvOut currently supports WAV, AIFF, AIFC, SND (AU), MAT-file (Matlab), and STK RAW file formats. Signed integer (8-, 16-, and 32-bit) and floating- point (32- and 64-bit) data types are supported. STK RAW files use 16-bit integers by definition. MAT-files will always be written as 64-bit floats. If a data type specification does not match the specified file type, the data type will automatically be modified. Uncompressed data types are not supported.\n\ |
| 4388 | //\n\ | 4391 | \n\ |
| 4389 | //Currently, WvOut is non-interpolating and the output rate is always `Stk::sampleRate()`.\n\ | 4392 | Currently, WvOut is non-interpolating and the output rate is always `Stk::sampleRate()`.\n\ |
| 4390 | //\n\ | 4393 | \n\ |
| 4391 | //by Perry R. Cook and Gary P. Scavone, 1995 - 2002."; | 4394 | by Perry R. Cook and Gary P. Scavone, 1995 - 2002."; |
| 4392 | // | 4395 | |
| 4393 | // if( !type_engine_import_ugen_begin( env, "WvOut", "UGen", env->global(), | 4396 | if( !type_engine_import_ugen_begin( env, "WvOut", "UGen", env->global(), |
| 4394 | // WvOut_ctor, WvOut_dtor, | 4397 | WvOut_ctor, WvOut_dtor, |
| 4395 | // WvOut_tick, WvOut_pmsg, doc.c_str() ) ) return FALSE; | 4398 | WvOut_tick, WvOut_pmsg, doc.c_str() ) ) return FALSE; |
| 4396 | // | 4399 | |
| 4397 | // //member variable | 4400 | //member variable |
| 4398 | // WvOut_offset_data = type_engine_import_mvar ( env, "int", "@WvOut_data", FALSE ); | 4401 | WvOut_offset_data = type_engine_import_mvar ( env, "int", "@WvOut_data", FALSE ); |
| 4399 | // if( WvOut_offset_data == CK_INVALID_OFFSET ) goto error; | 4402 | if( WvOut_offset_data == CK_INVALID_OFFSET ) goto error; |
| 4400 | // | 4403 | |
| 4401 | // func = make_new_mfun( "string", "matFilename", WvOut_ctrl_matFilename ); //!open matlab file for writing | 4404 | func = make_new_mfun( "string", "matFilename", WvOut_ctrl_matFilename ); //!open matlab file for writing |
| 4402 | // func->add_arg( "string", "value" ); | 4405 | func->add_arg( "string", "value" ); |
| 4403 | // func->doc = "Open MatLab file for writing."; | 4406 | func->doc = "Open MatLab file for writing."; |
| 4404 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4407 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4405 | // | 4408 | |
| 4406 | // func = make_new_mfun( "string", "sndFilename", WvOut_ctrl_sndFilename ); //!open snd file for writing | 4409 | func = make_new_mfun( "string", "sndFilename", WvOut_ctrl_sndFilename ); //!open snd file for writing |
| 4407 | // func->add_arg( "string", "value" ); | 4410 | func->add_arg( "string", "value" ); |
| 4408 | // func->doc = "Open SND file for writing."; | 4411 | func->doc = "Open SND file for writing."; |
| 4409 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4412 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4410 | // | 4413 | |
| 4411 | // func = make_new_mfun( "string", "wavFilename", WvOut_ctrl_wavFilename ); //!open WAVE file for writing | 4414 | func = make_new_mfun( "string", "wavFilename", WvOut_ctrl_wavFilename ); //!open WAVE file for writing |
| 4412 | // func->add_arg( "string", "value" ); | 4415 | func->add_arg( "string", "value" ); |
| 4413 | // func->doc = "Open WAVE file for writing."; | 4416 | func->doc = "Open WAVE file for writing."; |
| 4414 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4417 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4415 | // | 4418 | |
| 4416 | // func = make_new_mfun( "string", "rawFilename", WvOut_ctrl_rawFilename ); //!open raw file for writing | 4419 | func = make_new_mfun( "string", "rawFilename", WvOut_ctrl_rawFilename ); //!open raw file for writing |
| 4417 | // func->add_arg( "string", "value" ); | 4420 | func->add_arg( "string", "value" ); |
| 4418 | // func->doc = "Open a raw file for writing."; | 4421 | func->doc = "Open a raw file for writing."; |
| 4419 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4422 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4420 | // | 4423 | |
| 4421 | // func = make_new_mfun( "string", "aifFilename", WvOut_ctrl_aifFilename ); //!open AIFF file for writing | 4424 | func = make_new_mfun( "string", "aifFilename", WvOut_ctrl_aifFilename ); //!open AIFF file for writing |
| 4422 | // func->add_arg( "string", "value" ); | 4425 | func->add_arg( "string", "value" ); |
| 4423 | // func->doc = "Open an AIFF file for writing."; | 4426 | func->doc = "Open an AIFF file for writing."; |
| 4424 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4427 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4425 | // | 4428 | |
| 4426 | // func = make_new_mfun( "string", "filename", WvOut_cget_filename ); //!get filename | 4429 | func = make_new_mfun( "string", "filename", WvOut_cget_filename ); //!get filename |
| 4427 | // func->doc = "Get filename."; | 4430 | func->doc = "Get filename."; |
| 4428 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4431 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4429 | // | 4432 | |
| 4430 | // func = make_new_mfun( "int", "record", WvOut_ctrl_record ); // !start/stop output | 4433 | func = make_new_mfun( "int", "record", WvOut_ctrl_record ); // !start/stop output |
| 4431 | // func->add_arg( "int", "value" ); | 4434 | func->add_arg( "int", "value" ); |
| 4432 | // func->doc = "Start/stop output."; | 4435 | func->doc = "Start/stop output."; |
| 4433 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4436 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4434 | // | 4437 | |
| 4435 | // func = make_new_mfun( "int", "record", WvOut_cget_record ); // !start/stop output | 4438 | func = make_new_mfun( "int", "record", WvOut_cget_record ); // !start/stop output |
| 4436 | // func->doc = "Start/stop output."; | 4439 | func->doc = "Start/stop output."; |
| 4437 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4440 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4438 | // | 4441 | |
| 4439 | // func = make_new_mfun( "string", "closeFile", WvOut_ctrl_closeFile ); //! close file properly | 4442 | func = make_new_mfun( "string", "closeFile", WvOut_ctrl_closeFile ); //! close file properly |
| 4440 | // func->add_arg( "string", "value" ); | 4443 | func->add_arg( "string", "value" ); |
| 4441 | // func->doc = "Close the file properly."; | 4444 | func->doc = "Close the file properly."; |
| 4442 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4445 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4443 | // | 4446 | |
| 4444 | // func = make_new_mfun( "string", "closeFile", WvOut_ctrl_closeFile ); //! close file properly | 4447 | func = make_new_mfun( "string", "closeFile", WvOut_ctrl_closeFile ); //! close file properly |
| 4445 | // func->doc = "Close the file properly."; | 4448 | func->doc = "Close the file properly."; |
| 4446 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4449 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4447 | // | 4450 | |
| 4448 | // func = make_new_mfun( "string", "autoPrefix", WvOut_ctrl_autoPrefix ); //! set/get auto prefix string | 4451 | func = make_new_mfun( "string", "autoPrefix", WvOut_ctrl_autoPrefix ); //! set/get auto prefix string |
| 4449 | // func->add_arg( "string", "value" ); | 4452 | func->add_arg( "string", "value" ); |
| 4450 | // func->doc = "Set auto prefix string."; | 4453 | func->doc = "Set auto prefix string."; |
| 4451 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4454 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4452 | // | 4455 | |
| 4453 | // func = make_new_mfun( "string", "autoPrefix", WvOut_cget_autoPrefix ); //! set/get auto prefix string | 4456 | func = make_new_mfun( "string", "autoPrefix", WvOut_cget_autoPrefix ); //! set/get auto prefix string |
| 4454 | // func->doc = "Get auto prefix string."; | 4457 | func->doc = "Get auto prefix string."; |
| 4455 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4458 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4456 | // | 4459 | |
| 4457 | // func = make_new_mfun( "float", "fileGain", WvOut_ctrl_fileGain ); //! set/get auto prefix string | 4460 | func = make_new_mfun( "float", "fileGain", WvOut_ctrl_fileGain ); //! set/get auto prefix string |
| 4458 | // func->add_arg( "float", "value" ); | 4461 | func->add_arg( "float", "value" ); |
| 4459 | // func->doc = "Set file gain."; | 4462 | func->doc = "Set file gain."; |
| 4460 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4463 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4461 | // | 4464 | |
| 4462 | // func = make_new_mfun( "float", "fileGain", WvOut_cget_fileGain ); //! set/get auto prefix string | 4465 | func = make_new_mfun( "float", "fileGain", WvOut_cget_fileGain ); //! set/get auto prefix string |
| 4463 | // func->doc = "Get file gain."; | 4466 | func->doc = "Get file gain."; |
| 4464 | // if( !type_engine_import_mfun( env, func ) ) goto error; | 4467 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 4465 | // | 4468 | |
| 4466 | // // end the class import | 4469 | // end the class import |
| 4467 | // type_engine_import_class_end( env ); | 4470 | type_engine_import_class_end( env ); |
| 4468 | // | ||
| 4469 | // | ||
| 4470 | // if( !type_engine_import_ugen_begin( env, "WvOut2", "WvOut", env->global(), | ||
| 4471 | // NULL, NULL, | ||
| 4472 | // NULL, WvOut2_tickf, WvOut_pmsg, 2, 2 ) ) return FALSE; | ||
| 4473 | // | ||
| 4474 | // func = make_new_mfun( "string", "matFilename", WvOut2_ctrl_matFilename ); //!open matlab file for writing | ||
| 4475 | // func->add_arg( "string", "value" ); | ||
| 4476 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 4477 | // | ||
| 4478 | // func = make_new_mfun( "string", "sndFilename", WvOut2_ctrl_sndFilename ); //!open snd file for writing | ||
| 4479 | // func->add_arg( "string", "value" ); | ||
| 4480 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 4481 | // | ||
| 4482 | // func = make_new_mfun( "string", "wavFilename", WvOut2_ctrl_wavFilename ); //!open WAVE file for writing | ||
| 4483 | // func->add_arg( "string", "value" ); | ||
| 4484 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 4485 | // | ||
| 4486 | // func = make_new_mfun( "string", "rawFilename", WvOut2_ctrl_rawFilename ); //!open raw file for writing | ||
| 4487 | // func->add_arg( "string", "value" ); | ||
| 4488 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 4489 | // | ||
| 4490 | // func = make_new_mfun( "string", "aifFilename", WvOut2_ctrl_aifFilename ); //!open AIFF file for writing | ||
| 4491 | // func->add_arg( "string", "value" ); | ||
| 4492 | // if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 4493 | // | ||
| 4494 | // // end the class import | ||
| 4495 | // type_engine_import_class_end( env ); | ||
| 4496 | 4471 | ||
| 4472 | |||
| 4473 | if( !type_engine_import_ugen_begin( env, "WvOut2", "WvOut", env->global(), | ||
| 4474 | NULL, NULL, | ||
| 4475 | NULL, WvOut2_tickf, WvOut_pmsg, 2, 2 ) ) return FALSE; | ||
| 4476 | |||
| 4477 | func = make_new_mfun( "string", "matFilename", WvOut2_ctrl_matFilename ); //!open matlab file for writing | ||
| 4478 | func->add_arg( "string", "value" ); | ||
| 4479 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 4480 | |||
| 4481 | func = make_new_mfun( "string", "sndFilename", WvOut2_ctrl_sndFilename ); //!open snd file for writing | ||
| 4482 | func->add_arg( "string", "value" ); | ||
| 4483 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 4484 | |||
| 4485 | func = make_new_mfun( "string", "wavFilename", WvOut2_ctrl_wavFilename ); //!open WAVE file for writing | ||
| 4486 | func->add_arg( "string", "value" ); | ||
| 4487 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 4488 | |||
| 4489 | func = make_new_mfun( "string", "rawFilename", WvOut2_ctrl_rawFilename ); //!open raw file for writing | ||
| 4490 | func->add_arg( "string", "value" ); | ||
| 4491 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 4492 | |||
| 4493 | func = make_new_mfun( "string", "aifFilename", WvOut2_ctrl_aifFilename ); //!open AIFF file for writing | ||
| 4494 | func->add_arg( "string", "value" ); | ||
| 4495 | if( !type_engine_import_mfun( env, func ) ) goto error; | ||
| 4496 | |||
| 4497 | // end the class import | ||
| 4498 | type_engine_import_class_end( env ); | ||
| 4499 | #endif //__DISABLE_WVOUT__ | ||
| 4500 | |||
| 4497 | 4501 | ||
| 4498 | //------------------------------------------------------------------------ | 4502 | //------------------------------------------------------------------------ |
| 4499 | // begin BLT (BandLtd) | 4503 | // begin BLT (BandLtd) |
| @@ -17820,11 +17824,13 @@ MY_FLOAT *WvIn :: tickFrame(MY_FLOAT *frameVector, unsigned int frames) · 13320 unmodified lines | |||
| 17820 | /***************************************************/ | 17824 | /***************************************************/ |
| 17821 | 17825 | ||
| 17822 | 17826 | ||
| 17823 | //const WvOut::FILE_TYPE WvOut :: WVOUT_RAW = 1; | 17827 | #ifndef __DISABLE_WVOUT__ |
| 17824 | //const WvOut::FILE_TYPE WvOut :: WVOUT_WAV = 2; | 17828 | const WvOut::FILE_TYPE WvOut :: WVOUT_RAW = 1; |
| 17825 | //const WvOut::FILE_TYPE WvOut :: WVOUT_SND = 3; | 17829 | const WvOut::FILE_TYPE WvOut :: WVOUT_WAV = 2; |
| 17826 | //const WvOut::FILE_TYPE WvOut :: WVOUT_AIF = 4; | 17830 | const WvOut::FILE_TYPE WvOut :: WVOUT_SND = 3; |
| 17827 | //const WvOut::FILE_TYPE WvOut :: WVOUT_MAT = 5; | 17831 | const WvOut::FILE_TYPE WvOut :: WVOUT_AIF = 4; |
| 17832 | const WvOut::FILE_TYPE WvOut :: WVOUT_MAT = 5; | ||
| 17833 | #endif | ||
| 17828 | 17834 | ||
| 17829 | // WAV header structure. See ftp://ftp.isi.edu/in-notes/rfc2361.txt | 17835 | // WAV header structure. See ftp://ftp.isi.edu/in-notes/rfc2361.txt |
| 17830 | // for information regarding format codes. | 17836 | // for information regarding format codes. |
| @@ -17884,811 +17890,815 @@ struct mathdr { · 53 unmodified lines | |||
| 17884 | // There's more, but it's of variable length | 17890 | // There's more, but it's of variable length |
| 17885 | }; | 17891 | }; |
| 17886 | 17892 | ||
| 17887 | //size_t WvOut::fwrite(const void * ptr, size_t size, size_t nitems, FILE * stream) | ||
| 17888 | //{ | ||
| 17889 | // if(asyncIO) | ||
| 17890 | // return asyncWriteThread->fwrite(ptr, size, nitems, stream); | ||
| 17891 | // else | ||
| 17892 | // return ::fwrite(ptr, size, nitems, stream); | ||
| 17893 | //} | ||
| 17894 | // | ||
| 17895 | //int WvOut::fseek(FILE *stream, long offset, int whence) | ||
| 17896 | //{ | ||
| 17897 | // if(asyncIO) | ||
| 17898 | // return asyncWriteThread->fseek(stream, offset, whence); | ||
| 17899 | // else | ||
| 17900 | // return ::fseek(stream, offset, whence); | ||
| 17901 | //} | ||
| 17902 | // | ||
| 17903 | //int WvOut::fflush(FILE *stream) | ||
| 17904 | //{ | ||
| 17905 | // if(asyncIO) | ||
| 17906 | // return asyncWriteThread->fflush(stream); | ||
| 17907 | // else | ||
| 17908 | // return ::fflush(stream); | ||
| 17909 | //} | ||
| 17910 | // | ||
| 17911 | //int WvOut::fclose(FILE *stream) | ||
| 17912 | //{ | ||
| 17913 | // if(asyncIO) | ||
| 17914 | // return asyncWriteThread->fclose(stream); | ||
| 17915 | // else | ||
| 17916 | // return ::fclose(stream); | ||
| 17917 | //} | ||
| 17918 | // | ||
| 17919 | //size_t WvOut::fread(void *ptr, size_t size, size_t nitems, FILE *stream) | ||
| 17920 | //{ | ||
| 17921 | // // can't read asynchronously (yet) | ||
| 17922 | // assert(0); | ||
| 17923 | // return 0; | ||
| 17924 | //} | ||
| 17925 | // | ||
| 17926 | //WvOut :: WvOut() | ||
| 17927 | //{ | ||
| 17928 | // init(); | ||
| 17929 | //} | ||
| 17930 | // | ||
| 17931 | //WvOut::WvOut( const char *fileName, unsigned int nChannels, FILE_TYPE type, Stk::STK_FORMAT format ) | ||
| 17932 | //{ | ||
| 17933 | // init(); | ||
| 17934 | // openFile( fileName, nChannels, type, format ); | ||
| 17935 | //} | ||
| 17936 | // | ||
| 17937 | //WvOut :: ~WvOut() | ||
| 17938 | //{ | ||
| 17939 | // closeFile(); | ||
| 17940 | // | ||
| 17941 | // if (data) | ||
| 17942 | // delete [] data; | ||
| 17943 | //} | ||
| 17944 | // | ||
| 17945 | //void WvOut :: init() | ||
| 17946 | //{ | ||
| 17947 | // fd = 0; | ||
| 17948 | // data = 0; | ||
| 17949 | // fileType = 0; | ||
| 17950 | // dataType = 0; | ||
| 17951 | // channels = 0; | ||
| 17952 | // counter = 0; | ||
| 17953 | // totalCount = 0; | ||
| 17954 | // //m_filename[0] = '\0'; | ||
| 17955 | // start = TRUE; | ||
| 17956 | // flush = 0; | ||
| 17957 | // fileGain = 1; | ||
| 17958 | // | ||
| 17959 | // // spencer: added as flag for off-thread write | ||
| 17960 | // asyncIO = FALSE; | ||
| 17961 | // asyncWriteThread = NULL; | ||
| 17962 | //} | ||
| 17963 | // | ||
| 17964 | //void WvOut :: closeFile( void ) | ||
| 17965 | //{ | ||
| 17966 | // if( fd ) { | ||
| 17967 | // // If there's an existing file, close it first. | ||
| 17968 | // writeData( counter ); | ||
| 17969 | // | ||
| 17970 | // if ( fileType == WVOUT_RAW ) | ||
| 17971 | // fclose( fd ); | ||
| 17972 | // else if ( fileType == WVOUT_WAV ) | ||
| 17973 | // closeWavFile(); | ||
| 17974 | // else if ( fileType == WVOUT_SND ) | ||
| 17975 | // closeSndFile(); | ||
| 17976 | // else if ( fileType == WVOUT_AIF ) | ||
| 17977 | // closeAifFile(); | ||
| 17978 | // else if ( fileType == WVOUT_MAT ) | ||
| 17979 | // closeMatFile(); | ||
| 17980 | // fd = 0; | ||
| 17981 | // | ||
| 17982 | // // printf("%f Seconds Computed\n\n", getTime() ); | ||
| 17983 | // totalCount = 0; | ||
| 17984 | // } | ||
| 17985 | // | ||
| 17986 | // str_filename.set( "" ); | ||
| 17987 | // //m_filename[0] = '\0'; | ||
| 17988 | //} | ||
| 17989 | // | ||
| 17990 | //void WvOut :: openFile( const char *fileName, unsigned int nChannels, WvOut::FILE_TYPE type, Stk::STK_FORMAT format ) | ||
| 17991 | //{ | ||
| 17992 | // closeFile(); | ||
| 17993 | // str_filename.set( fileName ); | ||
| 17994 | // //strncpy( m_filename, fileName, 255); | ||
| 17995 | // //if ( strlen( fileName ) > 255 ) | ||
| 17996 | // // m_filename[255] = '\0'; | ||
| 17997 | // | ||
| 17998 | // if ( nChannels < 1 ) { | ||
| 17999 | // sprintf(msg, "[chuck](via WvOut): the channels argument must be greater than zero!"); | ||
| 18000 | // handleError( msg, StkError::FUNCTION_ARGUMENT ); | ||
| 18001 | // } | ||
| 18002 | // | ||
| 18003 | // unsigned int lastChannels = channels; | ||
| 18004 | // channels = nChannels; | ||
| 18005 | // fileType = type; | ||
| 18006 | // | ||
| 18007 | // if ( format != STK_SINT8 && format != STK_SINT16 && | ||
| 18008 | // format != STK_SINT32 && format != MY_FLOAT32 && | ||
| 18009 | // format != MY_FLOAT64 ) { | ||
| 18010 | // sprintf( msg, "[chuck](via WvOut): Unknown data type specified (%ld).", format ); | ||
| 18011 | // handleError(msg, StkError::FUNCTION_ARGUMENT); | ||
| 18012 | // } | ||
| 18013 | // dataType = format; | ||
| 18014 | // | ||
| 18015 | // bool result = false; | ||
| 18016 | // if ( fileType == WVOUT_RAW ) { | ||
| 18017 | // if ( channels != 1 ) { | ||
| 18018 | // sprintf(msg, "[chuck](via WvOut): STK RAW files are, by definition, always monaural (channels = %d not supported)!", nChannels); | ||
| 18019 | // handleError( msg, StkError::FUNCTION_ARGUMENT ); | ||
| 18020 | // } | ||
| 18021 | // result = setRawFile( fileName ); | ||
| 18022 | // } | ||
| 18023 | // else if ( fileType == WVOUT_WAV ) | ||
| 18024 | // result = setWavFile( fileName ); | ||
| 18025 | // else if ( fileType == WVOUT_SND ) | ||
| 18026 | // result = setSndFile( fileName ); | ||
| 18027 | // else if ( fileType == WVOUT_AIF ) | ||
| 18028 | // result = setAifFile( fileName ); | ||
| 18029 | // else if ( fileType == WVOUT_MAT ) | ||
| 18030 | // result = setMatFile( fileName ); | ||
| 18031 | // else { | ||
| 18032 | // sprintf(msg, "[chuck](via WvOut): Unknown file type specified (%ld).", fileType); | ||
| 18033 | // handleError(msg, StkError::FUNCTION_ARGUMENT); | ||
| 18034 | // } | ||
| 18035 | // | ||
| 18036 | // if ( result == false ) | ||
| 18037 | // { | ||
| 18038 | // //closeFile(); | ||
| 18039 | // handleError(msg, StkError::FILE_ERROR); | ||
| 18040 | // // handleError( msg, StkError::WARNING ); | ||
| 18041 | // // return; | ||
| 18042 | // } | ||
| 18043 | // | ||
| 18044 | // // Allocate new memory if necessary. | ||
| 18045 | // if ( lastChannels < channels ) { | ||
| 18046 | // if ( data ) delete [] data; | ||
| 18047 | // data = (MY_FLOAT *) new MY_FLOAT[BUFFER_SIZE*channels]; | ||
| 18048 | // } | ||
| 18049 | // counter = 0; | ||
| 18050 | //} | ||
| 18051 | // | ||
| 18052 | //bool WvOut :: setRawFile( const char *fileName ) | ||
| 18053 | //{ | ||
| 18054 | // char name[128]; | ||
| 18055 | // strncpy(name, fileName, 128); | ||
| 18056 | // if ( strstr(name, ".raw") == NULL) strcat(name, ".raw"); | ||
| 18057 | // fd = fopen(name, "wb"); | ||
| 18058 | // if ( !fd ) { | ||
| 18059 | // sprintf(msg, "[chuck](via WvOut): Could not create RAW file: %s", name); | ||
| 18060 | // return false; | ||
| 18061 | // } | ||
| 18062 | // | ||
| 18063 | // if ( dataType != STK_SINT16 ) { | ||
| 18064 | // dataType = STK_SINT16; | ||
| 18065 | // sprintf(msg, "[chuck](via WvOut): Using 16-bit signed integer data format for file %s.", name); | ||
| 18066 | // handleError(msg, StkError::WARNING); | ||
| 18067 | // } | ||
| 18068 | // | ||
| 18069 | // byteswap = false; | ||
| 18070 | // if( little_endian ) | ||
| 18071 | // byteswap = true; | ||
| 18072 | // | ||
| 18073 | // // printf("\nCreating RAW file: %s\n", name); | ||
| 18074 | // return true; | ||
| 18075 | //} | ||
| 18076 | // | ||
| 18077 | //bool WvOut :: setWavFile( const char *fileName ) | ||
| 18078 | //{ | ||
| 18079 | // char name[128]; | ||
| 18080 | // strncpy(name, fileName, 128); | ||
| 18081 | // if( strstr(name, ".wav") == NULL ) strcat(name, ".wav"); | ||
| 18082 | // fd = fopen( name, "wb" ); | ||
| 18083 | // if( !fd ) { | ||
| 18084 | // sprintf(msg, "[chuck](via WvOut): Could not create WAV file: %s", name); | ||
| 18085 | // return false; | ||
| 18086 | // } | ||
| 18087 | // | ||
| 18088 | // struct wavhdr hdr = {"RIF", 44, "WAV", "fmt", 16, 1, 1, | ||
| 18089 | // (SINT32) Stk::sampleRate(), 0, 2, 16, "dat", 0}; | ||
| 18090 | // hdr.riff[3] = 'F'; | ||
| 18091 | // hdr.wave[3] = 'E'; | ||
| 18092 | // hdr.fmt[3] = ' '; | ||
| 18093 | // hdr.data[3] = 'a'; | ||
| 18094 | // hdr.num_chans = (SINT16) channels; | ||
| 18095 | // if ( dataType == STK_SINT8 ) | ||
| 18096 | // hdr.bits_per_samp = 8; | ||
| 18097 | // else if ( dataType == STK_SINT16 ) | ||
| 18098 | // hdr.bits_per_samp = 16; | ||
| 18099 | // else if ( dataType == STK_SINT32 ) | ||
| 18100 | // hdr.bits_per_samp = 32; | ||
| 18101 | // else if ( dataType == MY_FLOAT32 ) { | ||
| 18102 | // hdr.format_tag = 3; | ||
| 18103 | // hdr.bits_per_samp = 32; | ||
| 18104 | // } | ||
| 18105 | // else if ( dataType == MY_FLOAT64 ) { | ||
| 18106 | // hdr.format_tag = 3; | ||
| 18107 | // hdr.bits_per_samp = 64; | ||
| 18108 | // } | ||
| 18109 | // hdr.bytes_per_samp = (SINT16) (channels * hdr.bits_per_samp / 8); | ||
| 18110 | // hdr.bytes_per_sec = (SINT32) (hdr.sample_rate * hdr.bytes_per_samp); | ||
| 18111 | // | ||
| 18112 | // byteswap = false; | ||
| 18113 | // if( !little_endian ) | ||
| 18114 | // { | ||
| 18115 | // byteswap = true; | ||
| 18116 | // swap32((unsigned char *)&hdr.file_size); | ||
| 18117 | // swap32((unsigned char *)&hdr.chunk_size); | ||
| 18118 | // swap16((unsigned char *)&hdr.format_tag); | ||
| 18119 | // swap16((unsigned char *)&hdr.num_chans); | ||
| 18120 | // swap32((unsigned char *)&hdr.sample_rate); | ||
| 18121 | // swap32((unsigned char *)&hdr.bytes_per_sec); | ||
| 18122 | // swap16((unsigned char *)&hdr.bytes_per_samp); | ||
| 18123 | // swap16((unsigned char *)&hdr.bits_per_samp); | ||
| 18124 | // } | ||
| 18125 | // | ||
| 18126 | // if ( fwrite(&hdr, 4, 11, fd) != 11 ) { | ||
| 18127 | // sprintf(msg, "[chuck](via WvOut): Could not write WAV header for file %s", name); | ||
| 18128 | // return false; | ||
| 18129 | // } | ||
| 18130 | // | ||
| 18131 | // // printf("\nCreating WAV file: %s\n", name); | ||
| 18132 | // return true; | ||
| 18133 | //} | ||
| 18134 | // | ||
| 18135 | //void WvOut :: closeWavFile( void ) | ||
| 18136 | //{ | ||
| 18137 | // int bytes_per_sample = 1; | ||
| 18138 | // if ( dataType == STK_SINT16 ) | ||
| 18139 | // bytes_per_sample = 2; | ||
| 18140 | // else if ( dataType == STK_SINT32 || dataType == MY_FLOAT32 ) | ||
| 18141 | // bytes_per_sample = 4; | ||
| 18142 | // else if ( dataType == MY_FLOAT64 ) | ||
| 18143 | // bytes_per_sample = 8; | ||
| 18144 | // | ||
| 18145 | // SINT32 bytes = totalCount * channels * bytes_per_sample; | ||
| 18146 | //if( !little_endian ) | ||
| 18147 | // swap32((unsigned char *)&bytes); | ||
| 18148 | // | ||
| 18149 | // fseek(fd, 40, SEEK_SET); // jump to data length | ||
| 18150 | // fwrite(&bytes, 4, 1, fd); | ||
| 18151 | // | ||
| 18152 | // bytes = totalCount * channels * bytes_per_sample + 44; | ||
| 18153 | //if( !little_endian ) | ||
| 18154 | // swap32((unsigned char *)&bytes); | ||
| 18155 | // | ||
| 18156 | // fseek(fd, 4, SEEK_SET); // jump to file size | ||
| 18157 | // fwrite(&bytes, 4, 1, fd); | ||
| 18158 | // fclose( fd ); | ||
| 18159 | //} | ||
| 18160 | // | ||
| 18161 | //bool WvOut :: setSndFile( const char *fileName ) | ||
| 18162 | //{ | ||
| 18163 | // char name[128]; | ||
| 18164 | // strncpy(name, fileName, 128); | ||
| 18165 | // if ( strstr(name, ".snd") == NULL) strcat(name, ".snd"); | ||
| 18166 | // fd = fopen(name, "wb"); | ||
| 18167 | // if ( !fd ) { | ||
| 18168 | // sprintf(msg, "[chuck](via WvOut): Could not create SND file: %s", name); | ||
| 18169 | // return false; | ||
| 18170 | // } | ||
| 18171 | // | ||
| 18172 | // struct sndhdr hdr = {".sn", 40, 0, 3, (SINT32) Stk::sampleRate(), 1, "Created by STK"}; | ||
| 18173 | // hdr.pref[3] = 'd'; | ||
| 18174 | // hdr.num_channels = channels; | ||
| 18175 | // if ( dataType == STK_SINT8 ) | ||
| 18176 | // hdr.format = 2; | ||
| 18177 | // else if ( dataType == STK_SINT16 ) | ||
| 18178 | // hdr.format = 3; | ||
| 18179 | // else if ( dataType == STK_SINT32 ) | ||
| 18180 | // hdr.format = 5; | ||
| 18181 | // else if ( dataType == MY_FLOAT32 ) | ||
| 18182 | // hdr.format = 6; | ||
| 18183 | // else if ( dataType == MY_FLOAT64 ) | ||
| 18184 | // hdr.format = 7; | ||
| 18185 | // | ||
| 18186 | // byteswap = false; | ||
| 18187 | //if( little_endian ) | ||
| 18188 | //{ | ||
| 18189 | // byteswap = true; | ||
| 18190 | // swap32 ((unsigned char *)&hdr.hdr_length); | ||
| 18191 | // swap32 ((unsigned char *)&hdr.format); | ||
| 18192 | // swap32 ((unsigned char *)&hdr.sample_rate); | ||
| 18193 | // swap32 ((unsigned char *)&hdr.num_channels); | ||
| 18194 | //} | ||
| 18195 | // | ||
| 18196 | // if ( fwrite(&hdr, 4, 10, fd) != 10 ) { | ||
| 18197 | // sprintf(msg, "[chuck](via WvOut): Could not write SND header for file %s", name); | ||
| 18198 | // return false; | ||
| 18199 | // } | ||
| 18200 | // | ||
| 18201 | // // printf("\nCreating SND file: %s\n", name); | ||
| 18202 | // return true; | ||
| 18203 | //} | ||
| 18204 | // | ||
| 18205 | //void WvOut :: closeSndFile( void ) | ||
| 18206 | //{ | ||
| 18207 | // int bytes_per_sample = 1; | ||
| 18208 | // if ( dataType == STK_SINT16 ) | ||
| 18209 | // bytes_per_sample = 2; | ||
| 18210 | // else if ( dataType == STK_SINT32 ) | ||
| 18211 | // bytes_per_sample = 4; | ||
| 18212 | // else if ( dataType == MY_FLOAT32 ) | ||
| 18213 | // bytes_per_sample = 4; | ||
| 18214 | // else if ( dataType == MY_FLOAT64 ) | ||
| 18215 | // bytes_per_sample = 8; | ||
| 18216 | // | ||
| 18217 | // SINT32 bytes = totalCount * bytes_per_sample * channels; | ||
| 18218 | //if( little_endian ) | ||
| 18219 | // swap32 ((unsigned char *)&bytes); | ||
| 18220 | // | ||
| 18221 | // fseek(fd, 8, SEEK_SET); // jump to data size | ||
| 18222 | // fwrite(&bytes, 4, 1, fd); | ||
| 18223 | // fclose(fd); | ||
| 18224 | //} | ||
| 18225 | // | ||
| 18226 | //bool WvOut :: setAifFile( const char *fileName ) | ||
| 18227 | //{ | ||
| 18228 | // char name[128]; | ||
| 18229 | // strncpy(name, fileName, 128); | ||
| 18230 | // if ( strstr(name, ".aif") == NULL) strcat(name, ".aif"); | ||
| 18231 | // fd = fopen(name, "wb"); | ||
| 18232 | // if ( !fd ) { | ||
| 18233 | // sprintf(msg, "[chuck](via WvOut): Could not create AIF file: %s", name); | ||
| 18234 | // return false; | ||
| 18235 | // } | ||
| 18236 | // | ||
| 18237 | // // Common parts of AIFF/AIFC header. | ||
| 18238 | // struct aifhdr hdr = {"FOR", 46, "AIF", "COM", 18, 0, 0, 16, "0"}; | ||
| 18239 | // struct aifssnd ssnd = {"SSN", 8, 0, 0}; | ||
| 18240 | // hdr.form[3] = 'M'; | ||
| 18241 | // hdr.aiff[3] = 'F'; | ||
| 18242 | // hdr.comm[3] = 'M'; | ||
| 18243 | // ssnd.ssnd[3] = 'D'; | ||
| 18244 | // hdr.num_chans = channels; | ||
| 18245 | // if ( dataType == STK_SINT8 ) | ||
| 18246 | // hdr.sample_size = 8; | ||
| 18247 | // else if ( dataType == STK_SINT16 ) | ||
| 18248 | // hdr.sample_size = 16; | ||
| 18249 | // else if ( dataType == STK_SINT32 ) | ||
| 18250 | // hdr.sample_size = 32; | ||
| 18251 | // else if ( dataType == MY_FLOAT32 ) { | ||
| 18252 | // hdr.aiff[3] = 'C'; | ||
| 18253 | // hdr.sample_size = 32; | ||
| 18254 | // hdr.comm_size = 24; | ||
| 18255 | // } | ||
| 18256 | // else if ( dataType == MY_FLOAT64 ) { | ||
| 18257 | // hdr.aiff[3] = 'C'; | ||
| 18258 | // hdr.sample_size = 64; | ||
| 18259 | // hdr.comm_size = 24; | ||
| 18260 | // } | ||
| 18261 | // | ||
| 18262 | // // For AIFF files, the sample rate is stored in a 10-byte, | ||
| 18263 | // // IEEE Standard 754 floating point number, so we need to | ||
| 18264 | // // convert to that. | ||
| 18265 | // SINT16 i; | ||
| 18266 | // unsigned long exp; | ||
| 18267 | // unsigned long rate = (unsigned long) Stk::sampleRate(); | ||
| 18268 | // memset(hdr.srate, 0, 10); | ||
| 18269 | // exp = rate; | ||
| 18270 | // for (i=0; i<32; i++) { | ||
| 18271 | // exp >>= 1; | ||
| 18272 | // if (!exp) break; | ||
| 18273 | // } | ||
| 18274 | // i += 16383; | ||
| 18275 | //if( little_endian ) | ||
| 18276 | // swap16((unsigned char *)&i); | ||
| 18277 | // | ||
| 18278 | // *(SINT16 *)(hdr.srate) = (SINT16) i; | ||
| 18279 | // | ||
| 18280 | // for (i=32; i; i--) { | ||
| 18281 | // if (rate & 0x80000000) break; | ||
| 18282 | // rate <<= 1; | ||
| 18283 | // } | ||
| 18284 | // | ||
| 18285 | //if( little_endian ) | ||
| 18286 | // swap32((unsigned char *)&rate); | ||
| 18287 | // | ||
| 18288 | // *(unsigned long *)(hdr.srate+2) = (unsigned long) rate; | ||
| 18289 | // | ||
| 18290 | // byteswap = false; | ||
| 18291 | //if( little_endian ) | ||
| 18292 | //{ | ||
| 18293 | // byteswap = true; | ||
| 18294 | // swap32((unsigned char *)&hdr.form_size); | ||
| 18295 | // swap32((unsigned char *)&hdr.comm_size); | ||
| 18296 | // swap16((unsigned char *)&hdr.num_chans); | ||
| 18297 | // swap16((unsigned char *)&hdr.sample_size); | ||
| 18298 | // swap32((unsigned char *)&ssnd.ssnd_size); | ||
| 18299 | // swap32((unsigned char *)&ssnd.offset); | ||
| 18300 | // swap32((unsigned char *)&ssnd.block_size); | ||
| 18301 | //} | ||
| 18302 | // | ||
| 18303 | // // The structure boundaries don't allow a single write of 54 bytes. | ||
| 18304 | // if ( fwrite(&hdr, 4, 5, fd) != 5 ) goto error; | ||
| 18305 | // if ( fwrite(&hdr.num_chans, 2, 1, fd) != 1 ) goto error; | ||
| 18306 | // if ( fwrite(&hdr.sample_frames, 4, 1, fd) != 1 ) goto error; | ||
| 18307 | // if ( fwrite(&hdr.sample_size, 2, 1, fd) != 1 ) goto error; | ||
| 18308 | // if ( fwrite(&hdr.srate, 10, 1, fd) != 1 ) goto error; | ||
| 18309 | // | ||
| 18310 | // if ( dataType == MY_FLOAT32 ) { | ||
| 18311 | // char type[4] = {'f','l','3','2'}; | ||
| 18312 | // char zeroes[2] = { 0, 0 }; | ||
| 18313 | // if ( fwrite(&type, 4, 1, fd) != 1 ) goto error; | ||
| 18314 | // if ( fwrite(&zeroes, 2, 1, fd) != 1 ) goto error; | ||
| 18315 | // } | ||
| 18316 | // else if ( dataType == MY_FLOAT64 ) { | ||
| 18317 | // char type[4] = {'f','l','6','4'}; | ||
| 18318 | // char zeroes[2] = { 0, 0 }; | ||
| 18319 | // if ( fwrite(&type, 4, 1, fd) != 1 ) goto error; | ||
| 18320 | // if ( fwrite(&zeroes, 2, 1, fd) != 1 ) goto error; | ||
| 18321 | // } | ||
| 18322 | // | ||
| 18323 | // if ( fwrite(&ssnd, 4, 4, fd) != 4 ) goto error; | ||
| 18324 | // | ||
| 18325 | // // printf("\nCreating AIF file: %s\n", name); | ||
| 18326 | // return true; | ||
| 18327 | // | ||
| 18328 | // error: | ||
| 18329 | // sprintf(msg, "[chuck](via WvOut): Could not write AIF header for file %s", name); | ||
| 18330 | // return false; | ||
| 18331 | //} | ||
| 18332 | // | ||
| 18333 | //void WvOut :: closeAifFile( void ) | ||
| 18334 | //{ | ||
| 18335 | // unsigned long frames = (unsigned long) totalCount; | ||
| 18336 | //if( little_endian ) | ||
| 18337 | // swap32((unsigned char *)&frames); | ||
| 18338 | // | ||
| 18339 | // fseek(fd, 22, SEEK_SET); // jump to "COMM" sample_frames | ||
| 18340 | // fwrite(&frames, 4, 1, fd); | ||
| 18341 | // | ||
| 18342 | // int bytes_per_sample = 1; | ||
| 18343 | // if ( dataType == STK_SINT16 ) | ||
| 18344 | // bytes_per_sample = 2; | ||
| 18345 | // else if ( dataType == STK_SINT32 || dataType == MY_FLOAT32 ) | ||
| 18346 | // bytes_per_sample = 4; | ||
| 18347 | // else if ( dataType == MY_FLOAT64 ) | ||
| 18348 | // bytes_per_sample = 8; | ||
| 18349 | // | ||
| 18350 | // unsigned long bytes = totalCount * bytes_per_sample * channels + 46; | ||
| 18351 | // if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) bytes += 6; | ||
| 18352 | //if( little_endian ) | ||
| 18353 | // swap32((unsigned char *)&bytes); | ||
| 18354 | // | ||
| 18355 | // fseek(fd, 4, SEEK_SET); // jump to file size | ||
| 18356 | // fwrite(&bytes, 4, 1, fd); | ||
| 18357 | // | ||
| 18358 | // bytes = totalCount * bytes_per_sample * channels + 8; | ||
| 18359 | // if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) bytes += 6; | ||
| 18360 | //if( little_endian ) | ||
| 18361 | // swap32((unsigned char *)&bytes); | ||
| 18362 | // | ||
| 18363 | // if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) | ||
| 18364 | // fseek(fd, 48, SEEK_SET); // jump to "SSND" chunk size | ||
| 18365 | // else | ||
| 18366 | // fseek(fd, 42, SEEK_SET); // jump to "SSND" chunk size | ||
| 18367 | // fwrite(&bytes, 4, 1, fd); | ||
| 18368 | // | ||
| 18369 | // fclose( fd ); | ||
| 18370 | //} | ||
| 18371 | // | ||
| 18372 | //bool WvOut :: setMatFile( const char *fileName ) | ||
| 18373 | //{ | ||
| 18374 | // char name[128]; | ||
| 18375 | // strncpy(name, fileName, 128); | ||
| 18376 | // if ( strstr(name, ".mat") == NULL) strcat(name, ".mat"); | ||
| 18377 | // fd = fopen(name, "w+b"); | ||
| 18378 | // if ( !fd ) { | ||
| 18379 | // sprintf(msg, "[chuck](via WvOut): Could not create MAT file: %s", name); | ||
| 18380 | // return false; | ||
| 18381 | // } | ||
| 18382 | // | ||
| 18383 | // if ( dataType != MY_FLOAT64 ) { | ||
| 18384 | // dataType = MY_FLOAT64; | ||
| 18385 | // sprintf(msg, "[chuck](via WvOut): Using 64-bit floating-point data format for file %s", name); | ||
| 18386 | // handleError(msg, StkError::WARNING); | ||
| 18387 | // } | ||
| 18388 | // | ||
| 18389 | // struct mathdr hdr; | ||
| 18390 | // strcpy(hdr.heading,"MATLAB 5.0 MAT-file, Generated using the Synthesis ToolKit in C++ (STK). By Perry R. Cook and Gary P. Scavone, 1995-2002."); | ||
| 18391 | // | ||
| 18392 | // int i; | ||
| 18393 | // for (i=strlen(hdr.heading);i<124;i++) hdr.heading[i] = ' '; | ||
| 18394 | // | ||
| 18395 | // // Header Flag Fields | ||
| 18396 | // hdr.hff[0] = (SINT16) 0x0100; // Version field | ||
| 18397 | // hdr.hff[1] = (SINT16) 'M'; // Endian indicator field ("MI") | ||
| 18398 | // hdr.hff[1] <<= 8; | ||
| 18399 | // hdr.hff[1] += 'I'; | ||
| 18400 | // | ||
| 18401 | // hdr.adf[0] = (SINT32) 14; // Matlab array data type value | ||
| 18402 | // hdr.adf[1] = (SINT32) 0; // Size of file after this point to end (in bytes) | ||
| 18403 | // // Don't know size yet. | ||
| 18404 | // | ||
| 18405 | // // Numeric Array Subelements (4): | ||
| 18406 | // // 1. Array Flags | ||
| 18407 | // hdr.adf[2] = (SINT32) 6; // Matlab 32-bit unsigned integer data type value | ||
| 18408 | // hdr.adf[3] = (SINT32) 8; // 8 bytes of data to follow | ||
| 18409 | // hdr.adf[4] = (SINT32) 6; // Double-precision array, no array flags set | ||
| 18410 | // hdr.adf[5] = (SINT32) 0; // 4 bytes undefined | ||
| 18411 | // // 2. Array Dimensions | ||
| 18412 | // hdr.adf[6] = (SINT32) 5; // Matlab 32-bit signed integer data type value | ||
| 18413 | // hdr.adf[7] = (SINT32) 8; // 8 bytes of data to follow (2D array) | ||
| 18414 | // hdr.adf[8] = (SINT32) channels; // This is the number of rows | ||
| 18415 | // hdr.adf[9] = (SINT32) 0; // This is the number of columns | ||
| 18416 | // | ||
| 18417 | // // 3. Array Name | ||
| 18418 | // // We'll use fileName for the matlab array name (as well as the file name). | ||
| 18419 | // // If fileName is 4 characters or less, we have to use a compressed data element | ||
| 18420 | // // format for the array name data element. Otherwise, the array name must | ||
| 18421 | // // be formatted in 8-byte increments (up to 31 characters + NULL). | ||
| 18422 | // SINT32 namelength = (SINT32) strlen(fileName); | ||
| 18423 | // if (strstr(fileName, ".mat")) namelength -= 4; | ||
| 18424 | // if (namelength > 31) namelength = 31; // Truncate name to 31 characters. | ||
| 18425 | // char arrayName[64]; | ||
| 18426 | // strncpy(arrayName, fileName, namelength); | ||
| 18427 | // arrayName[namelength] = '\0'; | ||
| 18428 | // if (namelength > 4) { | ||
| 18429 | // hdr.adf[10] = (SINT32) 1; // Matlab 8-bit signed integer data type value | ||
| 18430 | // } | ||
| 18431 | // else { // Compressed data element format | ||
| 18432 | // hdr.adf[10] = namelength; | ||
| 18433 | // hdr.adf[10] <<= 16; | ||
| 18434 | // hdr.adf[10] += 1; | ||
| 18435 | // } | ||
| 18436 | // SINT32 headsize = 40; // Number of bytes in data element so far. | ||
| 18437 | // | ||
| 18438 | // // Write the fixed portion of the header | ||
| 18439 | // if ( fwrite(&hdr, 172, 1, fd) != 1 ) goto error; | ||
| 18440 | // | ||
| 18441 | // // Write MATLAB array name | ||
| 18442 | // SINT32 tmp; | ||
| 18443 | // if (namelength > 4) { | ||
| 18444 | // if ( fwrite(&namelength, 4, 1, fd) != 1) goto error; | ||
| 18445 | // if ( fwrite(arrayName, namelength, 1, fd) != 1 ) goto error; | ||
| 18446 | // tmp = (SINT32) ceil((float)namelength / 8); | ||
| 18447 | // if ( fseek(fd, tmp*8-namelength, SEEK_CUR) == -1 ) goto error; | ||
| 18448 | // headsize += tmp * 8; | ||
| 18449 | // } | ||
| 18450 | // else { // Compressed data element format | ||
| 18451 | // if ( fwrite(arrayName, namelength, 1, fd) != 1 ) goto error; | ||
| 18452 | // tmp = 4 - namelength; | ||
| 18453 | // if ( fseek(fd, tmp, SEEK_CUR) == -1 ) goto error; | ||
| 18454 | // } | ||
| 18455 | // | ||
| 18456 | // // Finish writing known header information | ||
| 18457 | // tmp = 9; // Matlab IEEE 754 double data type | ||
| 18458 | // if ( fwrite(&tmp, 4, 1, fd) != 1 ) goto error; | ||
| 18459 | // tmp = 0; // Size of real part subelement in bytes (8 per sample) | ||
| 18460 | // if ( fwrite(&tmp, 4, 1, fd) != 1 ) goto error; | ||
| 18461 | // headsize += 8; // Total number of bytes in data element so far | ||
| 18462 | // | ||
| 18463 | // if ( fseek(fd, 132, SEEK_SET) == -1 ) goto error; | ||
| 18464 | // if ( fwrite(&headsize, 4, 1, fd) != 1 ) goto error; // Write header size ... will update at end | ||
| 18465 | // if ( fseek(fd, 0, SEEK_END) == -1 ) goto error; | ||
| 18466 | // | ||
| 18467 | // byteswap = false; | ||
| 18468 | // CK_FPRINTF_STDERR( "[chuck]:(via STK): creating MAT-file (%s) containing MATLAB array: %s\n", name, arrayName); | ||
| 18469 | // return true; | ||
| 18470 | // | ||
| 18471 | // error: | ||
| 18472 | // sprintf(msg, "[chuck](via WvOut): Could not write MAT-file header for file %s", name); | ||
| 18473 | // return false; | ||
| 18474 | //} | ||
| 18475 | // | ||
| 18476 | //void WvOut :: closeMatFile( void ) | ||
| 18477 | //{ | ||
| 18478 | // fseek(fd, 164, SEEK_SET); // jump to number of columns | ||
| 18479 | // fwrite(&totalCount, 4, 1, fd); | ||
| 18480 | // | ||
| 18481 | // SINT32 headsize, temp; | ||
| 18482 | // fseek(fd, 132, SEEK_SET); // jump to header size | ||
| 18483 | // fread(&headsize, 4, 1, fd); | ||
| 18484 | // temp = headsize; | ||
| 18485 | // headsize += (SINT32) (totalCount * 8 * channels); | ||
| 18486 | // fseek(fd, 132, SEEK_SET); | ||
| 18487 | // // Write file size (minus some header info) | ||
| 18488 | // fwrite(&headsize, 4, 1, fd); | ||
| 18489 | // | ||
| 18490 | // fseek(fd, temp+132, SEEK_SET); // jumpt to data size (in bytes) | ||
| 18491 | // temp = totalCount * 8 * channels; | ||
| 18492 | // fwrite(&temp, 4, 1, fd); | ||
| 18493 | // | ||
| 18494 | // fclose(fd); | ||
| 18495 | //} | ||
| 18496 | // | ||
| 18497 | //unsigned long WvOut :: getFrames( void ) const | ||
| 18498 | //{ | ||
| 18499 | // return totalCount; | ||
| 18500 | //} | ||
| 18501 | // | ||
| 18502 | //MY_FLOAT WvOut :: getTime( void ) const | ||
| 18503 | //{ | ||
| 18504 | // return (MY_FLOAT) totalCount / Stk::sampleRate(); | ||
| 18505 | //} | ||
| 18506 | // | ||
| 18507 | //void WvOut :: writeData( unsigned long frames ) | ||
| 18508 | //{ | ||
| 18509 | // // make sure we have file descriptor | ||
| 18510 | // if( !fd ) return; | ||
| 18511 | // | ||
| 18512 | // if ( dataType == STK_SINT8 ) { | ||
| 18513 | // if ( fileType == WVOUT_WAV ) { // 8-bit WAV data is unsigned! | ||
| 18514 | // for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18515 | // float float_sample = data[k] * 127.0 + 128.0; | ||
| 18516 | // if(float_sample < 0) float_sample = 0; | ||
| 18517 | // if(float_sample > 255) float_sample = 255; | ||
| 18518 | // unsigned char sample = (unsigned char) float_sample; | ||
| 18519 | // | ||
| 18520 | // if ( fwrite(&sample, 1, 1, fd) != 1 ) goto error; | ||
| 18521 | // } | ||
| 18522 | // } | ||
| 18523 | // else { | ||
| 18524 | // for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18525 | // float float_sample = data[k] * 127.0; | ||
| 18526 | // if(float_sample < -128) float_sample = -128; | ||
| 18527 | // if(float_sample > 127) float_sample = 127; | ||
| 18528 | // signed char sample = (signed char) float_sample; | ||
| 18529 | // | ||
| 18530 | // if ( fwrite(&sample, 1, 1, fd) != 1 ) goto error; | ||
| 18531 | // } | ||
| 18532 | // } | ||
| 18533 | // } | ||
| 18534 | // else if ( dataType == STK_SINT16 ) { | ||
| 18535 | // for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18536 | // float float_sample = data[k] * 32767.0; | ||
| 18537 | // if(float_sample < -32767) float_sample = -32767; | ||
| 18538 | // if(float_sample > 32767) float_sample = 32767; | ||
| 18539 | // SINT16 sample = (SINT16) float_sample; | ||
| 18540 | // | ||
| 18541 | // if ( byteswap ) swap16( (unsigned char *)&sample ); | ||
| 18542 | // if ( fwrite(&sample, 2, 1, fd) != 1 ) goto error; | ||
| 18543 | // } | ||
| 18544 | // } | ||
| 18545 | // else if ( dataType == STK_SINT32 ) { | ||
| 18546 | // for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18547 | // float float_sample = data[k] * 32767.0; | ||
| 18548 | // if(float_sample < -2147483647) float_sample = (float)-2147483647; | ||
| 18549 | // if(float_sample > 2147483647) float_sample = (float)2147483647; | ||
| 18550 | // SINT32 sample = (SINT32) float_sample; | ||
| 18551 | // | ||
| 18552 | // if ( byteswap ) swap32( (unsigned char *)&sample ); | ||
| 18553 | // if ( fwrite(&sample, 4, 1, fd) != 1 ) goto error; | ||
| 18554 | // } | ||
| 18555 | // } | ||
| 18556 | // else if ( dataType == MY_FLOAT32 ) { | ||
| 18557 | // FLOAT32 sample; | ||
| 18558 | // for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18559 | // sample = (FLOAT32) (data[k]); | ||
| 18560 | // | ||
| 18561 | // if ( byteswap ) swap32( (unsigned char *)&sample ); | ||
| 18562 | // if ( fwrite(&sample, 4, 1, fd) != 1 ) goto error; | ||
| 18563 | // } | ||
| 18564 | // } | ||
| 18565 | // else if ( dataType == MY_FLOAT64 ) { | ||
| 18566 | // FLOAT64 sample; | ||
| 18567 | // for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18568 | // sample = (FLOAT64) (data[k]); | ||
| 18569 | // | ||
| 18570 | // if ( byteswap ) swap64( (unsigned char *)&sample ); | ||
| 18571 | // if ( fwrite(&sample, 8, 1, fd) != 1 ) goto error; | ||
| 18572 | // } | ||
| 18573 | // } | ||
| 18574 | // | ||
| 18575 | // flush += frames; | ||
| 18576 | // if( flush >= 8192 ) | ||
| 18577 | // { | ||
| 18578 | // flush = 0; | ||
| 18579 | // fflush( fd ); | ||
| 18580 | // } | ||
| 18581 | // | ||
| 18582 | // return; | ||
| 18583 | // | ||
| 18584 | // error: | ||
| 18585 | // sprintf(msg, "[chuck](via WvOut): Error writing data to file."); | ||
| 18586 | // handleError(msg, StkError::FILE_ERROR); | ||
| 18587 | //} | ||
| 18588 | // | ||
| 18589 | //void WvOut :: tick(const MY_FLOAT sample) | ||
| 18590 | //{ | ||
| 18591 | // if ( !fd ) return; | ||
| 18592 | // | ||
| 18593 | // for ( unsigned int j=0; j<channels; j++ ) | ||
| 18594 | // data[counter*channels+j] = sample; | ||
| 18595 | // | ||
| 18596 | // counter++; | ||
| 18597 | // totalCount++; | ||
| 18598 | // | ||
| 18599 | // if ( counter == BUFFER_SIZE ) { | ||
| 18600 | // writeData( BUFFER_SIZE ); | ||
| 18601 | // counter = 0; | ||
| 18602 | // } | ||
| 18603 | //} | ||
| 18604 | // | ||
| 18605 | //void WvOut :: tick(const MY_FLOAT *vec, unsigned int vectorSize) | ||
| 18606 | //{ | ||
| 18607 | // if ( !fd ) return; | ||
| 18608 | // | ||
| 18609 | // for (unsigned int i=0; i<vectorSize; i++) | ||
| 18610 | // tick( vec[i] ); | ||
| 18611 | //} | ||
| 18612 | // | ||
| 18613 | //void WvOut :: tickFrame(const MY_FLOAT *frameVector, unsigned int frames) | ||
| 18614 | //{ | ||
| 18615 | // if ( !fd ) return; | ||
| 18616 | // | ||
| 18617 | // unsigned int j; | ||
| 18618 | // for ( unsigned int i=0; i<frames; i++ ) { | ||
| 18619 | // for ( j=0; j<channels; j++ ) { | ||
| 18620 | // data[counter*channels+j] = frameVector[i*channels+j]; | ||
| 18621 | // } | ||
| 18622 | // counter++; | ||
| 18623 | // totalCount++; | ||
| 18624 | // | ||
| 18625 | // if ( counter == BUFFER_SIZE ) { | ||
| 18626 | // writeData( BUFFER_SIZE ); | ||
| 18627 | // counter = 0; | ||
| 18628 | // } | ||
| 18629 | // } | ||
| 18630 | //} | ||
| 18631 | // | ||
| 18632 | 17893 | ||
| 17894 | #ifndef __DISABLE_WVOUT__ | ||
| 17895 | size_t WvOut::fwrite(const void * ptr, size_t size, size_t nitems, FILE * stream) | ||
| 17896 | { | ||
| 17897 | if(asyncIO) | ||
| 17898 | return asyncWriteThread->fwrite(ptr, size, nitems, stream); | ||
| 17899 | else | ||
| 17900 | return ::fwrite(ptr, size, nitems, stream); | ||
| 17901 | } | ||
| 18633 | 17902 | ||
| 18634 | /**********************************************************************/ | 17903 | int WvOut::fseek(FILE *stream, long offset, int whence) |
| 18635 | /*! \class MidiFileIn | 17904 | { |
| 18636 | \brief A standard MIDI file reading/parsing class. | 17905 | if(asyncIO) |
| 18637 | 17906 | return asyncWriteThread->fseek(stream, offset, whence); | |
| 18638 | This class can be used to read events from a standard MIDI file. | 17907 | else |
| 18639 | Event bytes are copied to a C++ vector and must be subsequently | 17908 | return ::fseek(stream, offset, whence); |
| 18640 | interpreted by the user. The function getNextMidiEvent() skips | 17909 | } |
| 18641 | meta and sysex events, returning only MIDI channel messages. | ||
| 18642 | Event delta-times are returned in the form of "ticks" and a | ||
| 18643 | function is provided to determine the current "seconds per tick". | ||
| 18644 | Tempo changes are internally tracked by the class and reflected in | ||
| 18645 | the values returned by the function getTickSeconds(). | ||
| 18646 | |||
| 18647 | by Gary P. Scavone, 2003 - 2010. | ||
| 18648 | */ | ||
| 18649 | /**********************************************************************/ | ||
| 18650 | 17910 | ||
| 18651 | #include <cstring> | 17911 | int WvOut::fflush(FILE *stream) |
| 18652 | #include <iostream> | 17912 | { |
| 17913 | if(asyncIO) | ||
| 17914 | return asyncWriteThread->fflush(stream); | ||
| 17915 | else | ||
| 17916 | return ::fflush(stream); | ||
| 17917 | } | ||
| 18653 | 17918 | ||
| 18654 | #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) | 17919 | int WvOut::fclose(FILE *stream) |
| 18655 | #define __LITTLE_ENDIAN__ | 17920 | { |
| 18656 | #endif // !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) | 17921 | if(asyncIO) |
| 17922 | return asyncWriteThread->fclose(stream); | ||
| 17923 | else | ||
| 17924 | return ::fclose(stream); | ||
| 17925 | } | ||
| 18657 | 17926 | ||
| 18658 | namespace stk { | 17927 | size_t WvOut::fread(void *ptr, size_t size, size_t nitems, FILE *stream) |
| 18659 | |||
| 18660 | MidiFileIn :: MidiFileIn( std::string fileName ) | ||
| 18661 | { | 17928 | { |
| 18662 | // Attempt to open the file. | 17929 | // can't read asynchronously (yet) |
| 18663 | file_.open( fileName.c_str(), std::ios::in | std::ios::binary ); | 17930 | assert(0); |
| 18664 | if ( !file_ ) { | 17931 | return 0; |
| 18665 | CK_STDCOUT << "MidiFileIn: error opening or finding file (" << fileName << ")."; | 17932 | } |
| 18666 | handleError( "", StkError::FILE_NOT_FOUND ); | 17933 | |
| 18667 | } | 17934 | WvOut :: WvOut() |
| 18668 | 17935 | { | |
| 18669 | // Parse header info. | 17936 | init(); |
| 18670 | char chunkType[4]; | 17937 | } |
| 18671 | char buffer[4]; | 17938 | |
| 18672 | SINT32 *length; | 17939 | WvOut::WvOut( const char *fileName, unsigned int nChannels, FILE_TYPE type, Stk::STK_FORMAT format ) |
| 18673 | if ( !file_.read( chunkType, 4 ) ) goto error; | 17940 | { |
| 18674 | if ( !file_.read( buffer, 4 ) ) goto error; | 17941 | init(); |
| 18675 | #ifdef __LITTLE_ENDIAN__ | 17942 | openFile( fileName, nChannels, type, format ); |
| 18676 | swap32((unsigned char *)&buffer); | 17943 | } |
| 18677 | #endif | 17944 | |
| 18678 | length = (SINT32 *) &buffer; | 17945 | WvOut :: ~WvOut() |
| 18679 | if ( strncmp( chunkType, "MThd", 4 ) || ( *length != 6 ) ) { | 17946 | { |
| 18680 | CK_STDCOUT << "MidiFileIn: file (" << fileName << ") does not appear to be a MIDI file!"; | 17947 | closeFile(); |
| 18681 | handleError( "", StkError::FILE_UNKNOWN_FORMAT ); | 17948 | |
| 18682 | } | 17949 | if (data) |
| 18683 | 17950 | delete [] data; | |
| 18684 | // Read the MIDI file format. | 17951 | } |
| 18685 | SINT16 *data; | 17952 | |
| 18686 | if ( !file_.read( buffer, 2 ) ) goto error; | 17953 | void WvOut :: init() |
| 18687 | #ifdef __LITTLE_ENDIAN__ | 17954 | { |
| 18688 | swap16((unsigned char *)&buffer); | 17955 | fd = 0; |
| 18689 | #endif | 17956 | data = 0; |
| 18690 | data = (SINT16 *) &buffer; | 17957 | fileType = 0; |
| 18691 | if ( *data < 0 || *data > 2 ) { | 17958 | dataType = 0; |
| 17959 | channels = 0; | ||
| 17960 | counter = 0; | ||
| 17961 | totalCount = 0; | ||
| 17962 | //m_filename[0] = '\0'; | ||
| 17963 | start = TRUE; | ||
| 17964 | flush = 0; | ||
| 17965 | fileGain = 1; | ||
| 17966 | |||
| 17967 | // spencer: added as flag for off-thread write | ||
| 17968 | asyncIO = FALSE; | ||
| 17969 | asyncWriteThread = NULL; | ||
| 17970 | } | ||
| 17971 | |||
| 17972 | void WvOut :: closeFile( void ) | ||
| 17973 | { | ||
| 17974 | if( fd ) { | ||
| 17975 | // If there's an existing file, close it first. | ||
| 17976 | writeData( counter ); | ||
| 17977 | |||
| 17978 | if ( fileType == WVOUT_RAW ) | ||
| 17979 | fclose( fd ); | ||
| 17980 | else if ( fileType == WVOUT_WAV ) | ||
| 17981 | closeWavFile(); | ||
| 17982 | else if ( fileType == WVOUT_SND ) | ||
| 17983 | closeSndFile(); | ||
| 17984 | else if ( fileType == WVOUT_AIF ) | ||
| 17985 | closeAifFile(); | ||
| 17986 | else if ( fileType == WVOUT_MAT ) | ||
| 17987 | closeMatFile(); | ||
| 17988 | fd = 0; | ||
| 17989 | |||
| 17990 | // printf("%f Seconds Computed\n\n", getTime() ); | ||
| 17991 | totalCount = 0; | ||
| 17992 | } | ||
| 17993 | |||
| 17994 | str_filename.set( "" ); | ||
| 17995 | //m_filename[0] = '\0'; | ||
| 17996 | } | ||
| 17997 | |||
| 17998 | void WvOut :: openFile( const char *fileName, unsigned int nChannels, WvOut::FILE_TYPE type, Stk::STK_FORMAT format ) | ||
| 17999 | { | ||
| 18000 | closeFile(); | ||
| 18001 | str_filename.set( fileName ); | ||
| 18002 | //strncpy( m_filename, fileName, 255); | ||
| 18003 | //if ( strlen( fileName ) > 255 ) | ||
| 18004 | // m_filename[255] = '\0'; | ||
| 18005 | |||
| 18006 | if ( nChannels < 1 ) { | ||
| 18007 | sprintf(msg, "[chuck](via WvOut): the channels argument must be greater than zero!"); | ||
| 18008 | handleError( msg, StkError::FUNCTION_ARGUMENT ); | ||
| 18009 | } | ||
| 18010 | |||
| 18011 | unsigned int lastChannels = channels; | ||
| 18012 | channels = nChannels; | ||
| 18013 | fileType = type; | ||
| 18014 | |||
| 18015 | if ( format != STK_SINT8 && format != STK_SINT16 && | ||
| 18016 | format != STK_SINT32 && format != MY_FLOAT32 && | ||
| 18017 | format != MY_FLOAT64 ) { | ||
| 18018 | sprintf( msg, "[chuck](via WvOut): Unknown data type specified (%ld).", format ); | ||
| 18019 | handleError(msg, StkError::FUNCTION_ARGUMENT); | ||
| 18020 | } | ||
| 18021 | dataType = format; | ||
| 18022 | |||
| 18023 | bool result = false; | ||
| 18024 | if ( fileType == WVOUT_RAW ) { | ||
| 18025 | if ( channels != 1 ) { | ||
| 18026 | sprintf(msg, "[chuck](via WvOut): STK RAW files are, by definition, always monaural (channels = %d not supported)!", nChannels); | ||
| 18027 | handleError( msg, StkError::FUNCTION_ARGUMENT ); | ||
| 18028 | } | ||
| 18029 | result = setRawFile( fileName ); | ||
| 18030 | } | ||
| 18031 | else if ( fileType == WVOUT_WAV ) | ||
| 18032 | result = setWavFile( fileName ); | ||
| 18033 | else if ( fileType == WVOUT_SND ) | ||
| 18034 | result = setSndFile( fileName ); | ||
| 18035 | else if ( fileType == WVOUT_AIF ) | ||
| 18036 | result = setAifFile( fileName ); | ||
| 18037 | else if ( fileType == WVOUT_MAT ) | ||
| 18038 | result = setMatFile( fileName ); | ||
| 18039 | else { | ||
| 18040 | sprintf(msg, "[chuck](via WvOut): Unknown file type specified (%ld).", fileType); | ||
| 18041 | handleError(msg, StkError::FUNCTION_ARGUMENT); | ||
| 18042 | } | ||
| 18043 | |||
| 18044 | if ( result == false ) | ||
| 18045 | { | ||
| 18046 | //closeFile(); | ||
| 18047 | handleError(msg, StkError::FILE_ERROR); | ||
| 18048 | // handleError( msg, StkError::WARNING ); | ||
| 18049 | // return; | ||
| 18050 | } | ||
| 18051 | |||
| 18052 | // Allocate new memory if necessary. | ||
| 18053 | if ( lastChannels < channels ) { | ||
| 18054 | if ( data ) delete [] data; | ||
| 18055 | data = (MY_FLOAT *) new MY_FLOAT[BUFFER_SIZE*channels]; | ||
| 18056 | } | ||
| 18057 | counter = 0; | ||
| 18058 | } | ||
| 18059 | |||
| 18060 | bool WvOut :: setRawFile( const char *fileName ) | ||
| 18061 | { | ||
| 18062 | char name[128]; | ||
| 18063 | strncpy(name, fileName, 128); | ||
| 18064 | if ( strstr(name, ".raw") == NULL) strcat(name, ".raw"); | ||
| 18065 | fd = fopen(name, "wb"); | ||
| 18066 | if ( !fd ) { | ||
| 18067 | sprintf(msg, "[chuck](via WvOut): Could not create RAW file: %s", name); | ||
| 18068 | return false; | ||
| 18069 | } | ||
| 18070 | |||
| 18071 | if ( dataType != STK_SINT16 ) { | ||
| 18072 | dataType = STK_SINT16; | ||
| 18073 | sprintf(msg, "[chuck](via WvOut): Using 16-bit signed integer data format for file %s.", name); | ||
| 18074 | handleError(msg, StkError::WARNING); | ||
| 18075 | } | ||
| 18076 | |||
| 18077 | byteswap = false; | ||
| 18078 | if( little_endian ) | ||
| 18079 | byteswap = true; | ||
| 18080 | |||
| 18081 | // printf("\nCreating RAW file: %s\n", name); | ||
| 18082 | return true; | ||
| 18083 | } | ||
| 18084 | |||
| 18085 | bool WvOut :: setWavFile( const char *fileName ) | ||
| 18086 | { | ||
| 18087 | char name[128]; | ||
| 18088 | strncpy(name, fileName, 128); | ||
| 18089 | if( strstr(name, ".wav") == NULL ) strcat(name, ".wav"); | ||
| 18090 | fd = fopen( name, "wb" ); | ||
| 18091 | if( !fd ) { | ||
| 18092 | sprintf(msg, "[chuck](via WvOut): Could not create WAV file: %s", name); | ||
| 18093 | return false; | ||
| 18094 | } | ||
| 18095 | |||
| 18096 | struct wavhdr hdr = {"RIF", 44, "WAV", "fmt", 16, 1, 1, | ||
| 18097 | (SINT32) Stk::sampleRate(), 0, 2, 16, "dat", 0}; | ||
| 18098 | hdr.riff[3] = 'F'; | ||
| 18099 | hdr.wave[3] = 'E'; | ||
| 18100 | hdr.fmt[3] = ' '; | ||
| 18101 | hdr.data[3] = 'a'; | ||
| 18102 | hdr.num_chans = (SINT16) channels; | ||
| 18103 | if ( dataType == STK_SINT8 ) | ||
| 18104 | hdr.bits_per_samp = 8; | ||
| 18105 | else if ( dataType == STK_SINT16 ) | ||
| 18106 | hdr.bits_per_samp = 16; | ||
| 18107 | else if ( dataType == STK_SINT32 ) | ||
| 18108 | hdr.bits_per_samp = 32; | ||
| 18109 | else if ( dataType == MY_FLOAT32 ) { | ||
| 18110 | hdr.format_tag = 3; | ||
| 18111 | hdr.bits_per_samp = 32; | ||
| 18112 | } | ||
| 18113 | else if ( dataType == MY_FLOAT64 ) { | ||
| 18114 | hdr.format_tag = 3; | ||
| 18115 | hdr.bits_per_samp = 64; | ||
| 18116 | } | ||
| 18117 | hdr.bytes_per_samp = (SINT16) (channels * hdr.bits_per_samp / 8); | ||
| 18118 | hdr.bytes_per_sec = (SINT32) (hdr.sample_rate * hdr.bytes_per_samp); | ||
| 18119 | |||
| 18120 | byteswap = false; | ||
| 18121 | if( !little_endian ) | ||
| 18122 | { | ||
| 18123 | byteswap = true; | ||
| 18124 | swap32((unsigned char *)&hdr.file_size); | ||
| 18125 | swap32((unsigned char *)&hdr.chunk_size); | ||
| 18126 | swap16((unsigned char *)&hdr.format_tag); | ||
| 18127 | swap16((unsigned char *)&hdr.num_chans); | ||
| 18128 | swap32((unsigned char *)&hdr.sample_rate); | ||
| 18129 | swap32((unsigned char *)&hdr.bytes_per_sec); | ||
| 18130 | swap16((unsigned char *)&hdr.bytes_per_samp); | ||
| 18131 | swap16((unsigned char *)&hdr.bits_per_samp); | ||
| 18132 | } | ||
| 18133 | |||
| 18134 | if ( fwrite(&hdr, 4, 11, fd) != 11 ) { | ||
| 18135 | sprintf(msg, "[chuck](via WvOut): Could not write WAV header for file %s", name); | ||
| 18136 | return false; | ||
| 18137 | } | ||
| 18138 | |||
| 18139 | // printf("\nCreating WAV file: %s\n", name); | ||
| 18140 | return true; | ||
| 18141 | } | ||
| 18142 | |||
| 18143 | void WvOut :: closeWavFile( void ) | ||
| 18144 | { | ||
| 18145 | int bytes_per_sample = 1; | ||
| 18146 | if ( dataType == STK_SINT16 ) | ||
| 18147 | bytes_per_sample = 2; | ||
| 18148 | else if ( dataType == STK_SINT32 || dataType == MY_FLOAT32 ) | ||
| 18149 | bytes_per_sample = 4; | ||
| 18150 | else if ( dataType == MY_FLOAT64 ) | ||
| 18151 | bytes_per_sample = 8; | ||
| 18152 | |||
| 18153 | SINT32 bytes = totalCount * channels * bytes_per_sample; | ||
| 18154 | if( !little_endian ) | ||
| 18155 | swap32((unsigned char *)&bytes); | ||
| 18156 | |||
| 18157 | fseek(fd, 40, SEEK_SET); // jump to data length | ||
| 18158 | fwrite(&bytes, 4, 1, fd); | ||
| 18159 | |||
| 18160 | bytes = totalCount * channels * bytes_per_sample + 44; | ||
| 18161 | if( !little_endian ) | ||
| 18162 | swap32((unsigned char *)&bytes); | ||
| 18163 | |||
| 18164 | fseek(fd, 4, SEEK_SET); // jump to file size | ||
| 18165 | fwrite(&bytes, 4, 1, fd); | ||
| 18166 | fclose( fd ); | ||
| 18167 | } | ||
| 18168 | |||
| 18169 | bool WvOut :: setSndFile( const char *fileName ) | ||
| 18170 | { | ||
| 18171 | char name[128]; | ||
| 18172 | strncpy(name, fileName, 128); | ||
| 18173 | if ( strstr(name, ".snd") == NULL) strcat(name, ".snd"); | ||
| 18174 | fd = fopen(name, "wb"); | ||
| 18175 | if ( !fd ) { | ||
| 18176 | sprintf(msg, "[chuck](via WvOut): Could not create SND file: %s", name); | ||
| 18177 | return false; | ||
| 18178 | } | ||
| 18179 | |||
| 18180 | struct sndhdr hdr = {".sn", 40, 0, 3, (SINT32) Stk::sampleRate(), 1, "Created by STK"}; | ||
| 18181 | hdr.pref[3] = 'd'; | ||
| 18182 | hdr.num_channels = channels; | ||
| 18183 | if ( dataType == STK_SINT8 ) | ||
| 18184 | hdr.format = 2; | ||
| 18185 | else if ( dataType == STK_SINT16 ) | ||
| 18186 | hdr.format = 3; | ||
| 18187 | else if ( dataType == STK_SINT32 ) | ||
| 18188 | hdr.format = 5; | ||
| 18189 | else if ( dataType == MY_FLOAT32 ) | ||
| 18190 | hdr.format = 6; | ||
| 18191 | else if ( dataType == MY_FLOAT64 ) | ||
| 18192 | hdr.format = 7; | ||
| 18193 | |||
| 18194 | byteswap = false; | ||
| 18195 | if( little_endian ) | ||
| 18196 | { | ||
| 18197 | byteswap = true; | ||
| 18198 | swap32 ((unsigned char *)&hdr.hdr_length); | ||
| 18199 | swap32 ((unsigned char *)&hdr.format); | ||
| 18200 | swap32 ((unsigned char *)&hdr.sample_rate); | ||
| 18201 | swap32 ((unsigned char *)&hdr.num_channels); | ||
| 18202 | } | ||
| 18203 | |||
| 18204 | if ( fwrite(&hdr, 4, 10, fd) != 10 ) { | ||
| 18205 | sprintf(msg, "[chuck](via WvOut): Could not write SND header for file %s", name); | ||
| 18206 | return false; | ||
| 18207 | } | ||
| 18208 | |||
| 18209 | // printf("\nCreating SND file: %s\n", name); | ||
| 18210 | return true; | ||
| 18211 | } | ||
| 18212 | |||
| 18213 | void WvOut :: closeSndFile( void ) | ||
| 18214 | { | ||
| 18215 | int bytes_per_sample = 1; | ||
| 18216 | if ( dataType == STK_SINT16 ) | ||
| 18217 | bytes_per_sample = 2; | ||
| 18218 | else if ( dataType == STK_SINT32 ) | ||
| 18219 | bytes_per_sample = 4; | ||
| 18220 | else if ( dataType == MY_FLOAT32 ) | ||
| 18221 | bytes_per_sample = 4; | ||
| 18222 | else if ( dataType == MY_FLOAT64 ) | ||
| 18223 | bytes_per_sample = 8; | ||
| 18224 | |||
| 18225 | SINT32 bytes = totalCount * bytes_per_sample * channels; | ||
| 18226 | if( little_endian ) | ||
| 18227 | swap32 ((unsigned char *)&bytes); | ||
| 18228 | |||
| 18229 | fseek(fd, 8, SEEK_SET); // jump to data size | ||
| 18230 | fwrite(&bytes, 4, 1, fd); | ||
| 18231 | fclose(fd); | ||
| 18232 | } | ||
| 18233 | |||
| 18234 | bool WvOut :: setAifFile( const char *fileName ) | ||
| 18235 | { | ||
| 18236 | char name[128]; | ||
| 18237 | strncpy(name, fileName, 128); | ||
| 18238 | if ( strstr(name, ".aif") == NULL) strcat(name, ".aif"); | ||
| 18239 | fd = fopen(name, "wb"); | ||
| 18240 | if ( !fd ) { | ||
| 18241 | sprintf(msg, "[chuck](via WvOut): Could not create AIF file: %s", name); | ||
| 18242 | return false; | ||
| 18243 | } | ||
| 18244 | |||
| 18245 | // Common parts of AIFF/AIFC header. | ||
| 18246 | struct aifhdr hdr = {"FOR", 46, "AIF", "COM", 18, 0, 0, 16, "0"}; | ||
| 18247 | struct aifssnd ssnd = {"SSN", 8, 0, 0}; | ||
| 18248 | hdr.form[3] = 'M'; | ||
| 18249 | hdr.aiff[3] = 'F'; | ||
| 18250 | hdr.comm[3] = 'M'; | ||
| 18251 | ssnd.ssnd[3] = 'D'; | ||
| 18252 | hdr.num_chans = channels; | ||
| 18253 | if ( dataType == STK_SINT8 ) | ||
| 18254 | hdr.sample_size = 8; | ||
| 18255 | else if ( dataType == STK_SINT16 ) | ||
| 18256 | hdr.sample_size = 16; | ||
| 18257 | else if ( dataType == STK_SINT32 ) | ||
| 18258 | hdr.sample_size = 32; | ||
| 18259 | else if ( dataType == MY_FLOAT32 ) { | ||
| 18260 | hdr.aiff[3] = 'C'; | ||
| 18261 | hdr.sample_size = 32; | ||
| 18262 | hdr.comm_size = 24; | ||
| 18263 | } | ||
| 18264 | else if ( dataType == MY_FLOAT64 ) { | ||
| 18265 | hdr.aiff[3] = 'C'; | ||
| 18266 | hdr.sample_size = 64; | ||
| 18267 | hdr.comm_size = 24; | ||
| 18268 | } | ||
| 18269 | |||
| 18270 | // For AIFF files, the sample rate is stored in a 10-byte, | ||
| 18271 | // IEEE Standard 754 floating point number, so we need to | ||
| 18272 | // convert to that. | ||
| 18273 | SINT16 i; | ||
| 18274 | unsigned long exp; | ||
| 18275 | unsigned long rate = (unsigned long) Stk::sampleRate(); | ||
| 18276 | memset(hdr.srate, 0, 10); | ||
| 18277 | exp = rate; | ||
| 18278 | for (i=0; i<32; i++) { | ||
| 18279 | exp >>= 1; | ||
| 18280 | if (!exp) break; | ||
| 18281 | } | ||
| 18282 | i += 16383; | ||
| 18283 | if( little_endian ) | ||
| 18284 | swap16((unsigned char *)&i); | ||
| 18285 | |||
| 18286 | *(SINT16 *)(hdr.srate) = (SINT16) i; | ||
| 18287 | |||
| 18288 | for (i=32; i; i--) { | ||
| 18289 | if (rate & 0x80000000) break; | ||
| 18290 | rate <<= 1; | ||
| 18291 | } | ||
| 18292 | |||
| 18293 | if( little_endian ) | ||
| 18294 | swap32((unsigned char *)&rate); | ||
| 18295 | |||
| 18296 | *(unsigned long *)(hdr.srate+2) = (unsigned long) rate; | ||
| 18297 | |||
| 18298 | byteswap = false; | ||
| 18299 | if( little_endian ) | ||
| 18300 | { | ||
| 18301 | byteswap = true; | ||
| 18302 | swap32((unsigned char *)&hdr.form_size); | ||
| 18303 | swap32((unsigned char *)&hdr.comm_size); | ||
| 18304 | swap16((unsigned char *)&hdr.num_chans); | ||
| 18305 | swap16((unsigned char *)&hdr.sample_size); | ||
| 18306 | swap32((unsigned char *)&ssnd.ssnd_size); | ||
| 18307 | swap32((unsigned char *)&ssnd.offset); | ||
| 18308 | swap32((unsigned char *)&ssnd.block_size); | ||
| 18309 | } | ||
| 18310 | |||
| 18311 | // The structure boundaries don't allow a single write of 54 bytes. | ||
| 18312 | if ( fwrite(&hdr, 4, 5, fd) != 5 ) goto error; | ||
| 18313 | if ( fwrite(&hdr.num_chans, 2, 1, fd) != 1 ) goto error; | ||
| 18314 | if ( fwrite(&hdr.sample_frames, 4, 1, fd) != 1 ) goto error; | ||
| 18315 | if ( fwrite(&hdr.sample_size, 2, 1, fd) != 1 ) goto error; | ||
| 18316 | if ( fwrite(&hdr.srate, 10, 1, fd) != 1 ) goto error; | ||
| 18317 | |||
| 18318 | if ( dataType == MY_FLOAT32 ) { | ||
| 18319 | char type[4] = {'f','l','3','2'}; | ||
| 18320 | char zeroes[2] = { 0, 0 }; | ||
| 18321 | if ( fwrite(&type, 4, 1, fd) != 1 ) goto error; | ||
| 18322 | if ( fwrite(&zeroes, 2, 1, fd) != 1 ) goto error; | ||
| 18323 | } | ||
| 18324 | else if ( dataType == MY_FLOAT64 ) { | ||
| 18325 | char type[4] = {'f','l','6','4'}; | ||
| 18326 | char zeroes[2] = { 0, 0 }; | ||
| 18327 | if ( fwrite(&type, 4, 1, fd) != 1 ) goto error; | ||
| 18328 | if ( fwrite(&zeroes, 2, 1, fd) != 1 ) goto error; | ||
| 18329 | } | ||
| 18330 | |||
| 18331 | if ( fwrite(&ssnd, 4, 4, fd) != 4 ) goto error; | ||
| 18332 | |||
| 18333 | // printf("\nCreating AIF file: %s\n", name); | ||
| 18334 | return true; | ||
| 18335 | |||
| 18336 | error: | ||
| 18337 | sprintf(msg, "[chuck](via WvOut): Could not write AIF header for file %s", name); | ||
| 18338 | return false; | ||
| 18339 | } | ||
| 18340 | |||
| 18341 | void WvOut :: closeAifFile( void ) | ||
| 18342 | { | ||
| 18343 | unsigned long frames = (unsigned long) totalCount; | ||
| 18344 | if( little_endian ) | ||
| 18345 | swap32((unsigned char *)&frames); | ||
| 18346 | |||
| 18347 | fseek(fd, 22, SEEK_SET); // jump to "COMM" sample_frames | ||
| 18348 | fwrite(&frames, 4, 1, fd); | ||
| 18349 | |||
| 18350 | int bytes_per_sample = 1; | ||
| 18351 | if ( dataType == STK_SINT16 ) | ||
| 18352 | bytes_per_sample = 2; | ||
| 18353 | else if ( dataType == STK_SINT32 || dataType == MY_FLOAT32 ) | ||
| 18354 | bytes_per_sample = 4; | ||
| 18355 | else if ( dataType == MY_FLOAT64 ) | ||
| 18356 | bytes_per_sample = 8; | ||
| 18357 | |||
| 18358 | unsigned long bytes = totalCount * bytes_per_sample * channels + 46; | ||
| 18359 | if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) bytes += 6; | ||
| 18360 | if( little_endian ) | ||
| 18361 | swap32((unsigned char *)&bytes); | ||
| 18362 | |||
| 18363 | fseek(fd, 4, SEEK_SET); // jump to file size | ||
| 18364 | fwrite(&bytes, 4, 1, fd); | ||
| 18365 | |||
| 18366 | bytes = totalCount * bytes_per_sample * channels + 8; | ||
| 18367 | if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) bytes += 6; | ||
| 18368 | if( little_endian ) | ||
| 18369 | swap32((unsigned char *)&bytes); | ||
| 18370 | |||
| 18371 | if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) | ||
| 18372 | fseek(fd, 48, SEEK_SET); // jump to "SSND" chunk size | ||
| 18373 | else | ||
| 18374 | fseek(fd, 42, SEEK_SET); // jump to "SSND" chunk size | ||
| 18375 | fwrite(&bytes, 4, 1, fd); | ||
| 18376 | |||
| 18377 | fclose( fd ); | ||
| 18378 | } | ||
| 18379 | |||
| 18380 | bool WvOut :: setMatFile( const char *fileName ) | ||
| 18381 | { | ||
| 18382 | char name[128]; | ||
| 18383 | strncpy(name, fileName, 128); | ||
| 18384 | if ( strstr(name, ".mat") == NULL) strcat(name, ".mat"); | ||
| 18385 | fd = fopen(name, "w+b"); | ||
| 18386 | if ( !fd ) { | ||
| 18387 | sprintf(msg, "[chuck](via WvOut): Could not create MAT file: %s", name); | ||
| 18388 | return false; | ||
| 18389 | } | ||
| 18390 | |||
| 18391 | if ( dataType != MY_FLOAT64 ) { | ||
| 18392 | dataType = MY_FLOAT64; | ||
| 18393 | sprintf(msg, "[chuck](via WvOut): Using 64-bit floating-point data format for file %s", name); | ||
| 18394 | handleError(msg, StkError::WARNING); | ||
| 18395 | } | ||
| 18396 | |||
| 18397 | struct mathdr hdr; | ||
| 18398 | strcpy(hdr.heading,"MATLAB 5.0 MAT-file, Generated using the Synthesis ToolKit in C++ (STK). By Perry R. Cook and Gary P. Scavone, 1995-2002."); | ||
| 18399 | |||
| 18400 | int i; | ||
| 18401 | for (i=strlen(hdr.heading);i<124;i++) hdr.heading[i] = ' '; | ||
| 18402 | |||
| 18403 | // Header Flag Fields | ||
| 18404 | hdr.hff[0] = (SINT16) 0x0100; // Version field | ||
| 18405 | hdr.hff[1] = (SINT16) 'M'; // Endian indicator field ("MI") | ||
| 18406 | hdr.hff[1] <<= 8; | ||
| 18407 | hdr.hff[1] += 'I'; | ||
| 18408 | |||
| 18409 | hdr.adf[0] = (SINT32) 14; // Matlab array data type value | ||
| 18410 | hdr.adf[1] = (SINT32) 0; // Size of file after this point to end (in bytes) | ||
| 18411 | // Don't know size yet. | ||
| 18412 | |||
| 18413 | // Numeric Array Subelements (4): | ||
| 18414 | // 1. Array Flags | ||
| 18415 | hdr.adf[2] = (SINT32) 6; // Matlab 32-bit unsigned integer data type value | ||
| 18416 | hdr.adf[3] = (SINT32) 8; // 8 bytes of data to follow | ||
| 18417 | hdr.adf[4] = (SINT32) 6; // Double-precision array, no array flags set | ||
| 18418 | hdr.adf[5] = (SINT32) 0; // 4 bytes undefined | ||
| 18419 | // 2. Array Dimensions | ||
| 18420 | hdr.adf[6] = (SINT32) 5; // Matlab 32-bit signed integer data type value | ||
| 18421 | hdr.adf[7] = (SINT32) 8; // 8 bytes of data to follow (2D array) | ||
| 18422 | hdr.adf[8] = (SINT32) channels; // This is the number of rows | ||
| 18423 | hdr.adf[9] = (SINT32) 0; // This is the number of columns | ||
| 18424 | |||
| 18425 | // 3. Array Name | ||
| 18426 | // We'll use fileName for the matlab array name (as well as the file name). | ||
| 18427 | // If fileName is 4 characters or less, we have to use a compressed data element | ||
| 18428 | // format for the array name data element. Otherwise, the array name must | ||
| 18429 | // be formatted in 8-byte increments (up to 31 characters + NULL). | ||
| 18430 | SINT32 namelength = (SINT32) strlen(fileName); | ||
| 18431 | if (strstr(fileName, ".mat")) namelength -= 4; | ||
| 18432 | if (namelength > 31) namelength = 31; // Truncate name to 31 characters. | ||
| 18433 | char arrayName[64]; | ||
| 18434 | strncpy(arrayName, fileName, namelength); | ||
| 18435 | arrayName[namelength] = '\0'; | ||
| 18436 | if (namelength > 4) { | ||
| 18437 | hdr.adf[10] = (SINT32) 1; // Matlab 8-bit signed integer data type value | ||
| 18438 | } | ||
| 18439 | else { // Compressed data element format | ||
| 18440 | hdr.adf[10] = namelength; | ||
| 18441 | hdr.adf[10] <<= 16; | ||
| 18442 | hdr.adf[10] += 1; | ||
| 18443 | } | ||
| 18444 | SINT32 headsize = 40; // Number of bytes in data element so far. | ||
| 18445 | |||
| 18446 | // Write the fixed portion of the header | ||
| 18447 | if ( fwrite(&hdr, 172, 1, fd) != 1 ) goto error; | ||
| 18448 | |||
| 18449 | // Write MATLAB array name | ||
| 18450 | SINT32 tmp; | ||
| 18451 | if (namelength > 4) { | ||
| 18452 | if ( fwrite(&namelength, 4, 1, fd) != 1) goto error; | ||
| 18453 | if ( fwrite(arrayName, namelength, 1, fd) != 1 ) goto error; | ||
| 18454 | tmp = (SINT32) ceil((float)namelength / 8); | ||
| 18455 | if ( fseek(fd, tmp*8-namelength, SEEK_CUR) == -1 ) goto error; | ||
| 18456 | headsize += tmp * 8; | ||
| 18457 | } | ||
| 18458 | else { // Compressed data element format | ||
| 18459 | if ( fwrite(arrayName, namelength, 1, fd) != 1 ) goto error; | ||
| 18460 | tmp = 4 - namelength; | ||
| 18461 | if ( fseek(fd, tmp, SEEK_CUR) == -1 ) goto error; | ||
| 18462 | } | ||
| 18463 | |||
| 18464 | // Finish writing known header information | ||
| 18465 | tmp = 9; // Matlab IEEE 754 double data type | ||
| 18466 | if ( fwrite(&tmp, 4, 1, fd) != 1 ) goto error; | ||
| 18467 | tmp = 0; // Size of real part subelement in bytes (8 per sample) | ||
| 18468 | if ( fwrite(&tmp, 4, 1, fd) != 1 ) goto error; | ||
| 18469 | headsize += 8; // Total number of bytes in data element so far | ||
| 18470 | |||
| 18471 | if ( fseek(fd, 132, SEEK_SET) == -1 ) goto error; | ||
| 18472 | if ( fwrite(&headsize, 4, 1, fd) != 1 ) goto error; // Write header size ... will update at end | ||
| 18473 | if ( fseek(fd, 0, SEEK_END) == -1 ) goto error; | ||
| 18474 | |||
| 18475 | byteswap = false; | ||
| 18476 | CK_FPRINTF_STDERR( "[chuck]:(via STK): creating MAT-file (%s) containing MATLAB array: %s\n", name, arrayName); | ||
| 18477 | return true; | ||
| 18478 | |||
| 18479 | error: | ||
| 18480 | sprintf(msg, "[chuck](via WvOut): Could not write MAT-file header for file %s", name); | ||
| 18481 | return false; | ||
| 18482 | } | ||
| 18483 | |||
| 18484 | void WvOut :: closeMatFile( void ) | ||
| 18485 | { | ||
| 18486 | fseek(fd, 164, SEEK_SET); // jump to number of columns | ||
| 18487 | fwrite(&totalCount, 4, 1, fd); | ||
| 18488 | |||
| 18489 | SINT32 headsize, temp; | ||
| 18490 | fseek(fd, 132, SEEK_SET); // jump to header size | ||
| 18491 | fread(&headsize, 4, 1, fd); | ||
| 18492 | temp = headsize; | ||
| 18493 | headsize += (SINT32) (totalCount * 8 * channels); | ||
| 18494 | fseek(fd, 132, SEEK_SET); | ||
| 18495 | // Write file size (minus some header info) | ||
| 18496 | fwrite(&headsize, 4, 1, fd); | ||
| 18497 | |||
| 18498 | fseek(fd, temp+132, SEEK_SET); // jumpt to data size (in bytes) | ||
| 18499 | temp = totalCount * 8 * channels; | ||
| 18500 | fwrite(&temp, 4, 1, fd); | ||
| 18501 | |||
| 18502 | fclose(fd); | ||
| 18503 | } | ||
| 18504 | |||
| 18505 | unsigned long WvOut :: getFrames( void ) const | ||
| 18506 | { | ||
| 18507 | return totalCount; | ||
| 18508 | } | ||
| 18509 | |||
| 18510 | MY_FLOAT WvOut :: getTime( void ) const | ||
| 18511 | { | ||
| 18512 | return (MY_FLOAT) totalCount / Stk::sampleRate(); | ||
| 18513 | } | ||
| 18514 | |||
| 18515 | void WvOut :: writeData( unsigned long frames ) | ||
| 18516 | { | ||
| 18517 | // make sure we have file descriptor | ||
| 18518 | if( !fd ) return; | ||
| 18519 | |||
| 18520 | if ( dataType == STK_SINT8 ) { | ||
| 18521 | if ( fileType == WVOUT_WAV ) { // 8-bit WAV data is unsigned! | ||
| 18522 | for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18523 | float float_sample = data[k] * 127.0 + 128.0; | ||
| 18524 | if(float_sample < 0) float_sample = 0; | ||
| 18525 | if(float_sample > 255) float_sample = 255; | ||
| 18526 | unsigned char sample = (unsigned char) float_sample; | ||
| 18527 | |||
| 18528 | if ( fwrite(&sample, 1, 1, fd) != 1 ) goto error; | ||
| 18529 | } | ||
| 18530 | } | ||
| 18531 | else { | ||
| 18532 | for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18533 | float float_sample = data[k] * 127.0; | ||
| 18534 | if(float_sample < -128) float_sample = -128; | ||
| 18535 | if(float_sample > 127) float_sample = 127; | ||
| 18536 | signed char sample = (signed char) float_sample; | ||
| 18537 | |||
| 18538 | if ( fwrite(&sample, 1, 1, fd) != 1 ) goto error; | ||
| 18539 | } | ||
| 18540 | } | ||
| 18541 | } | ||
| 18542 | else if ( dataType == STK_SINT16 ) { | ||
| 18543 | for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18544 | float float_sample = data[k] * 32767.0; | ||
| 18545 | if(float_sample < -32767) float_sample = -32767; | ||
| 18546 | if(float_sample > 32767) float_sample = 32767; | ||
| 18547 | SINT16 sample = (SINT16) float_sample; | ||
| 18548 | |||
| 18549 | if ( byteswap ) swap16( (unsigned char *)&sample ); | ||
| 18550 | if ( fwrite(&sample, 2, 1, fd) != 1 ) goto error; | ||
| 18551 | } | ||
| 18552 | } | ||
| 18553 | else if ( dataType == STK_SINT32 ) { | ||
| 18554 | for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18555 | float float_sample = data[k] * 32767.0; | ||
| 18556 | if(float_sample < -2147483647) float_sample = (float)-2147483647; | ||
| 18557 | if(float_sample > 2147483647) float_sample = (float)2147483647; | ||
| 18558 | SINT32 sample = (SINT32) float_sample; | ||
| 18559 | |||
| 18560 | if ( byteswap ) swap32( (unsigned char *)&sample ); | ||
| 18561 | if ( fwrite(&sample, 4, 1, fd) != 1 ) goto error; | ||
| 18562 | } | ||
| 18563 | } | ||
| 18564 | else if ( dataType == MY_FLOAT32 ) { | ||
| 18565 | FLOAT32 sample; | ||
| 18566 | for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18567 | sample = (FLOAT32) (data[k]); | ||
| 18568 | |||
| 18569 | if ( byteswap ) swap32( (unsigned char *)&sample ); | ||
| 18570 | if ( fwrite(&sample, 4, 1, fd) != 1 ) goto error; | ||
| 18571 | } | ||
| 18572 | } | ||
| 18573 | else if ( dataType == MY_FLOAT64 ) { | ||
| 18574 | FLOAT64 sample; | ||
| 18575 | for ( unsigned long k=0; k<frames*channels; k++ ) { | ||
| 18576 | sample = (FLOAT64) (data[k]); | ||
| 18577 | |||
| 18578 | if ( byteswap ) swap64( (unsigned char *)&sample ); | ||
| 18579 | if ( fwrite(&sample, 8, 1, fd) != 1 ) goto error; | ||
| 18580 | } | ||
| 18581 | } | ||
| 18582 | |||
| 18583 | flush += frames; | ||
| 18584 | if( flush >= 8192 ) | ||
| 18585 | { | ||
| 18586 | flush = 0; | ||
| 18587 | fflush( fd ); | ||
| 18588 | } | ||
| 18589 | |||
| 18590 | return; | ||
| 18591 | |||
| 18592 | error: | ||
| 18593 | sprintf(msg, "[chuck](via WvOut): Error writing data to file."); | ||
| 18594 | handleError(msg, StkError::FILE_ERROR); | ||
| 18595 | } | ||
| 18596 | |||
| 18597 | void WvOut :: tick(const MY_FLOAT sample) | ||
| 18598 | { | ||
| 18599 | if ( !fd ) return; | ||
| 18600 | |||
| 18601 | for ( unsigned int j=0; j<channels; j++ ) | ||
| 18602 | data[counter*channels+j] = sample; | ||
| 18603 | |||
| 18604 | counter++; | ||
| 18605 | totalCount++; | ||
| 18606 | |||
| 18607 | if ( counter == BUFFER_SIZE ) { | ||
| 18608 | writeData( BUFFER_SIZE ); | ||
| 18609 | counter = 0; | ||
| 18610 | } | ||
| 18611 | } | ||
| 18612 | |||
| 18613 | void WvOut :: tick(const MY_FLOAT *vec, unsigned int vectorSize) | ||
| 18614 | { | ||
| 18615 | if ( !fd ) return; | ||
| 18616 | |||
| 18617 | for (unsigned int i=0; i<vectorSize; i++) | ||
| 18618 | tick( vec[i] ); | ||
| 18619 | } | ||
| 18620 | |||
| 18621 | void WvOut :: tickFrame(const MY_FLOAT *frameVector, unsigned int frames) | ||
| 18622 | { | ||
| 18623 | if ( !fd ) return; | ||
| 18624 | |||
| 18625 | unsigned int j; | ||
| 18626 | for ( unsigned int i=0; i<frames; i++ ) { | ||
| 18627 | for ( j=0; j<channels; j++ ) { | ||
| 18628 | data[counter*channels+j] = frameVector[i*channels+j]; | ||
| 18629 | } | ||
| 18630 | counter++; | ||
| 18631 | totalCount++; | ||
| 18632 | |||
| 18633 | if ( counter == BUFFER_SIZE ) { | ||
| 18634 | writeData( BUFFER_SIZE ); | ||
| 18635 | counter = 0; | ||
| 18636 | } | ||
| 18637 | } | ||
| 18638 | } | ||
| 18639 | #endif //__DISABLE_WVOUT__ | ||
| 18640 | |||
| 18641 | |||
| 18642 | |||
| 18643 | |||
| 18644 | /**********************************************************************/ | ||
| 18645 | /*! \class MidiFileIn | ||
| 18646 | \brief A standard MIDI file reading/parsing class. | ||
| 18647 | |||
| 18648 | This class can be used to read events from a standard MIDI file. | ||
| 18649 | Event bytes are copied to a C++ vector and must be subsequently | ||
| 18650 | interpreted by the user. The function getNextMidiEvent() skips | ||
| 18651 | meta and sysex events, returning only MIDI channel messages. | ||
| 18652 | Event delta-times are returned in the form of "ticks" and a | ||
| 18653 | function is provided to determine the current "seconds per tick". | ||
| 18654 | Tempo changes are internally tracked by the class and reflected in | ||
| 18655 | the values returned by the function getTickSeconds(). | ||
| 18656 | |||
| 18657 | by Gary P. Scavone, 2003 - 2010. | ||
| 18658 | */ | ||
| 18659 | /**********************************************************************/ | ||
| 18660 | |||
| 18661 | #include <cstring> | ||
| 18662 | #include <iostream> | ||
| 18663 | |||
| 18664 | #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) | ||
| 18665 | #define __LITTLE_ENDIAN__ | ||
| 18666 | #endif // !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) | ||
| 18667 | |||
| 18668 | namespace stk { | ||
| 18669 | |||
| 18670 | MidiFileIn :: MidiFileIn( std::string fileName ) | ||
| 18671 | { | ||
| 18672 | // Attempt to open the file. | ||
| 18673 | file_.open( fileName.c_str(), std::ios::in | std::ios::binary ); | ||
| 18674 | if ( !file_ ) { | ||
| 18675 | CK_STDCOUT << "MidiFileIn: error opening or finding file (" << fileName << ")."; | ||
| 18676 | handleError( "", StkError::FILE_NOT_FOUND ); | ||
| 18677 | } | ||
| 18678 | |||
| 18679 | // Parse header info. | ||
| 18680 | char chunkType[4]; | ||
| 18681 | char buffer[4]; | ||
| 18682 | SINT32 *length; | ||
| 18683 | if ( !file_.read( chunkType, 4 ) ) goto error; | ||
| 18684 | if ( !file_.read( buffer, 4 ) ) goto error; | ||
| 18685 | #ifdef __LITTLE_ENDIAN__ | ||
| 18686 | swap32((unsigned char *)&buffer); | ||
| 18687 | #endif | ||
| 18688 | length = (SINT32 *) &buffer; | ||
| 18689 | if ( strncmp( chunkType, "MThd", 4 ) || ( *length != 6 ) ) { | ||
| 18690 | CK_STDCOUT << "MidiFileIn: file (" << fileName << ") does not appear to be a MIDI file!"; | ||
| 18691 | handleError( "", StkError::FILE_UNKNOWN_FORMAT ); | ||
| 18692 | } | ||
| 18693 | |||
| 18694 | // Read the MIDI file format. | ||
| 18695 | SINT16 *data; | ||
| 18696 | if ( !file_.read( buffer, 2 ) ) goto error; | ||
| 18697 | #ifdef __LITTLE_ENDIAN__ | ||
| 18698 | swap16((unsigned char *)&buffer); | ||
| 18699 | #endif | ||
| 18700 | data = (SINT16 *) &buffer; | ||
| 18701 | if ( *data < 0 || *data > 2 ) { | ||
| 18692 | CK_STDCOUT << "MidiFileIn: the file (" << fileName << ") format is invalid!"; | 18702 | CK_STDCOUT << "MidiFileIn: the file (" << fileName << ") format is invalid!"; |
| 18693 | handleError( "", StkError::FILE_ERROR ); | 18703 | handleError( "", StkError::FILE_ERROR ); |
| 18694 | } | 18704 | } |
| @@ -20472,173 +20482,412 @@ struct Brass_ · 1777 unmodified lines | |||
| 20472 | imp = new Brass(d); | 20482 | imp = new Brass(d); |
| 20473 | m_frequency = 100.0; | 20483 | m_frequency = 100.0; |
| 20474 | m_rate = 0.5; | 20484 | m_rate = 0.5; |
| 20475 | m_lip = 0.1; | 20485 | m_lip = 0.1; |
| 20476 | } | 20486 | } |
| 20477 | 20487 | ||
| 20478 | ~Brass_() | 20488 | ~Brass_() |
| 20479 | { | 20489 | { |
| 20480 | SAFE_DELETE( imp ); | 20490 | SAFE_DELETE( imp ); |
| 20491 | } | ||
| 20492 | }; */ | ||
| 20493 | |||
| 20494 | |||
| 20495 | //----------------------------------------------------------------------------- | ||
| 20496 | // name: Brass_ctor() | ||
| 20497 | // desc: CTOR function ... | ||
| 20498 | //----------------------------------------------------------------------------- | ||
| 20499 | CK_DLL_CTOR( Brass_ctor ) | ||
| 20500 | { | ||
| 20501 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)new Brass( 20.0 ); | ||
| 20502 | } | ||
| 20503 | |||
| 20504 | |||
| 20505 | //----------------------------------------------------------------------------- | ||
| 20506 | // name: Brass_dtor() | ||
| 20507 | // desc: DTOR function ... | ||
| 20508 | //----------------------------------------------------------------------------- | ||
| 20509 | CK_DLL_DTOR( Brass_dtor ) | ||
| 20510 | { | ||
| 20511 | delete (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20512 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; | ||
| 20513 | } | ||
| 20514 | |||
| 20515 | |||
| 20516 | //----------------------------------------------------------------------------- | ||
| 20517 | // name: Brass_tick() | ||
| 20518 | // desc: TICK function ... | ||
| 20519 | //----------------------------------------------------------------------------- | ||
| 20520 | CK_DLL_TICK( Brass_tick ) | ||
| 20521 | { | ||
| 20522 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20523 | *out = b->tick(); | ||
| 20524 | return TRUE; | ||
| 20525 | } | ||
| 20526 | |||
| 20527 | |||
| 20528 | //----------------------------------------------------------------------------- | ||
| 20529 | // name: Brass_pmsg() | ||
| 20530 | // desc: PMSG function ... | ||
| 20531 | //----------------------------------------------------------------------------- | ||
| 20532 | CK_DLL_PMSG( Brass_pmsg ) | ||
| 20533 | { | ||
| 20534 | return TRUE; | ||
| 20535 | } | ||
| 20536 | |||
| 20537 | |||
| 20538 | //----------------------------------------------------------------------------- | ||
| 20539 | // name: Brass_ctrl_startBlowing() | ||
| 20540 | // desc: CTRL function ... | ||
| 20541 | //----------------------------------------------------------------------------- | ||
| 20542 | CK_DLL_CTRL( Brass_ctrl_startBlowing ) | ||
| 20543 | { | ||
| 20544 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20545 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 20546 | b->startBlowing( f, b->m_rate ); | ||
| 20547 | } | ||
| 20548 | |||
| 20549 | |||
| 20550 | //----------------------------------------------------------------------------- | ||
| 20551 | // name: Brass_ctrl_stopBlowing() | ||
| 20552 | // desc: CTRL function ... | ||
| 20553 | //----------------------------------------------------------------------------- | ||
| 20554 | CK_DLL_CTRL( Brass_ctrl_stopBlowing ) | ||
| 20555 | { | ||
| 20556 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20557 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 20558 | b->stopBlowing( f ); | ||
| 20559 | } | ||
| 20560 | |||
| 20561 | |||
| 20562 | //----------------------------------------------------------------------------- | ||
| 20563 | // name: Brass_ctrl_clear() | ||
| 20564 | // desc: CTRL function ... | ||
| 20565 | //----------------------------------------------------------------------------- | ||
| 20566 | CK_DLL_CTRL( Brass_ctrl_clear ) | ||
| 20567 | { | ||
| 20568 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20569 | b->clear(); | ||
| 20570 | } | ||
| 20571 | |||
| 20572 | |||
| 20573 | //----------------------------------------------------------------------------- | ||
| 20574 | // name: Brass_ctrl_rate() | ||
| 20575 | // desc: CTRL function ... | ||
| 20576 | //----------------------------------------------------------------------------- | ||
| 20577 | CK_DLL_CTRL( Brass_ctrl_rate ) | ||
| 20578 | { | ||
| 20579 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20580 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 20581 | b->m_rate = f; | ||
| 20582 | RETURN->v_float = (t_CKFLOAT)b->m_rate; | ||
| 20583 | } | ||
| 20584 | |||
| 20585 | |||
| 20586 | //----------------------------------------------------------------------------- | ||
| 20587 | // name: Brass_cget_rate() | ||
| 20588 | // desc: CGET function ... | ||
| 20589 | //----------------------------------------------------------------------------- | ||
| 20590 | CK_DLL_CGET( Brass_cget_rate ) | ||
| 20591 | { | ||
| 20592 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20593 | RETURN->v_float = (t_CKFLOAT)b->m_rate; | ||
| 20594 | } | ||
| 20595 | |||
| 20596 | |||
| 20597 | //----------------------------------------------------------------------------- | ||
| 20598 | // name: Brass_ctrl_lip() | ||
| 20599 | // desc: CTRL function ... | ||
| 20600 | //----------------------------------------------------------------------------- | ||
| 20601 | CK_DLL_CTRL( Brass_ctrl_lip ) | ||
| 20602 | { | ||
| 20603 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20604 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 20605 | b->controlChange( 2, f * 128.0 ); | ||
| 20606 | RETURN->v_float = (t_CKFLOAT)b->m_lip; | ||
| 20607 | } | ||
| 20608 | |||
| 20609 | |||
| 20610 | //----------------------------------------------------------------------------- | ||
| 20611 | // name: Brass_cget_lip() | ||
| 20612 | // desc: CGET function ... | ||
| 20613 | //----------------------------------------------------------------------------- | ||
| 20614 | CK_DLL_CGET( Brass_cget_lip ) | ||
| 20615 | { | ||
| 20616 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20617 | RETURN->v_float = (t_CKFLOAT)b->m_lip; | ||
| 20618 | } | ||
| 20619 | |||
| 20620 | |||
| 20621 | //----------------------------------------------------------------------------- | ||
| 20622 | // name: Brass_ctrl_slide() | ||
| 20623 | // desc: CTRL function ... | ||
| 20624 | //----------------------------------------------------------------------------- | ||
| 20625 | CK_DLL_CTRL( Brass_ctrl_slide ) | ||
| 20626 | { | ||
| 20627 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20628 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 20629 | b->controlChange( 4, f * 128.0 ); | ||
| 20630 | RETURN->v_float = (t_CKFLOAT)b->m_slide; | ||
| 20631 | } | ||
| 20632 | |||
| 20633 | |||
| 20634 | //----------------------------------------------------------------------------- | ||
| 20635 | // name: Brass_cget_slide() | ||
| 20636 | // desc: CGET function ... | ||
| 20637 | //----------------------------------------------------------------------------- | ||
| 20638 | CK_DLL_CGET( Brass_cget_slide ) | ||
| 20639 | { | ||
| 20640 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20641 | RETURN->v_float = (t_CKFLOAT)b->m_slide; | ||
| 20642 | } | ||
| 20643 | |||
| 20644 | |||
| 20645 | //----------------------------------------------------------------------------- | ||
| 20646 | // name: Brass_ctrl_vibratoFreq() | ||
| 20647 | // desc: CTRL function ... | ||
| 20648 | //----------------------------------------------------------------------------- | ||
| 20649 | CK_DLL_CTRL( Brass_ctrl_vibratoFreq ) | ||
| 20650 | { | ||
| 20651 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20652 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 20653 | b->setVibratoFreq( f ); | ||
| 20654 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; | ||
| 20655 | } | ||
| 20656 | |||
| 20657 | |||
| 20658 | //----------------------------------------------------------------------------- | ||
| 20659 | // name: Brass_cget_vibratoFreq() | ||
| 20660 | // desc: CGET function ... | ||
| 20661 | //----------------------------------------------------------------------------- | ||
| 20662 | CK_DLL_CGET( Brass_cget_vibratoFreq ) | ||
| 20663 | { | ||
| 20664 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20665 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; | ||
| 20666 | } | ||
| 20667 | |||
| 20668 | |||
| 20669 | //----------------------------------------------------------------------------- | ||
| 20670 | // name: Brass_ctrl_vibratoGain() | ||
| 20671 | // desc: CTRL function ... | ||
| 20672 | //----------------------------------------------------------------------------- | ||
| 20673 | CK_DLL_CTRL( Brass_ctrl_vibratoGain ) | ||
| 20674 | { | ||
| 20675 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20676 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 20677 | b->controlChange( 1, f * 128.0 ); | ||
| 20678 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; | ||
| 20679 | } | ||
| 20680 | |||
| 20681 | |||
| 20682 | //----------------------------------------------------------------------------- | ||
| 20683 | // name: Brass_cget_vibratoGain() | ||
| 20684 | // desc: CGET function ... | ||
| 20685 | //----------------------------------------------------------------------------- | ||
| 20686 | CK_DLL_CGET( Brass_cget_vibratoGain) | ||
| 20687 | { | ||
| 20688 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20689 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; | ||
| 20690 | } | ||
| 20691 | |||
| 20692 | |||
| 20693 | //----------------------------------------------------------------------------- | ||
| 20694 | // name: Brass_ctrl_volume() | ||
| 20695 | // desc: CTRL function ... | ||
| 20696 | //----------------------------------------------------------------------------- | ||
| 20697 | CK_DLL_CTRL( Brass_ctrl_volume ) | ||
| 20698 | { | ||
| 20699 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20700 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 20701 | b->controlChange( 128, f * 128.0 ); | ||
| 20702 | RETURN->v_float = (t_CKFLOAT)b->m_volume; | ||
| 20703 | } | ||
| 20704 | |||
| 20705 | |||
| 20706 | //----------------------------------------------------------------------------- | ||
| 20707 | // name: Brass_cget_volume() | ||
| 20708 | // desc: CGET function ... | ||
| 20709 | //----------------------------------------------------------------------------- | ||
| 20710 | CK_DLL_CGET( Brass_cget_volume ) | ||
| 20711 | { | ||
| 20712 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 20713 | RETURN->v_float = (t_CKFLOAT)b->m_volume; | ||
| 20714 | } | ||
| 20715 | |||
| 20716 | |||
| 20717 | |||
| 20718 | |||
| 20719 | /* | ||
| 20720 | struct Clarinet_ { | ||
| 20721 | Clarinet * imp; | ||
| 20722 | double m_frequency; | ||
| 20723 | double m_rate; | ||
| 20724 | double m_reed; | ||
| 20725 | Clarinet_ ( double d ) { | ||
| 20726 | imp = new Clarinet(d); | ||
| 20727 | m_frequency = 100.0; | ||
| 20728 | m_rate = 0.5; | ||
| 20729 | m_reed = 0.5; | ||
| 20481 | } | 20730 | } |
| 20482 | }; */ | 20731 | }; */ |
| 20483 | 20732 | ||
| 20484 | 20733 | ||
| 20734 | // Clarinet | ||
| 20485 | //----------------------------------------------------------------------------- | 20735 | //----------------------------------------------------------------------------- |
| 20486 | // name: Brass_ctor() | 20736 | // name: Clarinet_ctor() |
| 20487 | // desc: CTOR function ... | 20737 | // desc: CTOR function ... |
| 20488 | //----------------------------------------------------------------------------- | 20738 | //----------------------------------------------------------------------------- |
| 20489 | CK_DLL_CTOR( Brass_ctor ) | 20739 | CK_DLL_CTOR( Clarinet_ctor ) |
| 20490 | { | 20740 | { |
| 20491 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)new Brass( 20.0 ); | 20741 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)new Clarinet( 30.0 ); |
| 20492 | } | 20742 | } |
| 20493 | 20743 | ||
| 20494 | 20744 | ||
| 20495 | //----------------------------------------------------------------------------- | 20745 | //----------------------------------------------------------------------------- |
| 20496 | // name: Brass_dtor() | 20746 | // name: Clarinet_dtor() |
| 20497 | // desc: DTOR function ... | 20747 | // desc: DTOR function ... |
| 20498 | //----------------------------------------------------------------------------- | 20748 | //----------------------------------------------------------------------------- |
| 20499 | CK_DLL_DTOR( Brass_dtor ) | 20749 | CK_DLL_DTOR( Clarinet_dtor ) |
| 20500 | { | 20750 | { |
| 20501 | delete (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20751 | delete (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20502 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; | 20752 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; |
| 20503 | } | 20753 | } |
| 20504 | 20754 | ||
| 20505 | |||
| 20506 | //----------------------------------------------------------------------------- | 20755 | //----------------------------------------------------------------------------- |
| 20507 | // name: Brass_tick() | 20756 | // name: Clarinet_tick() |
| 20508 | // desc: TICK function ... | 20757 | // desc: TICK function ... |
| 20509 | //----------------------------------------------------------------------------- | 20758 | //----------------------------------------------------------------------------- |
| 20510 | CK_DLL_TICK( Brass_tick ) | 20759 | CK_DLL_TICK( Clarinet_tick ) |
| 20511 | { | 20760 | { |
| 20512 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20761 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20513 | *out = b->tick(); | 20762 | *out = b->tick(); |
| 20514 | return TRUE; | 20763 | return TRUE; |
| 20515 | } | 20764 | } |
| 20516 | 20765 | ||
| 20517 | 20766 | ||
| 20518 | //----------------------------------------------------------------------------- | 20767 | //----------------------------------------------------------------------------- |
| 20519 | // name: Brass_pmsg() | 20768 | // name: Clarinet_pmsg() |
| 20520 | // desc: PMSG function ... | 20769 | // desc: PMSG function ... |
| 20521 | //----------------------------------------------------------------------------- | 20770 | //----------------------------------------------------------------------------- |
| 20522 | CK_DLL_PMSG( Brass_pmsg ) | 20771 | CK_DLL_PMSG( Clarinet_pmsg ) |
| 20523 | { | 20772 | { |
| 20524 | return TRUE; | 20773 | return TRUE; |
| 20525 | } | 20774 | } |
| 20526 | 20775 | ||
| 20527 | 20776 | ||
| 20528 | //----------------------------------------------------------------------------- | 20777 | //----------------------------------------------------------------------------- |
| 20529 | // name: Brass_ctrl_startBlowing() | 20778 | // name: Clarinet_ctrl_startBlowing() |
| 20530 | // desc: CTRL function ... | 20779 | // desc: CTRL function ... |
| 20531 | //----------------------------------------------------------------------------- | 20780 | //----------------------------------------------------------------------------- |
| 20532 | CK_DLL_CTRL( Brass_ctrl_startBlowing ) | 20781 | CK_DLL_CTRL( Clarinet_ctrl_startBlowing ) |
| 20533 | { | 20782 | { |
| 20534 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20783 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20535 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 20784 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20536 | b->startBlowing( f, b->m_rate ); | 20785 | b->startBlowing( f, b->m_rate ); |
| 20537 | } | 20786 | } |
| 20538 | 20787 | ||
| 20539 | 20788 | ||
| 20540 | //----------------------------------------------------------------------------- | 20789 | //----------------------------------------------------------------------------- |
| 20541 | // name: Brass_ctrl_stopBlowing() | 20790 | // name: Clarinet_ctrl_stopBlowing() |
| 20542 | // desc: CTRL function ... | 20791 | // desc: CTRL function ... |
| 20543 | //----------------------------------------------------------------------------- | 20792 | //----------------------------------------------------------------------------- |
| 20544 | CK_DLL_CTRL( Brass_ctrl_stopBlowing ) | 20793 | CK_DLL_CTRL( Clarinet_ctrl_stopBlowing ) |
| 20545 | { | 20794 | { |
| 20546 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20795 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20547 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 20796 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20548 | b->stopBlowing( f ); | 20797 | b->stopBlowing( f ); |
| 20549 | } | 20798 | } |
| 20550 | 20799 | ||
| 20551 | 20800 | ||
| 20552 | //----------------------------------------------------------------------------- | 20801 | //----------------------------------------------------------------------------- |
| 20553 | // name: Brass_ctrl_clear() | 20802 | // name: Clarinet_ctrl_clear() |
| 20554 | // desc: CTRL function ... | 20803 | // desc: CTRL function ... |
| 20555 | //----------------------------------------------------------------------------- | 20804 | //----------------------------------------------------------------------------- |
| 20556 | CK_DLL_CTRL( Brass_ctrl_clear ) | 20805 | CK_DLL_CTRL( Clarinet_ctrl_clear ) |
| 20557 | { | 20806 | { |
| 20558 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20807 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20559 | b->clear(); | 20808 | b->clear(); |
| 20560 | } | 20809 | } |
| 20561 | 20810 | ||
| 20562 | 20811 | ||
| 20563 | //----------------------------------------------------------------------------- | 20812 | //----------------------------------------------------------------------------- |
| 20564 | // name: Brass_ctrl_rate() | 20813 | // name: Clarinet_ctrl_reed() |
| 20565 | // desc: CTRL function ... | 20814 | // desc: CTRL function ... |
| 20566 | //----------------------------------------------------------------------------- | 20815 | //----------------------------------------------------------------------------- |
| 20567 | CK_DLL_CTRL( Brass_ctrl_rate ) | 20816 | CK_DLL_CTRL( Clarinet_ctrl_reed ) |
| 20568 | { | 20817 | { |
| 20569 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20818 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20570 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 20819 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20571 | b->m_rate = f; | 20820 | b->controlChange( 2, f * 128.0 ); |
| 20572 | RETURN->v_float = (t_CKFLOAT)b->m_rate; | 20821 | RETURN->v_float = (t_CKFLOAT)b->m_reed; |
| 20573 | } | 20822 | } |
| 20574 | 20823 | ||
| 20575 | 20824 | ||
| 20576 | //----------------------------------------------------------------------------- | 20825 | //----------------------------------------------------------------------------- |
| 20577 | // name: Brass_cget_rate() | 20826 | // name: Clarinet_cget_reed() |
| 20578 | // desc: CGET function ... | 20827 | // desc: CGET function ... |
| 20579 | //----------------------------------------------------------------------------- | 20828 | //----------------------------------------------------------------------------- |
| 20580 | CK_DLL_CGET( Brass_cget_rate ) | 20829 | CK_DLL_CGET( Clarinet_cget_reed ) |
| 20581 | { | 20830 | { |
| 20582 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20831 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20583 | RETURN->v_float = (t_CKFLOAT)b->m_rate; | 20832 | RETURN->v_float = (t_CKFLOAT)b->m_reed; |
| 20584 | } | 20833 | } |
| 20585 | 20834 | ||
| 20586 | 20835 | ||
| 20587 | //----------------------------------------------------------------------------- | 20836 | //----------------------------------------------------------------------------- |
| 20588 | // name: Brass_ctrl_lip() | 20837 | // name: Clarinet_ctrl_rate() |
| 20589 | // desc: CTRL function ... | 20838 | // desc: CTRL function ... |
| 20590 | //----------------------------------------------------------------------------- | 20839 | //----------------------------------------------------------------------------- |
| 20591 | CK_DLL_CTRL( Brass_ctrl_lip ) | 20840 | CK_DLL_CTRL( Clarinet_ctrl_rate ) |
| 20592 | { | 20841 | { |
| 20593 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20842 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20594 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 20843 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20595 | b->controlChange( 2, f * 128.0 ); | 20844 | b->m_rate = f; |
| 20596 | RETURN->v_float = (t_CKFLOAT)b->m_lip; | 20845 | RETURN->v_float = (t_CKFLOAT)b->m_rate; |
| 20597 | } | 20846 | } |
| 20598 | 20847 | ||
| 20599 | 20848 | ||
| 20600 | //----------------------------------------------------------------------------- | 20849 | //----------------------------------------------------------------------------- |
| 20601 | // name: Brass_cget_lip() | 20850 | // name: Clarinet_cget_rate() |
| 20602 | // desc: CGET function ... | 20851 | // desc: CGET function ... |
| 20603 | //----------------------------------------------------------------------------- | 20852 | //----------------------------------------------------------------------------- |
| 20604 | CK_DLL_CGET( Brass_cget_lip ) | 20853 | CK_DLL_CGET( Clarinet_cget_rate ) |
| 20605 | { | 20854 | { |
| 20606 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20855 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20607 | RETURN->v_float = (t_CKFLOAT)b->m_lip; | 20856 | RETURN->v_float = (t_CKFLOAT) b->m_rate; |
| 20608 | } | 20857 | } |
| 20609 | 20858 | ||
| 20610 | 20859 | ||
| 20611 | //----------------------------------------------------------------------------- | 20860 | //----------------------------------------------------------------------------- |
| 20612 | // name: Brass_ctrl_slide() | 20861 | // name: Clarinet_ctrl_noiseGain() |
| 20613 | // desc: CTRL function ... | 20862 | // desc: CTRL function ... |
| 20614 | //----------------------------------------------------------------------------- | 20863 | //----------------------------------------------------------------------------- |
| 20615 | CK_DLL_CTRL( Brass_ctrl_slide ) | 20864 | CK_DLL_CTRL( Clarinet_ctrl_noiseGain ) |
| 20616 | { | 20865 | { |
| 20617 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20866 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20618 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 20867 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20619 | b->controlChange( 4, f * 128.0 ); | 20868 | b->controlChange( 4, f * 128.0 ); |
| 20620 | RETURN->v_float = (t_CKFLOAT)b->m_slide; | 20869 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; |
| 20621 | } | 20870 | } |
| 20622 | 20871 | ||
| 20623 | 20872 | ||
| 20624 | //----------------------------------------------------------------------------- | 20873 | //----------------------------------------------------------------------------- |
| 20625 | // name: Brass_cget_slide() | 20874 | // name: Clarinet_cget_noiseGain() |
| 20626 | // desc: CGET function ... | 20875 | // desc: CGET function ... |
| 20627 | //----------------------------------------------------------------------------- | 20876 | //----------------------------------------------------------------------------- |
| 20628 | CK_DLL_CGET( Brass_cget_slide ) | 20877 | CK_DLL_CGET( Clarinet_cget_noiseGain ) |
| 20629 | { | 20878 | { |
| 20630 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20879 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20631 | RETURN->v_float = (t_CKFLOAT)b->m_slide; | 20880 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; |
| 20632 | } | 20881 | } |
| 20633 | 20882 | ||
| 20634 | 20883 | ||
| 20635 | //----------------------------------------------------------------------------- | 20884 | //----------------------------------------------------------------------------- |
| 20636 | // name: Brass_ctrl_vibratoFreq() | 20885 | // name: Clarinet_ctrl_vibratoFreq() |
| 20637 | // desc: CTRL function ... | 20886 | // desc: CTRL function ... |
| 20638 | //----------------------------------------------------------------------------- | 20887 | //----------------------------------------------------------------------------- |
| 20639 | CK_DLL_CTRL( Brass_ctrl_vibratoFreq ) | 20888 | CK_DLL_CTRL( Clarinet_ctrl_vibratoFreq ) |
| 20640 | { | 20889 | { |
| 20641 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20890 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20642 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 20891 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20643 | b->setVibratoFreq( f ); | 20892 | b->setVibratoFreq( f ); |
| 20644 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; | 20893 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; |
| @@ -20646,23 +20895,23 @@ CK_DLL_CTRL( Brass_ctrl_vibratoFreq ) · 1 unmodified line | |||
| 20646 | 20895 | ||
| 20647 | 20896 | ||
| 20648 | //----------------------------------------------------------------------------- | 20897 | //----------------------------------------------------------------------------- |
| 20649 | // name: Brass_cget_vibratoFreq() | 20898 | // name: Clarinet_cget_vibratoFreq() |
| 20650 | // desc: CGET function ... | 20899 | // desc: CGET function ... |
| 20651 | //----------------------------------------------------------------------------- | 20900 | //----------------------------------------------------------------------------- |
| 20652 | CK_DLL_CGET( Brass_cget_vibratoFreq ) | 20901 | CK_DLL_CGET( Clarinet_cget_vibratoFreq ) |
| 20653 | { | 20902 | { |
| 20654 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20903 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20655 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; | 20904 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; |
| 20656 | } | 20905 | } |
| 20657 | 20906 | ||
| 20658 | 20907 | ||
| 20659 | //----------------------------------------------------------------------------- | 20908 | //----------------------------------------------------------------------------- |
| 20660 | // name: Brass_ctrl_vibratoGain() | 20909 | // name: Clarinet_ctrl_vibratoGain() |
| 20661 | // desc: CTRL function ... | 20910 | // desc: CTRL function ... |
| 20662 | //----------------------------------------------------------------------------- | 20911 | //----------------------------------------------------------------------------- |
| 20663 | CK_DLL_CTRL( Brass_ctrl_vibratoGain ) | 20912 | CK_DLL_CTRL( Clarinet_ctrl_vibratoGain ) |
| 20664 | { | 20913 | { |
| 20665 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20914 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20666 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 20915 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20667 | b->controlChange( 1, f * 128.0 ); | 20916 | b->controlChange( 1, f * 128.0 ); |
| 20668 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; | 20917 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; |
| @@ -20670,23 +20919,23 @@ CK_DLL_CTRL( Brass_ctrl_vibratoGain ) · 1 unmodified line | |||
| 20670 | 20919 | ||
| 20671 | 20920 | ||
| 20672 | //----------------------------------------------------------------------------- | 20921 | //----------------------------------------------------------------------------- |
| 20673 | // name: Brass_cget_vibratoGain() | 20922 | // name: Clarinet_cget_vibratoGain() |
| 20674 | // desc: CGET function ... | 20923 | // desc: CGET function ... |
| 20675 | //----------------------------------------------------------------------------- | 20924 | //----------------------------------------------------------------------------- |
| 20676 | CK_DLL_CGET( Brass_cget_vibratoGain) | 20925 | CK_DLL_CGET( Clarinet_cget_vibratoGain ) |
| 20677 | { | 20926 | { |
| 20678 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20927 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20679 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; | 20928 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; |
| 20680 | } | 20929 | } |
| 20681 | 20930 | ||
| 20682 | 20931 | ||
| 20683 | //----------------------------------------------------------------------------- | 20932 | //----------------------------------------------------------------------------- |
| 20684 | // name: Brass_ctrl_volume() | 20933 | // name: Clarinet_ctrl_pressure() |
| 20685 | // desc: CTRL function ... | 20934 | // desc: CTRL function ... |
| 20686 | //----------------------------------------------------------------------------- | 20935 | //----------------------------------------------------------------------------- |
| 20687 | CK_DLL_CTRL( Brass_ctrl_volume ) | 20936 | CK_DLL_CTRL( Clarinet_ctrl_pressure ) |
| 20688 | { | 20937 | { |
| 20689 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20938 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20690 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 20939 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20691 | b->controlChange( 128, f * 128.0 ); | 20940 | b->controlChange( 128, f * 128.0 ); |
| 20692 | RETURN->v_float = (t_CKFLOAT)b->m_volume; | 20941 | RETURN->v_float = (t_CKFLOAT)b->m_volume; |
| @@ -20694,166 +20943,217 @@ CK_DLL_CTRL( Brass_ctrl_volume ) · 1 unmodified line | |||
| 20694 | 20943 | ||
| 20695 | 20944 | ||
| 20696 | //----------------------------------------------------------------------------- | 20945 | //----------------------------------------------------------------------------- |
| 20697 | // name: Brass_cget_volume() | 20946 | // name: Clarinet_cget_pressure() |
| 20698 | // desc: CGET function ... | 20947 | // desc: CGET function ... |
| 20699 | //----------------------------------------------------------------------------- | 20948 | //----------------------------------------------------------------------------- |
| 20700 | CK_DLL_CGET( Brass_cget_volume ) | 20949 | CK_DLL_CGET( Clarinet_cget_pressure ) |
| 20701 | { | 20950 | { |
| 20702 | Brass * b = (Brass *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20951 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20703 | RETURN->v_float = (t_CKFLOAT)b->m_volume; | 20952 | RETURN->v_float = (t_CKFLOAT)b->m_volume; |
| 20704 | } | 20953 | } |
| 20705 | 20954 | ||
| 20706 | 20955 | ||
| 20956 | // Flute | ||
| 20957 | struct Flute_ { | ||
| 20958 | Flute * imp; | ||
| 20707 | 20959 | ||
| 20708 | |||
| 20709 | /* | ||
| 20710 | struct Clarinet_ { | ||
| 20711 | Clarinet * imp; | ||
| 20712 | double m_frequency; | 20960 | double m_frequency; |
| 20713 | double m_rate; | 20961 | double m_rate; |
| 20714 | double m_reed; | 20962 | double m_jetDelay; |
| 20715 | Clarinet_ ( double d ) { | 20963 | double m_jetReflection; |
| 20716 | imp = new Clarinet(d); | 20964 | double m_endReflection; |
| 20965 | |||
| 20966 | Flute_ ( double d ) { | ||
| 20967 | imp = new Flute(d); | ||
| 20717 | m_frequency = 100.0; | 20968 | m_frequency = 100.0; |
| 20718 | m_rate = 0.5; | 20969 | m_rate = 0.5; |
| 20719 | m_reed = 0.5; | 20970 | m_jetDelay = 0.0; |
| 20971 | m_jetReflection = 0.0; | ||
| 20972 | m_endReflection = 0.0; | ||
| 20720 | } | 20973 | } |
| 20721 | }; */ | 20974 | }; |
| 20722 | 20975 | ||
| 20723 | 20976 | ||
| 20724 | // Clarinet | ||
| 20725 | //----------------------------------------------------------------------------- | 20977 | //----------------------------------------------------------------------------- |
| 20726 | // name: Clarinet_ctor() | 20978 | // name: Flute_ctor() |
| 20727 | // desc: CTOR function ... | 20979 | // desc: CTOR function ... |
| 20728 | //----------------------------------------------------------------------------- | 20980 | //----------------------------------------------------------------------------- |
| 20729 | CK_DLL_CTOR( Clarinet_ctor ) | 20981 | CK_DLL_CTOR( Flute_ctor ) |
| 20730 | { | 20982 | { |
| 20731 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)new Clarinet( 30.0 ); | 20983 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT) new Flute( 40.0 ); |
| 20732 | } | 20984 | } |
| 20733 | 20985 | ||
| 20734 | 20986 | ||
| 20735 | //----------------------------------------------------------------------------- | 20987 | //----------------------------------------------------------------------------- |
| 20736 | // name: Clarinet_dtor() | 20988 | // name: Flute_dtor() |
| 20737 | // desc: DTOR function ... | 20989 | // desc: DTOR function ... |
| 20738 | //----------------------------------------------------------------------------- | 20990 | //----------------------------------------------------------------------------- |
| 20739 | CK_DLL_DTOR( Clarinet_dtor ) | 20991 | CK_DLL_DTOR( Flute_dtor ) |
| 20740 | { | 20992 | { |
| 20741 | delete (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 20993 | Flute * f = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20994 | SAFE_DELETE(f); | ||
| 20742 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; | 20995 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; |
| 20743 | } | 20996 | } |
| 20744 | 20997 | ||
| 20998 | |||
| 20745 | //----------------------------------------------------------------------------- | 20999 | //----------------------------------------------------------------------------- |
| 20746 | // name: Clarinet_tick() | 21000 | // name: Flute_tick() |
| 20747 | // desc: TICK function ... | 21001 | // desc: TICK function ... |
| 20748 | //----------------------------------------------------------------------------- | 21002 | //----------------------------------------------------------------------------- |
| 20749 | CK_DLL_TICK( Clarinet_tick ) | 21003 | CK_DLL_TICK( Flute_tick ) |
| 20750 | { | 21004 | { |
| 20751 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21005 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20752 | *out = b->tick(); | 21006 | *out = b->tick(); |
| 20753 | return TRUE; | 21007 | return TRUE; |
| 20754 | } | 21008 | } |
| 20755 | 21009 | ||
| 20756 | |||
| 20757 | //----------------------------------------------------------------------------- | 21010 | //----------------------------------------------------------------------------- |
| 20758 | // name: Clarinet_pmsg() | 21011 | // name: Flute_pmsg() |
| 20759 | // desc: PMSG function ... | 21012 | // desc: PMSG function ... |
| 20760 | //----------------------------------------------------------------------------- | 21013 | //----------------------------------------------------------------------------- |
| 20761 | CK_DLL_PMSG( Clarinet_pmsg ) | 21014 | CK_DLL_PMSG( Flute_pmsg ) |
| 20762 | { | 21015 | { |
| 20763 | return TRUE; | 21016 | return TRUE; |
| 20764 | } | 21017 | } |
| 20765 | 21018 | ||
| 20766 | 21019 | ||
| 20767 | //----------------------------------------------------------------------------- | 21020 | //----------------------------------------------------------------------------- |
| 20768 | // name: Clarinet_ctrl_startBlowing() | 21021 | // name: Flute_ctrl_startBlowing() |
| 20769 | // desc: CTRL function ... | 21022 | // desc: CTRL function ... |
| 20770 | //----------------------------------------------------------------------------- | 21023 | //----------------------------------------------------------------------------- |
| 20771 | CK_DLL_CTRL( Clarinet_ctrl_startBlowing ) | 21024 | CK_DLL_CTRL( Flute_ctrl_startBlowing ) |
| 20772 | { | 21025 | { |
| 20773 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21026 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20774 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21027 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20775 | b->startBlowing( f, b->m_rate ); | 21028 | b->startBlowing( f, b->m_rate ); |
| 20776 | } | 21029 | } |
| 20777 | 21030 | ||
| 20778 | |||
| 20779 | //----------------------------------------------------------------------------- | 21031 | //----------------------------------------------------------------------------- |
| 20780 | // name: Clarinet_ctrl_stopBlowing() | 21032 | // name: Flute_ctrl_stopBlowing() |
| 20781 | // desc: CTRL function ... | 21033 | // desc: CTRL function ... |
| 20782 | //----------------------------------------------------------------------------- | 21034 | //----------------------------------------------------------------------------- |
| 20783 | CK_DLL_CTRL( Clarinet_ctrl_stopBlowing ) | 21035 | CK_DLL_CTRL( Flute_ctrl_stopBlowing ) |
| 20784 | { | 21036 | { |
| 20785 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21037 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20786 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21038 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20787 | b->stopBlowing( f ); | 21039 | b->stopBlowing( f ); |
| 20788 | } | 21040 | } |
| 20789 | 21041 | ||
| 20790 | 21042 | ||
| 20791 | //----------------------------------------------------------------------------- | 21043 | //----------------------------------------------------------------------------- |
| 20792 | // name: Clarinet_ctrl_clear() | 21044 | // name: Flute_ctrl_clear() |
| 20793 | // desc: CTRL function ... | 21045 | // desc: CTRL function ... |
| 20794 | //----------------------------------------------------------------------------- | 21046 | //----------------------------------------------------------------------------- |
| 20795 | CK_DLL_CTRL( Clarinet_ctrl_clear ) | 21047 | CK_DLL_CTRL( Flute_ctrl_clear ) |
| 20796 | { | 21048 | { |
| 20797 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21049 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20798 | b->clear(); | 21050 | b->clear(); |
| 20799 | } | 21051 | } |
| 20800 | 21052 | ||
| 20801 | 21053 | ||
| 20802 | //----------------------------------------------------------------------------- | 21054 | //----------------------------------------------------------------------------- |
| 20803 | // name: Clarinet_ctrl_reed() | 21055 | // name: Flute_ctrl_rate() |
| 20804 | // desc: CTRL function ... | 21056 | // desc: CTRL function ... |
| 20805 | //----------------------------------------------------------------------------- | 21057 | //----------------------------------------------------------------------------- |
| 20806 | CK_DLL_CTRL( Clarinet_ctrl_reed ) | 21058 | CK_DLL_CTRL( Flute_ctrl_rate ) |
| 21059 | { | ||
| 21060 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21061 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 21062 | b->m_rate = f; | ||
| 21063 | RETURN->v_float = (t_CKFLOAT)b->m_rate; | ||
| 21064 | } | ||
| 21065 | |||
| 21066 | |||
| 21067 | //----------------------------------------------------------------------------- | ||
| 21068 | // name: Flute_cget_rate() | ||
| 21069 | // desc: CGET function ... | ||
| 21070 | //----------------------------------------------------------------------------- | ||
| 21071 | CK_DLL_CGET( Flute_cget_rate ) | ||
| 21072 | { | ||
| 21073 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21074 | RETURN->v_float = (t_CKFLOAT)b->m_rate; | ||
| 21075 | } | ||
| 21076 | |||
| 21077 | |||
| 21078 | //----------------------------------------------------------------------------- | ||
| 21079 | // name: Flute_ctrl_jetDelay() | ||
| 21080 | // desc: CTRL function ... | ||
| 21081 | //----------------------------------------------------------------------------- | ||
| 21082 | CK_DLL_CTRL( Flute_ctrl_jetDelay ) | ||
| 21083 | { | ||
| 21084 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21085 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 21086 | b->setJetDelay( f); | ||
| 21087 | RETURN->v_float = (t_CKFLOAT)b->m_jetDelay; | ||
| 21088 | } | ||
| 21089 | |||
| 21090 | |||
| 21091 | //----------------------------------------------------------------------------- | ||
| 21092 | // name: Flute_cget_jetDelay() | ||
| 21093 | // desc: CGET function ... | ||
| 21094 | //----------------------------------------------------------------------------- | ||
| 21095 | CK_DLL_CGET( Flute_cget_jetDelay ) | ||
| 21096 | { | ||
| 21097 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21098 | RETURN->v_float = (t_CKFLOAT)b->m_jetDelay; | ||
| 21099 | } | ||
| 21100 | |||
| 21101 | |||
| 21102 | //----------------------------------------------------------------------------- | ||
| 21103 | // name: Flute_ctrl_jetReflection() | ||
| 21104 | // desc: CTRL function ... | ||
| 21105 | //----------------------------------------------------------------------------- | ||
| 21106 | CK_DLL_CTRL( Flute_ctrl_jetReflection ) | ||
| 20807 | { | 21107 | { |
| 20808 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21108 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20809 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21109 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20810 | b->controlChange( 2, f * 128.0 ); | 21110 | b->setJetReflection( f); |
| 20811 | RETURN->v_float = (t_CKFLOAT)b->m_reed; | 21111 | RETURN->v_float = (t_CKFLOAT)b->m_jetReflection; |
| 20812 | } | 21112 | } |
| 20813 | 21113 | ||
| 20814 | 21114 | ||
| 20815 | //----------------------------------------------------------------------------- | 21115 | //----------------------------------------------------------------------------- |
| 20816 | // name: Clarinet_cget_reed() | 21116 | // name: Flute_cget_jetReflection() |
| 20817 | // desc: CGET function ... | 21117 | // desc: CGET function ... |
| 20818 | //----------------------------------------------------------------------------- | 21118 | //----------------------------------------------------------------------------- |
| 20819 | CK_DLL_CGET( Clarinet_cget_reed ) | 21119 | CK_DLL_CGET( Flute_cget_jetReflection ) |
| 20820 | { | 21120 | { |
| 20821 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21121 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20822 | RETURN->v_float = (t_CKFLOAT)b->m_reed; | 21122 | RETURN->v_float = (t_CKFLOAT)b->m_jetReflection; |
| 20823 | } | 21123 | } |
| 20824 | 21124 | ||
| 20825 | 21125 | ||
| 20826 | //----------------------------------------------------------------------------- | 21126 | //----------------------------------------------------------------------------- |
| 20827 | // name: Clarinet_ctrl_rate() | 21127 | // name: Flute_ctrl_endReflection() |
| 20828 | // desc: CTRL function ... | 21128 | // desc: CTRL function ... |
| 20829 | //----------------------------------------------------------------------------- | 21129 | //----------------------------------------------------------------------------- |
| 20830 | CK_DLL_CTRL( Clarinet_ctrl_rate ) | 21130 | CK_DLL_CTRL( Flute_ctrl_endReflection ) |
| 20831 | { | 21131 | { |
| 20832 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21132 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20833 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21133 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20834 | b->m_rate = f; | 21134 | b->setEndReflection(f); |
| 20835 | RETURN->v_float = (t_CKFLOAT)b->m_rate; | 21135 | RETURN->v_float = (t_CKFLOAT)b->m_endReflection; |
| 20836 | } | 21136 | } |
| 20837 | 21137 | ||
| 20838 | 21138 | ||
| 20839 | //----------------------------------------------------------------------------- | 21139 | //----------------------------------------------------------------------------- |
| 20840 | // name: Clarinet_cget_rate() | 21140 | // name: Flute_cget_endReflection() |
| 20841 | // desc: CGET function ... | 21141 | // desc: CGET function ... |
| 20842 | //----------------------------------------------------------------------------- | 21142 | //----------------------------------------------------------------------------- |
| 20843 | CK_DLL_CGET( Clarinet_cget_rate ) | 21143 | CK_DLL_CGET( Flute_cget_endReflection ) |
| 20844 | { | 21144 | { |
| 20845 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21145 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20846 | RETURN->v_float = (t_CKFLOAT) b->m_rate; | 21146 | RETURN->v_float = (t_CKFLOAT)b->m_endReflection; |
| 20847 | } | 21147 | } |
| 20848 | 21148 | ||
| 20849 | 21149 | ||
| 20850 | //----------------------------------------------------------------------------- | 21150 | //----------------------------------------------------------------------------- |
| 20851 | // name: Clarinet_ctrl_noiseGain() | 21151 | // name: Flute_ctrl_noiseGain() |
| 20852 | // desc: CTRL function ... | 21152 | // desc: CTRL function ... |
| 20853 | //----------------------------------------------------------------------------- | 21153 | //----------------------------------------------------------------------------- |
| 20854 | CK_DLL_CTRL( Clarinet_ctrl_noiseGain ) | 21154 | CK_DLL_CTRL( Flute_ctrl_noiseGain ) |
| 20855 | { | 21155 | { |
| 20856 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21156 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20857 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21157 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20858 | b->controlChange( 4, f * 128.0 ); | 21158 | b->controlChange( 4, f * 128.0 ); |
| 20859 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; | 21159 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; |
| @@ -20861,23 +21161,23 @@ CK_DLL_CTRL( Clarinet_ctrl_noiseGain ) · 1 unmodified line | |||
| 20861 | 21161 | ||
| 20862 | 21162 | ||
| 20863 | //----------------------------------------------------------------------------- | 21163 | //----------------------------------------------------------------------------- |
| 20864 | // name: Clarinet_cget_noiseGain() | 21164 | // name: Flute_cget_noiseGain() |
| 20865 | // desc: CGET function ... | 21165 | // desc: CGET function ... |
| 20866 | //----------------------------------------------------------------------------- | 21166 | //----------------------------------------------------------------------------- |
| 20867 | CK_DLL_CGET( Clarinet_cget_noiseGain ) | 21167 | CK_DLL_CGET( Flute_cget_noiseGain ) |
| 20868 | { | 21168 | { |
| 20869 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21169 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20870 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; | 21170 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; |
| 20871 | } | 21171 | } |
| 20872 | 21172 | ||
| 20873 | 21173 | ||
| 20874 | //----------------------------------------------------------------------------- | 21174 | //----------------------------------------------------------------------------- |
| 20875 | // name: Clarinet_ctrl_vibratoFreq() | 21175 | // name: Flute_ctrl_vibratoFreq() |
| 20876 | // desc: CTRL function ... | 21176 | // desc: CTRL function ... |
| 20877 | //----------------------------------------------------------------------------- | 21177 | //----------------------------------------------------------------------------- |
| 20878 | CK_DLL_CTRL( Clarinet_ctrl_vibratoFreq ) | 21178 | CK_DLL_CTRL( Flute_ctrl_vibratoFreq ) |
| 20879 | { | 21179 | { |
| 20880 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21180 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20881 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21181 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20882 | b->setVibratoFreq( f ); | 21182 | b->setVibratoFreq( f ); |
| 20883 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; | 21183 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; |
| @@ -20885,23 +21185,23 @@ CK_DLL_CTRL( Clarinet_ctrl_vibratoFreq ) · 1 unmodified line | |||
| 20885 | 21185 | ||
| 20886 | 21186 | ||
| 20887 | //----------------------------------------------------------------------------- | 21187 | //----------------------------------------------------------------------------- |
| 20888 | // name: Clarinet_cget_vibratoFreq() | 21188 | // name: Flute_cget_vibratoFreq() |
| 20889 | // desc: CGET function ... | 21189 | // desc: CGET function ... |
| 20890 | //----------------------------------------------------------------------------- | 21190 | //----------------------------------------------------------------------------- |
| 20891 | CK_DLL_CGET( Clarinet_cget_vibratoFreq ) | 21191 | CK_DLL_CGET( Flute_cget_vibratoFreq ) |
| 20892 | { | 21192 | { |
| 20893 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21193 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20894 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; | 21194 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; |
| 20895 | } | 21195 | } |
| 20896 | 21196 | ||
| 20897 | 21197 | ||
| 20898 | //----------------------------------------------------------------------------- | 21198 | //----------------------------------------------------------------------------- |
| 20899 | // name: Clarinet_ctrl_vibratoGain() | 21199 | // name: Flute_ctrl_vibratoGain() |
| 20900 | // desc: CTRL function ... | 21200 | // desc: CTRL function ... |
| 20901 | //----------------------------------------------------------------------------- | 21201 | //----------------------------------------------------------------------------- |
| 20902 | CK_DLL_CTRL( Clarinet_ctrl_vibratoGain ) | 21202 | CK_DLL_CTRL( Flute_ctrl_vibratoGain ) |
| 20903 | { | 21203 | { |
| 20904 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21204 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20905 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21205 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20906 | b->controlChange( 1, f * 128.0 ); | 21206 | b->controlChange( 1, f * 128.0 ); |
| 20907 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; | 21207 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; |
| @@ -20909,2290 +21209,2313 @@ CK_DLL_CTRL( Clarinet_ctrl_vibratoGain ) · 1 unmodified line | |||
| 20909 | 21209 | ||
| 20910 | 21210 | ||
| 20911 | //----------------------------------------------------------------------------- | 21211 | //----------------------------------------------------------------------------- |
| 20912 | // name: Clarinet_cget_vibratoGain() | 21212 | // name: Flute_cget_vibratoGain() |
| 20913 | // desc: CGET function ... | 21213 | // desc: CGET function ... |
| 20914 | //----------------------------------------------------------------------------- | 21214 | //----------------------------------------------------------------------------- |
| 20915 | CK_DLL_CGET( Clarinet_cget_vibratoGain ) | 21215 | CK_DLL_CGET( Flute_cget_vibratoGain ) |
| 20916 | { | 21216 | { |
| 20917 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21217 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20918 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; | 21218 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; |
| 20919 | } | 21219 | } |
| 20920 | 21220 | ||
| 20921 | 21221 | ||
| 20922 | //----------------------------------------------------------------------------- | 21222 | //----------------------------------------------------------------------------- |
| 20923 | // name: Clarinet_ctrl_pressure() | 21223 | // name: Flute_ctrl_pressure() |
| 20924 | // desc: CTRL function ... | 21224 | // desc: CTRL function ... |
| 20925 | //----------------------------------------------------------------------------- | 21225 | //----------------------------------------------------------------------------- |
| 20926 | CK_DLL_CTRL( Clarinet_ctrl_pressure ) | 21226 | CK_DLL_CTRL( Flute_ctrl_pressure ) |
| 20927 | { | 21227 | { |
| 20928 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21228 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20929 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21229 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 20930 | b->controlChange( 128, f * 128.0 ); | 21230 | b->controlChange( 128, f * 128.0 ); |
| 20931 | RETURN->v_float = (t_CKFLOAT)b->m_volume; | 21231 | RETURN->v_float = (t_CKFLOAT)b->m_pressure; |
| 20932 | } | 21232 | } |
| 20933 | 21233 | ||
| 20934 | 21234 | ||
| 20935 | //----------------------------------------------------------------------------- | 21235 | //----------------------------------------------------------------------------- |
| 20936 | // name: Clarinet_cget_pressure() | 21236 | // name: Flute_cget_pressure() |
| 20937 | // desc: CGET function ... | 21237 | // desc: CGET function ... |
| 20938 | //----------------------------------------------------------------------------- | 21238 | //----------------------------------------------------------------------------- |
| 20939 | CK_DLL_CGET( Clarinet_cget_pressure ) | 21239 | CK_DLL_CGET( Flute_cget_pressure ) |
| 20940 | { | 21240 | { |
| 20941 | Clarinet * b = (Clarinet *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21241 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20942 | RETURN->v_float = (t_CKFLOAT)b->m_volume; | 21242 | RETURN->v_float = (t_CKFLOAT)b->m_pressure; |
| 20943 | } | 21243 | } |
| 20944 | 21244 | ||
| 20945 | 21245 | ||
| 20946 | // Flute | 21246 | // ModalBar |
| 20947 | struct Flute_ { | 21247 | struct ModalBar_ { |
| 20948 | Flute * imp; | 21248 | ModalBar modalbar; |
| 20949 | |||
| 20950 | double m_frequency; | ||
| 20951 | double m_rate; | ||
| 20952 | double m_jetDelay; | ||
| 20953 | double m_jetReflection; | ||
| 20954 | double m_endReflection; | ||
| 20955 | 21249 | ||
| 20956 | Flute_ ( double d ) { | 21250 | int m_preset; |
| 20957 | imp = new Flute(d); | 21251 | int m_modeIndex; |
| 20958 | m_frequency = 100.0; | 21252 | double m_modeRatio; |
| 20959 | m_rate = 0.5; | 21253 | double m_modeRadius; |
| 20960 | m_jetDelay = 0.0; | 21254 | |
| 20961 | m_jetReflection = 0.0; | 21255 | ModalBar_ ( ) { |
| 20962 | m_endReflection = 0.0; | 21256 | m_preset = 0; |
| 21257 | m_modeIndex = 0; | ||
| 20963 | } | 21258 | } |
| 20964 | }; | 21259 | }; |
| 20965 | 21260 | ||
| 20966 | 21261 | ||
| 20967 | //----------------------------------------------------------------------------- | 21262 | //----------------------------------------------------------------------------- |
| 20968 | // name: Flute_ctor() | 21263 | // name: ModalBar_ctor() |
| 20969 | // desc: CTOR function ... | 21264 | // desc: CTOR function ... |
| 20970 | //----------------------------------------------------------------------------- | 21265 | //----------------------------------------------------------------------------- |
| 20971 | CK_DLL_CTOR( Flute_ctor ) | 21266 | CK_DLL_CTOR( ModalBar_ctor ) |
| 20972 | { | 21267 | { |
| 20973 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT) new Flute( 40.0 ); | 21268 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)new ModalBar_(); |
| 20974 | } | 21269 | } |
| 20975 | 21270 | ||
| 20976 | 21271 | ||
| 20977 | //----------------------------------------------------------------------------- | 21272 | //----------------------------------------------------------------------------- |
| 20978 | // name: Flute_dtor() | 21273 | // name: ModalBar_dtor() |
| 20979 | // desc: DTOR function ... | 21274 | // desc: DTOR function ... |
| 20980 | //----------------------------------------------------------------------------- | 21275 | //----------------------------------------------------------------------------- |
| 20981 | CK_DLL_DTOR( Flute_dtor ) | 21276 | CK_DLL_DTOR( ModalBar_dtor ) |
| 20982 | { | 21277 | { |
| 20983 | Flute * f = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21278 | delete (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20984 | SAFE_DELETE(f); | ||
| 20985 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; | 21279 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; |
| 20986 | } | 21280 | } |
| 20987 | 21281 | ||
| 20988 | 21282 | ||
| 20989 | //----------------------------------------------------------------------------- | 21283 | //----------------------------------------------------------------------------- |
| 20990 | // name: Flute_tick() | 21284 | // name: ModalBar_tick() |
| 20991 | // desc: TICK function ... | 21285 | // desc: TICK function ... |
| 20992 | //----------------------------------------------------------------------------- | 21286 | //----------------------------------------------------------------------------- |
| 20993 | CK_DLL_TICK( Flute_tick ) | 21287 | CK_DLL_TICK( ModalBar_tick ) |
| 20994 | { | 21288 | { |
| 20995 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21289 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 20996 | *out = b->tick(); | 21290 | *out = b->modalbar.tick(); |
| 20997 | return TRUE; | 21291 | return TRUE; |
| 20998 | } | 21292 | } |
| 20999 | 21293 | ||
| 21294 | |||
| 21000 | //----------------------------------------------------------------------------- | 21295 | //----------------------------------------------------------------------------- |
| 21001 | // name: Flute_pmsg() | 21296 | // name: ModalBar_pmsg() |
| 21002 | // desc: PMSG function ... | 21297 | // desc: PMSG function ... |
| 21003 | //----------------------------------------------------------------------------- | 21298 | //----------------------------------------------------------------------------- |
| 21004 | CK_DLL_PMSG( Flute_pmsg ) | 21299 | CK_DLL_PMSG( ModalBar_pmsg ) |
| 21005 | { | 21300 | { |
| 21006 | return TRUE; | 21301 | return TRUE; |
| 21007 | } | 21302 | } |
| 21008 | 21303 | ||
| 21009 | 21304 | ||
| 21010 | //----------------------------------------------------------------------------- | 21305 | //----------------------------------------------------------------------------- |
| 21011 | // name: Flute_ctrl_startBlowing() | 21306 | // name: ModalBar_ctrl_strike() |
| 21012 | // desc: CTRL function ... | 21307 | // desc: CTRL function ... |
| 21013 | //----------------------------------------------------------------------------- | 21308 | //----------------------------------------------------------------------------- |
| 21014 | CK_DLL_CTRL( Flute_ctrl_startBlowing ) | 21309 | CK_DLL_CTRL( ModalBar_ctrl_strike ) |
| 21015 | { | 21310 | { |
| 21016 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21311 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21017 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21312 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21018 | b->startBlowing( f, b->m_rate ); | 21313 | b->modalbar.strike( f ); |
| 21019 | } | 21314 | } |
| 21020 | 21315 | ||
| 21316 | |||
| 21021 | //----------------------------------------------------------------------------- | 21317 | //----------------------------------------------------------------------------- |
| 21022 | // name: Flute_ctrl_stopBlowing() | 21318 | // name: ModalBar_ctrl_damp() |
| 21023 | // desc: CTRL function ... | 21319 | // desc: CTRL function ... |
| 21024 | //----------------------------------------------------------------------------- | 21320 | //----------------------------------------------------------------------------- |
| 21025 | CK_DLL_CTRL( Flute_ctrl_stopBlowing ) | 21321 | CK_DLL_CTRL( ModalBar_ctrl_damp ) |
| 21026 | { | 21322 | { |
| 21027 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21323 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21028 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21324 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21029 | b->stopBlowing( f ); | 21325 | b->modalbar.damp( f ); |
| 21030 | } | 21326 | } |
| 21031 | 21327 | ||
| 21032 | 21328 | ||
| 21033 | //----------------------------------------------------------------------------- | 21329 | //----------------------------------------------------------------------------- |
| 21034 | // name: Flute_ctrl_clear() | 21330 | // name: ModalBar_ctrl_clear() |
| 21035 | // desc: CTRL function ... | 21331 | // desc: CTRL function ... |
| 21036 | //----------------------------------------------------------------------------- | 21332 | //----------------------------------------------------------------------------- |
| 21037 | CK_DLL_CTRL( Flute_ctrl_clear ) | 21333 | CK_DLL_CTRL( ModalBar_ctrl_clear ) |
| 21334 | { | ||
| 21335 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21336 | b->modalbar.clear(); | ||
| 21337 | } | ||
| 21338 | |||
| 21339 | |||
| 21340 | //----------------------------------------------------------------------------- | ||
| 21341 | // name: ModalBar_ctrl_preset() | ||
| 21342 | // desc: CTRL function ... | ||
| 21343 | //----------------------------------------------------------------------------- | ||
| 21344 | CK_DLL_CTRL( ModalBar_ctrl_preset ) | ||
| 21345 | { | ||
| 21346 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21347 | int f = GET_CK_INT(ARGS); | ||
| 21348 | b->m_preset = f; | ||
| 21349 | b->modalbar.setPreset ( f ); | ||
| 21350 | RETURN->v_int = (t_CKINT)b->m_preset; | ||
| 21351 | } | ||
| 21352 | |||
| 21353 | |||
| 21354 | //----------------------------------------------------------------------------- | ||
| 21355 | // name: ModalBar_cget_preset() | ||
| 21356 | // desc: CGET function ... | ||
| 21357 | //----------------------------------------------------------------------------- | ||
| 21358 | CK_DLL_CGET( ModalBar_cget_preset ) | ||
| 21359 | { | ||
| 21360 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21361 | RETURN->v_int = (t_CKINT)b->m_preset; | ||
| 21362 | } | ||
| 21363 | |||
| 21364 | |||
| 21365 | //----------------------------------------------------------------------------- | ||
| 21366 | // name: ModalBar_ctrl_strikePosition() | ||
| 21367 | // desc: CTRL function ... | ||
| 21368 | //----------------------------------------------------------------------------- | ||
| 21369 | CK_DLL_CTRL( ModalBar_ctrl_strikePosition ) | ||
| 21370 | { | ||
| 21371 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21372 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 21373 | b->modalbar.setStrikePosition( f ); | ||
| 21374 | RETURN->v_float = (t_CKFLOAT)b->modalbar.strikePosition; | ||
| 21375 | } | ||
| 21376 | |||
| 21377 | |||
| 21378 | //----------------------------------------------------------------------------- | ||
| 21379 | // name: ModalBar_cget_strikePosition() | ||
| 21380 | // desc: CGET function ... | ||
| 21381 | //----------------------------------------------------------------------------- | ||
| 21382 | CK_DLL_CGET( ModalBar_cget_strikePosition ) | ||
| 21383 | { | ||
| 21384 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21385 | RETURN->v_float = (t_CKFLOAT)b->modalbar.strikePosition; | ||
| 21386 | } | ||
| 21387 | |||
| 21388 | |||
| 21389 | //----------------------------------------------------------------------------- | ||
| 21390 | // name: ModalBar_ctrl_vibratoGain() | ||
| 21391 | // desc: CTRL function ... | ||
| 21392 | //----------------------------------------------------------------------------- | ||
| 21393 | CK_DLL_CTRL( ModalBar_ctrl_vibratoGain ) | ||
| 21394 | { | ||
| 21395 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21396 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 21397 | b->modalbar.controlChange( 11, f*128 ); | ||
| 21398 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_vibratoGain; | ||
| 21399 | } | ||
| 21400 | |||
| 21401 | |||
| 21402 | //----------------------------------------------------------------------------- | ||
| 21403 | // name: ModalBar_cget_vibratoGain() | ||
| 21404 | // desc: CGET function ... | ||
| 21405 | //----------------------------------------------------------------------------- | ||
| 21406 | CK_DLL_CGET( ModalBar_cget_vibratoGain ) | ||
| 21407 | { | ||
| 21408 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21409 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_vibratoGain; | ||
| 21410 | } | ||
| 21411 | |||
| 21412 | |||
| 21413 | //----------------------------------------------------------------------------- | ||
| 21414 | // name: ModalBar_ctrl_vibratoFreq() | ||
| 21415 | // desc: CTRL function ... | ||
| 21416 | //----------------------------------------------------------------------------- | ||
| 21417 | CK_DLL_CTRL( ModalBar_ctrl_vibratoFreq ) | ||
| 21418 | { | ||
| 21419 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21420 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 21421 | b->modalbar.vibrato->setFrequency( f ); | ||
| 21422 | b->modalbar.m_vibratoFreq = b->modalbar.vibrato->m_freq; | ||
| 21423 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_vibratoFreq; | ||
| 21424 | } | ||
| 21425 | |||
| 21426 | |||
| 21427 | //----------------------------------------------------------------------------- | ||
| 21428 | // name: ModalBar_cget_vibratoFreq() | ||
| 21429 | // desc: CGET function ... | ||
| 21430 | //----------------------------------------------------------------------------- | ||
| 21431 | CK_DLL_CGET( ModalBar_cget_vibratoFreq ) | ||
| 21038 | { | 21432 | { |
| 21039 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21433 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21040 | b->clear(); | 21434 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_vibratoFreq; |
| 21041 | } | 21435 | } |
| 21042 | 21436 | ||
| 21043 | 21437 | ||
| 21044 | //----------------------------------------------------------------------------- | 21438 | //----------------------------------------------------------------------------- |
| 21045 | // name: Flute_ctrl_rate() | 21439 | // name: ModalBar_ctrl_stickHardness() |
| 21046 | // desc: CTRL function ... | 21440 | // desc: CTRL function ... |
| 21047 | //----------------------------------------------------------------------------- | 21441 | //----------------------------------------------------------------------------- |
| 21048 | CK_DLL_CTRL( Flute_ctrl_rate ) | 21442 | CK_DLL_CTRL( ModalBar_ctrl_stickHardness ) |
| 21049 | { | 21443 | { |
| 21050 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21444 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21051 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21445 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21052 | b->m_rate = f; | 21446 | b->modalbar.setStickHardness ( f ); |
| 21053 | RETURN->v_float = (t_CKFLOAT)b->m_rate; | 21447 | RETURN->v_float = (t_CKFLOAT)b->modalbar.stickHardness; |
| 21054 | } | 21448 | } |
| 21055 | 21449 | ||
| 21056 | 21450 | ||
| 21451 | |||
| 21057 | //----------------------------------------------------------------------------- | 21452 | //----------------------------------------------------------------------------- |
| 21058 | // name: Flute_cget_rate() | 21453 | // name: ModalBar_cget_stickHardness() |
| 21059 | // desc: CGET function ... | 21454 | // desc: CGET function ... |
| 21060 | //----------------------------------------------------------------------------- | 21455 | //----------------------------------------------------------------------------- |
| 21061 | CK_DLL_CGET( Flute_cget_rate ) | 21456 | CK_DLL_CGET( ModalBar_cget_stickHardness ) |
| 21062 | { | 21457 | { |
| 21063 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21458 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21064 | RETURN->v_float = (t_CKFLOAT)b->m_rate; | 21459 | RETURN->v_float = (t_CKFLOAT)b->modalbar.stickHardness; |
| 21065 | } | 21460 | } |
| 21066 | 21461 | ||
| 21067 | 21462 | ||
| 21068 | //----------------------------------------------------------------------------- | 21463 | //----------------------------------------------------------------------------- |
| 21069 | // name: Flute_ctrl_jetDelay() | 21464 | // name: ModalBar_ctrl_masterGain() |
| 21070 | // desc: CTRL function ... | 21465 | // desc: CTRL function ... |
| 21071 | //----------------------------------------------------------------------------- | 21466 | //----------------------------------------------------------------------------- |
| 21072 | CK_DLL_CTRL( Flute_ctrl_jetDelay ) | 21467 | CK_DLL_CTRL( ModalBar_ctrl_masterGain ) |
| 21073 | { | 21468 | { |
| 21074 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21469 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21075 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21470 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21076 | b->setJetDelay( f); | 21471 | b->modalbar.setMasterGain( f ); |
| 21077 | RETURN->v_float = (t_CKFLOAT)b->m_jetDelay; | 21472 | RETURN->v_float = (t_CKFLOAT)b->modalbar.masterGain; |
| 21078 | } | 21473 | } |
| 21079 | 21474 | ||
| 21080 | 21475 | ||
| 21081 | //----------------------------------------------------------------------------- | 21476 | //----------------------------------------------------------------------------- |
| 21082 | // name: Flute_cget_jetDelay() | 21477 | // name: ModalBar_cget_masterGain() |
| 21083 | // desc: CGET function ... | 21478 | // desc: CGET function ... |
| 21084 | //----------------------------------------------------------------------------- | 21479 | //----------------------------------------------------------------------------- |
| 21085 | CK_DLL_CGET( Flute_cget_jetDelay ) | 21480 | CK_DLL_CGET( ModalBar_cget_masterGain ) |
| 21086 | { | 21481 | { |
| 21087 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21482 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21088 | RETURN->v_float = (t_CKFLOAT)b->m_jetDelay; | 21483 | RETURN->v_float = (t_CKFLOAT)b->modalbar.masterGain; |
| 21089 | } | 21484 | } |
| 21090 | 21485 | ||
| 21091 | 21486 | ||
| 21092 | //----------------------------------------------------------------------------- | 21487 | //----------------------------------------------------------------------------- |
| 21093 | // name: Flute_ctrl_jetReflection() | 21488 | // name: ModalBar_ctrl_directGain() |
| 21094 | // desc: CTRL function ... | 21489 | // desc: CTRL function ... |
| 21095 | //----------------------------------------------------------------------------- | 21490 | //----------------------------------------------------------------------------- |
| 21096 | CK_DLL_CTRL( Flute_ctrl_jetReflection ) | 21491 | CK_DLL_CTRL( ModalBar_ctrl_directGain ) |
| 21097 | { | 21492 | { |
| 21098 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21493 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21099 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21494 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21100 | b->setJetReflection( f); | 21495 | b->modalbar.setDirectGain( f ); |
| 21101 | RETURN->v_float = (t_CKFLOAT)b->m_jetReflection; | 21496 | RETURN->v_float = (t_CKFLOAT) b->modalbar.directGain; |
| 21102 | } | 21497 | } |
| 21103 | 21498 | ||
| 21104 | 21499 | ||
| 21105 | //----------------------------------------------------------------------------- | 21500 | //----------------------------------------------------------------------------- |
| 21106 | // name: Flute_cget_jetReflection() | 21501 | // name: ModalBar_cget_directGain() |
| 21107 | // desc: CGET function ... | 21502 | // desc: CGET function ... |
| 21108 | //----------------------------------------------------------------------------- | 21503 | //----------------------------------------------------------------------------- |
| 21109 | CK_DLL_CGET( Flute_cget_jetReflection ) | 21504 | CK_DLL_CGET( ModalBar_cget_directGain ) |
| 21110 | { | 21505 | { |
| 21111 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21506 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21112 | RETURN->v_float = (t_CKFLOAT)b->m_jetReflection; | 21507 | RETURN->v_float = (t_CKFLOAT)b->modalbar.directGain; |
| 21113 | } | 21508 | } |
| 21114 | 21509 | ||
| 21115 | 21510 | ||
| 21116 | //----------------------------------------------------------------------------- | 21511 | //----------------------------------------------------------------------------- |
| 21117 | // name: Flute_ctrl_endReflection() | 21512 | // name: ModalBar_ctrl_mode() |
| 21118 | // desc: CTRL function ... | 21513 | // desc: CTRL function ... |
| 21119 | //----------------------------------------------------------------------------- | 21514 | //----------------------------------------------------------------------------- |
| 21120 | CK_DLL_CTRL( Flute_ctrl_endReflection ) | 21515 | CK_DLL_CTRL( ModalBar_ctrl_mode ) |
| 21121 | { | 21516 | { |
| 21122 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21517 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21123 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21518 | int i = GET_CK_INT(ARGS); |
| 21124 | b->setEndReflection(f); | 21519 | if ( i >= 0 && i < b->modalbar.nModes ) |
| 21125 | RETURN->v_float = (t_CKFLOAT)b->m_endReflection; | 21520 | { |
| 21521 | b->m_modeIndex = i; | ||
| 21522 | b->m_modeRatio = b->modalbar.ratios[i]; | ||
| 21523 | b->m_modeRadius = b->modalbar.radii[i]; | ||
| 21524 | RETURN->v_float = (t_CKFLOAT)b->m_modeIndex; | ||
| 21525 | } | ||
| 21126 | } | 21526 | } |
| 21127 | 21527 | ||
| 21128 | 21528 | ||
| 21129 | //----------------------------------------------------------------------------- | 21529 | //----------------------------------------------------------------------------- |
| 21130 | // name: Flute_cget_endReflection() | 21530 | // name: ModalBar_cget_mode() |
| 21131 | // desc: CGET function ... | 21531 | // desc: CGET function ... |
| 21132 | //----------------------------------------------------------------------------- | 21532 | //----------------------------------------------------------------------------- |
| 21133 | CK_DLL_CGET( Flute_cget_endReflection ) | 21533 | CK_DLL_CGET( ModalBar_cget_mode ) |
| 21134 | { | 21534 | { |
| 21135 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21535 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21136 | RETURN->v_float = (t_CKFLOAT)b->m_endReflection; | 21536 | RETURN->v_float = (t_CKFLOAT)b->m_modeIndex; |
| 21137 | } | 21537 | } |
| 21138 | 21538 | ||
| 21139 | 21539 | ||
| 21140 | //----------------------------------------------------------------------------- | 21540 | //----------------------------------------------------------------------------- |
| 21141 | // name: Flute_ctrl_noiseGain() | 21541 | // name: ModalBar_ctrl_modeGain() |
| 21142 | // desc: CTRL function ... | 21542 | // desc: CTRL function ... |
| 21143 | //----------------------------------------------------------------------------- | 21543 | //----------------------------------------------------------------------------- |
| 21144 | CK_DLL_CTRL( Flute_ctrl_noiseGain ) | 21544 | CK_DLL_CTRL( ModalBar_ctrl_modeGain ) |
| 21145 | { | 21545 | { |
| 21146 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21546 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21147 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21547 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21148 | b->controlChange( 4, f * 128.0 ); | 21548 | b->modalbar.setModeGain( b->m_modeIndex, f ); |
| 21149 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; | 21549 | RETURN->v_float = (t_CKFLOAT)b->modalbar.filters[b->m_modeIndex]->getGain(); |
| 21150 | } | 21550 | } |
| 21151 | 21551 | ||
| 21152 | 21552 | ||
| 21153 | //----------------------------------------------------------------------------- | 21553 | //----------------------------------------------------------------------------- |
| 21154 | // name: Flute_cget_noiseGain() | 21554 | // name: ModalBar_cget_modeGain() |
| 21155 | // desc: CGET function ... | 21555 | // desc: CGET function ... |
| 21156 | //----------------------------------------------------------------------------- | 21556 | //----------------------------------------------------------------------------- |
| 21157 | CK_DLL_CGET( Flute_cget_noiseGain ) | 21557 | CK_DLL_CGET( ModalBar_cget_modeGain ) |
| 21158 | { | 21558 | { |
| 21159 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21559 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21160 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; | 21560 | RETURN->v_float = (t_CKFLOAT)b->modalbar.filters[b->m_modeIndex]->getGain(); |
| 21161 | } | 21561 | } |
| 21162 | 21562 | ||
| 21163 | 21563 | ||
| 21164 | //----------------------------------------------------------------------------- | 21564 | //----------------------------------------------------------------------------- |
| 21165 | // name: Flute_ctrl_vibratoFreq() | 21565 | // name: ModalBar_ctrl_modeRatio() |
| 21166 | // desc: CTRL function ... | 21566 | // desc: CTRL function ... |
| 21167 | //----------------------------------------------------------------------------- | 21567 | //----------------------------------------------------------------------------- |
| 21168 | CK_DLL_CTRL( Flute_ctrl_vibratoFreq ) | 21568 | CK_DLL_CTRL( ModalBar_ctrl_modeRatio ) |
| 21169 | { | 21569 | { |
| 21170 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21570 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21171 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21571 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21172 | b->setVibratoFreq( f ); | 21572 | if ( b->m_modeIndex >= 0 && b->m_modeIndex < b->modalbar.nModes ) |
| 21173 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; | 21573 | { |
| 21574 | b->modalbar.setRatioAndRadius( b->m_modeIndex, f , b->m_modeRadius ); | ||
| 21575 | b->m_modeRatio = b->modalbar.ratios[b->m_modeIndex]; | ||
| 21576 | RETURN->v_float = (t_CKFLOAT) b->m_modeRatio; | ||
| 21577 | } | ||
| 21174 | } | 21578 | } |
| 21175 | 21579 | ||
| 21176 | 21580 | ||
| 21177 | //----------------------------------------------------------------------------- | 21581 | //----------------------------------------------------------------------------- |
| 21178 | // name: Flute_cget_vibratoFreq() | 21582 | // name: ModalBar_cget_modeRatio() |
| 21179 | // desc: CGET function ... | 21583 | // desc: CGET function ... |
| 21180 | //----------------------------------------------------------------------------- | 21584 | //----------------------------------------------------------------------------- |
| 21181 | CK_DLL_CGET( Flute_cget_vibratoFreq ) | 21585 | CK_DLL_CGET( ModalBar_cget_modeRatio ) |
| 21182 | { | 21586 | { |
| 21183 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21587 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21184 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoFreq; | 21588 | RETURN->v_float = (t_CKFLOAT)b->m_modeRatio; |
| 21185 | } | 21589 | } |
| 21186 | 21590 | ||
| 21187 | 21591 | ||
| 21188 | //----------------------------------------------------------------------------- | 21592 | //----------------------------------------------------------------------------- |
| 21189 | // name: Flute_ctrl_vibratoGain() | 21593 | // name: ModalBar_ctrl_modeRadius() |
| 21190 | // desc: CTRL function ... | 21594 | // desc: CTRL function ... |
| 21191 | //----------------------------------------------------------------------------- | 21595 | //----------------------------------------------------------------------------- |
| 21192 | CK_DLL_CTRL( Flute_ctrl_vibratoGain ) | 21596 | CK_DLL_CTRL( ModalBar_ctrl_modeRadius ) |
| 21193 | { | 21597 | { |
| 21194 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21598 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21195 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21599 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21196 | b->controlChange( 1, f * 128.0 ); | 21600 | if( b->m_modeIndex >= 0 && b->m_modeIndex < b->modalbar.nModes ) |
| 21197 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; | 21601 | { |
| 21602 | b->modalbar.setRatioAndRadius ( b->m_modeIndex, b->m_modeRatio, f ); | ||
| 21603 | b->m_modeRadius = b->modalbar.radii[b->m_modeIndex]; | ||
| 21604 | RETURN->v_float = (t_CKFLOAT) b->m_modeRadius; | ||
| 21605 | } | ||
| 21198 | } | 21606 | } |
| 21199 | 21607 | ||
| 21200 | 21608 | ||
| 21201 | //----------------------------------------------------------------------------- | 21609 | //----------------------------------------------------------------------------- |
| 21202 | // name: Flute_cget_vibratoGain() | 21610 | // name: ModalBar_cget_modeRadius() |
| 21203 | // desc: CGET function ... | 21611 | // desc: CGET function ... |
| 21204 | //----------------------------------------------------------------------------- | 21612 | //----------------------------------------------------------------------------- |
| 21205 | CK_DLL_CGET( Flute_cget_vibratoGain ) | 21613 | CK_DLL_CGET( ModalBar_cget_modeRadius ) |
| 21206 | { | 21614 | { |
| 21207 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21615 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21208 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; | 21616 | RETURN->v_float = (t_CKFLOAT)b->m_modeRadius; |
| 21209 | } | 21617 | } |
| 21210 | 21618 | ||
| 21211 | 21619 | ||
| 21212 | //----------------------------------------------------------------------------- | 21620 | //----------------------------------------------------------------------------- |
| 21213 | // name: Flute_ctrl_pressure() | 21621 | // name: ModalBar_ctrl_volume() |
| 21214 | // desc: CTRL function ... | 21622 | // desc: CTRL function ... |
| 21215 | //----------------------------------------------------------------------------- | 21623 | //----------------------------------------------------------------------------- |
| 21216 | CK_DLL_CTRL( Flute_ctrl_pressure ) | 21624 | CK_DLL_CTRL( ModalBar_ctrl_volume ) |
| 21217 | { | 21625 | { |
| 21218 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21626 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21219 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21627 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21220 | b->controlChange( 128, f * 128.0 ); | 21628 | b->modalbar.controlChange( 128, f*128 ); |
| 21221 | RETURN->v_float = (t_CKFLOAT)b->m_pressure; | 21629 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_volume; |
| 21222 | } | 21630 | } |
| 21223 | 21631 | ||
| 21224 | 21632 | ||
| 21225 | //----------------------------------------------------------------------------- | 21633 | //----------------------------------------------------------------------------- |
| 21226 | // name: Flute_cget_pressure() | 21634 | // name: ModalBar_cget_volume() |
| 21227 | // desc: CGET function ... | 21635 | // desc: CGET function ... |
| 21228 | //----------------------------------------------------------------------------- | 21636 | //----------------------------------------------------------------------------- |
| 21229 | CK_DLL_CGET( Flute_cget_pressure ) | 21637 | CK_DLL_CGET( ModalBar_cget_volume ) |
| 21230 | { | 21638 | { |
| 21231 | Flute * b = (Flute *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21639 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21232 | RETURN->v_float = (t_CKFLOAT)b->m_pressure; | 21640 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_volume; |
| 21233 | } | 21641 | } |
| 21234 | 21642 | ||
| 21235 | 21643 | ||
| 21236 | // ModalBar | ||
| 21237 | struct ModalBar_ { | ||
| 21238 | ModalBar modalbar; | ||
| 21239 | 21644 | ||
| 21240 | int m_preset; | 21645 | |
| 21241 | int m_modeIndex; | 21646 | // Sitar |
| 21242 | double m_modeRatio; | 21647 | /* |
| 21243 | double m_modeRadius; | 21648 | struct Sitar_ { |
| 21244 | 21649 | Sitar * imp; | |
| 21245 | ModalBar_ ( ) { | 21650 | double m_frequency; |
| 21246 | m_preset = 0; | 21651 | |
| 21247 | m_modeIndex = 0; | 21652 | Sitar_ ( double d ) { |
| 21653 | imp = new Sitar(d); | ||
| 21654 | m_frequency = 100.0; | ||
| 21248 | } | 21655 | } |
| 21249 | }; | 21656 | };*/ |
| 21250 | 21657 | ||
| 21251 | 21658 | ||
| 21252 | //----------------------------------------------------------------------------- | 21659 | //----------------------------------------------------------------------------- |
| 21253 | // name: ModalBar_ctor() | 21660 | // name: Sitar_ctor() |
| 21254 | // desc: CTOR function ... | 21661 | // desc: CTOR function ... |
| 21255 | //----------------------------------------------------------------------------- | 21662 | //----------------------------------------------------------------------------- |
| 21256 | CK_DLL_CTOR( ModalBar_ctor ) | 21663 | CK_DLL_CTOR( Sitar_ctor ) |
| 21257 | { | 21664 | { |
| 21258 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)new ModalBar_(); | 21665 | Sitar * sitar = new Sitar( 20 ); |
| 21666 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)sitar; | ||
| 21667 | // default | ||
| 21668 | sitar->setFrequency( 220 ); | ||
| 21259 | } | 21669 | } |
| 21260 | 21670 | ||
| 21261 | 21671 | ||
| 21262 | //----------------------------------------------------------------------------- | 21672 | //----------------------------------------------------------------------------- |
| 21263 | // name: ModalBar_dtor() | 21673 | // name: Sitar_dtor() |
| 21264 | // desc: DTOR function ... | 21674 | // desc: DTOR function ... |
| 21265 | //----------------------------------------------------------------------------- | 21675 | //----------------------------------------------------------------------------- |
| 21266 | CK_DLL_DTOR( ModalBar_dtor ) | 21676 | CK_DLL_DTOR( Sitar_dtor ) |
| 21267 | { | 21677 | { |
| 21268 | delete (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21678 | Sitar * s = (Sitar *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21679 | SAFE_DELETE(s); | ||
| 21269 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; | 21680 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; |
| 21270 | } | 21681 | } |
| 21271 | 21682 | ||
| 21272 | 21683 | ||
| 21273 | //----------------------------------------------------------------------------- | 21684 | //----------------------------------------------------------------------------- |
| 21274 | // name: ModalBar_tick() | 21685 | // name: Sitar_tick() |
| 21275 | // desc: TICK function ... | 21686 | // desc: TICK function ... |
| 21276 | //----------------------------------------------------------------------------- | 21687 | //----------------------------------------------------------------------------- |
| 21277 | CK_DLL_TICK( ModalBar_tick ) | 21688 | CK_DLL_TICK( Sitar_tick ) |
| 21278 | { | 21689 | { |
| 21279 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21690 | Sitar * b = (Sitar *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21280 | *out = b->modalbar.tick(); | 21691 | *out = b->tick(); |
| 21281 | return TRUE; | 21692 | return TRUE; |
| 21282 | } | 21693 | } |
| 21283 | 21694 | ||
| 21284 | 21695 | ||
| 21285 | //----------------------------------------------------------------------------- | 21696 | //----------------------------------------------------------------------------- |
| 21286 | // name: ModalBar_pmsg() | 21697 | // name: Sitar_pmsg() |
| 21287 | // desc: PMSG function ... | 21698 | // desc: PMSG function ... |
| 21288 | //----------------------------------------------------------------------------- | 21699 | //----------------------------------------------------------------------------- |
| 21289 | CK_DLL_PMSG( ModalBar_pmsg ) | 21700 | CK_DLL_PMSG( Sitar_pmsg ) |
| 21290 | { | 21701 | { |
| 21291 | return TRUE; | 21702 | return TRUE; |
| 21292 | } | 21703 | } |
| 21293 | 21704 | ||
| 21294 | 21705 | ||
| 21295 | //----------------------------------------------------------------------------- | 21706 | //----------------------------------------------------------------------------- |
| 21296 | // name: ModalBar_ctrl_strike() | 21707 | // name: Sitar_ctrl_pluck() |
| 21297 | // desc: CTRL function ... | ||
| 21298 | //----------------------------------------------------------------------------- | ||
| 21299 | CK_DLL_CTRL( ModalBar_ctrl_strike ) | ||
| 21300 | { | ||
| 21301 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21302 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 21303 | b->modalbar.strike( f ); | ||
| 21304 | } | ||
| 21305 | |||
| 21306 | |||
| 21307 | //----------------------------------------------------------------------------- | ||
| 21308 | // name: ModalBar_ctrl_damp() | ||
| 21309 | // desc: CTRL function ... | 21708 | // desc: CTRL function ... |
| 21310 | //----------------------------------------------------------------------------- | 21709 | //----------------------------------------------------------------------------- |
| 21311 | CK_DLL_CTRL( ModalBar_ctrl_damp ) | 21710 | CK_DLL_CTRL( Sitar_ctrl_pluck ) |
| 21312 | { | 21711 | { |
| 21313 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21712 | Sitar * b = (Sitar *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21314 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21713 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21315 | b->modalbar.damp( f ); | 21714 | b->pluck( f ); |
| 21316 | } | ||
| 21317 | |||
| 21318 | |||
| 21319 | //----------------------------------------------------------------------------- | ||
| 21320 | // name: ModalBar_ctrl_clear() | ||
| 21321 | // desc: CTRL function ... | ||
| 21322 | //----------------------------------------------------------------------------- | ||
| 21323 | CK_DLL_CTRL( ModalBar_ctrl_clear ) | ||
| 21324 | { | ||
| 21325 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 21326 | b->modalbar.clear(); | ||
| 21327 | } | 21715 | } |
| 21328 | 21716 | ||
| 21329 | 21717 | ||
| 21330 | //----------------------------------------------------------------------------- | 21718 | //----------------------------------------------------------------------------- |
| 21331 | // name: ModalBar_ctrl_preset() | 21719 | // name: Sitar_ctrl_clear() |
| 21332 | // desc: CTRL function ... | 21720 | // desc: CTRL function ... |
| 21333 | //----------------------------------------------------------------------------- | 21721 | //----------------------------------------------------------------------------- |
| 21334 | CK_DLL_CTRL( ModalBar_ctrl_preset ) | 21722 | CK_DLL_CTRL( Sitar_ctrl_clear ) |
| 21335 | { | 21723 | { |
| 21336 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21724 | Sitar * b = (Sitar *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21337 | int f = GET_CK_INT(ARGS); | 21725 | b->clear(); |
| 21338 | b->m_preset = f; | ||
| 21339 | b->modalbar.setPreset ( f ); | ||
| 21340 | RETURN->v_int = (t_CKINT)b->m_preset; | ||
| 21341 | } | 21726 | } |
| 21342 | 21727 | ||
| 21343 | 21728 | ||
| 21729 | |||
| 21730 | |||
| 21344 | //----------------------------------------------------------------------------- | 21731 | //----------------------------------------------------------------------------- |
| 21345 | // name: ModalBar_cget_preset() | 21732 | // name: Saxofony_ctor() |
| 21346 | // desc: CGET function ... | 21733 | // desc: CTOR function ... |
| 21347 | //----------------------------------------------------------------------------- | 21734 | //----------------------------------------------------------------------------- |
| 21348 | CK_DLL_CGET( ModalBar_cget_preset ) | 21735 | CK_DLL_CTOR( Saxofony_ctor ) |
| 21349 | { | 21736 | { |
| 21350 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21737 | Saxofony * fony = new Saxofony( 20 ); |
| 21351 | RETURN->v_int = (t_CKINT)b->m_preset; | 21738 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)fony; |
| 21739 | // default | ||
| 21740 | fony->setFrequency( 220 ); | ||
| 21352 | } | 21741 | } |
| 21353 | 21742 | ||
| 21354 | 21743 | ||
| 21355 | //----------------------------------------------------------------------------- | 21744 | //----------------------------------------------------------------------------- |
| 21356 | // name: ModalBar_ctrl_strikePosition() | 21745 | // name: Saxofony_dtor() |
| 21357 | // desc: CTRL function ... | 21746 | // desc: DTOR function ... |
| 21358 | //----------------------------------------------------------------------------- | 21747 | //----------------------------------------------------------------------------- |
| 21359 | CK_DLL_CTRL( ModalBar_ctrl_strikePosition ) | 21748 | CK_DLL_DTOR( Saxofony_dtor ) |
| 21360 | { | 21749 | { |
| 21361 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21750 | Saxofony * d = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21362 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21751 | SAFE_DELETE(d); |
| 21363 | b->modalbar.setStrikePosition( f ); | 21752 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; |
| 21364 | RETURN->v_float = (t_CKFLOAT)b->modalbar.strikePosition; | ||
| 21365 | } | 21753 | } |
| 21366 | 21754 | ||
| 21367 | 21755 | ||
| 21368 | //----------------------------------------------------------------------------- | 21756 | //----------------------------------------------------------------------------- |
| 21369 | // name: ModalBar_cget_strikePosition() | 21757 | // name: Saxofony_tick() |
| 21370 | // desc: CGET function ... | 21758 | // desc: TICK function ... |
| 21371 | //----------------------------------------------------------------------------- | 21759 | //----------------------------------------------------------------------------- |
| 21372 | CK_DLL_CGET( ModalBar_cget_strikePosition ) | 21760 | CK_DLL_TICK( Saxofony_tick ) |
| 21373 | { | 21761 | { |
| 21374 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21762 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21375 | RETURN->v_float = (t_CKFLOAT)b->modalbar.strikePosition; | 21763 | *out = b->tick(); |
| 21764 | return TRUE; | ||
| 21376 | } | 21765 | } |
| 21377 | 21766 | ||
| 21378 | 21767 | ||
| 21379 | //----------------------------------------------------------------------------- | 21768 | //----------------------------------------------------------------------------- |
| 21380 | // name: ModalBar_ctrl_vibratoGain() | 21769 | // name: Saxofony_pmsg() |
| 21381 | // desc: CTRL function ... | 21770 | // desc: PMSG function ... |
| 21382 | //----------------------------------------------------------------------------- | 21771 | //----------------------------------------------------------------------------- |
| 21383 | CK_DLL_CTRL( ModalBar_ctrl_vibratoGain ) | 21772 | CK_DLL_PMSG( Saxofony_pmsg ) |
| 21384 | { | 21773 | { |
| 21385 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21774 | return TRUE; |
| 21386 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 21387 | b->modalbar.controlChange( 11, f*128 ); | ||
| 21388 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_vibratoGain; | ||
| 21389 | } | 21775 | } |
| 21390 | 21776 | ||
| 21391 | 21777 | ||
| 21392 | //----------------------------------------------------------------------------- | 21778 | //----------------------------------------------------------------------------- |
| 21393 | // name: ModalBar_cget_vibratoGain() | 21779 | // name: Saxofony_ctrl_startBlowing() |
| 21394 | // desc: CGET function ... | 21780 | // desc: CTRL function ... |
| 21395 | //----------------------------------------------------------------------------- | 21781 | //----------------------------------------------------------------------------- |
| 21396 | CK_DLL_CGET( ModalBar_cget_vibratoGain ) | 21782 | CK_DLL_CTRL( Saxofony_ctrl_startBlowing ) |
| 21397 | { | 21783 | { |
| 21398 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21784 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21399 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_vibratoGain; | 21785 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21786 | b->startBlowing( f, b->m_rate ); | ||
| 21400 | } | 21787 | } |
| 21401 | 21788 | ||
| 21402 | 21789 | ||
| 21403 | //----------------------------------------------------------------------------- | 21790 | //----------------------------------------------------------------------------- |
| 21404 | // name: ModalBar_ctrl_vibratoFreq() | 21791 | // name: Saxofony_ctrl_stopBlowing() |
| 21405 | // desc: CTRL function ... | 21792 | // desc: CTRL function ... |
| 21406 | //----------------------------------------------------------------------------- | 21793 | //----------------------------------------------------------------------------- |
| 21407 | CK_DLL_CTRL( ModalBar_ctrl_vibratoFreq ) | 21794 | CK_DLL_CTRL( Saxofony_ctrl_stopBlowing ) |
| 21408 | { | 21795 | { |
| 21409 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21796 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21410 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21797 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21411 | b->modalbar.vibrato->setFrequency( f ); | 21798 | b->stopBlowing( f ); |
| 21412 | b->modalbar.m_vibratoFreq = b->modalbar.vibrato->m_freq; | ||
| 21413 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_vibratoFreq; | ||
| 21414 | } | 21799 | } |
| 21415 | 21800 | ||
| 21416 | 21801 | ||
| 21417 | //----------------------------------------------------------------------------- | 21802 | //----------------------------------------------------------------------------- |
| 21418 | // name: ModalBar_cget_vibratoFreq() | 21803 | // name: Saxofony_ctrl_clear() |
| 21419 | // desc: CGET function ... | 21804 | // desc: CTRL function ... |
| 21420 | //----------------------------------------------------------------------------- | 21805 | //----------------------------------------------------------------------------- |
| 21421 | CK_DLL_CGET( ModalBar_cget_vibratoFreq ) | 21806 | CK_DLL_CTRL( Saxofony_ctrl_clear ) |
| 21422 | { | 21807 | { |
| 21423 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21808 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21424 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_vibratoFreq; | 21809 | b->clear(); |
| 21425 | } | 21810 | } |
| 21426 | 21811 | ||
| 21427 | 21812 | ||
| 21428 | //----------------------------------------------------------------------------- | 21813 | //----------------------------------------------------------------------------- |
| 21429 | // name: ModalBar_ctrl_stickHardness() | 21814 | // name: Saxofony_ctrl_rate() |
| 21430 | // desc: CTRL function ... | 21815 | // desc: CTRL function ... |
| 21431 | //----------------------------------------------------------------------------- | 21816 | //----------------------------------------------------------------------------- |
| 21432 | CK_DLL_CTRL( ModalBar_ctrl_stickHardness ) | 21817 | CK_DLL_CTRL( Saxofony_ctrl_rate ) |
| 21433 | { | 21818 | { |
| 21434 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21819 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21435 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21820 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21436 | b->modalbar.setStickHardness ( f ); | 21821 | b->m_rate = f; |
| 21437 | RETURN->v_float = (t_CKFLOAT)b->modalbar.stickHardness; | 21822 | RETURN->v_float = (t_CKFLOAT)b->m_rate; |
| 21438 | } | 21823 | } |
| 21439 | 21824 | ||
| 21440 | 21825 | ||
| 21441 | |||
| 21442 | //----------------------------------------------------------------------------- | 21826 | //----------------------------------------------------------------------------- |
| 21443 | // name: ModalBar_cget_stickHardness() | 21827 | // name: Saxofony_cget_rate() |
| 21444 | // desc: CGET function ... | 21828 | // desc: CGET function ... |
| 21445 | //----------------------------------------------------------------------------- | 21829 | //----------------------------------------------------------------------------- |
| 21446 | CK_DLL_CGET( ModalBar_cget_stickHardness ) | 21830 | CK_DLL_CGET( Saxofony_cget_rate ) |
| 21447 | { | 21831 | { |
| 21448 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21832 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21449 | RETURN->v_float = (t_CKFLOAT)b->modalbar.stickHardness; | 21833 | RETURN->v_float = (t_CKFLOAT)b->m_rate; |
| 21450 | } | 21834 | } |
| 21451 | 21835 | ||
| 21452 | 21836 | ||
| 21453 | //----------------------------------------------------------------------------- | 21837 | //----------------------------------------------------------------------------- |
| 21454 | // name: ModalBar_ctrl_masterGain() | 21838 | // name: Saxofony_ctrl_blowPosition() |
| 21455 | // desc: CTRL function ... | 21839 | // desc: CTRL function ... |
| 21456 | //----------------------------------------------------------------------------- | 21840 | //----------------------------------------------------------------------------- |
| 21457 | CK_DLL_CTRL( ModalBar_ctrl_masterGain ) | 21841 | CK_DLL_CTRL( Saxofony_ctrl_blowPosition ) |
| 21458 | { | 21842 | { |
| 21459 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21843 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21460 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21844 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21461 | b->modalbar.setMasterGain( f ); | 21845 | b->setBlowPosition(f); |
| 21462 | RETURN->v_float = (t_CKFLOAT)b->modalbar.masterGain; | 21846 | RETURN->v_float = (t_CKFLOAT)b->position; |
| 21463 | } | 21847 | } |
| 21464 | 21848 | ||
| 21465 | 21849 | ||
| 21466 | //----------------------------------------------------------------------------- | 21850 | //----------------------------------------------------------------------------- |
| 21467 | // name: ModalBar_cget_masterGain() | 21851 | // name: Saxofony_cget_blowPosition() |
| 21468 | // desc: CGET function ... | 21852 | // desc: CGET function ... |
| 21469 | //----------------------------------------------------------------------------- | 21853 | //----------------------------------------------------------------------------- |
| 21470 | CK_DLL_CGET( ModalBar_cget_masterGain ) | 21854 | CK_DLL_CGET( Saxofony_cget_blowPosition ) |
| 21471 | { | 21855 | { |
| 21472 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21856 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21473 | RETURN->v_float = (t_CKFLOAT)b->modalbar.masterGain; | 21857 | RETURN->v_float = (t_CKFLOAT)b->position; |
| 21474 | } | 21858 | } |
| 21475 | 21859 | ||
| 21476 | 21860 | ||
| 21477 | //----------------------------------------------------------------------------- | 21861 | //----------------------------------------------------------------------------- |
| 21478 | // name: ModalBar_ctrl_directGain() | 21862 | // name: Saxofony_ctrl_reed() |
| 21479 | // desc: CTRL function ... | 21863 | // desc: CTRL function ... |
| 21480 | //----------------------------------------------------------------------------- | 21864 | //----------------------------------------------------------------------------- |
| 21481 | CK_DLL_CTRL( ModalBar_ctrl_directGain ) | 21865 | CK_DLL_CTRL( Saxofony_ctrl_reed ) |
| 21482 | { | 21866 | { |
| 21483 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21867 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21484 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21868 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21485 | b->modalbar.setDirectGain( f ); | 21869 | b->controlChange( 2, f * 128 ); |
| 21486 | RETURN->v_float = (t_CKFLOAT) b->modalbar.directGain; | 21870 | RETURN->v_float = (t_CKFLOAT)b->m_stiffness; |
| 21487 | } | 21871 | } |
| 21488 | 21872 | ||
| 21489 | 21873 | ||
| 21490 | //----------------------------------------------------------------------------- | 21874 | //----------------------------------------------------------------------------- |
| 21491 | // name: ModalBar_cget_directGain() | 21875 | // name: Saxofony_cget_reed() |
| 21492 | // desc: CGET function ... | 21876 | // desc: CGET function ... |
| 21493 | //----------------------------------------------------------------------------- | 21877 | //----------------------------------------------------------------------------- |
| 21494 | CK_DLL_CGET( ModalBar_cget_directGain ) | 21878 | CK_DLL_CGET( Saxofony_cget_reed ) |
| 21495 | { | 21879 | { |
| 21496 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21880 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21497 | RETURN->v_float = (t_CKFLOAT)b->modalbar.directGain; | 21881 | RETURN->v_float = (t_CKFLOAT)b->m_stiffness; |
| 21498 | } | 21882 | } |
| 21499 | 21883 | ||
| 21500 | 21884 | ||
| 21501 | //----------------------------------------------------------------------------- | 21885 | //----------------------------------------------------------------------------- |
| 21502 | // name: ModalBar_ctrl_mode() | 21886 | // name: Saxofony_ctrl_aperture() |
| 21503 | // desc: CTRL function ... | 21887 | // desc: CTRL function ... |
| 21504 | //----------------------------------------------------------------------------- | 21888 | //----------------------------------------------------------------------------- |
| 21505 | CK_DLL_CTRL( ModalBar_ctrl_mode ) | 21889 | CK_DLL_CTRL( Saxofony_ctrl_aperture ) |
| 21506 | { | 21890 | { |
| 21507 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21891 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21508 | int i = GET_CK_INT(ARGS); | 21892 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21509 | if ( i >= 0 && i < b->modalbar.nModes ) | 21893 | b->controlChange( 26, f * 128 ); |
| 21510 | { | 21894 | RETURN->v_float = (t_CKFLOAT)b->m_aperture; |
| 21511 | b->m_modeIndex = i; | ||
| 21512 | b->m_modeRatio = b->modalbar.ratios[i]; | ||
| 21513 | b->m_modeRadius = b->modalbar.radii[i]; | ||
| 21514 | RETURN->v_float = (t_CKFLOAT)b->m_modeIndex; | ||
| 21515 | } | ||
| 21516 | } | 21895 | } |
| 21517 | 21896 | ||
| 21518 | 21897 | ||
| 21519 | //----------------------------------------------------------------------------- | 21898 | //----------------------------------------------------------------------------- |
| 21520 | // name: ModalBar_cget_mode() | 21899 | // name: Saxofony_cget_aperture() |
| 21521 | // desc: CGET function ... | 21900 | // desc: CGET function ... |
| 21522 | //----------------------------------------------------------------------------- | 21901 | //----------------------------------------------------------------------------- |
| 21523 | CK_DLL_CGET( ModalBar_cget_mode ) | 21902 | CK_DLL_CGET( Saxofony_cget_aperture ) |
| 21524 | { | 21903 | { |
| 21525 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21904 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21526 | RETURN->v_float = (t_CKFLOAT)b->m_modeIndex; | 21905 | RETURN->v_float = (t_CKFLOAT)b->m_aperture; |
| 21527 | } | 21906 | } |
| 21528 | 21907 | ||
| 21529 | 21908 | ||
| 21530 | //----------------------------------------------------------------------------- | 21909 | //----------------------------------------------------------------------------- |
| 21531 | // name: ModalBar_ctrl_modeGain() | 21910 | // name: Saxofony_ctrl_noiseGain() |
| 21532 | // desc: CTRL function ... | 21911 | // desc: CTRL function ... |
| 21533 | //----------------------------------------------------------------------------- | 21912 | //----------------------------------------------------------------------------- |
| 21534 | CK_DLL_CTRL( ModalBar_ctrl_modeGain ) | 21913 | CK_DLL_CTRL( Saxofony_ctrl_noiseGain ) |
| 21535 | { | 21914 | { |
| 21536 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21915 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21537 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21916 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21538 | b->modalbar.setModeGain( b->m_modeIndex, f ); | 21917 | b->controlChange( 4, f * 128 ); |
| 21539 | RETURN->v_float = (t_CKFLOAT)b->modalbar.filters[b->m_modeIndex]->getGain(); | 21918 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; |
| 21540 | } | 21919 | } |
| 21541 | 21920 | ||
| 21542 | 21921 | ||
| 21543 | //----------------------------------------------------------------------------- | 21922 | //----------------------------------------------------------------------------- |
| 21544 | // name: ModalBar_cget_modeGain() | 21923 | // name: Saxofony_cget_noiseGain() |
| 21545 | // desc: CGET function ... | 21924 | // desc: CGET function ... |
| 21546 | //----------------------------------------------------------------------------- | 21925 | //----------------------------------------------------------------------------- |
| 21547 | CK_DLL_CGET( ModalBar_cget_modeGain ) | 21926 | CK_DLL_CGET( Saxofony_cget_noiseGain ) |
| 21548 | { | 21927 | { |
| 21549 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21928 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21550 | RETURN->v_float = (t_CKFLOAT)b->modalbar.filters[b->m_modeIndex]->getGain(); | 21929 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; |
| 21551 | } | 21930 | } |
| 21552 | 21931 | ||
| 21553 | 21932 | ||
| 21554 | //----------------------------------------------------------------------------- | 21933 | //----------------------------------------------------------------------------- |
| 21555 | // name: ModalBar_ctrl_modeRatio() | 21934 | // name: Saxofony_ctrl_vibratoFreq() |
| 21556 | // desc: CTRL function ... | 21935 | // desc: CTRL function ... |
| 21557 | //----------------------------------------------------------------------------- | 21936 | //----------------------------------------------------------------------------- |
| 21558 | CK_DLL_CTRL( ModalBar_ctrl_modeRatio ) | 21937 | CK_DLL_CTRL( Saxofony_ctrl_vibratoFreq ) |
| 21559 | { | 21938 | { |
| 21560 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21939 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21561 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21940 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21562 | if ( b->m_modeIndex >= 0 && b->m_modeIndex < b->modalbar.nModes ) | 21941 | b->vibrato->setFrequency( f ); |
| 21563 | { | 21942 | RETURN->v_float = (t_CKFLOAT)b->vibrato->m_freq; |
| 21564 | b->modalbar.setRatioAndRadius( b->m_modeIndex, f , b->m_modeRadius ); | ||
| 21565 | b->m_modeRatio = b->modalbar.ratios[b->m_modeIndex]; | ||
| 21566 | RETURN->v_float = (t_CKFLOAT) b->m_modeRatio; | ||
| 21567 | } | ||
| 21568 | } | 21943 | } |
| 21569 | 21944 | ||
| 21570 | 21945 | ||
| 21571 | //----------------------------------------------------------------------------- | 21946 | //----------------------------------------------------------------------------- |
| 21572 | // name: ModalBar_cget_modeRatio() | 21947 | // name: Saxofony_cget_vibratoFreq() |
| 21573 | // desc: CGET function ... | 21948 | // desc: CGET function ... |
| 21574 | //----------------------------------------------------------------------------- | 21949 | //----------------------------------------------------------------------------- |
| 21575 | CK_DLL_CGET( ModalBar_cget_modeRatio ) | 21950 | CK_DLL_CGET( Saxofony_cget_vibratoFreq ) |
| 21576 | { | 21951 | { |
| 21577 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21952 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21578 | RETURN->v_float = (t_CKFLOAT)b->m_modeRatio; | 21953 | RETURN->v_float = (t_CKFLOAT)b->vibrato->m_freq; |
| 21579 | } | 21954 | } |
| 21580 | 21955 | ||
| 21581 | 21956 | ||
| 21582 | //----------------------------------------------------------------------------- | 21957 | //----------------------------------------------------------------------------- |
| 21583 | // name: ModalBar_ctrl_modeRadius() | 21958 | // name: Saxofony_ctrl_vibratoGain() |
| 21584 | // desc: CTRL function ... | 21959 | // desc: CTRL function ... |
| 21585 | //----------------------------------------------------------------------------- | 21960 | //----------------------------------------------------------------------------- |
| 21586 | CK_DLL_CTRL( ModalBar_ctrl_modeRadius ) | 21961 | CK_DLL_CTRL( Saxofony_ctrl_vibratoGain ) |
| 21587 | { | 21962 | { |
| 21588 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21963 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21589 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21964 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21590 | if( b->m_modeIndex >= 0 && b->m_modeIndex < b->modalbar.nModes ) | 21965 | b->controlChange( 1, f * 128 ); |
| 21591 | { | 21966 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; |
| 21592 | b->modalbar.setRatioAndRadius ( b->m_modeIndex, b->m_modeRatio, f ); | ||
| 21593 | b->m_modeRadius = b->modalbar.radii[b->m_modeIndex]; | ||
| 21594 | RETURN->v_float = (t_CKFLOAT) b->m_modeRadius; | ||
| 21595 | } | ||
| 21596 | } | 21967 | } |
| 21597 | 21968 | ||
| 21598 | 21969 | ||
| 21599 | //----------------------------------------------------------------------------- | 21970 | //----------------------------------------------------------------------------- |
| 21600 | // name: ModalBar_cget_modeRadius() | 21971 | // name: Saxofony_cget_vibratoGain() |
| 21601 | // desc: CGET function ... | 21972 | // desc: CGET function ... |
| 21602 | //----------------------------------------------------------------------------- | 21973 | //----------------------------------------------------------------------------- |
| 21603 | CK_DLL_CGET( ModalBar_cget_modeRadius ) | 21974 | CK_DLL_CGET( Saxofony_cget_vibratoGain ) |
| 21604 | { | 21975 | { |
| 21605 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21976 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21606 | RETURN->v_float = (t_CKFLOAT)b->m_modeRadius; | 21977 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; |
| 21607 | } | 21978 | } |
| 21608 | 21979 | ||
| 21609 | 21980 | ||
| 21610 | //----------------------------------------------------------------------------- | 21981 | //----------------------------------------------------------------------------- |
| 21611 | // name: ModalBar_ctrl_volume() | 21982 | // name: Saxofony_ctrl_pressure() |
| 21612 | // desc: CTRL function ... | 21983 | // desc: CTRL function ... |
| 21613 | //----------------------------------------------------------------------------- | 21984 | //----------------------------------------------------------------------------- |
| 21614 | CK_DLL_CTRL( ModalBar_ctrl_volume ) | 21985 | CK_DLL_CTRL( Saxofony_ctrl_pressure ) |
| 21615 | { | 21986 | { |
| 21616 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 21987 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21617 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 21988 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21618 | b->modalbar.controlChange( 128, f*128 ); | 21989 | b->controlChange( 128, f * 128 ); |
| 21619 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_volume; | 21990 | RETURN->v_float = (t_CKFLOAT)b->m_pressure; |
| 21620 | } | 21991 | } |
| 21621 | 21992 | ||
| 21622 | 21993 | ||
| 21623 | //----------------------------------------------------------------------------- | 21994 | //----------------------------------------------------------------------------- |
| 21624 | // name: ModalBar_cget_volume() | 21995 | // name: Saxofony_cget_pressure() |
| 21625 | // desc: CGET function ... | 21996 | // desc: CGET function ... |
| 21626 | //----------------------------------------------------------------------------- | 21997 | //----------------------------------------------------------------------------- |
| 21627 | CK_DLL_CGET( ModalBar_cget_volume ) | 21998 | CK_DLL_CGET( Saxofony_cget_pressure ) |
| 21628 | { | 21999 | { |
| 21629 | ModalBar_ * b = (ModalBar_ *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22000 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21630 | RETURN->v_float = (t_CKFLOAT)b->modalbar.m_volume; | 22001 | RETURN->v_float = (t_CKFLOAT)b->m_pressure; |
| 21631 | } | 22002 | } |
| 21632 | 22003 | ||
| 21633 | 22004 | ||
| 21634 | 22005 | ||
| 21635 | 22006 | ||
| 21636 | // Sitar | 22007 | // StifKarp |
| 21637 | /* | ||
| 21638 | struct Sitar_ { | ||
| 21639 | Sitar * imp; | ||
| 21640 | double m_frequency; | ||
| 21641 | |||
| 21642 | Sitar_ ( double d ) { | ||
| 21643 | imp = new Sitar(d); | ||
| 21644 | m_frequency = 100.0; | ||
| 21645 | } | ||
| 21646 | };*/ | ||
| 21647 | |||
| 21648 | 22008 | ||
| 21649 | //----------------------------------------------------------------------------- | 22009 | //----------------------------------------------------------------------------- |
| 21650 | // name: Sitar_ctor() | 22010 | // name: StifKarp_ctor() |
| 21651 | // desc: CTOR function ... | 22011 | // desc: CTOR function ... |
| 21652 | //----------------------------------------------------------------------------- | 22012 | //----------------------------------------------------------------------------- |
| 21653 | CK_DLL_CTOR( Sitar_ctor ) | 22013 | CK_DLL_CTOR( StifKarp_ctor ) |
| 21654 | { | 22014 | { |
| 21655 | Sitar * sitar = new Sitar( 20 ); | 22015 | // initialize member object |
| 21656 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)sitar; | 22016 | StifKarp * karp = new StifKarp( 20.0 ); |
| 22017 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)karp; | ||
| 21657 | // default | 22018 | // default |
| 21658 | sitar->setFrequency( 220 ); | 22019 | karp->setFrequency( 220.0 ); |
| 21659 | } | 22020 | } |
| 21660 | 22021 | ||
| 21661 | 22022 | ||
| 21662 | //----------------------------------------------------------------------------- | 22023 | //----------------------------------------------------------------------------- |
| 21663 | // name: Sitar_dtor() | 22024 | // name: StifKarp_dtor() |
| 21664 | // desc: DTOR function ... | 22025 | // desc: DTOR function ... |
| 21665 | //----------------------------------------------------------------------------- | 22026 | //----------------------------------------------------------------------------- |
| 21666 | CK_DLL_DTOR( Sitar_dtor ) | 22027 | CK_DLL_DTOR( StifKarp_dtor ) |
| 21667 | { | 22028 | { |
| 21668 | Sitar * s = (Sitar *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22029 | delete (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21669 | SAFE_DELETE(s); | ||
| 21670 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; | 22030 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; |
| 21671 | } | 22031 | } |
| 21672 | 22032 | ||
| 21673 | 22033 | ||
| 21674 | //----------------------------------------------------------------------------- | 22034 | //----------------------------------------------------------------------------- |
| 21675 | // name: Sitar_tick() | 22035 | // name: StifKarp_tick() |
| 21676 | // desc: TICK function ... | 22036 | // desc: TICK function ... |
| 21677 | //----------------------------------------------------------------------------- | 22037 | //----------------------------------------------------------------------------- |
| 21678 | CK_DLL_TICK( Sitar_tick ) | 22038 | CK_DLL_TICK( StifKarp_tick ) |
| 21679 | { | 22039 | { |
| 21680 | Sitar * b = (Sitar *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22040 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21681 | *out = b->tick(); | 22041 | *out = b->tick(); |
| 21682 | return TRUE; | 22042 | return TRUE; |
| 21683 | } | 22043 | } |
| 21684 | 22044 | ||
| 21685 | 22045 | ||
| 21686 | //----------------------------------------------------------------------------- | 22046 | //----------------------------------------------------------------------------- |
| 21687 | // name: Sitar_pmsg() | 22047 | // name: StifKarp_pmsg() |
| 21688 | // desc: PMSG function ... | 22048 | // desc: PMSG function ... |
| 21689 | //----------------------------------------------------------------------------- | 22049 | //----------------------------------------------------------------------------- |
| 21690 | CK_DLL_PMSG( Sitar_pmsg ) | 22050 | CK_DLL_PMSG( StifKarp_pmsg ) |
| 21691 | { | 22051 | { |
| 21692 | return TRUE; | 22052 | return TRUE; |
| 21693 | } | 22053 | } |
| 21694 | 22054 | ||
| 21695 | 22055 | ||
| 21696 | //----------------------------------------------------------------------------- | 22056 | //----------------------------------------------------------------------------- |
| 21697 | // name: Sitar_ctrl_pluck() | 22057 | // name: StifKarp_ctrl_pluck() |
| 21698 | // desc: CTRL function ... | 22058 | // desc: CTRL function ... |
| 21699 | //----------------------------------------------------------------------------- | 22059 | //----------------------------------------------------------------------------- |
| 21700 | CK_DLL_CTRL( Sitar_ctrl_pluck ) | 22060 | CK_DLL_CTRL( StifKarp_ctrl_pluck ) |
| 21701 | { | 22061 | { |
| 21702 | Sitar * b = (Sitar *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22062 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21703 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 22063 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21704 | b->pluck( f ); | 22064 | b->pluck( f ); |
| 21705 | } | 22065 | } |
| 21706 | 22066 | ||
| 21707 | 22067 | ||
| 21708 | //----------------------------------------------------------------------------- | 22068 | //----------------------------------------------------------------------------- |
| 21709 | // name: Sitar_ctrl_clear() | 22069 | // name: StifKarp_ctrl_clear() |
| 21710 | // desc: CTRL function ... | 22070 | // desc: CTRL function ... |
| 21711 | //----------------------------------------------------------------------------- | 22071 | //----------------------------------------------------------------------------- |
| 21712 | CK_DLL_CTRL( Sitar_ctrl_clear ) | 22072 | CK_DLL_CTRL( StifKarp_ctrl_clear ) |
| 21713 | { | 22073 | { |
| 21714 | Sitar * b = (Sitar *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22074 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21715 | b->clear(); | 22075 | b->clear(); |
| 21716 | } | 22076 | } |
| 21717 | 22077 | ||
| 21718 | 22078 | ||
| 21719 | |||
| 21720 | |||
| 21721 | //----------------------------------------------------------------------------- | 22079 | //----------------------------------------------------------------------------- |
| 21722 | // name: Saxofony_ctor() | 22080 | // name: StifKarp_ctrl_pickupPosition() |
| 21723 | // desc: CTOR function ... | 22081 | // desc: CTRL function ... |
| 21724 | //----------------------------------------------------------------------------- | 22082 | //----------------------------------------------------------------------------- |
| 21725 | CK_DLL_CTOR( Saxofony_ctor ) | 22083 | CK_DLL_CTRL( StifKarp_ctrl_pickupPosition ) |
| 21726 | { | 22084 | { |
| 21727 | Saxofony * fony = new Saxofony( 20 ); | 22085 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21728 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)fony; | 22086 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21729 | // default | 22087 | b->setPickupPosition( f ); |
| 21730 | fony->setFrequency( 220 ); | 22088 | RETURN->v_float = (t_CKFLOAT)b->pickupPosition; |
| 21731 | } | 22089 | } |
| 21732 | 22090 | ||
| 21733 | 22091 | ||
| 21734 | //----------------------------------------------------------------------------- | 22092 | //----------------------------------------------------------------------------- |
| 21735 | // name: Saxofony_dtor() | 22093 | // name: StifKarp_cget_pickupPosition() |
| 21736 | // desc: DTOR function ... | 22094 | // desc: CGET function ... |
| 21737 | //----------------------------------------------------------------------------- | 22095 | //----------------------------------------------------------------------------- |
| 21738 | CK_DLL_DTOR( Saxofony_dtor ) | 22096 | CK_DLL_CGET( StifKarp_cget_pickupPosition ) |
| 21739 | { | 22097 | { |
| 21740 | Saxofony * d = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22098 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21741 | SAFE_DELETE(d); | 22099 | RETURN->v_float = (t_CKFLOAT)b->pickupPosition; |
| 21742 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; | ||
| 21743 | } | 22100 | } |
| 21744 | 22101 | ||
| 21745 | 22102 | ||
| 21746 | //----------------------------------------------------------------------------- | 22103 | //----------------------------------------------------------------------------- |
| 21747 | // name: Saxofony_tick() | 22104 | // name: StifKarp_ctrl_stretch() |
| 21748 | // desc: TICK function ... | 22105 | // desc: CTRL function ... |
| 21749 | //----------------------------------------------------------------------------- | 22106 | //----------------------------------------------------------------------------- |
| 21750 | CK_DLL_TICK( Saxofony_tick ) | 22107 | CK_DLL_CTRL( StifKarp_ctrl_stretch ) |
| 21751 | { | 22108 | { |
| 21752 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22109 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21753 | *out = b->tick(); | 22110 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21754 | return TRUE; | 22111 | b->setStretch( f ); |
| 22112 | RETURN->v_float = (t_CKFLOAT)b->stretching; | ||
| 21755 | } | 22113 | } |
| 21756 | 22114 | ||
| 21757 | 22115 | ||
| 21758 | //----------------------------------------------------------------------------- | 22116 | //----------------------------------------------------------------------------- |
| 21759 | // name: Saxofony_pmsg() | 22117 | // name: StifKarp_cget_stretch() |
| 21760 | // desc: PMSG function ... | 22118 | // desc: CGET function ... |
| 21761 | //----------------------------------------------------------------------------- | 22119 | //----------------------------------------------------------------------------- |
| 21762 | CK_DLL_PMSG( Saxofony_pmsg ) | 22120 | CK_DLL_CGET( StifKarp_cget_stretch ) |
| 21763 | { | 22121 | { |
| 21764 | return TRUE; | 22122 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 22123 | RETURN->v_float = (t_CKFLOAT)b->stretching; | ||
| 21765 | } | 22124 | } |
| 21766 | 22125 | ||
| 21767 | 22126 | ||
| 21768 | //----------------------------------------------------------------------------- | 22127 | //----------------------------------------------------------------------------- |
| 21769 | // name: Saxofony_ctrl_startBlowing() | 22128 | // name: StifKarp_ctrl_sustain() |
| 21770 | // desc: CTRL function ... | 22129 | // desc: CTRL function ... |
| 21771 | //----------------------------------------------------------------------------- | 22130 | //----------------------------------------------------------------------------- |
| 21772 | CK_DLL_CTRL( Saxofony_ctrl_startBlowing ) | 22131 | CK_DLL_CTRL( StifKarp_ctrl_sustain ) |
| 21773 | { | 22132 | { |
| 21774 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22133 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21775 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 22134 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 21776 | b->startBlowing( f, b->m_rate ); | 22135 | b->controlChange( __SK_StringDamping_, f * 128 ); |
| 22136 | RETURN->v_float = (t_CKFLOAT)b->m_sustain; | ||
| 21777 | } | 22137 | } |
| 21778 | 22138 | ||
| 21779 | 22139 | ||
| 21780 | //----------------------------------------------------------------------------- | 22140 | //----------------------------------------------------------------------------- |
| 21781 | // name: Saxofony_ctrl_stopBlowing() | 22141 | // name: StifKarp_cget_sustain() |
| 21782 | // desc: CTRL function ... | 22142 | // desc: CGET function ... |
| 21783 | //----------------------------------------------------------------------------- | 22143 | //----------------------------------------------------------------------------- |
| 21784 | CK_DLL_CTRL( Saxofony_ctrl_stopBlowing ) | 22144 | CK_DLL_CGET( StifKarp_cget_sustain ) |
| 21785 | { | 22145 | { |
| 21786 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22146 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21787 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 22147 | RETURN->v_float = (t_CKFLOAT)b->m_sustain; |
| 21788 | b->stopBlowing( f ); | ||
| 21789 | } | 22148 | } |
| 21790 | 22149 | ||
| 21791 | 22150 | ||
| 21792 | //----------------------------------------------------------------------------- | 22151 | //----------------------------------------------------------------------------- |
| 21793 | // name: Saxofony_ctrl_clear() | 22152 | // name: StifKarp_ctrl_baseLoopGain() |
| 21794 | // desc: CTRL function ... | 22153 | // desc: CTRL function ... |
| 21795 | //----------------------------------------------------------------------------- | 22154 | //----------------------------------------------------------------------------- |
| 21796 | CK_DLL_CTRL( Saxofony_ctrl_clear ) | 22155 | CK_DLL_CTRL( StifKarp_ctrl_baseLoopGain ) |
| 21797 | { | 22156 | { |
| 21798 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22157 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21799 | b->clear(); | 22158 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); |
| 22159 | b->setBaseLoopGain( f ); | ||
| 22160 | RETURN->v_float = (t_CKFLOAT)b->baseLoopGain; | ||
| 21800 | } | 22161 | } |
| 21801 | 22162 | ||
| 21802 | 22163 | ||
| 21803 | //----------------------------------------------------------------------------- | 22164 | //----------------------------------------------------------------------------- |
| 21804 | // name: Saxofony_ctrl_rate() | 22165 | // name: StifKarp_cget_baseLoopGain() |
| 21805 | // desc: CTRL function ... | 22166 | // desc: CGET function ... |
| 21806 | //----------------------------------------------------------------------------- | 22167 | //----------------------------------------------------------------------------- |
| 21807 | CK_DLL_CTRL( Saxofony_ctrl_rate ) | 22168 | CK_DLL_CGET( StifKarp_cget_baseLoopGain ) |
| 21808 | { | 22169 | { |
| 21809 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22170 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); |
| 21810 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 22171 | RETURN->v_float = (t_CKFLOAT)b->baseLoopGain; |
| 21811 | b->m_rate = f; | ||
| 21812 | RETURN->v_float = (t_CKFLOAT)b->m_rate; | ||
| 21813 | } | 22172 | } |
| 21814 | 22173 | ||
| 21815 | 22174 | ||
| 22175 | |||
| 22176 | // Delay | ||
| 21816 | //----------------------------------------------------------------------------- | 22177 | //----------------------------------------------------------------------------- |
| 21817 | // name: Saxofony_cget_rate() | 22178 | // name: Delay_ctor() |
| 21818 | // desc: CGET function ... | 22179 | // desc: CTOR function ... |
| 21819 | //----------------------------------------------------------------------------- | 22180 | //----------------------------------------------------------------------------- |
| 21820 | CK_DLL_CGET( Saxofony_cget_rate ) | 22181 | CK_DLL_CTOR( Delay_ctor ) |
| 21821 | { | 22182 | { |
| 21822 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22183 | OBJ_MEMBER_UINT(SELF, Delay_offset_data) = (t_CKUINT)new Delay; |
| 21823 | RETURN->v_float = (t_CKFLOAT)b->m_rate; | ||
| 21824 | } | 22184 | } |
| 21825 | 22185 | ||
| 21826 | 22186 | ||
| 21827 | //----------------------------------------------------------------------------- | 22187 | //----------------------------------------------------------------------------- |
| 21828 | // name: Saxofony_ctrl_blowPosition() | 22188 | // name: Delay_dtor() |
| 21829 | // desc: CTRL function ... | 22189 | // desc: DTOR function ... |
| 21830 | //----------------------------------------------------------------------------- | 22190 | //----------------------------------------------------------------------------- |
| 21831 | CK_DLL_CTRL( Saxofony_ctrl_blowPosition ) | 22191 | CK_DLL_DTOR( Delay_dtor ) |
| 21832 | { | 22192 | { |
| 21833 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22193 | delete (Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); |
| 21834 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 22194 | OBJ_MEMBER_UINT(SELF, Delay_offset_data) = 0; |
| 21835 | b->setBlowPosition(f); | ||
| 21836 | RETURN->v_float = (t_CKFLOAT)b->position; | ||
| 21837 | } | 22195 | } |
| 21838 | 22196 | ||
| 21839 | 22197 | ||
| 21840 | //----------------------------------------------------------------------------- | 22198 | //----------------------------------------------------------------------------- |
| 21841 | // name: Saxofony_cget_blowPosition() | 22199 | // name: Delay_tick() |
| 21842 | // desc: CGET function ... | 22200 | // desc: TICK function ... |
| 21843 | //----------------------------------------------------------------------------- | 22201 | //----------------------------------------------------------------------------- |
| 21844 | CK_DLL_CGET( Saxofony_cget_blowPosition ) | 22202 | CK_DLL_TICK( Delay_tick ) |
| 21845 | { | 22203 | { |
| 21846 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22204 | *out = (SAMPLE)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->tick( in ); |
| 21847 | RETURN->v_float = (t_CKFLOAT)b->position; | 22205 | return TRUE; |
| 21848 | } | 22206 | } |
| 21849 | 22207 | ||
| 21850 | 22208 | ||
| 21851 | //----------------------------------------------------------------------------- | 22209 | //----------------------------------------------------------------------------- |
| 21852 | // name: Saxofony_ctrl_reed() | 22210 | // name: Delay_pmsg() |
| 21853 | // desc: CTRL function ... | 22211 | // desc: PMSG function ... |
| 21854 | //----------------------------------------------------------------------------- | 22212 | //----------------------------------------------------------------------------- |
| 21855 | CK_DLL_CTRL( Saxofony_ctrl_reed ) | 22213 | CK_DLL_PMSG( Delay_pmsg ) |
| 21856 | { | 22214 | { |
| 21857 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22215 | return FALSE; |
| 21858 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 21859 | b->controlChange( 2, f * 128 ); | ||
| 21860 | RETURN->v_float = (t_CKFLOAT)b->m_stiffness; | ||
| 21861 | } | 22216 | } |
| 21862 | 22217 | ||
| 21863 | 22218 | ||
| 21864 | //----------------------------------------------------------------------------- | 22219 | //----------------------------------------------------------------------------- |
| 21865 | // name: Saxofony_cget_reed() | 22220 | // name: Delay_ctrl_delay() |
| 21866 | // desc: CGET function ... | 22221 | // desc: CTRL function ... |
| 21867 | //----------------------------------------------------------------------------- | 22222 | //----------------------------------------------------------------------------- |
| 21868 | CK_DLL_CGET( Saxofony_cget_reed ) | 22223 | CK_DLL_CTRL( Delay_ctrl_delay ) |
| 21869 | { | 22224 | { |
| 21870 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22225 | ((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->setDelay( (long)(GET_NEXT_DUR(ARGS)+.5) ); |
| 21871 | RETURN->v_float = (t_CKFLOAT)b->m_stiffness; | 22226 | RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->getDelay(); |
| 21872 | } | 22227 | } |
| 21873 | 22228 | ||
| 21874 | 22229 | ||
| 21875 | //----------------------------------------------------------------------------- | 22230 | //----------------------------------------------------------------------------- |
| 21876 | // name: Saxofony_ctrl_aperture() | 22231 | // name: Delay_cget_delay() |
| 21877 | // desc: CTRL function ... | 22232 | // desc: CGET function ... |
| 21878 | //----------------------------------------------------------------------------- | 22233 | //----------------------------------------------------------------------------- |
| 21879 | CK_DLL_CTRL( Saxofony_ctrl_aperture ) | 22234 | CK_DLL_CGET( Delay_cget_delay ) |
| 21880 | { | 22235 | { |
| 21881 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22236 | RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->getDelay(); |
| 21882 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 21883 | b->controlChange( 26, f * 128 ); | ||
| 21884 | RETURN->v_float = (t_CKFLOAT)b->m_aperture; | ||
| 21885 | } | 22237 | } |
| 21886 | 22238 | ||
| 21887 | 22239 | ||
| 21888 | //----------------------------------------------------------------------------- | 22240 | //----------------------------------------------------------------------------- |
| 21889 | // name: Saxofony_cget_aperture() | 22241 | // name: Delay_ctrl_max() |
| 21890 | // desc: CGET function ... | 22242 | // desc: CTRL function ... |
| 21891 | //----------------------------------------------------------------------------- | 22243 | //----------------------------------------------------------------------------- |
| 21892 | CK_DLL_CGET( Saxofony_cget_aperture ) | 22244 | CK_DLL_CTRL( Delay_ctrl_max ) |
| 21893 | { | 22245 | { |
| 21894 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22246 | Delay * delay = (Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); |
| 21895 | RETURN->v_float = (t_CKFLOAT)b->m_aperture; | 22247 | t_CKFLOAT val = (t_CKFLOAT)delay->getDelay(); |
| 22248 | t_CKDUR max = GET_NEXT_DUR(ARGS); | ||
| 22249 | delay->set( (long)(val+.5), (long)(max+1.5) ); | ||
| 22250 | RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->length-1.0; | ||
| 21896 | } | 22251 | } |
| 21897 | 22252 | ||
| 21898 | 22253 | ||
| 21899 | //----------------------------------------------------------------------------- | 22254 | //----------------------------------------------------------------------------- |
| 21900 | // name: Saxofony_ctrl_noiseGain() | 22255 | // name: Delay_cget_max() |
| 21901 | // desc: CTRL function ... | 22256 | // desc: CGET function ... |
| 21902 | //----------------------------------------------------------------------------- | 22257 | //----------------------------------------------------------------------------- |
| 21903 | CK_DLL_CTRL( Saxofony_ctrl_noiseGain ) | 22258 | CK_DLL_CGET( Delay_cget_max ) |
| 21904 | { | 22259 | { |
| 21905 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22260 | RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->length-1.0; |
| 21906 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 21907 | b->controlChange( 4, f * 128 ); | ||
| 21908 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; | ||
| 21909 | } | 22261 | } |
| 21910 | 22262 | ||
| 21911 | 22263 | ||
| 21912 | //----------------------------------------------------------------------------- | 22264 | //----------------------------------------------------------------------------- |
| 21913 | // name: Saxofony_cget_noiseGain() | 22265 | // name: Delay_clear() |
| 21914 | // desc: CGET function ... | 22266 | // desc: CGET function ... |
| 21915 | //----------------------------------------------------------------------------- | 22267 | //----------------------------------------------------------------------------- |
| 21916 | CK_DLL_CGET( Saxofony_cget_noiseGain ) | 22268 | CK_DLL_CGET( Delay_clear ) |
| 21917 | { | 22269 | { |
| 21918 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22270 | Delay * delay = (Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); |
| 21919 | RETURN->v_float = (t_CKFLOAT)b->m_noiseGain; | 22271 | delay->clear(); |
| 21920 | } | 22272 | } |
| 21921 | 22273 | ||
| 21922 | 22274 | ||
| 22275 | |||
| 22276 | |||
| 22277 | // DelayA | ||
| 21923 | //----------------------------------------------------------------------------- | 22278 | //----------------------------------------------------------------------------- |
| 21924 | // name: Saxofony_ctrl_vibratoFreq() | 22279 | // name: DelayA_ctor() |
| 21925 | // desc: CTRL function ... | 22280 | // desc: CTOR function ... |
| 21926 | //----------------------------------------------------------------------------- | 22281 | //----------------------------------------------------------------------------- |
| 21927 | CK_DLL_CTRL( Saxofony_ctrl_vibratoFreq ) | 22282 | CK_DLL_CTOR( DelayA_ctor ) |
| 21928 | { | 22283 | { |
| 21929 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22284 | OBJ_MEMBER_UINT(SELF, DelayA_offset_data) = (t_CKUINT)new DelayA; |
| 21930 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 21931 | b->vibrato->setFrequency( f ); | ||
| 21932 | RETURN->v_float = (t_CKFLOAT)b->vibrato->m_freq; | ||
| 21933 | } | 22285 | } |
| 21934 | 22286 | ||
| 21935 | 22287 | ||
| 21936 | //----------------------------------------------------------------------------- | 22288 | //----------------------------------------------------------------------------- |
| 21937 | // name: Saxofony_cget_vibratoFreq() | 22289 | // name: DelayA_dtor() |
| 21938 | // desc: CGET function ... | 22290 | // desc: DTOR function ... |
| 21939 | //----------------------------------------------------------------------------- | 22291 | //----------------------------------------------------------------------------- |
| 21940 | CK_DLL_CGET( Saxofony_cget_vibratoFreq ) | 22292 | CK_DLL_DTOR( DelayA_dtor ) |
| 21941 | { | 22293 | { |
| 21942 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22294 | delete (DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data); |
| 21943 | RETURN->v_float = (t_CKFLOAT)b->vibrato->m_freq; | 22295 | OBJ_MEMBER_UINT(SELF, DelayA_offset_data) = 0; |
| 21944 | } | 22296 | } |
| 21945 | 22297 | ||
| 21946 | 22298 | ||
| 21947 | //----------------------------------------------------------------------------- | 22299 | //----------------------------------------------------------------------------- |
| 21948 | // name: Saxofony_ctrl_vibratoGain() | 22300 | // name: DelayA_tick() |
| 21949 | // desc: CTRL function ... | 22301 | // desc: TICK function ... |
| 21950 | //----------------------------------------------------------------------------- | 22302 | //----------------------------------------------------------------------------- |
| 21951 | CK_DLL_CTRL( Saxofony_ctrl_vibratoGain ) | 22303 | CK_DLL_TICK( DelayA_tick ) |
| 21952 | { | 22304 | { |
| 21953 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22305 | *out = (SAMPLE)((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->tick( in ); |
| 21954 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 22306 | return TRUE; |
| 21955 | b->controlChange( 1, f * 128 ); | ||
| 21956 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; | ||
| 21957 | } | 22307 | } |
| 21958 | 22308 | ||
| 21959 | 22309 | ||
| 21960 | //----------------------------------------------------------------------------- | 22310 | //----------------------------------------------------------------------------- |
| 21961 | // name: Saxofony_cget_vibratoGain() | 22311 | // name: DelayA_pmsg() |
| 21962 | // desc: CGET function ... | 22312 | // desc: PMSG function ... |
| 21963 | //----------------------------------------------------------------------------- | 22313 | //----------------------------------------------------------------------------- |
| 21964 | CK_DLL_CGET( Saxofony_cget_vibratoGain ) | 22314 | CK_DLL_PMSG( DelayA_pmsg ) |
| 21965 | { | 22315 | { |
| 21966 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22316 | return FALSE; |
| 21967 | RETURN->v_float = (t_CKFLOAT)b->m_vibratoGain; | ||
| 21968 | } | 22317 | } |
| 21969 | 22318 | ||
| 21970 | 22319 | ||
| 21971 | //----------------------------------------------------------------------------- | 22320 | //----------------------------------------------------------------------------- |
| 21972 | // name: Saxofony_ctrl_pressure() | 22321 | // name: DelayA_ctrl_delay() |
| 21973 | // desc: CTRL function ... | 22322 | // desc: CTRL function ... |
| 21974 | //----------------------------------------------------------------------------- | 22323 | //----------------------------------------------------------------------------- |
| 21975 | CK_DLL_CTRL( Saxofony_ctrl_pressure ) | 22324 | CK_DLL_CTRL( DelayA_ctrl_delay ) |
| 21976 | { | 22325 | { |
| 21977 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22326 | ((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->setDelay( GET_NEXT_DUR(ARGS) ); |
| 21978 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 22327 | RETURN->v_dur = (t_CKDUR)((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->getDelay(); |
| 21979 | b->controlChange( 128, f * 128 ); | ||
| 21980 | RETURN->v_float = (t_CKFLOAT)b->m_pressure; | ||
| 21981 | } | 22328 | } |
| 21982 | 22329 | ||
| 21983 | 22330 | ||
| 21984 | //----------------------------------------------------------------------------- | 22331 | //----------------------------------------------------------------------------- |
| 21985 | // name: Saxofony_cget_pressure() | 22332 | // name: DelayA_cget_delay() |
| 21986 | // desc: CGET function ... | 22333 | // desc: CGET function ... |
| 21987 | //----------------------------------------------------------------------------- | 22334 | //----------------------------------------------------------------------------- |
| 21988 | CK_DLL_CGET( Saxofony_cget_pressure ) | 22335 | CK_DLL_CGET( DelayA_cget_delay ) |
| 21989 | { | 22336 | { |
| 21990 | Saxofony * b = (Saxofony *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22337 | RETURN->v_dur = (t_CKDUR)((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->getDelay(); |
| 21991 | RETURN->v_float = (t_CKFLOAT)b->m_pressure; | ||
| 21992 | } | 22338 | } |
| 21993 | 22339 | ||
| 21994 | 22340 | ||
| 21995 | |||
| 21996 | |||
| 21997 | // StifKarp | ||
| 21998 | |||
| 21999 | //----------------------------------------------------------------------------- | 22341 | //----------------------------------------------------------------------------- |
| 22000 | // name: StifKarp_ctor() | 22342 | // name: DelayA_ctrl_max() |
| 22001 | // desc: CTOR function ... | 22343 | // desc: CTRL function ... |
| 22002 | //----------------------------------------------------------------------------- | 22344 | //----------------------------------------------------------------------------- |
| 22003 | CK_DLL_CTOR( StifKarp_ctor ) | 22345 | CK_DLL_CTRL( DelayA_ctrl_max ) |
| 22004 | { | 22346 | { |
| 22005 | // initialize member object | 22347 | DelayA * delay = (DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data); |
| 22006 | StifKarp * karp = new StifKarp( 20.0 ); | 22348 | t_CKDUR val = (t_CKDUR)delay->getDelay(); |
| 22007 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = (t_CKUINT)karp; | 22349 | t_CKDUR max = GET_NEXT_DUR(ARGS); |
| 22008 | // default | 22350 | delay->set( val, (long)(max+1.5) ); |
| 22009 | karp->setFrequency( 220.0 ); | 22351 | RETURN->v_dur = (t_CKDUR)((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->length-1.0; |
| 22010 | } | 22352 | } |
| 22011 | 22353 | ||
| 22012 | 22354 | ||
| 22013 | //----------------------------------------------------------------------------- | 22355 | //----------------------------------------------------------------------------- |
| 22014 | // name: StifKarp_dtor() | 22356 | // name: DelayA_cget_max() |
| 22015 | // desc: DTOR function ... | 22357 | // desc: CGET function ... |
| 22016 | //----------------------------------------------------------------------------- | 22358 | //----------------------------------------------------------------------------- |
| 22017 | CK_DLL_DTOR( StifKarp_dtor ) | 22359 | CK_DLL_CGET( DelayA_cget_max ) |
| 22018 | { | 22360 | { |
| 22019 | delete (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22361 | RETURN->v_dur = (t_CKDUR)((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->length-1.0; |
| 22020 | OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data) = 0; | ||
| 22021 | } | 22362 | } |
| 22022 | 22363 | ||
| 22023 | 22364 | ||
| 22024 | //----------------------------------------------------------------------------- | 22365 | //----------------------------------------------------------------------------- |
| 22025 | // name: StifKarp_tick() | 22366 | // name: DelayA_clear() |
| 22026 | // desc: TICK function ... | 22367 | // desc: CGET function ... |
| 22027 | //----------------------------------------------------------------------------- | 22368 | //----------------------------------------------------------------------------- |
| 22028 | CK_DLL_TICK( StifKarp_tick ) | 22369 | CK_DLL_CGET( DelayA_clear ) |
| 22029 | { | 22370 | { |
| 22030 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22371 | DelayA * delay = (DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data); |
| 22031 | *out = b->tick(); | 22372 | delay->clear(); |
| 22032 | return TRUE; | ||
| 22033 | } | 22373 | } |
| 22034 | 22374 | ||
| 22035 | 22375 | ||
| 22036 | //----------------------------------------------------------------------------- | ||
| 22037 | // name: StifKarp_pmsg() | ||
| 22038 | // desc: PMSG function ... | ||
| 22039 | //----------------------------------------------------------------------------- | ||
| 22040 | CK_DLL_PMSG( StifKarp_pmsg ) | ||
| 22041 | { | ||
| 22042 | return TRUE; | ||
| 22043 | } | ||
| 22044 | 22376 | ||
| 22045 | 22377 | ||
| 22378 | // DelayL | ||
| 22046 | //----------------------------------------------------------------------------- | 22379 | //----------------------------------------------------------------------------- |
| 22047 | // name: StifKarp_ctrl_pluck() | 22380 | // name: DelayL_ctor() |
| 22048 | // desc: CTRL function ... | 22381 | // desc: CTOR function ... |
| 22049 | //----------------------------------------------------------------------------- | 22382 | //----------------------------------------------------------------------------- |
| 22050 | CK_DLL_CTRL( StifKarp_ctrl_pluck ) | 22383 | CK_DLL_CTOR( DelayL_ctor ) |
| 22051 | { | 22384 | { |
| 22052 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22385 | OBJ_MEMBER_UINT(SELF, DelayL_offset_data) = (t_CKUINT)new DelayL; |
| 22053 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 22054 | b->pluck( f ); | ||
| 22055 | } | 22386 | } |
| 22056 | 22387 | ||
| 22057 | 22388 | ||
| 22058 | //----------------------------------------------------------------------------- | 22389 | //----------------------------------------------------------------------------- |
| 22059 | // name: StifKarp_ctrl_clear() | 22390 | // name: DelayL_dtor() |
| 22060 | // desc: CTRL function ... | 22391 | // desc: DTOR function ... |
| 22061 | //----------------------------------------------------------------------------- | 22392 | //----------------------------------------------------------------------------- |
| 22062 | CK_DLL_CTRL( StifKarp_ctrl_clear ) | 22393 | CK_DLL_DTOR( DelayL_dtor ) |
| 22063 | { | 22394 | { |
| 22064 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22395 | delete (DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data); |
| 22065 | b->clear(); | 22396 | OBJ_MEMBER_UINT(SELF, DelayL_offset_data) = 0; |
| 22066 | } | 22397 | } |
| 22067 | 22398 | ||
| 22068 | 22399 | ||
| 22069 | //----------------------------------------------------------------------------- | 22400 | //----------------------------------------------------------------------------- |
| 22070 | // name: StifKarp_ctrl_pickupPosition() | 22401 | // name: DelayL_tick() |
| 22071 | // desc: CTRL function ... | 22402 | // desc: TICK function ... |
| 22072 | //----------------------------------------------------------------------------- | 22403 | //----------------------------------------------------------------------------- |
| 22073 | CK_DLL_CTRL( StifKarp_ctrl_pickupPosition ) | 22404 | CK_DLL_TICK( DelayL_tick ) |
| 22074 | { | 22405 | { |
| 22075 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22406 | *out = (SAMPLE)((DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data))->tick( in ); |
| 22076 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 22407 | return TRUE; |
| 22077 | b->setPickupPosition( f ); | ||
| 22078 | RETURN->v_float = (t_CKFLOAT)b->pickupPosition; | ||
| 22079 | } | 22408 | } |
| 22080 | 22409 | ||
| 22081 | 22410 | ||
| 22082 | //----------------------------------------------------------------------------- | 22411 | //----------------------------------------------------------------------------- |
| 22083 | // name: StifKarp_cget_pickupPosition() | 22412 | // name: DelayL_pmsg() |
| 22084 | // desc: CGET function ... | 22413 | // desc: PMSG function ... |
| 22085 | //----------------------------------------------------------------------------- | 22414 | //----------------------------------------------------------------------------- |
| 22086 | CK_DLL_CGET( StifKarp_cget_pickupPosition ) | 22415 | CK_DLL_PMSG( DelayL_pmsg ) |
| 22087 | { | 22416 | { |
| 22088 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22417 | return FALSE; |
| 22089 | RETURN->v_float = (t_CKFLOAT)b->pickupPosition; | ||
| 22090 | } | 22418 | } |
| 22091 | 22419 | ||
| 22092 | 22420 | ||
| 22093 | //----------------------------------------------------------------------------- | 22421 | //----------------------------------------------------------------------------- |
| 22094 | // name: StifKarp_ctrl_stretch() | 22422 | // name: DelayL_ctrl_delay() |
| 22095 | // desc: CTRL function ... | 22423 | // desc: CTRL function ... |
| 22096 | //----------------------------------------------------------------------------- | 22424 | //----------------------------------------------------------------------------- |
| 22097 | CK_DLL_CTRL( StifKarp_ctrl_stretch ) | 22425 | CK_DLL_CTRL( DelayL_ctrl_delay ) |
| 22098 | { | 22426 | { |
| 22099 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22427 | ((DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data))->setDelay( GET_NEXT_DUR(ARGS) ); |
| 22100 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 22428 | RETURN->v_dur = (t_CKDUR)((DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data))->getDelay(); |
| 22101 | b->setStretch( f ); | ||
| 22102 | RETURN->v_float = (t_CKFLOAT)b->stretching; | ||
| 22103 | } | 22429 | } |
| 22104 | 22430 | ||
| 22105 | 22431 | ||
| 22106 | //----------------------------------------------------------------------------- | 22432 | //----------------------------------------------------------------------------- |
| 22107 | // name: StifKarp_cget_stretch() | 22433 | // name: DelayL_cget_delay() |
| 22108 | // desc: CGET function ... | 22434 | // desc: CGET function ... |
| 22109 | //----------------------------------------------------------------------------- | 22435 | //----------------------------------------------------------------------------- |
| 22110 | CK_DLL_CGET( StifKarp_cget_stretch ) | 22436 | CK_DLL_CGET( DelayL_cget_delay ) |
| 22111 | { | 22437 | { |
| 22112 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22438 | RETURN->v_dur = (t_CKDUR)((DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data))->getDelay(); |
| 22113 | RETURN->v_float = (t_CKFLOAT)b->stretching; | ||
| 22114 | } | 22439 | } |
| 22115 | 22440 | ||
| 22116 | 22441 | ||
| 22117 | //----------------------------------------------------------------------------- | 22442 | //----------------------------------------------------------------------------- |
| 22118 | // name: StifKarp_ctrl_sustain() | 22443 | // name: DelayL_ctrl_max() |
| 22119 | // desc: CTRL function ... | 22444 | // desc: CTRL function ... |
| 22120 | //----------------------------------------------------------------------------- | 22445 | //----------------------------------------------------------------------------- |
| 22121 | CK_DLL_CTRL( StifKarp_ctrl_sustain ) | 22446 | CK_DLL_CTRL( DelayL_ctrl_max ) |
| 22122 | { | 22447 | { |
| 22123 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22448 | DelayL * delay = (DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data); |
| 22124 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | 22449 | t_CKDUR val = (t_CKDUR)delay->getDelay(); |
| 22125 | b->controlChange( __SK_StringDamping_, f * 128 ); | 22450 | t_CKDUR max = GET_NEXT_DUR(ARGS); |
| 22126 | RETURN->v_float = (t_CKFLOAT)b->m_sustain; | 22451 | delay->set( val, (long)(max+1.5) ); |
| 22452 | RETURN->v_dur = (t_CKDUR)delay->length-1.0; | ||
| 22127 | } | 22453 | } |
| 22128 | 22454 | ||
| 22129 | 22455 | ||
| 22130 | //----------------------------------------------------------------------------- | 22456 | //----------------------------------------------------------------------------- |
| 22131 | // name: StifKarp_cget_sustain() | 22457 | // name: DelayL_cget_max() |
| 22132 | // desc: CGET function ... | 22458 | // desc: CGET function ... |
| 22133 | //----------------------------------------------------------------------------- | 22459 | //----------------------------------------------------------------------------- |
| 22134 | CK_DLL_CGET( StifKarp_cget_sustain ) | 22460 | CK_DLL_CGET( DelayL_cget_max ) |
| 22135 | { | ||
| 22136 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | ||
| 22137 | RETURN->v_float = (t_CKFLOAT)b->m_sustain; | ||
| 22138 | } | ||
| 22139 | |||
| 22140 | |||
| 22141 | //----------------------------------------------------------------------------- | ||
| 22142 | // name: StifKarp_ctrl_baseLoopGain() | ||
| 22143 | // desc: CTRL function ... | ||
| 22144 | //----------------------------------------------------------------------------- | ||
| 22145 | CK_DLL_CTRL( StifKarp_ctrl_baseLoopGain ) | ||
| 22146 | { | 22461 | { |
| 22147 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22462 | RETURN->v_dur = (t_CKDUR)((DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data))->length-1.0; |
| 22148 | t_CKFLOAT f = GET_NEXT_FLOAT(ARGS); | ||
| 22149 | b->setBaseLoopGain( f ); | ||
| 22150 | RETURN->v_float = (t_CKFLOAT)b->baseLoopGain; | ||
| 22151 | } | 22463 | } |
| 22152 | 22464 | ||
| 22153 | 22465 | ||
| 22154 | //----------------------------------------------------------------------------- | 22466 | //----------------------------------------------------------------------------- |
| 22155 | // name: StifKarp_cget_baseLoopGain() | 22467 | // name: DelayL_clear() |
| 22156 | // desc: CGET function ... | 22468 | // desc: CGET function ... |
| 22157 | //----------------------------------------------------------------------------- | 22469 | //----------------------------------------------------------------------------- |
| 22158 | CK_DLL_CGET( StifKarp_cget_baseLoopGain ) | 22470 | CK_DLL_CGET( DelayL_clear ) |
| 22159 | { | 22471 | { |
| 22160 | StifKarp * b = (StifKarp *)OBJ_MEMBER_UINT(SELF, Instrmnt_offset_data); | 22472 | DelayL * delay = (DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data); |
| 22161 | RETURN->v_float = (t_CKFLOAT)b->baseLoopGain; | 22473 | delay->clear(); |
| 22162 | } | 22474 | } |
| 22163 | 22475 | ||
| 22164 | 22476 | ||
| 22165 | 22477 | ||
| 22166 | // Delay | 22478 | |
| 22479 | // Echo | ||
| 22167 | //----------------------------------------------------------------------------- | 22480 | //----------------------------------------------------------------------------- |
| 22168 | // name: Delay_ctor() | 22481 | // name: Echo_ctor() |
| 22169 | // desc: CTOR function ... | 22482 | // desc: CTOR function ... |
| 22170 | //----------------------------------------------------------------------------- | 22483 | //----------------------------------------------------------------------------- |
| 22171 | CK_DLL_CTOR( Delay_ctor ) | 22484 | CK_DLL_CTOR( Echo_ctor ) |
| 22172 | { | 22485 | { |
| 22173 | OBJ_MEMBER_UINT(SELF, Delay_offset_data) = (t_CKUINT)new Delay; | 22486 | // initialize member object |
| 22487 | OBJ_MEMBER_UINT(SELF, Echo_offset_data) = (t_CKUINT)new Echo( Stk::sampleRate() / 2.0 ); | ||
| 22174 | } | 22488 | } |
| 22175 | 22489 | ||
| 22176 | 22490 | ||
| 22177 | //----------------------------------------------------------------------------- | 22491 | //----------------------------------------------------------------------------- |
| 22178 | // name: Delay_dtor() | 22492 | // name: Echo_dtor() |
| 22179 | // desc: DTOR function ... | 22493 | // desc: DTOR function ... |
| 22180 | //----------------------------------------------------------------------------- | 22494 | //----------------------------------------------------------------------------- |
| 22181 | CK_DLL_DTOR( Delay_dtor ) | 22495 | CK_DLL_DTOR( Echo_dtor ) |
| 22182 | { | 22496 | { |
| 22183 | delete (Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); | 22497 | delete (Echo *)OBJ_MEMBER_UINT(SELF, Echo_offset_data); |
| 22184 | OBJ_MEMBER_UINT(SELF, Delay_offset_data) = 0; | 22498 | OBJ_MEMBER_UINT(SELF, Echo_offset_data) = 0; |
| 22185 | } | 22499 | } |
| 22186 | 22500 | ||
| 22187 | 22501 | ||
| 22188 | //----------------------------------------------------------------------------- | 22502 | //----------------------------------------------------------------------------- |
| 22189 | // name: Delay_tick() | 22503 | // name: Echo_tick() |
| 22190 | // desc: TICK function ... | 22504 | // desc: TICK function ... |
| 22191 | //----------------------------------------------------------------------------- | 22505 | //----------------------------------------------------------------------------- |
| 22192 | CK_DLL_TICK( Delay_tick ) | 22506 | CK_DLL_TICK( Echo_tick ) |
| 22193 | { | 22507 | { |
| 22194 | *out = (SAMPLE)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->tick( in ); | 22508 | *out = (SAMPLE)((Echo *)OBJ_MEMBER_UINT(SELF, Echo_offset_data))->tick( in ); |
| 22195 | return TRUE; | 22509 | return TRUE; |
| 22196 | } | 22510 | } |
| 22197 | 22511 | ||
| 22198 | 22512 | ||
| 22199 | //----------------------------------------------------------------------------- | 22513 | //----------------------------------------------------------------------------- |
| 22200 | // name: Delay_pmsg() | 22514 | // name: Echo_pmsg() |
| 22201 | // desc: PMSG function ... | 22515 | // desc: PMSG function ... |
| 22202 | //----------------------------------------------------------------------------- | 22516 | //----------------------------------------------------------------------------- |
| 22203 | CK_DLL_PMSG( Delay_pmsg ) | 22517 | CK_DLL_PMSG( Echo_pmsg ) |
| 22204 | { | 22518 | { |
| 22205 | return FALSE; | 22519 | return FALSE; |
| 22206 | } | 22520 | } |
| 22207 | 22521 | ||
| 22208 | 22522 | ||
| 22209 | //----------------------------------------------------------------------------- | 22523 | //----------------------------------------------------------------------------- |
| 22210 | // name: Delay_ctrl_delay() | 22524 | // name: Echo_ctrl_delay() |
| 22211 | // desc: CTRL function ... | 22525 | // desc: CTRL function ... |
| 22212 | //----------------------------------------------------------------------------- | 22526 | //----------------------------------------------------------------------------- |
| 22213 | CK_DLL_CTRL( Delay_ctrl_delay ) | 22527 | CK_DLL_CTRL( Echo_ctrl_delay ) |
| 22214 | { | 22528 | { |
| 22215 | ((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->setDelay( (long)(GET_NEXT_DUR(ARGS)+.5) ); | 22529 | ((Echo *)OBJ_MEMBER_UINT(SELF, Echo_offset_data))->setDelay( GET_NEXT_DUR(ARGS) ); |
| 22216 | RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->getDelay(); | 22530 | RETURN->v_dur = (t_CKDUR)((Echo *)OBJ_MEMBER_UINT(SELF, Echo_offset_data))->getDelay(); |
| 22217 | } | 22531 | } |
| 22218 | 22532 | ||
| 22219 | 22533 | ||
| 22220 | //----------------------------------------------------------------------------- | 22534 | //----------------------------------------------------------------------------- |
| 22221 | // name: Delay_cget_delay() | 22535 | // name: Echo_cget_delay() |
| 22222 | // desc: CGET function ... | 22536 | // desc: CGET function ... |
| 22223 | //----------------------------------------------------------------------------- | 22537 | //----------------------------------------------------------------------------- |
| 22224 | CK_DLL_CGET( Delay_cget_delay ) | 22538 | CK_DLL_CGET( Echo_cget_delay ) |
| 22225 | { | 22539 | { |
| 22226 | RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->getDelay(); | 22540 | RETURN->v_dur = (t_CKDUR)((Echo *)OBJ_MEMBER_UINT(SELF, Echo_offset_data))->getDelay(); |
| 22227 | } | 22541 | } |
| 22228 | 22542 | ||
| 22229 | 22543 | ||
| 22230 | //----------------------------------------------------------------------------- | 22544 | //----------------------------------------------------------------------------- |
| 22231 | // name: Delay_ctrl_max() | 22545 | // name: Echo_ctrl_max() |
| 22232 | // desc: CTRL function ... | 22546 | // desc: CTRL function ... |
| 22233 | //----------------------------------------------------------------------------- | 22547 | //----------------------------------------------------------------------------- |
| 22234 | CK_DLL_CTRL( Delay_ctrl_max ) | 22548 | CK_DLL_CTRL( Echo_ctrl_max ) |
| 22235 | { | 22549 | { |
| 22236 | Delay * delay = (Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); | 22550 | ((Echo *)OBJ_MEMBER_UINT(SELF, Echo_offset_data))->set( GET_NEXT_DUR(ARGS) ); |
| 22237 | t_CKFLOAT val = (t_CKFLOAT)delay->getDelay(); | 22551 | RETURN->v_dur = (t_CKDUR)((Echo *)OBJ_MEMBER_UINT(SELF, Echo_offset_data))->length; |
| 22238 | t_CKDUR max = GET_NEXT_DUR(ARGS); | ||
| 22239 | delay->set( (long)(val+.5), (long)(max+1.5) ); | ||
| 22240 | RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->length-1.0; | ||
| 22241 | } | 22552 | } |
| 22242 | 22553 | ||
| 22243 | 22554 | ||
| 22244 | //----------------------------------------------------------------------------- | 22555 | //----------------------------------------------------------------------------- |
| 22245 | // name: Delay_cget_max() | 22556 | // name: Echo_cget_max() |
| 22246 | // desc: CGET function ... | 22557 | // desc: CGET function ... |
| 22247 | //----------------------------------------------------------------------------- | 22558 | //----------------------------------------------------------------------------- |
| 22248 | CK_DLL_CGET( Delay_cget_max ) | 22559 | CK_DLL_CGET( Echo_cget_max ) |
| 22249 | { | 22560 | { |
| 22250 | RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->length-1.0; | 22561 | RETURN->v_dur = (t_CKDUR)((Echo *)OBJ_MEMBER_UINT(SELF, Echo_offset_data))->length; |
| 22251 | } | 22562 | } |
| 22252 | 22563 | ||
| 22253 | 22564 | ||
| 22254 | //----------------------------------------------------------------------------- | 22565 | //----------------------------------------------------------------------------- |
| 22255 | // name: Delay_clear() | 22566 | // name: Echo_ctrl_mix() |
| 22256 | // desc: CGET function ... | 22567 | // desc: CTRL function ... |
| 22257 | //----------------------------------------------------------------------------- | 22568 | //----------------------------------------------------------------------------- |
| 22258 | CK_DLL_CGET( Delay_clear ) | 22569 | CK_DLL_CTRL( Echo_ctrl_mix ) |
| 22259 | { | 22570 | { |
| 22260 | Delay * delay = (Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); | 22571 | ((Echo *)OBJ_MEMBER_UINT(SELF, Echo_offset_data))->setEffectMix( GET_NEXT_FLOAT(ARGS) ); |
| 22261 | delay->clear(); | 22572 | RETURN->v_float = (t_CKFLOAT)((Echo *)OBJ_MEMBER_UINT(SELF, Echo_offset_data))->effectMix; |
| 22262 | } | 22573 | } |
| 22263 | 22574 | ||
| 22264 | 22575 | ||
| 22576 | //----------------------------------------------------------------------------- | ||
| 22577 | // name: Echo_cget_mix() | ||
| 22578 | // desc: CGET function ... | ||
| 22579 | //----------------------------------------------------------------------------- | ||
| 22580 | CK_DLL_CGET( Echo_cget_mix ) | ||
| 22581 | { | ||
| 22582 | RETURN->v_float = (t_CKFLOAT)((Echo *)OBJ_MEMBER_UINT(SELF, Echo_offset_data))->effectMix; | ||
| 22583 | } | ||
| 22265 | 22584 | ||
| 22266 | 22585 | ||
| 22267 | // DelayA | ||
| 22268 | //----------------------------------------------------------------------------- | 22586 | //----------------------------------------------------------------------------- |
| 22269 | // name: DelayA_ctor() | 22587 | // name: Envelope - import |
| 22588 | // desc: .. | ||
| 22589 | //----------------------------------------------------------------------------- | ||
| 22590 | //----------------------------------------------------------------------------- | ||
| 22591 | // name: Envelope_ctor() | ||
| 22270 | // desc: CTOR function ... | 22592 | // desc: CTOR function ... |
| 22271 | //----------------------------------------------------------------------------- | 22593 | //----------------------------------------------------------------------------- |
| 22272 | CK_DLL_CTOR( DelayA_ctor ) | 22594 | CK_DLL_CTOR( Envelope_ctor ) |
| 22273 | { | 22595 | { |
| 22274 | OBJ_MEMBER_UINT(SELF, DelayA_offset_data) = (t_CKUINT)new DelayA; | 22596 | OBJ_MEMBER_UINT(SELF, Envelope_offset_data) = (t_CKUINT)new Envelope; |
| 22275 | } | 22597 | } |
| 22276 | 22598 | ||
| 22277 | 22599 | ||
| 22278 | //----------------------------------------------------------------------------- | 22600 | //----------------------------------------------------------------------------- |
| 22279 | // name: DelayA_dtor() | 22601 | // name: Envelope_dtor() |
| 22280 | // desc: DTOR function ... | 22602 | // desc: DTOR function ... |
| 22281 | //----------------------------------------------------------------------------- | 22603 | //----------------------------------------------------------------------------- |
| 22282 | CK_DLL_DTOR( DelayA_dtor ) | 22604 | CK_DLL_DTOR( Envelope_dtor ) |
| 22283 | { | 22605 | { |
| 22284 | delete (DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data); | 22606 | delete (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22285 | OBJ_MEMBER_UINT(SELF, DelayA_offset_data) = 0; | 22607 | OBJ_MEMBER_UINT(SELF, Envelope_offset_data) = 0; |
| 22286 | } | 22608 | } |
| 22287 | 22609 | ||
| 22288 | 22610 | ||
| 22289 | //----------------------------------------------------------------------------- | 22611 | //----------------------------------------------------------------------------- |
| 22290 | // name: DelayA_tick() | 22612 | // name: Envelope_tick() |
| 22291 | // desc: TICK function ... | 22613 | // desc: TICK function ... |
| 22292 | //----------------------------------------------------------------------------- | 22614 | //----------------------------------------------------------------------------- |
| 22293 | CK_DLL_TICK( DelayA_tick ) | 22615 | CK_DLL_TICK( Envelope_tick ) |
| 22294 | { | 22616 | { |
| 22295 | *out = (SAMPLE)((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->tick( in ); | 22617 | Envelope * d = (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22618 | *out = in * d->tick(); | ||
| 22296 | return TRUE; | 22619 | return TRUE; |
| 22297 | } | 22620 | } |
| 22298 | 22621 | ||
| 22299 | 22622 | ||
| 22300 | //----------------------------------------------------------------------------- | 22623 | //----------------------------------------------------------------------------- |
| 22301 | // name: DelayA_pmsg() | 22624 | // name: Envelope_pmsg() |
| 22302 | // desc: PMSG function ... | 22625 | // desc: PMSG function ... |
| 22303 | //----------------------------------------------------------------------------- | 22626 | //----------------------------------------------------------------------------- |
| 22304 | CK_DLL_PMSG( DelayA_pmsg ) | 22627 | CK_DLL_PMSG( Envelope_pmsg ) |
| 22305 | { | 22628 | { |
| 22306 | return FALSE; | 22629 | return FALSE; |
| 22307 | } | 22630 | } |
| 22308 | 22631 | ||
| 22309 | 22632 | ||
| 22310 | //----------------------------------------------------------------------------- | 22633 | //----------------------------------------------------------------------------- |
| 22311 | // name: DelayA_ctrl_delay() | 22634 | // name: Envelope_ctrl_time() |
| 22312 | // desc: CTRL function ... | 22635 | // desc: CTRL function ... |
| 22313 | //----------------------------------------------------------------------------- | 22636 | //----------------------------------------------------------------------------- |
| 22314 | CK_DLL_CTRL( DelayA_ctrl_delay ) | 22637 | CK_DLL_CTRL( Envelope_ctrl_time ) |
| 22315 | { | 22638 | { |
| 22316 | ((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->setDelay( GET_NEXT_DUR(ARGS) ); | 22639 | Envelope * d = (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22317 | RETURN->v_dur = (t_CKDUR)((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->getDelay(); | 22640 | d->setTime( GET_NEXT_FLOAT(ARGS) ); |
| 22641 | RETURN->v_float = d->m_time; | ||
| 22318 | } | 22642 | } |
| 22319 | 22643 | ||
| 22320 | 22644 | ||
| 22321 | //----------------------------------------------------------------------------- | 22645 | //----------------------------------------------------------------------------- |
| 22322 | // name: DelayA_cget_delay() | 22646 | // name: Envelope_cget_time() |
| 22323 | // desc: CGET function ... | 22647 | // desc: CGET function ... |
| 22324 | //----------------------------------------------------------------------------- | 22648 | //----------------------------------------------------------------------------- |
| 22325 | CK_DLL_CGET( DelayA_cget_delay ) | 22649 | CK_DLL_CGET( Envelope_cget_time ) |
| 22326 | { | 22650 | { |
| 22327 | RETURN->v_dur = (t_CKDUR)((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->getDelay(); | 22651 | Envelope * d = (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22652 | RETURN->v_float = d->m_time; | ||
| 22328 | } | 22653 | } |
| 22329 | 22654 | ||
| 22330 | 22655 | ||
| 22331 | //----------------------------------------------------------------------------- | 22656 | //----------------------------------------------------------------------------- |
| 22332 | // name: DelayA_ctrl_max() | 22657 | // name: Envelope_ctrl_duration() |
| 22333 | // desc: CTRL function ... | 22658 | // desc: CTRL function ... |
| 22334 | //----------------------------------------------------------------------------- | 22659 | //----------------------------------------------------------------------------- |
| 22335 | CK_DLL_CTRL( DelayA_ctrl_max ) | 22660 | CK_DLL_CTRL( Envelope_ctrl_duration ) |
| 22336 | { | 22661 | { |
| 22337 | DelayA * delay = (DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data); | 22662 | Envelope * d = (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22338 | t_CKDUR val = (t_CKDUR)delay->getDelay(); | 22663 | d->setTime( GET_NEXT_FLOAT(ARGS) / Stk::sampleRate() ); |
| 22339 | t_CKDUR max = GET_NEXT_DUR(ARGS); | 22664 | RETURN->v_float = d->m_time * Stk::sampleRate(); |
| 22340 | delay->set( val, (long)(max+1.5) ); | ||
| 22341 | RETURN->v_dur = (t_CKDUR)((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->length-1.0; | ||
| 22342 | } | 22665 | } |
| 22343 | 22666 | ||
| 22344 | 22667 | ||
| 22345 | //----------------------------------------------------------------------------- | 22668 | //----------------------------------------------------------------------------- |
| 22346 | // name: DelayA_cget_max() | 22669 | // name: Envelope_cget_duration() |
| 22347 | // desc: CGET function ... | 22670 | // desc: CGET function ... |
| 22348 | //----------------------------------------------------------------------------- | 22671 | //----------------------------------------------------------------------------- |
| 22349 | CK_DLL_CGET( DelayA_cget_max ) | 22672 | CK_DLL_CGET( Envelope_cget_duration ) |
| 22350 | { | 22673 | { |
| 22351 | RETURN->v_dur = (t_CKDUR)((DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data))->length-1.0; | 22674 | Envelope * d = (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22675 | RETURN->v_float = d->m_time * Stk::sampleRate(); | ||
| 22352 | } | 22676 | } |
| 22353 | 22677 | ||
| 22354 | 22678 | ||
| 22355 | //----------------------------------------------------------------------------- | 22679 | //----------------------------------------------------------------------------- |
| 22356 | // name: DelayA_clear() | 22680 | // name: Envelope_ctrl_rate() |
| 22357 | // desc: CGET function ... | 22681 | // desc: CTRL function ... |
| 22358 | //----------------------------------------------------------------------------- | 22682 | //----------------------------------------------------------------------------- |
| 22359 | CK_DLL_CGET( DelayA_clear ) | 22683 | CK_DLL_CTRL( Envelope_ctrl_rate ) |
| 22360 | { | 22684 | { |
| 22361 | DelayA * delay = (DelayA *)OBJ_MEMBER_UINT(SELF, DelayA_offset_data); | 22685 | Envelope * d = (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22362 | delay->clear(); | 22686 | d->setRate( GET_NEXT_FLOAT(ARGS) ); |
| 22687 | RETURN->v_float = (t_CKFLOAT)d->rate; | ||
| 22363 | } | 22688 | } |
| 22364 | 22689 | ||
| 22365 | 22690 | ||
| 22366 | |||
| 22367 | |||
| 22368 | // DelayL | ||
| 22369 | //----------------------------------------------------------------------------- | 22691 | //----------------------------------------------------------------------------- |
| 22370 | // name: DelayL_ctor() | 22692 | // name: Envelope_cget_rate() |
| 22371 | // desc: CTOR function ... | 22693 | // desc: CGET function ... |
| 22372 | //----------------------------------------------------------------------------- | 22694 | //----------------------------------------------------------------------------- |
| 22373 | CK_DLL_CTOR( DelayL_ctor ) | 22695 | CK_DLL_CGET( Envelope_cget_rate ) |
| 22374 | { | 22696 | { |
| 22375 | OBJ_MEMBER_UINT(SELF, DelayL_offset_data) = (t_CKUINT)new DelayL; | 22697 | Envelope * d = (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22698 | RETURN->v_float = (t_CKFLOAT)d->rate; | ||
| 22376 | } | 22699 | } |
| 22377 | 22700 | ||
| 22378 | 22701 | ||
| 22379 | //----------------------------------------------------------------------------- | 22702 | //----------------------------------------------------------------------------- |
| 22380 | // name: DelayL_dtor() | 22703 | // name: Envelope_ctrl_target() |
| 22381 | // desc: DTOR function ... | 22704 | // desc: CTRL function ... |
| 22382 | //----------------------------------------------------------------------------- | 22705 | //----------------------------------------------------------------------------- |
| 22383 | CK_DLL_DTOR( DelayL_dtor ) | 22706 | CK_DLL_CTRL( Envelope_ctrl_target ) |
| 22384 | { | 22707 | { |
| 22385 | delete (DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data); | 22708 | Envelope * d = (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22386 | OBJ_MEMBER_UINT(SELF, DelayL_offset_data) = 0; | 22709 | d->setTarget( GET_NEXT_FLOAT(ARGS) ); |
| 22710 | RETURN->v_float = (t_CKFLOAT)d->target; | ||
| 22387 | } | 22711 | } |
| 22388 | 22712 | ||
| 22389 | 22713 | ||
| 22390 | //----------------------------------------------------------------------------- | 22714 | //----------------------------------------------------------------------------- |
| 22391 | // name: DelayL_tick() | 22715 | // name: Envelope_cget_target() |
| 22392 | // desc: TICK function ... | 22716 | // desc: CGET function ... |
| 22393 | //----------------------------------------------------------------------------- | 22717 | //----------------------------------------------------------------------------- |
| 22394 | CK_DLL_TICK( DelayL_tick ) | 22718 | CK_DLL_CGET( Envelope_cget_target ) |
| 22395 | { | 22719 | { |
| 22396 | *out = (SAMPLE)((DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data))->tick( in ); | 22720 | Envelope * d = (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22397 | return TRUE; | 22721 | RETURN->v_float = (t_CKFLOAT)d->target; |
| 22398 | } | 22722 | } |
| 22399 | 22723 | ||
| 22400 | 22724 | ||
| 22401 | //----------------------------------------------------------------------------- | 22725 | //----------------------------------------------------------------------------- |
| 22402 | // name: DelayL_pmsg() | 22726 | // name: Envelope_ctrl_value() |
| 22403 | // desc: PMSG function ... | 22727 | // desc: CTRL function ... |
| 22404 | //----------------------------------------------------------------------------- | 22728 | //----------------------------------------------------------------------------- |
| 22405 | CK_DLL_PMSG( DelayL_pmsg ) | 22729 | CK_DLL_CTRL( Envelope_ctrl_value ) |
| 22406 | { | 22730 | { |
| 22407 | return FALSE; | 22731 | Envelope * d = (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22732 | d->setValue( GET_NEXT_FLOAT(ARGS) ); | ||
| 22733 | RETURN->v_float = (t_CKFLOAT)d->value; | ||
| 22408 | } | 22734 | } |
| 22409 | 22735 | ||
| 22410 | 22736 | ||
| 22411 | //----------------------------------------------------------------------------- | 22737 | //----------------------------------------------------------------------------- |
| 22412 | // name: DelayL_ctrl_delay() | 22738 | // name: Envelope_cget_value() |
| 22413 | // desc: CTRL function ... | 22739 | // desc: CGET function ... |
| 22414 | //----------------------------------------------------------------------------- | 22740 | //----------------------------------------------------------------------------- |
| 22415 | CK_DLL_CTRL( DelayL_ctrl_delay ) | 22741 | CK_DLL_CGET( Envelope_cget_value ) |
| 22416 | { | 22742 | { |
| 22417 | ((DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data))->setDelay( GET_NEXT_DUR(ARGS) ); | 22743 | Envelope * d = (Envelope *)OBJ_MEMBER_UINT(SELF, Envelope_offset_data); |
| 22418 | RETURN->v_dur = (t_CKDUR)((DelayL *)OBJ_MEMBER_UINT(SELF, DelayL_offset_data))->getDelay(); | 22744 | RETURN->v_float = (t_CKFLOAT)d->value; |
| 22419 | } | 22745 | } |
| 22420 | 22746 | ||
| 22421 | 22747 | ||
| 22422 | //----------------------------------------------------------------------------- | 22748 | //----------------------------------------------------------------------------- |
6396 more lines aren’t shown here.
| @@ -5398,131 +5398,134 @@ public: // SWAP formerly protected · 5397 unmodified lines | |||
| 5398 | #if !defined(__WVOUT_H) | 5398 | #if !defined(__WVOUT_H) |
| 5399 | #define __WVOUT_H | 5399 | #define __WVOUT_H |
| 5400 | 5400 | ||
| 5401 | //#include <stdio.h> | 5401 | |
| 5402 | ////#include "util_thread.h" | 5402 | #ifndef __DISABLE_WVOUT__ |
| 5403 | // | 5403 | #include <stdio.h> |
| 5404 | //#define BUFFER_SIZE 1024 // sample frames | 5404 | //#include "util_thread.h" |
| 5405 | // | 5405 | |
| 5406 | //class WvOut : public Stk | 5406 | #define BUFFER_SIZE 1024 // sample frames |
| 5407 | //{ | 5407 | |
| 5408 | // public: | 5408 | class WvOut : public Stk |
| 5409 | // | 5409 | { |
| 5410 | // typedef unsigned long FILE_TYPE; | 5410 | public: |
| 5411 | // | 5411 | |
| 5412 | // static const FILE_TYPE WVOUT_RAW; /*!< STK RAW file type. */ | 5412 | typedef unsigned long FILE_TYPE; |
| 5413 | // static const FILE_TYPE WVOUT_WAV; /*!< WAV file type. */ | 5413 | |
| 5414 | // static const FILE_TYPE WVOUT_SND; /*!< SND (AU) file type. */ | 5414 | static const FILE_TYPE WVOUT_RAW; /*!< STK RAW file type. */ |
| 5415 | // static const FILE_TYPE WVOUT_AIF; /*!< AIFF file type. */ | 5415 | static const FILE_TYPE WVOUT_WAV; /*!< WAV file type. */ |
| 5416 | // static const FILE_TYPE WVOUT_MAT; /*!< Matlab MAT-file type. */ | 5416 | static const FILE_TYPE WVOUT_SND; /*!< SND (AU) file type. */ |
| 5417 | // | 5417 | static const FILE_TYPE WVOUT_AIF; /*!< AIFF file type. */ |
| 5418 | // // chuck: override stdio fwrite/etc. functions | 5418 | static const FILE_TYPE WVOUT_MAT; /*!< Matlab MAT-file type. */ |
| 5419 | // size_t fwrite(const void * ptr, size_t size, size_t nitems, FILE * stream); | 5419 | |
| 5420 | // int fseek(FILE *stream, long offset, int whence); | 5420 | // chuck: override stdio fwrite/etc. functions |
| 5421 | // int fflush(FILE *stream); | 5421 | size_t fwrite(const void * ptr, size_t size, size_t nitems, FILE * stream); |
| 5422 | // int fclose(FILE *stream); | 5422 | int fseek(FILE *stream, long offset, int whence); |
| 5423 | // size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream); | 5423 | int fflush(FILE *stream); |
| 5424 | // | 5424 | int fclose(FILE *stream); |
| 5425 | // //! Default constructor. | 5425 | size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream); |
| 5426 | // WvOut(); | 5426 | |
| 5427 | // | 5427 | //! Default constructor. |
| 5428 | // //! Overloaded constructor used to specify a file name, type, and data format with this object. | 5428 | WvOut(); |
| 5429 | // /*! | 5429 | |
| 5430 | // An StkError is thrown for invalid argument values or if an error occurs when initializing the output file. | 5430 | //! Overloaded constructor used to specify a file name, type, and data format with this object. |
| 5431 | // */ | 5431 | /*! |
| 5432 | // WvOut( const char *fileName, unsigned int nChannels = 1, FILE_TYPE type = WVOUT_WAV, Stk::STK_FORMAT format = STK_SINT16 ); | 5432 | An StkError is thrown for invalid argument values or if an error occurs when initializing the output file. |
| 5433 | // | 5433 | */ |
| 5434 | // //! Class destructor. | 5434 | WvOut( const char *fileName, unsigned int nChannels = 1, FILE_TYPE type = WVOUT_WAV, Stk::STK_FORMAT format = STK_SINT16 ); |
| 5435 | // virtual ~WvOut(); | 5435 | |
| 5436 | // | 5436 | //! Class destructor. |
| 5437 | // //! Create a file of the specified type and name and output samples to it in the given data format. | 5437 | virtual ~WvOut(); |
| 5438 | // /*! | 5438 | |
| 5439 | // An StkError is thrown for invalid argument values or if an error occurs when initializing the output file. | 5439 | //! Create a file of the specified type and name and output samples to it in the given data format. |
| 5440 | // */ | 5440 | /*! |
| 5441 | // void openFile( const char *fileName, unsigned int nChannels = 1, \ | 5441 | An StkError is thrown for invalid argument values or if an error occurs when initializing the output file. |
| 5442 | // WvOut::FILE_TYPE type = WVOUT_WAV, Stk::STK_FORMAT = STK_SINT16 ); | 5442 | */ |
| 5443 | // //! If a file is open, write out samples in the queue and then close it. | 5443 | void openFile( const char *fileName, unsigned int nChannels = 1, \ |
| 5444 | // void closeFile( void ); | 5444 | WvOut::FILE_TYPE type = WVOUT_WAV, Stk::STK_FORMAT = STK_SINT16 ); |
| 5445 | // | 5445 | //! If a file is open, write out samples in the queue and then close it. |
| 5446 | // //! Return the number of sample frames output. | 5446 | void closeFile( void ); |
| 5447 | // unsigned long getFrames( void ) const; | 5447 | |
| 5448 | // | 5448 | //! Return the number of sample frames output. |
| 5449 | // //! Return the number of seconds of data output. | 5449 | unsigned long getFrames( void ) const; |
| 5450 | // MY_FLOAT getTime( void ) const; | 5450 | |
| 5451 | // | 5451 | //! Return the number of seconds of data output. |
| 5452 | // //! Output a single sample to all channels in a sample frame. | 5452 | MY_FLOAT getTime( void ) const; |
| 5453 | // /*! | 5453 | |
| 5454 | // An StkError is thrown if a file write error occurs. | 5454 | //! Output a single sample to all channels in a sample frame. |
| 5455 | // */ | 5455 | /*! |
| 5456 | // virtual void tick(const MY_FLOAT sample); | 5456 | An StkError is thrown if a file write error occurs. |
| 5457 | // | 5457 | */ |
| 5458 | // //! Output each sample in \e vector to all channels in \e vectorSize sample frames. | 5458 | virtual void tick(const MY_FLOAT sample); |
| 5459 | // /*! | 5459 | |
| 5460 | // An StkError is thrown if a file write error occurs. | 5460 | //! Output each sample in \e vector to all channels in \e vectorSize sample frames. |
| 5461 | // */ | 5461 | /*! |
| 5462 | // virtual void tick(const MY_FLOAT *vector, unsigned int vectorSize); | 5462 | An StkError is thrown if a file write error occurs. |
| 5463 | // | 5463 | */ |
| 5464 | // //! Output the \e frameVector of sample frames of the given length. | 5464 | virtual void tick(const MY_FLOAT *vector, unsigned int vectorSize); |
| 5465 | // /*! | 5465 | |
| 5466 | // An StkError is thrown if a file write error occurs. | 5466 | //! Output the \e frameVector of sample frames of the given length. |
| 5467 | // */ | 5467 | /*! |
| 5468 | // virtual void tickFrame(const MY_FLOAT *frameVector, unsigned int frames = 1); | 5468 | An StkError is thrown if a file write error occurs. |
| 5469 | // | 5469 | */ |
| 5470 | // public: // SWAP formerly protected | 5470 | virtual void tickFrame(const MY_FLOAT *frameVector, unsigned int frames = 1); |
| 5471 | // | 5471 | |
| 5472 | // // Initialize class variables. | 5472 | public: // SWAP formerly protected |
| 5473 | // void init( void ); | 5473 | |
| 5474 | // | 5474 | // Initialize class variables. |
| 5475 | // // Write data to output file; | 5475 | void init( void ); |
| 5476 | // virtual void writeData( unsigned long frames ); | 5476 | |
| 5477 | // | 5477 | // Write data to output file; |
| 5478 | // // Write STK RAW file header. | 5478 | virtual void writeData( unsigned long frames ); |
| 5479 | // bool setRawFile( const char *fileName ); | 5479 | |
| 5480 | // | 5480 | // Write STK RAW file header. |
| 5481 | // // Write WAV file header. | 5481 | bool setRawFile( const char *fileName ); |
| 5482 | // bool setWavFile( const char *fileName ); | 5482 | |
| 5483 | // | 5483 | // Write WAV file header. |
| 5484 | // // Close WAV file, updating the header. | 5484 | bool setWavFile( const char *fileName ); |
| 5485 | // void closeWavFile( void ); | 5485 | |
| 5486 | // | 5486 | // Close WAV file, updating the header. |
| 5487 | // // Write SND (AU) file header. | 5487 | void closeWavFile( void ); |
| 5488 | // bool setSndFile( const char *fileName ); | 5488 | |
| 5489 | // | 5489 | // Write SND (AU) file header. |
| 5490 | // // Close SND file, updating the header. | 5490 | bool setSndFile( const char *fileName ); |
| 5491 | // void closeSndFile( void ); | 5491 | |
| 5492 | // | 5492 | // Close SND file, updating the header. |
| 5493 | // // Write AIFF file header. | 5493 | void closeSndFile( void ); |
| 5494 | // bool setAifFile( const char *fileName ); | 5494 | |
| 5495 | // | 5495 | // Write AIFF file header. |
| 5496 | // // Close AIFF file, updating the header. | 5496 | bool setAifFile( const char *fileName ); |
| 5497 | // void closeAifFile( void ); | 5497 | |
| 5498 | // | 5498 | // Close AIFF file, updating the header. |
| 5499 | // // Write MAT-file header. | 5499 | void closeAifFile( void ); |
| 5500 | // bool setMatFile( const char *fileName ); | 5500 | |
| 5501 | // | 5501 | // Write MAT-file header. |
| 5502 | // // Close MAT-file, updating the header. | 5502 | bool setMatFile( const char *fileName ); |
| 5503 | // void closeMatFile( void ); | 5503 | |
| 5504 | // | 5504 | // Close MAT-file, updating the header. |
| 5505 | // char msg[256]; | 5505 | void closeMatFile( void ); |
| 5506 | // FILE *fd; | 5506 | |
| 5507 | // MY_FLOAT *data; | 5507 | char msg[256]; |
| 5508 | // FILE_TYPE fileType; | 5508 | FILE *fd; |
| 5509 | // STK_FORMAT dataType; | 5509 | MY_FLOAT *data; |
| 5510 | // bool byteswap; | 5510 | FILE_TYPE fileType; |
| 5511 | // unsigned int channels; | 5511 | STK_FORMAT dataType; |
| 5512 | // unsigned long counter; | 5512 | bool byteswap; |
| 5513 | // unsigned long totalCount; | 5513 | unsigned int channels; |
| 5514 | // // char m_filename[1024]; | 5514 | unsigned long counter; |
| 5515 | // Chuck_String str_filename; | 5515 | unsigned long totalCount; |
| 5516 | // t_CKUINT start; | 5516 | // char m_filename[1024]; |
| 5517 | // // char autoPrefix[1024]; | 5517 | Chuck_String str_filename; |
| 5518 | // Chuck_String autoPrefix; | 5518 | t_CKUINT start; |
| 5519 | // t_CKUINT flush; | 5519 | // char autoPrefix[1024]; |
| 5520 | // t_CKFLOAT fileGain; | 5520 | Chuck_String autoPrefix; |
| 5521 | // | 5521 | t_CKUINT flush; |
| 5522 | // // spencer: for data asynch write | 5522 | t_CKFLOAT fileGain; |
| 5523 | // t_CKBOOL asyncIO; | 5523 | |
| 5524 | // XWriteThread * asyncWriteThread; | 5524 | // spencer: for data asynch write |
| 5525 | //}; | 5525 | t_CKBOOL asyncIO; |
| 5526 | XWriteThread * asyncWriteThread; | ||
| 5527 | }; | ||
| 5528 | #endif // __DISABLED_WVOUT__ | ||
| 5526 | 5529 | ||
| 5527 | #endif // defined(__WVOUT_H) | 5530 | #endif // defined(__WVOUT_H) |
| 5528 | 5531 | ||
| @@ -41,11 +41,13 @@ · 40 unmodified lines | |||
| 41 | #include <sys/stat.h> | 41 | #include <sys/stat.h> |
| 42 | #include <limits.h> | 42 | #include <limits.h> |
| 43 | 43 | ||
| 44 | //#if defined(__CK_SNDFILE_NATIVE__) | 44 | #ifndef __DISABLE_SNDBUF__ |
| 45 | //#include <sndfile.h> | 45 | #if defined(__CK_SNDFILE_NATIVE__) |
| 46 | //#else | 46 | #include <sndfile.h> |
| 47 | //#include "util_sndfile.h" | 47 | #else |
| 48 | //#endif | 48 | #include "util_sndfile.h" |
| 49 | #endif | ||
| 50 | #endif | ||
| 49 | 51 | ||
| 50 | #include "ugen_xxx.h" | 52 | #include "ugen_xxx.h" |
| 51 | #include "chuck_type.h" | 53 | #include "chuck_type.h" |
| @@ -33,7 +33,7 @@ · 32 unmodified lines | |||
| 33 | #define __ULIB_MACHINE_H__ | 33 | #define __ULIB_MACHINE_H__ |
| 34 | 34 | ||
| 35 | #include "chuck_dl.h" | 35 | #include "chuck_dl.h" |
| 36 | //#include "chuck_otf.h" | 36 | #include "chuck_otf.h" |
| 37 | 37 | ||
| 38 | // forward reference | 38 | // forward reference |
| 39 | struct Chuck_VM; | 39 | struct Chuck_VM; |
| @@ -34,10 +34,14 @@ · 33 unmodified lines | |||
| 34 | #include <time.h> | 34 | #include <time.h> |
| 35 | #include <math.h> | 35 | #include <math.h> |
| 36 | #include "util_buffers.h" | 36 | #include "util_buffers.h" |
| 37 | //#include "util_console.h" | 37 | #ifndef __DISABLE_PROMPTER__ |
| 38 | #include "util_console.h" | ||
| 39 | #endif | ||
| 38 | #include "util_math.h" | 40 | #include "util_math.h" |
| 39 | #include "util_string.h" | 41 | #include "util_string.h" |
| 40 | //#include "util_thread.h" | 42 | #ifndef __DISABLE_THREADS__ |
| 43 | #include "util_thread.h" | ||
| 44 | #endif | ||
| 41 | #include "chuck.h" | 45 | #include "chuck.h" |
| 42 | #include "chuck_type.h" | 46 | #include "chuck_type.h" |
| 43 | #include "chuck_compile.h" | 47 | #include "chuck_compile.h" |
| @@ -61,7 +65,9 @@ int setenv( const char *n, const char *v, int i ) · 17 unmodified lines | |||
| 61 | // for ConsoleInput and StringTokenizer | 65 | // for ConsoleInput and StringTokenizer |
| 62 | #include <sstream> | 66 | #include <sstream> |
| 63 | #include <iostream> | 67 | #include <iostream> |
| 64 | //#include "util_thread.h" | 68 | #ifndef __DISABLE_THREADS__ |
| 69 | #include "util_thread.h" | ||
| 70 | #endif | ||
| 65 | using namespace std; | 71 | using namespace std; |
| 66 | 72 | ||
| 67 | 73 | ||
| @@ -121,7 +121,9 @@ void CBufferAdvance::cleanup() · 120 unmodified lines | |||
| 121 | UINT__ CBufferAdvance::join( Chuck_Event * event ) | 121 | UINT__ CBufferAdvance::join( Chuck_Event * event ) |
| 122 | { | 122 | { |
| 123 | // TODO: necessary? | 123 | // TODO: necessary? |
| 124 | // m_mutex.acquire(); | 124 | #ifndef __DISABLE_THREADS__ |
| 125 | m_mutex.acquire(); | ||
| 126 | #endif | ||
| 125 | 127 | ||
| 126 | // index of new pointer that will be pushed back | 128 | // index of new pointer that will be pushed back |
| 127 | UINT__ read_offset_index; | 129 | UINT__ read_offset_index; |
| @@ -143,7 +145,9 @@ UINT__ CBufferAdvance::join( Chuck_Event * event ) · 15 unmodified lines | |||
| 143 | } | 145 | } |
| 144 | 146 | ||
| 145 | // TODO: necessary? | 147 | // TODO: necessary? |
| 146 | // m_mutex.release(); | 148 | #ifndef __DISABLE_THREADS__ |
| 149 | m_mutex.release(); | ||
| 150 | #endif | ||
| 147 | 151 | ||
| 148 | // return index | 152 | // return index |
| 149 | return read_offset_index; | 153 | return read_offset_index; |
| @@ -161,7 +165,9 @@ void CBufferAdvance::resign( UINT__ read_offset_index ) · 11 unmodified lines | |||
| 161 | return; | 165 | return; |
| 162 | 166 | ||
| 163 | // TODO: necessary? | 167 | // TODO: necessary? |
| 164 | // m_mutex.acquire(); | 168 | #ifndef __DISABLE_THREADS__ |
| 169 | m_mutex.acquire(); | ||
| 170 | #endif | ||
| 165 | 171 | ||
| 166 | // add this index to free queue | 172 | // add this index to free queue |
| 167 | m_free.push( read_offset_index ); | 173 | m_free.push( read_offset_index ); |
| @@ -171,7 +177,9 @@ void CBufferAdvance::resign( UINT__ read_offset_index ) · 3 unmodified lines | |||
| 171 | m_read_offsets[read_offset_index].event = NULL; | 177 | m_read_offsets[read_offset_index].event = NULL; |
| 172 | 178 | ||
| 173 | // TODO: necessary? | 179 | // TODO: necessary? |
| 174 | // m_mutex.release(); | 180 | #ifndef __DISABLE_THREADS__ |
| 181 | m_mutex.release(); | ||
| 182 | #endif | ||
| 175 | } | 183 | } |
| 176 | 184 | ||
| 177 | 185 | ||
| @@ -208,7 +216,9 @@ void CBufferAdvance::put( void * data, UINT__ num_elem ) · 30 unmodified lines | |||
| 208 | BYTE__ * d = (BYTE__ *)data; | 216 | BYTE__ * d = (BYTE__ *)data; |
| 209 | 217 | ||
| 210 | // TODO: necessary? | 218 | // TODO: necessary? |
| 211 | // m_mutex.acquire(); | 219 | #ifndef __DISABLE_THREADS__ |
| 220 | m_mutex.acquire(); | ||
| 221 | #endif | ||
| 212 | 222 | ||
| 213 | // copy | 223 | // copy |
| 214 | for( i = 0; i < num_elem; i++ ) | 224 | for( i = 0; i < num_elem; i++ ) |
| @@ -240,7 +250,9 @@ void CBufferAdvance::put( void * data, UINT__ num_elem ) · 25 unmodified lines | |||
| 240 | } | 250 | } |
| 241 | 251 | ||
| 242 | // TODO: necessary? | 252 | // TODO: necessary? |
| 243 | // m_mutex.release(); | 253 | #ifndef __DISABLE_THREADS__ |
| 254 | m_mutex.release(); | ||
| 255 | #endif | ||
| 244 | } | 256 | } |
| 245 | 257 | ||
| 246 | 258 | ||
| @@ -308,17 +320,23 @@ UINT__ CBufferAdvance::get( void * data, UINT__ num_elem, UINT__ read_offset_ind · 61 unmodified lines | |||
| 308 | BYTE__ * d = (BYTE__ *)data; | 320 | BYTE__ * d = (BYTE__ *)data; |
| 309 | 321 | ||
| 310 | // TODO: necessary? | 322 | // TODO: necessary? |
| 311 | // m_mutex.acquire(); | 323 | #ifndef __DISABLE_THREADS__ |
| 324 | m_mutex.acquire(); | ||
| 325 | #endif | ||
| 312 | 326 | ||
| 313 | // make sure index is valid | 327 | // make sure index is valid |
| 314 | if( read_offset_index >= m_read_offsets.size() ) | 328 | if( read_offset_index >= m_read_offsets.size() ) |
| 315 | { | 329 | { |
| 316 | // m_mutex.release(); | 330 | #ifndef __DISABLE_THREADS__ |
| 331 | m_mutex.release(); | ||
| 332 | #endif | ||
| 317 | return 0; | 333 | return 0; |
| 318 | } | 334 | } |
| 319 | if( m_read_offsets[read_offset_index].read_offset < 0 ) | 335 | if( m_read_offsets[read_offset_index].read_offset < 0 ) |
| 320 | { | 336 | { |
| 321 | // m_mutex.release(); | 337 | #ifndef __DISABLE_THREADS__ |
| 338 | m_mutex.release(); | ||
| 339 | #endif | ||
| 322 | return 0; | 340 | return 0; |
| 323 | } | 341 | } |
| 324 | 342 | ||
| @@ -327,7 +345,9 @@ UINT__ CBufferAdvance::get( void * data, UINT__ num_elem, UINT__ read_offset_ind · 2 unmodified lines | |||
| 327 | // read catch up with write | 345 | // read catch up with write |
| 328 | if( m_read_offset == m_write_offset ) | 346 | if( m_read_offset == m_write_offset ) |
| 329 | { | 347 | { |
| 330 | // m_mutex.release(); | 348 | #ifndef __DISABLE_THREADS__ |
| 349 | m_mutex.release(); | ||
| 350 | #endif | ||
| 331 | return 0; | 351 | return 0; |
| 332 | } | 352 | } |
| 333 | 353 | ||
| @@ -357,7 +377,9 @@ UINT__ CBufferAdvance::get( void * data, UINT__ num_elem, UINT__ read_offset_ind · 23 unmodified lines | |||
| 357 | m_read_offsets[read_offset_index].read_offset = m_read_offset; | 377 | m_read_offsets[read_offset_index].read_offset = m_read_offset; |
| 358 | 378 | ||
| 359 | // TODO: necessary? | 379 | // TODO: necessary? |
| 360 | // m_mutex.release(); | 380 | #ifndef __DISABLE_THREADS__ |
| 381 | m_mutex.release(); | ||
| 382 | #endif | ||
| 361 | 383 | ||
| 362 | // return number of elems | 384 | // return number of elems |
| 363 | return i; | 385 | return i; |
| @@ -36,7 +36,9 @@ · 35 unmodified lines | |||
| 36 | #define __UTIL_BUFFERS_H__ | 36 | #define __UTIL_BUFFERS_H__ |
| 37 | 37 | ||
| 38 | #include "chuck_oo.h" | 38 | #include "chuck_oo.h" |
| 39 | //#include "util_thread.h" | 39 | #ifndef __DISABLE_THREADS__ |
| 40 | #include "util_thread.h" | ||
| 41 | #endif | ||
| 40 | #include <vector> | 42 | #include <vector> |
| 41 | #include <queue> | 43 | #include <queue> |
| 42 | #include <iostream> | 44 | #include <iostream> |
| @@ -98,7 +100,9 @@ protected: · 55 unmodified lines | |||
| 98 | SINT__ m_max_elem; | 100 | SINT__ m_max_elem; |
| 99 | 101 | ||
| 100 | // TODO: necessary? | 102 | // TODO: necessary? |
| 101 | // XMutex m_mutex; | 103 | #ifndef __DISABLE_THREADS__ |
| 104 | XMutex m_mutex; | ||
| 105 | #endif | ||
| 102 | 106 | ||
| 103 | CBufferSimple * m_event_buffer; | 107 | CBufferSimple * m_event_buffer; |
| 104 | }; | 108 | }; |
| @@ -361,34 +361,35 @@ done: · 360 unmodified lines | |||
| 361 | 361 | ||
| 362 | /* from http://developer.apple.com/library/mac/#qa/qa1549/_index.html */ | 362 | /* from http://developer.apple.com/library/mac/#qa/qa1549/_index.html */ |
| 363 | 363 | ||
| 364 | #ifndef __PLATFORM_WIN32__ | 364 | #if !defined(__PLATFORM_WIN32__) && !defined(__EMSCRIPTEN__) |
| 365 | 365 | ||
| 366 | #include <glob.h> | 366 | #include <glob.h> |
| 367 | 367 | ||
| 368 | //char* CreatePathByExpandingTildePath(const char* path) | ||
| 369 | //{ | ||
| 370 | // glob_t globbuf; | ||
| 371 | // char **v; | ||
| 372 | // char *expandedPath = NULL, *result = NULL; | ||
| 373 | // | ||
| 374 | // assert(path != NULL); | ||
| 375 | // | ||
| 376 | // if (glob(path, GLOB_TILDE, NULL, &globbuf) == 0) //success | ||
| 377 | // { | ||
| 378 | // v = globbuf.gl_pathv; //list of matched pathnames | ||
| 379 | // expandedPath = v[0]; //number of matched pathnames, gl_pathc == 1 | ||
| 380 | // | ||
| 381 | // result = (char*)calloc(1, strlen(expandedPath) + 1); //the extra char is for the null-termination | ||
| 382 | // if(result) | ||
| 383 | // strncpy(result, expandedPath, strlen(expandedPath) + 1); //copy the null-termination as well | ||
| 384 | // | ||
| 385 | // globfree(&globbuf); | ||
| 386 | // } | ||
| 387 | // | ||
| 388 | // return result; | ||
| 389 | //} | ||
| 390 | 368 | ||
| 391 | #endif // __PLATFORM_WIN32__ | 369 | char* CreatePathByExpandingTildePath(const char* path) |
| 370 | { | ||
| 371 | glob_t globbuf; | ||
| 372 | char **v; | ||
| 373 | char *expandedPath = NULL, *result = NULL; | ||
| 374 | |||
| 375 | assert(path != NULL); | ||
| 376 | |||
| 377 | if (glob(path, GLOB_TILDE, NULL, &globbuf) == 0) //success | ||
| 378 | { | ||
| 379 | v = globbuf.gl_pathv; //list of matched pathnames | ||
| 380 | expandedPath = v[0]; //number of matched pathnames, gl_pathc == 1 | ||
| 381 | |||
| 382 | result = (char*)calloc(1, strlen(expandedPath) + 1); //the extra char is for the null-termination | ||
| 383 | if(result) | ||
| 384 | strncpy(result, expandedPath, strlen(expandedPath) + 1); //copy the null-termination as well | ||
| 385 | |||
| 386 | globfree(&globbuf); | ||
| 387 | } | ||
| 388 | |||
| 389 | return result; | ||
| 390 | } | ||
| 391 | |||
| 392 | #endif // __PLATFORM_WIN32__ && __EMSCRIPTEN__ | ||
| 392 | 393 | ||
| 393 | 394 | ||
| 394 | // get full path to file | 395 | // get full path to file |
| @@ -26,7 +26,7 @@ endif · 25 unmodified lines | |||
| 26 | endif | 26 | endif |
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | ############################## MAKE EMSCRIPTEN################################## | 29 | ############################## MAKE EMSCRIPTEN ################################# |
| 30 | EMSCRIPTENSRCS=host_web/chuck_emscripten.cpp \ | 30 | EMSCRIPTENSRCS=host_web/chuck_emscripten.cpp \ |
| 31 | host_web/chuck_emscripten_main.cpp core/chuck.cpp core/chuck_absyn.cpp \ | 31 | host_web/chuck_emscripten_main.cpp core/chuck.cpp core/chuck_absyn.cpp \ |
| 32 | core/chuck_carrier.cpp core/chuck_compile.cpp core/chuck_dl.cpp \ | 32 | core/chuck_carrier.cpp core/chuck_compile.cpp core/chuck_dl.cpp \ |
| @@ -48,7 +48,10 @@ emscripten: host_web/chuckscript.js · 15 unmodified lines | |||
| 48 | host_web/chuckscript.js: $(EMSCRIPTENSRCS) | 48 | host_web/chuckscript.js: $(EMSCRIPTENSRCS) |
| 49 | emcc -Icore -D__DISABLE_MIDI__ -D__DISABLE_WATCHDOG__ -D__DISABLE_RAW__ \ | 49 | emcc -Icore -D__DISABLE_MIDI__ -D__DISABLE_WATCHDOG__ -D__DISABLE_RAW__ \ |
| 50 | -D__DISABLE_KBHIT__ -D__DISABLE_PROMPTER__ -D__DISABLE_RTAUDIO__ \ | 50 | -D__DISABLE_KBHIT__ -D__DISABLE_PROMPTER__ -D__DISABLE_RTAUDIO__ \ |
| 51 | -D__DISABLE_OTF_SERVER__ -D__ALTER_HID__ -D__DISABLE_SNDBUF__ \ | 51 | -D__DISABLE_OTF_SERVER__ -D__ALTER_HID__ -D__DISABLE_HID__ \ |
| 52 | -D__DISABLE_SNDBUF__ -D__DISABLE_SERIAL__ -D__DISABLE_THREADS__ \ | ||
| 53 | -D__DISABLE_NETWORK__ -D__DISABLE_SHELL__ -D__DISABLE_WVOUT__ \ | ||
| 54 | -D__DISABLE_FILEIO__ \ | ||
| 52 | $(EMSCRIPTENSRCS) -o host_web/chuckscript.js \ | 55 | $(EMSCRIPTENSRCS) -o host_web/chuckscript.js \ |
| 53 | -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap", "getValue", "setValue"]' \ | 56 | -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap", "getValue", "setValue"]' \ |
| 54 | -s LINKABLE=1 -s MODULARIZE=1 -s 'EXPORT_NAME="ChucK"' | 57 | -s LINKABLE=1 -s MODULARIZE=1 -s 'EXPORT_NAME="ChucK"' |