SaS hdf5 module 31/3631/2
cedric Delamarre [Thu, 24 Mar 2011 16:37:25 +0000 (17:37 +0100)]
Change-Id: I356540aa92753afd5607b766c1461b4d7db34971

15 files changed:
scilab/Scilab.sln
scilab/etc/modules.xml.in
scilab/etc/modules.xml.vc
scilab/modules/functions_manager/includes/module_declaration.hxx
scilab/modules/functions_manager/src/cpp/funcmanager.cpp
scilab/modules/hdf5/Makefile.am
scilab/modules/hdf5/Makefile.in
scilab/modules/hdf5/includes/gw_hdf5.h
scilab/modules/hdf5/includes/hdf5_gw.hxx [new file with mode: 0644]
scilab/modules/hdf5/sci_gateway/cpp/hdf5_gw.cpp [new file with mode: 0644]
scilab/modules/hdf5/sci_gateway/cpp/sci_export_to_hdf5.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_import_from_hdf5.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_no_hdf5.cpp
scilab/modules/hdf5/src/c/hdf5.vcproj
scilab/modules/types/includes/listundefined.hxx

index 951fa73..5ca285e 100644 (file)
@@ -1171,6 +1171,7 @@ EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hdf5", "modules\hdf5\src\c\hdf5.vcproj", "{A824EA62-AF07-4F43-9036-0E63990556BD}"
        ProjectSection(ProjectDependencies) = postProject
                {ECFFEB0C-1EDA-45EE-9A10-B18143852E17} = {ECFFEB0C-1EDA-45EE-9A10-B18143852E17}
+               {2C60033B-0DBD-4CA4-80D3-176C9BE9CE2F} = {2C60033B-0DBD-4CA4-80D3-176C9BE9CE2F}
                {4FC72D4A-80EE-4B1A-8724-0201C1A35621} = {4FC72D4A-80EE-4B1A-8724-0201C1A35621}
                {8028F371-6A94-4A26-8804-6E7F05F1D1AA} = {8028F371-6A94-4A26-8804-6E7F05F1D1AA}
                {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E} = {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E}
@@ -1178,6 +1179,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hdf5", "modules\hdf5\src\c\
                {43C5BAB1-1DCA-4743-A183-77E0D42FE7D0} = {43C5BAB1-1DCA-4743-A183-77E0D42FE7D0}
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}
                {A5911CD7-F8E8-440C-A23E-4843A0636F3A} = {A5911CD7-F8E8-440C-A23E-4843A0636F3A}
+               {64E090DA-DCB5-4F4D-93D7-E88DDEC9C2EF} = {64E090DA-DCB5-4F4D-93D7-E88DDEC9C2EF}
                {7CA60AEF-9AFA-4D06-AF28-613C0AA27640} = {7CA60AEF-9AFA-4D06-AF28-613C0AA27640}
        EndProjectSection
 EndProject
@@ -1240,6 +1242,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "functions_manager", "module
                {4FC72D4A-80EE-4B1A-8724-0201C1A35621} = {4FC72D4A-80EE-4B1A-8724-0201C1A35621}
                {BAE68B54-2C1A-44D0-A0E9-05156A784E79} = {BAE68B54-2C1A-44D0-A0E9-05156A784E79}
                {0D3FA25B-8116-44EC-A45E-260789DAA3D9} = {0D3FA25B-8116-44EC-A45E-260789DAA3D9}
+               {A824EA62-AF07-4F43-9036-0E63990556BD} = {A824EA62-AF07-4F43-9036-0E63990556BD}
                {719EC179-3AD3-4C6B-BBD8-B44C96B1A204} = {719EC179-3AD3-4C6B-BBD8-B44C96B1A204}
                {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E} = {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E}
                {74D43792-DBFC-47F0-ADBC-4D7A20CDADA2} = {74D43792-DBFC-47F0-ADBC-4D7A20CDADA2}
index 842aca2..15d627a 100644 (file)
@@ -34,5 +34,6 @@
     <module name="jvm" activate="@JAVA_ENABLE@"/>
     <module name="functions" activate="yes"/>
     <module name="helptools" activate="@HELP_ENABLE@"/>
+    <module name="hdf5" activate="yes"/>
 </modules>
 
index 743e7e9..325c93e 100644 (file)
@@ -34,5 +34,6 @@
     <module name="windows_tools" activate="yes"/>
     <module name="jvm" activate="yes"/>
     <module name="helptools" activate="yes"/>
+    <module name="hdf5" activate="yes"/>
 </modules>
 
index c91fd55..6a289cb 100644 (file)
@@ -31,5 +31,6 @@
 #include "../../windows_tools/includes/windows_tools_gw.hxx"
 #include "../../jvm/includes/jvm_gw.hxx"
 #include "../../helptools/includes/helptools_gw.hxx"
+#include "../../hdf5/includes/hdf5_gw.hxx"
 
 #endif /* !__MODULE_DECLARATION_HXX__ */
index 14addfd..eb6de04 100644 (file)
@@ -299,6 +299,7 @@ bool FuncManager::CreateModuleList(void)
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"scinotes", &ScinotesModule::Load));
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"localization", &LocalizationModule::Load));
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"helptools", &HelptoolsModule::Load));
+    m_ModuleMap.insert(pair<wstring, GW_MOD>(L"hdf5", &Hdf5Module::Load));
     if (ConfigVariable::getScilabMode() != SCILAB_NWNI)
     {
         m_ModuleMap.insert(pair<wstring, GW_MOD>(L"jvm", &JvmModule::Load));
index 9c0ec55..48ccc4e 100644 (file)
@@ -36,8 +36,10 @@ endif
 
 GATEWAY_C_SOURCES = sci_gateway/c/gw_hdf5.c
 
-GATEWAY_CPP_SOURCES = sci_gateway/cpp/sci_export_to_hdf5.cpp \
-sci_gateway/cpp/sci_import_from_hdf5.cpp
+GATEWAY_CPP_SOURCES = \
+    sci_gateway/cpp/sci_export_to_hdf5.cpp \
+    sci_gateway/cpp/sci_import_from_hdf5.cpp \
+    sci_gateway/cpp/hdf5_gw.cpp
 
 FORCE_LOAD_SOURCES_DISABLE = src/cpp/forceJHDF5load-jvmdisable.cpp
 
@@ -80,6 +82,10 @@ libscihdf5_la_CPPFLAGS=      -I$(srcdir)/includes/ \
                                -I$(top_srcdir)/modules/fileio/includes \
                                -I$(top_srcdir)/modules/system_env/includes \
                                -I$(top_srcdir)/modules/string/includes \
+                               -I$(top_srcdir)/modules/types/includes \
+                               -I$(top_srcdir)/modules/functions_manager/includes \
+                               -I$(top_srcdir)/modules/symbol/includes \
+                               -I$(top_srcdir)/modules/abstractSyntaxTree/includes \
                                $(JAVA_JNI_INCLUDE) \
                                $(HDF5_CFLAGS)
 
index 9818a24..df4449b 100644 (file)
@@ -160,10 +160,11 @@ libscihdf5_la_DEPENDENCIES = libscihdf5-algo.la \
 am__libscihdf5_la_SOURCES_DIST = sci_gateway/cpp/sci_no_hdf5.cpp \
        sci_gateway/cpp/sci_export_to_hdf5.cpp \
        sci_gateway/cpp/sci_import_from_hdf5.cpp \
-       sci_gateway/c/gw_hdf5.c
+       sci_gateway/cpp/hdf5_gw.cpp sci_gateway/c/gw_hdf5.c
 @HDF5_FALSE@am__objects_5 = libscihdf5_la-sci_no_hdf5.lo
 @HDF5_TRUE@am__objects_5 = libscihdf5_la-sci_export_to_hdf5.lo \
-@HDF5_TRUE@    libscihdf5_la-sci_import_from_hdf5.lo
+@HDF5_TRUE@    libscihdf5_la-sci_import_from_hdf5.lo \
+@HDF5_TRUE@    libscihdf5_la-hdf5_gw.lo
 @HDF5_TRUE@am__objects_6 = libscihdf5_la-gw_hdf5.lo
 am_libscihdf5_la_OBJECTS = $(am__objects_5) $(am__objects_6)
 libscihdf5_la_OBJECTS = $(am_libscihdf5_la_OBJECTS)
@@ -485,8 +486,10 @@ yacc_present = @yacc_present@
 @HDF5_FALSE@GATEWAY_C_SOURCES = 
 @HDF5_TRUE@GATEWAY_C_SOURCES = sci_gateway/c/gw_hdf5.c
 @HDF5_FALSE@GATEWAY_CPP_SOURCES = sci_gateway/cpp/sci_no_hdf5.cpp
-@HDF5_TRUE@GATEWAY_CPP_SOURCES = sci_gateway/cpp/sci_export_to_hdf5.cpp \
-@HDF5_TRUE@sci_gateway/cpp/sci_import_from_hdf5.cpp
+@HDF5_TRUE@GATEWAY_CPP_SOURCES = \
+@HDF5_TRUE@    sci_gateway/cpp/sci_export_to_hdf5.cpp \
+@HDF5_TRUE@    sci_gateway/cpp/sci_import_from_hdf5.cpp \
+@HDF5_TRUE@    sci_gateway/cpp/hdf5_gw.cpp
 
 @HDF5_TRUE@FORCE_LOAD_SOURCES_DISABLE = src/cpp/forceJHDF5load-jvmdisable.cpp
 @HDF5_TRUE@libscihdf5_forceload_la_LDFLAGS = -version-number $(SCILAB_LIBRARY_VERSION) $(LD_FLAGS) $(HDF5_LIBS)
@@ -513,6 +516,10 @@ libscihdf5_la_CPPFLAGS = -I$(srcdir)/includes/ \
                                -I$(top_srcdir)/modules/fileio/includes \
                                -I$(top_srcdir)/modules/system_env/includes \
                                -I$(top_srcdir)/modules/string/includes \
+                               -I$(top_srcdir)/modules/types/includes \
+                               -I$(top_srcdir)/modules/functions_manager/includes \
+                               -I$(top_srcdir)/modules/symbol/includes \
+                               -I$(top_srcdir)/modules/abstractSyntaxTree/includes \
                                $(JAVA_JNI_INCLUDE) \
                                $(HDF5_CFLAGS)
 
@@ -721,6 +728,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihdf5_forceload_la-forceJHDF5load.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihdf5_forceload_la-jhdf5load.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihdf5_la-gw_hdf5.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihdf5_la-hdf5_gw.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihdf5_la-sci_export_to_hdf5.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihdf5_la-sci_import_from_hdf5.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihdf5_la-sci_no_hdf5.Plo@am__quote@
@@ -844,6 +852,13 @@ libscihdf5_la-sci_import_from_hdf5.lo: sci_gateway/cpp/sci_import_from_hdf5.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihdf5_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihdf5_la-sci_import_from_hdf5.lo `test -f 'sci_gateway/cpp/sci_import_from_hdf5.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_import_from_hdf5.cpp
 
+libscihdf5_la-hdf5_gw.lo: sci_gateway/cpp/hdf5_gw.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihdf5_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihdf5_la-hdf5_gw.lo -MD -MP -MF $(DEPDIR)/libscihdf5_la-hdf5_gw.Tpo -c -o libscihdf5_la-hdf5_gw.lo `test -f 'sci_gateway/cpp/hdf5_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/hdf5_gw.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihdf5_la-hdf5_gw.Tpo $(DEPDIR)/libscihdf5_la-hdf5_gw.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/hdf5_gw.cpp' object='libscihdf5_la-hdf5_gw.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihdf5_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihdf5_la-hdf5_gw.lo `test -f 'sci_gateway/cpp/hdf5_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/hdf5_gw.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index 46dda5a..23fa424 100644 (file)
@@ -18,8 +18,7 @@
 /*--------------------------------------------------------------------------*/ 
 HDF5_SCILAB_IMPEXP int gw_hdf5(void);
 /*--------------------------------------------------------------------------*/ 
-HDF5_SCILAB_IMPEXP int sci_export_to_hdf5(char *fname, int* _piKey);
-HDF5_SCILAB_IMPEXP int sci_import_from_hdf5(char *fname, int* _piKey);
 /*--------------------------------------------------------------------------*/ 
 #endif /* __GW_HDF5_H__ */
 /*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/hdf5/includes/hdf5_gw.hxx b/scilab/modules/hdf5/includes/hdf5_gw.hxx
new file mode 100644 (file)
index 0000000..d51576f
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011 - 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 __HDF5_GW_HXX__
+#define __HDF5_GW_HXX__
+
+#include "funcmanager.hxx"
+#include "context.hxx"
+extern "C"
+{
+    #include "dynlib_hdf5_scilab.h"
+}
+class Hdf5Module
+{
+private :
+    Hdf5Module() {};
+    ~Hdf5Module() {};
+
+public :
+       HDF5_SCILAB_IMPEXP static bool Load();
+};
+
+CPP_GATEWAY_PROTOTYPE(sci_export_to_hdf5);
+CPP_GATEWAY_PROTOTYPE(sci_import_from_hdf5);
+
+#endif /* !__FILEIO_GW_HXX__ */
diff --git a/scilab/modules/hdf5/sci_gateway/cpp/hdf5_gw.cpp b/scilab/modules/hdf5/sci_gateway/cpp/hdf5_gw.cpp
new file mode 100644 (file)
index 0000000..964c783
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011 - 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 "hdf5_gw.hxx"
+
+#define MODULE_NAME L"hdf5"
+
+extern "C"
+{
+       #include "gw_fileio.h"
+}
+
+using namespace types;
+
+bool Hdf5Module::Load()
+{
+    symbol::Context::getInstance()->AddFunction(Function::createFunction(L"export_to_hdf5", &sci_export_to_hdf5, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(Function::createFunction(L"import_from_hdf5", &sci_import_from_hdf5, MODULE_NAME));
+    return true;
+}
index 69c771f..eef5597 100644 (file)
 *
 */
 
+#include <stdio.h>
+
+#include "string.hxx"
+#include "int.hxx"
+#include "bool.hxx"
+#include "polynom.hxx"
+#include "tlist.hxx"
+#include "mlist.hxx"
+#include "function.hxx"
+#include "funcmanager.hxx"
+#include "hdf5_gw.hxx"
+
 extern "C"
 {
-#include <string.h>
-#include <stdio.h>
-#include "gw_hdf5.h"
-#include "stack-c.h"
 #include "MALLOC.h"
-#include "Scierror.h"
 #include "localization.h"
-#include "sciprint.h"
-#include "api_scilab.h"
+#include "charEncoding.h"
+#include "Scierror.h"
 #include "h5_fileManagement.h"
 #include "h5_writeDataToFile.h"
-#include "freeArrayOfString.h"
-#include "os_strdup.h"
-#include "splitpath.h"
-#include "scicurdir.h"
+#include "sci_types.h"
 }
+
 #include "forceJHDF5load.hxx"
 
 //#define PRINT_DEBUG
 int iLevel = 0;
 
-static bool export_data(int* _piKey, int _iH5File, int *_piVar, char* _pstName);
-static bool export_list(int* _piKey, int _iH5File, int *_piVar, char* _pstName, int _iVarType);
-static bool export_double(int* _piKey, int _iH5File, int *_piVar, char* _pstName);
-static bool export_poly(int* _piKey, int _iH5File, int *_piVar, char* _pstName);
-static bool export_boolean(int* _piKey, int _iH5File, int *_piVar, char* _pstName);
-static bool export_sparse(int* _piKey, int _iH5File, int *_piVar, char* _pstName);
-static bool export_boolean_sparse(int* _piKey, int _iH5File, int *_piVar, char* _pstName);
-static bool export_matlab_sparse(int* _piKey, int *_piVar, char* _pstName);
-static bool export_ints(int* _piKey, int _iH5File, int *_piVar, char* _pstName);
-static bool export_handles(int* _piKey, int *_piVar, char* _pstName);
-static bool export_strings(int* _piKey, int _iH5File, int *_piVar, char* _pstName);
-static bool export_u_function(int* _piKey, int *_piVar, char* _pstName);
-static bool export_c_function(int* _piKey, int *_piVar, char* _pstName);
-static bool export_lib(int* _piKey, int *_piVar, char* _pstName);
-static bool export_lufact_pointer(int* _piKey, int *_piVar, char* _pstName);
-static bool export_void(int* _piKey, int _iH5File, int *_piVar, char* _pstName);
+static bool export_data(int _iH5File, types::InternalType* pIT, wchar_t* _pwstName);
+static bool export_list(int _iH5File, types::InternalType* pIT, wchar_t* _pwstName);
+static bool export_double(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName);
+static bool export_poly(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName);
+static bool export_boolean(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName);
+static bool export_sparse(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName);
+//static bool export_boolean_sparse(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName);
+//static bool export_matlab_sparse(int* _piKey, int *_piVar, char* _pstName);
+static bool export_ints(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName);
+//static bool export_handles(int* _piKey, int *_piVar, char* _pstName);
+static bool export_strings(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName);
+//static bool export_u_function(int* _piKey, int *_piVar, char* _pstName);
+//static bool export_c_function(int* _piKey, int *_piVar, char* _pstName);
+//static bool export_lib(int* _piKey, int *_piVar, char* _pstName);
+//static bool export_lufact_pointer(int* _piKey, int *_piVar, char* _pstName);
+
+static bool export_void(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName);
+
 
 void print_type(char* _pstType);
-int extractVarNameList(int* _piKey, int _iStart, int _iEnd, char** _pstNameList);
+int extractVarNameList(types::typed_list &in, wchar_t** _pstNameList);
 
-static char fname[]                    = "export_to_hdf5";
 /*--------------------------------------------------------------------------*/
-int sci_export_to_hdf5(char *fname, int* _piKey)
+types::Function::ReturnValue sci_export_to_hdf5(types::typed_list &in, int _iRetCount, types::typed_list &out)
 {
-    int iRet            = 0;
-    int iNbVar          = 0;
-    int iLen            = 0;
-    int** piAddrList    = NULL;
-    char* pstFilename   = NULL;
-    char** pstNameList = NULL;
-    bool bExport        = false;
-
-    SciErr sciErr;
-
-    CheckLhs(1,1);//output parameter
+    int iNbVar              = 0;
+    wchar_t** pwstNameList     = NULL;
+    char* pstFileName       = NULL;
+    bool bExport            = false;
 
 #ifndef _MSC_VER
     forceJHDF5load();
 #endif
 
-    /*get input data*/
-    if(Rhs < 2)
-    {
-        Scierror(999,_("%s: Wrong number of input argument(s): At most %d expected.\n"), fname, 2);
-        return 0;
-    }
-
-    pstNameList = (char**)MALLOC(sizeof(char*) * Rhs);
-    iNbVar = extractVarNameList(_piKey, 1, Rhs, pstNameList);
-    if(iNbVar == 0)
-    {
-        FREE(pstNameList);
-        return 0;
-    }
-
-    piAddrList = (int**)MALLOC(sizeof(int*) * (iNbVar - 1));
-    for(int i = 0 ; i < Rhs - 1 ; i++)
-    {
-        sciErr = getVarAddressFromName(_piKey, pstNameList[i + 1], &piAddrList[i]);
-        if(sciErr.iErr)
-        {
-            // i+1 = i for filename + 1 because starting arg number is 1 for human being
-            Scierror(999,_("%s: Wrong value for input argument #%d: Defined variable expected.\n"), fname, i + 2);
-            printError(&sciErr, 0);
-            return 0;
-        }
-    }
-
-    iLevel = 0;
-    // open hdf5 file
-    int iH5File = createHDF5File(pstNameList[0]);
-
-    if(iH5File < 0)
-    {
-        if(iH5File == -2)
-        {
-            Scierror(999, _("%s: Wrong value for input argument #%d: \"%s\" is a directory"), fname, 1, pstNameList[0]);
-        }
-        else
-        {
-            Scierror(999,_("%s: Cannot open file %s.\n"), fname, pstNameList[0]);
-        }
-
-        return 0;
+    if(in.size() < 2)
+    {
+        //error
+        return types::Function::Error;
+    }
+    
+    pwstNameList = (wchar_t**)MALLOC(sizeof(wchar_t*) * in.size());
+    iNbVar = extractVarNameList(in, pwstNameList);
+    if(iNbVar != 0)
+    {
+        //convert UTF16 to UTF8
+        pstFileName = wide_string_to_UTF8(pwstNameList[0]);
+
+        // open hdf5 file
+        int iH5File = createHDF5File(pstFileName);
+        if(iH5File < 0)
+        {
+            if(iH5File == -2)
+            {
+                ScierrorW(999, _W("%ls: Wrong value for input argument #%d: \"%s\" is a directory"), L"export_to_hdf5", 1, pstFileName);
+            }
+            else
+            {
+                ScierrorW(999,_W("%ls: Cannot open file %s.\n"), L"export_to_hdf5", pstFileName);
+            }
+            FREE(pstFileName);
+            FREE(pwstNameList);
+            return types::Function::Error;
+        }
+        
+        for(int i = 0 ; i < in.size() - 1; i++)
+        {
+            types::InternalType* pIT = symbol::Context::getInstance()->get(symbol::Symbol(pwstNameList[i + 1]));
+       
+            bExport = export_data(iH5File, pIT, pwstNameList[i + 1]);
+            if(bExport == false)
+            {
+                break;
+            }
+        }
+        
+        //close hdf5 file
+        closeHDF5File(iH5File);
+    
     }
-
-    // export data
-    for(int i = 0 ; i < Rhs - 1; i++)
-    {
-        bExport = export_data(_piKey, iH5File, piAddrList[i], pstNameList[i + 1]);
-        if(bExport == false)
-        {
-            break;
-        }
-    }
-
-    //close hdf5 file
-    closeHDF5File(iH5File);
-
     //create boolean return value
-    int *piReturn = NULL;
-    sciErr = allocMatrixOfBoolean(_piKey, Rhs + 1, 1, 1, &piReturn);
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 0;
-    }
-
-    if(bExport == true)
-    {
-        piReturn[0] = 1;
-    }
-    else
-    {
-        piReturn[0] = 0;
-    }
-
-    LhsVar(1) = Rhs + 1;
-    PutLhsVar();
-    return 0;
+    types::Bool* pOut = new types::Bool(bExport);
+    out.push_back(pOut);
+    
+    //free allocated memory
+    FREE(pstFileName);
+    FREE(pwstNameList);
+    
+    return types::Function::OK;
 }
 
-static bool export_data(int* _piKey, int _iH5File, int* _piVar, char* _pstName)
+static bool export_data(int _iH5File, types::InternalType* pIT, wchar_t* _pwstName)
 {
     bool bReturn = false;
-    int iType = 0;
 
-    SciErr sciErr = getVarType(_piKey, _piVar, &iType);
-    if(sciErr.iErr)
+    switch(pIT->getType())
     {
-        printError(&sciErr, 0);
-        return false;
-    }
-
-    switch(iType)
-    {
-    case sci_matrix :
+    case types::InternalType::RealDouble :
         {
-            bReturn = export_double(_piKey, _iH5File, _piVar, _pstName);
+            bReturn = export_double(_iH5File, pIT, _pwstName);
             break;
         }
-    case sci_poly :
+   case types::InternalType::RealPoly :
         {
-            bReturn = export_poly(_piKey, _iH5File, _piVar, _pstName);
+            bReturn = export_poly(_iH5File, pIT, _pwstName);
             break;
         }
-    case sci_boolean :
+    case types::InternalType::RealBool :
         {
-            bReturn = export_boolean(_piKey, _iH5File, _piVar, _pstName);
+            bReturn = export_boolean(_iH5File, pIT, _pwstName);
             break;
         }
+        /*
     case sci_sparse :
         {
-            bReturn = export_sparse(_piKey, _iH5File, _piVar, _pstName);
+            bReturn = export_sparse(_iH5File, pIT, _pwstName);
             break;
         }
     case sci_boolean_sparse :
         {
-            bReturn = export_boolean_sparse(_piKey, _iH5File, _piVar, _pstName);
+            bReturn = export_boolean_sparse(_iH5File, pIT, _pwstName);
             break;
         }
     case sci_matlab_sparse :
         {
-            bReturn = export_matlab_sparse(_piKey, _piVar, _pstName);
+            bReturn = export_matlab_sparse(_piKey, _piVar, _pwstName);
             break;
         }
-    case sci_ints :
-        {
-            bReturn = export_ints(_piKey, _iH5File, _piVar, _pstName);
+     */   
+    case types::InternalType::RealInt8 : 
+    case types::InternalType::RealUInt8 : 
+    case types::InternalType::RealInt16 : 
+    case types::InternalType::RealUInt16 : 
+    case types::InternalType::RealInt32 : 
+    case types::InternalType::RealUInt32 : 
+    case types::InternalType::RealInt64 : 
+    case types::InternalType::RealUInt64 : 
+        {
+            bReturn = export_ints(_iH5File, pIT, _pwstName);
             break;
         }
+        /*
     case sci_handles :
         {
-            bReturn = export_handles(_piKey, _piVar, _pstName);
+            bReturn = export_handles(_piKey, _piVar, _pwstName);
             break;
         }
-    case sci_strings :
+        */
+    case types::InternalType::RealString :
         {
-            bReturn = export_strings(_piKey, _iH5File, _piVar, _pstName);
+            bReturn = export_strings(_iH5File, pIT, _pwstName);
             break;
         }
-    case sci_u_function :
+        /*
+    case types::Function : 
         {
-            bReturn = export_u_function(_piKey, _piVar, _pstName);
+            bReturn = export_u_function(_piKey, _piVar, _pwstName);
             break;
         }
     case sci_c_function :
         {
-            bReturn = export_c_function(_piKey, _piVar, _pstName);
+            bReturn = export_c_function(_piKey, _piVar, _pwstName);
             break;
         }
     case sci_lib :
         {
-            bReturn = export_lib(_piKey, _piVar, _pstName);
+            bReturn = export_lib(_piKey, _piVar, _pwstName);
             break;
         }
-    case sci_list :
-    case sci_tlist :
-    case sci_mlist :
+        */
+    case types::InternalType::RealList : 
+    case types::InternalType::RealTList : 
+    case types::InternalType::RealMList : 
         {
-            bReturn = export_list(_piKey, _iH5File, _piVar, _pstName, iType);
+            bReturn = export_list(_iH5File, pIT, _pwstName);
             break;
         }
+        /*
     case sci_lufact_pointer :
         {
-            bReturn = export_lufact_pointer(_piKey, _piVar, _pstName);
+            bReturn = export_lufact_pointer(_piKey, _piVar, _pwstName);
             break;
         }
+        */
     case 0 : //void case to "null" items in list
         {
-            bReturn = export_void(_piKey, _iH5File, _piVar, _pstName);
+            bReturn = export_void(_iH5File, pIT, _pwstName);
             break;
         }
     }
     return bReturn;
 }
 
-static bool export_void(int* _piKey, int _iH5File, int *_piVar, char* _pstName)
+
+static bool export_void(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName)
 {
-    int iRet = writeVoid(_iH5File, _pstName);
+    int iRet = writeVoid(_iH5File, wide_string_to_UTF8(_pwstName));
     if(iRet)
     {
         return false;
@@ -263,9 +245,9 @@ static bool export_void(int* _piKey, int _iH5File, int *_piVar, char* _pstName)
     return true;
 }
 
-static bool export_undefined(int* _piKey, int _iH5File, int *_piVar, char* _pstName)
+static bool export_undefined(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName)
 {
-    int iRet = writeUndefined(_iH5File, _pstName);
+    int iRet = writeUndefined(_iH5File, wide_string_to_UTF8(_pwstName));
     if(iRet)
     {
         return false;
@@ -276,25 +258,16 @@ static bool export_undefined(int* _piKey, int _iH5File, int *_piVar, char* _pstN
     return true;
 }
 
-static bool export_list(int* _piKey, int _iH5File, int *_piVar, char* _pstName, int _iVarType)
-{
+static bool export_list(int _iH5File, types::InternalType* pIT, wchar_t* _pwstName)
+{    
     int iRet        = 0;
+    char* pstName   = wide_string_to_UTF8(_pwstName);
     bool bReturn    = false;
-    int iItemNumber = 0;
-    SciErr sciErr   = getListItemNumber(_piKey, _piVar, &iItemNumber);
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
-    }
-
-
+    
+    types::List* pList = pIT->getAs<types::List>();
+    int iItemNumber = pList->getSize();
     //create groupe name
-    char* pstGroupName = createGroupName(_pstName);
-
-    char pstMsg[256];
-    sprintf(pstMsg, "list (%d)", iItemNumber);
-    print_type(pstMsg);
+    char* pstGroupName = createGroupName(pstName);
 
     iLevel++;
     //open list
@@ -302,74 +275,61 @@ static bool export_list(int* _piKey, int _iH5File, int *_piVar, char* _pstName,
     for(int i = 0 ; i < iItemNumber ; i++)
     {
         int *piNewVar = NULL;
-        getListItemAddress(_piKey, _piVar, i + 1, &piNewVar);//1 indexed
+       // getListItemAddress(_piVar, i + 1, &piNewVar);//1 indexed
+        types::InternalType* pNewIT =  pList->get(i);
         char* pstPathName   = createPathName(pstGroupName, i);
-
-        if(piNewVar == NULL)
+        wchar_t* pwstPathName = to_wide_string(pstPathName);
+        if(pNewIT->isListUndefined())
         {//undefined item
-            bReturn = export_undefined(_piKey, _iH5File, piNewVar, pstPathName);
+            bReturn = export_undefined(_iH5File, pNewIT, pwstPathName);
         }
         else
         {
-            bReturn = export_data(_piKey, _iH5File, piNewVar, pstPathName);
+            bReturn = export_data(_iH5File, pNewIT, pwstPathName);
         }
 
         iRet = addItemInList(_iH5File, pvList, i, pstPathName);
         FREE(pstPathName);
+        FREE(pwstPathName);
+        
         if(bReturn == false || iRet)
             return false;
     }
     iLevel--;
-    closeList(_iH5File, pvList, _pstName, iItemNumber, _iVarType);
+    
+    int type = 0;
+    switch(pIT->getType())
+    {
+    case types::InternalType::RealList : 
+        type = sci_list;
+        break;
+    case types::InternalType::RealTList : 
+        type = sci_tlist;
+        break;
+    case types::InternalType::RealMList : 
+        type = sci_mlist;
+        break;
+    default : return false;
+    }
+    
+    closeList(_iH5File, pvList, pstName, iItemNumber, type);
     FREE(pstGroupName);
     //close list
     return true;
 }
 
-static bool export_double(int* _piKey, int _iH5File, int *_piVar, char* _pstName)
+static bool export_double(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName)
 {
-    int iRet                                   = 0;
-    int iComplex                       = isVarComplex(_piKey, _piVar);
-    int iRows                                  = 0;
-    int iCols                                  = 0;
-    int iType = 0;
-    double *pdblReal   = NULL;
-    double *pdblImg            = NULL;
-
-    SciErr sciErr = getVarType(_piKey, _piVar, &iType);
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
-    }
-
-    if(iType != sci_matrix)
-    {
-        return false;
-    }
-
-    if(iComplex)
-    {
-        sciErr = getComplexMatrixOfDouble(_piKey, _piVar, &iRows, &iCols, &pdblReal, &pdblImg);
-        if(sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return false;
-        }
+    int iRet            = 0;
+    types::Double* pDbl = pIT->getAs<types::Double>();
+    char* pstName       = wide_string_to_UTF8(_pwstName);
 
-        iRet = writeDoubleComplexMatrix(_iH5File, _pstName, iRows, iCols, pdblReal, pdblImg);
-    }
+    if(pDbl->isComplex())
+        iRet = writeDoubleComplexMatrix(_iH5File, pstName, pDbl->getRows(), pDbl->getCols(), pDbl->getReal(), pDbl->getImg());
     else
-    {
-        sciErr = getMatrixOfDouble(_piKey, _piVar, &iRows, &iCols, &pdblReal);
-        if(sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return false;
-        }
-
-        iRet = writeDoubleMatrix(_iH5File, _pstName, iRows, iCols, pdblReal);
-    }
+        iRet = writeDoubleMatrix(_iH5File, pstName, pDbl->getRows(), pDbl->getCols(), pDbl->getReal());
+    
+    FREE(pstName);
 
     if(iRet)
     {
@@ -377,140 +337,74 @@ static bool export_double(int* _piKey, int _iH5File, int *_piVar, char* _pstName
     }
 
     char pstMsg[512];
-    sprintf(pstMsg, "double (%d x %d)", iRows, iCols);
+    sprintf(pstMsg, "double (%d x %d)", pDbl->getRows(), pDbl->getCols());
     print_type(pstMsg);
     return true;
 }
 
-static bool export_poly(int* _piKey, int _iH5File, int *_piVar, char* _pstName)
+static bool export_poly(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName)
 {
-    int iRet                                           = 0;
-    int iRows                                          = 0;
-    int iCols                                          = 0;
-    int* piNbCoef                              = NULL;
-    double** pdblReal          = NULL;
-    double** pdblImg           = NULL;
-    char pstVarName[64]        = {0};
-    int iVarNameLen                    = 0;
-
-    SciErr sciErr = getPolyVariableName(_piKey, _piVar, pstVarName, &iVarNameLen);
-    if(sciErr.iErr)
+    int iRet                = 0;
+    types::Polynom* pPoly   = pIT->getAs<types::Polynom>();
+    char* pstName           = wide_string_to_UTF8(_pwstName);
+    char* varName           = wide_string_to_UTF8(pPoly->getVariableName().c_str());
+    double** real           = NULL;
+    double** img            = NULL;
+    int* nbrCoef            = NULL;
+    int size                = pPoly->getRows()*pPoly->getCols();
+    
+    real = (double**)MALLOC(size*sizeof(double*));
+    nbrCoef = (int*)MALLOC(size*sizeof(int));
+     
+    for(int i=0; i < size; i++)
     {
-        printError(&sciErr, 0);
-        return false;
+        nbrCoef[i] = pPoly->get(i)->getRank();
+        real[i] = pPoly->get(i)->getCoefReal();
     }
 
-    if(isVarComplex(_piKey, _piVar))
+    if(pPoly->isComplex())
     {
-        sciErr = getComplexMatrixOfPoly(_piKey, _piVar, &iRows, &iCols, NULL, NULL, NULL);
-        if(sciErr.iErr)
+        img = (double**)MALLOC(size*sizeof(double*));
+        for(int i=0; i <size; i++)
         {
-            printError(&sciErr, 0);
-            return false;
-        }
-
-        piNbCoef = (int*)MALLOC(iRows * iCols * sizeof(int));
-        sciErr = getComplexMatrixOfPoly(_piKey, _piVar, &iRows, &iCols, piNbCoef, NULL, NULL);
-        if(sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return false;
+            img[i] = pPoly->get(i)->getCoefImg();
         }
 
-        pdblReal = (double**)MALLOC(sizeof(double*) * iRows * iCols);
-        pdblImg = (double**)MALLOC(sizeof(double*) * iRows * iCols);
-        for(int i = 0 ; i < iRows * iCols ; i++)
-        {
-            pdblReal[i] = (double*)MALLOC(sizeof(double) * piNbCoef[i]);// for null termination
-            pdblImg[i] = (double*)MALLOC(sizeof(double) * piNbCoef[i]);// for null termination
-        }
-        sciErr = getComplexMatrixOfPoly(_piKey, _piVar, &iRows, &iCols, piNbCoef, pdblReal, pdblImg);
-        if(sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return false;
-        }
-
-        iRet = writePolyComplexMatrix(_iH5File, _pstName, pstVarName, iRows, iCols, piNbCoef, pdblReal, pdblImg);
+        iRet = writePolyComplexMatrix(_iH5File, pstName, varName , pPoly->getRows(), pPoly->getCols(), nbrCoef, real, img);
+        FREE(img);
     }
     else
     {
-        sciErr = getMatrixOfPoly(_piKey, _piVar, &iRows, &iCols, NULL, NULL);
-        if(sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return false;
-        }
-
-        piNbCoef = (int*)MALLOC(iRows * iCols * sizeof(int));
-        sciErr = getMatrixOfPoly(_piKey, _piVar, &iRows, &iCols, piNbCoef, NULL);
-        if(sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return false;
-        }
-
-        pdblReal = (double**)MALLOC(sizeof(double*) * iRows * iCols);
-        for(int i = 0 ; i < iRows * iCols ; i++)
-        {
-            pdblReal[i] = (double*)MALLOC(sizeof(double) * piNbCoef[i]);// for null termination
-        }
-        sciErr = getMatrixOfPoly(_piKey, _piVar, &iRows, &iCols, piNbCoef, pdblReal);
-        if(sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return false;
-        }
-
-        iRet = writePolyMatrix(_iH5File, _pstName, pstVarName, iRows, iCols, piNbCoef, pdblReal);
+        iRet = writePolyMatrix(_iH5File, pstName, varName, pPoly->getRows(), pPoly->getCols(), nbrCoef, real);
     }
-
+    
+    FREE(nbrCoef);
+    FREE(real);
+    FREE(pstName);
+    FREE(varName);
+    
     if(iRet)
     {
         return false;
     }
-
+/*
     char pstMsg[512];
     sprintf(pstMsg, "poly (%d x %d)", iRows, iCols);
     print_type(pstMsg);
-
-    if(pdblReal)
-    {
-        for(int i = 0 ; i < iRows * iCols ; i++)
-        {
-            FREE(pdblReal[i]);
-        }
-        FREE(pdblReal);
-    }
-
-    if(pdblImg)
-    {
-        for(int i = 0 ; i < iRows * iCols ; i++)
-        {
-            FREE(pdblImg[i]);
-        }
-        FREE(pdblImg);
-    }
-
-    FREE(piNbCoef);
+*/
     return true;
 }
 
-static bool export_boolean(int* _piKey, int _iH5File, int *_piVar, char* _pstName)
+static bool export_boolean(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName)
 {
-    int iRows                                  = 0;
-    int iCols                                  = 0;
-    int *piData                                = NULL;
+    int iRet            = 0;
+    types::Bool* pBool  = pIT->getAs<types::Bool>();
+    char* pstName       = wide_string_to_UTF8(_pwstName);
 
-    //for error management
-    SciErr sciErr = getMatrixOfBoolean(_piKey, _piVar, &iRows, &iCols, &piData);
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 0;
-    }
+    iRet = writeBooleanMatrix(_iH5File, pstName, pBool->getRows(), pBool->getCols(), pBool->get());
+    
+    FREE(pstName);
 
-    int iRet = writeBooleanMatrix(_iH5File, _pstName, iRows, iCols, piData);
     if(iRet)
     {
         //Msg ??
@@ -518,15 +412,15 @@ static bool export_boolean(int* _piKey, int _iH5File, int *_piVar, char* _pstNam
     }
 
     char pstMsg[512];
-    sprintf(pstMsg, "bool (%d x %d)", iRows, iCols);
+    sprintf(pstMsg, "bool (%d x %d)", pBool->getRows(), pBool->getCols());
     print_type(pstMsg);
     return true;
 }
-
-static bool export_boolean_sparse(int* _piKey, int _iH5File, int *_piVar, char* _pstName)
+/*
+static bool export_boolean_sparse(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName)
 {
     int iRet                                           = 0;
-    int iRows                                          = 0;
+    int iRows                                          = 0;InternalType::Real
     int iCols                                          = 0;
     int iNbItem                                        = 0;
     int* piNbCoef                              = NULL;
@@ -552,8 +446,8 @@ static bool export_boolean_sparse(int* _piKey, int _iH5File, int *_piVar, char*
     print_type(pstMsg);
     return true;
 }
-
-static bool export_sparse(int* _piKey, int _iH5File, int *_piVar, char* _pstName)
+/*
+static bool export_sparse(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName)
 {
     int iRet                                           = 0;
     int iRows                                          = 0;
@@ -599,199 +493,144 @@ static bool export_sparse(int* _piKey, int _iH5File, int *_piVar, char* _pstName
     print_type(pstMsg);
     return true;
 }
-
+/*
 static bool export_matlab_sparse(int* _piKey, int *_piVar, char* _pstName)
 {
     print_type(_pstName);
     return true;
 }
-
-static bool export_ints(int* _piKey, int _iH5File, int *_piVar, char* _pstName)
+*/
+static bool export_ints(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName)
 {
-    int iRet                                   = 0;
-    int iRows                                  = 0;
-    int iCols                                  = 0;
-    void *piData                       = NULL;
-    int iPrec                                  = 0;
-
-    SciErr sciErr = getMatrixOfIntegerPrecision(_piKey, _piVar, &iPrec);
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
-    }
+    int iRet            = 0;
+    char* pstName       = wide_string_to_UTF8(_pwstName);
 
-    switch(iPrec)
+    switch(pIT->getType())
     {
-    case SCI_INT8 :
-        sciErr = getMatrixOfInteger8(_piKey, _piVar, &iRows, &iCols, (char**)&piData);
-        if(sciErr.iErr)
+        case types::InternalType::RealInt8 :
         {
-            printError(&sciErr, 0);
-            return false;
+            types::Int8* pInt    = pIT->getAs<types::Int8>();
+            iRet = writeInterger8Matrix(_iH5File, pstName, pInt->getRows(), pInt->getCols(), pInt->get());
+            break;
         }
-        iRet = writeInterger8Matrix(_iH5File, _pstName, iRows, iCols, (char*)piData);
-        break;
-    case SCI_UINT8 :
-        sciErr = getMatrixOfUnsignedInteger8(_piKey, _piVar, &iRows, &iCols, (unsigned char**)&piData);
-        if(sciErr.iErr)
+        case types::InternalType::RealUInt8 :
         {
-            printError(&sciErr, 0);
-            return false;
+            types::UInt8* pInt    = pIT->getAs<types::UInt8>();
+            iRet = writeUnsignedInterger8Matrix(_iH5File, pstName, pInt->getRows(), pInt->getCols(), pInt->get());
+            break;
         }
-        iRet = writeUnsignedInterger8Matrix(_iH5File, _pstName, iRows, iCols, (unsigned char*)piData);
-        break;
-    case SCI_INT16 :
-        sciErr = getMatrixOfInteger16(_piKey, _piVar, &iRows, &iCols, (short**)&piData);
-        if(sciErr.iErr)
+        case types::InternalType::RealInt16 :
         {
-            printError(&sciErr, 0);
-            return false;
+            types::Int16* pInt    = pIT->getAs<types::Int16>();
+            iRet = writeInterger16Matrix(_iH5File, pstName, pInt->getRows(), pInt->getCols(), pInt->get());
+            break;
         }
-        iRet = writeInterger16Matrix(_iH5File, _pstName, iRows, iCols, (short*)piData);
-        break;
-    case SCI_UINT16 :
-        sciErr = getMatrixOfUnsignedInteger16(_piKey, _piVar, &iRows, &iCols, (unsigned short**)&piData);
-        if(sciErr.iErr)
+        case types::InternalType::RealUInt16 : 
         {
-            printError(&sciErr, 0);
-            return false;
+            types::UInt16* pInt    = pIT->getAs<types::UInt16>();
+            iRet = writeUnsignedInterger16Matrix(_iH5File, pstName, pInt->getRows(), pInt->getCols(), pInt->get());
+            break;
         }
-        iRet = writeUnsignedInterger16Matrix(_iH5File, _pstName, iRows, iCols, (unsigned short*)piData);
-        break;
-    case SCI_INT32 :
-        sciErr = getMatrixOfInteger32(_piKey, _piVar, &iRows, &iCols, (int**)&piData);
-        if(sciErr.iErr)
+        case types::InternalType::RealInt32 :
         {
-            printError(&sciErr, 0);
-            return false;
+            types::Int32* pInt    = pIT->getAs<types::Int32>();
+            iRet = writeInterger32Matrix(_iH5File, pstName, pInt->getRows(), pInt->getCols(), pInt->get()); 
+            break;
         }
-        iRet = writeInterger32Matrix(_iH5File, _pstName, iRows, iCols, (int*)piData);
-        break;
-    case SCI_UINT32 :
-        sciErr = getMatrixOfUnsignedInteger32(_piKey, _piVar, &iRows, &iCols, (unsigned int**)&piData);
-        if(sciErr.iErr)
+        case types::InternalType::RealUInt32 : 
         {
-            printError(&sciErr, 0);
-            return false;
+            types::UInt32* pInt    = pIT->getAs<types::UInt32>();
+            iRet = writeUnsignedInterger32Matrix(_iH5File, pstName, pInt->getRows(), pInt->getCols(), pInt->get());
+            break;
         }
-        iRet = writeUnsignedInterger32Matrix(_iH5File, _pstName, iRows, iCols, (unsigned int*)piData);
-        break;
-    case SCI_INT64 :
-        //sciErr = getMatrixOfInteger64(_piVar, &iRows, &iCols, (long long**)&piData);
-        //if(sciErr.iErr)
-        //{
-        //     printError(&sciErr, 0);
-        //     return false;
-        //}
-        //iRet = writeInterger64Matrix(_iH5File, _pstName, iRows, iCols, (long long*)piData);
-        //break;
-    case SCI_UINT64 :
-        //sciErr = getMatrixOfUnsignedInteger64(_piVar, &iRows, &iCols, (unsigned long long**)&piData);
-        //if(sciErr.iErr)
-        //{
-        //     printError(&sciErr, 0);
-        //     return false;
-        //}
-        //iRet = writeUnsignedInterger64Matrix(_iH5File, _pstName, iRows, iCols, (unsigned long long*)piData);
-        //break;
-    default :
-        return 1;
-        break;
+        case types::InternalType::RealInt64 :
+        {
+            types::Int64* pInt    = pIT->getAs<types::Int64>();
+            iRet = writeInterger64Matrix(_iH5File, pstName, pInt->getRows(), pInt->getCols(), pInt->get()); 
+            break;
+        }
+        case types::InternalType::RealUInt64 : 
+        {
+            types::UInt64* pInt    = pIT->getAs<types::UInt64>();
+            iRet = writeUnsignedInterger64Matrix(_iH5File, pstName, pInt->getRows(), pInt->getCols(), pInt->get());
+            break;
+        }
+        default :
+            iRet = true;
     }
 
     if(iRet)
     {
         return false;
     }
-
+/*
     char pstMsg[512];
     sprintf(pstMsg, "int%d (%d x %d)", 8*iPrec, iRows, iCols);
     print_type(pstMsg);
+*/
     return true;
 }
-
+/*
 static bool export_handles(int* _piKey, int *_piVar, char* _pstName)
 {
     print_type(_pstName);
     return true;
 }
-
-static bool export_strings(int* _piKey, int _iH5File, int *_piVar, char* _pstName)
+*/
+static bool export_strings(int _iH5File, types::InternalType* pIT,wchar_t* _pwstName)
 {
-    int iRet                           = 0;
-    int iRows                          = 0;
-    int iCols                          = 0;
-    int* piLen                 = NULL;
-    char** pstData     = NULL;
-
-
-    SciErr sciErr = getMatrixOfString(_piKey, _piVar, &iRows, &iCols, NULL, NULL);
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
-    }
-
-    piLen = (int*)MALLOC(iRows * iCols * sizeof(int));
-    sciErr = getMatrixOfString(_piKey, _piVar, &iRows, &iCols, piLen, NULL);
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
-    }
-
-    pstData = (char**)MALLOC(sizeof(char*) * iRows * iCols);
-    for(int i = 0 ; i < iRows * iCols ; i++)
-    {
-        pstData[i] = (char*)MALLOC(sizeof(char) * (piLen[i] + 1));// for null termination
-    }
-    sciErr = getMatrixOfString(_piKey, _piVar, &iRows, &iCols, piLen, pstData);
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
-    }
-
-    iRet = writeStringMatrix(_iH5File, _pstName, iRows, iCols, pstData);
 
+    int iRet            = 0;
+    types::String* pStr = pIT->getAs<types::String>();
+    char* pstName       = wide_string_to_UTF8(_pwstName);
+    char** pstData      = NULL;
+    
+    pstData = (char**)malloc(pStr->getRows()*pStr->getCols()*sizeof(char*));
+    
+    for(int i=0; i < pStr->getRows()*pStr->getCols(); i++)
+        pstData[i] = wide_string_to_UTF8(pStr->get(i));
+
+    iRet = writeStringMatrix(_iH5File, pstName, pStr->getRows(), pStr->getCols(),pstData);
+    FREE(pstName);
+    FREE(pstData);
+    
     if(iRet)
     {
         return false;
     }
 
     char pstMsg[512];
-    sprintf(pstMsg, "string (%d x %d)", iRows, iCols);
+    sprintf(pstMsg, "string (%d x %d)", pStr->getRows(), pStr->getCols());
     print_type(pstMsg);
 
-    freeArrayOfString(pstData, iRows * iCols);
     return true;
 }
-
+/*
 static bool export_u_function(int* _piKey, int *_piVar, char* _pstName)
 {
     print_type(_pstName);
     return true;
 }
-
+/*
 static bool export_c_function(int* _piKey, int *_piVar, char* _pstName)
 {
     print_type(_pstName);
     return true;
 }
-
+/*
 static bool export_lib(int* _piKey, int *_piVar, char* _pstName)
 {
     print_type(_pstName);
     return true;
 }
-
+/*
 static bool export_lufact_pointer(int* _piKey, int *_piVar, char* _pstName)
 {
     print_type(_pstName);
     return true;
 }
-
+*/
 void print_type(char* _pstType)
 {
 #ifdef PRINT_DEBUG
@@ -803,71 +642,22 @@ void print_type(char* _pstType)
 #endif
 }
 
-int extractVarNameList(int* _piKey, int _iStart, int _iEnd, char** _pstNameList)
+
+int extractVarNameList(types::typed_list &in, wchar_t** _pstNameList)
 {
     int iCount = 0;
 
-    for(int i = _iStart ; i <= _iEnd ; i++)
+    for(int i = 0 ; i < in.size() ; i++)
     {
-        int iRows                                      = 0;
-        int iCols                                      = 0;
-        int iLen                                       = 0;
-        int* piAddr                            = NULL;
-        int iType                                      = 0;
-
-        SciErr sciErr = getVarAddressFromPosition(_piKey, i, &piAddr);
-        if(sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return 0;
-        }
-
-        //get filename
-        sciErr = getVarType(_piKey, piAddr, &iType);
-        if(sciErr.iErr)
+        if(in[i]->isString() == false || in[i]->getAs<types::String>()->isScalar() == false)
         {
-            printError(&sciErr, 0);
-            return 0;
-        }
-
-        if(iType != sci_strings)
-        {
-            Scierror(999,_("%s: Wrong type for input argument #%d: A string expected.\n"), "export_to_hdf5", i);
-            return 0;
-        }
-
-        sciErr = getVarDimension(_piKey, piAddr, &iRows, &iCols);
-        if(sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return 0;
-        }
-
-        if(iRows != 1 || iCols != 1)
-        {
-            Scierror(999,_("%s: Wrong size for input argument #%d: A string expected.\n"), "export_to_hdf5", i);
-            Scierror(999,_("%s: Type: %dx%d\n"), "export_to_hdf5", iRows, iCols);
-            return 0;
-        }
-
-        sciErr = getMatrixOfString(_piKey, piAddr, &iRows, &iCols, &iLen, NULL);
-        if(sciErr.iErr)
-        {
-            printError(&sciErr, 0);
-            return 0;
-        }
-
-        _pstNameList[iCount] = (char*)MALLOC((iLen + 1) * sizeof(char));//+1 for null termination
-        sciErr = getMatrixOfString(_piKey, piAddr, &iRows, &iCols, &iLen, &_pstNameList[iCount]);
-        if(sciErr.iErr)
-        {
-            printError(&sciErr, 0);
+            ScierrorW(999,_W("%ls: Wrong type for input argument #%d: A string expected.\n"), L"export_to_hdf5", i + 1);
             return 0;
         }
 
+        _pstNameList[i] = in[i]->getAs<types::String>()->get(0);
         iCount++;
     }
     return iCount;
 }
-
 /*--------------------------------------------------------------------------*/
index 1ee441c..79a34e8 100644 (file)
@@ -1,6 +1,7 @@
 /*
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2009 - DIGITEO - Antoine ELIAS
+* Copyright (C) 2011 - 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
 *
 */
 
+#include "string.hxx"
+#include "bool.hxx"
+#include "polynom.hxx"
+#include "int.hxx"
+#include "tlist.hxx"
+#include "mlist.hxx"
+#include "function.hxx"
+#include "funcmanager.hxx"
+#include "hdf5_gw.hxx"
+#include "listundefined.hxx"
+
 extern "C"
 {
-#include <hdf5.h>
-#include <string.h>
-#include "gw_hdf5.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "Scierror.h"
+#include "sci_types.h"
 #include "localization.h"
-#include "sciprint.h"
-#include "api_scilab.h"
-#include "../../../call_scilab/includes/call_scilab.h"
+#include "charEncoding.h"
+#include "Scierror.h"
 #include "h5_fileManagement.h"
 #include "h5_readDataFromFile.h"
-#include "intmacr2tree.h"
-#include "stack-def.h"
+#include "api_scilab.h"
 }
+
 #include "forceJHDF5load.hxx"
 
 
@@ -39,86 +45,61 @@ static int iCloseList = 0;
 
 void print_tree(char* _pstMsg);
 
-static bool import_data(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname);
-static bool import_double(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname);
-static bool import_string(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname);
-static bool import_boolean(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname);
-static bool import_integer(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname);
-static bool import_sparse(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname);
-static bool import_boolean_sparse(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname);
-static bool import_poly(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname);
-static bool import_list(int* _piKey, int _iDatasetId, int _iVarType, int _iItemPos, int* _piAddress, char* _pstVarname);
-static bool import_void(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname);
-static bool import_undefined(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname);
-
-int sci_import_from_hdf5(char *fname, int* _piKey)
+static types::InternalType* import_data(int _iDatasetId);
+static types::InternalType* import_double(int _iDatasetId);
+static types::InternalType* import_string(int _iDatasetId);
+static types::InternalType* import_boolean(int _iDatasetId);
+static types::InternalType* import_integer(int _iDatasetId);
+//static types::InternalType* import_sparse(int _iDatasetId);
+//static types::InternalType* import_boolean_sparse(int _iDatasetId);
+static types::InternalType* import_poly(int _iDatasetId);
+static types::InternalType* import_list(int _iDatasetId, int _iVarType);
+//static types::InternalType* import_void(int _iDatasetId);
+static types::InternalType* import_undefined(int _iDatasetId);
+
+types::Function::ReturnValue sci_import_from_hdf5(types::typed_list &in, int _iRetCount, types::typed_list &out)
 {
-    CheckRhs(1,2);
-    CheckLhs(1,1);
-
-    int iRows                                          = 0;
-    int iCols                                          = 0;
-    int iLen                                           = 0;
-    int iType                                          = 0;
-    int* piAddr                                        = NULL;
-    char *pstVarName           = NULL;
-    bool bImport                               = false;
-    SciErr sciErr;
-
+    char* pstFileName       = NULL;
+    int iNbItem             = 0;
+    int iFile               = 0;
+    bool bImport            = false;
+    
 #ifndef _MSC_VER
     forceJHDF5load();
 #endif
 
-    iCloseList = 0;
-    sciErr = getVarAddressFromPosition(_piKey, 1, &piAddr);
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 0;
-    }
-
-    sciErr = getVarDimension(_piKey, piAddr, &iRows, &iCols);
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 0;
-    }
-
-    if(iRows != 1 || iCols != 1)
-    {
-        Scierror(999,_("%s: Wrong size for input argument #%d: A string expected.\n"),fname,2);
-    }
 
-    sciErr = getMatrixOfString(_piKey, piAddr, &iRows, &iCols, &iLen, NULL);
-    if(sciErr.iErr)
+    if(in.size() != 1)
     {
-        printError(&sciErr, 0);
-        return 0;
+        //error
+        return types::Function::Error;
     }
-
-    pstVarName = (char*)MALLOC((iLen + 1) * sizeof(char));
-    sciErr = getMatrixOfString(_piKey, piAddr, &iRows, &iCols, &iLen, &pstVarName);
-    if(sciErr.iErr)
+    
+    if(in[0]->isString() == false || in[0]->getAs<types::String>()->isScalar() == false)
     {
-        printError(&sciErr, 0);
-        return 0;
-    }
-
+        ScierrorW(999,_W("%ls: Wrong type for input argument #%d: A string expected.\n"), L"import_from_hdf5", 1);
+        return types::Function::Error;
+    }   
+    
+    pstFileName = wide_string_to_UTF8(in[0]->getAs<types::String>()->get(0));
+    
     //open hdf5 file
-    int iFile = openHDF5File(pstVarName);
-
+    iFile = openHDF5File(pstFileName);
     if(iFile < 0)
     {
-        Scierror(999, _("%s: Unable to open file: %s\n"), fname, pstVarName);
-        return 0;
-    }
-
-    int iNbItem = 0;
+        ScierrorW(999,_W("%ls: Cannot open file %s.\n"), L"import_to_hdf5", pstFileName);
+        return types::Function::Error;
+    }    
     iNbItem = getVariableNames(iFile, NULL);
     if(iNbItem != 0)
     {
-        char** pstVarNameList = (char**)MALLOC(sizeof(char*) * iNbItem);
+        char** pstVarNameList = (char**)MALLOC(sizeof(char*) * iNbItem);                   
+        wchar_t** pwstVarNameList = (wchar_t**)MALLOC(sizeof(wchar_t*) * iNbItem);
         iNbItem = getVariableNames(iFile, pstVarNameList);
+        for(int i=0; i<iNbItem; i++)
+        {
+            pwstVarNameList[i] = to_wide_string(pstVarNameList[i]);
+        }
 
         //import all data
         for(int i = 0 ; i < iNbItem ; i++)
@@ -126,48 +107,35 @@ int sci_import_from_hdf5(char *fname, int* _piKey)
             int iDataSetId = getDataSetIdFromName(iFile, pstVarNameList[i]);
             if(iDataSetId == 0)
             {
-                return 0;
+                return types::Function::Error;
             }
 
-            bImport = import_data(_piKey, iDataSetId, 0, NULL, pstVarNameList[i]);
-            if(bImport == false)
+            types::InternalType* pIT = import_data(iDataSetId);
+
+            if(pIT == NULL)
             {
                 break;
             }
-
+                      
+            symbol::Context::getInstance()->put(symbol::Symbol(pwstVarNameList[i]), *pIT);
+            bImport = true;
         }
     }
     //close the file
-    closeHDF5File(iFile);
-
-    FREE(pstVarName);
-
-    int *piReturn = NULL;
-    sciErr = allocMatrixOfBoolean(_piKey, Rhs + 1, 1, 1, &piReturn);
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return 0;
-    }
-
-    if(bImport == true)
-    {
-        piReturn[0] = 1;
-    }
-    else
-    {
-        piReturn[0] = 0;
-    }
-
-    LhsVar(1) = Rhs + 1;
-    PutLhsVar();
-
-    // printf("End gateway !!!\n");
-    return 0;
+    closeHDF5File(iFile); 
+    
+    //create boolean return value
+    types::Bool* pOut = new types::Bool(bImport);
+    out.push_back(pOut); 
+      
+    FREE(pstFileName);
+    return types::Function::OK;
 }
 
-static bool import_data(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname)
+//static types::InternalType* import_data(int* _piKey, int _iDatasetId)
+static types::InternalType* import_data(int _iDatasetId)
 {
+    types::InternalType* pIT = NULL;
     bool bRet = false;
     //get var type
     int iVarType = getScilabTypeFromDataSet(_iDatasetId);
@@ -175,54 +143,56 @@ static bool import_data(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAdd
     {
     case sci_matrix :
         {
-            bRet = import_double(_piKey, _iDatasetId, _iItemPos, _piAddress, _pstVarname);
+            pIT = import_double(_iDatasetId);
             break;
         }
     case sci_strings :
         {
-            bRet = import_string(_piKey, _iDatasetId, _iItemPos, _piAddress, _pstVarname);
+            pIT = import_string(_iDatasetId);
             break;
         }
     case sci_list :
     case sci_tlist :
     case sci_mlist :
         {
-            bRet = import_list(_piKey, _iDatasetId, iVarType, _iItemPos, _piAddress, _pstVarname);
+            pIT = import_list(_iDatasetId, iVarType);
             break;
         }
     case sci_boolean :
         {
-            bRet = import_boolean(_piKey, _iDatasetId, _iItemPos, _piAddress, _pstVarname);
+            pIT = import_boolean(_iDatasetId);
             break;
         }
     case sci_poly :
         {
-            bRet = import_poly(_piKey, _iDatasetId, _iItemPos, _piAddress, _pstVarname);
+            pIT = import_poly(_iDatasetId);
             break;
         }
     case sci_ints:
         {
-            bRet = import_integer(_piKey, _iDatasetId, _iItemPos, _piAddress, _pstVarname);
+            pIT = import_integer(_iDatasetId);
             break;
         }
+        /*
     case sci_sparse :
         {
-            bRet = import_sparse(_piKey, _iDatasetId, _iItemPos, _piAddress, _pstVarname);
+            pIT = import_sparse(_piKey, _iDatasetId);
             break;
         }
     case sci_boolean_sparse :
         {
-            bRet = import_boolean_sparse(_piKey, _iDatasetId, _iItemPos, _piAddress, _pstVarname);
+            pIT = import_boolean_sparse(_piKey, _iDatasetId);
             break;
         }
+        */
     case sci_void : //void item only on list variable
         {
-            bRet = import_void(_piKey, _iDatasetId, _iItemPos, _piAddress, _pstVarname);
+            //pIT = import_void(_iDatasetId);
             break;
         }
     case sci_undefined : //undefined item only on list variable
         {
-            bRet = import_undefined(_piKey, _iDatasetId, _iItemPos, _piAddress, _pstVarname);
+            pIT = import_undefined(_iDatasetId);
             break;
         }
     default :
@@ -235,75 +205,48 @@ static bool import_data(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAdd
                 print_tree(pstMsg);
             }
 #endif
+            return NULL;
         }
     }
 
-    return bRet;
+    return pIT;
 }
-
-static bool import_void(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname)
+/*
+static types::InternalType* import_void(int _iDatasetId)
 {
-    SciErr sciErr;
+
     if(_piAddress)
     {
-        sciErr = createVoidInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos);
+        sciErr = createVoidInNamedList(_piKey);
     }
     else
     {
-        return false;
+        return NULL;
     }
 
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
-    }
-    return true;
+    return pVoid;
 }
-
-static bool import_undefined(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname)
+*/
+static types::InternalType* import_undefined(int _iDatasetId)
 {
-    SciErr sciErr;
-    if(_piAddress)
-    {
-        sciErr = createUndefinedInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos);
-    }
-    else
-    {
-        return false;
-    }
-
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
-    }
-    return true;
+    return new types::ListUndefined();
 }
 
-static bool import_double(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname)
+static types::InternalType* import_double(int _iDatasetId)
 {
     int iRet            = 0;
-    double *pdblReal    = NULL;
+    int iComplex        = 0;
+    double *pdblReal    = NULL; 
     double *pdblImg     = NULL;
     int        iRows           = 0;
     int iCols           = 0;
-    int iComplex        = 0;
-    SciErr sciErr;
-
-#ifdef TIME_DEBUG
-    LARGE_INTEGER iStart, iEnd, iFreq;
-    QueryPerformanceFrequency(&iFreq);
-    QueryPerformanceCounter(&iStart);
-#endif
-
+    
     iRet        = getDatasetDims(_iDatasetId, &iRows, &iCols);
     iComplex    = isComplexData(_iDatasetId);
     if(iRet)
     {
-        return false;
-    }
-
+        return NULL;
+    }    
     if(iRows * iCols != 0)
     {
         if(iComplex)
@@ -320,54 +263,26 @@ static bool import_double(int* _piKey, int _iDatasetId, int _iItemPos, int* _piA
 
         if(iRet)
         {
-            return false;
+            return NULL;
         }
     }
     else
     {
-        /*bug 7224 : to close dataset*/
+        //bug 7224 : to close dataset
         iRet    = readEmptyMatrix(_iDatasetId);
         if(iRet)
         {
-            return false;
+            return NULL;
         }
     }
-
-    if(_piAddress == NULL)
-    {
-        if(iComplex)
-        {
-            sciErr             = createNamedComplexMatrixOfDouble(_piKey, _pstVarname, iRows, iCols, pdblReal, pdblImg);
-        }
-        else
-        {
-            sciErr             = createNamedMatrixOfDouble(_piKey, _pstVarname, iRows, iCols, pdblReal);
-        }
-    }
-    else //if not null this variable is in a list
+    
+    types::Double* pDbl = new types::Double(iRows, iCols, iComplex == 0 ? false : true);
+    pDbl->set(pdblReal);
+    if(pDbl->isComplex())
     {
-        if(iComplex)
-        {
-            sciErr             = createComplexMatrixOfDoubleInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pdblReal, pdblImg);
-        }
-        else
-        {
-            sciErr             = createMatrixOfDoubleInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pdblReal);
-        }
-    }
-
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
+        pDbl->setImg(pdblImg);
     }
-
-#ifdef PRINT_DEBUG
-    char pstMsg[512];
-    sprintf(pstMsg, "double_%d (%d x %d)", _iItemPos, iRows, iCols);
-    print_tree(pstMsg);
-#endif
-
+    
     if(pdblReal)
     {
         FREE(pdblReal);
@@ -377,130 +292,64 @@ static bool import_double(int* _piKey, int _iDatasetId, int _iItemPos, int* _piA
     {
         FREE(pdblImg);
     }
+    
+    return pDbl;
 
-    if(iRet)
-    {
-        return false;
-    }
-
-#ifdef TIME_DEBUG
-    QueryPerformanceCounter(&iEnd);
-    double dblTime     =((iEnd.QuadPart - iStart.QuadPart) * 1000.0) / iFreq.QuadPart;
-    printf("Total Double : %0.3f ms\n\n", dblTime);
-#endif
-
-    return true;
 }
 
-static bool import_string(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname)
+static types::InternalType* import_string(int _iDatasetId)
 {
-    int iRet                                           = 0;
-    int i                                                              = 0;
-    int        iRows                                           = 0;
-    int iCols                                          = 0;
-    char **pstData                     = NULL;
-    SciErr sciErr;
-
-#ifdef TIME_DEBUG
-    LARGE_INTEGER iStart1, iEnd1, iStart2, iEnd2, iStart3, iEnd3, iFreq;
-
-    QueryPerformanceFrequency(&iFreq);
-    QueryPerformanceCounter(&iStart1);
-#endif
+    int iRet            = 0;
+    int        iRows           = 0;
+    int iCols           = 0;
+    char **pstData      = NULL;
+    wchar_t** pwstData   = NULL;
+    
     iRet = getDatasetDims(_iDatasetId, &iRows, &iCols);
     if(iRet)
     {
-        return false;
+        return NULL;
     }
-
-
+    
     pstData = (char **) MALLOC(iRows * iCols * sizeof(char*));
-
-#ifdef TIME_DEBUG
-    QueryPerformanceCounter(&iStart1);
-#endif
-
+    pwstData = (wchar_t **) MALLOC(iRows * iCols * sizeof(wchar_t*)); 
+    
     iRet = readStringMatrix(_iDatasetId, iRows, iCols, pstData);
     if(iRet)
     {
-        return false;
-    }
-
-#ifdef TIME_DEBUG
-    QueryPerformanceCounter(&iEnd1);
-#endif
-#ifdef TIME_DEBUG
-    QueryPerformanceCounter(&iStart2);
-#endif
-
-    if(_piAddress == NULL)
-    {
-        sciErr = createNamedMatrixOfString(_piKey, _pstVarname, iRows, iCols, pstData);
+        return NULL;
     }
-    else //if not null this variable is in a list
+    
+    for(int i=0; i < iRows * iCols; i++)
     {
-        sciErr = createMatrixOfStringInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pstData);
+        pwstData[i] = to_wide_string(pstData[i]);
     }
+    
+    types::String* pStr = new types::String(iRows,iCols);
+    pStr->set(pwstData);
 
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
-    }
-
-#ifdef TIME_DEBUG
-    QueryPerformanceCounter(&iEnd2);
-    QueryPerformanceCounter(&iStart3);
-#endif
-#ifdef PRINT_DEBUG
-    char pstMsg[512];
-    sprintf(pstMsg, "string_%d (%d x %d)", _iItemPos, iRows, iCols);
-    print_tree(pstMsg);
-#endif
-    for(i = 0 ; i < iRows * iCols ; i++)
-    {
-        FREE(pstData[i]);
-    }
     FREE(pstData);
-
-    if(iRet)
-    {
-        return false;
-    }
-
-#ifdef TIME_DEBUG
-    QueryPerformanceCounter(&iEnd3);
-
-    //double dblTime   =((iEnd1.QuadPart - iStart1.QuadPart) * 1000.0) / iFreq.QuadPart;
-    //printf("HDF5 : %0.3f ms\n", dblTime);
-    //dblTime  =((iEnd2.QuadPart - iStart2.QuadPart) * 1000.0) / iFreq.QuadPart;
-    //printf("Stack : %0.3f ms\n", dblTime);
-    //dblTime  =((iEnd3.QuadPart - iStart3.QuadPart) * 1000.0) / iFreq.QuadPart;
-    //printf("Clear : %0.3f ms\n", dblTime);
-    double dblTime     =((iEnd3.QuadPart - iStart1.QuadPart) * 1000.0) / iFreq.QuadPart;
-    printf("Total String: %0.3f ms\n\n", dblTime);
-#endif
-    return true;
+    FREE(pwstData);
+    return pStr;
 }
 
-static bool import_integer(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname)
+static types::InternalType* import_integer( int _iDatasetId)
 {
-    int iRet                                           = 0;
-    int        iRows                                           = 0;
-    int iCols                                          = 0;
-    int iPrec                                          = 0;
-    SciErr sciErr;
+    int iRet    = 0;
+    int        iRows   = 0;
+    int iCols   = 0;
+    int iPrec   = 0;
 
     iRet = getDatasetDims(_iDatasetId, &iRows, &iCols);
     if(iRet)
     {
-        return false;
+        return NULL;
     }
 
-    iRet                                                               = getDatasetPrecision(_iDatasetId, &iPrec);
+    iRet = getDatasetPrecision(_iDatasetId, &iPrec);
     if(iRet)
     {
-        return false;
+        return NULL;
     }
 
     switch(iPrec)
@@ -512,19 +361,12 @@ static bool import_integer(int* _piKey, int _iDatasetId, int _iItemPos, int* _pi
             iRet = readInterger8Matrix(_iDatasetId, iRows, iCols, pcData);
             if(iRet)
             {
-                return false;
-            }
-
-            if(_piAddress == NULL)
-            {
-                sciErr = createNamedMatrixOfInteger8(_piKey, _pstVarname, iRows, iCols, pcData);
-            }
-            else
-            {
-                sciErr = createMatrixOfInteger8InNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pcData);
+                return NULL;
             }
+            types::Int8* pInt = new types::Int8(iRows,iCols);;
+            pInt->set(pcData);
+            return pInt;
         }
-        break;
     case SCI_UINT8 :
         {
             unsigned char* pucData     = NULL;
@@ -532,19 +374,12 @@ static bool import_integer(int* _piKey, int _iDatasetId, int _iItemPos, int* _pi
             iRet = readUnsignedInterger8Matrix(_iDatasetId, iRows, iCols, pucData);
             if(iRet)
             {
-                return false;
-            }
-
-            if(_piAddress == NULL)
-            {
-                sciErr = createNamedMatrixOfUnsignedInteger8(_piKey, _pstVarname, iRows, iCols, pucData);
-            }
-            else
-            {
-                sciErr = createMatrixOfUnsignedInteger8InNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pucData);
+                return NULL;
             }
+            types::UInt8* pInt = new types::UInt8(iRows,iCols);;
+            pInt->set(pucData);
+            return pInt;
         }
-        break;
     case SCI_INT16 :
         {
             short* psData      = NULL;
@@ -552,19 +387,13 @@ static bool import_integer(int* _piKey, int _iDatasetId, int _iItemPos, int* _pi
             iRet = readInterger16Matrix(_iDatasetId, iRows, iCols, psData);
             if(iRet)
             {
-                return false;
+                return NULL;
             }
 
-            if(_piAddress == NULL)
-            {
-                sciErr = createNamedMatrixOfInteger16(_piKey, _pstVarname, iRows, iCols, psData);
-            }
-            else
-            {
-                sciErr = createMatrixOfInteger16InNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, psData);
-            }
+            types::Int16* pInt = new types::Int16(iRows,iCols);
+            pInt->set(psData);
+            return pInt;
         }
-        break;
     case SCI_UINT16 :
         {
             unsigned short* pusData    = NULL;
@@ -572,19 +401,13 @@ static bool import_integer(int* _piKey, int _iDatasetId, int _iItemPos, int* _pi
             iRet = readUnsignedInterger16Matrix(_iDatasetId, iRows, iCols, pusData);
             if(iRet)
             {
-                return false;
+                return NULL;
             }
 
-            if(_piAddress == NULL)
-            {
-                sciErr = createNamedMatrixOfUnsignedInteger16(_piKey, _pstVarname, iRows, iCols, pusData);
-            }
-            else
-            {
-                sciErr = createMatrixOfUnsignedInteger16InNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pusData);
-            }
+            types::UInt16* pInt = new types::UInt16(iRows,iCols);;
+            pInt->set(pusData);
+            return pInt;
         }
-        break;
     case SCI_INT32 :
         {
             int* piData        = NULL;
@@ -592,19 +415,13 @@ static bool import_integer(int* _piKey, int _iDatasetId, int _iItemPos, int* _pi
             iRet = readInterger32Matrix(_iDatasetId, iRows, iCols, piData);
             if(iRet)
             {
-                return false;
+                return NULL;
             }
 
-            if(_piAddress == NULL)
-            {
-                sciErr = createNamedMatrixOfInteger32(_piKey, _pstVarname, iRows, iCols, piData);
-            }
-            else
-            {
-                sciErr = createMatrixOfInteger32InNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, piData);
-            }
+            types::Int32* pInt = new types::Int32(iRows,iCols);;
+            pInt->set(piData);
+            return pInt;
         }
-        break;
     case SCI_UINT32 :
         {
             unsigned int* puiData      = NULL;
@@ -612,236 +429,164 @@ static bool import_integer(int* _piKey, int _iDatasetId, int _iItemPos, int* _pi
             iRet = readUnsignedInterger32Matrix(_iDatasetId, iRows, iCols, puiData);
             if(iRet)
             {
-                return false;
+                return NULL;
             }
 
-            if(_piAddress == NULL)
-            {
-                sciErr = createNamedMatrixOfUnsignedInteger32(_piKey, _pstVarname, iRows, iCols, puiData);
-            }
-            else
-            {
-                sciErr = createMatrixOfUnsignedInteger32InNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, puiData);
-            }
+            types::UInt32* pInt = new types::UInt32(iRows,iCols);
+            pInt->set(puiData);
+            return pInt;
         }
-        break;
     case SCI_INT64 :
         {
-#ifdef __SCILAB_INT64__
             long long* pllData = NULL;
             pllData = (long long*)MALLOC(sizeof(long long) * iRows * iCols);
             iRet = readInterger64Matrix(_iDatasetId, iRows, iCols, pllData);
             if(iRet)
             {
-                return false;
+                return NULL;
             }
 
-            if(_piAddress == NULL)
-            {
-                sciErr = createNamedMatrixOfInteger64(_piKey, _pstVarname, iRows, iCols, pllData);
-            }
-            else
-            {
-                sciErr = createMatrixOfInteger64InNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pllData);
-            }
-#else
-            return false;
-#endif
+            types::Int64* pInt = new types::Int64(iRows,iCols);
+            pInt->set(pllData);
+            return pInt;
         }
         break;
     case SCI_UINT64 :
         {
-#ifdef __SCILAB_INT64__
             unsigned long long* pullData       = NULL;
             pullData = (unsigned long long*)MALLOC(sizeof(unsigned long long) * iRows * iCols);
             iRet = readUnsignedInterger64Matrix(_iDatasetId, iRows, iCols, pullData);
             if(iRet)
             {
-                return false;
+                return NULL;
             }
 
-            if(_piAddress == NULL)
-            {
-                sciErr = createNamedMatrixOfUnsignedInteger64(_piKey, _pstVarname, iRows, iCols, pullData);
-            }
-            else
-            {
-                sciErr = createMatrixOfUnsignedInteger64InNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pullData);
-            }
-#else
-            return false;
-#endif
+            types::UInt64* pInt = new types::UInt64(iRows,iCols);
+            pInt->set(pullData);
+            return pInt;
         }
         break;
     default :
-        return false;
-    }
-
-#ifdef PRINT_DEBUG
-    char pstMsg[512];
-    sprintf(pstMsg, "integer_%d (%d x %d)", _iItemPos, iRows, iCols);
-    print_tree(pstMsg);
-#endif
-
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
+        return NULL;
     }
 
-    return true;
+    return NULL;
 }
 
-static bool import_boolean(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname)
+static types::InternalType* import_boolean(int _iDatasetId)
 {
-    int iRet                                           = 0;
-    int* piData                                        = NULL;
-    int        iRows                                           = 0;
-    int iCols                                          = 0;
-    SciErr sciErr;
+    int iRet        = 0;
+    int* piData            = NULL;
+    int        iRows       = 0;
+    int iCols       = 0;
 
-    iRet                               = getDatasetDims(_iDatasetId, &iRows, &iCols);
+    iRet = getDatasetDims(_iDatasetId, &iRows, &iCols);
     if(iRet)
     {
-        return false;
+        return NULL;
     }
 
     if(iRows * iCols != 0)
     {
-        piData         = (int *) MALLOC(iRows * iCols * sizeof(int));
-        iRet                   = readBooleanMatrix(_iDatasetId, iRows, iCols, piData);
+        piData  = (int *) MALLOC(iRows * iCols * sizeof(int));
+        iRet    = readBooleanMatrix(_iDatasetId, iRows, iCols, piData);
         if(iRet)
         {
-            return false;
+            return NULL;
         }
     }
-
-    if(_piAddress == NULL)
-    {
-        sciErr = createNamedMatrixOfBoolean(_piKey, _pstVarname, iRows, iCols, piData);
-    }
-    else //if not null this variable is in a list
-    {
-        sciErr = createMatrixOfBooleanInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, piData);
-    }
-
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
-    }
-
-#ifdef PRINT_DEBUG
-    char pstMsg[512];
-    sprintf(pstMsg, "boolean_%d (%d x %d)", _iItemPos, iRows, iCols);
-    print_tree(pstMsg);
-#endif
+    
+    types::Bool* pBool = new types::Bool(iRows,iCols);
+    pBool->set(piData);
 
     if(piData)
     {
         FREE(piData);
     }
 
-    if(iRet)
-    {
-        return false;
-    }
-
-    return true;
+    return pBool;
 }
 
-static bool import_poly(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname)
+static types::InternalType* import_poly(int _iDatasetId)
 {
-    int iRet                                           = 0;
-    int i                                                              = 0;
-    int        iRows                                           = 0;
-    int iCols                                          = 0;
-    int iComplex                               = 0;
-    char pstVarName[64]        = {0};
-    double **pdblReal          = NULL;
-    double **pdblImg           = NULL;
-    int *piNbCoef                              = NULL;
-    SciErr sciErr;
+    int iRet                = 0;
+    int i                   = 0;
+    int        iRows               = 0;
+    int iCols               = 0;
+    int iComplex            = 0;
+    char pstVarName[64]            = {0};
+    wchar_t* pwstVarName    = NULL;
+    double **pdblReal       = NULL;
+    double **pdblImg        = NULL;
+    int *piNbCoef           = NULL;
 
-    iRet                               = getDatasetDims(_iDatasetId, &iRows, &iCols);
+    iRet = getDatasetDims(_iDatasetId, &iRows, &iCols);
     if(iRet)
     {
-        return false;
+        return NULL;
     }
 
-    iComplex           = isComplexData(_iDatasetId);
-
+    iComplex = isComplexData(_iDatasetId);
 
     if(iComplex)
     {
-        piNbCoef               = (int*)MALLOC(iRows * iCols * sizeof(int));
-        pdblReal               = (double**)MALLOC(iRows * iCols * sizeof(double*));
-        pdblImg                        = (double**)MALLOC(iRows * iCols * sizeof(double*));
-        iRet                           = readPolyComplexMatrix(_iDatasetId, pstVarName, iRows, iCols, piNbCoef, pdblReal, pdblImg);
+        piNbCoef    = (int*)MALLOC(iRows * iCols * sizeof(int));
+        pdblReal    = (double**)MALLOC(iRows * iCols * sizeof(double*));
+        pdblImg     = (double**)MALLOC(iRows * iCols * sizeof(double*));
+        iRet        = readPolyComplexMatrix(_iDatasetId, pstVarName, iRows, iCols, piNbCoef, pdblReal, pdblImg);
     }
     else
     {
-        piNbCoef               = (int*)MALLOC(iRows * iCols * sizeof(int));
-        pdblReal               = (double**)MALLOC(iRows * iCols * sizeof(double*));
-        iRet                           = readPolyMatrix(_iDatasetId, pstVarName, iRows, iCols, piNbCoef, pdblReal);
+        piNbCoef    = (int*)MALLOC(iRows * iCols * sizeof(int));
+        pdblReal    = (double**)MALLOC(iRows * iCols * sizeof(double*));
+        iRet           = readPolyMatrix(_iDatasetId, pstVarName, iRows, iCols, piNbCoef, pdblReal);
     }
 
     if(iRet)
     {
-        return false;
+        return NULL;
     }
+    
+    pwstVarName = to_wide_string(pstVarName);
+    types::Polynom* pPoly = new types::Polynom(pwstVarName,iRows,iCols,piNbCoef);
 
-    if(_piAddress == NULL)
+    for(int i = 0 ; i < iRows * iCols ; i++)
     {
+        types::Double* pCoef = new types::Double(1, piNbCoef[i],  iComplex == 0 ? false : true);
+        pCoef->set(pdblReal[i]);
         if(iComplex)
         {
-            sciErr = createNamedComplexMatrixOfPoly(_piKey, _pstVarname, pstVarName, iRows, iCols, piNbCoef, pdblReal, pdblImg);
-        }
-        else
-        {
-            sciErr = createNamedMatrixOfPoly(_piKey, _pstVarname, pstVarName, iRows, iCols, piNbCoef, pdblReal);
+            pCoef->setImg(pdblImg[i]);
         }
+        pPoly->setCoef(i, pCoef);
     }
-    else //if not null this variable is in a list
+    for(i = 0 ; i < iRows * iCols ; i++)
     {
+        FREE(pdblReal[i]);
         if(iComplex)
         {
-            sciErr = createComplexMatrixOfPolyInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, pstVarName, iRows, iCols, piNbCoef, pdblReal, pdblImg);
-        }
-        else
-        {
-            sciErr = createMatrixOfPolyInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, pstVarName, iRows, iCols, piNbCoef, pdblReal);
+            FREE(pdblImg[i]);
         }
     }
 
-    if(sciErr.iErr)
-    {
-        printError(&sciErr, 0);
-        return false;
-    }
-
-#ifdef PRINT_DEBUG
-    char pstMsg[512];
-    sprintf(pstMsg, "poly_%d (%d x %d)", _iItemPos, iRows, iCols);
-    print_tree(pstMsg);
-#endif
-
-    for(i = 0 ; i < iRows * iCols ; i++)
+    FREE(pdblReal);
+    if(iComplex)
     {
-        FREE(pdblReal[i]);
+        FREE(pdblImg);
     }
-    FREE(pdblReal);
+    
     FREE(piNbCoef);
 
     if(iRet)
     {
-        return false;
+        return NULL;
     }
 
-    return true;
+    return pPoly;
 }
-
-static bool import_sparse(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname)
+/*
+static types::InternalType* import_sparse(int* _piKey, int _iDatasetId)
 {
     int iRet                                           = 0;
     int i                                                              = 0;
@@ -889,22 +634,22 @@ static bool import_sparse(int* _piKey, int _iDatasetId, int _iItemPos, int* _piA
     {
         if(iComplex)
         {
-            sciErr = createNamedComplexSparseMatrix(_piKey, _pstVarname, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal, pdblImg);
+            sciErr = createNamedComplexSparseMatrix(_piKey, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal, pdblImg);
         }
         else
         {
-            sciErr = createNamedSparseMatrix(_piKey, _pstVarname, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
+            sciErr = createNamedSparseMatrix(_piKey, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
         }
     }
     else //if not null this variable is in a list
     {
         if(iComplex)
         {
-            sciErr = createComplexSparseMatrixInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal, pdblImg);
+            sciErr = createComplexSparseMatrixInNamedList(_piKey, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal, pdblImg);
         }
         else
         {
-            sciErr = createSparseMatrixInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
+            sciErr = createSparseMatrixInNamedList(_piKey, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
         }
     }
 
@@ -916,7 +661,7 @@ static bool import_sparse(int* _piKey, int _iDatasetId, int _iItemPos, int* _piA
 
 #ifdef PRINT_DEBUG
     char pstMsg[512];
-    sprintf(pstMsg, "sparse_%d (%d x %d)", _iItemPos, iRows, iCols);
+    sprintf(pstMsg, "sparse_%d (%d x %d)", iRows, iCols);
     print_tree(pstMsg);
 #endif
 
@@ -937,13 +682,13 @@ static bool import_sparse(int* _piKey, int _iDatasetId, int _iItemPos, int* _piA
     return true;
 }
 
-static bool import_boolean_sparse(int* _piKey, int _iDatasetId, int _iItemPos, int* _piAddress, char* _pstVarname)
+static types::InternalType* import_boolean_sparse(int* _piKey, int _iDatasetId)
 {
     int iRet                                           = 0;
     int i                                                              = 0;
     int        iRows                                           = 0;
     int iCols                                          = 0;
-    int iNbItem                                        = 0;
+    int     types::Polynom* pPoly = NULL;iNbItem                                       = 0;
     int* piNbItemRow           = NULL;
     int* piColPos                              = NULL;
     SciErr sciErr;
@@ -965,11 +710,11 @@ static bool import_boolean_sparse(int* _piKey, int _iDatasetId, int _iItemPos, i
 
     if(_piAddress == NULL)
     {
-        sciErr                                 = createNamedBooleanSparseMatrix(_piKey, _pstVarname, iRows, iCols, iNbItem, piNbItemRow, piColPos);
+        sciErr                                 = createNamedBooleanSparseMatrix(_piKey, iRows, iCols, iNbItem, piNbItemRow, piColPos);
     }
     else //if not null this variable is in a list
     {
-        sciErr                                 = createBooleanSparseMatrixInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iRows, iCols, iNbItem, piNbItemRow, piColPos);
+        sciErr                                 = createBooleanSparseMatrixInNamedList(_piKey, iRows, iCols, iNbItem, piNbItemRow, piColPos);
     }
 
     if(sciErr.iErr)
@@ -980,7 +725,7 @@ static bool import_boolean_sparse(int* _piKey, int _iDatasetId, int _iItemPos, i
 
 #ifdef PRINT_DEBUG
     char pstMsg[512];
-    sprintf(pstMsg, "boolean sparse_%d (%d x %d)", _iItemPos, iRows, iCols);
+    sprintf(pstMsg, "boolean sparse_%d (%d x %d)", iRows, iCols);
     print_tree(pstMsg);
 #endif
 
@@ -995,20 +740,18 @@ static bool import_boolean_sparse(int* _piKey, int _iDatasetId, int _iItemPos, i
 
     return true;
 }
-
-static bool import_list(int* _piKey, int _iDatasetId, int _iVarType, int _iItemPos, int* _piAddress, char* _pstVarname)
+*/
+static types::InternalType* import_list(int _iDatasetId, int _iVarType)
 {
-    int iRet                                                           = 0;
-    int i                                                                              = 0;
-    int        iItems                                                  = 0;
-    int* piListAddr                                    = NULL;
-    hobj_ref_t* piItemRef              = NULL;
-    SciErr sciErr;
+    int iRet                = 0;
+    int i                   = 0;
+    int        iItems              = 0;
+    hobj_ref_t* piItemRef   = NULL;
 
     iRet = getListDims(_iDatasetId, &iItems);
     if(iRet)
     {
-        return false;
+        return NULL;
     }
 
 
@@ -1017,94 +760,62 @@ static bool import_list(int* _piKey, int _iDatasetId, int _iVarType, int _iItemP
     }
     else
     {
-        iRet                   = getListItemReferences(_iDatasetId, &piItemRef);
+        iRet = getListItemReferences(_iDatasetId, &piItemRef);
         if(iRet)
         {
-            return false;
+            return NULL;
         }
     }
-
-#ifdef PRINT_DEBUG
-    char pstMsg[512];
-    sprintf(pstMsg, "list_%d (%d)", _iItemPos, iItems);
-    print_tree(pstMsg);
-#endif
-
-    if(_piAddress == 0)
+    
+    types::List* pList  = NULL;
+    
+    switch(_iVarType)
     {
-        switch(_iVarType)
-        {
-        case sci_list :
-            sciErr     = createNamedList(_piKey, _pstVarname, iItems, &piListAddr);
-            break;
-        case sci_tlist :
-            sciErr     = createNamedTList(_piKey, _pstVarname, iItems, &piListAddr);
-            break;
-        case sci_mlist :
-            sciErr     = createNamedMList(_piKey, _pstVarname, iItems, &piListAddr);
-            break;
-        default :
-            return false;
-        }
+    case sci_list :
+    {
+        pList = new types::List();
+        break;
     }
-    else //if not null this variable is in a list
+    case sci_tlist :
     {
-        switch(_iVarType)
-        {
-        case sci_list :
-            sciErr     = createListInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iItems, &piListAddr);
-            break;
-        case sci_tlist :
-            sciErr     = createTListInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iItems, &piListAddr);
-            break;
-        case sci_mlist :
-            sciErr     = createMListInNamedList(_piKey, _pstVarname, _piAddress, _iItemPos, iItems, &piListAddr);
-            break;
-        default :
-            return false;
-        }
+        pList = new types::TList();
+        break;
     }
-
-    if(sciErr.iErr)
+    case sci_mlist :
     {
-        printError(&sciErr, 0);
-        return false;
+        pList = new types::MList();
+        break;
     }
-
+    default :
+        return NULL;
+    }
+    
     iTab++;
     for(i = 0 ; i < iItems ; i++)
     {
         int iItemDataset = 0;
-        iRet                   = getListItemDataset(_iDatasetId, piItemRef, i, &iItemDataset);
+        iRet = getListItemDataset(_iDatasetId, piItemRef, i, &iItemDataset);
         if(iRet || iItemDataset == 0)
         {
-            return false;
+            return NULL;
         }
 
-        bool bRet = import_data(_piKey, iItemDataset, i + 1, piListAddr, _pstVarname);
-        if(bRet == false)
+        types::InternalType* pItem = import_data(iItemDataset);
+        if(pItem == NULL)
         {
-            return false;
+            return NULL;
         }
+        pList->append(pItem);
     }
     iTab--;
 
     iRet = deleteListItemReferences(_iDatasetId, piItemRef);
     if(iRet)
     {
-        return false;
+        return NULL;
     }
 
-#ifdef TIME_DEBUG
-    printf("Close List %d\n\n", iCloseList++);
-#endif
-
-#ifdef PRINT_DEBUG
-    char pstMsg1[512];
-    sprintf(pstMsg1, "ListEnd_%d", _iItemPos);
-    print_tree(pstMsg1);
-#endif
-    return true;
+    return pList;
 }
 
 void print_tree(char* _pstMsg)
@@ -1117,4 +828,5 @@ void print_tree(char* _pstMsg)
     printf("%s\n", _pstMsg);
 #endif
 }
+
 /*--------------------------------------------------------------------------*/
index ce42362..b6c8cfa 100644 (file)
@@ -9,29 +9,10 @@
  *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  * 
  */
-extern "C" {
-#include "stack-c.h"
-#include "gw_hdf5.h"
-#include "Scierror.h"
-#include "localization.h"
-}
-
-int gw_hdf5()
-{
-  Scierror(999, _("HDF5 is not installed"));
-  return 0;
-}
-
-int sci_export_to_hdf5(char *fname,unsigned long fname_len)
-{
-  Scierror(999, _("HDF5 is not installed"));
-  PutLhsVar();
-  return 0;
-}
+*
+#include "hdf5_gw.hxx"
 
-int sci_import_from_hdf5(char *fname,unsigned long fname_len)
+bool Hdf5Module::Load()
 {
-  Scierror(999, _("HDF5 is not installed"));
-  PutLhsVar();
-  return 0;
+    return true;
 }
index fc6cca9..7c80663 100644 (file)
@@ -45,7 +45,7 @@
                                Name="VCCLCompilerTool"
                                AdditionalOptions=""
                                Optimization="0"
-                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/hdf5/include;../../../windows_tools/includes;../../../operations/includes;../../../fileio/includes;../../../jvm/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../jni;../cpp;../../../system_env/includes;../../../string/includes"
+                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/hdf5/include;../../../windows_tools/includes;../../../operations/includes;../../../fileio/includes;../../../jvm/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../jni;../cpp;../../../system_env/includes;../../../string/includes;../../../types/includes;../../../functions_manager/includes;../../../abstractSyntaxTree/includes;../../../symbol/includes"
                                PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;HDF5_SCILAB_EXPORTS;_HDF5USEDLL_;WIN32"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="0"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/hdf5/include;../../../windows_tools/includes;../../../operations/includes;../../../fileio/includes;../../../jvm/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../jni;../cpp;../../../system_env/includes;../../../string/includes"
+                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/hdf5/include;../../../windows_tools/includes;../../../operations/includes;../../../fileio/includes;../../../jvm/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../jni;../cpp;../../../system_env/includes;../../../string/includes;../../../types/includes;../../../functions_manager/includes;../../../abstractSyntaxTree/includes;../../../symbol/includes"
                                PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;HDF5_SCILAB_EXPORTS;_HDF5USEDLL_;WIN32"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="0"
                                InlineFunctionExpansion="1"
                                FavorSizeOrSpeed="1"
                                WholeProgramOptimization="false"
-                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/hdf5/include;../../../windows_tools/includes;../../../operations/includes;../../../fileio/includes;../../../jvm/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../jni;../cpp;../../../system_env/includes;../../../string/includes"
+                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/hdf5/include;../../../windows_tools/includes;../../../operations/includes;../../../fileio/includes;../../../jvm/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../jni;../cpp;../../../system_env/includes;../../../string/includes;../../../types/includes;../../../functions_manager/includes;../../../abstractSyntaxTree/includes;../../../symbol/includes"
                                PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;HDF5_SCILAB_EXPORTS;_HDF5USEDLL_;WIN32"
                                StringPooling="true"
                                RuntimeLibrary="2"
                                InlineFunctionExpansion="1"
                                FavorSizeOrSpeed="1"
                                WholeProgramOptimization="false"
-                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/hdf5/include;../../../windows_tools/includes;../../../operations/includes;../../../fileio/includes;../../../jvm/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../jni;../cpp;../../../system_env/includes;../../../string/includes"
+                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/hdf5/include;../../../windows_tools/includes;../../../operations/includes;../../../fileio/includes;../../../jvm/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../jni;../cpp;../../../system_env/includes;../../../string/includes;../../../types/includes;../../../functions_manager/includes;../../../abstractSyntaxTree/includes;../../../symbol/includes"
                                PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;HDF5_SCILAB_EXPORTS;_HDF5USEDLL_;WIN32"
                                StringPooling="true"
                                RuntimeLibrary="2"
                                >
                        </File>
                        <File
+                               RelativePath="..\..\sci_gateway\cpp\hdf5_gw.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\jni\jhdf5load.cpp"
                                >
                        </File>
                        </File>
                </Filter>
                <File
+                       RelativePath="..\..\..\..\bin\blasplus.lib"
+                       >
+               </File>
+               <File
                        RelativePath="..\..\hdf5.iss"
                        >
                </File>
                        >
                </File>
                <File
+                       RelativePath="..\..\..\..\bin\lapack.lib"
+                       >
+               </File>
+               <File
                        RelativePath="..\..\Makefile.am"
                        >
                </File>
index d8c7e1b..e6372fd 100644 (file)
@@ -29,7 +29,7 @@ namespace types
 
         ListUndefined*          getAsListUndefined(void);
         RealType                getType(void);
-        bool                    is() { return true; }
+        bool                    isListUndefined() { return true; }
 
         void                    whoAmI();