Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86645 - trunk/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2013-11-12 04:16:18


Author: danieljames
Date: 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013)
New Revision: 86645
URL: http://svn.boost.org/trac/boost/changeset/86645

Log:
Rename input_path.?pp to native_text.

Added:
   trunk/tools/quickbook/src/native_text.cpp (contents, props changed)
      - copied, changed from r86644, trunk/tools/quickbook/src/input_path.cpp
   trunk/tools/quickbook/src/native_text.hpp (contents, props changed)
      - copied, changed from r86644, trunk/tools/quickbook/src/input_path.hpp
Deleted:
   trunk/tools/quickbook/src/input_path.cpp
   trunk/tools/quickbook/src/input_path.hpp
Text files modified:
   trunk/tools/quickbook/src/Jamfile.v2 | 2
   trunk/tools/quickbook/src/actions.cpp | 2
   trunk/tools/quickbook/src/code_snippet.cpp | 2
   trunk/tools/quickbook/src/dependency_tracker.cpp | 2
   trunk/tools/quickbook/src/doc_info_actions.cpp | 2
   trunk/tools/quickbook/src/include_paths.cpp | 2
   /dev/null | 324 ----------------------------------------
   /dev/null | 136 ----------------
   trunk/tools/quickbook/src/main_grammar.cpp | 2
   trunk/tools/quickbook/src/native_text.cpp | 2
   trunk/tools/quickbook/src/native_text.hpp | 2
   trunk/tools/quickbook/src/quickbook.cpp | 2
   trunk/tools/quickbook/src/state.cpp | 2
   trunk/tools/quickbook/src/syntax_highlight.cpp | 2
   14 files changed, 13 insertions(+), 471 deletions(-)

Modified: trunk/tools/quickbook/src/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/src/Jamfile.v2 Tue Nov 12 04:15:40 2013 (r86644)
+++ trunk/tools/quickbook/src/Jamfile.v2 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -30,7 +30,7 @@
     dependency_tracker.cpp
     utils.cpp
     files.cpp
- input_path.cpp
+ native_text.cpp
     include_paths.cpp
     values.cpp
     document_state.cpp

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp Tue Nov 12 04:15:40 2013 (r86644)
+++ trunk/tools/quickbook/src/actions.cpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -29,7 +29,7 @@
 #include "state.hpp"
 #include "state_save.hpp"
 #include "grammar.hpp"
-#include "input_path.hpp"
+#include "native_text.hpp"
 #include "block_tags.hpp"
 #include "phrase_tags.hpp"
 #include "document_state.hpp"

Modified: trunk/tools/quickbook/src/code_snippet.cpp
==============================================================================
--- trunk/tools/quickbook/src/code_snippet.cpp Tue Nov 12 04:15:40 2013 (r86644)
+++ trunk/tools/quickbook/src/code_snippet.cpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -18,7 +18,7 @@
 #include "state.hpp"
 #include "values.hpp"
 #include "files.hpp"
-#include "input_path.hpp"
+#include "native_text.hpp"
 
 namespace quickbook
 {

Modified: trunk/tools/quickbook/src/dependency_tracker.cpp
==============================================================================
--- trunk/tools/quickbook/src/dependency_tracker.cpp Tue Nov 12 04:15:40 2013 (r86644)
+++ trunk/tools/quickbook/src/dependency_tracker.cpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -7,7 +7,7 @@
 =============================================================================*/
 
 #include "dependency_tracker.hpp"
-#include "input_path.hpp"
+#include "native_text.hpp"
 #include <boost/filesystem/operations.hpp>
 #include <boost/filesystem/fstream.hpp>
 #include <boost/foreach.hpp>

Modified: trunk/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/doc_info_actions.cpp Tue Nov 12 04:15:40 2013 (r86644)
+++ trunk/tools/quickbook/src/doc_info_actions.cpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -16,7 +16,7 @@
 #include "quickbook.hpp"
 #include "utils.hpp"
 #include "files.hpp"
-#include "input_path.hpp"
+#include "native_text.hpp"
 #include "state.hpp"
 #include "actions.hpp"
 #include "doc_info_tags.hpp"

Modified: trunk/tools/quickbook/src/include_paths.cpp
==============================================================================
--- trunk/tools/quickbook/src/include_paths.cpp Tue Nov 12 04:15:40 2013 (r86644)
+++ trunk/tools/quickbook/src/include_paths.cpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -9,7 +9,7 @@
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 
-#include "input_path.hpp"
+#include "native_text.hpp"
 #include "include_paths.hpp"
 #include "state.hpp"
 #include "utils.hpp"

Deleted: trunk/tools/quickbook/src/input_path.cpp
==============================================================================
--- trunk/tools/quickbook/src/input_path.cpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86644)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,324 +0,0 @@
-/*=============================================================================
- Copyright (c) 2009 Daniel James
-
- Use, modification and distribution is subject to 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)
-=============================================================================*/
-
-#include <boost/program_options.hpp>
-#include <iostream>
-#include "input_path.hpp"
-#include "utils.hpp"
-#include "files.hpp"
-
-#if QUICKBOOK_WIDE_PATHS || QUICKBOOK_WIDE_STREAMS
-#include <boost/scoped_ptr.hpp>
-#include <windows.h>
-#include <io.h>
-#include <fcntl.h>
-#endif
-
-#if QUICKBOOK_CYGWIN_PATHS
-#include <boost/scoped_array.hpp>
-#include <boost/program_options/errors.hpp>
-#include <sys/cygwin.h>
-#endif
-
-namespace quickbook {
- extern bool ms_errors;
-}
-
-namespace quickbook {
-namespace detail {
-
-// This is used for converting paths to UTF-8 on cygin.
-// Might be better not to use a windows
-#if QUICKBOOK_WIDE_PATHS || QUICKBOOK_WIDE_STREAMS
- namespace {
- std::string to_utf8(std::wstring const& x)
- {
- int buffer_count = WideCharToMultiByte(CP_UTF8, 0, x.c_str(), -1, 0, 0, 0, 0);
-
- if (!buffer_count)
- throw conversion_error("Error converting wide string to utf-8.");
-
- boost::scoped_ptr<char> buffer(new char[buffer_count]);
-
- if (!WideCharToMultiByte(CP_UTF8, 0, x.c_str(), -1, buffer.get(), buffer_count, 0, 0))
- throw conversion_error("Error converting wide string to utf-8.");
-
- return std::string(buffer.get());
- }
-
- std::wstring from_utf8(boost::string_ref text)
- {
- std::string x(text.begin(), text.end());
- int buffer_count = MultiByteToWideChar(CP_UTF8, 0, x.c_str(), -1, 0, 0);
-
- if (!buffer_count)
- throw conversion_error("Error converting utf-8 to wide string.");
-
- boost::scoped_ptr<wchar_t> buffer(new wchar_t[buffer_count]);
-
- if (!MultiByteToWideChar(CP_UTF8, 0, x.c_str(), -1, buffer.get(), buffer_count))
- throw conversion_error("Error converting utf-8 to wide string.");
-
- return std::wstring(buffer.get());
- }
- }
-#endif
-
-#if QUICKBOOK_WIDE_PATHS
- std::string input_to_utf8(input_string const& x)
- {
- return to_utf8(x);
- }
-#else
- std::string input_to_utf8(input_string const& x)
- {
- return x;
- }
-#endif
-
-#if QUICKBOOK_WIDE_PATHS
- fs::path generic_to_path(boost::string_ref x)
- {
- return fs::path(from_utf8(x));
- }
-
- std::string path_to_generic(fs::path const& x)
- {
- return to_utf8(x.generic_wstring());
- }
-#else
- fs::path generic_to_path(boost::string_ref x)
- {
- return fs::path(x.begin(), x.end());
- }
-
- std::string path_to_generic(fs::path const& x)
- {
- return x.generic_string();
- }
-
-#endif
-
-#if QUICKBOOK_CYGWIN_PATHS
- fs::path input_to_path(input_string const& path)
- {
- cygwin_conv_path_t flags = CCP_POSIX_TO_WIN_W | CCP_RELATIVE;
-
- ssize_t size = cygwin_conv_path(flags, path.c_str(), NULL, 0);
-
- if (size < 0)
- throw conversion_error("Error converting cygwin path to windows.");
-
- boost::scoped_array<char> result(new char[size]);
- void* ptr = result.get();
-
- if(cygwin_conv_path(flags, path.c_str(), ptr, size))
- throw conversion_error("Error converting cygwin path to windows.");
-
- return fs::path(static_cast<wchar_t*>(ptr));
- }
-
- ostream::string path_to_stream(fs::path const& path)
- {
- cygwin_conv_path_t flags = CCP_WIN_W_TO_POSIX | CCP_RELATIVE;
-
- ssize_t size = cygwin_conv_path(flags, path.native().c_str(), NULL, 0);
-
- if (size < 0)
- throw conversion_error("Error converting windows path to cygwin.");
-
- boost::scoped_array<char> result(new char[size]);
-
- if(cygwin_conv_path(flags, path.native().c_str(), result.get(), size))
- throw conversion_error("Error converting windows path to cygwin.");
-
- return std::string(result.get());
- }
-#else
- fs::path input_to_path(input_string const& path)
- {
- return fs::path(path);
- }
-
-#if QUICKBOOK_WIDE_PATHS && !QUICKBOOK_WIDE_STREAMS
- ostream::string path_to_stream(fs::path const& path)
- {
- return path.string();
- }
-#else
- ostream::string path_to_stream(fs::path const& path)
- {
- return path.native();
- }
-#endif
-
-#endif // QUICKBOOK_CYGWIN_PATHS
-
-#if QUICKBOOK_WIDE_STREAMS
-
- void initialise_output()
- {
- if (_isatty(_fileno(stdout))) _setmode(_fileno(stdout), _O_U16TEXT);
- if (_isatty(_fileno(stderr))) _setmode(_fileno(stderr), _O_U16TEXT);
- }
-
- void write_utf8(ostream::base_ostream& out, boost::string_ref x)
- {
- out << from_utf8(x);
- }
-
- ostream& out()
- {
- static ostream x(std::wcout);
- return x;
- }
-
- namespace
- {
- inline ostream& error_stream()
- {
- static ostream x(std::wcerr);
- return x;
- }
- }
-
-#else
-
- void initialise_output()
- {
- }
-
- void write_utf8(ostream::base_ostream& out, boost::string_ref x)
- {
- out << x;
- }
-
- ostream& out()
- {
- static ostream x(std::cout);
- return x;
- }
-
- namespace
- {
- inline ostream& error_stream()
- {
- static ostream x(std::clog);
- return x;
- }
- }
-
-#endif
-
- ostream& outerr()
- {
- return error_stream() << "Error: ";
- }
-
- ostream& outerr(fs::path const& file, int line)
- {
- if (line >= 0)
- {
- if (ms_errors)
- return error_stream() << path_to_stream(file) << "(" << line << "): error: ";
- else
- return error_stream() << path_to_stream(file) << ":" << line << ": error: ";
- }
- else
- {
- return error_stream() << path_to_stream(file) << ": error: ";
- }
- }
-
- ostream& outerr(file_ptr const& f, string_iterator pos)
- {
- return outerr(f->path, f->position_of(pos).line);
- }
-
- ostream& outwarn(fs::path const& file, int line)
- {
- if (line >= 0)
- {
- if (ms_errors)
- return error_stream() << path_to_stream(file) << "(" << line << "): warning: ";
- else
- return error_stream() << path_to_stream(file) << ":" << line << ": warning: ";
- }
- else
- {
- return error_stream() << path_to_stream(file) << ": warning: ";
- }
- }
-
- ostream& outwarn(file_ptr const& f, string_iterator pos)
- {
- return outwarn(f->path, f->position_of(pos).line);
- }
-
- ostream& ostream::operator<<(char c) {
- assert(c > 0 && c <= 127);
- base << c;
- return *this;
- }
-
- inline bool check_ascii(char const* x) {
- for(;*x;++x) if(*x <= 0 || *x > 127) return false;
- return true;
- }
-
- ostream& ostream::operator<<(char const* x) {
- assert(check_ascii(x));
- base << x;
- return *this;
- }
-
- ostream& ostream::operator<<(std::string const& x) {
- write_utf8(base, x);
- return *this;
- }
-
- ostream& ostream::operator<<(boost::string_ref x) {
- write_utf8(base, x);
- return *this;
- }
-
- ostream& ostream::operator<<(int x) {
- base << x;
- return *this;
- }
-
- ostream& ostream::operator<<(unsigned int x) {
- base << x;
- return *this;
- }
-
- ostream& ostream::operator<<(long x) {
- base << x;
- return *this;
- }
-
- ostream& ostream::operator<<(unsigned long x) {
- base << x;
- return *this;
- }
-
- ostream& ostream::operator<<(fs::path const& x) {
- base << path_to_stream(x);
- return *this;
- }
-
- ostream& ostream::operator<<(base_ostream& (*x)(base_ostream&)) {
- base << x;
- return *this;
- }
-
- ostream& ostream::operator<<(base_ios& (*x)(base_ios&)) {
- base << x;
- return *this;
- }
-}}

Deleted: trunk/tools/quickbook/src/input_path.hpp
==============================================================================
--- trunk/tools/quickbook/src/input_path.hpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86644)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,136 +0,0 @@
-/*=============================================================================
- Copyright (c) 2009 Daniel James
-
- Use, modification and distribution is subject to 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)
-=============================================================================*/
-
-#if !defined(BOOST_QUICKBOOK_DETAIL_INPUT_PATH_HPP)
-#define BOOST_QUICKBOOK_DETAIL_INPUT_PATH_HPP
-
-#include <boost/config.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/utility/string_ref.hpp>
-#include <string>
-#include <stdexcept>
-#include <iostream>
-#include "fwd.hpp"
-
-#if defined(__cygwin__) || defined(__CYGWIN__)
-# define QUICKBOOK_CYGWIN_PATHS 1
-#elif defined(_WIN32)
-# define QUICKBOOK_WIDE_PATHS 1
-# if defined(BOOST_MSVC) && BOOST_MSVC >= 1400
-# define QUICKBOOK_WIDE_STREAMS 1
-# endif
-#endif
-
-#if !defined(QUICKBOOK_WIDE_PATHS)
-#define QUICKBOOK_WIDE_PATHS 0
-#endif
-
-#if !defined(QUICKBOOK_WIDE_STREAMS)
-#define QUICKBOOK_WIDE_STREAMS 0
-#endif
-
-#if !defined(QUICKBOOK_CYGWIN_PATHS)
-#define QUICKBOOK_CYGWIN_PATHS 0
-#endif
-
-namespace quickbook
-{
- namespace fs = boost::filesystem;
-
- namespace detail
- {
- struct conversion_error : std::runtime_error
- {
- conversion_error(char const* m) : std::runtime_error(m) {}
- };
-
- // 'generic': Paths in quickbook source and the generated boostbook.
- // Always UTF-8.
- // 'input': Paths (or other parameters) from the command line and
- // possibly other sources in the future. Wide strings on
- // normal windows, UTF-8 for cygwin and other platforms
- // (hopefully).
- // 'stream': Strings to be written to a stream.
- // 'path': Stored as a boost::filesystem::path. Since
- // Boost.Filesystem doesn't support cygwin, this
- // is always wide on windows. UTF-8 on other
- // platforms (again, hopefully).
-
-#if QUICKBOOK_WIDE_PATHS
- typedef std::wstring input_string;
- typedef boost::wstring_ref input_string_ref;
-#else
- typedef std::string input_string;
- typedef boost::string_ref input_string_ref;
-#endif
-
- // A light wrapper around C++'s streams that gets things right
- // in the quickbook context.
- //
- // This is far from perfect but it fixes some issues.
- struct ostream
- {
-#if QUICKBOOK_WIDE_STREAMS
- typedef std::wostream base_ostream;
- typedef std::wios base_ios;
- typedef std::wstring string;
- typedef boost::wstring_ref string_ref;
-#else
- typedef std::ostream base_ostream;
- typedef std::ios base_ios;
- typedef std::string string;
- typedef boost::string_ref string_ref;
-#endif
- base_ostream& base;
-
- explicit ostream(base_ostream& x) : base(x) {}
-
- // C strings should always be ascii.
- ostream& operator<<(char);
- ostream& operator<<(char const*);
-
- // std::string should be UTF-8 (what a mess!)
- ostream& operator<<(std::string const&);
- ostream& operator<<(boost::string_ref);
-
- // Other value types.
- ostream& operator<<(int x);
- ostream& operator<<(unsigned int x);
- ostream& operator<<(long x);
- ostream& operator<<(unsigned long x);
- ostream& operator<<(fs::path const&);
-
- // Modifiers
- ostream& operator<<(base_ostream& (*)(base_ostream&));
- ostream& operator<<(base_ios& (*)(base_ios&));
- };
-
-
- std::string input_to_utf8(input_string const&);
- fs::path input_to_path(input_string const&);
-
- std::string path_to_generic(fs::path const&);
- fs::path generic_to_path(boost::string_ref);
-
- void initialise_output();
-
- ostream& out();
-
- // Preformats an error/warning message so that it can be parsed by
- // common IDEs. Uses the ms_errors global to determine if VS format
- // or GCC format. Returns the stream to continue ouput of the verbose
- // error message.
- ostream& outerr();
- ostream& outerr(fs::path const& file, int line = -1);
- ostream& outwarn(fs::path const& file, int line = -1);
- ostream& outerr(file_ptr const&, string_iterator);
- ostream& outwarn(file_ptr const&, string_iterator);
- }
-}
-
-#endif

Modified: trunk/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/main_grammar.cpp Tue Nov 12 04:15:40 2013 (r86644)
+++ trunk/tools/quickbook/src/main_grammar.cpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -17,7 +17,7 @@
 #include "phrase_tags.hpp"
 #include "parsers.hpp"
 #include "scoped.hpp"
-#include "input_path.hpp"
+#include "native_text.hpp"
 #include <boost/spirit/include/classic_core.hpp>
 #include <boost/spirit/include/classic_chset.hpp>
 #include <boost/spirit/include/classic_if.hpp>

Copied and modified: trunk/tools/quickbook/src/native_text.cpp (from r86644, trunk/tools/quickbook/src/input_path.cpp)
==============================================================================
--- trunk/tools/quickbook/src/input_path.cpp Tue Nov 12 04:15:40 2013 (r86644, copy source)
+++ trunk/tools/quickbook/src/native_text.cpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -8,7 +8,7 @@
 
 #include <boost/program_options.hpp>
 #include <iostream>
-#include "input_path.hpp"
+#include "native_text.hpp"
 #include "utils.hpp"
 #include "files.hpp"
 

Copied and modified: trunk/tools/quickbook/src/native_text.hpp (from r86644, trunk/tools/quickbook/src/input_path.hpp)
==============================================================================
--- trunk/tools/quickbook/src/input_path.hpp Tue Nov 12 04:15:40 2013 (r86644, copy source)
+++ trunk/tools/quickbook/src/native_text.hpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -6,6 +6,8 @@
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 
+// For handling native strings and streams.
+
 #if !defined(BOOST_QUICKBOOK_DETAIL_INPUT_PATH_HPP)
 #define BOOST_QUICKBOOK_DETAIL_INPUT_PATH_HPP
 

Modified: trunk/tools/quickbook/src/quickbook.cpp
==============================================================================
--- trunk/tools/quickbook/src/quickbook.cpp Tue Nov 12 04:15:40 2013 (r86644)
+++ trunk/tools/quickbook/src/quickbook.cpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -14,7 +14,7 @@
 #include "post_process.hpp"
 #include "utils.hpp"
 #include "files.hpp"
-#include "input_path.hpp"
+#include "native_text.hpp"
 #include "document_state.hpp"
 #include <boost/program_options.hpp>
 #include <boost/filesystem/path.hpp>

Modified: trunk/tools/quickbook/src/state.cpp
==============================================================================
--- trunk/tools/quickbook/src/state.cpp Tue Nov 12 04:15:40 2013 (r86644)
+++ trunk/tools/quickbook/src/state.cpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -12,7 +12,7 @@
 #include "state_save.hpp"
 #include "quickbook.hpp"
 #include "grammar.hpp"
-#include "input_path.hpp"
+#include "native_text.hpp"
 #include "utils.hpp"
 #include "phrase_tags.hpp"
 

Modified: trunk/tools/quickbook/src/syntax_highlight.cpp
==============================================================================
--- trunk/tools/quickbook/src/syntax_highlight.cpp Tue Nov 12 04:15:40 2013 (r86644)
+++ trunk/tools/quickbook/src/syntax_highlight.cpp 2013-11-12 04:16:18 EST (Tue, 12 Nov 2013) (r86645)
@@ -17,7 +17,7 @@
 #include "actions.hpp"
 #include "utils.hpp"
 #include "files.hpp"
-#include "input_path.hpp"
+#include "native_text.hpp"
 #include "phrase_tags.hpp"
 
 namespace quickbook


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk