Merge remote-tracking branch 'origin/YaSp' into richelieu-vmkit
Peter Senna Tschudin [Fri, 3 May 2013 15:02:57 +0000 (17:02 +0200)]
60 files changed:
scilab/Scilab.sln
scilab/modules/ast/Makefile.am
scilab/modules/ast/Makefile.in
scilab/modules/ast/ast.vcxproj
scilab/modules/ast/ast.vcxproj.filters
scilab/modules/ast/includes/macrovarvisitor.hxx [new file with mode: 0644]
scilab/modules/ast/src/cpp/macrovarvisitor.cpp [new file with mode: 0644]
scilab/modules/data_structures/Makefile.am
scilab/modules/data_structures/Makefile.in
scilab/modules/data_structures/includes/data_structures_gw.hxx [new file with mode: 0644]
scilab/modules/data_structures/includes/gw_data_structures2.h
scilab/modules/data_structures/sci_gateway/c/gw_data_structures2.c
scilab/modules/data_structures/sci_gateway/c/sci_getfield.c [deleted file]
scilab/modules/data_structures/sci_gateway/cpp/data_structures_gw.cpp [new file with mode: 0644]
scilab/modules/data_structures/sci_gateway/cpp/sci_getfield.cpp [new file with mode: 0644]
scilab/modules/data_structures/sci_gateway/cpp/sci_setfield.cpp [new file with mode: 0644]
scilab/modules/data_structures/src/c/data_structures.vcxproj
scilab/modules/data_structures/src/c/data_structures.vcxproj.filters
scilab/modules/functions/Makefile.am
scilab/modules/functions/Makefile.in
scilab/modules/functions/includes/functions_gw.hxx
scilab/modules/functions/macros/macrovar.sci [deleted file]
scilab/modules/functions/sci_gateway/cpp/functions_gw.vcxproj
scilab/modules/functions/sci_gateway/cpp/functions_gw.vcxproj.filters
scilab/modules/functions/sci_gateway/cpp/sci_macrovar.cpp [new file with mode: 0644]
scilab/modules/functions/sci_gateway/functions_gateway.xml
scilab/modules/functions_manager/functions_manager.vcxproj
scilab/modules/functions_manager/includes/module_declaration.hxx
scilab/modules/functions_manager/src/cpp/funcmanager.cpp
scilab/modules/operations/src/cpp/types_comparison_eq.cpp
scilab/modules/operations/src/cpp/types_comparison_ne.cpp
scilab/modules/operations/src/cpp/types_substraction.cpp
scilab/modules/sparse/Makefile.am
scilab/modules/sparse/Makefile.in
scilab/modules/sparse/includes/sparse_gw.hxx
scilab/modules/sparse/macros/sp2adj.sci [deleted file]
scilab/modules/sparse/sci_gateway/cpp/sci_ordmmd.cpp [new file with mode: 0644]
scilab/modules/sparse/sci_gateway/cpp/sci_sparse.cpp
scilab/modules/sparse/sci_gateway/cpp/sparse_f_Import.def [new file with mode: 0644]
scilab/modules/sparse/sci_gateway/cpp/sparse_gw.cpp
scilab/modules/sparse/sci_gateway/cpp/sparse_gw.vcxproj
scilab/modules/sparse/sci_gateway/cpp/sparse_gw.vcxproj.filters
scilab/modules/sparse/src/fortran/sparse_f.vfproj
scilab/modules/sparse/tests/unit_tests/pcg_list.dia.ref
scilab/modules/sparse/tests/unit_tests/pcg_list.tst
scilab/modules/sparse/tests/unit_tests/qmr.dia.ref
scilab/modules/sparse/tests/unit_tests/qmr.tst
scilab/modules/sparse/tests/unit_tests/sparse.dia.ref
scilab/modules/sparse/tests/unit_tests/sparse.tst
scilab/modules/types/Makefile.am
scilab/modules/types/Makefile.in
scilab/modules/types/includes/types_gw.hxx
scilab/modules/types/sci_gateway/cpp/sci_getfield.cpp [deleted file]
scilab/modules/types/sci_gateway/cpp/types_gw.cpp
scilab/modules/types/sci_gateway/cpp/types_gw.vcxproj
scilab/modules/types/sci_gateway/cpp/types_gw.vcxproj.filters
scilab/modules/types/src/cpp/double.cpp
scilab/modules/types/src/cpp/list.cpp
scilab/modules/types/src/cpp/macro.cpp
scilab/modules/types/src/cpp/tlist.cpp

index eb63504..9f3f934 100644 (file)
@@ -623,6 +623,9 @@ EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "types_gw", "modules\types\sci_gateway\cpp\types_gw.vcxproj", "{C2E5F4F6-5EE7-4B36-BFAC-4AC36BB41420}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sparse_gw", "modules\sparse\sci_gateway\cpp\sparse_gw.vcxproj", "{7FC7AEC9-4922-4864-83F1-EAED67981AAC}"
+       ProjectSection(ProjectDependencies) = postProject
+               {13082624-97F9-47DB-A9A1-AD7D6BF3856A} = {13082624-97F9-47DB-A9A1-AD7D6BF3856A}
+       EndProjectSection
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
index df4378f..f9bc0f2 100644 (file)
@@ -20,7 +20,8 @@ libsciast_la_SOURCES = \
        src/cpp/debugvisitor.cpp \
        src/cpp/mutevisitor.cpp \
        src/cpp/shortcutvisitor.cpp \
-       src/cpp/scilabexception.cpp
+       src/cpp/scilabexception.cpp \
+       src/cpp/macrovarvisitor.cpp
 
 libsciast_la_CPPFLAGS = \
        -Iincludes \
index 5d2e4d1..0b126b1 100644 (file)
@@ -135,7 +135,8 @@ am_libsciast_la_OBJECTS = libsciast_la-libAst.lo \
        libsciast_la-visitor_common.lo libsciast_la-printvisitor.lo \
        libsciast_la-debugvisitor.lo libsciast_la-mutevisitor.lo \
        libsciast_la-shortcutvisitor.lo \
-       libsciast_la-scilabexception.lo
+       libsciast_la-scilabexception.lo \
+       libsciast_la-macrovarvisitor.lo
 libsciast_la_OBJECTS = $(am_libsciast_la_OBJECTS)
 am_testConstExp_OBJECTS = testConstExp-testConstExp.$(OBJEXT)
 testConstExp_OBJECTS = $(am_testConstExp_OBJECTS)
@@ -457,7 +458,8 @@ libsciast_la_SOURCES = \
        src/cpp/debugvisitor.cpp \
        src/cpp/mutevisitor.cpp \
        src/cpp/shortcutvisitor.cpp \
-       src/cpp/scilabexception.cpp
+       src/cpp/scilabexception.cpp \
+       src/cpp/macrovarvisitor.cpp
 
 libsciast_la_CPPFLAGS = \
        -Iincludes \
@@ -671,6 +673,7 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciast_la-debugvisitor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciast_la-libAst.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciast_la-macrovarvisitor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciast_la-mutevisitor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciast_la-printvisitor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciast_la-scilabexception.Plo@am__quote@
@@ -750,6 +753,13 @@ libsciast_la-scilabexception.lo: src/cpp/scilabexception.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) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsciast_la-scilabexception.lo `test -f 'src/cpp/scilabexception.cpp' || echo '$(srcdir)/'`src/cpp/scilabexception.cpp
 
+libsciast_la-macrovarvisitor.lo: src/cpp/macrovarvisitor.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsciast_la-macrovarvisitor.lo -MD -MP -MF $(DEPDIR)/libsciast_la-macrovarvisitor.Tpo -c -o libsciast_la-macrovarvisitor.lo `test -f 'src/cpp/macrovarvisitor.cpp' || echo '$(srcdir)/'`src/cpp/macrovarvisitor.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libsciast_la-macrovarvisitor.Tpo $(DEPDIR)/libsciast_la-macrovarvisitor.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/macrovarvisitor.cpp' object='libsciast_la-macrovarvisitor.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) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsciast_la-macrovarvisitor.lo `test -f 'src/cpp/macrovarvisitor.cpp' || echo '$(srcdir)/'`src/cpp/macrovarvisitor.cpp
+
 testConstExp-testConstExp.o: src/cpp/testConstExp.cpp
 @am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testConstExp_CXXFLAGS) $(CXXFLAGS) -MT testConstExp-testConstExp.o -MD -MP -MF $(DEPDIR)/testConstExp-testConstExp.Tpo -c -o testConstExp-testConstExp.o `test -f 'src/cpp/testConstExp.cpp' || echo '$(srcdir)/'`src/cpp/testConstExp.cpp
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/testConstExp-testConstExp.Tpo $(DEPDIR)/testConstExp-testConstExp.Po
index 956c077..929ba30 100644 (file)
   <ItemGroup>
     <ClCompile Include="src\cpp\debugvisitor.cpp" />
     <ClCompile Include="src\cpp\libAst.cpp" />
+    <ClCompile Include="src\cpp\macrovarvisitor.cpp" />
     <ClCompile Include="src\cpp\mutevisitor.cpp" />
     <ClCompile Include="src\cpp\printvisitor.cpp" />
     <ClCompile Include="src\cpp\shortcutvisitor.cpp" />
     <ClInclude Include="includes\functiondec.hxx" />
     <ClInclude Include="includes\ifexp.hxx" />
     <ClInclude Include="includes\intexp.hxx" />
+    <ClInclude Include="includes\macrovarvisitor.hxx" />
     <ClInclude Include="includes\stepvisitor.hxx" />
     <ClInclude Include="src\cpp\libAst.hxx" />
     <ClInclude Include="includes\listexp.hxx" />
index ae88779..9c99692 100644 (file)
@@ -19,6 +19,9 @@
     <ClCompile Include="src\cpp\visitor_common.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="src\cpp\macrovarvisitor.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="includes\all.hxx">
     <ClInclude Include="includes\stepvisitor.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="includes\macrovarvisitor.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <Library Include="..\..\bin\blasplus.lib" />
diff --git a/scilab/modules/ast/includes/macrovarvisitor.hxx b/scilab/modules/ast/includes/macrovarvisitor.hxx
new file mode 100644 (file)
index 0000000..1d8b128
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2013 - Scilab Enterprises - 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 __MACROVARVISITOR_HXX__
+#define __MACROVARVISITOR_HXX__
+
+#include "visitor.hxx"
+#include "allexp.hxx"
+#include "allvar.hxx"
+#include "alldec.hxx"
+#include "dummyvisitor.hxx"
+
+/*
+** This class defines a dummy visitor which only purpose is to
+** followup itself through the AST.
+*/
+
+namespace ast
+{
+class EXTERN_AST MacrovarVisitor : public DummyVisitor
+{
+public:
+    MacrovarVisitor() {}
+    ~MacrovarVisitor() {}
+
+    void visit (const SimpleVar &e);
+    void visit(const CallExp &e);
+    void visit (const VarDec &e);
+    void visit(const AssignExp &e);
+
+    std::list<std::wstring>& getIn();
+    std::list<std::wstring>& getOut();
+    std::list<std::wstring>& getExternal();
+    std::list<std::wstring>& getCalled();
+    std::list<std::wstring>& getLocal();
+    void add(std::list<std::wstring>& lst);
+    void add();
+
+    bool isAlreadyIn(std::list<std::wstring>& lst);
+    bool isAlreadyUsed();
+
+    void addIn(std::wstring st)
+    {
+        m_in.push_back(st);
+    }
+
+    void addOut(std::wstring st)
+    {
+        m_out.push_back(st);
+    }
+
+    std::list<std::wstring> m_in; //inout variables
+    std::list<std::wstring> m_out; //output functions
+    std::list<std::wstring> m_external; //external variables
+    std::list<std::wstring> m_called; //called functions
+    std::list<std::wstring> m_local; // local variables
+
+    std::wstring m_current;
+};
+}
+
+#endif /* !__MACROVARVISITOR_HXX__ */
diff --git a/scilab/modules/ast/src/cpp/macrovarvisitor.cpp b/scilab/modules/ast/src/cpp/macrovarvisitor.cpp
new file mode 100644 (file)
index 0000000..7a377b1
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2013 - Scilab Enterprises - 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 "macrovarvisitor.hxx"
+#include "context.hxx"
+
+using namespace std;
+using namespace ast;
+using namespace symbol;
+namespace ast
+{
+void MacrovarVisitor::visit (const SimpleVar &e)
+{
+    m_current = e.name_get().name_get();
+}
+
+void MacrovarVisitor::visit(const CallExp &e)
+{
+    e.name_get().accept (*this);
+    add();
+
+    std::list<Exp *>::const_iterator i;
+    for (i = e.args_get().begin (); i != e.args_get().end (); ++i)
+    {
+        (*i)->accept (*this);
+        add();
+    }
+}
+
+void MacrovarVisitor::visit(const AssignExp &e)
+{
+    e.left_exp_get().accept (*this);
+    add();
+    e.right_exp_get().accept (*this);
+    add();
+}
+
+void MacrovarVisitor::visit (const VarDec  &e)
+{
+    e.init_get().accept(*this);
+    add(m_local);
+}
+
+std::list<std::wstring>& MacrovarVisitor::getIn()
+{
+    return m_in;
+}
+
+std::list<std::wstring>& MacrovarVisitor::getOut()
+{
+    return m_out;
+}
+
+std::list<std::wstring>& MacrovarVisitor::getExternal()
+{
+    return m_external;
+}
+
+std::list<std::wstring>& MacrovarVisitor::getCalled()
+{
+    return m_called;
+}
+
+std::list<std::wstring>& MacrovarVisitor::getLocal()
+{
+    return m_local;
+}
+
+void MacrovarVisitor::add(std::list<std::wstring>& lst)
+{
+    if (m_current == L"")
+    {
+        return;
+    }
+
+    if (isAlreadyUsed() == false)
+    {
+        lst.push_back(m_current);
+    }
+
+    m_current = L"";
+}
+
+void MacrovarVisitor::add()
+{
+    InternalType* pVar = Context::getInstance()->get(Symbol(m_current));
+
+    if (pVar)
+    {
+        if (pVar->isCallable())
+        {
+            //symbol already exists and callable
+            add(m_called);
+            return;
+        }
+
+        //symbol already exists and not callable.
+        //it is a external var
+        add(m_external);
+        return;
+    }
+
+    add(m_local);
+}
+
+bool MacrovarVisitor::isAlreadyIn(std::list<std::wstring>& lst)
+{
+    std::list<std::wstring>::iterator it;
+    for (it = lst.begin(); it != lst.end() ; it++)
+    {
+        if (*it == m_current)
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+bool MacrovarVisitor::isAlreadyUsed()
+{
+    if (isAlreadyIn(m_in))
+    {
+        return true;
+    }
+
+    if (isAlreadyIn(m_out))
+    {
+        return true;
+    }
+
+    if (isAlreadyIn(m_external))
+    {
+        return true;
+    }
+
+    if (isAlreadyIn(m_called))
+    {
+        return true;
+    }
+
+    if (isAlreadyIn(m_local))
+    {
+        return true;
+    }
+
+    return false;
+}
+}
\ No newline at end of file
index b9f56a1..e9e986e 100644 (file)
@@ -4,11 +4,13 @@
 # This file is distributed under the same license as the Scilab package.
 
 
-DATA_STRUCTURES_C_SOURCES = src/c/stcreate.c \
+DATA_STRUCTURES_C_SOURCES = \
+src/c/stcreate.c \
 src/c/hmops.c \
 src/c/strpos.c
 
-DATA_STRUCTURES_FORTRAN_SOURCES = src/fortran/extractfields.f \
+DATA_STRUCTURES_FORTRAN_SOURCES = \
+src/fortran/extractfields.f \
 src/fortran/forcerhs.f \
 src/fortran/lsstyp.f \
 src/fortran/udptr.f \
@@ -17,29 +19,38 @@ src/fortran/gratyp.f \
 src/fortran/mlist.f \
 src/fortran/insertfield.f
 
-GATEWAY_C_SOURCES = sci_gateway/c/sci_lsslist.c \
+GATEWAY_C_SOURCES = \
+sci_gateway/c/sci_lsslist.c \
 sci_gateway/c/sci_glist.c \
 sci_gateway/c/sci_definedfields.c \
-sci_gateway/c/sci_getfield.c \
-sci_gateway/c/sci_setfield.c \
 sci_gateway/c/sci_lstcat.c \
 sci_gateway/c/gw_data_structures1.c \
 sci_gateway/c/gw_data_structures2.c \
 sci_gateway/c/sci_lstsize.c \
 sci_gateway/c/sci_rlist.c
 
-GATEWAY_FORTRAN_SOURCES =  sci_gateway/fortran/sci_f_definedfields.f \
+GATEWAY_CPP_SOURCES = \
+sci_gateway/cpp/data_structures_gw.cpp \
+sci_gateway/cpp/sci_getfield.cpp \
+sci_gateway/cpp/sci_setfield.cpp
+
+GATEWAY_FORTRAN_SOURCES = \
+sci_gateway/fortran/sci_f_definedfields.f \
 sci_gateway/fortran/sci_f_lstsize.f \
 sci_gateway/fortran/sci_f_lstcat.f \
 sci_gateway/fortran/sci_f_list.f
 
-libscidata_structures_la_CPPFLAGS = -I$(srcdir)/includes/ \
--I$(top_srcdir)/modules/localization/includes/ \
--I$(top_srcdir)/modules/output_stream/includes/ \
+libscidata_structures_la_CPPFLAGS = \
+-I$(srcdir)/includes/ \
+-I$(top_srcdir)/modules/types/includes/ \
+-I$(top_srcdir)/modules/ast/includes/ \
+-I$(top_srcdir)/modules/symbol/includes/ \
+-I$(top_srcdir)/modules/dynamic_link/includes/ \
 -I$(top_srcdir)/modules/string/includes/ \
+-I$(top_srcdir)/modules/output_stream/includes/ \
+-I$(top_srcdir)/modules/localization/includes/ \
 -I$(top_srcdir)/modules/api_scilab/includes/ \
 -I$(top_srcdir)/modules/operations/includes/ \
--I$(top_srcdir)/modules/string/includes/ \
 $(AM_CPPFLAGS)
 
 if MAINTAINER_MODE
@@ -51,11 +62,11 @@ endif
 
 
 libscidata_structures_algo_la_SOURCES = $(DATA_STRUCTURES_C_SOURCES) $(DATA_STRUCTURES_FORTRAN_SOURCES)
-libscidata_structures_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_FORTRAN_SOURCES)
+libscidata_structures_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_CPP_SOURCES) $(GATEWAY_FORTRAN_SOURCES)
 libscidata_structures_algo_la_CPPFLAGS = $(libscidata_structures_la_CPPFLAGS)
 
 # For the code check (splint)
-CHECK_SRC= $(DATA_STRUCTURES_C_SOURCES) $(GATEWAY_C_SOURCES)
+CHECK_SRC= $(DATA_STRUCTURES_C_SOURCES) $(GATEWAY_C_SOURCES) $(GATEWAY_CPP_SOURCES)
 INCLUDE_FLAGS = $(libscidata_structures_la_CFLAGS)
 
 libscidata_structures_la_LIBADD = libscidata_structures-algo.la
index ce10795..498c337 100644 (file)
@@ -149,17 +149,18 @@ libscidata_structures_la_DEPENDENCIES = libscidata_structures-algo.la
 am__objects_3 = libscidata_structures_la-sci_lsslist.lo \
        libscidata_structures_la-sci_glist.lo \
        libscidata_structures_la-sci_definedfields.lo \
-       libscidata_structures_la-sci_getfield.lo \
-       libscidata_structures_la-sci_setfield.lo \
        libscidata_structures_la-sci_lstcat.lo \
        libscidata_structures_la-gw_data_structures1.lo \
        libscidata_structures_la-gw_data_structures2.lo \
        libscidata_structures_la-sci_lstsize.lo \
        libscidata_structures_la-sci_rlist.lo
-am__objects_4 = sci_f_definedfields.lo sci_f_lstsize.lo \
+am__objects_4 = libscidata_structures_la-data_structures_gw.lo \
+       libscidata_structures_la-sci_getfield.lo \
+       libscidata_structures_la-sci_setfield.lo
+am__objects_5 = sci_f_definedfields.lo sci_f_lstsize.lo \
        sci_f_lstcat.lo sci_f_list.lo
 am_libscidata_structures_la_OBJECTS = $(am__objects_3) \
-       $(am__objects_4)
+       $(am__objects_4) $(am__objects_5)
 libscidata_structures_la_OBJECTS =  \
        $(am_libscidata_structures_la_OBJECTS)
 @MAINTAINER_MODE_FALSE@am_libscidata_structures_la_rpath =
@@ -178,6 +179,15 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
        $(LDFLAGS) -o $@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
 F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
 LTF77COMPILE = $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS)
@@ -465,11 +475,13 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 yacc_present = @yacc_present@
-DATA_STRUCTURES_C_SOURCES = src/c/stcreate.c \
+DATA_STRUCTURES_C_SOURCES = \
+src/c/stcreate.c \
 src/c/hmops.c \
 src/c/strpos.c
 
-DATA_STRUCTURES_FORTRAN_SOURCES = src/fortran/extractfields.f \
+DATA_STRUCTURES_FORTRAN_SOURCES = \
+src/fortran/extractfields.f \
 src/fortran/forcerhs.f \
 src/fortran/lsstyp.f \
 src/fortran/udptr.f \
@@ -478,40 +490,49 @@ src/fortran/gratyp.f \
 src/fortran/mlist.f \
 src/fortran/insertfield.f
 
-GATEWAY_C_SOURCES = sci_gateway/c/sci_lsslist.c \
+GATEWAY_C_SOURCES = \
+sci_gateway/c/sci_lsslist.c \
 sci_gateway/c/sci_glist.c \
 sci_gateway/c/sci_definedfields.c \
-sci_gateway/c/sci_getfield.c \
-sci_gateway/c/sci_setfield.c \
 sci_gateway/c/sci_lstcat.c \
 sci_gateway/c/gw_data_structures1.c \
 sci_gateway/c/gw_data_structures2.c \
 sci_gateway/c/sci_lstsize.c \
 sci_gateway/c/sci_rlist.c
 
-GATEWAY_FORTRAN_SOURCES = sci_gateway/fortran/sci_f_definedfields.f \
+GATEWAY_CPP_SOURCES = \
+sci_gateway/cpp/data_structures_gw.cpp \
+sci_gateway/cpp/sci_getfield.cpp \
+sci_gateway/cpp/sci_setfield.cpp
+
+GATEWAY_FORTRAN_SOURCES = \
+sci_gateway/fortran/sci_f_definedfields.f \
 sci_gateway/fortran/sci_f_lstsize.f \
 sci_gateway/fortran/sci_f_lstcat.f \
 sci_gateway/fortran/sci_f_list.f
 
-libscidata_structures_la_CPPFLAGS = -I$(srcdir)/includes/ \
--I$(top_srcdir)/modules/localization/includes/ \
--I$(top_srcdir)/modules/output_stream/includes/ \
+libscidata_structures_la_CPPFLAGS = \
+-I$(srcdir)/includes/ \
+-I$(top_srcdir)/modules/types/includes/ \
+-I$(top_srcdir)/modules/ast/includes/ \
+-I$(top_srcdir)/modules/symbol/includes/ \
+-I$(top_srcdir)/modules/dynamic_link/includes/ \
 -I$(top_srcdir)/modules/string/includes/ \
+-I$(top_srcdir)/modules/output_stream/includes/ \
+-I$(top_srcdir)/modules/localization/includes/ \
 -I$(top_srcdir)/modules/api_scilab/includes/ \
 -I$(top_srcdir)/modules/operations/includes/ \
--I$(top_srcdir)/modules/string/includes/ \
 $(AM_CPPFLAGS)
 
 @MAINTAINER_MODE_TRUE@pkglib_LTLIBRARIES = libscidata_structures.la
 @MAINTAINER_MODE_FALSE@noinst_LTLIBRARIES = libscidata_structures-algo.la libscidata_structures.la
 @MAINTAINER_MODE_TRUE@noinst_LTLIBRARIES = libscidata_structures-algo.la
 libscidata_structures_algo_la_SOURCES = $(DATA_STRUCTURES_C_SOURCES) $(DATA_STRUCTURES_FORTRAN_SOURCES)
-libscidata_structures_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_FORTRAN_SOURCES)
+libscidata_structures_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_CPP_SOURCES) $(GATEWAY_FORTRAN_SOURCES)
 libscidata_structures_algo_la_CPPFLAGS = $(libscidata_structures_la_CPPFLAGS)
 
 # For the code check (splint)
-CHECK_SRC = $(DATA_STRUCTURES_C_SOURCES) $(GATEWAY_C_SOURCES)
+CHECK_SRC = $(DATA_STRUCTURES_C_SOURCES) $(GATEWAY_C_SOURCES) $(GATEWAY_CPP_SOURCES)
 INCLUDE_FLAGS = $(libscidata_structures_la_CFLAGS)
 libscidata_structures_la_LIBADD = libscidata_structures-algo.la
 
@@ -605,7 +626,7 @@ HELP_CHAPTERLANG = en_US fr_FR pt_BR
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .sci .bin .c .f .lo .o .obj
+.SUFFIXES: .sci .bin .c .cpp .f .lo .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.incl.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
@@ -681,7 +702,7 @@ clean-pkglibLTLIBRARIES:
 libscidata_structures-algo.la: $(libscidata_structures_algo_la_OBJECTS) $(libscidata_structures_algo_la_DEPENDENCIES) $(EXTRA_libscidata_structures_algo_la_DEPENDENCIES) 
        $(F77LINK) $(am_libscidata_structures_algo_la_rpath) $(libscidata_structures_algo_la_OBJECTS) $(libscidata_structures_algo_la_LIBADD) $(LIBS)
 libscidata_structures.la: $(libscidata_structures_la_OBJECTS) $(libscidata_structures_la_DEPENDENCIES) $(EXTRA_libscidata_structures_la_DEPENDENCIES) 
-       $(F77LINK) $(am_libscidata_structures_la_rpath) $(libscidata_structures_la_OBJECTS) $(libscidata_structures_la_LIBADD) $(LIBS)
+       $(CXXLINK) $(am_libscidata_structures_la_rpath) $(libscidata_structures_la_OBJECTS) $(libscidata_structures_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
@@ -692,6 +713,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidata_structures_algo_la-hmops.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidata_structures_algo_la-stcreate.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidata_structures_algo_la-strpos.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidata_structures_la-data_structures_gw.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidata_structures_la-gw_data_structures1.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidata_structures_la-gw_data_structures2.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscidata_structures_la-sci_definedfields.Plo@am__quote@
@@ -766,20 +788,6 @@ libscidata_structures_la-sci_definedfields.lo: sci_gateway/c/sci_definedfields.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscidata_structures_la-sci_definedfields.lo `test -f 'sci_gateway/c/sci_definedfields.c' || echo '$(srcdir)/'`sci_gateway/c/sci_definedfields.c
 
-libscidata_structures_la-sci_getfield.lo: sci_gateway/c/sci_getfield.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscidata_structures_la-sci_getfield.lo -MD -MP -MF $(DEPDIR)/libscidata_structures_la-sci_getfield.Tpo -c -o libscidata_structures_la-sci_getfield.lo `test -f 'sci_gateway/c/sci_getfield.c' || echo '$(srcdir)/'`sci_gateway/c/sci_getfield.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidata_structures_la-sci_getfield.Tpo $(DEPDIR)/libscidata_structures_la-sci_getfield.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_getfield.c' object='libscidata_structures_la-sci_getfield.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscidata_structures_la-sci_getfield.lo `test -f 'sci_gateway/c/sci_getfield.c' || echo '$(srcdir)/'`sci_gateway/c/sci_getfield.c
-
-libscidata_structures_la-sci_setfield.lo: sci_gateway/c/sci_setfield.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscidata_structures_la-sci_setfield.lo -MD -MP -MF $(DEPDIR)/libscidata_structures_la-sci_setfield.Tpo -c -o libscidata_structures_la-sci_setfield.lo `test -f 'sci_gateway/c/sci_setfield.c' || echo '$(srcdir)/'`sci_gateway/c/sci_setfield.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidata_structures_la-sci_setfield.Tpo $(DEPDIR)/libscidata_structures_la-sci_setfield.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_setfield.c' object='libscidata_structures_la-sci_setfield.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscidata_structures_la-sci_setfield.lo `test -f 'sci_gateway/c/sci_setfield.c' || echo '$(srcdir)/'`sci_gateway/c/sci_setfield.c
-
 libscidata_structures_la-sci_lstcat.lo: sci_gateway/c/sci_lstcat.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscidata_structures_la-sci_lstcat.lo -MD -MP -MF $(DEPDIR)/libscidata_structures_la-sci_lstcat.Tpo -c -o libscidata_structures_la-sci_lstcat.lo `test -f 'sci_gateway/c/sci_lstcat.c' || echo '$(srcdir)/'`sci_gateway/c/sci_lstcat.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscidata_structures_la-sci_lstcat.Tpo $(DEPDIR)/libscidata_structures_la-sci_lstcat.Plo
@@ -815,6 +823,48 @@ libscidata_structures_la-sci_rlist.lo: sci_gateway/c/sci_rlist.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscidata_structures_la-sci_rlist.lo `test -f 'sci_gateway/c/sci_rlist.c' || echo '$(srcdir)/'`sci_gateway/c/sci_rlist.c
 
+.cpp.o:
+@am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@  $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+libscidata_structures_la-data_structures_gw.lo: sci_gateway/cpp/data_structures_gw.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidata_structures_la-data_structures_gw.lo -MD -MP -MF $(DEPDIR)/libscidata_structures_la-data_structures_gw.Tpo -c -o libscidata_structures_la-data_structures_gw.lo `test -f 'sci_gateway/cpp/data_structures_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/data_structures_gw.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidata_structures_la-data_structures_gw.Tpo $(DEPDIR)/libscidata_structures_la-data_structures_gw.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/data_structures_gw.cpp' object='libscidata_structures_la-data_structures_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) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidata_structures_la-data_structures_gw.lo `test -f 'sci_gateway/cpp/data_structures_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/data_structures_gw.cpp
+
+libscidata_structures_la-sci_getfield.lo: sci_gateway/cpp/sci_getfield.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidata_structures_la-sci_getfield.lo -MD -MP -MF $(DEPDIR)/libscidata_structures_la-sci_getfield.Tpo -c -o libscidata_structures_la-sci_getfield.lo `test -f 'sci_gateway/cpp/sci_getfield.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_getfield.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidata_structures_la-sci_getfield.Tpo $(DEPDIR)/libscidata_structures_la-sci_getfield.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_getfield.cpp' object='libscidata_structures_la-sci_getfield.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) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidata_structures_la-sci_getfield.lo `test -f 'sci_gateway/cpp/sci_getfield.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_getfield.cpp
+
+libscidata_structures_la-sci_setfield.lo: sci_gateway/cpp/sci_setfield.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscidata_structures_la-sci_setfield.lo -MD -MP -MF $(DEPDIR)/libscidata_structures_la-sci_setfield.Tpo -c -o libscidata_structures_la-sci_setfield.lo `test -f 'sci_gateway/cpp/sci_setfield.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_setfield.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscidata_structures_la-sci_setfield.Tpo $(DEPDIR)/libscidata_structures_la-sci_setfield.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_setfield.cpp' object='libscidata_structures_la-sci_setfield.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) $(libscidata_structures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscidata_structures_la-sci_setfield.lo `test -f 'sci_gateway/cpp/sci_setfield.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_setfield.cpp
+
 .f.o:
        $(F77COMPILE) -c -o $@ $<
 
diff --git a/scilab/modules/data_structures/includes/data_structures_gw.hxx b/scilab/modules/data_structures/includes/data_structures_gw.hxx
new file mode 100644 (file)
index 0000000..26cb71d
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2013 - Scilab Enterprises - 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 __DATA_STRUCTURES_GW_HXX__
+#define __DATA_STRUCTURES_GW_HXX__
+
+#include "dynlib_data_structures.h"
+
+#include "cpp_gateway_prototype.hxx"
+
+class DataStructuresModule
+{
+private:
+    DataStructuresModule() {};
+    ~DataStructuresModule() {};
+
+public:
+    DATA_STRUCTURES_IMPEXP static int Load();
+};
+
+CPP_GATEWAY_PROTOTYPE(sci_getfield);
+CPP_GATEWAY_PROTOTYPE(sci_setfield);
+
+#endif /* !__DATA_STRUCTURES_GW_HXX__ */
index a77c646..421744b 100644 (file)
@@ -18,8 +18,8 @@
 /*--------------------------------------------------------------------------*/
 DATA_STRUCTURES_IMPEXP int gw_data_structures2(void);
 /*--------------------------------------------------------------------------*/
-int sci_getfield(char *fname,unsigned long fname_len);
-int sci_setfield(char *fname,unsigned long fname_len);
+//int sci_getfield(char *fname,unsigned long fname_len);
+//int sci_setfield(char *fname,unsigned long fname_len);
 /*--------------------------------------------------------------------------*/
 #endif /*  __GW_DATA_STRUCTURES2__ */
 /*--------------------------------------------------------------------------*/
index 13ef038..61592bd 100644 (file)
 /*--------------------------------------------------------------------------*/
 static gw_generic_table Tab[] =
 {
-       {sci_getfield, "getfield"},
-       {sci_setfield, "setfield"}
+    {NULL, ""}, //getfield
+    {NULL, ""} //setfield
 };
 /*--------------------------------------------------------------------------*/
 int gw_data_structures2(void)
 {
-       return 0;
+    return 0;
 }
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/data_structures/sci_gateway/c/sci_getfield.c b/scilab/modules/data_structures/sci_gateway/c/sci_getfield.c
deleted file mode 100644 (file)
index 6314bef..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007-2008 - INRIA - Allan CORNET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-/*--------------------------------------------------------------------------*/
-#include "machine.h"
-#include "gw_data_structures2.h"
-/*--------------------------------------------------------------------------*/
-extern int C2F(intgetfield)(); /* fortran */
-/*--------------------------------------------------------------------------*/
-int sci_getfield(char *fname,unsigned long fname_len)
-{
-       //C2F(intgetfield)();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/data_structures/sci_gateway/cpp/data_structures_gw.cpp b/scilab/modules/data_structures/sci_gateway/cpp/data_structures_gw.cpp
new file mode 100644 (file)
index 0000000..3f1e164
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2013 - Scilab Enterprises - 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 "data_structures_gw.hxx"
+#include "context.hxx"
+
+#define MODULE_NAME L"data_structures"
+
+extern "C"
+{
+#include "gw_data_structures1.h"
+#include "gw_data_structures2.h"
+}
+
+int DataStructuresModule::Load()
+{
+    symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getfield", &sci_getfield, MODULE_NAME));
+    symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"setfield", &sci_setfield, MODULE_NAME));
+    return 1;
+}
diff --git a/scilab/modules/data_structures/sci_gateway/cpp/sci_getfield.cpp b/scilab/modules/data_structures/sci_gateway/cpp/sci_getfield.cpp
new file mode 100644 (file)
index 0000000..b08b6d8
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2013 - Scilab Enterprises - 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 "data_structures_gw.hxx"
+#include "function.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "mlist.hxx"
+#include "tlist.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "MALLOC.h"
+#include "localization.h"
+#include "freeArrayOfString.h"
+}
+
+/*-----------------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_getfield(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if (in.size() != 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), "getfield", 2);
+        return types::Function::Error;
+    }
+
+    types::InternalType* pIndex = in[0];
+    types::List* pL = in[1]->getAs<types::List>();
+    std::vector<types::InternalType*> vOut;
+
+    if (pL->isList() == false && pL->isMList() == false && pL->isTList() == false)
+    {
+        Scierror(999, _("%s:  Wrong type for input argument #%d: List expected.\n"), "getfield", 2);
+        return types::Function::Error;
+    }
+
+    if (pIndex->isString())
+    {
+        //extraction by fieldnames
+        if (pL->isMList() == false && pL->isTList() == false)
+        {
+            Scierror(999, _("%s: Soft coded field names not yet implemented.\n"), "getfield");
+            return types::Function::Error;
+        }
+
+        types::TList* pT = pL->getAs<types::TList>();
+        types::String* pS = pIndex->getAs<types::String>();
+
+        std::list<std::wstring> stFields;
+
+        //check output arguments count
+        for (int i = 0 ; i < pS->getSize() ; i++)
+        {
+            std::wstring wst = pS->get(i);
+            if (pT->exists(wst) == false)
+            {
+                Scierror(999, _("%s: Invalid index.\n"), "getfield");
+                return types::Function::Error;
+            }
+
+            stFields.push_back(pS->get(i));
+        }
+
+        vOut = pT->extractStrings(stFields);
+    }
+    else
+    {
+        //extraction by index
+        types::typed_list Args;
+        Args.push_back(pIndex);
+        vOut = pL->extract(&Args);
+    }
+
+
+    if (_iRetCount < vOut.size())
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "getfield", vOut.size());
+        return types::Function::Error;
+    }
+
+    for (int i = 0 ; i < vOut.size() ; i++)
+    {
+        out.push_back(vOut[i]);
+    }
+
+    return types::Function::OK;
+}
+/*-----------------------------------------------------------------------------------*/
diff --git a/scilab/modules/data_structures/sci_gateway/cpp/sci_setfield.cpp b/scilab/modules/data_structures/sci_gateway/cpp/sci_setfield.cpp
new file mode 100644 (file)
index 0000000..bf3b442
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2013 - Scilab Enterprises - 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 "data_structures_gw.hxx"
+#include "function.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "mlist.hxx"
+#include "tlist.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "MALLOC.h"
+#include "localization.h"
+#include "freeArrayOfString.h"
+}
+
+/*-----------------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_setfield(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if (in.size() != 3)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), "setfield", 2);
+        return types::Function::Error;
+    }
+
+    if (_iRetCount > 1)
+    {
+        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "setfield", 0);
+        return types::Function::Error;
+    }
+
+
+    types::InternalType* pIndex = in[0];
+    types::InternalType* pData = in[1];
+    types::List* pL = in[2]->getAs<types::List>();
+
+    if (pL->isList() == false && pL->isMList() == false && pL->isTList() == false)
+    {
+        Scierror(999, _("%s:  Wrong type for input argument #%d: List expected.\n"), "setfield", 3);
+        return types::Function::Error;
+    }
+
+    if (pIndex->isString())
+    {
+        //insertion by fieldname
+        types::String* pS = pIndex->getAs<types::String>();
+        if ((pL->isMList() == false && pL->isTList() == false) || pS->getSize() != 1)
+        {
+            Scierror(999, _("%s: Not implemented in scilab...\n"), "setfield");
+            return types::Function::Error;
+        }
+
+        types::TList* pT = pL->getAs<types::TList>();
+
+        std::wstring stField = pS->get(0);
+        if (pT->set(stField, pData) == false)
+        {
+            Scierror(999, _("%s: Invalid index.\n"), "setfield");
+            return types::Function::Error;
+        }
+    }
+    else
+    {
+        //insertion by index
+        types::typed_list Args;
+        Args.push_back(pIndex);
+        pL->insert(&Args, pData);
+    }
+
+    return types::Function::OK;
+}
+/*-----------------------------------------------------------------------------------*/
index 93e1696..d4a7fd6 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
@@ -76,7 +76,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../string/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../data_structures/includes;../../../api_scilab/includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../string/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../data_structures/includes;../../../api_scilab/includes;../../../operations/includes;../../../symbol/includes;../../../types/includes;../../../ast/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;DATA_STRUCTURES_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -105,7 +105,7 @@ lib /DEF:"$(ProjectDir)linpack_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../string/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../data_structures/includes;../../../api_scilab/includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../string/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../data_structures/includes;../../../api_scilab/includes;../../../operations/includes;../../../symbol/includes;../../../types/includes;../../../ast/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;DATA_STRUCTURES_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -132,7 +132,7 @@ lib /DEF:"$(ProjectDir)linpack_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../string/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../data_structures/includes;../../../api_scilab/includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../string/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../data_structures/includes;../../../api_scilab/includes;../../../operations/includes;../../../symbol/includes;../../../types/includes;../../../ast/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;DATA_STRUCTURES_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -166,7 +166,7 @@ lib /DEF:"$(ProjectDir)linpack_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../string/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../data_structures/includes;../../../api_scilab/includes;../../../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../string/includes;../../../core/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../dynamic_link/src/c;../../../localization/includes;../../../core/src/c;../../../../libs/intl;../../../data_structures/includes;../../../api_scilab/includes;../../../operations/includes;../../../symbol/includes;../../../types/includes;../../../ast/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;DATA_STRUCTURES_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -194,6 +194,9 @@ lib /DEF:"$(ProjectDir)linpack_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\..\sci_gateway\cpp\data_structures_gw.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_getfield.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_setfield.cpp" />
     <ClCompile Include="DllmainData_structures.c" />
     <ClCompile Include="..\..\sci_gateway\c\gw_data_structures1.c" />
     <ClCompile Include="..\..\sci_gateway\c\gw_data_structures2.c" />
@@ -202,17 +205,16 @@ lib /DEF:"$(ProjectDir)linpack_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Disabled</Optimization>
     </ClCompile>
     <ClCompile Include="..\..\sci_gateway\c\sci_definedfields.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_getfield.c" />
     <ClCompile Include="..\..\sci_gateway\c\sci_glist.c" />
     <ClCompile Include="..\..\sci_gateway\c\sci_lsslist.c" />
     <ClCompile Include="..\..\sci_gateway\c\sci_lstcat.c" />
     <ClCompile Include="..\..\sci_gateway\c\sci_lstsize.c" />
     <ClCompile Include="..\..\sci_gateway\c\sci_rlist.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_setfield.c" />
     <ClCompile Include="strpos.c" />
     <ClCompile Include="stcreate.c" />
   </ItemGroup>
   <ItemGroup>
+    <ClInclude Include="..\..\includes\data_structures_gw.hxx" />
     <ClInclude Include="..\..\includes\dynlib_data_structures.h" />
     <ClInclude Include="..\..\includes\gw_data_structures1.h" />
     <ClInclude Include="..\..\includes\gw_data_structures2.h" />
@@ -252,6 +254,12 @@ lib /DEF:"$(ProjectDir)linpack_f_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
       <Project>{8d45767a-9b03-4905-97f6-d2f3f79141ea}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\symbol\symbol.vcxproj">
+      <Project>{2c60033b-0dbd-4ca4-80d3-176c9be9ce2f}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\types\types.vcxproj">
+      <Project>{64e090da-dcb5-4f4d-93d7-e88ddec9c2ef}</Project>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
index 82b1111..616bccc 100644 (file)
@@ -38,9 +38,6 @@
     <ClCompile Include="..\..\sci_gateway\c\sci_definedfields.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_getfield.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\sci_gateway\c\sci_glist.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\..\sci_gateway\c\sci_rlist.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_setfield.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="stcreate.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="strpos.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\sci_gateway\cpp\data_structures_gw.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_getfield.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_setfield.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\includes\dynlib_data_structures.h">
@@ -82,6 +85,9 @@
     <ClInclude Include="stcreate.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\includes\data_structures_gw.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="data_structures_f_Import.def">
index 86b19b3..aad7fca 100644 (file)
@@ -25,7 +25,8 @@ sci_gateway/cpp/sci_whereis.cpp \
 sci_gateway/cpp/sci_execstr.cpp \
 sci_gateway/cpp/sci_getCurrentThreadId.cpp \
 sci_gateway/cpp/sci_mode.cpp \
-sci_gateway/cpp/sci_getThreads.cpp
+sci_gateway/cpp/sci_getThreads.cpp \
+sci_gateway/cpp/sci_macrovar.cpp
 
 GATEWAY_FORTRAN_SOURCES = \
 sci_gateway/fortran/intlib.f \
index 9b3306c..4b29c75 100644 (file)
@@ -155,7 +155,8 @@ am__objects_5 = libscifunctions_la-sci_exec.lo \
        libscifunctions_la-sci_execstr.lo \
        libscifunctions_la-sci_getCurrentThreadId.lo \
        libscifunctions_la-sci_mode.lo \
-       libscifunctions_la-sci_getThreads.lo
+       libscifunctions_la-sci_getThreads.lo \
+       libscifunctions_la-sci_macrovar.lo
 am_libscifunctions_la_OBJECTS = $(am__objects_3) $(am__objects_4) \
        $(am__objects_5)
 libscifunctions_la_OBJECTS = $(am_libscifunctions_la_OBJECTS)
@@ -488,7 +489,8 @@ sci_gateway/cpp/sci_whereis.cpp \
 sci_gateway/cpp/sci_execstr.cpp \
 sci_gateway/cpp/sci_getCurrentThreadId.cpp \
 sci_gateway/cpp/sci_mode.cpp \
-sci_gateway/cpp/sci_getThreads.cpp
+sci_gateway/cpp/sci_getThreads.cpp \
+sci_gateway/cpp/sci_macrovar.cpp
 
 GATEWAY_FORTRAN_SOURCES = \
 sci_gateway/fortran/intlib.f \
@@ -719,6 +721,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifunctions_la-sci_lib.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifunctions_la-sci_librarieslist.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifunctions_la-sci_libraryinfo.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifunctions_la-sci_macrovar.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifunctions_la-sci_mode.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifunctions_la-sci_whereis.Plo@am__quote@
 
@@ -883,6 +886,13 @@ libscifunctions_la-sci_getThreads.lo: sci_gateway/cpp/sci_getThreads.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) $(libscifunctions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscifunctions_la-sci_getThreads.lo `test -f 'sci_gateway/cpp/sci_getThreads.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_getThreads.cpp
 
+libscifunctions_la-sci_macrovar.lo: sci_gateway/cpp/sci_macrovar.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifunctions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscifunctions_la-sci_macrovar.lo -MD -MP -MF $(DEPDIR)/libscifunctions_la-sci_macrovar.Tpo -c -o libscifunctions_la-sci_macrovar.lo `test -f 'sci_gateway/cpp/sci_macrovar.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_macrovar.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscifunctions_la-sci_macrovar.Tpo $(DEPDIR)/libscifunctions_la-sci_macrovar.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_macrovar.cpp' object='libscifunctions_la-sci_macrovar.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) $(libscifunctions_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscifunctions_la-sci_macrovar.lo `test -f 'sci_gateway/cpp/sci_macrovar.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_macrovar.cpp
+
 .f.o:
        $(F77COMPILE) -c -o $@ $<
 
index d93aff4..3c21baf 100644 (file)
@@ -24,6 +24,7 @@ CPP_GATEWAY_PROTOTYPE_EXPORT(sci_whereis, FUNCTIONS_GW_IMPEXP);
 CPP_GATEWAY_PROTOTYPE_EXPORT(sci_getCurrentThreadId, FUNCTIONS_GW_IMPEXP);
 CPP_GATEWAY_PROTOTYPE_EXPORT(sci_mode, FUNCTIONS_GW_IMPEXP);
 CPP_GATEWAY_PROTOTYPE_EXPORT(sci_getThreads, FUNCTIONS_GW_IMPEXP);
+CPP_GATEWAY_PROTOTYPE_EXPORT(sci_macrovar, FUNCTIONS_GW_IMPEXP);
 
 #endif /* __FUNCTIONS_GW_HXX__ */
 
diff --git a/scilab/modules/functions/macros/macrovar.sci b/scilab/modules/functions/macros/macrovar.sci
deleted file mode 100644 (file)
index 7da202a..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 1992-2008 - INRIA - Serge STEER <serge.steer@inria.fr>
-//
-// This file must be used under the terms of the CeCILL.
-// This source file is licensed as described in the file COPYING, which
-// you should have received as part of this distribution.  The terms
-// are also available at
-// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-
-function vars=macrovar(macro)
-// Returns in a list the set of varibles used by a macro
-//    mac  : macro
-//    vars : list(in,out,globals,called,locals)
-//           in : input variables
-//           out: output variables
-//           globals: global variables
-//           called : macros called
-//           locals : local variables
-//!
-if type(macro)==11 then comp(macro),end
-if type(macro)<>13 then 
-  error(msprintf(gettext("%s: Wrong type for input argument #%d: Scilab function expected.\n"),"macrovar",1)),
-end
-lst=macr2lst(macro);
-out=lst(2)',if prod(size(out))==0 then out =[],end
-in=lst(3)'
-vars=[]
-getted=[]
-[vars,getted]=listvars(lst)
-ng=prod(size(getted))
-globals=[],called=[]
-for k=1:ng
-  if (find(getted(k)==vars)==[])&(find(getted(k)==in)==[]) then 
-    clear w //to avoid redefinition warning (bug 1774)
-    ierr=execstr('w='+getted(k),'errcatch')
-    if ierr==0 then //the variable exists
-      if or(type(w)==[13 130 11]) then
-        called=[called;getted(k)]
-      else
-        globals=[globals;getted(k)]
-      end
-    else
-      globals=[globals;getted(k)]
-      lasterror(%t)  // clear the error (bug 2393)
-    end
-  end
-end
-locals=[]
-nl=prod(size(vars))
-for k=1:nl
-  if (find(vars(k)==in)==[])&(find(vars(k)==out)==[]) then 
-    locals=[locals;vars(k)]
-  end
-end
-vars=list(in,out,globals,called,locals)
-
-endfunction
-
-function [vars,getted]=listvars(lst)
-for lstk=lst
-  if type(lstk)==15 then
-    [vars,getted]=listvars(lstk)
-  else
-    if lstk(1)=='1'|lstk(1)=='for' then 
-      // case 1 retained for 2.7 and earlier versions
-       vars=[vars;addvar(lstk(2))],
-    elseif lstk(1)=='29' then 
-      nlhs=(size(lstk,'*')-2)/2
-      for k=0:nlhs-1
-       vars=[vars;addvar(lstk(3+2*k))],
-      end
-    elseif or(lstk(1)==['2','20']) then 
-       getted=[getted;addget(lstk(2))],
-    end
-  end
-end
-
-endfunction
-function vnam=addvar(vnam)
-if find(vnam==vars)<>[] then 
-  vnam=[]
-end
-
-endfunction
-function vnam=addget(vnam)
-if find(vnam==getted)<>[] then 
-  vnam=[]
-end
-endfunction
index 726fe99..a5f31c0 100644 (file)
     <ClCompile Include="sci_functionlist.cpp" />
     <ClCompile Include="sci_getCurrentThreadId.cpp" />
     <ClCompile Include="sci_getThreads.cpp" />
+    <ClCompile Include="sci_macrovar.cpp" />
     <ClCompile Include="sci_mode.cpp" />
     <ClCompile Include="sci_whereis.cpp" />
   </ItemGroup>
index d8a3242..588b87a 100644 (file)
@@ -36,6 +36,9 @@
     <ClCompile Include="sci_whereis.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="sci_macrovar.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\includes\dynlib_functions_gw.h">
diff --git a/scilab/modules/functions/sci_gateway/cpp/sci_macrovar.cpp b/scilab/modules/functions/sci_gateway/cpp/sci_macrovar.cpp
new file mode 100644 (file)
index 0000000..578a30a
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2013 - Scilab Enterprises - 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 <string.h>
+#include "parser.hxx"
+#include "funcmanager.hxx"
+#include "context.hxx"
+#include "functions_gw.hxx"
+#include "macrovarvisitor.hxx"
+#include "list.hxx"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+extern "C"
+{
+#include "Scierror.h"
+#include "localization.h"
+}
+
+using namespace types;
+using namespace ast;
+using namespace std;
+
+InternalType* createString(std::list<std::wstring>& lst);
+void addIn(MacrovarVisitor& pVisit, std::list<symbol::Symbol>* pSym);
+void addOut(MacrovarVisitor& pVisit, std::list<symbol::Symbol>* pSym);
+
+Function::ReturnValue sci_macrovar(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if (in.size() != 1)
+    {
+        Scierror(999, _("%s: Wrong number of input arguments: %d expected.\n"), "macrovar" , 1);
+        return Function::Error;
+    }
+
+    if (_iRetCount != 1)
+    {
+        Scierror(999, _("%s: Wrong number of output arguments: %d expected.\n"), "macrovar" , 1);
+        return Function::Error;
+    }
+
+    Macro* pM = NULL;
+    switch (in[0]->getType())
+    {
+        case InternalType::RealMacro :
+        {
+            pM = in[0]->getAs<Macro>();
+            break;
+        }
+        case InternalType::RealMacroFile :
+        {
+            MacroFile* pMF = in[0]->getAs<MacroFile>();
+            pM = pMF->getMacro();
+            break;
+        }
+        default :
+            Scierror(999, _("%s: Wrong type for input arguments: macro expected.\n"), "macrovar");
+            return Function::Error;
+    }
+
+
+    MacrovarVisitor visit;
+
+    addIn(visit, pM->inputs_get());
+    addOut(visit, pM->outputs_get());
+
+    pM->getBody()->accept(visit);
+
+    List* pL = new List();
+
+    pL->append(createString(visit.getIn()));
+    pL->append(createString(visit.getOut()));
+    pL->append(createString(visit.getExternal()));
+    pL->append(createString(visit.getCalled()));
+    pL->append(createString(visit.getLocal()));
+
+    out.push_back(pL);
+    return Function::OK;
+}
+
+
+InternalType* createString(std::list<std::wstring>& lst)
+{
+    if (lst.size() == 0)
+    {
+        return Double::Empty();
+    }
+
+    String* pS = new String((int)lst.size(), 1);
+    std::list<std::wstring>::iterator it = lst.begin();
+    for (int i = 0 ; it != lst.end() ; it++, i++)
+    {
+        pS->set(i, (*it).c_str());
+    }
+
+    return pS;
+}
+
+void addOut(MacrovarVisitor& visit, std::list<symbol::Symbol>* pSym)
+{
+    if (pSym == 0 || pSym->size() == 0)
+    {
+        return;
+    }
+
+    std::list<symbol::Symbol>::iterator it = pSym->begin();
+    for (int i = 0 ; it != pSym->end() ; it++, i++)
+    {
+        visit.addOut((*it).name_get().c_str());
+    }
+}
+
+void addIn(MacrovarVisitor& visit, std::list<symbol::Symbol>* pSym)
+{
+    if (pSym == 0 || pSym->size() == 0)
+    {
+        return;
+    }
+
+    std::list<symbol::Symbol>::iterator it = pSym->begin();
+    for (int i = 0 ; it != pSym->end() ; it++, i++)
+    {
+        visit.addIn((*it).name_get().c_str());
+    }
+}
\ No newline at end of file
index a74df84..ae22971 100644 (file)
@@ -26,4 +26,5 @@
     <gateway name="sci_getCurrentThreadId"  function="getCurrentThreadId"   type="1" />
     <gateway name="sci_mode"                function="mode"                 type="1" />
     <gateway name="sci_getThreads"          function="getThreads"           type="1" />
+    <gateway name="sci_macrovar"            function="macrovar"           type="1" />
 </module>
index a084de4..2246323 100644 (file)
       <Project>{c6e2bc17-34d8-46e4-85f3-6293cb21adcd}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\data_structures\src\c\data_structures.vcxproj">
+      <Project>{b7a168a0-dfc0-4c6d-b0cc-6079912a4a76}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\dynamic_link\sci_gateway\cpp\dynamic_link_gw.vcxproj">
       <Project>{f93ff3ee-217a-4554-ab17-2f8d56b4bf4b}</Project>
     </ProjectReference>
index c34bdcc..9c96a2a 100644 (file)
@@ -47,4 +47,5 @@
 #include "../../graphics/includes/graphics_gw.hxx"
 #include "../../interpolation/includes/interpolation_gw.hxx"
 #include "../../polynomials/includes/polynomials_gw.hxx"
+#include "../../data_structures/includes/data_structures_gw.hxx"
 #endif /* !__MODULE_DECLARATION_HXX__ */
index bee4583..e8b9990 100644 (file)
@@ -327,6 +327,7 @@ bool FuncManager::CreateModuleList(void)
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"graphic_export", &GraphicExportModule::Load));
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"polynomials", &PolynomialsModule::Load));
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"arnoldi", &ArnoldiModule::Load));
+    m_ModuleMap.insert(pair<wstring, GW_MOD>(L"data_structures", &DataStructuresModule::Load));
 
     if (ConfigVariable::getScilabMode() != SCILAB_NWNI)
     {
index c54b20f..50d70a5 100644 (file)
@@ -751,10 +751,12 @@ int EqualToSparseAndSparse(Sparse* _pSparse1, Sparse* _pSparse2, GenericType** _
             || _pSparse1->isScalar() || _pSparse2->isScalar()) //scalar cases
     {
         *_pOut = _pSparse1->newEqualTo(*_pSparse2);
-        return 0;
     }
-
-    return 1;
+    else
+    {
+        *_pOut = new Bool(false);
+    }
+    return 0;
 }
 
 int EqualToDoubleAndSparse(Double* _pDouble, Sparse* _pSparse, GenericType** _pOut)
index 68174d4..137fdf3 100644 (file)
@@ -18,14 +18,14 @@ using namespace types;
 
 InternalType *GenericComparisonNonEqual(InternalType *_pLeftOperand, InternalType *_pRightOperand)
 {
-    if(_pLeftOperand->isSparse() && _pRightOperand->isSparse())
+    if (_pLeftOperand->isSparse() && _pRightOperand->isSparse())
     {
         InternalType *pResult = NULL;
         Sparse* pL = _pLeftOperand->getAs<Sparse>();
         Sparse* pR = _pRightOperand->getAs<Sparse>();
 
         int iResult = NotEqualToSparseAndSparse(pL, pR, (GenericType**)&pResult);
-        if(iResult)
+        if (iResult)
         {
             throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
         }
@@ -35,26 +35,27 @@ InternalType *GenericComparisonNonEqual(InternalType *_pLeftOperand, InternalTyp
     else
     {
         InternalType* pResult = GenericComparisonEqual(_pLeftOperand, _pRightOperand);
-        if(pResult == NULL)
-        {//to call overloading
+        if (pResult == NULL)
+        {
+            //to call overloading
             return NULL;
         }
 
-        if(pResult->isBool())
+        if (pResult->isBool())
         {
             Bool *pB = pResult->getAs<Bool>();
-            for(int i = 0 ; i < pB->getSize() ; i++)
+            for (int i = 0 ; i < pB->getSize() ; i++)
             {
                 pB->set(i, pB->get(i) == 0);
             }
             return pB;
         }
-        else if(pResult->isSparseBool())
+        else if (pResult->isSparseBool())
         {
             SparseBool *pSB = pResult->getAs<SparseBool>();
-            for(int i = 0 ; i < pSB->getRows() ; i++)
+            for (int i = 0 ; i < pSB->getRows() ; i++)
             {
-                for(int j = 0 ; j < pSB->getCols() ; j++)
+                for (int j = 0 ; j < pSB->getCols() ; j++)
                 {
                     bool b = !pSB->get(i, j);
                     pSB->set(i, j, !pSB->get(i, j));
@@ -69,12 +70,15 @@ InternalType *GenericComparisonNonEqual(InternalType *_pLeftOperand, InternalTyp
 
 int NotEqualToSparseAndSparse(Sparse* _pSparse1, Sparse* _pSparse2, GenericType** _pOut)
 {
-    if((_pSparse1->getRows() == _pSparse2->getRows() && _pSparse1->getCols() == _pSparse2->getCols()) //matrix case
-        || _pSparse1->isScalar() || _pSparse2->isScalar()) //scalar cases
+    if ((_pSparse1->getRows() == _pSparse2->getRows() && _pSparse1->getCols() == _pSparse2->getCols()) //matrix case
+            || _pSparse1->isScalar() || _pSparse2->isScalar()) //scalar cases
     {
         *_pOut = _pSparse1->newNotEqualTo(*_pSparse2);
-        return 0;
+    }
+    else
+    {
+        *_pOut = new Bool(true);
     }
 
-    return 1;
+    return 0;
 }
index 1044b00..31879cf 100644 (file)
@@ -394,9 +394,21 @@ int SubstractDoubleToDouble(Double* _pDouble1, Double* _pDouble2, Double** _pDou
 
         //return opposite
         double* pDbl = (*_pDoubleOut)->get();
-        for (int i = 0 ; i < _pDouble2->getSize() ; i++)
+        if ((*_pDoubleOut)->isComplex())
         {
-            pDbl[i] = -pDbl[i];
+            double* pDblImg = (*_pDoubleOut)->getImg();
+            for (int i = 0 ; i < _pDouble2->getSize() ; i++)
+            {
+                pDbl[i] = -pDbl[i];
+                pDblImg[i] = -pDblImg[i];
+            }
+        }
+        else
+        {
+            for (int i = 0 ; i < _pDouble2->getSize() ; i++)
+            {
+                pDbl[i] = -pDbl[i];
+            }
         }
         return 0;
     }
index c7c5250..d00913a 100644 (file)
@@ -9,7 +9,8 @@ SPARSE_FORTRAN_SOURCES = \
 src/fortran/isort1.f \
 src/fortran/spt.f \
 src/fortran/sz2ptr.f \
-src/fortran/spreshape.f
+src/fortran/spreshape.f \
+src/fortran/ordmmd.f
 
 GATEWAY_C_SOURCES =
 
@@ -23,7 +24,8 @@ sci_gateway/cpp/sci_sparse.cpp \
 sci_gateway/cpp/sci_spcompack.cpp \
 sci_gateway/cpp/sci_spget.cpp \
 sci_gateway/cpp/sci_spzeros.cpp \
-sci_gateway/cpp/sci_spones.cpp
+sci_gateway/cpp/sci_spones.cpp \
+sci_gateway/cpp/sci_ordmmd.cpp
 
 
 libscisparse_la_CPPFLAGS = -I$(srcdir)/includes/ \
index 19a9155..1c38f62 100644 (file)
@@ -135,7 +135,7 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" \
 LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES)
 libscisparse_algo_la_LIBADD =
 am__objects_1 =
-am__objects_2 = isort1.lo spt.lo sz2ptr.lo spreshape.lo
+am__objects_2 = isort1.lo spt.lo sz2ptr.lo spreshape.lo ordmmd.lo
 am_libscisparse_algo_la_OBJECTS = $(am__objects_1) $(am__objects_2)
 libscisparse_algo_la_OBJECTS = $(am_libscisparse_algo_la_OBJECTS)
 @MAINTAINER_MODE_FALSE@am_libscisparse_algo_la_rpath =
@@ -146,7 +146,7 @@ am__objects_3 = libscisparse_la-sparse_gw.lo \
        libscisparse_la-sci_nnz.lo libscisparse_la-sci_sp2adj.lo \
        libscisparse_la-sci_sparse.lo libscisparse_la-sci_spcompack.lo \
        libscisparse_la-sci_spget.lo libscisparse_la-sci_spzeros.lo \
-       libscisparse_la-sci_spones.lo
+       libscisparse_la-sci_spones.lo libscisparse_la-sci_ordmmd.lo
 am_libscisparse_la_OBJECTS = $(am__objects_1) $(am__objects_3)
 libscisparse_la_OBJECTS = $(am_libscisparse_la_OBJECTS)
 @MAINTAINER_MODE_FALSE@am_libscisparse_la_rpath =
@@ -454,7 +454,8 @@ SPARSE_FORTRAN_SOURCES = \
 src/fortran/isort1.f \
 src/fortran/spt.f \
 src/fortran/sz2ptr.f \
-src/fortran/spreshape.f
+src/fortran/spreshape.f \
+src/fortran/ordmmd.f
 
 GATEWAY_C_SOURCES = 
 GATEWAY_CPP_SOURCES = \
@@ -467,7 +468,8 @@ sci_gateway/cpp/sci_sparse.cpp \
 sci_gateway/cpp/sci_spcompack.cpp \
 sci_gateway/cpp/sci_spget.cpp \
 sci_gateway/cpp/sci_spzeros.cpp \
-sci_gateway/cpp/sci_spones.cpp
+sci_gateway/cpp/sci_spones.cpp \
+sci_gateway/cpp/sci_ordmmd.cpp
 
 libscisparse_la_CPPFLAGS = -I$(srcdir)/includes/ \
                                -I$(top_srcdir)/modules/ast/includes/ \
@@ -671,6 +673,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisparse_la-sci_adj2sp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisparse_la-sci_full.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisparse_la-sci_nnz.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisparse_la-sci_ordmmd.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisparse_la-sci_sp2adj.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisparse_la-sci_sparse.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscisparse_la-sci_spcompack.Plo@am__quote@
@@ -770,6 +773,13 @@ libscisparse_la-sci_spones.lo: sci_gateway/cpp/sci_spones.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) $(libscisparse_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscisparse_la-sci_spones.lo `test -f 'sci_gateway/cpp/sci_spones.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_spones.cpp
 
+libscisparse_la-sci_ordmmd.lo: sci_gateway/cpp/sci_ordmmd.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscisparse_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscisparse_la-sci_ordmmd.lo -MD -MP -MF $(DEPDIR)/libscisparse_la-sci_ordmmd.Tpo -c -o libscisparse_la-sci_ordmmd.lo `test -f 'sci_gateway/cpp/sci_ordmmd.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_ordmmd.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscisparse_la-sci_ordmmd.Tpo $(DEPDIR)/libscisparse_la-sci_ordmmd.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_ordmmd.cpp' object='libscisparse_la-sci_ordmmd.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) $(libscisparse_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscisparse_la-sci_ordmmd.lo `test -f 'sci_gateway/cpp/sci_ordmmd.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_ordmmd.cpp
+
 .f.o:
        $(F77COMPILE) -c -o $@ $<
 
@@ -791,6 +801,9 @@ sz2ptr.lo: src/fortran/sz2ptr.f
 spreshape.lo: src/fortran/spreshape.f
        $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o spreshape.lo `test -f 'src/fortran/spreshape.f' || echo '$(srcdir)/'`src/fortran/spreshape.f
 
+ordmmd.lo: src/fortran/ordmmd.f
+       $(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o ordmmd.lo `test -f 'src/fortran/ordmmd.f' || echo '$(srcdir)/'`src/fortran/ordmmd.f
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index 04bb577..52a4662 100644 (file)
@@ -37,5 +37,6 @@ CPP_GATEWAY_PROTOTYPE(sci_spget);
 CPP_GATEWAY_PROTOTYPE(sci_spzeros);
 CPP_GATEWAY_PROTOTYPE(sci_spones);
 CPP_GATEWAY_PROTOTYPE(sci_full);
+CPP_GATEWAY_PROTOTYPE(sci_ordmmd);
 
 #endif /* !__SPARSE_GW_HXX__ */
diff --git a/scilab/modules/sparse/macros/sp2adj.sci b/scilab/modules/sparse/macros/sp2adj.sci
deleted file mode 100644 (file)
index 17cb5dd..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) XXXX-2008 - INRIA
-// Copyright (C) 2010 - DIGITEO - Michael Baudin
-// 
-// This file must be used under the terms of the CeCILL.
-// This source file is licensed as described in the file COPYING, which
-// you should have received as part of this distribution.  The terms
-// are also available at    
-// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-
-
-function [xadj,iadj,v]=sp2adj(A)
-    // sparse conversion to adjacency
-    // See sp2adj.xml for help.
-    //
-    // Check number of arguments
-    [lhs, rhs] = argn()
-    if ( rhs <> 1 ) then
-        lstr = gettext("%s: Wrong number of input arguments: %d to %d expected.\n")
-        error ( msprintf(lstr,"sp2adj",1,1))
-    end
-    if ( and(lhs <> [0 1 2 3]) ) then
-        lstr = gettext("%s: Wrong number of output arguments: %d to %d expected.\n")
-        error ( msprintf(lstr,"sp2adj",0,3))
-    end
-    //
-    // Check type of arguments
-    if ( typeof(A) <> "sparse" ) then
-        lstr = gettext("%s: Wrong type for input argument #%d.\n")
-        error ( msprintf(lstr,"sp2adj",1))
-    end
-    //
-    // Check size of arguments
-    // Nothing to do
-    //
-    // Check content of arguments
-    // Nothing to do
-    //
-    [ij,v,n]=spget(A')
-    N=n(1)
-    if ( ij == [] ) then,
-        xadj=ones(n(2)+1,1)
-        iadj=[]
-        v=[]
-    else,
-        [xadj,la,iadj]=ta2lpd(ij(:,1)',ij(:,2)',N+1,N)
-        xadj=xadj(:)
-        iadj=iadj(:)
-    end
-endfunction
diff --git a/scilab/modules/sparse/sci_gateway/cpp/sci_ordmmd.cpp b/scilab/modules/sparse/sci_gateway/cpp/sci_ordmmd.cpp
new file mode 100644 (file)
index 0000000..6ce92a5
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2010-2010 - DIGITEO - Bernard HUGUENEY
+*
+*  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 <iostream>
+#include "sparse_gw.hxx"
+#include "function.hxx"
+#include "sparse.hxx"
+
+extern "C"
+{
+#include "charEncoding.h"
+#include "Scierror.h"
+#include "localization.h"
+}
+
+extern "C" int C2F(ordmmd)(int* neqns, int* xadj, int* adjncy, int* invp, int* perm,
+                           int* iwsiz, int* iwork, int* nofsub, int* iflag);
+
+using namespace types;
+
+Function::ReturnValue sci_ordmmd(typed_list &in, int _iRetCount, typed_list &out)
+{
+    if (in.size() != 3)
+    {
+        Scierror(999, _("%s: Wrong number of input argument(s): %d expected.\n"), "ordmmd", 3);
+        return Function::Error;
+    }
+
+    if (_iRetCount != 3)
+    {
+        Scierror(999, _("%s: Wrong number of output arguments: %d expected.\n"), "ordmmd", 3);
+        return Function::Error;
+    }
+
+
+    //get argument #1
+    if (in[0]->isDouble() == false)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: A matrix of integer value expected.\n"), "ordmmd", 1);
+        return Function::Error;
+    }
+
+    Double* pdbl1 = in[0]->getAs<Double>();
+    pdbl1->convertToInteger();
+    int* pXADJ = (int*)pdbl1->get();
+
+    //get argument #2
+    if (in[1]->isDouble() == false)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: A matrix of integer value expected.\n"), "ordmmd", 2);
+        return Function::Error;
+    }
+
+    Double* pdbl2 = in[1]->getAs<Double>();
+    pdbl2->convertToInteger();
+    int* pADJNCY = (int*)pdbl2->get();
+
+    //get argument #3
+    Double* pdbl3 = in[2]->getAs<Double>();
+    if (in[2]->isDouble() == false || pdbl3->getSize() != 1)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: An integer value expected.\n"), "ordmmd", 3);
+        return Function::Error;
+    }
+
+    int NEQNS = (int)pdbl3->get(0);
+
+    Double* pdbl4 = new Double(NEQNS, 1);
+    pdbl4->convertToInteger();
+
+    Double* pdbl5 = new Double(NEQNS, 1);
+    pdbl5->convertToInteger();
+
+    Double* pdbl6 = new Double(1, 1);
+    pdbl6->convertToInteger();
+
+    Double* pdbl7 = new Double(4 * NEQNS, 1);
+    pdbl7->convertToInteger();
+    int iSize = 4 * NEQNS;
+
+    int iFlag = 0;
+    C2F(ordmmd)(&NEQNS, (int*)pdbl1->get(), (int*)pdbl2->get(), (int*)pdbl5->get(),
+                (int*)pdbl4->get(), &iSize, (int*)pdbl7->get(), (int*)pdbl6->get(), &iFlag);
+
+    if (iFlag)
+    {
+        Scierror(999, _("%s: insufficient working storage"), "ordmmd");
+        return Function::Error;
+    }
+
+    pdbl1->convertFromInteger();
+    pdbl2->convertFromInteger();
+    pdbl4->convertFromInteger();
+    pdbl5->convertFromInteger();
+    pdbl6->convertFromInteger();
+    pdbl7->convertFromInteger();
+    delete pdbl7;
+
+    out.push_back(pdbl4);
+    out.push_back(pdbl5);
+    out.push_back(pdbl6);
+
+    return Function::OK;
+}
+
index 16870d5..d7b2a58 100644 (file)
@@ -187,6 +187,12 @@ Function::ReturnValue sci_sparse(typed_list &in, int _piRetCount, typed_list &ou
                 Scierror(999, _("%s: Wrong size for input argument #%d: A matrix of size %d x %d expected.\n"), "sparse", 3, 1, 2);
                 return Function::Error;
             }
+
+            if (pDims->get(0) * pDims->get(1) == 0)
+            {
+                out.push_back(types::Double::Empty());
+                return types::Function::OK;
+            }
         }
 
         types::GenericType* pGT1 = in[0]->getAs<types::GenericType>();
diff --git a/scilab/modules/sparse/sci_gateway/cpp/sparse_f_Import.def b/scilab/modules/sparse/sci_gateway/cpp/sparse_f_Import.def
new file mode 100644 (file)
index 0000000..40dc192
--- /dev/null
@@ -0,0 +1,6 @@
+LIBRARY    sparse_f.dll
+
+
+EXPORTS
+ordmmd_
+
index 8ac3d6e..3069847 100644 (file)
@@ -25,6 +25,6 @@ int SparseModule::Load()
     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"spzeros", &sci_spzeros, MODULE_NAME));
     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"spones", &sci_spones, MODULE_NAME));
     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"full", &sci_full, MODULE_NAME));
-
+    symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"ordmmd", &sci_ordmmd, MODULE_NAME));
     return 1;
 }
index 03072b5..9ffcfe6 100644 (file)
       <ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary>
       <TargetMachine>MachineX86</TargetMachine>
       <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <AdditionalDependencies>sparse_f.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
+    <PreLinkEvent>
+      <Command>lib /DEF:"$(ProjectDir)sparse_f_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)sparse_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+    </PreLinkEvent>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <Midl>
       <ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary>
       <TargetMachine>MachineX64</TargetMachine>
       <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <AdditionalDependencies>sparse_f.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
+    <PreLinkEvent>
+      <Command>lib /DEF:"$(ProjectDir)sparse_f_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)sparse_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+    </PreLinkEvent>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
       <ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary>
       <TargetMachine>MachineX86</TargetMachine>
       <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <AdditionalDependencies>sparse_f.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
+    <PreLinkEvent>
+      <Command>lib /DEF:"$(ProjectDir)sparse_f_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)sparse_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+    </PreLinkEvent>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <Midl>
       <ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary>
       <TargetMachine>MachineX64</TargetMachine>
       <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <AdditionalDependencies>sparse_f.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
+    <PreLinkEvent>
+      <Command>lib /DEF:"$(ProjectDir)sparse_f_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)sparse_f.lib" 1&gt;NUL 2&gt;NUL</Command>
+    </PreLinkEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="sci_adj2sp.cpp" />
     <ClCompile Include="sci_full.cpp" />
     <ClCompile Include="sci_nnz.cpp" />
+    <ClCompile Include="sci_ordmmd.cpp" />
     <ClCompile Include="sci_sp2adj.cpp" />
     <ClCompile Include="sci_sparse.cpp" />
     <ClCompile Include="sci_spcompack.cpp" />
   <ItemGroup>
     <Library Include="..\..\..\..\bin\libintl.lib" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="sparse_f_Import.def" />
+  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
index 6e7229e..5a4f129 100644 (file)
@@ -48,6 +48,9 @@
     <ClCompile Include="sparse_gw.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="sci_ordmmd.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\includes\sparse_gw.hxx">
@@ -57,4 +60,9 @@
   <ItemGroup>
     <Library Include="..\..\..\..\bin\libintl.lib" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="sparse_f_Import.def">
+      <Filter>Libraries Dependencies</Filter>
+    </None>
+  </ItemGroup>
 </Project>
\ No newline at end of file
index 05d2170..253a486 100644 (file)
@@ -58,6 +58,8 @@
                <File RelativePath=".\sparse_f.rc"/></Filter>
                <Filter Name="Source Files" Filter="f90;for;f;fpp;ftn;def;odl;idl">
                <File RelativePath="isort1.f"/>
+               <File RelativePath=".\ordmmd.f"/>
+               <File RelativePath="..\..\sci_gateway\fortran\sci_f_ordmmd.f"/>
                <File RelativePath="spreshape.f"/>
                <File RelativePath="spt.f"/>
                <File RelativePath="sz2ptr.f"/></Filter>
index bb68026..72eba12 100644 (file)
@@ -4,6 +4,7 @@
 //
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
+// <-- CLI SHELL MODE -->
 // Numerical tests
 // Case where A is given as a function computing the right-hand side
 mymatrix=[ 94  0   0   0    0   28  0   0   32  0
@@ -30,42 +31,7 @@ function y=Atimesx(x,mymatrix)
   y=mymatrix*x
 endfunction
 // With the default 10 iterations, the algorithm performs well
-Alist = list(Atimesx,mymatrix)
- Alist  =
-       Alist(1)
-[y]=function(x,mymatrix)
-       Alist(2)
-         column 1 to 9
-    94.    0.     0.     0.      0.     28.    0.     0.     32.  
-    0.     59.    13.    5.      0.     0.     0.     10.    0.   
-    0.     13.    72.    34.     2.     0.     0.     0.     0.   
-    0.     5.     34.    114.    0.     0.     0.     0.     0.   
-    0.     0.     2.     0.      70.    0.     28.    32.    12.  
-    28.    0.     0.     0.      0.     87.    20.    0.     33.  
-    0.     0.     0.     0.      28.    20.    71.    39.    0.   
-    0.     10.    0.     0.      32.    0.     39.    46.    8.   
-    32.    0.     0.     0.      12.    33.    0.     8.     82.  
-    0.     0.     65.    55.     0.     0.     0.     0.     11.  
-         column 10
-    0.    
-    0.    
-    65.   
-    55.   
-    0.    
-    0.    
-    0.    
-    0.    
-    11.   
-    100.  
+Alist = list(Atimesx,mymatrix);
 [xcomputed, fail, err, iter, res]=pcg(Alist,b);
 xexpected=ones(10,1);
 if norm(xcomputed-xexpected)>10**3*%eps then bugmes();quit;end
index 94bd11b..86a4517 100644 (file)
@@ -33,7 +33,7 @@ function y=Atimesx(x,mymatrix)
   y=mymatrix*x
 endfunction
 // With the default 10 iterations, the algorithm performs well
-Alist = list(Atimesx,mymatrix)
+Alist = list(Atimesx,mymatrix);
 [xcomputed, fail, err, iter, res]=pcg(Alist,b);
 xexpected=ones(10,1);
 if norm(xcomputed-xexpected)>10**3*%eps then pause,end
index 21b0f0b..bf84a25 100644 (file)
@@ -85,7 +85,7 @@ assert_checkalmostequal ( xcomputed , xexpected , %eps);
 // =================================================================================================
 A=[100,1;1,10.];
 b=[101;11];
-[xcomputed, flag, err, iter, res]=qmr(A,b,x0=[1.;1.]);
+[xcomputed, flag, err, iter, res]=qmr(A,b, [1.;1.]);
 assert_checkequal ( iter , 1 );
 // 9. Test the special case where b=0
 // ====================================
@@ -254,10 +254,7 @@ b = [11;11];
 x0 = [1;1];
 M1=[1,0;0,1];
 M2 = eye(2,2);
-maxit = 10
- maxit  =
-    10.  
+maxit = 10;
 [xcomputed, flag, err, iter, res]=qmr(func_qmr,b,x0,M1,M2,maxit);
 xexpected=[1;1];
 assert_checkalmostequal ( xcomputed , xexpected , %eps);
index fc2a392..91174f0 100644 (file)
@@ -95,7 +95,7 @@ assert_checkalmostequal ( xcomputed , xexpected , %eps);
 // =================================================================================================\r
 A=[100,1;1,10.];\r
 b=[101;11];\r
-[xcomputed, flag, err, iter, res]=qmr(A,b,x0=[1.;1.]);\r
+[xcomputed, flag, err, iter, res]=qmr(A,b, [1.;1.]);\r
 assert_checkequal ( iter , 1 );\r
 \r
 // 9. Test the special case where b=0\r
@@ -282,7 +282,7 @@ b = [11;11];
 x0 = [1;1];\r
 M1=[1,0;0,1];\r
 M2 = eye(2,2);\r
-maxit = 10\r
+maxit = 10;\r
 [xcomputed, flag, err, iter, res]=qmr(func_qmr,b,x0,M1,M2,maxit);\r
 xexpected=[1;1];\r
 assert_checkalmostequal ( xcomputed , xexpected , %eps);\r
@@ -615,4 +615,5 @@ assert_checkalmostequal ( xcomputed , xexpected , %eps);
 \r
 \r
 \r
-\r\r
+\r
+\r
index db2b5ed..8f52610 100644 (file)
@@ -5,7 +5,6 @@
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
 // <-- CLI SHELL MODE -->
-mode(5)
 lines(0)
 ij=[1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6];
 v=[1;2;3;4;5;6;7;8;9];
@@ -24,7 +23,6 @@ bc=sparse([1 6;1 2;6 5],[-1;-1;-1]+%i*[0;0.3;-1.2],[6 6]);
 mac=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],-(1:9)-%i*(21:29),[6 6]);
 mbc=sparse([1 6;1 2;6 5],[1;1;1]+%i*[0;-0.3;1.2],[6 6]);
 //
-if %t then
 //-------------------------------------------------------------
 //test des primitives sparse, full
 //--------------------------------------------------------------
@@ -186,8 +184,6 @@ if or(full(2*eye()-ac)<>2*eye()-full(ac)) then bugmes();quit;end
 if or(full(ac+full(bc))<>full(ac)+full(bc)) then bugmes();quit;end
 if or(full(ac-full(bc))<>full(ac)-full(bc)) then bugmes();quit;end
 if or(full(full(ac)+full(bc))<>full(ac)+full(bc)) then bugmes();quit;end
-end
-if %t then
 //-----------------------------------------------
 // multiplication tests
 //-----------------------------------------------
@@ -349,7 +345,6 @@ if or(full(vc([1 1]))<>vcf([1 1])) then bugmes();quit;end
 // ----------------------------------------------------------
 // test des insertions
 //-----------------------------------------------------------
-end
 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
 vt=sparse([1 2;1 3;1 4;1 6],[10;11;12;13],[1,6]);
 // full line insertion
index 45a2ace..34eda43 100644 (file)
@@ -7,7 +7,6 @@
 
 // <-- CLI SHELL MODE -->
 
-mode(5)
 lines(0)
 ij=[1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6];
 v=[1;2;3;4;5;6;7;8;9];
@@ -26,7 +25,7 @@ bc=sparse([1 6;1 2;6 5],[-1;-1;-1]+%i*[0;0.3;-1.2],[6 6]);
 mac=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],-(1:9)-%i*(21:29),[6 6]);
 mbc=sparse([1 6;1 2;6 5],[1;1;1]+%i*[0;-0.3;1.2],[6 6]);
 //
-if %t then
+
 //-------------------------------------------------------------
 //test des primitives sparse, full
 //--------------------------------------------------------------
@@ -188,8 +187,6 @@ if or(full(2*eye()-ac)<>2*eye()-full(ac)) then pause,end
 if or(full(ac+full(bc))<>full(ac)+full(bc)) then pause,end
 if or(full(ac-full(bc))<>full(ac)-full(bc)) then pause,end
 if or(full(full(ac)+full(bc))<>full(ac)+full(bc)) then pause,end
-end
-if %t then
 //-----------------------------------------------
 // multiplication tests
 //-----------------------------------------------
@@ -351,7 +348,7 @@ if or(full(vc([1 1]))<>vcf([1 1])) then pause,end
 // ----------------------------------------------------------
 // test des insertions
 //-----------------------------------------------------------
-end
+
 a=sparse([1 6;1 5;1 3;2 4;2 1;4 4;4 3;5 1;6 6],1:9,[6 6]);
 vt=sparse([1 2;1 3;1 4;1 6],[10;11;12;13],[1,6]);
 // full line insertion
index 8acb99f..86cff68 100644 (file)
@@ -96,8 +96,7 @@ TYPES_GATEWAY_CPP_SOURCES = \
        sci_gateway/cpp/sci_tlist.cpp \
        sci_gateway/cpp/sci_mlist.cpp \
        sci_gateway/cpp/sci_isfield.cpp \
-       sci_gateway/cpp/sci_fieldnames.cpp \
-       sci_gateway/cpp/sci_getfield.cpp
+       sci_gateway/cpp/sci_fieldnames.cpp
 
 
 if ENABLE_DEBUG
index ee0705c..08d9cd0 100644 (file)
@@ -219,7 +219,6 @@ am__libscitypes_la_SOURCES_DIST = sci_gateway/cpp/types_gw.cpp \
        sci_gateway/cpp/sci_typeof.cpp sci_gateway/cpp/sci_tlist.cpp \
        sci_gateway/cpp/sci_mlist.cpp sci_gateway/cpp/sci_isfield.cpp \
        sci_gateway/cpp/sci_fieldnames.cpp \
-       sci_gateway/cpp/sci_getfield.cpp \
        sci_gateway/cpp/sci_inspectorDeleteUnreferencedItems.cpp \
        sci_gateway/cpp/sci_inspectorGetItem.cpp \
        sci_gateway/cpp/sci_inspectorGetItemCount.cpp \
@@ -240,8 +239,7 @@ am__objects_6 = libscitypes_la-types_gw.lo libscitypes_la-sci_list.lo \
        libscitypes_la-sci_makecell.lo libscitypes_la-sci_usertype.lo \
        libscitypes_la-sci_typeof.lo libscitypes_la-sci_tlist.lo \
        libscitypes_la-sci_mlist.lo libscitypes_la-sci_isfield.lo \
-       libscitypes_la-sci_fieldnames.lo \
-       libscitypes_la-sci_getfield.lo $(am__objects_5)
+       libscitypes_la-sci_fieldnames.lo $(am__objects_5)
 am_libscitypes_la_OBJECTS = $(am__objects_6)
 libscitypes_la_OBJECTS = $(am_libscitypes_la_OBJECTS)
 am_testTypes_OBJECTS = testTypes-test-types.$(OBJEXT)
@@ -670,8 +668,7 @@ TYPES_GATEWAY_CPP_SOURCES = sci_gateway/cpp/types_gw.cpp \
        sci_gateway/cpp/sci_usertype.cpp \
        sci_gateway/cpp/sci_typeof.cpp sci_gateway/cpp/sci_tlist.cpp \
        sci_gateway/cpp/sci_mlist.cpp sci_gateway/cpp/sci_isfield.cpp \
-       sci_gateway/cpp/sci_fieldnames.cpp \
-       sci_gateway/cpp/sci_getfield.cpp $(am__append_4)
+       sci_gateway/cpp/sci_fieldnames.cpp $(am__append_4)
 libscitypes_java_la_CFLAGS = $(JAVA_JNI_INCLUDE) \
                        -I$(srcdir)/includes
 
@@ -889,7 +886,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscitypes_java_la-getScilabVariable_wrap.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscitypes_la-sci_cell.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscitypes_la-sci_fieldnames.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscitypes_la-sci_getfield.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscitypes_la-sci_insert.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscitypes_la-sci_inspectorDeleteUnreferencedItems.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscitypes_la-sci_inspectorGetFunctionList.Plo@am__quote@
@@ -1337,13 +1333,6 @@ libscitypes_la-sci_fieldnames.lo: sci_gateway/cpp/sci_fieldnames.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) $(libscitypes_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscitypes_la-sci_fieldnames.lo `test -f 'sci_gateway/cpp/sci_fieldnames.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_fieldnames.cpp
 
-libscitypes_la-sci_getfield.lo: sci_gateway/cpp/sci_getfield.cpp
-@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitypes_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscitypes_la-sci_getfield.lo -MD -MP -MF $(DEPDIR)/libscitypes_la-sci_getfield.Tpo -c -o libscitypes_la-sci_getfield.lo `test -f 'sci_gateway/cpp/sci_getfield.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_getfield.cpp
-@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscitypes_la-sci_getfield.Tpo $(DEPDIR)/libscitypes_la-sci_getfield.Plo
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_getfield.cpp' object='libscitypes_la-sci_getfield.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) $(libscitypes_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscitypes_la-sci_getfield.lo `test -f 'sci_gateway/cpp/sci_getfield.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_getfield.cpp
-
 libscitypes_la-sci_inspectorDeleteUnreferencedItems.lo: sci_gateway/cpp/sci_inspectorDeleteUnreferencedItems.cpp
 @am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscitypes_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscitypes_la-sci_inspectorDeleteUnreferencedItems.lo -MD -MP -MF $(DEPDIR)/libscitypes_la-sci_inspectorDeleteUnreferencedItems.Tpo -c -o libscitypes_la-sci_inspectorDeleteUnreferencedItems.lo `test -f 'sci_gateway/cpp/sci_inspectorDeleteUnreferencedItems.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_inspectorDeleteUnreferencedItems.cpp
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscitypes_la-sci_inspectorDeleteUnreferencedItems.Tpo $(DEPDIR)/libscitypes_la-sci_inspectorDeleteUnreferencedItems.Plo
index 8a56a6d..cc12d80 100644 (file)
@@ -39,7 +39,6 @@ CPP_GATEWAY_PROTOTYPE(sci_typeof);
 CPP_GATEWAY_PROTOTYPE(sci_tlist);
 CPP_GATEWAY_PROTOTYPE(sci_mlist);
 CPP_GATEWAY_PROTOTYPE(sci_isfield);
-CPP_GATEWAY_PROTOTYPE(sci_getfield);
 CPP_GATEWAY_PROTOTYPE(sci_fieldnames);
 
 #ifndef NDEBUG
diff --git a/scilab/modules/types/sci_gateway/cpp/sci_getfield.cpp b/scilab/modules/types/sci_gateway/cpp/sci_getfield.cpp
deleted file mode 100644 (file)
index c5ac5d4..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- *  Copyright (C) 2011-2011 - DIGITEO - Bruno JOFRET
- *
- *  This file must be used under the terms of the CeCILL.
- *  This source file is licensed as described in the file COPYING, which
- *  you should have received as part of this distribution.  The terms
- *  are also available at
- *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-#include "types_gw.hxx"
-#include "function.hxx"
-#include "double.hxx"
-#include "list.hxx"
-
-extern "C"
-{
-#include "Scierror.h"
-#include "localization.h"
-#include "charEncoding.h"
-}
-
-using namespace types;
-
-Function::ReturnValue sci_getfield(typed_list &in, int _iRetCount, typed_list &out)
-{
-    if (in.size() != 2)
-    {
-        Scierror(999, _("%s: Wrong number of input argument(s): %d expected.\n"), "getfield", 2);
-        return Function::Error;
-    }
-
-    if (in[0]->isDouble() == false || in[0]->getAs<Double>()->isComplex() == true)
-    {
-        Scierror(999, _("%s:  Wrong type for input argument #%d: Real Matrix expected.\n"), "getfield", 1);
-        return Function::Error;
-    }
-
-    if (in[1]->isList() == false && in[1]->isMList() == false && in[1]->isTList() == false)
-    {
-        Scierror(999, _("%s:  Wrong type for input argument #%d: List expected.\n"), "getfield", 2);
-        return Function::Error;
-    }
-
-    // FIXME : Scilab < 6 allows mlist wrapped types like struct, hypermat, aso...
-    // Need to investigate if this feature is mandatory.
-
-    Double *pInDouble = in[0]->getAs<Double>();
-
-    if (_iRetCount != pInDouble->getSize())
-    {
-        Scierror(999, _("%s: Wrong number of output argument(s): %d expected.\n"), "getfield", pInDouble->getSize());
-        return Function::Error;
-    }
-
-    List *pInList = in[1]->getAs<List>();
-    double *pdblReal = pInDouble->get();
-
-    for (int i = 0 ; i < pInDouble->getSize() ; ++i)
-    {
-        const int iIndex = ((int) pdblReal[i]) - 1;
-        InternalType *pIT = pInList->get(iIndex);
-        if (pIT != NULL)
-        {
-            out.push_back(pIT);
-        }
-        else
-        {
-            Scierror(21, _("%s: Invalid index: Computed index was %d.\n"), "getfield", iIndex + 1);
-            return Function::Error;
-        }
-    }
-
-    return Function::OK;
-}
index 60bd7e5..f9573a0 100644 (file)
@@ -27,7 +27,6 @@ int TypesModule::Load()
     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"tlist", &sci_tlist, MODULE_NAME));
     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"mlist", &sci_mlist, MODULE_NAME));
     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"isfield", &sci_isfield, MODULE_NAME));
-    symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getfield", &sci_getfield, MODULE_NAME));
     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"fieldnames", &sci_fieldnames, MODULE_NAME));
 
 #ifndef NDEBUG
index 7f4d233..51fa96f 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
   <ItemGroup>
     <ClCompile Include="sci_cell.cpp" />
     <ClCompile Include="sci_fieldnames.cpp" />
-    <ClCompile Include="sci_getfield.cpp" />
     <ClCompile Include="sci_insert.cpp" />
     <ClCompile Include="sci_inspectorDeleteUnreferencedItems.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
index fd76aaa..7dcadb0 100644 (file)
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\sci_cell.cpp">
+    <ClCompile Include="sci_cell.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_fieldnames.cpp">
+    <ClCompile Include="sci_fieldnames.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_insert.cpp">
+    <ClCompile Include="sci_insert.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_isfield.cpp">
+    <ClCompile Include="sci_inspectorDeleteUnreferencedItems.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_list.cpp">
+    <ClCompile Include="sci_inspectorGetItem.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_makecell.cpp">
+    <ClCompile Include="sci_inspectorGetItemCount.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_mlist.cpp">
+    <ClCompile Include="sci_inspectorGetUnreferencedItem.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_null.cpp">
+    <ClCompile Include="sci_inspectorShowItem.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_struct.cpp">
+    <ClCompile Include="sci_inspectorShowUnreferencedItem.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_tlist.cpp">
+    <ClCompile Include="sci_isfield.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_typeof.cpp">
+    <ClCompile Include="sci_list.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_usertype.cpp">
+    <ClCompile Include="sci_makecell.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\types_gw.cpp">
+    <ClCompile Include="sci_mlist.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_getfield.cpp">
+    <ClCompile Include="sci_null.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_inspectorGetItemCount.cpp">
+    <ClCompile Include="sci_struct.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_inspectorShowItem.cpp">
+    <ClCompile Include="sci_tlist.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_inspectorGetItem.cpp">
+    <ClCompile Include="sci_typeof.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_inspectorGetUnreferencedItem.cpp">
+    <ClCompile Include="sci_usertype.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_inspectorDeleteUnreferencedItems.cpp">
+    <ClCompile Include="types_gw.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\sci_inspectorShowUnreferencedItem.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\sci_inspectorGetFunctionList.cpp">
+    <ClCompile Include="sci_inspectorGetFunctionList.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\..\includes\dynlib_types_gw.h">
+    <ClInclude Include="..\..\includes\dynlib_types_gw.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\sci_tlist_or_mlist.hxx">
+    <ClInclude Include="sci_tlist_or_mlist.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\..\includes\types_gw.hxx">
+    <ClInclude Include="..\..\includes\types_gw.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
   </ItemGroup>
   <ItemGroup>
-    <Library Include="..\..\..\..\..\bin\libintl.lib" />
+    <Library Include="..\..\..\..\bin\libintl.lib" />
   </ItemGroup>
 </Project>
\ No newline at end of file
index 66031a8..35fb79e 100644 (file)
@@ -1113,7 +1113,6 @@ void Double::convertToInteger()
     //convert in place double to integer
     int* piR = (int*)get();
     double *pdblR = get();
-    //convert in place integer to double
 
     if (isComplex())
     {
@@ -1121,18 +1120,18 @@ void Double::convertToInteger()
         double *pdblI = getImg();
 
         //normal way to prevent overlap
-        for (int i = 0 ; i < getSize() ; i--)
+        for (int i = 0 ; i < getSize() ; i++)
         {
-            pdblR[i] = (double)piR[i];
-            pdblI[i] = (double)piI[i];
+            piR[i] = (int)pdblR[i];
+            piI[i] = (int)pdblI[i];
         }
     }
     else
     {
         //normal way to prevent overlap
-        for (int i = 0 ; i < getSize() ; i--)
+        for (int i = 0 ; i < getSize() ; i++)
         {
-            pdblR[i] = (double)piR[i];
+            piR[i] = (int)pdblR[i];
         }
     }
 
index 905c12b..848e9ac 100644 (file)
@@ -72,7 +72,7 @@ List::List(List *_oListCopyMe)
     for (int i = 0 ; i < _oListCopyMe->getData()->size() ; i++)
     {
         InternalType* pIT = (*_oListCopyMe->getData())[i];
-        append(pIT);
+        append(pIT->clone());
     }
 
     m_iSize = static_cast<int>(m_plData->size());
@@ -101,8 +101,7 @@ int List::getSize()
 */
 void List::append(InternalType *_typedValue)
 {
-    _typedValue->IncreaseRef();
-    m_plData->push_back(_typedValue);
+    m_plData->push_back(_typedValue->clone());
     m_iSize = static_cast<int>(m_plData->size());
 }
 
@@ -176,7 +175,7 @@ std::vector<InternalType*>  List::extract(typed_list* _pArgs)
             break;
         }
         InternalType* pIT = (*m_plData)[idx - 1];
-        outList.push_back(pIT);
+        outList.push_back(pIT->clone());
     }
 
     for (int iArg = 0 ; iArg < pArg.size() ; iArg++)
@@ -229,13 +228,9 @@ InternalType* List::insert(typed_list* _pArgs, InternalType* _pSource)
         else if (idx <= m_plData->size())
         {
             InternalType* pIT = (*m_plData)[idx - 1];
-            if (pIT)
+            if (pIT && pIT->isDeletable())
             {
-                pIT->DecreaseRef();
-                if (pIT->isDeletable())
-                {
-                    delete pIT;
-                }
+                delete pIT;
             }
             m_plData->erase(m_plData->begin() + idx - 1);
         }
@@ -250,16 +245,13 @@ InternalType* List::insert(typed_list* _pArgs, InternalType* _pSource)
             throw ast::ScilabError(os.str());
         }
 
-        InternalType* pInsert = _pSource->getAs<ListInsert>()->getInsert();
-        pInsert->IncreaseRef();
+        InternalType* pInsert = _pSource->getAs<ListInsert>()->getInsert()->clone();
         if (idx > m_plData->size())
         {
             //try to insert after the last index, increase list size and assign value
             while (m_plData->size() < idx)
             {
                 //incease list size and fill with "Undefined"
-                InternalType* pUndef = new ListUndefined();
-                pUndef->IncreaseRef();
                 m_plData->push_back(new ListUndefined());
             }
             (*m_plData)[idx - 1] = pInsert;
@@ -281,8 +273,8 @@ InternalType* List::insert(typed_list* _pArgs, InternalType* _pSource)
         {
             pInsert = _pSource;
         }
-        pInsert->IncreaseRef();
-        m_plData->insert(m_plData->begin(), pInsert);
+
+        m_plData->insert(m_plData->begin(), pInsert->clone());
     }
     else
     {
@@ -293,14 +285,12 @@ InternalType* List::insert(typed_list* _pArgs, InternalType* _pSource)
         }
 
         InternalType* pIT = (*m_plData)[idx - 1];
-        pIT->DecreaseRef();
-        if (pIT->isDeletable())
+        if (pIT && pIT->isDeletable())
         {
             delete pIT;
         }
 
-        _pSource->IncreaseRef();
-        (*m_plData)[idx - 1] = _pSource;
+        (*m_plData)[idx - 1] = _pSource->clone();
     }
 
     m_iSize = (int)m_plData->size();
index df3b70c..f784d71 100644 (file)
 
 extern "C"
 {
-    #include "Scierror.h"
-    #include "MALLOC.h"
-    #include "os_swprintf.h"
+#include "Scierror.h"
+#include "MALLOC.h"
+#include "os_swprintf.h"
 }
 
 namespace types
 {
-    Macro::Macro(const std::wstring& _stName, std::list<symbol::Symbol> &_inputArgs, std::list<symbol::Symbol> &_outputArgs, ast::SeqExp &_body, const wstring& _stModule):
-        Callable(), m_inputArgs(&_inputArgs), m_outputArgs(&_outputArgs), m_body(&_body),
-        m_ArgInSymb(symbol::Symbol(L"nargin")), m_ArgOutSymb(symbol::Symbol(L"nargout"))
-    {
-        setName(_stName);
-        setModule(_stModule);
-        bAutoAlloc = false;
-        m_pDblArgIn = new Double(1);
-        m_pDblArgIn->IncreaseRef(); //never delete
-        m_pDblArgOut = new Double(1);
-        m_pDblArgOut->IncreaseRef(); //never delete
-    }
+Macro::Macro(const std::wstring& _stName, std::list<symbol::Symbol> &_inputArgs, std::list<symbol::Symbol> &_outputArgs, ast::SeqExp &_body, const wstring& _stModule):
+    Callable(), m_inputArgs(&_inputArgs), m_outputArgs(&_outputArgs), m_body(&_body),
+    m_ArgInSymb(symbol::Symbol(L"nargin")), m_ArgOutSymb(symbol::Symbol(L"nargout"))
+{
+    setName(_stName);
+    setModule(_stModule);
+    bAutoAlloc = false;
+    m_pDblArgIn = new Double(1);
+    m_pDblArgIn->IncreaseRef(); //never delete
+    m_pDblArgOut = new Double(1);
+    m_pDblArgOut->IncreaseRef(); //never delete
+}
 
-    Macro::~Macro()
-    {
-        delete m_body;
-    }
+Macro::~Macro()
+{
+    delete m_body;
+}
 
-    InternalType* Macro::clone()
-    {
-        IncreaseRef();
-        return this;
-    }
+InternalType* Macro::clone()
+{
+    IncreaseRef();
+    return this;
+}
 
-    void Macro::whoAmI()
-    {
-        std::cout << "types::Macro";
-    }
+void Macro::whoAmI()
+{
+    std::cout << "types::Macro";
+}
 
-    InternalType::RealType Macro::getType(void)
-    {
-        return RealMacro;
-    }
+InternalType::RealType Macro::getType(void)
+{
+    return RealMacro;
+}
 
-    ast::SeqExp* Macro::getBody(void)
-    {
-        return m_body;
-    }
+ast::SeqExp* Macro::getBody(void)
+{
+    return m_body;
+}
+
+bool Macro::toString(std::wostringstream& ostr)
+{
+    ostr << L"FIXME : Implement Macro::toString" << std::endl;
+    return true;
+}
 
-    bool Macro::toString(std::wostringstream& ostr)
+Callable::ReturnValue Macro::call(typed_list &in, optional_list &opt, int _iRetCount, typed_list &out, ast::ConstVisitor* execFunc)
+{
+    bool bVarargout = false;
+    ReturnValue RetVal = Callable::OK;
+    symbol::Context *pContext = symbol::Context::getInstance();
+
+    //open a new scope
+    pContext->scope_begin();
+
+    //add optional paramter in current scope
+    optional_list::const_iterator it;
+    for (it = opt.begin() ; it != opt.end() ; it++)
     {
-        ostr << L"FIXME : Implement Macro::toString" << std::endl;
-        return true;
+        pContext->put(symbol::Symbol(it->first), *it->second);
     }
+    //check excepted and input/output parameters numbers
+    // Scilab Macro can be called with less than prototyped arguments,
+    // but not more execpts with varargin
 
-    Callable::ReturnValue Macro::call(typed_list &in, optional_list &opt, int _iRetCount, typed_list &out, ast::ConstVisitor* execFunc)
+    // varargin management
+    if (m_inputArgs->size() > 0 && m_inputArgs->back().name_get() == L"varargin")
     {
-        bool bVarargout = false;
-        ReturnValue RetVal = Callable::OK;
-        symbol::Context *pContext = symbol::Context::getInstance();
-
-        //open a new scope
-        pContext->scope_begin();
-
-        //add optional paramter in current scope
-        optional_list::const_iterator it;
-        for(it = opt.begin() ; it != opt.end() ; it++)
+        int iVarPos = static_cast<int>(in.size());
+        if (iVarPos > static_cast<int>(m_inputArgs->size()) - 1)
         {
-            pContext->put(symbol::Symbol(it->first), *it->second);
+            iVarPos = static_cast<int>(m_inputArgs->size()) - 1;
         }
-        //check excepted and input/output parameters numbers
-        // Scilab Macro can be called with less than prototyped arguments,
-        // but not more execpts with varargin
 
-        // varargin management
-        if(m_inputArgs->size() > 0 && m_inputArgs->back().name_get() == L"varargin")
+        //add all standard variable in function context but not varargin
+        std::list<symbol::Symbol>::const_iterator itName = m_inputArgs->begin();
+        typed_list::const_iterator itValue = in.begin();
+        while (iVarPos > 0)
         {
-            int iVarPos = static_cast<int>(in.size());
-            if(iVarPos > static_cast<int>(m_inputArgs->size()) - 1)
-            {
-                iVarPos = static_cast<int>(m_inputArgs->size()) - 1;
-            }
+            pContext->put((*itName), **itValue);
+            iVarPos--;
+            itName++;
+            itValue++;
+        }
 
-            //add all standard variable in function context but not varargin
-            std::list<symbol::Symbol>::const_iterator itName = m_inputArgs->begin();
-            typed_list::const_iterator itValue = in.begin();
-            while(iVarPos > 0)
+        //create varargin only if previous variable are assigned
+        if (in.size() >= m_inputArgs->size() - 1)
+        {
+            //create and fill varargin
+            List* pL = new List();
+            while (itValue != in.end())
             {
-                pContext->put((*itName), **itValue);
-                iVarPos--;
-                itName++;
+                pL->append(*itValue);
                 itValue++;
             }
-
-            //create varargin only if previous variable are assigned
-            if(in.size() >= m_inputArgs->size() - 1)
-            {
-                //create and fill varargin
-                List* pL = new List();
-                while(itValue != in.end())
-                {
-                    pL->append(*itValue);
-                    itValue++;
-                }
-                pContext->put(symbol::Symbol(L"varargin"), *pL);
-            }
+            pContext->put(symbol::Symbol(L"varargin"), *pL);
         }
-               else if(in.size() > m_inputArgs->size())
-               {
-            wostringstream ostr;
-            ostr << _W("Wrong number of input arguments:") << std::endl << std::endl;
-            ostr << _W("Excepted: ") << m_inputArgs->size() << std::endl;
-
-            if(m_inputArgs->size() > 0)
-            {
-                ostr << _W("Arguments are:") << std::endl << std::endl;
-                ostr << " ";
-                for (std::list<symbol::Symbol>::iterator it =  m_inputArgs->begin() ; it != m_inputArgs->end() ; ++it)
-                {
-                    ostr << (*it).name_get() << L"    ";
-                }
-                ostr << std::endl;
-            }
+    }
+    else if (in.size() > m_inputArgs->size())
+    {
+        wostringstream ostr;
+        ostr << _W("Wrong number of input arguments:") << std::endl << std::endl;
+        ostr << _W("Excepted: ") << m_inputArgs->size() << std::endl;
 
-            char* pst = wide_string_to_UTF8(ostr.str().c_str());
-            Scierror(58, "%s", pst);
-            pContext->scope_end();
-                       return Callable::Error;
-               }
-        else
+        if (m_inputArgs->size() > 0)
         {
-            //assign value to variable in the new context
-            std::list<symbol::Symbol>::const_iterator i;
-            typed_list::const_iterator j;
-
-            for (i = m_inputArgs->begin(), j = in.begin(); j != in.end (); ++j,++i)
+            ostr << _W("Arguments are:") << std::endl << std::endl;
+            ostr << " ";
+            for (std::list<symbol::Symbol>::iterator it =  m_inputArgs->begin() ; it != m_inputArgs->end() ; ++it)
             {
-                pContext->put((*i), **j);
+                ostr << (*it).name_get() << L"    ";
             }
+            ostr << std::endl;
         }
 
-        // varargout management
-        //rules : 
-        // varargout must be alone
-        // varargout is a list
-        // varargout can containt more items than caller need
-        // varargout must containt at leat caller needs
-        if(m_outputArgs->size() == 1 && m_outputArgs->back().name_get() == L"varargout")
+        char* pst = wide_string_to_UTF8(ostr.str().c_str());
+        Scierror(58, "%s", pst);
+        pContext->scope_end();
+        return Callable::Error;
+    }
+    else
+    {
+        //assign value to variable in the new context
+        std::list<symbol::Symbol>::const_iterator i;
+        typed_list::const_iterator j;
+
+        for (i = m_inputArgs->begin(), j = in.begin(); j != in.end (); ++j, ++i)
         {
-            bVarargout = true;
-            List* pL = new List();
-            pContext->put(symbol::Symbol(L"varargout"), *pL);
+            pContext->put((*i), **j);
         }
+    }
 
-        //common part with or without varargin/varargout
+    // varargout management
+    //rules :
+    // varargout must be alone
+    // varargout is a list
+    // varargout can containt more items than caller need
+    // varargout must containt at leat caller needs
+    if (m_outputArgs->size() == 1 && m_outputArgs->back().name_get() == L"varargout")
+    {
+        bVarargout = true;
+        List* pL = new List();
+        pContext->put(symbol::Symbol(L"varargout"), *pL);
+    }
 
-        // Declare nargin & nargout in function context.
-        m_pDblArgIn->set(0, static_cast<double>(in.size()));
-        m_pDblArgOut->set(0, _iRetCount);
-        pContext->put(m_ArgInSymb, *m_pDblArgIn);
-        pContext->put(m_ArgOutSymb, *m_pDblArgOut);
+    //common part with or without varargin/varargout
 
-        //save current prompt mode
-        int oldVal = ConfigVariable::getPromptMode();
-        try
-        {
-            //m_body->mute();
-            //MuteVisitor mute;
-            //m_body->accept(mute);
+    // Declare nargin & nargout in function context.
+    m_pDblArgIn->set(0, static_cast<double>(in.size()));
+    m_pDblArgOut->set(0, _iRetCount);
+    pContext->put(m_ArgInSymb, *m_pDblArgIn);
+    pContext->put(m_ArgOutSymb, *m_pDblArgOut);
 
-            ConfigVariable::setPromptMode(-1);
+    //save current prompt mode
+    int oldVal = ConfigVariable::getPromptMode();
+    try
+    {
+        //m_body->mute();
+        //MuteVisitor mute;
+        //m_body->accept(mute);
+
+        ConfigVariable::setPromptMode(-1);
+        m_body->returnable_set();
+        m_body->accept(*execFunc);
+        //restore previous prompt mode
+        ConfigVariable::setPromptMode(oldVal);
+        if (m_body->is_return())
+        {
             m_body->returnable_set();
-            m_body->accept(*execFunc);
-            //restore previous prompt mode
-            ConfigVariable::setPromptMode(oldVal);
-            if(m_body->is_return())
+        }
+
+        //varargout management
+        if (bVarargout)
+        {
+            InternalType* pOut = pContext->get(symbol::Symbol(L"varargout"));
+            if (pOut == NULL)
             {
-                m_body->returnable_set();
+                Scierror(999, _("Invalid index.\n"));
+                return Callable::Error;
             }
 
-            //varargout management
-            if(bVarargout)
+            if (pOut->isList() == false || pOut->getAs<List>()->getSize() == 0)
             {
-                InternalType* pOut = pContext->get(symbol::Symbol(L"varargout"));
-                if(pOut == NULL)
-                {
-                    Scierror(999, _("Invalid index.\n"));
-                    return Callable::Error;
-                }
+                Scierror(999, _("Invalid index.\n"));
+                return Callable::Error;
+            }
 
-                if(pOut->isList() == false || pOut->getAs<List>()->getSize() == 0)
+            List* pVarOut = pOut->getAs<List>();
+            for (int i = 0 ; i < Min(pVarOut->getSize(), _iRetCount) ; i++)
+            {
+                InternalType* pIT = pVarOut->get(i)->clone();
+                if (pIT->isListUndefined())
                 {
-                    Scierror(999, _("Invalid index.\n"));
+                    Scierror(999, _("List element number %d is Undefined.\n"), i + 1);
                     return Callable::Error;
                 }
 
-                List* pVarOut = pOut->getAs<List>();
-                for(int i = 0 ; i < Min(pVarOut->getSize(), _iRetCount) ; i++)
+                out.push_back(pIT);
+            }
+        }
+        else
+        {
+            //normal output management
+            std::list<symbol::Symbol>::const_iterator i;
+            for (i = m_outputArgs->begin(); i != m_outputArgs->end() && _iRetCount; ++i, --_iRetCount)
+            {
+                InternalType *pIT = pContext->get((*i));
+                if (pIT != NULL)
                 {
-                    InternalType* pIT = pVarOut->get(i);
-                    if(pIT->isListUndefined())
-                    {
-                        Scierror(999, _("List element number %d is Undefined.\n"), i + 1);
-                        return Callable::Error;
-                    }
-
                     out.push_back(pIT);
                     pIT->IncreaseRef();
                 }
-            }
-            else
-            {//normal output management
-                std::list<symbol::Symbol>::const_iterator i;
-                for (i = m_outputArgs->begin(); i != m_outputArgs->end() && _iRetCount; ++i, --_iRetCount)
+                else
                 {
-                    InternalType *pIT = pContext->get((*i));
-                    if(pIT != NULL)
-                    {
-                        out.push_back(pIT);
-                        pIT->IncreaseRef();
-                    }
-                    else
-                    {
-                        char* pst = wide_string_to_UTF8((*i).name_get().c_str());
-                        Scierror(999, _("Undefined variable %s.\n"), pst);
-                        FREE(pst);
-                        return Callable::Error;
-                    }
+                    char* pst = wide_string_to_UTF8((*i).name_get().c_str());
+                    Scierror(999, _("Undefined variable %s.\n"), pst);
+                    FREE(pst);
+                    return Callable::Error;
                 }
             }
         }
-        catch(ast::ScilabMessage se)
-        {
-            //restore previous prompt mode
-            ConfigVariable::setPromptMode(oldVal);
-            //close the current scope
-            pContext->scope_end();
-            for (size_t j = 0; j < out.size(); ++j)
-            {
-                out[j]->DecreaseRef();
-            }
-            throw se;
-        }
-        catch(ast::InternalAbort sa)
+    }
+    catch (ast::ScilabMessage se)
+    {
+        //restore previous prompt mode
+        ConfigVariable::setPromptMode(oldVal);
+        //close the current scope
+        pContext->scope_end();
+        for (size_t j = 0; j < out.size(); ++j)
         {
-            //restore previous prompt mode
-            ConfigVariable::setPromptMode(oldVal);
-            //close the current scope
-            pContext->scope_end();
-            for (size_t j = 0; j < out.size(); ++j)
-            {
-                out[j]->DecreaseRef();
-            }
-            throw sa;
+            out[j]->DecreaseRef();
         }
-
+        throw se;
+    }
+    catch (ast::InternalAbort sa)
+    {
+        //restore previous prompt mode
+        ConfigVariable::setPromptMode(oldVal);
         //close the current scope
         pContext->scope_end();
-
         for (size_t j = 0; j < out.size(); ++j)
         {
             out[j]->DecreaseRef();
         }
-        return RetVal;
+        throw sa;
     }
 
-    std::list<symbol::Symbol>* Macro::inputs_get()
-    {
-        return m_inputArgs;
-    }
+    //close the current scope
+    pContext->scope_end();
 
-    std::list<symbol::Symbol>* Macro::outputs_get()
+    for (size_t j = 0; j < out.size(); ++j)
     {
-        return m_outputArgs;
+        out[j]->DecreaseRef();
     }
+    return RetVal;
+}
+
+std::list<symbol::Symbol>* Macro::inputs_get()
+{
+    return m_inputArgs;
+}
+
+std::list<symbol::Symbol>* Macro::outputs_get()
+{
+    return m_outputArgs;
+}
 }
index 252d341..b3b72af 100644 (file)
 
 namespace types
 {
-    /**
-    ** Constructor & Destructor (public)
-    */
-    TList::TList() : List()
-    {
+/**
+** Constructor & Destructor (public)
+*/
+TList::TList() : List()
+{
 #ifndef NDEBUG
-        Inspector::addItem(this);
+    Inspector::addItem(this);
 #endif
-    }
+}
 
-    TList::~TList()
-    {
+TList::~TList()
+{
 #ifndef NDEBUG
-        Inspector::removeItem(this);
+    Inspector::removeItem(this);
 #endif
-    }
-    /**
-    ** Private Copy Constructor and data Access
-    */
-    TList::TList(TList *_oTListCopyMe)
-    {
-        std::vector<InternalType *>::iterator itValues;
-        m_plData = new std::vector<InternalType *>;
+}
+/**
+** Private Copy Constructor and data Access
+*/
+TList::TList(TList *_oTListCopyMe)
+{
+    std::vector<InternalType *>::iterator itValues;
+    m_plData = new std::vector<InternalType *>;
 
-        for(int i = 0 ; i < _oTListCopyMe->getData()->size() ; i++)
-        {
-            InternalType* pIT = (*_oTListCopyMe->getData())[i];
-            append(pIT);
-        }
+    for (int i = 0 ; i < _oTListCopyMe->getData()->size() ; i++)
+    {
+        InternalType* pIT = (*_oTListCopyMe->getData())[i];
+        append(pIT->clone());
+    }
 
-        m_iSize = static_cast<int>(m_plData->size());
+    m_iSize = static_cast<int>(m_plData->size());
 #ifndef NDEBUG
-        Inspector::addItem(this);
+    Inspector::addItem(this);
 #endif
-    }
+}
 
-    /**
-    ** Clone
-    ** Create a new List and Copy all values.
-    */
-    InternalType* TList::clone()
-    {
-        return new TList(this);
-    }
+/**
+** Clone
+** Create a new List and Copy all values.
+*/
+InternalType* TList::clone()
+{
+    return new TList(this);
+}
 
-    bool TList::exists(const std::wstring& _sKey)
+bool TList::exists(const std::wstring& _sKey)
+{
+    if (getSize() < 1)
     {
-        if(getSize() < 1)
-        {
-            return false;
-        }
-
-        String* pS = (*m_plData)[0]->getAs<types::String>();
-
-        //first field is the tlist type
-        for(int i = 1 ; i < pS->getSize() ; i++)
-        {
-            if(wcscmp(pS->get(i), _sKey.c_str()) == 0)
-            {
-                return true;
-            }
-        }
         return false;
     }
 
-    InternalType* TList::get(const std::wstring& _sKey)
-    {
-        return List::get(getIndexFromString(_sKey));
-    }
+    String* pS = (*m_plData)[0]->getAs<types::String>();
 
-    int TList::getIndexFromString(const std::wstring& _sKey)
+    //first field is the tlist type
+    for (int i = 1 ; i < pS->getSize() ; i++)
     {
-        if(getSize() < 1)
+        if (wcscmp(pS->get(i), _sKey.c_str()) == 0)
         {
-            return -1;
+            return true;
         }
+    }
+    return false;
+}
 
-        String* pS = (*m_plData)[0]->getAs<types::String>();
-        //first field is the tlist type
-        for(int i = 1 ; i < pS->getSize() ; i++)
-        {
-            if(wcscmp(pS->get(i), _sKey.c_str()) == 0)
-            {
-                return i;
-            }
-        }
+InternalType* TList::get(const std::wstring& _sKey)
+{
+    return List::get(getIndexFromString(_sKey));
+}
+
+int TList::getIndexFromString(const std::wstring& _sKey)
+{
+    if (getSize() < 1)
+    {
         return -1;
     }
 
-    std::vector<InternalType*> TList::extractStrings(const std::list<std::wstring>& _stFields)
+    String* pS = (*m_plData)[0]->getAs<types::String>();
+    //first field is the tlist type
+    for (int i = 1 ; i < pS->getSize() ; i++)
     {
-        std::vector<InternalType*> Result;
-
-        std::list<std::wstring>::const_iterator it;
-        for(it = _stFields.begin() ; it != _stFields.end() ; it++)
+        if (wcscmp(pS->get(i), _sKey.c_str()) == 0)
         {
-            if(exists(*it) == false)
-            {
-                return Result;
-            }
+            return i;
         }
-
-        for(it = _stFields.begin() ; it != _stFields.end() ; it++)
-        {
-            Result.push_back(get(*it));
-        }
-        return Result;
     }
+    return -1;
+}
+
+std::vector<InternalType*> TList::extractStrings(const std::list<std::wstring>& _stFields)
+{
+    std::vector<InternalType*> Result;
 
-    std::wstring TList::getTypeStr()
+    std::list<std::wstring>::const_iterator it;
+    for (it = _stFields.begin() ; it != _stFields.end() ; it++)
     {
-        if(getSize() < 1)
+        if (exists(*it) == false)
         {
-            return L"";
+            return Result;
         }
-
-        return (*m_plData)[0]->getAs<types::String>()->get(0);
     }
 
-    std::wstring TList::getShortTypeStr()
+    for (it = _stFields.begin() ; it != _stFields.end() ; it++)
     {
-        return getTypeStr();
+        Result.push_back(get(*it));
     }
+    return Result;
+}
 
-    bool TList::set(const std::wstring& _sKey, InternalType* _pIT)
+std::wstring TList::getTypeStr()
+{
+    if (getSize() < 1)
     {
-        return set(getIndexFromString(_sKey), _pIT);
+        return L"";
     }
 
-    bool TList::set(const int _iIndex, InternalType* _pIT)
-    {
-        if(_iIndex < 0)
-        {
-            return false;
-        }
+    return (*m_plData)[0]->getAs<types::String>()->get(0);
+}
 
-        while(m_plData->size() <_iIndex)
-        {//incease list size and fill with "Undefined"
-            m_plData->push_back(new ListUndefined());
-            m_iSize = getSize();
-        }
+std::wstring TList::getShortTypeStr()
+{
+    return getTypeStr();
+}
 
-        //manage ref on the old value
-        InternalType* pOld = (*m_plData)[_iIndex];
-        if(pOld)
-        {
-            pOld->DecreaseRef();
-            if(pOld->isDeletable())
-            {
-                delete pOld;
-            }
-        }
+bool TList::set(const std::wstring& _sKey, InternalType* _pIT)
+{
+    return set(getIndexFromString(_sKey), _pIT);
+}
 
-        _pIT->IncreaseRef();
-        (*m_plData)[_iIndex] = _pIT;
-        return true;
+bool TList::set(const int _iIndex, InternalType* _pIT)
+{
+    if (_iIndex < 0)
+    {
+        return false;
     }
+
+    while (m_plData->size() < _iIndex)
+    {
+        //incease list size and fill with "Undefined"
+        m_plData->push_back(new ListUndefined());
+        m_iSize = getSize();
+    }
+
+    InternalType* pOld = (*m_plData)[_iIndex];
+    if (pOld && pOld->isDeletable())
+    {
+        delete pOld;
+    }
+
+    (*m_plData)[_iIndex] = _pIT->clone();
+    return true;
+}
 }