rename _piKey to pvApiCtx for compatibility with api of scilab 5 34/6134/3
Antoine ELIAS [Wed, 1 Feb 2012 14:00:54 +0000 (15:00 +0100)]
Change-Id: I1ace2da868deb96edbc12f023e5a8e856fd52912

219 files changed:
scilab/modules/api_scilab/api_scilab_header.def
scilab/modules/api_scilab/includes/api_oldstack.h
scilab/modules/api_scilab/src/cpp/api_oldstack.cpp
scilab/modules/boolean/sci_gateway/c/sci_and.c
scilab/modules/boolean/sci_gateway/c/sci_or.c
scilab/modules/console/includes/gw_console.h
scilab/modules/console/sci_gateway/c/sci_lines.c
scilab/modules/core/includes/gw_core.h
scilab/modules/core/sci_gateway/c/sci_errclear.c
scilab/modules/core/sci_gateway/c/sci_format.c
scilab/modules/core/sci_gateway/c/sci_funcprot.c
scilab/modules/core/sci_gateway/c/sci_getdebuginfo.c
scilab/modules/core/sci_gateway/c/sci_newfun.c
scilab/modules/core/sci_gateway/c/sci_predef.c
scilab/modules/core/sci_gateway/c/sci_type.c
scilab/modules/core/sci_gateway/c/sci_typename.c
scilab/modules/core/sci_gateway/cpp/sci_getversion.cpp
scilab/modules/dynamic_link/sci_gateway/cpp/sci_getdynlibext.cpp
scilab/modules/dynamic_link/sci_gateway/cpp/sci_ilib_verbose.cpp
scilab/modules/elementary_functions/sci_gateway/c/sci_abs.c
scilab/modules/elementary_functions/sci_gateway/c/sci_acos.c
scilab/modules/elementary_functions/sci_gateway/c/sci_asin.c
scilab/modules/elementary_functions/sci_gateway/c/sci_atan.c
scilab/modules/elementary_functions/sci_gateway/c/sci_ceil.c
scilab/modules/elementary_functions/sci_gateway/c/sci_clean.c
scilab/modules/elementary_functions/sci_gateway/c/sci_conj.c
scilab/modules/elementary_functions/sci_gateway/c/sci_cos.c
scilab/modules/elementary_functions/sci_gateway/c/sci_cumprod.c
scilab/modules/elementary_functions/sci_gateway/c/sci_cumsum.c
scilab/modules/elementary_functions/sci_gateway/c/sci_diag.c
scilab/modules/elementary_functions/sci_gateway/c/sci_dsearch.c
scilab/modules/elementary_functions/sci_gateway/c/sci_exp.c
scilab/modules/elementary_functions/sci_gateway/c/sci_expm.c
scilab/modules/elementary_functions/sci_gateway/c/sci_floor.c
scilab/modules/elementary_functions/sci_gateway/c/sci_frexp.c
scilab/modules/elementary_functions/sci_gateway/c/sci_gsort.c
scilab/modules/elementary_functions/sci_gateway/c/sci_imag.c
scilab/modules/elementary_functions/sci_gateway/c/sci_imult.c
scilab/modules/elementary_functions/sci_gateway/c/sci_int.c
scilab/modules/elementary_functions/sci_gateway/c/sci_isreal.c
scilab/modules/elementary_functions/sci_gateway/c/sci_kron.c
scilab/modules/elementary_functions/sci_gateway/c/sci_log.c
scilab/modules/elementary_functions/sci_gateway/c/sci_log1p.c
scilab/modules/elementary_functions/sci_gateway/c/sci_matrix.c
scilab/modules/elementary_functions/sci_gateway/c/sci_maxi.c
scilab/modules/elementary_functions/sci_gateway/c/sci_nearfloat.c
scilab/modules/elementary_functions/sci_gateway/c/sci_number_properties.c
scilab/modules/elementary_functions/sci_gateway/c/sci_prod.c
scilab/modules/elementary_functions/sci_gateway/c/sci_real.c
scilab/modules/elementary_functions/sci_gateway/c/sci_round.c
scilab/modules/elementary_functions/sci_gateway/c/sci_sign.c
scilab/modules/elementary_functions/sci_gateway/c/sci_sin.c
scilab/modules/elementary_functions/sci_gateway/c/sci_sqrt.c
scilab/modules/elementary_functions/sci_gateway/c/sci_tan.c
scilab/modules/elementary_functions/sci_gateway/c/sci_testmatrix.c
scilab/modules/elementary_functions/sci_gateway/c/sci_tril.c
scilab/modules/elementary_functions/sci_gateway/c/sci_triu.c
scilab/modules/fileio/sci_gateway/c/sci_chdir.c
scilab/modules/fileio/sci_gateway/c/sci_copyfile.c
scilab/modules/fileio/sci_gateway/c/sci_fprintfMat.c
scilab/modules/fileio/sci_gateway/c/sci_fscanfMat.c
scilab/modules/fileio/sci_gateway/c/sci_movefile.c
scilab/modules/fileio/sci_gateway/c/sci_pwd.c
scilab/modules/fileio/sci_gateway/c/sci_tempname.c
scilab/modules/fileio/sci_gateway/cpp/sci_basename.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_fileparts.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_isfile.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_pathconvert.cpp
scilab/modules/functions/includes/gw_functions.h
scilab/modules/functions/sci_gateway/c/sci_lib.c
scilab/modules/functions/sci_gateway/c/sci_libraryinfo.c
scilab/modules/gui/includes/gw_gui.h
scilab/modules/gui/sci_gateway/cpp/sci_about.cpp
scilab/modules/gui/sci_gateway/cpp/sci_toprint.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_export_to_hdf5.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_import_from_hdf5.cpp
scilab/modules/helptools/includes/gw_helptools.h
scilab/modules/helptools/sci_gateway/cpp/sci_buildDocv2.cpp
scilab/modules/integer/includes/gw_integer.h
scilab/modules/integer/sci_gateway/c/sci_int.c
scilab/modules/io/includes/gw_io.h
scilab/modules/io/sci_gateway/c/sci_getenv.c
scilab/modules/io/sci_gateway/c/sci_setenv.c
scilab/modules/io/sci_gateway/cpp/sci_file.cpp
scilab/modules/jvm/includes/gw_jvm.h
scilab/modules/jvm/sci_gateway/c/sci_javaclasspath.c
scilab/modules/linear_algebra/includes/gw_linear_algebra.h
scilab/modules/matio/includes/gw_matio.h
scilab/modules/matio/sci_gateway/c/sci_matfile_close.c
scilab/modules/matio/sci_gateway/c/sci_matfile_listvar.c
scilab/modules/matio/sci_gateway/c/sci_matfile_open.c
scilab/modules/matio/sci_gateway/c/sci_matfile_varreadnext.c
scilab/modules/matio/sci_gateway/c/sci_matfile_varwrite.c
scilab/modules/matio/src/c/CreateBooleanVariable.c
scilab/modules/matio/src/c/CreateCellVariable.c
scilab/modules/matio/src/c/CreateCharVariable.c
scilab/modules/matio/src/c/CreateDoubleVariable.c
scilab/modules/matio/src/c/CreateHyperMatrixVariable.c
scilab/modules/matio/src/c/CreateIntegerVariable.c
scilab/modules/matio/src/c/CreateMatlabVariable.c
scilab/modules/matio/src/c/CreateMatlabVariable.h
scilab/modules/matio/src/c/CreateSparseVariable.c
scilab/modules/matio/src/c/CreateStructVariable.c
scilab/modules/matio/src/c/GetCellVariable.c
scilab/modules/matio/src/c/GetCharVariable.c
scilab/modules/matio/src/c/GetDoubleVariable.c
scilab/modules/matio/src/c/GetIntegerVariable.c
scilab/modules/matio/src/c/GetMatlabVariable.c
scilab/modules/matio/src/c/GetMatlabVariable.h
scilab/modules/matio/src/c/GetMlistVariable.c
scilab/modules/matio/src/c/GetSparseVariable.c
scilab/modules/matio/src/c/GetStructVariable.c
scilab/modules/output_stream/sci_gateway/cpp/sci_diary.cpp
scilab/modules/output_stream/src/c/api_scilab_Import.def
scilab/modules/parallel/includes/gw_parallel.h
scilab/modules/parallel/sci_gateway/c/sci_parallel_concurrency.c
scilab/modules/parallel/src/cpp/parallel_run.hxx
scilab/modules/scinotes/includes/gw_scinotes.h
scilab/modules/scinotes/sci_gateway/cpp/sci_closeSciNotesFromScilab.cpp
scilab/modules/scinotes/sci_gateway/cpp/sci_scinotes.cpp
scilab/modules/signal_processing/sci_gateway/c/sci_amell.c
scilab/modules/signal_processing/sci_gateway/c/sci_remez.c
scilab/modules/sound/includes/gw_sound.h
scilab/modules/sound/sci_gateway/c/sci_PlaySound.c
scilab/modules/sound/sci_gateway/c/sci_beep.c
scilab/modules/sparse/includes/gw_sparse.h
scilab/modules/sparse/sci_gateway/c/sci_spmax.c
scilab/modules/sparse/sci_gateway/c/sci_spmin.c
scilab/modules/special_functions/includes/gw_special_functions.h
scilab/modules/special_functions/sci_gateway/c/sci_dlgamma.c
scilab/modules/special_functions/sci_gateway/c/sci_gamma.c
scilab/modules/special_functions/sci_gateway/c/sci_lgamma.c
scilab/modules/statistics/includes/CdfBase.h
scilab/modules/statistics/includes/sci_string_matrix.h
scilab/modules/statistics/sci_gateway/c/sci_cdfbet.c
scilab/modules/statistics/sci_gateway/c/sci_cdfbin.c
scilab/modules/statistics/sci_gateway/c/sci_cdfchi.c
scilab/modules/statistics/sci_gateway/c/sci_cdfchn.c
scilab/modules/statistics/sci_gateway/c/sci_cdff.c
scilab/modules/statistics/sci_gateway/c/sci_cdffnc.c
scilab/modules/statistics/sci_gateway/c/sci_cdfgam.c
scilab/modules/statistics/sci_gateway/c/sci_cdfnbn.c
scilab/modules/statistics/sci_gateway/c/sci_cdfnor.c
scilab/modules/statistics/sci_gateway/c/sci_cdfpoi.c
scilab/modules/statistics/sci_gateway/c/sci_cdft.c
scilab/modules/statistics/src/c/CdfBase.c
scilab/modules/statistics/src/c/sci_string_matrix.c
scilab/modules/string/sci_gateway/c/sci_isalphanum.c
scilab/modules/string/sci_gateway/c/sci_isascii.c
scilab/modules/string/sci_gateway/c/sci_isdigit.c
scilab/modules/string/sci_gateway/c/sci_strsplit.c
scilab/modules/time/includes/gw_time.h
scilab/modules/time/sci_gateway/c/sci_calendar.c
scilab/modules/time/sci_gateway/c/sci_getdate.c
scilab/modules/time/sci_gateway/c/sci_realtime.c
scilab/modules/time/sci_gateway/c/sci_sleep.c
scilab/modules/time/sci_gateway/c/sci_timer.c
scilab/modules/time/sci_gateway/c/sci_xpause.c
scilab/modules/types/includes/c_gateway_prototype.h
scilab/modules/ui_data/sci_gateway/cpp/sci_browsevar.cpp
scilab/modules/ui_data/sci_gateway/cpp/sci_editvar.cpp
scilab/modules/windows_tools/includes/gw_windows_tools.h
scilab/modules/windows_tools/sci_gateway/c/sci_dos.c
scilab/modules/windows_tools/sci_gateway/c/sci_win64.c
scilab/modules/windows_tools/sci_gateway/c/sci_winqueryreg.c
scilab/modules/xcos/includes/gw_xcos.h
scilab/modules/xcos/includes/xcosUtilities.hxx
scilab/modules/xcos/sci_gateway/cpp/sci_Xcos.cpp
scilab/modules/xcos/sci_gateway/cpp/sci_warnBlockByUID.cpp
scilab/modules/xcos/sci_gateway/cpp/sci_xcosConfigureXmlFile.cpp
scilab/modules/xcos/sci_gateway/cpp/sci_xcosDiagramToHDF5.cpp
scilab/modules/xcos/sci_gateway/cpp/sci_xcosPalCategoryAdd.cpp
scilab/modules/xcos/sci_gateway/cpp/sci_xcosPalDelete.cpp
scilab/modules/xcos/sci_gateway/cpp/sci_xcosPalDisable.cpp
scilab/modules/xcos/sci_gateway/cpp/sci_xcosPalEnable.cpp
scilab/modules/xcos/sci_gateway/cpp/sci_xcosPalGenerateIcon.cpp
scilab/modules/xcos/sci_gateway/cpp/sci_xcosPalLoad.cpp
scilab/modules/xcos/sci_gateway/cpp/sci_xcosPalMove.cpp
scilab/modules/xcos/src/cpp/xcosUtilities.cpp
scilab/modules/xml/includes/xml_mlist.h
scilab/modules/xml/sci_gateway/cpp/sci_extraction.cpp
scilab/modules/xml/sci_gateway/cpp/sci_insertion.cpp
scilab/modules/xml/sci_gateway/cpp/sci_percent_XMLAttr_e.cpp
scilab/modules/xml/sci_gateway/cpp/sci_percent_XMLAttr_length.cpp
scilab/modules/xml/sci_gateway/cpp/sci_percent_XMLAttr_size.cpp
scilab/modules/xml/sci_gateway/cpp/sci_percent_XMLList_e.cpp
scilab/modules/xml/sci_gateway/cpp/sci_percent_XMLList_length.cpp
scilab/modules/xml/sci_gateway/cpp/sci_percent_XMLList_size.cpp
scilab/modules/xml/sci_gateway/cpp/sci_percent_c_i_XMLAttr.cpp
scilab/modules/xml/sci_gateway/cpp/sci_percent_foo_i_XMLList.cpp
scilab/modules/xml/sci_gateway/cpp/sci_percent_s_i_XMLList.cpp
scilab/modules/xml/sci_gateway/cpp/sci_print.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlAddNs.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlAsNumber.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlAsText.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlDelete.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlDocument.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlDump.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlElement.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlGetNsByHref.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlGetNsByPrefix.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlGetOpenDocs.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlIsValidObject.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlNs.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlRead.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlReadStr.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlRemove.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlSetAttributes.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlValidate.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlValidationFile.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlWrite.cpp
scilab/modules/xml/sci_gateway/cpp/sci_xmlXPath.cpp
scilab/modules/xml/src/c/XMLMlistsManagement.c
scilab/modules/xml/src/cpp/XMLList_insertion.hpp
scilab/modules/xml/src/cpp/XMLObject.cpp
scilab/modules/xml/src/cpp/XMLObject.hxx
scilab/modules/xml/src/cpp/XMLRhsValue.hxx
scilab/modules/xml/src/cpp/extraction.hpp
scilab/modules/xml/src/cpp/insertion.hpp

index d19faaa..10da066 100644 (file)
@@ -6,4 +6,3 @@ EXPORTS
 ; --------------------------------------- 
 ; api_scilab explicit export (SEP 35)
 ; --------------------------------------- 
-pvApiCtx DATA
index 020bc0c..b9a5661 100644 (file)
@@ -23,50 +23,50 @@ static int api_fake_int = 0;
 /*  TOP  */
 #ifdef Top
 #undef Top
-#define Top api_Top(_piKey)
+#define Top api_Top(pvApiCtx)
 #endif
-int api_Top(int* _piKey);
+int api_Top(void* pvApiCtx);
 
 /*  RHS  */
 #ifdef Rhs
 #undef Rhs
-#define Rhs api_Rhs(_piKey)
+#define Rhs api_Rhs(pvApiCtx)
 #endif
-int api_Rhs(int* _piKey);
+int api_Rhs(void* pvApiCtx);
 
 /*  LHS  */
 #ifdef Lhs
 #undef Lhs
-#define Lhs api_Lhs(_piKey)
+#define Lhs api_Lhs(pvApiCtx)
 #endif
-int api_Lhs(int* _piKey);
+int api_Lhs(void* pvApiCtx);
 
 /*  CheckRhs  */
 #ifdef CheckRhs
 #undef CheckRhs
 #define CheckRhs(a,b) \
-       if(api_CheckRhs(a,b, _piKey) == 0) \
+       if(api_CheckRhs(a,b, pvApiCtx) == 0) \
        { \
                return 1; \
        }
 #endif
-int api_CheckRhs(int _iMin, int _iMax, int* _piKey);
+int api_CheckRhs(int _iMin, int _iMax, void* pvApiCtx);
 
 /*  CheckLhs  */
 #ifdef CheckLhs
 #undef CheckLhs
 #define CheckLhs(a,b) \
-       if(api_CheckLhs(a,b, _piKey) == 0) \
+       if(api_CheckLhs(a,b, pvApiCtx) == 0) \
        { \
                return 1; \
        }
 #endif
-int api_CheckLhs(int _iMin, int _iMax, int* _piKey);
+int api_CheckLhs(int _iMin, int _iMax, void* pvApiCtx);
 
 //LhsVar(1) = Rhs + 1;
 #ifdef LhsVar
 #undef LhsVar
-#define LhsVar(x) *api_LhsVar(x, _piKey)
+#define LhsVar(x) *api_LhsVar(x, pvApiCtx)
 #endif
 int* api_LhsVar(int _iVal, void* _pvCtx);
 
@@ -77,9 +77,9 @@ int* api_LhsVar(int _iVal, void* _pvCtx);
 
 #ifdef OverLoad
 #undef OverLoad
-#define OverLoad(x) api_OverLoad(x, _piKey)
+#define OverLoad(x) api_OverLoad(x, pvApiCtx)
 #endif
-void api_OverLoad(int _iVal, int *_piKey);
+void api_OverLoad(int _iVal, void* pvApiCtx);
 
 #ifdef __cplusplus
 }
index 3c473dc..9285b23 100644 (file)
@@ -28,14 +28,14 @@ extern "C"
 
 using namespace types;
 
-int api_Top(int* _piKey)
+int api_Top(void* pvApiCtx)
 {
-       return api_Rhs(_piKey);
+       return api_Rhs(pvApiCtx);
 }
 
-int api_Rhs(int* _piKey)
+int api_Rhs(void* pvApiCtx)
 {
-       GatewayStruct *pStr =  (GatewayStruct*)_piKey;
+       GatewayStruct *pStr =  (GatewayStruct*)pvApiCtx;
 
        if(pStr == NULL)
        {
@@ -52,9 +52,9 @@ int api_Rhs(int* _piKey)
        return (int)pStr->m_pIn->size();
 }
 
-int api_Lhs(int* _piKey)
+int api_Lhs(void* pvApiCtx)
 {
-       GatewayStruct *pStr =  (GatewayStruct*)_piKey;
+       GatewayStruct *pStr =  (GatewayStruct*)pvApiCtx;
 
        if(pStr == NULL)
        {
@@ -69,10 +69,10 @@ int api_Lhs(int* _piKey)
        return abs(*pStr->m_piRetCount);
 }
 
-int api_CheckRhs(int _iMin, int _iMax, int* _piKey)
+int api_CheckRhs(int _iMin, int _iMax, void* pvApiCtx)
 {
-    GatewayStruct *pStr = (GatewayStruct*)_piKey;
-    int iRhs            = api_Rhs(_piKey);
+    GatewayStruct *pStr = (GatewayStruct*)pvApiCtx;
+    int iRhs            = api_Rhs(pvApiCtx);
 
     if(iRhs > _iMax || iRhs < _iMin)
     {
@@ -89,10 +89,10 @@ int api_CheckRhs(int _iMin, int _iMax, int* _piKey)
     return 1;
 }
 
-int api_CheckLhs(int _iMin, int _iMax, int* _piKey)
+int api_CheckLhs(int _iMin, int _iMax, void* pvApiCtx)
 {
-    GatewayStruct *pStr = (GatewayStruct*)_piKey;
-       int iLhs = api_Lhs(_piKey);
+    GatewayStruct *pStr = (GatewayStruct*)pvApiCtx;
+       int iLhs = api_Lhs(pvApiCtx);
 
        if(iLhs > _iMax || iLhs < _iMin)
        {
@@ -129,9 +129,9 @@ int* api_LhsVar(int _iVal, void* _pvCtx)
        return pVal;
 }
 
-void api_OverLoad(int _iVal, int* _piKey)
+void api_OverLoad(int _iVal, void* pvApiCtx)
 {
-    GatewayStruct* pStr = (GatewayStruct*)_piKey;
+    GatewayStruct* pStr = (GatewayStruct*)pvApiCtx;
     Function::ReturnValue callResult;
     typed_list tlReturnedValues;
 
index 5d0dccc..0bd25d3 100644 (file)
@@ -22,7 +22,7 @@
 /*--------------------------------------------------------------------------*/
 /* SCILAB function : and */
 /*--------------------------------------------------------------------------*/
-int sci_and(char *fname, int* _piKey)
+int sci_and(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int iRet        = 0;
@@ -40,14 +40,14 @@ int sci_and(char *fname, int* _piKey)
        CheckRhs(1,2);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr1);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       if(!isBooleanType(_piKey, piAddr1))
+       if(!isBooleanType(pvApiCtx, piAddr1))
        {
                OverLoad(1);
                return 0;
@@ -55,7 +55,7 @@ int sci_and(char *fname, int* _piKey)
 
        if(Rhs == 2)
        {
-               sciErr = getProcessMode(_piKey, 2, piAddr1, &iMode);
+               sciErr = getProcessMode(pvApiCtx, 2, piAddr1, &iMode);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -63,7 +63,7 @@ int sci_and(char *fname, int* _piKey)
                }
        }
 
-       sciErr = getMatrixOfBoolean(_piKey, piAddr1, &iRows, &iCols, &piBool1);
+       sciErr = getMatrixOfBoolean(pvApiCtx, piAddr1, &iRows, &iCols, &piBool1);
        if(iRet)
        {
                return 1;
@@ -90,14 +90,14 @@ int sci_and(char *fname, int* _piKey)
        switch(iMode)
        {
        case BY_ALL :
-               iRet = createScalarBoolean(_piKey, Rhs + 1, *piBool3);
+               iRet = createScalarBoolean(pvApiCtx, Rhs + 1, *piBool3);
                if(iRet)
                {
                        return 0;
                }
                break;
        case BY_ROWS :
-               sciErr = createMatrixOfBoolean(_piKey, Rhs + 1, 1, iCols, piBool3);
+               sciErr = createMatrixOfBoolean(pvApiCtx, Rhs + 1, 1, iCols, piBool3);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -105,7 +105,7 @@ int sci_and(char *fname, int* _piKey)
                }
                break;
        case BY_COLS :
-               sciErr = createMatrixOfBoolean(_piKey, Rhs + 1, iRows, 1, piBool3);
+               sciErr = createMatrixOfBoolean(pvApiCtx, Rhs + 1, iRows, 1, piBool3);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index 6fede3f..3db69fd 100644 (file)
@@ -22,7 +22,7 @@
 /*--------------------------------------------------------------------------*/
 /* SCILAB function : or */
 /*--------------------------------------------------------------------------*/
-int sci_or(char *fname, int* _piKey)
+int sci_or(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int iRet                        = 0;
@@ -41,14 +41,14 @@ int sci_or(char *fname, int* _piKey)
        CheckLhs(1,1);
 
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr1);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       if(!isBooleanType(_piKey, piAddr1))
+       if(!isBooleanType(pvApiCtx, piAddr1))
        {
                OverLoad(1);
                return 0;
@@ -56,7 +56,7 @@ int sci_or(char *fname, int* _piKey)
 
        if(Rhs == 2)
        {
-               sciErr = getProcessMode(_piKey, 2, piAddr1, &iMode);
+               sciErr = getProcessMode(pvApiCtx, 2, piAddr1, &iMode);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -64,7 +64,7 @@ int sci_or(char *fname, int* _piKey)
                }
        }
 
-       sciErr = getMatrixOfBoolean(_piKey, piAddr1, &iRows, &iCols, &piBool1);
+       sciErr = getMatrixOfBoolean(pvApiCtx, piAddr1, &iRows, &iCols, &piBool1);
        if(iRet)
        {
                return 1;
@@ -91,14 +91,14 @@ int sci_or(char *fname, int* _piKey)
        switch(iMode)
        {
        case BY_ALL :
-               iRet = createScalarBoolean(_piKey, Rhs + 1, *piBool3);
+               iRet = createScalarBoolean(pvApiCtx, Rhs + 1, *piBool3);
                if(iRet)
                {
                        return 0;
                }
                break;
        case BY_ROWS :
-               sciErr = createMatrixOfBoolean(_piKey, Rhs + 1, 1, iCols, piBool3);
+               sciErr = createMatrixOfBoolean(pvApiCtx, Rhs + 1, 1, iCols, piBool3);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -106,7 +106,7 @@ int sci_or(char *fname, int* _piKey)
                }
                break;
        case BY_COLS :
-               sciErr = createMatrixOfBoolean(_piKey, Rhs + 1, iRows, 1, piBool3);
+               sciErr = createMatrixOfBoolean(pvApiCtx, Rhs + 1, iRows, 1, piBool3);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index 12cff6d..cc395fb 100644 (file)
@@ -23,7 +23,7 @@ CONSOLE_IMPEXP int gw_console(void);
 /* used in sci_gateway */
 //CONSOLE_IMPEXP int sci_clc(char *fname,unsigned long fname_len);
 //CONSOLE_IMPEXP int sci_tohome(char *fname,unsigned long fname_len);
-//CONSOLE_IMPEXP int sci_lines(char *fname, int *_piKey);
+//CONSOLE_IMPEXP int sci_lines(char *fname, void* pvApiCtx);
 //CONSOLE_IMPEXP int sci_prompt(char *fname,unsigned long fname_len);
 //CONSOLE_IMPEXP int sci_iswaitingforinput(char *fname,unsigned long fname_len);
 /*--------------------------------------------------------------------------*/
index 93e6aa3..336ac19 100644 (file)
 #include "ScilabLinesUpdate.h"
 #include "sci_mode.h"
 /*--------------------------------------------------------------------------*/
-static int sci_lines_no_rhs(char *fname, int *_piKey);
-static int sci_lines_one_rhs(char *fname, int *_piKey);
-static int sci_lines_two_rhs(char *fname, int *_piKey);
+static int sci_lines_no_rhs(char *fname, void* pvApiCtx);
+static int sci_lines_one_rhs(char *fname, void* pvApiCtx);
+static int sci_lines_two_rhs(char *fname, void* pvApiCtx);
 /*--------------------------------------------------------------------------*/
-int sci_lines(char *fname, int *_piKey)
+int sci_lines(char *fname, void* pvApiCtx)
 {
     CheckRhs(0,2);
     CheckLhs(1,1);
@@ -33,19 +33,19 @@ int sci_lines(char *fname, int *_piKey)
     switch(Rhs)
     {
     case 0:
-        sci_lines_no_rhs(fname, _piKey);
+        sci_lines_no_rhs(fname, pvApiCtx);
         break;
     case 1:
-        sci_lines_one_rhs(fname, _piKey);
+        sci_lines_one_rhs(fname, pvApiCtx);
         break;
     case 2:
-        sci_lines_two_rhs(fname, _piKey);
+        sci_lines_two_rhs(fname, pvApiCtx);
         break;
     }
     return 0;
 }
 /*--------------------------------------------------------------------------*/
-static int sci_lines_no_rhs(char *fname, int *_piKey)
+static int sci_lines_no_rhs(char *fname, void* pvApiCtx)
 {
     /* ncl = lines() */
     /* with ncl a 1x2 vector [nc , nl] */
@@ -59,7 +59,7 @@ static int sci_lines_no_rhs(char *fname, int *_piKey)
     returnedDouble[1] = (double)getLinesSize();
 
     n1 = 1; m1 = 2;
-    sciErr = createMatrixOfDouble(_piKey, Rhs + 1, n1, m1, returnedDouble);
+    sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, n1, m1, returnedDouble);
 
     if (sciErr.iErr)
     {
@@ -74,7 +74,7 @@ static int sci_lines_no_rhs(char *fname, int *_piKey)
     return 0;
 }
 /*--------------------------------------------------------------------------*/
-static int sci_lines_one_rhs(char *fname, int *_piKey)
+static int sci_lines_one_rhs(char *fname, void* pvApiCtx)
 {
     /* lines(nb_lines) */
     /* nb_lines == -1 auto */
@@ -84,7 +84,7 @@ static int sci_lines_one_rhs(char *fname, int *_piKey)
     int *piAddressVarOne = NULL;
     int iParam1 = 0;
 
-    sciErr = getVarAddressFromPosition(_piKey, 1, &piAddressVarOne);
+    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
     if(sciErr.iErr)
     {
         printError(&sciErr, 0);
@@ -93,21 +93,21 @@ static int sci_lines_one_rhs(char *fname, int *_piKey)
     }
 
     /* compatibility with previous version manages int32 and double */
-    if (!(isDoubleType(_piKey, piAddressVarOne) || isIntegerType(_piKey, piAddressVarOne)))
+    if (!(isDoubleType(pvApiCtx, piAddressVarOne) || isIntegerType(pvApiCtx, piAddressVarOne)))
     {
         Scierror(999,_("%s: Wrong type for input argument #%d: A scalar expected.\n"),fname, 1);
         return 0;
     }
 
-    if (!isScalar(_piKey, piAddressVarOne))
+    if (!isScalar(pvApiCtx, piAddressVarOne))
     {
         Scierror(999,_("%s: Wrong size for input argument #%d: A scalar expected.\n"),fname, 1);
         return 0;
     }
 
-    if (isIntegerType(_piKey, piAddressVarOne))
+    if (isIntegerType(pvApiCtx, piAddressVarOne))
     {
-        if (getScalarInteger32(_piKey, piAddressVarOne, &iParam1) != 0)
+        if (getScalarInteger32(pvApiCtx, piAddressVarOne, &iParam1) != 0)
         {
             Scierror(999,_("%s: Wrong type for input argument #%d: A scalar expected.\n"),fname, 1);
             return 0;
@@ -116,7 +116,7 @@ static int sci_lines_one_rhs(char *fname, int *_piKey)
     else // double
     {
         double dParam1 = 0.;
-        if (getScalarDouble(_piKey,piAddressVarOne, &dParam1) == 0)
+        if (getScalarDouble(pvApiCtx,piAddressVarOne, &dParam1) == 0)
         {
             iParam1 = (int)dParam1;
         }
@@ -148,7 +148,7 @@ static int sci_lines_one_rhs(char *fname, int *_piKey)
     return 0;
 }
 /*--------------------------------------------------------------------------*/
-static int sci_lines_two_rhs(char *fname, int *_piKey)
+static int sci_lines_two_rhs(char *fname, void* pvApiCtx)
 {
     /* lines (nl, nc) */
     SciErr sciErr;
@@ -158,7 +158,7 @@ static int sci_lines_two_rhs(char *fname, int *_piKey)
     int iParam1 = 0;
     int iParam2 = 0;
 
-    sciErr = getVarAddressFromPosition(_piKey, 2, &piAddressVarTwo);
+    sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
     if(sciErr.iErr)
     {
         printError(&sciErr, 0);
@@ -166,7 +166,7 @@ static int sci_lines_two_rhs(char *fname, int *_piKey)
         return 0;
     }
 
-    sciErr = getVarAddressFromPosition(_piKey, 1, &piAddressVarOne);
+    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
     if(sciErr.iErr)
     {
         printError(&sciErr, 0);
@@ -175,33 +175,33 @@ static int sci_lines_two_rhs(char *fname, int *_piKey)
     }
 
     /* compatibility with previous version manages int32 and double */
-    if (!(isDoubleType(_piKey, piAddressVarOne) || isIntegerType(_piKey, piAddressVarOne)))
+    if (!(isDoubleType(pvApiCtx, piAddressVarOne) || isIntegerType(pvApiCtx, piAddressVarOne)))
     {
         Scierror(999,_("%s: Wrong type for input argument #%d: A scalar expected.\n"),fname, 1);
         return 0;
     }
 
-    if (!(isDoubleType(_piKey, piAddressVarTwo) || isIntegerType(_piKey, piAddressVarTwo)))
+    if (!(isDoubleType(pvApiCtx, piAddressVarTwo) || isIntegerType(pvApiCtx, piAddressVarTwo)))
     {
         Scierror(999,_("%s: Wrong type for input argument #%d: A scalar expected.\n"),fname, 2);
         return 0;
     }
 
-    if (!isScalar(_piKey, piAddressVarOne))
+    if (!isScalar(pvApiCtx, piAddressVarOne))
     {
         Scierror(999,_("%s: Wrong size for input argument #%d: A scalar expected.\n"),fname, 1);
         return 0;
     }
 
-    if (!isScalar(_piKey, piAddressVarTwo))
+    if (!isScalar(pvApiCtx, piAddressVarTwo))
     {
         Scierror(999,_("%s: Wrong size for input argument #%d: A scalar expected.\n"),fname, 2);
         return 0;
     }
 
-    if (isIntegerType(_piKey, piAddressVarOne))
+    if (isIntegerType(pvApiCtx, piAddressVarOne))
     {
-        if (getScalarInteger32(_piKey, piAddressVarOne, &iParam1) != 0)
+        if (getScalarInteger32(pvApiCtx, piAddressVarOne, &iParam1) != 0)
         {
             Scierror(999,_("%s: Wrong type for input argument #%d: A scalar expected.\n"),fname, 1);
             return 0;
@@ -210,15 +210,15 @@ static int sci_lines_two_rhs(char *fname, int *_piKey)
     else // double
     {
         double dParam1 = 0.;
-        if (getScalarDouble(_piKey,piAddressVarOne, &dParam1) == 0)
+        if (getScalarDouble(pvApiCtx,piAddressVarOne, &dParam1) == 0)
         {
             iParam1 = (int)dParam1;
         }
     }
 
-    if (isIntegerType(_piKey, piAddressVarTwo))
+    if (isIntegerType(pvApiCtx, piAddressVarTwo))
     {
-        if (getScalarInteger32(_piKey, piAddressVarTwo, &iParam2) != 0)
+        if (getScalarInteger32(pvApiCtx, piAddressVarTwo, &iParam2) != 0)
         {
             Scierror(999,_("%s: Wrong type for input argument #%d: A scalar expected.\n"),fname, 2);
             return 0;
@@ -227,7 +227,7 @@ static int sci_lines_two_rhs(char *fname, int *_piKey)
     else // double
     {
         double dParam2 = 0.;
-        if (getScalarDouble(_piKey,piAddressVarTwo, &dParam2) == 0)
+        if (getScalarDouble(pvApiCtx,piAddressVarTwo, &dParam2) == 0)
         {
             iParam2 = (int)dParam2;
         }
index a6067d9..8f1971d 100644 (file)
@@ -61,8 +61,8 @@ int C2F(sci_readgateway)(char *fname,unsigned long fname_len);
 int C2F(sci_comp)(char *fname,unsigned long fname_len);
 
 C_GATEWAY_PROTOTYPE(C2F(sci_typename));
-int C2F(sci_funcprot)(char *fname,int* _piKey);
-int C2F(sci_newfun)(char *fname, int* _piKey);
+int C2F(sci_funcprot)(char *fname,void* pvApiCtx);
+int C2F(sci_newfun)(char *fname, void* pvApiCtx);
 
 //Yasp
 C_GATEWAY_PROTOTYPE(sci_type);
index 81bf0f8..e701477 100644 (file)
@@ -19,7 +19,7 @@
 #include "localization.h"
 #include "Scierror.h"
 /*--------------------------------------------------------------------------*/
-int sci_errclear(char *fname, int *_piKey)
+int sci_errclear(char *fname, void* pvApiCtx)
 {
     //Rhs = Max(0,Rhs);
     CheckRhs(0,2);
@@ -30,7 +30,7 @@ int sci_errclear(char *fname, int *_piKey)
         SciErr sciErr;
         int *piAddressVarOne = NULL;
 
-        sciErr = getVarAddressFromPosition(_piKey, 1, &piAddressVarOne);
+        sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
         if(sciErr.iErr)
         {
             printError(&sciErr, 0);
@@ -38,20 +38,20 @@ int sci_errclear(char *fname, int *_piKey)
             return 0;
         }
 
-        if (isDoubleType(_piKey, piAddressVarOne))
+        if (isDoubleType(pvApiCtx, piAddressVarOne))
         {
             double dValue = 0.;
             int iValue = 0;
             int iLastErrorValue = 0;
             //int iLastErrorValue = getLastErrorValue();
 
-            if (!isScalar(_piKey, piAddressVarOne))
+            if (!isScalar(pvApiCtx, piAddressVarOne))
             {
                 Scierror(999,_("%s: Wrong size for input argument #%d: A scalar expected.\n"), fname, 1);
                 return 0;
             }
 
-             getScalarDouble(_piKey, piAddressVarOne, &dValue);
+             getScalarDouble(pvApiCtx, piAddressVarOne, &dValue);
              iValue = (int)dValue;
 
              if ((double)iValue != dValue)
index 4d56bd6..a03049a 100644 (file)
 #define mode_variable 1
 #define mode_e 0
 /*--------------------------------------------------------------------------*/
-static int sci_format_tworhs(char *fname, int* _piKey);
-static int sci_format_onerhs(char *fname, int* _piKey);
-static int sci_format_norhs(char *fname, int* _piKey);
+static int sci_format_tworhs(char *fname, void* pvApiCtx);
+static int sci_format_onerhs(char *fname, void* pvApiCtx);
+static int sci_format_norhs(char *fname, void* pvApiCtx);
 static void setVariableFormat(int numberDigits);
 static void set_e_Format(int numberDigits);
 static void getFormat(double *e_mode, double *numberDigits);
 static void setVariableMode(void);
 
 /*--------------------------------------------------------------------------*/
-int C2F(sci_format) (char *fname, int *_piKey)
+int C2F(sci_format) (char *fname, void* pvApiCtx)
 {
     Rhs = Max(0, Rhs);
 
@@ -44,25 +44,25 @@ int C2F(sci_format) (char *fname, int *_piKey)
     switch (Rhs)
     {
     case 2:
-        return sci_format_tworhs(fname, _piKey);
+        return sci_format_tworhs(fname, pvApiCtx);
     case 1:
-        return sci_format_onerhs(fname, _piKey);
+        return sci_format_onerhs(fname, pvApiCtx);
         break;
     case 0:
     default:
-        return sci_format_norhs(fname, _piKey);
+        return sci_format_norhs(fname, pvApiCtx);
     }
 }
 
 /*--------------------------------------------------------------------------*/
-static int sci_format_norhs(char *fname, int *_piKey)
+static int sci_format_norhs(char *fname, void* pvApiCtx)
 {
     SciErr sciErr;
     double dParamout[2];
 
     getFormat(&dParamout[0], &dParamout[1]);
 
-    sciErr = createMatrixOfDouble(_piKey, Rhs + 1, 1, 2, dParamout);
+    sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, 1, 2, dParamout);
     if (sciErr.iErr)
     {
         printError(&sciErr, 0);
@@ -75,10 +75,10 @@ static int sci_format_norhs(char *fname, int *_piKey)
 }
 
 /*--------------------------------------------------------------------------*/
-static int sci_format_onerhs(char *fname, int* _piKey)
+static int sci_format_onerhs(char *fname, void* pvApiCtx)
 {
     int *piAddressVarOne = NULL;
-    SciErr sciErr = getVarAddressFromPosition(_piKey, 1, &piAddressVarOne);
+    SciErr sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
 
     if (sciErr.iErr)
     {
@@ -87,17 +87,17 @@ static int sci_format_onerhs(char *fname, int* _piKey)
         return 0;
     }
 
-    if (isStringType(_piKey, piAddressVarOne))
+    if (isStringType(pvApiCtx, piAddressVarOne))
     {
         char *param = NULL;
 
-        if (!isScalar(_piKey, piAddressVarOne))
+        if (!isScalar(pvApiCtx, piAddressVarOne))
         {
             Scierror(999, _("%s: Wrong value for input argument #%d: '%s' or '%s' expected.\n"), fname, 1, e_type_format, v_type_format);
             return 0;
         }
 
-        if (getAllocatedSingleString(_piKey, piAddressVarOne, &param) == 0)
+        if (getAllocatedSingleString(pvApiCtx, piAddressVarOne, &param) == 0)
         {
             if ((strcmp(e_type_format, param) == 0) || (strcmp(v_type_format, param) == 0))
             {
@@ -132,13 +132,13 @@ static int sci_format_onerhs(char *fname, int* _piKey)
             return 0;
         }
     }
-    else if (isDoubleType(_piKey, piAddressVarOne))
+    else if (isDoubleType(pvApiCtx, piAddressVarOne))
     {
-        if (isScalar(_piKey, piAddressVarOne))
+        if (isScalar(pvApiCtx, piAddressVarOne))
         {
             double dValue = 0.;
 
-            if (getScalarDouble(_piKey, piAddressVarOne, &dValue) == 0)
+            if (getScalarDouble(pvApiCtx, piAddressVarOne, &dValue) == 0)
             {
                 double mode = 0.;
                 double previous_numberDigits = 0.;
@@ -181,13 +181,13 @@ static int sci_format_onerhs(char *fname, int* _piKey)
         }
         else
         {
-            if (checkVarDimension(_piKey, piAddressVarOne, 1, 2) || checkVarDimension(_piKey, piAddressVarOne, 2, 1))
+            if (checkVarDimension(pvApiCtx, piAddressVarOne, 1, 2) || checkVarDimension(pvApiCtx, piAddressVarOne, 2, 1))
             {
                 int nbRowsOne = 0;
                 int nbColsOne = 0;
                 double *pDouble = NULL;
 
-                sciErr = getMatrixOfDouble(_piKey, piAddressVarOne, &nbRowsOne, &nbColsOne, &pDouble);
+                sciErr = getMatrixOfDouble(pvApiCtx, piAddressVarOne, &nbRowsOne, &nbColsOne, &pDouble);
                 if (sciErr.iErr)
                 {
                     printError(&sciErr, 0);
@@ -241,13 +241,13 @@ static int sci_format_onerhs(char *fname, int* _piKey)
 }
 
 /*--------------------------------------------------------------------------*/
-static int sci_format_tworhs(char *fname, int* _piKey)
+static int sci_format_tworhs(char *fname, void* pvApiCtx)
 {
     /* format(1, 10) */
     int *piAddressVarOne = NULL;
     int *piAddressVarTwo = NULL;
 
-    SciErr sciErr = getVarAddressFromPosition(_piKey, 1, &piAddressVarOne);
+    SciErr sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
 
     if (sciErr.iErr)
     {
@@ -256,7 +256,7 @@ static int sci_format_tworhs(char *fname, int* _piKey)
         return 0;
     }
 
-    sciErr = getVarAddressFromPosition(_piKey, 2, &piAddressVarTwo);
+    sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
     if (sciErr.iErr)
     {
         printError(&sciErr, 0);
@@ -264,31 +264,31 @@ static int sci_format_tworhs(char *fname, int* _piKey)
         return 0;
     }
 
-    if (!isScalar(_piKey, piAddressVarOne))
+    if (!isScalar(pvApiCtx, piAddressVarOne))
     {
         Scierror(999, _("%s: Wrong size for input argument #%d.\n"), fname, 1);
         return 0;
     }
 
-    if (!isScalar(_piKey, piAddressVarTwo))
+    if (!isScalar(pvApiCtx, piAddressVarTwo))
     {
         Scierror(999, _("%s: Wrong size for input argument #%d.\n"), fname, 2);
         return 0;
     }
 
-    if (isDoubleType(_piKey, piAddressVarOne) && isDoubleType(_piKey, piAddressVarTwo))
+    if (isDoubleType(pvApiCtx, piAddressVarOne) && isDoubleType(pvApiCtx, piAddressVarTwo))
     {
         double type_value_d = 0.;
         double v_value_d = 0.;
         int v_value = 0;
 
-        if (getScalarDouble(_piKey, piAddressVarOne, &v_value_d) != 0)
+        if (getScalarDouble(pvApiCtx, piAddressVarOne, &v_value_d) != 0)
         {
             Scierror(999, _("%s: No more memory.\n"), fname);
             return 0;
         }
 
-        if (getScalarDouble(_piKey, piAddressVarTwo, &type_value_d) != 0)
+        if (getScalarDouble(pvApiCtx, piAddressVarTwo, &type_value_d) != 0)
         {
             Scierror(999, _("%s: No more memory.\n"), fname);
             return 0;
@@ -332,23 +332,23 @@ static int sci_format_tworhs(char *fname, int* _piKey)
         PutLhsVar();
     }
     /* format('e',10) & format(10,'e') syntax */
-    else if ((isStringType(_piKey, piAddressVarOne) &&
-              (isDoubleType(_piKey, piAddressVarTwo)) || (isDoubleType(_piKey, piAddressVarOne) && isStringType(_piKey, piAddressVarTwo))))
+    else if ((isStringType(pvApiCtx, piAddressVarOne) &&
+              (isDoubleType(pvApiCtx, piAddressVarTwo)) || (isDoubleType(pvApiCtx, piAddressVarOne) && isStringType(pvApiCtx, piAddressVarTwo))))
     {
         char *param = NULL;
         unsigned int value = 0;
 
-        if (isStringType(_piKey, piAddressVarOne))
+        if (isStringType(pvApiCtx, piAddressVarOne))
         {
             double dvalue = 0;
 
-            if (getAllocatedSingleString(_piKey, piAddressVarOne, &param) != 0)
+            if (getAllocatedSingleString(pvApiCtx, piAddressVarOne, &param) != 0)
             {
                 Scierror(999, _("%s: No more memory.\n"), fname);
                 return 0;
             }
 
-            if (getScalarDouble(_piKey, piAddressVarTwo, &dvalue) != 0)
+            if (getScalarDouble(pvApiCtx, piAddressVarTwo, &dvalue) != 0)
             {
                 freeAllocatedSingleString(param);
                 param = NULL;
@@ -370,7 +370,7 @@ static int sci_format_tworhs(char *fname, int* _piKey)
         {
             double dvalue = 0;
 
-            if (getScalarDouble(_piKey, piAddressVarOne, &dvalue) != 0)
+            if (getScalarDouble(pvApiCtx, piAddressVarOne, &dvalue) != 0)
             {
                 Scierror(999, _("%s: No more memory.\n"), fname);
                 return 0;
@@ -383,7 +383,7 @@ static int sci_format_tworhs(char *fname, int* _piKey)
                 return 0;
             }
 
-            if (getAllocatedSingleString(_piKey, piAddressVarTwo, &param) != 0)
+            if (getAllocatedSingleString(pvApiCtx, piAddressVarTwo, &param) != 0)
             {
                 Scierror(999, _("%s: No more memory.\n"), fname);
                 return 0;
index 06ca1bb..6fc1519 100644 (file)
@@ -19,7 +19,7 @@
 #include "localization.h"
 #include "MALLOC.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_funcprot)(char *fname, int* _piKey)
+int C2F(sci_funcprot)(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        CheckLhs(1,1);
@@ -31,7 +31,7 @@ int C2F(sci_funcprot)(char *fname, int* _piKey)
                double dOut = (double) getfuncprot();
 
                m_out = 1;  n_out = 1;
-               sciErr = createMatrixOfDouble(_piKey, Rhs + 1, m_out, n_out, &dOut);
+               sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, m_out, n_out, &dOut);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -51,7 +51,7 @@ int C2F(sci_funcprot)(char *fname, int* _piKey)
                double *pdVarOne                        = NULL;
 
                /* get Address of inputs */
-               sciErr = getVarAddressFromPosition(_piKey, 1, &piAddressVarOne);
+               sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -59,7 +59,7 @@ int C2F(sci_funcprot)(char *fname, int* _piKey)
                        return 0;
                }
 
-               sciErr = getVarType(_piKey, piAddressVarOne, &iType1);
+               sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType1);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -74,7 +74,7 @@ int C2F(sci_funcprot)(char *fname, int* _piKey)
                        return 0;
                }
 
-               sciErr = getMatrixOfDouble(_piKey, piAddressVarOne,&m1,&n1,&pdVarOne);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddressVarOne,&m1,&n1,&pdVarOne);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index 663085b..80669c6 100644 (file)
@@ -25,7 +25,7 @@
 #include "getdynamicdebuginfo.h"
 #endif
 /*--------------------------------------------------------------------------*/
-int sci_getdebuginfo(char *fname, int* _piKey)
+int sci_getdebuginfo(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        char **outputDynamicList = NULL;
@@ -37,14 +37,14 @@ int sci_getdebuginfo(char *fname, int* _piKey)
        CheckLhs(0,2);
 
 #ifdef _MSC_VER
-       outputDynamicList = getDynamicDebugInfo_Windows(&m1, _piKey);
+       outputDynamicList = getDynamicDebugInfo_Windows(&m1, pvApiCtx);
        outputStaticList = getStaticDebugInfo_Windows(&m2);
 #else
-       outputDynamicList = getDynamicDebugInfo(&m1, _piKey);
+       outputDynamicList = getDynamicDebugInfo(&m1, pvApiCtx);
        outputStaticList = getStaticDebugInfo(&m2);
 #endif
 
-       sciErr = createMatrixOfString(_piKey, Rhs + 1, m1, n1, outputDynamicList);
+       sciErr = createMatrixOfString(pvApiCtx, Rhs + 1, m1, n1, outputDynamicList);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -55,7 +55,7 @@ int sci_getdebuginfo(char *fname, int* _piKey)
 
        if (Lhs == 2)
        {
-               sciErr = createMatrixOfString(_piKey, Rhs + 2, m2, n2, outputStaticList);
+               sciErr = createMatrixOfString(pvApiCtx, Rhs + 2, m2, n2, outputStaticList);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index 5a3e9da..5362a02 100644 (file)
@@ -26,7 +26,7 @@
 /*--------------------------------------------------------------------------*/
 static BOOL Is_a_correct_function_name(char *functionname);
 /*--------------------------------------------------------------------------*/
-int C2F(sci_newfun) (char *fname, int* _piKey)
+int C2F(sci_newfun) (char *fname, void* pvApiCtx)
 {
     SciErr sciErr;
     int m1 = 0, n1 = 0;
@@ -45,7 +45,7 @@ int C2F(sci_newfun) (char *fname, int* _piKey)
     CheckRhs(2,2);
     CheckLhs(1,1);
 
-    sciErr = getVarAddressFromPosition(_piKey, 1, &piAddressVarOne);
+    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
     if(sciErr.iErr)
     {
         printError(&sciErr, 0);
@@ -53,7 +53,7 @@ int C2F(sci_newfun) (char *fname, int* _piKey)
         return 0;
     }
 
-    sciErr = getVarAddressFromPosition(_piKey, 2, &piAddressVarTwo);
+    sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
     if(sciErr.iErr)
     {
         printError(&sciErr, 0);
@@ -61,7 +61,7 @@ int C2F(sci_newfun) (char *fname, int* _piKey)
         return 0;
     }
 
-    sciErr = getVarType(_piKey, piAddressVarOne, &iType1);
+    sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType1);
     if(sciErr.iErr)
     {
         printError(&sciErr, 0);
@@ -69,7 +69,7 @@ int C2F(sci_newfun) (char *fname, int* _piKey)
         return 0;
     }
 
-    sciErr = getVarType(_piKey, piAddressVarTwo, &iType2);
+    sciErr = getVarType(pvApiCtx, piAddressVarTwo, &iType2);
     if(sciErr.iErr)
     {
         printError(&sciErr, 0);
@@ -89,7 +89,7 @@ int C2F(sci_newfun) (char *fname, int* _piKey)
         return 0;
     }
 
-    sciErr = getMatrixOfString(_piKey, piAddressVarOne,&m1,&n1,&lenStVarOne, NULL);
+    sciErr = getMatrixOfString(pvApiCtx, piAddressVarOne,&m1,&n1,&lenStVarOne, NULL);
     if(sciErr.iErr)
     {
         printError(&sciErr, 0);
@@ -103,7 +103,7 @@ int C2F(sci_newfun) (char *fname, int* _piKey)
         return 0;
     }
 
-    sciErr = getMatrixOfDouble(_piKey, piAddressVarTwo,&m2,&n2,&pdVarTwo);
+    sciErr = getMatrixOfDouble(pvApiCtx, piAddressVarTwo,&m2,&n2,&pdVarTwo);
     if(sciErr.iErr)
     {
         printError(&sciErr, 0);
@@ -127,7 +127,7 @@ int C2F(sci_newfun) (char *fname, int* _piKey)
     pStVarOne = (char*)MALLOC(sizeof(char)*(lenStVarOne + 1));
     if (pStVarOne)
     {
-        sciErr = getMatrixOfString(_piKey, piAddressVarOne,&m1,&n1,&lenStVarOne,&pStVarOne);
+        sciErr = getMatrixOfString(pvApiCtx, piAddressVarOne,&m1,&n1,&lenStVarOne,&pStVarOne);
         if(sciErr.iErr)
         {
             printError(&sciErr, 0);
index 2725760..c7676f9 100644 (file)
@@ -19,7 +19,7 @@
 #include "MALLOC.h"
 #include "freeArrayOfString.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_predef)(char *fname, int* _piKey)
+int C2F(sci_predef)(char *fname, void* pvApiCtx)
 {
     int previous_n_var_protected = 0;
 
@@ -94,7 +94,7 @@ int C2F(sci_predef)(char *fname, int* _piKey)
                     char **variablesPredef = getPredefinedVariablesName(&nbElements);
                     if (variablesPredef && (nbElements > 0))
                     {
-                        SciErr sciErr = createMatrixOfString(_piKey, Rhs + 1, nbElements, 1, variablesPredef);
+                        SciErr sciErr = createMatrixOfString(pvApiCtx, Rhs + 1, nbElements, 1, variablesPredef);
                         freeArrayOfString(variablesPredef, nbElements);
                         variablesPredef = NULL;
                         if(sciErr.iErr)
@@ -111,7 +111,7 @@ int C2F(sci_predef)(char *fname, int* _piKey)
                     }
                     else
                     {
-                        createEmptyMatrix(_piKey, Rhs + 1);
+                        createEmptyMatrix(pvApiCtx, Rhs + 1);
                         LhsVar(1) = Rhs + 1;
                         PutLhsVar();
                         return 0;
index 6319d3f..f86c30b 100644 (file)
@@ -15,7 +15,7 @@
 #include "api_scilab.h"
 #include "api_oldstack.h"
 /*--------------------------------------------------------------------------*/
-int sci_type(char *fname, int* _piKey)
+int sci_type(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int* piAddr     = NULL;
@@ -25,21 +25,21 @@ int sci_type(char *fname, int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       iRet = createMatrixOfDoubleFromInteger(_piKey, Rhs + 1, 1, 1, &iType);
+       iRet = createMatrixOfDoubleFromInteger(pvApiCtx, Rhs + 1, 1, 1, &iType);
        if(iRet)
        {
                return 0;
index ab50255..d4138ef 100644 (file)
 #include "api_scilab.h"
 #include "freeArrayOfString.h"
 /*--------------------------------------------------------------------------*/
-static int sci_typename_two_rhs(char *fname, int* _piKey);
-static int sci_typename_no_rhs(char *fname, int* _piKey);
+static int sci_typename_two_rhs(char *fname, void* pvApiCtx);
+static int sci_typename_no_rhs(char *fname, void* pvApiCtx);
 /*--------------------------------------------------------------------------*/
-int C2F(sci_typename)(char *fname, int *_piKey)
+int C2F(sci_typename)(char *fname, void* pvApiCtx)
 {
        CheckLhs(1,2); 
        switch (Rhs)
        {
        case 0:
-               sci_typename_no_rhs(fname, _piKey);
+               sci_typename_no_rhs(fname, pvApiCtx);
                break;
        case 2:
-               sci_typename_two_rhs(fname, _piKey);
+               sci_typename_two_rhs(fname, pvApiCtx);
                break;
        default:
                Scierror(999,_("%s: Wrong number of input arguments: %d or %d expected.\n"),fname,0,2);
@@ -41,7 +41,7 @@ int C2F(sci_typename)(char *fname, int *_piKey)
        return 0;
 }
 /*--------------------------------------------------------------------------*/
-int sci_typename_two_rhs(char *fname, int* _piKey)
+int sci_typename_two_rhs(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int m1 = 0, n1 = 0;
@@ -55,7 +55,7 @@ int sci_typename_two_rhs(char *fname, int* _piKey)
        int *piAddressVarTwo = NULL;
        double *pdVarTwo = NULL;
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddressVarOne);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -64,7 +64,7 @@ int sci_typename_two_rhs(char *fname, int* _piKey)
        }
 
 
-       sciErr = getVarAddressFromPosition(_piKey, 2, &piAddressVarTwo);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -73,7 +73,7 @@ int sci_typename_two_rhs(char *fname, int* _piKey)
        }
 
 
-       sciErr = getVarType(_piKey, piAddressVarOne, &iType1);
+       sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -81,7 +81,7 @@ int sci_typename_two_rhs(char *fname, int* _piKey)
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddressVarTwo, &iType2);
+       sciErr = getVarType(pvApiCtx, piAddressVarTwo, &iType2);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -101,7 +101,7 @@ int sci_typename_two_rhs(char *fname, int* _piKey)
                return 0;
        }
 
-       sciErr = getMatrixOfDouble(_piKey, piAddressVarTwo,&m2,&n2,&pdVarTwo);
+       sciErr = getMatrixOfDouble(pvApiCtx, piAddressVarTwo,&m2,&n2,&pdVarTwo);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -115,7 +115,7 @@ int sci_typename_two_rhs(char *fname, int* _piKey)
                return 0;
        }
 
-       sciErr = getMatrixOfString(_piKey, piAddressVarOne,&m1,&n1,&lenStVarOne,&pStVarOne);
+       sciErr = getMatrixOfString(pvApiCtx, piAddressVarOne,&m1,&n1,&lenStVarOne,&pStVarOne);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -130,7 +130,7 @@ int sci_typename_two_rhs(char *fname, int* _piKey)
        }
        
        pStVarOne = (char*)MALLOC(sizeof(char)*(lenStVarOne + 1));
-       sciErr = getMatrixOfString(_piKey, piAddressVarOne,&m1,&n1,&lenStVarOne,&pStVarOne);
+       sciErr = getMatrixOfString(pvApiCtx, piAddressVarOne,&m1,&n1,&lenStVarOne,&pStVarOne);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -142,7 +142,7 @@ int sci_typename_two_rhs(char *fname, int* _piKey)
        if (pStVarOne)
        {
                int ierr = 0;
-               sciErr = getMatrixOfString(_piKey, piAddressVarOne,&m1,&n1,&lenStVarOne,&pStVarOne);
+               sciErr = getMatrixOfString(pvApiCtx, piAddressVarOne,&m1,&n1,&lenStVarOne,&pStVarOne);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -186,7 +186,7 @@ int sci_typename_two_rhs(char *fname, int* _piKey)
        return 0;
 }
 /*--------------------------------------------------------------------------*/
-int sci_typename_no_rhs(char *fname, int* _piKey)
+int sci_typename_no_rhs(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int numberOfTypes = 0;
@@ -198,7 +198,7 @@ int sci_typename_no_rhs(char *fname, int* _piKey)
        m_out1 = numberOfTypes;
        n_out1 = 1;
 
-       sciErr = createMatrixOfInteger32(_piKey, Rhs + 1,m_out1,n_out1,TypesNumbers);
+       sciErr = createMatrixOfInteger32(pvApiCtx, Rhs + 1,m_out1,n_out1,TypesNumbers);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -218,7 +218,7 @@ int sci_typename_no_rhs(char *fname, int* _piKey)
                m_out2 = numberOfTypes;
                n_out2 = 1;
                
-               sciErr = createMatrixOfString(_piKey, Rhs + 2, m_out2, n_out2, TypesNames);
+               sciErr = createMatrixOfString(pvApiCtx, Rhs + 2, m_out2, n_out2, TypesNames);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index 94db840..669285b 100644 (file)
@@ -28,9 +28,9 @@ extern "C"
 /*--------------------------------------------------------------------------*/
 #define VERSION_STRING L"string_info"
 /*--------------------------------------------------------------------------*/
-static int getversion_no_rhs(char *fname, int* _piKey);
-static int getversion_one_rhs(char *fname, int* _piKey);
-static int getversion_two_rhs(char *fname, int* _piKey);
+static int getversion_no_rhs(char *fname, void* pvApiCtx);
+static int getversion_one_rhs(char *fname, void* pvApiCtx);
+static int getversion_two_rhs(char *fname, void* pvApiCtx);
 /*--------------------------------------------------------------------------*/
 
 using namespace types;
@@ -135,27 +135,27 @@ Function::ReturnValue sci_getversion(types::typed_list &in, int _iRetCount, type
 //     if (Rhs == 0)
 //     {
 //             CheckLhs(1,2);
-//             getversion_no_rhs(fname, _piKey);
+//             getversion_no_rhs(fname, pvApiCtx);
 //     }
 //     else if (Rhs == 1)
 //     {
 //             CheckLhs(1,1);
-//             getversion_one_rhs(fname, _piKey);
+//             getversion_one_rhs(fname, pvApiCtx);
 //     }
 //     else /* Rhs == 2 */
 //     {
 //             CheckLhs(1,1);
-//             getversion_two_rhs(fname, _piKey);
+//             getversion_two_rhs(fname, pvApiCtx);
 //     }
 //     return 0;
 //}
 ///*--------------------------------------------------------------------------*/
-//int getversion_no_rhs(char *fname, int* _piKey)
+//int getversion_no_rhs(char *fname, void* pvApiCtx)
 //{
 //     char *version = getScilabVersionAsString();
 //     if (version)
 //     {
-//             createSingleString(_piKey, Rhs + 1, version);
+//             createSingleString(pvApiCtx, Rhs + 1, version);
 //             LhsVar(1) = Rhs + 1;
 //             FREE(version);
 //             version = NULL;
@@ -176,7 +176,7 @@ Function::ReturnValue sci_getversion(types::typed_list &in, int _iRetCount, type
 //                     SciErr sciErr;
 //                     int m = 1;
 //                     int n = sizeOptions;
-//                     sciErr = createMatrixOfString(_piKey, Rhs + 2, m, n, ScilabOptions);
+//                     sciErr = createMatrixOfString(pvApiCtx, Rhs + 2, m, n, ScilabOptions);
 //                     freeArrayOfString(ScilabOptions, sizeOptions);
 //
 //                     if(sciErr.iErr)
@@ -199,29 +199,29 @@ Function::ReturnValue sci_getversion(types::typed_list &in, int _iRetCount, type
 //     return 0;
 //}
 ///*--------------------------------------------------------------------------*/
-//int getversion_one_rhs(char *fname, int* _piKey)
+//int getversion_one_rhs(char *fname, void* pvApiCtx)
 //{
 //     SciErr sciErr;
 //     int *piAddressVarOne = NULL;
 //
-//     sciErr = getVarAddressFromPosition(_piKey, 1, &piAddressVarOne);
+//     sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
 //     if(sciErr.iErr)
 //     {
 //             printError(&sciErr, 0);
 //             return 0;
 //     }
 //
-//     if (isStringType(_piKey, piAddressVarOne))
+//     if (isStringType(pvApiCtx, piAddressVarOne))
 //     {
 //             char *modulename = NULL;
 //
-//             if (!isScalar(_piKey, piAddressVarOne))
+//             if (!isScalar(pvApiCtx, piAddressVarOne))
 //             {
 //                     Scierror(999,_("%s: Wrong size for input argument #%d: String expected.\n"), fname, 1);
 //                     return 0;
 //             }
 //
-//             if (getAllocatedSingleString(_piKey, piAddressVarOne, &modulename) == 0)
+//             if (getAllocatedSingleString(pvApiCtx, piAddressVarOne, &modulename) == 0)
 //             {
 //                     if (modulename)
 //                     {
@@ -248,7 +248,7 @@ Function::ReturnValue sci_getversion(types::typed_list &in, int _iRetCount, type
 //                                                     freeAllocatedSingleString(modulename);
 //                                                     modulename = NULL;
 //
-//                                                     sciErr = createMatrixOfDouble(_piKey, Rhs + 1, m, n, versionAsDouble);
+//                                                     sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, m, n, versionAsDouble);
 //                                                     FREE(versionAsDouble);
 //                                                     versionAsDouble = NULL;
 //
@@ -309,45 +309,45 @@ Function::ReturnValue sci_getversion(types::typed_list &in, int _iRetCount, type
 //     return 0;
 //}
 ///*--------------------------------------------------------------------------*/
-//int getversion_two_rhs(char *fname, int* _piKey)
+//int getversion_two_rhs(char *fname, void* pvApiCtx)
 //{
 //     SciErr sciErr;
 //     int *piAddressVarOne = NULL;
 //     int *piAddressVarTwo = NULL;
 //
-//     sciErr = getVarAddressFromPosition(_piKey, 1, &piAddressVarOne);
+//     sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
 //     if(sciErr.iErr)
 //     {
 //             printError(&sciErr, 0);
 //             return 0;
 //     }
 //
-//     sciErr = getVarAddressFromPosition(_piKey, 2, &piAddressVarTwo);
+//     sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
 //     if(sciErr.iErr)
 //     {
 //             printError(&sciErr, 0);
 //             return 0;
 //     }
 //
-//     if (isStringType(_piKey, piAddressVarOne) && isStringType(_piKey, piAddressVarTwo))
+//     if (isStringType(pvApiCtx, piAddressVarOne) && isStringType(pvApiCtx, piAddressVarTwo))
 //     {
 //             char *modulename = NULL;
 //             char *optionname = NULL;
 //
-//             if (!isScalar(_piKey, piAddressVarOne))
+//             if (!isScalar(pvApiCtx, piAddressVarOne))
 //             {
 //                     Scierror(999,_("%s: Wrong size for input argument #%d: String expected.\n"), fname, 1);
 //                     return 0;
 //             }
 //
-//             if (!isScalar(_piKey, piAddressVarTwo))
+//             if (!isScalar(pvApiCtx, piAddressVarTwo))
 //             {
 //                     Scierror(999,_("%s: Wrong size for input argument #%d: String expected.\n"), fname, 2);
 //                     return 0;
 //             }
 //
-//             if ( (getAllocatedSingleString(_piKey, piAddressVarOne, &modulename) == 0) &&
-//                     (getAllocatedSingleString(_piKey, piAddressVarTwo, &optionname) == 0) )
+//             if ( (getAllocatedSingleString(pvApiCtx, piAddressVarOne, &modulename) == 0) &&
+//                     (getAllocatedSingleString(pvApiCtx, piAddressVarTwo, &optionname) == 0) )
 //             {
 //                     if ( (modulename) && (optionname) )
 //                     {
@@ -359,7 +359,7 @@ Function::ReturnValue sci_getversion(types::typed_list &in, int _iRetCount, type
 //
 //                                             if (versionInfo)
 //                                             {
-//                                                     createSingleString(_piKey, Rhs + 1, versionInfo);
+//                                                     createSingleString(pvApiCtx, Rhs + 1, versionInfo);
 //
 //                                                     FREE(versionInfo);
 //                                                     versionInfo = NULL;
index 4d53bc2..a8ec637 100644 (file)
@@ -34,7 +34,7 @@ types::Function::ReturnValue sci_getdynlibext(types::typed_list &in, int _iRetCo
        //CheckRhs(0,0);
        //CheckLhs(1,1);
 
- //   createSingleString(_piKey, Rhs + 1, SHARED_LIB_EXT);
+ //   createSingleString(pvApiCtx, Rhs + 1, SHARED_LIB_EXT);
 
        //LhsVar(1) = Rhs+1;
        //PutLhsVar();
index f9030e7..728ae94 100644 (file)
@@ -69,7 +69,7 @@ types::Function::ReturnValue sci_ilib_verbose(types::typed_list &in, int _iRetCo
 
     //if(Rhs == 0)
     //{
-    //    if(createScalarDouble(_piKey, Rhs + 1, (double)getIlibVerboseLevel()))
+    //    if(createScalarDouble(pvApiCtx, Rhs + 1, (double)getIlibVerboseLevel()))
     //    {
     //        return 1;
     //    }
@@ -78,20 +78,20 @@ types::Function::ReturnValue sci_ilib_verbose(types::typed_list &in, int _iRetCo
     //}
     //else
     //{
-    //    sciErr = getVarAddressFromPosition(_piKey, 1, &piAddress);
+    //    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddress);
     //    if(sciErr.iErr)
     //    {
     //        printError(&sciErr, 0);
     //        return sciErr.iErr;
     //    }
 
-    //    if(isDoubleType(_piKey, piAddress) == 0)
+    //    if(isDoubleType(pvApiCtx, piAddress) == 0)
     //    {
     //        Scierror(999,_("%s: Wrong type for input argument #%d: A int expected.\n"),fname,1);
     //        return 1;
     //    }
 
-    //    if(getScalarDouble(_piKey, piAddress, &dblLevel))
+    //    if(getScalarDouble(pvApiCtx, piAddress, &dblLevel))
     //    {
     //        return 1;
     //    }
index 06005b2..2686139 100644 (file)
 #include "basic_functions.h"
 #include "api_oldstack.h"
 
-SciErr abs_double(int* _piKey, int* _piAddress);
-SciErr abs_poly(int* _piKey, int* _piAddress);
-SciErr abs_sparse(int* _piKey, int* _piAddress);
+SciErr abs_double(void* pvApiCtx, int* _piAddress);
+SciErr abs_poly(void* pvApiCtx, int* _piAddress);
+SciErr abs_sparse(void* pvApiCtx, int* _piAddress);
 
-int sci_abs(char *fname, int* _piKey)
+int sci_abs(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int iType                       = 0;
@@ -30,14 +30,14 @@ int sci_abs(char *fname, int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -47,13 +47,13 @@ int sci_abs(char *fname, int* _piKey)
        switch(iType)
        {
        case sci_matrix:
-               sciErr = abs_double(_piKey, piAddr);
+               sciErr = abs_double(pvApiCtx, piAddr);
                break;
        case sci_poly:
-               sciErr = abs_poly(_piKey, piAddr);
+               sciErr = abs_poly(pvApiCtx, piAddr);
                break;
        case sci_sparse:
-               sciErr = abs_sparse(_piKey, piAddr);
+               sciErr = abs_sparse(pvApiCtx, piAddr);
                break;
        default:
                OverLoad(1);
@@ -72,7 +72,7 @@ int sci_abs(char *fname, int* _piKey)
 }
 
 /*Absolute value for a double*/
-SciErr abs_double(int* _piKey, int* _piAddress)
+SciErr abs_double(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i;
@@ -83,15 +83,15 @@ SciErr abs_double(int* _piKey, int* _piAddress)
 
        double* pdblRealRet     = NULL;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -104,13 +104,13 @@ SciErr abs_double(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -125,7 +125,7 @@ SciErr abs_double(int* _piKey, int* _piAddress)
 }
 
 /*Absolute value for a polynomial ( absolute value of each coefficient )*/
-SciErr abs_poly(int* _piKey, int* _piAddress)
+SciErr abs_poly(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i,j;
@@ -139,7 +139,7 @@ SciErr abs_poly(int* _piKey, int* _piAddress)
        double** pdblImg                        = NULL;
        double** pdblRealRet    = NULL;
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -147,22 +147,22 @@ SciErr abs_poly(int* _piKey, int* _piAddress)
        
        pstVarName = (char*)MALLOC(sizeof(char) * (iLen + 1));
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
        }
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)MALLOC(iRows * iCols * sizeof(int));
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -179,7 +179,7 @@ SciErr abs_poly(int* _piKey, int* _piAddress)
                        pdblRealRet[i]  = (double*)MALLOC(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -193,7 +193,7 @@ SciErr abs_poly(int* _piKey, int* _piAddress)
                        }
                }
 
-               sciErr = createMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -201,14 +201,14 @@ SciErr abs_poly(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)MALLOC(iRows * iCols * sizeof(int));
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -223,7 +223,7 @@ SciErr abs_poly(int* _piKey, int* _piAddress)
                        pdblRealRet[i]  = (double*)MALLOC(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -237,7 +237,7 @@ SciErr abs_poly(int* _piKey, int* _piAddress)
                        }
                }
 
-               sciErr = createMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -254,7 +254,7 @@ SciErr abs_poly(int* _piKey, int* _piAddress)
        FREE(pdblReal);
        FREE(pdblRealRet);
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
                for(i = 0 ; i < iRows * iCols ; i++)
                {
@@ -266,7 +266,7 @@ SciErr abs_poly(int* _piKey, int* _piAddress)
 }
 
 /*Absolute value for a sparse ( absolute value of each element )*/
-SciErr abs_sparse(int* _piKey, int* _piAddress)
+SciErr abs_sparse(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i;
@@ -284,9 +284,9 @@ SciErr abs_sparse(int* _piKey, int* _piAddress)
        double *pdblImg                 = NULL;
        double *pdblRealRet     = NULL;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexSparseMatrix(_piKey, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg);
+               sciErr = getComplexSparseMatrix(pvApiCtx, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -299,7 +299,7 @@ SciErr abs_sparse(int* _piKey, int* _piAddress)
                        pdblRealRet[i] = dabsz(pdblReal[i], pdblImg[i]);
                }
 
-               sciErr = createSparseMatrix(_piKey, Rhs + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblRealRet);
+               sciErr = createSparseMatrix(pvApiCtx, Rhs + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -307,7 +307,7 @@ SciErr abs_sparse(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getSparseMatrix(_piKey, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal);
+               sciErr = getSparseMatrix(pvApiCtx, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -320,7 +320,7 @@ SciErr abs_sparse(int* _piKey, int* _piAddress)
                        pdblRealRet[i] = dabss(pdblReal[i]);
                }
 
-               sciErr = createSparseMatrix(_piKey, Rhs + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblRealRet);
+               sciErr = createSparseMatrix(pvApiCtx, Rhs + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
index 40cf2aa..f7c9edf 100644 (file)
@@ -17,7 +17,7 @@
 #include "api_oldstack.h"
 
 /*--------------------------------------------------------------------------*/
-int sci_acos(char *fname, int*_piKey)
+int sci_acos(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -35,7 +35,7 @@ int sci_acos(char *fname, int*_piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -43,7 +43,7 @@ int sci_acos(char *fname, int*_piKey)
        }
 
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -56,16 +56,16 @@ int sci_acos(char *fname, int*_piKey)
                return 0;
        }
 
-       if(isVarComplex(_piKey, piAddr))
+       if(isVarComplex(pvApiCtx, piAddr))
        {// case complex
-               sciErr = getComplexMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -81,7 +81,7 @@ int sci_acos(char *fname, int*_piKey)
        {// case real
                int             itr                             = 0;
 
-               sciErr = getMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -101,7 +101,7 @@ int sci_acos(char *fname, int*_piKey)
 
                if(itr == 0)
                {//all values are in [-1,1]
-                       sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+                       sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
@@ -115,7 +115,7 @@ int sci_acos(char *fname, int*_piKey)
                }
                else
                {// Values outside [-1,1]
-                       sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+                       sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
index 3e1af3e..3ab71f3 100644 (file)
@@ -17,7 +17,7 @@
 #include "api_oldstack.h"
 
 /*--------------------------------------------------------------------------*/
-int sci_asin(char *fname, int*_piKey)
+int sci_asin(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -35,14 +35,14 @@ int sci_asin(char *fname, int*_piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -55,17 +55,17 @@ int sci_asin(char *fname, int*_piKey)
                return 0;
        }
 
-       if(isVarComplex(_piKey, piAddr))
+       if(isVarComplex(pvApiCtx, piAddr))
        {// case complex
 
-               sciErr = getComplexMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -81,7 +81,7 @@ int sci_asin(char *fname, int*_piKey)
        {// case real
                int             itr                             = 0;
 
-               sciErr = getMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -100,7 +100,7 @@ int sci_asin(char *fname, int*_piKey)
 
                if(itr == 0)
                {//all values are in [-1,1]
-                       sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+                       sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
@@ -114,7 +114,7 @@ int sci_asin(char *fname, int*_piKey)
                }
                else
                {// Values outside [-1,1]
-                       sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+                       sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
index 4b5ea90..9804e8e 100644 (file)
@@ -21,7 +21,7 @@
 #include "msgs.h"
 
 /*--------------------------------------------------------------------------*/
-int sci_atan(char *fname, int*_piKey)
+int sci_atan(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -45,14 +45,14 @@ int sci_atan(char *fname, int*_piKey)
        CheckRhs(1,2);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr1);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr1, &iType1);
+       sciErr = getVarType(pvApiCtx, piAddr1, &iType1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -67,16 +67,16 @@ int sci_atan(char *fname, int*_piKey)
 
        if(Rhs == 1)
        {
-               if(isVarComplex(_piKey, piAddr1))
+               if(isVarComplex(pvApiCtx, piAddr1))
                {// case complex
-                       sciErr = getComplexMatrixOfDouble(_piKey, piAddr1, &iRows1, &iCols1, &pdblReal1, &pdblImg1);
+                       sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr1, &iRows1, &iCols1, &pdblReal1, &pdblImg1);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
                                return 0;
                        }
 
-                       sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows1, iCols1, &pdblRealRet, &pdblImgRet);
+                       sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows1, iCols1, &pdblRealRet, &pdblImgRet);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
@@ -97,14 +97,14 @@ int sci_atan(char *fname, int*_piKey)
                }
                else
                {// case real
-                       sciErr = getMatrixOfDouble(_piKey, piAddr1, &iRows1, &iCols1, &pdblReal1);
+                       sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows1, &iCols1, &pdblReal1);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
                                return 0;
                        }
 
-                       sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows1, iCols1, &pdblRealRet);
+                       sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows1, iCols1, &pdblRealRet);
                        for(i = 0 ; i < iRows1 * iCols1 ; i++)
                        {
                                pdblRealRet[i] = datans(pdblReal1[i]);
@@ -113,23 +113,23 @@ int sci_atan(char *fname, int*_piKey)
        }
        else
        {//Rhs == 2
-               sciErr = getVarAddressFromPosition(_piKey, 2, &piAddr2);
+               sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               if(isVarComplex(_piKey, piAddr1) == FALSE && isVarComplex(_piKey, piAddr2) == FALSE)
+               if(isVarComplex(pvApiCtx, piAddr1) == FALSE && isVarComplex(pvApiCtx, piAddr2) == FALSE)
                {//Only works with real matrix
-                       sciErr = getMatrixOfDouble(_piKey, piAddr1, &iRows1, &iCols1, &pdblReal1);
+                       sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows1, &iCols1, &pdblReal1);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
                                return 0;
                        }
 
-                       sciErr = getMatrixOfDouble(_piKey, piAddr2, &iRows2, &iCols2, &pdblReal2);
+                       sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows2, &iCols2, &pdblReal2);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
@@ -138,7 +138,7 @@ int sci_atan(char *fname, int*_piKey)
 
                        if(iRows1 * iCols1 == iRows2 * iCols2)
                        {
-                               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows1, iCols1, &pdblRealRet);
+                               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows1, iCols1, &pdblRealRet);
                                for(i = 0 ; i < iRows1 * iCols1 ; i++)
                                {
                                        pdblRealRet[i] = datan2s(pdblReal1[i], pdblReal2[i]);
index 4374c83..c8d6ebd 100644 (file)
 #include "api_scilab.h"
 #include "api_oldstack.h"
 
-SciErr ceil_double(int* _piKey, int* _piAddress);
-SciErr ceil_poly(int* _piKey, int* _piAddress);
-SciErr ceil_int(int* _piKey, int* _piAddress);
+SciErr ceil_double(void* pvApiCtx, int* _piAddress);
+SciErr ceil_poly(void* pvApiCtx, int* _piAddress);
+SciErr ceil_int(void* pvApiCtx, int* _piAddress);
 
 /*--------------------------------------------------------------------------*/
-int sci_ceil(char *fname, int* _piKey)
+int sci_ceil(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int iType               = 0;
@@ -32,14 +32,14 @@ int sci_ceil(char *fname, int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -49,13 +49,13 @@ int sci_ceil(char *fname, int* _piKey)
        switch(iType)
        {
        case sci_matrix :
-               sciErr = ceil_double(_piKey, piAddr);
+               sciErr = ceil_double(pvApiCtx, piAddr);
                break;
        case sci_poly :
-               sciErr = ceil_poly(_piKey, piAddr);
+               sciErr = ceil_poly(pvApiCtx, piAddr);
                break;
        case sci_ints :
-               sciErr = ceil_int(_piKey, piAddr);
+               sciErr = ceil_int(pvApiCtx, piAddr);
                break;
        default :
                OverLoad(1);
@@ -72,7 +72,7 @@ int sci_ceil(char *fname, int* _piKey)
        return 0;
 }
 
-SciErr ceil_double(int* _piKey, int* _piAddress)
+SciErr ceil_double(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i;
@@ -83,15 +83,15 @@ SciErr ceil_double(int* _piKey, int* _piAddress)
        double *pdblRealRet     = NULL;
        double *pdblImgRet      = NULL;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -105,13 +105,13 @@ SciErr ceil_double(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -127,7 +127,7 @@ SciErr ceil_double(int* _piKey, int* _piAddress)
        return sciErr;
 }
 
-SciErr ceil_poly(int* _piKey, int* _piAddress)
+SciErr ceil_poly(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i,j;
@@ -141,7 +141,7 @@ SciErr ceil_poly(int* _piKey, int* _piAddress)
        int *piCoeff                                    = NULL;
        char* pstVarName                        = NULL;
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -149,22 +149,22 @@ SciErr ceil_poly(int* _piKey, int* _piAddress)
        
        pstVarName = (char*)MALLOC(sizeof(char) * (iLen + 1));
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
        }
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)MALLOC(iRows * iCols * sizeof(int));
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -183,7 +183,7 @@ SciErr ceil_poly(int* _piKey, int* _piAddress)
                        pdblImgRet[i]           = (double*)MALLOC(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -198,7 +198,7 @@ SciErr ceil_poly(int* _piKey, int* _piAddress)
                        }
                }
 
-               sciErr = createComplexMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
+               sciErr = createComplexMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -214,7 +214,7 @@ SciErr ceil_poly(int* _piKey, int* _piAddress)
                FREE(pdblReal);
                FREE(pdblRealRet);
 
-               if(isVarComplex(_piKey, _piAddress))
+               if(isVarComplex(pvApiCtx, _piAddress))
                {
                        for(i = 0 ; i < iRows * iCols ; i++)
                        {
@@ -227,14 +227,14 @@ SciErr ceil_poly(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)MALLOC(iRows * iCols * sizeof(int));
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -249,7 +249,7 @@ SciErr ceil_poly(int* _piKey, int* _piAddress)
                        pdblRealRet[i]  = (double*)MALLOC(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -263,7 +263,7 @@ SciErr ceil_poly(int* _piKey, int* _piAddress)
                        }
                }
 
-               sciErr = createMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -285,7 +285,7 @@ SciErr ceil_poly(int* _piKey, int* _piAddress)
        return sciErr;
 }
 
-SciErr ceil_int(int* _piKey, int* _piAddress)
+SciErr ceil_int(void* pvApiCtx, int* _piAddress)
 {//No change for integer
        SciErr sciErr;sciErr.iErr = 0;
        LhsVar(1) = 1;
index daab10f..f4dfb8f 100644 (file)
@@ -23,11 +23,11 @@ extern int sci_spclean (char *fname,unsigned long fname_len);
 extern int C2F(ref2val) (void);
 extern double C2F(dasum)();
 
-SciErr clean_double(int* _piKey, int* _piAddress);
-int clean_poly(int* _piKey, int* _piAddress);
-int clean_sparse(int* _piKey, int* _piAddress);
+SciErr clean_double(void* pvApiCtx, int* _piAddress);
+int clean_poly(void* pvApiCtx, int* _piAddress);
+int clean_sparse(void* pvApiCtx, int* _piAddress);
 
-int sci_clean(char *fname, int*_piKey)
+int sci_clean(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
 
@@ -37,14 +37,14 @@ int sci_clean(char *fname, int*_piKey)
        CheckRhs(1,3);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr1);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr1, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr1, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -54,7 +54,7 @@ int sci_clean(char *fname, int*_piKey)
        switch(iType)
        {
        case sci_matrix :
-               sciErr = clean_double(_piKey, piAddr1);
+               sciErr = clean_double(pvApiCtx, piAddr1);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -64,10 +64,10 @@ int sci_clean(char *fname, int*_piKey)
                PutLhsVar();
                break;
        case sci_poly :
-               clean_poly(_piKey, piAddr1);
+               clean_poly(pvApiCtx, piAddr1);
                break;
        case sci_sparse :
-               clean_sparse(_piKey, piAddr1);
+               clean_sparse(pvApiCtx, piAddr1);
                break;
        default :
                OverLoad(1);
@@ -77,20 +77,20 @@ int sci_clean(char *fname, int*_piKey)
        return 0;
 }
 
-int clean_poly(int* _piKey, int* _piAddress)
+int clean_poly(void* pvApiCtx, int* _piAddress)
 {
        sci_cleanp("clean", 5);
        return 0;
 }
 
-int clean_sparse(int* _piKey, int* _piAddress)
+int clean_sparse(void* pvApiCtx, int* _piAddress)
 {
        C2F(ref2val)();
        sci_spclean("clean", 5);
        return 0;
 }
 
-SciErr clean_double(int* _piKey, int* _piAddress)
+SciErr clean_double(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i;
@@ -121,13 +121,13 @@ SciErr clean_double(int* _piKey, int* _piAddress)
 
        if(Rhs == 3)
        {
-               sciErr = getVarAddressFromPosition(_piKey, 3, &piAddr3);
+               sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = getMatrixOfDouble(_piKey, piAddr3, &iRows3, &iCols3, &pdblReal3);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &iRows3, &iCols3, &pdblReal3);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -143,13 +143,13 @@ SciErr clean_double(int* _piKey, int* _piAddress)
 
        if(Rhs >= 2)
        {
-               sciErr = getVarAddressFromPosition(_piKey, 2, &piAddr2);
+               sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = getMatrixOfDouble(_piKey, piAddr2, &iRows2, &iCols2, &pdblReal2);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows2, &iCols2, &pdblReal2);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -163,9 +163,9 @@ SciErr clean_double(int* _piKey, int* _piAddress)
                dblEpsA = pdblReal2[0];
        }
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, _piAddress, &iRows1, &iCols1, &pdblReal1, &pdblImg1);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows1, &iCols1, &pdblReal1, &pdblImg1);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -174,7 +174,7 @@ SciErr clean_double(int* _piKey, int* _piAddress)
 
                dblNorm = wasums(iRows1 * iCols1, pdblReal1, pdblImg1);
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows1, iCols1, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows1, iCols1, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -193,7 +193,7 @@ SciErr clean_double(int* _piKey, int* _piAddress)
                int iOne        = 1;
                int iSize1      = 0;
 
-               sciErr = getMatrixOfDouble(_piKey, _piAddress, &iRows1, &iCols1, &pdblReal1);
+               sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows1, &iCols1, &pdblReal1);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -204,7 +204,7 @@ SciErr clean_double(int* _piKey, int* _piAddress)
                dblNorm                 = C2F(dasum)(&iSize1, pdblReal1, &iOne);
 
                dblEps = Max(dblEpsA, dblEpsR * dblNorm);
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows1, iCols1, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows1, iCols1, &pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
index 05d9417..e49bcf5 100644 (file)
 
 extern int C2F(dscal)();
 
-SciErr conj_double(int*_piKey, int* _piAddress);
-SciErr conj_poly(int*_piKey, int* _piAddress);
+SciErr conj_double(void* pvApiCtx, int* _piAddress);
+SciErr conj_poly(void* pvApiCtx, int* _piAddress);
 
-int sci_conj(char *fname, int* _piKey)
+int sci_conj(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int iType               = 0;
@@ -30,14 +30,14 @@ int sci_conj(char *fname, int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -47,10 +47,10 @@ int sci_conj(char *fname, int* _piKey)
        switch(iType)
        {
        case sci_matrix :
-               sciErr = conj_double(_piKey, piAddr);
+               sciErr = conj_double(pvApiCtx, piAddr);
                break;
        case sci_poly :
-               sciErr = conj_poly(_piKey, piAddr);
+               sciErr = conj_poly(pvApiCtx, piAddr);
                break;
        default :
                OverLoad(1);
@@ -67,7 +67,7 @@ int sci_conj(char *fname, int* _piKey)
        return 0;
 }
 
-SciErr conj_double(int*_piKey, int* _piAddress)
+SciErr conj_double(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int iRows                                               = 0;
@@ -81,9 +81,9 @@ SciErr conj_double(int*_piKey, int* _piAddress)
        int iSize                                               = 0;
        double dblCoef                  = -1;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -91,7 +91,7 @@ SciErr conj_double(int*_piKey, int* _piAddress)
 
                iSize = iRows * iCols;
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -104,13 +104,13 @@ SciErr conj_double(int*_piKey, int* _piAddress)
        }
        else
        {//do nothing, just copy in a new variable
-               sciErr = getMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = createMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, pdblReal);
+               sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -119,7 +119,7 @@ SciErr conj_double(int*_piKey, int* _piAddress)
        return sciErr;
 }
 
-SciErr conj_poly(int*_piKey, int* _piAddress)
+SciErr conj_poly(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i;
@@ -136,16 +136,16 @@ SciErr conj_poly(int*_piKey, int* _piAddress)
        int iSize                                                       = 0;
        double dblCoef                          = -1;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)malloc(iRows * iCols * sizeof(int));
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -164,7 +164,7 @@ SciErr conj_poly(int*_piKey, int* _piAddress)
                        pdblImgRet[i]           = (double*)malloc(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -177,7 +177,7 @@ SciErr conj_poly(int*_piKey, int* _piAddress)
                        C2F(dscal)(&piCoeff[i], &dblCoef, pdblImgRet[i], &iOne);
                }
 
-               sciErr = createComplexMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
+               sciErr = createComplexMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -185,14 +185,14 @@ SciErr conj_poly(int*_piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)malloc(iRows * iCols * sizeof(int));
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -204,13 +204,13 @@ SciErr conj_poly(int*_piKey, int* _piAddress)
                        pdblReal[i] = (double*)malloc(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = createMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblReal);
+               sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -226,7 +226,7 @@ SciErr conj_poly(int*_piKey, int* _piAddress)
        }
        free(pdblReal);
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
                for(i = 0 ; i < iRows * iCols ; i++)
                {
index 13dfd40..aaea63a 100644 (file)
@@ -17,7 +17,7 @@
 #include "api_oldstack.h"
 
 /*--------------------------------------------------------------------------*/
-int sci_cos(char *fname, int* _piKey)
+int sci_cos(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -34,14 +34,14 @@ int sci_cos(char *fname, int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 1;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -54,16 +54,16 @@ int sci_cos(char *fname, int* _piKey)
                return 0;
        }
 
-       if(isVarComplex(_piKey, piAddr))
+       if(isVarComplex(pvApiCtx, piAddr))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 1;
                }
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -77,14 +77,14 @@ int sci_cos(char *fname, int* _piKey)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 1;
                }
 
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index 744cb4b..6dca3c1 100644 (file)
@@ -19,7 +19,7 @@
 #include "api_oldstack.h"
 
 
-int sci_cumprod(char *fname, int*_piKey)
+int sci_cumprod(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -38,14 +38,14 @@ int sci_cumprod(char *fname, int*_piKey)
        CheckRhs(1,2);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr1);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr1, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr1, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -60,7 +60,7 @@ int sci_cumprod(char *fname, int*_piKey)
 
        if(Rhs == 2)
        {
-               sciErr = getProcessMode(_piKey, 2, piAddr1, &iMode);
+               sciErr = getProcessMode(pvApiCtx, 2, piAddr1, &iMode);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -68,16 +68,16 @@ int sci_cumprod(char *fname, int*_piKey)
                }
        }
 
-       if(isVarComplex(_piKey, piAddr1))
+       if(isVarComplex(pvApiCtx, piAddr1))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, piAddr1, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr1, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -124,14 +124,14 @@ int sci_cumprod(char *fname, int*_piKey)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, piAddr1, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index a28bebf..170b9d6 100644 (file)
@@ -18,7 +18,7 @@
 #include "api_oldstack.h"
 
 /*--------------------------------------------------------------------------*/
-int sci_cumsum(char *fname, int*_piKey)
+int sci_cumsum(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -37,14 +37,14 @@ int sci_cumsum(char *fname, int*_piKey)
        CheckRhs(1,2);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr1);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr1, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr1, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -59,7 +59,7 @@ int sci_cumsum(char *fname, int*_piKey)
 
        if(Rhs == 2)
        {
-               sciErr = getProcessMode(_piKey, 2, piAddr1, &iMode);
+               sciErr = getProcessMode(pvApiCtx, 2, piAddr1, &iMode);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -67,16 +67,16 @@ int sci_cumsum(char *fname, int*_piKey)
                }
        }
 
-       if(isVarComplex(_piKey, piAddr1))
+       if(isVarComplex(pvApiCtx, piAddr1))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, piAddr1, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr1, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -119,14 +119,14 @@ int sci_cumsum(char *fname, int*_piKey)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, piAddr1, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index ad94c8e..feeb021 100644 (file)
 #include "Scierror.h"
 #include "api_oldstack.h"
 
-SciErr getStartPosition(int* _piKey, int _iPos, int* _piStartPos);
+SciErr getStartPosition(void* pvApiCtx, int _iPos, int* _piStartPos);
 
-SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos);
-int diag_poly(int* _piKey, int* _piAddress, int _iStartPos);
+SciErr diag_double(void* pvApiCtx, int* _piAddress, int _iStartPos);
+int diag_poly(void* pvApiCtx, int* _piAddress, int _iStartPos);
 
 extern int sci_pdiag(char *fname,unsigned long fname_len);
 
 
-int sci_diag(char *fname, int*_piKey)
+int sci_diag(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int iRows                                               = 0;
@@ -42,7 +42,7 @@ int sci_diag(char *fname, int*_piKey)
 
        if(Rhs == 2)
        {
-               sciErr = getStartPosition(_piKey, 2, &iStartPos);
+               sciErr = getStartPosition(pvApiCtx, 2, &iStartPos);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -50,14 +50,14 @@ int sci_diag(char *fname, int*_piKey)
                }
        }
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -67,7 +67,7 @@ int sci_diag(char *fname, int*_piKey)
        switch(iType)
        {
        case sci_matrix :
-               sciErr = diag_double(_piKey, piAddr, iStartPos);
+               sciErr = diag_double(pvApiCtx, piAddr, iStartPos);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -75,7 +75,7 @@ int sci_diag(char *fname, int*_piKey)
                }
                break;
        case sci_poly :
-               if(diag_poly(_piKey, piAddr, iStartPos))
+               if(diag_poly(pvApiCtx, piAddr, iStartPos))
                {
                        return 1;
                }
@@ -90,7 +90,7 @@ int sci_diag(char *fname, int*_piKey)
        return 0;
 }
 
-SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos)
+SciErr diag_double(void* pvApiCtx, int* _piAddress, int _iStartPos)
 {
        SciErr sciErr;
        int iRows                                               = 0;
@@ -102,9 +102,9 @@ SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos)
        double *pdblRealRet = NULL;
        double *pdblImgRet      = NULL;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -112,7 +112,7 @@ SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -131,20 +131,20 @@ SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos)
                        iRows = 0;
                        iCols = 0;
 
-                       sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+                       sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                        return sciErr;
                }
                else
                {
                        int iIncIn      = iRows + 1;
                        int iIncOut = 1;
-                       if(isVarComplex(_piKey, _piAddress))
+                       if(isVarComplex(pvApiCtx, _piAddress))
                        {
-                               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iMatrixSize, 1, &pdblRealRet, &pdblImgRet);
+                               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iMatrixSize, 1, &pdblRealRet, &pdblImgRet);
                        }
                        else
                        {
-                               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iMatrixSize, 1, &pdblRealRet);
+                               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iMatrixSize, 1, &pdblRealRet);
                        }
 
                        if(sciErr.iErr)
@@ -157,7 +157,7 @@ SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos)
                                double *pdblStartAddr = pdblReal + _iStartPos * iRows;
                                C2F(unsfdcopy)(&iMatrixSize, pdblStartAddr, &iIncIn, pdblRealRet, &iIncOut);
 
-                               if(isVarComplex(_piKey, _piAddress))
+                               if(isVarComplex(pvApiCtx, _piAddress))
                                {
                                        pdblStartAddr = pdblImg + _iStartPos * iRows;
                                        C2F(unsfdcopy)(&iMatrixSize, pdblStartAddr, &iIncIn, pdblImgRet, &iIncOut);
@@ -168,7 +168,7 @@ SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos)
                                double *pdblStartAddr = pdblReal - _iStartPos;
                                C2F(unsfdcopy)(&iMatrixSize, pdblStartAddr, &iIncIn, pdblRealRet, &iIncOut);
 
-                               if(isVarComplex(_piKey, _piAddress))
+                               if(isVarComplex(pvApiCtx, _piAddress))
                                {
                                        pdblStartAddr = pdblImg - _iStartPos;
                                        C2F(unsfdcopy)(&iMatrixSize, pdblStartAddr, &iIncIn, pdblImgRet, &iIncOut);
@@ -188,9 +188,9 @@ SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos)
                iMatrixSize = Max(iRows, iCols) + (int)dabss(_iStartPos);
                iIncOut = iMatrixSize + 1;
 
-               if(isVarComplex(_piKey, _piAddress))
+               if(isVarComplex(pvApiCtx, _piAddress))
                {
-                       sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iMatrixSize, iMatrixSize, &pdblRealRet, &pdblImgRet);
+                       sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iMatrixSize, iMatrixSize, &pdblRealRet, &pdblImgRet);
                        if(sciErr.iErr)
                        {
                                return sciErr;
@@ -200,7 +200,7 @@ SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos)
                }
                else
                {
-                       sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iMatrixSize, iMatrixSize, &pdblRealRet);
+                       sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iMatrixSize, iMatrixSize, &pdblRealRet);
                        if(sciErr.iErr)
                        {
                                return sciErr;
@@ -214,7 +214,7 @@ SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos)
                        double *pdblStartAddr = pdblRealRet + iMatrixSize * _iStartPos;
                        C2F(unsfdcopy)(&iOriginalSize, pdblReal, &iIncIn, pdblStartAddr, &iIncOut);
 
-                       if(isVarComplex(_piKey, _piAddress))
+                       if(isVarComplex(pvApiCtx, _piAddress))
                        {
                                pdblStartAddr = pdblImgRet + iMatrixSize * _iStartPos;
                                C2F(unsfdcopy)(&iOriginalSize, pdblImg, &iIncIn, pdblStartAddr, &iIncOut);
@@ -225,7 +225,7 @@ SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos)
                        double *pdblStartAddr = pdblRealRet - _iStartPos;
                        C2F(unsfdcopy)(&iOriginalSize, pdblReal, &iIncIn, pdblStartAddr, &iIncOut);
 
-                       if(isVarComplex(_piKey, _piAddress))
+                       if(isVarComplex(pvApiCtx, _piAddress))
                        {
                                pdblStartAddr = pdblImgRet - _iStartPos;
                                C2F(unsfdcopy)(&iOriginalSize, pdblImg, &iIncIn, pdblStartAddr, &iIncOut);
@@ -235,13 +235,13 @@ SciErr diag_double(int* _piKey, int* _piAddress, int _iStartPos)
        return sciErr;
 }
 
-int diag_poly(int* _piKey, int* _piAddress, int _iStartPos)
+int diag_poly(void* pvApiCtx, int* _piAddress, int _iStartPos)
 {
        sci_pdiag("diag", 4);
        return 0;
 }
 
-SciErr getStartPosition(int* _piKey, int _iPos, int* _piStartPos)
+SciErr getStartPosition(void* pvApiCtx, int _iPos, int* _piStartPos)
 {
        SciErr sciErr;
        int iRows                                       = 0;
@@ -249,13 +249,13 @@ SciErr getStartPosition(int* _piKey, int _iPos, int* _piStartPos)
        int* piAddr                             = NULL;
        double* pdblReal        = NULL;
 
-       sciErr = getVarAddressFromPosition(_piKey, _iPos, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, _iPos, &piAddr);
        if(sciErr.iErr)
        {
                return sciErr;
        }
 
-       sciErr = getMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal);
+       sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
        if(sciErr.iErr)
        {
                return sciErr;
index b860c35..327a9d2 100644 (file)
 #include "Scierror.h"
 #include "api_oldstack.h"
 
-static int getMode(int* _piKey, int _iPos, char *_pcMode);
+static int getMode(void* pvApiCtx, int _iPos, char *_pcMode);
 
 /*--------------------------------------------------------------------------*/
 
-int sci_dsearch(char *fname, int* _piKey)
+int sci_dsearch(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -52,28 +52,28 @@ int sci_dsearch(char *fname, int* _piKey)
        CheckRhs(2,3);
        CheckLhs(1,3);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr1);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarAddressFromPosition(_piKey, 2, &piAddr2);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr1, &iType1);
+       sciErr = getVarType(pvApiCtx, piAddr1, &iType1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr2, &iType2);
+       sciErr = getVarType(pvApiCtx, piAddr2, &iType2);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -89,7 +89,7 @@ int sci_dsearch(char *fname, int* _piKey)
        //get ch
        if(Rhs == 3)
        {
-               int iRet = getMode(_piKey, 3, &cMode);
+               int iRet = getMode(pvApiCtx, 3, &cMode);
                if(iRet)
                {
                        return 0;
@@ -107,14 +107,14 @@ int sci_dsearch(char *fname, int* _piKey)
                return 0;
        }
 
-       if(isVarComplex(_piKey, piAddr1) || isVarComplex(_piKey, piAddr2))
+       if(isVarComplex(pvApiCtx, piAddr1) || isVarComplex(pvApiCtx, piAddr2))
        {
                SciError(202);
                return 0;
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, piAddr2, &iRows2, &iCols2, &pdblReal2);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows2, &iCols2, &pdblReal2);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -163,7 +163,7 @@ int sci_dsearch(char *fname, int* _piKey)
        }
 
        //Get X
-       sciErr = getMatrixOfDouble(_piKey, piAddr1, &iRows1, &iCols1, &pdblReal1);
+       sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows1, &iCols1, &pdblReal1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -172,7 +172,7 @@ int sci_dsearch(char *fname, int* _piKey)
 
        if(Lhs >= 1)
        {
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows1, iCols1, &pdblRealInd);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows1, iCols1, &pdblRealInd);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -182,7 +182,7 @@ int sci_dsearch(char *fname, int* _piKey)
 
        if(Lhs >= 2)
        {
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 2, iRowsOcc, iColsOcc, &pdblRealOcc);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 2, iRowsOcc, iColsOcc, &pdblRealOcc);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -192,7 +192,7 @@ int sci_dsearch(char *fname, int* _piKey)
 
        if(Lhs >= 3)
        {
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 3, 1, 1, &pdblRealInfo);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 3, 1, 1, &pdblRealInfo);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -240,7 +240,7 @@ int sci_dsearch(char *fname, int* _piKey)
        return 0;
 }
 
-static int getMode(int* _piKey, int _iPos, char *_pcMode)
+static int getMode(void* pvApiCtx, int _iPos, char *_pcMode)
 {
        SciErr sciErr;
        int iRows                       = 0;
@@ -251,7 +251,7 @@ static int getMode(int* _piKey, int _iPos, char *_pcMode)
        int iLen                        = 0;
        char *pstMode   = NULL;
 
-       sciErr = getVarAddressFromPosition(_piKey, _iPos, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, _iPos, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -259,7 +259,7 @@ static int getMode(int* _piKey, int _iPos, char *_pcMode)
        }
 
 
-       sciErr = getVarDimension(_piKey, piAddr, &iRows, &iCols);
+       sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -268,8 +268,8 @@ static int getMode(int* _piKey, int _iPos, char *_pcMode)
 
        if(iRows == 1 && iCols == 1)
        {
-               int iRet = getAllocatedSingleString(_piKey, piAddr, &pstMode);
-               //sciErr = getMatrixOfString(_piKey, piAddr, &iRows, &iCols, &iLen, &pstMode);
+               int iRet = getAllocatedSingleString(pvApiCtx, piAddr, &pstMode);
+               //sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, &iLen, &pstMode);
                if(iRet)
                {
                        return iRet;
index c40d4f2..8b752d4 100644 (file)
@@ -16,7 +16,7 @@
 #include "api_scilab.h"
 #include "api_oldstack.h"
 
-int sci_exp(char *fname, int* _piKey)
+int sci_exp(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -34,14 +34,14 @@ int sci_exp(char *fname, int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -54,16 +54,16 @@ int sci_exp(char *fname, int* _piKey)
                return 0;
        }
 
-       if(isVarComplex(_piKey, piAddr))
+       if(isVarComplex(pvApiCtx, piAddr))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -77,14 +77,14 @@ int sci_exp(char *fname, int* _piKey)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index bede37a..8eb67ce 100644 (file)
@@ -109,7 +109,7 @@ extern int C2F(wexpm1)();
 extern int C2F(drot)();
 
 /*--------------------------------------------------------------------------*/
-int sci_expm(char *fname, int* _piKey)
+int sci_expm(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int iRet                                                = 0;
@@ -128,14 +128,14 @@ int sci_expm(char *fname, int* _piKey)
        CheckLhs(1,1);
        CheckRhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -148,13 +148,13 @@ int sci_expm(char *fname, int* _piKey)
                return 0;
        }
 
-       if(isVarComplex(_piKey, piAddr))
+       if(isVarComplex(pvApiCtx, piAddr))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
        }
 
        if(sciErr.iErr)
@@ -165,7 +165,7 @@ int sci_expm(char *fname, int* _piKey)
 
        if(iRows * iCols == 0)
        {
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, 0, 0, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, 0, 0, &pdblRealRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -183,9 +183,9 @@ int sci_expm(char *fname, int* _piKey)
                return 0;
        }
 
-       if(isVarComplex(_piKey, piAddr))
+       if(isVarComplex(pvApiCtx, piAddr))
        {
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -200,7 +200,7 @@ int sci_expm(char *fname, int* _piKey)
        }
        else
        {
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index b8b58c8..705eee0 100644 (file)
 #include "api_scilab.h"
 #include "api_oldstack.h"
 
-SciErr floor_poly(int* _piKey, int* _piAddress);
-SciErr floor_double(int* _piKey, int* _piAddress);
-SciErr floor_int(int* _piKey, int* _piAddress);
+SciErr floor_poly(void* pvApiCtx, int* _piAddress);
+SciErr floor_double(void* pvApiCtx, int* _piAddress);
+SciErr floor_int(void* pvApiCtx, int* _piAddress);
 
 
-int sci_floor(char *fname,int* _piKey)
+int sci_floor(char *fname,void* pvApiCtx)
 {
        SciErr sciErr;
 
@@ -32,14 +32,14 @@ int sci_floor(char *fname,int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -49,13 +49,13 @@ int sci_floor(char *fname,int* _piKey)
        switch(iType)
        {
        case sci_matrix :
-               sciErr = floor_double(_piKey, piAddr);
+               sciErr = floor_double(pvApiCtx, piAddr);
                break;
        case sci_poly :
-               sciErr = floor_poly(_piKey, piAddr);
+               sciErr = floor_poly(pvApiCtx, piAddr);
                break;
        case sci_ints :
-               sciErr = floor_int(_piKey, piAddr);
+               sciErr = floor_int(pvApiCtx, piAddr);
                break;
        default:
                OverLoad(1);
@@ -73,7 +73,7 @@ int sci_floor(char *fname,int* _piKey)
        return 0;
 }
 
-SciErr floor_double(int* _piKey, int* _piAddress)
+SciErr floor_double(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i;
@@ -85,15 +85,15 @@ SciErr floor_double(int* _piKey, int* _piAddress)
        double *pdblRealRet             = NULL;
        double *pdblImgRet              = NULL;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -107,13 +107,13 @@ SciErr floor_double(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -127,7 +127,7 @@ SciErr floor_double(int* _piKey, int* _piAddress)
        return sciErr;
 }
 
-SciErr floor_poly(int* _piKey, int* _piAddress)
+SciErr floor_poly(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i,j;
@@ -145,7 +145,7 @@ SciErr floor_poly(int* _piKey, int* _piAddress)
 
        char* pstVarName                        = NULL;
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -153,22 +153,22 @@ SciErr floor_poly(int* _piKey, int* _piAddress)
 
        pstVarName = (char*)MALLOC(sizeof(char) * (iLen + 1));
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
        }
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)malloc(iRows * iCols * sizeof(int));
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -187,7 +187,7 @@ SciErr floor_poly(int* _piKey, int* _piAddress)
                        pdblImgRet[i]           = (double*)malloc(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -202,7 +202,7 @@ SciErr floor_poly(int* _piKey, int* _piAddress)
                        }
                }
 
-               sciErr = createComplexMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
+               sciErr = createComplexMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -210,14 +210,14 @@ SciErr floor_poly(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)malloc(iRows * iCols * sizeof(int));
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -232,7 +232,7 @@ SciErr floor_poly(int* _piKey, int* _piAddress)
                        pdblRealRet[i]  = (double*)malloc(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -246,7 +246,7 @@ SciErr floor_poly(int* _piKey, int* _piAddress)
                        }
                }
 
-               sciErr = createMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -256,7 +256,7 @@ SciErr floor_poly(int* _piKey, int* _piAddress)
        return sciErr;
 }
 
-SciErr floor_int(int* _piKey, int* _piAddress)
+SciErr floor_int(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
 
@@ -264,7 +264,7 @@ SciErr floor_int(int* _piKey, int* _piAddress)
        int iCols = 0;
        int iPrec = 0;
 
-       sciErr = getMatrixOfIntegerPrecision(_piKey, _piAddress, &iPrec);
+       sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddress, &iPrec);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -275,13 +275,13 @@ SciErr floor_int(int* _piKey, int* _piAddress)
        case SCI_INT8 :
                {
                        char* pcData = NULL;
-                       sciErr = getMatrixOfInteger8(_piKey, _piAddress, &iRows, &iCols, &pcData);
+                       sciErr = getMatrixOfInteger8(pvApiCtx, _piAddress, &iRows, &iCols, &pcData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
                        }
 
-                       sciErr = createMatrixOfInteger8(_piKey, Rhs + 1, iRows, iCols, pcData);
+                       sciErr = createMatrixOfInteger8(pvApiCtx, Rhs + 1, iRows, iCols, pcData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
@@ -291,13 +291,13 @@ SciErr floor_int(int* _piKey, int* _piAddress)
        case SCI_UINT8 :
                {
                        unsigned char* pucData = NULL;
-                       sciErr = getMatrixOfUnsignedInteger8(_piKey, _piAddress, &iRows, &iCols, &pucData);
+                       sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddress, &iRows, &iCols, &pucData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
                        }
 
-                       sciErr = createMatrixOfUnsignedInteger8(_piKey, Rhs + 1, iRows, iCols, pucData);
+                       sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, Rhs + 1, iRows, iCols, pucData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
@@ -307,13 +307,13 @@ SciErr floor_int(int* _piKey, int* _piAddress)
        case SCI_INT16 :
                {
                        short* psData = NULL;
-                       sciErr = getMatrixOfInteger16(_piKey, _piAddress, &iRows, &iCols, &psData);
+                       sciErr = getMatrixOfInteger16(pvApiCtx, _piAddress, &iRows, &iCols, &psData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
                        }
 
-                       sciErr = createMatrixOfInteger16(_piKey, Rhs + 1, iRows, iCols, psData);
+                       sciErr = createMatrixOfInteger16(pvApiCtx, Rhs + 1, iRows, iCols, psData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
@@ -323,13 +323,13 @@ SciErr floor_int(int* _piKey, int* _piAddress)
        case SCI_UINT16 :
                {
                        unsigned short* pusData = NULL;
-                       sciErr = getMatrixOfUnsignedInteger16(_piKey, _piAddress, &iRows, &iCols, &pusData);
+                       sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddress, &iRows, &iCols, &pusData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
                        }
 
-                       sciErr = createMatrixOfUnsignedInteger16(_piKey, Rhs + 1, iRows, iCols, pusData);
+                       sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, Rhs + 1, iRows, iCols, pusData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
@@ -339,13 +339,13 @@ SciErr floor_int(int* _piKey, int* _piAddress)
        case SCI_INT32 :
                {
                        int* piData = NULL;
-                       sciErr = getMatrixOfInteger32(_piKey, _piAddress, &iRows, &iCols, &piData);
+                       sciErr = getMatrixOfInteger32(pvApiCtx, _piAddress, &iRows, &iCols, &piData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
                        }
 
-                       sciErr = createMatrixOfInteger32(_piKey, Rhs + 1, iRows, iCols, piData);
+                       sciErr = createMatrixOfInteger32(pvApiCtx, Rhs + 1, iRows, iCols, piData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
@@ -355,13 +355,13 @@ SciErr floor_int(int* _piKey, int* _piAddress)
        case SCI_UINT32 :
                {
                        unsigned int* puiData = NULL;
-                       sciErr = getMatrixOfUnsignedInteger32(_piKey, _piAddress, &iRows, &iCols, &puiData);
+                       sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddress, &iRows, &iCols, &puiData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
                        }
 
-                       sciErr = createMatrixOfUnsignedInteger32(_piKey, Rhs + 1, iRows, iCols, puiData);
+                       sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, Rhs + 1, iRows, iCols, puiData);
                        if(sciErr.iErr)
                        {
                                return sciErr;
index f3c642d..c2506b2 100644 (file)
@@ -20,7 +20,7 @@
 #include "api_oldstack.h"
 
 /*--------------------------------------------------------------------------*/
-int sci_frexp(char *fname, int* _piKey)
+int sci_frexp(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -39,7 +39,7 @@ int sci_frexp(char *fname, int* _piKey)
        CheckRhs(1,1);
        CheckLhs(2,2);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
     Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
        if(sciErr.iErr)
        {
@@ -47,7 +47,7 @@ int sci_frexp(char *fname, int* _piKey)
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -60,27 +60,27 @@ int sci_frexp(char *fname, int* _piKey)
                return 0;
        }
 
-       if(isVarComplex(_piKey, piAddr))
+       if(isVarComplex(pvApiCtx, piAddr))
        {
                Scierror(999,_("%s: Wrong type for input argument #%d: Real matrix expected.\n"), fname, 1);
         return 0;
        }
 
-       sciErr = getMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal);
+       sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblCoef);
+       sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblCoef);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = allocMatrixOfDouble(_piKey, Rhs + 2, iRows, iCols, &pdblExp);
+       sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 2, iRows, iCols, &pdblExp);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
index a14998f..a9655c9 100644 (file)
@@ -44,17 +44,17 @@ of error
 #define CreateVarNoCheck(n,ct,mx,nx,lx) C2F(createvar)((c_local=n,&c_local),ct,mx,nx,(void *)lx, 1L)
 
 int checkInputValue(char* _pstInput, const char** _pcstRef, int _iRefCount);
-char* getWayType(int* _piKey, int* _piAddress);
-char* getProcessType(int* _piKey, int* _piAddress);
+char* getWayType(void* pvApiCtx, int* _piAddress);
+char* getProcessType(void* pvApiCtx, int* _piAddress);
 int computeIndiceDim(const char* _pcstProcess, int _iRowsIn, int _iColsIn,  int* _piRowsOut, int* _piColsOut);
 
-int    gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const char* _pcstWay);
-int    gsort_string(int* _piKey, int * _piAddress, const char* _pcstProcess, const char* _pcstWay);
-int    gsort_double(int* _piKey, int * _piAddress, const char* _pcstProcess, const char* _pcstWay);
+int    gsort_int(void* pvApiCtx, int * _piAddress, const char* _pcstProcess, const char* _pcstWay);
+int    gsort_string(void* pvApiCtx, int * _piAddress, const char* _pcstProcess, const char* _pcstWay);
+int    gsort_double(void* pvApiCtx, int * _piAddress, const char* _pcstProcess, const char* _pcstWay);
 /*--------------------------------------------------------------------------*/
 static int gsort_complex(char *fname, char *mode, char *order);
 /*--------------------------------------------------------------------------*/
-int sci_gsort(char *fname, int* _piKey)
+int sci_gsort(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int iRet                                                                = 0;
@@ -75,14 +75,14 @@ int sci_gsort(char *fname, int* _piKey)
 
        if(Rhs > 1)
        {//get option
-               sciErr = getVarAddressFromPosition(_piKey, 2, &piAddr2);
+               sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               pcstProcess = getProcessType(_piKey, piAddr2); 
+               pcstProcess = getProcessType(pvApiCtx, piAddr2); 
                if(pcstProcess == NULL)
                {
                        return 1;
@@ -91,38 +91,38 @@ int sci_gsort(char *fname, int* _piKey)
 
        if(Rhs == 3)
        {//get way ( inc or dec )
-               sciErr = getVarAddressFromPosition(_piKey, 3, &piAddr3);
+               sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               pcstWay = getWayType(_piKey, piAddr3); 
+               pcstWay = getWayType(pvApiCtx, piAddr3); 
                if(pcstWay == NULL)
                {
                        return 1;
                }
        }
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr1);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
        
-       sciErr = getVarType(_piKey, piAddr1, &iType1);
+       sciErr = getVarType(pvApiCtx, piAddr1, &iType1);
        switch(iType1)
        {
        case sci_matrix : 
-               iRet = gsort_double(_piKey, piAddr1, pcstProcess, pcstWay);
+               iRet = gsort_double(pvApiCtx, piAddr1, pcstProcess, pcstWay);
                break;
        case sci_strings : 
-               iRet = gsort_string(_piKey, piAddr1, pcstProcess, pcstWay);
+               iRet = gsort_string(pvApiCtx, piAddr1, pcstProcess, pcstWay);
                break;
        case sci_ints : 
-               iRet = gsort_int(_piKey, piAddr1, pcstProcess, pcstWay);
+               iRet = gsort_int(pvApiCtx, piAddr1, pcstProcess, pcstWay);
                break;
        default :
                return 1;
@@ -145,7 +145,7 @@ int sci_gsort(char *fname, int* _piKey)
 } 
 
 
-int    gsort_double(int* _piKey, int * _piAddress, const char* _pcstProcess, const char* _pcstWay)
+int    gsort_double(void* pvApiCtx, int * _piAddress, const char* _pcstProcess, const char* _pcstWay)
 {
        SciErr sciErr;
        int iRet                                                        = 0;
@@ -159,9 +159,9 @@ int gsort_double(int* _piKey, int * _piAddress, const char* _pcstProcess, const
        int *piInd                                              = NULL;
        int iLhs2                                                       = Lhs == 2;
 
-       if(isEmptyMatrix(_piKey, _piAddress))
+       if(isEmptyMatrix(pvApiCtx, _piAddress))
        {
-               iRet = createEmptyMatrix(_piKey, Rhs + 1);
+               iRet = createEmptyMatrix(pvApiCtx, Rhs + 1);
                if(iRet)
                {
                        return iRet;
@@ -169,7 +169,7 @@ int gsort_double(int* _piKey, int * _piAddress, const char* _pcstProcess, const
 
                if(Lhs == 2)
                {               
-                       iRet = createEmptyMatrix(_piKey, Rhs + 1);
+                       iRet = createEmptyMatrix(pvApiCtx, Rhs + 1);
                        if(iRet)
                        {
                                return iRet;
@@ -177,20 +177,20 @@ int       gsort_double(int* _piKey, int * _piAddress, const char* _pcstProcess, const
                }               
        }
        
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
                OverLoad(1); //call %_gsort.sci
                return 0;
        }
        
-       sciErr = getMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal);
+       sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return sciErr.iErr;
        }
 
-       sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealOut1);
+       sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealOut1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -209,7 +209,7 @@ int gsort_double(int* _piKey, int * _piAddress, const char* _pcstProcess, const
 
        if(Lhs == 2)
        {
-               iRet = createMatrixOfDoubleFromInteger(_piKey, Rhs + 2, iRowsInd, iColsInd, piInd);
+               iRet = createMatrixOfDoubleFromInteger(pvApiCtx, Rhs + 2, iRowsInd, iColsInd, piInd);
                if(iRet)
                {
                        FREE(piInd);
@@ -221,7 +221,7 @@ int gsort_double(int* _piKey, int * _piAddress, const char* _pcstProcess, const
        return 0;
 }
 
-int    gsort_string(int* _piKey, int * _piAddress, const char* _pcstProcess, const char* _pcstWay)
+int    gsort_string(void* pvApiCtx, int * _piAddress, const char* _pcstProcess, const char* _pcstWay)
 {
        SciErr sciErr;
        int iRet                                = 0;
@@ -234,7 +234,7 @@ int gsort_string(int* _piKey, int * _piAddress, const char* _pcstProcess, const
        int* piInd                      = NULL;
        char** pstData  = NULL;
 
-       iRet = getAllocatedMatrixOfString(_piKey, _piAddress, &iRows, &iCols, &pstData);
+       iRet = getAllocatedMatrixOfString(pvApiCtx, _piAddress, &iRows, &iCols, &pstData);
        if(iRet)
        {
                freeAllocatedMatrixOfString(iRows, iCols, pstData);
@@ -251,7 +251,7 @@ int gsort_string(int* _piKey, int * _piAddress, const char* _pcstProcess, const
        piInd = (int*)MALLOC(sizeof(int) * iRowsInd * iColsInd);
        C2F(gsorts)(pstData, piInd, &iLhs2, &iRows,&iCols, (char*)_pcstProcess, (char*)_pcstWay);
        
-       sciErr = createMatrixOfString(_piKey, Rhs + 1, iRows, iCols, pstData);
+       sciErr = createMatrixOfString(pvApiCtx, Rhs + 1, iRows, iCols, pstData);
        if(sciErr.iErr)
        {
                freeAllocatedMatrixOfString(iRows, iCols, pstData);
@@ -262,7 +262,7 @@ int gsort_string(int* _piKey, int * _piAddress, const char* _pcstProcess, const
 
        if(Lhs == 2)
        {
-               iRet = createMatrixOfDoubleFromInteger(_piKey, Rhs + 2, iRowsInd, iColsInd, piInd);
+               iRet = createMatrixOfDoubleFromInteger(pvApiCtx, Rhs + 2, iRowsInd, iColsInd, piInd);
                if(iRet)
                {
                        FREE(piInd);
@@ -274,7 +274,7 @@ int gsort_string(int* _piKey, int * _piAddress, const char* _pcstProcess, const
        return 0;
 }
 
-int    gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const char* _pcstWay)
+int    gsort_int(void* pvApiCtx, int * _piAddress, const char* _pcstProcess, const char* _pcstWay)
 {
        SciErr sciErr;
        int iRet                        = 0;
@@ -287,7 +287,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
 
        int* piInd              = NULL;
 
-       sciErr = getVarDimension(_piKey, _piAddress, &iRows, &iCols);
+       sciErr = getVarDimension(pvApiCtx, _piAddress, &iRows, &iCols);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -302,7 +302,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
 
        piInd = (int*)MALLOC(sizeof(int) * iRowsInd * iColsInd);
 
-       sciErr = getMatrixOfIntegerPrecision(_piKey, _piAddress, &iPrec);
+       sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddress, &iPrec);
        if(sciErr.iErr)
        {
                FREE(piInd);
@@ -317,7 +317,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                        char* pcDataIn          = NULL;
                        char* pcDataOut         = NULL;
                        
-                       sciErr = getMatrixOfInteger8(_piKey, _piAddress, &iRows, &iCols, &pcDataIn);
+                       sciErr = getMatrixOfInteger8(pvApiCtx, _piAddress, &iRows, &iCols, &pcDataIn);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -325,7 +325,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                                return sciErr.iErr;
                        }
 
-                       sciErr  = allocMatrixOfInteger8(_piKey, Rhs + 1, iRows, iCols, &pcDataOut);
+                       sciErr  = allocMatrixOfInteger8(pvApiCtx, Rhs + 1, iRows, iCols, &pcDataOut);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -342,7 +342,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                        unsigned char* pucDataIn                = NULL;
                        unsigned char* pucDataOut               = NULL;
                        
-                       sciErr = getMatrixOfUnsignedInteger8(_piKey, _piAddress, &iRows, &iCols, &pucDataIn);
+                       sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddress, &iRows, &iCols, &pucDataIn);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -350,7 +350,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                                return sciErr.iErr;
                        }
 
-                       sciErr = allocMatrixOfUnsignedInteger8(_piKey, Rhs + 1, iRows, iCols, &pucDataOut);
+                       sciErr = allocMatrixOfUnsignedInteger8(pvApiCtx, Rhs + 1, iRows, iCols, &pucDataOut);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -367,7 +367,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                        short* psDataIn         = NULL;
                        short* psDataOut        = NULL;
                        
-                       sciErr = getMatrixOfInteger16(_piKey, _piAddress, &iRows, &iCols, &psDataIn);
+                       sciErr = getMatrixOfInteger16(pvApiCtx, _piAddress, &iRows, &iCols, &psDataIn);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -375,7 +375,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                                return sciErr.iErr;
                        }
 
-                       sciErr = allocMatrixOfInteger16(_piKey, Rhs + 1, iRows, iCols, &psDataOut);
+                       sciErr = allocMatrixOfInteger16(pvApiCtx, Rhs + 1, iRows, iCols, &psDataOut);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -392,7 +392,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                        unsigned short* pusDataIn               = NULL;
                        unsigned short* pusDataOut      = NULL;
                        
-                       sciErr = getMatrixOfUnsignedInteger16(_piKey, _piAddress, &iRows, &iCols, &pusDataIn);
+                       sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddress, &iRows, &iCols, &pusDataIn);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -400,7 +400,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                                return sciErr.iErr;
                        }
 
-                       sciErr = allocMatrixOfUnsignedInteger16(_piKey, Rhs + 1, iRows, iCols, &pusDataOut);
+                       sciErr = allocMatrixOfUnsignedInteger16(pvApiCtx, Rhs + 1, iRows, iCols, &pusDataOut);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -417,7 +417,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                        int* piDataIn           = NULL;
                        int* piDataOut  = NULL;
                        
-                       sciErr = getMatrixOfInteger32(_piKey, _piAddress, &iRows, &iCols, &piDataIn);
+                       sciErr = getMatrixOfInteger32(pvApiCtx, _piAddress, &iRows, &iCols, &piDataIn);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -425,7 +425,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                                return sciErr.iErr;
                        }
 
-                       sciErr = allocMatrixOfInteger32(_piKey, Rhs + 1, iRows, iCols, &piDataOut);
+                       sciErr = allocMatrixOfInteger32(pvApiCtx, Rhs + 1, iRows, iCols, &piDataOut);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -442,7 +442,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                        unsigned int* puiDataIn         = NULL;
                        unsigned int* puiDataOut        = NULL;
                        
-                       sciErr = getMatrixOfUnsignedInteger32(_piKey, _piAddress, &iRows, &iCols, &puiDataIn);
+                       sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddress, &iRows, &iCols, &puiDataIn);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -450,7 +450,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
                                return sciErr.iErr;
                        }
 
-                       sciErr = allocMatrixOfUnsignedInteger32(_piKey, Rhs + 1, iRows, iCols, &puiDataOut);
+                       sciErr = allocMatrixOfUnsignedInteger32(pvApiCtx, Rhs + 1, iRows, iCols, &puiDataOut);
                        if(sciErr.iErr)
                        {
                                FREE(piInd);
@@ -469,7 +469,7 @@ int gsort_int(int* _piKey, int * _piAddress, const char* _pcstProcess, const cha
 
        if(Lhs == 2)
        {
-               iRet = createMatrixOfDoubleFromInteger(_piKey, Rhs + 2, iRowsInd, iColsInd, piInd);
+               iRet = createMatrixOfDoubleFromInteger(pvApiCtx, Rhs + 2, iRowsInd, iColsInd, piInd);
                if(iRet)
                {
                        FREE(piInd);
@@ -489,7 +489,7 @@ static int gsort_complex(char *fname, char *mode, char *order)
 }
 /*-----------------------------------------------------------------------------------*/
 
-char* getWayType(int* _piKey, int* _piAddress)
+char* getWayType(void* pvApiCtx, int* _piAddress)
 {
        int iRet                                        = 0;
        int iRows                                       = 0;
@@ -498,7 +498,7 @@ char* getWayType(int* _piKey, int* _piAddress)
 
        const char* pcstRef[2] = {g_pcstWayDec,g_pcstWayInc};
        
-       iRet = getAllocatedSingleString(_piKey, _piAddress, &pstWay);
+       iRet = getAllocatedSingleString(pvApiCtx, _piAddress, &pstWay);
        if(iRet)
        {
                freeAllocatedSingleString(pstWay);
@@ -514,7 +514,7 @@ char* getWayType(int* _piKey, int* _piAddress)
        return pstWay;
 }
 
-char* getProcessType(int* _piKey, int* _piAddress)
+char* getProcessType(void* pvApiCtx, int* _piAddress)
 {
        int iRet                                        = 0;
        int iRows                                       = 0;
@@ -523,7 +523,7 @@ char* getProcessType(int* _piKey, int* _piAddress)
 
        const char* pcstRef[5] = {g_pcstProcessGlobal,g_pcstProcessRow,g_pcstProcessCol,g_pcstProcessListRow,g_pcstProcessListCol};
        
-       iRet = getAllocatedSingleString(_piKey, _piAddress, &pstProcess);
+       iRet = getAllocatedSingleString(pvApiCtx, _piAddress, &pstProcess);
        if(iRet)
        {
                freeAllocatedSingleString(pstProcess);
index d072790..33bb069 100644 (file)
 #include "api_scilab.h"
 #include "api_oldstack.h"
 
-SciErr img_double(int* _piKey, int* _piAddress);
-SciErr img_poly(int* _piKey, int* _piAddress);
-SciErr img_sparse(int* _piKey, int* _piAddress);
+SciErr img_double(void* pvApiCtx, int* _piAddress);
+SciErr img_poly(void* pvApiCtx, int* _piAddress);
+SciErr img_sparse(void* pvApiCtx, int* _piAddress);
 
 /*--------------------------------------------------------------------------*/
-int sci_imag(char *fname, int* _piKey)
+int sci_imag(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int* piAddr             = NULL;
@@ -31,30 +31,30 @@ int sci_imag(char *fname, int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
 
        switch(iType)
        {
        case sci_matrix:
                {
-                       sciErr = img_double(_piKey, piAddr);
+                       sciErr = img_double(pvApiCtx, piAddr);
                        break;
                }
        case sci_poly:
                {
-                       sciErr = img_poly(_piKey, piAddr);
+                       sciErr = img_poly(pvApiCtx, piAddr);
                        break;
                }
        case sci_sparse:
                {
-                       sciErr = img_sparse(_piKey, piAddr);
+                       sciErr = img_sparse(pvApiCtx, piAddr);
                        break;
                }
        default:
@@ -73,7 +73,7 @@ int sci_imag(char *fname, int* _piKey)
        return 0;
 }
 
-SciErr img_double(int* _piKey, int* _piAddress)
+SciErr img_double(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int iRows                                               = 0;
@@ -83,15 +83,15 @@ SciErr img_double(int* _piKey, int* _piAddress)
        double *pdblImg                 = NULL;
        double *pdblRealRet     = NULL;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = createMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, pdblImg);
+               sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -99,13 +99,13 @@ SciErr img_double(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getVarDimension(_piKey, _piAddress, &iRows, &iCols);
+               sciErr = getVarDimension(pvApiCtx, _piAddress, &iRows, &iCols);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -117,7 +117,7 @@ SciErr img_double(int* _piKey, int* _piAddress)
        return sciErr;
 }
 
-SciErr img_poly(int* _piKey, int* _piAddress)
+SciErr img_poly(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i,j;
@@ -131,7 +131,7 @@ SciErr img_poly(int* _piKey, int* _piAddress)
        double** pdblImg                        = NULL;
        double** pdblRealRet    = NULL;
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -139,22 +139,22 @@ SciErr img_poly(int* _piKey, int* _piAddress)
 
        pstVarName = (char*)MALLOC(sizeof(char) * (iLen + 1));
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
        }
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)malloc(iRows * iCols * sizeof(int));
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -169,7 +169,7 @@ SciErr img_poly(int* _piKey, int* _piAddress)
                        pdblImg[i]                      = (double*)malloc(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -190,7 +190,7 @@ SciErr img_poly(int* _piKey, int* _piAddress)
                                }
                        }
                }
-               sciErr = createMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblImg);
+               sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -198,7 +198,7 @@ SciErr img_poly(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getVarDimension(_piKey, _piAddress, &iRows, &iCols);
+               sciErr = getVarDimension(pvApiCtx, _piAddress, &iRows, &iCols);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -212,7 +212,7 @@ SciErr img_poly(int* _piKey, int* _piAddress)
                        pdblRealRet[i] = (double*)malloc(sizeof(double) * 1);
                        pdblRealRet[i] = 0;
                }
-               sciErr = createMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -221,7 +221,7 @@ SciErr img_poly(int* _piKey, int* _piAddress)
        return sciErr;
 }
 
-SciErr img_sparse(int* _piKey, int* _piAddress)
+SciErr img_sparse(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i,j,x,y;
@@ -239,9 +239,9 @@ SciErr img_sparse(int* _piKey, int* _piAddress)
        double *pdblImg                 = 0;
        double *pdblRealRet     = NULL;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexSparseMatrix(_piKey, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg);
+               sciErr = getComplexSparseMatrix(pvApiCtx, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -255,7 +255,7 @@ SciErr img_sparse(int* _piKey, int* _piAddress)
                        }
                }
 
-               sciErr = allocSparseMatrix(_piKey, Rhs + 1, iRows, iCols, iNbItemNew, &piNbItemRowNew, &piColPosNew, &pdblRealRet);
+               sciErr = allocSparseMatrix(pvApiCtx, Rhs + 1, iRows, iCols, iNbItemNew, &piNbItemRowNew, &piColPosNew, &pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -281,13 +281,13 @@ SciErr img_sparse(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getVarDimension(_piKey, _piAddress, &iRows, &iCols);
+               sciErr = getVarDimension(pvApiCtx, _piAddress, &iRows, &iCols);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = allocSparseMatrix(_piKey, Rhs + 1, iRows, iCols, 0, &piNbItemRowNew, &piColPosNew, &pdblRealRet);
+               sciErr = allocSparseMatrix(pvApiCtx, Rhs + 1, iRows, iCols, 0, &piNbItemRowNew, &piColPosNew, &pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
index 88aafc3..d20e32a 100644 (file)
@@ -17,7 +17,7 @@
 #include "api_oldstack.h"
 
 /*--------------------------------------------------------------------------*/
-int sci_imult(char *fname,int* _piKey)
+int sci_imult(char *fname,void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -35,14 +35,14 @@ int sci_imult(char *fname,int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -55,9 +55,9 @@ int sci_imult(char *fname,int* _piKey)
                return 0;
        }
 
-       if(isVarComplex(_piKey, piAddr))
+       if(isVarComplex(pvApiCtx, piAddr))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -69,7 +69,7 @@ int sci_imult(char *fname,int* _piKey)
                        pdblImg[i] *= -1;
                }
 
-               sciErr = createComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, pdblImg, pdblReal);
+               sciErr = createComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, pdblImg, pdblReal);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -78,7 +78,7 @@ int sci_imult(char *fname,int* _piKey)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -88,7 +88,7 @@ int sci_imult(char *fname,int* _piKey)
                pdblRealRet = (double*)malloc(sizeof(double) * iRows * iCols);
                memset(pdblRealRet, 0x00, sizeof(double) * iRows * iCols);
 
-               sciErr = createComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, pdblRealRet, pdblReal);
+               sciErr = createComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, pdblRealRet, pdblReal);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index b266178..5aa1062 100644 (file)
 #include "api_scilab.h"
 #include "api_oldstack.h"
 
-SciErr int_double(int* _piKey, int* _piAddress);
-SciErr int_poly(int* _piKey, int* _piAddress);
+SciErr int_double(void* pvApiCtx, int* _piAddress);
+SciErr int_poly(void* pvApiCtx, int* _piAddress);
 /*--------------------------------------------------------------------------*/
-int sci_int(char *fname,int* _piKey)
+int sci_int(char *fname,void* pvApiCtx)
 {
        SciErr sciErr;
        int iType                       = 0;
@@ -29,14 +29,14 @@ int sci_int(char *fname,int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -46,10 +46,10 @@ int sci_int(char *fname,int* _piKey)
        switch(iType)
        {
        case sci_matrix :
-               sciErr = int_double(_piKey, piAddr);
+               sciErr = int_double(pvApiCtx, piAddr);
                break;
        case sci_poly :
-               sciErr = int_poly(_piKey, piAddr);
+               sciErr = int_poly(pvApiCtx, piAddr);
        default :
                OverLoad(1);
                return 0;
@@ -66,7 +66,7 @@ int sci_int(char *fname,int* _piKey)
        return 0;
 }
 
-SciErr int_double(int* _piKey, int* _piAddress)
+SciErr int_double(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i;
@@ -78,15 +78,15 @@ SciErr int_double(int* _piKey, int* _piAddress)
        double *pdblRealRet = NULL;
        double *pdblImgRet      = NULL;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -100,13 +100,13 @@ SciErr int_double(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -120,7 +120,7 @@ SciErr int_double(int* _piKey, int* _piAddress)
        return sciErr;
 }
 
-SciErr int_poly(int* _piKey, int* _piAddress)
+SciErr int_poly(void* pvApiCtx, int* _piAddress)
 {
        SciErr sciErr;
        int i,j;
@@ -136,7 +136,7 @@ SciErr int_poly(int* _piKey, int* _piAddress)
        double** pdblRealRet    = NULL;
        double** pdblImgRet             = NULL;
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -144,22 +144,22 @@ SciErr int_poly(int* _piKey, int* _piAddress)
 
        pstVarName = (char*)MALLOC(sizeof(char) * (iLen + 1));
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
        }
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)malloc(iRows * iCols * sizeof(int));
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -178,7 +178,7 @@ SciErr int_poly(int* _piKey, int* _piAddress)
                        pdblImgRet[i]           = (double*)malloc(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -193,7 +193,7 @@ SciErr int_poly(int* _piKey, int* _piAddress)
                        }
                }
 
-               sciErr = createComplexMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
+               sciErr = createComplexMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet, pdblImgRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -201,14 +201,14 @@ SciErr int_poly(int* _piKey, int* _piAddress)
        }
        else
        {
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)malloc(iRows * iCols * sizeof(int));
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -223,7 +223,7 @@ SciErr int_poly(int* _piKey, int* _piAddress)
                        pdblRealRet[i]  = (double*)malloc(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -237,7 +237,7 @@ SciErr int_poly(int* _piKey, int* _piAddress)
                        }
                }
 
-               sciErr = createMatrixOfPoly(_piKey, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
+               sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, iRows, iCols, piCoeff, pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -253,7 +253,7 @@ SciErr int_poly(int* _piKey, int* _piAddress)
        free(pdblReal);
        free(pdblRealRet);
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
                for(i = 0 ; i < iRows * iCols ; i++)
                {
index 1d1a6c6..7f8f807 100644 (file)
 #include "Scierror.h"
 #include "api_oldstack.h"
 
-int isreal_double(int* _piKey, int* _piAddress, double _dblRef, int* _piIsReal);
-int isreal_poly(int* _piKey, int* _piAddress, double _dblRef, int* _piIsReal);
-int isreal_sparse(int* _piKey, int* _piAddress, double _dblRef, int* _piIsReal);
+int isreal_double(void* pvApiCtx, int* _piAddress, double _dblRef, int* _piIsReal);
+int isreal_poly(void* pvApiCtx, int* _piAddress, double _dblRef, int* _piIsReal);
+int isreal_sparse(void* pvApiCtx, int* _piAddress, double _dblRef, int* _piIsReal);
 int isreal_common(double *_pdblData, int _iSize, double _dblRef, int* _piIsReal);
 
 /*--------------------------------------------------------------------------*/
-int sci_isreal(char *fname,int* _piKey)
+int sci_isreal(char *fname,void* pvApiCtx)
 {
        SciErr sciErr;
        int iRet                        = 0;
@@ -39,7 +39,7 @@ int sci_isreal(char *fname,int* _piKey)
        CheckRhs(1,2);
        CheckLhs(1,1);
 
-       sciErr  = getVarAddressFromPosition(_piKey, 1, &piAddr1);
+       sciErr  = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -47,7 +47,7 @@ int sci_isreal(char *fname,int* _piKey)
        }
 
 
-       if(!isDoubleType(_piKey, piAddr1) && !isPolyType(_piKey, piAddr1) && !isSparseType(_piKey, piAddr1))
+       if(!isDoubleType(pvApiCtx, piAddr1) && !isPolyType(pvApiCtx, piAddr1) && !isSparseType(pvApiCtx, piAddr1))
        {
                OverLoad(1);
                return 0;
@@ -55,14 +55,14 @@ int sci_isreal(char *fname,int* _piKey)
 
        if(Rhs == 1)
        {
-               if(isVarComplex(_piKey, piAddr1))
+               if(isVarComplex(pvApiCtx, piAddr1))
                        iBool = 0;
                else
                        iBool = 1;
        }
        else //Rhs == 2
        {
-               if(!isVarComplex(_piKey, piAddr1)) //Not complex
+               if(!isVarComplex(pvApiCtx, piAddr1)) //Not complex
                {
                        iBool = 1;
                }
@@ -71,20 +71,20 @@ int sci_isreal(char *fname,int* _piKey)
                        int iType1                      = 0;
                        double dblPrec  = 0;
                        
-                       sciErr = getVarAddressFromPosition(_piKey, 2, &piAddr2);
+                       sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
                                return 0;
                        }
 
-                       iRet = getScalarDouble(_piKey, piAddr2, &dblPrec);
+                       iRet = getScalarDouble(pvApiCtx, piAddr2, &dblPrec);
                        if(iRet)
                        {
                                return 0;
                        }
 
-                       sciErr = getVarType(_piKey, piAddr1, &iType1);
+                       sciErr = getVarType(pvApiCtx, piAddr1, &iType1);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
@@ -94,13 +94,13 @@ int sci_isreal(char *fname,int* _piKey)
                        switch(iType1)
                        {
                        case sci_matrix :
-                               iRet = isreal_double(_piKey, piAddr1, dblPrec, &iBool);
+                               iRet = isreal_double(pvApiCtx, piAddr1, dblPrec, &iBool);
                                break;
                        case sci_poly :
-                               iRet = isreal_poly(_piKey, piAddr1, dblPrec, &iBool);
+                               iRet = isreal_poly(pvApiCtx, piAddr1, dblPrec, &iBool);
                                break;
                        case sci_sparse :
-                               iRet = isreal_sparse(_piKey, piAddr1, dblPrec, &iBool);
+                               iRet = isreal_sparse(pvApiCtx, piAddr1, dblPrec, &iBool);
                                break;
                        default: //never come here
                                break;
@@ -113,7 +113,7 @@ int sci_isreal(char *fname,int* _piKey)
                return 1;
        }
 
-       iRet = createScalarBoolean(_piKey, Rhs + 1, iBool);
+       iRet = createScalarBoolean(pvApiCtx, Rhs + 1, iBool);
        if(iRet)
        {
                return 1;
@@ -124,7 +124,7 @@ int sci_isreal(char *fname,int* _piKey)
        return 0;
 }
 
-int isreal_double(int* _piKey, int* _piAddress, double _dblRef, int* _piIsReal)
+int isreal_double(void* pvApiCtx, int* _piAddress, double _dblRef, int* _piIsReal)
 {
        SciErr sciErr;
        int iRet                                        = 0;
@@ -135,7 +135,7 @@ int isreal_double(int* _piKey, int* _piAddress, double _dblRef, int* _piIsReal)
        double *pdblReal        = NULL;
        double *pdblImg         = NULL;
 
-       sciErr = getComplexMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
+       sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -151,7 +151,7 @@ int isreal_double(int* _piKey, int* _piAddress, double _dblRef, int* _piIsReal)
        return 0;
 }
 
-int isreal_poly(int* _piKey, int* _piAddress, double _dblRef, int* _piIsReal)
+int isreal_poly(void* pvApiCtx, int* _piAddress, double _dblRef, int* _piIsReal)
 {
        int i;
        int iRet                                        = 0;
@@ -162,7 +162,7 @@ int isreal_poly(int* _piKey, int* _piAddress, double _dblRef, int* _piIsReal)
        double** pdblReal       = NULL;
        double** pdblImg        = NULL;
 
-       iRet = getAllocatedMatrixOfComplexPoly(_piKey, _piAddress, &iRows, &iCols, &piCoeff, &pdblReal, &pdblImg);
+       iRet = getAllocatedMatrixOfComplexPoly(pvApiCtx, _piAddress, &iRows, &iCols, &piCoeff, &pdblReal, &pdblImg);
        if(iRet)
        {
                freeAllocatedMatrixOfComplexPoly(iRows, iCols, piCoeff, pdblReal, pdblImg);
@@ -188,7 +188,7 @@ int isreal_poly(int* _piKey, int* _piAddress, double _dblRef, int* _piIsReal)
        return 0;
 }
 
-int isreal_sparse(int* _piKey, int* _piAddress, double _dblRef, int* _piIsReal)
+int isreal_sparse(void* pvApiCtx, int* _piAddress, double _dblRef, int* _piIsReal)
 {
        int iRet                                        = 0;
        int iRows                                       = 0;
@@ -200,7 +200,7 @@ int isreal_sparse(int* _piKey, int* _piAddress, double _dblRef, int* _piIsReal)
        double *pdblReal        = NULL;
        double *pdblImg         = NULL;
 
-       iRet = getAllocatedComplexSparseMatrix(_piKey, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg);
+       iRet = getAllocatedComplexSparseMatrix(pvApiCtx, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg);
        if(iRet)
        {
                return iRet;
index fd081e8..27163f7 100644 (file)
@@ -25,7 +25,7 @@ extern int C2F(dcopy)();
 extern int C2F(dscal)();
 
 /*--------------------------------------------------------------------------*/
-int sci_kron(char *fname,int* _piKey)
+int sci_kron(char *fname,void* pvApiCtx)
 {
        SciErr sciErr;
        int iRows1                                      = 0;
@@ -52,28 +52,28 @@ int sci_kron(char *fname,int* _piKey)
        CheckRhs(2,2);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr1);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarAddressFromPosition(_piKey, 2, &piAddr2);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       iComplex1 = isVarComplex(_piKey, piAddr1);
-       iComplex2 = isVarComplex(_piKey, piAddr2);
+       iComplex1 = isVarComplex(pvApiCtx, piAddr1);
+       iComplex2 = isVarComplex(pvApiCtx, piAddr2);
        iComplexRet = iComplex1 | iComplex2;
 
        /*get first parameter*/
-       if(isVarComplex(_piKey, piAddr1))
+       if(isVarComplex(pvApiCtx, piAddr1))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, piAddr1, &iRows1, &iCols1, &pdblReal1, &pdblImg1);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr1, &iRows1, &iCols1, &pdblReal1, &pdblImg1);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -82,7 +82,7 @@ int sci_kron(char *fname,int* _piKey)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, piAddr1, &iRows1, &iCols1, &pdblReal1);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows1, &iCols1, &pdblReal1);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -91,9 +91,9 @@ int sci_kron(char *fname,int* _piKey)
        }
 
        /*get second parameter*/
-       if(isVarComplex(_piKey, piAddr2))
+       if(isVarComplex(pvApiCtx, piAddr2))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, piAddr2, &iRows2, &iCols2, &pdblReal2, &pdblImg2);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr2, &iRows2, &iCols2, &pdblReal2, &pdblImg2);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -102,7 +102,7 @@ int sci_kron(char *fname,int* _piKey)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, piAddr2, &iRows2, &iCols2, &pdblReal2);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows2, &iCols2, &pdblReal2);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -114,7 +114,7 @@ int sci_kron(char *fname,int* _piKey)
        {
                iRowsRet = iRows1 * iRows2;
                iColsRet = iCols1 * iCols2;
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRowsRet, iColsRet, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRowsRet, iColsRet, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -125,7 +125,7 @@ int sci_kron(char *fname,int* _piKey)
        {
                iRowsRet = iRows1 * iRows2;
                iColsRet = iCols1 * iCols2;
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRowsRet, iColsRet, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRowsRet, iColsRet, &pdblRealRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index b6dd919..cc30808 100644 (file)
@@ -20,7 +20,7 @@
 #include "msgs.h"
 
 /*--------------------------------------------------------------------------*/
-int sci_log(char *fname,int* _piKey)
+int sci_log(char *fname,void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -39,14 +39,14 @@ int sci_log(char *fname,int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -59,16 +59,16 @@ int sci_log(char *fname,int* _piKey)
                return 0;
        }
 
-       if(isVarComplex(_piKey, piAddr))
+       if(isVarComplex(pvApiCtx, piAddr))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -97,7 +97,7 @@ int sci_log(char *fname,int* _piKey)
        else
        {
                int iLessZero   = 0;
-               sciErr = getMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -127,7 +127,7 @@ int sci_log(char *fname,int* _piKey)
 
                if(iLessZero == 0)
                {//All values > 0
-                       sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+                       sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
@@ -141,7 +141,7 @@ int sci_log(char *fname,int* _piKey)
                }
                else
                {
-                       sciErr = allocComplexMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
+                       sciErr = allocComplexMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet, &pdblImgRet);
                        if(sciErr.iErr)
                        {
                                printError(&sciErr, 0);
index 56c8b1c..a91d8ec 100644 (file)
@@ -20,7 +20,7 @@
 #include "msgs.h"
 
 /*--------------------------------------------------------------------------*/
-int sci_log1p(char *fname, int* _piKey)
+int sci_log1p(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int i;
@@ -37,14 +37,14 @@ int sci_log1p(char *fname, int* _piKey)
        CheckRhs(1,1);
        CheckLhs(1,1);
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -57,14 +57,14 @@ int sci_log1p(char *fname, int* _piKey)
                return 0;
        }
 
-       if(isVarComplex(_piKey, piAddr))
+       if(isVarComplex(pvApiCtx, piAddr))
        {
                SciError(43);
                return 0;
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, piAddr, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -87,7 +87,7 @@ int sci_log1p(char *fname, int* _piKey)
                        }
                }
 
-               sciErr = allocMatrixOfDouble(_piKey, Rhs + 1, iRows, iCols, &pdblRealRet);
+               sciErr = allocMatrixOfDouble(pvApiCtx, Rhs + 1, iRows, iCols, &pdblRealRet);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
index cd3c860..c403265 100644 (file)
 
 #define MAX_INTERGER   2147483647
 
-SciErr matrix_double(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet);
-SciErr matrix_bsparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet);
-SciErr matrix_sparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet);
-SciErr matrix_poly(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet);
-SciErr matrix_string(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet);
-SciErr matrix_int(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet);
-SciErr matrix_bool(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet);
+SciErr matrix_double(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet);
+SciErr matrix_bsparse(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet);
+SciErr matrix_sparse(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet);
+SciErr matrix_poly(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet);
+SciErr matrix_string(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet);
+SciErr matrix_int(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet);
+SciErr matrix_bool(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet);
 
 /*--------------------------------------------------------------------------*/
-int sci_scimatrix(char *fname, int* _piKey)
+int sci_scimatrix(char *fname, void* pvApiCtx)
 {
        SciErr sciErr;
        int iRows1                      = 0;
@@ -73,14 +73,14 @@ int sci_scimatrix(char *fname, int* _piKey)
                return 0;
        }
 
-       sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr1);
+       sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
                return 0;
        }
 
-       sciErr = getVarType(_piKey, piAddr1, &iType);
+       sciErr = getVarType(pvApiCtx, piAddr1, &iType);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -101,20 +101,20 @@ int sci_scimatrix(char *fname, int* _piKey)
 
        if(Rhs == 2)
        {
-               sciErr = getVarAddressFromPosition(_piKey, 2, &piAddr2);
+               sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               if(isVarComplex(_piKey, piAddr2))
+               if(isVarComplex(pvApiCtx, piAddr2))
                {
                        SciError(32);
                        return 0;
                }
 
-               sciErr = getMatrixOfDouble(_piKey, piAddr2, &iRows2, &iCols2, &pdblRealData2);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows2, &iCols2, &pdblRealData2);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -142,34 +142,34 @@ int sci_scimatrix(char *fname, int* _piKey)
        }
        else
        {
-               sciErr = getVarAddressFromPosition(_piKey, 2, &piAddr2);
+               sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               sciErr = getVarAddressFromPosition(_piKey, 3, &piAddr3);
+               sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               if(isVarComplex(_piKey, piAddr3) || isVarComplex(_piKey, piAddr2))
+               if(isVarComplex(pvApiCtx, piAddr3) || isVarComplex(pvApiCtx, piAddr2))
                {
                        SciError(32);
                        return 0;
                }
 
-               sciErr = getMatrixOfDouble(_piKey, piAddr3, &iRows3, &iCols3, &pdblRealData3);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &iRows3, &iCols3, &pdblRealData3);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
                        return 0;
                }
 
-               sciErr = getMatrixOfDouble(_piKey, piAddr2, &iRows2, &iCols2, &pdblRealData2);
+               sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows2, &iCols2, &pdblRealData2);
                if(sciErr.iErr)
                {
                        printError(&sciErr, 0);
@@ -200,7 +200,7 @@ int sci_scimatrix(char *fname, int* _piKey)
                return 0;
        }
 
-       sciErr = getVarDimension(_piKey, piAddr1, &iRows1, &iCols1);
+       sciErr = getVarDimension(pvApiCtx, piAddr1, &iRows1, &iCols1);
        if(sciErr.iErr)
        {
                printError(&sciErr, 0);
@@ -232,25 +232,25 @@ int sci_scimatrix(char *fname, int* _piKey)
        switch(iType)
        {
        case sci_matrix :
-               sciErr = matrix_double(_piKey, piAddr1, iRowsRet, iColsRet);
+               sciErr = matrix_double(pvApiCtx, piAddr1, iRowsRet, iColsRet);
                break;
        case sci_poly:
-               sciErr = matrix_poly(_piKey, piAddr1, iRowsRet, iColsRet);
+               sciErr = matrix_poly(pvApiCtx, piAddr1, iRowsRet, iColsRet);
                break;
        case sci_boolean :
-               sciErr = matrix_bool(_piKey, piAddr1, iRowsRet, iColsRet);
+               sciErr = matrix_bool(pvApiCtx, piAddr1, iRowsRet, iColsRet);
                break;
        case sci_sparse :
-               sciErr = matrix_sparse(_piKey, piAddr1, iRowsRet, iColsRet);
+               sciErr = matrix_sparse(pvApiCtx, piAddr1, iRowsRet, iColsRet);
                break;
        case sci_boolean_sparse :
-               sciErr = matrix_bsparse(_piKey, piAddr1, iRowsRet, iColsRet);
+               sciErr = matrix_bsparse(pvApiCtx, piAddr1, iRowsRet, iColsRet);
                break;
        case sci_ints:
-               sciErr = matrix_int(_piKey, piAddr1, iRowsRet, iColsRet);
+               sciErr = matrix_int(pvApiCtx, piAddr1, iRowsRet, iColsRet);
                break;
        case sci_strings:
-               sciErr = matrix_string(_piKey, piAddr1, iRowsRet, iColsRet);
+               sciErr = matrix_string(pvApiCtx, piAddr1, iRowsRet, iColsRet);
                break;
        default :
                return 1;
@@ -269,7 +269,7 @@ int sci_scimatrix(char *fname, int* _piKey)
        return 0;
 }
 
-SciErr matrix_sparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
+SciErr matrix_sparse(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet)
 {
        SciErr sciErr;
        int iRows                                               = 0;
@@ -290,10 +290,10 @@ SciErr matrix_sparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        double *pdblRealRet     = NULL;
        double *pdblImgRet      = NULL;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
                double *pOrder[3];
-               sciErr = getComplexSparseMatrix(_piKey, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg);
+               sciErr = getComplexSparseMatrix(pvApiCtx, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -303,7 +303,7 @@ SciErr matrix_sparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
                pOrder[1] = (double*)malloc(iNbItem * sizeof(double));
                pOrder[2] = (double*)malloc(iNbItem * sizeof(double));
 
-               sciErr = allocComplexSparseMatrix(_piKey, Rhs + 1, _iRowsRet, _iColsRet, iNbItem, &piNbItemRowRet, &piColPosRet, &pdblRealRet, &pdblImgRet);
+               sciErr = allocComplexSparseMatrix(pvApiCtx, Rhs + 1, _iRowsRet, _iColsRet, iNbItem, &piNbItemRowRet, &piColPosRet, &pdblRealRet, &pdblImgRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -369,7 +369,7 @@ SciErr matrix_sparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        else
        {//void GetRhsSparseVar(int _iVarNum, int* _piRows, int* _piCols, int* _piRowsElem, int* _piColsElem, int* _piReal);
                double *pOrder[3];
-               sciErr = getSparseMatrix(_piKey, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal);
+               sciErr = getSparseMatrix(pvApiCtx, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -379,7 +379,7 @@ SciErr matrix_sparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
                pOrder[1] = (double*)malloc(iNbItem * sizeof(double));
                pOrder[2] = (double*)malloc(iNbItem * sizeof(double));
 
-               sciErr = allocSparseMatrix(_piKey, Rhs + 1, _iRowsRet, _iColsRet, iNbItem, &piNbItemRowRet, &piColPosRet, &pdblRealRet);
+               sciErr = allocSparseMatrix(pvApiCtx, Rhs + 1, _iRowsRet, _iColsRet, iNbItem, &piNbItemRowRet, &piColPosRet, &pdblRealRet);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -444,7 +444,7 @@ SciErr matrix_sparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        return sciErr;
 }
 
-SciErr matrix_bsparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
+SciErr matrix_bsparse(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet)
 {
        SciErr sciErr;
        int iRows                                               = 0;
@@ -462,7 +462,7 @@ SciErr matrix_bsparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet
 
 
        int *pOrder[3];
-       sciErr = getBooleanSparseMatrix(_piKey, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos);
+       sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddress, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -471,7 +471,7 @@ SciErr matrix_bsparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet
        pOrder[0] = (int*)malloc(iNbItem * sizeof(int));
        pOrder[2] = (int*)malloc(iNbItem * sizeof(int));
 
-       sciErr = allocBooleanSparseMatrix(_piKey, Rhs + 1, _iRowsRet, _iColsRet, iNbItem, &piNbItemRowRet, &piColPosRet);
+       sciErr = allocBooleanSparseMatrix(pvApiCtx, Rhs + 1, _iRowsRet, _iColsRet, iNbItem, &piNbItemRowRet, &piColPosRet);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -528,7 +528,7 @@ SciErr matrix_bsparse(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet
        return sciErr;
 }
 
-SciErr matrix_double(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
+SciErr matrix_double(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet)
 {
        SciErr sciErr;
        int iIndex                              = 0;
@@ -538,15 +538,15 @@ SciErr matrix_double(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        double* pdblReal        = NULL;
        double* pdblImg         = NULL;
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
+               sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal, &pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = createComplexMatrixOfDouble(_piKey, Rhs + 1, _iRowsRet, _iColsRet, pdblReal, pdblImg);
+               sciErr = createComplexMatrixOfDouble(pvApiCtx, Rhs + 1, _iRowsRet, _iColsRet, pdblReal, pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -554,13 +554,13 @@ SciErr matrix_double(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        }
        else
        {
-               sciErr = getMatrixOfDouble(_piKey, _piAddress, &iRows, &iCols, &pdblReal);
+               sciErr = getMatrixOfDouble(pvApiCtx, _piAddress, &iRows, &iCols, &pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = createMatrixOfDouble(_piKey, Rhs + 1, _iRowsRet, _iColsRet, pdblReal);
+               sciErr = createMatrixOfDouble(pvApiCtx, Rhs + 1, _iRowsRet, _iColsRet, pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -569,7 +569,7 @@ SciErr matrix_double(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        return sciErr;
 }
 
-SciErr matrix_poly(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
+SciErr matrix_poly(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet)
 {
        SciErr sciErr;
        int i;
@@ -582,7 +582,7 @@ SciErr matrix_poly(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        double **pdblImg        = NULL;
        char* pstVarName        = NULL;
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -590,22 +590,22 @@ SciErr matrix_poly(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
 
        pstVarName = (char*)MALLOC(sizeof(char) * (iLen + 1));
 
-       sciErr = getPolyVariableName(_piKey, _piAddress, pstVarName, &iLen);
+       sciErr = getPolyVariableName(pvApiCtx, _piAddress, pstVarName, &iLen);
        if(sciErr.iErr)
        {
                return sciErr;
        }
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)malloc(sizeof(int) * iRows * iCols);
-               sciErr  = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
+               sciErr  = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -619,13 +619,13 @@ SciErr matrix_poly(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
                        pdblImg[i]      = malloc(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getComplexMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
+               sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = createComplexMatrixOfPoly(_piKey, Rhs + 1, pstVarName, _iRowsRet, _iColsRet, piCoeff, pdblReal, pdblImg);
+               sciErr = createComplexMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, _iRowsRet, _iColsRet, piCoeff, pdblReal, pdblImg);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -633,14 +633,14 @@ SciErr matrix_poly(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        }
        else
        {
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, NULL, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
                piCoeff = (int*)malloc(sizeof(int) * iRows * iCols);
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, NULL);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, NULL);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -652,13 +652,13 @@ SciErr matrix_poly(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
                        pdblReal[i] = malloc(sizeof(double) * piCoeff[i]);
                }
 
-               sciErr = getMatrixOfPoly(_piKey, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
+               sciErr = getMatrixOfPoly(pvApiCtx, _piAddress, &iRows, &iCols, piCoeff, pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = createMatrixOfPoly(_piKey, Rhs + 1, pstVarName, _iRowsRet, _iColsRet, piCoeff, pdblReal);
+               sciErr = createMatrixOfPoly(pvApiCtx, Rhs + 1, pstVarName, _iRowsRet, _iColsRet, piCoeff, pdblReal);
                if(sciErr.iErr)
                {
                        return sciErr;
@@ -674,7 +674,7 @@ SciErr matrix_poly(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        }
        free(pdblReal);
 
-       if(isVarComplex(_piKey, _piAddress))
+       if(isVarComplex(pvApiCtx, _piAddress))
        {
                for(i = 0 ; i < iRows * iCols ; i++)
                {
@@ -686,7 +686,7 @@ SciErr matrix_poly(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        return sciErr;
 }
 
-SciErr matrix_string(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
+SciErr matrix_string(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet)
 {
        SciErr sciErr;
        int i;
@@ -695,14 +695,14 @@ SciErr matrix_string(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        int *piLen                      = NULL;
        char **pstData  = NULL;
 
-       sciErr = getMatrixOfString(_piKey, _piAddress, &iRows, &iCols, NULL, NULL);
+       sciErr = getMatrixOfString(pvApiCtx, _piAddress, &iRows, &iCols, NULL, NULL);
        if(sciErr.iErr)
        {
                return sciErr;
        }
 
        piLen = malloc(sizeof(int) * iRows * iCols);
-       sciErr = getMatrixOfString(_piKey, _piAddress, &iRows, &iCols, piLen, NULL);
+       sciErr = getMatrixOfString(pvApiCtx, _piAddress, &iRows, &iCols, piLen, NULL);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -714,13 +714,13 @@ SciErr matrix_string(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
                pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+1 for null termination
        }
 
-       sciErr = getMatrixOfString(_piKey, _piAddress, &iRows, &iCols, piLen, pstData);
+       sciErr = getMatrixOfString(pvApiCtx, _piAddress, &iRows, &iCols, piLen, pstData);
        if(sciErr.iErr)
        {
                return sciErr;
        }
 
-       sciErr = createMatrixOfString(_piKey, Rhs + 1, _iRowsRet, _iColsRet, pstData);
+       sciErr = createMatrixOfString(pvApiCtx, Rhs + 1, _iRowsRet, _iColsRet, pstData);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -735,7 +735,7 @@ SciErr matrix_string(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        return sciErr;
 }
 
-SciErr matrix_int(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
+SciErr matrix_int(void* pvApiCtx, int* _piAddress, int _iRowsRet, int _iColsRet)
 {
        SciErr sciErr;
        int iPrec                                                               = 0;
@@ -749,7 +749,7 @@ SciErr matrix_int(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        unsigned short* pusData = NULL;
        unsigned int* puiData           = NULL;
 
-       sciErr = getMatrixOfIntegerPrecision(_piKey, _piAddress, &iPrec);
+       sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddress, &iPrec);
        if(sciErr.iErr)
        {
                return sciErr;
@@ -758,58 +758,58 @@ SciErr matrix_int(int* _piKey, int* _piAddress, int _iRowsRet, int _iColsRet)
        switch(iPrec)
        {
        case SCI_INT8 :
-               sciErr = getMatrixOfInteger8(_piKey, _piAddress, &iRows, &iCols, &pcData);
+               sciErr = getMatrixOfInteger8(pvApiCtx, _piAddress, &iRows, &iCols, &pcData);
                if(sciErr.iErr)
                {
                        return sciErr;
                }
 
-               sciErr = createMatrixOfInteger8(_piKey, Rhs + 1, _iRowsRet, _iColsRet, pcData);
+               sciErr = createMatrixOfInteger8(pvApiCtx, Rhs + 1, _iRowsRet, _iColsRet, pcData);
                break;
        case SCI_UINT8 :
-           &