diff --git a/README.md b/README.md index 53b44b217..1797ac7a3 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ navigate to the `chuck/src` directory, and run `make`: cd chuck/src make mac ``` -OR to build a universal binary (intel + apple sillicon): +OR to build a universal binary (intel + apple silicon): ``` make mac-ub ``` diff --git a/src/core/chuck_dl.cpp b/src/core/chuck_dl.cpp index b2ee323f9..69628ef61 100644 --- a/src/core/chuck_dl.cpp +++ b/src/core/chuck_dl.cpp @@ -1930,6 +1930,80 @@ static t_CKBOOL CK_DLL_CALL ck_array_int_get_key( Chuck_DL_Api::ArrayInt a, cons +//----------------------------------------------------------------------------- +// name: ck_array_float_size() +// desc: get size of an array | 1.5.1.8 (nshaheed) added +//----------------------------------------------------------------------------- +static t_CKBOOL CK_DLL_CALL ck_array_float_size( Chuck_DL_Api::ArrayFloat a, t_CKINT & value ) +{ + // default value + value = 0; + // check + if( a == NULL ) return FALSE; + + // cast to array_float + Chuck_ArrayFloat * array = (Chuck_ArrayFloat *)a; + + value = array->size(); + return TRUE; +} + + + + +//----------------------------------------------------------------------------- +// name: ck_array_float_push_back() +// desc: push back an element into an array | 1.5.1.8 (nshaheed) added +//----------------------------------------------------------------------------- +static t_CKBOOL CK_DLL_CALL ck_array_float_push_back( Chuck_DL_Api::ArrayFloat a, t_CKFLOAT value ) +{ + // check + if( a == NULL ) return FALSE; + // cast to array_float + Chuck_ArrayFloat * array = (Chuck_ArrayFloat *)a; + // action + array->push_back( value ); + // done + return TRUE; +} + + + + +//----------------------------------------------------------------------------- +// name: ck_array_float_get_idx() +// desc: get an indexed element from an array | 1.5.1.8 (nshaheed) added +//----------------------------------------------------------------------------- +static t_CKBOOL CK_DLL_CALL ck_array_float_get_idx( Chuck_DL_Api::ArrayFloat a, t_CKINT idx, t_CKFLOAT & value ) +{ + // check + if( a == NULL ) return FALSE; + // cast to array_float + Chuck_ArrayFloat * array = (Chuck_ArrayFloat *)a; + // action + return array->get( idx, &value ); +} + + + + +//----------------------------------------------------------------------------- +// name: ck_array_float_get() +// desc: get a keyed element from an array | 1.5.1.8 (nshaheed) added +//----------------------------------------------------------------------------- +static t_CKBOOL CK_DLL_CALL ck_array_float_get_key( Chuck_DL_Api::ArrayFloat a, const std::string& key, t_CKFLOAT & value ) +{ + // check + if( a == NULL ) return FALSE; + // cast to array_float + Chuck_ArrayFloat * array = (Chuck_ArrayFloat *)a; + // action + return array->get( key, &value ); +} + + + + //----------------------------------------------------------------------------- // constructor for the VMApi; connects function pointers to host-side impl //----------------------------------------------------------------------------- @@ -1970,7 +2044,11 @@ set_string(ck_set_string), array_int_size(ck_array_int_size), array_int_push_back(ck_array_int_push_back), array_int_get_idx(ck_array_int_get_idx), -array_int_get_key(ck_array_int_get_key) +array_int_get_key(ck_array_int_get_key), +array_float_size(ck_array_float_size), +array_float_push_back(ck_array_float_push_back), +array_float_get_idx(ck_array_float_get_idx), +array_float_get_key(ck_array_float_get_key) { } diff --git a/src/core/chuck_dl.h b/src/core/chuck_dl.h index 750d393fe..3759b0693 100644 --- a/src/core/chuck_dl.h +++ b/src/core/chuck_dl.h @@ -839,6 +839,7 @@ struct Chuck_DL_Api typedef Chuck_Type * Type; typedef Chuck_String * String; typedef Chuck_ArrayInt * ArrayInt; // 1.5.0.1 (ge) added + typedef Chuck_ArrayFloat * ArrayFloat; // 1.5.1.8 (nshaheed) added public: static Chuck_DL_Api g_api; @@ -916,6 +917,11 @@ struct Chuck_DL_Api t_CKBOOL (CK_DLL_CALL * const array_int_push_back)( ArrayInt array, t_CKUINT value ); t_CKBOOL (CK_DLL_CALL * const array_int_get_idx)( ArrayInt array, t_CKINT idx, t_CKUINT & value ); t_CKBOOL (CK_DLL_CALL * const array_int_get_key)( ArrayInt array, const std::string & key, t_CKUINT & value ); + // array_float operations + t_CKBOOL (CK_DLL_CALL * const array_float_size)( ArrayFloat array, t_CKINT & value ); + t_CKBOOL (CK_DLL_CALL * const array_float_push_back)( ArrayFloat array, t_CKFLOAT value ); + t_CKBOOL (CK_DLL_CALL * const array_float_get_idx)( ArrayFloat array, t_CKINT idx, t_CKFLOAT & value ); + t_CKBOOL (CK_DLL_CALL * const array_float_get_key)( ArrayFloat array, const std::string & key, t_CKFLOAT & value ); } * const object; // access to host-side chuck types diff --git a/src/core/chuck_emit.cpp b/src/core/chuck_emit.cpp index 2171d3e38..6bcb8926b 100644 --- a/src/core/chuck_emit.cpp +++ b/src/core/chuck_emit.cpp @@ -1886,15 +1886,15 @@ t_CKBOOL emit_engine_emit_exp( Chuck_Emitter * emit, a_Exp exp, t_CKBOOL doAddRe if( isobj( emit->env, exp->func_call.ret_type ) ) { // the return needs to be released (later at the end of the stmt that contains this) - Chuck_Instr_Stmt_Start * start = emit->stmt_stack.size() ? emit->stmt_stack.back() : NULL; + Chuck_Instr_Stmt_Start * onStack = emit->stmt_stack.size() ? emit->stmt_stack.back() : NULL; // check it - if( start ) + if( onStack ) { t_CKUINT offset = 0; // acquire next offset - if( !start->nextOffset( offset ) ) return FALSE; + if( !onStack->nextOffset( offset ) ) return FALSE; // append instruction - emit->append( new Chuck_Instr_Stmt_Remember_Object( start, offset ) ); + emit->append( new Chuck_Instr_Stmt_Remember_Object( onStack, offset ) ); } } break; diff --git a/src/core/chuck_vm.cpp b/src/core/chuck_vm.cpp index c119d3aa7..1cbadb0ba 100644 --- a/src/core/chuck_vm.cpp +++ b/src/core/chuck_vm.cpp @@ -1488,12 +1488,12 @@ static void ckvm_process_watcher( t_CKBOOL add, list & // name: subscribe_watcher() | 1.5.1.5 // desc: subscribe shreds watcher callback //----------------------------------------------------------------------------- -void Chuck_VM::subscribe_watcher( f_shreds_watcher cb, t_CKUINT options, void * data ) +void Chuck_VM::subscribe_watcher( f_shreds_watcher cb, t_CKUINT options, void * userdata ) { // check if( !cb ) return; // watcher bundle - Chuck_VM_Shreds_Watcher w( cb, data ); + Chuck_VM_Shreds_Watcher w( cb, userdata ); // check options and subscribe the watcher ckvm_process_watcher( options & CKVM_SHREDS_WATCH_SPORK, m_shreds_watchers_spork, w ); ckvm_process_watcher( options & CKVM_SHREDS_WATCH_REMOVE, m_shreds_watchers_remove, w ); diff --git a/src/core/chuck_vm.h b/src/core/chuck_vm.h index 2d7c34479..9adb9bd3e 100644 --- a/src/core/chuck_vm.h +++ b/src/core/chuck_vm.h @@ -635,7 +635,7 @@ struct Chuck_VM : public Chuck_Object public: // subscribe shreds watcher callback | 1.5.1.5 - void subscribe_watcher( f_shreds_watcher cb, t_CKUINT options, void * data = NULL ); + void subscribe_watcher( f_shreds_watcher cb, t_CKUINT options, void * userdata = NULL ); // notify watchers | 1.5.1.5 void notify_watchers( ckvmShredsWatcherFlag which, Chuck_VM_Shred * shred, std::list & v );