2
0
mirror of https://github.com/boostorg/spirit.git synced 2026-01-19 04:42:11 +00:00

Revert "Merge pull request #817 from saki7/modernize-char-string"

This reverts commit b6acdc57d3, reversing
changes made to 1ef37da85d.
This commit is contained in:
Nana Sakisaka
2025-09-13 08:56:57 +09:00
parent 385a9c3f06
commit 14dfeaffdc
57 changed files with 1873 additions and 13380 deletions

View File

@@ -1,6 +1,5 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2025 Nana Sakisaka
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)
@@ -9,6 +8,7 @@
#include <boost/phoenix.hpp>
#include <boost/unordered_map.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/cstdint.hpp>
#include <boost/foreach.hpp>
#include <boost/array.hpp>
#include <boost/scoped_array.hpp>
@@ -22,12 +22,10 @@
#include <string>
#include <map>
#include <cstdint>
// We place the data here. Each line comprises various fields
using ucd_line = std::vector<std::string>;
using ucd_vector = std::vector<ucd_line>;
using ucd_iterator = std::vector<ucd_line>::iterator;
typedef std::vector<std::string> ucd_line;
typedef std::vector<ucd_line> ucd_vector;
typedef std::vector<ucd_line>::iterator ucd_iterator;
// spirit and phoenix using declarations
using boost::spirit::qi::parse;
@@ -42,9 +40,9 @@ using boost::phoenix::push_back;
using boost::phoenix::ref;
// basic unsigned types
using std::uint8_t;
using std::uint16_t;
using std::uint32_t;
using boost::uint8_t;
using boost::uint16_t;
using boost::uint32_t;
enum code_action
{
@@ -537,16 +535,15 @@ void print_head(Out& out)
out
<< "/*=============================================================================\n"
<< " Copyright (c) 2001-2011 Joel de Guzman\n"
<< " Copyright (c) 2025 Nana Sakisaka\n"
<< "\n"
<< " Distributed under the Boost Software License, Version 1.0. (See accompanying\n"
<< " file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n"
<< "\n"
<< " AUTOGENERATED. DO NOT EDIT!!!\n"
<< "==============================================================================*/\n"
<< "#include <cstdint>\n"
<< "#include <boost/cstdint.hpp>\n"
<< "\n"
<< "namespace boost::spirit::x3::unicode::detail\n"
<< "namespace boost { namespace spirit { namespace ucd { namespace detail\n"
<< "{"
;
}
@@ -556,7 +553,7 @@ void print_tail(Out& out)
{
out
<< "\n"
<< "} // boost::spirit::x3::unicode::detail\n"
<< "}}}} // namespace boost::spirit::unicode::detail\n"
;
}
@@ -564,10 +561,10 @@ char const* get_int_type_name(int size)
{
switch (size)
{
case 1: return "std::uint8_t";
case 2: return "std::uint16_t";
case 4: return "std::uint32_t";
case 5: return "std::uint64_t";
case 1: return "::boost::uint8_t";
case 2: return "::boost::uint16_t";
case 4: return "::boost::uint32_t";
case 5: return "::boost::uint64_t";
default: BOOST_ASSERT(false); return 0; // invalid size
};
}
@@ -591,7 +588,7 @@ void print_file(Out& out, Builder& builder, int field_width, char const* name)
out
<< "\n"
<< " inline constexpr std::uint8_t " << name << "_stage1[] = {\n"
<< " static const ::boost::uint8_t " << name << "_stage1[] = {\n"
<< "\n"
;
@@ -603,7 +600,7 @@ void print_file(Out& out, Builder& builder, int field_width, char const* name)
<< " };"
<< "\n"
<< "\n"
<< " inline constexpr " << int_name << ' ' << name << "_stage2[] = {"
<< " static const " << int_name << ' ' << name << "_stage2[] = {"
;
int block_n = 0;
@@ -624,9 +621,9 @@ void print_file(Out& out, Builder& builder, int field_width, char const* name)
out
<< "\n"
<< " [[nodiscard]] constexpr " << int_name << ' ' << name << "_lookup(std::uint32_t ch) noexcept\n"
<< " inline " << int_name << ' ' << name << "_lookup(::boost::uint32_t ch)\n"
<< " {\n"
<< " std::uint32_t block_offset = " << name << "_stage1[ch / " << block_size << "] * " << block_size << ";\n"
<< " ::boost::uint32_t block_offset = " << name << "_stage1[ch / " << block_size << "] * " << block_size << ";\n"
<< " return " << name << "_stage2[block_offset + ch % " << block_size << "];\n"
<< " }\n"
;
@@ -669,4 +666,6 @@ int main()
builder.collect("UnicodeData.txt", 12, assign_code_value);
print_file(out, builder, 6, "uppercase");
}
return 0;
}