Unified · Split
| @@ -32,6 +32,7 @@ · 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_io.h" | ||
| 35 | #ifndef __DISABLE_OTF_SERVER__ | 36 | #ifndef __DISABLE_OTF_SERVER__ |
| 36 | #include "chuck_otf.h" | 37 | #include "chuck_otf.h" |
| 37 | #endif | 38 | #endif |
| @@ -52,8 +53,10 @@ · 14 unmodified lines | |||
| 52 | #include "ulib_opsc.h" | 53 | #include "ulib_opsc.h" |
| 53 | #endif | 54 | #endif |
| 54 | 55 | ||
| 56 | // 1.5.0.0 (ge) | chunreal | ||
| 57 | #ifndef __DISABLE_REGEX__ | ||
| 55 | #include "ulib_regex.h" | 58 | #include "ulib_regex.h" |
| 56 | #include "chuck_io.h" | 59 | #endif |
| 57 | 60 | ||
| 58 | #if defined(__PLATFORM_WIN32__) | 61 | #if defined(__PLATFORM_WIN32__) |
| 59 | #include "dirent_win32.h" | 62 | #include "dirent_win32.h" |
| @@ -400,8 +403,8 @@ t_CKBOOL Chuck_Compiler::do_only_classes( Chuck_Context * context ) · 340 unmodified lines | |||
| 400 | return FALSE; | 403 | return FALSE; |
| 401 | 404 | ||
| 402 | // emit (pass 4) | 405 | // emit (pass 4) |
| 403 | if( !(code = emit_engine_emit_prog( emitter, g_program , te_do_classes_only )) ) | 406 | code = emit_engine_emit_prog( emitter, g_program , te_do_classes_only ); |
| 404 | return FALSE; | 407 | if( !code ) return FALSE; |
| 405 | 408 | ||
| 406 | // set the state of the context to done | 409 | // set the state of the context to done |
| 407 | context->progress = Chuck_Context::P_ALL_DONE; | 410 | context->progress = Chuck_Context::P_ALL_DONE; |
| @@ -433,8 +436,8 @@ t_CKBOOL Chuck_Compiler::do_all_except_classes( Chuck_Context * context ) · 25 unmodified lines | |||
| 433 | return FALSE; | 436 | return FALSE; |
| 434 | 437 | ||
| 435 | // emit (pass 4) | 438 | // emit (pass 4) |
| 436 | if( !(code = emit_engine_emit_prog( emitter, g_program, te_do_no_classes )) ) | 439 | code = emit_engine_emit_prog( emitter, g_program, te_do_no_classes ); |
| 437 | return FALSE; | 440 | if( !code ) return FALSE; |
| 438 | 441 | ||
| 439 | // set the state of the context to done | 442 | // set the state of the context to done |
| 440 | context->progress = Chuck_Context::P_ALL_DONE; | 443 | context->progress = Chuck_Context::P_ALL_DONE; |
| @@ -490,8 +493,8 @@ t_CKBOOL Chuck_Compiler::do_normal_depend( const string & filename, FILE * fd, · 49 unmodified lines | |||
| 490 | { ret = FALSE; goto cleanup; } | 493 | { ret = FALSE; goto cleanup; } |
| 491 | 494 | ||
| 492 | // emit (pass 4) | 495 | // emit (pass 4) |
| 493 | if( !(code = emit_engine_emit_prog( emitter, g_program, te_do_all )) ) | 496 | code = emit_engine_emit_prog( emitter, g_program, te_do_all ); |
| 494 | { ret = FALSE; goto cleanup; } | 497 | if( !code ) { ret = FALSE; goto cleanup; } |
| 495 | 498 | ||
| 496 | cleanup: | 499 | cleanup: |
| 497 | 500 | ||
| @@ -543,7 +546,8 @@ t_CKBOOL Chuck_Compiler::do_auto_depend( const string & filename, FILE * fd, · 45 unmodified lines | |||
| 543 | { ret = FALSE; goto cleanup; } | 546 | { ret = FALSE; goto cleanup; } |
| 544 | 547 | ||
| 545 | // get the code | 548 | // get the code |
| 546 | if( !(code = context->code()) ) | 549 | code = context->code(); |
| 550 | if( !code ) | ||
| 547 | { | 551 | { |
| 548 | ret = FALSE; | 552 | ret = FALSE; |
| 549 | EM_error2( 0, "internal error: context->code() NULL!" ); | 553 | EM_error2( 0, "internal error: context->code() NULL!" ); |
| @@ -633,8 +637,8 @@ t_CKBOOL load_module( Chuck_Compiler * compiler, Chuck_Env * env, f_ck_query que · 83 unmodified lines | |||
| 633 | // load osc | 637 | // load osc |
| 634 | dll = new Chuck_DLL( compiler->carrier(), name ); | 638 | dll = new Chuck_DLL( compiler->carrier(), name ); |
| 635 | // (fixed: 1.3.0.0) query_failed now catches either failure of load or query | 639 | // (fixed: 1.3.0.0) query_failed now catches either failure of load or query |
| 636 | if( (query_failed = !(dll->load( query ) && dll->query())) || | 640 | query_failed = !(dll->load( query ) && dll->query()); |
| 637 | !type_engine_add_dll( env, dll, nspc ) ) | 641 | if( query_failed || !type_engine_add_dll( env, dll, nspc ) ) |
| 638 | { | 642 | { |
| 639 | CK_FPRINTF_STDERR( | 643 | CK_FPRINTF_STDERR( |
| 640 | "[chuck]: internal error loading module '%s.%s'...\n", | 644 | "[chuck]: internal error loading module '%s.%s'...\n", |
| @@ -709,8 +713,10 @@ t_CKBOOL load_internal_modules( Chuck_Compiler * compiler ) · 68 unmodified lines | |||
| 709 | if( !load_module( compiler, env, opensoundcontrol_query, "opsc", "global" ) ) goto error; | 713 | if( !load_module( compiler, env, opensoundcontrol_query, "opsc", "global" ) ) goto error; |
| 710 | #endif | 714 | #endif |
| 711 | 715 | ||
| 716 | #ifndef __DISABLE_REGEX__ | ||
| 712 | EM_log( CK_LOG_SEVERE, "module 'RegEx'" ); | 717 | EM_log( CK_LOG_SEVERE, "module 'RegEx'" ); |
| 713 | if( !load_module( compiler, env, regex_query, "RegEx", "global" ) ) goto error; | 718 | if( !load_module( compiler, env, regex_query, "RegEx", "global" ) ) goto error; |
| 719 | #endif | ||
| 714 | 720 | ||
| 715 | // deprecated: | 721 | // deprecated: |
| 716 | // if( !load_module( compiler, env, net_query, "net", "global" ) ) goto error; | 722 | // if( !load_module( compiler, env, net_query, "net", "global" ) ) goto error; |
| @@ -770,8 +776,9 @@ t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler, · 53 unmodified lines | |||
| 770 | Chuck_DLL * dll = new Chuck_DLL( compiler->carrier(), name ); | 776 | Chuck_DLL * dll = new Chuck_DLL( compiler->carrier(), name ); |
| 771 | t_CKBOOL query_failed = FALSE; | 777 | t_CKBOOL query_failed = FALSE; |
| 772 | 778 | ||
| 773 | if((query_failed = !(dll->load(dl_path) && dll->query())) || | 779 | // try to load and query |
| 774 | !type_engine_add_dll2(env, dll, "global")) | 780 | query_failed = !(dll->load(dl_path) && dll->query()); |
| 781 | if( query_failed || !type_engine_add_dll2(env, dll, "global")) | ||
| 775 | { | 782 | { |
| 776 | EM_pushlog(); | 783 | EM_pushlog(); |
| 777 | EM_log(CK_LOG_SEVERE, "cannot load chugin '%s', skipping...", name); | 784 | EM_log(CK_LOG_SEVERE, "cannot load chugin '%s', skipping...", name); |
| @@ -848,9 +855,11 @@ t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, · 70 unmodified lines | |||
| 848 | // log | 855 | // log |
| 849 | EM_log( CK_LOG_INFO, "examining directory '%s' for chugins", directory ); | 856 | EM_log( CK_LOG_INFO, "examining directory '%s' for chugins", directory ); |
| 850 | 857 | ||
| 851 | struct dirent *de = NULL; | 858 | // do first read | 1.5.0.0 (ge + eito) #chunreal |
| 859 | struct dirent * de = readdir(dir); | ||
| 852 | 860 | ||
| 853 | while( (de = readdir(dir)) ) | 861 | // while( (de = readdir(dir)) ) <- in ge's opinion clearer than what UE5 forces us to do |
| 862 | while( de != NULL ) | ||
| 854 | { | 863 | { |
| 855 | t_CKBOOL is_regular = false; | 864 | t_CKBOOL is_regular = false; |
| 856 | t_CKBOOL is_directory = false; | 865 | t_CKBOOL is_directory = false; |
| @@ -909,6 +918,9 @@ t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, · 52 unmodified lines | |||
| 909 | extension); | 918 | extension); |
| 910 | } | 919 | } |
| 911 | } | 920 | } |
| 921 | |||
| 922 | // read next | 1.5.0.0 (ge) moved here due to #chunreal | ||
| 923 | de = readdir( dir ); | ||
| 912 | } | 924 | } |
| 913 | 925 | ||
| 914 | // close | 926 | // close |
| @@ -37,7 +37,6 @@ · 36 unmodified lines | |||
| 37 | #include <memory.h> | 37 | #include <memory.h> |
| 38 | #include <assert.h> | 38 | #include <assert.h> |
| 39 | 39 | ||
| 40 | |||
| 41 | // types | 40 | // types |
| 42 | #ifndef __EMSCRIPTEN__ | 41 | #ifndef __EMSCRIPTEN__ |
| 43 | #define t_CKTIME double | 42 | #define t_CKTIME double |
| @@ -193,8 +192,13 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 149 unmodified lines | |||
| 193 | 192 | ||
| 194 | #ifdef __PLATFORM_WIN32__ | 193 | #ifdef __PLATFORM_WIN32__ |
| 195 | #ifndef usleep | 194 | #ifndef usleep |
| 196 | #define usleep(x) Sleep( (x / 1000 <= 0 ? 1 : x / 1000) ) | 195 | #ifndef __CHUNREAL_ENGINE__ |
| 197 | #endif | 196 | #define usleep(x) Sleep((x / 1000 <= 0 ? 1 : x / 1000) ) |
| 197 | #else | ||
| 198 | // 1.5.0.0 (ge) | #chunreal | ||
| 199 | #define usleep(x) FPlatformProcess::Sleep( x/1000000.0f <= 0 ? .001 : x/1000000.0f ); | ||
| 200 | #endif // #ifndef __UNREAL_ENGINE__ | ||
| 201 | #endif // #ifndef usleep | ||
| 198 | // 1.4.2.0 (ge and spencer) | added for legacy windows, as part of switch to snprintf | 202 | // 1.4.2.0 (ge and spencer) | added for legacy windows, as part of switch to snprintf |
| 199 | // https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010 | 203 | // https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010 |
| 200 | #if defined(_MSC_VER) && _MSC_VER < 1900 | 204 | #if defined(_MSC_VER) && _MSC_VER < 1900 |
| @@ -207,7 +211,7 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 6 unmodified lines | |||
| 207 | #pragma warning (disable : 4244) // truncation | 211 | #pragma warning (disable : 4244) // truncation |
| 208 | #pragma warning (disable : 4068) // unknown pragma | 212 | #pragma warning (disable : 4068) // unknown pragma |
| 209 | #pragma warning (disable : 4018) // signed/unsigned mismatch | 213 | #pragma warning (disable : 4018) // signed/unsigned mismatch |
| 210 | #endif | 214 | #endif // #ifdef __PLATFORM_WIN32__ |
| 211 | 215 | ||
| 212 | #ifdef __CHIP_MODE__ | 216 | #ifdef __CHIP_MODE__ |
| 213 | #define __DISABLE_MIDI__ | 217 | #define __DISABLE_MIDI__ |
| @@ -1313,11 +1313,23 @@ set_string(ck_set_string) · 1312 unmodified lines | |||
| 1313 | #if defined(__PLATFORM_WIN32__) | 1313 | #if defined(__PLATFORM_WIN32__) |
| 1314 | extern "C" | 1314 | extern "C" |
| 1315 | { | 1315 | { |
| 1316 | #include <windows.h> | 1316 | #ifndef __CHUNREAL_ENGINE__ |
| 1317 | #include <windows.h> | ||
| 1318 | #else | ||
| 1319 | // 1.5.0.0 (ge) | #chunreal | ||
| 1320 | // unreal engine on windows disallows including windows.h | ||
| 1321 | #include "Windows/MinWindows.h" | ||
| 1322 | #endif // #ifndef __CHUNREAL_ENGINE__ | ||
| 1317 | 1323 | ||
| 1318 | void *dlopen( const char *path, int mode ) | 1324 | void *dlopen( const char *path, int mode ) |
| 1319 | { | 1325 | { |
| 1326 | #ifndef __CHUNREAL_ENGINE__ | ||
| 1320 | return (void *)LoadLibrary(path); | 1327 | return (void *)LoadLibrary(path); |
| 1328 | #else | ||
| 1329 | // 1.5.0.0 (ge) | #chunreal; explicitly call ASCII version | ||
| 1330 | // the build envirnment seems to force UNICODE | ||
| 1331 | return (void *)LoadLibraryA(path); | ||
| 1332 | #endif | ||
| 1321 | } | 1333 | } |
| 1322 | 1334 | ||
| 1323 | int dlclose( void *handle ) | 1335 | int dlclose( void *handle ) |
| @@ -56,7 +56,7 @@ Chuck_Frame::Chuck_Frame() · 55 unmodified lines | |||
| 56 | // name: alloc_local() | 56 | // name: alloc_local() |
| 57 | // desc: ... | 57 | // desc: ... |
| 58 | //----------------------------------------------------------------------------- | 58 | //----------------------------------------------------------------------------- |
| 59 | Chuck_Local * Chuck_Frame::alloc_local( t_CKUINT size, const string & name, | 59 | Chuck_Local * Chuck_Frame::alloc_local( t_CKUINT size, const string & theName, |
| 60 | t_CKBOOL is_ref, t_CKBOOL is_obj, t_CKBOOL is_global ) | 60 | t_CKBOOL is_ref, t_CKBOOL is_obj, t_CKBOOL is_global ) |
| 61 | { | 61 | { |
| 62 | // alloc | 62 | // alloc |
| @@ -74,7 +74,7 @@ Chuck_Local * Chuck_Frame::alloc_local( t_CKUINT size, const string & name, · 11 unmodified lines | |||
| 74 | // the next offset | 74 | // the next offset |
| 75 | this->curr_offset += local->size; | 75 | this->curr_offset += local->size; |
| 76 | // name | 76 | // name |
| 77 | local->name = name; | 77 | local->name = theName; |
| 78 | // push the local | 78 | // push the local |
| 79 | this->stack.push_back( local ); | 79 | this->stack.push_back( local ); |
| 80 | 80 | ||
| @@ -69,7 +69,13 @@ Chuck_Instr::Chuck_Instr() · 68 unmodified lines | |||
| 69 | //----------------------------------------------------------------------------- | 69 | //----------------------------------------------------------------------------- |
| 70 | const char * Chuck_Instr::name() const | 70 | const char * Chuck_Instr::name() const |
| 71 | { | 71 | { |
| 72 | return mini_type( typeid(*this).name() ); | 72 | #ifndef __CHUNREAL_ENGINE__ |
| 73 | return mini_type( typeid(*this).name() ); | ||
| 74 | #else | ||
| 75 | // 1.5.0.0 (ge) | #chureal | ||
| 76 | // Unreal Engine seems to disable C++ run time type information | ||
| 77 | return "[chunreal type info disabled]"; | ||
| 78 | #endif // #ifndef __CHUNREAL_ENGINE__ | ||
| 73 | } | 79 | } |
| 74 | 80 | ||
| 75 | 81 | ||
| @@ -3861,15 +3867,15 @@ t_CKBOOL initialize_object( Chuck_Object * object, Chuck_Type * type ) · 3785 unmodified lines | |||
| 3861 | // reference count | 3867 | // reference count |
| 3862 | SAFE_ADD_REF(object->type_ref); | 3868 | SAFE_ADD_REF(object->type_ref); |
| 3863 | // get the size | 3869 | // get the size |
| 3864 | object->size = type->obj_size; | 3870 | object->data_size = type->obj_size; |
| 3865 | // allocate memory | 3871 | // allocate memory |
| 3866 | if( object->size ) | 3872 | if( object->data_size ) |
| 3867 | { | 3873 | { |
| 3868 | // check to ensure enough memory | 3874 | // check to ensure enough memory |
| 3869 | object->data = new t_CKBYTE[object->size]; | 3875 | object->data = new t_CKBYTE[object->data_size]; |
| 3870 | if( !object->data ) goto out_of_memory; | 3876 | if( !object->data ) goto out_of_memory; |
| 3871 | // zero it out | 3877 | // zero it out |
| 3872 | memset( object->data, 0, object->size ); | 3878 | memset( object->data, 0, object->data_size ); |
| 3873 | } | 3879 | } |
| 3874 | else object->data = NULL; | 3880 | else object->data = NULL; |
| 3875 | 3881 | ||
| @@ -5472,7 +5478,7 @@ Chuck_Object * do_alloc_array( Chuck_VM * vm, // REFACTOR-2017: added · 1596 unmodified lines | |||
| 5472 | Chuck_Type * type ) | 5478 | Chuck_Type * type ) |
| 5473 | { | 5479 | { |
| 5474 | // not top level | 5480 | // not top level |
| 5475 | Chuck_Array4 * base = NULL; | 5481 | Chuck_Array4 * theBase = NULL; |
| 5476 | Chuck_Object * next = NULL; | 5482 | Chuck_Object * next = NULL; |
| 5477 | Chuck_Type * typeNext = NULL; | 5483 | Chuck_Type * typeNext = NULL; |
| 5478 | t_CKINT i = 0; | 5484 | t_CKINT i = 0; |
| @@ -5487,8 +5493,8 @@ Chuck_Object * do_alloc_array( Chuck_VM * vm, // REFACTOR-2017: added · 8 unmodified lines | |||
| 5487 | // 1.3.1.0: look at type to use kind instead of size | 5493 | // 1.3.1.0: look at type to use kind instead of size |
| 5488 | if( kind == kindof_INT ) // ISSUE: 64-bit (fixed 1.3.1.0) | 5494 | if( kind == kindof_INT ) // ISSUE: 64-bit (fixed 1.3.1.0) |
| 5489 | { | 5495 | { |
| 5490 | Chuck_Array4 * base = new Chuck_Array4( is_obj, *capacity ); | 5496 | Chuck_Array4 * baseX = new Chuck_Array4( is_obj, *capacity ); |
| 5491 | if( !base ) goto out_of_memory; | 5497 | if( !baseX ) goto out_of_memory; |
| 5492 | 5498 | ||
| 5493 | // if object | 5499 | // if object |
| 5494 | if( is_obj && objs ) | 5500 | if( is_obj && objs ) |
| @@ -5497,59 +5503,59 @@ Chuck_Object * do_alloc_array( Chuck_VM * vm, // REFACTOR-2017: added · 2 unmodified lines | |||
| 5497 | for( i = 0; i < *capacity; i++ ) | 5503 | for( i = 0; i < *capacity; i++ ) |
| 5498 | { | 5504 | { |
| 5499 | // add to array for later allocation | 5505 | // add to array for later allocation |
| 5500 | objs[index++] = base->addr( i ); | 5506 | objs[index++] = baseX->addr( i ); |
| 5501 | } | 5507 | } |
| 5502 | } | 5508 | } |
| 5503 | 5509 | ||
| 5504 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array | 5510 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array |
| 5505 | // for the object->type_ref to contain more specific information | 5511 | // for the object->type_ref to contain more specific information |
| 5506 | initialize_object( base, type ); | 5512 | initialize_object( baseX, type ); |
| 5507 | // initialize_object( base, vm->env()->t_array ); | 5513 | // initialize_object( baseX, vm->env()->t_array ); |
| 5508 | return base; | 5514 | return baseX; |
| 5509 | } | 5515 | } |
| 5510 | else if( kind == kindof_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0) | 5516 | else if( kind == kindof_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0) |
| 5511 | { | 5517 | { |
| 5512 | Chuck_Array8 * base = new Chuck_Array8( *capacity ); | 5518 | Chuck_Array8 * baseX = new Chuck_Array8( *capacity ); |
| 5513 | if( !base ) goto out_of_memory; | 5519 | if( !baseX ) goto out_of_memory; |
| 5514 | 5520 | ||
| 5515 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array | 5521 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array |
| 5516 | // for the object->type_ref to contain more specific information | 5522 | // for the object->type_ref to contain more specific information |
| 5517 | initialize_object( base, type ); | 5523 | initialize_object( baseX, type ); |
| 5518 | // initialize_object( base, vm->env()->t_array ); | 5524 | // initialize_object( baseX, vm->env()->t_array ); |
| 5519 | return base; | 5525 | return baseX; |
| 5520 | } | 5526 | } |
| 5521 | else if( kind == kindof_COMPLEX ) // ISSUE: 64-bit (fixed 1.3.1.0) | 5527 | else if( kind == kindof_COMPLEX ) // ISSUE: 64-bit (fixed 1.3.1.0) |
| 5522 | { | 5528 | { |
| 5523 | Chuck_Array16 * base = new Chuck_Array16( *capacity ); | 5529 | Chuck_Array16 * baseX = new Chuck_Array16( *capacity ); |
| 5524 | if( !base ) goto out_of_memory; | 5530 | if( !baseX ) goto out_of_memory; |
| 5525 | 5531 | ||
| 5526 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array | 5532 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array |
| 5527 | // for the object->type_ref to contain more specific information | 5533 | // for the object->type_ref to contain more specific information |
| 5528 | initialize_object( base, type ); | 5534 | initialize_object( baseX, type ); |
| 5529 | // initialize_object( base, vm->env()->t_array ); | 5535 | // initialize_object( baseX, vm->env()->t_array ); |
| 5530 | return base; | 5536 | return baseX; |
| 5531 | } | 5537 | } |
| 5532 | else if( kind == kindof_VEC3 ) // 1.3.5.3 | 5538 | else if( kind == kindof_VEC3 ) // 1.3.5.3 |
| 5533 | { | 5539 | { |
| 5534 | Chuck_Array24 * base = new Chuck_Array24( *capacity ); | 5540 | Chuck_Array24 * baseX = new Chuck_Array24( *capacity ); |
| 5535 | if( !base ) goto out_of_memory; | 5541 | if( !baseX ) goto out_of_memory; |
| 5536 | 5542 | ||
| 5537 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array | 5543 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array |
| 5538 | // for the object->type_ref to contain more specific information | 5544 | // for the object->type_ref to contain more specific information |
| 5539 | initialize_object( base, type ); | 5545 | initialize_object( baseX, type ); |
| 5540 | // initialize_object( base, vm->env()->t_array ); | 5546 | // initialize_object( baseX, vm->env()->t_array ); |
| 5541 | return base; | 5547 | return baseX; |
| 5542 | } | 5548 | } |
| 5543 | else if( kind == kindof_VEC4 ) // 1.3.5.3 | 5549 | else if( kind == kindof_VEC4 ) // 1.3.5.3 |
| 5544 | { | 5550 | { |
| 5545 | Chuck_Array32 * base = new Chuck_Array32( *capacity ); | 5551 | Chuck_Array32 * baseX = new Chuck_Array32( *capacity ); |
| 5546 | if( !base ) goto out_of_memory; | 5552 | if( !baseX ) goto out_of_memory; |
| 5547 | 5553 | ||
| 5548 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array | 5554 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array |
| 5549 | // for the object->type_ref to contain more specific information | 5555 | // for the object->type_ref to contain more specific information |
| 5550 | initialize_object( base, type ); | 5556 | initialize_object( baseX, type ); |
| 5551 | // initialize_object( base, vm->env()->t_array ); | 5557 | // initialize_object( baseX, vm->env()->t_array ); |
| 5552 | return base; | 5558 | return baseX; |
| 5553 | } | 5559 | } |
| 5554 | 5560 | ||
| 5555 | // shouldn't get here | 5561 | // shouldn't get here |
| @@ -5557,8 +5563,8 @@ Chuck_Object * do_alloc_array( Chuck_VM * vm, // REFACTOR-2017: added · 1 unmodified line | |||
| 5557 | } | 5563 | } |
| 5558 | 5564 | ||
| 5559 | // not top level | 5565 | // not top level |
| 5560 | base = new Chuck_Array4( TRUE, *capacity ); | 5566 | theBase = new Chuck_Array4( TRUE, *capacity ); |
| 5561 | if( !base ) goto out_of_memory; | 5567 | if( !theBase) goto out_of_memory; |
| 5562 | 5568 | ||
| 5563 | // construct type for next array level | 1.5.0.0 (ge) added | 5569 | // construct type for next array level | 1.5.0.0 (ge) added |
| 5564 | typeNext = type->copy( vm->env() ); | 5570 | typeNext = type->copy( vm->env() ); |
| @@ -5575,15 +5581,14 @@ Chuck_Object * do_alloc_array( Chuck_VM * vm, // REFACTOR-2017: added · 10 unmodified lines | |||
| 5575 | // error if NULL | 5581 | // error if NULL |
| 5576 | if( !next ) goto error; | 5582 | if( !next ) goto error; |
| 5577 | // set that, with ref count | 5583 | // set that, with ref count |
| 5578 | base->set( i, (t_CKUINT)next ); | 5584 | theBase->set( i, (t_CKUINT)next ); |
| 5579 | } | 5585 | } |
| 5580 | 5586 | ||
| 5581 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array | 5587 | // initialize object | 1.5.0.0 (ge) use array type instead of base t_array |
| 5582 | // for the object->type_ref to contain more specific information | 5588 | // for the object->type_ref to contain more specific information |
| 5583 | initialize_object( base, type ); | 5589 | initialize_object( theBase, type ); |
| 5584 | // initialize_object( base, vm->env()->t_array ); | 5590 | // initialize_object( theBase, vm->env()->t_array ); |
| 5585 | 5591 | return theBase; | |
| 5586 | return base; | ||
| 5587 | 5592 | ||
| 5588 | internal_error_array_depth: | 5593 | internal_error_array_depth: |
| 5589 | // we have a big problem | 5594 | // we have a big problem |
| @@ -5605,7 +5610,7 @@ negative_array_size: · 15 unmodified lines | |||
| 5605 | 5610 | ||
| 5606 | error: | 5611 | error: |
| 5607 | // base shouldn't have been ref counted | 5612 | // base shouldn't have been ref counted |
| 5608 | SAFE_DELETE( base ); | 5613 | SAFE_DELETE( theBase ); |
| 5609 | return NULL; | 5614 | return NULL; |
| 5610 | } | 5615 | } |
| 5611 | 5616 | ||
| @@ -31,10 +31,10 @@ · 30 unmodified lines | |||
| 31 | //----------------------------------------------------------------------------- | 31 | //----------------------------------------------------------------------------- |
| 32 | #include "chuck_io.h" | 32 | #include "chuck_io.h" |
| 33 | #include "chuck_errmsg.h" | 33 | #include "chuck_errmsg.h" |
| 34 | #include "util_serial.h" | ||
| 35 | #include "chuck_instr.h" | 34 | #include "chuck_instr.h" |
| 36 | #include "chuck_type.h" | 35 | #include "chuck_type.h" |
| 37 | #include "chuck_vm.h" | 36 | #include "chuck_vm.h" |
| 37 | |||
| 38 | #ifndef __DISABLE_HID__ | 38 | #ifndef __DISABLE_HID__ |
| 39 | #include "hidio_sdl.h" | 39 | #include "hidio_sdl.h" |
| 40 | #endif | 40 | #endif |
| @@ -43,6 +43,10 @@ · 2 unmodified lines | |||
| 43 | #include "midiio_rtmidi.h" | 43 | #include "midiio_rtmidi.h" |
| 44 | #endif | 44 | #endif |
| 45 | 45 | ||
| 46 | #ifndef __DISABLE_SERIAL__ | ||
| 47 | #include "util_serial.h" | ||
| 48 | #endif | ||
| 49 | |||
| 46 | #ifndef __PLATFORM_WIN32__ | 50 | #ifndef __PLATFORM_WIN32__ |
| 47 | #include <sys/select.h> | 51 | #include <sys/select.h> |
| 48 | #include <poll.h> | 52 | #include <poll.h> |
| @@ -3308,7 +3312,7 @@ void Chuck_IO_Serial::write( t_CKFLOAT val ) · 3259 unmodified lines | |||
| 3308 | { | 3312 | { |
| 3309 | // assume 4-byte int | 3313 | // assume 4-byte int |
| 3310 | char * buf = (char *) &val; | 3314 | char * buf = (char *) &val; |
| 3311 | // 1.5.0.0 (ge and eito) | changed from size to sizeof | 3315 | // 1.5.0.0 (ge) | fixed from size to sizeof |
| 3312 | fwrite(buf, 1, sizeof(val), m_cfd); | 3316 | fwrite(buf, 1, sizeof(val), m_cfd); |
| 3313 | } | 3317 | } |
| 3314 | } | 3318 | } |
| @@ -157,8 +157,13 @@ void Chuck_VM_Object::release() · 156 unmodified lines | |||
| 157 | *(int *)0 = 1; | 157 | *(int *)0 = 1; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | #ifndef __CHUNREAL_ENGINE__ | ||
| 160 | // log | 1.5.0.0 (ge) added | 161 | // log | 1.5.0.0 (ge) added |
| 161 | EM_log( CK_LOG_FINEST, "reclaiming %s: 0x%08x", typeid(*this).name(), this ); | 162 | EM_log( CK_LOG_FINEST, "reclaiming %s: 0x%08x", typeid(*this).name(), this ); |
| 163 | #else | ||
| 164 | // #chunreal UE seems to disallow real-time type info | ||
| 165 | EM_log( CK_LOG_FINEST, "reclaiming object: 0x%08x", this ); | ||
| 166 | #endif // #ifndef __CHUNREAL_ENGINE__ | ||
| 162 | 167 | ||
| 163 | // tell the object manager to set this free | 168 | // tell the object manager to set this free |
| 164 | // Chuck_VM_Alloc::instance()->free_object( this ); | 169 | // Chuck_VM_Alloc::instance()->free_object( this ); |
| @@ -322,10 +327,10 @@ Chuck_Object::Chuck_Object() · 157 unmodified lines | |||
| 322 | vtable = NULL; | 327 | vtable = NULL; |
| 323 | // zero type | 328 | // zero type |
| 324 | type_ref = NULL; | 329 | type_ref = NULL; |
| 325 | // zero size | ||
| 326 | size = 0; | ||
| 327 | // zero data | 330 | // zero data |
| 328 | data = NULL; | 331 | data = NULL; |
| 332 | // zero size | ||
| 333 | data_size = 0; | ||
| 329 | 334 | ||
| 330 | // add to vm allocator | 335 | // add to vm allocator |
| 331 | // Chuck_VM_Alloc::instance()->add_object( this ); | 336 | // Chuck_VM_Alloc::instance()->add_object( this ); |
| @@ -3038,11 +3043,12 @@ t_CKBOOL Chuck_IO_File::open( const string & path, t_CKINT flags ) · 2706 unmodified lines | |||
| 3038 | mode |= ios_base::binary; | 3043 | mode |= ios_base::binary; |
| 3039 | 3044 | ||
| 3040 | // close first | 3045 | // close first |
| 3041 | if (m_io.is_open()) | 3046 | if( m_io.is_open() ) |
| 3042 | this->close(); | 3047 | this->close(); |
| 3043 | 3048 | ||
| 3044 | // try to open as a dir first (fixed 1.3.0.0 removed warning) | 3049 | // try to open as a dir first (fixed 1.3.0.0 removed warning) |
| 3045 | if( (m_dir = opendir( path.c_str() )) ) | 3050 | m_dir = opendir(path.c_str()); |
| 3051 | if( m_dir ) | ||
| 3046 | { | 3052 | { |
| 3047 | EM_poplog(); | 3053 | EM_poplog(); |
| 3048 | return TRUE; | 3054 | return TRUE; |
| @@ -3050,7 +3056,7 @@ t_CKBOOL Chuck_IO_File::open( const string & path, t_CKINT flags ) · 1 unmodified line | |||
| 3050 | 3056 | ||
| 3051 | // not a dir, create file if it does not exist unless flag is | 3057 | // not a dir, create file if it does not exist unless flag is |
| 3052 | // readonly | 3058 | // readonly |
| 3053 | if ( !(flags & FLAG_READONLY) ) | 3059 | if( !(flags & FLAG_READONLY) ) |
| 3054 | { | 3060 | { |
| 3055 | m_io.open( path.c_str(), ios_base::in ); | 3061 | m_io.open( path.c_str(), ios_base::in ); |
| 3056 | if ( m_io.fail() ) | 3062 | if ( m_io.fail() ) |
| @@ -3319,8 +3325,11 @@ Chuck_Array4 * Chuck_IO_File::dirList() · 262 unmodified lines | |||
| 3319 | // fill vector with entry names | 3325 | // fill vector with entry names |
| 3320 | rewinddir( m_dir ); | 3326 | rewinddir( m_dir ); |
| 3321 | std::vector<Chuck_String *> entrylist; | 3327 | std::vector<Chuck_String *> entrylist; |
| 3322 | struct dirent *ent; | 3328 | |
| 3323 | while( (ent = readdir( m_dir )) ) // fixed 1.3.0.0: removed warning | 3329 | // 1.5.0.0 (ge) | #chunreal UE-forced refactor |
| 3330 | struct dirent * ent = readdir( m_dir ); | ||
| 3331 | // was: while( (ent = readdir( m_dir ) ) <-- in ge's opinion this is cleaner splitting readir() into two places | ||
| 3332 | while( ent != NULL ) // fixed 1.3.0.0: removed warning | ||
| 3324 | { | 3333 | { |
| 3325 | // pass NULL as shred ref | 3334 | // pass NULL as shred ref |
| 3326 | Chuck_String *s = (Chuck_String *)instantiate_and_initialize_object( m_vmRef->env()->t_string, NULL, m_vmRef ); | 3335 | Chuck_String *s = (Chuck_String *)instantiate_and_initialize_object( m_vmRef->env()->t_string, NULL, m_vmRef ); |
| @@ -3330,6 +3339,8 @@ Chuck_Array4 * Chuck_IO_File::dirList() · 3 unmodified lines | |||
| 3330 | // don't include .. and . in the list | 3339 | // don't include .. and . in the list |
| 3331 | entrylist.push_back( s ); | 3340 | entrylist.push_back( s ); |
| 3332 | } | 3341 | } |
| 3342 | // #chunreal refactor | ||
| 3343 | ent = readdir( m_dir ); | ||
| 3333 | } | 3344 | } |
| 3334 | 3345 | ||
| 3335 | // make array | 3346 | // make array |
| @@ -189,10 +189,10 @@ public: · 188 unmodified lines | |||
| 189 | Chuck_VTable * vtable; | 189 | Chuck_VTable * vtable; |
| 190 | // reference to type | 190 | // reference to type |
| 191 | Chuck_Type * type_ref; | 191 | Chuck_Type * type_ref; |
| 192 | // the size of the data region | ||
| 193 | t_CKUINT size; | ||
| 194 | // data for the object | 192 | // data for the object |
| 195 | t_CKBYTE * data; | 193 | t_CKBYTE * data; |
| 194 | // the size of the data region | ||
| 195 | t_CKUINT data_size; | ||
| 196 | }; | 196 | }; |
| 197 | 197 | ||
| 198 | 198 | ||
| @@ -39,8 +39,14 @@ · 38 unmodified lines | |||
| 39 | #endif | 39 | #endif |
| 40 | 40 | ||
| 41 | #ifdef __PLATFORM_WIN32__ | 41 | #ifdef __PLATFORM_WIN32__ |
| 42 | #include <windows.h> // for win32_tmpfile() | 42 | #ifndef __CHUNREAL_ENGINE__ |
| 43 | #endif | 43 | #include <windows.h> // for win32_tmpfile() |
| 44 | #else | ||
| 45 | // 1.5.0.0 (ge) | #chunreal | ||
| 46 | // unreal engine on windows disallows including windows.h | ||
| 47 | #include "Windows/MinWindows.h" | ||
| 48 | #endif // #ifndef __CHUNREAL_ENGINE__ | ||
| 49 | #endif // #ifdef __PLATFORM_WIN32__ | ||
| 44 | 50 | ||
| 45 | using namespace std; | 51 | using namespace std; |
| 46 | 52 | ||
| @@ -76,44 +82,53 @@ FILE * open_cat_ck( c_str fname ) · 29 unmodified lines | |||
| 76 | } | 82 | } |
| 77 | #endif // __ANDROID__ | 83 | #endif // __ANDROID__ |
| 78 | 84 | ||
| 79 | FILE * fd = NULL; | 85 | FILE * fd = fopen(fname, "rb"); |
| 80 | if( !(fd = fopen( fname, "rb" )) ) | 86 | if( !fd ) |
| 87 | { | ||
| 81 | if( !strstr( fname, ".ck" ) && !strstr( fname, ".CK" ) ) | 88 | if( !strstr( fname, ".ck" ) && !strstr( fname, ".CK" ) ) |
| 82 | { | 89 | { |
| 83 | strcat( fname, ".ck" ); | 90 | strcat( fname, ".ck" ); |
| 84 | fd = fopen( fname, "rb" ); | 91 | fd = fopen( fname, "rb" ); |
| 85 | } | 92 | } |
| 93 | } | ||
| 86 | return fd; | 94 | return fd; |
| 87 | } | 95 | } |
| 88 | 96 | ||
| 89 | 97 | ||
| 90 | 98 | ||
| 99 | |||
| 91 | //----------------------------------------------------------------------------- | 100 | //----------------------------------------------------------------------------- |
| 92 | // name: win32_tmpfile() | 101 | // name: win32_tmpfile() |
| 93 | // desc: replacement for broken tmpfile() on Windows Vista + 7 | 102 | // desc: replacement for broken tmpfile() on Windows Vista + 7 |
| 94 | //----------------------------------------------------------------------------- | 103 | //----------------------------------------------------------------------------- |
| 95 | #ifdef __PLATFORM_WIN32__ | 104 | #ifdef __PLATFORM_WIN32__ |
| 96 | |||
| 97 | #include <windows.h> | ||
| 98 | |||
| 99 | FILE *win32_tmpfile() | 105 | FILE *win32_tmpfile() |
| 100 | { | 106 | { |
| 101 | char tmp_path[MAX_PATH]; | 107 | char tmp_path[MAX_PATH]; |
| 102 | char file_path[MAX_PATH]; | 108 | char file_path[MAX_PATH]; |
| 103 | FILE * file = NULL; | 109 | FILE * file = NULL; |
| 104 | 110 | ||
| 105 | if(GetTempPath(256, tmp_path) == 0) | 111 | #ifndef __CHUNREAL_ENGINE__ |
| 112 | if( GetTempPath(256, tmp_path) == 0 ) | ||
| 113 | #else | ||
| 114 | // 1.5.0.0 (ge) | #chunreal explicit call ASCII version | ||
| 115 | if( GetTempPathA(256, tmp_path) == 0 ) | ||
| 116 | #endif | ||
| 106 | return NULL; | 117 | return NULL; |
| 107 | 118 | ||
| 108 | if(GetTempFileName(tmp_path, "mA", 0, file_path) == 0) | 119 | #ifndef __CHUNREAL_ENGINE__ |
| 120 | if( GetTempFileName(tmp_path, "mA", 0, file_path) == 0 ) | ||
| 121 | #else | ||
| 122 | // 1.5.0.0 (ge) | #chunreal explicit call ASCII version | ||
| 123 | if( GetTempFileNameA(tmp_path, "mA", 0, file_path) == 0 ) | ||
| 124 | #endif | ||
| 109 | return NULL; | 125 | return NULL; |
| 110 | 126 | ||
| 111 | file = fopen(file_path, "wb+D"); | 127 | file = fopen( file_path, "wb+D" ); |
| 112 | 128 | ||
| 113 | return file; | 129 | return file; |
| 114 | } | 130 | } |
| 115 | 131 | #endif // #ifdef __PLATFORM_WIN32__ | |
| 116 | #endif | ||
| 117 | 132 | ||
| 118 | 133 | ||
| 119 | 134 | ||
| @@ -2489,7 +2489,8 @@ t_CKBOOL type_engine_scan2_func_def( Chuck_Env * env, a_Func_Def f ) · 2488 unmodified lines | |||
| 2489 | assert( !f->code || f->code->s_type == ae_stmt_code ); | 2489 | assert( !f->code || f->code->s_type == ae_stmt_code ); |
| 2490 | 2490 | ||
| 2491 | // look up the value in the current class (can shadow?) | 2491 | // look up the value in the current class (can shadow?) |
| 2492 | if(( overload = env->curr->lookup_value( f->name, FALSE ) )) | 2492 | overload = env->curr->lookup_value( f->name, FALSE ); |
| 2493 | if( overload ) | ||
| 2493 | { | 2494 | { |
| 2494 | // if value | 2495 | // if value |
| 2495 | if( !isa( overload->type, env->t_function ) ) | 2496 | if( !isa( overload->type, env->t_function ) ) |
| @@ -53,7 +53,7 @@ static S_Symbol mksymbol( c_constr name, S_Symbol next ) · 52 unmodified lines | |||
| 53 | 53 | ||
| 54 | static S_Symbol hashtable[SIZE]; | 54 | static S_Symbol hashtable[SIZE]; |
| 55 | 55 | ||
| 56 | static unsigned int hash(const char *s0) | 56 | static unsigned int s_hash(const char *s0) |
| 57 | { | 57 | { |
| 58 | unsigned int h=0; const char *s; | 58 | unsigned int h=0; const char *s; |
| 59 | for(s=s0; *s; s++) | 59 | for(s=s0; *s; s++) |
| @@ -69,7 +69,7 @@ static int streq(c_constr a, c_constr b) · 9 unmodified lines | |||
| 69 | S_Symbol insert_symbol(c_constr name) | 69 | S_Symbol insert_symbol(c_constr name) |
| 70 | { | 70 | { |
| 71 | S_Symbol syms = NULL, sym; | 71 | S_Symbol syms = NULL, sym; |
| 72 | int index= hash(name) % SIZE; | 72 | int index= s_hash(name) % SIZE; |
| 73 | 73 | ||
| 74 | if( !name ) return NULL; | 74 | if( !name ) return NULL; |
| 75 | syms = hashtable[index]; | 75 | syms = hashtable[index]; |
| @@ -630,19 +630,18 @@ t_CKBOOL Chuck_UGen::remove( Chuck_UGen * src ) · 629 unmodified lines | |||
| 630 | } | 630 | } |
| 631 | 631 | ||
| 632 | // remove | 632 | // remove |
| 633 | for( t_CKUINT i = 0; i < m_num_src; i++ ) | 633 | for( t_CKUINT k = 0; k < m_num_src; k++ ) |
| 634 | if( m_src_list[i] == src ) | 634 | if( m_src_list[k] == src ) |
| 635 | { | 635 | { |
| 636 | ret = TRUE; | 636 | ret = TRUE; |
| 637 | for( t_CKUINT j = i+1; j < m_num_src; j++ ) | 637 | for( t_CKUINT j = k+1; j < m_num_src; j++ ) |
| 638 | m_src_list[j-1] = m_src_list[j]; | 638 | m_src_list[j-1] = m_src_list[j]; |
| 639 | 639 | ||
| 640 | m_src_list[--m_num_src] = NULL; | 640 | m_src_list[--m_num_src] = NULL; |
| 641 | src->remove_by( this ); | 641 | src->remove_by( this ); |
| 642 | src->release(); | 642 | src->release(); |
| 643 | --i; | 643 | --k; |
| 644 | } | 644 | } |
| 645 | |||
| 646 | } | 645 | } |
| 647 | /* else if( outs >= 2 && ins == 1 ) | 646 | /* else if( outs >= 2 && ins == 1 ) |
| 648 | { | 647 | { |
| @@ -866,11 +865,11 @@ t_CKBOOL Chuck_UGen::system_tick( t_CKTIME now ) · 217 unmodified lines | |||
| 866 | if( m_time >= now ) | 865 | if( m_time >= now ) |
| 867 | return m_valid; | 866 | return m_valid; |
| 868 | 867 | ||
| 869 | t_CKUINT i; Chuck_UGen * ugen; SAMPLE multi; | 868 | t_CKUINT i; |
| 870 | 869 | Chuck_UGen * ugen = NULL; | |
| 871 | 870 | SAMPLE multi; | |
| 872 | /*** Part 1: Tick upstream ugens ***/ | ||
| 873 | 871 | ||
| 872 | // part 1: tick upstream ugens | ||
| 874 | // inc time | 873 | // inc time |
| 875 | m_time = now; | 874 | m_time = now; |
| 876 | // initial sum | 875 | // initial sum |
| @@ -957,12 +956,10 @@ t_CKBOOL Chuck_UGen::system_tick( t_CKTIME now ) · 80 unmodified lines | |||
| 957 | 956 | ||
| 958 | 957 | ||
| 959 | 958 | ||
| 960 | /*** Part Two: Synthesize with tick function ***/ | 959 | // part 2: synthesize with tick function |
| 961 | |||
| 962 | if( m_multi_chan_size && tickf ) | 960 | if( m_multi_chan_size && tickf ) |
| 963 | { | 961 | { |
| 964 | /* evaluate multi-channel tickf (added 1.3.0.0) */ | 962 | // evaluate multi-channel tickf (added 1.3.0.0) |
| 965 | |||
| 966 | multi = 0; | 963 | multi = 0; |
| 967 | 964 | ||
| 968 | if( m_op > 0 ) // UGEN_OP_TICK | 965 | if( m_op > 0 ) // UGEN_OP_TICK |
| @@ -1072,15 +1069,15 @@ t_CKBOOL Chuck_UGen::system_tick_v( t_CKTIME now, t_CKUINT numFrames ) · 103 unmodified lines | |||
| 1072 | if( m_time >= now ) | 1069 | if( m_time >= now ) |
| 1073 | return m_valid; | 1070 | return m_valid; |
| 1074 | 1071 | ||
| 1075 | t_CKUINT i, j; Chuck_UGen * ugen; SAMPLE factor; | 1072 | t_CKUINT i, j; |
| 1073 | Chuck_UGen * ugen = NULL; | ||
| 1074 | SAMPLE factor; | ||
| 1076 | SAMPLE multi; | 1075 | SAMPLE multi; |
| 1077 | 1076 | ||
| 1078 | // inc time | 1077 | // inc time |
| 1079 | m_time = now; | 1078 | m_time = now; |
| 1080 | 1079 | ||
| 1081 | 1080 | // part 1: tick upstream ugens | |
| 1082 | /*** Part 1: Tick upstream ugens ***/ | ||
| 1083 | |||
| 1084 | if( m_num_src ) | 1081 | if( m_num_src ) |
| 1085 | { | 1082 | { |
| 1086 | ugen = m_src_list[0]; | 1083 | ugen = m_src_list[0]; |
| @@ -1122,7 +1119,7 @@ t_CKBOOL Chuck_UGen::system_tick_v( t_CKTIME now, t_CKUINT numFrames ) · 35 unmodified lines | |||
| 1122 | // tick multiple channels | 1119 | // tick multiple channels |
| 1123 | if( m_multi_chan_size ) | 1120 | if( m_multi_chan_size ) |
| 1124 | { | 1121 | { |
| 1125 | if(tickf) | 1122 | if( tickf ) |
| 1126 | { | 1123 | { |
| 1127 | // system tick each input channel (added 1.3.0.0) | 1124 | // system tick each input channel (added 1.3.0.0) |
| 1128 | for( int c = 0; c < m_multi_chan_size; c++ ) | 1125 | for( int c = 0; c < m_multi_chan_size; c++ ) |
| @@ -1166,13 +1163,10 @@ t_CKBOOL Chuck_UGen::system_tick_v( t_CKTIME now, t_CKUINT numFrames ) · 37 unmodified lines | |||
| 1166 | } | 1163 | } |
| 1167 | } | 1164 | } |
| 1168 | 1165 | ||
| 1169 | 1166 | // part 2: synthesize with tick function | |
| 1170 | /*** Part Two: Synthesize with tick function ***/ | ||
| 1171 | |||
| 1172 | if( m_multi_chan_size && tickf ) | 1167 | if( m_multi_chan_size && tickf ) |
| 1173 | { | 1168 | { |
| 1174 | /* evaluate multi-channel tick (added added 1.3.0.0) */ | 1169 | // evaluate multi-channel tick (added added 1.3.0.0) |
| 1175 | |||
| 1176 | if( m_op > 0) // UGEN_OP_TICK | 1170 | if( m_op > 0) // UGEN_OP_TICK |
| 1177 | { | 1171 | { |
| 1178 | // compute samples with tickf | 1172 | // compute samples with tickf |
| @@ -1250,8 +1244,7 @@ t_CKBOOL Chuck_UGen::system_tick_v( t_CKTIME now, t_CKUINT numFrames ) · 71 unmodified lines | |||
| 1250 | } | 1244 | } |
| 1251 | else | 1245 | else |
| 1252 | { | 1246 | { |
| 1253 | /* evaluate single-channel tick */ | 1247 | // evaluate single-channel tick |
| 1254 | |||
| 1255 | if( m_op > 0 ) // UGEN_OP_TICK | 1248 | if( m_op > 0 ) // UGEN_OP_TICK |
| 1256 | { | 1249 | { |
| 1257 | // tick the ugen (Chuck_DL_Api::Api::instance() added 1.3.0.0) | 1250 | // tick the ugen (Chuck_DL_Api::Api::instance() added 1.3.0.0) |
| @@ -35,12 +35,12 @@ · 34 unmodified lines | |||
| 35 | #include "chuck_type.h" | 35 | #include "chuck_type.h" |
| 36 | #include "chuck_dl.h" | 36 | #include "chuck_dl.h" |
| 37 | #include "chuck_globals.h" // added 1.4.1.0 (jack) | 37 | #include "chuck_globals.h" // added 1.4.1.0 (jack) |
| 38 | #include "chuck_errmsg.h" | ||
| 38 | 39 | ||
| 39 | #ifndef __DISABLE_SERIAL__ | 40 | #ifndef __DISABLE_SERIAL__ |
| 40 | #include "chuck_io.h" | 41 | #include "chuck_io.h" |
| 41 | #endif | 42 | #endif |
| 42 | 43 | ||
| 43 | #include "chuck_errmsg.h" | ||
| 44 | #include "ugen_xxx.h" | 44 | #include "ugen_xxx.h" |
| 45 | #include "util_buffers.h" | 45 | #include "util_buffers.h" |
| 46 | 46 | ||
| @@ -56,11 +56,16 @@ · 9 unmodified lines | |||
| 56 | using namespace std; | 56 | using namespace std; |
| 57 | 57 | ||
| 58 | #if defined(__PLATFORM_WIN32__) | 58 | #if defined(__PLATFORM_WIN32__) |
| 59 | #include <windows.h> | 59 | #ifndef __CHUNREAL_ENGINE__ |
| 60 | #include <windows.h> | ||
| 61 | #else | ||
| 62 | // 1.5.0.0 (ge) | #chunreal | ||
| 63 | #include "Windows/MinWindows.h" | ||
| 64 | #endif // #ifndef __CHUNREAL_ENGINE__ | ||
| 60 | #else | 65 | #else |
| 61 | #include <unistd.h> | 66 | #include <unistd.h> |
| 62 | #include <pthread.h> | 67 | #include <pthread.h> |
| 63 | #endif | 68 | #endif // #if defined(__PLATFORM_WIN32__) |
| 64 | 69 | ||
| 65 | // uncomment to compile VM debug messages | 70 | // uncomment to compile VM debug messages |
| 66 | #define CK_VM_DEBUG_ENABLE (0) | 71 | #define CK_VM_DEBUG_ENABLE (0) |
| @@ -484,15 +489,16 @@ t_CKBOOL Chuck_VM::compute() · 417 unmodified lines | |||
| 484 | // global manager added 1.4.1.0 (jack) | 489 | // global manager added 1.4.1.0 (jack) |
| 485 | m_globals_manager->handle_global_queue_messages(); | 490 | m_globals_manager->handle_global_queue_messages(); |
| 486 | 491 | ||
| 487 | // iteration until no more shreds/events/messages | 492 | // iterate until no more shreds/events/messages |
| 488 | while( iterate ) | 493 | while( iterate ) |
| 489 | { | 494 | { |
| 490 | // get the shreds queued for 'now' | 495 | // get the shreds queued for 'now' |
| 491 | while(( shred = m_shreduler->get() )) | 496 | shred = m_shreduler->get(); |
| 497 | // run all shreds waiting to run 'now' | ||
| 498 | while( shred != NULL ) | ||
| 492 | { | 499 | { |
| 493 | // set the current time of the shred | 500 | // set the current time of the shred |
| 494 | shred->now = shred->wake_time; | 501 | shred->now = shred->wake_time; |
| 495 | |||
| 496 | // track shred activation | 502 | // track shred activation |
| 497 | CK_TRACK( Chuck_Stats::instance()->activate_shred( shred ) ); | 503 | CK_TRACK( Chuck_Stats::instance()->activate_shred( shred ) ); |
| 498 | 504 | ||
| @@ -510,9 +516,8 @@ t_CKBOOL Chuck_VM::compute() · 11 unmodified lines | |||
| 510 | 516 | ||
| 511 | // track shred deactivation | 517 | // track shred deactivation |
| 512 | CK_TRACK( if( shred ) Chuck_Stats::instance()->deactivate_shred( shred ) ); | 518 | CK_TRACK( if( shred ) Chuck_Stats::instance()->deactivate_shred( shred ) ); |
| 513 | 519 | // get next shred queued for 'now' | |
| 514 | // zero out | 520 | shred = m_shreduler->get(); |
| 515 | shred = NULL; | ||
| 516 | } | 521 | } |
| 517 | 522 | ||
| 518 | // set to false for now | 523 | // set to false for now |
| @@ -2385,8 +2390,8 @@ void Chuck_VM_Shreduler::status( Chuck_VM_Status * status ) · 1866 unmodified lines | |||
| 2385 | } | 2390 | } |
| 2386 | 2391 | ||
| 2387 | // get current shred | 2392 | // get current shred |
| 2388 | if( ( temp = m_current_shred ) ) | 2393 | temp = m_current_shred; |
| 2389 | list.push_back( temp ); | 2394 | if( temp ) list.push_back( temp ); |
| 2390 | 2395 | ||
| 2391 | // sort the list | 2396 | // sort the list |
| 2392 | SortByID byid; | 2397 | SortByID byid; |
| @@ -56,7 +56,16 @@ · 55 unmodified lines | |||
| 56 | #ifndef DIRENT_H | 56 | #ifndef DIRENT_H |
| 57 | #define DIRENT_H | 57 | #define DIRENT_H |
| 58 | 58 | ||
| 59 | #include <windows.h> | 59 | |
| 60 | // assume windows... | ||
| 61 | #ifndef __CHUNREAL_ENGINE__ | ||
| 62 | #include <windows.h> | ||
| 63 | #else | ||
| 64 | // 1.5.0.0 (ge) | #chunreal | ||
| 65 | // unreal engine on windows disallows including windows.h | ||
| 66 | #include "Windows/MinWindows.h" | ||
| 67 | #endif // #ifndef __CHUNREAL_ENGINE__ | ||
| 68 | |||
| 60 | #include <string.h> | 69 | #include <string.h> |
| 61 | #include <assert.h> | 70 | #include <assert.h> |
| 62 | 71 | ||