diff options
author | Shashank | 2017-05-29 12:40:26 +0530 |
---|---|---|
committer | Shashank | 2017-05-29 12:40:26 +0530 |
commit | 0345245e860375a32c9a437c4a9d9cae807134e9 (patch) | |
tree | ad51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/windows_tools/src | |
download | scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2 scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip |
CMSCOPE changed
Diffstat (limited to 'modules/windows_tools/src')
118 files changed, 8979 insertions, 0 deletions
diff --git a/modules/windows_tools/src/c/CScilex/CScilex.c b/modules/windows_tools/src/c/CScilex/CScilex.c new file mode 100755 index 000000000..676bafded --- /dev/null +++ b/modules/windows_tools/src/c/CScilex/CScilex.c @@ -0,0 +1,180 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) 2010 - DIGITEO - 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 <windows.h> +#include <strsafe.h> +#include <string.h> +#include <stdio.h> +#include "GetWindowsVersion.h" +#include "MALLOC.h" +/*--------------------------------------------------------------------------*/ +#define MSG_DETECT_XP_OR_MORE "Scilab requires Windows XP or more." +#define MSG_DETECT_UNKNOW "Scilab does not support this unknow version of Windows." +#define MSG_DETECT_SSE_OR_MORE "Scilab requires SSE Instructions." +#define MSG_WARNING "Warning" +#define MSG_LOAD_LIBRARIES "scilex.exe failed with error %d: %s" +#define MAIN_FUNCTION "Console_Main" +#define SCILAB_LIBRARY "scilab_windows" +#define ARG_NW "-nw" +#define ARG_NWNI "-nwni" +#define ARG_NOGUI "-nogui" +#define LENGTH_BUFFER_SECURITY 64 +/*--------------------------------------------------------------------------*/ +typedef int (*MYPROC1) (int , char **); +/*--------------------------------------------------------------------------*/ +/* BUG 6934 */ +/* http://bugzilla.scilab.org/show_bug.cgi?id=6934 */ +/* http://msdn.microsoft.com/en-us/library/chh3fb0k(VS.80).aspx */ +#ifdef __INTEL_COMPILER +#pragma optimize("g", off) +#endif +/*--------------------------------------------------------------------------*/ +int main (int argc, char **argv) +{ +#define MAXCMDTOKENS 128 + int iExitCode = 0; + UINT LastErrorMode = 0; + HINSTANCE hinstLib = NULL; + + BOOL fFreeResult = FALSE, fRunTimeLinkSuccess = FALSE; + + int argcbis = -1; + LPSTR argvbis[MAXCMDTOKENS]; + int i = 0; + int FindNW = 0; + + if (GetWindowsVersion() == OS_ERROR ) + { + MessageBox(NULL, TEXT(MSG_DETECT_UNKNOW), TEXT(MSG_WARNING), MB_ICONWARNING); + return -1; + } + + if (GetWindowsVersion() < OS_WIN32_WINDOWS_XP ) + { + MessageBox(NULL, TEXT(MSG_DETECT_XP_OR_MORE), TEXT(MSG_WARNING), MB_ICONWARNING); + return -1; + } + + /* http://msdn.microsoft.com/en-us/library/ms724482(VS.85).aspx */ + if (!IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE)) + { + MessageBox(NULL, TEXT(MSG_DETECT_SSE_OR_MORE), TEXT(MSG_WARNING), MB_ICONWARNING); + return -1; + } + + for (i = 0; i < argc; i++) + { + if (_stricmp(argv[i], ARG_NW) == 0) + { + FindNW = 1; + } + if (_stricmp(argv[i], ARG_NWNI) == 0 ) + { + FindNW = 1; + } + if (_stricmp(argv[i], ARG_NOGUI) == 0 ) + { + FindNW = 1; + } + } + + if ( FindNW == 0 ) + { + /* -nw added as first argument and not last */ + char *nwparam = NULL; + nwparam = (char*)MALLOC((strlen(ARG_NW) + 1) * sizeof(char)); + strcpy_s(nwparam, (strlen(ARG_NW) + 1), ARG_NW); + + argvbis[0] = argv[0]; + argvbis[1] = nwparam; + + for (i = 1; i < argc; i++) + { + argvbis[i + 1] = argv[i]; + } + argcbis = argc + 1; + } + else + { + for (i = 0; i < argc; i++) + { + argvbis[i] = argv[i]; + } + argcbis = argc; + } + + /* Disable system errors msgbox */ + LastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); + + hinstLib = LoadLibrary(TEXT(SCILAB_LIBRARY)); + + /* re enable system errors msgbox */ + SetErrorMode(LastErrorMode); + + if (hinstLib != NULL) + { + MYPROC1 Console_Main = NULL; + + /* launch main */ + Console_Main = (MYPROC1) GetProcAddress(hinstLib, MAIN_FUNCTION); + + if (NULL != Console_Main) + { + fRunTimeLinkSuccess = TRUE; + +#ifndef _DEBUG + /* catch system errors msgbox (release mode only) */ + /* http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx */ + LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOGPFAULTERRORBOX ); + _try + { +#endif + iExitCode = (Console_Main)(argcbis, argvbis); + +#ifndef _DEBUG + } + _except (EXCEPTION_EXECUTE_HANDLER) + { + } +#endif + } + fFreeResult = FreeLibrary(hinstLib); + } + + if (! fRunTimeLinkSuccess) + { +#define BUFFER_SIZE 512 + char buffer[BUFFER_SIZE]; + char *OutputMsg = NULL; + DWORD dw = GetLastError(); + + if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, + dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + buffer, BUFFER_SIZE, NULL) == 0) + { + StringCchPrintf(buffer, strlen("Unknown Error") + 1, "Unknown Error"); + } + + fprintf(stderr, "scilex can't launch scilab.\nError code : %lu\n", dw); + OutputMsg = (char*)MALLOC((strlen(buffer) + 1) * sizeof(char)); + if (OutputMsg) + { + CharToOem(buffer, OutputMsg); + fprintf(stderr, "%s\n", OutputMsg); + FREE(OutputMsg); + } + exit(1); + } + return iExitCode; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/CScilex/CScilex.rc b/modules/windows_tools/src/c/CScilex/CScilex.rc new file mode 100755 index 000000000..a2ee69bc6 --- /dev/null +++ b/modules/windows_tools/src/c/CScilex/CScilex.rc @@ -0,0 +1,138 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "wresource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON_SCILAB ICON "..\\resources\\scilab.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""wresource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 5,5,2,0 + PRODUCTVERSION 5,5,2,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040c04b0" + BEGIN + VALUE "CompanyName", "Scilab Enterprises" + VALUE "FileDescription", "Scilab 5.5.1 (NO GUI)" + VALUE "FileVersion", "5, 5, 2, 0" + VALUE "InternalName", "WScilex" + VALUE "LegalCopyright", "Copyright (C) 2017" + VALUE "OriginalFilename", "WScilex.exe" + VALUE "ProductName", "Scilab 5.x Application" + VALUE "ProductVersion", "5, 5, 2, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40c, 1200 + END +END + +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/modules/windows_tools/src/c/CScilex/CScilex.vcxproj b/modules/windows_tools/src/c/CScilex/CScilex.vcxproj new file mode 100755 index 000000000..3638589d5 --- /dev/null +++ b/modules/windows_tools/src/c/CScilex/CScilex.vcxproj @@ -0,0 +1,187 @@ +<?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"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>Scilex</ProjectName> + <ProjectGuid>{9BA6F7E4-AE64-4FD9-A5A7-0996A8B73B77}</ProjectGuid> + <RootNamespace>CScilex</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>$(SolutionDir)libs\DetectFramework2;$(SolutionDir)libs\GetWindowsVersion;$(SolutionDir)modules\core\includes;$(SolutionDir)modules\windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <ObjectFileName>$(Configuration)/</ObjectFileName> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)CScilex.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>$(SolutionDir)libs\DetectFramework2;$(SolutionDir)libs\GetWindowsVersion;$(SolutionDir)modules\core\includes;$(SolutionDir)modules\windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <ObjectFileName>$(Configuration)/</ObjectFileName> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(OutDir)CScilex.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>$(SolutionDir)libs\DetectFramework2;$(SolutionDir)libs\GetWindowsVersion;$(SolutionDir)modules\core\includes;$(SolutionDir)modules\windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <ObjectFileName>$(Configuration)/</ObjectFileName> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>$(SolutionDir)libs\DetectFramework2;$(SolutionDir)libs\GetWindowsVersion;$(SolutionDir)modules\core\includes;$(SolutionDir)modules\windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <ObjectFileName>$(Configuration)/</ObjectFileName> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="CScilex.c" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="CScilex.rc" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\..\libs\GetWindowsVersion\GetWindowsVersion.vcxproj"> + <Project>{982bf37f-42c4-4d37-8d14-60521b141503}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\..\core\src\c\core.vcxproj"> + <Project>{c6e2bc17-34d8-46e4-85f3-6293cb21adcd}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/modules/windows_tools/src/c/CScilex/CScilex.vcxproj.filters b/modules/windows_tools/src/c/CScilex/CScilex.vcxproj.filters new file mode 100755 index 000000000..6b2834ae4 --- /dev/null +++ b/modules/windows_tools/src/c/CScilex/CScilex.vcxproj.filters @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="CScilex.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="CScilex.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/modules/windows_tools/src/c/CScilex/resource.h b/modules/windows_tools/src/c/CScilex/resource.h new file mode 100755 index 000000000..25bfe22f8 --- /dev/null +++ b/modules/windows_tools/src/c/CScilex/resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by WScilex.rc +// +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +#define IDI_ICON_SCILAB 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 112 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/modules/windows_tools/src/c/CScilex/wresource.h b/modules/windows_tools/src/c/CScilex/wresource.h new file mode 100755 index 000000000..ed1e39e94 --- /dev/null +++ b/modules/windows_tools/src/c/CScilex/wresource.h @@ -0,0 +1,4 @@ +#ifndef __WRESOURCE_H__ +#define __WRESOURCE_H__ + +#endif /* __WRESOURCE_H__ */ diff --git a/modules/windows_tools/src/c/Call_scilab_Import.def b/modules/windows_tools/src/c/Call_scilab_Import.def new file mode 100755 index 000000000..84decaffe --- /dev/null +++ b/modules/windows_tools/src/c/Call_scilab_Import.def @@ -0,0 +1,5 @@ +LIBRARY call_scilab.dll + + +EXPORTS +IsFromC
\ No newline at end of file diff --git a/modules/windows_tools/src/c/DllmainWindows_Tools.c b/modules/windows_tools/src/c/DllmainWindows_Tools.c new file mode 100755 index 000000000..53ca65b35 --- /dev/null +++ b/modules/windows_tools/src/c/DllmainWindows_Tools.c @@ -0,0 +1,34 @@ +/* +* 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 <windows.h> +/*--------------------------------------------------------------------------*/ +#pragma comment(lib,"../../../../bin/libintl.lib") +/*--------------------------------------------------------------------------*/ +int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + break; + case DLL_PROCESS_DETACH: + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + } + return 1; +} +/*--------------------------------------------------------------------------*/ + diff --git a/modules/windows_tools/src/c/FindFileAssociation.c b/modules/windows_tools/src/c/FindFileAssociation.c new file mode 100755 index 000000000..d2cb680d7 --- /dev/null +++ b/modules/windows_tools/src/c/FindFileAssociation.c @@ -0,0 +1,50 @@ +/* +* 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 <shlwapi.h> +#include <stdio.h> +#include "FindFileAssociation.h" +#include "MALLOC.h" +#include "strdup_windows.h" +#include "PATH_MAX.h" +#include "charEncoding.h" +/*--------------------------------------------------------------------------*/ +#pragma comment(lib,"shlwapi.lib") /* AssocQueryString */ +/*--------------------------------------------------------------------------*/ +char *FindFileAssociation (char *ptrFindStr, char *Extra) +{ + char *ptrResult = NULL ; + + if ( ptrFindStr ) + { + wchar_t *wcptrFindStr = to_wide_string(ptrFindStr); + wchar_t *wcExtra = to_wide_string(Extra); + wchar_t szDefault[PATH_MAX + FILENAME_MAX]; + DWORD ccDefault = PATH_MAX + FILENAME_MAX; + + if (wcptrFindStr) + { + HRESULT rc = AssocQueryStringW (0, ASSOCSTR_EXECUTABLE, wcptrFindStr, wcExtra, szDefault, &ccDefault); + if (ccDefault) + { + if (rc == S_OK) + { + ptrResult = wide_string_to_UTF8(szDefault); + } + } + } + } + return ptrResult; +} +/*--------------------------------------------------------------------------*/ + diff --git a/modules/windows_tools/src/c/FindFileAssociation.h b/modules/windows_tools/src/c/FindFileAssociation.h new file mode 100755 index 000000000..fb26fcf1e --- /dev/null +++ b/modules/windows_tools/src/c/FindFileAssociation.h @@ -0,0 +1,28 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __FINDFILEASSOCIATION_H__ +#define __FINDFILEASSOCIATION_H__ + +/** +* returns full name of application associated to a file extension +* example : FindFileAssociation (".sce","print"); +* returns "c:\programs files\scilab-5.0\wscilex.exe" +* @param[in] file extension +* @param[in] It is typically set to a Shell verb such as open. Set this parameter to NULL if it is not used. +* @return file associated +*/ +char * FindFileAssociation (char *ptrFindStr, char *Extra); + +#endif /* __FINDFILEASSOCIATION_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/InitializeWindows_tools.c b/modules/windows_tools/src/c/InitializeWindows_tools.c new file mode 100755 index 000000000..018ad9900 --- /dev/null +++ b/modules/windows_tools/src/c/InitializeWindows_tools.c @@ -0,0 +1,32 @@ +/* +* 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 <stdio.h> +#include <windows.h> +#include "InitializeWindows_tools.h" +#include "fromc.h" +/*--------------------------------------------------------------------------*/ +BOOL InitializeWindows_tools(void) +{ + BOOL bOK = FALSE; + + HWND hScilab = GetConsoleWindow(); + + if ( (hScilab) && IsFromC() ) + { + /* force redirect stdout, stderr in console */ + freopen("CONOUT$", "wb", stdout); /* redirect stdout --> CONOUT$*/ + } + return bOK; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/TerminateWindows_tools.c b/modules/windows_tools/src/c/TerminateWindows_tools.c new file mode 100755 index 000000000..4f992cd0f --- /dev/null +++ b/modules/windows_tools/src/c/TerminateWindows_tools.c @@ -0,0 +1,48 @@ +/* +* 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 "TerminateWindows_tools.h" +#include "scilabmode.h" +#include "console.h" +#include "InnosetupMutex.h" +/*--------------------------------------------------------------------------*/ +BOOL TerminateWindows_tools(void) +{ + BOOL bOK = FALSE; + int scilabMode = getScilabMode(); + + switch (scilabMode) + { + case SCILAB_STD: + { + CloseScilabConsole(); + closeInnosetupMutex(); + bOK = TRUE; + } + break; + + case SCILAB_NW: + { + RestoreConsoleColors(); + RestoreExitButton(); + bOK = TRUE; + } + break; + + default: + break; + } + + return bOK; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/WScilex/WScilex.c b/modules/windows_tools/src/c/WScilex/WScilex.c new file mode 100755 index 000000000..4ac5b7cae --- /dev/null +++ b/modules/windows_tools/src/c/WScilex/WScilex.c @@ -0,0 +1,130 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) 2010 - DIGITEO - 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 <windows.h> +#include <strsafe.h> +#include <string.h> +#include <stdio.h> +#include "GetWindowsVersion.h" +#include "MALLOC.h" +/*--------------------------------------------------------------------------*/ +#define MSG_DETECT_XP_OR_MORE "Scilab requires Windows XP or more." +#define MSG_DETECT_UNKNOW "Scilab does not support this unknow version of Windows." +#define MSG_DETECT_SSE_OR_MORE "Scilab requires SSE Instructions." +#define MSG_WARNING "Warning" +#define MSG_LOAD_LIBRARIES "Wscilex.exe failed with error %d: %s" +#define MAIN_FUNCTION "Windows_Main" +#define SCILAB_LIBRARY "scilab_windows" +#define ARG_NW "-nw" +#define ARG_NWNI "-nwni" +#define ARG_NOGUI "-nogui" +#define LENGTH_BUFFER_SECURITY 64 +/*--------------------------------------------------------------------------*/ +typedef int (*MYPROC1) (HINSTANCE, HINSTANCE , LPSTR szCmdLine, int iCmdShow); +/*--------------------------------------------------------------------------*/ +/* BUG 6934 */ +/* http://bugzilla.scilab.org/show_bug.cgi?id=6934 */ +/* http://msdn.microsoft.com/en-us/library/chh3fb0k(VS.80).aspx */ +#ifdef __INTEL_COMPILER +#pragma optimize("g", off) +#endif +/*--------------------------------------------------------------------------*/ +int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow) +{ + int iExitCode = 0; + HINSTANCE hinstLib = NULL; + BOOL fFreeResult = FALSE, fRunTimeLinkSuccess = FALSE; + + if (GetWindowsVersion() == OS_ERROR ) + { + MessageBox(NULL, TEXT(MSG_DETECT_UNKNOW), TEXT(MSG_WARNING), MB_ICONWARNING); + return -1; + } + + if (GetWindowsVersion() < OS_WIN32_WINDOWS_XP ) + { + MessageBox(NULL, TEXT(MSG_DETECT_XP_OR_MORE), TEXT(MSG_WARNING), MB_ICONWARNING); + return -1; + } + + /* http://msdn.microsoft.com/en-us/library/ms724482(VS.85).aspx */ + if (!IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE)) + { + MessageBox(NULL, TEXT(MSG_DETECT_SSE_OR_MORE), TEXT(MSG_WARNING), MB_ICONWARNING); + return -1; + } + + hinstLib = LoadLibrary(TEXT(SCILAB_LIBRARY)); + if (hinstLib != NULL) + { + MYPROC1 Windows_Main = NULL; + + /* launch main */ + Windows_Main = (MYPROC1) GetProcAddress(hinstLib, MAIN_FUNCTION); + if (NULL != Windows_Main) + { + +#ifndef _DEBUG + /* catch system errors msgbox (release mode only) */ + /* http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx */ + UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOGPFAULTERRORBOX ); + _try + { +#endif + fRunTimeLinkSuccess = TRUE; + /* launch main */ + iExitCode = (Windows_Main)(hInstance, hPrevInstance, szCmdLine, iCmdShow); + +#ifndef _DEBUG + } + _except (EXCEPTION_EXECUTE_HANDLER) + { + } +#endif + } + fFreeResult = FreeLibrary(hinstLib); + } + + if (!fRunTimeLinkSuccess) + { + LPVOID lpMsgBuf; + LPVOID lpDisplayBuf; + + DWORD dw = GetLastError(); + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + dw, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, NULL ); + + lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT, + (lstrlen((LPCTSTR)lpMsgBuf) + LENGTH_BUFFER_SECURITY) * sizeof(TCHAR)); + StringCchPrintf((LPTSTR)lpDisplayBuf, + LocalSize(lpDisplayBuf) / sizeof(TCHAR), + TEXT(MSG_LOAD_LIBRARIES), + dw, lpMsgBuf); + + MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT(MSG_WARNING), MB_ICONERROR); + + LocalFree(lpMsgBuf); + LocalFree(lpDisplayBuf); + exit(1); + } + return iExitCode; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/WScilex/WScilex.rc b/modules/windows_tools/src/c/WScilex/WScilex.rc new file mode 100755 index 000000000..6a922b988 --- /dev/null +++ b/modules/windows_tools/src/c/WScilex/WScilex.rc @@ -0,0 +1,128 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "wresource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""wresource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 5,5,2,0 + PRODUCTVERSION 5,5,2,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040c04b0" + BEGIN + VALUE "CompanyName", "Scilab Enterprises" + VALUE "FileDescription", "Scilab 5.5.2 (GUI)" + VALUE "FileVersion", "5, 5, 2, 0" + VALUE "InternalName", "WScilex" + VALUE "LegalCopyright", "Copyright (C) 2017" + VALUE "OriginalFilename", "WScilex.exe" + VALUE "ProductName", "Scilab 5.x Application" + VALUE "ProductVersion", "5, 5, 2, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40c, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +IDI_ICON_SCILAB ICON "..\\resources\\scilab.ico" +IDI_ICON_BIN ICON "..\\resources\\bin.ico" +IDI_ICON_XCOS ICON "..\\resources\\xcos.ico" +IDI_ICON_COSF ICON "..\\resources\\cosf.ico" +IDI_ICON_DEM ICON "..\\resources\\dem.ico" +IDI_ICON_GRAPH ICON "..\\resources\\graph.ico" +IDI_ICON_SAV ICON "..\\resources\\sav.ico" +IDI_ICON_SCE ICON "..\\resources\\sce.ico" +IDI_ICON_SCI ICON "..\\resources\\sci.ico" +IDI_ICON_TST ICON "..\\resources\\tst.ico" +IDI_ICON_SOD ICON "..\\resources\\sod.ico" +IDI_ICON_ZCOS ICON "..\\resources\\zcos.ico" + +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/modules/windows_tools/src/c/WScilex/WScilex.vcxproj b/modules/windows_tools/src/c/WScilex/WScilex.vcxproj new file mode 100755 index 000000000..06306f9c3 --- /dev/null +++ b/modules/windows_tools/src/c/WScilex/WScilex.vcxproj @@ -0,0 +1,212 @@ +<?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"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{CCD80549-EB9C-42AA-9B86-D687377E94F6}</ProjectGuid> + <RootNamespace>WScilex</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>$(SolutionDir)libs\DetectFramework2;$(SolutionDir)libs\GetWindowsVersion;$(SolutionDir)modules\core\includes;$(SolutionDir)modules\windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <ObjectFileName>$(Configuration)/</ObjectFileName> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)WScilex.pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>$(SolutionDir)libs\DetectFramework2;$(SolutionDir)libs\GetWindowsVersion;$(SolutionDir)modules\core\includes;$(SolutionDir)modules\windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <ObjectFileName>$(Configuration)/</ObjectFileName> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(OutDir)WScilex.pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>$(SolutionDir)libs\DetectFramework2;$(SolutionDir)libs\GetWindowsVersion;$(SolutionDir)modules\core\includes;$(SolutionDir)modules\windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <ObjectFileName>$(Configuration)/</ObjectFileName> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>$(SolutionDir)libs\DetectFramework2;$(SolutionDir)libs\GetWindowsVersion;$(SolutionDir)modules\core\includes;$(SolutionDir)modules\windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <ObjectFileName>$(Configuration)/</ObjectFileName> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).exe</OutputFile> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="WScilex.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="resource.h" /> + </ItemGroup> + <ItemGroup> + <None Include="..\resources\BIN.ICO" /> + <None Include="..\resources\COS.ICO" /> + <None Include="..\resources\COSF.ICO" /> + <None Include="..\resources\DEM.ICO" /> + <None Include="..\resources\Graph.ICO" /> + <None Include="..\resources\SAV.ICO" /> + <None Include="..\resources\SCE.ICO" /> + <None Include="..\resources\SCI.ICO" /> + <None Include="..\resources\scilab.ico" /> + <None Include="..\resources\sod.ico" /> + <None Include="..\resources\TST.ICO" /> + <None Include="..\resources\xcos.ico" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="WScilex.rc" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\..\libs\GetWindowsVersion\GetWindowsVersion.vcxproj"> + <Project>{982bf37f-42c4-4d37-8d14-60521b141503}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\tools\localization\generatePoFile.vcxproj"> + <Project>{6880d4df-bc7a-411f-ad9b-20a14429a92f}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\..\functions\scripts\buildmacros\BuildMacros.vcxproj"> + <Project>{66f2fb48-5d68-4445-a856-119f685a371b}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\CScilex\CScilex.vcxproj"> + <Project>{9ba6f7e4-ae64-4fd9-a5a7-0996a8b73b77}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/modules/windows_tools/src/c/WScilex/WScilex.vcxproj.filters b/modules/windows_tools/src/c/WScilex/WScilex.vcxproj.filters new file mode 100755 index 000000000..d09d491a5 --- /dev/null +++ b/modules/windows_tools/src/c/WScilex/WScilex.vcxproj.filters @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="WScilex.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="resource.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <None Include="..\resources\BIN.ICO"> + <Filter>Resource Files</Filter> + </None> + <None Include="..\resources\COS.ICO"> + <Filter>Resource Files</Filter> + </None> + <None Include="..\resources\COSF.ICO"> + <Filter>Resource Files</Filter> + </None> + <None Include="..\resources\DEM.ICO"> + <Filter>Resource Files</Filter> + </None> + <None Include="..\resources\Graph.ICO"> + <Filter>Resource Files</Filter> + </None> + <None Include="..\resources\SAV.ICO"> + <Filter>Resource Files</Filter> + </None> + <None Include="..\resources\SCE.ICO"> + <Filter>Resource Files</Filter> + </None> + <None Include="..\resources\SCI.ICO"> + <Filter>Resource Files</Filter> + </None> + <None Include="..\resources\scilab.ico"> + <Filter>Resource Files</Filter> + </None> + <None Include="..\resources\TST.ICO"> + <Filter>Resource Files</Filter> + </None> + <None Include="..\resources\xcos.ico"> + <Filter>Resource Files</Filter> + </None> + <None Include="..\resources\sod.ico"> + <Filter>Resource Files</Filter> + </None> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="WScilex.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/modules/windows_tools/src/c/WScilex/resource.h b/modules/windows_tools/src/c/WScilex/resource.h new file mode 100755 index 000000000..05efc2d1f --- /dev/null +++ b/modules/windows_tools/src/c/WScilex/resource.h @@ -0,0 +1,28 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by WScilex.rc +// + +#define IDI_ICON_SCILAB 112 +#define IDI_ICON_BIN 113 +#define IDI_ICON_XCOS 114 +#define IDI_ICON_COSF 115 +#define IDI_ICON_DEM 116 +#define IDI_ICON_GRAPH 117 +#define IDI_ICON_SAV 118 +#define IDI_ICON_SCE 119 +#define IDI_ICON_SCI 120 +#define IDI_ICON_TST 121 +#define IDI_ICON_SOD 122 +#define IDI_ICON_ZCOS 123 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 123 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/modules/windows_tools/src/c/WScilex/wresource.h b/modules/windows_tools/src/c/WScilex/wresource.h new file mode 100755 index 000000000..4e319ab57 --- /dev/null +++ b/modules/windows_tools/src/c/WScilex/wresource.h @@ -0,0 +1,14 @@ +// 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 + + +#ifndef __WRESOURCE_H__ +#define __WRESOURCE_H__ + +#endif /* __WRESOURCE_H__ */ diff --git a/modules/windows_tools/src/c/WinConsole.c b/modules/windows_tools/src/c/WinConsole.c new file mode 100755 index 000000000..b425a1c8f --- /dev/null +++ b/modules/windows_tools/src/c/WinConsole.c @@ -0,0 +1,86 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#define _WIN32_WINNT 0x0500 +#include <Windows.h> +#include <stdio.h> +#include "WinConsole.h" +#include "version.h" +#include "scilabmode.h" +#include "MALLOC.h" +#include "scilab_windows/console.h" +/*--------------------------------------------------------------------------*/ +static int Windows_Console_State = 0;/* 0 Hide 1 Show */ +/*--------------------------------------------------------------------------*/ +/*Cache la fenetre Scilex(x) de ce processus */ +void HideScilex(void) +{ + HWND hScilex = NULL; + hScilex = GetConsoleWindow(); + if (hScilex) + { + ShowWindow(hScilex, SW_HIDE); + SetConsoleState(0); + } +} +/*--------------------------------------------------------------------------*/ +/*Montre la fenetre Scilex(x) de ce processus */ +void ShowScilex(void) +{ + HWND hScilex = NULL; + hScilex = GetConsoleWindow(); + if (hScilex) + { + ShowWindow(hScilex, SW_SHOWNOACTIVATE); + SetConsoleState(1); + } +} +/*--------------------------------------------------------------------------*/ +void SwitchConsole(void) +{ + char *ConsoleName = getScilexConsoleName(); + + switch (GetConsoleState()) + { + /* La fenetre etait cachée , on la restaure */ + case 0: + { + ShowScilex(); + } + break; + /* La fenetre etait apparente , on la cache */ + case 1: + { + HideScilex(); + } + break; + } + + if (ConsoleName) + { + SetConsoleTitle(ConsoleName); + FREE(ConsoleName); + ConsoleName = NULL; + } +} +/*--------------------------------------------------------------------------*/ +int GetConsoleState(void) +{ + return Windows_Console_State; +} +/*--------------------------------------------------------------------------*/ +void SetConsoleState(int state) +{ + Windows_Console_State = state; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/WinConsole.h b/modules/windows_tools/src/c/WinConsole.h new file mode 100755 index 000000000..a3b1c2e57 --- /dev/null +++ b/modules/windows_tools/src/c/WinConsole.h @@ -0,0 +1,51 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __WINCONSOLE_H__ +#define __WINCONSOLE_H__ +/*--------------------------------------------------------------------------*/ +#include "dynlib_windows_tools.h" +/*--------------------------------------------------------------------------*/ +/* Theses functions are used to manipulate console 'dos' added to GUI */ +/* only for windows */ +/*--------------------------------------------------------------------------*/ + +/** +* hide scilex console +*/ +WINDOWS_TOOLS_IMPEXP void HideScilex(void); + +/** +* show scilex console +*/ +WINDOWS_TOOLS_IMPEXP void ShowScilex(void); + +/** +* switch between hide and show +*/ +WINDOWS_TOOLS_IMPEXP void SwitchConsole(void); + +/** +* Get console state +*@return state 0 hide , 1 show +*/ +WINDOWS_TOOLS_IMPEXP int GetConsoleState(void); + +/** +* Set console state +* @param[in] 0 hide , 1 show +*/ +WINDOWS_TOOLS_IMPEXP void SetConsoleState(int state); + +#endif /* __WINCONSOLE_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/core_Import.def b/modules/windows_tools/src/c/core_Import.def new file mode 100755 index 000000000..fdce4e242 --- /dev/null +++ b/modules/windows_tools/src/c/core_Import.def @@ -0,0 +1,24 @@ + LIBRARY core.dll + + +EXPORTS +;core + +callFunctionFromGateway +com_ +putlhsvar_ +intersci_ +createvarfromptr_ +getScilabMode +stack_ +getrhsvar_ +gettype_ +vstk_ +checklhs_ +checkrhs_ +freeArrayOfString +getTMPDIR +createvar_ +getWarningMode +MyHeapAlloc +MyHeapFree diff --git a/modules/windows_tools/src/c/createGUID.c b/modules/windows_tools/src/c/createGUID.c new file mode 100755 index 000000000..3157a73ac --- /dev/null +++ b/modules/windows_tools/src/c/createGUID.c @@ -0,0 +1,32 @@ +/* +* 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 <unknwn.h> +#include "createGUID.h" +#include "strdup_Windows.h" +/*--------------------------------------------------------------------------*/ +#define _OLEAUT32_ +/*--------------------------------------------------------------------------*/ +char *createGUID(void) +{ + GUID guid; + WORD* wstrGUID[100]; + char strGUID[100]; + + CoCreateGuid (&guid); + StringFromCLSID (&guid, wstrGUID); + WideCharToMultiByte (CP_ACP, 0, *wstrGUID, -1, strGUID, MAX_PATH, NULL, NULL); + strGUID[strlen(strGUID) - 1] = '\0'; + return strdup(strGUID + 1); +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/createGUID.h b/modules/windows_tools/src/c/createGUID.h new file mode 100755 index 000000000..8f31bb505 --- /dev/null +++ b/modules/windows_tools/src/c/createGUID.h @@ -0,0 +1,24 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __CREATEGUID_H__ +#define __CREATEGUID_H__ + +/** +* Creates a GUID, a unique 128-bit int used for CLSIDs and interface identifiers. +* @return a string (GUID) +*/ +char *createGUID(void); + +#endif /* __CREATEGUID_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/httpdownloadfile.c b/modules/windows_tools/src/c/httpdownloadfile.c new file mode 100755 index 000000000..d73d62776 --- /dev/null +++ b/modules/windows_tools/src/c/httpdownloadfile.c @@ -0,0 +1,425 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) DIGITEO - 2010 - 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 +* +*/ +/*--------------------------------------------------------------------------*/ +#define _WIN32_WINNT 0x0501 +#define _WIN32_IE 0x0501 +#include <windows.h> +#include <wininet.h> +#include <urlmon.h> +#include "MALLOC.h" +#include "httpdownloadfile.h" +/* http://msdn2.microsoft.com/en-us/library/aa385098.aspx */ +/* http://msdn.microsoft.com/en-us/library/ms775123(VS.85).aspx */ +/*--------------------------------------------------------------------------*/ +#define MO 0x100000 /* Read 1 Mo by 1Mo. */ +#define OPENURL_MODE INTERNET_OPEN_TYPE_PRECONFIG +/*--------------------------------------------------------------------------*/ +static HINSTANCE WinINETDll = NULL; +static HINSTANCE UrlmonDll = NULL; + +typedef HRESULT (WINAPI * URLDownloadToFilePROC)(LPUNKNOWN pCaller, + LPCTSTR szURL, + LPCTSTR szFileName, + DWORD dwReserved, + LPBINDSTATUSCALLBACK lpfnCB); + +static HRESULT dynlib_URLDownloadToFile(LPUNKNOWN pCaller, + LPCTSTR szURL, + LPCTSTR szFileName, + DWORD dwReserved, + LPBINDSTATUSCALLBACK lpfnCB); + +static httpdownloadfile_error_code urlDownloadFile(char * szURL, char * szSaveFilePath); +/*--------------------------------------------------------------------------*/ +typedef HINTERNET (WINAPI * InternetOpenUrlPROC) (HINTERNET hInternet, + LPCTSTR lpszUrl, + LPCTSTR lpszHeaders, + DWORD dwHeadersLength, + DWORD dwFlags, + DWORD_PTR dwContext); + +static HINTERNET dynlib_InternetOpenUrl(HINTERNET hInternet, + LPCTSTR lpszUrl, + LPCTSTR lpszHeaders, + DWORD dwHeadersLength, + DWORD dwFlags, + DWORD_PTR dwContext); +/*--------------------------------------------------------------------------*/ +typedef HINTERNET (WINAPI * InternetOpenPROC) (LPCTSTR lpszAgent, + DWORD dwAccessType, + LPCTSTR lpszProxyName, + LPCTSTR lpszProxyBypass, + DWORD dwFlags); + +static HINTERNET dynlib_InternetOpen(LPCTSTR lpszAgent, + DWORD dwAccessType, + LPCTSTR lpszProxyName, + LPCTSTR lpszProxyBypass, + DWORD dwFlags); +/*--------------------------------------------------------------------------*/ +typedef BOOL (WINAPI * InternetCloseHandlePROC) (HINTERNET hInternet); + +static BOOL dynlib_InternetCloseHandle(HINTERNET hInternet); +/*--------------------------------------------------------------------------*/ +typedef BOOL (WINAPI * HttpQueryInfoPROC) (HINTERNET hRequest, + DWORD dwInfoLevel, + LPVOID lpvBuffer, + LPDWORD lpdwBufferLength, + LPDWORD lpdwIndex); + +static BOOL dynlib_HttpQueryInfo(HINTERNET hRequest, + DWORD dwInfoLevel, + LPVOID lpvBuffer, + LPDWORD lpdwBufferLength, + LPDWORD lpdwIndex); +/*--------------------------------------------------------------------------*/ +typedef BOOL (WINAPI * InternetReadFilePROC) (HINTERNET hFile, + LPVOID lpBuffer, + DWORD dwNumberOfBytesToRead, + LPDWORD lpdwNumberOfBytesRead); + +static BOOL dynlib_InternetReadFile(HINTERNET hFile, + LPVOID lpBuffer, + DWORD dwNumberOfBytesToRead, + LPDWORD lpdwNumberOfBytesRead); +/*--------------------------------------------------------------------------*/ +void httpdownload(char * szURL, char * szSaveFilePath, double *ierr) +{ + *ierr = urlDownloadFile(szURL, szSaveFilePath); + if (*ierr != HTTP_DOWNLOAD_ERROR_OK) + { + // fails to download by standard way + // we try by another method + // last chance ... + *ierr = httpDownloadFile(szURL, szSaveFilePath); + } + + if (WinINETDll) + { + FreeLibrary(WinINETDll); + WinINETDll = NULL; + } + + if (UrlmonDll) + { + FreeLibrary(UrlmonDll); + UrlmonDll = NULL; + } +} +/*--------------------------------------------------------------------------*/ +httpdownloadfile_error_code httpDownloadFile(char * szURL, char * szSaveFilePath) +{ + HINTERNET hiConnex = NULL; + /* * / * : /*rfc 2616 protocole http. all files type accepted*/ + char szHeader[] = "Accept: */*\r\n\r\n"; + HINTERNET hiDownload; + + hiConnex = dynlib_InternetOpen("Scilab_Download", OPENURL_MODE, NULL, NULL, 0); + if (hiConnex == NULL) + { + return HTTP_DOWNLOAD_ERROR_INTERNET_OPEN; + } + + hiDownload = dynlib_InternetOpenUrl(hiConnex, szURL, szHeader, lstrlen(szHeader), INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD | INTERNET_FLAG_PRAGMA_NOCACHE, 0); + if (!hiDownload) + { + dynlib_InternetCloseHandle(hiConnex); + return HTTP_DOWNLOAD_ERROR_OPEN_URL; + } + else + { + DWORD dwStatus = 0; + DWORD dwStatusSize = sizeof(dwStatus); + DWORD dwIndex = 0; + + dynlib_HttpQueryInfo(hiDownload, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &dwStatus, &dwStatusSize, &dwIndex); + + if (dwStatus != HTTP_STATUS_OK) + { + dynlib_InternetCloseHandle(hiConnex); + dynlib_InternetCloseHandle(hiDownload); + return HTTP_DOWNLOAD_ERROR_INVALID_URL; + } + else + { + HANDLE haFile; + + haFile = CreateFile(szSaveFilePath, GENERIC_WRITE, FILE_SHARE_WRITE, 0, CREATE_ALWAYS, 0, 0); + if (haFile == INVALID_HANDLE_VALUE) + { + dynlib_InternetCloseHandle(hiConnex); + return HTTP_DOWNLOAD_ERROR_CREATEFILE; + } + else + { + char *szBuff = NULL; + + DWORD dwBytesRequired = 0; + DWORD dwSizeOfByReq = 4; + DWORD dwBytesRead = 0; + DWORD dwBytesWritten = 0; + + /* Get file size */ + if (!dynlib_HttpQueryInfo(hiDownload, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, (LPVOID)&dwBytesRequired, &dwSizeOfByReq, 0)) + { + dynlib_InternetCloseHandle(hiConnex); + return HTTP_DOWNLOAD_ERROR_INVALID_FILE_SIZE; + } + else + { + if (dwBytesRequired > MO) + { + szBuff = (char*)MALLOC(MO); + if (szBuff == NULL) + { + CloseHandle(haFile); + dynlib_InternetCloseHandle(hiConnex); + return HTTP_DOWNLOAD_OUTOFMEMORY; + } + } + else + { + szBuff = (char*)MALLOC(dwBytesRequired); + if (szBuff == NULL) + { + CloseHandle(haFile); + dynlib_InternetCloseHandle(hiConnex); + return HTTP_DOWNLOAD_OUTOFMEMORY; + } + } + + while (dwBytesRequired > 0) + { + /* we read 1Mo from file. */ + if (dwBytesRequired >= MO) + { + if (!dynlib_InternetReadFile(hiDownload, szBuff, MO, &dwBytesRead) || dwBytesRead != MO) + { + CloseHandle(haFile); + dynlib_InternetCloseHandle(hiConnex); + FREE(szBuff); + return HTTP_DOWNLOAD_ERROR_INTERNET_READFILE; + } + dwBytesRequired -= MO; + + + /* we write buffer */ + if (!WriteFile(haFile, szBuff, MO, &dwBytesWritten, NULL) || dwBytesWritten != MO) + { + CloseHandle(haFile); + dynlib_InternetCloseHandle(hiConnex); + FREE(szBuff); + return HTTP_DOWNLOAD_ERROR_WRITEFILE; + } + } + else + { + if (!dynlib_InternetReadFile(hiDownload, szBuff, dwBytesRequired, &dwBytesRead) || dwBytesRead != dwBytesRequired) + { + CloseHandle(haFile); + dynlib_InternetCloseHandle(hiConnex); + FREE(szBuff); + return HTTP_DOWNLOAD_ERROR_INTERNET_READFILE; + } + + /* we write buffer in a backup file*/ + if (!WriteFile(haFile, szBuff, dwBytesRequired, &dwBytesWritten, NULL) || dwBytesWritten != dwBytesRequired) + { + CloseHandle(haFile); + dynlib_InternetCloseHandle(hiConnex); + FREE(szBuff); + return HTTP_DOWNLOAD_ERROR_WRITEFILE; + } + + dwBytesRequired = 0; + } + } + + dynlib_InternetCloseHandle(hiConnex); + CloseHandle(haFile); + FREE(szBuff); + return HTTP_DOWNLOAD_ERROR_OK; + } + } + } + } +} +/*--------------------------------------------------------------------------*/ +httpdownloadfile_error_code urlDownloadFile(char * szURL, char * szSaveFilePath) +{ + HRESULT hr = dynlib_URLDownloadToFile(NULL, szURL, szSaveFilePath, 0, NULL); + switch (hr) + { + case S_OK: + { + return HTTP_DOWNLOAD_ERROR_OK; + } + break; + + case E_OUTOFMEMORY: + { + return HTTP_DOWNLOAD_OUTOFMEMORY; + } + break; + + case INET_E_DOWNLOAD_FAILURE: + default: + { + return HTTP_DOWNLOAD_FAILURE; + } + break; + } +} +/*--------------------------------------------------------------------------*/ +static HRESULT dynlib_URLDownloadToFile(LPUNKNOWN pCaller, + LPCTSTR szURL, + LPCTSTR szFileName, + DWORD dwReserved, + LPBINDSTATUSCALLBACK lpfnCB) +{ + if (UrlmonDll == NULL) + { + UrlmonDll = LoadLibrary ("urlmon.dll"); + } + if (UrlmonDll) + { + URLDownloadToFilePROC dllURLDownloadToFile = (URLDownloadToFilePROC)GetProcAddress(UrlmonDll, "URLDownloadToFileA"); + if (dllURLDownloadToFile) + { + return (HRESULT)(dllURLDownloadToFile)(pCaller, szURL, szFileName, dwReserved, lpfnCB); + } + } + return S_FALSE; +} +/*--------------------------------------------------------------------------*/ +HINTERNET dynlib_InternetOpenUrl(HINTERNET hInternet, + LPCTSTR lpszUrl, + LPCTSTR lpszHeaders, + DWORD dwHeadersLength, + DWORD dwFlags, + DWORD_PTR dwContext) +{ + if (WinINETDll == NULL) + { + WinINETDll = LoadLibrary ("WININET.dll"); + } + if (WinINETDll) + { + InternetOpenUrlPROC dllInternetOpenUrl = (InternetOpenUrlPROC)GetProcAddress(WinINETDll, "InternetOpenUrlA"); + if (dllInternetOpenUrl) + { + return (HINTERNET)(dllInternetOpenUrl)(hInternet, + lpszUrl, + lpszHeaders, + dwHeadersLength, + dwFlags, + dwContext); + } + } + return NULL; +} +/*--------------------------------------------------------------------------*/ +HINTERNET dynlib_InternetOpen(LPCTSTR lpszAgent, + DWORD dwAccessType, + LPCTSTR lpszProxyName, + LPCTSTR lpszProxyBypass, + DWORD dwFlags) +{ + if (WinINETDll == NULL) + { + WinINETDll = LoadLibrary ("WININET.dll"); + } + if (WinINETDll) + { + InternetOpenPROC dllInternetOpen = (InternetOpenPROC)GetProcAddress(WinINETDll, "InternetOpenA"); + if (dllInternetOpen) + { + return (HINTERNET)(dllInternetOpen)(lpszAgent, + dwAccessType, + lpszProxyName, + lpszProxyBypass, + dwFlags); + } + } + return NULL; +} +/*--------------------------------------------------------------------------*/ +BOOL dynlib_InternetCloseHandle(HINTERNET hInternet) +{ + if (WinINETDll == NULL) + { + WinINETDll = LoadLibrary ("WININET.dll"); + } + if (WinINETDll) + { + InternetCloseHandlePROC dllInternetCloseHandle = (InternetCloseHandlePROC) + GetProcAddress(WinINETDll, "InternetCloseHandle"); + + if (dllInternetCloseHandle) + { + return (BOOL)(dllInternetCloseHandle)(hInternet); + } + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ +BOOL dynlib_HttpQueryInfo(HINTERNET hRequest, + DWORD dwInfoLevel, + LPVOID lpvBuffer, + LPDWORD lpdwBufferLength, + LPDWORD lpdwIndex) +{ + if (WinINETDll == NULL) + { + WinINETDll = LoadLibrary ("WININET.dll"); + } + if (WinINETDll) + { + HttpQueryInfoPROC dllHttpQueryInfo = (HttpQueryInfoPROC) + GetProcAddress(WinINETDll, "HttpQueryInfoA"); + if (dllHttpQueryInfo) + { + return (BOOL)(dllHttpQueryInfo)(hRequest, + dwInfoLevel, + lpvBuffer, + lpdwBufferLength, + lpdwIndex); + } + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ +BOOL dynlib_InternetReadFile(HINTERNET hFile, + LPVOID lpBuffer, + DWORD dwNumberOfBytesToRead, + LPDWORD lpdwNumberOfBytesRead) +{ + if (WinINETDll == NULL) + { + WinINETDll = LoadLibrary ("WININET.dll"); + } + if (WinINETDll) + { + InternetReadFilePROC dllInternetReadFile = (InternetReadFilePROC) + GetProcAddress(WinINETDll, "InternetReadFile"); + if (dllInternetReadFile) + { + return (BOOL)(dllInternetReadFile)(hFile, + lpBuffer, + dwNumberOfBytesToRead, + lpdwNumberOfBytesRead); + } + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/httpdownloadfile.h b/modules/windows_tools/src/c/httpdownloadfile.h new file mode 100755 index 000000000..9f5200c99 --- /dev/null +++ b/modules/windows_tools/src/c/httpdownloadfile.h @@ -0,0 +1,48 @@ +/*--------------------------------------------------------------------------*/ + +/* +* 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 +* +*/ + +#ifndef __HTTPDOWNLOADFILE_H__ +#define __HTTPDOWNLOADFILE_H__ + +#include "dynlib_windows_tools.h" + +typedef enum +{ + HTTP_DOWNLOAD_ERROR_OK = 0, + HTTP_DOWNLOAD_ERROR_INVALID_URL = -1, + HTTP_DOWNLOAD_ERROR_INTERNET_OPEN = -2, + HTTP_DOWNLOAD_ERROR_OPEN_URL = -3, + HTTP_DOWNLOAD_ERROR_CREATEFILE = -4, + HTTP_DOWNLOAD_ERROR_INVALID_FILE_SIZE = -5, + HTTP_DOWNLOAD_ERROR_INTERNET_READFILE = -6, + HTTP_DOWNLOAD_ERROR_WRITEFILE = -7, + HTTP_DOWNLOAD_FAILURE = -8, + HTTP_DOWNLOAD_OUTOFMEMORY = -9 +} httpdownloadfile_error_code; + +/** +* download a file by http (uses wininet library) +* http://msdn2.microsoft.com/en-us/library/aa385473(VS.85).aspx +* example httpDownloadFile("http://www.scilab.org/download/4.1.2/scilab-4.1.2.exe","d:/scilab-4.1.2.exe"); +* @param[in] szURL string url file to download +* @param[in] szSaveFilePath string filename destination +*/ +httpdownloadfile_error_code httpDownloadFile(char * szURL, char * szSaveFilePath); + +/* simplified version for 'call' from scilab */ +WINDOWS_TOOLS_IMPEXP void httpdownload(char * szURL, char * szSaveFilePath, double *ierr); + +#endif /* __HTTPDOWNLOADFILE_H__ */ +/*--------------------------------------------------------------------------*/ + diff --git a/modules/windows_tools/src/c/localization_Import.def b/modules/windows_tools/src/c/localization_Import.def new file mode 100755 index 000000000..a26ff4773 --- /dev/null +++ b/modules/windows_tools/src/c/localization_Import.def @@ -0,0 +1,8 @@ +LIBRARY scilocalization.dll + + +EXPORTS +to_wide_string +wide_string_to_UTF8 +IsValidUTF8 + diff --git a/modules/windows_tools/src/c/registry.c b/modules/windows_tools/src/c/registry.c new file mode 100755 index 000000000..3168c7c58 --- /dev/null +++ b/modules/windows_tools/src/c/registry.c @@ -0,0 +1,286 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) DIGITEO - 2011 - 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 "registry.h" +#include "PATH_MAX.h" +#include "MALLOC.h" +#include "GetWindowsVersion.h" +#include "strdup_windows.h" +/*--------------------------------------------------------------------------*/ +#define MAX_KEY_LENGTH 255 +#define MAX_VALUE_NAME 16383 +/*--------------------------------------------------------------------------*/ + +static BOOL WindowsOpenRegistry(char* _pstRoot, char* _pstKey, HKEY* _pKeyOut) +{ + DWORD OpensKeyOptions = 0; + HKEY hKeyToOpen = NULL; + + hKeyToOpen = GetHkeyrootFromString(_pstRoot); + if (hKeyToOpen == NULL) + { + return FALSE; + } + +#ifdef _WIN64 /* Scilab x64 on x64 windows */ + OpensKeyOptions = KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE | KEY_WOW64_64KEY; + if ( RegOpenKeyEx(hKeyToOpen, _pstKey, 0, OpensKeyOptions, _pKeyOut) != ERROR_SUCCESS) + { + OpensKeyOptions = KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE | KEY_WOW64_32KEY; + if ( RegOpenKeyEx(hKeyToOpen, _pstKey, 0, OpensKeyOptions, _pKeyOut) != ERROR_SUCCESS) + { + return FALSE; + } + } +#else + if (IsWow64()) /* Scilab 32 bits on x64 windows */ + { + OpensKeyOptions = KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE | KEY_WOW64_64KEY; + if ( RegOpenKeyEx(hKeyToOpen, _pstKey, 0, OpensKeyOptions, _pKeyOut) != ERROR_SUCCESS) + { + OpensKeyOptions = KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE | KEY_WOW64_32KEY; + if ( RegOpenKeyEx(hKeyToOpen, _pstKey, 0, OpensKeyOptions, _pKeyOut) != ERROR_SUCCESS) + { + return FALSE; + } + } + } + else /* Scilab 32 bits on windows 32 bits */ + { + OpensKeyOptions = KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE; + if ( RegOpenKeyEx(hKeyToOpen, _pstKey, 0, OpensKeyOptions, _pKeyOut) != ERROR_SUCCESS) + { + return FALSE; + } + } +#endif + return TRUE; +} + +BOOL WindowsQueryRegistry(char *ParamIn1, char *ParamIn2, char *ParamIn3, char *ParamOut1, int *ParamOut2, BOOL *OuputIsREG_SZ) +{ + BOOL bOK = TRUE; + HKEY key; + DWORD type = 0; + + if (WindowsOpenRegistry(ParamIn1, ParamIn2, &key) == FALSE) + { + return FALSE; + } + + if ( RegQueryValueEx(key, ParamIn3, NULL, &type, NULL, NULL) == ERROR_SUCCESS ) + { + if ( (type == REG_EXPAND_SZ) || (type == REG_SZ) ) + { + DWORD Length = PATH_MAX; + char Line[PATH_MAX]; + if (RegQueryValueEx(key, ParamIn3, NULL, &type, (LPBYTE)&Line, &Length) == ERROR_SUCCESS ) + { + wsprintf(ParamOut1, "%s", Line); + *OuputIsREG_SZ = TRUE; + } + } + else + { + DWORD size = 4; + int Num = 0; + if (RegQueryValueEx(key, ParamIn3, NULL, &type, (LPBYTE)&Num, &size) == ERROR_SUCCESS ) + { + *ParamOut2 = Num; + *OuputIsREG_SZ = FALSE; + } + } + } + else + { + bOK = FALSE; + } + + RegCloseKey(key); + + return bOK; +} +/*--------------------------------------------------------------------------*/ +BOOL WindowsQueryRegistryValuesList(char *ParamIn1, char *ParamIn2, int dimMax, char **ListKeys) +{ + HKEY key; + int i = 0; + + if (WindowsOpenRegistry(ParamIn1, ParamIn2, &key) == FALSE) + { + return FALSE; + } + + for (i = 0; i < dimMax; i++) + { + TCHAR achKey[MAX_KEY_LENGTH]; + DWORD cbName = MAX_KEY_LENGTH; + DWORD Type = 0; + DWORD retCode = 0; + + retCode = RegEnumValue(key, i, + achKey, + &cbName, + NULL, + &Type, + NULL, + NULL); + + if (retCode != ERROR_SUCCESS) + { + RegCloseKey(key); + return FALSE; + } + else + { + ListKeys[i] = strdup(achKey); + } + } + + RegCloseKey(key); + + return TRUE; +} + +BOOL WindowsQueryRegistryKeysList(char *ParamIn1, char *ParamIn2, int dimMax, char **ListKeys) +{ + HKEY key; + int i = 0; + + if (WindowsOpenRegistry(ParamIn1, ParamIn2, &key) == FALSE) + { + return FALSE; + } + + for (i = 0; i < dimMax; i++) + { + TCHAR achKey[MAX_KEY_LENGTH]; + DWORD cbName = MAX_KEY_LENGTH; + + LONG Err = RegEnumKey(key, i, achKey, cbName); + if (Err != ERROR_SUCCESS) + { + RegCloseKey(key); + return FALSE; + } + else + { + ListKeys[i] = strdup(achKey); + } + } + + RegCloseKey(key); + + return TRUE; +} +/*--------------------------------------------------------------------------*/ +HKEY GetHkeyrootFromString(char *string) +{ + if ( strcmp(string, "HKEY_CLASSES_ROOT") == 0 || strcmp(string, "HKCR") == 0) + { + return HKEY_CLASSES_ROOT; + } + + if ( strcmp(string, "HKEY_CURRENT_USER") == 0 || strcmp(string, "HKCU") == 0 ) + { + return HKEY_CURRENT_USER; + } + + if ( strcmp(string, "HKEY_LOCAL_MACHINE") == 0 || strcmp(string, "HKLM") == 0 ) + { + return HKEY_LOCAL_MACHINE; + } + + if ( strcmp(string, "HKEY_USERS") == 0 || strcmp(string, "HKU") == 0 ) + { + return HKEY_USERS; + } + + if ( strcmp(string, "HKEY_DYN_DATA") == 0 || strcmp(string, "HKDD") == 0 ) + { + return HKEY_DYN_DATA; + } + + if ( strcmp(string, "HKEY_CURRENT_CONFIG") == 0 || strcmp(string, "HKCC") == 0 ) + { + return HKEY_CURRENT_CONFIG; + } + + return NULL; +} +/*--------------------------------------------------------------------------*/ +static BOOL WindowsQueryRegistryNumberOfItemsInList(char *ParamIn1, char *ParamIn2, int* _piKeyNumber, int* _piValueNumber) +{ + BOOL bOK = TRUE; + + HKEY key; + DWORD retCode = 0; + + TCHAR achClass[PATH_MAX] = TEXT(""); // buffer for class name + DWORD cchClassName = PATH_MAX; // size of class string + DWORD cSubKeys = 0; // number of subkeys + DWORD cbMaxSubKey = 0; // longest subkey size + DWORD cchMaxClass = 0; // longest class string + DWORD cValues = 0; // number of values for key + DWORD cchMaxValue = 0; // longest value name + DWORD cbMaxValueData = 0; // longest value data + DWORD cbSecurityDescriptor = 0; // size of security descriptor + FILETIME ftLastWriteTime; // last write time + + if (WindowsOpenRegistry(ParamIn1, ParamIn2, &key) == FALSE) + { + return FALSE; + } + + retCode = RegQueryInfoKey( + key, // key handle + achClass, // buffer for class name + &cchClassName, // size of class string + NULL, // reserved + &cSubKeys, // number of subkeys + &cbMaxSubKey, // longest subkey size + &cchMaxClass, // longest class string + &cValues, // number of values for this key + &cchMaxValue, // longest value name + &cbMaxValueData, // longest value data + &cbSecurityDescriptor, // security descriptor + &ftLastWriteTime); // last write time + + if (retCode != ERROR_SUCCESS) + { + bOK = FALSE; + } + else + { + *_piValueNumber = cValues; + *_piKeyNumber = cSubKeys; + } + + RegCloseKey(key); + + return bOK; +} +/*--------------------------------------------------------------------------*/ +BOOL WindowsQueryRegistryNumberOfValuesInList(char *ParamIn1, char *ParamIn2, int *Number) +{ + int iKey = 0; + return WindowsQueryRegistryNumberOfItemsInList(ParamIn1, ParamIn2, &iKey, Number); +} +/*--------------------------------------------------------------------------*/ +BOOL WindowsQueryRegistryNumberOfKeysInList(char *ParamIn1, char *ParamIn2, int *Number) +{ + int iValue = 0; + return WindowsQueryRegistryNumberOfItemsInList(ParamIn1, ParamIn2, Number, &iValue); +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/registry.h b/modules/windows_tools/src/c/registry.h new file mode 100755 index 000000000..e688e44f1 --- /dev/null +++ b/modules/windows_tools/src/c/registry.h @@ -0,0 +1,86 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __REGISTY_H__ +#define __REGISTY_H__ + +#include <Windows.h> +#include "BOOL.h" /* BOOL */ + +/** +* WindowsQueryRegistry +* Query a value in a registry key +* @param[in] ParamIn1 (HKEY) +* @param[in] ParamIn2 (SUBKEY) +* @param[in] ParamIn3 (value name) +* @param[out] ParamOut1 (value REG_SZ format) +* @param[out] ParamOut2 (value int) +* @param[out] OuputIsREG_SZ +* @return TRUE or FALSE +*/ +BOOL WindowsQueryRegistry(char *ParamIn1, char *ParamIn2, char *ParamIn3, char *ParamOut1, int *ParamOut2, BOOL *OuputIsREG_SZ); + +/** +* WindowsQueryRegistryValuesList +* Query a list of values in a registry key +* @param[in] ParamIn1 (HKEY) +* @param[in] ParamIn2 (SUBKEY) +* @param[in] dimMax +* @param[out] ListKeys (values) +* @return TRUE or FALSE +*/ +BOOL WindowsQueryRegistryValuesList(char *ParamIn1, char *ParamIn2, int dimMax, char **ListKeys); + +/** +* WindowsQueryRegistryKeysList +* Query a list of values in a registry key +* @param[in] ParamIn1 (HKEY) +* @param[in] ParamIn2 (SUBKEY) +* @param[in] dimMax +* @param[out] ListKeys (values) +* @return TRUE or FALSE +*/ +BOOL WindowsQueryRegistryKeysList(char *ParamIn1, char *ParamIn2, int dimMax, char **ListKeys); + + +/** +* WindowsQueryRegistryNumberOfElementsInList +* get numbers of elements in a list +* @param[in] ParamIn1 (HKEY) +* @param[in] ParamIn2 (SUBKEY) +* @param[out] Number +* @return TRUE or FALSE +*/ +BOOL WindowsQueryRegistryNumberOfValuesInList(char *ParamIn1, char *ParamIn2, int *Number); + +/** +* WindowsQueryRegistryNumberOfKeysInList +* get numbers of Key in a list +* @param[in] ParamIn1 (HKEY) +* @param[in] ParamIn2 (SUBKEY) +* @param[out] Number +* @return TRUE or FALSE +*/ +BOOL WindowsQueryRegistryNumberOfKeysInList(char *ParamIn1, char *ParamIn2, int *Number); + +/** +* GetHkeyrootFromString +* convert string value to HKEY +* @param[in] string example "HKEY_CLASSES_ROOT" +* @return HKEY +*/ +HKEY GetHkeyrootFromString(char *string); + + +#endif /* __REGISTY_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/resource.h b/modules/windows_tools/src/c/resource.h new file mode 100755 index 000000000..0695c9521 --- /dev/null +++ b/modules/windows_tools/src/c/resource.h @@ -0,0 +1,23 @@ +// 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 + +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by windows_tools.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/modules/windows_tools/src/c/resources/bin.ico b/modules/windows_tools/src/c/resources/bin.ico Binary files differnew file mode 100755 index 000000000..275ce25b0 --- /dev/null +++ b/modules/windows_tools/src/c/resources/bin.ico diff --git a/modules/windows_tools/src/c/resources/cos.ico b/modules/windows_tools/src/c/resources/cos.ico Binary files differnew file mode 100755 index 000000000..1f00acf02 --- /dev/null +++ b/modules/windows_tools/src/c/resources/cos.ico diff --git a/modules/windows_tools/src/c/resources/cosf.ico b/modules/windows_tools/src/c/resources/cosf.ico Binary files differnew file mode 100755 index 000000000..169b3da4e --- /dev/null +++ b/modules/windows_tools/src/c/resources/cosf.ico diff --git a/modules/windows_tools/src/c/resources/dem.ico b/modules/windows_tools/src/c/resources/dem.ico Binary files differnew file mode 100755 index 000000000..7758a16d5 --- /dev/null +++ b/modules/windows_tools/src/c/resources/dem.ico diff --git a/modules/windows_tools/src/c/resources/graph.ico b/modules/windows_tools/src/c/resources/graph.ico Binary files differnew file mode 100755 index 000000000..7e5d9d841 --- /dev/null +++ b/modules/windows_tools/src/c/resources/graph.ico diff --git a/modules/windows_tools/src/c/resources/sav.ico b/modules/windows_tools/src/c/resources/sav.ico Binary files differnew file mode 100755 index 000000000..400610377 --- /dev/null +++ b/modules/windows_tools/src/c/resources/sav.ico diff --git a/modules/windows_tools/src/c/resources/sce.ico b/modules/windows_tools/src/c/resources/sce.ico Binary files differnew file mode 100755 index 000000000..e07eb8d4d --- /dev/null +++ b/modules/windows_tools/src/c/resources/sce.ico diff --git a/modules/windows_tools/src/c/resources/sci.ico b/modules/windows_tools/src/c/resources/sci.ico Binary files differnew file mode 100755 index 000000000..1472d23fe --- /dev/null +++ b/modules/windows_tools/src/c/resources/sci.ico diff --git a/modules/windows_tools/src/c/resources/scilab.ico b/modules/windows_tools/src/c/resources/scilab.ico Binary files differnew file mode 100755 index 000000000..eb34764a4 --- /dev/null +++ b/modules/windows_tools/src/c/resources/scilab.ico diff --git a/modules/windows_tools/src/c/resources/scilab_splashscreen.bmp b/modules/windows_tools/src/c/resources/scilab_splashscreen.bmp Binary files differnew file mode 100755 index 000000000..90ccae9a4 --- /dev/null +++ b/modules/windows_tools/src/c/resources/scilab_splashscreen.bmp diff --git a/modules/windows_tools/src/c/resources/sod.ico b/modules/windows_tools/src/c/resources/sod.ico Binary files differnew file mode 100755 index 000000000..9e1d91b3c --- /dev/null +++ b/modules/windows_tools/src/c/resources/sod.ico diff --git a/modules/windows_tools/src/c/resources/tst.ico b/modules/windows_tools/src/c/resources/tst.ico Binary files differnew file mode 100755 index 000000000..3fe07becc --- /dev/null +++ b/modules/windows_tools/src/c/resources/tst.ico diff --git a/modules/windows_tools/src/c/resources/xcos.ico b/modules/windows_tools/src/c/resources/xcos.ico Binary files differnew file mode 100755 index 000000000..f6e7f8d28 --- /dev/null +++ b/modules/windows_tools/src/c/resources/xcos.ico diff --git a/modules/windows_tools/src/c/resources/zcos.ico b/modules/windows_tools/src/c/resources/zcos.ico Binary files differnew file mode 100755 index 000000000..13947e6eb --- /dev/null +++ b/modules/windows_tools/src/c/resources/zcos.ico diff --git a/modules/windows_tools/src/c/scilab_windows/ConvertSlash.c b/modules/windows_tools/src/c/scilab_windows/ConvertSlash.c new file mode 100755 index 000000000..c1c514564 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/ConvertSlash.c @@ -0,0 +1,69 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 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.1-en.txt + * + */ +/*--------------------------------------------------------------------------*/ +#include <string.h> +#include "BOOL.h" +#include "dynlib_scilab_windows.h" +/*--------------------------------------------------------------------------*/ +#define UNIX_SEPATATOR '/' +#define WINDOWS_SEPATATOR '\\' +/*--------------------------------------------------------------------------*/ +static BOOL convertSlash(char *path_in, char *path_out, BOOL slashToAntislash); +/*--------------------------------------------------------------------------*/ +SCILAB_WINDOWS_IMPEXP BOOL slashToAntislash(char *pathunix, char *pathwindows) +{ + return convertSlash(pathunix, pathwindows, TRUE); +} +/*--------------------------------------------------------------------------*/ +SCILAB_WINDOWS_IMPEXP BOOL AntislashToSlash(char *pathwindows, char *pathunix) +{ + return convertSlash(pathwindows, pathunix, FALSE); +} +/*--------------------------------------------------------------------------*/ +static BOOL convertSlash(char *path_in, char *path_out, BOOL slashToAntislash) +{ + BOOL bOK = FALSE; + if ( (path_in) && (path_out) ) + { + int i = 0; + int len_path_out = 0; + strcpy(path_out, path_in); + len_path_out = (int)strlen(path_out); + + for (i = 0; i < len_path_out; i++) + { + if ( slashToAntislash ) + { + if (path_in[i] == UNIX_SEPATATOR) + { + path_out[i] = WINDOWS_SEPATATOR; + bOK = TRUE; + } + } + else + { + if (path_in[i] == WINDOWS_SEPATATOR) + { + path_out[i] = UNIX_SEPATATOR; + bOK = TRUE; + } + } + } + } + else + { + return FALSE; + } + + return bOK; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/DllmainScilab_Windows.c b/modules/windows_tools/src/c/scilab_windows/DllmainScilab_Windows.c new file mode 100755 index 000000000..422524069 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/DllmainScilab_Windows.c @@ -0,0 +1,34 @@ +/* +* 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 <windows.h> +/*--------------------------------------------------------------------------*/ +#pragma comment(lib,"../../../../../bin/libintl.lib") +/*--------------------------------------------------------------------------*/ +int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + break; + case DLL_PROCESS_DETACH: + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + } + return 1; +} +/*--------------------------------------------------------------------------*/ + diff --git a/modules/windows_tools/src/c/scilab_windows/FilesAssociations.c b/modules/windows_tools/src/c/scilab_windows/FilesAssociations.c new file mode 100755 index 000000000..e903fd536 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/FilesAssociations.c @@ -0,0 +1,332 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) DIGITEO - 2009-2010 - 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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#include "TextToPrint.h" +#include <windows.h> +#include <Winuser.h> +#include <shlwapi.h> +#include "version.h" +#include "FilesAssociations.h" +#include "MALLOC.h" +#include "FindScilab.h" +#include "wmcopydata.h" +#include "strdup_windows.h" +#include "MutexClosingScilab.h" +#include "with_module.h" +#include "FileExist.h" +#include "getshortpathname.h" +/*--------------------------------------------------------------------------*/ +static void ReplaceSlash(char *pathout, char *pathin); +static void ExtensionFileIntoLowerCase(char *fichier); +static BOOL isGoodExtension(char *chainefichier, char *ext); +static BOOL IsAScicosFileCOS(char *chainefichier); +static BOOL IsAScicosFileCOSF(char *chainefichier); +static BOOL IsAScicosFileXCOS(char *chainefichier); +static BOOL IsAScicosFileZCOS(char *chainefichier); +static BOOL IsASciNotesFileSCE(char *chainefichier); +static BOOL IsASciNotesFileSCI(char *chainefichier); +static BOOL IsASciNotesFileTST(char *chainefichier); +/*--------------------------------------------------------------------------*/ +#define MSG_SCIMSG1 "%s -e load(getlongpathname('%s'));disp(getlongpathname('%s')+ascii(32)+'loaded');" +#define MSG_SCIMSG2_XCOS "%s -e xcos(getlongpathname('%s'));" +#define MSG_SCIMSG3_XCOS "execstr('xcos(getlongpathname(''%s''));','errcatch');" +#define MSG_SCIMSG4 "%s -e exec(getlongpathname('%s'));" +#define MSG_SCIMSG5_EDITOR "%s -e editor(getlongpathname('%s'));" +/* we try to launch scilab editor */ +#define MSG_SCIMSG6_EDITOR "execstr('editor(getlongpathname(''%s''));','errcatch');" +#define MSG_SCIMSG7 "Scilab Communication" +/*--------------------------------------------------------------------------*/ +/* Teste si le fichier a une extension .sav ou .bin*/ +/* retourne TRUE si c'est le cas sinon FALSE */ +BOOL IsABinOrSavFile(char *chainefichier) +{ + if (isGoodExtension(chainefichier, ".BIN") || isGoodExtension(chainefichier, ".SAV") + || isGoodExtension(chainefichier, ".SOD")) + { + return TRUE; + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ +BOOL IsAScicosFile(char *chainefichier) +{ + if (IsAScicosFileCOS(chainefichier) || + IsAScicosFileCOSF(chainefichier) || + IsAScicosFileXCOS(chainefichier) || + IsAScicosFileZCOS(chainefichier)) + { + return TRUE; + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ +BOOL IsAScicosFileCOS(char *chainefichier) +{ + return isGoodExtension(chainefichier, ".COS"); +} +/*--------------------------------------------------------------------------*/ +BOOL IsAScicosFileCOSF(char *chainefichier) +{ + return isGoodExtension(chainefichier, ".COSF"); +} +/*--------------------------------------------------------------------------*/ +BOOL IsAScicosFileXCOS(char *chainefichier) +{ + return isGoodExtension(chainefichier, ".XCOS"); +} +/*--------------------------------------------------------------------------*/ +BOOL IsAScicosFileZCOS(char *chainefichier) +{ + return isGoodExtension(chainefichier, ".ZCOS"); +} +/*--------------------------------------------------------------------------*/ +BOOL IsASciNotesFile(char *chainefichier) +{ + if (IsASciNotesFileSCE(chainefichier) || + IsASciNotesFileSCI(chainefichier) || + IsASciNotesFileTST(chainefichier)) + { + return TRUE; + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ +BOOL IsASciNotesFileSCE(char *chainefichier) +{ + return isGoodExtension(chainefichier, ".SCE"); +} +/*--------------------------------------------------------------------------*/ +BOOL IsASciNotesFileSCI(char *chainefichier) +{ + return isGoodExtension(chainefichier, ".SCI"); +} +/*--------------------------------------------------------------------------*/ +BOOL IsASciNotesFileTST(char *chainefichier) +{ + return isGoodExtension(chainefichier, ".TST"); +} +/*--------------------------------------------------------------------------*/ +int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd) +{ + int ReturnedValue = 0; + if (FileExist(fichier)) + { + BOOL bConverted = FALSE; + char FinalFileName[(MAX_PATH * 2) + 1]; + char *ShortPath = NULL; + char PathWScilex[(MAX_PATH * 2) + 1]; + + + /* Recuperation du nom du fichier au format 8.3 */ + ShortPath = getshortpathname(fichier, &bConverted); + GetShortPathName(fichier, ShortPath, MAX_PATH); + ReplaceSlash(FinalFileName, ShortPath); + if (ShortPath) + { + FREE(ShortPath); + ShortPath = NULL; + } + + GetModuleFileName ((HINSTANCE)GetModuleHandle(NULL), PathWScilex, MAX_PATH); + ReturnedValue = 1; + + switch (OpenCode) + { + case 0: + default: /* -O Open file with editor */ + { + if (!HaveAnotherWindowScilab() || haveMutexClosingScilab()) + { + if (with_module("scinotes")) + { + wsprintf(Cmd, MSG_SCIMSG5_EDITOR, PathWScilex, FinalFileName); + } + else + { + MessageBox(NULL, "Please install editor module.", "Error", MB_ICONSTOP); + exit(0); + } + } + else + { + char *ScilabDestination = NULL; + + if (with_module("scinotes")) + { + wsprintf(Cmd, MSG_SCIMSG6_EDITOR, FinalFileName); + } + else + { + MessageBox(NULL, "Please install editor module.", "Error", MB_ICONSTOP); + exit(0); + } + + ScilabDestination = getLastScilabFound(); + if (ScilabDestination) + { + SendCommandToAnotherScilab(MSG_SCIMSG7, ScilabDestination, Cmd); + FREE(ScilabDestination); + exit(0); + } + else + { + if (with_module("scinotes")) + { + wsprintf(Cmd, MSG_SCIMSG5_EDITOR, PathWScilex, FinalFileName); + } + else + { + MessageBox(NULL, "Please install editor module.", "Error", MB_ICONSTOP); + exit(0); + } + } + } + } + break; + + case 1: /* -X eXecute file */ + { + if (IsABinOrSavFile(FinalFileName) == TRUE) + { + /* C'est un fichier .BIN ou .SAV d'ou load */ + wsprintf(Cmd, MSG_SCIMSG1, PathWScilex, FinalFileName, FinalFileName); + } + else + { + if (IsAScicosFile(fichier) == TRUE) + { + ExtensionFileIntoLowerCase(FinalFileName); + if (!HaveAnotherWindowScilab() || haveMutexClosingScilab()) + { + if (with_module("xcos")) + { + wsprintf(Cmd, MSG_SCIMSG2_XCOS, PathWScilex, FinalFileName); + } + else + { + MessageBox(NULL, "Please install xcos module.", "Error", MB_ICONSTOP); + exit(0); + } + } + else + { + char *ScilabDestination = NULL; + + if (with_module("xcos")) + { + wsprintf(Cmd, MSG_SCIMSG3_XCOS, FinalFileName); + } + else + { + MessageBox(NULL, "Please install xcos module.", "Error", MB_ICONSTOP); + exit(0); + } + + ScilabDestination = getLastScilabFound(); + if (ScilabDestination) + { + SendCommandToAnotherScilab(MSG_SCIMSG7, ScilabDestination, Cmd); + FREE(ScilabDestination); + exit(0); + } + else + { + if (with_module("xcos")) + { + wsprintf(Cmd, MSG_SCIMSG2_XCOS, PathWScilex, FinalFileName); + } + else + { + MessageBox(NULL, "Please install xcos module.", "Error", MB_ICONSTOP); + exit(0); + } + } + } + } + else + { + wsprintf(Cmd, MSG_SCIMSG4, PathWScilex, FinalFileName); + } + } + } + break; + + case 2: /* -P Print file */ + { + PrintFile(fichier); + strcpy(Cmd, " "); + exit(0); + } + break; + } + } + return ReturnedValue; +} +/*--------------------------------------------------------------------------*/ +static void ExtensionFileIntoLowerCase(char *fichier) +{ + char *tmpfile = NULL; + char *buffer = NULL; + char *lastdot = NULL; + char *ext = NULL; + + tmpfile = strdup(fichier); + buffer = strtok(tmpfile, "."); + while (buffer = strtok(NULL, ".")) + { + lastdot = buffer; + } + /* le dernier . permet d'avoir l'extension */ + ext = _strlwr(lastdot); /* Fichier en Majuscule */ + + strcpy(&fichier[strlen(fichier) - strlen(ext)], ext); + + FREE(tmpfile); +} +/*--------------------------------------------------------------------------*/ +static void ReplaceSlash(char *pathout, char *pathin) +{ + int i = 0; + int len_pathin = (int)strlen(pathin); + for (i = 0; i < len_pathin; i++) + { + if (pathin[i] == '\\') + { + pathout[i] = '/'; + } + else + { + pathout[i] = pathin[i]; + } + } + pathout[i] = '\0'; +} +/*--------------------------------------------------------------------------*/ +static BOOL isGoodExtension(char *chainefichier, char *ext) +{ + char *ExtensionFilename = PathFindExtension(chainefichier); + if (ExtensionFilename) + { + if (_stricmp(ExtensionFilename, ext) == 0) + { + return TRUE; + } + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/FilesAssociations.h b/modules/windows_tools/src/c/scilab_windows/FilesAssociations.h new file mode 100755 index 000000000..9423f70ef --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/FilesAssociations.h @@ -0,0 +1,51 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __FILEASSOCIATION_H__ +#define __FILEASSOCIATION_H__ + +#include "dynlib_scilab_windows.h" +#include "BOOL.h" /* BOOL */ +/*--------------------------------------------------------------------------*/ +/** +* check if it is a .bin or .sav +* @param[in] +* @return TRUE or FALSE +*/ +SCILAB_WINDOWS_IMPEXP BOOL IsABinOrSavFile(char *chainefichier); + +/** +* check if it is a scicos file +* @param[in] +* @return TRUE or FALSE +*/ +SCILAB_WINDOWS_IMPEXP BOOL IsAScicosFile(char *chainefichier); + +/** +* check if it is a SciNotes file +* @param[in] +* @return TRUE or FALSE +*/ +SCILAB_WINDOWS_IMPEXP BOOL IsASciNotesFile(char *chainefichier); + +/** +* get command to do by file extension +* @param[in] +* @param[in] +* @param[out] +* @return TRUE or FALSE +*/ +SCILAB_WINDOWS_IMPEXP int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd); + +#endif /* __FILEASSOCIATION_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/FindScilab.c b/modules/windows_tools/src/c/scilab_windows/FindScilab.c new file mode 100755 index 000000000..af070be0d --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/FindScilab.c @@ -0,0 +1,75 @@ +/* +* 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 <windows.h> +#include <string.h> +#include "FindScilab.h" +#include "version.h" +#include "MALLOC.h" +#include "WndThread.h" +#include "strdup_windows.h" +/*--------------------------------------------------------------------------*/ +#define LineMax 255 +#define NumberScilabMax 10 +/*--------------------------------------------------------------------------*/ +static char BeginningHiddenScilabWindow[LineMax]; +static char ListScilabName[NumberScilabMax][LineMax]; +static char ListHiddenScilabName[NumberScilabMax][LineMax]; +static int NumberScilab = 0; +static BOOL MoreMaxNumberScilabMax = FALSE; +/*--------------------------------------------------------------------------*/ +BOOL HaveAnotherWindowScilab(void) +{ + BOOL Retour = FALSE; + HWND CurrenthWnd = NULL; + + wsprintf(BeginningHiddenScilabWindow, FORMAT_TITLE_HIDDEN_WINDOWS, SCI_VERSION_STRING, 0); + /* scilab-5.0 hidden window */ + BeginningHiddenScilabWindow[strlen(BeginningHiddenScilabWindow) - 4] = '\0'; + + CurrenthWnd = GetWindow(GetDesktopWindow(), GW_CHILD); + CurrenthWnd = GetWindow(CurrenthWnd, GW_HWNDFIRST); + + while ( CurrenthWnd != NULL ) + { + char Title[LineMax]; + + GetWindowText(CurrenthWnd, Title, (int)strlen(BeginningHiddenScilabWindow) + 1); + if (strcmp(Title, BeginningHiddenScilabWindow) == 0) + { + GetWindowText(CurrenthWnd, Title, LineMax); + if (NumberScilab < NumberScilabMax) + { + wsprintf(ListHiddenScilabName[NumberScilab], "%s", Title); + } + else + { + MoreMaxNumberScilabMax = TRUE; + } + NumberScilab++; + Retour = TRUE; + } + CurrenthWnd = GetWindow(CurrenthWnd, GW_HWNDNEXT); + } + return Retour; +} +/*--------------------------------------------------------------------------*/ +char * getLastScilabFound(void) +{ + return strdup(ListHiddenScilabName[0]); +} +/*--------------------------------------------------------------------------*/ +char * getFirstScilabFound(void) +{ + return strdup(ListHiddenScilabName[NumberScilab - 1]); +} +/*--------------------------------------------------------------------------*/
\ No newline at end of file diff --git a/modules/windows_tools/src/c/scilab_windows/FindScilab.h b/modules/windows_tools/src/c/scilab_windows/FindScilab.h new file mode 100755 index 000000000..f66a85354 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/FindScilab.h @@ -0,0 +1,39 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __FINDSCILAB_H__ +#define __FINDSCILAB_H__ + +#include "dynlib_scilab_windows.h" +#include "BOOL.h" /* BOOL */ + +/** +* Check if exists another scilab window +* @return TRUE or FALSE +*/ +SCILAB_WINDOWS_IMPEXP BOOL HaveAnotherWindowScilab(void); + +/** +* returns name of the first Scilab found +* @return name +*/ +SCILAB_WINDOWS_IMPEXP char * getFirstScilabFound(void); + +/** +* returns name of the last Scilab found +* @return name +*/ +SCILAB_WINDOWS_IMPEXP char * getLastScilabFound(void); + +#endif /*__FINDSCILAB_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/FocusOnConsole.c b/modules/windows_tools/src/c/scilab_windows/FocusOnConsole.c new file mode 100755 index 000000000..d1d5b6c95 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/FocusOnConsole.c @@ -0,0 +1,30 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2008 - 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 <windows.h> +#include "dynlib_scilab_windows.h" +#include "scilabmode.h" +/*--------------------------------------------------------------------------*/ +SCILAB_WINDOWS_IMPEXP void setFocusOnConsole(void) +{ + if ( (getScilabMode() == SCILAB_NW) || (getScilabMode() == SCILAB_NWNI) ) + { + HWND hWndConsole = GetConsoleWindow(); + if (hWndConsole) + { + SetForegroundWindow(hWndConsole); + SetActiveWindow(hWndConsole); + } + } +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/Gui_Import.def b/modules/windows_tools/src/c/scilab_windows/Gui_Import.def new file mode 100755 index 000000000..6b4b324f5 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/Gui_Import.def @@ -0,0 +1,9 @@ +LIBRARY scigui.dll + + +EXPORTS +; +normalMainWindow +maximizeMainWindow +iconifyMainWindow +setVisibleMainWindow diff --git a/modules/windows_tools/src/c/scilab_windows/InnosetupMutex.c b/modules/windows_tools/src/c/scilab_windows/InnosetupMutex.c new file mode 100755 index 000000000..98fa2cff8 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/InnosetupMutex.c @@ -0,0 +1,45 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - 2008 - Allan CORNET +* Copyright (C) DIGITEO - 2012 - 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 <windows.h> +#include "InnosetupMutex.h" +#include "BOOL.h" +#include "version.h" +/*--------------------------------------------------------------------------*/ +static HANDLE hMutexScilabID; +/*--------------------------------------------------------------------------*/ +void createInnosetupMutex(void) +{ + /* http://www.vincenzo.net/isxkb/index.php?title=Application_considerations */ + /* creates a named mutex used by Innosetup */ + hMutexScilabID = CreateMutex (NULL, FALSE, SCI_VERSION_STRING ); +} +/*--------------------------------------------------------------------------*/ +void closeInnosetupMutex(void) +{ + /* close named mutex */ + CloseHandle(hMutexScilabID); +} +/*--------------------------------------------------------------------------*/ +BOOL haveInnosetupMutex(void) +{ + HANDLE hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, SCI_VERSION_STRING); + if (hMutex) + { + CloseHandle(hMutex); + return TRUE; + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/InnosetupMutex.h b/modules/windows_tools/src/c/scilab_windows/InnosetupMutex.h new file mode 100755 index 000000000..3b44be703 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/InnosetupMutex.h @@ -0,0 +1,38 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - 2008 - 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __INNOSETUPMUTEX_H__ +#define __INNOSETUPMUTEX_H__ + +#include "dynlib_scilab_windows.h" + +/*--------------------------------------------------------------------------*/ +/** +* Create a named Mutex used by Innosetup +* http://www.vincenzo.net/isxkb/index.php?title=Application_considerations +*/ +SCILAB_WINDOWS_IMPEXP void createInnosetupMutex(void); + +/** +* Close named Mutex used by Innosetup +*/ +SCILAB_WINDOWS_IMPEXP void closeInnosetupMutex(void); + +/** +* Check if named Mutex used by Innosetup exists +*/ +SCILAB_WINDOWS_IMPEXP BOOL haveInnosetupMutex(void); + +/*--------------------------------------------------------------------------*/ + +#endif /* __INNOSETUPMUTEX_H__ */ diff --git a/modules/windows_tools/src/c/scilab_windows/Localization_Import.def b/modules/windows_tools/src/c/scilab_windows/Localization_Import.def new file mode 100755 index 000000000..d4654096e --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/Localization_Import.def @@ -0,0 +1,10 @@ +LIBRARY scilocalization.dll + + +EXPORTS +; +wide_string_to_UTF8 +to_wide_string +setLanguageFromCommandLine +IsValidUTF8 + diff --git a/modules/windows_tools/src/c/scilab_windows/MutexClosingScilab.c b/modules/windows_tools/src/c/scilab_windows/MutexClosingScilab.c new file mode 100755 index 000000000..9fa9ecf77 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/MutexClosingScilab.c @@ -0,0 +1,77 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2008 - 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 <windows.h> +#include "MALLOC.h" +#include "MutexClosingScilab.h" +#include "version.h" +/*--------------------------------------------------------------------------*/ +static HANDLE hMutexClosingScilabID = NULL; +/*--------------------------------------------------------------------------*/ +static char *getClosingScilabMutexName(void); +/*--------------------------------------------------------------------------*/ +void createMutexClosingScilab(void) +{ + char *mutexname = getClosingScilabMutexName(); + if (mutexname) + { + HANDLE hMutex = NULL; + hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, mutexname); + /* checks if a previous Mutex exists */ + if (!hMutex) + { + hMutexClosingScilabID = CreateMutex (NULL, FALSE, mutexname); + } + FREE(mutexname); + mutexname = NULL; + } +} +/*--------------------------------------------------------------------------*/ +void terminateMutexClosingScilab(void) +{ + /* close named mutex */ + if (hMutexClosingScilabID) + { + CloseHandle(hMutexClosingScilabID); + } +} +/*--------------------------------------------------------------------------*/ +BOOL haveMutexClosingScilab(void) +{ + char *mutexname = getClosingScilabMutexName(); + if (mutexname) + { + HANDLE hMutex; + hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, mutexname); + FREE(mutexname); + mutexname = NULL; + if (hMutex) + { + return TRUE; + } + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ +static char *getClosingScilabMutexName(void) +{ + int lenmutexname = (int)(strlen(CLOSING_SCILAB_MUTEX_NAME) + strlen(SCI_VERSION_STRING) + 1); + char *mutexname = (char*)MALLOC(sizeof(char) * lenmutexname); + if (mutexname) + { + strcpy(mutexname, CLOSING_SCILAB_MUTEX_NAME); + strcat(mutexname, SCI_VERSION_STRING); + } + return mutexname; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/SetHeapOptions.c b/modules/windows_tools/src/c/scilab_windows/SetHeapOptions.c new file mode 100755 index 000000000..4e15d000a --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/SetHeapOptions.c @@ -0,0 +1,54 @@ +/* +* 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 <windows.h> +#include "SetHeapOptions.h" +/* http://msdn.microsoft.com/en-us/library/bb430720.aspx */ +/*--------------------------------------------------------------------------*/ +typedef BOOL (WINAPI *HSI) (HANDLE, HEAP_INFORMATION_CLASS , PVOID, SIZE_T); +/*--------------------------------------------------------------------------*/ +BOOL SetHeapOptions(void) +{ +#ifdef _DEBUG + HMODULE hLib = LoadLibrary(TEXT("kernel32.dll")); + if (hLib == NULL) + { + return FALSE; + } + else + { + BOOL fRet = FALSE; + HSI pHsi = (HSI)GetProcAddress(hLib, "HeapSetInformation"); + if (!pHsi) + { + FreeLibrary(hLib); + return FALSE; + } +#ifndef HeapEnableTerminationOnCorruption +#define HeapEnableTerminationOnCorruption (HEAP_INFORMATION_CLASS)1 +#endif + + fRet = (pHsi)(NULL, HeapEnableTerminationOnCorruption, NULL, 0) ? TRUE : FALSE; + + if (hLib) + { + FreeLibrary(hLib); + } + + return fRet; + } +#else + return FALSE; +#endif +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/SetHeapOptions.h b/modules/windows_tools/src/c/scilab_windows/SetHeapOptions.h new file mode 100755 index 000000000..2d3429ae0 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/SetHeapOptions.h @@ -0,0 +1,30 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 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.1-en.txt + * + */ + +/*--------------------------------------------------------------------------*/ +#ifndef __SETHEAPOPTIONS_H__ +#define __SETHEAPOPTIONS_H__ + +#include "dynlib_scilab_windows.h" +#include "BOOL.h" + +/** + * Heap corruption detection is the ability to fail an application if + * the heap manager detects that the application has corrupted the heap. + * Only on Vista and debug mode. + * @return TRUE if it is enabled. + */ + +SCILAB_WINDOWS_IMPEXP BOOL SetHeapOptions(void); + +#endif /* __SETHEAPOPTIONS_H__ */ +/*--------------------------------------------------------------------------*/
\ No newline at end of file diff --git a/modules/windows_tools/src/c/scilab_windows/SetScilabEnvironmentVariables.c b/modules/windows_tools/src/c/scilab_windows/SetScilabEnvironmentVariables.c new file mode 100755 index 000000000..08bd0e6ac --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/SetScilabEnvironmentVariables.c @@ -0,0 +1,266 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) DIGITEO - 2010 - 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 <windows.h> +#include <stdio.h> +#include "SetScilabEnvironmentVariables.h" +#include "PATH_MAX.h" +#include "MALLOC.h" +#include "setgetSCIpath.h" +#include "getScilabDirectory.h" +#include "scilabDefaults.h" +#include "ConvertSlash.h" +#include "charEncoding.h" +#include "getshortpathname.h" +#include "stristr.h" +#include "strsubst.h" +/*--------------------------------------------------------------------------*/ +static BOOL IsTheGoodShell(void); +static BOOL Set_Shell(void); +static BOOL Set_SCI_PATH(char *DefaultPath); +static BOOL Set_HOME_PATH(char *DefaultPath); +static BOOL AddScilabBinDirectoryToPATHEnvironnementVariable(char *DefaultPath); +static BOOL Set_SOME_ENVIRONMENTS_VARIABLES_FOR_SCILAB(void); +/*--------------------------------------------------------------------------*/ +/** +* Set some environment variablesSCI, and some others +*/ +void SciEnvForWindows(void) +{ + char *SCIPathName = getScilabDirectory(TRUE); + + /* Correction Bug 1579 */ + if (!IsTheGoodShell()) + { + if ( (!Set_Shell()) || (!IsTheGoodShell())) + { + MessageBox(NULL, + "Please modify ""ComSpec"" environment variable.\ncmd.exe on W2K and more.", + "Warning", MB_ICONWARNING | MB_OK); + } + } + + SetScilabEnvironmentVariables(SCIPathName); + if (SCIPathName) + { + FREE(SCIPathName); + SCIPathName = NULL; + } +} +/*--------------------------------------------------------------------------*/ +/* set env variables (used when calling scilab from * other programs) */ +void SetScilabEnvironmentVariables(char *DefaultSCIPATH) +{ + if (DefaultSCIPATH) + { + Set_SCI_PATH(DefaultSCIPATH); + Set_HOME_PATH(DefaultSCIPATH); + Set_SOME_ENVIRONMENTS_VARIABLES_FOR_SCILAB(); + AddScilabBinDirectoryToPATHEnvironnementVariable(DefaultSCIPATH); + } + else + { + /* Error */ + exit(1); + } + +} +/*--------------------------------------------------------------------------*/ +BOOL Set_SCI_PATH(char *DefaultPath) +{ + BOOL bOK = FALSE; + char *ShortPath = NULL; + + /* to be sure that it's unix 8.3 format */ + /* c:/progra~1/scilab-5.0 */ + ShortPath = getshortpathname(DefaultPath, &bOK); + if (ShortPath) + { + char env[PATH_MAX + 1 + 10]; + AntislashToSlash(ShortPath, ShortPath); + + sprintf (env, "SCI=%s", ShortPath); + setSCIpath(ShortPath); + + if (ShortPath) + { + FREE(ShortPath); + ShortPath = NULL; + } + + if (_putenv (env)) + { + bOK = FALSE; + } + else + { + bOK = TRUE; + } + } + return bOK; +} +/*--------------------------------------------------------------------------*/ +BOOL Set_HOME_PATH(char *DefaultPath) +{ + wchar_t *wHOME = _wgetenv(L"HOME"); + if (wHOME == NULL) + { + wchar_t *wUserProfile = _wgetenv(L"USERPROFILE"); + if (wUserProfile) + { + return SetEnvironmentVariableW(L"HOME", wUserProfile); + } + else + { + /* if USERPROFILE is not defined , we use default profile */ + wchar_t *wAllUsersProfile = _wgetenv(L"ALLUSERSPROFILE"); + if (wAllUsersProfile) + { + return SetEnvironmentVariableW(L"HOME", wUserProfile); + } + else + { + BOOL bRes = FALSE; + wchar_t *wDefault = to_wide_string(DefaultPath); + if (wDefault) + { + bRes = SetEnvironmentVariableW(L"HOME", wDefault); + FREE(wDefault); + wDefault = NULL; + } + return bRes; + } + } + } + return TRUE; +} +/*--------------------------------------------------------------------------*/ +BOOL Set_SOME_ENVIRONMENTS_VARIABLES_FOR_SCILAB(void) +{ + BOOL bOK = TRUE; + +#ifdef _MSC_VER + _putenv ("COMPILER=VC++"); +#endif + + /* WIN32 variable Environment */ +#ifdef _WIN32 + _putenv ("WIN32=OK"); +#endif + + /* WIN64 variable Environment */ +#ifdef _WIN64 + _putenv ("WIN64=OK"); +#endif + + if ( GetSystemMetrics(SM_REMOTESESSION) ) + { + _putenv ("SCILAB_MSTS_SESSION=OK"); + } + + return bOK; +} +/*--------------------------------------------------------------------------*/ +BOOL IsTheGoodShell(void) +{ + char shellCmd[PATH_MAX]; + char drive[_MAX_DRIVE]; + char dir[_MAX_DIR]; + char fname[_MAX_FNAME]; + char ext[_MAX_EXT]; + + strcpy(shellCmd, ""); + strcpy(fname, ""); + GetEnvironmentVariable("ComSpec", shellCmd, PATH_MAX); + _splitpath(shellCmd, drive, dir, fname, ext); + + if (_stricmp(fname, "cmd") == 0) + { + return TRUE; + } + + return FALSE; +} +/*--------------------------------------------------------------------------*/ +BOOL Set_Shell(void) +{ + BOOL bOK = FALSE; + char env[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 10]; + char *WINDIRPATH = NULL; + + WINDIRPATH = getenv ("SystemRoot"); + sprintf(env, "ComSpec=%s\\system32\\cmd.exe", WINDIRPATH); + + if (_putenv (env)) + { + bOK = FALSE; + } + else + { + bOK = TRUE; + } + + if (WINDIRPATH) + { + FREE(WINDIRPATH); + WINDIRPATH = NULL; + } + return bOK; +} +/*--------------------------------------------------------------------------*/ +static BOOL AddScilabBinDirectoryToPATHEnvironnementVariable(char *DefaultPath) +{ +#define SCILAB_BIN_PATH "%s/bin" +#define NEW_PATH "PATH=%s;%s" + + BOOL bOK = FALSE; + char *PATH = NULL; + char *env = NULL; + char scilabBinPath[MAX_PATH]; + char *scilabBinPathConverted; + + PATH = getenv("PATH"); + + env = (char*) MALLOC(sizeof(char) * (strlen(NEW_PATH) + strlen(PATH) + + strlen(DefaultPath) + 1)); + if (env) + { + sprintf(scilabBinPath, SCILAB_BIN_PATH, DefaultPath); + + scilabBinPathConverted = (char*) MALLOC(MAX_PATH * sizeof(char)); +#ifdef _MSC_VER + scilabBinPathConverted = strsub(scilabBinPath, "/", "\\"); +#else + scilabBinPathConverted = strdup(scilabBinPath); +#endif + if (stristr(PATH, scilabBinPathConverted) == 0) + { + sprintf(env, NEW_PATH, scilabBinPathConverted, PATH); + if (_putenv (env)) + { + bOK = FALSE; + } + else + { + bOK = TRUE; + } + FREE(env); + env = NULL; + } + + FREE(scilabBinPathConverted); + } + return bOK; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/SetScilabEnvironmentVariables.h b/modules/windows_tools/src/c/scilab_windows/SetScilabEnvironmentVariables.h new file mode 100755 index 000000000..439123fc5 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/SetScilabEnvironmentVariables.h @@ -0,0 +1,28 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __SETSCILABENVIRONMENTVARIABLES_H__ +#define __SETSCILABENVIRONMENTVARIABLES_H__ + +#include "dynlib_scilab_windows.h" + +/** +* Set Some environment variables for Scilab (Windows) +* @param[in] default path of scilab +*/ +SCILAB_WINDOWS_IMPEXP void SetScilabEnvironmentVariables(char *DefaultSCIPATH); + +SCILAB_WINDOWS_IMPEXP void SciEnvForWindows(void); + +#endif /* __SETSCILABENVIRONMENTVARIABLES_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/TextToPrint.c b/modules/windows_tools/src/c/scilab_windows/TextToPrint.c new file mode 100755 index 000000000..873cde933 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/TextToPrint.c @@ -0,0 +1,626 @@ +/* +* 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 "TextToPrint.h" +#include "MALLOC.h" +#include "charEncoding.h" +#include "strdup_windows.h" +/*--------------------------------------------------------------------------*/ +static HDC PrinterHDC = NULL; +static char PrinterName[2048]; +static char PrinterOrientation; +/*--------------------------------------------------------------------------*/ +HFONT EzCreateFont (HDC hdc, TCHAR * szFaceName, int iDeciPtHeight, int iDeciPtWidth, int iAttributes, BOOL fLogRes) +{ + FLOAT cxDpi, cyDpi ; + HFONT hFont ; + LOGFONT lf ; + POINT pt ; + TEXTMETRIC tm ; + SaveDC (hdc) ; + SetGraphicsMode (hdc, GM_ADVANCED) ; + ModifyWorldTransform (hdc, NULL, MWT_IDENTITY) ; + SetViewportOrgEx (hdc, 0, 0, NULL) ; + SetWindowOrgEx (hdc, 0, 0, NULL) ; + if (fLogRes) + { + cxDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSX) ; + cyDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSY) ; + } + else + { + cxDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, HORZRES) / + GetDeviceCaps (hdc, HORZSIZE)) ; + cyDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, VERTRES) / + GetDeviceCaps (hdc, VERTSIZE)) ; + } + pt.x = (int) (iDeciPtWidth * cxDpi / 72) ; + pt.y = (int) (iDeciPtHeight * cyDpi / 72) ; + DPtoLP (hdc, &pt, 1) ; + + lf.lfHeight = - (int) (fabs (pt.y) / 10.0 + 0.5) ; + lf.lfWidth = 0 ; + lf.lfEscapement = 0 ; + lf.lfOrientation = 0 ; + lf.lfWeight = iAttributes & EZ_ATTR_BOLD ? 700 : 0 ; + lf.lfItalic = iAttributes & EZ_ATTR_ITALIC ? 1 : 0 ; + lf.lfUnderline = iAttributes & EZ_ATTR_UNDERLINE ? 1 : 0 ; + lf.lfStrikeOut = iAttributes & EZ_ATTR_STRIKEOUT ? 1 : 0 ; + lf.lfCharSet = DEFAULT_CHARSET ; + lf.lfOutPrecision = 0 ; + lf.lfClipPrecision = 0 ; + lf.lfQuality = 0 ; + lf.lfPitchAndFamily = 0 ; + lstrcpy (lf.lfFaceName, szFaceName) ; + hFont = CreateFontIndirect (&lf) ; + if (iDeciPtWidth != 0) + { + hFont = (HFONT) SelectObject (hdc, hFont) ; + GetTextMetrics (hdc, &tm) ; + DeleteObject (SelectObject (hdc, hFont)) ; + lf.lfWidth = (int) (tm.tmAveCharWidth * + fabs (pt.x) / fabs (pt.y) + 0.5) ; + hFont = CreateFontIndirect (&lf) ; + } + RestoreDC (hdc, -1) ; + return hFont ; +} +/*--------------------------------------------------------------------------*/ +void PrintString(char *lines, char *Entete) +{ + HDC PrintDC; + HFONT hFont, hOldFont; + HDC hDCmem; + DOCINFO di; + int TextLength = 0; + int i = 0; + int Index1 = 0; + int Index2 = 3; + int numero = 1; + // Extrait les informations sur la police + TEXTMETRIC tm; + int NbLigneParPage = 0; + int HauteurCaractere = 0; + int NombredeCaracteresparLignes = 0; + + + PrintDC = GetPrinterDC(); + if (PrintDC != NULL) + { + hFont = EzCreateFont (PrintDC, TEXT ("Courier New"), 120, 0, 0, TRUE) ; + + hOldFont = SelectObject(PrintDC, hFont ); + + hDCmem = CreateCompatibleDC(PrintDC); + memset( &di, 0, sizeof( DOCINFO ) ); + di.cbSize = sizeof( DOCINFO ); + di.lpszDocName = "Scilab Document"; + + TextLength = (int)strlen(lines); + + GetTextMetrics(PrintDC, (TEXTMETRIC *)&tm); + + NombredeCaracteresparLignes = GetDeviceCaps(PrintDC, HORZRES) / (tm.tmMaxCharWidth + 1); + // la valeur HauteurCaractere contient hauteur des caractéres + l'interligne + HauteurCaractere = tm.tmHeight + tm.tmExternalLeading; + NbLigneParPage = GetDeviceCaps(PrintDC, VERTRES) / HauteurCaractere; + + if (TextLength > 0) + { + if ( StartDoc( PrintDC, &di ) > 0 ) + { + char *LignePrint = NULL; + LignePrint = (char*)MALLOC((NombredeCaracteresparLignes + 1) * sizeof(char)); + + StartPage(PrintDC); + PageHeader(PrintDC, Entete); + for (i = 0; i < TextLength; i++) + { + LignePrint[Index1] = lines[i]; + if ( Index1 == NombredeCaracteresparLignes ) + { + Index2 ++; + LignePrint[Index1] = '\0'; + if (LignePrint[Index1 - 1] == '\r') + { + LignePrint[Index1 - 1] = '\0'; + } + TextOut (PrintDC, (tm.tmMaxCharWidth + 10), Index2 * HauteurCaractere, LignePrint, (int)strlen(LignePrint)); + Index1 = 0; + if (LignePrint) + { + FREE(LignePrint); + LignePrint = NULL; + } + LignePrint = (char*)MALLOC((NombredeCaracteresparLignes + 1) * sizeof(char)); + } + else if ( (lines[i] == '\n') ) + { + Index2 ++; + if (Index1 > 0) + { + LignePrint[Index1] = '\0'; + if (LignePrint[Index1 - 1] == '\r') + { + LignePrint[Index1 - 1] = '\0'; + } + TextOut (PrintDC, (tm.tmMaxCharWidth + 10), Index2 * HauteurCaractere, LignePrint, (int)strlen(LignePrint)); + Index1 = 0; + } + if (LignePrint) + { + FREE(LignePrint); + LignePrint = NULL; + } + LignePrint = (char*)MALLOC((NombredeCaracteresparLignes + 1) * sizeof(char)); + } + else + { + Index1 ++; + } + if (Index2 == NbLigneParPage - 4) + { + Footer(PrintDC, numero); + EndPage (PrintDC); + StartPage(PrintDC); + numero++; + PageHeader(PrintDC, Entete); + Index2 = 3; + } + } + Index2 ++; + LignePrint[Index1] = '\0'; + TextOut (PrintDC, (tm.tmMaxCharWidth + 10), Index2 * HauteurCaractere, LignePrint, (int) strlen(LignePrint)); + Footer(PrintDC, numero); + EndPage (PrintDC); + EndDoc (PrintDC); + + if (LignePrint) + { + FREE(LignePrint); + LignePrint = NULL; + } + } + } + SelectObject(PrintDC, hOldFont ); + } + +} +/*--------------------------------------------------------------------------*/ +void PrintFile(char *filename) +{ +#define MAXBUF 4096 + HDC PrintDC; + HFONT hFont, hOldFont; + HDC hDCmem; + DOCINFO di; + int Index2 = 3; + int numero = 1; + // Extrait les informations sur la police + TEXTMETRIC tm; + int NbLigneParPage = 0; + int HauteurCaractere = 0; + int NombredeCaracteresparLignes = 0; + FILE * pFile; + char line[MAXBUF]; + + PrintDC = GetPrinterDC(); + if (PrintDC != NULL) + { + + hFont = EzCreateFont (PrintDC, TEXT ("Courier New"), 120, 0, 0, TRUE) ; + hOldFont = SelectObject(PrintDC, hFont ); + + hDCmem = CreateCompatibleDC(PrintDC); + memset( &di, 0, sizeof( DOCINFO ) ); + di.cbSize = sizeof( DOCINFO ); + di.lpszDocName = "Scilab Document"; + + GetTextMetrics(PrintDC, (TEXTMETRIC *)&tm); + + NombredeCaracteresparLignes = GetDeviceCaps(PrintDC, HORZRES) / (tm.tmMaxCharWidth + 1); + // la valeur HauteurCaractere contient hauteur des caractéres + l'interligne + HauteurCaractere = tm.tmHeight + tm.tmExternalLeading; + NbLigneParPage = GetDeviceCaps(PrintDC, VERTRES) / HauteurCaractere; + + wcfopen(pFile , filename, "rt"); + + if (pFile) + { + if ( StartDoc( PrintDC, &di ) > 0 ) + { + char *LignePrint = NULL; + StartPage(PrintDC); + PageHeader(PrintDC, filename); + + while (fgets (line, sizeof(line), pFile) != NULL) + { + if (line[strlen(line) - 1] == '\n') + { + line[strlen(line) - 1] = '\0'; /* enleve le retour chariot */ + } + if (line[strlen(line) - 2] == '\r') + { + line[strlen(line) - 2] = '\0'; /* enleve le retour chariot */ + } + + if ( strlen(line) > (unsigned int )NombredeCaracteresparLignes) + { + int i = 0; + int j = 0; + int subline = 0; + int restsubline = 0; + subline = (int)strlen(line) / NombredeCaracteresparLignes ; + restsubline = (int)strlen(line) % NombredeCaracteresparLignes ; + + for (i = 0; i < subline; i++) + { + LignePrint = (char*)MALLOC( (NombredeCaracteresparLignes + 1) * sizeof(char)); + for (j = 0; j < (NombredeCaracteresparLignes); j++) + { + if (line[(i * NombredeCaracteresparLignes) + j] == 9) /* == \t */ + { + LignePrint[j] = ' '; + } + else + { + LignePrint[j] = line[(i * NombredeCaracteresparLignes) + j]; + } + + } + LignePrint[j] = '\0'; + + TextOut (PrintDC, (tm.tmMaxCharWidth + 10), Index2 * HauteurCaractere, LignePrint, (int)strlen(LignePrint)); + if (LignePrint) + { + FREE(LignePrint); + LignePrint = NULL; + } + Index2 ++; + if (Index2 == NbLigneParPage - 4) + { + Footer(PrintDC, numero); + EndPage (PrintDC); + StartPage(PrintDC); + numero++; + PageHeader(PrintDC, filename); + Index2 = 3; + } + } + if (restsubline > 0) + { + LignePrint = (char*)MALLOC( (NombredeCaracteresparLignes + 1) * sizeof(char)); + for (j = 0; j < (restsubline); j++) + { + if (line[(i * NombredeCaracteresparLignes) + j] == 9) /* == \t */ + { + LignePrint[j] = ' '; + } + else + { + LignePrint[j] = line[(i * NombredeCaracteresparLignes) + j]; + } + } + LignePrint[j] = '\0'; + TextOut (PrintDC, (tm.tmMaxCharWidth + 10), Index2 * HauteurCaractere, LignePrint, (int)strlen(LignePrint)); + if (LignePrint) + { + FREE(LignePrint); + LignePrint = NULL; + } + Index2 ++; + if (Index2 == NbLigneParPage - 4) + { + Footer(PrintDC, numero); + EndPage (PrintDC); + StartPage(PrintDC); + numero++; + PageHeader(PrintDC, filename); + Index2 = 3; + } + } + } + else + { + LignePrint = strdup(line); + TextOut (PrintDC, (tm.tmMaxCharWidth + 10), Index2 * HauteurCaractere, LignePrint, (int)strlen(LignePrint)); + if (LignePrint) + { + FREE(LignePrint); + LignePrint = NULL; + } + Index2 ++; + if (Index2 == NbLigneParPage - 4) + { + Footer(PrintDC, numero); + EndPage (PrintDC); + StartPage(PrintDC); + numero++; + PageHeader(PrintDC, filename); + Index2 = 3; + } + } + } + fclose(pFile); + + Footer(PrintDC, numero); + EndPage (PrintDC); + EndDoc (PrintDC); + } + } + SelectObject(PrintDC, hOldFont ); + } +} +/*--------------------------------------------------------------------------*/ +void Footer(HDC hdc, int number) +{ + HPEN hPen, hPenOld; + LOGBRUSH lb; + int NombredeCaracteresparLignes = 0; + TEXTMETRIC tm; + int yChar = 0; + char *ptrLine = NULL; + + int CySize = GetDeviceCaps(hdc, VERTRES); + // Initialize the pen's brush. + lb.lbStyle = BS_SOLID; + lb.lbColor = RGB(0, 0, 0); + lb.lbHatch = 0; + + GetTextMetrics (hdc, (TEXTMETRIC *) & tm); + NombredeCaracteresparLignes = tm.tmMaxCharWidth + 10; + yChar = tm.tmHeight + tm.tmExternalLeading ; + ptrLine = (char*)MALLOC( (NombredeCaracteresparLignes + 1) * sizeof(char)); + + hPen = ExtCreatePen(PS_SOLID, 1, &lb, 0, NULL); + hPenOld = SelectObject(hdc, hPen); + + MoveToEx(hdc, (tm.tmMaxCharWidth + 10), CySize - (yChar * 3) - 10, NULL); + LineTo(hdc, GetDeviceCaps(hdc, HORZRES) - (tm.tmMaxCharWidth + 10), CySize - (yChar * 3) - 10); + + SelectObject(hdc, hPenOld); + DeleteObject(hPen); + + wsprintf(ptrLine, "Page : %d", number); + TextOut(hdc, (tm.tmMaxCharWidth + 10), CySize - (yChar * 3), ptrLine, (int)strlen(ptrLine)); + FREE(ptrLine); +} +/*--------------------------------------------------------------------------*/ +void PageHeader(HDC hdc, LPSTR Entete) +{ + HPEN hPen, hPenOld; + LOGBRUSH lb; + + TEXTMETRIC tm; + int NbLigneParPage = 0; + int HauteurCaractere = 0; + int NombredeCaracteresparLignes = 0; + int NombredeLignesOccupeesparEntete = 1; + + char dbuffer [9]; + char tbuffer [9]; + char *ptrLine = NULL; + + // Initialize the pen's brush. + lb.lbStyle = BS_SOLID; + lb.lbColor = RGB(0, 0, 0); + lb.lbHatch = 0; + + _strdate( dbuffer ); + _strtime( tbuffer ); + + GetTextMetrics (hdc, (TEXTMETRIC *) & tm); + + NombredeCaracteresparLignes = GetDeviceCaps(hdc, HORZRES) / (tm.tmMaxCharWidth + 10); + // la valeur HauteurCaractere contient hauteur des caractéres + l'interligne + HauteurCaractere = tm.tmHeight + tm.tmExternalLeading; + NbLigneParPage = GetDeviceCaps(hdc, VERTRES) / HauteurCaractere; + + ptrLine = (char*)MALLOC( (NombredeCaracteresparLignes + 1) * sizeof(char)); + wsprintf(ptrLine, "%s %s %s", dbuffer, tbuffer, Entete); + + TextOut(hdc, (tm.tmMaxCharWidth + 10), NombredeLignesOccupeesparEntete * HauteurCaractere, ptrLine, (int)strlen(ptrLine)); + NombredeLignesOccupeesparEntete++; + + hPen = ExtCreatePen(PS_SOLID, 1, &lb, 0, NULL); + hPenOld = SelectObject(hdc, hPen); + + MoveToEx(hdc, (tm.tmMaxCharWidth + 10), NombredeLignesOccupeesparEntete * HauteurCaractere, NULL); + LineTo(hdc, GetDeviceCaps(hdc, HORZRES) - (tm.tmMaxCharWidth + 10), NombredeLignesOccupeesparEntete * HauteurCaractere); + + SelectObject(hdc, hPenOld); + DeleteObject(hPen); + + FREE(ptrLine); + +} +/*--------------------------------------------------------------------------*/ +void CutLineForDisplay(char *CutLine, char *Line, int NumberOfCharByLine) +{ + int LenLine = lstrlen(Line); + + if (LenLine > NumberOfCharByLine) + { + int NumberOfLines = lstrlen(Line) / NumberOfCharByLine; + int i = 0; + char *Buffer = NULL; + + Buffer = (char*)MALLOC((LenLine + NumberOfLines + 1) * sizeof(char)); + for (i = 0; i < NumberOfLines + 1; i++) + { + if ( i == 0) + { + lstrcpyn(Buffer, &Line[i * NumberOfCharByLine], NumberOfCharByLine); + + } + else + { + char BufferCat[MAX_PATH]; + lstrcpyn(BufferCat, &Line[i * NumberOfCharByLine], NumberOfCharByLine); + lstrcat(Buffer, BufferCat); + + } + if (i != NumberOfLines) + { + lstrcat(Buffer, "\n"); + } + } + lstrcpy(CutLine, Buffer); + + FREE(Buffer); + } + else + { + wsprintf(CutLine, "%s", Line); + } +} +/*--------------------------------------------------------------------------*/ +BOOL ConfigurePrinterDialogBox(void) +{ + BOOL bOK = FALSE; + + PRINTDLG pd; + + if (PrinterHDC) + { + DeleteDC(PrinterHDC); + PrinterHDC = NULL; + } + wsprintf(PrinterName, "%s", "EMPTY"); + PrinterOrientation = 'p'; + + memset (&pd, 0, sizeof (PRINTDLG)); + pd.lStructSize = sizeof (PRINTDLG); + pd.hwndOwner = NULL; + pd.hDevMode = NULL; + pd.hDevNames = NULL; + pd.hDC = NULL; + pd.Flags = PD_ALLPAGES | PD_COLLATE | PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE | PD_NOSELECTION | PD_HIDEPRINTTOFILE | PD_NONETWORKBUTTON; + pd.nFromPage = 0; + pd.nToPage = 0; + pd.nMinPage = 0; + pd.nMaxPage = 0; + pd.nCopies = 1; + pd.hInstance = NULL; + pd.lCustData = 0L; + pd.lpfnPrintHook = NULL; + pd.lpfnSetupHook = NULL; + pd.lpPrintTemplateName = NULL; + pd.lpSetupTemplateName = NULL; + pd.hPrintTemplate = NULL; + pd.hSetupTemplate = NULL; + if (PrintDlg (&pd) == FALSE) + { + wsprintf(PrinterName, "%s", "EMPTY"); + PrinterOrientation = 'p'; + PrinterHDC = NULL; + bOK = FALSE; + } + else + { + LPDEVNAMES lpDev = (LPDEVNAMES)GlobalLock(pd.hDevNames); + LPDEVMODE lpDevMode = (LPDEVMODE)GlobalLock(pd.hDevMode); + LPCTSTR lpszDevice = (LPCTSTR)lpDev + lpDev->wDeviceOffset; + + wsprintf(PrinterName, "%s", lpszDevice); + GlobalUnlock(pd.hDevNames); + + if (lpDevMode->dmOrientation == DMORIENT_PORTRAIT ) + { + PrinterOrientation = 'p'; + } + else + { + PrinterOrientation = 'l'; + } + GlobalUnlock(pd.hDevMode); + + if (PrinterHDC) + { + DeleteDC(PrinterHDC); + PrinterHDC = NULL; + } + PrinterHDC = pd.hDC; + bOK = TRUE; + } + + return bOK; +} +/*--------------------------------------------------------------------------*/ +HDC GetPrinterDC(void) +{ + if (PrinterHDC == NULL) + { + PRINTDLG pd; + LPDEVNAMES lpDev = NULL; + LPDEVMODE lpDevMode = NULL; + LPCTSTR lpszDevice = NULL; + + int failed = 0; + + // Reset printdlg struct + memset( &pd, 0, sizeof(PRINTDLG) ); + pd.Flags = PD_RETURNDEFAULT | PD_RETURNDC; + pd.lStructSize = sizeof( PRINTDLG ); + + + failed = ( ! PrintDlg( &pd ) ); + if (failed) + { + ConfigurePrinterDialogBox(); + } + + lpDev = (LPDEVNAMES)GlobalLock(pd.hDevNames); + lpDevMode = (LPDEVMODE)GlobalLock(pd.hDevMode); + lpszDevice = (LPCTSTR)lpDev + lpDev->wDeviceOffset; + + wsprintf(PrinterName, "%s", lpszDevice); + GlobalUnlock(pd.hDevNames); + + if (lpDevMode->dmOrientation == DMORIENT_PORTRAIT ) + { + PrinterOrientation = 'p'; + } + else + { + PrinterOrientation = 'l'; + } + GlobalUnlock(pd.hDevMode); + + if (PrinterHDC) + { + DeleteDC(PrinterHDC); + PrinterHDC = NULL; + } + PrinterHDC = pd.hDC; + + } + + return PrinterHDC; +} +/*--------------------------------------------------------------------------*/ +char GetPrinterOrientation(void) +{ + return PrinterOrientation; +} +/*--------------------------------------------------------------------------*/ +char* GetPrinterName(void) +{ + char *ReturnPrinterName = NULL; + + ReturnPrinterName = MALLOC(strlen(PrinterName) * sizeof(char)); + wsprintf(ReturnPrinterName, "%s", PrinterName); + + return ReturnPrinterName; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/TextToPrint.h b/modules/windows_tools/src/c/scilab_windows/TextToPrint.h new file mode 100755 index 000000000..bed255d57 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/TextToPrint.h @@ -0,0 +1,45 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __TEXTTOPRINT__ +#define __TEXTTOPRINT__ +/*--------------------------------------------------------------------------*/ + +#include <windows.h> +#include <windowsx.h> +#include <stdio.h> +#include <commdlg.h> +#include <stdio.h> +#include <ShlObj.h> +#include <time.h> +#include <math.h> +#include "BOOL.h" + +/*--------------------------------------------------------------------------*/ +/* EzCreateFont */ +/* Fonts Properties */ +#define EZ_ATTR_BOLD 1 +#define EZ_ATTR_ITALIC 2 +#define EZ_ATTR_UNDERLINE 4 +#define EZ_ATTR_STRIKEOUT 8 +/*--------------------------------------------------------------------------*/ +void PrintString(char *lines, char *Entete); +void PrintFile(char *filename); +void PageHeader(HDC hdc, LPSTR Entete); +void Footer(HDC hdc, int number); +HDC GetPrinterDC(void); +BOOL ConfigurePrinterDialogBox(void); +/*--------------------------------------------------------------------------*/ +extern HDC TryToGetDC(HWND hWnd); +#endif /* __TEXTTOPRINT__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/WindowShow.c b/modules/windows_tools/src/c/scilab_windows/WindowShow.c new file mode 100755 index 000000000..e4584a140 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/WindowShow.c @@ -0,0 +1,74 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2010 - 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 <windows.h> +#include "WindowShow.h" +#include "iconifyMainWindow.h" +#include "setVisibleMainWindow.h" +/*--------------------------------------------------------------------------*/ +static int CmdShow = -1; +/*--------------------------------------------------------------------------*/ +void setWindowShowMode(int nCmdShow) +{ + switch (nCmdShow) + { + case SW_HIDE: + case SW_SHOWMINIMIZED: + case SW_SHOWMAXIMIZED: + case SW_SHOWNOACTIVATE: + case SW_SHOW: + case SW_MINIMIZE: + case SW_SHOWMINNOACTIVE: + case SW_SHOWNA: + case SW_RESTORE: + case SW_SHOWDEFAULT: + case SW_MAX: + CmdShow = nCmdShow; + break; + case SW_SHOWNORMAL: + default: + CmdShow = SW_NORMAL; + break; + } +} +/*--------------------------------------------------------------------------*/ +int getWindowShowMode(void) +{ + return CmdShow; +} +/*--------------------------------------------------------------------------*/ +void WindowShow(void) +{ + switch (CmdShow) + { + case SW_HIDE: + setVisibleMainWindow(FALSE); + break; + + case SW_SHOWMINIMIZED: + case SW_MINIMIZE: + case SW_SHOWMINNOACTIVE: + iconifyMainWindow(); + break; + + case SW_SHOWMAXIMIZED: + case SW_MAX: + maximizeMainWindow(); + break; + + case SW_SHOWNORMAL: + default: + normalMainWindow(); + break; + } +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/WindowShow.h b/modules/windows_tools/src/c/scilab_windows/WindowShow.h new file mode 100755 index 000000000..513924473 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/WindowShow.h @@ -0,0 +1,36 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2010 - 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 +* +*/ +/*--------------------------------------------------------------------------*/ +#ifndef __WINDOWSHOW_H__ +#define __WINDOWSHOW_H__ + +#include "dynlib_scilab_windows.h" + +/** +* set Current Window Mode Show +* @param[IN] set Current Window Mode Show +*/ +SCILAB_WINDOWS_IMPEXP void setWindowShowMode(int nCmdShow); + +/** +* get Current Window Show Mode +* @return current Window Show Mode +*/ +SCILAB_WINDOWS_IMPEXP int getWindowShowMode(void); + +/** +* update Window show with current Mode +*/ +SCILAB_WINDOWS_IMPEXP void WindowShow(void); + +#endif /* __WINDOWSHOW_H__*/ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/WndThread.c b/modules/windows_tools/src/c/scilab_windows/WndThread.c new file mode 100755 index 000000000..1de7300c6 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/WndThread.c @@ -0,0 +1,160 @@ +/* +* 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 <Windows.h> +#include <windowsx.h> +#include "WndThread.h" +#include "MALLOC.h" +#include "version.h" +#include "wmcopydata.h" +#include "storeCommand.h" +#include "strdup_windows.h" +/*--------------------------------------------------------------------------*/ +static HWND hWndScilab = NULL; +HANDLE HandleThreadWnd = NULL; +static char titleHiddenScilabWindow[MAX_PATH] = ""; +static int ScilabId = -1; +/*--------------------------------------------------------------------------*/ +static DWORD WINAPI WndThread(LPVOID lpParam); +static void RegisterWindowClass(void); +static void GetFreeTitleOfWindowHidden(void); +static BOOL ON_WND_HIDDEN_WM_COPYDATA(HWND hwnd, HWND hWndSend, PCOPYDATASTRUCT MyCopyDataStruct); +/*--------------------------------------------------------------------------*/ +BOOL CreateScilabHiddenWndThread(void) +{ + BOOL bOK = FALSE; + + if (!HandleThreadWnd) + { + HandleThreadWnd = CreateThread( NULL, 0, WndThread, NULL, 0, NULL); + } + if (HandleThreadWnd) + { + bOK = TRUE; + } + + return bOK; +} +/*--------------------------------------------------------------------------*/ +static DWORD WINAPI WndThread(LPVOID lpParam) +{ + HANDLE hWndScilab = NULL; + HINSTANCE hInstanceThisDll = (HINSTANCE)GetModuleHandle("scilab_windows"); + + RegisterWindowClass(); + + GetFreeTitleOfWindowHidden(); + + hWndScilab = CreateWindow(HiddenWindowClassName, + titleHiddenScilabWindow, WS_OVERLAPPEDWINDOW, + 0, 0, 350, 0, + NULL, NULL, hInstanceThisDll, NULL); + + ShowWindow (hWndScilab, SW_HIDE); + UpdateWindow (hWndScilab); + + if (hWndScilab) + { + MSG Msg; + while (GetMessage(&Msg, NULL, 0, 0)) + { + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } + } + + return 0; +} +/*--------------------------------------------------------------------------*/ +LRESULT CALLBACK HiddenWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + switch (Msg) + { + HANDLE_MSG(hWnd, WM_COPYDATA, ON_WND_HIDDEN_WM_COPYDATA); + } + return DefWindowProc(hWnd, Msg, wParam, lParam); +} +/*--------------------------------------------------------------------------*/ +static void RegisterWindowClass(void) +{ + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = HiddenWndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = (HINSTANCE)GetModuleHandle("scilab_windows"); + wcex.hIcon = 0; + wcex.hCursor = 0; + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); + wcex.lpszMenuName = 0; + wcex.lpszClassName = HiddenWindowClassName; + wcex.hIconSm = 0; + + RegisterClassEx(&wcex); +} +/*--------------------------------------------------------------------------*/ +static void GetFreeTitleOfWindowHidden(void) +{ + HWND hWndScilab = NULL; + int Number_of_Scilab = 0; + + char SearchedScilabWindow[MAX_PATH]; + + wsprintf(SearchedScilabWindow, FORMAT_TITLE_HIDDEN_WINDOWS, SCI_VERSION_STRING, Number_of_Scilab); + + hWndScilab = FindWindow(NULL, SearchedScilabWindow); + + while ( hWndScilab ) + { + Number_of_Scilab++; + wsprintf(SearchedScilabWindow, FORMAT_TITLE_HIDDEN_WINDOWS, SCI_VERSION_STRING, Number_of_Scilab); + hWndScilab = FindWindow(NULL, SearchedScilabWindow); + } + + strcpy(titleHiddenScilabWindow, SearchedScilabWindow); + ScilabId = Number_of_Scilab; +} +/*--------------------------------------------------------------------------*/ +static BOOL ON_WND_HIDDEN_WM_COPYDATA(HWND hwnd, HWND hWndSend, PCOPYDATASTRUCT MyCopyDataStruct) +{ + char Command[MAX_PATH]; + char TitleWndSend[MAX_PATH]; + + ReceiveFromAnotherScilab(hWndSend, MyCopyDataStruct); + + if ( GetCommandFromAnotherScilab(TitleWndSend, Command) ) + { + StoreCommand (Command); + } + + return TRUE; +} +/*--------------------------------------------------------------------------*/ +char *getCurrentTitleScilabHiddenWindow(void) +{ + char *currentTitle = NULL; + if ( strcmp(titleHiddenScilabWindow, "") ) + { + currentTitle = strdup(titleHiddenScilabWindow); + } + return currentTitle; +} +/*--------------------------------------------------------------------------*/ +int getCurrentScilabId(void) +{ + return ScilabId; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/WndThread.h b/modules/windows_tools/src/c/scilab_windows/WndThread.h new file mode 100755 index 000000000..38f94ec7c --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/WndThread.h @@ -0,0 +1,48 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __WNDTHREAD_H__ +#define __WNDTHREAD_H__ + +#include "BOOL.h" /* BOOL */ +#include "dynlib_scilab_windows.h" + +/* format for title of hidden windows */ +#define FORMAT_TITLE_HIDDEN_WINDOWS "%s hidden window (%d)" + +/* window class name */ +#define HiddenWindowClassName "Scilab hidden window" + +/** +* Create a hidden window for Scilab (in a separate thread) +* This window (only windows) is used for some features as WM_COPYDATA +* disabled on -NWNI mode +* @return TRUE or FALSE +*/ +SCILAB_WINDOWS_IMPEXP BOOL CreateScilabHiddenWndThread(void); + +/** +* get current title for scilab hidden window +* example : scilab-5.0 hidden window (0) +*/ +SCILAB_WINDOWS_IMPEXP char *getCurrentTitleScilabHiddenWindow(void); + +/** +* get current scilab id +* return a Id : must be (>= 0) +* -1 if we have a problem +*/ +SCILAB_WINDOWS_IMPEXP int getCurrentScilabId(void); + +#endif /* __WNDTHREAD_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/buildMainWindowTitle_Windows.c b/modules/windows_tools/src/c/scilab_windows/buildMainWindowTitle_Windows.c new file mode 100755 index 000000000..d32e9b088 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/buildMainWindowTitle_Windows.c @@ -0,0 +1,32 @@ +/* +* 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 <Windows.h> +#include "buildMainWindowTitle_Windows.h" +#include "MALLOC.h" +#include "version.h" +#include "WndThread.h" +/*--------------------------------------------------------------------------*/ +char *buildMainWindowTitle_Windows(void) +{ + char *title = NULL; + + title = (char*)MALLOC(sizeof(char) * (strlen("%s (%d)") + strlen(SCI_VERSION_STRING) + 10 + 1)); + if (title) + { + wsprintf(title, "%s (%d)", SCI_VERSION_STRING, getCurrentScilabId()); + } + + return title; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/buildMainWindowTitle_Windows.h b/modules/windows_tools/src/c/scilab_windows/buildMainWindowTitle_Windows.h new file mode 100755 index 000000000..804f11438 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/buildMainWindowTitle_Windows.h @@ -0,0 +1,27 @@ + +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __BUILDMAINWINDOWTITLE_WINDOWS_H__ +#define __BUILDMAINWINDOWTITLE_WINDOWS_H__ + +#include "dynlib_scilab_windows.h" + +/** +* build title of the main scilab window (Windows) +* @return string (title) +*/ +SCILAB_WINDOWS_IMPEXP char *buildMainWindowTitle_Windows(void); + +#endif /* __BUILDMAINWINDOWTITLE_WINDOWS_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/console.c b/modules/windows_tools/src/c/scilab_windows/console.c new file mode 100755 index 000000000..511d799e7 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/console.c @@ -0,0 +1,186 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ + +#define _WIN32_WINNT 0x0500 // GetConsoleWindow +#include <Windows.h> +#include <shlwapi.h> +#include <stdio.h> +#pragma comment(lib, "shlwapi.lib") + +#include "WinConsole.h" +#include "WndThread.h" +#include "console.h" +#include "version.h" +#include "strdup_windows.h" +/*--------------------------------------------------------------------------*/ +#define NameConsole "Console" +/*--------------------------------------------------------------------------*/ +static CONSOLE_SCREEN_BUFFER_INFO csbiInfoSave; +static char ScilexConsoleName[MAX_PATH]; +/*--------------------------------------------------------------------------*/ +void UpdateConsoleColors(void) +{ + HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); + COORD Coord; + DWORD cWritten; + + Coord.X = 0; + Coord.Y = 0; + + FillConsoleOutputAttribute( hConsole, + BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY, + csbiInfoSave.dwSize.X * csbiInfoSave.dwSize.Y, + Coord, + &cWritten); + + SetConsoleTextAttribute(hConsole, BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY); + +} +/*--------------------------------------------------------------------------*/ +void SaveConsoleColors(void) +{ + GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbiInfoSave); +} +/*--------------------------------------------------------------------------*/ +void RestoreConsoleColors(void) +{ + HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); + COORD Coord; + DWORD cWritten; + + Coord.X = 0; + Coord.Y = 0; + + FillConsoleOutputAttribute( hConsole, + csbiInfoSave.wAttributes, + csbiInfoSave.dwSize.X * csbiInfoSave.dwSize.Y, + Coord, + &cWritten); + SetConsoleTextAttribute(hConsole, csbiInfoSave.wAttributes); +} +/*--------------------------------------------------------------------------*/ +void RenameConsole(void) +{ + HWND hScilex = NULL; + char CurrentConsoleName[MAX_PATH]; + char CurrentConsoleNameTmp[MAX_PATH]; + + GetConsoleTitle(CurrentConsoleName, MAX_PATH); + strncpy(CurrentConsoleNameTmp, CurrentConsoleName, strlen(NameConsole)); + CurrentConsoleNameTmp[strlen(NameConsole)] = '\0'; + + if ( strcmp(CurrentConsoleNameTmp, NameConsole) != 0) + { + wsprintf(ScilexConsoleName, "%s %s", NameConsole, SCI_VERSION_STRING); + SetConsoleTitle(ScilexConsoleName); + } + + hScilex = GetConsoleWindow(); + if (hScilex) + { + HMENU hmenuConsole = NULL; + // Desactive croix dans la console + hmenuConsole = GetSystemMenu(hScilex, FALSE); + DeleteMenu(hmenuConsole, SC_CLOSE, MF_BYCOMMAND); + } +} +/*--------------------------------------------------------------------------*/ +void RestoreExitButton(void) +{ + HWND hScilex = NULL; + hScilex = GetConsoleWindow(); + if (hScilex) + { + HMENU hmenuConsole = NULL; + // Active croix dans la console + hmenuConsole = GetSystemMenu(hScilex, FALSE); + AppendMenu( hmenuConsole, MF_BYCOMMAND, SC_CLOSE, "&Close Alt+F4" ); + } +} +/*--------------------------------------------------------------------------*/ +void CreateScilabConsole(int ShowBanner) +{ + HWND hScilex = NULL; + + SetConsoleState(0); /* Console DOS Cachée par défaut */ + AllocConsole(); + + wsprintf(ScilexConsoleName, "%s %s (%d)", NameConsole, SCI_VERSION_STRING, getCurrentScilabId()); + SetConsoleTitle(ScilexConsoleName); + + CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); + freopen("CONOUT$", "wb", stdout); /* redirect stdout --> CONOUT$*/ + freopen("CONOUT$", "wb", stderr); /* redirect stderr --> CONOUT$*/ + + if (ShowBanner) + { + char line[80]; + + strcpy(line, " ___________________________________________\n"); + printf(line); + wsprintf(line, " %s\n\n", SCI_VERSION_STRING); + printf(line); + strcpy(line, " Scilab Enterprises\n"); + printf(line); + strcpy(line, " Copyright (c) 2011-2017 (Scilab Enterprises)\n"); + printf(line); + strcpy(line, " Copyright (c) 1989-2012 (INRIA)\n"); + printf(line); + strcpy(line, " Copyright (c) 1989-2007 (ENPC)\n"); + printf(line); + strcpy(line, " ___________________________________________\n\n"); + printf(line); + } + + hScilex = GetConsoleWindow(); + if (hScilex) + { + HMENU hmenuConsole = NULL; + // Desactive croix dans la console + hmenuConsole = GetSystemMenu(hScilex, FALSE); + DeleteMenu(hmenuConsole, SC_CLOSE, MF_BYCOMMAND); + + /* Cache la fenetre Console */ + ShowWindow(hScilex, SW_HIDE); + } +} +/*--------------------------------------------------------------------------*/ +void CloseScilabConsole(void) +{ + fclose(stdout); + fclose(stderr); + FreeConsole(); +} +/*--------------------------------------------------------------------------*/ +char *getScilexConsoleName(void) +{ + char *retName = NULL; + + if (strlen(ScilexConsoleName) > 0) + { + retName = strdup(ScilexConsoleName); + } + return retName; +} +/*--------------------------------------------------------------------------*/ +int getXConsoleScreenSize(void) +{ + return (csbiInfoSave.srWindow.Right - csbiInfoSave.srWindow.Left); +} +/*--------------------------------------------------------------------------*/ +int getYConsoleScreenSize(void) +{ + return (csbiInfoSave.srWindow.Bottom - csbiInfoSave.srWindow.Top); +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/console.h b/modules/windows_tools/src/c/scilab_windows/console.h new file mode 100755 index 000000000..418e34b51 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/console.h @@ -0,0 +1,67 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __CONSOLE_H__ +#define __CONSOLE_H__ +#include "dynlib_scilab_windows.h" +#include "BOOL.h" + +/** +* Update Colors of console +*/ +SCILAB_WINDOWS_IMPEXP void UpdateConsoleColors(void); + +/** +* Save colors before creation +*/ +SCILAB_WINDOWS_IMPEXP void SaveConsoleColors(void); + +/** +* Restore colors of console +*/ +SCILAB_WINDOWS_IMPEXP void RestoreConsoleColors(void); + +/** +* Restore Exit button +*/ +SCILAB_WINDOWS_IMPEXP void RestoreExitButton(void); + +/** +* Rename Scilab Console with correct name +*/ +SCILAB_WINDOWS_IMPEXP void RenameConsole(void); + +/** +* Create Scilab Console +*/ +SCILAB_WINDOWS_IMPEXP void CreateScilabConsole(BOOL ShowBanner); + +/** +* Close Scilab Console +*/ +SCILAB_WINDOWS_IMPEXP void CloseScilabConsole(void); + +/** +* get scilex console name +* @return a name +*/ +SCILAB_WINDOWS_IMPEXP char *getScilexConsoleName(void); + +/* return colums size of screen console */ +SCILAB_WINDOWS_IMPEXP int getXConsoleScreenSize(void); + +/* return lines size of screen console */ +SCILAB_WINDOWS_IMPEXP int getYConsoleScreenSize(void); + +#endif /* __CONSOLE_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/console_main.c b/modules/windows_tools/src/c/scilab_windows/console_main.c new file mode 100755 index 000000000..7cbb4e6e0 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/console_main.c @@ -0,0 +1,188 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) DIGITEO - 2010-2012 - 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 <Windows.h> +#include <shellapi.h> +#include "console_main.h" +#include "core_math.h" +#include "getcommandlineargs.h" +#include "scilabmode.h" +#include "forbiddenToUseScilab.h" +#include "realmain.h" +#include "version.h" +#include "getScilabDirectory.h" +#include "MALLOC.h" +#include "sciquit.h" +#include "scilab_main.h" +#include "console.h" +#include "WndThread.h" +#include "localization.h" +#include "LanguagePreferences_Windows.h" +#include "with_module.h" + +/*--------------------------------------------------------------------------*/ +#define MIN_STACKSIZE 180000 +/*--------------------------------------------------------------------------*/ +static LPSTR my_argv[MAXCMDTOKENS]; +static int my_argc = -1; +static int startupf = 0; /** 0 if we execute startup else 1 **/ +static int memory = MIN_STACKSIZE; +/*--------------------------------------------------------------------------*/ +extern void settexmacs(void); +/*--------------------------------------------------------------------------*/ +int sci_show_banner = 1; +/*--------------------------------------------------------------------------*/ +int Console_Main(int argc, char **argv) +{ + int iExitCode = 0; + int argcount = 0, lpath = 0; + InitScriptType pathtype = SCILAB_SCRIPT; + char *path = NULL; + char *ScilabDirectory = NULL; + int i = 0; + + my_argc = -1; + + forbiddenToUseScilab(); + + setScilabMode(SCILAB_NW); + + setCommandLineArgs(argv, argc); + + for (i = 0; i < argc; i++) + { + my_argv[i] = argv[i]; + } + my_argc = argc; + + ScilabDirectory = getScilabDirectory(FALSE); + + if (ScilabDirectory == NULL) + { + // This message must never occur, but ... + MessageBox (NULL, "ERROR" , "Cannot determine the Scilab directory (SCI).", MB_ICONSTOP | MB_OK); + exit(1); + } + else + { + FREE(ScilabDirectory); + ScilabDirectory = NULL; + } + + argcount = my_argc; + while (argcount > 0) + { + argcount--; + if (_stricmp (my_argv[argcount], "-NS") == 0) + { + startupf = 1; + } + else if ( _stricmp(my_argv[argcount], "-NB") == 0) + { + sci_show_banner = 0; + } + else if (_stricmp (my_argv[argcount], "-NWNI") == 0) + { + setScilabMode(SCILAB_NWNI); + } + else if (_stricmp (my_argv[argcount], "-F") == 0 && argcount + 1 < my_argc) + { + path = my_argv[argcount + 1]; + lpath = (int) strlen (my_argv[argcount + 1]); + } + else if (_stricmp (my_argv[argcount], "-E") == 0 && argcount + 1 < my_argc) + { + path = my_argv[argcount + 1]; + lpath = (int) strlen (my_argv[argcount + 1]); + pathtype = SCILAB_CODE; + } + else if ( _stricmp(my_argv[argcount], "-MEM") == 0 && argcount + 1 < my_argc) + { + memory = Max(atoi( my_argv[argcount + 1]), MIN_STACKSIZE ); + } + else if ( _stricmp(my_argv[argcount], "-TEXMACS") == 0 ) + { + setScilabMode(SCILAB_NWNI); + settexmacs(); + } + else if ( _stricmp(my_argv[argcount], "-NOGUI") == 0 ) + { + setScilabMode(SCILAB_NWNI); + } + else if ( (_stricmp (my_argv[argcount], "-VERSION") == 0) || + (_stricmp (my_argv[argcount], "-VER") == 0) ) + { + disp_scilab_version(); + exit(1); + } + else if ( _stricmp(my_argv[argcount], "-L") == 0 && argcount + 1 < my_argc) + { + char *language = my_argv[argcount + 1]; + setLanguageFromCommandLine(language); + } + else if ( (_stricmp (my_argv[argcount], "-H") == 0) || + (_stricmp (my_argv[argcount], "-?") == 0) || + (_stricmp (my_argv[argcount], "-HELP") == 0) ) + { + printf("scilex <Options>: run Scilab.\n"); + printf("Arguments: passes Arguments to Scilab, This Arguments can be retreived\n by the Scilab function sciargs.\n"); + printf("-e Instruction: execute the scilab instruction given in Instruction argument.\n"); + printf("-f File: execute the scilab script given in File argument.\n"); + printf(" '-e' and '-f' options are mutually exclusive.\n\n"); + printf("-l lang: it fixes the user language.\n\n" ); + printf("-mem N: set the initial stacksize.\n"); + printf("-ns: if this option is present the startup file scilab.start is not executed.\n"); + printf("-nb: if this option is present then Scilab loading message is not displayed.\n"); + printf("-nouserstartup: don't execute user startup files SCIHOME/.scilab or SCIHOME/scilab.ini.\n"); + printf("-nw: start Scilab without specialized Scilab Window.\n"); + printf("-nwni: start Scilab without user interaction (batch mode).\n"); + printf("-nogui: start Scilab without GUI,tcl/tk and user interaction (batch mode).\n"); + printf("-texmacs: reserved for WinTeXMacs.\n"); + printf("-version: print product version and exit.\n"); + printf("\n"); + exit(1); + } + } + + if (!with_module("jvm")) + { + /* no module jvm then we force NWNI mode */ + setScilabMode(SCILAB_NWNI); + } + + if (getScilabMode() != SCILAB_NWNI) + { + CreateScilabHiddenWndThread(); + } + + if ( (getScilabMode() == SCILAB_NWNI) || (getScilabMode() == SCILAB_NW) ) + { + SaveConsoleColors(); + if (getScilabMode() == SCILAB_NW) + { + RenameConsole(); + UpdateConsoleColors(); + } + + iExitCode = sci_windows_main (&startupf, path, (InitScriptType)pathtype, &lpath, memory); + + } + else + { + MessageBox(NULL, "-nw or -nwni not found", "ERROR", MB_ICONWARNING); + iExitCode = 1; + } + return iExitCode; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/console_main.h b/modules/windows_tools/src/c/scilab_windows/console_main.h new file mode 100755 index 000000000..b2ae90a79 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/console_main.h @@ -0,0 +1,28 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ + +#ifndef __CONSOLE_MAIN_H__ +#define __CONSOLE_MAIN_H__ + +#include "dynlib_scilab_windows.h" + +/** +* Main for scilab with no gui +* @param [in] argc : number of arguments +* @param [in] argv : values of arguments +* @return 0 +*/ +SCILAB_WINDOWS_IMPEXP int Console_Main(int argc, char **argv); + +#endif /* __CONSOLE_MAIN_H__ */
\ No newline at end of file diff --git a/modules/windows_tools/src/c/scilab_windows/core_Import.def b/modules/windows_tools/src/c/scilab_windows/core_Import.def new file mode 100755 index 000000000..1f132dd52 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/core_Import.def @@ -0,0 +1,21 @@ +LIBRARY core.dll + + +EXPORTS +;core +getScilabMode +disp_scilab_version +settexmacs +setCommandLineArgs +setScilabMode +with_module +setSCIpath +realmain +InitializeLaunchScilabSignal +sciquit +getTMPDIR +getTMPDIRW +StoreCommand +MyHeapAlloc +MyHeapFree +MyHeapRealloc diff --git a/modules/windows_tools/src/c/scilab_windows/dynlib_scilab_windows.h b/modules/windows_tools/src/c/scilab_windows/dynlib_scilab_windows.h new file mode 100755 index 000000000..2ad899031 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/dynlib_scilab_windows.h @@ -0,0 +1,28 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2009 - 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __DYNLIB_SCILAB_WINDOWS_H__ +#define __DYNLIB_SCILAB_WINDOWS_H__ + +#ifdef _MSC_VER +#ifdef SCILAB_WINDOWS_EXPORTS +#define SCILAB_WINDOWS_IMPEXP __declspec(dllexport) +#else +#define SCILAB_WINDOWS_IMPEXP __declspec(dllimport) +#endif +#else +#define SCILAB_WINDOWS_IMPEXP +#endif + +#endif /* __DYNLIB_SCILAB_WINDOWS_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/forbiddenToUseScilab.c b/modules/windows_tools/src/c/scilab_windows/forbiddenToUseScilab.c new file mode 100755 index 000000000..49fbded3a --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/forbiddenToUseScilab.c @@ -0,0 +1,34 @@ +/* +* 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 "forbiddenToUseScilab.h" +#include <Windows.h> +/*--------------------------------------------------------------------------*/ +BOOL forbiddenToUseScilab(void) +{ + BOOL bOK = FALSE; + HDC hdc = GetDC(NULL); + int BitsByPixel = GetDeviceCaps(hdc, BITSPIXEL); + + ReleaseDC (NULL, hdc); + + if ( BitsByPixel < 8 ) + { + MessageBox(NULL, "Warning", "Scilab supports only 256 colors or more.\n", MB_ICONSTOP); + exit(1); + } + + bOK = TRUE; + return bOK; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/forbiddenToUseScilab.h b/modules/windows_tools/src/c/scilab_windows/forbiddenToUseScilab.h new file mode 100755 index 000000000..575cf1dd6 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/forbiddenToUseScilab.h @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------*/ +// 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 +/*--------------------------------------------------------------------------*/ +#ifndef __FORBIDDENTOUSESCILAB_H__ +#define __FORBIDDENTOUSESCILAB_H__ + +#include "dynlib_scilab_windows.h" +#include "BOOL.h" /* BOOL */ + +/* +* stop scilab if windows < 256 colors +* @return TRUE or FALSE +*/ +SCILAB_WINDOWS_IMPEXP BOOL forbiddenToUseScilab(void); + +#endif /* __FORBIDDENTOUSESCILAB_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/getBlasType.c b/modules/windows_tools/src/c/scilab_windows/getBlasType.c new file mode 100755 index 000000000..389a6e57e --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/getBlasType.c @@ -0,0 +1,65 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2011 - 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 <Windows.h> +#include "getBlasType.h" +/*--------------------------------------------------------------------------*/ +#define BLASLIBNAME "blasplus.dll" +#define DGEMMCNAME "dgemm" +#define DGEMMFNAME "dgemm_" +#define MKLGETVERSIONNAME "MKL_Get_Version" +/*--------------------------------------------------------------------------*/ +static blas_type blasType = BLAS_UNKNOW; +static BOOL bBlasDetected = FALSE; +/*--------------------------------------------------------------------------*/ +typedef int (*DGEMPROC_C) (); +typedef int (*DGEMPROC_F) (); +typedef int (*MKL_GET_VERSIONPROC) (); +/*--------------------------------------------------------------------------*/ +blas_type getBlasType(void) +{ + if (!bBlasDetected) + { + HINSTANCE BlasDll = NULL; + bBlasDetected = TRUE; + BlasDll = LoadLibrary (BLASLIBNAME); + if (BlasDll != NULL) + { + DGEMPROC_C dynDGEMMPROC_C = (DGEMPROC_C)GetProcAddress(BlasDll, DGEMMCNAME); + DGEMPROC_F dynDGEMMPROC_F = (DGEMPROC_C)GetProcAddress(BlasDll, "dgemm_"); + MKL_GET_VERSIONPROC dynMKL_GET_VERSIONPROC = (MKL_GET_VERSIONPROC)GetProcAddress(BlasDll, MKLGETVERSIONNAME); + if (dynMKL_GET_VERSIONPROC) + { + blasType = BLAS_MKL; + } + else + { + if (dynDGEMMPROC_C && dynDGEMMPROC_F) + { + blasType = BLAS_REF; + } + else + { + if ((dynDGEMMPROC_F == NULL) && (dynDGEMMPROC_C)) + { + blasType = BLAS_ATLAS; + } + } + } + FreeLibrary(BlasDll); + BlasDll = NULL; + } + } + return blasType; +} +/*--------------------------------------------------------------------------*/ + diff --git a/modules/windows_tools/src/c/scilab_windows/getBlasType.h b/modules/windows_tools/src/c/scilab_windows/getBlasType.h new file mode 100755 index 000000000..89519f231 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/getBlasType.h @@ -0,0 +1,28 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2011 - 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 +* +*/ +/*--------------------------------------------------------------------------*/ +#ifndef __GETBLASTYPE_H__ +#define __GETBLASTYPE_H__ + +#include "dynlib_scilab_windows.h" + +typedef enum { BLAS_UNKNOW = -1, + BLAS_REF = 0, + BLAS_ATLAS = 1, + BLAS_MKL = 2 + } blas_type; + +/* detect blas type used by scilab */ +SCILAB_WINDOWS_IMPEXP blas_type getBlasType(void); + +#endif /* __GETBLASTYPE_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/getScilabDirectory.c b/modules/windows_tools/src/c/scilab_windows/getScilabDirectory.c new file mode 100755 index 000000000..ab3c5f675 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/getScilabDirectory.c @@ -0,0 +1,85 @@ +/* +* 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 <windows.h> +#include <stdlib.h> +#include "getScilabDirectory.h" +#include "MALLOC.h" +#include "setgetSCIpath.h" +#include "charEncoding.h" +/*--------------------------------------------------------------------------*/ +char *getScilabDirectory(BOOL UnixStyle) +{ + char *SciPathName = NULL; + wchar_t* wcSciPathName = NULL; + wchar_t ScilabModuleName[MAX_PATH + 1]; + wchar_t drive[_MAX_DRIVE]; + wchar_t dir[_MAX_DIR]; + wchar_t fname[_MAX_FNAME]; + wchar_t ext[_MAX_EXT]; + wchar_t *DirTmp = NULL; + + + if (!GetModuleFileNameW ((HINSTANCE)GetModuleHandleW(L"core"), (wchar_t*) ScilabModuleName, MAX_PATH)) + { + return NULL; + } + + _wsplitpath(ScilabModuleName, drive, dir, fname, ext); + + if (dir[wcslen(dir) - 1] == L'\\') + { + dir[wcslen(dir) - 1] = L'\0'; + } + + DirTmp = wcsrchr (dir, L'\\'); + + if (wcslen(dir) - wcslen(DirTmp) > 0) + { + dir[wcslen(dir) - wcslen(DirTmp)] = L'\0'; + } + else + { + return NULL; + } + + wcSciPathName = (wchar_t*)MALLOC((int)( wcslen(drive) + wcslen(dir) + 5) * sizeof(wchar_t)); + if (wcSciPathName) + { + _wmakepath(wcSciPathName, drive, dir, NULL, NULL); + if ( UnixStyle ) + { + int i = 0; + for (i = 0; i < (int)wcslen(wcSciPathName); i++) + { + if (wcSciPathName[i] == L'\\') + { + wcSciPathName[i] = L'/'; + } + } + } + wcSciPathName[wcslen(wcSciPathName) - 1] = '\0'; + + SciPathName = wide_string_to_UTF8(wcSciPathName); + FREE(wcSciPathName); + wcSciPathName = NULL; + } + + if (SciPathName) + { + setSCIpath(SciPathName); + } + + return SciPathName; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/getScilabDirectory.h b/modules/windows_tools/src/c/scilab_windows/getScilabDirectory.h new file mode 100755 index 000000000..e0ff08799 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/getScilabDirectory.h @@ -0,0 +1,28 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __GETSCILABDIRECTORY_H__ +#define __GETSCILABDIRECTORY_H__ + +#include "dynlib_scilab_windows.h" +#include "BOOL.h" /* BOOL */ + +/** +* get scilab directory (windows) +* @param [in] +* @return +*/ +SCILAB_WINDOWS_IMPEXP char *getScilabDirectory(BOOL UnixStyle); + +#endif /* __GETSCILABDIRECTORY_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/getVideoAdapters.c b/modules/windows_tools/src/c/scilab_windows/getVideoAdapters.c new file mode 100755 index 000000000..46575bd1a --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/getVideoAdapters.c @@ -0,0 +1,160 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2011 - 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 <Windows.h> +#include "getVideoAdapters.h" +#include "MALLOC.h" +#include "BOOL.h" +#include "strdup_windows.h" +/*--------------------------------------------------------------------------*/ +static int getNumberOfAdapters(BOOL *multiDriver); +static void RemoveDuplicateStrings(char **Strings, int *SizeStrings); +/*--------------------------------------------------------------------------*/ +char **getVideoAdapters(int *returnedNbAdapters) +{ + BOOL bMultiDriver = FALSE; + DISPLAY_DEVICE displayDevice; + DEVMODE devMode; + char **StringNames = NULL; + DISPLAY_DEVICE dd; + int nbAdapters = getNumberOfAdapters(&bMultiDriver); + memset(&dd, 0, sizeof(DISPLAY_DEVICE)); + *returnedNbAdapters = 0; + + if (nbAdapters > 0) + { + StringNames = (char**)MALLOC(sizeof(char*) * nbAdapters); + if (StringNames) + { + DWORD deviceNum = 0; + DWORD i = 0; + memset(&displayDevice, 0, sizeof(displayDevice)); + displayDevice.cb = sizeof(DISPLAY_DEVICE); + while (EnumDisplayDevices(NULL, i, &displayDevice, 0)) + { + if (displayDevice.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) + { + } + else + { + EnumDisplaySettings(displayDevice.DeviceName, ENUM_CURRENT_SETTINGS, &devMode); + StringNames[(int)deviceNum] = strdup(displayDevice.DeviceString); + ++deviceNum; + } + ++i; + } + *returnedNbAdapters = (int)deviceNum; + RemoveDuplicateStrings(StringNames, returnedNbAdapters); + } + } + return StringNames; +} +/*--------------------------------------------------------------------------*/ +static int getNumberOfAdapters(BOOL *multiDriver) +{ + DWORD deviceNum = 0; + DWORD i = 0; + DISPLAY_DEVICE displayDevice; + + memset(&displayDevice, 0, sizeof(displayDevice)); + displayDevice.cb = sizeof(DISPLAY_DEVICE); + while (EnumDisplayDevices(NULL, i, &displayDevice, 0)) + { + if (displayDevice.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) + { + } + else + { + if (displayDevice.StateFlags & DISPLAY_DEVICE_MULTI_DRIVER ) + { + *multiDriver = TRUE; + } + ++deviceNum; + } + ++i; + } + return deviceNum; +} +/*--------------------------------------------------------------------------*/ +static void RemoveDuplicateStrings(char **Strings, int *SizeStrings) +{ + int fin, i; + int newsize = *SizeStrings; + for (fin = *SizeStrings - 1; fin > 0; fin--) + { + int Sorted = FALSE; + for (i = 0; i < fin; i++) + { + if (Strings[i]) + { + if (strcmp(Strings[i], Strings[i + 1]) == 0) + { + FREE(Strings[i + 1]); + Strings[i + 1] = NULL; + Sorted = TRUE; + newsize--; + } + } + else + { + Strings[i] = Strings[i + 1]; + Strings[i + 1] = NULL; + Sorted = TRUE; + } + } + if (!Sorted) + { + break; + } + } + + *SizeStrings = newsize; +} +/*--------------------------------------------------------------------------*/ +char * GetPrimaryVideoCardVersion(void) +{ +#define KeyDisplayIdentifer "SYSTEM\\ControlSet001\\Control\\Class\\{4D36E968-E325-11CE-BFC1-08002BE10318}\\0000" +#define KeyDisplayIdentiferOthers "SYSTEM\\ControlSet002\\Control\\Class\\{4D36E968-E325-11CE-BFC1-08002BE10318}\\0000" +#define LenLine 255 + + HKEY key; + DWORD result; + char *LineIdentifier; + ULONG length = LenLine, Type; + + result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, KeyDisplayIdentifer, 0, KEY_QUERY_VALUE , &key); + if (result != ERROR_SUCCESS) + { + // On some configuration (x64 + non official drivers), ControlSet001 does not exist + result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, KeyDisplayIdentiferOthers, 0, KEY_QUERY_VALUE , &key); + } + + LineIdentifier = (char*)MALLOC(sizeof(char) * length); + + if ( RegQueryValueEx(key, "DriverVersion", 0, &Type, (LPBYTE)LineIdentifier, &length) != ERROR_SUCCESS ) + { + wsprintf(LineIdentifier, "ERROR"); + } + + if ( Type != REG_SZ ) + { + wsprintf(LineIdentifier, "ERROR"); + } + + if ( result == ERROR_SUCCESS ) + { + RegCloseKey(key); + } + + return (char *)LineIdentifier; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/getVideoAdapters.h b/modules/windows_tools/src/c/scilab_windows/getVideoAdapters.h new file mode 100755 index 000000000..12bdfae25 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/getVideoAdapters.h @@ -0,0 +1,21 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2011 - 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 +* +*/ +/*--------------------------------------------------------------------------*/ +#ifndef __GETVIDEOADAPTERS_H__ +#define __GETVIDEOADAPTERS_H__ + +#include "dynlib_scilab_windows.h" + +SCILAB_WINDOWS_IMPEXP char **getVideoAdapters(int *returnedNbAdapters); +SCILAB_WINDOWS_IMPEXP char * GetPrimaryVideoCardVersion(void); +#endif /* __GETVIDEOADAPTERS_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/killScilabProcess.c b/modules/windows_tools/src/c/scilab_windows/killScilabProcess.c new file mode 100755 index 000000000..68600ea39 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/killScilabProcess.c @@ -0,0 +1,33 @@ +/* +* 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 <windows.h> +#include "killScilabProcess.h" +/*--------------------------------------------------------------------------*/ +void killScilabProcess(int exitCode) +{ + HANDLE hProcess; + + /* Ouverture de ce Process avec droit pour le tuer */ + hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, GetCurrentProcessId()); + if (hProcess) + { + /* Tue ce Process */ + TerminateProcess(hProcess, exitCode); + } + else + { + MessageBox(NULL, "Don't Find Scilab Process", "Warning", MB_ICONWARNING); + } +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/killScilabProcess.h b/modules/windows_tools/src/c/scilab_windows/killScilabProcess.h new file mode 100755 index 000000000..09a50be6b --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/killScilabProcess.h @@ -0,0 +1,26 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __KILLSCILABPROCESS_H__ +#define __KILLSCILABPROCESS_H__ + +#include "dynlib_scilab_windows.h" + +/** +* Kill current scilab process +* @param[in] exit code value +*/ +SCILAB_WINDOWS_IMPEXP void killScilabProcess(int exitCode); + +#endif /* __KILLSCILABPROCESS_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/mmapWindows.c b/modules/windows_tools/src/c/scilab_windows/mmapWindows.c new file mode 100755 index 000000000..7f488176c --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/mmapWindows.c @@ -0,0 +1,135 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2010 - 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 <windows.h> +#include "mmapWindows.h" +/*--------------------------------------------------------------------------*/ +#ifdef _WIN64 +typedef LONG64 LOCKLONG; +#else +typedef LONG LOCKLONG; +#endif +static LOCKLONG g_sl = 0; +/*--------------------------------------------------------------------------*/ +/* Wait for spin lock */ +static int slwait (LOCKLONG *sl) +{ + + LOCKLONG Destination = *sl; + LONG Exchange = 1; + LONG Comparand = 0; +#if _WIN64 + while (InterlockedCompareExchange64(&Destination, Exchange, Comparand)) + +#else + while (InterlockedCompareExchange (&Destination, Exchange, Comparand)) +#endif + { + Sleep (0); + } + *sl = Destination; + return 0; +} +/*--------------------------------------------------------------------------*/ +/* Release spin lock */ +static int slrelease (LOCKLONG *sl) +{ + InterlockedExchange ((volatile LONG*)sl, 0); + return 0; +} +/*--------------------------------------------------------------------------*/ +/* getpagesize for windows */ +static long getpagesize (void) +{ + static long g_pagesize = 0; + if (!g_pagesize) + { + SYSTEM_INFO system_info; + GetSystemInfo (&system_info); + g_pagesize = system_info.dwPageSize; + } + return g_pagesize; +} +/*--------------------------------------------------------------------------*/ +static long getregionsize (void) +{ + static long g_regionsize = 0; + if (! g_regionsize) + { + SYSTEM_INFO system_info; + GetSystemInfo (&system_info); + g_regionsize = system_info.dwAllocationGranularity; + } + return g_regionsize; +} +/*--------------------------------------------------------------------------*/ +void *mmap (void *ptr, long size, long prot, long type, long handle, long arg) +{ + static long g_pagesize; + static long g_regionsize; + + /* Wait for spin lock */ + slwait (&g_sl); + + /* First time initialization */ + if (! g_pagesize) + { + g_pagesize = getpagesize (); + } + + if (! g_regionsize) + { + g_regionsize = getregionsize (); + } + + /* Allocate this */ + ptr = VirtualAlloc (ptr, size, MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE); + /* Release spin lock */ + slrelease (&g_sl); + return ptr; +} +/*--------------------------------------------------------------------------*/ +long munmap (void *ptr, long size) +{ + static long g_pagesize = 0; + static long g_regionsize = 0; + int rc = MUNMAP_FAILURE; + + /* Wait for spin lock */ + slwait (&g_sl); + + /* First time initialization */ + if (! g_pagesize) + { + g_pagesize = getpagesize (); + } + + if (! g_regionsize) + { + g_regionsize = getregionsize (); + } + + /* Free this */ + if (! VirtualFree (ptr, 0, MEM_RELEASE)) + { + /* Release spin lock */ + slrelease (&g_sl); + return rc; + } + + rc = 0; + /* Release spin lock */ + slrelease (&g_sl); + return rc; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/mmapWindows.h b/modules/windows_tools/src/c/scilab_windows/mmapWindows.h new file mode 100755 index 000000000..a85906e5b --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/mmapWindows.h @@ -0,0 +1,32 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2010 - 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 +* +*/ +/*--------------------------------------------------------------------------*/ +#ifndef __MMAPWINDOWS_H__ +#define __MMAPWINDOWS_H__ + +#include "dynlib_scilab_windows.h" + +#define MMAP_FAILURE (-1) +#define MUNMAP_FAILURE (-1) +#define PROT_READ 0x1 +#define PROT_WRITE 0x2 +#define MAP_SHARED 1 +#define MAP_ANONYMOUS 0x20 + +/* Emulation of mmap and munmap on Windows */ + +SCILAB_WINDOWS_IMPEXP void *mmap (void *ptr, long size, long prot, long type, long handle, long arg); + +SCILAB_WINDOWS_IMPEXP long munmap (void *ptr, long size); + +#endif /* __MMAPWINDOWS_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/registry-files-association.reg b/modules/windows_tools/src/c/scilab_windows/registry-files-association.reg new file mode 100755 index 000000000..59ecda58c --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/registry-files-association.reg @@ -0,0 +1,46 @@ +Windows Registry Editor Version 5.00 + +[HKEY_CLASSES_ROOT\.sce] + +[HKEY_CLASSES_ROOT\.sce\DefaultIcon] +@="D:\\TRUNK\\scilab\\bin\\wscilex.exe,7" + +[HKEY_CLASSES_ROOT\.sce\print] + +[HKEY_CLASSES_ROOT\.sce\print\command] +@="\"D:\\TRUNK\\scilab\\bin\\scilex.exe\" -P \"%1\"" + +[HKEY_CLASSES_ROOT\.sce\Run with Scilab 5.0-SVN] + +[HKEY_CLASSES_ROOT\.sce\Run with Scilab 5.0-SVN\command] +@="\"d:\\TRUNK\\scilab\\bin\\wscilex.exe\" -X \"%1\"" + +[HKEY_CLASSES_ROOT\.sce\shell] + +[HKEY_CLASSES_ROOT\.sce\shell\open] + +[HKEY_CLASSES_ROOT\.sce\shell\open\command] +@="\"D:\\TRUNK\\scilab\\bin\\wscilex.exe\" -O \"%1\"" + +[HKEY_CLASSES_ROOT\.sci] + +[HKEY_CLASSES_ROOT\.sci\DefaultIcon] +@="D:\\TRUNK\\scilab\\bin\\wscilex.exe,8" + +[HKEY_CLASSES_ROOT\.sci\print] + +[HKEY_CLASSES_ROOT\.sci\print\command] +@="\"D:\\TRUNK\\scilab\\bin\\scilex.exe\" -P \"%1\"" + +[HKEY_CLASSES_ROOT\.sci\Run with Scilab 5.0-SVN] + +[HKEY_CLASSES_ROOT\.sci\Run with Scilab 5.0-SVN\command] +@="\"d:\\TRUNK\\scilab\\bin\\wscilex.exe\" -X \"%1\"" + +[HKEY_CLASSES_ROOT\.sci\shell] + +[HKEY_CLASSES_ROOT\.sci\shell\open] + +[HKEY_CLASSES_ROOT\.sci\shell\open\command] +@="\"D:\\TRUNK\\scilab\\bin\\wscilex.exe\" -O \"%1\"" + diff --git a/modules/windows_tools/src/c/scilab_windows/resource.h b/modules/windows_tools/src/c/scilab_windows/resource.h new file mode 100755 index 000000000..475683b20 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/resource.h @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) INRIA - Allan CORNET +// Copyright (C) DIGITEO - 2012 - Allan CORNET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, whic +// you should have received as part of this distribution. The terms +// are also available at +// +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by scilab_windows.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 106 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1006 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/modules/windows_tools/src/c/scilab_windows/scilab_main.c b/modules/windows_tools/src/c/scilab_windows/scilab_main.c new file mode 100755 index 000000000..3f132ac1e --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/scilab_main.c @@ -0,0 +1,99 @@ +/* +* 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 <Windows.h> +#include <stdio.h> +#include <setjmp.h> +#include <signal.h> + +#include "scilab_main.h" +#include "scilabmode.h" +#include "realmain.h" +#include "sciprint.h" +#include "sciquit.h" +#include "LaunchScilabSignal.h" +/*--------------------------------------------------------------------------*/ +static void interrupt_setup (void); +static void interrupt (int an_int); +/*--------------------------------------------------------------------------*/ +jmp_buf env; +/*--------------------------------------------------------------------------*/ +int sci_windows_main ( int *nos, char *path, InitScriptType pathtype, int *lpath, int memory) +{ + InitializeLaunchScilabSignal(); + setbuf (stderr, (char *) NULL); + if (!setjmp (env)) + { + /* first time */ + interrupt_setup (); + } + /* take commands from stdin */ + return realmain(*nos, path, pathtype, memory); +} +/*--------------------------------------------------------------------------*/ +/* Set up to catch interrupts */ +static void interrupt_setup (void) +{ + (void) signal (SIGINT, interrupt); +} +/*--------------------------------------------------------------------------*/ +void interrupt (int an_int) +{ + (void) signal (SIGINT, interrupt); + (void) signal (SIGFPE, SIG_DFL); /* turn off FPE trapping */ + (void) fflush (stdout); + sciprint ("\n"); + longjmp (env, TRUE); /* return to prompt */ +} +/*--------------------------------------------------------------------------*/ +void sci_clear_and_exit(int n) /* used with handlers */ +{ +#ifdef _DEBUG + char Message[256]; + switch (n) + { + case SIGINT: + wsprintf(Message, "SIGINT Signal detected"); + break; + case SIGILL: + wsprintf(Message, "SIGILL Signal detected"); + break; + case SIGFPE: + wsprintf(Message, "SIGFPE Signal detected"); + break; + case SIGSEGV: + wsprintf(Message, "SIGSEGV Signal detected"); + break; + case SIGTERM: + wsprintf(Message, "SIGTERM Signal detected"); + break; + case SIGBREAK: + wsprintf(Message, "SIGBREAK Signal detected"); + break; + case SIGABRT: + wsprintf(Message, "SIGABRT Signal detected"); + break; + default: + wsprintf(Message, "Unknown Signal detected"); + break; + } + MessageBox(NULL, Message, "ERROR", MB_ICONWARNING); +#else + /* + MessageBox(NULL,"Scilab has performed a illegal operation\nand will be shutdown.\n Please save your work ...", + "Warning",MB_ICONWARNING); + */ +#endif + sciquit(); +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/scilab_main.h b/modules/windows_tools/src/c/scilab_windows/scilab_main.h new file mode 100755 index 000000000..43e23e797 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/scilab_main.h @@ -0,0 +1,31 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __SCILAB_MAIN__H__ +#define __SCILAB_MAIN__H__ + +#include "dynlib_scilab_windows.h" +#include "realmain.h" /* InitScriptType */ + +/** +* common main for windows +* @param[in] no startup +* @param[in] path script +* @param[in] path type +* @param[in] size path +* @param[in] stacksize +*/ +SCILAB_WINDOWS_IMPEXP int sci_windows_main ( int *nos, char *path, InitScriptType pathtype, int *lpath, int memory); + +#endif /* __SCILAB_MAIN__H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/scilab_windows.rc b/modules/windows_tools/src/c/scilab_windows/scilab_windows.rc new file mode 100755 index 000000000..97e82a5b2 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/scilab_windows.rc @@ -0,0 +1,93 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include <windows.h> + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 5,5,2,0 + PRODUCTVERSION 5,5,2,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x0L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040c04b0" + BEGIN + VALUE "FileDescription", "Scilab for Windows" + VALUE "FileVersion", "5, 5, 2, 0" + VALUE "InternalName", "Scilab for Windows" + VALUE "LegalCopyright", "Copyright (C) 2017" + VALUE "OriginalFilename", "scilab_windows.dll" + VALUE "ProductName", "scilab_windows" + VALUE "ProductVersion", "5, 5, 2, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40c, 1200 + END +END + +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/modules/windows_tools/src/c/scilab_windows/scilab_windows.vcxproj b/modules/windows_tools/src/c/scilab_windows/scilab_windows.vcxproj new file mode 100755 index 000000000..1a1274ee7 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/scilab_windows.vcxproj @@ -0,0 +1,295 @@ +<?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"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{8028F371-6A94-4A26-8804-6E7F05F1D1AA}</ProjectGuid> + <RootNamespace>scilab_windows</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>.;..;../../../includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../../string/includes</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCILAB_WINDOWS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Gui_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scigui.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;scilocalization.lib;scigui.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>.;..;../../../includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../../string/includes</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCILAB_WINDOWS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Gui_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scigui.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;scilocalization.lib;scigui.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <WholeProgramOptimization>false</WholeProgramOptimization> + <AdditionalIncludeDirectories>.;..;../../../includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../../string/includes</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCILAB_WINDOWS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Gui_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scigui.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;scilocalization.lib;scigui.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <LinkTimeCodeGeneration> + </LinkTimeCodeGeneration> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <WholeProgramOptimization>false</WholeProgramOptimization> + <AdditionalIncludeDirectories>.;..;../../../includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../../string/includes</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCILAB_WINDOWS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Gui_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scigui.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;scilocalization.lib;scigui.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <LinkTimeCodeGeneration> + </LinkTimeCodeGeneration> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="buildMainWindowTitle_Windows.c" /> + <ClCompile Include="console.c" /> + <ClCompile Include="console_main.c" /> + <ClCompile Include="ConvertSlash.c" /> + <ClCompile Include="DllmainScilab_Windows.c" /> + <ClCompile Include="FilesAssociations.c" /> + <ClCompile Include="FindScilab.c" /> + <ClCompile Include="FocusOnConsole.c" /> + <ClCompile Include="forbiddenToUseScilab.c" /> + <ClCompile Include="getBlasType.c" /> + <ClCompile Include="getScilabDirectory.c" /> + <ClCompile Include="getVideoAdapters.c" /> + <ClCompile Include="InnosetupMutex.c" /> + <ClCompile Include="killScilabProcess.c" /> + <ClCompile Include="mmapWindows.c" /> + <ClCompile Include="MutexClosingScilab.c" /> + <ClCompile Include="scilab_main.c" /> + <ClCompile Include="SetScilabEnvironmentVariables.c" /> + <ClCompile Include="spawncommand.c" /> + <ClCompile Include="splashScreen.cpp" /> + <ClCompile Include="strdup_windows.c" /> + <ClCompile Include="TextToPrint.c" /> + <ClCompile Include="windows_main.c" /> + <ClCompile Include="WindowShow.c" /> + <ClCompile Include="wmcopydata.c" /> + <ClCompile Include="WndThread.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="buildMainWindowTitle_Windows.h" /> + <ClInclude Include="console.h" /> + <ClInclude Include="console_main.h" /> + <ClInclude Include="..\..\..\includes\ConvertSlash.h" /> + <ClInclude Include="dynlib_scilab_windows.h" /> + <ClInclude Include="FilesAssociations.h" /> + <ClInclude Include="FindScilab.h" /> + <ClInclude Include="..\..\..\includes\FocusOnConsole.h" /> + <ClInclude Include="forbiddenToUseScilab.h" /> + <ClInclude Include="getBlasType.h" /> + <ClInclude Include="getScilabDirectory.h" /> + <ClInclude Include="getVideoAdapters.h" /> + <ClInclude Include="InnosetupMutex.h" /> + <ClInclude Include="killScilabProcess.h" /> + <ClInclude Include="mmapWindows.h" /> + <ClInclude Include="..\..\..\includes\MutexClosingScilab.h" /> + <ClInclude Include="resource.h" /> + <ClInclude Include="scilab_main.h" /> + <ClInclude Include="SetHeapOptions.h" /> + <ClInclude Include="SetScilabEnvironmentVariables.h" /> + <ClInclude Include="spawncommand.h" /> + <ClInclude Include="splashScreen.h" /> + <ClInclude Include="..\..\..\includes\strdup_windows.h" /> + <ClInclude Include="TextToPrint.h" /> + <ClInclude Include="windows_main.h" /> + <ClInclude Include="WindowShow.h" /> + <ClInclude Include="wmcopydata.h" /> + <ClInclude Include="WndThread.h" /> + </ItemGroup> + <ItemGroup> + <None Include="Gui_Import.def" /> + <None Include="core_import.def" /> + <None Include="Localization_Import.def" /> + <None Include="windows_tools_Import.def" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="scilab_windows.rc" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\..\tools\Dumpexts\Dumpexts.vcxproj"> + <Project>{3170e4c2-1173-4264-a222-7ee8ccb3ddf7}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\..\fileio\fileio.vcxproj"> + <Project>{4fc72d4a-80ee-4b1a-8724-0201c1a35621}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\..\output_stream\src\c\output_stream.vcxproj"> + <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\..\string\src\c\string.vcxproj"> + <Project>{8d45767a-9b03-4905-97f6-d2f3f79141ea}</Project> + </ProjectReference> + <ProjectReference Include="..\windows_tools.vcxproj"> + <Project>{9594ac02-20ee-4fbf-95b4-bfa5865ed7ca}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/modules/windows_tools/src/c/scilab_windows/scilab_windows.vcxproj.filters b/modules/windows_tools/src/c/scilab_windows/scilab_windows.vcxproj.filters new file mode 100755 index 000000000..3a8ef3af9 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/scilab_windows.vcxproj.filters @@ -0,0 +1,207 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{5c5e1adc-2a57-45a2-9bcc-0d584f86aaf8}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{fe205ab9-974b-42cf-8f22-9886967a1c5c}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{36da833f-eb67-489f-a609-9921cae3b997}</UniqueIdentifier> + </Filter> + <Filter Include="Libraries Dependencies"> + <UniqueIdentifier>{c2601202-2c27-49e6-b2e5-500839247091}</UniqueIdentifier> + </Filter> + <Filter Include="Libraries Dependencies\Imports"> + <UniqueIdentifier>{f93061bc-eb15-411c-883c-7d772d9c3eed}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="buildMainWindowTitle_Windows.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="console.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="console_main.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ConvertSlash.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="DllmainScilab_Windows.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="FilesAssociations.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="FindScilab.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="FocusOnConsole.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="forbiddenToUseScilab.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="getScilabDirectory.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="InnosetupMutex.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="killScilabProcess.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="mmapWindows.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="MutexClosingScilab.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="scilab_main.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SetScilabEnvironmentVariables.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="spawncommand.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="strdup_windows.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="TextToPrint.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="windows_main.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="WindowShow.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="wmcopydata.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="WndThread.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="getBlasType.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="getVideoAdapters.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="splashScreen.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="buildMainWindowTitle_Windows.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="console.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="console_main.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\includes\ConvertSlash.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="dynlib_scilab_windows.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="FilesAssociations.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="FindScilab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\includes\FocusOnConsole.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="forbiddenToUseScilab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="getScilabDirectory.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="InnosetupMutex.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="killScilabProcess.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="mmapWindows.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\includes\MutexClosingScilab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="scilab_main.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SetHeapOptions.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SetScilabEnvironmentVariables.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spawncommand.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="splashScreen.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\includes\strdup_windows.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="TextToPrint.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="windows_main.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="WindowShow.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="wmcopydata.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="WndThread.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="getBlasType.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="getVideoAdapters.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="resource.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <None Include="Gui_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="core_import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="Localization_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="windows_tools_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="scilab_windows.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/modules/windows_tools/src/c/scilab_windows/spawncommand.c b/modules/windows_tools/src/c/scilab_windows/spawncommand.c new file mode 100755 index 000000000..c8b31b461 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/spawncommand.c @@ -0,0 +1,476 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) DIGITEO - 2010 - 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 <stdio.h> +#include "PATH_MAX.h" +#include "MALLOC.h" +#include "tmpdir.h" +#include "FileExist.h" +#include "scilabmode.h" +#include "spawncommand.h" +#include "strdup_windows.h" +#include "charEncoding.h" +#include "getshortpathname.h" +#include "strdup_windows.h" +/*--------------------------------------------------------------------------*/ +#define BUFSIZE 4096 +#define LF_STR "\n" +#define CR '\r' +#define LF '\n' +#define BLANK L' ' +#define NOTPRINTABLE -96 +#define EMPTY_CHAR L'\0' +#define CMDLINE_FORMAT_DETACHED L"%ls /A /C \"%ls\"" +#define CMDLINE_FORMAT_NOTDETACHED L"%ls /A /C \"%ls && echo DOS > %ls\"" +#define OUTPUT_CHECK_FILENAME_FORMAT L"%ls\\DOS.OK" +/*--------------------------------------------------------------------------*/ +pipeinfo SCILAB_WINDOWS_IMPEXP pipeSpawnOut = {INVALID_HANDLE_VALUE, NULL, 0}; +pipeinfo SCILAB_WINDOWS_IMPEXP pipeSpawnErr = {INVALID_HANDLE_VALUE, NULL, 0}; +/*--------------------------------------------------------------------------*/ +static int GetNumberOfLines(char *lines); +static BOOL removeEOL(char *_string); +static BOOL removeNotPrintableCharacters(char *_string); +static char *convertLine(char *_string, BOOL DetachProcess); +/*--------------------------------------------------------------------------*/ +int spawncommand(wchar_t *command, BOOL DetachProcess) +{ + wchar_t shellCmd[PATH_MAX]; + wchar_t *CmdLine = NULL; + + STARTUPINFOW si; + PROCESS_INFORMATION pi; + SECURITY_ATTRIBUTES sa; + DWORD threadID; + DWORD dwCreationFlags; + BOOL ok = FALSE; + HANDLE hProcess = NULL, h = NULL, pipeThreads[2]; + DWORD ExitCode = 0; + + if (wcscmp(command, L"") == 0) + { + // do nothing + pipeSpawnOut.NumberOfLines = 0; + pipeSpawnOut.OutputBuffer = NULL; + + pipeSpawnErr.NumberOfLines = 0; + pipeSpawnErr.OutputBuffer = NULL; + + return 1; + } + + hProcess = GetCurrentProcess(); + + ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); + ZeroMemory(&si, sizeof(STARTUPINFOW)); + si.cb = sizeof(STARTUPINFO); + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdInput = INVALID_HANDLE_VALUE; + + ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES)); + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; + + /* create a non-inheritible pipe. */ + CreatePipe(&pipeSpawnOut.pipe, &h, &sa, 0); + + /* dupe the write side, make it inheritible, and close the original. */ + DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, + 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + + /* Same as above, but for the error side. */ + CreatePipe(&pipeSpawnErr.pipe, &h, &sa, 0); + DuplicateHandle(hProcess, h, hProcess, &si.hStdError, + 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + + /* base command line */ + GetEnvironmentVariableW(L"ComSpec", shellCmd, PATH_MAX); + + if (DetachProcess) + { + int lenCmdLine = (int)(wcslen(shellCmd) + wcslen(command) + wcslen(CMDLINE_FORMAT_DETACHED)); + CmdLine = (wchar_t*) MALLOC((lenCmdLine + 1) * sizeof(wchar_t)); + swprintf(CmdLine, lenCmdLine, CMDLINE_FORMAT_DETACHED, shellCmd, command); + + dwCreationFlags = DETACHED_PROCESS; + } + else + { + int lenCmdLine = 0; + wchar_t FileTMPDir[PATH_MAX + 16]; + BOOL bConvert = FALSE; + + wchar_t *TMPDirLong = getTMPDIRW(); + + swprintf(FileTMPDir, PATH_MAX + 16, OUTPUT_CHECK_FILENAME_FORMAT, TMPDirLong); + FREE(TMPDirLong); + + if (FileExistW(FileTMPDir)) + { + DeleteFileW(FileTMPDir); + } + + lenCmdLine = (int)(wcslen(shellCmd) + wcslen(command) + wcslen(CMDLINE_FORMAT_NOTDETACHED) + + wcslen(FileTMPDir)); + CmdLine = (wchar_t*)MALLOC((lenCmdLine + 1) * sizeof(wchar_t)); + swprintf(CmdLine, lenCmdLine, CMDLINE_FORMAT_NOTDETACHED, shellCmd, command, FileTMPDir); + + dwCreationFlags = 0; + } + + ok = CreateProcessW( + NULL, /* Module name. */ + CmdLine, /* Command line. */ + NULL, /* Process handle not inheritable. */ + NULL, /* Thread handle not inheritable. */ + TRUE, /* yes, inherit handles. */ + dwCreationFlags, /* No console for you. */ + NULL, /* Use parent's environment block. */ + NULL, /* Use parent's starting directory. */ + &si, /* Pointer to STARTUPINFO structure. */ + &pi); /* Pointer to PROCESS_INFORMATION structure. */ + + if (!ok) + { + return 2; + } + + if (CmdLine) + { + FREE(CmdLine); + CmdLine = NULL; + } + + /* close our references to the write handles that have now been inherited. */ + CloseHandle(si.hStdOutput); + CloseHandle(si.hStdError); + + WaitForInputIdle(pi.hProcess, 5000); + CloseHandle(pi.hThread); + + /* start the pipe reader threads. */ + pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &pipeSpawnOut, 0, &threadID); + pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &pipeSpawnErr, 0, &threadID); + + /* block waiting for the process to end. */ + WaitForSingleObject(pi.hProcess, INFINITE); + + if ( GetExitCodeProcess(pi.hProcess, &ExitCode) == STILL_ACTIVE ) + { + TerminateProcess(pi.hProcess, 0); + } + + CloseHandle(pi.hProcess); + + /* wait for our pipe to get done reading */ + WaitForMultipleObjects(2, pipeThreads, TRUE, 500); + CloseHandle(pipeThreads[0]); + CloseHandle(pipeThreads[1]); + + return ExitCode; +} +/*--------------------------------------------------------------------------*/ +int ClosePipeInfo (pipeinfo pipe) +{ + CloseHandle(pipe.pipe); + if (pipe.OutputBuffer) + { + FREE(pipe.OutputBuffer); + pipe.OutputBuffer = NULL; + pipe.NumberOfLines = 0; + } + return 0; +} +/*--------------------------------------------------------------------------*/ +DWORD WINAPI ReadFromPipe (LPVOID args) +{ + pipeinfo *pi = (pipeinfo *) args; + int readSoFar = 0; + DWORD dwRead; + BOOL moreOutput = TRUE; + unsigned char *op = NULL; + + pi->OutputBuffer = (unsigned char*) MALLOC(BUFSIZE); + op = pi->OutputBuffer; + + while (moreOutput) + { + BOOL bres = ReadFile( pi->pipe, op, BUFSIZE - 1, &dwRead, NULL); + + moreOutput = bres || (dwRead != 0); + + if (moreOutput) + { + readSoFar += dwRead; + pi->OutputBuffer = (unsigned char*) REALLOC(pi->OutputBuffer , readSoFar + BUFSIZE); + op = pi->OutputBuffer + readSoFar; + } + } + *op = '\0'; + return 0; +} +/*--------------------------------------------------------------------------*/ +int GetNumberOfLines(char *lines) +{ + int NumberOfLines = 0; + if (lines) + { + char *buffer = strdup(lines); + if (buffer) + { + int i = 0; + char *line = strtok(buffer, LF_STR); + + while (line) + { + line = strtok(NULL, LF_STR); + i++; + } + + NumberOfLines = i; + + FREE(buffer); + buffer = NULL; + } + if (NumberOfLines == 0) + { + NumberOfLines = 1; + } + } + return NumberOfLines; +} +/*--------------------------------------------------------------------------*/ +char **CreateOuput(pipeinfo *pipe, BOOL DetachProcess) +{ + char **OuputStrings = NULL; + if (pipe) + { + if (pipe->OutputBuffer) + { + char *buffer = strdup((const char *)(pipe->OutputBuffer)); + if (buffer) + { + pipe->NumberOfLines = GetNumberOfLines(buffer); + if (pipe->NumberOfLines) + { + OuputStrings = (char**)MALLOC((pipe->NumberOfLines) * sizeof(char*)); + if (OuputStrings) + { + char *line = strtok(buffer, LF_STR); + int i = 0; + + while (line) + { + OuputStrings[i] = convertLine(line, DetachProcess); + line = strtok(NULL, LF_STR); + i++; + if (i > pipe->NumberOfLines) + { + break; + } + } + } + } + FREE(buffer); + buffer = NULL; + } + } + } + return OuputStrings; +} +/*--------------------------------------------------------------------------*/ +BOOL DetectDetachProcessInCommandLine(wchar_t *command) +{ + BOOL bOK = FALSE; + if (command) + { + int i = (int)wcslen(command); + for (i = (int)wcslen(command) - 1; i >= 0; i--) + { + if (command[i] == BLANK) + { + command[i] = EMPTY_CHAR; + } + else + { + break; + } + } + i = (int)wcslen(command); + if ( (i > 0) && (command[i - 1] == L'&') ) + { + bOK = TRUE; + } + } + return bOK; +} +/*--------------------------------------------------------------------------*/ +BOOL removeEOL(char *_string) +{ + if (_string) + { + int len = (int)strlen(_string); + if ( (_string[len - 1] == CR) || (_string[len - 1] == LF) ) + { + _string[len - 1] = EMPTY_CHAR; + return TRUE; + } + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ +BOOL removeNotPrintableCharacters(char *_string) +{ + if (_string) + { + int j = 0; + int len = (int)strlen(_string); + BOOL bRemove = FALSE; + for (j = 0; j < len; j++) + { + /* remove some no printable characters */ + if (_string[j] == NOTPRINTABLE) + { + _string[j] = BLANK; + bRemove = TRUE; + } + } + return bRemove; + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ +char *convertLine(char *_string, BOOL DetachProcess) +{ + char *convertedString = NULL; + if (_string) + { + convertedString = strdup(_string); + + if (getScilabMode() == SCILAB_STD) + { + if ( (!DetachProcess) && (!IsValidUTF8(_string)) ) + { + // We need to add detection of ANSI characters + // in this case we do not convert from Oem to char + OemToChar(_string, convertedString); + } + } + else + { + // in -nw mode + // chcp 65001 (to switch cmd to UNICODE) + // and change font to Lucida (TrueType) + if ( (DetachProcess) && (!IsValidUTF8(_string)) ) + { + CharToOem(_string, convertedString); + } + } + + removeEOL(convertedString); + removeNotPrintableCharacters(convertedString); + + } + return convertedString; +} +/*--------------------------------------------------------------------------*/ +int CallWindowsShell(char *command) +{ + int returnedExitCode = -1; + + wchar_t shellCmd[PATH_MAX]; + wchar_t *CmdLine = NULL; + wchar_t * wcommand = NULL; + size_t iCmdSize = 0; + + PROCESS_INFORMATION piProcInfo; + STARTUPINFOW siStartInfo; + SECURITY_ATTRIBUTES saAttr; + + DWORD ExitCode = 0; + + wchar_t *TMPDir = NULL; + wchar_t FileTMPDir[PATH_MAX]; + + if (strcmp(command, "") == 0) + { + // do nothing + return 1; + } + + saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); + saAttr.bInheritHandle = TRUE; + saAttr.lpSecurityDescriptor = NULL; + + ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) ); + + ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) ); + siStartInfo.cb = sizeof(STARTUPINFO); + siStartInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; + siStartInfo.wShowWindow = SW_HIDE; + siStartInfo.hStdInput = NULL; + + siStartInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); + siStartInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE); + + GetEnvironmentVariableW(L"ComSpec", shellCmd, PATH_MAX); + TMPDir = getTMPDIRW(); + swprintf(FileTMPDir, PATH_MAX, L"%s\\DOS.OK", TMPDir); + if (TMPDir) + { + FREE(TMPDir); + TMPDir = NULL; + } + + wcommand = to_wide_string(command); + iCmdSize = (wcslen(shellCmd) + wcslen(wcommand) + wcslen(FileTMPDir) + wcslen(L"%s /a /c \"%s\" && echo DOS>%s") + 1); + CmdLine = (wchar_t*)MALLOC(iCmdSize * sizeof(wchar_t)); + swprintf(CmdLine, iCmdSize, L"%s /a /c \"%s\" && echo DOS>%s", shellCmd, wcommand, FileTMPDir); + + if (CreateProcessW(NULL, CmdLine, NULL, NULL, TRUE, 0, NULL, NULL, &siStartInfo, &piProcInfo)) + { + WaitForSingleObject(piProcInfo.hProcess, INFINITE); + + if ( GetExitCodeProcess(piProcInfo.hProcess, &ExitCode) == STILL_ACTIVE ) + { + TerminateProcess(piProcInfo.hProcess, 0); + } + + CloseHandle(piProcInfo.hProcess); + + if (CmdLine) + { + FREE(CmdLine); + CmdLine = NULL; + } + + if (FileExistW(FileTMPDir)) + { + DeleteFileW(FileTMPDir); + } + + returnedExitCode = (int)ExitCode; + } + else + { + CloseHandle(piProcInfo.hProcess); + if (CmdLine) + { + FREE(CmdLine); + CmdLine = NULL; + } + } + return returnedExitCode; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/spawncommand.h b/modules/windows_tools/src/c/scilab_windows/spawncommand.h new file mode 100755 index 000000000..fbbfa1431 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/spawncommand.h @@ -0,0 +1,79 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) DIGITEO - 2010 - 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __SPAWNCOMMAND_H__ +#define __SPAWNCOMMAND_H__ +/*--------------------------------------------------------------------------*/ +#include <Windows.h> +#include "dynlib_scilab_windows.h" +#include "BOOL.h" /* BOOL */ +/*--------------------------------------------------------------------------*/ +typedef struct pipeinfo +{ + HANDLE pipe; + unsigned char *OutputBuffer; + int NumberOfLines; +} pipeinfo; + +#ifndef SCILAB_WINDOWS_EXPORTS +pipeinfo SCILAB_WINDOWS_IMPEXP pipeSpawnOut; +pipeinfo SCILAB_WINDOWS_IMPEXP pipeSpawnErr; +#endif +/*--------------------------------------------------------------------------*/ +/** +* spawn a command +* @param[in] command +* @param[in] DetachProcess (if we want detach to scilab process) +* @return 0 +*/ +SCILAB_WINDOWS_IMPEXP int spawncommand(wchar_t *command, BOOL DetachProcess); + +/** +* ReadFromPipe (in or out) +* @param[in] pipe handle +* @return 0 +*/ +SCILAB_WINDOWS_IMPEXP DWORD WINAPI ReadFromPipe (LPVOID args); + +/** +* check if we have a '&' (detach process) +* @param[in] command +* @return TRUE or FALSE +*/ +SCILAB_WINDOWS_IMPEXP BOOL DetectDetachProcessInCommandLine(wchar_t *command); + +/** +* CreateOuput +* @param[in] pipe +* @param[in] DetachProcess +* @return output +*/ +SCILAB_WINDOWS_IMPEXP char **CreateOuput(pipeinfo *pipe, BOOL DetachProcess); + +/** +* Close pipe +* @param[in] pipe +* @return 0 +*/ +SCILAB_WINDOWS_IMPEXP int ClosePipeInfo (pipeinfo pipe); + +/** +* Call cmd.exe windows shell +* @param[in] command to execute +* @param[out] exit code returned by cmd +*/ +SCILAB_WINDOWS_IMPEXP int CallWindowsShell(char *command); + +#endif /* __SPAWNCOMMAND_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/splashScreen.cpp b/modules/windows_tools/src/c/scilab_windows/splashScreen.cpp new file mode 100755 index 000000000..6efcb380b --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/splashScreen.cpp @@ -0,0 +1,231 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) DIGITEO - 2012 - 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 +* +*/ +/*--------------------------------------------------------------------------*/ +#pragma comment (lib, "gdiplus.lib") +/*--------------------------------------------------------------------------*/ +#include <Windows.h> +#include <stdio.h> +#include <string> +#include <CommCtrl.h> +#include <GdiPlus.h> +extern "C" +{ +#include "splashScreen.h" +#include "localization.h" +#include "resource.h" +#include "version.h" +#include "WndThread.h" +#include "charEncoding.h" +#include "getScilabDirectory.h" +#include "InnosetupMutex.h" +#include "MALLOC.h" +}; +/*--------------------------------------------------------------------------*/ +#define SPLASH_WINDOW_CLASSNAME "Scilab splashscreen" +#define FORMAT_FULLPATH_SPLASH_IMAGE "%s/modules/gui/images/icons/aboutScilab.png" +/*--------------------------------------------------------------------------*/ +static DWORD WINAPI ThreadSplashScreen(LPVOID lpParam); +static BOOL stopSplashScreen(UINT _time, UINT _timeMax); +static BOOL haveConsoleWindow(void); +/*--------------------------------------------------------------------------*/ +static UINT timeSplashScreen = 0; +static Gdiplus::Image* pImage = NULL; +/*--------------------------------------------------------------------------*/ +void splashScreen(void) +{ + DWORD dwThreadId, dwThrdParam = 0; + + if (!haveConsoleWindow() && !haveInnosetupMutex()) + { + HANDLE hThreadSplashScreen = CreateThread(NULL, 0, ThreadSplashScreen, &dwThrdParam, 0, &dwThreadId); + } +} +/*--------------------------------------------------------------------------*/ +LRESULT CALLBACK SplashWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_PAINT: + { + if (pImage) + { + Gdiplus::Graphics gdip(hwnd); + gdip.DrawImage(pImage, 0, 0, pImage->GetWidth(), pImage->GetHeight()); + } + ValidateRect(hwnd, NULL); + return 0; + } + break; + case WM_DESTROY: + { + if (pImage) + { + delete pImage; + pImage = NULL; + } + } + } + + return DefWindowProc(hwnd, uMsg, wParam, lParam); +} +/*--------------------------------------------------------------------------*/ +static DWORD WINAPI ThreadSplashScreen(LPVOID lpParam) +{ + char *ScilabDirectory = NULL; + char *ImageFilename = NULL; + wchar_t *wImageFilename = NULL; + + size_t len = 0; + Gdiplus::GdiplusStartupInput gdiplusStartupInput; + + ULONG_PTR gdiplusToken = NULL; + Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + HINSTANCE hInstanceThisDll = (HINSTANCE)GetModuleHandle("scilab_windows"); + + ScilabDirectory = getScilabDirectory(TRUE); + if (ScilabDirectory == NULL) + { + return 0; + } + + len = strlen(FORMAT_FULLPATH_SPLASH_IMAGE) + strlen(ScilabDirectory) + 1; + ImageFilename = (char*)MALLOC(sizeof(char) * len); + if (ImageFilename == NULL) + { + return 0; + } + + sprintf(ImageFilename, FORMAT_FULLPATH_SPLASH_IMAGE, ScilabDirectory); + FREE(ScilabDirectory); + ScilabDirectory = NULL; + + wImageFilename = to_wide_string(ImageFilename); + FREE(ImageFilename); + ImageFilename = NULL; + if (wImageFilename == NULL) + { + return 0; + } + + pImage = Gdiplus::Image::FromFile((const WCHAR *)wImageFilename); + FREE(wImageFilename); + wImageFilename = NULL; + if (pImage == NULL) + { + return 0; + } + + WNDCLASS wndcls = {0}; + + wndcls.style = CS_HREDRAW | CS_VREDRAW; + wndcls.lpfnWndProc = SplashWndProc; + wndcls.hInstance = GetModuleHandle(NULL); + wndcls.hCursor = LoadCursor(NULL, IDC_APPSTARTING); + wndcls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); + wndcls.lpszClassName = SPLASH_WINDOW_CLASSNAME; + wndcls.hIcon = LoadIcon(wndcls.hInstance, (char*)MAKEINTRESOURCE(IDI_APPLICATION)); + + if (!RegisterClass(&wndcls)) + { + if (GetLastError() != 0x00000582) // already registered + { + return 0; + } + } + + // try to find monitor where mouse was last time + POINT point = {0}; + MONITORINFO mi = {sizeof(MONITORINFO), 0}; + HMONITOR hMonitor = 0; + RECT rcArea = {0}; + + ::GetCursorPos(&point); + hMonitor = ::MonitorFromPoint(point, MONITOR_DEFAULTTONEAREST); + if (::GetMonitorInfo(hMonitor, &mi)) + { + rcArea.left = (mi.rcMonitor.right + mi.rcMonitor.left - pImage->GetWidth()) / 2; + rcArea.top = (mi.rcMonitor.top + mi.rcMonitor.bottom - pImage->GetHeight()) / 2; + } + else + { + SystemParametersInfo(SPI_GETWORKAREA, NULL, &rcArea, NULL); + rcArea.left = (rcArea.right + rcArea.left - pImage->GetWidth()) / 2; + rcArea.top = (rcArea.top + rcArea.bottom - pImage->GetHeight()) / 2; + } + + HWND hdlg = CreateWindowEx(WS_EX_TOOLWINDOW, + SPLASH_WINDOW_CLASSNAME, + SPLASH_WINDOW_CLASSNAME, + WS_CLIPCHILDREN | WS_POPUP, + rcArea.left, + rcArea.top, + pImage->GetWidth(), + pImage->GetHeight(), + NULL, + NULL, + wndcls.hInstance, + NULL); + + if (hdlg == NULL) + { + return 0; + } + + ShowWindow(hdlg, SW_SHOWNORMAL); + UpdateWindow(hdlg); + SetWindowPos(hdlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + + while (!stopSplashScreen(20, 1000)) + { + Sleep(20); + } + + DestroyWindow(hdlg); + return 0; +} +/*--------------------------------------------------------------------------*/ +static BOOL stopSplashScreen(UINT _time, UINT _timeMax) +{ + if (haveConsoleWindow() || (timeSplashScreen >= _timeMax)) + { + return TRUE; + } + else + { + if (timeSplashScreen < _timeMax) + { + timeSplashScreen = timeSplashScreen + _time; + } + } + return FALSE; +} +/*--------------------------------------------------------------------------*/ +static BOOL haveConsoleWindow(void) +{ + HWND hWndMainScilab = NULL; + char titleMainWindow[MAX_PATH]; + int id = getCurrentScilabId(); + + wsprintf(titleMainWindow, "%s (%d)", SCI_VERSION_STRING, id); + hWndMainScilab = FindWindow(NULL, titleMainWindow); + + if (hWndMainScilab == NULL) + { + wsprintf(titleMainWindow, _("Scilab %s Console"), std::string(SCI_VERSION_STRING).substr(strlen("scilab-"), std::string::npos).c_str()); + hWndMainScilab = FindWindow(NULL, titleMainWindow); + } + + return (hWndMainScilab == NULL) ? FALSE : TRUE; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/splashScreen.h b/modules/windows_tools/src/c/scilab_windows/splashScreen.h new file mode 100755 index 000000000..36a6f88b5 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/splashScreen.h @@ -0,0 +1,23 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __SPLASHSCREEN_H__ +#define __SPLASHSCREEN_H__ + +#include "dynlib_scilab_windows.h" + +/* Display splashscreen */ +SCILAB_WINDOWS_IMPEXP void splashScreen(void); + +#endif /* __SPLASHSCREEN_H__ */ +/*--------------------------------------------------------------------------*/
\ No newline at end of file diff --git a/modules/windows_tools/src/c/scilab_windows/strdup_windows.c b/modules/windows_tools/src/c/scilab_windows/strdup_windows.c new file mode 100755 index 000000000..92a56cf6d --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/strdup_windows.c @@ -0,0 +1,48 @@ +/* +* 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 "dynlib_scilab_windows.h" +#include "MALLOC.h" +/*--------------------------------------------------------------------------*/ +/* strdup is deprecated on windows*/ +/* required to fix warnings about strdup */ +/*--------------------------------------------------------------------------*/ +SCILAB_WINDOWS_IMPEXP char *strdup_windows(const char *strSource) +{ + char *retStr = NULL; + if (strSource) + { + retStr = (char *)MALLOC(sizeof(char) * ((int)strlen(strSource) + 1)); + if (retStr) + { + strcpy(retStr, strSource); + } + } + return retStr; +} +/*--------------------------------------------------------------------------*/ +SCILAB_WINDOWS_IMPEXP wchar_t *wstrdup_windows(const wchar_t *strSource) +{ + wchar_t *retStr = NULL; + if (strSource) + { + retStr = (wchar_t *)MALLOC(sizeof(wchar_t) * ((int)wcslen(strSource) + 1)); + if (retStr) + { + wcscpy(retStr, strSource); + } + } + return retStr; +} +/*--------------------------------------------------------------------------*/
\ No newline at end of file diff --git a/modules/windows_tools/src/c/scilab_windows/windows_main.c b/modules/windows_tools/src/c/scilab_windows/windows_main.c new file mode 100755 index 000000000..73a2fd7f8 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/windows_main.c @@ -0,0 +1,271 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) DIGITEO - 2010-2012 - 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 <Windows.h> +#include <shellapi.h> +#include "windows_main.h" +#include "core_math.h" +#include "getcommandlineargs.h" +#include "scilabmode.h" +#include "forbiddenToUseScilab.h" +#include "realmain.h" +#include "version.h" +#include "PATH_MAX.h" +#include "getScilabDirectory.h" +#include "MALLOC.h" +#include "FilesAssociations.h" +#include "sciquit.h" +#include "scilab_main.h" +#include "stristr.h" +#include "console.h" +#include "WinConsole.h" +#include "splashScreen.h" +#include "WndThread.h" +#include "strdup_windows.h" +#include "InnosetupMutex.h" +#include "charEncoding.h" +#include "WindowShow.h" +#include "LanguagePreferences_Windows.h" +/*--------------------------------------------------------------------------*/ +#define MIN_STACKSIZE 180000 +#define WSCILEX "wscilex.exe" +/*--------------------------------------------------------------------------*/ +static LPSTR my_argv[MAXCMDTOKENS]; +static int my_argc = -1; +static int startupf = 0; /** 0 if we execute startup else 1 **/ +static int memory = MIN_STACKSIZE; +/*--------------------------------------------------------------------------*/ +extern int sci_show_banner ; +/*--------------------------------------------------------------------------*/ +int Windows_Main (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) +{ + BOOL ShortCircuitExec = FALSE; + BOOL LaunchAFile = FALSE; + char *ScilabDirectory = NULL; + LPWSTR *szArglist = NULL; + char FileName[PATH_MAX * 2]; + int nArgs = 0; + int i = 0; + int argcount = 0, lpath = 0; + InitScriptType pathtype = SCILAB_SCRIPT; + char *path = NULL; + BOOL bHideConsole = TRUE; + + forbiddenToUseScilab(); + + setScilabMode(SCILAB_STD); + setWindowShowMode(iCmdShow); + + ScilabDirectory = getScilabDirectory(FALSE); + + if (ScilabDirectory == NULL) + { + // This message must never occur, but ... + MessageBox (NULL, "ERROR" , "Cannot determine the Scilab directory (SCI).", MB_ICONSTOP | MB_OK); + exit(1); + } + else + { + FREE(ScilabDirectory); + ScilabDirectory = NULL; + } + + szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs); + if (szArglist) + { + for (i = 0; i < nArgs; i++) + { + my_argv[i] = wide_string_to_UTF8(szArglist[i]); + } + my_argc = nArgs; + LocalFree(szArglist); + } + + setCommandLineArgs(my_argv, my_argc); + + for (i = 1; i < my_argc; i++) + { + if ( (_stricmp (my_argv[i], "-NW") == 0) || (_stricmp (my_argv[i], "-NWI") == 0) || (_stricmp (my_argv[i], "-TEXMACS") == 0) || (_stricmp (my_argv[i], "-NOGUI") == 0) ) + { + MessageBox(NULL, "Not with Windows Console", "Error", MB_ICONINFORMATION); + exit(1); + } + + if ( (_stricmp (my_argv[i], "-VERSION") == 0) || + (_stricmp (my_argv[i], "-VER") == 0) ) + { + disp_scilab_version(); + exit(1); + } + + if ( (_stricmp (my_argv[i], "-H") == 0) || + (_stricmp (my_argv[i], "-?") == 0) || + (_stricmp (my_argv[i], "-HELP") == 0) ) + { + char Msg[2048]; + strcpy(Msg, "Wscilex <Options>: run Scilab.\n"); + strcat(Msg, "Arguments: passes Arguments to Scilab, This Arguments can be retreived\n by the Scilab function sciargs.\n"); + strcat(Msg, "-e Instruction: execute the scilab instruction given in Instruction argument.\n"); + strcat(Msg, "-f File: execute the scilab script given in File argument.\n"); + strcat(Msg, " '-e' and '-f' options are mutually exclusive.\n\n"); + strcat(Msg, "-l lang: it fixes the user language.\n\n" ); + strcat(Msg, "-mem N: set the initial stacksize.\n"); + strcat(Msg, "-ns: if this option is present the startup file scilab.start is not executed.\n"); + strcat(Msg, "-nb: if this option is present then Scilab loading message is not displayed.\n"); + strcat(Msg, "-nouserstartup: don't execute user startup files SCIHOME/.scilab or SCIHOME/scilab.ini.\n"); + strcat(Msg, "-nw: start Scilab without specialized Scilab Window.\n"); + strcat(Msg, "-nwni: start Scilab without user interaction (batch mode).\n"); + strcat(Msg, "-nogui: start Scilab without GUI,tcl/tk and user interaction (batch mode).\n"); + strcat(Msg, "-texmacs: reserved for WinTeXMacs.\n"); + strcat(Msg, "-version: print product version and exit.\n"); + strcat(Msg, "-keepconsole: keep native console box opened.\n"); + + MessageBox(NULL, Msg, "Help", MB_ICONINFORMATION); + exit(1); + } + } + + argcount = my_argc; + if (argcount > 2) + { + if ( (_stricmp (my_argv[1], "-X") == 0) || + (_stricmp (my_argv[1], "-O") == 0) || + (_stricmp (my_argv[1], "-P") == 0) ) + { + char *Commande = NULL; + int CodeAction = -1; + + LaunchAFile = TRUE; + strcpy(FileName, my_argv[2]); + + if (_stricmp (my_argv[1], "-O") == 0) + { + CodeAction = 0; + } + if (_stricmp (my_argv[1], "-X") == 0) + { + CodeAction = 1; + } + if (_stricmp (my_argv[1], "-P") == 0) + { + CodeAction = 2; + } + + Commande = (char*)MALLOC(((PATH_MAX * 2) + 1) * sizeof(char)); + strcpy(Commande, "empty"); + CommandByFileExtension(FileName, CodeAction, Commande); + + if ( + ( ( IsAScicosFile(FileName) == TRUE ) && (CodeAction == 1) ) || + ( ( IsABinOrSavFile(FileName) == TRUE ) && (CodeAction == 1) ) || + ( ( IsASciNotesFile(FileName) == TRUE ) ) + ) + { + my_argc = -1; + my_argv[++my_argc] = Commande; + argcount = my_argc; + ShortCircuitExec = TRUE; + } + else + { + my_argc = -1; + my_argv[++my_argc] = strtok (Commande, " "); + while (my_argv[my_argc] != NULL) + { + my_argv[++my_argc] = strtok(NULL, " "); + } + argcount = my_argc; + } + } + } + + + if ( ShortCircuitExec == TRUE) + { + char PathWScilex[PATH_MAX * 2]; + int lenPathWScilex = 0; + GetModuleFileName ((HINSTANCE)GetModuleHandle(NULL), PathWScilex, PATH_MAX); + lenPathWScilex = (int)strlen(PathWScilex); + path = my_argv[argcount] + lenPathWScilex + 3; + lpath = (int)strlen (my_argv[argcount] + lenPathWScilex + 3); + pathtype = SCILAB_CODE; + LaunchAFile = TRUE; + } + else while (argcount > 0) + { + char ArgTmp[PATH_MAX * 2]; + + argcount--; + strcpy(ArgTmp, my_argv[argcount]); + + if (_stricmp (ArgTmp, "-NS") == 0) + { + startupf = 1; + } + else if ( _stricmp(ArgTmp, "-NB") == 0) + { + sci_show_banner = 0; + } + else if (_stricmp (ArgTmp, "-F") == 0 && argcount + 1 < my_argc) + { + path = my_argv[argcount + 1]; + lpath = (int)strlen (my_argv[argcount + 1]); + } + else if (_stricmp (ArgTmp, "-E") == 0 && argcount + 1 < my_argc) + { + path = my_argv[argcount + 1]; + lpath = (int)strlen (my_argv[argcount + 1]); + pathtype = SCILAB_CODE; + } + else if ( _stricmp(ArgTmp, "-MEM") == 0 && argcount + 1 < my_argc) + { + memory = Max(atoi( my_argv[argcount + 1]), MIN_STACKSIZE ); + } + else if ( _stricmp(ArgTmp, "-L") == 0 && argcount + 1 < my_argc) + { + char *language = my_argv[argcount + 1]; + setLanguageFromCommandLine(language); + } + else if ( _stricmp(ArgTmp, "-keepconsole") == 0) + { + bHideConsole = FALSE; + } + } + +#ifndef _DEBUG + if ( (iCmdShow != SW_HIDE) && (iCmdShow != SW_MINIMIZE) && (iCmdShow != SW_SHOWMINNOACTIVE) ) + { + if ( (sci_show_banner) && (LaunchAFile == FALSE) ) + { + splashScreen(); + } + } +#endif + + CreateScilabHiddenWndThread(); + CreateScilabConsole(sci_show_banner); + + if (bHideConsole) + { + HideScilex(); /* hide console window */ + } + else + { + ShowScilex(); + } + + createInnosetupMutex(); + return sci_windows_main (&startupf, path, (InitScriptType)pathtype, &lpath, memory); +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/windows_main.h b/modules/windows_tools/src/c/scilab_windows/windows_main.h new file mode 100755 index 000000000..26bca09b7 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/windows_main.h @@ -0,0 +1,31 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __WINDOWS_MAIN_H__ +#define __WINDOWS_MAIN_H__ + +#include <Windows.h> +#include "dynlib_scilab_windows.h" + +/** +* Main for scilab with GUI +* @param [in] current instance of the application. +* @param [in] previous instance of the application +* @param [in] command line for the application +* @param [in] Specifies how the window is to be shown +* @return 0 +*/ +SCILAB_WINDOWS_IMPEXP int Windows_Main (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow); + +#endif /* __WINDOWS_MAIN_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/windows_tools_Import.def b/modules/windows_tools/src/c/scilab_windows/windows_tools_Import.def new file mode 100755 index 000000000..2351b305f --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/windows_tools_Import.def @@ -0,0 +1,6 @@ +LIBRARY windows_tools.dll + + +EXPORTS +;windows_tools +SetConsoleState
\ No newline at end of file diff --git a/modules/windows_tools/src/c/scilab_windows/wmcopydata.c b/modules/windows_tools/src/c/scilab_windows/wmcopydata.c new file mode 100755 index 000000000..bc14efe28 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/wmcopydata.c @@ -0,0 +1,92 @@ +/* +* 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 "wmcopydata.h" +/*--------------------------------------------------------------------------*/ +static char LineFromAnotherScilab[PATH_MAX]; +static BOOL ReceiveDatafromAnotherScilab = FALSE; +static char TitleScilabSend[PATH_MAX]; +/*--------------------------------------------------------------------------*/ +BOOL GetCommandFromAnotherScilab(char *TitleWindowSend, char *CommandLine) +{ + BOOL Retour = FALSE; + + if (ReceiveDatafromAnotherScilab) + { + if (wsprintf(CommandLine, "%s", LineFromAnotherScilab) <= 0) + { + return FALSE; + } + wsprintf(TitleWindowSend, "%s", TitleScilabSend); + + ReceiveDatafromAnotherScilab = FALSE; + Retour = TRUE; + } + else + { + Retour = FALSE; + } + + return Retour; +} +/*--------------------------------------------------------------------------*/ +BOOL SendCommandToAnotherScilab(char *ScilabWindowNameSource, char *ScilabWindowNameDestination, char *CommandLine) +{ + COPYDATASTRUCT MyCDS; + MYREC MyRec; + HWND hWndSource = NULL; + HWND hWndDestination = NULL; + + if (wsprintf(MyRec.CommandFromAnotherScilab, "%s", CommandLine) <= 0) + { + return FALSE; + } + + MyCDS.dwData = 0; + MyCDS.cbData = sizeof( MyRec ); + MyCDS.lpData = &MyRec; + + hWndSource = FindWindow(NULL, ScilabWindowNameSource); + hWndDestination = FindWindow(NULL, ScilabWindowNameDestination); + + if ( (hWndDestination != NULL) ) + { + SendMessage( hWndDestination, + WM_COPYDATA, + (WPARAM)(HWND) hWndDestination, + (LPARAM) (LPVOID) &MyCDS ); + } + else + { + return FALSE; + } + + return TRUE; +} +/*--------------------------------------------------------------------------*/ +BOOL ReceiveFromAnotherScilab(HWND hWndSend, PCOPYDATASTRUCT MyCopyDataStruct) +{ + BOOL Retour = FALSE; + + if (wsprintf(LineFromAnotherScilab, "%s", (LPSTR) ((MYREC *)(MyCopyDataStruct->lpData))->CommandFromAnotherScilab) <= 0) + { + return FALSE; + } + + GetWindowText(hWndSend, TitleScilabSend, PATH_MAX); + ReceiveDatafromAnotherScilab = TRUE; + Retour = TRUE; + + return Retour; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows/wmcopydata.h b/modules/windows_tools/src/c/scilab_windows/wmcopydata.h new file mode 100755 index 000000000..0b7b549c9 --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows/wmcopydata.h @@ -0,0 +1,54 @@ +/* +* 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 +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __WMCOPYDATA_H__ +#define __WMCOPYDATA_H__ + +#include <windows.h> +#include "dynlib_scilab_windows.h" +#include "PATH_MAX.h" +#include "BOOL.h" + +typedef struct tagMYREC +{ + char CommandFromAnotherScilab[PATH_MAX]; +} +MYREC; + +/** +* Send a command to another Scilab +* @param[in] Title Window source +* @param[in] Title Window destination +* @param[in] command to send +* @return TRUE or FALSE +*/ +SCILAB_WINDOWS_IMPEXP BOOL SendCommandToAnotherScilab(char *ScilabWindowNameSource, char *ScilabWindowNameDestination, char *CommandLine); + +/** +* Get a command from another scilab +* @param[in] Title +* @param[in] command to send +* @return TRUE or FALSE +*/ +SCILAB_WINDOWS_IMPEXP BOOL GetCommandFromAnotherScilab(char *TitleWindowSend, char *CommandLine); + +/** +* Receive data from another scilab +* @param[in] Handle on Window +* @param[in] COPYDATASTRUCT +* @return TRUE or FALSE +*/ +SCILAB_WINDOWS_IMPEXP BOOL ReceiveFromAnotherScilab(HWND hWndSend, PCOPYDATASTRUCT MyCopyDataStruct); + +#endif /*__WMCOPYDATA_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/scilab_windows_Import.def b/modules/windows_tools/src/c/scilab_windows_Import.def new file mode 100755 index 000000000..62f018bbd --- /dev/null +++ b/modules/windows_tools/src/c/scilab_windows_Import.def @@ -0,0 +1,19 @@ +LIBRARY scilab_windows.dll + + +EXPORTS +; --------------------------------------- +; scilab_windows +; --------------------------------------- +strdup_windows +ClosePipeInfo +pipeSpawnOut +CreateOuput +pipeSpawnErr +spawncommand +DetectDetachProcessInCommandLine +RestoreExitButton +RestoreConsoleColors +closeInnosetupMutex +CloseScilabConsole +getScilexConsoleName diff --git a/modules/windows_tools/src/c/windows_tools.rc b/modules/windows_tools/src/c/windows_tools.rc new file mode 100755 index 000000000..5ea52b601 --- /dev/null +++ b/modules/windows_tools/src/c/windows_tools.rc @@ -0,0 +1,97 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +//#include "afxres.h" +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 5,5,2,0 + PRODUCTVERSION 5,5,2,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x0L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040c04b0" + BEGIN + VALUE "FileDescription", "windows_tools module" + VALUE "FileVersion", "5, 5, 2, 0" + VALUE "InternalName", "windows_tools module" + VALUE "LegalCopyright", "Copyright (C) 2017" + VALUE "OriginalFilename", "windows_tools.dll" + VALUE "ProductName", " windows_tools" + VALUE "ProductVersion", "5, 5, 2, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40c, 1200 + END +END + +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/modules/windows_tools/src/c/windows_tools.vcxproj b/modules/windows_tools/src/c/windows_tools.vcxproj new file mode 100755 index 000000000..4d0bab0aa --- /dev/null +++ b/modules/windows_tools/src/c/windows_tools.vcxproj @@ -0,0 +1,281 @@ +<?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"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{9594AC02-20EE-4FBF-95B4-BFA5865ED7CA}</ProjectGuid> + <RootNamespace>windows_tools</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>.;../../includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilab_windows.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Call_scilab_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)call_scilab.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;scilab_windows.lib;scilocalization.lib;call_scilab.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>.;../../includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilab_windows.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Call_scilab_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)call_scilab.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;scilab_windows.lib;scilocalization.lib;call_scilab.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <WholeProgramOptimization>false</WholeProgramOptimization> + <AdditionalIncludeDirectories>.;../../includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilab_windows.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Call_scilab_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)call_scilab.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;scilab_windows.lib;scilocalization.lib;call_scilab.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <WholeProgramOptimization>false</WholeProgramOptimization> + <AdditionalIncludeDirectories>.;../../includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilab_windows.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)localization_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)scilocalization.lib" 1>NUL 2>NUL +lib /DEF:"$(ProjectDir)Call_scilab_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)call_scilab.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;scilab_windows.lib;scilocalization.lib;call_scilab.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="createGUID.c" /> + <ClCompile Include="DllmainWindows_Tools.c" /> + <ClCompile Include="FindFileAssociation.c" /> + <ClCompile Include="..\..\sci_gateway\c\gw_windows_tools.c" /> + <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" /> + <ClCompile Include="..\..\sci_gateway\c\sci_getsystemmetrics.c" /> + <ClCompile Include="..\..\sci_gateway\c\sci_istssession.c" /> + <ClCompile Include="..\..\sci_gateway\c\sci_mcisendstring.c" /> + <ClCompile Include="..\..\sci_gateway\c\sci_win64.c" /> + <ClCompile Include="..\..\sci_gateway\c\sci_winopen.c" /> + <ClCompile Include="..\..\sci_gateway\c\sci_winqueryreg.c" /> + <ClCompile Include="TerminateWindows_tools.c" /> + <ClCompile Include="WinConsole.c" /> + <ClCompile Include="winopen.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\includes\ConvertSlash.h" /> + <ClInclude Include="..\..\includes\FocusOnConsole.h" /> + <ClInclude Include="..\..\includes\MutexClosingScilab.h" /> + <ClInclude Include="..\..\includes\strdup_windows.h" /> + <ClInclude Include="createGUID.h" /> + <ClInclude Include="..\..\includes\dynlib_windows_tools.h" /> + <ClInclude Include="FindFileAssociation.h" /> + <ClInclude Include="..\..\includes\gw_windows_tools.h" /> + <ClInclude Include="httpdownloadfile.h" /> + <ClInclude Include="..\..\includes\InitializeWindows_tools.h" /> + <ClInclude Include="registry.h" /> + <ClInclude Include="resource.h" /> + <ClInclude Include="..\..\includes\TerminateWindows_tools.h" /> + <ClInclude Include="WinConsole.h" /> + <ClInclude Include="winopen.h" /> + </ItemGroup> + <ItemGroup> + <None Include="..\..\locales\windows_tools.pot" /> + <None Include="Call_scilab_Import.def" /> + <None Include="core_import.def" /> + <None Include="localization_Import.def" /> + <None Include="scilab_windows_Import.def" /> + <None Include="..\..\Makefile.am" /> + <None Include="..\..\windows_tools.iss" /> + <None Include="..\..\sci_gateway\windows_tools_gateway.xml" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="windows_tools.rc" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\libs\GetWindowsVersion\GetWindowsVersion.vcxproj"> + <Project>{982bf37f-42c4-4d37-8d14-60521b141503}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\..\tools\Dumpexts\Dumpexts.vcxproj"> + <Project>{3170e4c2-1173-4264-a222-7ee8ccb3ddf7}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\api_scilab\api_scilab.vcxproj"> + <Project>{43c5bab1-1dca-4743-a183-77e0d42fe7d0}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\fileio\fileio.vcxproj"> + <Project>{4fc72d4a-80ee-4b1a-8724-0201c1a35621}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\output_stream\src\c\output_stream.vcxproj"> + <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/modules/windows_tools/src/c/windows_tools.vcxproj.filters b/modules/windows_tools/src/c/windows_tools.vcxproj.filters new file mode 100755 index 000000000..df1b8c91e --- /dev/null +++ b/modules/windows_tools/src/c/windows_tools.vcxproj.filters @@ -0,0 +1,159 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{6b897292-8de0-4852-afaf-f445f3eb2f00}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{a19b6de5-a578-4b32-badf-de1fbf9f0773}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="localization"> + <UniqueIdentifier>{24ae625f-c135-4f8f-b127-eee116430079}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{8b8c75c2-9ebc-4ade-b38a-6790a5eb898f}</UniqueIdentifier> + </Filter> + <Filter Include="Libraries Dependencies"> + <UniqueIdentifier>{dc56d296-fa41-4dd0-aec2-a6db08bb93ae}</UniqueIdentifier> + </Filter> + <Filter Include="Libraries Dependencies\Imports"> + <UniqueIdentifier>{28fc6a90-3106-4a95-b4df-600a1c72bd91}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="createGUID.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="DllmainWindows_Tools.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="FindFileAssociation.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sci_gateway\c\gw_windows_tools.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="httpdownloadfile.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="InitializeWindows_tools.c"> + <Filter>Source Files</Filter> + </ClCompile> + <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> + <ClCompile Include="..\..\sci_gateway\c\sci_dos.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sci_gateway\c\sci_findfileassociation.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sci_gateway\c\sci_getsystemmetrics.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sci_gateway\c\sci_istssession.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sci_gateway\c\sci_mcisendstring.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sci_gateway\c\sci_win64.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sci_gateway\c\sci_winopen.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sci_gateway\c\sci_winqueryreg.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="TerminateWindows_tools.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="WinConsole.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="winopen.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="createGUID.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\includes\dynlib_windows_tools.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="FindFileAssociation.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\includes\gw_windows_tools.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="httpdownloadfile.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\includes\InitializeWindows_tools.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="registry.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="resource.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\includes\TerminateWindows_tools.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="WinConsole.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="winopen.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\includes\ConvertSlash.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\includes\FocusOnConsole.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\includes\MutexClosingScilab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\includes\strdup_windows.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <None Include="Call_scilab_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="core_import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="localization_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="scilab_windows_Import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="..\..\Makefile.am" /> + <None Include="..\..\windows_tools.iss" /> + <None Include="..\..\sci_gateway\windows_tools_gateway.xml" /> + <None Include="..\..\locales\windows_tools.pot"> + <Filter>localization</Filter> + </None> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="windows_tools.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project> diff --git a/modules/windows_tools/src/c/winopen.c b/modules/windows_tools/src/c/winopen.c new file mode 100755 index 000000000..ea685920c --- /dev/null +++ b/modules/windows_tools/src/c/winopen.c @@ -0,0 +1,51 @@ +/* +* 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 <stdio.h> +#include <Windows.h> +#include "winopen.h" +#include "expandPathVariable.h" +#include "Scierror.h" +#include "PATH_MAX.h" +#include "charEncoding.h" +#include "MALLOC.h" +/*--------------------------------------------------------------------------*/ +BOOL winopen(char *scilabfilename) +{ + BOOL bOK = FALSE; + char *filename = NULL; + wchar_t *wcfilename = NULL; + HINSTANCE error = NULL; + + filename = expandPathVariable(scilabfilename); + if (filename) + { + wcfilename = to_wide_string(filename); + FREE(filename); + filename = NULL; + if (wcfilename) + { + error = ShellExecuteW(NULL, L"open", wcfilename, NULL, NULL, SW_SHOWNORMAL); + if ( error <= (HINSTANCE)32) + { + bOK = FALSE; + } + else + { + bOK = TRUE; + } + } + } + return bOK; +} +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/c/winopen.h b/modules/windows_tools/src/c/winopen.h new file mode 100755 index 000000000..144421369 --- /dev/null +++ b/modules/windows_tools/src/c/winopen.h @@ -0,0 +1,28 @@ +/* +* 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 +* +*/ + + +/*--------------------------------------------------------------------------*/ +#ifndef __WINOPEN_H__ +#define __WINOPEN_H__ + +#include "BOOL.h" /* BOOL */ + +/** +* Opens the item specified by the filename parameter. The item can be a file or folder +* @param[in] a filename. SCI is converted +* @return TRUE or FALSE +*/ +BOOL winopen(char *scilabfilename); + +#endif /* __WINOPEN_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/windows_tools/src/nowindows_tools/.deps/.dirstamp b/modules/windows_tools/src/nowindows_tools/.deps/.dirstamp new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/modules/windows_tools/src/nowindows_tools/.deps/.dirstamp diff --git a/modules/windows_tools/src/nowindows_tools/.deps/libsciwindows_tools_la-nowindows_tools.Plo b/modules/windows_tools/src/nowindows_tools/.deps/libsciwindows_tools_la-nowindows_tools.Plo new file mode 100755 index 000000000..66cb4b6bf --- /dev/null +++ b/modules/windows_tools/src/nowindows_tools/.deps/libsciwindows_tools_la-nowindows_tools.Plo @@ -0,0 +1,21 @@ +src/nowindows_tools/libsciwindows_tools_la-nowindows_tools.lo: \ + src/nowindows_tools/nowindows_tools.c /usr/include/stdc-predef.h \ + includes/gw_windows_tools.h includes/dynlib_windows_tools.h \ + ../../modules/output_stream/includes/Scierror.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + ../../modules/output_stream/includes/do_error_number.h \ + ../../modules/core/includes/machine.h + +/usr/include/stdc-predef.h: + +includes/gw_windows_tools.h: + +includes/dynlib_windows_tools.h: + +../../modules/output_stream/includes/Scierror.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +../../modules/output_stream/includes/do_error_number.h: + +../../modules/core/includes/machine.h: diff --git a/modules/windows_tools/src/nowindows_tools/.dirstamp b/modules/windows_tools/src/nowindows_tools/.dirstamp new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/modules/windows_tools/src/nowindows_tools/.dirstamp diff --git a/modules/windows_tools/src/nowindows_tools/.libs/libsciwindows_tools_la-nowindows_tools.o b/modules/windows_tools/src/nowindows_tools/.libs/libsciwindows_tools_la-nowindows_tools.o Binary files differnew file mode 100755 index 000000000..e25e0a416 --- /dev/null +++ b/modules/windows_tools/src/nowindows_tools/.libs/libsciwindows_tools_la-nowindows_tools.o diff --git a/modules/windows_tools/src/nowindows_tools/libsciwindows_tools_la-nowindows_tools.lo b/modules/windows_tools/src/nowindows_tools/libsciwindows_tools_la-nowindows_tools.lo new file mode 100755 index 000000000..69836c53f --- /dev/null +++ b/modules/windows_tools/src/nowindows_tools/libsciwindows_tools_la-nowindows_tools.lo @@ -0,0 +1,12 @@ +# src/nowindows_tools/libsciwindows_tools_la-nowindows_tools.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libsciwindows_tools_la-nowindows_tools.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/windows_tools/src/nowindows_tools/nowindows_tools.c b/modules/windows_tools/src/nowindows_tools/nowindows_tools.c new file mode 100755 index 000000000..c71e3f342 --- /dev/null +++ b/modules/windows_tools/src/nowindows_tools/nowindows_tools.c @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------*/ +// 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 "gw_windows_tools.h" +#include "Scierror.h" +/*--------------------------------------------------------------------------*/ +int gw_windows_tools(void) +{ + Scierror(999, "Scilab windows_tools module not installed.\n"); + return 0; +} +/*--------------------------------------------------------------------------*/ + diff --git a/modules/windows_tools/src/nowindows_tools/nowindows_tools.rc b/modules/windows_tools/src/nowindows_tools/nowindows_tools.rc new file mode 100755 index 000000000..e3032f5a8 --- /dev/null +++ b/modules/windows_tools/src/nowindows_tools/nowindows_tools.rc @@ -0,0 +1,97 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +//#include "afxres.h" +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 5,5,2,0 + PRODUCTVERSION 5,5,2,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x0L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040c04b0" + BEGIN + VALUE "FileDescription", "nowindows_tools module" + VALUE "FileVersion", "5, 5, 2, 0" + VALUE "InternalName", "nowindows_tools module" + VALUE "LegalCopyright", "Copyright (C) 2017" + VALUE "OriginalFilename", "nowindows_tools.dll" + VALUE "ProductName", " nowindows_tools" + VALUE "ProductVersion", "5, 5, 2, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40c, 1200 + END +END + +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/modules/windows_tools/src/nowindows_tools/nowindows_tools.vcxproj b/modules/windows_tools/src/nowindows_tools/nowindows_tools.vcxproj new file mode 100755 index 000000000..99e780a6f --- /dev/null +++ b/modules/windows_tools/src/nowindows_tools/nowindows_tools.vcxproj @@ -0,0 +1,187 @@ +<?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"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{73E14CE1-E24C-4AFB-BD0C-BC8643730D62}</ProjectGuid> + <RootNamespace>nowindows_tools</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../core/includes;../../../output_stream/includes;../../../../libs/intl;../../../api_scilab/includes;../../includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../core/includes;../../../output_stream/includes;../../../../libs/intl;../../../api_scilab/includes;../../includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <WholeProgramOptimization>false</WholeProgramOptimization> + <AdditionalIncludeDirectories>../../../core/includes;../../../output_stream/includes;../../../../libs/intl;../../../api_scilab/includes;../../includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <WholeProgramOptimization>false</WholeProgramOptimization> + <AdditionalIncludeDirectories>../../../core/includes;../../../output_stream/includes;../../../../libs/intl;../../../api_scilab/includes;../../includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="nowindows_tools.c" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="nowindows_tools.rc" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\tools\Dumpexts\Dumpexts.vcxproj"> + <Project>{3170e4c2-1173-4264-a222-7ee8ccb3ddf7}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\output_stream\src\c\output_stream.vcxproj"> + <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/modules/windows_tools/src/nowindows_tools/nowindows_tools.vcxproj.filters b/modules/windows_tools/src/nowindows_tools/nowindows_tools.vcxproj.filters new file mode 100755 index 000000000..0eaf28523 --- /dev/null +++ b/modules/windows_tools/src/nowindows_tools/nowindows_tools.vcxproj.filters @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Libraries Dependencies"> + <UniqueIdentifier>{92cd13d4-57b2-4804-8452-fd293bc9697e}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="nowindows_tools.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="nowindows_tools.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/modules/windows_tools/src/nowindows_tools/resource.h b/modules/windows_tools/src/nowindows_tools/resource.h new file mode 100755 index 000000000..328b8d6ba --- /dev/null +++ b/modules/windows_tools/src/nowindows_tools/resource.h @@ -0,0 +1,21 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by windows_tools.rc +// 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 +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif |