fix bug 12321 save environment failed to save lib variable. Now these variables are... 60/10560/2
Antoine ELIAS [Thu, 21 Feb 2013 15:12:21 +0000 (16:12 +0100)]
Change-Id: I6497a2efe9ae4238117b9cb1f77393ec28bac66e

scilab/CHANGES_5.4.X
scilab/modules/hdf5/sci_gateway/cpp/sci_export_to_hdf5.cpp
scilab/modules/io/macros/%_save.sci

index 78fc554..0d16c71 100644 (file)
@@ -157,6 +157,9 @@ Xcos
 * Bug #12290 fixed - AFFICH_m block inside a superblock led to java null
                      pointer exception.
 
+* Bug #12321 fixed - save environment failed to save lib variable. Now these variables
+                     are ignored like previous version of save function.
+
 
 Documentation
 ==============
index 253ac77..68ff9c6 100644 (file)
@@ -69,7 +69,7 @@ int sci_export_to_hdf5(char *fname, unsigned long fname_len)
     int** piAddrList    = NULL;
     char** pstNameList  = NULL;
     char *pstFileName   = NULL;
-    bool bExport        = false;
+    bool bExport        = true;
     bool bAppendMode    = false;
 
     SciErr sciErr;
index 6dd50e9..27f33f8 100644 (file)
@@ -893,7 +893,7 @@ function [] = %_save(%__filename__, varargin)
     if size(varargin) == 0 then
     end
 
-    for %__i__ = 1:size(varargin)
+    for %__i__ = size(varargin):-1:1
 
         if varargin(%__i__) == "-append" then
             continue;
@@ -916,10 +916,13 @@ function [] = %_save(%__filename__, varargin)
             value = extractMacro(temp, varargin(%__i__));
             //update 
             execstr(varargin(%__i__) + " = value");
+        elseif type(temp) == 14 then //library, must not be save
+            varargin(%__i__) = null();
         end
     end
     warning(oldMode);
 
+    //if size(varargin) == 0, create an empty file
     result = export_to_hdf5(%__filename__, varargin(:));
 
 endfunction