The variable browser also shows the user type of a mlist 19/11319/3
Sylvestre Ledru [Thu, 18 Apr 2013 13:08:36 +0000 (15:08 +0200)]
Change-Id: Id4264b7a8c24e23e0b6d829d1ceade7c3315d5e4

scilab/CHANGES_5.5.X
scilab/modules/ui_data/src/cpp/UpdateBrowseVar.cpp
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/BrowseVar.java
scilab/modules/ui_data/src/jni/BrowseVar.cpp
scilab/modules/ui_data/src/jni/BrowseVar.giws.xml
scilab/modules/ui_data/src/jni/BrowseVar.hxx

index 212142c..5fa939b 100644 (file)
@@ -22,7 +22,7 @@ BDF methods with direct and preconditioned Krylov linear solvers, from ODEPACK.
 * Add a complete set of functions to read and write any HDF5 file from Scilab.
 
 * The Variable Browser shows also the size of integers and the user type of
-  the tlist.
+  the tlist/mlist.
   See bug #12523 and #10409
 
 * isnum has been redesigned in native code. Up to 130x performance
index 2439cb3..12546cb 100644 (file)
@@ -40,7 +40,7 @@ extern "C"
 using namespace org_scilab_modules_ui_data;
 
 static std::set < string > createScilabDefaultVariablesSet();
-static char * getTlistName(char * variableName);
+static char * getListName(char * variableName);
 
 /*--------------------------------------------------------------------------*/
 void UpdateBrowseVar(BOOL update)
@@ -63,7 +63,7 @@ void UpdateBrowseVar(BOOL update)
 
     char **pstAllVariableNames = (char **)MALLOC((iLocalVariablesUsed + iGlobalVariablesUsed) * sizeof(char *));
     char **pstAllVariableVisibility = (char **)MALLOC((iLocalVariablesUsed + iGlobalVariablesUsed) * sizeof(char *));
-    char **pstAllVariableTlistTypes = (char **)MALLOC((iLocalVariablesUsed + iGlobalVariablesUsed) * sizeof(char *));
+    char **pstAllVariableListTypes = (char **)MALLOC((iLocalVariablesUsed + iGlobalVariablesUsed) * sizeof(char *));
     int *piAllVariableBytes = (int *)MALLOC((iLocalVariablesUsed + iGlobalVariablesUsed) * sizeof(int));
     char **pstAllVariableSizes = (char **)MALLOC((iLocalVariablesUsed + iGlobalVariablesUsed) * sizeof(char *));
     int *piAllVariableTypes = (int *)MALLOC((iLocalVariablesUsed + iGlobalVariablesUsed) * sizeof(int));
@@ -134,13 +134,13 @@ void UpdateBrowseVar(BOOL update)
             piAllVariableIntegerTypes[i] = -1;
         }
 
-        if (piAllVariableTypes[i] == sci_tlist)
+        if (piAllVariableTypes[i] == sci_tlist || piAllVariableTypes[i] == sci_mlist)
         {
-            pstAllVariableTlistTypes[i] = getTlistName(pstAllVariableNames[i]);
+            pstAllVariableListTypes[i] = getListName(pstAllVariableNames[i]);
         }
         else
         {
-            pstAllVariableTlistTypes[i] = strdup("");
+            pstAllVariableListTypes[i] = strdup("");
         }
 
 
@@ -184,13 +184,13 @@ void UpdateBrowseVar(BOOL update)
         pstAllVariableVisibility[i] = strdup("global");
 
 
-        if (piAllVariableTypes[i] == sci_tlist)
+        if (piAllVariableTypes[i] == sci_tlist || piAllVariableTypes[i] == sci_mlist)
         {
-            pstAllVariableTlistTypes[i] = getTlistName(pstAllVariableNames[i]);
+            pstAllVariableListTypes[i] = getListName(pstAllVariableNames[i]);
         }
         else
         {
-            pstAllVariableTlistTypes[i] = strdup("");
+            pstAllVariableListTypes[i] = strdup("");
         }
 
 
@@ -212,7 +212,7 @@ void UpdateBrowseVar(BOOL update)
                                    piAllVariableBytes, iLocalVariablesUsed + iGlobalVariablesUsed,
                                    piAllVariableTypes, iLocalVariablesUsed + iGlobalVariablesUsed,
                                    piAllVariableIntegerTypes, iLocalVariablesUsed + iGlobalVariablesUsed,
-                                   pstAllVariableTlistTypes, iLocalVariablesUsed + iGlobalVariablesUsed,
+                                   pstAllVariableListTypes, iLocalVariablesUsed + iGlobalVariablesUsed,
                                    pstAllVariableSizes, iLocalVariablesUsed + iGlobalVariablesUsed,
                                    pstAllVariableVisibility, iLocalVariablesUsed + iGlobalVariablesUsed,
                                    piAllVariableFromUser, iLocalVariablesUsed + iGlobalVariablesUsed);
@@ -220,7 +220,7 @@ void UpdateBrowseVar(BOOL update)
     freeArrayOfString(pstAllVariableNames, iLocalVariablesUsed + iGlobalVariablesUsed);
     freeArrayOfString(pstAllVariableVisibility, iLocalVariablesUsed + iGlobalVariablesUsed);
     freeArrayOfString(pstAllVariableSizes, iLocalVariablesUsed + iGlobalVariablesUsed);
-    freeArrayOfString(pstAllVariableTlistTypes, iLocalVariablesUsed + iGlobalVariablesUsed);
+    freeArrayOfString(pstAllVariableListTypes, iLocalVariablesUsed + iGlobalVariablesUsed);
 
     if (piAllVariableFromUser)
     {
@@ -299,7 +299,7 @@ static std::set < string > createScilabDefaultVariablesSet()
     return ScilabDefaultVariables;
 }
 
-static char * getTlistName(char * variableName)
+static char * getListName(char * variableName)
 {
     SciErr sciErr;
     int *piAddr = NULL;
index c1b5bf2..fbde084 100644 (file)
@@ -129,7 +129,7 @@ public class BrowseVar {
      * @param dataVisibility : local or global variable
      * @param dataFromUser : Scilab data or user data
      */
-    public static void openVariableBrowser(boolean update, String[] dataNames, int[] dataBytes, int[] dataTypes, int[] dataIntegerTypes, String[] variableTlistTypes, String[] dataSizes, String[] dataVisibility, boolean[] dataFromUser) {
+    public static void openVariableBrowser(boolean update, String[] dataNames, int[] dataBytes, int[] dataTypes, int[] dataIntegerTypes, String[] variableListTypes, String[] dataSizes, String[] dataVisibility, boolean[] dataFromUser) {
         Object[][] data = new Object[dataNames.length][COLUMNNAMES.length];
         for (int i = 0; i < dataNames.length; ++i) {
             data[i][ICON_COLUMN_INDEX] = getIconFromType(dataTypes[i]);
@@ -140,9 +140,9 @@ public class BrowseVar {
                 // It is an integer. We want to detail the precision of the int
                 data[i][TYPE_DESC_COLUMN_INDEX] = data[i][TYPE_DESC_COLUMN_INDEX] + " " + dataIntegerTypes[i];
             }
-            if (dataTypes[i] == ScilabTypeEnum.sci_tlist.swigValue() && !variableTlistTypes[i].equals("")) {
+            if ((dataTypes[i] == ScilabTypeEnum.sci_tlist.swigValue() || dataTypes[i] == ScilabTypeEnum.sci_mlist.swigValue()) && !variableListTypes[i].equals("")) {
                 // It is a tlist and we want to display the user datatype
-                data[i][TYPE_DESC_COLUMN_INDEX] = variableTlistTypes[i] + " (" + data[i][TYPE_DESC_COLUMN_INDEX] + ")";
+                data[i][TYPE_DESC_COLUMN_INDEX] = variableListTypes[i] + " (" + data[i][TYPE_DESC_COLUMN_INDEX] + ")";
             }
             data[i][VISIBILITY_COLUMN_INDEX] = dataVisibility[i];
             data[i][BYTES_COLUMN_INDEX] = dataBytes[i];
index 44206f1..b403fc3 100644 (file)
@@ -151,7 +151,7 @@ throw GiwsException::JniMonitorException(getCurrentEnv(), "BrowseVar");
 }
 // Method(s)
 
-void BrowseVar::openVariableBrowser (JavaVM * jvm_, bool update, char const* const* variableNames, int variableNamesSize, int const* variableBytes, int variableBytesSize, int const* variableTypes, int variableTypesSize, int const* variableIntegerTypes, int variableIntegerTypesSize, char const* const* variableTlistTypes, int variableTlistTypesSize, char const* const* variableSize, int variableSizeSize, char const* const* variableVisibility, int variableVisibilitySize, bool const* variableFromUser, int variableFromUserSize){
+void BrowseVar::openVariableBrowser (JavaVM * jvm_, bool update, char const* const* variableNames, int variableNamesSize, int const* variableBytes, int variableBytesSize, int const* variableTypes, int variableTypesSize, int const* variableIntegerTypes, int variableIntegerTypesSize, char const* const* variableListTypes, int variableListTypesSize, char const* const* variableSize, int variableSizeSize, char const* const* variableVisibility, int variableVisibilitySize, bool const* variableFromUser, int variableFromUserSize){
 
 JNIEnv * curEnv = NULL;
 jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
@@ -221,22 +221,22 @@ curEnv->SetIntArrayRegion( variableIntegerTypes_, 0, variableIntegerTypesSize, (
 
 
 // create java array of strings.
-jobjectArray variableTlistTypes_ = curEnv->NewObjectArray( variableTlistTypesSize, stringArrayClass, NULL);
-if (variableTlistTypes_ == NULL)
+jobjectArray variableListTypes_ = curEnv->NewObjectArray( variableListTypesSize, stringArrayClass, NULL);
+if (variableListTypes_ == NULL)
 {
 throw GiwsException::JniBadAllocException(curEnv);
 }
 
 // convert each char * to java strings and fill the java array.
-for ( int i = 0; i < variableTlistTypesSize; i++)
+for ( int i = 0; i < variableListTypesSize; i++)
 {
-jstring TempString = curEnv->NewStringUTF( variableTlistTypes[i] );
+jstring TempString = curEnv->NewStringUTF( variableListTypes[i] );
 if (TempString == NULL)
 {
 throw GiwsException::JniBadAllocException(curEnv);
 }
 
-curEnv->SetObjectArrayElement( variableTlistTypes_, i, TempString);
+curEnv->SetObjectArrayElement( variableListTypes_, i, TempString);
 
 // avoid keeping reference on to many strings
 curEnv->DeleteLocalRef(TempString);
@@ -288,13 +288,13 @@ curEnv->DeleteLocalRef(TempString);
 jbooleanArray variableFromUser_ = curEnv->NewBooleanArray( variableFromUserSize ) ;
 curEnv->SetBooleanArrayRegion( variableFromUser_, 0, variableFromUserSize, (jboolean*)variableFromUser ) ;
 
-                         curEnv->CallStaticVoidMethod(cls, voidopenVariableBrowserjbooleanbooleanjobjectArray_java_lang_Stringjava_lang_StringjintArray_intintjintArray_intintjintArray_intintjobjectArray_java_lang_Stringjava_lang_StringjobjectArray_java_lang_Stringjava_lang_StringjobjectArray_java_lang_Stringjava_lang_StringjbooleanArray_booleanbooleanID ,update_, variableNames_, variableBytes_, variableTypes_, variableIntegerTypes_, variableTlistTypes_, variableSize_, variableVisibility_, variableFromUser_);
+                         curEnv->CallStaticVoidMethod(cls, voidopenVariableBrowserjbooleanbooleanjobjectArray_java_lang_Stringjava_lang_StringjintArray_intintjintArray_intintjintArray_intintjobjectArray_java_lang_Stringjava_lang_StringjobjectArray_java_lang_Stringjava_lang_StringjobjectArray_java_lang_Stringjava_lang_StringjbooleanArray_booleanbooleanID ,update_, variableNames_, variableBytes_, variableTypes_, variableIntegerTypes_, variableListTypes_, variableSize_, variableVisibility_, variableFromUser_);
                         curEnv->DeleteLocalRef(stringArrayClass);
 curEnv->DeleteLocalRef(variableNames_);
 curEnv->DeleteLocalRef(variableBytes_);
 curEnv->DeleteLocalRef(variableTypes_);
 curEnv->DeleteLocalRef(variableIntegerTypes_);
-curEnv->DeleteLocalRef(variableTlistTypes_);
+curEnv->DeleteLocalRef(variableListTypes_);
 curEnv->DeleteLocalRef(variableSize_);
 curEnv->DeleteLocalRef(variableVisibility_);
 curEnv->DeleteLocalRef(variableFromUser_);
index 6a5dc3c..fbdfc91 100644 (file)
@@ -7,7 +7,7 @@
             <parameter type="int[]" name="variableBytes"/>
             <parameter type="int[]" name="variableTypes"/>
             <parameter type="int[]" name="variableIntegerTypes"/>
-            <parameter type="String[]" name="variableTlistTypes"/>
+            <parameter type="String[]" name="variableListTypes"/>
             <parameter type="String[]" name="variableSize"/>
             <parameter type="String[]" name="variableVisibility"/>
             <parameter type="boolean[]" name="variableFromUser"/>
index a8257fa..6c2a782 100644 (file)
@@ -139,7 +139,7 @@ void synchronize();
 void endSynchronize();
 
 // Methods
-static void openVariableBrowser(JavaVM * jvm_, bool update, char const* const* variableNames, int variableNamesSize, int const* variableBytes, int variableBytesSize, int const* variableTypes, int variableTypesSize, int const* variableIntegerTypes, int variableIntegerTypesSize, char const* const* variableTlistTypes, int variableTlistTypesSize, char const* const* variableSize, int variableSizeSize, char const* const* variableVisibility, int variableVisibilitySize, bool const* variableFromUser, int variableFromUserSize);
+static void openVariableBrowser(JavaVM * jvm_, bool update, char const* const* variableNames, int variableNamesSize, int const* variableBytes, int variableBytesSize, int const* variableTypes, int variableTypesSize, int const* variableIntegerTypes, int variableIntegerTypesSize, char const* const* variableListTypes, int variableListTypesSize, char const* const* variableSize, int variableSizeSize, char const* const* variableVisibility, int variableVisibilitySize, bool const* variableFromUser, int variableFromUserSize);
 
 static bool isVariableBrowserOpened(JavaVM * jvm_);