diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2015-10-21 03:46:28 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2015-10-21 03:46:28 +0000 |
| commit | 9ccee73baca0fd7ecb95c90cb983133b737c6c55 (patch) | |
| tree | 66fea1e6521df31727431520fe3c1ead1896bc5d /Utilities/File2Include | |
| download | DiligentCore-9ccee73baca0fd7ecb95c90cb983133b737c6c55.tar.gz DiligentCore-9ccee73baca0fd7ecb95c90cb983133b737c6c55.zip | |
Release v1.0.0
Diffstat (limited to 'Utilities/File2Include')
| -rw-r--r-- | Utilities/File2Include/.gitignore | 2 | ||||
| -rw-r--r-- | Utilities/File2Include/File2String.cpp | 58 | ||||
| -rw-r--r-- | Utilities/File2Include/File2String.exe | bin | 0 -> 89600 bytes | |||
| -rw-r--r-- | Utilities/File2Include/File2String.sln | 22 | ||||
| -rw-r--r-- | Utilities/File2Include/File2String.vcxproj | 98 | ||||
| -rw-r--r-- | Utilities/File2Include/File2String.vcxproj.filters | 36 | ||||
| -rw-r--r-- | Utilities/File2Include/ReadMe.txt | 40 | ||||
| -rw-r--r-- | Utilities/File2Include/stdafx.cpp | 8 | ||||
| -rw-r--r-- | Utilities/File2Include/stdafx.h | 15 | ||||
| -rw-r--r-- | Utilities/File2Include/targetver.h | 8 |
10 files changed, 287 insertions, 0 deletions
diff --git a/Utilities/File2Include/.gitignore b/Utilities/File2Include/.gitignore new file mode 100644 index 00000000..f8db2d27 --- /dev/null +++ b/Utilities/File2Include/.gitignore @@ -0,0 +1,2 @@ +**/debug +**/release diff --git a/Utilities/File2Include/File2String.cpp b/Utilities/File2Include/File2String.cpp new file mode 100644 index 00000000..9b416da7 --- /dev/null +++ b/Utilities/File2Include/File2String.cpp @@ -0,0 +1,58 @@ +// File2Include.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" +#include "stdio.h" +#include "tchar.h" + +int _tmain(int argc, _TCHAR* argv[]) +{ + if( argc < 3 ) + { + printf( "Incorrect number of command line arguments. Expected arguments: src file, dst file\n"); + return -1; + } + auto SrcFile = argv[1]; + auto DstFile = argv[2]; + FILE *pSrcFile = nullptr; + if( _tfopen_s( &pSrcFile, SrcFile, _T( "r" ) ) != 0 ) + { + _tprintf( _T("Failed to open source file %s\n"), SrcFile ); + return -1; + } + + FILE *pDstFile = nullptr; + if( _tfopen_s(&pDstFile, DstFile, _T( "w" ) ) != 0 ) + { + _tprintf( _T("Failed to open destination file %s\n"), DstFile ); + fclose(pSrcFile); + return -1; + } + + + _TCHAR Buff[1024]; + _TCHAR SpecialChars[] = _T( "\'\"\\" ); + while( !feof( pSrcFile ) ) + { + auto Line = _fgetts( Buff, sizeof( Buff )/sizeof(Buff[0]) , pSrcFile ); + if( Line == nullptr ) + break; + _fputtc( _T( '\"' ), pDstFile ); + auto CurrChar = Line; + while( CurrChar && *CurrChar != '\n' ) + { + if( _tcschr( SpecialChars, *CurrChar) ) + _fputtc( _T( '\\' ), pDstFile ); + _fputtc( *CurrChar, pDstFile ); + ++CurrChar; + } + _fputts( _T("\\n\"\n"), pDstFile ); + } + + fclose(pDstFile); + fclose(pSrcFile); + + _tprintf( _T("File2String: sucessfully converted %s to %s\n"), SrcFile, DstFile ); + + return 0; +} diff --git a/Utilities/File2Include/File2String.exe b/Utilities/File2Include/File2String.exe Binary files differnew file mode 100644 index 00000000..76d799d2 --- /dev/null +++ b/Utilities/File2Include/File2String.exe diff --git a/Utilities/File2Include/File2String.sln b/Utilities/File2Include/File2String.sln new file mode 100644 index 00000000..50b94f3a --- /dev/null +++ b/Utilities/File2Include/File2String.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "File2String", "File2String.vcxproj", "{D1DEE902-0993-4FDF-8A4D-03705BC040A2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D1DEE902-0993-4FDF-8A4D-03705BC040A2}.Debug|Win32.ActiveCfg = Debug|Win32 + {D1DEE902-0993-4FDF-8A4D-03705BC040A2}.Debug|Win32.Build.0 = Debug|Win32 + {D1DEE902-0993-4FDF-8A4D-03705BC040A2}.Release|Win32.ActiveCfg = Release|Win32 + {D1DEE902-0993-4FDF-8A4D-03705BC040A2}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Utilities/File2Include/File2String.vcxproj b/Utilities/File2Include/File2String.vcxproj new file mode 100644 index 00000000..e73e3e72 --- /dev/null +++ b/Utilities/File2Include/File2String.vcxproj @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.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="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{D1DEE902-0993-4FDF-8A4D-03705BC040A2}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>File2Include</RootNamespace> + <ProjectName>File2String</ProjectName> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader>Use</PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <Text Include="ReadMe.txt" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="stdafx.h" /> + <ClInclude Include="targetver.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="File2String.cpp" /> + <ClCompile Include="stdafx.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Utilities/File2Include/File2String.vcxproj.filters b/Utilities/File2Include/File2String.vcxproj.filters new file mode 100644 index 00000000..fa46de9d --- /dev/null +++ b/Utilities/File2Include/File2String.vcxproj.filters @@ -0,0 +1,36 @@ +<?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;hh;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;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <Text Include="ReadMe.txt" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="stdafx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="targetver.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="stdafx.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="File2String.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Utilities/File2Include/ReadMe.txt b/Utilities/File2Include/ReadMe.txt new file mode 100644 index 00000000..8f5b8397 --- /dev/null +++ b/Utilities/File2Include/ReadMe.txt @@ -0,0 +1,40 @@ +======================================================================== + CONSOLE APPLICATION : File2Include Project Overview +======================================================================== + +AppWizard has created this File2Include application for you. + +This file contains a summary of what you will find in each of the files that +make up your File2Include application. + + +File2Include.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +File2Include.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +File2Include.cpp + This is the main application source file. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named File2Include.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/Utilities/File2Include/stdafx.cpp b/Utilities/File2Include/stdafx.cpp new file mode 100644 index 00000000..d7e78357 --- /dev/null +++ b/Utilities/File2Include/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// File2Include.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/Utilities/File2Include/stdafx.h b/Utilities/File2Include/stdafx.h new file mode 100644 index 00000000..b005a839 --- /dev/null +++ b/Utilities/File2Include/stdafx.h @@ -0,0 +1,15 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include <stdio.h> +#include <tchar.h> + + + +// TODO: reference additional headers your program requires here diff --git a/Utilities/File2Include/targetver.h b/Utilities/File2Include/targetver.h new file mode 100644 index 00000000..87c0086d --- /dev/null +++ b/Utilities/File2Include/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include <SDKDDKVer.h> |
