Merge remote-tracking branch 'origin/master' into YaSp
[scilab.git] / scilab / modules / ui_data / src / cpp / UpdateBrowseVar.cpp
index 88fd01a..1c1fa95 100644 (file)
@@ -32,10 +32,8 @@ extern "C"
 #include "getScilabJavaVM.h"
 #include "Scierror.h"
 #include "freeArrayOfString.h"
+#include "os_strdup.h"
 #include "sci_types.h"
-#ifdef _MSC_VER
-#include "strdup_windows.h"
-#endif
 }
 using namespace org_scilab_modules_ui_data;
 
@@ -77,11 +75,11 @@ void UpdateBrowseVar(BOOL update)
         // name
         pstAllVariableNames[i] = getLocalNamefromId(i + 1);
         // type
-        err = getNamedVarType(pvApiCtx, pstAllVariableNames[i], &piAllVariableTypes[i]);
+        err = getNamedVarType(NULL, pstAllVariableNames[i], &piAllVariableTypes[i]);
         if (!err.iErr)
         {
             piAllVariableBytes[i] = getLocalSizefromId(i);
-            err = getNamedVarDimension(pvApiCtx, pstAllVariableNames[i], &nbRows, &nbCols);
+            err = getNamedVarDimension(NULL, pstAllVariableNames[i], &nbRows, &nbCols);
         }
 
         if (err.iErr || nbRows * nbCols == 0)
@@ -95,12 +93,12 @@ void UpdateBrowseVar(BOOL update)
             // 11 =strlen("2147483647")+1 (1 for security)
             sizeStr = (char *)MALLOC((11 + 11 + 1 + 1) * sizeof(char));
             sprintf(sizeStr, "%dx%d", nbRows, nbCols);
-            pstAllVariableSizes[i] = strdup(sizeStr);
+            pstAllVariableSizes[i] = os_strdup(sizeStr);
             FREE(sizeStr);
         }
 
         // global / local ??
-        pstAllVariableVisibility[i] = strdup("local");
+        pstAllVariableVisibility[i] = os_strdup("local");
 
         if (scilabDefaultVariablesSet.find(string(pstAllVariableNames[i])) == scilabDefaultVariablesSet.end() && piAllVariableTypes[i] != sci_c_function    /*TODO: voir si je fais sauter ou pas */
                 && piAllVariableTypes[i] != sci_lib)
@@ -122,22 +120,23 @@ void UpdateBrowseVar(BOOL update)
         piAllVariableBytes[i] = getGlobalSizefromId(j);
         // type
         // Calling "API Scilab": not yet implemented for global variable
-        //getNamedVarType(pvApiCtx, pstAllVariableNames[i], &piAllVariableTypes[i]);
+        //getNamedVarType(NULL, pstAllVariableNames[i], &piAllVariableTypes[i]);
         // Using old stack operations...
-        int pos = C2F(vstk).isiz + 2 + j;
+        //int pos = C2F(vstk).isiz + 2 + j;
 
-        piAllVariableTypes[i] = C2F(gettype) (&pos);
+        //piAllVariableTypes[i] = C2F(gettype) (&pos);
+        getNamedVarType(NULL, pstAllVariableNames[i], &piAllVariableTypes[i]);
 
         // Sizes of the variable
-        getNamedVarDimension(pvApiCtx, pstAllVariableNames[i], &nbRows, &nbCols);
+        getNamedVarDimension(NULL, pstAllVariableNames[i], &nbRows, &nbCols);
         // 11 =strlen("2147483647")+1 (1 for security)
         sizeStr = (char *)MALLOC((11 + 11 + 1 + 1) * sizeof(char));
         sprintf(sizeStr, "%dx%d", nbRows, nbCols);
-        pstAllVariableSizes[i] = strdup(sizeStr);
+        pstAllVariableSizes[i] = os_strdup(sizeStr);
         FREE(sizeStr);
 
         // global / local ??
-        pstAllVariableVisibility[i] = strdup("global");
+        pstAllVariableVisibility[i] = os_strdup("global");
 
         if (scilabDefaultVariablesSet.find(string(pstAllVariableNames[i])) == scilabDefaultVariablesSet.end()
                 && piAllVariableTypes[i] != sci_c_function && piAllVariableTypes[i] != sci_lib)