Skip to content

Commit

Permalink
PEGTL: avoiding mmap on Windows until we upgrade to PEGTL v3
Browse files Browse the repository at this point in the history
because PEGTL v2 API doesn't support Unicode filenames
(and also, including <windows.h> has side-effects)
  • Loading branch information
wojdyr committed Mar 14, 2024
1 parent 028efcb commit 1f189ee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 230 deletions.
7 changes: 5 additions & 2 deletions include/gemmi/third_party/tao/NOTES
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
This directory contains files from PEGTL 2.8.3:
LICENSE and include/tao/* except include/tao/pegtl/contrib
with minor local modifications (in position.hpp and input_error.hpp):
LICENSE and include/tao/pegtl* except contrib/ and file_mapper_win32.hpp
with minor modifications (in position.hpp, input_error.hpp, file_input.hpp):
- changed formatting of error messages,
- using std::system_error instead of pegtl::input_error.
- avoiding mmap on Windows (until we upgrade to PEGTL v3),
because PEGTL v2 API doesn't support Unicode filenames
(and also, including <windows.h> has side-effects)

PEGTL can be updated to v3 only when gemmi drops support for C++11/14.
https://github.com/project-gemmi/gemmi/issues/212
4 changes: 2 additions & 2 deletions include/gemmi/third_party/tao/pegtl/file_input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <unistd.h> // Required for _POSIX_MAPPED_FILES
#endif

#if defined( _POSIX_MAPPED_FILES ) || defined( _WIN32 )
#if defined( _POSIX_MAPPED_FILES )
#include "mmap_input.hpp"
#else
#include "read_input.hpp"
Expand All @@ -22,7 +22,7 @@ namespace tao
{
namespace TAO_PEGTL_NAMESPACE
{
#if defined( _POSIX_MAPPED_FILES ) || defined( _WIN32 )
#if defined( _POSIX_MAPPED_FILES )
template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf >
struct file_input
: mmap_input< P, Eol >
Expand Down
226 changes: 0 additions & 226 deletions include/gemmi/third_party/tao/pegtl/internal/file_mapper_win32.hpp

This file was deleted.

0 comments on commit 1f189ee

Please sign in to comment.