management of --std=c++11 for toolboxes. 62/15462/5
Cedric Delamarre [Tue, 4 Nov 2014 09:16:54 +0000 (10:16 +0100)]
test_run api_scilab

Change-Id: I9984008c6b0eed5453628be387ac5150f1c17f25

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/types/addfunction.h [new file with mode: 0644]
scilab/modules/ast/src/cpp/types/addfunction.cpp [new file with mode: 0644]
scilab/modules/dynamic_link/macros/ilib_compile.sci
scilab/modules/dynamic_link/macros/ilib_gen_gateway.sci

index db25336..d004a5b 100644 (file)
@@ -88,6 +88,7 @@ libsciast_la_SOURCES = \
     src/cpp/types/struct.cpp \
     src/cpp/types/macrofile.cpp \
     src/cpp/types/callable.cpp \
+    src/cpp/types/addfunction.cpp \
     src/cpp/system_env/dynamic_module.cpp \
     src/cpp/system_env/setenvvar.cpp \
     src/cpp/system_env/sci_home.cpp \
index aa11d53..dcdc645 100644 (file)
@@ -212,7 +212,7 @@ am__libsciast_la_SOURCES_DIST = src/cpp/ast/runvisitor.cpp \
        src/cpp/types/listundefined.cpp src/cpp/types/string.cpp \
        src/cpp/types/implicitlist.cpp src/cpp/types/macro.cpp \
        src/cpp/types/struct.cpp src/cpp/types/macrofile.cpp \
-       src/cpp/types/callable.cpp \
+       src/cpp/types/callable.cpp src/cpp/types/addfunction.cpp \
        src/cpp/system_env/dynamic_module.cpp \
        src/cpp/system_env/setenvvar.cpp \
        src/cpp/system_env/sci_home.cpp \
@@ -300,6 +300,7 @@ am_libsciast_la_OBJECTS = src/cpp/ast/libsciast_la-runvisitor.lo \
        src/cpp/types/libsciast_la-struct.lo \
        src/cpp/types/libsciast_la-macrofile.lo \
        src/cpp/types/libsciast_la-callable.lo \
+       src/cpp/types/libsciast_la-addfunction.lo \
        src/cpp/system_env/libsciast_la-dynamic_module.lo \
        src/cpp/system_env/libsciast_la-setenvvar.lo \
        src/cpp/system_env/libsciast_la-sci_home.lo \
@@ -734,7 +735,7 @@ libsciast_la_SOURCES = src/cpp/ast/runvisitor.cpp \
        src/cpp/types/listundefined.cpp src/cpp/types/string.cpp \
        src/cpp/types/implicitlist.cpp src/cpp/types/macro.cpp \
        src/cpp/types/struct.cpp src/cpp/types/macrofile.cpp \
-       src/cpp/types/callable.cpp \
+       src/cpp/types/callable.cpp src/cpp/types/addfunction.cpp \
        src/cpp/system_env/dynamic_module.cpp \
        src/cpp/system_env/setenvvar.cpp \
        src/cpp/system_env/sci_home.cpp \
@@ -1332,6 +1333,9 @@ src/cpp/types/libsciast_la-macrofile.lo:  \
        src/cpp/types/$(DEPDIR)/$(am__dirstamp)
 src/cpp/types/libsciast_la-callable.lo: src/cpp/types/$(am__dirstamp) \
        src/cpp/types/$(DEPDIR)/$(am__dirstamp)
+src/cpp/types/libsciast_la-addfunction.lo:  \
+       src/cpp/types/$(am__dirstamp) \
+       src/cpp/types/$(DEPDIR)/$(am__dirstamp)
 src/cpp/system_env/$(am__dirstamp):
        @$(MKDIR_P) src/cpp/system_env
        @: > src/cpp/system_env/$(am__dirstamp)
@@ -1447,6 +1451,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/system_env/$(DEPDIR)/libsciast_la-sci_path.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/system_env/$(DEPDIR)/libsciast_la-sci_tmpdir.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/system_env/$(DEPDIR)/libsciast_la-setenvvar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/types/$(DEPDIR)/libsciast_la-addfunction.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/types/$(DEPDIR)/libsciast_la-arrayof.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/types/$(DEPDIR)/libsciast_la-bool.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/types/$(DEPDIR)/libsciast_la-callable.Plo@am__quote@
@@ -2047,6 +2052,13 @@ src/cpp/types/libsciast_la-callable.lo: src/cpp/types/callable.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/types/libsciast_la-callable.lo `test -f 'src/cpp/types/callable.cpp' || echo '$(srcdir)/'`src/cpp/types/callable.cpp
 
+src/cpp/types/libsciast_la-addfunction.lo: src/cpp/types/addfunction.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/types/libsciast_la-addfunction.lo -MD -MP -MF src/cpp/types/$(DEPDIR)/libsciast_la-addfunction.Tpo -c -o src/cpp/types/libsciast_la-addfunction.lo `test -f 'src/cpp/types/addfunction.cpp' || echo '$(srcdir)/'`src/cpp/types/addfunction.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/types/$(DEPDIR)/libsciast_la-addfunction.Tpo src/cpp/types/$(DEPDIR)/libsciast_la-addfunction.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='src/cpp/types/addfunction.cpp' object='src/cpp/types/libsciast_la-addfunction.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/types/libsciast_la-addfunction.lo `test -f 'src/cpp/types/addfunction.cpp' || echo '$(srcdir)/'`src/cpp/types/addfunction.cpp
+
 src/cpp/system_env/libsciast_la-dynamic_module.lo: src/cpp/system_env/dynamic_module.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/system_env/libsciast_la-dynamic_module.lo -MD -MP -MF src/cpp/system_env/$(DEPDIR)/libsciast_la-dynamic_module.Tpo -c -o src/cpp/system_env/libsciast_la-dynamic_module.lo `test -f 'src/cpp/system_env/dynamic_module.cpp' || echo '$(srcdir)/'`src/cpp/system_env/dynamic_module.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/system_env/$(DEPDIR)/libsciast_la-dynamic_module.Tpo src/cpp/system_env/$(DEPDIR)/libsciast_la-dynamic_module.Plo
index 11fc1af..412e047 100644 (file)
@@ -460,6 +460,7 @@ lib /DEF:"$(ProjectDir)fileio_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform
     <ClCompile Include="src\cpp\system_env\sci_path.cpp" />
     <ClCompile Include="src\cpp\system_env\sci_tmpdir.cpp" />
     <ClCompile Include="src\cpp\system_env\setenvvar.cpp" />
+    <ClCompile Include="src\cpp\types\addfunction.cpp" />
     <ClCompile Include="src\cpp\types\arrayof.cpp" />
     <ClCompile Include="src\cpp\types\bool.cpp" />
     <ClCompile Include="src\cpp\types\callable.cpp" />
index e976772..1be5f3d 100644 (file)
     <ClCompile Include="src\cpp\system_env\configvariable_interface.cpp">
       <Filter>Source Files\system_env</Filter>
     </ClCompile>
+    <ClCompile Include="src\cpp\types\addfunction.cpp">
+      <Filter>Source Files\types</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/scilab/modules/ast/includes/types/addfunction.h b/scilab/modules/ast/includes/types/addfunction.h
new file mode 100644 (file)
index 0000000..71cd74b
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
+*  Copyright (C) 2014 - Scilab Enterprises - Cedric Delamarre
+*
+*  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 __ADDFUNCTION_H__
+#define __ADDFUNCTION_H__
+
+#include "dynlib_ast.h"
+
+EXTERN_AST void addCFunction(wchar_t* _wstName, OLDGW_FUNC _pFunc, wchar_t* _wstModule);
+
+#endif // __ADDFUNCTION_H__
diff --git a/scilab/modules/ast/src/cpp/types/addfunction.cpp b/scilab/modules/ast/src/cpp/types/addfunction.cpp
new file mode 100644 (file)
index 0000000..2eada0b
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
+*  Copyright (C) 2014 - Scilab Enterprises - Cedric Delamarre
+*
+*  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 "context.hxx"
+#include "function.hxx"
+
+extern "C"
+{
+#include "addfunction.h"
+}
+
+void addCFunction(wchar_t* _wstName, OLDGW_FUNC _pFunc, wchar_t* _wstModule)
+{
+    symbol::Context::getInstance()->addFunction(types::Function::createFunction(_wstName, _pFunc, _wstModule));
+}
index 7515b35..f8d84b1 100644 (file)
@@ -78,7 +78,7 @@ function libn = ilib_compile(lib_name, ..
         // Headers are dispatched in the source tree
         if isdir(SCI+"/modules/core/includes/") then
             defaultModulesCHeader=[ "core", "mexlib","api_scilab","output_stream","localization",  "dynamic_link",  "threads",  "string",  "console"];
-            defaultKernelCHeader=[ "ast" "exps" "operations" "parse" "symbol" "system_env" "types"];
+            defaultKernelCHeader=[ "analysis" "ast" "exps" "operations" "parse" "symbol" "system_env" "types"];
             defaultModulesFHeader=[ "core" ];
             ScilabTreeFound=%t
 
@@ -109,6 +109,12 @@ function libn = ilib_compile(lib_name, ..
             ScilabTreeFound=%t
         end
 
+        global cppCompilation;
+        if cppCompilation then
+            cflags = cflags + " --std=c++11";
+        end
+        clearglobal cppCompilation;
+
         if ( ilib_verbose() <> 0 & ScilabTreeFound <> %t) then
             mprintf(gettext("%s: Warning: Scilab has not been able to find where the Scilab sources are. Please submit a bug report on http://bugzilla.scilab.org/\n"),"ilib_compile");
         end
index 6a761e0..742aa24 100644 (file)
@@ -66,25 +66,46 @@ function gateway_filename = ilib_gen_gateway(name,tables)
         if ( nt <> 3 ) then
             error(msprintf(gettext("%s: Wrong size for input argument #%d: %d expected.\n"),"ilib_gen_gateway",2,3));
         end
-        [gate,names] = new_names(table);
-
+        [gate,names,cppCompilation] = new_names(table);
+        global cppCompilation;
         //generate cpp interface file
-        t = [
-        "#include ""context.hxx""";
-        "#include """ + tname + ".hxx""";
-        "extern ""C""";
-        "{";
-        "#include """ + tname + ".h""";
-        "}";
-        "";
-        "#define MODULE_NAME L""" + tname + """";
-        "";
-        "int " + tname + "(wchar_t* _pwstFuncName)";
-        "{";
-        "    if(wcscmp(_pwstFuncName, L""" + table(:,1) + """) == 0){ " + "symbol::Context::getInstance()->addFunction(types::Function::createFunction(L""" + table(:,1) + """, &" + names(:) + ", MODULE_NAME)); }";
-        "";
-        "    return 1;";
-        "}"];
+        if  cppCompilation then
+            t = [
+            "#include ""context.hxx""";
+            "#include ""cpp_gateway_prototype.hxx""";
+            "#include """ + tname + ".hxx""";
+            "extern ""C""";
+            "{";
+            "#include """ + tname + ".h""";
+            "}";
+            "";
+            "#define MODULE_NAME L""" + tname + """";
+            "";
+            "int " + tname + "(wchar_t* _pwstFuncName)";
+            "{";
+            "    if(wcscmp(_pwstFuncName, L""" + table(:,1) + """) == 0){ " + "symbol::Context::getInstance()->addFunction(types::Function::createFunction(L""" + table(:,1) + """, &" + names(:) + ", MODULE_NAME)); }";
+            "";
+            "    return 1;";
+            "}"];
+        else
+            t = [
+            "#include <wchar.h>";
+            "#include """ + tname + ".hxx""";
+            "extern ""C""";
+            "{";
+            "#include """ + tname + ".h""";
+            "#include ""addfunction.h""";
+            "}";
+            "";
+            "#define MODULE_NAME L""" + tname + """";
+            "";
+            "int " + tname + "(wchar_t* _pwstFuncName)";
+            "{";
+            "    if(wcscmp(_pwstFuncName, L""" + table(:,1) + """) == 0){ " + "addCFunction(L""" + table(:,1) + """, &" + names(:) + ", MODULE_NAME); }";
+            "";
+            "    return 1;";
+            "}"];
+        end
 
         gateway_filename(1) = path + tname + ".cpp";
         // first check if we have already a gateway
@@ -111,9 +132,6 @@ function gateway_filename = ilib_gen_gateway(name,tables)
         "#ifndef __" + TNAME + "_GW_HXX__";
         "#define __" + TNAME + "_GW_HXX__";
         "";
-        "#include ""c_gateway_prototype.h""";
-        "#include ""cpp_gateway_prototype.hxx""";
-        "";
         "#ifdef _MSC_VER";
         "#ifdef " + TNAME + "_GW_EXPORTS";
         "#define " + TNAME + "_GW_IMPEXP __declspec(dllexport)";
@@ -180,8 +198,9 @@ endfunction
 //=============================================================================
 // new_names only used by ilib_gen_gateway
 //=============================================================================
-function [gate,names] = new_names(table)
+function [gate,names,cppCompilation] = new_names(table)
     // change names according to types
+    cppCompilation = %f;
     [mt,nt] = size(table);
     gate = [""];
     gate = gate(ones(mt, 2));
@@ -205,6 +224,7 @@ function [gate,names] = new_names(table)
             names(i) = "C2F(" + table(i,2) + ")";
             gate(i, 1) = "C_GATEWAY_PROTOTYPE(" + names(i) + ");";
         case "cppsci"  then
+            cppCompilation = %t;
             names(i) = table(i,2);
             gate(i, 2) = "CPP_GATEWAY_PROTOTYPE(" + names(i) + ");";
         case "direct"  then