Skip to content

Commit

Permalink
馃帀 Tiny buffers are golden now, thanks @lunasorcery 馃挌馃挌
Browse files Browse the repository at this point in the history
- 馃摑 Fix up some of the documentation for execution and friends
- 馃洜 Completely revamp the __scheme_handler for decode and encode steps
- 馃洜 Fix up some of the CMake Files
  • Loading branch information
ThePhD committed Jul 27, 2021
1 parent a57714b commit 6cf1fa1
Show file tree
Hide file tree
Showing 206 changed files with 2,796 additions and 907 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ if (ZTD_TEXT_IS_TOP_LEVEL_PROJECT)
check_compiler_flag(warn-pedantic MSVC /permissive- GCC -pedantic)
check_compiler_flag(warn-all MSVC /W4 GCC -Wall)
check_compiler_flag(warn-errors MSVC /WX GCC -Werror)
check_compiler_flag(warn-extra GCC -Wextra CLANG -Wextra)
check_compiler_flag(utf8-literal-encoding MSVC /execution-charset:utf-8 GCC -fexec-charset=utf-8)
check_compiler_flag(utf8-source-encoding MSVC /source-charset:utf-8 GCC -finput-charset=utf-8)
check_compiler_flag(extra-constexpr-depth MSVC /constexpr:depth2147483647 GCC -fconstexpr-depth=2147483647 CLANG -fconstexpr-depth=2147483647)
Expand Down Expand Up @@ -205,5 +206,6 @@ if (ZTD_TEXT_SCRATCH)
${--disable-permissive}
${--warn-pedantic}
${--warn-all}
${--warn-extra}
${--warn-errors})
endif()
3 changes: 1 addition & 2 deletions cmake/ztd.text-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ endif()
if(TARGET ztd::text::single)
get_target_property(ZTD_TEXT_SINGLE_INCLUDE_DIRS
ztd.text.single INTERFACE_INCLUDE_DIRECTORIES)
set_and_check(ZTD_TEXT_INCLUDE_DIRS "${ZTD_TEXT_SINGLE_INCLUDE_DIRS}")
set(ZTD_TEXT_LIBRARIES_SINGLE ztd::text::single)
set_and_check(ZTD_TEXT_SINGLE_INCLUDE_DIRS "${ZTD_TEXT_SINGLE_INCLUDE_DIRS}")
if (TARGET ztd::cuneicode::single)
set(ZTD_TEXT_LIBRARIES_SINGLE ztd::text::single ztd::cuneicode::single)
else()
Expand Down
19 changes: 16 additions & 3 deletions documentation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ include(GNUInstallDirs)
# Find all the public headers
file(GLOB_RECURSE ztd_text_public_headers
LIST_DIRECTORIES NO
CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/include/**.*)
CONFIGURE_DEPENDS
${PROJECT_SOURCE_DIR}/include/**.*)
# make a list copy for use with dependency tracking later down below
set(ztd_text_doxygen_public_headers ${ztd_text_public_headers})
# Remove every single public header
list(FILTER ztd_text_doxygen_public_headers EXCLUDE REGEX /detail/.*)
# separate text with spaces and surround them with quotes for Doxygen to understand them all
list(TRANSFORM ztd_text_doxygen_public_headers REPLACE "(.+)" [["\1"]])
list(JOIN ztd_text_doxygen_public_headers " " ztd_text_doxygen_public_headers)
# do the same for the include paths
get_target_property(ztd_text_doxygen_include_paths ztd::text INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(ztd_idk_doxygen_include_paths ztd::idk INTERFACE_INCLUDE_DIRECTORIES)
list(TRANSFORM ztd_text_doxygen_include_paths REPLACE "(.+)" [["\1"]])
list(TRANSFORM ztd_idk_doxygen_include_paths REPLACE "(.+)" [["\1"]])
list(JOIN ztd_text_doxygen_include_paths " " ztd_text_doxygen_include_paths)
list(JOIN ztd_idk_doxygen_include_paths " " ztd_text_doxygen_include_paths)

set(ZTD_TEXT_DOXYGEN_PROJECT_DESCRIPTION ${PROJECT_DESCRIPTION})
set(ZTD_TEXT_DOXYGEN_PROJECT_VERSION ${PROJECT_VERSION})
Expand All @@ -55,6 +63,7 @@ set(ZTD_TEXT_DOXYGEN_INPUT ${ztd_text_doxygen_public_headers})
set(ZTD_TEXT_DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doxygen)
set(ZTD_TEXT_DOXYGEN_XML_OUTPUT_DIR ${ZTD_TEXT_DOXYGEN_OUTPUT_DIR}/xml)
set(ZTD_TEXT_DOXYGEN_HTML_OUTPUT_DIR ${ZTD_TEXT_DOXYGEN_OUTPUT_DIR}/html)
set(ZTD_TEXT_DOXYGEN_INCLUDE_PATH ${ztd_text_doxygen_include_paths})
set(ZTD_TEXT_DOXYGEN_INDEX_FILE ${ZTD_TEXT_DOXYGEN_XML_OUTPUT_DIR}/index.xml)
set(ZTD_TEXT_DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(ZTD_TEXT_DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
Expand All @@ -66,8 +75,12 @@ file(GLOB_RECURSE ztd_text_sphinx_sources
LIST_DIRECTORIES NO
CONFIGURE_DEPENDS ${ZTD_TEXT_SPHINX_SOURCE_DIR}/**.*)

#Replace variables inside @@ with the current values
configure_file(${ZTD_TEXT_DOXYFILE_IN} ${ZTD_TEXT_DOXYFILE_OUT} @ONLY)
# Do generator expressions and
# Replace variables inside @...@ with the current values
set(ZTD_TEXT_DOXYFILE_IN_CONFIGURED ${ZTD_TEXT_DOXYFILE_OUT}.conf)
configure_file(${ZTD_TEXT_DOXYFILE_IN} ${ZTD_TEXT_DOXYFILE_IN_CONFIGURED} @ONLY)
file(GENERATE OUTPUT ${ZTD_TEXT_DOXYFILE_OUT}
INPUT ${ZTD_TEXT_DOXYFILE_IN_CONFIGURED})

# Ensure Doxygen/Sphinx won't crash because it doesn't create directories for us
file(MAKE_DIRECTORY ${ZTD_TEXT_DOXYGEN_OUTPUT_DIR})
Expand Down
2 changes: 1 addition & 1 deletion documentation/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -2266,7 +2266,7 @@ SEARCH_INCLUDES = YES
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.

INCLUDE_PATH =
INCLUDE_PATH = @ZTD_TEXT_DOXYGEN_INCLUDE_PATH@

# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/code_point.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/code_unit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/containers/basic_text.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/contains_unicode_encoding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/conversions/count_decodable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/conversions/count_encodable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/conversions/decode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/conversions/encode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/conversions/transcode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/count_result.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/decode_result.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/decode_state.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/default_code_point_encoding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/default_code_unit_encoding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/encode_result.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/encode_state.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/encoding_error.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/encodings/any_encoding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/encodings/any_encoding_with.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/encodings/ascii.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/encodings/cuneicode_encoding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/encodings/encoding_scheme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
39 changes: 38 additions & 1 deletion documentation/source/api/encodings/execution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -31,4 +31,41 @@
Execution
=========

This is the locale-based, runtime encoding. It uses a number of compile-time and runtime heuristics to eventually be resolved to an implementation-defined encoding. It is not required to work in constant expressions either: for this, use :doc:`ztd::text::literal </api/encodings/literal>`, which represents the compile-time string (e.g. ``"my string"``) encoding.

Currently, the hierachy of behaviors is like so:

- If the platform is MacOS, then it assumes this is :doc:`UTF-8 </api/encodings/utf8>`;
- Otherwise, if libiconv is available, then it attempts to use :doc:`iconv </api/encodings/iconv_encoding>` configured to the ``"char"``-identified encoding;
- Otherwise, if the headers ``<cuchar>`` or ``<uchar.h>`` are available, then it attempts to use a gnarly, lossy, and dangerous encoding that potentially traffics through the C Standard Library and Locale APIs;
- Otherwise, it produces a compile-time error.

.. warning::

The C Standard Library has many design defects in its production of code points, which may make it unsuitable even if your C Standard Library recognizes certain locales (e.g., Big5-HKSCS). The runtime will always attempt to load ``iconv`` if the definition is turned on, since it may do a better job than the C Standard Library's interfaces until C23.

Even if, on a given platform, it can be assumed to be a static encoding (e.g., Apple/MacOS where it always returns the "C" Locale but processes text as UTF-8), ``ztd::text::execution`` will always present itself as a runtime and unknowable encoding. This is to prevent portability issues from relying on, e.g., ``ztd::text::is_decode_injective_v<ztd::text::execution>`` being true during development and working with that assumption, only to have it break when ported to a platform where that assumption no longer holds.

.. doxygentypedef:: ztd::text::execution



Internal Types
--------------

.. warning::

|reserved_name|


.. ``<cuchar>``-based
.. ++++++++++++++++++
..
.. .. doxygenclass:: ztd::text::__txt_impl::__execution_cuchar
.. :members:
MacOS-based
+++++++++++

.. doxygenclass:: ztd::text::__txt_impl::__execution_mac_os
:members:
2 changes: 1 addition & 1 deletion documentation/source/api/encodings/iconv_encoding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion documentation/source/api/encodings/literal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.. file except in compliance with the License. You may obtain a copy of the
.. License at
..
.. http:..www.apache.org/licenses/LICENSE-2.0
.. https://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
Expand Down

0 comments on commit 6cf1fa1

Please sign in to comment.