hdf5 load process 22/16822/5
Antoine ELIAS [Wed, 8 Jul 2015 12:07:27 +0000 (14:07 +0200)]
change in loading process
before was:
 -> load
 -> %_sodload
 -> import_hdf5_file
 -> post process in %_sodload

now is, for version < 3 :
 -> load ( mapped on import_from_hdf5_v1/v2 )
 -> %_sodload for post processing

and for version == 3:
 -> load ( mapped on import_from_hdf5_v3 )

%_sodload will be called only for hdf5 file version < 3 (before scilab 6)

Change-Id: Ie3efc4bcf499d7372111008bed55ddef09cbf036

18 files changed:
scilab/modules/fileio/includes/FileExist.h
scilab/modules/fileio/src/c/FileExist.c
scilab/modules/hdf5/Makefile.am
scilab/modules/hdf5/Makefile.in
scilab/modules/hdf5/sci_gateway/cpp/sci_import_from_hdf5.cpp
scilab/modules/hdf5/sci_gateway/cpp/sci_import_from_hdf5_v1.cpp [moved from scilab/modules/hdf5/src/cpp/sci_import_from_hdf5_v1.cpp with 98% similarity]
scilab/modules/hdf5/sci_gateway/cpp/sci_import_from_hdf5_v2.cpp
scilab/modules/hdf5/sci_gateway/hdf5_gateway.xml
scilab/modules/hdf5/src/c/hdf5.vcxproj
scilab/modules/hdf5/src/c/hdf5.vcxproj.filters
scilab/modules/io/includes/loadlib.hxx [moved from scilab/modules/io/src/cpp/loadlib.hxx with 73% similarity]
scilab/modules/io/macros/%_sodload.sci
scilab/modules/io/sci_gateway/cpp/sci_load.cpp
scilab/modules/io/src/c/io.vcxproj
scilab/modules/io/src/c/io.vcxproj.filters
scilab/modules/io/src/cpp/io_gw.vcxproj
scilab/modules/io/src/cpp/io_gw.vcxproj.filters
scilab/modules/io/src/cpp/loadlib.cpp

index ede166e..b402564 100644 (file)
 * @param filename a string
 * @return TRUE or FALSE
 */
-FILEIO_IMPEXP BOOL FileExist(char *filename);
+FILEIO_IMPEXP BOOL FileExist(const char *filename);
 
 /**
 * verify if filename is a valid file
 * @param filename a wide string
 * @return TRUE or FALSE
 */
-FILEIO_IMPEXP BOOL FileExistW(wchar_t *wcfilename);
+FILEIO_IMPEXP BOOL FileExistW(const wchar_t *wcfilename);
 /*--------------------------------------------------------------------------*/
 #endif /* __FILEEXIST_H__ */
index 4fba8f8..128c330 100644 (file)
@@ -20,7 +20,7 @@
 #include "charEncoding.h"
 #include "sci_malloc.h"
 /*--------------------------------------------------------------------------*/
-BOOL FileExist(char *filename)
+BOOL FileExist(const char *filename)
 {
 #ifdef _MSC_VER
     wchar_t *wcFilename = to_wide_string(filename);
@@ -46,7 +46,7 @@ BOOL FileExist(char *filename)
 
 }
 /*--------------------------------------------------------------------------*/
-BOOL FileExistW(wchar_t *wcfilename)
+BOOL FileExistW(const wchar_t *wcfilename)
 {
 #ifdef _MSC_VER
     if (wcfilename)
index 77a7cf6..5cd5497 100644 (file)
@@ -20,7 +20,6 @@ HDF5_SOURCES = \
     src/c/h5_writeDataToFile.c \
     src/c/h5_readDataFromFile.c \
     src/c/h5_readDataFromFile_v1.c \
-    src/cpp/sci_import_from_hdf5_v1.cpp \
     src/cpp/listvar_in_hdf5_v1.cpp
 
 HDF5_CXX_SOURCES = \
@@ -57,6 +56,7 @@ GATEWAY_CXX_SOURCES = \
     sci_gateway/cpp/sci_import_from_hdf5_v3.cpp \
     sci_gateway/cpp/sci_is_hdf5_file.cpp \
     sci_gateway/cpp/sci_listvar_in_hdf5.cpp \
+    sci_gateway/cpp/sci_import_from_hdf5_v1.cpp \
     sci_gateway/cpp/sci_listvar_in_hdf5_v2.cpp \
     sci_gateway/cpp/sci_listvar_in_hdf5_v3.cpp \
     sci_gateway/cpp/sci_hdf5_file_version.cpp \
@@ -125,6 +125,7 @@ libscihdf5_la_CPPFLAGS = \
     -I$(top_srcdir)/modules/console/includes/ \
     -I$(top_srcdir)/modules/graphic_objects/includes/ \
     -I$(top_srcdir)/modules/graphics/includes/ \
+    -I$(top_srcdir)/modules/io/includes/ \
     $(JAVA_JNI_INCLUDE) \
     $(HDF5_CFLAGS) \
     $(AM_CPPFLAGS) \
index b81ed0e..8aa5f82 100644 (file)
@@ -173,7 +173,6 @@ am__objects_1 = src/c/libscihdf5_algo_la-h5_fileManagement.lo \
        src/c/libscihdf5_algo_la-h5_writeDataToFile.lo \
        src/c/libscihdf5_algo_la-h5_readDataFromFile.lo \
        src/c/libscihdf5_algo_la-h5_readDataFromFile_v1.lo \
-       src/cpp/libscihdf5_algo_la-sci_import_from_hdf5_v1.lo \
        src/cpp/libscihdf5_algo_la-listvar_in_hdf5_v1.lo
 am__objects_2 = src/cpp/libscihdf5_algo_la-H5Attribute.lo \
        src/cpp/libscihdf5_algo_la-H5AttributesList.lo \
@@ -214,6 +213,7 @@ am__objects_3 = sci_gateway/cpp/libscihdf5_la-hdf5_gw.lo \
        sci_gateway/cpp/libscihdf5_la-sci_import_from_hdf5_v3.lo \
        sci_gateway/cpp/libscihdf5_la-sci_is_hdf5_file.lo \
        sci_gateway/cpp/libscihdf5_la-sci_listvar_in_hdf5.lo \
+       sci_gateway/cpp/libscihdf5_la-sci_import_from_hdf5_v1.lo \
        sci_gateway/cpp/libscihdf5_la-sci_listvar_in_hdf5_v2.lo \
        sci_gateway/cpp/libscihdf5_la-sci_listvar_in_hdf5_v3.lo \
        sci_gateway/cpp/libscihdf5_la-sci_hdf5_file_version.lo \
@@ -621,7 +621,6 @@ HDF5_SOURCES = \
     src/c/h5_writeDataToFile.c \
     src/c/h5_readDataFromFile.c \
     src/c/h5_readDataFromFile_v1.c \
-    src/cpp/sci_import_from_hdf5_v1.cpp \
     src/cpp/listvar_in_hdf5_v1.cpp
 
 HDF5_CXX_SOURCES = \
@@ -658,6 +657,7 @@ GATEWAY_CXX_SOURCES = \
     sci_gateway/cpp/sci_import_from_hdf5_v3.cpp \
     sci_gateway/cpp/sci_is_hdf5_file.cpp \
     sci_gateway/cpp/sci_listvar_in_hdf5.cpp \
+    sci_gateway/cpp/sci_import_from_hdf5_v1.cpp \
     sci_gateway/cpp/sci_listvar_in_hdf5_v2.cpp \
     sci_gateway/cpp/sci_listvar_in_hdf5_v3.cpp \
     sci_gateway/cpp/sci_hdf5_file_version.cpp \
@@ -723,6 +723,7 @@ libscihdf5_la_CPPFLAGS = \
     -I$(top_srcdir)/modules/console/includes/ \
     -I$(top_srcdir)/modules/graphic_objects/includes/ \
     -I$(top_srcdir)/modules/graphics/includes/ \
+    -I$(top_srcdir)/modules/io/includes/ \
     $(JAVA_JNI_INCLUDE) \
     $(HDF5_CFLAGS) \
     $(AM_CPPFLAGS) \
@@ -994,8 +995,6 @@ src/cpp/$(am__dirstamp):
 src/cpp/$(DEPDIR)/$(am__dirstamp):
        @$(MKDIR_P) src/cpp/$(DEPDIR)
        @: > src/cpp/$(DEPDIR)/$(am__dirstamp)
-src/cpp/libscihdf5_algo_la-sci_import_from_hdf5_v1.lo:  \
-       src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
 src/cpp/libscihdf5_algo_la-listvar_in_hdf5_v1.lo:  \
        src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
 src/cpp/libscihdf5_algo_la-H5Attribute.lo: src/cpp/$(am__dirstamp) \
@@ -1076,6 +1075,9 @@ sci_gateway/cpp/libscihdf5_la-sci_is_hdf5_file.lo:  \
 sci_gateway/cpp/libscihdf5_la-sci_listvar_in_hdf5.lo:  \
        sci_gateway/cpp/$(am__dirstamp) \
        sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
+sci_gateway/cpp/libscihdf5_la-sci_import_from_hdf5_v1.lo:  \
+       sci_gateway/cpp/$(am__dirstamp) \
+       sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
 sci_gateway/cpp/libscihdf5_la-sci_listvar_in_hdf5_v2.lo:  \
        sci_gateway/cpp/$(am__dirstamp) \
        sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
@@ -1198,6 +1200,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_h5write.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_hdf5_file_version.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_import_from_hdf5.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_import_from_hdf5_v1.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_import_from_hdf5_v2.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_import_from_hdf5_v3.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_is_hdf5_file.Plo@am__quote@
@@ -1236,7 +1239,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscihdf5_algo_la-HDF5Scilab.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscihdf5_algo_la-handle_properties.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscihdf5_algo_la-listvar_in_hdf5_v1.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscihdf5_algo_la-sci_import_from_hdf5_v1.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@   $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -1321,13 +1323,6 @@ src/c/libscihdf5_algo_la-DllmainHdf5.lo: src/c/DllmainHdf5.c
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
 
-src/cpp/libscihdf5_algo_la-sci_import_from_hdf5_v1.lo: src/cpp/sci_import_from_hdf5_v1.cpp
-@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihdf5_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libscihdf5_algo_la-sci_import_from_hdf5_v1.lo -MD -MP -MF src/cpp/$(DEPDIR)/libscihdf5_algo_la-sci_import_from_hdf5_v1.Tpo -c -o src/cpp/libscihdf5_algo_la-sci_import_from_hdf5_v1.lo `test -f 'src/cpp/sci_import_from_hdf5_v1.cpp' || echo '$(srcdir)/'`src/cpp/sci_import_from_hdf5_v1.cpp
-@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libscihdf5_algo_la-sci_import_from_hdf5_v1.Tpo src/cpp/$(DEPDIR)/libscihdf5_algo_la-sci_import_from_hdf5_v1.Plo
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='src/cpp/sci_import_from_hdf5_v1.cpp' object='src/cpp/libscihdf5_algo_la-sci_import_from_hdf5_v1.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihdf5_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libscihdf5_algo_la-sci_import_from_hdf5_v1.lo `test -f 'src/cpp/sci_import_from_hdf5_v1.cpp' || echo '$(srcdir)/'`src/cpp/sci_import_from_hdf5_v1.cpp
-
 src/cpp/libscihdf5_algo_la-listvar_in_hdf5_v1.lo: src/cpp/listvar_in_hdf5_v1.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihdf5_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libscihdf5_algo_la-listvar_in_hdf5_v1.lo -MD -MP -MF src/cpp/$(DEPDIR)/libscihdf5_algo_la-listvar_in_hdf5_v1.Tpo -c -o src/cpp/libscihdf5_algo_la-listvar_in_hdf5_v1.lo `test -f 'src/cpp/listvar_in_hdf5_v1.cpp' || echo '$(srcdir)/'`src/cpp/listvar_in_hdf5_v1.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libscihdf5_algo_la-listvar_in_hdf5_v1.Tpo src/cpp/$(DEPDIR)/libscihdf5_algo_la-listvar_in_hdf5_v1.Plo
@@ -1545,6 +1540,13 @@ sci_gateway/cpp/libscihdf5_la-sci_listvar_in_hdf5.lo: sci_gateway/cpp/sci_listva
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihdf5_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sci_gateway/cpp/libscihdf5_la-sci_listvar_in_hdf5.lo `test -f 'sci_gateway/cpp/sci_listvar_in_hdf5.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_listvar_in_hdf5.cpp
 
+sci_gateway/cpp/libscihdf5_la-sci_import_from_hdf5_v1.lo: sci_gateway/cpp/sci_import_from_hdf5_v1.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihdf5_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sci_gateway/cpp/libscihdf5_la-sci_import_from_hdf5_v1.lo -MD -MP -MF sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_import_from_hdf5_v1.Tpo -c -o sci_gateway/cpp/libscihdf5_la-sci_import_from_hdf5_v1.lo `test -f 'sci_gateway/cpp/sci_import_from_hdf5_v1.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_import_from_hdf5_v1.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_import_from_hdf5_v1.Tpo sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_import_from_hdf5_v1.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='sci_gateway/cpp/sci_import_from_hdf5_v1.cpp' object='sci_gateway/cpp/libscihdf5_la-sci_import_from_hdf5_v1.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihdf5_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sci_gateway/cpp/libscihdf5_la-sci_import_from_hdf5_v1.lo `test -f 'sci_gateway/cpp/sci_import_from_hdf5_v1.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_import_from_hdf5_v1.cpp
+
 sci_gateway/cpp/libscihdf5_la-sci_listvar_in_hdf5_v2.lo: sci_gateway/cpp/sci_listvar_in_hdf5_v2.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihdf5_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sci_gateway/cpp/libscihdf5_la-sci_listvar_in_hdf5_v2.lo -MD -MP -MF sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_listvar_in_hdf5_v2.Tpo -c -o sci_gateway/cpp/libscihdf5_la-sci_listvar_in_hdf5_v2.lo `test -f 'sci_gateway/cpp/sci_listvar_in_hdf5_v2.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_listvar_in_hdf5_v2.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_listvar_in_hdf5_v2.Tpo sci_gateway/cpp/$(DEPDIR)/libscihdf5_la-sci_listvar_in_hdf5_v2.Plo
index 4957d6b..8622bf6 100644 (file)
 #include "hdf5_gw.hxx"
 #include "function.hxx"
 #include "string.hxx"
+#include "list.hxx"
 #include "overload.hxx"
 #include "execvisitor.hxx"
+#include "loadlib.hxx"
 
 extern "C"
 {
 #include "sci_malloc.h"
 #include "Scierror.h"
+#include "FileExist.h"
 #include "expandPathVariable.h"
 #include "h5_fileManagement.h"
 #include "h5_attributeConstants.h"
@@ -29,49 +32,83 @@ extern "C"
 
 static const std::string fname("import_from_hdf5");
 
-types::Function::ReturnValue sci_import_from_hdf5(types::typed_list &in, int _iRetCount, types::typed_list &out)
+Function::ReturnValue sci_import_from_hdf5(typed_list &in, int _iRetCount, typed_list& out)
 {
     int rhs = static_cast<int>(in.size());
     if (rhs < 1)
     {
         Scierror(999, _("%s: Wrong number of input argument(s): at least %d expected.\n"), fname.data(), 1);
-        return types::Function::Error;
+        return Function::Error;
     }
 
-    if (in[0]->getId() != types::InternalType::IdScalarString)
+    if (in[0]->getId() != InternalType::IdScalarString)
     {
         Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), fname.data(), 1);
-        return types::Function::Error;
+        return Function::Error;
     }
 
-    wchar_t* wfilename = expandPathVariableW(in[0]->getAs<types::String>()->get()[0]);
-    char* cfilename = wide_string_to_UTF8(wfilename);
-    std::string filename = cfilename;
-    FREE(wfilename);
+    wchar_t* wcfilename = expandPathVariableW(in[0]->getAs<String>()->get()[0]);
+    char* cfilename = wide_string_to_UTF8(wcfilename);
+    std::string filename(cfilename);
+    std::wstring wfilename(wcfilename);
     FREE(cfilename);
+    FREE(wcfilename);
+
+    if (FileExistW(wfilename.data()) == FALSE)
+    {
+        Scierror(999, _("%s: Unable to open file: '%s'.\n"), fname.data(), filename.data());
+        return Function::Error;
+    }
+
+    //library ?
+    if (isHDF5File(filename.data()) == false)
+    {
+        //lib file
+        int err = 0;
+        Library* lib = loadlib(wfilename, &err);
+
+        switch (err)
+        {
+            case 1:
+                Scierror(999, _("%s: %s is not a valid module file.\n"), fname.data(), filename.data());
+                return Function::Error;
+            case 2:
+                Scierror(999, "%s: %s", fname.data(), _("Redefining permanent variable.\n"));
+                return Function::Error;
+            default:
+                break;
+        }
+
+        lib->killMe();
+        return Function::OK;
+    }
 
     int iFile = openHDF5File(filename.data(), 0);
     if (iFile < 0)
     {
         Scierror(999, _("%s: Unable to open file: %s\n"), fname.data(), filename.data());
-        return types::Function::Error;
+        return Function::Error;
     }
 
     std::wstring wstFuncName;
     //manage version information
     int version = getSODFormatAttribute(iFile);
     closeHDF5File(iFile);
+
+    bool needReprocess = false;
     switch (version)
     {
         case -1:
         case 1:
         {
             wstFuncName = L"import_from_hdf5_v1";
+            needReprocess = true;
             break;
         }
         case 2:
         {
             wstFuncName = L"import_from_hdf5_v2";
+            needReprocess = true;
             break;
         }
         case 3:
@@ -82,11 +119,51 @@ types::Function::ReturnValue sci_import_from_hdf5(types::typed_list &in, int _iR
         default :
         {
             Scierror(999, _("%s: Wrong SOD file format version. Max Expected: %d Found: %d\n"), fname.data(), SOD_FILE_VERSION, version);
-            return types::Function::Error;
+            return Function::Error;
         }
     }
 
 
     ast::ExecVisitor exec;
-    return Overload::call(wstFuncName, in, _iRetCount, out, &exec);
+    typed_list out1;
+    Function::ReturnValue ret = Overload::call(wstFuncName, in, _iRetCount, out1, &exec);
+
+    if (ret != Function::OK)
+    {
+        Scierror(999, _("%s: Unable to load '%s'\n"), fname.data(), filename.data());
+        return Function::Error;
+    }
+
+    if (needReprocess)
+    {
+        //call %sodload
+        String* vars = out1[0]->getAs<String>();
+        vars->IncreaseRef();
+        int size = vars->getSize();
+        typed_list in2(1, vars);
+        typed_list out2;
+        std::wstring wstFuncName = L"%_sodload";
+        Callable::ReturnValue Ret = Callable::Error;
+        Ret = Overload::call(wstFuncName, in2, _iRetCount, out2, &exec);
+        vars->DecreaseRef();
+
+        if (out2.size() != size)
+        {
+            Scierror(999, _("%s: Unable to load '%s'\n"), fname.data(), filename.data());
+            return Function::Error;
+        }
+
+        symbol::Context* ctx = symbol::Context::getInstance();
+        wchar_t** names = vars->get();
+
+        //update context with values return by %_sodload
+        for (int i = 0; i < size; ++i)
+        {
+            ctx->put(symbol::Symbol(names[i]), out2[i]);
+        }
+
+        vars->killMe();
+    }
+
+    return ret;
 }
\ No newline at end of file
@@ -64,6 +64,7 @@ int sci_import_from_hdf5_v1(char *fn, int* pvApiCtx)
     char* pstExpandedFilename = NULL;
     bool bImport = true;
 
+    const int nbIn = Rhs;
     int iSelectedVar = Rhs - 1;
 
     CheckInputArgumentAtLeast(pvApiCtx, 1);
@@ -103,6 +104,7 @@ int sci_import_from_hdf5_v1(char *fn, int* pvApiCtx)
     FREE(pstExpandedFilename);
     FREE(pstFilename);
 
+    std::vector<wchar_t*> varList;
     if (iSelectedVar)
     {
         //selected variable
@@ -134,6 +136,7 @@ int sci_import_from_hdf5_v1(char *fn, int* pvApiCtx)
                 break;
             }
 
+            varList.push_back(to_wide_string(pstVarName));
             FREE(pstVarName);
             pstVarName = NULL;
         }
@@ -157,6 +160,8 @@ int sci_import_from_hdf5_v1(char *fn, int* pvApiCtx)
                     bImport = false;
                     break;
                 }
+
+                varList.push_back(to_wide_string(pstVarNameList[i]));
             }
 
             freeArrayOfString(pstVarNameList, iNbItem);
@@ -165,26 +170,22 @@ int sci_import_from_hdf5_v1(char *fn, int* pvApiCtx)
     //close the file
     closeHDF5File(iFile);
 
-    int *piReturn = NULL;
-
-    sciErr = allocMatrixOfBoolean(pvApiCtx, Rhs + 1, 1, 1, &piReturn);
-    if (sciErr.iErr)
+    if (bImport == true && varList.size() != 0)
     {
-        printError(&sciErr, 0);
-        return 1;
+        createMatrixOfWideString(pvApiCtx, nbIn + 1, 1, static_cast<int>(varList.size()), varList.data());
     }
-
-    if (bImport == true)
+    else
     {
-        piReturn[0] = 1;
+        createEmptyMatrix(pvApiCtx, nbIn + 1);
     }
-    else
+
+    for (auto& i : varList)
     {
-        piReturn[0] = 0;
+        FREE(i);
     }
 
-    LhsVar(1) = Rhs + 1;
-    PutLhsVar();
+    AssignOutputVariable(pvApiCtx, 1) = nbIn + 1;
+    ReturnArguments(pvApiCtx);
 
     //  printf("End gateway !!!\n");
     return 0;
index d36b3dd..11e1408 100644 (file)
@@ -121,6 +121,7 @@ int sci_import_from_hdf5_v2(char *fn, int* pvApiCtx)
         }
     }
 
+    std::vector<wchar_t*> varList;
     if (iSelectedVar)
     {
         //selected variable
@@ -152,6 +153,7 @@ int sci_import_from_hdf5_v2(char *fn, int* pvApiCtx)
                 break;
             }
 
+            varList.push_back(to_wide_string(pstVarName));
             FREE(pstVarName);
             pstVarName = NULL;
         }
@@ -175,6 +177,8 @@ int sci_import_from_hdf5_v2(char *fn, int* pvApiCtx)
                     bImport = false;
                     break;
                 }
+
+                varList.push_back(to_wide_string(pstVarNameList[i]));
             }
 
             freeArrayOfString(pstVarNameList, iNbItem);
@@ -183,22 +187,18 @@ int sci_import_from_hdf5_v2(char *fn, int* pvApiCtx)
     //close the file
     closeHDF5File(iFile);
 
-    int *piReturn = NULL;
-
-    sciErr = allocMatrixOfBoolean(pvApiCtx, nbIn + 1, 1, 1, &piReturn);
-    if (sciErr.iErr)
+    if (bImport == true && varList.size() != 0)
     {
-        printError(&sciErr, 0);
-        return 1;
+        createMatrixOfWideString(pvApiCtx, nbIn + 1, 1, static_cast<int>(varList.size()), varList.data());
     }
-
-    if (bImport == true)
+    else
     {
-        piReturn[0] = 1;
+        createEmptyMatrix(pvApiCtx, nbIn + 1);
     }
-    else
+
+    for (auto& i : varList)
     {
-        piReturn[0] = 0;
+        FREE(i);
     }
 
     AssignOutputVariable(pvApiCtx, 1) = nbIn + 1;
index 79d5683..0aea586 100644 (file)
@@ -22,6 +22,7 @@
     <gateway name="sci_export_to_hdf5"                  function="export_to_hdf5"           type="1" />
     <gateway name="sci_export_to_hdf5"                  function="save"                     type="1" />
     <gateway name="sci_import_from_hdf5"                function="import_from_hdf5"         type="1" />
+    <gateway name="sci_import_from_hdf5"                function="load"                     type="1" />
     <gateway name="sci_import_from_hdf5_v1"             function="import_from_hdf5_v1"      type="0" />
     <gateway name="sci_import_from_hdf5_v2"             function="import_from_hdf5_v2"      type="0" />
     <gateway name="sci_import_from_hdf5_v3"             function="import_from_hdf5_v3"      type="1" />
index db2d77a..bbc1187 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../cpp;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../console/includes;../../../graphic_objects/includes;../../../graphics/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../cpp;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../io/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../console/includes;../../../graphic_objects/includes;../../../graphics/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>H5Topen_vers=2;H5Dcreate_vers=2;H5Aiterate_vers=2;H5Gcreate_vers=2;H5Gopen_vers=2;H5Tget_array_dims_vers=2;H5Acreate_vers=2;_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;HDF5_SCILAB_EXPORTS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../cpp;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../console/includes;../../../graphic_objects/includes;../../../graphics/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../cpp;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../io/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../console/includes;../../../graphic_objects/includes;../../../graphics/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>H5Topen_vers=2;H5Dcreate_vers=2;H5Aiterate_vers=2;H5Gcreate_vers=2;H5Gopen_vers=2;H5Tget_array_dims_vers=2;H5Acreate_vers=2;_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;HDF5_SCILAB_EXPORTS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../cpp;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../console/includes;../../../graphic_objects/includes;../../../graphics/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../cpp;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../io/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../console/includes;../../../graphic_objects/includes;../../../graphics/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>H5Topen_vers=2;H5Dcreate_vers=2;H5Aiterate_vers=2;H5Gcreate_vers=2;H5Gopen_vers=2;H5Tget_array_dims_vers=2;H5Acreate_vers=2;_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;HDF5_SCILAB_EXPORTS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../cpp;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../console/includes;../../../graphic_objects/includes;../../../graphics/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../cpp;../../../../libs/intl;../../../../libs/hdf5/include;../../../output_stream/includes;../../../core/includes;../../../api_scilab/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../io/includes;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../threads/includes;../../../dynamic_link/includes;../../../console/includes;../../../graphic_objects/includes;../../../graphics/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>H5Topen_vers=2;H5Dcreate_vers=2;H5Aiterate_vers=2;H5Gcreate_vers=2;H5Gopen_vers=2;H5Tget_array_dims_vers=2;H5Acreate_vers=2;_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;HDF5_SCILAB_EXPORTS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile Include="..\..\sci_gateway\cpp\sci_h5write.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_hdf5_file_version.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_import_from_hdf5.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_import_from_hdf5_v1.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_import_from_hdf5_v3.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_is_hdf5_file.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_listvar_in_hdf5.cpp" />
     <ClCompile Include="..\cpp\H5VlenData.cpp" />
     <ClCompile Include="..\cpp\handle_properties.cpp" />
     <ClCompile Include="..\cpp\HDF5Scilab.cpp" />
-    <ClCompile Include="..\cpp\sci_import_from_hdf5_v1.cpp" />
     <ClCompile Include="..\cpp\listvar_in_hdf5_v1.cpp" />
     <ClCompile Include="DllmainHdf5.c" />
     <ClCompile Include="h5_fileManagement.c" />
     <ProjectReference Include="..\..\..\graphic_objects\src\c\graphic_objects.vcxproj">
       <Project>{30f9ee41-587b-4618-8de7-698d3fba4985}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\io\src\c\io.vcxproj">
+      <Project>{80c0f142-184b-4e08-a8ee-5e71437cf904}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\jvm\libjvm.vcxproj">
       <Project>{8ba2dda8-bd04-4d4d-8ee6-6caa955f7470}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
index f59465b..c639f0d 100644 (file)
     <ClCompile Include="..\..\sci_gateway\cpp\sci_export_to_hdf5.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\cpp\sci_import_from_hdf5_v1.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\sci_gateway\cpp\sci_import_from_hdf5.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\..\sci_gateway\cpp\sci_hdf5_file_version.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_import_from_hdf5_v1.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\includes\dynlib_hdf5_scilab.h">
similarity index 73%
rename from scilab/modules/io/src/cpp/loadlib.hxx
rename to scilab/modules/io/includes/loadlib.hxx
index 5eaae7d..45f28c6 100644 (file)
@@ -13,8 +13,9 @@
 #ifndef __LOADLIB_H__
 #define __LOADLIB_H__
 
+#include "dynlib_io.h"
 #include "library.hxx"
 
-types::Library* loadlib(std::wstring _wstXML, int* ierr, bool _isFile = true, bool _bAddInContext = true);
+IO_IMPEXP types::Library* loadlib(const std::wstring& _wstXML, int* ierr, bool _isFile = true, bool _bAddInContext = true);
 
 #endif /* !__LOADLIB_H__ */
\ No newline at end of file
index 73b6c82..64ac51c 100644 (file)
@@ -8,30 +8,18 @@
 // are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 
-function %_sodload(%__filename__, varargin)
+function varargout = %_sodload(%__varnameList__)
 
-    function v = getScilabFileVersion(%__filename__)
-        verStr = h5readattr(%__filename__, "/", "SCILAB_scilab_version")
-        [a,b,c,d] = regexp(verStr, "/scilab-.*(\d)\.(\d)\.(\d)/");
-        if size(d, "*") == 3 then
-            v = evstr(d(1)) * 100 + evstr(d(2)) * 10 + evstr(d(3));
-        else
-            error("unable to find file version: %s", %__filename__);
-        end
-    endfunction
-
-    function [varValues] = %__convertVariable__(varValues, varNames)
-        for i = 1:size(varValues)
-            if typeof(varValues(i)) == "ScilabMatrixHandle" then
-                //convert tlist to handle
-                varValues(i) = createMatrixHandle(varValues(i));
-            elseif typeof(varValues(i)) == "ScilabMacro" then
-                //convert tlist to macro
-                varValues(i) = createMacro(varValues(i), varNames(i));
-            elseif isList(varValues(i)) then
-                //list container
-                varValues(i) = parseList(varValues(i));
-            end
+    function varValue = %__convertVariable__(varValue, varName)
+        if typeof(varValue) == "ScilabMatrixHandle" then
+            //convert tlist to handle
+            varValue = createMatrixHandle(varValue);
+        elseif typeof(varValue) == "ScilabMacro" then
+            //convert tlist to macro
+            varValue = createMacro(varValue, varName);
+        elseif isList(varValue) then
+            //list container
+            varValue = parseList(varValue);
         end
     endfunction
 
@@ -952,7 +940,6 @@ function %_sodload(%__filename__, varargin)
     endfunction
 
     function macro = createMacro(macroStr, macroName)
-
         macroSt = macroStr(3);
         if macroStr(2) == %t then
             flag = "c";
@@ -968,58 +955,9 @@ function %_sodload(%__filename__, varargin)
         execstr("macro = " + macroName);
     endfunction
 
-    [%__lhs__, %__rhs__] = argn();
-    %__resumeList__ = list();
-    %__resumeVarlist__ = [];
-    if %__rhs__ < 1 then
-        error(999, msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"), "load", 1));
+    varargout = list();
+    for i = 1:size(%__varnameList__, "*")
+        varargout(i) = %__convertVariable__(evstr(%__varnameList__(i)), %__varnameList__(i));
+        //printf("add %s: type %s become %s\n", %__varnameList__(i), typeof(evstr(%__varnameList__(i))), typeof(varargout(i)));
     end
-
-    if %__rhs__ >= 1 then
-        if typeof(%__filename__) <> "string" | size(%__filename__, "*") <> 1 then
-            error(999, msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"), "load", 1));
-        end
-    end
-
-    if isfile(%__filename__) & is_hdf5_file(%__filename__) then
-        %__loadFunction__ = import_from_hdf5;
-        //fileVersion = getScilabFileVersion(%__filename__); // Not needed for the moment
-    else
-        %__loadFunction__ = load;
-    end
-
-    //multiple output variables to prevent listinfile prints
-    [%__variableList__, %__varB__] = listvarinfile(%__filename__);
-    //
-    if size(varargin) <> 0 then
-        for i = 1:size(varargin)
-            %__variableName__ = varargin(i);
-            if typeof(%__variableName__) <> "string" | size(%__variableName__, "*") <> 1 then
-                error(999, msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"), "load", i));
-            end
-
-            if or(%__variableList__ == %__variableName__) then
-                %__loadFunction__(%__filename__, %__variableName__);
-                %__resumeList__($+1) = evstr(%__variableName__);
-                %__resumeVarlist__($+1) = %__variableName__;
-                clear(%__variableName__);
-            else
-                error(999, msprintf(gettext("%s: variable ''%s'' does not exist in ''%s''.\n"), "load", %__variableName__, %__filename__));
-            end
-        end
-    else
-        for i = 1:size(%__variableList__, "*")
-            %__variableName__ = %__variableList__(i);
-            %__loadFunction__(%__filename__, %__variableName__);
-            %__resumeList__($+1) = evstr(%__variableName__);
-            %__resumeVarlist__($+1) = %__variableName__;
-            clear(%__variableName__);
-        end
-    end
-
-    if isfile(%__filename__) & is_hdf5_file(%__filename__) & hdf5_file_version(%__filename__) < 3 then
-        %__resumeList__ = %__convertVariable__(%__resumeList__, %__resumeVarlist__);
-    end
-
-    execstr("[" + strcat(%__resumeVarlist__, ",") + "] = resume(%__resumeList__(:))");
 endfunction
index 0c73736..a8a763c 100644 (file)
@@ -19,7 +19,6 @@
 #include "library.hxx"
 #include "loadlib.hxx"
 
-
 extern "C"
 {
 #include "sci_malloc.h"
index 81a2937..e00d6c7 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../../libs/intl;../../../ast/includes/operations;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;IO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -109,7 +109,7 @@ lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../../libs/intl;../../../ast/includes/operations;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;IO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -136,7 +136,7 @@ lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../../libs/intl;../../../ast/includes/operations;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;IO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -170,7 +170,7 @@ lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../../libs/intl;../../../ast/includes/operations;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../localization/includes;../../../api_scilab/includes;../../../core/includes;../../../output_stream/includes;../../../fileio/includes;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../dynamic_link/includes;../../../ast/includes/operations;../../../string/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse;../../../threads/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;IO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -198,6 +198,7 @@ lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\cpp\loadlib.cpp" />
     <ClCompile Include="DllmainIo.c" />
     <ClCompile Include="getenvc.c" />
     <ClCompile Include="getpidc.c" />
@@ -208,6 +209,7 @@ lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
   <ItemGroup>
     <ClInclude Include="..\..\includes\dynlib_io.h" />
     <ClInclude Include="..\..\includes\getenvc.h" />
+    <ClInclude Include="..\..\includes\loadlib.hxx" />
     <ClInclude Include="getpidc.h" />
     <ClInclude Include="..\..\includes\gw_io.h" />
     <ClInclude Include="..\..\includes\setenvc.h" />
@@ -235,6 +237,9 @@ lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
       <Project>{43c5bab1-1dca-4743-a183-77e0d42fe7d0}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\ast\ast.vcxproj">
+      <Project>{0d3fa25b-8116-44ec-a45e-260789daa3d9}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\fileio\fileio.vcxproj">
       <Project>{4fc72d4a-80ee-4b1a-8724-0201c1a35621}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
@@ -248,6 +253,9 @@ lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <Library Include="..\..\..\..\bin\libxml2.lib" />
+  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
index 9e0f54b..76ff054 100644 (file)
@@ -41,6 +41,9 @@
     <ClCompile Include="v2cuniterror.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\cpp\loadlib.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\includes\dynlib_io.h">
@@ -64,6 +67,9 @@
     <ClInclude Include="v2cuniterror.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\includes\loadlib.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="io_f_Import.def">
@@ -87,4 +93,7 @@
       <Filter>Resource File</Filter>
     </ResourceCompile>
   </ItemGroup>
+  <ItemGroup>
+    <Library Include="..\..\..\..\bin\libxml2.lib" />
+  </ItemGroup>
 </Project>
\ No newline at end of file
index 0ecd00f..bad447d 100644 (file)
     <ClCompile Include="..\..\sci_gateway\cpp\sci_host.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_load.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_unix.cpp" />
-    <ClCompile Include="loadlib.cpp" />
     <ClCompile Include="readwrite.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\includes\dynlib_io_gw.h" />
     <ClInclude Include="..\..\includes\io_gw.hxx" />
-    <ClInclude Include="loadlib.hxx" />
     <ClInclude Include="readwrite.hxx" />
   </ItemGroup>
   <ItemGroup>
index 7e74af6..ac0f053 100644 (file)
@@ -63,9 +63,6 @@
     <ClCompile Include="..\..\sci_gateway\cpp\sci_lib.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="loadlib.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\sci_gateway\cpp\sci_write.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -83,9 +80,6 @@
     <ClInclude Include="..\..\includes\io_gw.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="loadlib.hxx">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="readwrite.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
index 7e633cc..c8fad8a 100644 (file)
@@ -29,7 +29,7 @@ extern "C"
 
 static char *GetXmlFileEncoding(std::string _filename);
 
-types::Library* loadlib(std::wstring _wstXML, int* err, bool _isFile, bool _bAddInContext)
+types::Library* loadlib(const std::wstring& _wstXML, int* err, bool _isFile, bool _bAddInContext)
 {
     types::Library* lib = NULL;