replug consolebox and update windows launching modes 01/15201/5
Antoine ELIAS [Tue, 9 Sep 2014 16:10:41 +0000 (18:10 +0200)]
Change-Id: I2a915bf7be18ebdec2a52d801ebbb1d358a508f3

16 files changed:
scilab/modules/core/Makefile.am
scilab/modules/core/Makefile.in
scilab/modules/core/includes/InitScilab.h
scilab/modules/core/sci_gateway/cpp/core_gw.vcxproj
scilab/modules/core/sci_gateway/cpp/sci_exit.cpp
scilab/modules/core/src/c/core.vcxproj
scilab/modules/core/src/c/core.vcxproj.filters
scilab/modules/core/src/cpp/InitScilab.cpp
scilab/modules/startup/src/cpp/scilab.cpp
scilab/modules/windows_tools/includes/windows_tools_gw.hxx
scilab/modules/windows_tools/sci_gateway/c/sci_consolebox.c [deleted file]
scilab/modules/windows_tools/sci_gateway/cpp/sci_consolebox.cpp [new file with mode: 0644]
scilab/modules/windows_tools/src/c/TerminateWindows_tools.c
scilab/modules/windows_tools/src/c/windows_tools.vcxproj
scilab/modules/windows_tools/src/c/windows_tools.vcxproj.filters
scilab/modules/windows_tools/src/cpp/windows_tools_gw.cpp

index 22a2835..ed11820 100644 (file)
@@ -204,6 +204,7 @@ libscicore_la_CPPFLAGS = \
     -I$(top_srcdir)/modules/preferences/includes/ \
     -I$(top_srcdir)/modules/external_objects/includes/ \
     -I$(top_srcdir)/modules/jvm/includes/ \
+    -I$(top_srcdir)/modules/jvm/src/c/ \
     -I$(top_srcdir)/modules/gui/includes/ \
     -I$(top_srcdir)/modules/graphics/includes/ \
     -I$(top_srcdir)/modules/hdf5/includes/ \
index a76efe3..259ad35 100644 (file)
@@ -900,6 +900,7 @@ libscicore_la_CPPFLAGS = -I$(srcdir)/includes/ -I$(srcdir)/src/c/ \
        -I$(top_srcdir)/modules/preferences/includes/ \
        -I$(top_srcdir)/modules/external_objects/includes/ \
        -I$(top_srcdir)/modules/jvm/includes/ \
+       -I$(top_srcdir)/modules/jvm/src/c/ \
        -I$(top_srcdir)/modules/gui/includes/ \
        -I$(top_srcdir)/modules/graphics/includes/ \
        -I$(top_srcdir)/modules/hdf5/includes/ $(EIGEN_CPPFLAGS) \
index 82be107..5215cf8 100644 (file)
@@ -33,6 +33,8 @@ typedef struct
     char* pstExec;
     char* pstLang;
     int iSerialize;
+    int iKeepConsole;
+    int iNoBanner;
 } ScilabEngineInfo;
 
 ScilabEngineInfo* InitScilabEngineInfo();
index 37e8b59..56ee680 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../fileio/includes;../../../threads/includes;../../../console/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../fileio/includes;../../../threads/includes;../../../console/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../jvm/src/c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CORE_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../fileio/includes;../../../threads/includes;../../../console/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../fileio/includes;../../../threads/includes;../../../console/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../jvm/src/c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CORE_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../fileio/includes;../../../threads/includes;../../../console/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../fileio/includes;../../../threads/includes;../../../console/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../jvm/src/c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CORE_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>../../includes;../../src/c;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../fileio/includes;../../../threads/includes;../../../console/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../includes;../../src/c;../../../../libs/intl;../../../../libs/Eigen/includes;../../../functions_manager/includes;../../../elementary_functions/includes;../../../api_scilab/includes;../../../output_stream/includes;../../../localization/includes;../../../string/includes;../../../fileio/includes;../../../threads/includes;../../../console/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../jvm/src/c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CORE_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <Project>{4fc72d4a-80ee-4b1a-8724-0201c1a35621}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\jvm\libjvm.vcxproj">
+      <Project>{8ba2dda8-bd04-4d4d-8ee6-6caa955f7470}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\localization\src\localization.vcxproj">
       <Project>{ecffeb0c-1eda-45ee-9a10-b18143852e17}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
index ccd47a2..a42fa53 100644 (file)
@@ -19,47 +19,64 @@ extern "C"
 {
 #include "localization.h"
 #include "Scierror.h"
+#include "sciprint.h"
+#include "sci_mode.h"
+#include "createMainScilabObject.h"
 }
 
-types::Function::ReturnValue sci_exit(types::typed_list &in, int _iRetCount, types::typed_list &out)
+using namespace types;
+
+Function::ReturnValue sci_exit(typed_list &in, int _iRetCount, typed_list &out)
 {
     // exit() or exit
     if (in.size() == 0)
     {
         ConfigVariable::setForceQuit(true);
-        return types::Function::OK;
+        return Function::OK;
     }
 
     // More than one input argument => ERROR
     if (in.size() != 1)
     {
         Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected."), "exit", 0, 1);
-        return types::Function::Error;
+        return Function::Error;
     }
 
     // in[0] Should be a scalar double value.
-    if (!in.front()->isDouble())
+    InternalType* pIT = in[0];
+    if (pIT->isDouble() == false)
     {
         Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), "exit", 1);
-        return types::Function::Error;
+        return Function::Error;
     }
 
-    if (in.front()->getAs<types::Double>()->getSize() != 1)
+    Double* pD = pIT->getAs<Double>();
+    if (pD->isScalar() == false)
     {
         Scierror(999, _("%s: Wrong size for input argument #%d: A scalar expected.\n"), "exit", 1);
-        return types::Function::Error;
+        return Function::Error;
     }
 
-    double dExit = in.front()->getAs<types::Double>()->getReal(0, 0);
-    int iExit = (int) in.front()->getAs<types::Double>()->getReal(0, 0);
+    double dExit = pD->get(0);
+    if (dExit != (int) dExit)
+    {
+        Scierror(999, _("%s: Wrong value for input argument #%d: An integer value expected.\n"), "exit", 1);
+        return Function::Error;
+    }
 
-    if (dExit != (double) iExit)
+    if (ConfigVariable::getScilabMode() != SCILAB_NWNI)
     {
-        Scierror(999, _("%s: Wrong value for input argument #%d: A integer expected.\n"), "exit", 1);
-        return types::Function::Error;
+        if (in.size() == 0)
+        {
+            //shouldExit = canCloseMainScilabObject();
+        }
+        else
+        {
+            //forceCloseMainScilabObject();
+        }
     }
 
-    ConfigVariable::setExitStatus(iExit);
+    ConfigVariable::setExitStatus((int)dExit);
     ConfigVariable::setForceQuit(true);
-    return types::Function::OK;
+    return Function::OK;
 }
index de69629..6e19444 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -120,7 +120,7 @@ cd ..
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -158,7 +158,7 @@ cd ..
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;NDEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -203,7 +203,7 @@ cd ..
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/GetWindowsVersion;../../../../libs/intl;../../../../libs/libxml2;../../../../libs/libxml2/libxml;../../../../libs/Eigen/includes;../../../mexlib/includes;../../../gui/src/c/wsci;../../../api_scilab/includes;../../../string/includes;../../../functions/includes;../../../dynamic_link/includes;../../../action_binding/includes;../../../output_stream/includes;../../../fileio/includes;../../../elementary_functions/includes;../../../tclsci/includes;../../../localization/includes;../../../tclsci/includes/tcltk;../../../windows_tools/includes;../../../windows_tools/src/c;../../../windows_tools/src/c/scilab_windows;../../../intersci/includes;../../../call_scilab/includes;../../../call_scilab/src/c;../../../graphics/includes;../../../io/includes;../../../console/includes;../../../preferences/includes;../../../history_manager/includes;../../../threads/includes;../../../external_objects/includes;../../../functions_manager/includes;../../../jvm/includes;../../../gui/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;../../../ast/includes/parse</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;NDEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -299,6 +299,7 @@ cd ..
     <ClCompile Include="readGateway.c" />
     <ClCompile Include="recursionFunction.c" />
     <ClCompile Include="returnanan.c" />
+    <ClCompile Include="saveCWDInPreferences.c" />
     <ClCompile Include="scimem.c" />
     <ClCompile Include="scirun.c" />
     <ClCompile Include="sci_tools.c" />
@@ -435,6 +436,7 @@ cd ..
     <ClInclude Include="predef.h" />
     <ClInclude Include="readGateway.h" />
     <ClInclude Include="run.h" />
+    <ClInclude Include="saveCWDInPreferences.h" />
     <ClInclude Include="str2sci.h" />
     <ClInclude Include="terme.h" />
   </ItemGroup>
index 7acf675..888da47 100644 (file)
     <ClCompile Include="sci_tools.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="saveCWDInPreferences.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\core.iss" />
     <ClInclude Include="..\..\includes\sci_malloc.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="saveCWDInPreferences.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\core.iss" />
index 5802dfa..9625708 100644 (file)
@@ -54,6 +54,8 @@ extern "C"
 #include "InitScilab.h"
 #include "setenvvar.h"
 #include "getScilabPreference.h"
+#include "saveCWDInPreferences.h"
+
 
 #ifdef _MSC_VER
 #include "InitializeWindows_tools.h"
@@ -62,7 +64,7 @@ extern "C"
 #include "console.h"
 #include "InnosetupMutex.h"
 #include "MutexClosingScilab.h"
-
+#include "WinConsole.h"
 #else
 #include "signal_mgmt.h"
 #include "initConsoleMode.h"
@@ -103,9 +105,12 @@ using namespace ast;
 
 ScilabEngineInfo* InitScilabEngineInfo()
 {
-    // Disable all but AST parsing.
+    // Disable all startup flags.
     ScilabEngineInfo* pSEI = (ScilabEngineInfo*)CALLOC(1, sizeof(ScilabEngineInfo));
-    pSEI->iExecAst      = 1;
+
+    //Active default flags
+    pSEI->iExecAst = 1;
+    pSEI->iNoBanner = 1;
 
     return pSEI;
 }
@@ -114,8 +119,6 @@ int StartScilabEngine(ScilabEngineInfo* _pSEI)
 {
     int iMainRet = 0;
 
-    InitializeLaunchScilabSignal();
-
     /* This bug only occurs under Linux 32 bits
      * See: http://wiki.scilab.org/Scilab_precision
      */
@@ -140,6 +143,43 @@ int StartScilabEngine(ScilabEngineInfo* _pSEI)
 
     checkForLinkerErrors();
 
+#ifdef _MSC_VER
+    //get current console window and hide it
+    int scilabMode = getScilabMode();
+    if (scilabMode == SCILAB_STD)
+    {
+        CreateScilabHiddenWndThread();
+        //show banner in console window
+        CreateScilabConsole(_pSEI->iNoBanner);
+
+        if (_pSEI->iKeepConsole == 0)
+        {
+            HideScilex(); /* hide console window */
+        }
+        else
+        {
+            ShowScilex();
+        }
+    }
+    else
+    {
+        if (scilabMode == SCILAB_NW || scilabMode == SCILAB_NWNI)
+        {
+            SaveConsoleColors();
+            if (scilabMode == SCILAB_NW)
+            {
+                RenameConsole();
+                UpdateConsoleColors();
+            }
+        }
+    }
+
+    //create a thread for innosetup to allow reinstall during scilab running
+    createInnosetupMutex();
+#endif
+
+    InitializeLaunchScilabSignal();
+
     /* Scilab Startup */
     InitializeEnvironnement();
 
@@ -176,34 +216,11 @@ int StartScilabEngine(ScilabEngineInfo* _pSEI)
     {
         /* Initialize console: lines... */
         InitializeConsole();
-
-#ifdef _MSC_VER
-        //get current console window and hide it
-        CreateScilabHiddenWndThread();
-        CreateScilabConsole(0);
-        //create a thread for innosetup to allow reinstall during scilab running
-        createInnosetupMutex();
-#endif
     }
     else
     {
 #ifndef _MSC_VER
         initConsoleMode(RAW);
-#else
-        if (getScilabMode() != SCILAB_NWNI)
-        {
-            CreateScilabHiddenWndThread();
-        }
-
-        if ( (getScilabMode() == SCILAB_NWNI) || (getScilabMode() == SCILAB_NW) )
-        {
-            SaveConsoleColors();
-            if (getScilabMode() == SCILAB_NW)
-            {
-                RenameConsole();
-                UpdateConsoleColors();
-            }
-        }
 #endif
     }
 
@@ -322,8 +339,10 @@ void StopScilabEngine(ScilabEngineInfo* _pSEI)
     symbol::Context::destroyInstance();
     //destroy function manager
     destroyfunctionManagerInstance();
-    //Unload dynamic modules
-    UnloadModules();
+
+    //from ExitScilab()
+    saveCWDInPreferences();
+    clearScilabPreferences();
 
     if (_pSEI->iNoJvm == 0)
     {
@@ -332,6 +351,7 @@ void StopScilabEngine(ScilabEngineInfo* _pSEI)
         TerminateJVM();
     }
 
+    /* TerminateCorePart2 */
 
     //clear opened files
     FileManager::destroy();
@@ -344,6 +364,9 @@ void StopScilabEngine(ScilabEngineInfo* _pSEI)
     /* Remove TMPDIR before exit */
     clearTMPDIR();
 
+    //Unload dynamic modules
+    UnloadModules();
+    /* TerminateCorePart2 end */
 
 #ifdef _MSC_VER
     TerminateWindows_tools();
index abc6823..4d56b43 100644 (file)
@@ -179,10 +179,18 @@ static int get_option(const int argc, char *argv[], ScilabEngineInfo* _pSEI)
         {
             _pSEI->iNoStart = 1;
         }
+        else if (!strcmp("-nb", argv[i]))
+        {
+            _pSEI->iNoBanner = 0;
+        }
         else if (!strcmp("--exec-verbose", argv[i]))
         {
             _pSEI->iExecVerbose = 1;
         }
+        else if (!strcmp("-keepconsole", argv[i]))
+        {
+            _pSEI->iKeepConsole = 1;
+        }
     }
 
     ConfigVariable::setCommandLineArgs(argc, argv);
index a92700f..101bf4f 100644 (file)
@@ -15,6 +15,7 @@
 
 
 #include "dynlib_windows_tools.h"
+#include "cpp_gateway_prototype.hxx"
 
 #include "context.hxx"
 
@@ -33,5 +34,6 @@ public :
     }
 };
 
+CPP_GATEWAY_PROTOTYPE(sci_consolebox);
 
 #endif /* !__WINDOWS_TOOLS_GW_HXX__ */
diff --git a/scilab/modules/windows_tools/sci_gateway/c/sci_consolebox.c b/scilab/modules/windows_tools/sci_gateway/c/sci_consolebox.c
deleted file mode 100644 (file)
index 8b868e6..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 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.1-en.txt
-*
-*/
-
-/*--------------------------------------------------------------------------*/
-#include <string.h>
-#include "gw_windows_tools.h"
-#include "sci_mode.h"
-#include "sci_malloc.h" /* MALLOC */
-#include "stack-c.h"
-#include "sciprint.h"
-#include "WinConsole.h"
-#include "Scierror.h"
-#include "localization.h"
-/*--------------------------------------------------------------------------*/
-int sci_consolebox(char *fname, unsigned long l)
-{
-    //static int l1, n1, m1;
-    //char *Output = NULL;
-
-    //Rhs = Max(Rhs, 0);
-    //CheckRhs(0, 1);
-    //CheckLhs(0, 1);
-
-    //Output = (char*)MALLOC(4 * sizeof(char));
-
-    //if (Rhs == 0)
-    //{
-    //    if (getScilabMode() == SCILAB_STD)
-    //    {
-    //        if (GetConsoleState())
-    //        {
-    //            strcpy(Output, "on");
-    //        }
-    //        else
-    //        {
-    //            strcpy(Output, "off");
-    //        }
-
-    //    }
-    //    else
-    //    {
-    //        sciprint(_("Only on Windows Mode, not in Console Mode.\n"));
-    //        strcpy(Output, "off");
-    //    }
-    //}
-    //else if (GetType(1) == sci_strings)
-    //{
-    //    char *param = NULL;
-
-    //    GetRhsVar(1, STRING_DATATYPE, &m1, &n1, &l1);
-    //    param = cstk(l1);
-
-    //    if ( (strcmp(param, "off") == 0) || (strcmp(param, "on") == 0) || (strcmp(param, "toggle") == 0) )
-    //    {
-    //        if (getScilabMode() == SCILAB_STD)
-    //        {
-    //            if (strcmp(param, "on") == 0)
-    //            {
-    //                SetConsoleState(1);
-    //                ShowScilex();
-    //                strcpy(Output, "on");
-    //            }
-    //            else if (strcmp(param, "off") == 0)
-    //            {
-    //                SetConsoleState(0);
-    //                HideScilex();
-    //                strcpy(Output, "off");
-    //            }
-    //            else /* toggle */
-    //            {
-    //                SwitchConsole();
-    //                if (GetConsoleState())
-    //                {
-    //                    strcpy(Output, "on");
-    //                }
-    //                else
-    //                {
-    //                    strcpy(Output, "off");
-    //                }
-    //            }
-    //        }
-    //        else
-    //        {
-    //            sciprint(_("Only on Windows Mode, not in Console Mode.\n"));
-    //            strcpy(Output, "off");
-    //        }
-    //    }
-    //    else
-    //    {
-    //        Scierror(999, ("%s: Wrong input argument: '%s', '%s' or '%s' expected.\n"), fname, "on", "off", "toggle");
-    //        return 0;
-    //    }
-    //}
-    //else
-    //{
-    //    Scierror(999, ("%s: Wrong input argument: '%s', '%s' or '%s' expected.\n"), fname, "on", "off", "toggle");
-    //    return 0;
-    //}
-
-    //n1 = 1;
-    //CreateVarFromPtr(Rhs + 1, STRING_DATATYPE, (m1 = (int)strlen(Output), &m1), &n1, &Output);
-    //if (Output)
-    //{
-    //    FREE(Output);
-    //    Output = NULL;
-    //}
-    //LhsVar(1) = Rhs + 1;
-    //PutLhsVar();
-    return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/windows_tools/sci_gateway/cpp/sci_consolebox.cpp b/scilab/modules/windows_tools/sci_gateway/cpp/sci_consolebox.cpp
new file mode 100644 (file)
index 0000000..a4ba828
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2014 - 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 "windows_tools_gw.hxx"
+#include "function.hxx"
+#include "string.hxx"
+
+extern "C"
+{
+#include "Scierror.h"
+#include "sciprint.h"
+#include "localization.h"
+#include "WinConsole.h"
+#include "sci_mode.h"
+}
+
+using namespace types;
+
+Function::ReturnValue sci_consolebox(typed_list &in, int _iRetCount, typed_list &out)
+{
+    if (in.size() < 0 || in.size() > 1)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d or %d expected.\n"), "consolebox", 0, 1);
+        return Function::Error;
+    }
+
+    if (getScilabMode() != SCILAB_STD)
+    {
+        sciprint(_("Only on Windows Mode, not in Console Mode.\n"));
+        out.push_back(new String(L"off"));
+        return Function::OK;
+    }
+
+
+    //request mode
+    if (in.size() == 0)
+    {
+        if (GetConsoleState())
+        {
+            out.push_back(new String(L"on"));
+        }
+        else
+        {
+            out.push_back(new String(L"off"));
+        }
+        return Function::OK;
+    }
+
+    InternalType* pIT1 = in[0];
+
+    if (pIT1->isString() == false)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), "consolebox", 1);
+        return Function::Error;
+    }
+
+    String* pS1 = pIT1->getAs<String>();
+    if (pS1->isScalar() == false)
+    {
+        Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), "consolebox", 1);
+        return Function::Error;
+    }
+
+    std::wstring wcsAction(pS1->get(0));
+
+    if (wcsAction == L"on")
+    {
+        SetConsoleState(1);
+        ShowScilex();
+    }
+    else if (wcsAction == L"off")
+    {
+        SetConsoleState(0);
+        HideScilex();
+    }
+    else if (wcsAction == L"toggle")
+    {
+        SwitchConsole();
+    }
+    else
+    {
+        Scierror(999, ("%s: Wrong input argument: '%s', '%s' or '%s' expected.\n"), "consolebox", "on", "off", "toggle");
+        return Function::Error;
+    }
+
+    if (GetConsoleState())
+    {
+        out.push_back(new String(L"on"));
+    }
+    else
+    {
+        out.push_back(new String(L"off"));
+    }
+
+    return Function::OK;
+}
+/*--------------------------------------------------------------------------*/
index 0a0ec8f..c993cff 100644 (file)
@@ -25,7 +25,9 @@ BOOL TerminateWindows_tools(void)
     {
         case SCILAB_STD:
         {
-            CloseScilabConsole();
+            //Since Scilab 6 All scilab mode are launch in console mode
+            //So we cannot close owner console
+            //CloseScilabConsole();
             closeInnosetupMutex();
             bOK = TRUE;
         }
index 83b7857..8261661 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">
@@ -250,6 +250,7 @@ lib /DEF:"$(ProjectDir)Call_scilab_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Pla
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_consolebox.cpp" />
     <ClCompile Include="createGUID.c" />
     <ClCompile Include="DllmainWindows_Tools.c" />
     <ClCompile Include="FindFileAssociation.c" />
@@ -257,7 +258,6 @@ lib /DEF:"$(ProjectDir)Call_scilab_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Pla
     <ClCompile Include="httpdownloadfile.c" />
     <ClCompile Include="InitializeWindows_tools.c" />
     <ClCompile Include="registry.c" />
-    <ClCompile Include="..\..\sci_gateway\c\sci_consolebox.c" />
     <ClCompile Include="..\..\sci_gateway\c\sci_createGUID.c" />
     <ClCompile Include="..\..\sci_gateway\c\sci_dos.c" />
     <ClCompile Include="..\..\sci_gateway\c\sci_findfileassociation.c" />
index 96b1b04..4702de0 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
     <Filter Include="Source Files">
@@ -44,9 +44,6 @@
     <ClCompile Include="registry.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\sci_gateway\c\sci_consolebox.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\sci_gateway\c\sci_createGUID.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -86,6 +83,9 @@
     <ClCompile Include="winopen.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_consolebox.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\includes\FocusOnConsole.h">
     <Library Include="..\..\..\..\bin\blasplus.lib" />
     <Library Include="..\..\..\..\bin\lapack.lib" />
   </ItemGroup>
-</Project>
+</Project>
\ No newline at end of file
index 5f76b41..1cef7c7 100644 (file)
@@ -23,5 +23,6 @@ int WindowsToolsModule::Load()
     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"win64", &sci_win64, MODULE_NAME));
     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"winqueryreg", &sci_winqueryreg, MODULE_NAME));
     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"dos", &sci_dos, MODULE_NAME));
+    symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"consolebox", &sci_consolebox, MODULE_NAME));
     return 1;
 }