From e40aac095c1df245b680763a536fa6cd4f17d0a1 Mon Sep 17 00:00:00 2001 From: Romain Geissler Date: Sun, 29 Jun 2025 10:02:15 +0000 Subject: [PATCH] Remove the deprecated POSIX API and make Boost.Regex header only. Closes #253 --- .github/workflows/ci.yml | 2 +- build.jam | 3 +- build/Jamfile.v2 | 163 ------ doc/html/boost_regex/ref/posix.html | 551 ------------------ doc/posix_api.qbk | 142 ----- doc/regex.qbk | 7 - example/Jamfile.v2 | 1 - performance/config/posix.cpp | 15 - performance/posix.cpp | 97 --- src/posix_api.cpp | 290 --------- src/wide_posix_api.cpp | 303 ---------- test/Jamfile.v2 | 161 ++++- test/c_compiler_checks/posix_api_check.c | 64 -- test/c_compiler_checks/posix_api_check.cpp | 65 --- test/c_compiler_checks/wide_posix_api_check.c | 89 --- .../wide_posix_api_check.cpp | 102 ---- test/captures/Jamfile.v2 | 23 - {build => test}/has_icu_test.cpp | 0 test/noeh_test/Jamfile.v2 | 35 -- test/test_consolidated.cpp | 14 - 20 files changed, 139 insertions(+), 1988 deletions(-) delete mode 100644 build/Jamfile.v2 delete mode 100644 doc/html/boost_regex/ref/posix.html delete mode 100644 doc/posix_api.qbk delete mode 100644 performance/config/posix.cpp delete mode 100644 performance/posix.cpp delete mode 100644 src/posix_api.cpp delete mode 100644 src/wide_posix_api.cpp delete mode 100644 test/c_compiler_checks/posix_api_check.c delete mode 100644 test/c_compiler_checks/posix_api_check.cpp delete mode 100644 test/c_compiler_checks/wide_posix_api_check.c delete mode 100644 test/c_compiler_checks/wide_posix_api_check.cpp delete mode 100644 test/captures/Jamfile.v2 rename {build => test}/has_icu_test.cpp (100%) delete mode 100644 test/noeh_test/Jamfile.v2 delete mode 100644 test/test_consolidated.cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca46c5d58..37cb5d955 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: - name: Install packages run: sudo apt install libicu-dev - name: Test - run: ${{ matrix.compiler }} -std=${{ matrix.standard }} -I../../include *.cpp ../../src/*.cpp -o regress && ./regress + run: ${{ matrix.compiler }} -std=${{ matrix.standard }} -I../../include *.cpp -o regress && ./regress working-directory: ./test/regress ubuntu-jammy-clang: runs-on: ubuntu-22.04 diff --git a/build.jam b/build.jam index b4223a583..97f83d9b5 100644 --- a/build.jam +++ b/build.jam @@ -20,11 +20,10 @@ project /boost/regex ; explicit - [ alias boost_regex : build//boost_regex ] + [ alias boost_regex : : : : include $(boost_dependencies) ] [ alias all : boost_regex example test ] ; call-if : boost-library regex - : install boost_regex ; diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 deleted file mode 100644 index c67a1b278..000000000 --- a/build/Jamfile.v2 +++ /dev/null @@ -1,163 +0,0 @@ -# copyright John Maddock 2003 -# 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. - -import modules ; -import testing ; -import errors ; - -constant boost_dependencies_private : - /boost/core//boost_core - ; - -project - : default-build all - : common-requirements $(boost_dependencies) - : requirements $(boost_dependencies_private) - ; - -local disable-icu = [ MATCH (--disable-icu) : [ modules.peek : ARGV ] ] ; - -rule path_options ( properties * ) -{ - local result ; - if 64 in $(properties) && msvc in $(properties) - { - result = $(ICU_PATH)/bin64 $(ICU_PATH)/lib64 ; - } - else - { - result = $(ICU_PATH)/bin $(ICU_PATH)/lib ; - } - return $(result) ; -} - -# -# ICU configuration: -# -if ! $(disable-icu) -{ - if [ modules.peek : ICU_LINK ] - { - errors.user-error : "The ICU_LINK option is no longer supported by the Boost.Regex build - please refer to the documentation for equivalent options" ; - } - - if [ modules.peek : ICU_PATH ] - { - ICU_PATH = [ modules.peek : ICU_PATH ] ; - } - if [ modules.peek : ICU_ICUUC_NAME ] - { - ICU_ICUUC_NAME = [ modules.peek : ICU_ICUUC_NAME ] ; - } - if [ modules.peek : ICU_ICUDT_NAME ] - { - ICU_ICUDT_NAME = [ modules.peek : ICU_ICUDT_NAME ] ; - } - if [ modules.peek : ICU_ICUIN_NAME ] - { - ICU_ICUIN_NAME = [ modules.peek : ICU_ICUIN_NAME ] ; - } - - if $(ICU_ICUUC_NAME) - { - lib icuuc : : $(ICU_ICUUC_NAME) @path_options ; - } - else - { - lib icuuc : : shared @path_options ; - lib icuuc : : msvc debug icuucd shared @path_options ; - lib icuuc : : intel windows debug icuucd shared @path_options ; - lib icuuc : : sicuuc static @path_options ; - lib icuuc : : msvc debug sicuucd static @path_options ; - lib icuuc : : intel windows debug sicuucd static @path_options ; - lib icuuc : : this_is_an_invalid_library_name ; - } - if $(ICU_ICUDT_NAME) - { - lib icudt : : $(ICU_ICUDT_NAME) @path_options ; - } - else - { - lib icudt : : icudata shared @path_options ; - lib icudt : : icudt msvc shared @path_options ; - lib icudt : : icudt intel windows shared @path_options ; - lib icudt : : sicudata static @path_options ; - lib icudt : : sicudt msvc static @path_options ; - lib icudt : : sicudt intel windows static @path_options ; - lib icudt : : this_is_an_invalid_library_name ; - } - if $(ICU_ICUIN_NAME) - { - lib icuin : : $(ICU_ICUIN_NAME) @path_options ; - } - else - { - lib icuin : : icui18n shared @path_options ; - lib icuin : : msvc debug icuind shared @path_options ; - lib icuin : : msvc icuin shared @path_options ; - lib icuin : : intel windows debug icuind shared @path_options ; - lib icuin : : intel windows icuin shared @path_options ; - lib icuin : : sicui18n static @path_options ; - lib icuin : : msvc debug sicuind static @path_options ; - lib icuin : : msvc sicuin static @path_options ; - lib icuin : : intel windows debug sicuind static @path_options ; - lib icuin : : intel windows sicuin static @path_options ; - lib icuin : : this_is_an_invalid_library_name ; - } - - ICU_OPTS = - $(ICU_PATH)/include - shared:icuuc/shared - shared:icudt/shared - shared:icuin/shared - static:icuuc - static:icudt - static:icuin - windows,clang:"advapi32.lib" - BOOST_HAS_ICU=1 - static:U_STATIC_IMPLEMENTATION=1 - ; - - if [ modules.peek : ICU_DATA_DIR ] - { - rule data-dir-options ( properties * ) - { - local result ; - local data_dir = [ modules.peek : ICU_DATA_DIR ] ; - if emscripten in $(properties) - { - result = ICU_DATA_DIR=\\\"/$(data_dir:BS)\\\" - "--embed-file $(data_dir)@/$(data_dir:BS)" - ; - } - else - { - result = ICU_DATA_DIR=\\\"$(data_dir)\\\" ; - } - return $(result) ; - } - - ICU_OPTS += @data-dir-options ; - } - -} - -exe has_icu : has_icu_test.cpp : $(ICU_OPTS) ; -explicit has_icu ; - -alias icu_options : : : : [ check-target-builds has_icu : $(ICU_OPTS) : ] ; - -SOURCES = - posix_api.cpp - wide_posix_api.cpp -; - -lib boost_regex : ../src/$(SOURCES) icu_options - : - shared:BOOST_REGEX_DYN_LINK=1 - gcc-cygwin:static - : : - BOOST_REGEX_NO_LIB=1 - ; diff --git a/doc/html/boost_regex/ref/posix.html b/doc/html/boost_regex/ref/posix.html deleted file mode 100644 index 0782ded38..000000000 --- a/doc/html/boost_regex/ref/posix.html +++ /dev/null @@ -1,551 +0,0 @@ - - - -POSIX Compatible C API's - - - - - - - - - - - - - - - - -
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
-
-
-PrevUpHomeNext -
-
- -
- - - - - -
[Note]Note

- this is an abridged reference to the POSIX API functions, these are provided - for compatibility with other libraries, rather than as an API to be used - in new code (unless you need access from a language other than C++). This - version of these functions should also happily coexist with other versions, - as the names used are macros that expand to the actual function names. -

-
#include <boost/cregex.hpp>
-
-

- or: -

-
#include <boost/regex.h>
-
-

- The following functions are available for users who need a POSIX compatible - C library, they are available in both Unicode and narrow character versions, - the standard POSIX API names are macros that expand to one version or the - other depending upon whether UNICODE is defined or not. -

-
- - - - - -
[Important]Important

- Note that all the symbols defined here are enclosed inside namespace boost when used in C++ programs, unless - you use #include <boost/regex.h> - instead - in which case the symbols are still defined in namespace boost, - but are made available in the global namespace as well. -

-

- The functions are defined as: -

-
extern "C" {
-
-struct regex_tA;
-struct regex_tW;
-
-int regcompA(regex_tA*, const char*, int);
-unsigned int regerrorA(int, const regex_tA*, char*, unsigned int);
-int regexecA(const regex_tA*, const char*, unsigned int, regmatch_t*, int);
-void regfreeA(regex_tA*);
-
-int regcompW(regex_tW*, const wchar_t*, int);
-unsigned int regerrorW(int, const regex_tW*, wchar_t*, unsigned int);
-int regexecW(const regex_tW*, const wchar_t*, unsigned int, regmatch_t*, int);
-void regfreeW(regex_tW*);
-
-#ifdef UNICODE
-#define regcomp regcompW
-#define regerror regerrorW
-#define regexec regexecW
-#define regfree regfreeW
-#define regex_t regex_tW
-#else
-#define regcomp regcompA
-#define regerror regerrorA
-#define regexec regexecA
-#define regfree regfreeA
-#define regex_t regex_tA
-#endif
-}
-
-

- All the functions operate on structure regex_t, which exposes two public - members: -

-
---- - - - - - - - - - - - - - - -
-

- Member -

-
-

- Meaning -

-
-

- unsigned int - re_nsub -

-
-

- This is filled in by regcomp - and indicates the number of sub-expressions contained in the regular - expression. -

-
-

- const TCHAR* re_endp -

-
-

- Points to the end of the expression to compile when the flag REG_PEND - is set. -

-
-
- - - - - -
[Note]Note

- regex_t is actually a - #define - it is either - regex_tA or regex_tW depending upon whether UNICODE is defined or not, TCHAR is either char - or wchar_t again depending - upon the macro UNICODE. -

-
- - regcomp -
-

- regcomp takes a pointer to - a regex_t, a pointer to the - expression to compile and a flags parameter which can be a combination of: -

-
---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Flag -

-
-

- Meaning -

-
-

- REG_EXTENDED -

-
-

- Compiles modern regular expressions. Equivalent to regbase::char_classes | - regbase::intervals | - regbase::bk_refs. -

-
-

- REG_BASIC -

-
-

- Compiles basic (obsolete) regular expression syntax. Equivalent - to regbase::char_classes | - regbase::intervals | - regbase::limited_ops | - regbase::bk_braces | - regbase::bk_parens | - regbase::bk_refs. -

-
-

- REG_NOSPEC -

-
-

- All characters are ordinary, the expression is a literal string. -

-
-

- REG_ICASE -

-
-

- Compiles for matching that ignores character case. -

-
-

- REG_NOSUB -

-
-

- Has no effect in this library. -

-
-

- REG_NEWLINE -

-
-

- When this flag is set a dot does not match the newline character. -

-
-

- REG_PEND -

-
-

- When this flag is set the re_endp parameter of the regex_t structure - must point to the end of the regular expression to compile. -

-
-

- REG_NOCOLLATE -

-
-

- When this flag is set then locale dependent collation for character - ranges is turned off. -

-
-

- REG_ESCAPE_IN_LISTS -

-
-

- When this flag is set, then escape sequences are permitted in bracket - expressions (character sets). -

-
-

- REG_NEWLINE_ALT -

-
-

- When this flag is set then the newline character is equivalent - to the alternation operator |. -

-
-

- REG_PERL -

-
-

- Compiles Perl like regular expressions. -

-
-

- REG_AWK -

-
-

- A shortcut for awk-like behavior: REG_EXTENDED - | REG_ESCAPE_IN_LISTS -

-
-

- REG_GREP -

-
-

- A shortcut for grep like behavior: REG_BASIC - | REG_NEWLINE_ALT -

-
-

- REG_EGREP -

-
-

- A shortcut for egrep like behavior: REG_EXTENDED - | REG_NEWLINE_ALT -

-
-
- - regerror -
-

- regerror takes the following parameters, it maps an error code to a human - readable string: -

-
---- - - - - - - - - - - - - - - - - - - - - - - -
-

- Parameter -

-
-

- Meaning -

-
-

- int code -

-
-

- The error code. -

-
-

- const regex_t* e -

-
-

- The regular expression (can be null). -

-
-

- char* buf -

-
-

- The buffer to fill in with the error message. -

-
-

- unsigned int buf_size -

-
-

- The length of buf. -

-
-

- If the error code is OR'ed with REG_ITOA then the message that results is - the printable name of the code rather than a message, for example "REG_BADPAT". - If the code is REG_ATIO then e must not be null and e->re_pend must point - to the printable name of an error code, the return value is then the value - of the error code. For any other value of code, the return value is the number - of characters in the error message, if the return value is greater than or - equal to buf_size then regerror will have to be called again with a larger - buffer. -

-
- - regexec -
-

- regexec finds the first occurrence of expression e within string buf. If - len is non-zero then *m is filled in with what matched - the regular expression, m[0] contains what matched the whole string, m[1] - the first sub-expression etc, see regmatch_t in the header file declaration - for more details. The eflags parameter can be a combination of: -

-
---- - - - - - - - - - - - - - - - - - - -
-

- Flag -

-
-

- Meaning -

-
-

- REG_NOTBOL -

-
-

- Parameter buf does not represent the start of a line. -

-
-

- REG_NOTEOL -

-
-

- Parameter buf does not terminate at the end of a line. -

-
-

- REG_STARTEND -

-
-

- The string searched starts at buf + pmatch[0].rm_so and ends at - buf + pmatch[0].rm_eo. -

-
-
- - regfree -
-

- regfree frees all the memory - that was allocated by regcomp. -

-
- -
-
-PrevUpHomeNext -
- - diff --git a/doc/posix_api.qbk b/doc/posix_api.qbk deleted file mode 100644 index beffa4647..000000000 --- a/doc/posix_api.qbk +++ /dev/null @@ -1,142 +0,0 @@ -[/ - Copyright 2006-2007 John Maddock. - 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). -] - -[section:posix POSIX Compatible C API's] - -[note this is an abridged reference to the POSIX API functions, these are provided -for compatibility with other libraries, rather than as an API to be used -in new code (unless you need access from a language other than C++). -This version of these functions should also happily coexist with other versions, -as the names used are macros that expand to the actual function names.] - - #include - -or: - - #include - -The following functions are available for users who need a POSIX compatible -C library, they are available in both Unicode and narrow character versions, -the standard POSIX API names are macros that expand to one version or the -other depending upon whether UNICODE is defined or not. - -[important Note that all the symbols defined here are enclosed inside namespace -`boost` when used in C++ programs, unless you use `#include ` -instead - in which case the symbols are still defined in namespace boost, but -are made available in the global namespace as well.] - -The functions are defined as: - - extern "C" { - - struct regex_tA; - struct regex_tW; - - int regcompA(regex_tA*, const char*, int); - unsigned int regerrorA(int, const regex_tA*, char*, unsigned int); - int regexecA(const regex_tA*, const char*, unsigned int, regmatch_t*, int); - void regfreeA(regex_tA*); - - int regcompW(regex_tW*, const wchar_t*, int); - unsigned int regerrorW(int, const regex_tW*, wchar_t*, unsigned int); - int regexecW(const regex_tW*, const wchar_t*, unsigned int, regmatch_t*, int); - void regfreeW(regex_tW*); - - #ifdef UNICODE - #define regcomp regcompW - #define regerror regerrorW - #define regexec regexecW - #define regfree regfreeW - #define regex_t regex_tW - #else - #define regcomp regcompA - #define regerror regerrorA - #define regexec regexecA - #define regfree regfreeA - #define regex_t regex_tA - #endif - } - -All the functions operate on structure regex_t, which exposes two public members: - -[table -[[Member][Meaning]] -[[`unsigned int re_nsub`][This is filled in by `regcomp` and indicates the number of sub-expressions contained in the regular expression.]] -[[`const TCHAR* re_endp`][Points to the end of the expression to compile when the flag REG_PEND is set.]] -] - -[note `regex_t` is actually a `#define` - it is either `regex_tA` or `regex_tW` -depending upon whether `UNICODE` is defined or not, `TCHAR` is either `char` -or `wchar_t` again depending upon the macro `UNICODE`.] - -[#regcomp][h4 regcomp] - -`regcomp` takes a pointer to a `regex_t`, a pointer to the expression to -compile and a flags parameter which can be a combination of: - -[table -[[Flag][Meaning]] -[[REG_EXTENDED][Compiles modern regular expressions. Equivalent to `regbase::char_classes | regbase::intervals | regbase::bk_refs`. ]] -[[REG_BASIC][Compiles basic (obsolete) regular expression syntax. Equivalent to `regbase::char_classes | regbase::intervals | regbase::limited_ops | regbase::bk_braces | regbase::bk_parens | regbase::bk_refs`. ]] -[[REG_NOSPEC][All characters are ordinary, the expression is a literal string. ]] -[[REG_ICASE][Compiles for matching that ignores character case. ]] -[[REG_NOSUB][Has no effect in this library. ]] -[[REG_NEWLINE][When this flag is set a dot does not match the newline character. ]] -[[REG_PEND][When this flag is set the re_endp parameter of the regex_t structure must point to the end of the regular expression to compile. ]] -[[REG_NOCOLLATE][When this flag is set then locale dependent collation for character ranges is turned off. ]] -[[REG_ESCAPE_IN_LISTS][When this flag is set, then escape sequences are permitted in bracket expressions (character sets). ]] -[[REG_NEWLINE_ALT ][When this flag is set then the newline character is equivalent to the alternation operator |. ]] -[[REG_PERL][Compiles Perl like regular expressions. ]] -[[REG_AWK][A shortcut for awk-like behavior: `REG_EXTENDED | REG_ESCAPE_IN_LISTS` ]] -[[REG_GREP][A shortcut for grep like behavior: `REG_BASIC | REG_NEWLINE_ALT` ]] -[[REG_EGREP][A shortcut for egrep like behavior: `REG_EXTENDED | REG_NEWLINE_ALT` ]] -] - -[#regerror][h4 regerror] - -regerror takes the following parameters, it maps an error code to a human -readable string: - -[table -[[Parameter][Meaning]] -[[int code][The error code. ]] -[[const regex_t* e][The regular expression (can be null). ]] -[[char* buf][The buffer to fill in with the error message. ]] -[[unsigned int buf_size][The length of buf. ]] -] - -If the error code is OR'ed with REG_ITOA then the message that results is the -printable name of the code rather than a message, for example "REG_BADPAT". -If the code is REG_ATIO then e must not be null and e->re_pend must point -to the printable name of an error code, the return value is then the value -of the error code. For any other value of code, the return value is the -number of characters in the error message, if the return value is greater than -or equal to buf_size then regerror will have to be called again with a larger buffer. - -[#regexec][h4 regexec] - -regexec finds the first occurrence of expression e within string buf. -If len is non-zero then /*m/ is filled in with what matched the regular -expression, m[0] contains what matched the whole string, m[1] the -first sub-expression etc, see regmatch_t in the header file declaration -for more details. The eflags parameter can be a combination of: - -[table -[[Flag][Meaning]] -[[REG_NOTBOL][Parameter buf does not represent the start of a line. ]] -[[REG_NOTEOL][Parameter buf does not terminate at the end of a line. ]] -[[REG_STARTEND][The string searched starts at buf + pmatch\[0\].rm_so and ends at buf + pmatch\[0\].rm_eo. ]] -] - -[#regfree][h4 regfree] - -`regfree` frees all the memory that was allocated by regcomp. - -[endsect] - - - diff --git a/doc/regex.qbk b/doc/regex.qbk index ebad5c2e9..92d8a2263 100644 --- a/doc/regex.qbk +++ b/doc/regex.qbk @@ -39,12 +39,6 @@ [template sed_format[] [link boost_regex.format.sed_format Sed]] [template boost_extended_format[] [link boost_regex.format.boost_format_syntax Boost-Extended]] -[/depricated stuff:] -[template regcomp[] [link boost_regex.ref.posix.regcomp `regcomp`]] -[template regexec[] [link boost_regex.ref.posix.regexec `regexec`]] -[template regerror[] [link boost_regex.ref.posix.regerror `regerror`]] -[template regfree[] [link boost_regex.ref.posix.regfree `regfree`]] - A printer-friendly [@http://sourceforge.net/projects/boost/files/boost-docs/ PDF version of this manual is also available]. @@ -78,7 +72,6 @@ PDF version of this manual is also available]. [include regex_traits.qbk] [include non_std_strings.qbk] -[include posix_api.qbk] [include concepts.qbk] [section:deprecated Deprecated Interfaces] diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index 6126b7d05..bfceeaff9 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -65,7 +65,6 @@ test-suite regex-examples : [ regex-test-run snippets/regex_token_iterator_eg_2.cpp : $(HERE)/../doc/html/index.html ] [ regex-test-run snippets/regex_iterator_example.cpp : $(HERE)/../include/boost/regex/v5/regex_iterator.hpp ] [ run snippets/captures_example.cpp - ../test/captures//boost_regex_extra : : : multi BOOST_REGEX_MATCH_EXTRA=1 ] ; diff --git a/performance/config/posix.cpp b/performance/config/posix.cpp deleted file mode 100644 index 26ac6d625..000000000 --- a/performance/config/posix.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/////////////////////////////////////////////////////////////// -// Copyright 2015 John Maddock. 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_ -// - -#include - -int main() -{ - regex_t pe; - int r = regcomp(&pe, "foo", REG_EXTENDED); - regfree(&pe); - return r; -} diff --git a/performance/posix.cpp b/performance/posix.cpp deleted file mode 100644 index 37f2a8d6e..000000000 --- a/performance/posix.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/////////////////////////////////////////////////////////////// -// Copyright 2015 John Maddock. 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_ -// - -#ifdef TEST_POSIX - -#include "performance.hpp" -#include - -#include - -struct posix_regex : public abstract_regex -{ -private: - regex_t pe, pe2; - bool init; -public: - posix_regex() : init(false) {} - ~posix_regex() - { - if(init) - { - regfree(&pe); - regfree(&pe2); - } - } - virtual bool set_expression(const char* pat, bool isperl) - { - if(isperl) - return false; - if(init) - { - regfree(&pe); - regfree(&pe2); - } - else - init = true; - int r = regcomp(&pe, pat, REG_EXTENDED); - std::string s(pat); - if(s.size() && (s[0] != '^')) - s.insert(0, 1, '^'); - if(s.size() && (*s.rbegin() != '$')) - s.append("$"); - r |= regcomp(&pe2, s.c_str(), REG_EXTENDED); - return r ? false : true; - } - virtual bool match_test(const char* text); - virtual unsigned find_all(const char* text); - virtual std::string name(); - - struct initializer - { - initializer() - { - posix_regex::register_instance(boost::shared_ptr(new posix_regex)); - } - void do_nothing()const {} - }; - static const initializer init2; -}; - -const posix_regex::initializer posix_regex::init2; - - -bool posix_regex::match_test(const char * text) -{ - regmatch_t m[30]; - int r = regexec(&pe2, text, 30, m, 0); - return r == 0; -} - -unsigned posix_regex::find_all(const char * text) -{ - unsigned count = 0; - regmatch_t m[30]; - int flags = 0; - while(regexec(&pe, text, 30, m, flags) == 0) - { - ++count; - text += m[0].rm_eo; - if(m[0].rm_eo - m[0].rm_so) - flags = *(text - 1) == '\n' ? 0 : REG_NOTBOL; - else - flags = 0; - } - return 0; -} - -std::string posix_regex::name() -{ - init2.do_nothing(); - return "POSIX"; -} - -#endif diff --git a/src/posix_api.cpp b/src/posix_api.cpp deleted file mode 100644 index e30f9d8e1..000000000 --- a/src/posix_api.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/* - * - * Copyright (c) 1998-2002 - * John Maddock - * - * Use, modification and distribution are 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) - * - */ - - /* - * LOCATION: see http://www.boost.org for most recent version. - * FILE: posix_api.cpp - * VERSION: see - * DESCRIPTION: Implements the Posix API wrappers. - */ - -#define BOOST_REGEX_SOURCE - -#include -#include -#include - -#ifndef BOOST_WORKAROUND -#define BOOST_WORKAROUND(x, y) false -#endif - -#ifndef BOOST_REGEX_STANDALONE -#include -#else -namespace boost { namespace core { using std::snprintf; } } -#endif - -namespace boost{ - -namespace{ - -unsigned int magic_value = 25631; - -const char* names[] = { - "REG_NOERROR", - "REG_NOMATCH", - "REG_BADPAT", - "REG_ECOLLATE", - "REG_ECTYPE", - "REG_EESCAPE", - "REG_ESUBREG", - "REG_EBRACK", - "REG_EPAREN", - "REG_EBRACE", - "REG_BADBR", - "REG_ERANGE", - "REG_ESPACE", - "REG_BADRPT", - "REG_EEND", - "REG_ESIZE", - "REG_ERPAREN", - "REG_EMPTY", - "REG_ECOMPLEXITY", - "REG_ESTACK", - "REG_E_PERL", - "REG_E_UNKNOWN", -}; -} // namespace - -typedef boost::basic_regex > c_regex_type; - -#ifdef BOOST_MSVC -# pragma warning(push) -#pragma warning(disable:26812) -#endif -BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char* ptr, int f) -{ -#ifndef BOOST_NO_EXCEPTIONS - try{ -#endif - expression->guts = new c_regex_type(); -#ifndef BOOST_NO_EXCEPTIONS - } catch(...) - { - expression->guts = 0; - return REG_ESPACE; - } -#else - if(0 == expression->guts) - return REG_E_MEMORY; -#endif - // set default flags: - unsigned flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic); - expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default; - // and translate those that are actually set: - - if(f & REG_NOCOLLATE) - { - flags |= regex::nocollate; -#ifndef BOOST_REGEX_V3 - flags &= ~regex::collate; -#endif - } - - if(f & REG_NOSUB) - { - //expression->eflags |= match_any; - flags |= regex::nosubs; - } - - if(f & REG_NOSPEC) - flags |= regex::literal; - if(f & REG_ICASE) - flags |= regex::icase; - if(f & REG_ESCAPE_IN_LISTS) - flags &= ~regex::no_escape_in_lists; - if(f & REG_NEWLINE_ALT) - flags |= regex::newline_alt; - - const char* p2; - if(f & REG_PEND) - p2 = expression->re_endp; - else p2 = ptr + std::strlen(ptr); - - int result; - -#ifndef BOOST_NO_EXCEPTIONS - try{ -#endif - expression->re_magic = magic_value; - static_cast(expression->guts)->set_expression(ptr, p2, flags); - expression->re_nsub = static_cast(expression->guts)->mark_count(); - result = static_cast(expression->guts)->error_code(); -#ifndef BOOST_NO_EXCEPTIONS - } - catch(const boost::regex_error& be) - { - result = be.code(); - } - catch(...) - { - result = REG_E_UNKNOWN; - } -#endif - if(result) - regfreeA(expression); - return result; - -} -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif - -BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA* e, char* buf, regsize_t buf_size) -{ - std::size_t result = 0; - if(code & REG_ITOA) - { - code &= ~REG_ITOA; - if(code <= (int)REG_E_UNKNOWN) - { - result = std::strlen(names[code]) + 1; - if(buf_size >= result) - BOOST_REGEX_DETAIL_NS::strcpy_s(buf, buf_size, names[code]); - return result; - } - return result; - } - if(code == REG_ATOI) - { - char localbuf[5]; - if(e == 0) - return 0; - for(int i = 0; i <= (int)REG_E_UNKNOWN; ++i) - { - if(std::strcmp(e->re_endp, names[i]) == 0) - { - // - // We're converting an integer i to a string, and since i <= REG_E_UNKNOWN - // a five character string is *always* large enough: - // - int r = (boost::core::snprintf)(localbuf, 5, "%d", i); - if(r < 0) - return 0; // sprintf failed - if(std::strlen(localbuf) < buf_size) - BOOST_REGEX_DETAIL_NS::strcpy_s(buf, buf_size, localbuf); - return std::strlen(localbuf) + 1; - } - } - int r = (boost::core::snprintf)(localbuf, 5, "%d", 0); - if(r < 0) - return 0; // sprintf failed - if(std::strlen(localbuf) < buf_size) - BOOST_REGEX_DETAIL_NS::strcpy_s(buf, buf_size, localbuf); - return std::strlen(localbuf) + 1; - } - if(code <= (int)REG_E_UNKNOWN) - { - std::string p; - if((e) && (e->re_magic == magic_value)) - p = static_cast(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code)); - else - { - p = BOOST_REGEX_DETAIL_NS::get_default_error_string(static_cast< ::boost::regex_constants::error_type>(code)); - } - std::size_t len = p.size(); - if(len < buf_size) - { - BOOST_REGEX_DETAIL_NS::strcpy_s(buf, buf_size, p.c_str()); - } - return len + 1; - } - if(buf_size) - *buf = 0; - return 0; -} - -BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, const char* buf, regsize_t n, regmatch_t* array, int eflags) -{ -#ifdef BOOST_MSVC -#pragma warning(push) -#pragma warning(disable:4267) -#endif - bool result = false; - match_flag_type flags = match_default | expression->eflags; - const char* end; - const char* start; - cmatch m; - - if(eflags & REG_NOTBOL) - flags |= match_not_bol; - if(eflags & REG_NOTEOL) - flags |= match_not_eol; - if(eflags & REG_STARTEND) - { - start = buf + array[0].rm_so; - end = buf + array[0].rm_eo; - } - else - { - start = buf; - end = buf + std::strlen(buf); - } - -#ifndef BOOST_NO_EXCEPTIONS - try{ -#endif - if(expression->re_magic == magic_value) - { - result = regex_search(start, end, m, *static_cast(expression->guts), flags); - } - else - return result; -#ifndef BOOST_NO_EXCEPTIONS - } catch(...) - { - return REG_E_UNKNOWN; - } -#endif - - if(result) - { - // extract what matched: - std::size_t i; - for(i = 0; (i < n) && (i < expression->re_nsub + 1); ++i) - { - array[i].rm_so = m[i].matched ? (m[i].first - buf) : -1; - array[i].rm_eo = m[i].matched ? (m[i].second - buf) : -1; - } - // and set anything else to -1: - for(i = expression->re_nsub + 1; i < n; ++i) - { - array[i].rm_so = -1; - array[i].rm_eo = -1; - } - return 0; - } - return REG_NOMATCH; -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif -} - -BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA* expression) -{ - if(expression->re_magic == magic_value) - { - delete static_cast(expression->guts); - } - expression->re_magic = 0; -} - -} // namespace boost diff --git a/src/wide_posix_api.cpp b/src/wide_posix_api.cpp deleted file mode 100644 index 6c01184b2..000000000 --- a/src/wide_posix_api.cpp +++ /dev/null @@ -1,303 +0,0 @@ -/* - * - * Copyright (c) 1998-2002 - * John Maddock - * - * Use, modification and distribution are 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) - * - */ - - /* - * LOCATION: see http://www.boost.org for most recent version. - * FILE: wide_posix_api.cpp - * VERSION: see - * DESCRIPTION: Implements the wide character POSIX API wrappers. - */ - -#define _CRT_SECURE_NO_WARNINGS // for std::wcscpy -#define BOOST_REGEX_SOURCE - -#include - -#ifndef BOOST_NO_WREGEX - -#include -#include - -#ifndef BOOST_REGEX_STANDALONE -#include -#else -namespace boost { namespace core { using std::swprintf; } } -#endif - -#ifndef BOOST_WORKAROUND -#define BOOST_WORKAROUND(x, y) false -#endif - -#include -#include -#include - -#ifdef BOOST_INTEL -#pragma warning(disable:981) -#endif - -namespace boost{ - -namespace { - -unsigned int wmagic_value = 28631; - -const wchar_t* wnames[] = { - L"REG_NOERROR", - L"REG_NOMATCH", - L"REG_BADPAT", - L"REG_ECOLLATE", - L"REG_ECTYPE", - L"REG_EESCAPE", - L"REG_ESUBREG", - L"REG_EBRACK", - L"REG_EPAREN", - L"REG_EBRACE", - L"REG_BADBR", - L"REG_ERANGE", - L"REG_ESPACE", - L"REG_BADRPT", - L"REG_EEND", - L"REG_ESIZE", - L"REG_ERPAREN", - L"REG_EMPTY", - L"REG_ECOMPLEXITY", - L"REG_ESTACK", - L"REG_E_PERL", - L"REG_E_UNKNOWN", -}; -} - -typedef boost::basic_regex > wc_regex_type; - -#ifdef BOOST_MSVC -# pragma warning(push) -#pragma warning(disable:26812) -#endif -BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wchar_t* ptr, int f) -{ -#ifndef BOOST_NO_EXCEPTIONS - try{ -#endif - expression->guts = new wc_regex_type(); -#ifndef BOOST_NO_EXCEPTIONS - } catch(...) - { - expression->guts = 0; - return REG_ESPACE; - } -#else - if(0 == expression->guts) - return REG_E_MEMORY; -#endif - // set default flags: - unsigned flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? wregex::extended : wregex::basic); - expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default; - - // and translate those that are actually set: - if(f & REG_NOCOLLATE) - { - flags |= wregex::nocollate; -#ifndef BOOST_REGEX_V3 - flags &= ~wregex::collate; -#endif - } - - if(f & REG_NOSUB) - { - //expression->eflags |= match_any; - flags |= wregex::nosubs; - } - - if(f & REG_NOSPEC) - flags |= wregex::literal; - if(f & REG_ICASE) - flags |= wregex::icase; - if(f & REG_ESCAPE_IN_LISTS) - flags &= ~wregex::no_escape_in_lists; - if(f & REG_NEWLINE_ALT) - flags |= wregex::newline_alt; - - const wchar_t* p2; - if(f & REG_PEND) - p2 = expression->re_endp; - else p2 = ptr + std::wcslen(ptr); - - int result; - -#ifndef BOOST_NO_EXCEPTIONS - try{ -#endif - expression->re_magic = wmagic_value; - static_cast(expression->guts)->set_expression(ptr, p2, flags); - expression->re_nsub = static_cast(expression->guts)->mark_count(); - result = static_cast(expression->guts)->error_code(); -#ifndef BOOST_NO_EXCEPTIONS - } - catch(const boost::regex_error& be) - { - result = be.code(); - } - catch(...) - { - result = REG_E_UNKNOWN; - } -#endif - if(result) - regfreeW(expression); - return result; - -} -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif - -BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW* e, wchar_t* buf, regsize_t buf_size) -{ - std::size_t result = 0; - if(code & REG_ITOA) - { - code &= ~REG_ITOA; - if((code <= (int)REG_E_UNKNOWN) && (code >= 0)) - { - result = std::wcslen(wnames[code]) + 1; - if(buf_size >= result) - std::wcscpy(buf, wnames[code]); - return result; - } - return result; - } - if(code == REG_ATOI) - { - wchar_t localbuf[5]; - if(e == 0) - return 0; - for(int i = 0; i <= (int)REG_E_UNKNOWN; ++i) - { - if(std::wcscmp(e->re_endp, wnames[i]) == 0) - { -#if defined(_WIN32_WCE) && !defined(UNDER_CE) - (std::swprintf)(localbuf, L"%d", i); -#else - (boost::core::swprintf)(localbuf, 5, L"%d", i); -#endif - if(std::wcslen(localbuf) < buf_size) - std::wcscpy(buf, localbuf); - return std::wcslen(localbuf) + 1; - } - } -#if defined(_WIN32_WCE) && !defined(UNDER_CE) - (std::swprintf)(localbuf, L"%d", 0); -#else - (boost::core::swprintf)(localbuf, 5, L"%d", 0); -#endif - if(std::wcslen(localbuf) < buf_size) - std::wcscpy(buf, localbuf); - return std::wcslen(localbuf) + 1; - } - if(code <= (int)REG_E_UNKNOWN) - { - std::string p; - if((e) && (e->re_magic == wmagic_value)) - p = static_cast(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code)); - else - { - p = BOOST_REGEX_DETAIL_NS::get_default_error_string(static_cast< ::boost::regex_constants::error_type>(code)); - } - std::size_t len = p.size(); - if(len < buf_size) - { - BOOST_REGEX_DETAIL_NS::copy(p.c_str(), p.c_str() + p.size() + 1, buf); - } - return len + 1; - } - if(buf_size) - *buf = 0; - return 0; -} - -BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, const wchar_t* buf, regsize_t n, regmatch_t* array, int eflags) -{ -#ifdef BOOST_MSVC -#pragma warning(push) -#pragma warning(disable:4267) -#endif - bool result = false; - match_flag_type flags = match_default | expression->eflags; - const wchar_t* end; - const wchar_t* start; - wcmatch m; - - if(eflags & REG_NOTBOL) - flags |= match_not_bol; - if(eflags & REG_NOTEOL) - flags |= match_not_eol; - if(eflags & REG_STARTEND) - { - start = buf + array[0].rm_so; - end = buf + array[0].rm_eo; - } - else - { - start = buf; - end = buf + std::wcslen(buf); - } - -#ifndef BOOST_NO_EXCEPTIONS - try{ -#endif - if(expression->re_magic == wmagic_value) - { - result = regex_search(start, end, m, *static_cast(expression->guts), flags); - } - else - return result; -#ifndef BOOST_NO_EXCEPTIONS - } catch(...) - { - return REG_E_UNKNOWN; - } -#endif - if(result) - { - // extract what matched: - std::size_t i; - for(i = 0; (i < n) && (i < expression->re_nsub + 1); ++i) - { - array[i].rm_so = m[i].matched ? (m[i].first - buf) : -1; - array[i].rm_eo = m[i].matched ? (m[i].second - buf) : -1; - } - // and set anything else to -1: - for(i = expression->re_nsub + 1; i < n; ++i) - { - array[i].rm_so = -1; - array[i].rm_eo = -1; - } - return 0; - } - return REG_NOMATCH; -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif -} - -BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW* expression) -{ - if(expression->re_magic == wmagic_value) - { - delete static_cast(expression->guts); - } - expression->re_magic = 0; -} - -} // namespace boost; - -#endif diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 8880deae3..354f42811 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -26,18 +26,138 @@ project . ; +local disable-icu = [ MATCH (--disable-icu) : [ modules.peek : ARGV ] ] ; + +rule path_options ( properties * ) +{ + local result ; + if 64 in $(properties) && msvc in $(properties) + { + result = $(ICU_PATH)/bin64 $(ICU_PATH)/lib64 ; + } + else + { + result = $(ICU_PATH)/bin $(ICU_PATH)/lib ; + } + return $(result) ; +} + # -# rule for simple regex test programs: +# ICU configuration: # -rule regex-test ( name : sources + : requirements * : input-files * ) +if ! $(disable-icu) { - return [ run $(sources) /boost/regex//boost_regex - : - : $(input-files) - : $(requirements) - : $(name) ] ; + if [ modules.peek : ICU_LINK ] + { + errors.user-error : "The ICU_LINK option is no longer supported by the Boost.Regex build - please refer to the documentation for equivalent options" ; + } + + if [ modules.peek : ICU_PATH ] + { + ICU_PATH = [ modules.peek : ICU_PATH ] ; + } + if [ modules.peek : ICU_ICUUC_NAME ] + { + ICU_ICUUC_NAME = [ modules.peek : ICU_ICUUC_NAME ] ; + } + if [ modules.peek : ICU_ICUDT_NAME ] + { + ICU_ICUDT_NAME = [ modules.peek : ICU_ICUDT_NAME ] ; + } + if [ modules.peek : ICU_ICUIN_NAME ] + { + ICU_ICUIN_NAME = [ modules.peek : ICU_ICUIN_NAME ] ; + } + + if $(ICU_ICUUC_NAME) + { + lib icuuc : : $(ICU_ICUUC_NAME) @path_options ; + } + else + { + lib icuuc : : shared @path_options ; + lib icuuc : : msvc debug icuucd shared @path_options ; + lib icuuc : : intel windows debug icuucd shared @path_options ; + lib icuuc : : sicuuc static @path_options ; + lib icuuc : : msvc debug sicuucd static @path_options ; + lib icuuc : : intel windows debug sicuucd static @path_options ; + lib icuuc : : this_is_an_invalid_library_name ; + } + if $(ICU_ICUDT_NAME) + { + lib icudt : : $(ICU_ICUDT_NAME) @path_options ; + } + else + { + lib icudt : : icudata shared @path_options ; + lib icudt : : icudt msvc shared @path_options ; + lib icudt : : icudt intel windows shared @path_options ; + lib icudt : : sicudata static @path_options ; + lib icudt : : sicudt msvc static @path_options ; + lib icudt : : sicudt intel windows static @path_options ; + lib icudt : : this_is_an_invalid_library_name ; + } + if $(ICU_ICUIN_NAME) + { + lib icuin : : $(ICU_ICUIN_NAME) @path_options ; + } + else + { + lib icuin : : icui18n shared @path_options ; + lib icuin : : msvc debug icuind shared @path_options ; + lib icuin : : msvc icuin shared @path_options ; + lib icuin : : intel windows debug icuind shared @path_options ; + lib icuin : : intel windows icuin shared @path_options ; + lib icuin : : sicui18n static @path_options ; + lib icuin : : msvc debug sicuind static @path_options ; + lib icuin : : msvc sicuin static @path_options ; + lib icuin : : intel windows debug sicuind static @path_options ; + lib icuin : : intel windows sicuin static @path_options ; + lib icuin : : this_is_an_invalid_library_name ; + } + + ICU_OPTS = + $(ICU_PATH)/include + shared:icuuc/shared + shared:icudt/shared + shared:icuin/shared + static:icuuc + static:icudt + static:icuin + windows,clang:"advapi32.lib" + BOOST_HAS_ICU=1 + static:U_STATIC_IMPLEMENTATION=1 + ; + + if [ modules.peek : ICU_DATA_DIR ] + { + rule data-dir-options ( properties * ) + { + local result ; + local data_dir = [ modules.peek : ICU_DATA_DIR ] ; + if emscripten in $(properties) + { + result = ICU_DATA_DIR=\\\"/$(data_dir:BS)\\\" + "--embed-file $(data_dir)@/$(data_dir:BS)" + ; + } + else + { + result = ICU_DATA_DIR=\\\"$(data_dir)\\\" ; + } + return $(result) ; + } + + ICU_OPTS += @data-dir-options ; + } + } +exe has_icu : has_icu_test.cpp : $(ICU_OPTS) ; +explicit has_icu ; + +alias icu_options : : : : [ check-target-builds has_icu : $(ICU_OPTS) : ] ; + R_SOURCE = basic_tests.cpp main.cpp @@ -66,22 +186,20 @@ test_operators.cpp local regress-sources = regress/$(R_SOURCE) ; -run regress/$(R_SOURCE) ../build//boost_regex ../build//icu_options +run regress/$(R_SOURCE) icu_options : # command line : # input files : # requirements : regex_regress ; -run regress/$(R_SOURCE) ../build//boost_regex - /boost/thread//boost_thread ../build//icu_options +run regress/$(R_SOURCE) /boost/thread//boost_thread icu_options : # command line : # input files : # requirements TEST_THREADS : regex_regress_threaded ; -run regress/$(R_SOURCE) ../build//boost_regex - /boost/thread//boost_thread ../build//icu_options +run regress/$(R_SOURCE) /boost/thread//boost_thread icu_options : # command line : # input files : # requirements @@ -89,34 +207,29 @@ run regress/$(R_SOURCE) ../build//boost_regex BOOST_REGEX_MAX_CACHE_BLOCKS=0 : regex_regress_threaded_no_cache ; -regex-test posix_api_check : c_compiler_checks/posix_api_check.c ; -compile c_compiler_checks/wide_posix_api_check.c : : wide_posix_api_check_c ; -regex-test posix_api_check_cpp : c_compiler_checks/posix_api_check.cpp ; -regex-test wide_posix_api_check_cpp : c_compiler_checks/wide_posix_api_check.cpp ; run pathology/bad_expression_test.cpp ; run pathology/recursion_test.cpp ; run named_subexpressions/named_subexpressions_test.cpp ; run unicode/unicode_iterator_test.cpp : : : release TEST_UTF8 : unicode_iterator_test_utf8 ; run unicode/unicode_iterator_test.cpp : : : release TEST_UTF16 : unicode_iterator_test_utf16 ; -run unicode/unicode_casefold_test.cpp ../build//boost_regex ../build//icu_options ; +run unicode/unicode_casefold_test.cpp icu_options ; run object_cache/object_cache_test.cpp ; -run config_info/regex_config_info.cpp ../build//boost_regex/static : : : always_show_run_output ; -run config_info/regex_config_info.cpp ../build//boost_regex : : : always_show_run_output : regex_dll_config_info ; -run collate_info/collate_info.cpp ../build//boost_regex : : : always_show_run_output : test_collate_info ; +run config_info/regex_config_info.cpp : : : always_show_run_output ; +run config_info/regex_config_info.cpp : : : always_show_run_output : regex_dll_config_info ; +run collate_info/collate_info.cpp : : : always_show_run_output : test_collate_info ; link concepts/concept_check.cpp /boost/range//boost_range : gcc:-Wno-deprecated-copy ; link concepts/concept_check.cpp : BOOST_REGEX_STANDALONE gcc:-Wno-deprecated-copy : standalone_concept_check ; link concepts/icu_concept_check.cpp : BOOST_REGEX_STANDALONE gcc:-Wno-deprecated-copy ; link concepts/icu_concept_check.cpp : gcc:-Wno-deprecated-copy : standalone_icu_concept_check ; link concepts/range_concept_check.cpp : gcc:-Wno-deprecated-copy /boost/range//boost_range ; run concepts/test_bug_11988.cpp ; -run captures/captures_test.cpp ../build//icu_options /boost/array//boost_array : : : multi BOOST_REGEX_MATCH_EXTRA=1 BOOST_REGEX_NO_LIB=1 : captures_test ; -run regress/$(R_SOURCE) ./noeh_test//boost_regex_noeh ../build//icu_options : : : BOOST_NO_EXCEPTIONS=1 off static shared : regex_regress_noeh ; -compile test_consolidated.cpp ; +run captures/captures_test.cpp icu_options /boost/array//boost_array : : : multi BOOST_REGEX_MATCH_EXTRA=1 : captures_test ; +run regress/$(R_SOURCE) icu_options : : : BOOST_NO_EXCEPTIONS=1 off static shared : regex_regress_noeh ; build-project ../example ; # `quick` target (for CI) -run quick.cpp ../build//boost_regex ; +run quick.cpp ; compile test_warnings.cpp : msvc:all msvc:on gcc:all gcc:on diff --git a/test/c_compiler_checks/posix_api_check.c b/test/c_compiler_checks/posix_api_check.c deleted file mode 100644 index 34abca142..000000000 --- a/test/c_compiler_checks/posix_api_check.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * - * Copyright (c) 1998-2002 - * John Maddock - * - * Use, modification and distribution are 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) - * - */ - - /* - * LOCATION: see http://www.boost.org for most recent version. - * FILE posix_api_compiler_check.c - * VERSION see - * DESCRIPTION: Verify that POSIX API calls compile: note this is a compile - * time check only. - */ - -#include -#include -#include -#include - -const char* expression = "^"; -const char* text = "\n "; -regmatch_t matches[1]; -int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB | - REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS | - REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP; - - -int main() -{ - regex_tA re; - int result; - result = regcompA(&re, expression, REG_AWK); - if(result > (int)REG_NOERROR) - { - char buf[256]; - regerrorA(result, &re, buf, sizeof(buf)); - puts(buf); - return result; - } - assert(re.re_nsub == 0); - matches[0].rm_so = 0; - matches[0].rm_eo = strlen(text); - result = regexecA(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND); - if(result > (int)REG_NOERROR) - { - char buf[256]; - regerrorA(result, &re, buf, sizeof(buf)); - puts(buf); - regfreeA(&re); - return result; - } - assert((matches[0].rm_so == matches[0].rm_eo) && (matches[0].rm_eo == 1)); - regfreeA(&re); - printf("no errors found\n"); - return 0; -} - - - diff --git a/test/c_compiler_checks/posix_api_check.cpp b/test/c_compiler_checks/posix_api_check.cpp deleted file mode 100644 index d3ff326a4..000000000 --- a/test/c_compiler_checks/posix_api_check.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Copyright (c) 1998-2002 - * John Maddock - * - * Use, modification and distribution are 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) - * - */ - - /* - * LOCATION: see http://www.boost.org for most recent version. - * FILE posix_api_compiler_check.c - * VERSION see - * DESCRIPTION: Verify that POSIX API calls compile: note this is a compile - * time check only. - */ - -#include -#include -#include -#include -#include "../test_macros.hpp" - -const char* expression = "^"; -const char* text = "\n "; -regmatch_t matches[1]; -int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB | - REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS | - REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP; - - -int main() -{ - regex_tA re; - unsigned int result; - result = regcompA(&re, expression, REG_AWK); - if(result > REG_NOERROR) - { - char buf[256]; - regerrorA(result, &re, buf, sizeof(buf)); - printf("%s", buf); - return result; - } - BOOST_CHECK(re.re_nsub == 0); - matches[0].rm_so = 0; - matches[0].rm_eo = strlen(text); - result = regexecA(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND); - if(result > REG_NOERROR) - { - char buf[256]; - regerrorA(result, &re, buf, sizeof(buf)); - printf("%s", buf); - regfreeA(&re); - return result; - } - BOOST_CHECK(matches[0].rm_so == matches[0].rm_eo); - regfreeA(&re); - printf("no errors found\n"); - return boost::report_errors(); -} - - - diff --git a/test/c_compiler_checks/wide_posix_api_check.c b/test/c_compiler_checks/wide_posix_api_check.c deleted file mode 100644 index cd1a287da..000000000 --- a/test/c_compiler_checks/wide_posix_api_check.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * - * Copyright (c) 1998-2002 - * John Maddock - * - * Use, modification and distribution are 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) - * - */ - - /* - * LOCATION: see http://www.boost.org for most recent version. - * FILE wide_posix_api_compiler_check.c - * VERSION see - * DESCRIPTION: Verify that POSIX API calls compile: note this is a compile - * time check only. - */ - -#define UNICODE -#define _UNICODE - -#include -#include -#include -#include -#include - -#ifndef BOOST_NO_WREGEX -#include - -const wchar_t* expression = L"^"; -const wchar_t* text = L"\n "; -regmatch_t matches[1]; -int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB | - REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS | - REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP; - - -int main() -{ - regex_t re; - int result; - wchar_t buf[256]; - char nbuf[256]; - int i; - result = regcomp(&re, expression, REG_AWK); - if(result > (int)REG_NOERROR) - { - regerror(result, &re, buf, sizeof(buf)); - for(i = 0; i < 256; ++i) - nbuf[i] = (char)(buf[i]); - puts(nbuf); - return result; - } - if(re.re_nsub != 0) - { - regfree(&re); - exit(-1); - } - matches[0].rm_so = 0; - matches[0].rm_eo = wcslen(text); - result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND); - if(result > (int)REG_NOERROR) - { - regerror(result, &re, buf, sizeof(buf)); - for(i = 0; i < 256; ++i) - nbuf[i] = (char)(buf[i]); - puts(nbuf); - regfree(&re); - return result; - } - if((matches[0].rm_so != matches[0].rm_eo) || (matches[0].rm_eo != 1)) - { - regfree(&re); - exit(-1); - } - regfree(&re); - printf("no errors found\n"); - return 0; -} - -#else -# error "This library has not been configured for wide character support" -#endif - - - - diff --git a/test/c_compiler_checks/wide_posix_api_check.cpp b/test/c_compiler_checks/wide_posix_api_check.cpp deleted file mode 100644 index 5c14cb229..000000000 --- a/test/c_compiler_checks/wide_posix_api_check.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * Copyright (c) 1998-2002 - * John Maddock - * - * Use, modification and distribution are 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) - * - */ - - /* - * LOCATION: see http://www.boost.org for most recent version. - * FILE wide_posix_api_compiler_check.c - * VERSION see - * DESCRIPTION: Verify that POSIX API calls compile: note this is a compile - * time check only. - */ - -#define UNICODE -#define _UNICODE - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef BOOST_NO_WREGEX - -const wchar_t* expression = L"^"; -const wchar_t* text = L"\n "; -regmatch_t matches[1]; -int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB | - REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS | - REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP; - - -int main() -{ - regex_t re; - unsigned result; - result = regcomp(&re, expression, REG_AWK); - if(result > REG_NOERROR) - { - wchar_t buf[256]; - regerror(result, &re, buf, sizeof(buf)); - char nbuf[256]; - for(int i = 0; i < 256; ++i) - nbuf[i] = static_cast(buf[i]); - printf("%s", nbuf); - return result; - } - if(re.re_nsub != 0) - { - regfree(&re); - exit(-1); - } - matches[0].rm_so = 0; - matches[0].rm_eo = wcslen(text); - result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND); - if(result > REG_NOERROR) - { - wchar_t buf[256]; - regerror(result, &re, buf, sizeof(buf)); - char nbuf[256]; - for(int i = 0; i < 256; ++i) - nbuf[i] = static_cast(buf[i]); - printf("%s", nbuf); - regfree(&re); - return result; - } - if((matches[0].rm_so != matches[0].rm_eo) || (matches[0].rm_eo != 1)) - { - regfree(&re); - exit(-1); - } - regfree(&re); - printf("%s", "no errors found\n"); - return 0; -} - -#else - -#include - -int main() -{ - std::cout << - "\n\n" - "This platform does not provide the needed wide character support for this test.\n" - "\n"; - return 0; -} -#endif - - - - diff --git a/test/captures/Jamfile.v2 b/test/captures/Jamfile.v2 deleted file mode 100644 index 2b07edf31..000000000 --- a/test/captures/Jamfile.v2 +++ /dev/null @@ -1,23 +0,0 @@ -# copyright John Maddock 2003 -# 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. - -project - : source-location ../../src - ; - -EX_SOURCES = - posix_api.cpp - wide_posix_api.cpp ; - -lib boost_regex_extra : $(EX_SOURCES) ../../build//icu_options - : - BOOST_REGEX_MATCH_EXTRA=1 - shared:BOOST_REGEX_DYN_LINK=1 - : - ; - - - - diff --git a/build/has_icu_test.cpp b/test/has_icu_test.cpp similarity index 100% rename from build/has_icu_test.cpp rename to test/has_icu_test.cpp diff --git a/test/noeh_test/Jamfile.v2 b/test/noeh_test/Jamfile.v2 deleted file mode 100644 index e95c736ea..000000000 --- a/test/noeh_test/Jamfile.v2 +++ /dev/null @@ -1,35 +0,0 @@ -# copyright John Maddock 2011 -# 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. - -project - : requirements - multi - shared:BOOST_REGEX_DYN_LINK=1 - msvc-7.1:TEST_MFC=1 - msvc-7.0:TEST_MFC=1 - msvc:on - # There are unidentified linker problems on these platforms: - mipspro-7.4:static - sun-5.9:static - all - gcc:-Wextra - gcc:-Wshadow - U_USING_ICU_NAMESPACE=0 - #gcc-mw:static - #gcc-mingw:static - gcc-cygwin:static - ; - - -lib boost_regex_noeh : - ../../src/posix_api.cpp - ../../src/wide_posix_api.cpp - ../../build//icu_options - : - static - BOOST_NO_EXCEPTIONS=1 - off - : - ; \ No newline at end of file diff --git a/test/test_consolidated.cpp b/test/test_consolidated.cpp deleted file mode 100644 index 3f59f2742..000000000 --- a/test/test_consolidated.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/* - * - * Copyright (c) 2011 - * John Maddock - * - * Use, modification and distribution are 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 -#include