forked from boostorg/regex
Fix numerous VC-10 compiler warnings.
Rewrite ICU configuration to use the new Boost.Build configuration logic. [SVN r61893]
This commit is contained in:
307
build/Jamfile.v2
307
build/Jamfile.v2
@ -3,10 +3,6 @@
|
|||||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
# http://www.boost.org/LICENSE_1_0.txt.
|
# http://www.boost.org/LICENSE_1_0.txt.
|
||||||
|
|
||||||
project boost/regex
|
|
||||||
: source-location ../src
|
|
||||||
;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# ICU configuration:
|
# ICU configuration:
|
||||||
#
|
#
|
||||||
@ -14,240 +10,35 @@ if [ modules.peek : ICU_PATH ]
|
|||||||
{
|
{
|
||||||
ICU_PATH = [ modules.peek : ICU_PATH ] ;
|
ICU_PATH = [ modules.peek : ICU_PATH ] ;
|
||||||
}
|
}
|
||||||
|
if [ modules.peek : ICU_LINK ]
|
||||||
rule check-icu-config ( )
|
{
|
||||||
{
|
ICU_LINK = [ modules.peek : ICU_LINK ] ;
|
||||||
local HAVE_ICU = [ modules.peek : HAVE_ICU ] ;
|
|
||||||
local ICU_LINK = [ modules.peek : ICU_LINK ] ;
|
|
||||||
|
|
||||||
if ! $(gICU_CONFIG_CHECKED)
|
|
||||||
{
|
|
||||||
if $(HAVE_ICU) && ! $(ICU_PATH)
|
|
||||||
{
|
|
||||||
gHAS_ICU = true ;
|
|
||||||
gICU_CORE_LIB = icuuc ;
|
|
||||||
gICU_IN_LIB = icui18n ;
|
|
||||||
gICU_DATA_LIB = icudata ;
|
|
||||||
gICU_CONFIG_CHECKED = true ;
|
|
||||||
}
|
|
||||||
else if $(ICU_PATH)
|
|
||||||
{
|
|
||||||
dir = $(ICU_PATH) ;
|
|
||||||
|
|
||||||
if [ GLOB $(dir)/include/unicode : utypes.h ]
|
|
||||||
{
|
|
||||||
gHAS_ICU = true ;
|
|
||||||
|
|
||||||
# try and find ICU libraries, look for NT versions first:
|
|
||||||
if $(ICU_LINK)
|
|
||||||
{
|
|
||||||
gICU_LIBS += <linkflags>$(ICU_LINK) ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(dir)/lib64 : icuuc.* ]
|
|
||||||
{
|
|
||||||
gICU_CORE_LIB = icuuc ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(dir)/lib : icuuc.* ]
|
|
||||||
{
|
|
||||||
gICU_CORE_LIB = icuuc ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(dir)/lib : libicuuc.* ]
|
|
||||||
{
|
|
||||||
gICU_CORE_LIB = icuuc ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(ICU_PATH)/lib : cygicuuc*.dll ]
|
|
||||||
{
|
|
||||||
gICU_CORE_LIB = cygicuuc.dll ;
|
|
||||||
gICU_CYGWIN = true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ECHO warning: ICU shared common library not found in path. ;
|
|
||||||
ECHO hint: If the regex library fails to link then try again ;
|
|
||||||
ECHO with the environment variable ICU_LINK set to contain ;
|
|
||||||
ECHO the linker options required to link to ICU. ;
|
|
||||||
ECHO Defaulting to look for libicuuc ... ;
|
|
||||||
gICU_CORE_LIB = icuuc ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if $(ICU_LINK)
|
|
||||||
{
|
|
||||||
# nothing to do, it's already been done!
|
|
||||||
# gICU_LIBS += <linkflags>$(ICU_LINK) ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(dir)/lib : icuin.* ]
|
|
||||||
{
|
|
||||||
gICU_IN_LIB = icuin ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(dir)/lib : icui18n.* ]
|
|
||||||
{
|
|
||||||
gICU_IN_LIB = icui18n ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(dir)/lib64 : libicui18n.* ]
|
|
||||||
{
|
|
||||||
gICU_IN_LIB = icui18n ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(dir)/lib : libicui18n.* ]
|
|
||||||
{
|
|
||||||
gICU_IN_LIB = icui18n ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(ICU_PATH)/lib : cygicuin*.dll ]
|
|
||||||
{
|
|
||||||
gICU_IN_LIB = cygicuin.dll ;
|
|
||||||
gICU_CYGWIN = true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ECHO warning: ICU shared i18n library not found in path. ;
|
|
||||||
ECHO hint: If the regex library fails to link then try again ;
|
|
||||||
ECHO with the environment variable ICU_LINK set to contain ;
|
|
||||||
ECHO the linker options required to link to ICU. ;
|
|
||||||
ECHO Defaulting to look for libicui18n ... ;
|
|
||||||
gICU_IN_LIB = icui18n ;
|
|
||||||
}
|
|
||||||
#Added by Tommy Nordgren - libicudata muct be linked against on Mac OS X
|
|
||||||
if $(ICU_LINK)
|
|
||||||
{
|
|
||||||
# nothing to do, it's already been done!
|
|
||||||
# gICU_LIBS += <linkflags>$(ICU_LINK) ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(dir)/lib64 : icudt.* ]
|
|
||||||
{
|
|
||||||
gICU_DATA_LIB = icudt ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(dir)/lib : icudt.* ]
|
|
||||||
{
|
|
||||||
gICU_DATA_LIB = icudt ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(dir)/lib : libicudata.* ]
|
|
||||||
{
|
|
||||||
gICU_DATA_LIB = icudata ;
|
|
||||||
}
|
|
||||||
else if [ GLOB $(ICU_PATH)/lib : cygicudt*.dll ]
|
|
||||||
{
|
|
||||||
gICU_DATA_LIB = cygicudt.dll ;
|
|
||||||
gICU_CYGWIN = true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
local os = [ modules.peek : OS ] ;
|
|
||||||
echo $(os) ;
|
|
||||||
if $(os) != "DARWIN"
|
|
||||||
{
|
|
||||||
ECHO warning: ICU shared data library not found in path. ;
|
|
||||||
ECHO hint: If the regex library fails to link then try again ;
|
|
||||||
ECHO with the environment variable ICU_LINK set to contain ;
|
|
||||||
ECHO the linker options required to link to ICU. ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ECHO warning: ICU shared data library not found in path. ;
|
|
||||||
ECHO hint: If the regex library fails to link then try again ;
|
|
||||||
ECHO with the environment variable ICU_LINK set to contain ;
|
|
||||||
ECHO the linker options required to link to ICU. ;
|
|
||||||
ECHO Defaulting to look for libicudata ... ;
|
|
||||||
gICU_DATA_LIB = icudata ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#End of addition by Tommy Nordgren
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gICU_CONFIG_CHECKED = true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if $(gHAS_ICU)
|
|
||||||
{
|
|
||||||
message icu_config ;
|
|
||||||
message icu_config2
|
|
||||||
: Note: Building Boost.Regex with Unicode/ICU support enabled
|
|
||||||
: " Using ICU in " $(ICU_PATH:J=" ")/include ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
message icu_config
|
|
||||||
: "warning: Building Boost.Regex with the optional Unicode/ICU support disabled."
|
|
||||||
: "note: Please refer to the Boost.Regex documentation for more information"
|
|
||||||
: "note: this is a strictly optional feature." ;
|
|
||||||
|
|
||||||
if $(ICU_PATH)
|
|
||||||
{
|
|
||||||
message icu_config2
|
|
||||||
: warning! ICU configuration failed
|
|
||||||
: " Couldn't find utypes.h in " $(ICU_PATH:J=" ")/include/unicode ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
message icu_config2 ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit icu_config ;
|
if $(ICU_LINK)
|
||||||
explicit icu_config2 ;
|
|
||||||
|
|
||||||
if [ check-icu-config ]
|
|
||||||
{
|
{
|
||||||
if $(gHAS_ICU)
|
ICU_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <define>BOOST_HAS_ICU=1 <runtime-link>shared ;
|
||||||
{
|
|
||||||
BOOST_REGEX_ICU_OPTS = "<target-os>freebsd:<include>/usr/local/include" ;
|
|
||||||
ICU_SEARCH_OPTS = "<target-os>freebsd:<search>$(ICU_PATH)/lib" ;
|
|
||||||
BOOST_REGEX_ICU_OPTS += "<define>BOOST_HAS_ICU=1" ;
|
|
||||||
BOOST_REGEX_ICU_OPTS += "$(gICU_LIBS)" ;
|
|
||||||
|
|
||||||
if $(ICU_PATH)
|
|
||||||
{
|
|
||||||
# If ICU_PATH is specified on the command line, then it's
|
|
||||||
# relative to the current directory, while paths specified
|
|
||||||
# in a Jamfile are relative to that Jamfile. So, to
|
|
||||||
# avoid confusing the user if he's not running from
|
|
||||||
# libs/regex/build, explicitly root this.
|
|
||||||
ICU_PATH = [ path.native
|
|
||||||
[ path.root [ path.make $(ICU_PATH) ] [ path.pwd ] ] ] ;
|
|
||||||
if $(ICU_PATH) != "/usr" && $(ICU_PATH) != "/usr/local"
|
|
||||||
{
|
|
||||||
BOOST_REGEX_ICU_OPTS += "<include>$(ICU_PATH)/include" ;
|
|
||||||
ICU_SEARCH_OPTS = <search>$(ICU_PATH)/lib ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if $(gICU_CYGWIN)
|
|
||||||
{
|
|
||||||
if $(gICU_CORE_LIB)
|
|
||||||
{
|
|
||||||
BOOST_REGEX_ICU_OPTS += "<linkflags>$(gICU_CORE_LIB) ;
|
|
||||||
}
|
|
||||||
if $(gICU_IN_LIB)
|
|
||||||
{
|
|
||||||
BOOST_REGEX_ICU_OPTS += "<linkflags>$(gICU_IN_LIB) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if $(gICU_CORE_LIB)
|
|
||||||
{
|
|
||||||
lib icucore : : <name>$(gICU_CORE_LIB) $(ICU_SEARCH_OPTS) <link>shared ;
|
|
||||||
ICU_EXTRA_SOURCE = icucore ;
|
|
||||||
explicit icucore ;
|
|
||||||
}
|
|
||||||
if $(gICU_IN_LIB)
|
|
||||||
{
|
|
||||||
lib icuin : : <name>$(gICU_IN_LIB) $(ICU_SEARCH_OPTS) <link>shared ;
|
|
||||||
ICU_EXTRA_SOURCE += icuin ;
|
|
||||||
explicit icuin ;
|
|
||||||
}
|
|
||||||
#Added by Tommy Nordgren libicudata must be linked against on Mac OS X
|
|
||||||
if $(gICU_DATA_LIB)
|
|
||||||
{
|
|
||||||
lib icudata : : <name>$(gICU_DATA_LIB) $(ICU_SEARCH_OPTS) <link>shared ;
|
|
||||||
ICU_EXTRA_SOURCE += icudata ;
|
|
||||||
explicit icudata ;
|
|
||||||
}
|
|
||||||
#End of addition by Tommy Nordgren
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lib icuuc : : <search>$(ICU_PATH)/lib <link>shared <runtime-link>shared ;
|
||||||
|
lib icuuc : : <toolset>msvc <variant>debug <name>icuucd <search>$(ICU_PATH)/lib <link>shared <runtime-link>shared ;
|
||||||
|
lib icuuc : : <name>this_is_an_invalid_library_name ;
|
||||||
|
lib icudt : : <search>$(ICU_PATH)/lib <name>icudata <link>shared <runtime-link>shared ;
|
||||||
|
lib icudt : : <search>$(ICU_PATH)/lib <name>icudt <toolset>msvc <link>shared <runtime-link>shared ;
|
||||||
|
lib icudt : : <name>this_is_an_invalid_library_name ;
|
||||||
|
lib icuin : : <search>$(ICU_PATH)/lib <name>icui18n <link>shared <runtime-link>shared ;
|
||||||
|
lib icuin : : <toolset>msvc <variant>debug <name>icuind <search>$(ICU_PATH)/lib <link>shared <runtime-link>shared ;
|
||||||
|
lib icuin : : <toolset>msvc <variant>release <name>icuin <search>$(ICU_PATH)/lib <link>shared <runtime-link>shared ;
|
||||||
|
lib icuin : : <name>this_is_an_invalid_library_name ;
|
||||||
|
|
||||||
|
ICU_OPTS = <include>$(ICU_PATH)/include <library>icuuc/<link>shared/<runtime-link>shared <library>icudt/<link>shared/<runtime-link>shared <library>icuin/<link>shared/<runtime-link>shared <dll-path>$(ICU_PATH)/bin <define>BOOST_HAS_ICU=1 <runtime-link>shared ;
|
||||||
|
}
|
||||||
|
|
||||||
|
exe has_icu : ./has_icu_test.cpp : $(ICU_OPTS) ;
|
||||||
|
explicit has_icu ;
|
||||||
|
|
||||||
|
alias icu_options : : : : [ check-target-builds has_icu : $(ICU_OPTS) : ] ;
|
||||||
|
|
||||||
SOURCES =
|
SOURCES =
|
||||||
c_regex_traits.cpp
|
c_regex_traits.cpp
|
||||||
@ -269,59 +60,13 @@ SOURCES =
|
|||||||
usinstances.cpp ;
|
usinstances.cpp ;
|
||||||
|
|
||||||
|
|
||||||
lib boost_regex : ../src/$(SOURCES) $(ICU_EXTRA_SOURCE) icu_config2 icu_config
|
lib boost_regex : ../src/$(SOURCES) icu_options
|
||||||
:
|
:
|
||||||
#<link>static:<define>BOOST_REGEX_NO_LIB=1
|
|
||||||
#<link>static:<define>BOOST_REGEX_STATIC_LINK=1
|
|
||||||
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
|
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
|
||||||
<toolset>gcc-mw:<link>static
|
<toolset>gcc-mw:<link>static
|
||||||
<toolset>gcc-mingw:<link>static
|
<toolset>gcc-mingw:<link>static
|
||||||
<toolset>gcc-cygwin:<link>static
|
<toolset>gcc-cygwin:<link>static
|
||||||
$(BOOST_REGEX_ICU_OPTS)
|
|
||||||
<conditional>@force-shared-linking
|
|
||||||
;
|
;
|
||||||
|
|
||||||
shared-linking-warning-emitted = ;
|
|
||||||
|
|
||||||
# The ICU is shipped as shared libraries with dynamic runtime.
|
|
||||||
# If Boost.Regex is built against static runtime, the combination
|
|
||||||
# will not work. The below rule forces shared runtime, and
|
|
||||||
# prints an explanation.
|
|
||||||
rule force-shared-linking ( properties * )
|
|
||||||
{
|
|
||||||
if $(gHAS_ICU)
|
|
||||||
{
|
|
||||||
if <runtime-link>static in $(properties)
|
|
||||||
{
|
|
||||||
if ! $(shared-linking-warning-emitted)
|
|
||||||
{
|
|
||||||
shared-linking-warning-emitted = 1 ;
|
|
||||||
ECHO "warning: forcing runtime-link=shared for Boost.Regex" ;
|
|
||||||
ECHO "warning: this is required when using the ICU library" ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return <runtime-link>shared ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
alias icu_options : $(ICU_EXTRA_SOURCE) : : : $(BOOST_REGEX_ICU_OPTS) ;
|
|
||||||
explicit icu_options ;
|
|
||||||
|
|
||||||
boost-install boost_regex ;
|
boost-install boost_regex ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
26
build/has_icu_test.cpp
Normal file
26
build/has_icu_test.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010
|
||||||
|
* 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 <unicode/uversion.h>
|
||||||
|
#include <unicode/utypes.h>
|
||||||
|
#include <unicode/uchar.h>
|
||||||
|
#include <unicode/coll.h>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(_DLL)
|
||||||
|
#error "Mixing ICU with a static runtime doesn't work"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
UErrorCode err = U_ZERO_ERROR;
|
||||||
|
UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, "GREEK SMALL LETTER ALPHA", &err);
|
||||||
|
return err;
|
||||||
|
}
|
@ -10,9 +10,12 @@ project
|
|||||||
# There are unidentified linker problems on these platforms:
|
# There are unidentified linker problems on these platforms:
|
||||||
<toolset>mipspro-7.4:<link>static
|
<toolset>mipspro-7.4:<link>static
|
||||||
<toolset>sun-5.9:<link>static
|
<toolset>sun-5.9:<link>static
|
||||||
|
<toolset>msvc:<warnings>all
|
||||||
|
<toolset>gcc:<warnings>all
|
||||||
|
<toolset>gcc:<cxxflags>-Wextra
|
||||||
|
<define>U_USING_ICU_NAMESPACE=0
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
rule regex-test-run ( sources + : input * : name * )
|
rule regex-test-run ( sources + : input * : name * )
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -13,9 +13,14 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <boost/program_options.hpp>
|
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_MSVC
|
||||||
|
#pragma warning(disable:4512 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
int after_context;
|
int after_context;
|
||||||
|
@ -152,9 +152,15 @@ int main()
|
|||||||
assert(file == "d.h");
|
assert(file == "d.h");
|
||||||
|
|
||||||
// Greek text extraction with u32regex_search:
|
// Greek text extraction with u32regex_search:
|
||||||
U_NAMESPACE_QUALIFIER UnicodeString text = L"Some where in \x0391\x039D\x0395\x0398\x0391 2004";
|
const UChar t[] = {
|
||||||
|
'S', 'o', 'm', 'e', ' ', 'w', 'h', 'e', 'r', 'e', ' ', 'i', 'n', 0x0391, 0x039D, 0x0395, 0x0398, 0x0391, 0
|
||||||
|
};
|
||||||
|
const UChar g[] = {
|
||||||
|
0x0391, 0x039D, 0x0395, 0x0398, 0x0391, 0
|
||||||
|
};
|
||||||
|
U_NAMESPACE_QUALIFIER UnicodeString text = t;
|
||||||
U_NAMESPACE_QUALIFIER UnicodeString greek = extract_greek(text);
|
U_NAMESPACE_QUALIFIER UnicodeString greek = extract_greek(text);
|
||||||
assert(greek == L"\x0391\x039D\x0395\x0398\x0391 2004");
|
assert(greek == g);
|
||||||
|
|
||||||
// extract currency symbols with associated value, use iterator interface:
|
// extract currency symbols with associated value, use iterator interface:
|
||||||
std::string text2 = " $100.23 or \xC2\xA3""198.12 "; // \xC2\xA3 is the pound sign encoded in UTF-8
|
std::string text2 = " $100.23 or \xC2\xA3""198.12 "; // \xC2\xA3 is the pound sign encoded in UTF-8
|
||||||
|
@ -61,7 +61,7 @@ void search(std::istream& is)
|
|||||||
std::memmove(buf, next_pos, leftover);
|
std::memmove(buf, next_pos, leftover);
|
||||||
// fill the rest from the stream:
|
// fill the rest from the stream:
|
||||||
is.read(buf + leftover, size);
|
is.read(buf + leftover, size);
|
||||||
unsigned read = is.gcount();
|
std::streamsize read = is.gcount();
|
||||||
// check to see if we've run out of text:
|
// check to see if we've run out of text:
|
||||||
have_more = read == size;
|
have_more = read == size;
|
||||||
// reset next_pos:
|
// reset next_pos:
|
||||||
|
@ -51,7 +51,7 @@ void search(std::istream& is)
|
|||||||
std::memmove(buf, next_pos, leftover);
|
std::memmove(buf, next_pos, leftover);
|
||||||
// fill the rest from the stream:
|
// fill the rest from the stream:
|
||||||
is.read(buf + leftover, size);
|
is.read(buf + leftover, size);
|
||||||
unsigned read = is.gcount();
|
std::streamsize read = is.gcount();
|
||||||
// check to see if we've run out of text:
|
// check to see if we've run out of text:
|
||||||
have_more = read == size;
|
have_more = read == size;
|
||||||
// reset next_pos:
|
// reset next_pos:
|
||||||
|
@ -89,7 +89,7 @@ void load_file(std::string& s, std::istream& is)
|
|||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
if(is.bad()) return;
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ void load_file(std::string& s, std::istream& is)
|
|||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
if(is.bad()) return;
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,7 @@ void load_file(std::string& s, std::istream& is)
|
|||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
if(is.bad()) return;
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ void load_file(std::string& s, std::istream& is)
|
|||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
if(is.bad()) return;
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ void load_file(std::string& s, std::istream& is)
|
|||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
if(is.bad()) return;
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ void load_file(std::string& s, std::istream& is)
|
|||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
if(is.bad()) return;
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ void load_file(std::string& s, std::istream& is)
|
|||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
if(is.bad()) return;
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ void load_file(std::string& s, std::istream& is)
|
|||||||
//
|
//
|
||||||
// attempt to grow string buffer to match file size,
|
// attempt to grow string buffer to match file size,
|
||||||
// this doesn't always work...
|
// this doesn't always work...
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ void load_file(std::string& s, std::istream& is)
|
|||||||
//
|
//
|
||||||
// attempt to grow string buffer to match file size,
|
// attempt to grow string buffer to match file size,
|
||||||
// this doesn't always work...
|
// this doesn't always work...
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
#include <boost/mpl/int_fwd.hpp>
|
#include <boost/mpl/int_fwd.hpp>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
|
#ifdef BOOST_MSVC
|
||||||
|
#pragma warning (push)
|
||||||
|
#pragma warning (disable: 4251)
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace boost{
|
namespace boost{
|
||||||
|
|
||||||
@ -1015,6 +1019,10 @@ inline U_NAMESPACE_QUALIFIER UnicodeString u32regex_replace(const U_NAMESPACE_QU
|
|||||||
|
|
||||||
} // namespace boost.
|
} // namespace boost.
|
||||||
|
|
||||||
|
#ifdef BOOST_MSVC
|
||||||
|
#pragma warning (pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/regex/v4/u32regex_iterator.hpp>
|
#include <boost/regex/v4/u32regex_iterator.hpp>
|
||||||
#include <boost/regex/v4/u32regex_token_iterator.hpp>
|
#include <boost/regex/v4/u32regex_token_iterator.hpp>
|
||||||
|
|
||||||
|
@ -149,7 +149,37 @@ namespace boost{ namespace re_detail{
|
|||||||
{
|
{
|
||||||
return stdext::unchecked_equal(first, last, with);
|
return stdext::unchecked_equal(first, last, with);
|
||||||
}
|
}
|
||||||
|
#elif BOOST_WORKAROUND(BOOST_MSVC, > 1500)
|
||||||
|
//
|
||||||
|
// MSVC 10 will either emit warnings or else refuse to compile
|
||||||
|
// code that makes perfectly legitimate use of std::copy, when
|
||||||
|
// the OutputIterator type is a user-defined class (apparently all user
|
||||||
|
// defined iterators are "unsafe"). What's more Microsoft have removed their
|
||||||
|
// non-standard "unchecked" versions, even though their still in the MS
|
||||||
|
// documentation!! Work around this as best we can:
|
||||||
|
//
|
||||||
|
template<class InputIterator, class OutputIterator>
|
||||||
|
inline OutputIterator copy(
|
||||||
|
InputIterator first,
|
||||||
|
InputIterator last,
|
||||||
|
OutputIterator dest
|
||||||
|
)
|
||||||
|
{
|
||||||
|
while(first != last)
|
||||||
|
*dest++ = *first++;
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
template<class InputIterator1, class InputIterator2>
|
||||||
|
inline bool equal(
|
||||||
|
InputIterator1 first,
|
||||||
|
InputIterator1 last,
|
||||||
|
InputIterator2 with
|
||||||
|
)
|
||||||
|
{
|
||||||
|
while(first != last)
|
||||||
|
if(*first++ != *with++) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
using std::copy;
|
using std::copy;
|
||||||
using std::equal;
|
using std::equal;
|
||||||
|
@ -292,7 +292,7 @@ template <class charT, class Traits, class Alloc>
|
|||||||
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
{
|
{
|
||||||
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
|
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
|
||||||
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
|
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, submatch, m);
|
||||||
}
|
}
|
||||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||||
{
|
{
|
||||||
|
@ -9,9 +9,15 @@ project
|
|||||||
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
|
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
|
||||||
<toolset>msvc-7.1:<define>TEST_MFC=1
|
<toolset>msvc-7.1:<define>TEST_MFC=1
|
||||||
<toolset>msvc-7.0:<define>TEST_MFC=1
|
<toolset>msvc-7.0:<define>TEST_MFC=1
|
||||||
|
<toolset>msvc:<asynch-exceptions>on
|
||||||
# There are unidentified linker problems on these platforms:
|
# There are unidentified linker problems on these platforms:
|
||||||
<toolset>mipspro-7.4:<link>static
|
<toolset>mipspro-7.4:<link>static
|
||||||
<toolset>sun-5.9:<link>static
|
<toolset>sun-5.9:<link>static
|
||||||
|
<toolset>msvc:<warnings>all
|
||||||
|
<toolset>gcc:<warnings>all
|
||||||
|
<toolset>gcc:<cxxflags>-Wextra
|
||||||
|
<toolset>gcc:<cxxflags>-Wshadow
|
||||||
|
<define>U_USING_ICU_NAMESPACE=0
|
||||||
;
|
;
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -135,4 +141,4 @@ test-suite regex
|
|||||||
]
|
]
|
||||||
;
|
;
|
||||||
|
|
||||||
|
build-project ../example ;
|
||||||
|
@ -35,7 +35,7 @@ int main()
|
|||||||
regex_tA re;
|
regex_tA re;
|
||||||
int result;
|
int result;
|
||||||
result = regcompA(&re, expression, REG_AWK);
|
result = regcompA(&re, expression, REG_AWK);
|
||||||
if(result > REG_NOERROR)
|
if(result > (int)REG_NOERROR)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
regerrorA(result, &re, buf, sizeof(buf));
|
regerrorA(result, &re, buf, sizeof(buf));
|
||||||
@ -46,7 +46,7 @@ int main()
|
|||||||
matches[0].rm_so = 0;
|
matches[0].rm_so = 0;
|
||||||
matches[0].rm_eo = strlen(text);
|
matches[0].rm_eo = strlen(text);
|
||||||
result = regexecA(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
result = regexecA(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||||
if(result > REG_NOERROR)
|
if(result > (int)REG_NOERROR)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
regerrorA(result, &re, buf, sizeof(buf));
|
regerrorA(result, &re, buf, sizeof(buf));
|
||||||
|
@ -45,11 +45,11 @@ int main()
|
|||||||
char nbuf[256];
|
char nbuf[256];
|
||||||
int i;
|
int i;
|
||||||
result = regcomp(&re, expression, REG_AWK);
|
result = regcomp(&re, expression, REG_AWK);
|
||||||
if(result > REG_NOERROR)
|
if(result > (int)REG_NOERROR)
|
||||||
{
|
{
|
||||||
regerror(result, &re, buf, sizeof(buf));
|
regerror(result, &re, buf, sizeof(buf));
|
||||||
for(i = 0; i < 256; ++i)
|
for(i = 0; i < 256; ++i)
|
||||||
nbuf[i] = buf[i];
|
nbuf[i] = (char)(buf[i]);
|
||||||
printf(nbuf);
|
printf(nbuf);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -61,11 +61,11 @@ int main()
|
|||||||
matches[0].rm_so = 0;
|
matches[0].rm_so = 0;
|
||||||
matches[0].rm_eo = wcslen(text);
|
matches[0].rm_eo = wcslen(text);
|
||||||
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||||
if(result > REG_NOERROR)
|
if(result > (int)REG_NOERROR)
|
||||||
{
|
{
|
||||||
regerror(result, &re, buf, sizeof(buf));
|
regerror(result, &re, buf, sizeof(buf));
|
||||||
for(i = 0; i < 256; ++i)
|
for(i = 0; i < 256; ++i)
|
||||||
nbuf[i] = buf[i];
|
nbuf[i] = (char)(buf[i]);
|
||||||
printf(nbuf);
|
printf(nbuf);
|
||||||
regfree(&re);
|
regfree(&re);
|
||||||
return result;
|
return result;
|
||||||
|
@ -33,9 +33,14 @@ int* get_array_data();
|
|||||||
|
|
||||||
int error_count = 0;
|
int error_count = 0;
|
||||||
|
|
||||||
|
#ifndef TEST_THREADS
|
||||||
#define RUN_TESTS(name) \
|
#define RUN_TESTS(name) \
|
||||||
std::cout << "Running test case \"" #name "\".\n";\
|
std::cout << "Running test case \"" #name "\".\n";\
|
||||||
name();
|
name();
|
||||||
|
#else
|
||||||
|
#define RUN_TESTS(name) \
|
||||||
|
name();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void run_tests()
|
void run_tests()
|
||||||
|
@ -94,7 +94,7 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
|||||||
std::copy(u32to16type(v.begin()), u32to16type(v.end()), std::back_inserter(v16));
|
std::copy(u32to16type(v.begin()), u32to16type(v.end()), std::back_inserter(v16));
|
||||||
#endif
|
#endif
|
||||||
#ifndef BOOST_NO_STD_DISTANCE
|
#ifndef BOOST_NO_STD_DISTANCE
|
||||||
BOOST_CHECK_EQUAL(std::distance(u32to16type(v.begin()), u32to16type(v.end())), v16.size());
|
BOOST_CHECK_EQUAL((std::size_t)std::distance(u32to16type(v.begin()), u32to16type(v.end())), v16.size());
|
||||||
#endif
|
#endif
|
||||||
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
|
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
|
||||||
v32.assign(u16to32type(v16.begin()), u16to32type(v16.end()));
|
v32.assign(u16to32type(v16.begin()), u16to32type(v16.end()));
|
||||||
@ -103,7 +103,7 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
|||||||
std::copy(u16to32type(v16.begin()), u16to32type(v16.end()), std::back_inserter(v32));
|
std::copy(u16to32type(v16.begin()), u16to32type(v16.end()), std::back_inserter(v32));
|
||||||
#endif
|
#endif
|
||||||
#ifndef BOOST_NO_STD_DISTANCE
|
#ifndef BOOST_NO_STD_DISTANCE
|
||||||
BOOST_CHECK_EQUAL(std::distance(u16to32type(v16.begin()), u16to32type(v16.end())), v32.size());
|
BOOST_CHECK_EQUAL((std::size_t)std::distance(u16to32type(v16.begin()), u16to32type(v16.end())), v32.size());
|
||||||
#endif
|
#endif
|
||||||
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
||||||
i = v.begin();
|
i = v.begin();
|
||||||
@ -117,12 +117,12 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
|||||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||||
v16.assign(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin())));
|
v16.assign(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin())));
|
||||||
#ifndef BOOST_NO_STD_DISTANCE
|
#ifndef BOOST_NO_STD_DISTANCE
|
||||||
BOOST_CHECK_EQUAL(std::distance(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin()))), v16.size());
|
BOOST_CHECK_EQUAL((std::size_t)std::distance(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin()))), v16.size());
|
||||||
#endif
|
#endif
|
||||||
std::reverse(v16.begin(), v16.end());
|
std::reverse(v16.begin(), v16.end());
|
||||||
v32.assign(ru16to32type(u16to32type(v16.end())), ru16to32type(u16to32type(v16.begin())));
|
v32.assign(ru16to32type(u16to32type(v16.end())), ru16to32type(u16to32type(v16.begin())));
|
||||||
#ifndef BOOST_NO_STD_DISTANCE
|
#ifndef BOOST_NO_STD_DISTANCE
|
||||||
BOOST_CHECK_EQUAL(std::distance(ru16to32type(u16to32type(v16.end())), ru16to32type(u16to32type(v16.begin()))), v32.size());
|
BOOST_CHECK_EQUAL((std::size_t)std::distance(ru16to32type(u16to32type(v16.end())), ru16to32type(u16to32type(v16.begin()))), v32.size());
|
||||||
#endif
|
#endif
|
||||||
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
||||||
std::reverse(v32.begin(), v32.end());
|
std::reverse(v32.begin(), v32.end());
|
||||||
@ -142,7 +142,7 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
|||||||
std::copy(u32to8type(v.begin()), u32to8type(v.end()), std::back_inserter(v8));
|
std::copy(u32to8type(v.begin()), u32to8type(v.end()), std::back_inserter(v8));
|
||||||
#endif
|
#endif
|
||||||
#ifndef BOOST_NO_STD_DISTANCE
|
#ifndef BOOST_NO_STD_DISTANCE
|
||||||
BOOST_CHECK_EQUAL(std::distance(u32to8type(v.begin()), u32to8type(v.end())), v8.size());
|
BOOST_CHECK_EQUAL((std::size_t)std::distance(u32to8type(v.begin()), u32to8type(v.end())), v8.size());
|
||||||
#endif
|
#endif
|
||||||
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
|
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
|
||||||
v32.assign(u8to32type(v8.begin()), u8to32type(v8.end()));
|
v32.assign(u8to32type(v8.begin()), u8to32type(v8.end()));
|
||||||
@ -151,7 +151,7 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
|||||||
std::copy(u8to32type(v8.begin()), u8to32type(v8.end()), std::back_inserter(v32));
|
std::copy(u8to32type(v8.begin()), u8to32type(v8.end()), std::back_inserter(v32));
|
||||||
#endif
|
#endif
|
||||||
#ifndef BOOST_NO_STD_DISTANCE
|
#ifndef BOOST_NO_STD_DISTANCE
|
||||||
BOOST_CHECK_EQUAL(std::distance(u8to32type(v8.begin()), u8to32type(v8.end())), v32.size());
|
BOOST_CHECK_EQUAL((std::size_t)std::distance(u8to32type(v8.begin()), u8to32type(v8.end())), v32.size());
|
||||||
#endif
|
#endif
|
||||||
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
||||||
i = v.begin();
|
i = v.begin();
|
||||||
@ -165,12 +165,12 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
|||||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||||
v8.assign(ru32to8type(u32to8type(v.end())), ru32to8type(u32to8type(v.begin())));
|
v8.assign(ru32to8type(u32to8type(v.end())), ru32to8type(u32to8type(v.begin())));
|
||||||
#ifndef BOOST_NO_STD_DISTANCE
|
#ifndef BOOST_NO_STD_DISTANCE
|
||||||
BOOST_CHECK_EQUAL(std::distance(ru32to8type(u32to8type(v.end())), ru32to8type(u32to8type(v.begin()))), v8.size());
|
BOOST_CHECK_EQUAL((std::size_t)std::distance(ru32to8type(u32to8type(v.end())), ru32to8type(u32to8type(v.begin()))), v8.size());
|
||||||
#endif
|
#endif
|
||||||
std::reverse(v8.begin(), v8.end());
|
std::reverse(v8.begin(), v8.end());
|
||||||
v32.assign(ru8to32type(u8to32type(v8.end())), ru8to32type(u8to32type(v8.begin())));
|
v32.assign(ru8to32type(u8to32type(v8.end())), ru8to32type(u8to32type(v8.begin())));
|
||||||
#ifndef BOOST_NO_STD_DISTANCE
|
#ifndef BOOST_NO_STD_DISTANCE
|
||||||
BOOST_CHECK_EQUAL(std::distance(ru8to32type(u8to32type(v8.end())), ru8to32type(u8to32type(v8.begin()))), v32.size());
|
BOOST_CHECK_EQUAL((std::size_t)std::distance(ru8to32type(u8to32type(v8.end())), ru8to32type(u8to32type(v8.begin()))), v32.size());
|
||||||
#endif
|
#endif
|
||||||
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
||||||
std::reverse(v32.begin(), v32.end());
|
std::reverse(v32.begin(), v32.end());
|
||||||
|
Reference in New Issue
Block a user