diff --git a/.gitignore b/.gitignore index f1e3d20..d163863 100644 --- a/.gitignore +++ b/.gitignore @@ -1,252 +1 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# DNX -project.lock.json -artifacts/ - -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/packages/repositories.config -# NuGet v3's project.json files produces more ignoreable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.pfx -*.publishsettings -node_modules/ -orleans.codegen.cs - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -*.mdf -*.ldf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml +build/ \ No newline at end of file diff --git a/CMake/FindNowide.cmake b/CMake/FindNowide.cmake new file mode 100644 index 0000000..aba7b0b --- /dev/null +++ b/CMake/FindNowide.cmake @@ -0,0 +1,13 @@ +# Nowide_FOUND +# Nowide_INCLUDE_DIRS + +find_path(Nowide_INCLUDE_DIR boost/nowide/convert.hpp + /usr/local/include + /usr/include +) + +set(Nowide_INCLUDE_DIR ${Nowide_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Nowide DEFAULT_MSG Nowide_INCLUDE_DIR) +mark_as_advanced(Nowide_FOUND Nowide_INCLUDE_DIR) \ No newline at end of file diff --git a/CMake/FindTCLAP.cmake b/CMake/FindTCLAP.cmake new file mode 100644 index 0000000..134ca57 --- /dev/null +++ b/CMake/FindTCLAP.cmake @@ -0,0 +1,13 @@ +# TCLAP_FOUND +# TCLAP_INCLUDE_DIRS + +find_path(TCLAP_INCLUDE_DIR tclap/CmdLine.h + /usr/local/include + /usr/include +) + +set(TCLAP_INCLUDE_DIRS ${TCLAP_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TCLAP DEFAULT_MSG TCLAP_INCLUDE_DIR) +mark_as_advanced(TCLAP_FOUND TCLAP_INCLUDE_DIR) \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..63250d0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.6) +project(RebootInto) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMake") +set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/deps/include") + +if(MINGW) + set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/deps/lib/mingw/x64") +elseif(MSVC) + if(CMAKE_GENERATOR MATCHES "x64") + set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/deps/lib/msvc14/x64") + else() + set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/deps/lib/msvc14/x86") + endif() +else() + set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/deps/lib/linux-gcc/x64") +endif() + +if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") +elseif(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif() + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) +foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) +endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES) + +# DEBUG definition +set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS + $<$:DEBUG> + $<$:DEBUG> +) + +include_directories(${PROJECT_SOURCE_DIR}/src) +add_subdirectory(src) diff --git a/RebootInto.sln b/RebootInto.sln deleted file mode 100644 index 69c4b63..0000000 --- a/RebootInto.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RebootInto", "RebootInto\RebootInto.vcxproj", "{99BB47F2-FC67-43E8-BDDB-CFF4C426D365}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Debug|x64.ActiveCfg = Debug|x64 - {99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Debug|x64.Build.0 = Debug|x64 - {99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Debug|x86.ActiveCfg = Debug|Win32 - {99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Debug|x86.Build.0 = Debug|Win32 - {99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Release|x64.ActiveCfg = Release|x64 - {99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Release|x64.Build.0 = Release|x64 - {99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Release|x86.ActiveCfg = Release|Win32 - {99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/RebootInto/RebootInto.vcxproj b/RebootInto/RebootInto.vcxproj deleted file mode 100644 index 1c5638e..0000000 --- a/RebootInto/RebootInto.vcxproj +++ /dev/null @@ -1,152 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {99BB47F2-FC67-43E8-BDDB-CFF4C426D365} - RebootInto - 8.1 - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)/deps/include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - $(SolutionDir)/deps/lib;$(LibraryPath) - - - $(SolutionDir)/deps/include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - $(SolutionDir)/deps/lib;$(LibraryPath) - - - $(SolutionDir)/deps/lib;$(LibraryPath) - $(SolutionDir)/deps/include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)/deps/lib;$(LibraryPath) - $(SolutionDir)/deps/include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - - Level3 - Disabled - true - MultiThreadedDebugDLL - - - Console - RequireAdministrator - - - - - Level3 - Disabled - true - MultiThreadedDebugDLL - - - RequireAdministrator - Console - - - - - Level3 - Full - true - false - true - Size - MultiThreaded - - - true - true - RequireAdministrator - Console - - - - - Level3 - Full - true - false - true - MultiThreaded - Size - false - - - true - true - RequireAdministrator - Console - - - - - - - - - \ No newline at end of file diff --git a/RebootInto/RebootInto.vcxproj.filters b/RebootInto/RebootInto.vcxproj.filters deleted file mode 100644 index 4327830..0000000 --- a/RebootInto/RebootInto.vcxproj.filters +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/deps/include/nowide/args.hpp b/deps/include/boost/nowide/args.hpp similarity index 93% rename from deps/include/nowide/args.hpp rename to deps/include/boost/nowide/args.hpp index d1e9b44..bb806d0 100644 --- a/deps/include/nowide/args.hpp +++ b/deps/include/boost/nowide/args.hpp @@ -5,19 +5,19 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#ifndef NOWIDE_ARGS_HPP_INCLUDED -#define NOWIDE_ARGS_HPP_INCLUDED +#ifndef BOOST_NOWIDE_ARGS_HPP_INCLUDED +#define BOOST_NOWIDE_ARGS_HPP_INCLUDED -#include -#include +#include +#include #include -#ifdef NOWIDE_WINDOWS -#include +#ifdef BOOST_WINDOWS +#include #endif - +namespace boost { namespace nowide { - #if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_DOXYGEN) + #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) class args { public: args(int &,char **&) {} @@ -160,7 +160,7 @@ namespace nowide { #endif } // nowide - +} // namespace boost #endif /// diff --git a/deps/include/nowide/cenv.hpp b/deps/include/boost/nowide/cenv.hpp similarity index 91% rename from deps/include/nowide/cenv.hpp rename to deps/include/boost/nowide/cenv.hpp index f7c8f84..5f6d084 100644 --- a/deps/include/nowide/cenv.hpp +++ b/deps/include/boost/nowide/cenv.hpp @@ -5,23 +5,23 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#ifndef NOWIDE_CENV_H_INCLUDED -#define NOWIDE_CENV_H_INCLUDED +#ifndef BOOST_NOWIDE_CENV_H_INCLUDED +#define BOOST_NOWIDE_CENV_H_INCLUDED #include #include #include -#include -#include +#include +#include #include -#ifdef NOWIDE_WINDOWS -#include +#ifdef BOOST_WINDOWS +#include #endif - +namespace boost { namespace nowide { - #if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_DOXYGEN) + #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) using ::getenv; using ::setenv; using ::unsetenv; @@ -119,7 +119,7 @@ namespace nowide { } #endif } // nowide - +} // namespace boost #endif /// diff --git a/deps/include/boost/nowide/config.hpp b/deps/include/boost/nowide/config.hpp new file mode 100644 index 0000000..d983109 --- /dev/null +++ b/deps/include/boost/nowide/config.hpp @@ -0,0 +1,54 @@ +// +// Copyright (c) 2012 Artyom Beilis (Tonkikh) +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +#ifndef BOOST_NOWIDE_CONFIG_HPP_INCLUDED +#define BOOST_NOWIDE_CONFIG_HPP_INCLUDED + +#include + +#ifndef BOOST_SYMBOL_VISIBLE +# define BOOST_SYMBOL_VISIBLE +#endif + +#ifdef BOOST_HAS_DECLSPEC +# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK) +# ifdef BOOST_NOWIDE_SOURCE +# define BOOST_NOWIDE_DECL BOOST_SYMBOL_EXPORT +# else +# define BOOST_NOWIDE_DECL BOOST_SYMBOL_IMPORT +# endif // BOOST_NOWIDE_SOURCE +# endif // DYN_LINK +#endif // BOOST_HAS_DECLSPEC + +#ifndef BOOST_NOWIDE_DECL +# define BOOST_NOWIDE_DECL +#endif + +// +// Automatically link to the correct build variant where possible. +// +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_NOWIDE_NO_LIB) && !defined(BOOST_NOWIDE_SOURCE) +// +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it: +// +#define BOOST_LIB_NAME boost_nowide +// +// If we're importing code from a dll, then tell auto_link.hpp about it: +// +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK) +# define BOOST_DYN_LINK +#endif +// +// And include the header that does the work: +// +#include +#endif // auto-linking disabled + + +#endif // boost/nowide/config.hpp +// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 \ No newline at end of file diff --git a/deps/include/nowide/convert.hpp b/deps/include/boost/nowide/convert.hpp similarity index 85% rename from deps/include/nowide/convert.hpp rename to deps/include/boost/nowide/convert.hpp index 9c234f7..33c0583 100644 --- a/deps/include/nowide/convert.hpp +++ b/deps/include/boost/nowide/convert.hpp @@ -5,13 +5,13 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#ifndef NOWIDE_CONVERT_H_INCLUDED -#define NOWIDE_CONVERT_H_INCLUDED +#ifndef BOOST_NOWIDE_CONVERT_H_INCLUDED +#define BOOST_NOWIDE_CONVERT_H_INCLUDED #include -#include - +#include +namespace boost { namespace nowide { /// /// \brief Template function that converts a buffer of UTF sequence in range [source_begin,source_end) @@ -30,7 +30,7 @@ namespace nowide { return 0; buffer_size --; while(source_begin!=source_end) { - using namespace nowide::utf; + using namespace boost::locale::utf; code_point c = utf_traits::template decode(source_begin,source_end); if(c==illegal || c==incomplete) { rv = 0; @@ -112,42 +112,42 @@ namespace nowide { /// /// Convert between Wide - UTF-16/32 string and UTF-8 string. /// - /// nowide::conv::conversion_error is thrown in a case of a error + /// boost::locale::conv::conversion_error is thrown in a case of a error /// inline std::string narrow(wchar_t const *s) { - return nowide::conv::utf_to_utf(s); + return boost::locale::conv::utf_to_utf(s); } /// /// Convert between UTF-8 and UTF-16 string, implemented only on Windows platform /// - /// nowide::conv::conversion_error is thrown in a case of a error + /// boost::locale::conv::conversion_error is thrown in a case of a error /// inline std::wstring widen(char const *s) { - return nowide::conv::utf_to_utf(s); + return boost::locale::conv::utf_to_utf(s); } /// /// Convert between Wide - UTF-16/32 string and UTF-8 string /// - /// nowide::conv::conversion_error is thrown in a case of a error + /// boost::locale::conv::conversion_error is thrown in a case of a error /// inline std::string narrow(std::wstring const &s) { - return nowide::conv::utf_to_utf(s); + return boost::locale::conv::utf_to_utf(s); } /// /// Convert between UTF-8 and UTF-16 string, implemented only on Windows platform /// - /// nowide::conv::conversion_error is thrown in a case of a error + /// boost::locale::conv::conversion_error is thrown in a case of a error /// inline std::wstring widen(std::string const &s) { - return nowide::conv::utf_to_utf(s); + return boost::locale::conv::utf_to_utf(s); } } // nowide - +} // namespace boost #endif /// diff --git a/deps/include/nowide/cstdio.hpp b/deps/include/boost/nowide/cstdio.hpp similarity index 87% rename from deps/include/nowide/cstdio.hpp rename to deps/include/boost/nowide/cstdio.hpp index b34ccf8..28755e6 100644 --- a/deps/include/nowide/cstdio.hpp +++ b/deps/include/boost/nowide/cstdio.hpp @@ -5,25 +5,25 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#ifndef NOWIDE_CSTDIO_H_INCLUDED -#define NOWIDE_CSTDIO_H_INCLUDED +#ifndef BOOST_NOWIDE_CSTDIO_H_INCLUDED +#define BOOST_NOWIDE_CSTDIO_H_INCLUDED #include #include -#include -#include -#include +#include +#include +#include #include -#ifdef NOWIDE_MSVC +#ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4996) #endif - +namespace boost { namespace nowide { -#if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_DOXYGEN) +#if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) using std::fopen; using std::freopen; using std::remove; @@ -90,9 +90,9 @@ inline int remove(char const *name) } #endif } // nowide +} // namespace boost - -#ifdef NOWIDE_MSVC +#ifdef BOOST_MSVC #pragma warning(pop) #endif diff --git a/deps/include/nowide/cstdlib.hpp b/deps/include/boost/nowide/cstdlib.hpp similarity index 65% rename from deps/include/nowide/cstdlib.hpp rename to deps/include/boost/nowide/cstdlib.hpp index 0a7cf69..27e2061 100644 --- a/deps/include/nowide/cstdlib.hpp +++ b/deps/include/boost/nowide/cstdlib.hpp @@ -5,11 +5,11 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#ifndef NOWIDE_CSTDLIB_HPP_INCLUDED -#define NOWIDE_CSTDLIB_HPP_INCLUDED +#ifndef BOOST_NOWIDE_CSTDLIB_HPP_INCLUDED +#define BOOST_NOWIDE_CSTDLIB_HPP_INCLUDED -#include -#include +#include +#include #endif /// diff --git a/deps/include/nowide/filebuf.hpp b/deps/include/boost/nowide/filebuf.hpp similarity index 95% rename from deps/include/nowide/filebuf.hpp rename to deps/include/boost/nowide/filebuf.hpp index c6ad987..b7ddec8 100644 --- a/deps/include/nowide/filebuf.hpp +++ b/deps/include/boost/nowide/filebuf.hpp @@ -5,25 +5,25 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#ifndef NOWIDE_FILEBUF_HPP -#define NOWIDE_FILEBUF_HPP +#ifndef BOOST_NOWIDE_FILEBUF_HPP +#define BOOST_NOWIDE_FILEBUF_HPP #include -#include -#include +#include +#include #include #include #include -#ifdef NOWIDE_MSVC +#ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4996 4244) #endif - +namespace boost { namespace nowide { -#if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_FSTREAM_TESTS) && !defined(NOWIDE_DOXYGEN) +#if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_FSTREAM_TESTS) && !defined(BOOST_NOWIDE_DOXYGEN) using std::basic_filebuf; using std::filebuf; #else // Windows @@ -93,8 +93,8 @@ namespace nowide { wstackstring name; if(!name.convert(s)) return 0; - #ifdef NOWIDE_FSTREAM_TESTS - FILE *f = ::fopen(s,nowide::convert(smode).c_str()); + #ifdef BOOST_NOWIDE_FSTREAM_TESTS + FILE *f = ::fopen(s,boost::nowide::convert(smode).c_str()); #else FILE *f = ::_wfopen(name.c_str(),smode); #endif @@ -146,7 +146,7 @@ namespace nowide { return this; } -#ifdef NOWIDE_DEBUG_FILEBUF +#ifdef BOOST_NOWIDE_DEBUG_FILEBUF void print_buf(char *b,char *p,char *e) { @@ -201,7 +201,7 @@ namespace nowide { int overflow(int c) { -#ifdef NOWIDE_DEBUG_FILEBUF +#ifdef BOOST_NOWIDE_DEBUG_FILEBUF print_guard g(this,__FUNCTION__); #endif if(!file_) @@ -239,7 +239,7 @@ namespace nowide { int underflow() { -#ifdef NOWIDE_DEBUG_FILEBUF +#ifdef BOOST_NOWIDE_DEBUG_FILEBUF print_guard g(this,__FUNCTION__); #endif if(!file_) @@ -272,7 +272,7 @@ namespace nowide { std::ios_base::seekdir seekdir, std::ios_base::openmode /*m*/) { -#ifdef NOWIDE_DEBUG_FILEBUF +#ifdef BOOST_NOWIDE_DEBUG_FILEBUF print_guard g(this,__FUNCTION__); #endif if(!file_) @@ -396,9 +396,9 @@ namespace nowide { #endif // windows } // nowide +} // namespace boost - -#ifdef NOWIDE_MSVC +#ifdef BOOST_MSVC # pragma warning(pop) #endif diff --git a/deps/include/nowide/fstream.hpp b/deps/include/boost/nowide/fstream.hpp similarity index 92% rename from deps/include/nowide/fstream.hpp rename to deps/include/boost/nowide/fstream.hpp index dda00d1..07d8629 100644 --- a/deps/include/nowide/fstream.hpp +++ b/deps/include/boost/nowide/fstream.hpp @@ -5,25 +5,25 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#ifndef NOWIDE_FSTREAM_INCLUDED_HPP -#define NOWIDE_FSTREAM_INCLUDED_HPP +#ifndef BOOST_NOWIDE_FSTREAM_INCLUDED_HPP +#define BOOST_NOWIDE_FSTREAM_INCLUDED_HPP #include -#include -#include -#include +#include +#include +#include #include #include -#include - +#include +namespace boost { /// /// \brief This namespace includes implementation of the standard library functios /// such that they accept UTF-8 strings on Windows. On other platforms it is just an alias /// of std namespace (i.e. not on Windows) /// namespace nowide { -#if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_FSTREAM_TESTS) && !defined(NOWIDE_DOXYGEN) +#if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_FSTREAM_TESTS) && !defined(BOOST_NOWIDE_DOXYGEN) using std::basic_ifstream; using std::basic_ofstream; @@ -93,7 +93,7 @@ namespace nowide { } private: - nowide::scoped_ptr buf_; + boost::scoped_ptr buf_; }; /// @@ -155,7 +155,7 @@ namespace nowide { } private: - nowide::scoped_ptr buf_; + boost::scoped_ptr buf_; }; /// @@ -217,7 +217,7 @@ namespace nowide { } private: - nowide::scoped_ptr buf_; + boost::scoped_ptr buf_; }; @@ -240,7 +240,7 @@ namespace nowide { #endif } // nowide - +} // namespace boost diff --git a/deps/include/nowide/iostream.hpp b/deps/include/boost/nowide/iostream.hpp similarity index 70% rename from deps/include/nowide/iostream.hpp rename to deps/include/boost/nowide/iostream.hpp index b08c477..6ab004a 100644 --- a/deps/include/nowide/iostream.hpp +++ b/deps/include/boost/nowide/iostream.hpp @@ -5,24 +5,24 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#ifndef NOWIDE_IOSTREAM_HPP_INCLUDED -#define NOWIDE_IOSTREAM_HPP_INCLUDED +#ifndef BOOST_NOWIDE_IOSTREAM_HPP_INCLUDED +#define BOOST_NOWIDE_IOSTREAM_HPP_INCLUDED -#include -#include +#include +#include #include #include #include -#ifdef NOWIDE_MSVC +#ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4251) #endif - +namespace boost { namespace nowide { - #if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_DOXYGEN) + #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) using std::cout; using std::cerr; using std::cin; @@ -34,17 +34,17 @@ namespace nowide { class console_output_buffer; class console_input_buffer; - class NOWIDE_DECL winconsole_ostream : public std::ostream { + class BOOST_NOWIDE_DECL winconsole_ostream : public std::ostream { winconsole_ostream(winconsole_ostream const &); void operator=(winconsole_ostream const &); public: winconsole_ostream(int fd); ~winconsole_ostream(); private: - nowide::scoped_ptr d; + boost::scoped_ptr d; }; - class NOWIDE_DECL winconsole_istream : public std::istream { + class BOOST_NOWIDE_DECL winconsole_istream : public std::istream { winconsole_istream(winconsole_istream const &); void operator=(winconsole_istream const &); public: @@ -53,7 +53,7 @@ namespace nowide { ~winconsole_istream(); private: struct data; - nowide::scoped_ptr d; + boost::scoped_ptr d; }; } // details @@ -64,32 +64,32 @@ namespace nowide { /// /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio /// - extern NOWIDE_DECL details::winconsole_istream cin; + extern BOOST_NOWIDE_DECL details::winconsole_istream cin; /// /// \brief Same as std::cout, but uses UTF-8 /// /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio /// - extern NOWIDE_DECL details::winconsole_ostream cout; + extern BOOST_NOWIDE_DECL details::winconsole_ostream cout; /// /// \brief Same as std::cerr, but uses UTF-8 /// /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio /// - extern NOWIDE_DECL details::winconsole_ostream cerr; + extern BOOST_NOWIDE_DECL details::winconsole_ostream cerr; /// /// \brief Same as std::clog, but uses UTF-8 /// /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio /// - extern NOWIDE_DECL details::winconsole_ostream clog; + extern BOOST_NOWIDE_DECL details::winconsole_ostream clog; #endif } // nowide +} // namespace boost - -#ifdef NOWIDE_MSVC +#ifdef BOOST_MSVC # pragma warning(pop) #endif diff --git a/deps/include/nowide/stackstring.hpp b/deps/include/boost/nowide/stackstring.hpp similarity index 95% rename from deps/include/nowide/stackstring.hpp rename to deps/include/boost/nowide/stackstring.hpp index c93f983..948a22f 100644 --- a/deps/include/nowide/stackstring.hpp +++ b/deps/include/boost/nowide/stackstring.hpp @@ -5,13 +5,13 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#ifndef NOWIDE_DETAILS_WIDESTR_H_INCLUDED -#define NOWIDE_DETAILS_WIDESTR_H_INCLUDED -#include +#ifndef BOOST_NOWIDE_DETAILS_WIDESTR_H_INCLUDED +#define BOOST_NOWIDE_DETAILS_WIDESTR_H_INCLUDED +#include #include #include - +namespace boost { namespace nowide { /// @@ -147,7 +147,7 @@ typedef basic_stackstring short_stackstring; } // nowide - +} // namespace boost #endif /// diff --git a/deps/include/nowide/system.hpp b/deps/include/boost/nowide/system.hpp similarity index 78% rename from deps/include/nowide/system.hpp rename to deps/include/boost/nowide/system.hpp index 8083bfc..a1fc975 100644 --- a/deps/include/nowide/system.hpp +++ b/deps/include/boost/nowide/system.hpp @@ -5,16 +5,16 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#ifndef NOWIDE_CSTDLIB_HPP -#define NOWIDE_CSTDLIB_HPP +#ifndef BOOST_NOWIDE_CSTDLIB_HPP +#define BOOST_NOWIDE_CSTDLIB_HPP #include #include -#include - +#include +namespace boost { namespace nowide { -#if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_DOXYGEN) +#if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) using ::system; @@ -39,7 +39,7 @@ inline int system(char const *cmd) #endif } // nowide - +} // namespace boost #endif /// diff --git a/deps/include/nowide/windows.hpp b/deps/include/boost/nowide/windows.hpp similarity index 90% rename from deps/include/nowide/windows.hpp rename to deps/include/boost/nowide/windows.hpp index b9abff4..164ed55 100644 --- a/deps/include/nowide/windows.hpp +++ b/deps/include/boost/nowide/windows.hpp @@ -5,12 +5,12 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#ifndef NOWIDE_WINDOWS_HPP_INCLUDED -#define NOWIDE_WINDOWS_HPP_INCLUDED +#ifndef BOOST_NOWIDE_WINDOWS_HPP_INCLUDED +#define BOOST_NOWIDE_WINDOWS_HPP_INCLUDED #include -#ifdef NOWIDE_USE_WINDOWS_H +#ifdef BOOST_NOWIDE_USE_WINDOWS_H #include #else diff --git a/deps/include/nowide/config.hpp b/deps/include/nowide/config.hpp deleted file mode 100644 index 89c1f51..0000000 --- a/deps/include/nowide/config.hpp +++ /dev/null @@ -1,37 +0,0 @@ -// -// Copyright (c) 2012 Artyom Beilis (Tonkikh) -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -#ifndef NOWIDE_CONFIG_H_INCLUDED -#define NOWIDE_CONFIG_H_INCLUDED - - -#if (defined(__WIN32) || defined(_WIN32) || defined(WIN32)) && !defined(__CYGWIN__) -#define NOWIDE_WINDOWS -#endif - -#ifdef _MSC_VER -#define NOWIDE_MSVC -#endif - -#ifdef NOWIDE_WINDOWS -# if defined(DLL_EXPORT) || defined(NOWIDE_EXPORT) -# ifdef NOWIDE_SOURCE -# define NOWIDE_DECL __declspec(dllexport) -# else -# define NOWIDE_DECL __declspec(dllimport) -# endif //NOWIDE_SOURCE -# endif // DYN_LINK -#endif - -#ifndef NOWIDE_DECL -# define NOWIDE_DECL -#endif - - -#endif -/// -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/deps/include/nowide/encoding_errors.hpp b/deps/include/nowide/encoding_errors.hpp deleted file mode 100644 index a7a4058..0000000 --- a/deps/include/nowide/encoding_errors.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -#ifndef NOWIDE_ENCODING_ERRORS_HPP_INCLUDED -#define NOWIDE_ENCODING_ERRORS_HPP_INCLUDED - -#include -#ifdef NOWIDE_MSVC -# pragma warning(push) -# pragma warning(disable : 4275 4251 4231 4660) -#endif -#include - - - -namespace nowide { - namespace conv { - /// - /// \addtogroup codepage - /// - /// @{ - - /// - /// \brief The excepton that is thrown in case of conversion error - /// - class conversion_error : public std::runtime_error { - public: - conversion_error() : std::runtime_error("Conversion failed") {} - }; - - /// - /// enum that defines conversion policy - /// - typedef enum { - skip = 0, ///< Skip illegal/unconvertable characters - stop = 1, ///< Stop conversion and throw conversion_error - default_method = skip ///< Default method - skip - } method_type; - - - /// @} - - } // conv - -} // nowide - -#ifdef NOWIDE_MSVC -#pragma warning(pop) -#endif - -#endif - -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - diff --git a/deps/include/nowide/encoding_utf.hpp b/deps/include/nowide/encoding_utf.hpp deleted file mode 100644 index 018b648..0000000 --- a/deps/include/nowide/encoding_utf.hpp +++ /dev/null @@ -1,84 +0,0 @@ -// -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -#ifndef NOWIDE_ENCODING_UTF_HPP_INCLUDED -#define NOWIDE_ENCODING_UTF_HPP_INCLUDED - -#include -#include -#include -#include -#ifdef NOWIDE_MSVC -# pragma warning(push) -# pragma warning(disable : 4275 4251 4231 4660) -#endif - - -namespace nowide{ - namespace conv { - /// - /// Convert a Unicode text in range [begin,end) to other Unicode encoding - /// - template - std::basic_string - utf_to_utf(CharIn const *begin,CharIn const *end,method_type how = default_method) - { - std::basic_string result; - result.reserve(end-begin); - typedef std::back_insert_iterator > inserter_type; - inserter_type inserter(result); - utf::code_point c; - while(begin!=end) { - c=utf::utf_traits::template decode(begin,end); - if(c==utf::illegal || c==utf::incomplete) { - if(how==stop) - throw conversion_error(); - } - else { - utf::utf_traits::template encode(c,inserter); - } - } - return result; - } - - /// - /// Convert a Unicode NUL terminated string \a str other Unicode encoding - /// - template - std::basic_string - utf_to_utf(CharIn const *str,method_type how = default_method) - { - CharIn const *end = str; - while(*end) - end++; - return utf_to_utf(str,end,how); - } - - - /// - /// Convert a Unicode string \a str other Unicode encoding - /// - template - std::basic_string - utf_to_utf(std::basic_string const &str,method_type how = default_method) - { - return utf_to_utf(str.c_str(),str.c_str()+str.size(),how); - } - - - -} // conv -} // nowide - -#ifdef NOWIDE_MSVC -#pragma warning(pop) -#endif - -#endif - -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - diff --git a/deps/include/nowide/scoped_ptr.hpp b/deps/include/nowide/scoped_ptr.hpp deleted file mode 100644 index 92410e2..0000000 --- a/deps/include/nowide/scoped_ptr.hpp +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef NOWIDE_SCOPED_PTR_HPP -#define NOWIDE_SCOPED_PTR_HPP - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov, -// Copyright (C) 2012 Artyom Beilis -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// http://www.boost.org/libs/smart_ptr/scoped_ptr.htm -// - -#include - -namespace nowide -{ - -// scoped_ptr mimics a built-in pointer except that it guarantees deletion -// of the object pointed to, either on destruction of the scoped_ptr or via -// an explicit reset(). scoped_ptr is a simple solution for simple needs; -// use shared_ptr or std::auto_ptr if your needs are more complex. - -template class scoped_ptr // noncopyable -{ -private: - - T * px; - - scoped_ptr(scoped_ptr const &); - scoped_ptr & operator=(scoped_ptr const &); - - typedef scoped_ptr this_type; - - void operator==( scoped_ptr const& ) const; - void operator!=( scoped_ptr const& ) const; - -public: - - typedef T element_type; - - explicit scoped_ptr( T * p = 0 ): px( p ) // never throws - { - } - - ~scoped_ptr() // never throws - { - delete px; - } - - void reset(T * p = 0) // never throws - { - assert( p == 0 || p != px ); // catch self-reset errors - this_type(p).swap(*this); - } - - T & operator*() const // never throws - { - assert( px != 0 ); - return *px; - } - - T * operator->() const // never throws - { - assert( px != 0 ); - return px; - } - - T * get() const // never throws - { - return px; - } - - operator bool() const - { - return px!=0; - } - - void swap(scoped_ptr & b) // never throws - { - T * tmp = b.px; - b.px = px; - px = tmp; - } -}; - - -} // namespace nowide - -#endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - diff --git a/deps/include/nowide/utf.hpp b/deps/include/nowide/utf.hpp deleted file mode 100644 index 55dc2cc..0000000 --- a/deps/include/nowide/utf.hpp +++ /dev/null @@ -1,469 +0,0 @@ -// -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -#ifndef NOWIDE_UTF_HPP_INCLUDED -#define NOWIDE_UTF_HPP_INCLUDED - -#include - -#ifndef NOWIDE_MSVC -namespace nowide { -namespace utf { - typedef unsigned uint32_t; - typedef unsigned short uint16_t; - typedef unsigned char uint8_t; -} -} -#else -#include -#endif - -namespace nowide { -/// -/// \brief Namespace that holds basic operations on UTF encoded sequences -/// -/// All functions defined in this namespace do not require linking with Boost.Locale library -/// -namespace utf { - /// \cond INTERNAL - #ifdef __GNUC__ - # define NOWIDE_LIKELY(x) __builtin_expect((x),1) - # define NOWIDE_UNLIKELY(x) __builtin_expect((x),0) - #else - # define NOWIDE_LIKELY(x) (x) - # define NOWIDE_UNLIKELY(x) (x) - #endif - /// \endcond - - /// - /// \brief The integral type type that can hold a Unicode code point - /// - typedef uint32_t code_point; - - /// - /// \brief Special constant that defines illegal code point - /// - static const code_point illegal = 0xFFFFFFFFu; - - /// - /// \brief Special constant that defines incomplete code point - /// - static const code_point incomplete = 0xFFFFFFFEu; - - /// - /// \brief the function checks if \a v is a valid code point - /// - inline bool is_valid_codepoint(code_point v) - { - if(v>0x10FFFF) - return false; - if(0xD800 <=v && v<= 0xDFFF) // surragates - return false; - return true; - } - - #ifdef NOWIDE_DOXYGEN - /// - /// \brief UTF Traits class - functions to convert UTF sequences to and from Unicode code points - /// - template - struct utf_traits { - /// - /// The type of the character - /// - typedef CharType char_type; - /// - /// Read one code point from the range [p,e) and return it. - /// - /// - If the sequence that was read is incomplete sequence returns \ref incomplete, - /// - If illegal sequence detected returns \ref illegal - /// - /// Requirements - /// - /// - Iterator is valid input iterator - /// - /// Postconditions - /// - /// - p points to the last consumed character - /// - template - static code_point decode(Iterator &p,Iterator e); - - /// - /// Maximal width of valid sequence in the code units: - /// - /// - UTF-8 - 4 - /// - UTF-16 - 2 - /// - UTF-32 - 1 - /// - static const int max_width; - /// - /// The width of specific code point in the code units. - /// - /// Requirement: value is a valid Unicode code point - /// Returns value in range [1..max_width] - /// - static int width(code_point value); - - /// - /// Get the size of the trail part of variable length encoded sequence. - /// - /// Returns -1 if C is not valid lead character - /// - static int trail_length(char_type c); - /// - /// Returns true if c is trail code unit, always false for UTF-32 - /// - static bool is_trail(char_type c); - /// - /// Returns true if c is lead code unit, always true of UTF-32 - /// - static bool is_lead(char_type c); - - /// - /// Convert valid Unicode code point \a value to the UTF sequence. - /// - /// Requirements: - /// - /// - \a value is valid code point - /// - \a out is an output iterator should be able to accept at least width(value) units - /// - /// Returns the iterator past the last written code unit. - /// - template - static Iterator encode(code_point value,Iterator out); - /// - /// Decodes valid UTF sequence that is pointed by p into code point. - /// - /// If the sequence is invalid or points to end the behavior is undefined - /// - template - static code_point decode_valid(Iterator &p); - }; - - #else - - template - struct utf_traits; - - template - struct utf_traits { - - typedef CharType char_type; - - static int trail_length(char_type ci) - { - unsigned char c = ci; - if(c < 128) - return 0; - if(NOWIDE_UNLIKELY(c < 194)) - return -1; - if(c < 224) - return 1; - if(c < 240) - return 2; - if(NOWIDE_LIKELY(c <=244)) - return 3; - return -1; - } - - static const int max_width = 4; - - static int width(code_point value) - { - if(value <=0x7F) { - return 1; - } - else if(value <=0x7FF) { - return 2; - } - else if(NOWIDE_LIKELY(value <=0xFFFF)) { - return 3; - } - else { - return 4; - } - } - - static bool is_trail(char_type ci) - { - unsigned char c=ci; - return (c & 0xC0)==0x80; - } - - static bool is_lead(char_type ci) - { - return !is_trail(ci); - } - - template - static code_point decode(Iterator &p,Iterator e) - { - if(NOWIDE_UNLIKELY(p==e)) - return incomplete; - - unsigned char lead = *p++; - - // First byte is fully validated here - int trail_size = trail_length(lead); - - if(NOWIDE_UNLIKELY(trail_size < 0)) - return illegal; - - // - // Ok as only ASCII may be of size = 0 - // also optimize for ASCII text - // - if(trail_size == 0) - return lead; - - code_point c = lead & ((1<<(6-trail_size))-1); - - // Read the rest - unsigned char tmp; - switch(trail_size) { - case 3: - if(NOWIDE_UNLIKELY(p==e)) - return incomplete; - tmp = *p++; - if (!is_trail(tmp)) - return illegal; - c = (c << 6) | ( tmp & 0x3F); - case 2: - if(NOWIDE_UNLIKELY(p==e)) - return incomplete; - tmp = *p++; - if (!is_trail(tmp)) - return illegal; - c = (c << 6) | ( tmp & 0x3F); - case 1: - if(NOWIDE_UNLIKELY(p==e)) - return incomplete; - tmp = *p++; - if (!is_trail(tmp)) - return illegal; - c = (c << 6) | ( tmp & 0x3F); - } - - // Check code point validity: no surrogates and - // valid range - if(NOWIDE_UNLIKELY(!is_valid_codepoint(c))) - return illegal; - - // make sure it is the most compact representation - if(NOWIDE_UNLIKELY(width(c)!=trail_size + 1)) - return illegal; - - return c; - - } - - template - static code_point decode_valid(Iterator &p) - { - unsigned char lead = *p++; - if(lead < 192) - return lead; - - int trail_size; - - if(lead < 224) - trail_size = 1; - else if(NOWIDE_LIKELY(lead < 240)) // non-BMP rare - trail_size = 2; - else - trail_size = 3; - - code_point c = lead & ((1<<(6-trail_size))-1); - - switch(trail_size) { - case 3: - c = (c << 6) | ( static_cast(*p++) & 0x3F); - case 2: - c = (c << 6) | ( static_cast(*p++) & 0x3F); - case 1: - c = (c << 6) | ( static_cast(*p++) & 0x3F); - } - - return c; - } - - - - template - static Iterator encode(code_point value,Iterator out) - { - if(value <= 0x7F) { - *out++ = static_cast(value); - } - else if(value <= 0x7FF) { - *out++ = static_cast((value >> 6) | 0xC0); - *out++ = static_cast((value & 0x3F) | 0x80); - } - else if(NOWIDE_LIKELY(value <= 0xFFFF)) { - *out++ = static_cast((value >> 12) | 0xE0); - *out++ = static_cast(((value >> 6) & 0x3F) | 0x80); - *out++ = static_cast((value & 0x3F) | 0x80); - } - else { - *out++ = static_cast((value >> 18) | 0xF0); - *out++ = static_cast(((value >> 12) & 0x3F) | 0x80); - *out++ = static_cast(((value >> 6) & 0x3F) | 0x80); - *out++ = static_cast((value & 0x3F) | 0x80); - } - return out; - } - }; // utf8 - - template - struct utf_traits { - typedef CharType char_type; - - // See RFC 2781 - static bool is_first_surrogate(uint16_t x) - { - return 0xD800 <=x && x<= 0xDBFF; - } - static bool is_second_surrogate(uint16_t x) - { - return 0xDC00 <=x && x<= 0xDFFF; - } - static code_point combine_surrogate(uint16_t w1,uint16_t w2) - { - return ((code_point(w1 & 0x3FF) << 10) | (w2 & 0x3FF)) + 0x10000; - } - static int trail_length(char_type c) - { - if(is_first_surrogate(c)) - return 1; - if(is_second_surrogate(c)) - return -1; - return 0; - } - /// - /// Returns true if c is trail code unit, always false for UTF-32 - /// - static bool is_trail(char_type c) - { - return is_second_surrogate(c); - } - /// - /// Returns true if c is lead code unit, always true of UTF-32 - /// - static bool is_lead(char_type c) - { - return !is_second_surrogate(c); - } - - template - static code_point decode(It ¤t,It last) - { - if(NOWIDE_UNLIKELY(current == last)) - return incomplete; - uint16_t w1=*current++; - if(NOWIDE_LIKELY(w1 < 0xD800 || 0xDFFF < w1)) { - return w1; - } - if(w1 > 0xDBFF) - return illegal; - if(current==last) - return incomplete; - uint16_t w2=*current++; - if(w2 < 0xDC00 || 0xDFFF < w2) - return illegal; - return combine_surrogate(w1,w2); - } - template - static code_point decode_valid(It ¤t) - { - uint16_t w1=*current++; - if(NOWIDE_LIKELY(w1 < 0xD800 || 0xDFFF < w1)) { - return w1; - } - uint16_t w2=*current++; - return combine_surrogate(w1,w2); - } - - static const int max_width = 2; - static int width(code_point u) - { - return u>=0x10000 ? 2 : 1; - } - template - static It encode(code_point u,It out) - { - if(NOWIDE_LIKELY(u<=0xFFFF)) { - *out++ = static_cast(u); - } - else { - u -= 0x10000; - *out++ = static_cast(0xD800 | (u>>10)); - *out++ = static_cast(0xDC00 | (u & 0x3FF)); - } - return out; - } - }; // utf16; - - - template - struct utf_traits { - typedef CharType char_type; - static int trail_length(char_type c) - { - if(is_valid_codepoint(c)) - return 0; - return -1; - } - static bool is_trail(char_type /*c*/) - { - return false; - } - static bool is_lead(char_type /*c*/) - { - return true; - } - - template - static code_point decode_valid(It ¤t) - { - return *current++; - } - - template - static code_point decode(It ¤t,It last) - { - if(NOWIDE_UNLIKELY(current == last)) - return nowide::utf::incomplete; - code_point c=*current++; - if(NOWIDE_UNLIKELY(!is_valid_codepoint(c))) - return nowide::utf::illegal; - return c; - } - static const int max_width = 1; - static int width(code_point /*u*/) - { - return 1; - } - template - static It encode(code_point u,It out) - { - *out++ = static_cast(u); - return out; - } - - }; // utf32 - - #endif - -} // utf -} // nowide - - -#endif - -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..1a7075e --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,26 @@ +project(RebootInto) +find_package(TCLAP REQUIRED) +find_package(Boost REQUIRED COMPONENTS locale) +find_package(Nowide REQUIRED) + +include_directories( + ${INCLUDE_PATH} + ${TCLAP_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ${Nowide_INCLUDE_DIRS} +) + +set(SOURCE_FILES + main.cpp +) +source_group("" FILES ${SOURCE_FILES}) + +if(MSVC) + add_definitions(-DUNICODE -D_UNICODE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT /Ox /Os") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE /level='requireAdministrator'") +endif() + +add_executable(RebootInto ${SOURCE_FILES}) \ No newline at end of file diff --git a/RebootInto/main.cpp b/src/main.cpp similarity index 99% rename from RebootInto/main.cpp rename to src/main.cpp index ce968ce..c5c065e 100644 --- a/RebootInto/main.cpp +++ b/src/main.cpp @@ -8,12 +8,12 @@ #include #define NOMINMAX #include -#include +#include //#define TCLAP_NAMESTARTSTRING "/" //#define TCLAP_FLAGSTARTSTRING "/" #include -using namespace nowide; +using namespace boost::nowide; #define VERSION "1.0.1" #define EFI_GLOBAL_VARIABLE L"{8BE4DF61-93CA-11D2-AA0D-00E098032B8C}"