try to fix sci_load 22/15322/11
Vladislav TRUBKIN [Mon, 6 Oct 2014 14:17:09 +0000 (16:17 +0200)]
Change-Id: Ic0ca3e3dcd86167ab752e3a82b9c2e0b9f0881ab

16 files changed:
scilab/modules/core/src/c/core.vcxproj
scilab/modules/core/src/cpp/InitScilab.cpp
scilab/modules/graphics/macros/%h_load.sci [deleted file]
scilab/modules/graphics/sci_gateway/cpp/sci_get.cpp
scilab/modules/hdf5/src/c/h5_fileManagement.c
scilab/modules/hdf5/src/cpp/dynhdf5.cpp [deleted file]
scilab/modules/hdf5/src/cpp/dynhdf5.hxx [deleted file]
scilab/modules/hdf5/src/cpp/h5_fileManagement.cpp [deleted file]
scilab/modules/hdf5/src/cpp/h5_readDataFromFile.cpp [deleted file]
scilab/modules/hdf5/src/cpp/h5_writeDataToFile.cpp [deleted file]
scilab/modules/io/Makefile.am
scilab/modules/io/Makefile.in
scilab/modules/io/macros/%_sodload.sci
scilab/modules/io/sci_gateway/cpp/sci_load.cpp
scilab/modules/io/src/cpp/io_gw.vcxproj
scilab/test/good/%h_load.sci [deleted file]

index 5cd5ec2..a918c90 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../hdf5/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -120,7 +120,7 @@ cd ..
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../hdf5/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -158,7 +158,7 @@ cd ..
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../hdf5/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;NDEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -203,7 +203,7 @@ cd ..
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../hdf5/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;NDEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -468,6 +468,9 @@ cd ..
     <ProjectReference Include="..\..\..\gui\src\c\gui.vcxproj">
       <Project>{45ca5b12-7601-4968-ae16-16069fd1a152}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\hdf5\src\c\hdf5.vcxproj">
+      <Project>{a824ea62-af07-4f43-9036-0e63990556bd}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\history_manager\src\c\history_manager.vcxproj">
       <Project>{1b98dc87-44f5-48ae-b5d0-29dd8ad86f5e}</Project>
     </ProjectReference>
index 7f7bd35..a1966e6 100644 (file)
@@ -55,6 +55,7 @@ extern "C"
 #include "setenvvar.h"
 #include "getScilabPreference.h"
 #include "saveCWDInPreferences.h"
+#include "h5_fileManagement.h"
 
 
 #ifdef _MSC_VER
@@ -378,6 +379,9 @@ void StopScilabEngine(ScilabEngineInfo* _pSEI)
     */
     xmlCleanupParser();
 
+    /* cleanup HDF5 */
+    HDF5cleanup();
+
     /* Cleanup the parser state */
     Parser::cleanup();
 
diff --git a/scilab/modules/graphics/macros/%h_load.sci b/scilab/modules/graphics/macros/%h_load.sci
deleted file mode 100644 (file)
index 7500f5e..0000000
+++ /dev/null
@@ -1,1597 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2004 - INRIA - Serge Steer
-// Copyright (C) 2004-2006 - INRIA - Fabrice Leray
-// Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
-// Copyright (C) 2010 - DIGITEO - Manuel Juliachs
-// This file must be used under the terms of the CeCILL.
-// This source file is licensed as described in the file COPYING, which
-// you should have received as part of this distribution.  The terms
-// are also available at
-// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
-
-
-function h=%h_load(fd)
-    global init_immediate_drawing
-    init_immediate_drawing = 0;
-
-    version=mget(4,"uc",fd)
-    // saving/loading character with 'c' is actually quite buggy
-    characterFormat = "uc";
-    stringFormat = "il";
-
-    immediate_drawing="";
-
-    h=[];
-
-    if is_higher_than([3 1 0 1]) then // case 3 1 0 2 and after
-        hsize = mget(2,characterFormat,fd)
-        for i=1:hsize(1)
-            for j=1:hsize(2)
-                [htmp,immediate_drawing] = load_graphichandle(fd)
-                h = [h htmp];
-            end
-        end
-    else
-        [h,immediate_drawing] = load_graphichandle(fd) // a single handle only can be loaded before 3 1 0 2
-    end
-    f=gcf();
-    f.immediate_drawing = immediate_drawing;
-    clearglobal init_immediate_drawing
-    clear init_immediate_drawing
-endfunction
-
-function [h,immediate_drawing] = load_graphichandle(fd)
-    global init_immediate_drawing
-    typ=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))
-    if typ<>"Figure"
-        f=gcf();
-        if init_immediate_drawing == 0
-            immediate_drawing = f.immediate_drawing;
-            f.immediate_drawing ="off";
-            init_immediate_drawing = 1;
-        end
-    end
-    //  mprintf('----------------------------- %s ----------------------\n',typ)
-    // Determines whether %h_load has been called by the xload macro
-    // in which case xload_mode is set to true
-    [lnums, fnames] = where();
-    ind = grep(fnames, "xload");
-    xload_mode = (ind ~= []);
-
-    select typ
-    case "Figure"
-        if xload_mode then
-            h=gcf()
-            visible=toggle(mget(1,characterFormat,fd)); // visible
-            figure_position=mget(2,"sl",fd); // figure_position
-            figure_size=mget(2,"sl",fd); // figure_size
-            axes_size=mget(2,"sl",fd); //axes_size
-            if ( is_higher_than([4 1 2 0]) ) then
-                viewport = mget(2,"sl",fd) ; // viewport
-                if is_higher_than([5 4 0 0]) then
-                    info_message = ascii(mget(mget(1,stringFormat,fd),characterFormat,fd)) ; // info_message
-                else
-                    info_message = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // info_message
-                end
-                tag = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // tag
-            end
-            auto_resize=toggle(mget(1,characterFormat,fd)); // auto_resize
-            if is_higher_than([5 4 0 0]) then
-                figure_name=ascii(mget(mget(1,stringFormat,fd),characterFormat,fd)) // figure_name
-            else
-                figure_name=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // figure_name
-            end
-            figure_id=mget(1,"sl",fd); // figure_id
-            h.color_map=matrix(mget(mget(1,"il",fd),"dl",fd),-1,3) // color_map
-            if ~is_higher_than([5 4 0 1]) then
-                pixmap=toggle(mget(1,characterFormat,fd)); // pixmap, removed from V5.5.0 on
-            end
-            pixel_drawing_mode=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // pixel_drawing_mode
-            if (is_higher_than([5 1 0 0])) then
-                anti_aliasing=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // anti_aliasing
-            end
-            immediate_drawing=toggle(mget(1,characterFormat,fd));// immediate drawing // init. global variable immediate_drawing
-            h.immediate_drawing = "off";  // set it to 'off' to pass useless redraw due to several 'set' calls
-            h.background=mget(1,"il",fd) // background
-            rotation_style=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // rotation_style
-        else
-            visible=toggle(mget(1,characterFormat,fd)); // visible
-            figure_position=mget(2,"sl",fd); // figure_position
-            // if figure is iconified in old scilab version, its position is -32000, -32000]
-            figure_position = max(figure_position, [0,0]);
-            figure_size=mget(2,"sl",fd); // figure_size
-            axes_size=mget(2,"sl",fd); // axes_size
-            if ( is_higher_than([4 1 2 0]) ) then
-                viewport = mget(2,"sl",fd) ; // viewport
-                if is_higher_than([5 4 0 0]) then
-                    info_message = ascii(mget(mget(1,stringFormat,fd),characterFormat,fd)) ; // info_message
-                else
-                    info_message = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // info_message
-                end
-                tag = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // tag
-            end
-            auto_resize=toggle(mget(1,characterFormat,fd)); // auto_resize
-            if is_higher_than([5 4 0 0]) then
-                figure_name=ascii(mget(mget(1,stringFormat,fd),characterFormat,fd)) // figure_name
-            else
-                figure_name=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // figure_name
-            end
-            figure_id=mget(1,"sl",fd); // figure_id
-            // create the figure
-            h=scf(figure_id);
-            h.visible=visible;  // can be set now as we act on immediate_drawing everywhere else F.Leray 18.02.05
-            h.figure_position=figure_position
-            // set auto_resize first otherwise viewport modification may not have any effect.
-            h.auto_resize = auto_resize;
-            h.figure_size = figure_size;
-            // set axes_size last because it's more important than figure_size
-            h.axes_size = axes_size;
-
-            if ( is_higher_than([4 1 2 0]) ) then
-                h.viewport = viewport;
-                h.info_message = info_message ;
-                h.tag = tag ;
-            end
-            h.figure_name=figure_name
-            h.color_map=matrix(mget(mget(1,"il",fd),"dl",fd),-1,3) // color_map
-            if ~is_higher_than([5 4 0 1]) then
-                pixmap=toggle(mget(1,characterFormat,fd)); // pixmap, removed from V5.5.0 on
-            end
-            h.pixel_drawing_mode=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // pixel_drawing_mode
-            if (is_higher_than([5 1 0 0])) then
-                h.anti_aliasing=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // anti_aliasing
-            end
-            immediate_drawing=toggle(mget(1,characterFormat,fd)); // immediate_drawing  // init. global variable immediate_drawing
-            h.immediate_drawing = "off"; // set it to 'off' to pass useless redraw due to several 'set' calls
-            h.background=mget(1,"il",fd); // background
-            h.rotation_style = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // rotation_style
-
-        end
-
-        if ( is_higher_than([4 1 2 0]) ) then
-            h.event_handler = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // event_handler
-            h.event_handler_enable = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // event_handler_enable
-        end
-
-        if ( is_higher_than([5 2 0 0]) ) then // Added in 5.4.0 version
-            h.resizefcn = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // resizefcn
-            h.closerequestfcn = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // closerequestfcn
-        end
-
-        // children
-        n_axes=mget(1,"il",fd);
-        if n_axes==1 then
-            load_graphichandle(fd)
-        else
-            load_graphichandle(fd);
-            for k=2:n_axes
-                xsetech(wrect=[0 0 .1 .1])
-                load_graphichandle(fd)
-            end
-        end
-        load_user_data(fd); // user_data
-    case "Axes"
-        // Hack to determine whether %h_load has been called by the %h_copy macro
-        // in which case a new Axes object is created
-        [lnums, fnames]=where();
-        ind=grep(fnames, "%h_copy");
-
-        if(ind<>[]) then
-            newaxes();
-        end;
-
-        a=gca() ;
-        titl=a.title ;
-        x_label=a.x_label ;
-        y_label=a.y_label ;
-        set(a,"visible"              , toggle(mget(1,characterFormat,fd))) // visible
-        if and(version==[3 0 0 0]) then // axes_visible
-            axes_visible= toggle(mget(1,characterFormat,fd));
-            axes_visible=emptystr(1,3)+axes_visible
-        else
-            axes_visible= toggle(mget(mget(1,characterFormat,fd),characterFormat,fd)) ;
-        end
-
-        if is_higher_than( [3 1 0 1] ) then // axes_reverse
-            axes_reverse = toggle(mget(mget(1,characterFormat,fd),characterFormat,fd)) ;
-        end
-
-        set(a,"axes_visible", axes_visible)
-        set(a,"axes_reverse", axes_reverse)
-        set(a,"grid"        , mget(mget(1,characterFormat,fd),"il",fd)) //grid
-        if (is_higher_than([5 0 3 0])) then
-            set(a,"grid_position",ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))); // grid_position
-        else
-            set(a,"grid_position","background"); // grid_position
-        end
-        set(a,"x_location"  , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // x_location
-        set(a,"y_location"  , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // y_location
-
-        view            =  ascii(mget(2,characterFormat,fd)); // view
-
-        // title
-        set(titl,"visible"   , toggle(mget(1,characterFormat,fd))) // title.visible
-        if is_higher_than( [4 1 2 0] ) then
-            set(titl, "text", load_text_matrix( fd ) ) ;
-        else
-            set(titl,"text"      , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // title.text
-        end
-        if is_higher_than([4 1 2 0]) then
-            set(titl,"font_foreground", mget(1,"il",fd)); // title.font_foreground
-            set(titl,"fractional_font", toggle(mget(1,characterFormat,fd))); //title.fractional_font
-        end
-        set(titl,"foreground", mget(1,"il",fd)); // title.foreground
-        if is_higher_than([3 1 0 0]) then
-            set(titl,"background"       , mget(1,"il",fd)); // title.background
-            set(titl,"fill_mode"        , toggle(mget(1,characterFormat,fd))); //title.fill_mode
-        end
-
-        set(titl,"font_style"       , mget(1,characterFormat,fd)); // title.font_style
-        set(titl,"font_size"        , mget(1,characterFormat,fd)); // title.font_size
-
-        if is_higher_than([3 1 0 0]) then
-            auto_rotation =  toggle(mget(1,characterFormat,fd)) ; // title.auto_rotation
-            set(titl,"font_angle"   , mget(1,"dl",fd)); // title.font_angle
-            auto_position = toggle(mget(1,characterFormat,fd)) ;  // title.auto_position
-            set(titl,"position"     , mget(2,"dl",fd)); // title.position
-            set( titl, "auto_rotation", auto_rotation ) ;
-            set( titl, "auto_position", auto_position ) ;
-        end
-
-        // x_label
-        set(x_label,"visible"   , toggle(mget(1,characterFormat,fd))) // x_label.visible
-        if is_higher_than( [4 1 2 0] ) then
-            set(x_label, "text", load_text_matrix( fd ) ) ;
-        else
-            set(x_label,"text"      , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // title.text
-        end
-        if is_higher_than([4 1 2 0]) then
-            set(x_label,"font_foreground", mget(1,"il",fd)); // x_label.font_foreground
-            set(x_label,"fractional_font", toggle(mget(1,characterFormat,fd))); //x_label.fractional_font
-        end
-        set(x_label,"foreground", mget(1,"il",fd)); // x_label.foreground
-        if is_higher_than([3 0 0 0]) then
-            set(x_label,"background"       , mget(1,"il",fd)); // x_label.background
-            set(x_label,"fill_mode"        , toggle(mget(1,characterFormat,fd))); // x_label.fill_mode
-        end
-        set(x_label,"font_style"     , mget(1,characterFormat,fd)); // x_label.font_style
-        set(x_label,"font_size"      , mget(1,characterFormat,fd)); // x_label.font_size
-
-        if is_higher_than([3 0 0 0]) then
-            auto_rotation =  toggle(mget(1,characterFormat,fd)) ; // x_label.auto_rotation
-            set(x_label,"font_angle"   , mget(1,"dl",fd)); // x_label.font_angle
-            auto_position = toggle(mget(1,characterFormat,fd)) ; // x_label.auto_position
-            set( x_label,"position"     , mget(2,"dl",fd)); // x_label.position
-            set( x_label, "auto_rotation", auto_rotation ) ;
-            set( x_label, "auto_position", auto_position ) ;
-        end
-
-        // y_label
-        set(y_label,"visible"        , toggle(mget(1,characterFormat,fd)))
-        if is_higher_than( [4 1 2 0] ) then
-            set(y_label, "text", load_text_matrix( fd ) ) ;
-        else
-            set(y_label,"text"      , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // title.text
-        end
-        if is_higher_than([4 1 2 0]) then
-            set(y_label,"font_foreground", mget(1,"il",fd)); // y_label.font_foreground
-            set(y_label,"fractional_font", toggle(mget(1,characterFormat,fd))); //y_label.fractional_font
-        end
-        set(y_label,"foreground"     , mget(1,"il",fd));
-        if is_higher_than([3 0 0 0]) then
-            set(y_label,"background"       , mget(1,"il",fd));
-            set(y_label,"fill_mode"        , toggle(mget(1,characterFormat,fd)));
-        end
-        set(y_label,"font_style"     , mget(1,characterFormat,fd));
-        set(y_label,"font_size"      , mget(1,characterFormat,fd));
-
-        if is_higher_than([3 0 0 0]) then
-            auto_rotation =  toggle(mget(1,characterFormat,fd)) ; // y_label.auto_rotation
-            set(y_label,"font_angle"   , mget(1,"dl",fd)); // y_label.font_angle
-            auto_position = toggle(mget(1,characterFormat,fd)) ; // y_label.auto_position
-            set( y_label,"position"     , mget(2,"dl",fd)); // y_label.position
-            set( y_label, "auto_rotation", auto_rotation ) ;
-            set( y_label, "auto_position", auto_position ) ;
-        end
-
-        if view=="3d" then
-            // z_label
-            z_label=a.z_label
-            set(z_label,"visible"        , toggle(mget(1,characterFormat,fd)))
-            if is_higher_than( [4 1 2 0] ) then
-                set(z_label, "text", load_text_matrix( fd ) ) ;
-            else
-                set(z_label,"text"      , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // title.text
-            end
-            if is_higher_than([4 1 2 0]) then
-                set(z_label,"font_foreground", mget(1,"il",fd)); // z_label.font_foreground
-                set(z_label,"fractional_font", toggle(mget(1,characterFormat,fd))); //z_label.fractional_font
-            end
-            set(z_label,"foreground"     , mget(1,"il",fd));
-            if is_higher_than([3 0 0 0]) then
-                set(z_label,"background"       , mget(1,"il",fd));
-                set(z_label,"fill_mode"        , toggle(mget(1,characterFormat,fd)));
-            end
-            set(z_label,"font_style"     , mget(1,characterFormat,fd));
-            set(z_label,"font_size"      , mget(1,characterFormat,fd));
-
-            if is_higher_than([3 0 0 0]) then
-                auto_rotation =  toggle(mget(1,characterFormat,fd)) ; // z_label.auto_rotation
-                set(z_label,"font_angle"   , mget(1,"dl",fd)); // z_label.font_angle
-                auto_position = toggle(mget(1,characterFormat,fd)) ; // z_label.auto_position
-                set( z_label,"position"     , mget(2,"dl",fd)); // z_label.position
-                set( z_label, "auto_rotation", auto_rotation ) ;
-                set( z_label, "auto_position", auto_position ) ;
-            end
-        end
-
-
-
-        if is_higher_than([3 0 0 0]) then
-            auto_ticks=toggle(mget(mget(1,characterFormat,fd),characterFormat,fd)); // auto_ticks
-
-            ticks=["ticks","locations","labels"]
-            sz=mget(1,"sl",fd) // x_ticks.locations
-            if sz>0 then
-                x_ticks_locations=mget(sz,"dl",fd)'
-                lz=mget(sz,characterFormat,fd) // x_ticks.label
-                x_ticks_labels=[];for ks=1:sz,x_ticks_labels(ks)=ascii(mget(lz(ks),characterFormat,fd));end
-                set(a,"x_ticks",tlist(ticks,x_ticks_locations,x_ticks_labels))
-            end
-
-            sz=mget(1,"sl",fd) // y_ticks.locations
-            if sz>0 then
-                y_ticks_locations=mget(sz,"dl",fd)'
-                lz=mget(sz,characterFormat,fd) // y_ticks.label
-                y_ticks_labels=[];for ks=1:sz,y_ticks_labels(ks)=ascii(mget(lz(ks),characterFormat,fd));end
-                set(a,"y_ticks",tlist(ticks,y_ticks_locations,y_ticks_labels))
-            end
-
-            sz=mget(1,"sl",fd) // z_ticks.locations
-            if sz>0 then
-                z_ticks_locations=mget(sz,"dl",fd)'
-                lz=mget(sz,characterFormat,fd) // z_ticks.labels
-                z_ticks_labels=[];for ks=1:sz,z_ticks_labels(ks)=ascii(mget(lz(ks),characterFormat,fd));end
-                set(a,"z_ticks",tlist(ticks,z_ticks_locations,z_ticks_labels))
-            end
-            set(a,"auto_ticks"           , auto_ticks)
-        end
-        if is_higher_than([4 1 2 0]) then
-            // migth be now 'off','hidden_axis','back_half' or 'on'
-            boxtype = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ;
-            set( a, "box", boxtype  ) // box
-            set(a,"filled",  toggle(mget(1,characterFormat,fd) )); // filled
-        else
-            set(a, "box", toggle(mget(1,characterFormat,fd) ) ) // box
-        end
-
-        set(a,"sub_tics"             , mget(mget(1,characterFormat,fd),characterFormat,fd)) // sub_tics
-        if ~(is_higher_than([3 1 0 1]) ) then
-            mget(1,"il",fd); // tics_color is removed F.Leray 15.03.05
-        end
-        set(a,"font_style"           , mget(1,characterFormat,fd));  // font_style
-        set(a,"font_size"            , mget(1,characterFormat,fd));  // font_size
-        set(a,"font_color"           , mget(1,"il",fd)); // font_color
-        if is_higher_than([4 1 2 0]) then
-            set(a,"fractional_font", toggle(mget(1,characterFormat,fd))); // fractional_font
-        end
-        set(a,"isoview"              , toggle(mget(1,characterFormat,fd))) // isoview
-
-        cube_scaling    = toggle(mget(1,characterFormat,fd)) // cube_scaling
-        rotation_angles = mget(2,"dl",fd); // rotation_angles
-
-        if a.view=="2d" then
-            set(a,"view"               , view);
-        end
-        if a.view=="3d" then
-            set(a,"cube_scaling"      , cube_scaling)
-            if view=="3d" then
-                set(a,"rotation_angles"   , rotation_angles)
-            end
-        end
-
-        if is_higher_than([3 0 0 0]) then // log_flags
-            log_flags= ascii(mget(3,characterFormat,fd));
-        else
-            log_flags= ascii(mget(2,characterFormat,fd));
-        end
-
-
-        set(a,"tight_limits"         , toggle(mget(1,characterFormat,fd))) // tight_limits
-        data_bounds = matrix(mget(mget(1,characterFormat,fd),"dl",fd),2,-1) // data_bounds
-
-
-        if view=="2d"& a.view=="3d" then
-            data_bounds(2,3)=0;
-        end
-        if xload_mode
-            // check if a had at least a child previously
-            // if not the axes is considered unused
-            // and we don't merge the data_bounds.
-            if a.children <> []  then
-                old_bounds=a.data_bounds;
-                for k=1:size(old_bounds,2)
-                    data_bounds(1,k)=min(data_bounds(1,k),old_bounds(1,k));
-                    data_bounds(2,k)=max(data_bounds(2,k),old_bounds(2,k));
-                end
-            end
-        end
-        if is_higher_than([3 0 0 0]) then
-            zoom_box_size = mget(1,characterFormat,fd);
-            if zoom_box_size<>0 then
-                set(a,"zoom_box"          , mget(zoom_box_size,"dl",fd))  // zoom_box
-            end
-        end
-        if is_higher_than([3 1 0 1]) then
-            set(a,"margins"              , mget(4,"dl",fd))  // margins
-        end
-
-        set(a,"axes_bounds"          , mget(4,"dl",fd))  // axes_bounds
-        set(a,"auto_clear"           , toggle(mget(1,characterFormat,fd))) // auto_clear
-        set(a,"auto_scale"           , toggle(mget(1,characterFormat,fd))) // auto_scale
-
-        if is_higher_than([4 1 2 0] ) then // 4 0 0 0 and after
-            set(a,"hidden_axis_color", mget(1,"il",fd)) ; // hidden_axis_color
-            set(a, "arc_drawing_method", ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))); // arc_drawing_method
-        else
-            set(a, "arc_drawing_method", "nurbs"); // default value, real circle
-        end
-
-        set(a,"hiddencolor"          , mget(1,"il",fd)), // hidden_color
-        set(a,"line_mode"            , toggle(mget(1,characterFormat,fd))), // line_mode
-        line_style = mget(1,characterFormat,fd);
-        if line_style==0 then // 0 and 1 are equivalents and 0 is obsolete since Scilab 5.4.0
-            line_style=1;
-        end
-        set(a,"line_style"           , line_style) // line_style
-        set(a,"thickness"            , mget(1,"sl",fd)), // thickness
-        set(a,"mark_mode"            , toggle(mget(1,characterFormat,fd))), //mark_mode
-        set(a,"mark_style"           , mget(1,characterFormat,fd)) // mark_style
-        set(a,"mark_size"            , mget(1,characterFormat,fd)) // mark_size
-        if is_higher_than([3 0 0 0]) then
-
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated" ;
-            else
-                msu="point";
-            end
-
-            set(a,"mark_size_unit"   , msu)
-            set(a,"mark_foreground"      , mget(1,"il",fd)) ; // mark_foreground
-            set(a,"mark_background"      , mget(1,"il",fd)) ; // mark_background
-        else
-            set(a,"mark_size_unit"     , "tabulated")
-        end
-        set(a,"foreground"           , mget(1,"il",fd)), // foreground
-        set(a,"background"           , mget(1,"il",fd)), // background
-        clip_state                   = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then // clip_box
-            set(a,"clip_box",mget(4,"dl",fd)) ;
-        end
-        set(a,"clip_state"           ,clip_state);
-
-        // children
-        nbChildren = mget(1,"il",fd) ;
-        for k = 1 : nbChildren
-            load_graphichandle(fd) ;
-        end
-        //next lines because tools used to rebuild children change the
-        //data_bounds an axes_visible properties
-        set(a,"data_bounds"          , data_bounds) ;
-        set(a,"log_flags"            , log_flags);
-
-        set(a,"axes_visible"          , axes_visible) ;
-        if is_higher_than([4 1 2 0] ) then
-            set(a, "box", boxtype ) ;
-        end
-
-        h=a;
-        load_user_data(fd) ; // user_data
-        global %LEG
-
-        if %LEG<>[] then
-            //get handles from paths
-            links=get_links_from_path(a,%LEG.paths)
-            if links<>[] then
-                L=captions(links,%LEG.text)
-                L.visible         = %LEG.visible
-                L.font_style      = %LEG.font_style
-                L.font_size       = %LEG.font_size
-                L.font_color      = %LEG.font_color
-                L.fractional_font = %LEG.fractional_font
-                L.mark_mode       = "off";
-                L.legend_location = %LEG.legend_location
-                L.position        = %LEG.position
-                L.line_mode       = %LEG.line_mode
-                L.thickness       = %LEG.thickness
-                L.foreground      = %LEG.foreground
-                L.fill_mode       = %LEG.fill_mode
-                L.background      = %LEG.background
-                L.clip_state      = %LEG.clip_state
-                if %LEG.clip_state=="on" then
-                    L.clip_box      = %LEG.clip_box
-                end
-                L.user_data       = %LEG.user_data
-            else
-                warning(msprintf(_("%s: Legend does not fit with the current context. Skipped\n"),"load"));
-            end
-        end
-        clearglobal %LEG
-
-    case "Polyline"
-
-        visible=toggle(mget(1,characterFormat,fd)) // visible
-        sz=mget(2,"il",fd); // data
-        data=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        if is_higher_than([3 1 0 0]) then
-            closed      = toggle(mget(1,characterFormat,fd)) // closed
-        end
-        line_mode      = toggle(mget(1,characterFormat,fd)) // line_mode
-        if is_higher_than([3 1 0 0]) then
-            fill_mode      = toggle(mget(1,characterFormat,fd)) // fill_mode
-        end
-        line_style     = mget(1,characterFormat,fd); // line_style
-        if line_style==0 then // 0 and 1 are equivalents and 0 is obsolete since Scilab 5.4.0
-            line_style=1;
-        end
-        thickness      = mget(1,"sl",fd); // thickness
-        if is_higher_than([3 1 0 1]) then
-            arrow_size_factor = mget(1,"sl",fd); // arrow_size_factor
-        end
-        polyline_style = mget(1,characterFormat,fd); // polyline_style
-
-        if is_higher_than([3 1 0 1] ) then
-            size_interp_color = mget(1,"sl",fd) ; // interp_color_vector
-            interp_color_vector = mget( size_interp_color, "dl", fd ) ;
-            interp_color_mode   = toggle( mget( 1, characterFormat, fd ) ) ; // interp_color_mode
-        end
-
-        mark_mode      = toggle(mget(1,characterFormat,fd)) // mark_mode
-        mark_style     = mget(1,characterFormat,fd); // mark_style
-        mark_size      = mget(1,characterFormat,fd); // mark_size
-
-        msu="tabulated"
-        if is_higher_than([3 0 0 0]) then
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated" ;
-            else
-                msu="point";
-            end
-        end
-
-        foreground     = mget(1,"il",fd); // foreground
-
-        if is_higher_than([3 1 0 0]) then
-            background     = mget(1,"il",fd); // background
-        end
-
-        if is_higher_than([3 0 0 0]) then
-            mark_foreground=mget(1,"il",fd) // mark_foreground
-            mark_background=mget(1,"il",fd) // mark_background
-        end
-
-        if is_higher_than([5 4 0 1]) then
-            mark_offset=mget(1,"il",fd) // mark_offset
-            mark_stride=mget(1,"il",fd) // mark_stride
-        end
-
-        if is_higher_than([3 1 0 0]) then
-            sz_x_shift=mget(1,"sl",fd) // x_shift
-            x_shift=mget(sz_x_shift,"dl",fd)'
-
-            sz_y_shift=mget(1,"sl",fd) // y_shift
-            y_shift=mget(sz_y_shift,"dl",fd)'
-
-            sz_z_shift=mget(1,"sl",fd) // z_shift
-            z_shift=mget(sz_z_shift,"dl",fd)'
-        end
-
-        if is_higher_than([3 1 0 1]) then
-            bar_width = mget( 1, "dl", fd ) ; // bar_width
-        end
-
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) ; // clip_box
-        else
-            clip_box = [] ;
-        end
-        // draw the polyline and set properties
-        xpoly(data(:,1),data(:,2))
-        //plot2d( data(:,1),data(:,2));
-        h=get("hdl")
-        set(h,"data",data)
-        set(h,"visible",visible)
-        set(h,"line_mode",line_mode),
-        set(h,"line_style",line_style)
-        set(h,"thickness",thickness)
-        set(h,"arrow_size_factor",arrow_size_factor);
-        set(h,"polyline_style",max(1,polyline_style)),
-        set(h,"mark_style",mark_style),
-        set(h,"mark_size",mark_size),
-        set(h,"mark_mode",mark_mode),
-        set(h,"foreground",foreground),
-        if is_higher_than([3 0 0 0]) then
-            set(h,"mark_size_unit",msu)
-            set(h,"mark_foreground",mark_foreground),
-            set(h,"mark_background",mark_background)
-        end
-        if is_higher_than([5 5 0 1]) then
-            set(h,"mark_offset",mark_offset)
-            set(h,"mark_stride",mark_stride)
-        end
-        if is_higher_than([3 1 0 0]) then
-            set(h,"background",background)
-            set(h,"fill_mode",fill_mode)
-            set(h,"closed",closed);
-            set(h,"x_shift",x_shift);
-            set(h,"y_shift",y_shift);
-            set(h,"z_shift",z_shift);
-        end
-
-        if is_higher_than([3 1 0 1]) then
-            if interp_color_mode == "on" & interp_color_vector~=[] then
-                set(h,"interp_color_vector",interp_color_vector);
-                set(h,"interp_color_mode","on");
-            else
-                if interp_color_vector~=[]
-                    h.interp_color_vector = interp_color_vector
-                end
-                h.interp_color_mode = interp_color_mode
-            end
-            set(h,"bar_width",bar_width);
-        end
-
-        if clip_state =="" then clip_state="clipgrf",end
-        if clip_state=="on" then set(h,"clip_box",clip_box),end
-        set(h,"clip_state",clip_state);
-
-        load_user_data(fd) // user_data
-
-    case "Datatip"
-        if is_higher_than([5 4 0 1]) then
-            visible=toggle(mget(1,characterFormat,fd)) // visible
-            sz = mget(2,characterFormat,fd)
-            tip_data = matrix(mget(prod(sz),"dl",fd),sz(1),-1) // data
-            tip_box_mode = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // box_mode
-            tip_label_mode = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // label_mode
-            tip_orientation = mget(1,characterFormat,fd); // orientation
-            tip_3component = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // z_component
-            tip_auto_orientation = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // auto_orientation
-            tip_interp_mode = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // interp_mode
-            tip_disp_function = load_text_matrix(fd); // display_function
-            mark_mode = toggle(mget(1,characterFormat,fd)) // mark_mode
-            mark_style = mget(1,characterFormat,fd); // mark_style
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated"
-            else
-                msu="point";
-            end
-            mark_size = mget(1,characterFormat,fd); // mark_size
-            mark_foreground=mget(1,"il",fd) // mark_foreground
-            mark_background=mget(1,"il",fd) // mark_background
-            tag = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // tag
-
-            h=get("hdl");
-            set(h, "font_foreground", mget(1, "il", fd)); // font_foreground
-            set(h,"foreground", mget(1,"il",fd)); // foreground
-            set(h, "background", mget(1, "il", fd)); // background
-            set(h,"mark_mode",mark_mode); // mark_mode
-            set(h,"mark_style",mark_style); // mark_style
-            set(h,"mark_size_unit",msu) // mark_size_unit
-            set(h,"mark_size",mark_size) // mark_size
-            set(h,"mark_foreground",mark_foreground) // mark_foreground
-            set(h,"mark_background",mark_background) // mark_background
-
-            load_user_data(fd) // user_data
-        end
-
-    case "Plot3d" then
-        visible=toggle(mget(1,characterFormat,fd)) // visible
-        surface_mode   = toggle(mget(1,characterFormat,fd)) // surface_mode
-        foreground     = mget(1,"il",fd); // foreground
-        thickness      = mget(1,"sl",fd); // thickness
-        mark_mode      = toggle(mget(1,characterFormat,fd)) // mark_mode
-        mark_style     = mget(1,characterFormat,fd); // mark_style
-        mark_size      = mget(1,characterFormat,fd); // mark_size
-
-        if is_higher_than([3 0 0 0]) then
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated" ;
-            else
-                msu="point";
-            end
-            mark_foreground=mget(1,"il",fd) // mark_foreground
-            mark_background=mget(1,"il",fd) // mark_background
-        else
-            msu="tabulated"
-        end
-
-        if is_higher_than([5 1 1 0]) then
-            color_mode     = mget(1,"il",fd); // color_mode
-            color_flag     = mget(1,"il",fd); // color_flag
-        else
-            color_mode     = mget(1,characterFormat,fd);
-            color_flag     = mget(1,characterFormat,fd);
-        end
-
-        sz=mget(2,"il",fd); // data.x
-        x=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.y
-        y=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.z
-        z=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-
-        if or(color_flag==[2,5]) then
-            sz=mget(2,"il",fd); // data.color
-            clr=matrix(mget(prod(sz),"il",fd),sz(1),-1);
-        end
-        hiddencolor    = mget(1,"il",fd); // hidden_color
-
-        // plot3d modify the given rotation angles
-        // trick to force keeping the good rotation angles F.Leray 18.02.05
-        // same issue with axes properties... B.Jofret 21.04.09
-        a=gca();
-        rotation_angles = a.rotation_angles;
-        axes_visible = a.axes_visible;
-        box = a.box;
-        margins = a.margins;
-        x_label_visible = a.x_label.visible;
-        y_label_visible = a.y_label.visible;
-        z_label_visible = a.z_label.visible;
-        x_label_text = a.x_label.text;
-        y_label_text = a.y_label.text;
-        z_label_text = a.z_label.text;
-        axes_isoview = a.isoview;
-
-
-        if or(color_flag==[2 5]) then
-            plot3d1(x,y,list(z,clr))
-        else
-            plot3d(x,y,z)
-        end
-
-        // Restore this properties after plot3d.
-        a.rotation_angles = rotation_angles;
-        a.axes_visible = axes_visible;
-        a.box = box;
-        a.margins = margins;
-        a.x_label.visible = x_label_visible;
-        a.y_label.visible = y_label_visible;
-        a.z_label.visible = z_label_visible;
-        a.x_label.text = x_label_text;
-        a.y_label.text = y_label_text;
-        a.z_label.text = z_label_text;
-        a.isoview = axes_isoview;
-
-
-        h=gce();
-        set(h,"visible",visible)
-        set(h,"surface_mode",surface_mode)
-        set(h,"thickness",thickness)
-        set(h,"foreground",foreground),
-        set(h,"color_mode",color_mode),
-        set(h,"mark_style",mark_style),
-        set(h,"mark_size",mark_size),
-        if is_higher_than([3 0 0 0]) then
-            set(h,"mark_size_unit",msu),
-            set(h,"mark_foreground",mark_foreground),
-            set(h,"mark_background",mark_background)
-        end
-        set(h,"mark_mode",mark_mode)
-        set(h,"color_flag",color_flag),
-        set(h,"hiddencolor",hiddencolor),
-
-        if is_higher_than([4 1 2 0])
-            clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-            if clip_state=="on" then
-                set(h,"clip_box", mget(4,"dl",fd)) // clip_box
-            end
-            set(h,"clip_state",clip_state);
-        end
-
-        load_user_data(fd)
-
-    case "Fac3d" then
-
-        visible=toggle(mget(1,characterFormat,fd)) // visible
-        surface_mode   = toggle(mget(1,characterFormat,fd)) // surface_mode
-        foreground     = mget(1,"il",fd); // foreground
-        thickness      = mget(1,"sl",fd); // thickness
-        mark_mode      = toggle(mget(1,characterFormat,fd)) // mark_mode
-        mark_style     = mget(1,characterFormat,fd); // mark_style
-        mark_size      = mget(1,characterFormat,fd); // mark_size
-        if is_higher_than([3 0 0 0]) then
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated";
-            else
-                msu="point";
-            end
-            mark_foreground=mget(1,"il",fd) ; // mark_foreground
-            mark_background=mget(1,"il",fd) ; // mark_background
-        end
-        if is_higher_than([5 1 1 0]) then
-            color_mode     = mget(1,"il",fd); // color_mode
-            color_flag     = mget(1,"il",fd); // color_flag
-        else
-            color_mode     = mget(1,characterFormat,fd);
-            color_flag     = mget(1,characterFormat,fd);
-        end
-
-        sz=mget(2,"il",fd); // data.x
-        x=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.y
-        y=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.z
-        z=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-
-        if is_higher_than([3 1 0 1]) & color_flag >= 2 then
-            sz=mget(2,"il",fd); // data.z
-            clr=matrix(mget(prod(sz),"il",fd),sz(1),-1);
-
-            if ascii(mget(1,characterFormat,fd)) == "s" then // cdata_mapping
-                cdata_mapping = "scaled" ;
-            else
-                cdata_mapping = "direct"  ;
-            end
-
-        elseif or(color_flag==[2 5]) then
-            // compatibility with old version
-            sz=mget(2,"il",fd); // data.z
-            clr=matrix(mget(prod(sz),"il",fd),sz(1),-1);
-        end
-        hiddencolor    = mget(1,"il",fd); // hiddencolor
-
-        // plot3d modify the given rotation angles
-        // trick to force keeping the good rotation angles F.Leray 18.02.05
-        // same issue with axes properties... B.Jofret 21.04.09
-        // and labels text and isoview
-        a=gca();
-        rotation_angles = a.rotation_angles;
-        axes_visible = a.axes_visible;
-        box = a.box;
-        margins = a.margins;
-        x_label_visible = a.x_label.visible;
-        y_label_visible = a.y_label.visible;
-        z_label_visible = a.z_label.visible;
-        x_label_text = a.x_label.text;
-        y_label_text = a.y_label.text;
-        z_label_text = a.z_label.text;
-        axes_isoview = a.isoview;
-
-        if is_higher_than([3 1 0 1]) & color_flag >= 2 then
-            plot3d1(x,y,list(z,clr))
-        elseif or(color_flag==[2 5]) then
-            plot3d1(x,y,list(z,clr))
-        else
-            plot3d(x,y,z)
-        end
-
-        // Restore this properties after plot3d.
-        a.rotation_angles = rotation_angles;
-        a.axes_visible = axes_visible;
-        a.box = box;
-        a.margins = margins;
-        a.x_label.visible = x_label_visible;
-        a.y_label.visible = y_label_visible;
-        a.z_label.visible = z_label_visible;
-        a.x_label.text = x_label_text;
-        a.y_label.text = y_label_text;
-        a.z_label.text = z_label_text;
-        a.isoview = axes_isoview;
-
-        h=gce();
-        set(h,"visible",visible)
-        set(h,"surface_mode",surface_mode)
-        set(h,"thickness",thickness)
-        set(h,"foreground",foreground),
-        set(h,"color_mode",color_mode),
-        set(h,"color_flag",color_flag),
-        set(h,"hiddencolor",hiddencolor),
-        set(h,"mark_style",mark_style),
-        set(h,"mark_size",mark_size),
-        set(h,"mark_mode",mark_mode)
-        if is_higher_than([3 0 0 0]) then
-            set(h,"mark_size_unit",msu),
-            set(h,"mark_foreground",mark_foreground),
-            set(h,"mark_background",mark_background)
-        end
-
-        if is_higher_than([3 1 0 1]) & color_flag >= 2 then
-            set(h,"cdata_mapping",cdata_mapping);
-        end
-
-        if is_higher_than([4 1 2 0])
-            clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-            if clip_state=="on" then
-                set(h,"clip_box", mget(4,"dl",fd)) // clip_box
-            end
-            set(h,"clip_state",clip_state);
-        end
-
-        load_user_data(fd) ; // user_data
-
-    case "Compound"
-        // children
-        n=mget(1,"il",fd)
-        H=[]
-        for k=1:n
-            htmp = load_graphichandle(fd)
-            H=[htmp H]
-        end
-        h=glue(H)
-        if is_higher_than([3 1 0 1]) then // visible
-            h.visible = toggle(mget(1,characterFormat,fd)) ;
-        end
-
-        load_user_data(fd) // user_data
-
-
-    case "Agregation" // for compatibility with old save
-
-        // children
-        n=mget(1,"il",fd)
-        H=[]
-        for k=1:n
-            htmp = load_graphichandle(fd)
-            H=[htmp H]
-        end
-        h=glue(H)
-
-        if is_higher_than([3 1 0 1]) then // visible
-            h.visible = toggle(mget(1,characterFormat,fd)) ;
-        end
-
-        load_user_data(fd) // user_data
-
-    case "Rectangle"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        thickness      = mget(1,"sl",fd); // thickness
-        mark_mode      = toggle(mget(1,characterFormat,fd)) // mark_mode
-        mark_style     = mget(1,characterFormat,fd); // mark_style
-        mark_size      = mget(1,characterFormat,fd); // mark_size
-        if is_higher_than([3 0 0 0]) then
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated" ;
-            else
-                msu="point";
-            end
-            mark_foreground=mget(1,"il",fd) // mark_foreground
-            mark_background=mget(1,"il",fd) // mark_background
-        else
-            msu="tabulated"
-        end
-
-        line_mode      = toggle(mget(1,characterFormat,fd)) ; // line_mode
-        line_style     = mget(1,characterFormat,fd); // line_style
-        if line_style==0 then // 0 and 1 are equivalents and 0 is obsolete since Scilab 5.4.0
-            line_style=1;
-        end
-        fill_mode      = toggle(mget(1,characterFormat,fd)) ; // fill_mode
-        foreground     = mget(1,"il",fd); // foreground
-
-        if is_higher_than([3 1 0 1]) then
-            background = mget(1,"il",fd); // background
-        end
-        if (is_higher_than([5 0 3 0])) then
-            // data size might be 4 or 5
-            data = mget(mget(1,"il",fd),"dl",fd); // data
-        else
-            parentAxes = gca();
-            if (parentAxes.view == "2d") then
-                data = mget(4,"dl",fd);
-            else
-                data = mget(5,"dl",fd);
-            end
-        end
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // clip_stata
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) // clip_box
-        else
-            clip_box=[]
-        end
-
-        // draw the rectangle
-        xrect(0,1,1,1); // create the rectangle with dummy values
-        h=get("hdl")
-        set(h,"data",data);
-        set(h,"visible",visible)
-        set(h,"thickness",thickness)
-        set(h,"mark_style",mark_style),
-        set(h,"mark_size",mark_size),
-        set(h,"mark_size_unit",msu),
-        if is_higher_than([3 0 0 0]) then
-            set(h,"mark_foreground",mark_foreground) ;
-            set(h,"mark_background",mark_background) ;
-        end
-        set(h,"mark_mode",mark_mode)
-        set(h,"line_style",line_style)
-        set(h,"fill_mode",fill_mode)
-        set(h,"foreground",foreground) ;
-        if is_higher_than([3 1 0 1]) then
-            set(h,"background",background) ;
-        end
-        set(h,"line_mode",line_mode)
-        if clip_state=="on" then set(h,"clip_box",clip_box),end
-        set(h,"clip_state",clip_state);
-
-        load_user_data(fd) ; // user_data
-
-    case "Arc"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        thickness      = mget(1,"sl",fd); // thickness
-        line_style     = mget(1,characterFormat,fd);  // line_style
-        if line_style==0 then // 0 and 1 are equivalents and 0 is obsolete since Scilab 5.4.0
-            line_style=1;
-        end
-
-        if is_higher_than([3 1 0 1])
-            line_mode = toggle(mget(1,characterFormat,fd)) ; // line_mode
-        end
-
-        fill_mode      = toggle(mget(1,characterFormat,fd)) // fill_mode
-        foreground     = mget(1,"il",fd); // foreground
-
-        if is_higher_than([3 1 0 1]) then
-            background = mget(1,"il",fd) ; // background
-        end
-
-        if (is_higher_than([5 0 3 0])) then
-            // data size might be 6 or 7
-            data = mget(mget(1,"il",fd),"dl",fd); // data
-        else
-            parentAxes = gca();
-            if (parentAxes.view == "2d") then
-                data = mget(6,"dl",fd);
-            else
-                data = mget(7,"dl",fd);
-            end
-        end
-
-        if is_higher_than([4 1 2 0]) then
-            drawing_method = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // drawing_method
-        else
-            drawing_method = "nurbs";
-        end
-
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) // clip_box
-        else
-            clip_box=[]
-        end
-        xarc(0,1,1,1,0,360); // create the arc dummy values
-        h=get("hdl")
-        if ~is_higher_than([4 1 2 0]) then
-            // angle wass stored by 64th of degree
-            data($) = data($) / 64;
-            data($-1) = data($-1) / 64;
-        end
-        set(h,"data",data);
-        set(h,"visible",visible)
-        set(h,"thickness",thickness)
-        set(h,"line_style",line_style)
-        set(h,"line_mode",line_mode);
-        set(h,"fill_mode",fill_mode)
-        set(h,"foreground",foreground) ;
-        set(h,"background",background) ;
-        set(h,"arc_drawing_method", drawing_method) ;
-        if clip_state=="on" then set(h,"clip_box",clip_box),end
-        set(h,"clip_state",clip_state);
-
-        load_user_data(fd) // user_data
-
-    case "Champ"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        sz=mget(2,"il",fd); // data.x
-        x=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.y
-        y=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.fx
-        fx=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.fy
-        fy=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-
-        // draw the champ
-        champ(x,y,fx,fy);
-        h=gce();
-
-        set(h,"visible",visible);
-        line_style = mget(1,characterFormat,fd);
-        if line_style==0 then // 0 and 1 are equivalents and 0 is obsolete since Scilab 5.4.0
-            line_style=1;
-        end
-        set(h,"line_style",line_style); // line_style
-        set(h,"thickness",mget(1,"sl",fd)) // thickness
-        set(h,"colored",toggle(mget(1,characterFormat,fd))) // colored
-        set(h,"arrow_size",mget(1,"dl",fd)) // arrow_size
-
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            set(h,"clip_box", mget(4,"dl",fd)) // clip_box
-        end
-        set(h,"clip_state",clip_state);
-        load_user_data(fd) // user_data
-
-    case "Segs"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        sz             = mget(2,"il",fd) // data
-        data           = matrix(mget(prod(sz),"dl",fd),sz(1),-1)
-
-        // draw the segs
-        xsegs(data(:,1),data(:,2))
-        h=gce()
-        if size(data,2)==3 then
-            h.data=data
-        end
-        set(h,"visible",visible);
-        set(h,"line_mode" ,toggle(mget(1,characterFormat,fd))) // line_mode
-        line_style = mget(1,characterFormat,fd);
-        if line_style==0 then // 0 and 1 are equivalents and 0 is obsolete since Scilab 5.4.0
-            line_style=1;
-        end
-        set(h,"line_style",line_style); // line_style
-        set(h,"thickness",mget(1,"sl",fd)) // thickness
-        set(h,"arrow_size",mget(1,"dl",fd)) // arrow_size
-
-        n=mget(1,"il",fd) // segs_color
-        set(h,"segs_color",mget(n,"il",fd))
-        // it is needed to set it at the end, ut I don't know why
-        mark_mode = toggle(mget(1,characterFormat,fd)) ; // mark_mode
-        set(h,"mark_style"           , mget(1,characterFormat,fd)) // mark_style
-        set(h,"mark_size"            , mget(1,characterFormat,fd)) // mark_size
-        if is_higher_than([3 0 0 0]) then
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated"
-            else
-                msu="point";
-            end
-            set(h,"mark_size_unit"     , msu) ;
-            set(h,"mark_foreground"    , mget(1,"il",fd)) ; // mark_foreground
-            set(h,"mark_background"    , mget(1,"il",fd)) ; // mark_background
-        else
-            set(h,"mark_size_unit"     , "tabulated") ; // mark_size_unit
-        end
-
-        set(h,"mark_mode", mark_mode ) ;
-
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            set(h,"clip_box", mget(4,"dl",fd)) // clip_box
-        end
-        set(h,"clip_state",clip_state);
-        load_user_data(fd) // user_data
-
-    case "Grayplot"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        if is_higher_than([3 0 0 0]) then
-            sz=mget(2,"il",fd); // data.x
-            x=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-            sz=mget(2,"il",fd); // data.y
-            y=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-            sz=mget(2,"il",fd); // data.z
-            z=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        else
-            sz = mget(2,"il",fd) // data
-            data = matrix(mget(prod(sz),"dl",fd),sz(1),-1)
-        end
-
-        data_mapping   = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // data_mapping
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) // clip_box
-        else
-            clip_box=[]
-        end
-
-        // draw the grayplot
-        if is_higher_than([3 0 0 0]) then
-            grayplot(x,y,z)
-        else
-            grayplot(data(2:$,1),data(1,2:$),data(2:$,2:$))
-        end
-
-        h=get("hdl")
-        set(h,"visible",visible)
-        set(h,"data_mapping",data_mapping)
-        if clip_state=="on" then
-            set(h,"clip_box",  clip_box)
-        end
-        set(h,"clip_state",clip_state);
-
-        load_user_data(fd) // user_data
-
-    case "Matplot"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        sz=mget(2,"il",fd); // data
-        data=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        //    data_mapping   = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) // clip_box
-        else
-            clip_box=[]
-        end
-
-        // draw the matplot
-        Matplot(data);
-
-        h=get("hdl")
-        set(h,"visible",visible)
-        //    set(h,"data_mapping",data_mapping)
-        if clip_state=="on" then
-            set(h,"clip_box",  clip_box)
-        end
-        set(h,"clip_state",clip_state);
-        // user_data
-        load_user_data(fd)
-
-    case "Fec"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        sz             = mget(2,"il",fd) // data
-        data           = matrix(mget(prod(sz),"dl",fd),sz(1),-1)
-        sz             = mget(2,"il",fd) // triangles
-        triangles      = matrix(mget(prod(sz),"dl",fd),sz(1),-1)
-        z_bounds       = mget(2,"dl",fd) // z_bounds
-        // draw the fec
-        fec(data(:,1),data(:,2),triangles,data(:,3))
-        h=unglue(get("hdl"))
-        set(h,"visible",visible)
-        set(h,"z_bounds",z_bounds)
-        if is_higher_than( [5 0 3 0] ) then
-            set(h,"color_range",mget(2,"dl",fd)); // color_range
-            set(h,"outside_colors",mget(2,"dl",fd)); // color_range
-            set(h,"line_mode" ,toggle(mget(1,characterFormat,fd))) // line_mode
-            set(h,"foreground", mget(1,"il",fd)); // foreground
-        end
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            set(h,"clip_box", mget(4,"dl",fd)) // clip_box
-        end
-        set(h,"clip_state",clip_state);
-        load_user_data(fd) // user_data
-
-    case "Legend"
-        if is_higher_than( [5 0 0 0] ) then
-            global %LEG
-            %LEG=[];
-            %LEG.visible         = toggle(mget(1,characterFormat,fd)) // visible
-            %LEG.text            = load_text_vector(fd); // text
-            %LEG.font_style      = mget(1,characterFormat,fd); // font_style
-            %LEG.font_size       = mget(1,characterFormat,fd); // font_size
-            %LEG.font_color      = mget(1,"il",fd); // font_size
-            %LEG.fractional_font = toggle(mget(1,characterFormat,fd)); // fractional_font
-            nlegends             = mget(1,characterFormat,fd);
-            paths = list()
-            for kl=1:nlegends
-                paths($+1)         = mget(mget(1,"il",fd),"il",fd);
-            end
-            %LEG.paths           = paths
-            %LEG.legend_location = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))
-            %LEG.position        = mget(2,"dl",fd)
-            %LEG.line_mode       = toggle(mget(1,characterFormat,fd))
-            %LEG.thickness       = mget(1,"sl",fd)
-            %LEG.foreground      = mget(1,"il",fd)
-            %LEG.fill_mode       = toggle(mget(1,characterFormat,fd))
-            %LEG.background      = mget(1,"il",fd)
-
-            %LEG.clip_state      = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-            if %LEG.clip_state=="on" then
-                %LEG.clip_box      = mget(4,"dl",fd); // clip_box
-            end
-            %_load(fd,"user_data")
-            %LEG.user_data       = user_data;
-        else
-            visible         = toggle(mget(1,characterFormat,fd)) // visible
-            line_mode       = toggle(mget(1,characterFormat,fd)) // line_mode
-            mark_mode       = toggle(mget(1,characterFormat,fd)) // mark_mode
-            mark_foreground = mget(1,"il",fd) ; // mark_foreground
-            mark_background = mget(1,"il",fd) ; // mark_background
-
-            //text=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // text
-
-            text = load_text_vector(fd); // text
-
-            //create the legend
-            //get the number of lines of the legend
-            lineFeedPosition = strindex(text,"@")
-            nbLines = size( lineFeedPosition ) ;
-            nbLines = nbLines(2) + 1
-            //create as many curves as lines in the text
-            nullVector = zeros(1,nbLines);
-            //draw the legend
-            plot2d(0,nullVector,leg=text) ;
-            H=unglue(get("hdl"));
-            h=H(1);
-            delete(H(2));
-
-            set(h,"visible",visible)
-            set(h,"line_mode",line_mode);
-            set(h,"mark_mode",mark_mode);
-            set(h,"mark_foreground",mark_foreground) ;
-            set(h,"mark_background",mark_background) ;
-            set(h,"foreground", mget(1,"il",fd)); // foreground
-
-            set(h,"font_style", mget(1,characterFormat,fd)); // font_style
-            set(h,"font_size" , mget(1,characterFormat,fd)); // font_size
-            if is_higher_than( [4 1 2 0] ) then
-                set(h,"fractional_font" , toggle(mget(1,characterFormat,fd))); // fractional_font
-            end
-            clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-            if clip_state=="on" then
-                set(h,"clip_box",mget(4,"dl",fd)); // clip_box
-            end
-            set(h,"clip_state",clip_state);
-        end
-
-    case "Text"
-        visible         = toggle(mget(1,characterFormat,fd)) // visible
-
-        if is_higher_than( [4 1 2 0] ) then
-            text            = load_text_matrix( fd ) ;
-        else
-            text            = load_text_vector(fd) // text
-        end
-        sz              = mget(2,characterFormat,fd)
-        data            = matrix(mget(prod(sz),"dl",fd),sz(1),-1) // data
-        text_box        = mget(2,"dl",fd) // text_box
-        text_box_mode   = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // text_box_mode
-
-        // draw the text
-        if text_box_mode == "off" then
-            xstring(data(1),data(2),text)
-        else
-            xstringb(data(1),data(2),text,text_box(1),text_box(2))
-        end
-
-        h=get("hdl");
-        set(h,"data",data);
-        set(h,"visible",visible) ;
-        set(h,"text_box_mode",text_box_mode)
-        set(h,"foreground"           , mget(1,"il",fd)); // foreground
-        set(h,"font_style"           , mget(1,characterFormat,fd)); // font_style
-
-        if text_box_mode == "filled" then // font_size
-            mget(1,characterFormat,fd) ;
-        else
-            set(h,"font_size", mget(1,characterFormat,fd));
-        end
-
-        set(h,"font_angle"           , mget(1,"dl",fd)); // font_angle
-
-        //adding JB Silvy 28/11/05
-        // box drawing
-        if is_higher_than([3 1 0 1]) then
-            set( h, "box"      , toggle( mget( 1, characterFormat, fd ) ) ) ; // box
-            set( h, "line_mode", toggle( mget( 1, characterFormat, fd ) ) ) ; // line_mode
-            set( h, "fill_mode", toggle( mget( 1, characterFormat, fd ) ) ) ; // fill_mode
-
-            set( h, "font_foreground", mget( 1, "il", fd ) ) ; // font_foreground
-            set( h, "background"     , mget( 1, "il", fd ) ) ; // background
-        end
-
-        if is_higher_than( [4 1 2 0] ) then
-            set( h, "alignment", ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)  ) ) ; // alignment
-            set( h, "fractional_font", toggle( mget( 1, characterFormat, fd ) ) ) ; // fractional_font
-        end
-
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) // clip_box
-            set(h,"clip_box",clip_box) ; // clip_box
-        else
-            clip_box=[]
-        end
-        set(h,"clip_state",clip_state);
-        load_user_data(fd) // user_data
-    case "Axis"
-        if is_higher_than([3 1 0 0]) then
-
-            visible          = toggle(mget(1,characterFormat,fd)) // visible
-            n                = mget(1,"il",fd) // tics_direction
-            tics_direction   = ascii(mget(n,characterFormat,fd));
-            nx               = mget(1,"il",fd) // xtics_coord
-            xtics_coord      = mget(nx,"dl",fd)'
-            ny               = mget(1,"il",fd) // ytics_coord
-            ytics_coord      = mget(ny,"dl",fd)'
-
-            if tics_direction == "bottom" then axisdir="d";
-            elseif tics_direction == "top" then axisdir="u";
-            elseif tics_direction == "left" then axisdir="l";
-            elseif tics_direction == "right" then axisdir="r";
-            elseif nx>1 then axisdir="u";
-            else axisdir="l";
-            end
-
-            drawaxis(x=xtics_coord,y=ytics_coord,dir=axisdir);
-            h=gce()
-
-            h.tics_color       = mget(1,"il",fd) // tics_color
-            h.tics_segment     = toggle(mget(1,characterFormat,fd)) // tics_segment
-            h.tics_style       = ascii(mget(1,characterFormat,fd)) // tics_style
-            h.sub_tics         = mget(1,"il",fd) // sub_tics
-            h.tics_labels     = load_text_vector(fd)' // tics_label
-            labelfontsize = mget(1,"il",fd);
-            // Bug fix: there was a bug in Scilab <=4.1.2 which used -1 as default value for labels_font_size
-            // Scilab 5 needs font size to be >= 0 so we change the value to avoid an error message due to a Scilab bug...
-            if labelfontsize == -1 then
-                //labelfontsize = 0;
-            end
-            h.labels_font_size = labelfontsize // label_font_size
-            h.labels_font_color= mget(1,"il",fd); // labels_font_color
-            if is_higher_than([5 4 0 1]) then
-                h.labels_font_style = mget(1,"il",fd);
-            end
-            if is_higher_than( [4 1 2 0] ) then
-                set( h, "fractional_font", toggle( mget( 1, characterFormat, fd ) ) ) ; // fractional_font
-            end
-            // h.tics_style=tics_style // jb Silvy apparently strange
-
-            clip_state       = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-            if clip_state == "on" then
-                set(h,"clip_box",clip_box)
-            end
-            set(h,"clip_state",clip_state);
-            load_user_data(fd) // user_data
-        end
-
-    case "uimenu"
-        if is_higher_than( [4 1 2 0] ) then
-            h = uimenu("parent", gcf());
-            h.enable = toggle(mget(1,"c",fd)); // Enable
-            ncolors = mget(1,"il",fd); // Foregroundcolor (size)
-            h.foregroundcolor = mget(ncolors,"dl",fd); // ForegroundColor (data)
-            h.label = ascii(mget(mget(1,"c",fd),"c",fd)); // Label
-            h.visible = toggle(mget(1,"c",fd)); // Visible
-            if is_higher_than( [5 4 0 0] ) then
-                h.callback = ascii(mget(mget(1, stringFormat,fd),"c",fd)); // Callback
-            else
-                h.callback = ascii(mget(mget(1,"c",fd),"c",fd)); // Callback
-            end
-            h.callback_type = mget(1,"il",fd); // Callback Type
-            h.tag = ascii(mget(mget(1,"c",fd),"c",fd)); // Tag
-        end
-        if is_higher_than( [5 1 2 0] ) then // 5.2 and higher
-            h.checked = toggle(mget(1,"c",fd)); // Checked
-        end
-        if is_higher_than( [5 1 1 0] ) then // 5.1.2 and higher
-            // children
-            nbChildren = mget(1,"il",fd) ;
-            for k = 1 : nbChildren
-                htmp = load_graphichandle(fd) ;
-                set(htmp, "Parent", h);
-            end
-        end
-
-    case "uicontextmenu"
-        h = uicontextmenu();
-        // children
-        nbChildren = mget(1,"il",fd) ;
-        for k = 1 : nbChildren
-            htmp = load_graphichandle(fd) ;
-            set(htmp, "Parent", h);
-        end
-
-    case "uicontrol"
-        if is_higher_than( [4 1 2 0] ) then
-            uistyle = ascii(mget(mget(1,"c",fd),"c",fd)); // Style
-            h = uicontrol("parent",gcf(), "style", uistyle);
-            ncolors = mget(1,"il",fd); // BackgroundColor (size)
-            h.backgroundcolor = mget(ncolors,"dl",fd); // BackgroundColor (data)
-            h.enable = toggle(mget(1,"c",fd)); // Enable
-            h.fontangle = ascii(mget(mget(1,"c",fd),"c",fd)); // FontAngle
-            h.fontname = ascii(mget(mget(1,"c",fd),"c",fd)); // FontName
-            fontsize_in_units = mget(1,"dl",fd); // FontSize
-            h.fontunits = ascii(mget(mget(1,"c",fd),"c",fd)); // FontUnits
-            h.fontsize = fontsize_in_units; // FontSize written after 'FontUnits' to avoid them to be computed again
-            h.fontweight = ascii(mget(mget(1,"c",fd),"c",fd)); // FontWeight
-            ncolors = mget(1,"il",fd); // Foregroundcolor (size)
-            h.foregroundcolor = mget(ncolors,"dl",fd); // ForegroundColor (data)
-            h.horizontalalignment = ascii(mget(mget(1,"c",fd),"c",fd)); // HorizontalAlignment
-            ndata = mget(1,"il",fd); // ListboxTop (size)
-            h.listboxtop = mget(ndata,"dl",fd); // ListboxTop (data)
-            h.max = mget(1,"dl",fd); // Max
-            h.min = mget(1,"dl",fd); // Min
-            ndata = mget(1,"il",fd); // Position (size)
-            position_in_units = mget(ndata,"dl",fd); // Position (data)
-            h.relief = ascii(mget(mget(1,"c",fd),"c",fd)); // Relief
-            ndata = mget(1,"il",fd); // SliderStep (size)
-            h.sliderstep = mget(ndata,"dl",fd); // SliderStep (data)
-            h.string = load_text_matrix(fd) ; // String
-            if ( is_higher_than([5 2 0 0]) ) then // Added in 5.4.0 version
-                h.tooltipstring = load_text_matrix(fd) ; // TooltipString
-            end
-            h.units = ascii(mget(mget(1,"c",fd),"c",fd)); // Units
-            h.position = position_in_units; // Position written after 'Units' to avoid them to be computed again
-            ndata = mget(1,"il",fd); // Value (size)
-            h.value = mget(ndata,"dl",fd); // Value (data)
-            h.verticalalignment = ascii(mget(mget(1,"c",fd),"c",fd)); // VerticalAlignment
-            h.visible = toggle(mget(1,"c",fd)); // Visible
-            if is_higher_than( [5 4 0 0] ) then
-                h.callback = ascii(mget(mget(1, stringFormat,fd),"c",fd)); // Callback
-            else
-                h.callback = ascii(mget(mget(1,"c",fd),"c",fd)); // Callback
-            end
-            h.callback_type = mget(1,"il",fd); // Callback Type
-            load_user_data(fd); // Userdata
-            h.tag = ascii(mget(mget(1,"c",fd),"c",fd)); // Tag
-        end
-
-    else
-        warning("type " +typ+" unhandled");
-    end
-
-endfunction
-
-function r=toggle(k)
-    r=emptystr(k)+"on"
-    r(k==0)="off"
-endfunction
-
-function load_user_data(fd)
-    if is_higher_than([3 1 0 0]) then
-        h; //make a copy of the calling context h here
-        %_load(fd,"user_data")
-        if ~isempty(user_data) then
-            set(h, "user_data", user_data);
-        end
-    end
-endfunction
-
-function r=is_higher_than(v)
-    //check if current version is strictly higher than the given one
-    r=%f
-    for k=1:4
-        if version(k)>v(k) then r=%t,break,end
-        if version(k)<v(k) then r=%f,break,end
-    end
-endfunction
-
-function text=load_text_vector(fd)
-    T=mget(mget(1,"il",fd),characterFormat,fd)
-    newline=[find(T==10) size(T,"*")+1];
-    text=[]
-    p=1
-    for k=1:size(newline,"*")
-        text=[text;ascii(T(p:newline(k)-1))];
-        p=newline(k)+1
-    end
-endfunction
-
-// retrieve a string matrix saved by save_text_matrix
-function strMat = load_text_matrix( fd )
-    nbRow = mget( 1, "il", fd ) ;
-    nbCol = mget( 1, "il", fd ) ;
-    for i = 1:nbRow
-        for j = 1:nbCol
-            if is_higher_than([5 4 0 0]) then
-                strMat(i,j) = ascii(mget(mget(1,stringFormat,fd),characterFormat,fd)) ;
-            else
-                strMat(i,j) = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ;
-            end
-        end
-    end
-endfunction
-
-function links=get_links_from_path(ax,paths)
-    //  ax is a  handle on an axes entity
-    //  paths a list or row vector which gives the set of paths relative to
-    //  the axes
-    links=[];ok=%t
-    for p=paths
-        e=ax;
-        p(1)=p(1)-1// the caption does not exists yet
-        for kp=1:size(p,"*"),
-            if or(e.type==["Axes","Compound"])&p(kp)<=size(e.children,"*") then
-                e=e.children(p(kp)),
-            else
-                ok=%f
-                break
-            end
-        end
-        if ~ok then break,end
-        links=[links,e]
-    end
-    if ~ok then links=[],end
-endfunction
index 1443a85..718c5f7 100644 (file)
@@ -240,9 +240,12 @@ types::Function::ReturnValue sci_get(types::typed_list &in, int _iRetCount, type
             Scierror(999, _("%s: The handle is not or no more valid.\n"), "get");
             return types::Function::Error;
         }
+        pOut = (types::InternalType*)callGetProperty(NULL, iObjUID, pstProperty);
+    }
+    else
+    {
+        pOut = (types::InternalType*)callGetProperty(NULL, 0, pstProperty);
     }
-
-    pOut = (types::InternalType*)callGetProperty(NULL, iObjUID, pstProperty);
 
     if (pOut == NULL)
     {
index 698abbf..2861bf6 100644 (file)
@@ -41,6 +41,11 @@ void HDF5cleanup(void)
     H5_term_library();
 }
 /*--------------------------------------------------------------------------*/
+void HDF5ErrorCleanup()
+{
+    H5Eclear(H5Eget_current_stack());
+}
+/*--------------------------------------------------------------------------*/
 int createHDF5File(char *name)
 {
     hid_t       file;
@@ -168,18 +173,22 @@ int isHDF5File(char* _pstFilename)
     /* and return in previous place */
     /* see BUG 6440 */
     currentpath = scigetcwd(&ierr);
-    {
 
-        //prevent error msg to change directory to ""
-        if (strcmp(pathdest, "") != 0)
-        {
-            scichdir(pathdest);
-        }
-        FREE(pathdest);
+    //prevent error msg to change directory to ""
+    if (strcmp(pathdest, "") != 0)
+    {
+        scichdir(pathdest);
+    }
+    FREE(pathdest);
 
-        iRet = H5Fis_hdf5(filename);
-        FREE(filename);
+    iRet = H5Fis_hdf5(filename);
+    if (iRet == 0)
+    {
+        HDF5ErrorCleanup();
     }
+
+    FREE(filename);
+
     scichdir(currentpath);
     FREE(currentpath);
 
diff --git a/scilab/modules/hdf5/src/cpp/dynhdf5.cpp b/scilab/modules/hdf5/src/cpp/dynhdf5.cpp
deleted file mode 100644 (file)
index e1faa02..0000000
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2009 - DIGITEO - Antoine ELIAS
-*
-* This file must be used under the terms of the CeCILL.
-* This source file is licensed as described in the file COPYING, which
-* you should have received as part of this distribution.  The terms
-* are also available at
-* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-*
-*/
-
-#include "dynhdf5.hxx"
-#include "MALLOC.h"
-
-DynLibHandle DynHDF5::m_hLib = NULL;
-hid_t DynHDF5::dynH5T_NATIVE_INT8_g;
-hid_t DynHDF5::dynH5T_NATIVE_UINT8_g;
-hid_t DynHDF5::dynH5T_NATIVE_INT16_g;
-hid_t DynHDF5::dynH5T_NATIVE_UINT16_g;
-hid_t DynHDF5::dynH5T_NATIVE_INT32_g;
-hid_t DynHDF5::dynH5T_NATIVE_UINT32_g;
-hid_t DynHDF5::dynH5T_NATIVE_INT64_g;
-hid_t DynHDF5::dynH5T_NATIVE_UINT64_g;
-hid_t DynHDF5::dynH5T_NATIVE_DOUBLE_g;
-hid_t DynHDF5::dynH5P_CLS_FILE_ACCESS_g;
-hid_t DynHDF5::dynH5T_NATIVE_INT_g;
-hid_t DynHDF5::dynH5T_C_S1_g;
-hid_t DynHDF5::dynH5T_STD_REF_OBJ_g;
-
-int DynHDF5::dynOpenLib()
-{
-    if (m_hLib == NULL)
-    {
-#ifdef _MSC_VER
-        m_hLib = LoadDynLibrary("hdf5dll.dll");
-#else
-        m_hLib = LoadDynLibrary("libhdf5.so");
-
-#endif
-        if (m_hLib == NULL)
-        {
-            return 1;
-        }
-
-        dynH5open();
-        dynH5T_NATIVE_INT8_g        = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_NATIVE_INT8_g");
-        dynH5T_NATIVE_UINT8_g       = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_NATIVE_UINT8_g");
-        dynH5T_NATIVE_INT16_g       = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_NATIVE_INT16_g");
-        dynH5T_NATIVE_UINT16_g      = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_NATIVE_UINT16_g");
-        dynH5T_NATIVE_INT32_g       = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_NATIVE_INT32_g");
-        dynH5T_NATIVE_UINT32_g      = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_NATIVE_UINT32_g");
-        dynH5T_NATIVE_INT64_g       = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_NATIVE_INT64_g");
-        dynH5T_NATIVE_UINT64_g      = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_NATIVE_UINT64_g");
-        dynH5T_NATIVE_DOUBLE_g      = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_NATIVE_DOUBLE_g");
-        dynH5P_CLS_FILE_ACCESS_g    = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5P_CLS_FILE_ACCESS_g");
-        dynH5T_NATIVE_INT_g         = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_NATIVE_INT_g");
-        dynH5T_C_S1_g               = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_C_S1_g");
-        dynH5T_STD_REF_OBJ_g        = *(hid_t*)GetDynLibFuncPtr(m_hLib, "H5T_STD_REF_OBJ_g");
-    }
-
-    return 0;
-}
-
-int DynHDF5::dynCLoseLib()
-{
-    if (m_hLib)
-    {
-        FreeDynLibrary(m_hLib);
-        m_hLib = NULL;
-    }
-    return 0;
-}
-
-herr_t DynHDF5::dynH5open(void)
-{
-    typedef herr_t (*HDF5Func)(void);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5open");
-    return pFunc();
-
-}
-
-hid_t DynHDF5::dynH5Pcreate(hid_t cls_id)
-{
-    typedef hid_t (*HDF5Func)(hid_t cls_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Pcreate");
-    return pFunc(cls_id);
-
-}
-
-hid_t DynHDF5::dynH5Fcreate(const char *filename, unsigned flags, hid_t create_plist, hid_t access_plist)
-{
-    typedef hid_t (*HDF5Func)(const char * filename, unsigned flags, hid_t create_plist, hid_t access_plist);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Fcreate");
-    return pFunc(filename, flags, create_plist, access_plist);
-}
-
-hid_t DynHDF5::dynH5Fopen(const char *filename, unsigned flags, hid_t access_plist)
-{
-    typedef hid_t (*HDF5Func)(const char * filename, unsigned flags, hid_t access_plist);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Fopen");
-    return pFunc(filename, flags, access_plist);
-}
-
-herr_t DynHDF5::dynH5Fclose(hid_t file_id)
-{
-    typedef herr_t (*HDF5Func)(hid_t file_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Fclose");
-    return pFunc(file_id);
-}
-
-herr_t DynHDF5::dynH5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
-{
-    typedef herr_t (*HDF5Func)(unsigned majnum, unsigned minnum, unsigned relnum);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5check_version");
-    return pFunc(majnum, minnum, relnum);
-}
-
-hid_t DynHDF5::dynH5Aopen_name(hid_t loc_id, const char *name)
-{
-    typedef hid_t (*HDF5Func)(hid_t loc_id, const char * name);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Aopen_name");
-    return pFunc(loc_id, name);
-}
-
-herr_t DynHDF5::dynH5Aread(hid_t attr_id, hid_t type_id, void *buf)
-{
-    typedef herr_t (*HDF5Func)(hid_t attr_id, hid_t type_id, void * buf);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Aread");
-    return pFunc(attr_id, type_id, buf);
-}
-
-herr_t DynHDF5::dynH5Aclose(hid_t attr_id)
-{
-    typedef herr_t (*HDF5Func)(hid_t attr_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Aclose");
-    return pFunc(attr_id);
-}
-
-herr_t DynHDF5::dynH5Aiterate(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
-{
-    typedef herr_t (*HDF5Func)(hid_t loc_id, unsigned * attr_num, H5A_operator1_t op, void * op_data);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Aiterate1");
-    return pFunc(loc_id, attr_num, op, op_data);
-}
-
-hid_t DynHDF5::dynH5Aget_type(hid_t attr_id)
-{
-    typedef hid_t (*HDF5Func)(hid_t attr_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Aget_type");
-    return pFunc(attr_id);
-}
-
-size_t DynHDF5::dynH5Tget_size(hid_t type_id)
-{
-    typedef size_t (*HDF5Func)(hid_t type_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Tget_size");
-    return pFunc(type_id);
-}
-
-hid_t DynHDF5::dynH5Aget_space(hid_t attr_id)
-{
-    typedef hid_t (*HDF5Func)(hid_t attr_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Aget_space");
-    return pFunc(attr_id);
-}
-
-int DynHDF5::dynH5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[], hsize_t maxdims[])
-{
-    typedef int (*HDF5Func)(hid_t space_id, hsize_t dims[], hsize_t maxdims[]);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Sget_simple_extent_dims");
-    return pFunc(space_id, dims, maxdims);
-}
-
-hid_t DynHDF5::dynH5Tcopy(hid_t type_id)
-{
-    typedef hid_t (*HDF5Func)(hid_t type_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Tcopy");
-    return pFunc(type_id);
-}
-
-herr_t DynHDF5::dynH5Tset_size(hid_t type_id, size_t size)
-{
-    typedef herr_t (*HDF5Func)(hid_t type_id, size_t size);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Tset_size");
-    return pFunc(type_id, size);
-}
-
-herr_t DynHDF5::dynH5Tclose(hid_t type_id)
-{
-    typedef herr_t (*HDF5Func)(hid_t type_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Tclose");
-    return pFunc(type_id);
-}
-
-herr_t DynHDF5::dynH5Sclose(hid_t space_id)
-{
-    typedef herr_t (*HDF5Func)(hid_t space_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Sclose");
-    return pFunc(space_id);
-}
-
-herr_t DynHDF5::dynH5Gget_num_objs(hid_t loc_id, hsize_t *num_objs)
-{
-    typedef herr_t (*HDF5Func)(hid_t loc_id, hsize_t * num_objs);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Gget_num_objs");
-    return pFunc(loc_id, num_objs);
-}
-
-H5G_obj_t DynHDF5::dynH5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
-{
-    typedef H5G_obj_t (*HDF5Func)(hid_t loc_id, hsize_t idx);
-    if (dynOpenLib())
-    {
-        return H5G_UNKNOWN;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Gget_objtype_by_idx");
-    return pFunc(loc_id, idx);
-}
-
-ssize_t DynHDF5::dynH5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char* name, size_t size)
-{
-    typedef ssize_t (*HDF5Func)(hid_t loc_id, hsize_t idx, char * name, size_t size);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Gget_objname_by_idx");
-    return pFunc(loc_id, idx, name, size);
-}
-
-hid_t DynHDF5::dynH5Dopen(hid_t file_id, const char *name)
-{
-    typedef hid_t (*HDF5Func)(hid_t file_id, const char * name);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Dopen1");
-    return pFunc(file_id, name);
-}
-
-herr_t DynHDF5::dynH5Dclose(hid_t dset_id)
-{
-    typedef herr_t (*HDF5Func)(hid_t dset_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Dclose");
-    return pFunc(dset_id);
-}
-
-hid_t DynHDF5::dynH5Rdereference(hid_t dataset, H5R_type_t ref_type, const void *ref)
-{
-    typedef hid_t (*HDF5Func)(hid_t dataset, H5R_type_t ref_type, const void * ref);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Rdereference");
-    return pFunc(dataset, ref_type, ref);
-}
-
-hid_t DynHDF5::dynH5Dget_type(hid_t dset_id)
-{
-    typedef hid_t (*HDF5Func)(hid_t dset_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Dget_type");
-    return pFunc(dset_id);
-}
-
-hid_t DynHDF5::dynH5Dget_space(hid_t dset_id)
-{
-    typedef hid_t (*HDF5Func)(hid_t dset_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Dget_space");
-    return pFunc(dset_id);
-}
-
-hid_t DynHDF5::dynH5Screate_simple(int rank, const hsize_t dims[], const hsize_t maxdims[])
-{
-    typedef hid_t (*HDF5Func)(int rank, const hsize_t dims[], const hsize_t maxdims[]);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Screate_simple");
-    return pFunc(rank, dims, maxdims);
-}
-
-herr_t DynHDF5::dynH5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], const hsize_t _stride[], const hsize_t count[], const hsize_t _block[])
-{
-    typedef herr_t (*HDF5Func)(hid_t space_id, H5S_seloper_t op, const hsize_t start[], const hsize_t _stride[], const hsize_t count[], const hsize_t _block[]);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Sselect_hyperslab");
-    return pFunc(space_id, op, start, _stride, count, _block);
-}
-
-herr_t DynHDF5::dynH5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf/*out*/)
-{
-    typedef herr_t (*HDF5Func)(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void * buf);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Dread");
-    return pFunc(dset_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf);
-}
-
-hid_t DynHDF5::dynH5Acreate/*H5Acreate1*/(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id)
-{
-    typedef hid_t (*HDF5Func)(hid_t loc_id, const char * name, hid_t type_id, hid_t space_id, hid_t acpl_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Acreate1");
-    return pFunc(loc_id, name, type_id, space_id, acpl_id);
-}
-
-herr_t  DynHDF5::dynH5Awrite(hid_t attr_id, hid_t type_id, const void *buf)
-{
-    typedef herr_t (*HDF5Func)(hid_t attr_id, hid_t type_id, const void * buf);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Awrite");
-    return pFunc(attr_id, type_id, buf);
-}
-
-hid_t DynHDF5::dynH5Dcreate/*H5Dcreate1*/(hid_t file_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id)
-{
-    typedef hid_t (*HDF5Func)(hid_t file_id, const char * name, hid_t type_id, hid_t space_id, hid_t dcpl_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Dcreate1");
-    return pFunc(file_id, name, type_id, space_id, dcpl_id);
-}
-
-herr_t DynHDF5::dynH5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf)
-{
-    typedef herr_t (*HDF5Func)(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void * buf);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Dwrite");
-    return pFunc(dset_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf);
-}
-
-herr_t DynHDF5::dynH5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id)
-{
-    typedef herr_t (*HDF5Func)(void * ref, hid_t loc_id, const char * name, H5R_type_t ref_type, hid_t space_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Rcreate");
-    return pFunc(ref, loc_id, name, ref_type, space_id);
-}
-
-hid_t DynHDF5::dynH5Gcreate/*H5Gcreate1*/(hid_t loc_id, const char *name, size_t size_hint)
-{
-    typedef hid_t (*HDF5Func)(hid_t loc_id, const char * name, size_t size_hint);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Gcreate1");
-    return pFunc(loc_id, name, size_hint);
-}
-
-herr_t DynHDF5::dynH5Gclose(hid_t group_id)
-{
-    typedef herr_t (*HDF5Func)(hid_t group_id);
-    if (dynOpenLib())
-    {
-        return 1;
-    }
-
-    HDF5Func pFunc = (HDF5Func)GetDynLibFuncPtr(m_hLib, "H5Gclose");
-    return pFunc(group_id);
-}
diff --git a/scilab/modules/hdf5/src/cpp/dynhdf5.hxx b/scilab/modules/hdf5/src/cpp/dynhdf5.hxx
deleted file mode 100644 (file)
index 43a51ba..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2009 - DIGITEO - Antoine ELIAS
-*
-* This file must be used under the terms of the CeCILL.
-* This source file is licensed as described in the file COPYING, which
-* you should have received as part of this distribution.  The terms
-* are also available at
-* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-*
-*/
-
-#ifndef __DYNHDF5_HXX__
-#define __DYNHDF5_HXX__
-
-extern "C"
-{
-#include <hdf5.h>
-#include "dynamiclibrary.h"
-}
-
-
-//static class to load HDF5 EntryPoint
-class DynHDF5
-{
-private :
-    static DynLibHandle m_hLib;
-public :
-    static hid_t dynH5T_NATIVE_INT8_g;
-    static hid_t dynH5T_NATIVE_UINT8_g;
-    static hid_t dynH5T_NATIVE_INT16_g;
-    static hid_t dynH5T_NATIVE_UINT16_g;
-    static hid_t dynH5T_NATIVE_INT32_g;
-    static hid_t dynH5T_NATIVE_UINT32_g;
-    static hid_t dynH5T_NATIVE_INT64_g;
-    static hid_t dynH5T_NATIVE_UINT64_g;
-    static hid_t dynH5T_NATIVE_DOUBLE_g;
-    static hid_t dynH5P_CLS_FILE_ACCESS_g;
-    static hid_t dynH5T_NATIVE_INT_g;
-    static hid_t dynH5T_C_S1_g;
-    static hid_t dynH5T_STD_REF_OBJ_g;
-
-    static int dynOpenLib();
-    static int dynCLoseLib();
-
-    static herr_t dynH5Check()
-    {
-        return dynH5check_version(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
-    }
-    static herr_t dynH5open(void);
-
-    //File management
-    static hid_t dynH5Pcreate(hid_t cls_id);
-    static hid_t dynH5Fcreate(const char *filename, unsigned flags, hid_t create_plist, hid_t access_plist);
-    static hid_t dynH5Fopen(const char *filename, unsigned flags, hid_t access_plist);
-    static herr_t dynH5Fclose(hid_t file_id);
-    static herr_t dynH5check_version(unsigned majnum, unsigned minnum, unsigned relnum);
-
-    //read operations
-    static hid_t dynH5Aopen_name(hid_t loc_id, const char *name);
-    static herr_t dynH5Aread(hid_t attr_id, hid_t type_id, void *buf);
-    static herr_t dynH5Aclose(hid_t attr_id);
-    static herr_t dynH5Aiterate(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data);
-    static hid_t dynH5Aget_type(hid_t attr_id);
-    static size_t dynH5Tget_size(hid_t type_id);
-    static hid_t dynH5Aget_space(hid_t attr_id);
-    static int dynH5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[], hsize_t maxdims[]);
-    static hid_t dynH5Tcopy(hid_t type_id);
-    static herr_t dynH5Tset_size(hid_t type_id, size_t size);
-    static herr_t dynH5Tclose(hid_t type_id);
-    static herr_t dynH5Sclose(hid_t space_id);
-    static herr_t dynH5Gget_num_objs(hid_t loc_id, hsize_t *num_objs);
-    static H5G_obj_t dynH5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx);
-    static ssize_t dynH5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char* name, size_t size);
-    static hid_t dynH5Dopen(hid_t file_id, const char *name);
-    static herr_t dynH5Giterate(hid_t loc_id, const char *name, int *idx, H5G_iterate_t op, void *op_data);
-    static herr_t dynH5Dclose(hid_t dset_id);
-    static hid_t dynH5Rdereference(hid_t dataset, H5R_type_t ref_type, const void *ref);
-    static hid_t dynH5Dget_type(hid_t dset_id);
-    static hid_t dynH5Dget_space(hid_t dset_id);
-    static hid_t dynH5Screate_simple(int rank, const hsize_t dims[], const hsize_t maxdims[]);
-    static herr_t dynH5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], const hsize_t _stride[], const hsize_t count[], const hsize_t _block[]);
-    static herr_t dynH5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf/*out*/);
-
-    //write functions
-    static hid_t dynH5Acreate/*H5Acreate1*/(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id);
-    static herr_t  dynH5Awrite(hid_t attr_id, hid_t type_id, const void *buf);
-    static hid_t dynH5Dcreate/*H5Dcreate1*/(hid_t file_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id);
-    static herr_t dynH5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf);
-    static herr_t dynH5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id);
-    static hid_t dynH5Gcreate/*H5Gcreate1*/(hid_t loc_id, const char *name, size_t size_hint);
-    static herr_t dynH5Gclose(hid_t group_id);
-
-};
-
-#undef H5F_ACC_TRUNC
-#define H5F_ACC_TRUNC (DynHDF5::dynH5Check(), 0x0002u)
-
-#undef H5F_ACC_RDONLY
-#define H5F_ACC_RDONLY (DynHDF5::dynH5Check(), 0x0000u)
-
-#undef H5P_FILE_ACCESS
-#define H5P_FILE_ACCESS (DynHDF5::dynH5open(), DynHDF5::dynH5P_CLS_FILE_ACCESS_g)
-
-#undef H5T_NATIVE_INT
-#define H5T_NATIVE_INT (DynHDF5::dynH5open(), DynHDF5::dynH5T_NATIVE_INT_g)
-
-#undef H5T_C_S1
-#define H5T_C_S1 (DynHDF5::dynH5open(), DynHDF5::dynH5T_C_S1_g)
-
-#undef H5T_NATIVE_DOUBLE
-#define H5T_NATIVE_DOUBLE (DynHDF5::dynH5open(), DynHDF5::dynH5T_NATIVE_DOUBLE_g)
-
-#undef H5T_STD_REF_OBJ
-#define H5T_STD_REF_OBJ (DynHDF5::dynH5open(), DynHDF5::dynH5T_STD_REF_OBJ_g)
-
-#undef H5T_NATIVE_INT8
-#define H5T_NATIVE_INT8 (DynHDF5::dynH5open(), DynHDF5::dynH5T_NATIVE_INT8_g)
-
-#undef H5T_NATIVE_UINT8
-#define H5T_NATIVE_UINT8 (DynHDF5::dynH5open(), DynHDF5::dynH5T_NATIVE_UINT8_g)
-
-#undef H5T_NATIVE_INT16
-#define H5T_NATIVE_INT16 (DynHDF5::dynH5open(), DynHDF5::dynH5T_NATIVE_INT16_g)
-
-#undef H5T_NATIVE_UINT16
-#define H5T_NATIVE_UINT16 (DynHDF5::dynH5open(), DynHDF5::dynH5T_NATIVE_UINT16_g)
-
-#undef H5T_NATIVE_INT32
-#define H5T_NATIVE_INT32 (DynHDF5::dynH5open(), DynHDF5::dynH5T_NATIVE_INT32_g)
-
-#undef H5T_NATIVE_UINT32
-#define H5T_NATIVE_UINT32 (DynHDF5::dynH5open(), DynHDF5::dynH5T_NATIVE_UINT32_g)
-
-#undef H5T_NATIVE_INT64
-#define H5T_NATIVE_INT64 (DynHDF5::dynH5open(), DynHDF5::dynH5T_NATIVE_INT64_g)
-
-#undef H5T_NATIVE_UINT64
-#define H5T_NATIVE_UINT64 (DynHDF5::dynH5open(), DynHDF5::dynH5T_NATIVE_UINT64_g)
-
-#endif /* ! __DYNHDF5_HXX__ */
diff --git a/scilab/modules/hdf5/src/cpp/h5_fileManagement.cpp b/scilab/modules/hdf5/src/cpp/h5_fileManagement.cpp
deleted file mode 100644 (file)
index 13c6160..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
-*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-*  Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET
-*  Copyright (C) 2010 - DIGITEO - Antoine ELIAS
-*  Copyright (C) 2010 - DIGITEO - Allan CORNET
-*
-*  This file must be used under the terms of the CeCILL.
-*  This source file is licensed as described in the file COPYING, which
-*  you should have received as part of this distribution.  The terms
-*  are also available at
-*  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-*
-*/
-/*--------------------------------------------------------------------------*/
-#include "dynhdf5.hxx"
-
-extern "C"
-{
-#include <string.h>
-#include "h5_fileManagement.h"
-#include "FileExist.h"
-#include "deleteafile.h"
-#include "isdir.h"
-#include "splitpath.h"
-#include "scicurdir.h"
-#include "MALLOC.h"
-#include "os_strdup.h"
-}
-/*--------------------------------------------------------------------------*/
-static char *getPathFilename(char *fullfilename);
-static char *getFilenameWithExtension(char *fullfilename);
-/*--------------------------------------------------------------------------*/
-int createHDF5File(char *name)
-{
-    hid_t       file;
-    hid_t fapl = DynHDF5::dynH5Pcreate(H5P_FILE_ACCESS);
-    char *pathdest = getPathFilename(name);
-    char *currentpath = NULL;
-    char *filename = getFilenameWithExtension(name);
-    int ierr = 0;
-
-    //H5Pset_fclose_degree(fapl, H5F_CLOSE_STRONG);
-
-    /* TO DO : remove when HDF5 will be fixed ... */
-    /* HDF5 does not manage no ANSI characters */
-    /* UGLY workaround :( */
-    /* We split path, move in this path, open file */
-    /* and return in previous place */
-    /* see BUG 6440 */
-    currentpath = scigetcwd(&ierr);
-
-    //prevent error msg to change directory to ""
-    if (strcmp(pathdest, "") != 0)
-    {
-        scichdir(pathdest);
-    }
-
-    FREE(pathdest);
-    /*bug 5629 : to prevent replace directory by file*/
-    if (isdir(filename))
-    {
-        FREE(filename);
-        FREE(currentpath);
-        return -2;
-    }
-
-    if (FileExist(filename))
-    {
-        deleteafile(filename);
-    }
-    /*
-    * Create a new file using the default properties.
-    */
-
-    file = DynHDF5::dynH5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
-
-    scichdir(currentpath);
-
-    if (currentpath)
-    {
-        FREE(currentpath);
-        currentpath = NULL;
-    }
-    if (filename)
-    {
-        FREE(filename);
-        filename = NULL;
-    }
-    if (pathdest)
-    {
-        FREE(pathdest);
-        pathdest = NULL;
-    }
-
-    return file;
-}
-/*--------------------------------------------------------------------------*/
-int openHDF5File(char *name)
-{
-    hid_t           file;
-    char *pathdest = getPathFilename(name);
-    char *currentpath = NULL;
-    char *filename = getFilenameWithExtension(name);
-    int ierr = 0;
-
-    /* TO DO : remove when HDF5 will be fixed ... */
-    /* HDF5 does not manage no ANSI characters */
-    /* UGLY workaround :( */
-    /* We split path, move in this path, open file */
-    /* and return in previous place */
-    /* see BUG 6440 */
-    currentpath = scigetcwd(&ierr);
-
-    //prevent error msg to change directory to ""
-    if (strcmp(pathdest, "") != 0)
-    {
-        scichdir(pathdest);
-    }
-
-    file = DynHDF5::dynH5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
-
-    scichdir(currentpath);
-
-    if (currentpath)
-    {
-        FREE(currentpath);
-        currentpath = NULL;
-    }
-    if (filename)
-    {
-        FREE(filename);
-        filename = NULL;
-    }
-    if (pathdest)
-    {
-        FREE(pathdest);
-        pathdest = NULL;
-    }
-
-    return file;
-}
-/*--------------------------------------------------------------------------*/
-int isHDF5File(char* _pstFilename)
-{
-    int iRet = 0;
-    char *pathdest = getPathFilename(_pstFilename);
-    char *currentpath = NULL;
-    char *filename = getFilenameWithExtension(_pstFilename);
-    int ierr = 0;
-
-    /* TO DO : remove when HDF5 will be fixed ... */
-    /* HDF5 does not manage no ANSI characters */
-    /* UGLY workaround :( */
-    /* We split path, move in this path, open file */
-    /* and return in previous place */
-    /* see BUG 6440 */
-    currentpath = scigetcwd(&ierr);
-    {
-
-        //prevent error msg to change directory to ""
-        if (strcmp(pathdest, "") != 0)
-        {
-            scichdir(pathdest);
-        }
-        FREE(pathdest);
-
-        iRet = H5Fis_hdf5(filename);
-        FREE(filename);
-    }
-    scichdir(currentpath);
-    FREE(currentpath);
-
-    return iRet > 0 ? 1 : 0;
-}
-
-void closeHDF5File(int file)
-{
-    herr_t status                                      = 0;
-
-    // H5Fflush(file, H5F_SCOPE_GLOBAL);
-    status =  DynHDF5::dynH5Fclose(file);
-    if (status < 0)
-    {
-        fprintf(stderr, "%s", "failed to close file");
-    }
-    DynHDF5::dynCLoseLib();
-}
-/*--------------------------------------------------------------------------*/
-static char *getPathFilename(char *fullfilename)
-{
-    char *path = NULL;
-    if (fullfilename)
-    {
-        char* drv  = os_strdup(fullfilename);
-        char* dir  = os_strdup(fullfilename);
-        char* name = os_strdup(fullfilename);
-        char* ext  = os_strdup(fullfilename);
-
-        path = os_strdup(fullfilename);
-
-        if (drv && dir && name && ext && path)
-        {
-            splitpath(fullfilename, FALSE, drv, dir, name, ext);
-
-            if (strcmp(drv, "") == 0)
-            {
-                strcpy(path, dir);
-            }
-            else
-            {
-                strcpy(path, drv);
-                strcat(path, dir);
-            }
-        }
-
-        if (drv)
-        {
-            FREE(drv);
-            drv = NULL;
-        }
-        if (dir)
-        {
-            FREE(dir);
-            dir = NULL;
-        }
-        if (name)
-        {
-            FREE(name);
-            name = NULL;
-        }
-        if (ext)
-        {
-            FREE(ext);
-            ext = NULL;
-        }
-    }
-    return path;
-}
-/*--------------------------------------------------------------------------*/
-static char *getFilenameWithExtension(char *fullfilename)
-{
-    char *filename = NULL;
-    if (fullfilename)
-    {
-        char* drv  = os_strdup(fullfilename);
-        char* dir  = os_strdup(fullfilename);
-        char* name = os_strdup(fullfilename);
-        char* ext  = os_strdup(fullfilename);
-
-        filename = os_strdup(fullfilename);
-
-        if (drv && dir && name && ext && filename)
-        {
-            splitpath(fullfilename, FALSE, drv, dir, name, ext);
-
-            if (strcmp(ext, "") == 0)
-            {
-                strcpy(filename, name);
-            }
-            else
-            {
-                strcpy(filename, name);
-                strcat(filename, ext);
-            }
-        }
-
-        if (drv)
-        {
-            FREE(drv);
-            drv = NULL;
-        }
-        if (dir)
-        {
-            FREE(dir);
-            dir = NULL;
-        }
-        if (name)
-        {
-            FREE(name);
-            name = NULL;
-        }
-        if (ext)
-        {
-            FREE(ext);
-            ext = NULL;
-        }
-    }
-    return filename;
-}
-/*--------------------------------------------------------------------------*/
-
diff --git a/scilab/modules/hdf5/src/cpp/h5_readDataFromFile.cpp b/scilab/modules/hdf5/src/cpp/h5_readDataFromFile.cpp
deleted file mode 100644 (file)
index 4f4d1d4..0000000
+++ /dev/null
@@ -1,1171 +0,0 @@
-/*
-*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-*  Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET
-*
-*  This file must be used under the terms of the CeCILL.
-*  This source file is licensed as described in the file COPYING, which
-*  you should have received as part of this distribution.  The terms
-*  are also available at
-*  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-*
-*/
-
-#define H5_USE_16_API
-
-extern "C"
-{
-#ifndef _MSC_VER
-#include <sys/time.h>
-#else
-#include <windows.h>
-    //#include <winbase.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include "MALLOC.h"
-#include "sci_types.h"
-#include "h5_attributeConstants.h"
-#include "h5_readDataFromFile.h"
-}
-
-#include "dynhdf5.hxx"
-
-//#define TIME_DEBUG
-
-static herr_t find_attr_by_name( hid_t loc_id, const char* name, void* data )
-{
-    return !strcmp(name, (const char*)data);
-}
-
-static int readIntAttribute(int _iDatasetId, const char *_pstName)
-{
-    hid_t iAttributeId;
-    herr_t status;
-    int iVal = 0;
-
-    iAttributeId = DynHDF5::dynH5Aopen_name(_iDatasetId, _pstName);
-    if (iAttributeId < 0)
-    {
-        return 0;
-    }
-
-    status = DynHDF5::dynH5Aread(iAttributeId, H5T_NATIVE_INT, &iVal);
-    if (status < 0)
-    {
-        return 0;
-    }
-
-    status = DynHDF5::dynH5Aclose(iAttributeId);
-    if (status < 0)
-    {
-        return 0;
-    }
-
-    return iVal;
-}
-
-/*
-** WARNING : this function returns an allocated value that must be freed.
-*/
-static char *readAttribute(int _iDatasetId, const char *_pstName)
-{
-    hid_t iAttributeId;
-    hid_t iFileType, memtype, iSpace;
-    herr_t status;
-    hsize_t dims[1];
-    size_t iDim;
-
-    char *pstValue  = NULL;
-
-    if (DynHDF5::dynH5Aiterate(_iDatasetId, NULL, find_attr_by_name, (void*)_pstName))
-    {
-        iAttributeId = DynHDF5::dynH5Aopen_name(_iDatasetId, _pstName);
-        if (iAttributeId < 0)
-        {
-            return NULL;
-        }
-        /*
-        * Get the datatype and its size.
-        */
-        iFileType = DynHDF5::dynH5Aget_type (iAttributeId);
-        iDim = DynHDF5::dynH5Tget_size (iFileType);
-        iDim++;                         /* Make room for null terminator */
-
-        /*
-        * Get dataspace and allocate memory for read buffer.  This is a
-        * two dimensional attribute so the dynamic allocation must be done
-        * in steps.
-        */
-        iSpace = DynHDF5::dynH5Aget_space (iAttributeId);
-        if (iSpace < 0)
-        {
-            return NULL;
-        }
-
-        status = DynHDF5::dynH5Sget_simple_extent_dims (iSpace, dims, NULL);
-        if (status < 0)
-        {
-            return NULL;
-        }
-
-        /*
-        * Allocate space for string data.
-        */
-        pstValue = (char *) MALLOC ( (size_t)((dims[0] * iDim + 1 ) * sizeof (char)));
-
-        /*
-        * Create the memory datatype.
-        */
-        memtype = DynHDF5::dynH5Tcopy (H5T_C_S1);
-        status = DynHDF5::dynH5Tset_size (memtype, iDim);
-        if (status < 0)
-        {
-            return NULL;
-        }
-
-        /*
-        * Read the data.
-        */
-        status = DynHDF5::dynH5Aread (iAttributeId, memtype, pstValue);
-        if (status < 0)
-        {
-            return NULL;
-        }
-
-        status = DynHDF5::dynH5Tclose(memtype);
-        if (status < 0)
-        {
-            return NULL;
-        }
-
-        status = DynHDF5::dynH5Sclose(iSpace);
-        if (status < 0)
-        {
-            return NULL;
-        }
-
-        status = DynHDF5::dynH5Tclose(iFileType);
-        if (status < 0)
-        {
-            return NULL;
-        }
-
-        status = DynHDF5::dynH5Aclose(iAttributeId);
-        if (status < 0)
-        {
-            return NULL;
-        }
-    }
-    return pstValue;
-
-}
-
-static int checkAttribute(int _iDatasetId, char* _pstAttribute, char* _pstValue)
-{
-    int iRet                = 0;
-    char *pstScilabClass    = NULL;
-
-    pstScilabClass = readAttribute(_iDatasetId, _pstAttribute);
-    if (pstScilabClass != NULL && strcmp(pstScilabClass, _pstValue) == 0)
-    {
-        iRet = 1;
-    }
-    if (pstScilabClass)
-    {
-        FREE(pstScilabClass);
-    }
-    return iRet;
-}
-
-/*
-** WARNING : this function returns an allocated value that must be freed.
-*/
-char* getScilabVersionAttribute(int _iFile)
-{
-    return readAttribute(_iFile, g_SCILAB_CLASS_SCI_VERSION);
-}
-
-int getSODFormatAttribute(int _iFile)
-{
-    return readIntAttribute(_iFile, g_SCILAB_CLASS_SOD_VERSION);
-}
-
-int getDatasetDimension(int _iDatasetId, int* _piRows, int * _piCols)
-{
-    int iRet                = 0;
-    int iDummy              = 0;
-
-
-    *_piRows = readIntAttribute(_iDatasetId, g_SCILAB_CLASS_ROWS);
-    *_piCols = readIntAttribute(_iDatasetId, g_SCILAB_CLASS_COLS);
-
-    return iRet;
-}
-
-int getSparseDimension(int _iDatasetId, int* _piRows, int * _piCols, int* _piNbItem)
-{
-    int iRet                = 0;
-    int iDummy              = 0;
-
-
-    //get number of item in the sparse matrix
-    getDatasetDims(_iDatasetId, _piRows, _piCols);
-    *_piNbItem = readIntAttribute(_iDatasetId, g_SCILAB_CLASS_ITEMS);
-
-    return iRet;
-}
-
-static int isEmptyDataset(int _iDatasetId)
-{
-    return checkAttribute(_iDatasetId, (char*)g_SCILAB_CLASS_EMPTY, "true");
-}
-
-int isComplexData(int _iDatasetId)
-{
-    return checkAttribute(_iDatasetId, (char*)g_SCILAB_CLASS_COMPLEX, "true");
-}
-
-int getDatasetPrecision(int _iDatasetId, int* _piPrec)
-{
-    int iRet                = 0;
-    char* pstScilabClass    = readAttribute(_iDatasetId, g_SCILAB_CLASS_PREC);
-
-    if (pstScilabClass == NULL)
-    {
-        return -1;
-    }
-    else if (strcmp(pstScilabClass, "8") == 0)
-    {
-        *_piPrec    = SCI_INT8;
-    }
-    else if (strcmp(pstScilabClass, "u8") == 0)
-    {
-        *_piPrec    = SCI_UINT8;
-    }
-    else if (strcmp(pstScilabClass, "16") == 0)
-    {
-        *_piPrec = SCI_INT16;
-    }
-    else if (strcmp(pstScilabClass, "u16") == 0)
-    {
-        *_piPrec = SCI_UINT16;
-    }
-    else if (strcmp(pstScilabClass, "32") == 0)
-    {
-        *_piPrec = SCI_INT32;
-    }
-    else if (strcmp(pstScilabClass, "u32") == 0)
-    {
-        *_piPrec = SCI_UINT32;
-    }
-    else if (strcmp(pstScilabClass, "64") == 0)
-    {
-        *_piPrec = SCI_INT64;
-    }
-    else if (strcmp(pstScilabClass, "u64") == 0)
-    {
-        *_piPrec = SCI_UINT64;
-    }
-    else
-    {
-        iRet = 1;
-    }
-
-    FREE(pstScilabClass);
-    return iRet;
-}
-
-int getVariableNames(int _iFile, char **pstNameList)
-{
-    hsize_t i           = 0;
-    hsize_t iCount      = 0;
-    herr_t status       = 0;
-    int iNbItem         = 0;
-
-    status = DynHDF5::dynH5Gget_num_objs(_iFile, &iCount);
-    if (status != 0)
-    {
-        return 0;
-    }
-
-    for (i = 0 ; i < iCount ; i++)
-    {
-        if (DynHDF5::dynH5Gget_objtype_by_idx(_iFile, i) == H5G_DATASET)
-        {
-            if (pstNameList != NULL)
-            {
-                int iLen = 0;
-                iLen = (int)DynHDF5::dynH5Gget_objname_by_idx(_iFile, i, NULL, iLen);
-                pstNameList[iNbItem] = (char*)MALLOC(sizeof(char) * (iLen + 1)); //null terminated
-                DynHDF5::dynH5Gget_objname_by_idx(_iFile, i, pstNameList[iNbItem], iLen + 1);
-            }
-            iNbItem++;
-        }
-    }
-    return iNbItem;
-}
-
-int getDataSetIdFromName(int _iFile, char *_pstName)
-{
-    return DynHDF5::dynH5Dopen(_iFile, _pstName);
-}
-
-int getListDims(int _iDatasetId, int *_piItems)
-{
-    /*
-    * Get dataspace and dimensions of the dataset. This is a
-    * two dimensional dataset.
-    */
-    if (isEmptyDataset(_iDatasetId))
-    {
-        *_piItems = 0;
-    }
-    else
-    {
-        *_piItems = readIntAttribute(_iDatasetId, g_SCILAB_CLASS_ITEMS);
-    }
-    return 0;
-}
-
-int getDatasetDims(int _iDatasetId, int *_piRows, int *_piCols)
-{
-    /*
-    * Get dataspace and dimensions of the dataset. This is a
-    * two dimensional dataset.
-    */
-    if (isEmptyDataset(_iDatasetId))
-    {
-        *_piCols = 0;
-        *_piRows = 0;
-    }
-    else
-    {
-        *_piRows = readIntAttribute(_iDatasetId, g_SCILAB_CLASS_ROWS);
-        *_piCols = readIntAttribute(_iDatasetId, g_SCILAB_CLASS_COLS);
-    }
-    return 0;
-}
-
-int readDouble(int _iDatasetId, int _iRows, int _iCols, double *_pdblData)
-{
-    herr_t status;
-
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread(_iDatasetId, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pdblData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readDoubleMatrix(int _iDatasetId, int _iRows, int _iCols, double *_pdblData)
-{
-    herr_t status;
-
-    if (_iRows != 0 && _iCols != 0)
-    {
-        hid_t obj;
-        hobj_ref_t *pRef = (hobj_ref_t *) MALLOC (1 * sizeof (hobj_ref_t));
-
-        //Read the data.
-        status = DynHDF5::dynH5Dread (_iDatasetId, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, pRef);
-
-        //Open the referenced object, get its name and type.
-        obj = DynHDF5::dynH5Rdereference (_iDatasetId, H5R_OBJECT, &pRef[0]);
-        readDouble(obj, _iRows, _iCols, _pdblData);
-        FREE(pRef);
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readDoubleComplexMatrix(int _iDatasetId, int _iRows, int _iCols, double *_pdblReal, double *_pdblImg)
-{
-    hid_t obj;
-    herr_t status;
-    hobj_ref_t *pRef = (hobj_ref_t *) MALLOC (2 * sizeof (hobj_ref_t));
-
-    //Read the data.
-    status = DynHDF5::dynH5Dread (_iDatasetId, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, pRef);
-
-    //Open the referenced object, get its name and type.
-    obj = DynHDF5::dynH5Rdereference (_iDatasetId, H5R_OBJECT, &pRef[0]);
-    status = readDouble(obj, _iRows, _iCols, _pdblReal);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    obj = DynHDF5::dynH5Rdereference (_iDatasetId, H5R_OBJECT, &pRef[1]);
-    status = readDouble(obj, _iRows, _iCols, _pdblImg);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readEmptyMatrix(int _iDatasetId)
-{
-    //close dataset
-    herr_t status;
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readBooleanMatrix(int _iDatasetId, int _iRows, int _iCols, int* _piData)
-{
-    herr_t status = 0;
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread(_iDatasetId, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, _piData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-
-static int readString(int _iDatasetId, char **_pstData)
-{
-    hid_t iFileType, memtype, iSpace;
-    herr_t status;
-    hsize_t dims[1];
-    size_t iDim;
-
-    /*
-    * Get the datatype and its size.
-    */
-    iFileType = DynHDF5::dynH5Dget_type (_iDatasetId);
-    iDim = DynHDF5::dynH5Tget_size (iFileType);
-    iDim++;                         /* Make room for null terminator */
-
-    /*
-    * Get dataspace and allocate memory for read buffer.  This is a
-    * two dimensional attribute so the dynamic allocation must be done
-    * in steps.
-    */
-    iSpace = DynHDF5::dynH5Dget_space (_iDatasetId);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sget_simple_extent_dims (iSpace, dims, NULL);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    /*
-    * Allocate space for string data.
-    */
-    *_pstData = (char *) MALLOC ( (size_t)((dims[0] * iDim + 1) * sizeof (char)));
-
-    /*
-    * Create the memory datatype.
-    */
-    memtype = DynHDF5::dynH5Tcopy (H5T_C_S1);
-    status = DynHDF5::dynH5Tset_size (memtype, iDim);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread (_iDatasetId, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, *_pstData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Tclose(memtype);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose(iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Tclose(iFileType);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readStringMatrix(int _iDatasetId, int _iRows, int _iCols, char **_pstData)
-{
-    int i;
-    herr_t status;
-    hsize_t dims[1];
-    hsize_t subdims[1]  = {1};
-    hid_t space, memspace, filetype, memtype;
-    size_t iDim;
-    size_t iAllocSize   = 0;
-
-#ifdef TIME_DEBUG
-    LARGE_INTEGER *piStart;
-    LARGE_INTEGER *piEnd;
-    LARGE_INTEGER iFreq;
-
-    QueryPerformanceFrequency(&iFreq);
-
-    piStart = (LARGE_INTEGER*)MALLOC(sizeof(LARGE_INTEGER) * (_iRows * _iCols + 1));
-    piEnd   = (LARGE_INTEGER*)MALLOC(sizeof(LARGE_INTEGER) * (_iRows * _iCols + 1));
-
-    QueryPerformanceCounter(&piStart[0]);
-#endif
-
-    /*
-    * Get the datatype and its size.
-    */
-    filetype = DynHDF5::dynH5Dget_type (_iDatasetId);
-    iDim = DynHDF5::dynH5Tget_size (filetype);
-    iDim++;                         /* Make room for null terminator */
-
-
-    /*create sub space*/
-    memspace = DynHDF5::dynH5Screate_simple(1, subdims, NULL);
-    if (memspace < 0)
-    {
-        return -1;
-    }
-
-
-    status = DynHDF5::dynH5Sget_simple_extent_dims (memspace, dims, NULL);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    space = DynHDF5::dynH5Dget_space (_iDatasetId);
-    if (space < 0)
-    {
-        return -1;
-    }
-
-
-    /*
-    * Create the memory datatype.
-    */
-    memtype = DynHDF5::dynH5Tcopy (H5T_C_S1);
-    status = DynHDF5::dynH5Tset_size (memtype, iDim);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    /*
-    * Allocate space for string data.
-    */
-    iAllocSize = (size_t)((iDim + 1) * sizeof (char));
-    for (i = 0 ; i < _iRows * _iCols; i++)
-    {
-        _pstData[i] = (char *) MALLOC (iAllocSize);
-    }
-
-    /*
-    * Read the data.
-    */
-    for (i = 0 ; i < _iRows * _iCols; i++)
-    {
-        hsize_t start[1] = {i};
-        hsize_t count[1] = {1};
-#ifdef TIME_DEBUG
-        QueryPerformanceCounter(&piStart[i + 1]);
-#endif
-        status = DynHDF5::dynH5Sselect_hyperslab (space, H5S_SELECT_SET, start, NULL, count, NULL);
-        if (status < 0)
-        {
-            return -1;
-        }
-
-        /*
-        * Read the data.
-        */
-        status = DynHDF5::dynH5Dread (_iDatasetId, memtype, memspace, space, H5P_DEFAULT, _pstData[i]);
-        if (status < 0)
-        {
-            return -1;
-        }
-#ifdef TIME_DEBUG
-        QueryPerformanceCounter(&piEnd[i + 1]);
-#endif
-    }
-
-    status = DynHDF5::dynH5Sclose(space);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose(memspace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-
-    status = DynHDF5::dynH5Tclose(filetype);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-#ifdef TIME_DEBUG
-    QueryPerformanceCounter(&piEnd[0]);
-
-    //print debuf timer
-    printf("\nGlobalTime : %0.3f ms\n", ((piEnd[0].QuadPart - piStart[0].QuadPart) * 1000.0) / iFreq.QuadPart);
-    for (i = 0 ; i < _iRows * _iCols; i++)
-    {
-        double dblTime    = ((piEnd[i + 1].QuadPart - piStart[i + 1].QuadPart) * 1000.0) / iFreq.QuadPart;
-        printf("SubTime %d : %0.3f ms\n", i, dblTime);
-    }
-#endif
-    return 0;
-}
-
-static int readComplexPoly(int _iDatasetId, int* _piNbCoef, double** _pdblReal, double** _pdblImg)
-{
-    int iRows   = 0;
-    int iCols   = 0;
-
-    //Get the datatype and its size.
-    getDatasetDims(_iDatasetId, &iRows, &iCols);
-
-    //Allocate space for string data.
-    *_piNbCoef  = iRows * iCols;
-    *_pdblReal  = (double*)MALLOC(*_piNbCoef * sizeof(double));
-    *_pdblImg   = (double*)MALLOC(*_piNbCoef * sizeof(double));
-
-    //Read the data and return result.
-    return readDoubleComplexMatrix(_iDatasetId, 1, *_piNbCoef, *_pdblReal, *_pdblImg);
-}
-
-static int readPoly(int _iDatasetId, int* _piNbCoef, double** _pdblData)
-{
-    int iRows   = 0;
-    int iCols   = 0;
-
-    //Get the datatype and its size.
-    getDatasetDims(_iDatasetId, &iRows, &iCols);
-
-    *_piNbCoef  = iRows * iCols;
-    *_pdblData  = (double*)MALLOC(*_piNbCoef * sizeof(double));
-
-    //Read the data and return result.
-    return readDoubleMatrix(_iDatasetId, 1, *_piNbCoef, *_pdblData);
-}
-
-int readCommonPolyMatrix(int _iDatasetId, char* _pstVarname, int _iComplex, int _iRows, int _iCols, int* _piNbCoef, double **_pdblReal, double **_pdblImg)
-{
-    int    i            = 0;
-    hid_t obj           = 0;
-    char* pstVarName    = 0;
-    hobj_ref_t *pData   = (hobj_ref_t *)MALLOC(_iRows * _iCols * sizeof (hobj_ref_t));
-    herr_t status;
-
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread (_iDatasetId, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, pData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    for (i = 0 ; i < _iRows * _iCols; i++)
-    {
-        /*
-        * Open the referenced object, get its name and type.
-        */
-        obj = DynHDF5::dynH5Rdereference (_iDatasetId, H5R_OBJECT, &pData[i]);
-        if (_iComplex)
-        {
-            status = readComplexPoly(obj, &_piNbCoef[i], &_pdblReal[i], &_pdblImg[i]);
-        }
-        else
-        {
-            status = readPoly(obj, &_piNbCoef[i], &_pdblReal[i]);
-        }
-
-        if (status < 0)
-        {
-            return -1;
-        }
-    }
-
-    pstVarName = readAttribute(_iDatasetId, g_SCILAB_CLASS_VARNAME);
-    strcpy(_pstVarname, pstVarName);
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    FREE(pData);
-    FREE(pstVarName);
-
-    return 0;
-}
-
-int readPolyMatrix(int _iDatasetId, char* _pstVarname, int _iRows, int _iCols, int* _piNbCoef, double **_pdblData)
-{
-    return readCommonPolyMatrix(_iDatasetId, _pstVarname, 0, _iRows, _iCols, _piNbCoef, _pdblData, NULL);
-}
-
-int readPolyComplexMatrix(int _iDatasetId, char* _pstVarname, int _iRows, int _iCols, int* _piNbCoef, double **_pdblReal, double **_pdblImg)
-{
-    return readCommonPolyMatrix(_iDatasetId, _pstVarname, 1, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg);
-}
-
-int readInteger8Matrix(int _iDatasetId, int _iRows, int _iCols, char* _pcData)
-{
-    herr_t status = 0;
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread(_iDatasetId, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pcData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readInteger16Matrix(int _iDatasetId, int _iRows, int _iCols, short* _psData)
-{
-    herr_t status = 0;
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread(_iDatasetId, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, _psData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readInteger32Matrix(int _iDatasetId, int _iRows, int _iCols, int* _piData)
-{
-    herr_t status = 0;
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread(_iDatasetId, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, _piData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readInteger64Matrix(int _iDatasetId, int _iRows, int _iCols, long long* _pllData)
-{
-    herr_t status = 0;
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread(_iDatasetId, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pllData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readUnsignedInteger8Matrix(int _iDatasetId, int _iRows, int _iCols, unsigned char* _pucData)
-{
-    herr_t status = 0;
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread(_iDatasetId, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pucData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readUnsignedInteger16Matrix(int _iDatasetId, int _iRows, int _iCols, unsigned short* _pusData)
-{
-    herr_t status = 0;
-
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread(_iDatasetId, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pusData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readUnsignedInteger32Matrix(int _iDatasetId, int _iRows, int _iCols, unsigned int* _puiData)
-{
-    herr_t status = 0;
-
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread(_iDatasetId, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, _puiData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readUnsignedInteger64Matrix(int _iDatasetId, int _iRows, int _iCols, unsigned long long* _pullData)
-{
-    herr_t status = 0;
-
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread(_iDatasetId, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pullData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int readCommonSparseComplexMatrix(int _iDatasetId, int _iComplex, int _iRows, int _iCols, int _iNbItem, int* _piNbItemRow,    int* _piColPos, double *_pdblReal, double *_pdblImg)
-{
-    hid_t obj           = 0;
-    hobj_ref_t *pRef    = (hobj_ref_t *)MALLOC(3 * sizeof (hobj_ref_t));
-    herr_t status;
-
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread (_iDatasetId, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, pRef);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //read Row data
-    obj = DynHDF5::dynH5Rdereference (_iDatasetId, H5R_OBJECT, &pRef[0]);
-    status = readInteger32Matrix(obj, 1, _iRows, _piNbItemRow);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //read cols data
-    obj = DynHDF5::dynH5Rdereference (_iDatasetId, H5R_OBJECT, &pRef[1]);
-    status = readInteger32Matrix(obj, 1, _iNbItem, _piColPos);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //read sparse data
-    obj = DynHDF5::dynH5Rdereference (_iDatasetId, H5R_OBJECT, &pRef[2]);
-
-    if (_iComplex)
-    {
-        status = readDoubleComplexMatrix(obj, 1, _iNbItem, _pdblReal, _pdblImg);
-    }
-    else
-    {
-        status = readDoubleMatrix(obj, 1, _iNbItem, _pdblReal);
-    }
-
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    FREE(pRef);
-
-    return 0;
-}
-
-int readSparseMatrix(int _iDatasetId, int _iRows, int _iCols, int _iNbItem, int* _piNbItemRow,    int* _piColPos, double *_pdblReal)
-{
-    return readCommonSparseComplexMatrix(_iDatasetId, 0, _iRows, _iCols, _iNbItem, _piNbItemRow,    _piColPos, _pdblReal, NULL);
-}
-
-int readSparseComplexMatrix(int _iDatasetId, int _iRows, int _iCols, int _iNbItem, int* _piNbItemRow,    int* _piColPos, double *_pdblReal, double *_pdblImg)
-{
-    return readCommonSparseComplexMatrix(_iDatasetId, 1, _iRows, _iCols, _iNbItem, _piNbItemRow,    _piColPos, _pdblReal, _pdblImg);
-}
-
-int readBooleanSparseMatrix(int _iDatasetId, int _iRows, int _iCols, int _iNbItem, int* _piNbItemRow,    int* _piColPos)
-{
-    hid_t obj           = 0;
-    hobj_ref_t *pRef    = (hobj_ref_t *)MALLOC(2 * sizeof (hobj_ref_t));
-    herr_t status;
-
-    /*
-    * Read the data.
-    */
-    status = DynHDF5::dynH5Dread (_iDatasetId, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, pRef);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //read Row data
-    obj = DynHDF5::dynH5Rdereference (_iDatasetId, H5R_OBJECT, &pRef[0]);
-    status = readInteger32Matrix(obj, 1, _iRows, _piNbItemRow);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //read cols data
-    obj = DynHDF5::dynH5Rdereference (_iDatasetId, H5R_OBJECT, &pRef[1]);
-    status = readInteger32Matrix(obj, 1, _iNbItem, _piColPos);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    FREE(pRef);
-
-    return 0;
-}
-
-int getScilabTypeFromDataSet(int _iDatasetId)
-{
-    int iVarType            = 0;
-    char *pstScilabClass    = readAttribute(_iDatasetId, g_SCILAB_CLASS);
-
-    if (pstScilabClass == NULL)
-    {
-        return unknow_type;
-    }
-    /* HDF5 Float type + SCILAB_Class = double <=> double */
-    if (strcmp(pstScilabClass, g_SCILAB_CLASS_DOUBLE) == 0)
-    {
-        iVarType = sci_matrix;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_STRING) == 0)
-    {
-        iVarType = sci_strings;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_BOOLEAN) == 0)
-    {
-        iVarType = sci_boolean;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_BOOLEAN) == 0)
-    {
-        iVarType = sci_boolean;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_POLY) == 0)
-    {
-        iVarType = sci_poly;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_INT) == 0)
-    {
-        iVarType = sci_ints;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_SPARSE) == 0)
-    {
-        iVarType = sci_sparse;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_BSPARSE) == 0)
-    {
-        iVarType = sci_boolean_sparse;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_LIST) == 0)
-    {
-        iVarType = sci_list;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_TLIST) == 0)
-    {
-        iVarType = sci_tlist;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_MLIST) == 0)
-    {
-        iVarType = sci_mlist;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_VOID) == 0)
-    {
-        iVarType = sci_void;
-    }
-    else if (strcmp(pstScilabClass, g_SCILAB_CLASS_UNDEFINED) == 0)
-    {
-        iVarType = sci_undefined;
-    }
-
-    if (iVarType == 0)
-    {
-        return 0;
-    }
-    FREE(pstScilabClass);
-    return iVarType;
-}
-
-
-int getListItemReferences(int _iDatasetId, hobj_ref_t** _piItemRef)
-{
-    int iItem       = 0;
-    herr_t status   = 0;
-
-    getListDims(_iDatasetId, &iItem);
-
-    *_piItemRef = (hobj_ref_t *) MALLOC (iItem * sizeof (hobj_ref_t));
-
-    status = DynHDF5::dynH5Dread (_iDatasetId, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, *_piItemRef);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int getListItemDataset(int _iDatasetId, void* _piItemRef, int _iItemPos, int* _piItemDataset)
-{
-    hobj_ref_t poRef    = ((hobj_ref_t*)_piItemRef)[_iItemPos];
-    *_piItemDataset     = DynHDF5::dynH5Rdereference (_iDatasetId, H5R_OBJECT, &poRef);
-
-    if (*_piItemDataset == 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int deleteListItemReferences(int _iDatasetId, void* _piItemRef)
-{
-    herr_t status;
-    if (_piItemRef)
-    {
-        hobj_ref_t *poRef    = (hobj_ref_t*)_piItemRef;
-        FREE(poRef);
-    }
-
-    status = DynHDF5::dynH5Dclose(_iDatasetId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
diff --git a/scilab/modules/hdf5/src/cpp/h5_writeDataToFile.cpp b/scilab/modules/hdf5/src/cpp/h5_writeDataToFile.cpp
deleted file mode 100644 (file)
index 82eac6f..0000000
+++ /dev/null
@@ -1,2118 +0,0 @@
-/*
-*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-*  Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET
-*
-*  This file must be used under the terms of the CeCILL.
-*  This source file is licensed as described in the file COPYING, which
-*  you should have received as part of this distribution.  The terms
-*  are also available at
-*  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-*
-*/
-
-#define H5_USE_16_API
-
-#include "dynhdf5.hxx"
-
-extern "C"
-{
-#include <MALLOC.h>
-#include <math.h>
-#include <string.h>
-#include "sci_types.h"
-#include "core_math.h"
-#include "h5_writeDataToFile.h"
-#include "h5_attributeConstants.h"
-#include "h5_readDataFromFile.h"
-#include "version.h"
-}
-
-static hid_t enableCompression(int _iLevel, int _iRank, const hsize_t* _piDims)
-{
-    hid_t iRet  = 0;
-    int iLevel  = _iLevel;
-
-    return H5P_DEFAULT;
-    /*
-      if(iLevel < 0)
-        {
-            iLevel = 0;
-        }
-
-      if(iLevel > 9)
-        {
-            iLevel = 9;
-        }
-
-        if(iLevel)
-        {
-            iRet = DynHDF5::dynH5Pcreate(H5P_DATASET_CREATE);
-            if(iRet < 0)
-            {
-                iRet = 0;
-            }
-            else
-            {
-                if(H5Pset_layout(iRet,H5D_COMPACT)<0)
-                {
-                    DynHDF5::dynH5Pclose(iRet);
-                    iRet = 0;
-                }
-                else
-                {
-                    if(H5Pset_chunk(iRet,_iRank, _piDims)<0)
-                    {
-                        DynHDF5::dynH5Pclose(iRet);
-                        iRet = 0;
-                    }
-                    else
-                    {
-                        if(H5Pset_deflate(iRet,iLevel)<0)
-                        {
-                            DynHDF5::dynH5Pclose(iRet);
-                            iRet = 0;
-                        }
-                    }
-                }
-            }
-        }
-        else
-        {
-            iRet = DynHDF5::dynH5Pcopy(H5P_DEFAULT);
-        }
-        return iRet;
-    */
-}
-
-static herr_t addIntAttribute(int _iDatasetId, const char *_pstName, const int _iVal)
-{
-    hsize_t attributeDims[1] = {1};
-    hid_t attributeTypeId, attributeSpace;
-    herr_t status;
-
-    //Create attribute dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    attributeSpace = DynHDF5::dynH5Screate_simple (1, attributeDims, NULL);
-
-    //Create the attribute and write it.
-    attributeTypeId = DynHDF5::dynH5Acreate (_iDatasetId, _pstName, H5T_NATIVE_INT, attributeSpace, H5P_DEFAULT);
-    if (attributeTypeId < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Awrite (attributeTypeId, H5T_NATIVE_INT, &_iVal);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Aclose (attributeTypeId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (attributeSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-static herr_t addAttribute(int _iDatasetId, const char *_pstName, const char *_pstValue)
-{
-    hsize_t attributeDims[1] = {1};
-    hid_t attributeTypeId, attributeSpace, attr;
-    herr_t status;
-
-    //Create attribute dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    attributeSpace = DynHDF5::dynH5Screate_simple (1, attributeDims, NULL);
-
-    //Create special attribute type
-    attributeTypeId = DynHDF5::dynH5Tcopy(H5T_C_S1);
-    status = DynHDF5::dynH5Tset_size(attributeTypeId, strlen(_pstValue));
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Create the attribute and write it.
-    attr = DynHDF5::dynH5Acreate (_iDatasetId, _pstName, attributeTypeId, attributeSpace, H5P_DEFAULT);
-    if (attr < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Awrite (attr, attributeTypeId, _pstValue);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Aclose (attr);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Tclose (attributeTypeId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int updateScilabVersion(int _iFile)
-{
-    herr_t status;
-    //try to read attribute
-    char* pstScilabVersion = getScilabVersionAttribute(_iFile);
-    if (pstScilabVersion)
-    {
-        //delete before write
-        status = H5Adelete(_iFile, g_SCILAB_CLASS_SCI_VERSION);
-        if (status < 0)
-        {
-            return -1;
-        }
-    }
-
-    if (strstr(SCI_VERSION_STRING, "branch"))
-    {
-        //compiled by user
-        char pstVersion[64];
-        sprintf(pstVersion, "%s %d.%d.%d", SCI_VERSION_STRING, SCI_VERSION_MAJOR, SCI_VERSION_MINOR, SCI_VERSION_MAINTENANCE);
-        status = addAttribute(_iFile, g_SCILAB_CLASS_SCI_VERSION, pstVersion);
-    }
-    else
-    {
-        //compiled by compilation chain
-        status = addAttribute(_iFile, g_SCILAB_CLASS_SCI_VERSION, SCI_VERSION_STRING);
-    }
-
-    return status;
-}
-
-int updateFileVersion(int _iFile)
-{
-    herr_t status;
-    //try to read attribute
-    int iHdf5Version = getSODFormatAttribute(_iFile);
-    if (iHdf5Version != -1)
-    {
-        status = H5Adelete(_iFile, g_SCILAB_CLASS_SOD_VERSION);
-        if (status < 0)
-        {
-            return -1;
-        }
-    }
-
-    return addIntAttribute(_iFile, g_SCILAB_CLASS_SOD_VERSION, SOD_FILE_VERSION);
-}
-
-static int writeString(int _iFile, char* _pstDatasetName, char *_pstData)
-{
-    hsize_t dims[1] = {1};
-    hid_t typeId, space, dset;
-    herr_t status;
-    hid_t iCompress;
-
-    //Create string dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    space = DynHDF5::dynH5Screate_simple (1, dims, NULL);
-    if (space < 0)
-    {
-        return -1;
-    }
-
-    //Create special string type
-    typeId = DynHDF5::dynH5Tcopy(H5T_C_S1);
-    if (strlen(_pstData) > 0)
-    {
-        status = DynHDF5::dynH5Tset_size(typeId, strlen(_pstData));
-        if (status < 0)
-        {
-            return -1;
-        }
-    }
-
-    //Create the data set and write it.
-    iCompress = enableCompression(9, 1, dims);
-    dset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, typeId, space, iCompress);
-    if (dset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite (dset, typeId, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pstData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = string to dataset
-    status = addAttribute(dset, g_SCILAB_CLASS, g_SCILAB_CLASS_STRING);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose(dset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Tclose(typeId);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose(space);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int writeStringMatrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, char **data)
-{
-    int i;
-    hsize_t dims[1] = {_iRows * _iCols};
-    hsize_t subdims[1] = {1};
-    hid_t typeId, space, dset, memspace;
-    herr_t status;
-    hid_t iCompress;
-    size_t iMaxLen = 0;
-    char* pstDataTemp = NULL;
-
-    for (i = 0 ; i < _iRows * _iCols ; i++)
-    {
-        iMaxLen = std::max(iMaxLen, strlen(data[i]));
-    }
-
-    //Create string dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    space = DynHDF5::dynH5Screate_simple (1, dims, NULL);
-    if (space < 0)
-    {
-        return -1;
-    }
-
-    //Create special string type
-    typeId = DynHDF5::dynH5Tcopy(H5T_C_S1);
-
-    /* Bug 6474 */
-    /* we allocate datas in fixed length string */
-    /* workaround for memcpy in hdf5 with wrong size */
-    pstDataTemp = (char*)MALLOC(sizeof(char) * (iMaxLen + 1));
-
-    if (iMaxLen > 0)
-    {
-        status = DynHDF5::dynH5Tset_size(typeId, iMaxLen);
-        if (status < 0)
-        {
-            FREE(pstDataTemp);
-            return -1;
-        }
-    }
-
-    //Create the data set and write it.
-    iCompress = enableCompression(9, 1, dims);
-    dset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, typeId, space, iCompress);
-    if (dset < 0)
-    {
-        FREE(pstDataTemp);
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose(space);
-    if (status < 0)
-    {
-        FREE(pstDataTemp);
-        return -1;
-    }
-
-
-
-    for (i = 0 ; i < _iRows * _iCols ; i++)
-    {
-        hsize_t start[1] = {i};
-        hsize_t count[1] = {1};
-
-        strcpy(pstDataTemp, data[i]);
-
-        space = DynHDF5::dynH5Dget_space(dset);
-        if (space < 0)
-        {
-            FREE(pstDataTemp);
-            return -1;
-        }
-
-        status = DynHDF5::dynH5Sselect_hyperslab (space, H5S_SELECT_SET, start, NULL, count, NULL);
-        if (status < 0)
-        {
-            FREE(pstDataTemp);
-            return -1;
-        }
-
-        /*create sub space*/
-        memspace = DynHDF5::dynH5Screate_simple(1, subdims, NULL);
-        if (memspace < 0)
-        {
-            FREE(pstDataTemp);
-            return -1;
-        }
-
-        status = DynHDF5::dynH5Dwrite (dset, typeId, memspace, space, H5P_DEFAULT, pstDataTemp);
-
-        if (status < 0)
-        {
-            FREE(pstDataTemp);
-            return -1;
-        }
-
-        status = DynHDF5::dynH5Sclose(space);
-        if (status < 0)
-        {
-            FREE(pstDataTemp);
-            return -1;
-        }
-
-        status = DynHDF5::dynH5Sclose(memspace);
-        if (status < 0)
-        {
-            FREE(pstDataTemp);
-            return -1;
-        }
-
-    }
-
-    //Add attribute SCILAB_Class = string to dataset
-    status = addAttribute(dset, g_SCILAB_CLASS, g_SCILAB_CLASS_STRING);
-    if (status < 0)
-    {
-        FREE(pstDataTemp);
-        return -1;
-    }
-
-    //Add attribute SCILAB_rows = _iRows
-    status = addIntAttribute(dset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        FREE(pstDataTemp);
-        return -1;
-    }
-
-    //Add attribute SCILAB_cols = _iCols
-    status = addIntAttribute(dset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        FREE(pstDataTemp);
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose(dset);
-    if (status < 0)
-    {
-        FREE(pstDataTemp);
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Tclose(typeId);
-    if (status < 0)
-    {
-        FREE(pstDataTemp);
-        return -1;
-    }
-
-    FREE(pstDataTemp);
-
-    return 0;
-}
-
-char* createGroupName(char* _pstGroupName)
-{
-    char* pstSlash      = NULL;
-    char* pstGroupName  = (char *)MALLOC((strlen(_pstGroupName) + 3) * sizeof(char));
-    // Generate groupname #<dataSetName>#
-    sprintf(pstGroupName, "#%s#", _pstGroupName);
-    pstSlash            = strstr(pstGroupName, "/");
-    if (pstSlash != NULL)
-    {
-        pstSlash[0]     = '_';
-    }
-
-    return pstGroupName;
-}
-
-char* createPathName(char* _pstGroupName, int _iIndex)
-{
-    char* pstName       = NULL;
-    char* pstPathName   = NULL;
-
-    pstName             = (char*)MALLOC(((int)log10((double)(_iIndex + 1)) + 3) * sizeof(char));
-    //1 for null termination, 2 for '#' characters
-    sprintf(pstName, "#%d#", _iIndex);
-
-    pstPathName         = (char*)MALLOC((strlen(_pstGroupName) + strlen(pstName) + 2) * sizeof(char));
-    //1 for null termination, 1 for separator, 2 for '#' characters
-    sprintf(pstPathName, "%s/%s", _pstGroupName, pstName);
-    return pstPathName;
-}
-
-int writeVoid(int _iFile, char* _pstDatasetName)
-{
-    hsize_t piDims[1]   = {1};
-    herr_t status       = 0;
-    hid_t iSpace        = 0;
-    hid_t iDataset      = 0;
-    hid_t iCompress     = 0;
-    char cData          = 0;
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    iSpace = DynHDF5::dynH5Screate_simple (1, piDims, NULL);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-    //Create the dataset and write the array data to it.
-    iCompress    = enableCompression(9, 1, piDims);
-    iDataset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_INT8, iSpace, iCompress);
-    if (iDataset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite (iDataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, &cData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(iDataset, g_SCILAB_CLASS, g_SCILAB_CLASS_VOID);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (iDataset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int writeUndefined(int _iFile, char* _pstDatasetName)
-{
-    hsize_t piDims[1]   = {1};
-    herr_t status       = 0;
-    hid_t iSpace        = 0;
-    hid_t iDataset      = 0;
-    hid_t iCompress     = 0;
-    char cData          = 0;
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    iSpace = DynHDF5::dynH5Screate_simple (1, piDims, NULL);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-    //Create the dataset and write the array data to it.
-    iCompress = enableCompression(9, 1, piDims);
-    iDataset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_INT8, iSpace, iCompress);
-    if (iDataset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite (iDataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, &cData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(iDataset, g_SCILAB_CLASS, g_SCILAB_CLASS_UNDEFINED);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (iDataset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-static hobj_ref_t writeCommomDoubleMatrix(int _iFile, char* _pstGroupName, char* _pstDatasetName, int _iIndex, int _iRows, int _iCols, double *_pdblData)
-{
-    hid_t space;
-    hid_t dset;
-    hid_t iCompress     = 0;
-    hsize_t dims[1]     = {_iRows * _iCols};
-    herr_t status       = 0;
-    hobj_ref_t iRef     = 0;
-
-    char* pstPathName   = NULL;
-
-    //createGroupe and dataset name
-    pstPathName         = createPathName(_pstGroupName, _iIndex);
-
-    if (_iRows * _iCols == 0)
-    {
-        double dblZero = 0;
-        //tips for empty double matrix
-
-        //Create dataspace.  Setting maximum size to NULL sets the maximum
-        //size to be the current size.
-        dims[0] = 1;
-
-        space = DynHDF5::dynH5Screate_simple (1, dims, NULL);
-        if (space < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-
-        //Create the dataset and write the array data to it.
-        iCompress = enableCompression(9, 1, dims);
-        dset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_DOUBLE, space, iCompress);
-        if (dset < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-
-        status = DynHDF5::dynH5Dwrite (dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dblZero);
-        if (status < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-
-        //Add attribute SCILAB_Class = double to dataset
-        status = addAttribute(dset, g_SCILAB_CLASS, g_SCILAB_CLASS_DOUBLE);
-        if (status < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-
-        status = addAttribute(dset, g_SCILAB_CLASS_EMPTY, "true");
-        if (status < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-    }
-    else
-    {
-        //Create dataspace.  Setting maximum size to NULL sets the maximum
-        //size to be the current size.
-        space = DynHDF5::dynH5Screate_simple (1, dims, NULL);
-        if (space < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-
-        //Create the dataset and write the array data to it.
-        iCompress = enableCompression(9, 1, dims);
-        dset = DynHDF5::dynH5Dcreate (_iFile, pstPathName, H5T_NATIVE_DOUBLE, space, iCompress);
-        if (dset < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-
-        status = DynHDF5::dynH5Dwrite (dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pdblData);
-        if (status < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-
-        //Add attribute SCILAB_Class = double to dataset
-        status = addAttribute(dset, g_SCILAB_CLASS, g_SCILAB_CLASS_DOUBLE);
-        if (status < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-
-        //Add attribute SCILAB_Class_rows = double to dataset
-        status = addIntAttribute(dset, g_SCILAB_CLASS_ROWS, _iRows);
-        if (status < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-
-        //Add attribute SCILAB_Class_cols = double to dataset
-        status = addIntAttribute(dset, g_SCILAB_CLASS_COLS, _iCols);
-        if (status < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-
-        // create the ref
-        status = DynHDF5::dynH5Rcreate (&iRef, _iFile, pstPathName, H5R_OBJECT, -1);
-        if (status < 0)
-        {
-            return (hobj_ref_t)(-1);
-        }
-    }
-
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (dset);
-    if (status < 0)
-    {
-        return (hobj_ref_t)(-1);
-    }
-
-    status = DynHDF5::dynH5Sclose (space);
-    if (status < 0)
-    {
-        return (hobj_ref_t)(-1);
-    }
-
-    FREE(pstPathName);
-
-    return iRef;
-}
-
-int writeDoubleMatrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, double *_pdblData)
-{
-    hid_t space         = 0;
-    hid_t dset          = 0;
-    herr_t status       = 0;
-    hsize_t dims[1]     = {1};
-    hid_t iCompress     = 0;
-    hobj_ref_t pRef[1]  = {0};
-
-    hid_t group         = 0;
-    char* pstGroupName  = NULL;
-    pstGroupName        = createGroupName(_pstDatasetName);
-
-    //create sub group only for non empty matrix
-    if (_iRows * _iCols != 0)
-    {
-        group   = DynHDF5::dynH5Gcreate(_iFile, pstGroupName, H5P_DEFAULT);
-        status  = DynHDF5::dynH5Gclose(group);
-        if (status < 0)
-        {
-            return -1;
-        }
-    }
-
-    pRef[0] = writeCommomDoubleMatrix(_iFile, pstGroupName, _pstDatasetName, 0, _iRows, _iCols, _pdblData);
-
-    //don't create reference for empty matrix
-    if (_iRows * _iCols == 0)
-    {
-        return 0;
-    }
-
-    if (pRef[0] == 0)
-    {
-        return -1;
-    }
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    space = DynHDF5::dynH5Screate_simple(1, dims, NULL);
-    if (space < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress   = enableCompression(9, 1, dims);
-    dset        = DynHDF5::dynH5Dcreate(_iFile, _pstDatasetName, H5T_STD_REF_OBJ, space, iCompress);
-    if (dset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite(dset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, pRef);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(dset, g_SCILAB_CLASS, g_SCILAB_CLASS_DOUBLE);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_rows = double to dataset
-    status = addIntAttribute(dset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols = double to dataset
-    status = addIntAttribute(dset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose(dset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose(space);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    FREE(pstGroupName);
-    return status;
-}
-
-
-
-int writeDoubleComplexMatrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, double *_pdblReal, double *_pdblImg)
-{
-    hid_t space         = 0;
-    hid_t dset          = 0;
-    herr_t status       = 0;
-    hid_t iCompress     = 0;
-    hsize_t dims[1]     = {2};
-    hobj_ref_t pRef[2]  = {0};
-
-    hid_t group         = 0;
-    char* pstGroupName  = NULL;
-    pstGroupName        = createGroupName(_pstDatasetName);
-    group               = DynHDF5::dynH5Gcreate(_iFile, pstGroupName, H5P_DEFAULT);
-    status              = DynHDF5::dynH5Gclose(group);
-
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    pRef[0] = writeCommomDoubleMatrix(_iFile, pstGroupName, _pstDatasetName, 0, _iRows, _iCols, _pdblReal);
-    pRef[1] = writeCommomDoubleMatrix(_iFile, pstGroupName, _pstDatasetName, 1, _iRows, _iCols, _pdblImg);
-    if (pRef[0] == 0 || pRef[1] == 0)
-    {
-        return 1;
-    }
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    space = DynHDF5::dynH5Screate_simple(1, dims, NULL);
-    if (space < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress   = enableCompression(9, 1, dims);
-    dset        = DynHDF5::dynH5Dcreate(_iFile, _pstDatasetName, H5T_STD_REF_OBJ, space, iCompress);
-    if (dset < 0)
-    {
-        printf("\nH5Dcreate\n");
-        return -1;
-    }
-    status = DynHDF5::dynH5Dwrite(dset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, pRef);
-    if (status < 0)
-    {
-        printf("\nH5Dwrite\n");
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(dset, g_SCILAB_CLASS, g_SCILAB_CLASS_DOUBLE);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_rows = double to dataset
-    status = addIntAttribute(dset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols = double to dataset
-    status = addIntAttribute(dset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addAttribute(dset, g_SCILAB_CLASS_COMPLEX, "true");
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose(dset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose(space);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    FREE(pstGroupName);
-    return 0;
-}
-
-int writeBooleanMatrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, int *_piData)
-{
-    hsize_t piDims[1] = {_iRows * _iCols};
-    herr_t status;
-    hid_t iSpace;
-    hid_t    iCompress;
-    hid_t iDataset;
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    iSpace = DynHDF5::dynH5Screate_simple (1, piDims, NULL);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress    = enableCompression(9, 1, piDims);
-    iDataset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_INT, iSpace, iCompress);
-    if (iDataset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite (iDataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, _piData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(iDataset, g_SCILAB_CLASS, g_SCILAB_CLASS_BOOLEAN);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_rows = double to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols = double to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (iDataset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-static int writeCommonPolyMatrix(int _iFile, char* _pstDatasetName, char* _pstVarName, int _iComplex, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)
-{
-    int i               = 0;
-    hsize_t dims[1]     = {_iRows * _iCols};
-    herr_t status       = 0;
-    hid_t space         = 0;
-    hid_t dset          = 0;
-    hid_t group         = 0;
-    hid_t iCompress     = 0;
-    hobj_ref_t* pData   = 0;
-
-    char* pstName       = NULL;
-    char* pstPathName   = NULL;
-
-    char* pstGroupName  = NULL;
-
-
-    // Create ref matrix
-    pData = (hobj_ref_t *)MALLOC(_iRows * _iCols * sizeof(hobj_ref_t));
-
-    // Generate groupname #<dataSetName>#
-    pstGroupName = createGroupName(_pstDatasetName);
-
-    //First create a group to store all referenced objects.
-    group = DynHDF5::dynH5Gcreate(_iFile, pstGroupName, H5P_DEFAULT);
-    status = DynHDF5::dynH5Gclose(group);
-
-    //Now create each String as a dedicated DataSet.
-    for (i = 0 ; i < _iRows * _iCols; i++)
-    {
-        pstPathName = createPathName(pstGroupName, i);
-
-        // Write the string to ref
-        if (_iComplex)
-        {
-            status = writeDoubleComplexMatrix(_iFile, pstPathName, 1, _piNbCoef[i], _pdblReal[i], _pdblImg[i] );
-        }
-        else
-        {
-            status = writeDoubleMatrix(_iFile, pstPathName, 1, _piNbCoef[i],  _pdblReal[i]);
-        }
-
-        if (status < 0)
-        {
-            return -1;
-        }
-        // create the ref
-        status = DynHDF5::dynH5Rcreate(&pData[i], _iFile, pstPathName, H5R_OBJECT, -1);
-        if (status < 0)
-        {
-            return -1;
-        }
-
-        FREE(pstName);
-        FREE(pstPathName);
-    }
-
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    space = DynHDF5::dynH5Screate_simple(1, dims, NULL);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress = enableCompression(9, 1, dims);
-    dset = DynHDF5::dynH5Dcreate(_iFile, _pstDatasetName, H5T_STD_REF_OBJ, space, iCompress);
-    if (dset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite(dset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, pData);
-    if (status < 0)
-    {
-        return -1;
-    }
-    //Add attribute SCILAB_Class = poly to dataset
-    status = addAttribute(dset, g_SCILAB_CLASS, g_SCILAB_CLASS_POLY);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute Varname attribute to dataset
-    status = addAttribute(dset, g_SCILAB_CLASS_VARNAME, _pstVarName);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    if (_iComplex)
-    {
-        //Add attribute Varname attribute to dataset
-        status = addAttribute(dset, g_SCILAB_CLASS_COMPLEX, "true");
-        if (status < 0)
-        {
-            return -1;
-        }
-    }
-
-    //Add attribute SCILAB_Class_rows = double to dataset
-    status = addIntAttribute(dset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols = double to dataset
-    status = addIntAttribute(dset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose(dset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose(space);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    FREE(pstGroupName);
-    FREE(pData);
-
-    return 0;
-}
-
-int writePolyMatrix(int _iFile, char* _pstDatasetName, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal)
-{
-    return writeCommonPolyMatrix(_iFile, _pstDatasetName, _pstVarName, 0, _iRows, _iCols, _piNbCoef, _pdblReal, NULL);
-}
-
-int writePolyComplexMatrix(int _iFile, char* _pstDatasetName, char* _pstVarName, int _iRows, int _iCols, int* _piNbCoef, double** _pdblReal, double** _pdblImg)
-{
-    return writeCommonPolyMatrix(_iFile, _pstDatasetName, _pstVarName, 1, _iRows, _iCols, _piNbCoef, _pdblReal, _pdblImg);
-}
-
-int writeInteger8Matrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, char* _pcData)
-{
-    hsize_t piDims[1]   = {_iRows * _iCols};
-    herr_t status       = 0;
-    hid_t iSpace        = 0;
-    hid_t iDataset      = 0;
-    hid_t iCompress     = 0;
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    iSpace = DynHDF5::dynH5Screate_simple (1, piDims, NULL);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-    //Create the dataset and write the array data to it.
-    iCompress = enableCompression(9, 1, piDims);
-    iDataset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_INT8, iSpace, iCompress);
-    if (iDataset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite (iDataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pcData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(iDataset, g_SCILAB_CLASS, g_SCILAB_CLASS_INT);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addAttribute(iDataset, g_SCILAB_CLASS_PREC, "8");
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_rows to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (iDataset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int writeInteger16Matrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, short* _psData)
-{
-    hsize_t piDims[1]   = {_iRows * _iCols};
-    herr_t status       = 0;
-    hid_t iSpace        = 0;
-    hid_t iDataset      = 0;
-    hid_t iCompress     = 0;
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    iSpace = DynHDF5::dynH5Screate_simple (1, piDims, NULL);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-    //Create the dataset and write the array data to it.
-    iCompress = enableCompression(9, 1, piDims);
-    iDataset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_INT16, iSpace, iCompress);
-    if (iDataset < 0)
-    {
-        return -1;
-    }
-    status = DynHDF5::dynH5Dwrite (iDataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, _psData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(iDataset, g_SCILAB_CLASS, g_SCILAB_CLASS_INT);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addAttribute(iDataset, g_SCILAB_CLASS_PREC, "16");
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_rows to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (iDataset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int writeInteger32Matrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, int* _piData)
-{
-    hsize_t piDims[1]   = {_iRows * _iCols};
-    herr_t status       = 0;
-    hid_t iSpace        = 0;
-    hid_t iDataset      = 0;
-    hid_t iCompress     = 0;
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    iSpace = DynHDF5::dynH5Screate_simple (1, piDims, NULL);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress = enableCompression(9, 1, piDims);
-    iDataset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_INT32, iSpace, iCompress);
-    if (iDataset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite (iDataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, _piData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(iDataset, g_SCILAB_CLASS, g_SCILAB_CLASS_INT);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addAttribute(iDataset, g_SCILAB_CLASS_PREC, "32");
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_rows to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (iDataset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int writeInteger64Matrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, long long* _pllData)
-{
-    hsize_t piDims[1]   = {_iRows * _iCols};
-    herr_t status       = 0;
-    hid_t iSpace        = 0;
-    hid_t iDataset      = 0;
-    hid_t iCompress     = 0;
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    iSpace = DynHDF5::dynH5Screate_simple (1, piDims, NULL);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress = enableCompression(9, 1, piDims);
-    iDataset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_INT64, iSpace, iCompress);
-    if (iDataset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite (iDataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pllData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(iDataset, g_SCILAB_CLASS, g_SCILAB_CLASS_INT);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addAttribute(iDataset, g_SCILAB_CLASS_PREC, "64");
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_rows to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (iDataset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-HDF5_SCILAB_IMPEXP int writeUnsignedInteger8Matrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, unsigned char* _pucData)
-{
-    hsize_t piDims[1]   = {_iRows * _iCols};
-    herr_t status       = 0;
-    hid_t iSpace        = 0;
-    hid_t iDataset      = 0;
-    hid_t iCompress     = 0;
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    iSpace = DynHDF5::dynH5Screate_simple (1, piDims, NULL);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress    = enableCompression(9, 1, piDims);
-    iDataset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_UINT8, iSpace, iCompress);
-    if (iDataset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite (iDataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pucData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(iDataset, g_SCILAB_CLASS, g_SCILAB_CLASS_INT);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addAttribute(iDataset, g_SCILAB_CLASS_PREC, "u8");
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_rows to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (iDataset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-HDF5_SCILAB_IMPEXP int writeUnsignedInteger16Matrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, unsigned short* _pusData)
-{
-    hsize_t piDims[1]   = {_iRows * _iCols};
-    herr_t status       = 0;
-    hid_t iSpace        = 0;
-    hid_t iDataset      = 0;
-    hid_t iCompress     = 0;
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    iSpace = DynHDF5::dynH5Screate_simple (1, piDims, NULL);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress    = enableCompression(9, 1, piDims);
-    iDataset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_UINT16, iSpace, iCompress);
-    if (iDataset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite (iDataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, _pusData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(iDataset, g_SCILAB_CLASS, g_SCILAB_CLASS_INT);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addAttribute(iDataset, g_SCILAB_CLASS_PREC, "u16");
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_rows to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (iDataset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-HDF5_SCILAB_IMPEXP int writeUnsignedInteger32Matrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, unsigned int* _puiData)
-{
-    hsize_t piDims[1]   = {_iRows * _iCols};
-    herr_t status       = 0;
-    hid_t iSpace        = 0;
-    hid_t iDataset      = 0;
-    hid_t iCompress     = 0;
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    iSpace = DynHDF5::dynH5Screate_simple (1, piDims, NULL);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress = enableCompression(9, 1, piDims);
-    iDataset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_UINT32, iSpace, iCompress);
-    if (iDataset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite (iDataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, _puiData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(iDataset, g_SCILAB_CLASS, g_SCILAB_CLASS_INT);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addAttribute(iDataset, g_SCILAB_CLASS_PREC, "u32");
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_rows to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (iDataset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-HDF5_SCILAB_IMPEXP int writeUnsignedInteger64Matrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, unsigned long long* _pullData)
-{
-    hsize_t piDims[1]   = {_iRows * _iCols};
-    herr_t status       = 0;
-    hid_t iSpace        = 0;
-    hid_t iDataset      = 0;
-    hid_t iCompress     = 0;
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    iSpace = DynHDF5::dynH5Screate_simple (1, piDims, NULL);
-    if (iSpace < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress = enableCompression(9, 1, piDims);
-    iDataset = DynHDF5::dynH5Dcreate (_iFile, _pstDatasetName, H5T_NATIVE_UINT64, iSpace, iCompress);
-    if (iDataset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite (iDataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT,    _pullData);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = double to dataset
-    status = addAttribute(iDataset, g_SCILAB_CLASS, g_SCILAB_CLASS_INT);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addAttribute(iDataset, g_SCILAB_CLASS_PREC, "u64");
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_rows to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class_cols to dataset
-    status = addIntAttribute(iDataset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (iDataset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (iSpace);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    return 0;
-}
-
-int writeCommonSparseComplexMatrix(int _iFile, char* _pstDatasetName, int _iComplex, int _iRows, int _iCols, int _iNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg)
-{
-    hsize_t dims[1]         = {3};
-    herr_t status           = 0;
-    hid_t space             = 0;
-    hid_t dset              = 0;
-    hid_t group             = 0;
-    hid_t iCompress         = 0;
-    hobj_ref_t* pDataRef    = 0;
-
-    char* pstRowPath        = NULL;
-    char* pstColPath        = NULL;
-    char* pstDataPath       = NULL;
-    char* pstGroupName      = NULL;
-
-
-    // Create ref matrix
-    //3 refs : 1 for data, 1 for Number Item by row ( row size ) and 1 for column position
-    pDataRef = (hobj_ref_t *)MALLOC(3 * sizeof(hobj_ref_t));
-
-    // Generate groupname #<dataSetName>#
-    pstGroupName = createGroupName(_pstDatasetName);
-
-    //First create a group to store all referenced objects.
-    group   = DynHDF5::dynH5Gcreate(_iFile, pstGroupName, H5P_DEFAULT);
-    status  = DynHDF5::dynH5Gclose(group);
-
-    //Create each sub dataset and insert data
-    pstRowPath = createPathName(pstGroupName, 0);
-    status = writeInteger32Matrix(_iFile, pstRowPath, 1, _iRows, _piNbItemRow);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Rcreate(&pDataRef[0], _iFile, pstRowPath, H5R_OBJECT, -1);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    pstColPath = createPathName(pstGroupName, 1);
-    status = writeInteger32Matrix(_iFile, pstColPath, 1, _iNbItem, _piColPos);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Rcreate(&pDataRef[1], _iFile, pstColPath, H5R_OBJECT, -1);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    pstDataPath = createPathName(pstGroupName, 2);
-    if (_iComplex)
-    {
-        status = writeDoubleComplexMatrix(_iFile, pstDataPath, 1, _iNbItem, _pdblReal, _pdblImg);
-    }
-    else
-    {
-        status = writeDoubleMatrix(_iFile, pstDataPath, 1, _iNbItem, _pdblReal);
-    }
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Rcreate(&pDataRef[2], _iFile, pstDataPath, H5R_OBJECT, -1);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //FREE group names
-    FREE(pstRowPath);
-    FREE(pstColPath);
-    FREE(pstDataPath);
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    space = DynHDF5::dynH5Screate_simple(1, dims, NULL);
-    if (space < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress   = enableCompression(9, 1, dims);
-    dset        = DynHDF5::dynH5Dcreate(_iFile, _pstDatasetName, H5T_STD_REF_OBJ, space, iCompress);
-    if (dset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite(dset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, pDataRef);
-    if (status < 0)
-    {
-        return -1;
-    }
-    //Add attribute SCILAB_Class = poly to dataset
-    //sprintf(pstRow, "%d", _iRows);
-    //sprintf(pstCol, "%d", _iCols);
-    status = addAttribute(dset, g_SCILAB_CLASS, g_SCILAB_CLASS_SPARSE);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addIntAttribute(dset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addIntAttribute(dset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addIntAttribute(dset, g_SCILAB_CLASS_ITEMS, _iNbItem);
-    if (status < 0)
-    {
-        return -1;
-    }
-    if (_iComplex)
-    {
-        //Add attribute Varname attribute to dataset
-        status = addAttribute(dset, g_SCILAB_CLASS_COMPLEX, "true");
-        if (status < 0)
-        {
-            return -1;
-        }
-    }
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose(dset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose(space);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    FREE(pstGroupName);
-
-    return 0;
-}
-
-int writeSparseMatrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, int _iNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal)
-{
-    return writeCommonSparseComplexMatrix(_iFile, _pstDatasetName, 0, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, NULL);
-}
-
-int writeSparseComplexMatrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, int _iNbItem, int* _piNbItemRow, int* _piColPos, double* _pdblReal, double* _pdblImg)
-{
-    return writeCommonSparseComplexMatrix(_iFile, _pstDatasetName, 1, _iRows, _iCols, _iNbItem, _piNbItemRow, _piColPos, _pdblReal, _pdblImg);
-}
-
-int writeBooleanSparseMatrix(int _iFile, char* _pstDatasetName, int _iRows, int _iCols, int _iNbItem, int* _piNbItemRow, int* _piColPos)
-{
-    int iRet                = 0;
-    hsize_t dims[1]         = {2};
-    herr_t status           = 0;
-    hid_t space             = 0;
-    hid_t dset              = 0;
-    hid_t group             = 0;
-    hid_t iCompress         = 0;
-    hobj_ref_t* pDataRef    = 0;
-
-    char* pstRowPath        = NULL;
-    char* pstColPath        = NULL;
-    char* pstGroupName      = NULL;
-
-
-    // Create ref matrix
-    //2 refs : 1 for data, 1 for Number Item by row ( row size ) and 1 for column position
-    pDataRef = (hobj_ref_t *)MALLOC(2 * sizeof(hobj_ref_t));
-
-    // Generate groupname #<dataSetName>#
-    pstGroupName = createGroupName(_pstDatasetName);
-
-    //First create a group to store all referenced objects.
-    group   = DynHDF5::dynH5Gcreate(_iFile, pstGroupName, H5P_DEFAULT);
-    status  = DynHDF5::dynH5Gclose(group);
-
-    //Create each sub dataset and insert data
-    pstRowPath = createPathName(pstGroupName, 0);
-    status = writeInteger32Matrix(_iFile, pstRowPath, 1, _iRows, _piNbItemRow);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Rcreate(&pDataRef[0], _iFile, pstRowPath, H5R_OBJECT, -1);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    pstColPath  = createPathName(pstGroupName, 1);
-    status      = writeInteger32Matrix(_iFile, pstColPath, 1, _iNbItem, _piColPos);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Rcreate(&pDataRef[1], _iFile, pstColPath, H5R_OBJECT, -1);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-
-    //FREE group names
-    FREE(pstRowPath);
-    FREE(pstColPath);
-
-    //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-    space = DynHDF5::dynH5Screate_simple(1, dims, NULL);
-    if (space < 0)
-    {
-        return -1;
-    }
-
-    //Create the dataset and write the array data to it.
-    iCompress   = enableCompression(9, 1, dims);
-    dset        = DynHDF5::dynH5Dcreate(_iFile, _pstDatasetName, H5T_STD_REF_OBJ, space, iCompress);
-    if (dset < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Dwrite(dset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, pDataRef);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    //Add attribute SCILAB_Class = boolean sparse to dataset
-    status = addAttribute(dset, g_SCILAB_CLASS, g_SCILAB_CLASS_BSPARSE);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addIntAttribute(dset, g_SCILAB_CLASS_ROWS, _iRows);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addIntAttribute(dset, g_SCILAB_CLASS_COLS, _iCols);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = addIntAttribute(dset, g_SCILAB_CLASS_ITEMS, _iNbItem);
-    if (status < 0)
-    {
-        return -1;
-    }
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose(dset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose(space);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    FREE(pstGroupName);
-    FREE(pDataRef);
-
-    return 0;
-}
-
-
-//create a group and create hobj_ref_t array
-void* openList(int _iFile, char* pstDatasetName, int _iNbItem)
-{
-    herr_t status           = 0;
-    hid_t group             = 0;
-    hobj_ref_t* pobjArray   = NULL;
-
-    //First create a group to store all referenced objects.
-    group = DynHDF5::dynH5Gcreate(_iFile, pstDatasetName, H5P_DEFAULT);
-    status = DynHDF5::dynH5Gclose(group);
-    if (status < 0)
-    {
-        return NULL;
-    }
-
-    if (_iNbItem)
-    {
-        pobjArray = (hobj_ref_t*)MALLOC(sizeof(hobj_ref_t) * _iNbItem);
-    }
-
-    return pobjArray;
-}
-
-int addItemInList(int _iFile, void* _pvList, int _iPos, char* _pstItemName)
-{
-    hobj_ref_t* pobjArray = (hobj_ref_t*)_pvList;
-    return DynHDF5::dynH5Rcreate(&pobjArray[_iPos], _iFile, _pstItemName, H5R_OBJECT, -1);
-}
-
-int closeList(int _iFile,  void* _pvList, char* _pstListName, int _iNbItem, int _iVarType)
-{
-    herr_t status           = 0;
-    hsize_t dims[1]         = {_iNbItem};
-    hid_t space             = 0;
-    hid_t dset              = 0;
-    hid_t iCompress         = 0;
-    const char* pcstClass   = NULL;
-
-    switch (_iVarType)
-    {
-        case sci_list :
-            pcstClass = g_SCILAB_CLASS_LIST;
-            break;
-        case sci_tlist :
-            pcstClass = g_SCILAB_CLASS_TLIST;
-            break;
-        case sci_mlist :
-            pcstClass = g_SCILAB_CLASS_MLIST;
-            break;
-        default :
-            return 1;
-    }
-
-    if (_iNbItem == 0)
-    {
-        //tips for empty list
-        //insert a fake refence in the array, value = 0
-
-        hobj_ref_t pvList[1];
-        pvList[0] = 0;
-        //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-
-        dims[0] = 1;
-        space = DynHDF5::dynH5Screate_simple (1, dims, NULL);
-        if (space < 0)
-        {
-            return -1;
-        }
-
-        //Create the dataset and write the array data to it.
-        iCompress = enableCompression(9, 1, dims);
-        dset = DynHDF5::dynH5Dcreate (_iFile, _pstListName, H5T_STD_REF_OBJ, space, iCompress);
-        if (dset < 0)
-        {
-            return -1;
-        }
-
-        status = DynHDF5::dynH5Dwrite (dset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, (hobj_ref_t*)pvList);
-        if (status < 0)
-        {
-            return -1;
-        }
-
-        //Add attribute SCILAB_Class = string to dataset
-        status = addAttribute(dset, g_SCILAB_CLASS,  pcstClass);
-        if (status < 0)
-        {
-            return -1;
-        }
-
-
-        status = addAttribute(dset, g_SCILAB_CLASS_EMPTY, "true");
-        if (status < 0)
-        {
-            return -1;
-        }
-    }
-    else
-    {
-        //Create dataspace.  Setting maximum size to NULL sets the maximum size to be the current size.
-        space = DynHDF5::dynH5Screate_simple (1, dims, NULL);
-        if (status < 0)
-        {
-            return -1;
-        }
-
-        //Create the dataset and write the array data to it.
-        iCompress = enableCompression(9, 1, dims);
-        dset = DynHDF5::dynH5Dcreate (_iFile, _pstListName, H5T_STD_REF_OBJ, space, iCompress);
-        if (dset < 0)
-        {
-            return -1;
-        }
-
-        status = DynHDF5::dynH5Dwrite (dset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, (hobj_ref_t*)_pvList);
-        if (status < 0)
-        {
-            return -1;
-        }
-
-        //Add attribute SCILAB_Class = string to dataset
-        status = addAttribute(dset, g_SCILAB_CLASS,  pcstClass);
-        if (status < 0)
-        {
-            return -1;
-        }
-
-        status = addIntAttribute(dset, g_SCILAB_CLASS_ITEMS, _iNbItem);
-        if (status < 0)
-        {
-            return -1;
-        }
-    }
-
-
-    //Close and release resources.
-    status = DynHDF5::dynH5Dclose (dset);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    status = DynHDF5::dynH5Sclose (space);
-    if (status < 0)
-    {
-        return -1;
-    }
-
-    FREE(_pvList);
-    return 0;
-}
-
index 5a519a8..0ca8fe8 100644 (file)
@@ -61,6 +61,8 @@ libsciio_la_CPPFLAGS = \
     -I$(top_srcdir)/modules/localization/includes/ \
     -I$(top_srcdir)/modules/threads/includes/ \
     -I$(top_srcdir)/modules/dynamic_link/includes \
+    -I$(top_srcdir)/modules/console/includes \
+    -I$(top_srcdir)/modules/hdf5/includes \
     $(EIGEN_CPPFLAGS) \
     $(XML_FLAGS) \
     $(AM_CPPFLAGS)
@@ -90,7 +92,7 @@ modulename=io
 
 #### io : Conf files ####
 libsciio_la_rootdir = $(mydatadir)
-libsciio_la_root_DATA =  license.txt 
+libsciio_la_root_DATA =  license.txt
 
 
 ####io : init scripts ####
index 3b2183e..091691f 100644 (file)
@@ -622,6 +622,8 @@ libsciio_la_CPPFLAGS = \
     -I$(top_srcdir)/modules/localization/includes/ \
     -I$(top_srcdir)/modules/threads/includes/ \
     -I$(top_srcdir)/modules/dynamic_link/includes \
+    -I$(top_srcdir)/modules/console/includes \
+    -I$(top_srcdir)/modules/hdf5/includes \
     $(EIGEN_CPPFLAGS) \
     $(XML_FLAGS) \
     $(AM_CPPFLAGS)
@@ -643,7 +645,7 @@ modulename = io
 
 #### io : Conf files ####
 libsciio_la_rootdir = $(mydatadir)
-libsciio_la_root_DATA = license.txt 
+libsciio_la_root_DATA = license.txt
 
 ####io : init scripts ####
 libsciio_la_etcdir = $(mydatadir)/etc
index 308c44d..50ca6a6 100644 (file)
@@ -952,7 +952,7 @@ function %_sodload(%__filename__, varargin)
         %__loadFunction__ = import_from_hdf5;
         //fileVersion = getScilabFileVersion(%__filename__); // Not needed for the moment
     else
-        %__loadFunction__ = %_load;
+        %__loadFunction__ = load;
     end
 
     //multiple output variables to prevent listinfile prints
index d201b8a..3d19dab 100644 (file)
 */
 
 #include <string.h>
+#include "api_scilab.hxx"
 #include "function.hxx"
+#include "overload.hxx"
+#include "execvisitor.hxx"
 #include "io_gw.hxx"
 #include "string.hxx"
 #include "library.hxx"
@@ -21,6 +24,7 @@ extern "C"
 {
 #include "sci_malloc.h"
 #include "expandPathVariable.h"
+#include "h5_fileManagement.h"
 }
 
 using namespace types;
@@ -28,16 +32,11 @@ using namespace types;
 /*--------------------------------------------------------------------------*/
 Function::ReturnValue sci_load(types::typed_list &in, int _iRetCount, types::typed_list &out)
 {
-    int iXMLFileLen = 0;
-    if (in.size() != 1)
-    {
-        return Function::Error;
-    }
-
     InternalType* pIT = in[0];
 
     if (pIT->isString() == false)
     {
+        Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), "load", 1);
         return Function::Error;
     }
 
@@ -45,17 +44,37 @@ Function::ReturnValue sci_load(types::typed_list &in, int _iRetCount, types::typ
 
     if (pS->isScalar() == false)
     {
+        Scierror(999, _("%s: Wrong type for input argument #%d: Scalar string expected.\n"), "load", 1);
         return Function::Error;
     }
 
-    wchar_t* pstPath = pS->get(0);
-    wchar_t* pwstPath = expandPathVariableW(pstPath);
-    Library* lib = loadlib(pwstPath);
-    FREE(pwstPath);
+    wchar_t* pwstPathLib = expandPathVariableW(pS->get(0));
+    char* pstPath = wide_string_to_UTF8(pwstPathLib);
 
-    if (lib == NULL)
+    if (isHDF5File(pstPath))
     {
-        return Function::Error;
+        FREE(pstPath);
+        FREE(pwstPathLib);
+
+        //call overload
+        std::wstring wstFuncName = L"%_sodload";
+        ast::ExecVisitor* exec = new ast::ExecVisitor();
+        Callable::ReturnValue Ret = Callable::Error;
+        Ret = Overload::call(wstFuncName, in, _iRetCount, out, exec);
+        delete exec;
+        return Ret;
+    }
+    else
+    {
+        Library* lib = loadlib(pwstPathLib);
+        FREE(pstPath);
+        FREE(pwstPathLib);
+
+        if (lib == NULL)
+        {
+            Scierror(999, _("%s: Wrong file type.\n"), "load");
+            return Function::Error;
+        }
     }
 
     return Function::OK;
index 2c56593..f7258ab 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../../../libs/libxml2;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../core/includes;../../../api_scilab/includes;../../../fileio/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../threads/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../../../libs/libxml2;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../core/includes;../../../api_scilab/includes;../../../fileio/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../threads/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../console/includes;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;IO_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../../../libs/libxml2;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../core/includes;../../../api_scilab/includes;../../../fileio/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../threads/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../../../libs/libxml2;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../core/includes;../../../api_scilab/includes;../../../fileio/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../threads/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../console/includes;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;IO_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../../../libs/libxml2;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../core/includes;../../../api_scilab/includes;../../../fileio/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../threads/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../../../libs/libxml2;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../core/includes;../../../api_scilab/includes;../../../fileio/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../threads/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../console/includes;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;IO_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../../../libs/libxml2;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../core/includes;../../../api_scilab/includes;../../../fileio/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../threads/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../src/cpp;../../../../libs/libxml2;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../core/includes;../../../api_scilab/includes;../../../fileio/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../threads/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../console/includes;../../../hdf5/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;IO_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <Project>{4fc72d4a-80ee-4b1a-8724-0201c1a35621}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\hdf5\src\c\hdf5.vcxproj">
+      <Project>{a824ea62-af07-4f43-9036-0e63990556bd}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\localization\src\localization.vcxproj">
       <Project>{ecffeb0c-1eda-45ee-9a10-b18143852e17}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
diff --git a/scilab/test/good/%h_load.sci b/scilab/test/good/%h_load.sci
deleted file mode 100644 (file)
index 386daf5..0000000
+++ /dev/null
@@ -1,1486 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2004 - INRIA - Serge Steer
-// Copyright (C) 2004-2006 - INRIA - Fabrice Leray
-// Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
-// Copyright (C) 2010 - DIGITEO - Manuel Juliachs
-// This file must be used under the terms of the CeCILL.
-// This source file is licensed as described in the file COPYING, which
-// you should have received as part of this distribution.  The terms
-// are also available at
-// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-
-
-function h=%h_load(fd)
-    global init_immediate_drawing
-    init_immediate_drawing = 0;
-
-    version=mget(4,"uc",fd)
-
-    // saving/loading character with 'c' is actually quite buggy
-    characterFormat = "uc";
-
-    immediate_drawing="";
-
-    h=[];
-
-    if is_higher_than([3 1 0 1]) then // case 3 1 0 2 and after
-        hsize = mget(2,characterFormat,fd)
-        for i=1:hsize(1)
-            for j=1:hsize(2)
-                [htmp,immediate_drawing] = load_graphichandle(fd)
-                h = [h htmp];
-            end
-        end
-    else
-        [h,immediate_drawing] = load_graphichandle(fd) // a single handle only can be loaded before 3 1 0 2
-    end
-    f=gcf();
-    f.immediate_drawing = immediate_drawing;
-    clearglobal init_immediate_drawing
-    clear init_immediate_drawing
-endfunction
-
-function [h,immediate_drawing] = load_graphichandle(fd)
-    global init_immediate_drawing
-    typ=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))
-    if typ<>"Figure"
-        f=gcf();
-        if init_immediate_drawing == 0
-            immediate_drawing = f.immediate_drawing;
-            f.immediate_drawing ="off";
-            init_immediate_drawing = 1;
-        end
-    end
-    //  mprintf('----------------------------- %s ----------------------\n',typ)
-    select typ
-    case "Figure"
-        xload_mode = %f;
-
-        // Determines whether %h_load has been called by the xload macro
-        // in which case xload_mode is set to true
-        [lnums, fnames] = where();
-        ind = grep(fnames, "xload");
-
-        if (ind <> []) then
-            xload_mode = %t;
-        end;
-
-        if xload_mode then
-            h=gcf()
-            visible=toggle(mget(1,characterFormat,fd)); // visible
-            figure_position=mget(2,"sl",fd); // figure_position
-            figure_size=mget(2,"sl",fd); // figure_size
-            axes_size=mget(2,"sl",fd); //axes_size
-            if ( is_higher_than([4 1 2 0]) ) then
-                viewport = mget(2,"sl",fd) ; // viewport
-                info_message = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // info_message
-                tag = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // tag
-            end
-            auto_resize=toggle(mget(1,characterFormat,fd)); // auto_resize
-            figure_name=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // figure_name
-            figure_id=mget(1,"sl",fd); // figure_id
-            h.color_map=matrix(mget(mget(1,"il",fd),"dl",fd),-1,3) // color_map
-            pixmap=toggle(mget(1,characterFormat,fd)); // pixmap
-            pixel_drawing_mode=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // pixel_drawing_mode
-            if (is_higher_than([5 1 0 0])) then
-                anti_aliasing=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // anti_aliasing
-            end
-            immediate_drawing=toggle(mget(1,characterFormat,fd));// immediate drawing // init. global variable immediate_drawing
-            h.immediate_drawing = "off";  // set it to 'off' to pass useless redraw due to several 'set' calls
-            h.background=mget(1,"il",fd) // background
-            rotation_style=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // rotation_style
-        else
-            visible=toggle(mget(1,characterFormat,fd)); // visible
-            figure_position=mget(2,"sl",fd); // figure_position
-            // if figure is iconified in old scilab version, its position is -32000, -32000]
-            figure_position = max(figure_position, [0,0]);
-            figure_size=mget(2,"sl",fd); // figure_size
-            axes_size=mget(2,"sl",fd); // axes_size
-            if ( is_higher_than([4 1 2 0]) ) then
-                viewport = mget(2,"sl",fd) ; // viewport
-                info_message = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // info_message
-                tag = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // tag
-            end
-            auto_resize=toggle(mget(1,characterFormat,fd)); // auto_resize
-            figure_name=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // figure_name
-            figure_id=mget(1,"sl",fd); // figure_id
-            // create the figure
-            h=scf(figure_id);
-            h.visible=visible;  // can be set now as we act on immediate_drawing everywhere else F.Leray 18.02.05
-            h.figure_position=figure_position
-            // set auto_resize first otherwise viewport modification may not have any effect.
-            h.auto_resize = auto_resize;
-            h.figure_size = figure_size;
-            // set axes_size last because it's more important than figure_size
-            h.axes_size = axes_size;
-
-            if ( is_higher_than([4 1 2 0]) ) then
-                h.viewport = viewport;
-                h.info_message = info_message ;
-                h.tag = tag ;
-            end
-            h.figure_name=figure_name
-            h.color_map=matrix(mget(mget(1,"il",fd),"dl",fd),-1,3) // color_map
-            h.pixmap=toggle(mget(1,characterFormat,fd)); // pixmap
-            h.pixel_drawing_mode=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // pixel_drawing_mode
-            if (is_higher_than([5 1 0 0])) then
-                h.anti_aliasing=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // anti_aliasing
-            end
-            immediate_drawing=toggle(mget(1,characterFormat,fd)); // immediate_drawing  // init. global variable immediate_drawing
-            h.immediate_drawing = "off"; // set it to 'off' to pass useless redraw due to several 'set' calls
-            h.background=mget(1,"il",fd); // background
-            h.rotation_style = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // rotation_style
-
-        end
-
-        if ( is_higher_than([4 1 2 0]) ) then
-            h.event_handler = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // event_handler
-            h.event_handler_enable = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // event_handler_enable
-        end
-
-        // children
-        n_axes=mget(1,"il",fd);
-        if n_axes==1 then
-            load_graphichandle(fd)
-        else
-            load_graphichandle(fd);
-            for k=2:n_axes
-                xsetech(wrect=[0 0 .1 .1])
-                load_graphichandle(fd)
-            end
-        end
-        load_user_data(fd); // user_data
-    case "Axes"
-        // Hack to determine whether %h_load has been called by the %h_copy macro
-        // in which case a new Axes object is created
-        [lnums, fnames]=where();
-        ind=grep(fnames, "%h_copy");
-
-        if(ind<>[]) then
-            newaxes();
-        end;
-
-        a=gca() ;
-        titl=a.title ;
-        x_label=a.x_label ;
-        y_label=a.y_label ;
-        set(a,"visible"              , toggle(mget(1,characterFormat,fd))) // visible
-        if and(version==[3 0 0 0]) then // axes_visible
-            axes_visible= toggle(mget(1,characterFormat,fd));
-            axes_visible=emptystr(1,3)+axes_visible
-        else
-            axes_visible= toggle(mget(mget(1,characterFormat,fd),characterFormat,fd)) ;
-        end
-
-        if is_higher_than( [3 1 0 1] ) then // axes_reverse
-            axes_reverse = toggle(mget(mget(1,characterFormat,fd),characterFormat,fd)) ;
-        end
-
-        set(a,"axes_visible", axes_visible)
-        set(a,"axes_reverse", axes_reverse)
-        set(a,"grid"        , mget(mget(1,characterFormat,fd),"il",fd)) //grid
-        if (is_higher_than([5 0 3 0])) then
-            set(a,"grid_position",ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))); // grid_position
-        else
-            set(a,"grid_position","background"); // grid_position
-        end
-        set(a,"x_location"  , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // x_location
-        set(a,"y_location"  , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // y_location
-
-        view            =  ascii(mget(2,characterFormat,fd)); // view
-
-        // title
-        set(titl,"visible"   , toggle(mget(1,characterFormat,fd))) // title.visible
-        if is_higher_than( [4 1 2 0] ) then
-            set(titl, "text", load_text_matrix( fd ) ) ;
-        else
-            set(titl,"text"      , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // title.text
-        end
-        if is_higher_than([4 1 2 0]) then
-            set(titl,"font_foreground", mget(1,"il",fd)); // title.font_foreground
-            set(titl,"fractional_font", toggle(mget(1,characterFormat,fd))); //title.fractional_font
-        end
-        set(titl,"foreground", mget(1,"il",fd)); // title.foreground
-        if is_higher_than([3 1 0 0]) then
-            set(titl,"background"       , mget(1,"il",fd)); // title.background
-            set(titl,"fill_mode"        , toggle(mget(1,characterFormat,fd))); //title.fill_mode
-        end
-
-        set(titl,"font_style"       , mget(1,characterFormat,fd)); // title.font_style
-        set(titl,"font_size"        , mget(1,characterFormat,fd)); // title.font_size
-
-        if is_higher_than([3 1 0 0]) then
-            auto_rotation =  toggle(mget(1,characterFormat,fd)) ; // title.auto_rotation
-            set(titl,"font_angle"   , mget(1,"dl",fd)); // title.font_angle
-            auto_position = toggle(mget(1,characterFormat,fd)) ;  // title.auto_position
-            set(titl,"position"     , mget(2,"dl",fd)); // title.position
-            set( titl, "auto_rotation", auto_rotation ) ;
-            set( titl, "auto_position", auto_position ) ;
-        end
-
-        // x_label
-        set(x_label,"visible"   , toggle(mget(1,characterFormat,fd))) // x_label.visible
-        if is_higher_than( [4 1 2 0] ) then
-            set(x_label, "text", load_text_matrix( fd ) ) ;
-        else
-            set(x_label,"text"      , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // title.text
-        end
-        if is_higher_than([4 1 2 0]) then
-            set(x_label,"font_foreground", mget(1,"il",fd)); // x_label.font_foreground
-            set(x_label,"fractional_font", toggle(mget(1,characterFormat,fd))); //x_label.fractional_font
-        end
-        set(x_label,"foreground", mget(1,"il",fd)); // x_label.foreground
-        if is_higher_than([3 0 0 0]) then
-            set(x_label,"background"       , mget(1,"il",fd)); // x_label.background
-            set(x_label,"fill_mode"        , toggle(mget(1,characterFormat,fd))); // x_label.fill_mode
-        end
-        set(x_label,"font_style"     , mget(1,characterFormat,fd)); // x_label.font_style
-        set(x_label,"font_size"      , mget(1,characterFormat,fd)); // x_label.font_size
-
-        if is_higher_than([3 0 0 0]) then
-            auto_rotation =  toggle(mget(1,characterFormat,fd)) ; // x_label.auto_rotation
-            set(x_label,"font_angle"   , mget(1,"dl",fd)); // x_label.font_angle
-            auto_position = toggle(mget(1,characterFormat,fd)) ; // x_label.auto_position
-            set( x_label,"position"     , mget(2,"dl",fd)); // x_label.position
-            set( x_label, "auto_rotation", auto_rotation ) ;
-            set( x_label, "auto_position", auto_position ) ;
-        end
-
-        // y_label
-        set(y_label,"visible"        , toggle(mget(1,characterFormat,fd)))
-        if is_higher_than( [4 1 2 0] ) then
-            set(y_label, "text", load_text_matrix( fd ) ) ;
-        else
-            set(y_label,"text"      , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // title.text
-        end
-        if is_higher_than([4 1 2 0]) then
-            set(y_label,"font_foreground", mget(1,"il",fd)); // y_label.font_foreground
-            set(y_label,"fractional_font", toggle(mget(1,characterFormat,fd))); //y_label.fractional_font
-        end
-        set(y_label,"foreground"     , mget(1,"il",fd));
-        if is_higher_than([3 0 0 0]) then
-            set(y_label,"background"       , mget(1,"il",fd));
-            set(y_label,"fill_mode"        , toggle(mget(1,characterFormat,fd)));
-        end
-        set(y_label,"font_style"     , mget(1,characterFormat,fd));
-        set(y_label,"font_size"      , mget(1,characterFormat,fd));
-
-        if is_higher_than([3 0 0 0]) then
-            auto_rotation =  toggle(mget(1,characterFormat,fd)) ; // y_label.auto_rotation
-            set(y_label,"font_angle"   , mget(1,"dl",fd)); // y_label.font_angle
-            auto_position = toggle(mget(1,characterFormat,fd)) ; // y_label.auto_position
-            set( y_label,"position"     , mget(2,"dl",fd)); // y_label.position
-            set( y_label, "auto_rotation", auto_rotation ) ;
-            set( y_label, "auto_position", auto_position ) ;
-        end
-
-        if view=="3d" then
-            // z_label
-            z_label=a.z_label
-            set(z_label,"visible"        , toggle(mget(1,characterFormat,fd)))
-            if is_higher_than( [4 1 2 0] ) then
-                set(z_label, "text", load_text_matrix( fd ) ) ;
-            else
-                set(z_label,"text"      , ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))) // title.text
-            end
-            if is_higher_than([4 1 2 0]) then
-                set(z_label,"font_foreground", mget(1,"il",fd)); // z_label.font_foreground
-                set(z_label,"fractional_font", toggle(mget(1,characterFormat,fd))); //z_label.fractional_font
-            end
-            set(z_label,"foreground"     , mget(1,"il",fd));
-            if is_higher_than([3 0 0 0]) then
-                set(z_label,"background"       , mget(1,"il",fd));
-                set(z_label,"fill_mode"        , toggle(mget(1,characterFormat,fd)));
-            end
-            set(z_label,"font_style"     , mget(1,characterFormat,fd));
-            set(z_label,"font_size"      , mget(1,characterFormat,fd));
-
-            if is_higher_than([3 0 0 0]) then
-                auto_rotation =  toggle(mget(1,characterFormat,fd)) ; // z_label.auto_rotation
-                set(z_label,"font_angle"   , mget(1,"dl",fd)); // z_label.font_angle
-                auto_position = toggle(mget(1,characterFormat,fd)) ; // z_label.auto_position
-                set( z_label,"position"     , mget(2,"dl",fd)); // z_label.position
-                set( z_label, "auto_rotation", auto_rotation ) ;
-                set( z_label, "auto_position", auto_position ) ;
-            end
-        end
-
-
-
-        if is_higher_than([3 0 0 0]) then
-            auto_ticks=toggle(mget(mget(1,characterFormat,fd),characterFormat,fd)); // auto_ticks
-
-            ticks=["ticks","locations","labels"]
-            sz=mget(1,"sl",fd) // x_ticks.locations
-            if sz>0 then
-                x_ticks_locations=mget(sz,"dl",fd)'
-                lz=mget(sz,characterFormat,fd) // x_ticks.label
-                x_ticks_labels=[];for ks=1:sz,x_ticks_labels(ks)=ascii(mget(lz(ks),characterFormat,fd));end
-                set(a,"x_ticks",tlist(ticks,x_ticks_locations,x_ticks_labels))
-            end
-
-            sz=mget(1,"sl",fd) // y_ticks.locations
-            if sz>0 then
-                y_ticks_locations=mget(sz,"dl",fd)'
-                lz=mget(sz,characterFormat,fd) // y_ticks.label
-                y_ticks_labels=[];for ks=1:sz,y_ticks_labels(ks)=ascii(mget(lz(ks),characterFormat,fd));end
-                set(a,"y_ticks",tlist(ticks,y_ticks_locations,y_ticks_labels))
-            end
-
-            sz=mget(1,"sl",fd) // z_ticks.locations
-            if sz>0 then
-                z_ticks_locations=mget(sz,"dl",fd)'
-                lz=mget(sz,characterFormat,fd) // z_ticks.labels
-                z_ticks_labels=[];for ks=1:sz,z_ticks_labels(ks)=ascii(mget(lz(ks),characterFormat,fd));end
-                set(a,"z_ticks",tlist(ticks,z_ticks_locations,z_ticks_labels))
-            end
-            set(a,"auto_ticks"           , auto_ticks)
-        end
-        if is_higher_than([4 1 2 0]) then
-            // migth be now 'off','hidden_axis','back_half' or 'on'
-            boxtype = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ;
-            set( a, "box", boxtype  ) // box
-            set(a,"filled",  toggle(mget(1,characterFormat,fd) )); // filled
-        else
-            set(a, "box", toggle(mget(1,characterFormat,fd) ) ) // box
-        end
-
-        set(a,"sub_tics"             , mget(mget(1,characterFormat,fd),characterFormat,fd)) // sub_tics
-        if ~(is_higher_than([3 1 0 1]) ) then
-            mget(1,"il",fd); // tics_color is removed F.Leray 15.03.05
-        end
-        set(a,"font_style"           , mget(1,characterFormat,fd));  // font_style
-        set(a,"font_size"            , mget(1,characterFormat,fd));  // font_size
-        set(a,"font_color"           , mget(1,"il",fd)); // font_color
-        if is_higher_than([4 1 2 0]) then
-            set(a,"fractional_font", toggle(mget(1,characterFormat,fd))); // fractional_font
-        end
-        set(a,"isoview"              , toggle(mget(1,characterFormat,fd))) // isoview
-
-        cube_scaling    = toggle(mget(1,characterFormat,fd)) // cube_scaling
-        rotation_angles = mget(2,"dl",fd); // rotation_angles
-
-        if a.view=="2d" then
-            set(a,"view"               , view);
-        end
-        if a.view=="3d" then
-            set(a,"cube_scaling"      , cube_scaling)
-            if view=="3d" then
-                set(a,"rotation_angles"   , rotation_angles)
-            end
-        end
-
-        if is_higher_than([3 0 0 0]) then // log_flags
-            log_flags= ascii(mget(3,characterFormat,fd));
-        else
-            log_flags= ascii(mget(2,characterFormat,fd));
-        end
-
-
-        set(a,"tight_limits"         , toggle(mget(1,characterFormat,fd))) // tight_limits
-        data_bounds = matrix(mget(mget(1,characterFormat,fd),"dl",fd),2,-1) // data_bounds
-
-
-        if view=="2d"& a.view=="3d" then
-            data_bounds(2,3)=0;
-        end
-        if xload_mode
-            // check if a had at least a child previously
-            // if not the axes is considered unused
-            // and we don't merge the data_bounds.
-            if a.children <> []  then
-                old_bounds=a.data_bounds;
-                for k=1:size(old_bounds,2)
-                    data_bounds(1,k)=min(data_bounds(1,k),old_bounds(1,k));
-                    data_bounds(2,k)=max(data_bounds(2,k),old_bounds(2,k));
-                end
-            end
-        end
-        if is_higher_than([3 0 0 0]) then
-            zoom_box_size = mget(1,characterFormat,fd);
-            if zoom_box_size<>0 then
-                set(a,"zoom_box"          , mget(zoom_box_size,"dl",fd))  // zoom_box
-            end
-        end
-        if is_higher_than([3 1 0 1]) then
-            set(a,"margins"              , mget(4,"dl",fd))  // margins
-        end
-
-        set(a,"axes_bounds"          , mget(4,"dl",fd))  // axes_bounds
-        set(a,"auto_clear"           , toggle(mget(1,characterFormat,fd))) // auto_clear
-        set(a,"auto_scale"           , toggle(mget(1,characterFormat,fd))) // auto_scale
-
-        if is_higher_than([4 1 2 0] ) then // 4 0 0 0 and after
-            set(a,"hidden_axis_color", mget(1,"il",fd)) ; // hidden_axis_color
-            set(a, "arc_drawing_method", ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))); // arc_drawing_method
-        else
-            set(a, "arc_drawing_method", "nurbs"); // default value, real circle
-        end
-
-        set(a,"hiddencolor"          , mget(1,"il",fd)), // hidden_color
-        set(a,"line_mode"            , toggle(mget(1,characterFormat,fd))), // line_mode
-        set(a,"line_style"           , mget(1,characterFormat,fd)) // line_style
-        set(a,"thickness"            , mget(1,"sl",fd)), // thickness
-        set(a,"mark_mode"            , toggle(mget(1,characterFormat,fd))), //mark_mode
-        set(a,"mark_style"           , mget(1,characterFormat,fd)) // mark_style
-        set(a,"mark_size"            , mget(1,characterFormat,fd)) // mark_size
-        if is_higher_than([3 0 0 0]) then
-
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated" ;
-            else
-                msu="point";
-            end
-
-            set(a,"mark_size_unit"   , msu)
-            set(a,"mark_foreground"      , mget(1,"il",fd)) ; // mark_foreground
-            set(a,"mark_background"      , mget(1,"il",fd)) ; // mark_background
-        else
-            set(a,"mark_size_unit"     , "tabulated")
-        end
-        set(a,"foreground"           , mget(1,"il",fd)), // foreground
-        set(a,"background"           , mget(1,"il",fd)), // background
-        clip_state                   = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then // clip_box
-            set(a,"clip_box",mget(4,"dl",fd)) ;
-        end
-        set(a,"clip_state"           ,clip_state);
-
-        // children
-        nbChildren = mget(1,"il",fd) ;
-        for k = 1 : nbChildren
-            load_graphichandle(fd) ;
-        end
-        //next lines because tools used to rebuild children change the
-        //data_bounds an axes_visible properties
-        set(a,"data_bounds"          , data_bounds) ;
-        set(a,"log_flags"            , log_flags);
-
-        set(a,"axes_visible"          , axes_visible) ;
-        if is_higher_than([4 1 2 0] ) then
-            set(a, "box", boxtype ) ;
-        end
-
-        h=a;
-        load_user_data(fd) ; // user_data
-        global %LEG
-
-        if %LEG<>[] then
-            //get handles from paths
-            links=get_links_from_path(a,%LEG.paths)
-            if links<>[] then
-                L=captions(links,%LEG.text)
-                L.visible         = %LEG.visible
-                L.font_style      = %LEG.font_style
-                L.font_size       = %LEG.font_size
-                L.font_color      = %LEG.font_color
-                L.fractional_font = %LEG.fractional_font
-                L.mark_mode       = "off";
-                L.legend_location = %LEG.legend_location
-                L.position        = %LEG.position
-                L.line_mode       = %LEG.line_mode
-                L.thickness       = %LEG.thickness
-                L.foreground      = %LEG.foreground
-                L.fill_mode       = %LEG.fill_mode
-                L.background      = %LEG.background
-                L.clip_state      = %LEG.clip_state
-                if %LEG.clip_state=="on" then
-                    L.clip_box      = %LEG.clip_box
-                end
-                L.user_data       = %LEG.user_data
-            else
-                warning(msprintf(_("%s: Legend does not fit with the current context. Skipped\n"),"load"));
-            end
-        end
-        clearglobal %LEG
-
-    case "Polyline"
-
-        visible=toggle(mget(1,characterFormat,fd)) // visible
-        sz=mget(2,"il",fd); // data
-        data=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        if is_higher_than([3 1 0 0]) then
-            closed      = toggle(mget(1,characterFormat,fd)) // closed
-        end
-        line_mode      = toggle(mget(1,characterFormat,fd)) // line_mode
-        if is_higher_than([3 1 0 0]) then
-            fill_mode      = toggle(mget(1,characterFormat,fd)) // fill_mode
-        end
-        line_style     = mget(1,characterFormat,fd); // line_style
-        thickness      = mget(1,"sl",fd); // thickness
-        if is_higher_than([3 1 0 1]) then
-            arrow_size_factor = mget(1,"sl",fd); // arrow_size_factor
-        end
-        polyline_style = mget(1,characterFormat,fd); // polyline_style
-
-        if is_higher_than([3 1 0 1] ) then
-            size_interp_color = mget(1,"sl",fd) ; // interp_color_vector
-            interp_color_vector = mget( size_interp_color, "dl", fd ) ;
-            interp_color_mode   = toggle( mget( 1, characterFormat, fd ) ) ; // interp_color_mode
-        end
-
-        mark_mode      = toggle(mget(1,characterFormat,fd)) // mark_mode
-        mark_style     = mget(1,characterFormat,fd); // mark_style
-        mark_size      = mget(1,characterFormat,fd); // mark_size
-
-        msu="tabulated"
-        if is_higher_than([3 0 0 0]) then
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated" ;
-            else
-                msu="point";
-            end
-        end
-
-        foreground     = mget(1,"il",fd); // foreground
-
-        if is_higher_than([3 1 0 0]) then
-            background     = mget(1,"il",fd); // background
-        end
-
-        if is_higher_than([3 0 0 0]) then
-            mark_foreground=mget(1,"il",fd) // mark_foreground
-            mark_background=mget(1,"il",fd) // mark_background
-        end
-
-        if is_higher_than([3 1 0 0]) then
-            sz_x_shift=mget(1,"sl",fd) // x_shift
-            x_shift=mget(sz_x_shift,"dl",fd)'
-
-            sz_y_shift=mget(1,"sl",fd) // y_shift
-            y_shift=mget(sz_y_shift,"dl",fd)'
-
-            sz_z_shift=mget(1,"sl",fd) // z_shift
-            z_shift=mget(sz_z_shift,"dl",fd)'
-        end
-
-        if is_higher_than([3 1 0 1]) then
-            bar_width = mget( 1, "dl", fd ) ; // bar_width
-        end
-
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) ; // clip_box
-        else
-            clip_box = [] ;
-        end
-        // draw the polyline and set properties
-        xpoly(data(:,1),data(:,2))
-        //plot2d( data(:,1),data(:,2));
-        h=get("hdl")
-        set(h,"data",data)
-        set(h,"visible",visible)
-        set(h,"line_mode",line_mode),
-        set(h,"line_style",line_style)
-        set(h,"thickness",thickness)
-        set(h,"arrow_size_factor",arrow_size_factor);
-        set(h,"polyline_style",max(1,polyline_style)),
-        set(h,"mark_style",mark_style),
-        set(h,"mark_size",mark_size),
-        set(h,"mark_mode",mark_mode),
-        set(h,"foreground",foreground),
-        if is_higher_than([3 0 0 0]) then
-            set(h,"mark_size_unit",msu)
-            set(h,"mark_foreground",mark_foreground),
-            set(h,"mark_background",mark_background)
-        end
-        if is_higher_than([3 1 0 0]) then
-            set(h,"background",background)
-            set(h,"fill_mode",fill_mode)
-            set(h,"closed",closed);
-            set(h,"x_shift",x_shift);
-            set(h,"y_shift",y_shift);
-            set(h,"z_shift",z_shift);
-        end
-
-        if is_higher_than([3 1 0 1]) then
-            set(h,"interp_color_mode",interp_color_mode);
-            if interp_color_mode == "on" then
-                set(h,"interp_color_vector",interp_color_vector);
-            end
-            set(h,"bar_width",bar_width);
-        end
-
-        if clip_state =="" then clip_state="clipgrf",end
-        if clip_state=="on" then set(h,"clip_box",clip_box),end
-        set(h,"clip_state",clip_state);
-
-        load_user_data(fd) // user_data
-
-    case "Plot3d" then
-        visible=toggle(mget(1,characterFormat,fd)) // visible
-        surface_mode   = toggle(mget(1,characterFormat,fd)) // surface_mode
-        foreground     = mget(1,"il",fd); // foreground
-        thickness      = mget(1,"sl",fd); // thickness
-        mark_mode      = toggle(mget(1,characterFormat,fd)) // mark_mode
-        mark_style     = mget(1,characterFormat,fd); // mark_style
-        mark_size      = mget(1,characterFormat,fd); // mark_size
-
-        if is_higher_than([3 0 0 0]) then
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated" ;
-            else
-                msu="point";
-            end
-            mark_foreground=mget(1,"il",fd) // mark_foreground
-            mark_background=mget(1,"il",fd) // mark_background
-        else
-            msu="tabulated"
-        end
-
-        if is_higher_than([5 1 1 0]) then
-            color_mode     = mget(1,"il",fd); // color_mode
-            color_flag     = mget(1,"il",fd); // color_flag
-        else
-            color_mode     = mget(1,characterFormat,fd);
-            color_flag     = mget(1,characterFormat,fd);
-        end
-
-        sz=mget(2,"il",fd); // data.x
-        x=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.y
-        y=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.z
-        z=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-
-        if or(color_flag==[2,5]) then
-            sz=mget(2,"il",fd); // data.color
-            clr=matrix(mget(prod(sz),"il",fd),sz(1),-1);
-        end
-        hiddencolor    = mget(1,"il",fd); // hidden_color
-
-        // plot3d modify the given rotation angles
-        // trick to force keeping the good rotation angles F.Leray 18.02.05
-        // same issue with axes properties... B.Jofret 21.04.09
-        a=gca();
-        rotation_angles = a.rotation_angles;
-        axes_visible = a.axes_visible;
-        box = a.box;
-        margins = a.margins;
-        x_label_visible = a.x_label.visible;
-        y_label_visible = a.y_label.visible;
-        z_label_visible = a.z_label.visible;
-        x_label_text = a.x_label.text;
-        y_label_text = a.y_label.text;
-        z_label_text = a.z_label.text;
-        axes_isoview = a.isoview;
-
-
-        if or(color_flag==[2 5]) then
-            plot3d1(x,y,list(z,clr))
-        else
-            plot3d(x,y,z)
-        end
-
-        // Restore this properties after plot3d.
-        a.rotation_angles = rotation_angles;
-        a.axes_visible = axes_visible;
-        a.box = box;
-        a.margins = margins;
-        a.x_label.visible = x_label_visible;
-        a.y_label.visible = y_label_visible;
-        a.z_label.visible = z_label_visible;
-        a.x_label.text = x_label_text;
-        a.y_label.text = y_label_text;
-        a.z_label.text = z_label_text;
-        a.isoview = axes_isoview;
-
-
-        h=gce();
-        set(h,"visible",visible)
-        set(h,"surface_mode",surface_mode)
-        set(h,"thickness",thickness)
-        set(h,"foreground",foreground),
-        set(h,"color_mode",color_mode),
-        set(h,"mark_style",mark_style),
-        set(h,"mark_size",mark_size),
-        if is_higher_than([3 0 0 0]) then
-            set(h,"mark_size_unit",msu),
-            set(h,"mark_foreground",mark_foreground),
-            set(h,"mark_background",mark_background)
-        end
-        set(h,"mark_mode",mark_mode)
-        set(h,"color_flag",color_flag),
-        set(h,"hiddencolor",hiddencolor),
-
-        if is_higher_than([4 1 2 0])
-            clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-            if clip_state=="on" then
-                set(h,"clip_box", mget(4,"dl",fd)) // clip_box
-            end
-            set(h,"clip_state",clip_state);
-        end
-
-        load_user_data(fd)
-
-    case "Fac3d" then
-
-        visible=toggle(mget(1,characterFormat,fd)) // visible
-        surface_mode   = toggle(mget(1,characterFormat,fd)) // surface_mode
-        foreground     = mget(1,"il",fd); // foreground
-        thickness      = mget(1,"sl",fd); // thickness
-        mark_mode      = toggle(mget(1,characterFormat,fd)) // mark_mode
-        mark_style     = mget(1,characterFormat,fd); // mark_style
-        mark_size      = mget(1,characterFormat,fd); // mark_size
-        if is_higher_than([3 0 0 0]) then
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated";
-            else
-                msu="point";
-            end
-            mark_foreground=mget(1,"il",fd) ; // mark_foreground
-            mark_background=mget(1,"il",fd) ; // mark_background
-        end
-        if is_higher_than([5 1 1 0]) then
-            color_mode     = mget(1,"il",fd); // color_mode
-            color_flag     = mget(1,"il",fd); // color_flag
-        else
-            color_mode     = mget(1,characterFormat,fd);
-            color_flag     = mget(1,characterFormat,fd);
-        end
-
-        sz=mget(2,"il",fd); // data.x
-        x=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.y
-        y=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.z
-        z=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-
-        if is_higher_than([3 1 0 1]) & color_flag >= 2 then
-            sz=mget(2,"il",fd); // data.z
-            clr=matrix(mget(prod(sz),"il",fd),sz(1),-1);
-
-            if ascii(mget(1,characterFormat,fd)) == "s" then // cdata_mapping
-                cdata_mapping = "scaled" ;
-            else
-                cdata_mapping = "direct"  ;
-            end
-
-        elseif or(color_flag==[2 5]) then
-            // compatibility with old version
-            sz=mget(2,"il",fd); // data.z
-            clr=matrix(mget(prod(sz),"il",fd),sz(1),-1);
-        end
-        hiddencolor    = mget(1,"il",fd); // hiddencolor
-
-        // plot3d modify the given rotation angles
-        // trick to force keeping the good rotation angles F.Leray 18.02.05
-        // same issue with axes properties... B.Jofret 21.04.09
-        // and labels text and isoview
-        a=gca();
-        rotation_angles = a.rotation_angles;
-        axes_visible = a.axes_visible;
-        box = a.box;
-        margins = a.margins;
-        x_label_visible = a.x_label.visible;
-        y_label_visible = a.y_label.visible;
-        z_label_visible = a.z_label.visible;
-        x_label_text = a.x_label.text;
-        y_label_text = a.y_label.text;
-        z_label_text = a.z_label.text;
-        axes_isoview = a.isoview;
-
-        if is_higher_than([3 1 0 1]) & color_flag >= 2 then
-            plot3d1(x,y,list(z,clr))
-        elseif or(color_flag==[2 5]) then
-            plot3d1(x,y,list(z,clr))
-        else
-            plot3d(x,y,z)
-        end
-
-        // Restore this properties after plot3d.
-        a.rotation_angles = rotation_angles;
-        a.axes_visible = axes_visible;
-        a.box = box;
-        a.margins = margins;
-        a.x_label.visible = x_label_visible;
-        a.y_label.visible = y_label_visible;
-        a.z_label.visible = z_label_visible;
-        a.x_label.text = x_label_text;
-        a.y_label.text = y_label_text;
-        a.z_label.text = z_label_text;
-        a.isoview = axes_isoview;
-
-        h=gce();
-        set(h,"visible",visible)
-        set(h,"surface_mode",surface_mode)
-        set(h,"thickness",thickness)
-        set(h,"foreground",foreground),
-        set(h,"color_mode",color_mode),
-        set(h,"color_flag",color_flag),
-        set(h,"hiddencolor",hiddencolor),
-        set(h,"mark_style",mark_style),
-        set(h,"mark_size",mark_size),
-        set(h,"mark_mode",mark_mode)
-        if is_higher_than([3 0 0 0]) then
-            set(h,"mark_size_unit",msu),
-            set(h,"mark_foreground",mark_foreground),
-            set(h,"mark_background",mark_background)
-        end
-
-        if is_higher_than([3 1 0 1]) & color_flag >= 2 then
-            set(h,"cdata_mapping",cdata_mapping);
-        end
-
-        if is_higher_than([4 1 2 0])
-            clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-            if clip_state=="on" then
-                set(h,"clip_box", mget(4,"dl",fd)) // clip_box
-            end
-            set(h,"clip_state",clip_state);
-        end
-
-        load_user_data(fd) ; // user_data
-
-    case "Compound"
-        // children
-        n=mget(1,"il",fd)
-        H=[]
-        for k=1:n
-            htmp = load_graphichandle(fd)
-            H=[htmp H]
-        end
-        h=glue(H)
-        if is_higher_than([3 1 0 1]) then // visible
-            h.visible = toggle(mget(1,characterFormat,fd)) ;
-        end
-
-        load_user_data(fd) // user_data
-
-
-    case "Agregation" // for compatibility with old save
-
-        // children
-        n=mget(1,"il",fd)
-        H=[]
-        for k=1:n
-            htmp = load_graphichandle(fd)
-            H=[htmp H]
-        end
-        h=glue(H)
-
-        if is_higher_than([3 1 0 1]) then // visible
-            h.visible = toggle(mget(1,characterFormat,fd)) ;
-        end
-
-        load_user_data(fd) // user_data
-
-    case "Rectangle"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        thickness      = mget(1,"sl",fd); // thickness
-        mark_mode      = toggle(mget(1,characterFormat,fd)) // mark_mode
-        mark_style     = mget(1,characterFormat,fd); // mark_style
-        mark_size      = mget(1,characterFormat,fd); // mark_size
-        if is_higher_than([3 0 0 0]) then
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated" ;
-            else
-                msu="point";
-            end
-            mark_foreground=mget(1,"il",fd) // mark_foreground
-            mark_background=mget(1,"il",fd) // mark_background
-        else
-            msu="tabulated"
-        end
-
-        line_mode      = toggle(mget(1,characterFormat,fd)) ; // line_mode
-        line_style     = mget(1,characterFormat,fd); // line_style
-        fill_mode      = toggle(mget(1,characterFormat,fd)) ; // fill_mode
-        foreground     = mget(1,"il",fd); // foreground
-
-        if is_higher_than([3 1 0 1]) then
-            background = mget(1,"il",fd); // background
-        end
-        if (is_higher_than([5 0 3 0])) then
-            // data size might be 4 or 5
-            data = mget(mget(1,"il",fd),"dl",fd); // data
-        else
-            parentAxes = gca();
-            if (parentAxes.view == "2d") then
-                data = mget(4,"dl",fd);
-            else
-                data = mget(5,"dl",fd);
-            end
-        end
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ; // clip_stata
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) // clip_box
-        else
-            clip_box=[]
-        end
-
-        // draw the rectangle
-        xrect(0,1,1,1); // create the rectangle with dummy values
-        h=get("hdl")
-        set(h,"data",data);
-        set(h,"visible",visible)
-        set(h,"thickness",thickness)
-        set(h,"mark_style",mark_style),
-        set(h,"mark_size",mark_size),
-        set(h,"mark_size_unit",msu),
-        if is_higher_than([3 0 0 0]) then
-            set(h,"mark_foreground",mark_foreground) ;
-            set(h,"mark_background",mark_background) ;
-        end
-        set(h,"mark_mode",mark_mode)
-        set(h,"line_style",line_style)
-        set(h,"fill_mode",fill_mode)
-        set(h,"foreground",foreground) ;
-        if is_higher_than([3 1 0 1]) then
-            set(h,"background",background) ;
-        end
-        set(h,"line_mode",line_mode)
-        if clip_state=="on" then set(h,"clip_box",clip_box),end
-        set(h,"clip_state",clip_state);
-
-        load_user_data(fd) ; // user_data
-
-    case "Arc"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        thickness      = mget(1,"sl",fd); // thickness
-        line_style     = mget(1,characterFormat,fd);  // line_style
-
-        if is_higher_than([3 1 0 1])
-            line_mode = toggle(mget(1,characterFormat,fd)) ; // line_mode
-        end
-
-        fill_mode      = toggle(mget(1,characterFormat,fd)) // fill_mode
-        foreground     = mget(1,"il",fd); // foreground
-
-        if is_higher_than([3 1 0 1]) then
-            background = mget(1,"il",fd) ; // background
-        end
-
-        if (is_higher_than([5 0 3 0])) then
-            // data size might be 6 or 7
-            data = mget(mget(1,"il",fd),"dl",fd); // data
-        else
-            parentAxes = gca();
-            if (parentAxes.view == "2d") then
-                data = mget(6,"dl",fd);
-            else
-                data = mget(7,"dl",fd);
-            end
-        end
-
-        if is_higher_than([4 1 2 0]) then
-            drawing_method = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // drawing_method
-        else
-            drawing_method = "nurbs";
-        end
-
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) // clip_box
-        else
-            clip_box=[]
-        end
-        xarc(0,1,1,1,0,360); // create the arc dummy values
-        h=get("hdl")
-        if ~is_higher_than([4 1 2 0]) then
-            // angle wass stored by 64th of degree
-            data($) = data($) / 64;
-            data($-1) = data($-1) / 64;
-        end
-        set(h,"data",data);
-        set(h,"visible",visible)
-        set(h,"thickness",thickness)
-        set(h,"line_style",line_style)
-        set(h,"line_mode",line_mode);
-        set(h,"fill_mode",fill_mode)
-        set(h,"foreground",foreground) ;
-        set(h,"background",background) ;
-        set(h,"arc_drawing_method", drawing_method) ;
-        if clip_state=="on" then set(h,"clip_box",clip_box),end
-        set(h,"clip_state",clip_state);
-
-        load_user_data(fd) // user_data
-
-    case "Champ"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        sz=mget(2,"il",fd); // data.x
-        x=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.y
-        y=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.fx
-        fx=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        sz=mget(2,"il",fd); // data.fy
-        fy=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-
-        // draw the champ
-        champ(x,y,fx,fy);
-        h=gce();
-
-        set(h,"visible",visible);
-        set(h,"line_style",mget(1,characterFormat,fd)); // line_style
-        set(h,"thickness",mget(1,"sl",fd)) // thickness
-        set(h,"colored",toggle(mget(1,characterFormat,fd))) // colored
-        set(h,"arrow_size",mget(1,"dl",fd)) // arrow_size
-
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            set(h,"clip_box", mget(4,"dl",fd)) // clip_box
-        end
-        set(h,"clip_state",clip_state);
-        load_user_data(fd) // user_data
-
-    case "Segs"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        sz             = mget(2,"il",fd) // data
-        data           = matrix(mget(prod(sz),"dl",fd),sz(1),-1)
-
-        // draw the segs
-        xsegs(data(:,1),data(:,2))
-        h=gce()
-        if size(data,2)==3 then
-            h.data=data
-        end
-        set(h,"visible",visible);
-        set(h,"line_mode" ,toggle(mget(1,characterFormat,fd))) // line_mode
-        set(h,"line_style",mget(1,characterFormat,fd)); // line_style
-        set(h,"thickness",mget(1,"sl",fd)) // thickness
-        set(h,"arrow_size",mget(1,"dl",fd)) // arrow_size
-
-        n=mget(1,"il",fd) // segs_color
-        set(h,"segs_color",mget(n,"il",fd))
-        // it is needed to set it at the end, ut I don't know why
-        mark_mode = toggle(mget(1,characterFormat,fd)) ; // mark_mode
-        set(h,"mark_style"           , mget(1,characterFormat,fd)) // mark_style
-        set(h,"mark_size"            , mget(1,characterFormat,fd)) // mark_size
-        if is_higher_than([3 0 0 0]) then
-            if ascii(mget(1,characterFormat,fd))=="t" then // mark_size_unit
-                msu="tabulated"
-            else
-                msu="point";
-            end
-            set(h,"mark_size_unit"     , msu) ;
-            set(h,"mark_foreground"    , mget(1,"il",fd)) ; // mark_foreground
-            set(h,"mark_background"    , mget(1,"il",fd)) ; // mark_background
-        else
-            set(h,"mark_size_unit"     , "tabulated") ; // mark_size_unit
-        end
-
-        set(h,"mark_mode", mark_mode ) ;
-
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            set(h,"clip_box", mget(4,"dl",fd)) // clip_box
-        end
-        set(h,"clip_state",clip_state);
-        load_user_data(fd) // user_data
-
-    case "Grayplot"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        if is_higher_than([3 0 0 0]) then
-            sz=mget(2,"il",fd); // data.x
-            x=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-            sz=mget(2,"il",fd); // data.y
-            y=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-            sz=mget(2,"il",fd); // data.z
-            z=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        else
-            sz = mget(2,"il",fd) // data
-            data = matrix(mget(prod(sz),"dl",fd),sz(1),-1)
-        end
-
-        data_mapping   = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // data_mapping
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) // clip_box
-        else
-            clip_box=[]
-        end
-
-        // draw the grayplot
-        if is_higher_than([3 0 0 0]) then
-            grayplot(x,y,z)
-        else
-            grayplot(data(2:$,1),data(1,2:$),data(2:$,2:$))
-        end
-
-        h=get("hdl")
-        set(h,"visible",visible)
-        set(h,"data_mapping",data_mapping)
-        if clip_state=="on" then
-            set(h,"clip_box",  clip_box)
-        end
-        set(h,"clip_state",clip_state);
-
-        load_user_data(fd) // user_data
-
-    case "Matplot"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        sz=mget(2,"il",fd); // data
-        data=matrix(mget(prod(sz),"dl",fd),sz(1),-1);
-        //    data_mapping   = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) // clip_box
-        else
-            clip_box=[]
-        end
-
-        // draw the matplot
-        Matplot(data);
-
-        h=get("hdl")
-        set(h,"visible",visible)
-        //    set(h,"data_mapping",data_mapping)
-        if clip_state=="on" then
-            set(h,"clip_box",  clip_box)
-        end
-        set(h,"clip_state",clip_state);
-        // user_data
-        load_user_data(fd)
-
-    case "Fec"
-        visible        = toggle(mget(1,characterFormat,fd)) // visible
-        sz             = mget(2,"il",fd) // data
-        data           = matrix(mget(prod(sz),"dl",fd),sz(1),-1)
-        sz             = mget(2,"il",fd) // triangles
-        triangles      = matrix(mget(prod(sz),"dl",fd),sz(1),-1)
-        z_bounds       = mget(2,"dl",fd) // z_bounds
-        // draw the fec
-        fec(data(:,1),data(:,2),triangles,data(:,3))
-        h=unglue(get("hdl"))
-        set(h,"visible",visible)
-        set(h,"z_bounds",z_bounds)
-        if is_higher_than( [5 0 3 0] ) then
-            set(h,"color_range",mget(2,"dl",fd)); // color_range
-            set(h,"outside_colors",mget(2,"dl",fd)); // color_range
-            set(h,"line_mode" ,toggle(mget(1,characterFormat,fd))) // line_mode
-            set(h,"foreground", mget(1,"il",fd)); // foreground
-        end
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            set(h,"clip_box", mget(4,"dl",fd)) // clip_box
-        end
-        set(h,"clip_state",clip_state);
-        load_user_data(fd) // user_data
-
-    case "Legend"
-        if is_higher_than( [5 0 0 0] ) then
-            global %LEG
-            %LEG=[];
-            %LEG.visible         = toggle(mget(1,characterFormat,fd)) // visible
-            %LEG.text            = load_text_vector(fd); // text
-            %LEG.font_style      = mget(1,characterFormat,fd); // font_style
-            %LEG.font_size       = mget(1,characterFormat,fd); // font_size
-            %LEG.font_color      = mget(1,"il",fd); // font_size
-            %LEG.fractional_font = toggle(mget(1,characterFormat,fd)); // fractional_font
-            nlegends             = mget(1,characterFormat,fd);
-            paths = list()
-            for kl=1:nlegends
-                paths($+1)         = mget(mget(1,"il",fd),"il",fd);
-            end
-            %LEG.paths           = paths
-            %LEG.legend_location = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd))
-            %LEG.position        = mget(2,"dl",fd)
-            %LEG.line_mode       = toggle(mget(1,characterFormat,fd))
-            %LEG.thickness       = mget(1,"sl",fd)
-            %LEG.foreground      = mget(1,"il",fd)
-            %LEG.fill_mode       = toggle(mget(1,characterFormat,fd))
-            %LEG.background      = mget(1,"il",fd)
-
-            %LEG.clip_state      = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-            if %LEG.clip_state=="on" then
-                %LEG.clip_box      = mget(4,"dl",fd); // clip_box
-            end
-            load(fd,"user_data")
-            %LEG.user_data       = user_data;
-        else
-            visible         = toggle(mget(1,characterFormat,fd)) // visible
-            line_mode       = toggle(mget(1,characterFormat,fd)) // line_mode
-            mark_mode       = toggle(mget(1,characterFormat,fd)) // mark_mode
-            mark_foreground = mget(1,"il",fd) ; // mark_foreground
-            mark_background = mget(1,"il",fd) ; // mark_background
-
-            //text=ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // text
-
-            text = load_text_vector(fd); // text
-
-            //create the legend
-            //get the number of lines of the legend
-            lineFeedPosition = strindex(text,"@")
-            nbLines = size( lineFeedPosition ) ;
-            nbLines = nbLines(2) + 1
-            //create as many curves as lines in the text
-            nullVector = zeros(1,nbLines);
-            //draw the legend
-            plot2d(0,nullVector,leg=text) ;
-            H=unglue(get("hdl"));
-            h=H(1);
-            delete(H(2));
-
-            set(h,"visible",visible)
-            set(h,"line_mode",line_mode);
-            set(h,"mark_mode",mark_mode);
-            set(h,"mark_foreground",mark_foreground) ;
-            set(h,"mark_background",mark_background) ;
-            set(h,"foreground", mget(1,"il",fd)); // foreground
-
-            set(h,"font_style", mget(1,characterFormat,fd)); // font_style
-            set(h,"font_size" , mget(1,characterFormat,fd)); // font_size
-            if is_higher_than( [4 1 2 0] ) then
-                set(h,"fractional_font" , toggle(mget(1,characterFormat,fd))); // fractional_font
-            end
-            clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-            if clip_state=="on" then
-                set(h,"clip_box",mget(4,"dl",fd)); // clip_box
-            end
-            set(h,"clip_state",clip_state);
-        end
-
-    case "Text"
-        visible         = toggle(mget(1,characterFormat,fd)) // visible
-
-        if is_higher_than( [4 1 2 0] ) then
-            text            = load_text_matrix( fd ) ;
-        else
-            text            = load_text_vector(fd) // text
-        end
-        sz              = mget(2,characterFormat,fd)
-        data            = matrix(mget(prod(sz),"dl",fd),sz(1),-1) // data
-        text_box        = mget(2,"dl",fd) // text_box
-        text_box_mode   = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)); // text_box_mode
-
-        // draw the text
-        if text_box_mode == "off" then
-            xstring(data(1),data(2),text)
-        else
-            xstringb(data(1),data(2),text,text_box(1),text_box(2))
-        end
-
-        h=get("hdl");
-        set(h,"data",data);
-        set(h,"visible",visible) ;
-        set(h,"text_box_mode",text_box_mode)
-        set(h,"foreground"           , mget(1,"il",fd)); // foreground
-        set(h,"font_style"           , mget(1,characterFormat,fd)); // font_style
-
-        if text_box_mode == "filled" then // font_size
-            mget(1,characterFormat,fd) ;
-        else
-            set(h,"font_size", mget(1,characterFormat,fd));
-        end
-
-        set(h,"font_angle"           , mget(1,"dl",fd)); // font_angle
-
-        //adding JB Silvy 28/11/05
-        // box drawing
-        if is_higher_than([3 1 0 1]) then
-            set( h, "box"      , toggle( mget( 1, characterFormat, fd ) ) ) ; // box
-            set( h, "line_mode", toggle( mget( 1, characterFormat, fd ) ) ) ; // line_mode
-            set( h, "fill_mode", toggle( mget( 1, characterFormat, fd ) ) ) ; // fill_mode
-
-            set( h, "font_foreground", mget( 1, "il", fd ) ) ; // font_foreground
-            set( h, "background"     , mget( 1, "il", fd ) ) ; // background
-        end
-
-        if is_higher_than( [4 1 2 0] ) then
-            set( h, "alignment", ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)  ) ) ; // alignment
-            set( h, "fractional_font", toggle( mget( 1, characterFormat, fd ) ) ) ; // fractional_font
-        end
-
-        clip_state     = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-        if clip_state=="on" then
-            clip_box     = mget(4,"dl",fd) // clip_box
-            set(h,"clip_box",clip_box) ; // clip_box
-        else
-            clip_box=[]
-        end
-        set(h,"clip_state",clip_state);
-        load_user_data(fd) // user_data
-    case "Axis"
-        if is_higher_than([3 1 0 0]) then
-
-            visible          = toggle(mget(1,characterFormat,fd)) // visible
-            n                = mget(1,"il",fd) // tics_direction
-            tics_direction   = ascii(mget(n,characterFormat,fd));
-            nx               = mget(1,"il",fd) // xtics_coord
-            xtics_coord      = mget(nx,"dl",fd)'
-            ny               = mget(1,"il",fd) // ytics_coord
-            ytics_coord      = mget(ny,"dl",fd)'
-
-            if tics_direction == "bottom" then axisdir="d";
-            elseif tics_direction == "top" then axisdir="u";
-            elseif tics_direction == "left" then axisdir="l";
-            elseif tics_direction == "right" then axisdir="r";
-            elseif nx>1 then axisdir="u";
-            else axisdir="l";
-            end
-
-            drawaxis(x=xtics_coord,y=ytics_coord,dir=axisdir);
-            h=gce()
-
-            h.tics_color       = mget(1,"il",fd) // tics_color
-            h.tics_segment     = toggle(mget(1,characterFormat,fd)) // tics_segment
-            h.tics_style       = ascii(mget(1,characterFormat,fd)) // tics_style
-            h.sub_tics         = mget(1,"il",fd) // sub_tics
-            h.tics_labels     = load_text_vector(fd)' // tics_label
-            labelfontsize = mget(1,"il",fd);
-            // Bug fix: there was a bug in Scilab <=4.1.2 which used -1 as default value for labels_font_size
-            // Scilab 5 needs font size to be >= 0 so we change the value to avoid an error message due to a Scilab bug...
-            if labelfontsize == -1 then
-                //labelfontsize = 0;
-            end
-            h.labels_font_size = labelfontsize // label_font_size
-            h.labels_font_color= mget(1,"il",fd); // labels_font_color
-            if is_higher_than( [4 1 2 0] ) then
-                set( h, "fractional_font", toggle( mget( 1, characterFormat, fd ) ) ) ; // fractional_font
-            end
-            // h.tics_style=tics_style // jb Silvy apparently strange
-
-            clip_state       = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) // clip_state
-            if clip_state == "on" then
-                set(h,"clip_box",clip_box)
-            end
-            set(h,"clip_state",clip_state);
-            load_user_data(fd) // user_data
-        end
-
-    case "uimenu"
-        if is_higher_than( [4 1 2 0] ) then
-            h = uimenu("parent", gcf());
-            h.enable = toggle(mget(1,"c",fd)); // Enable
-            ncolors = mget(1,"il",fd); // Foregroundcolor (size)
-            h.foregroundcolor = mget(ncolors,"dl",fd); // ForegroundColor (data)
-            h.label = ascii(mget(mget(1,"c",fd),"c",fd)); // Label
-            h.visible = toggle(mget(1,"c",fd)); // Visible
-            h.callback = ascii(mget(mget(1,"c",fd),"c",fd)); // Callback
-            h.callback_type = mget(1,"il",fd); // Callback Type
-            h.tag = ascii(mget(mget(1,"c",fd),"c",fd)); // Tag
-        end
-        if is_higher_than( [5 1 2 0] ) then // 5.2 and higher
-            h.checked = toggle(mget(1,"c",fd)); // Checked
-        end
-        if is_higher_than( [5 1 1 0] ) then // 5.1.2 and higher
-            // children
-            nbChildren = mget(1,"il",fd) ;
-            for k = 1 : nbChildren
-                htmp = load_graphichandle(fd) ;
-                set(htmp, "Parent", h);
-            end
-        end
-
-    case "uicontextmenu"
-        h = uicontextmenu();
-        // children
-        nbChildren = mget(1,"il",fd) ;
-        for k = 1 : nbChildren
-            htmp = load_graphichandle(fd) ;
-            set(htmp, "Parent", h);
-        end
-
-    case "uicontrol"
-        if is_higher_than( [4 1 2 0] ) then
-            uistyle = ascii(mget(mget(1,"c",fd),"c",fd)); // Style
-            h = uicontrol("parent",gcf(), "style", uistyle);
-            ncolors = mget(1,"il",fd); // BackgroundColor (size)
-            h.backgroundcolor = mget(ncolors,"dl",fd); // BackgroundColor (data)
-            h.enable = toggle(mget(1,"c",fd)); // Enable
-            h.fontangle = ascii(mget(mget(1,"c",fd),"c",fd)); // FontAngle
-            h.fontname = ascii(mget(mget(1,"c",fd),"c",fd)); // FontName
-            fontsize_in_units = mget(1,"dl",fd); // FontSize
-            h.fontunits = ascii(mget(mget(1,"c",fd),"c",fd)); // FontUnits
-            h.fontsize = fontsize_in_units; // FontSize written after 'FontUnits' to avoid them to be computed again
-            h.fontweight = ascii(mget(mget(1,"c",fd),"c",fd)); // FontWeight
-            ncolors = mget(1,"il",fd); // Foregroundcolor (size)
-            h.foregroundcolor = mget(ncolors,"dl",fd); // ForegroundColor (data)
-            h.horizontalalignment = ascii(mget(mget(1,"c",fd),"c",fd)); // HorizontalAlignment
-            ndata = mget(1,"il",fd); // ListboxTop (size)
-            h.listboxtop = mget(ndata,"dl",fd); // ListboxTop (data)
-            h.max = mget(1,"dl",fd); // Max
-            h.min = mget(1,"dl",fd); // Min
-            ndata = mget(1,"il",fd); // Position (size)
-            position_in_units = mget(ndata,"dl",fd); // Position (data)
-            h.relief = ascii(mget(mget(1,"c",fd),"c",fd)); // Relief
-            ndata = mget(1,"il",fd); // SliderStep (size)
-            h.sliderstep = mget(ndata,"dl",fd); // SliderStep (data)
-            h.string = load_text_matrix(fd) ; // String
-            h.units = ascii(mget(mget(1,"c",fd),"c",fd)); // Units
-            h.position = position_in_units; // Position written after 'Units' to avoid them to be computed again
-            ndata = mget(1,"il",fd); // Value (size)
-            h.value = mget(ndata,"dl",fd); // Value (data)
-            h.verticalalignment = ascii(mget(mget(1,"c",fd),"c",fd)); // VerticalAlignment
-            h.visible = toggle(mget(1,"c",fd)); // Visible
-            h.callback = ascii(mget(mget(1,"c",fd),"c",fd)); // Callback
-            h.callback_type = mget(1,"il",fd); // Callback Type
-            load_user_data(fd); // Userdata
-            h.tag = ascii(mget(mget(1,"c",fd),"c",fd)); // Tag
-        end
-
-    else
-        warning("type " +typ+" unhandled");
-    end
-
-endfunction
-
-function r=toggle(k)
-    r=emptystr(k)+"on"
-    r(k==0)="off"
-endfunction
-
-function load_user_data(fd)
-    if is_higher_than([3 1 0 0]) then
-        h; //make a copy of the calling context h here
-        load(fd,"user_data")
-        if user_data<>[] then
-            h.user_data=user_data;
-        end
-    end
-endfunction
-
-function r=is_higher_than(v)
-    //check if current version is strictly higher than the given one
-    r=%f
-    for k=1:4
-        if version(k)>v(k) then r=%t,break,end
-        if version(k)<v(k) then r=%f,break,end
-    end
-endfunction
-
-function text=load_text_vector(fd)
-    T=mget(mget(1,"il",fd),characterFormat,fd)
-    newline=[find(T==10) size(T,"*")+1]
-    text=[]
-    p=1
-    for k=1:size(newline,"*")
-        text=[text;ascii(T(p:newline(k)-1))]
-        p=newline(k)+1
-    end
-endfunction
-
-// retrieve a string matrix saved by save_text_matrix
-function strMat = load_text_matrix( fd )
-    nbRow = mget( 1, "il", fd ) ;
-    nbCol = mget( 1, "il", fd ) ;
-    for i = 1:nbRow
-        for j = 1:nbCol
-            strMat(i,j) = ascii(mget(mget(1,characterFormat,fd),characterFormat,fd)) ;
-        end
-    end
-endfunction
-
-function links=get_links_from_path(ax,paths)
-    //  ax is a  handle on an axes entity
-    //  paths a list or row vector which gives the set of paths relative to
-    //  the axes
-    links=[];ok=%t
-    for p=paths
-        e=ax;
-        p(1)=p(1)-1// the caption does not exists yet
-        for kp=1:size(p,"*"),
-            if or(e.type==["Axes","Compound"])&p(kp)<=size(e.children,"*") then
-                e=e.children(p(kp)),
-            else
-                ok=%f
-                break
-            end
-        end
-        if ~ok then break,end
-        links=[links,e]
-    end
-    if ~ok then links=[],end
-endfunction