Compare commits

..

44 Commits

Author SHA1 Message Date
e26bb62622 This commit was manufactured by cvs2svn to create tag
'Version_1_27_0'.

[SVN r12749]
2002-02-07 13:33:59 +00:00
26d899274a This commit was manufactured by cvs2svn to create branch 'RC_1_27_0'.
[SVN r12739]
2002-02-06 03:32:50 +00:00
f79497c625 Handle standard libraries that do not support std::iterator
[SVN r12686]
2002-02-04 12:54:17 +00:00
a108657449 Make string_out_iterator a full-fledged output iterator
[SVN r12671]
2002-02-03 17:30:13 +00:00
9225fa8531 Removed unnecessary template parameter from ostream_iterator so that it works with gcc2.9x now.
[SVN r12666]
2002-02-03 11:44:37 +00:00
07c20c1926 Modified code that determines how long to loop for, with upper limit of 1s.
[SVN r12665]
2002-02-03 11:43:23 +00:00
d227059666 New smart pointer documentation. Related clean-up of the smart pointer
library. Changing includes to include the new individual smart pointer
headers. Replacing old smart pointer library with an include of the new
smart pointer headers. Simplify ifdefs that involve the member templates
macros now that BOOST_MSVC6_MEMBER_TEMPLATES is also guaranteed to bet
set for platforms that have full member templates.


[SVN r12647]
2002-02-02 18:36:12 +00:00
f5082341c0 changed all pointer casts to explicit static_cast or reinterpret_cast.
Added more tests for forward lookahead asserts.


[SVN r12575]
2002-01-30 12:17:51 +00:00
5613d77433 Changed all pointer casts to either static_cast or reinterpret_cast as appropriate.
[SVN r12574]
2002-01-30 12:16:28 +00:00
6463dcfb07 regex_timer.cpp:
- Head off some infinite looping on some platforms


[SVN r12550]
2002-01-29 13:38:30 +00:00
c07c4e0a11 Added support for forward lookahead asserts.
[SVN r12455]
2002-01-23 12:42:31 +00:00
e993619390 Stripped tabs from source
[SVN r12351]
2002-01-19 12:38:14 +00:00
e22aaa9d20 Fixed copy self assignment bug
[SVN r12248]
2002-01-08 13:00:08 +00:00
52dbd281ca Added checks to message loading code.
Added extra members to RegEx class.
Updated docs accordingly.


[SVN r12244]
2002-01-07 13:03:50 +00:00
e4138b5bdc Added members RegEx::Match and RegEx::npos.
[SVN r12243]
2002-01-07 13:02:37 +00:00
534f6273c0 No longer throws on copy-construct
asserts when applying fixups (invariant checks) added


[SVN r12242]
2002-01-07 13:01:31 +00:00
b2dd7877da Updated regex examples and Jamfiles so that they are run as tests.
[SVN r12149]
2001-12-26 11:21:24 +00:00
0cda8c8a2e Initial checkin
[SVN r12122]
2001-12-19 11:57:20 +00:00
04282b5d0a Updated version numbers in docs.
[SVN r12081]
2001-12-17 12:44:26 +00:00
554832217c Updated regex examples and Jamfiles so that most now run as tests.
[SVN r12067]
2001-12-16 11:33:27 +00:00
63130c1ef5 Updated Jamfiles and tests so that they actually work now!
[SVN r11985]
2001-12-09 12:50:46 +00:00
edbc68df6c Updated to reflect changes in STLport-4.5
[SVN r11970]
2001-12-07 12:14:56 +00:00
372a07902e Made string_compare functions inline (they should have been all along).
[SVN r11952]
2001-12-06 12:39:31 +00:00
4ae95dae74 removed unneeded #if block
[SVN r11906]
2001-12-04 12:23:28 +00:00
277ca851c8 Metrowerks needs BOOST_NO_STD_LOCALE in config to be able to compile regex
regex test Jamfile updates so that some tests will actually run
warning suppression for condition.cpp

unit-test rule now accepts input files
updated metrowerks and borland to properly set up path for running tests

----------------------------------------------------------------------
Modified Files:
	boost/config/compiler/metrowerks.hpp
	libs/python/src/gen_function.py libs/regex/test/Jamfile
 Tag: thread-initial
	libs/thread/src/condition.cpp
 No tag
	tools/build/boost-base.jam tools/build/borland-tools.jam
	tools/build/metrowerks-tools.jam
----------------------------------------------------------------------


[SVN r11853]
2001-12-02 17:43:45 +00:00
f0d62fb2c0 Updated changes log
[SVN r11830]
2001-11-30 12:00:31 +00:00
7104418bd5 * Changed BOOST_RE_THREADS to BOOST_HAS_THREADS,
* Updated allocator code to use SGI node based allocator when available.


[SVN r11829]
2001-11-30 11:58:04 +00:00
0bd54d3821 Added optional code to time how long the test takes.
[SVN r11828]
2001-11-30 11:56:35 +00:00
c167b1f183 changed BOOST_RE_THREADS to BOOST_HAS_THREADS
[SVN r11827]
2001-11-30 11:56:02 +00:00
52920ff98f Added \ as a non-literal character (oversight).
[SVN r11717]
2001-11-16 12:25:17 +00:00
72c3b4ed13 Fix for broken split (doesn't spit out all sub expressions).
[SVN r11716]
2001-11-16 12:24:40 +00:00
6cc5cf41d5 Trivial fix for signed/unsigned comparison
[SVN r11715]
2001-11-16 12:24:01 +00:00
a7984bb149 Updated Jamfiles with forced dynamic linking removed.
[SVN r11647]
2001-11-10 12:12:38 +00:00
876ff39307 remove redundant <runtime-link>dynamic from default-BUILD section
[SVN r11644]
2001-11-09 15:30:45 +00:00
79f80ad09d Updated list of helpers
[SVN r11449]
2001-10-26 11:58:59 +00:00
19d8e96cf5 Added workaround for Rogue Wave lib bug.
[SVN r11391]
2001-10-16 11:36:47 +00:00
e047b2b509 Updated examples with better comment on expressions. Updated test program to test for apparent Rogur Wave bug (and it's workaround).
[SVN r11390]
2001-10-16 11:36:00 +00:00
28968bd2b6 renamed "free" member functions to avoid conflicts with system macros.
[SVN r11384]
2001-10-13 10:26:34 +00:00
c4b295684b Added docs for smatch and wsmatch typedefs, added warnings about using temporaries with regex_search/regex_match.
[SVN r11383]
2001-10-13 10:24:55 +00:00
33b6eb0637 Renamed member functions "free" to prevent conflict with system macro.
[SVN r11380]
2001-10-13 10:19:01 +00:00
de9ad8df74 Fix spelling error: "occurances" -> "occurrences".
[SVN r11376]
2001-10-11 17:26:04 +00:00
a042a0b6de Removed spurious MSVC pragma
[SVN r11369]
2001-10-09 11:25:43 +00:00
f16f300347 Fixed inclusion of windows.h
[SVN r11356]
2001-10-08 11:32:22 +00:00
a543dce5e3 regex, threads, and python will all build from the top level. If you build the 'test' target from the top level, it will run all regressions.
Jamfile:
  subincludes for thread, python libs, and status for regression tests

Jamrules:
  Use the new path-global rule to establish BOOST_ROOT correctly for all subprojects

libs/regex/build/Jamfile
  Take advantage of correct BOOST_ROOT setting

libs/python/build/Jamfile
  Search for python executable; don't try to build anything if it can't be found.
  don't build tests by default
  improved comments, organization, and naming.

status/Jamfile
  Fixed references to config test files
  Failed tests now leave their stdout results in <testname>.error instead of removing it
  No test targets are dependencies of 'all' anymore
  Added comments
  Reorganized

tools/build/Jambase
  Meant to check this in long ago.

tools/build/allyourbase.jam
  Fixed SHELL_EXPORT setting, added SHELL_SET
  removed 'test' from the dependencies of 'all'; tests no longer run by default.
  Fixed the direction of slashes for Windows when ALL_LOCATE_TARGET is used.
  Added path-global rule for declaring path variables which may be relative
  rule in-invocation-subdir returns true if the current subproject is the one
     from which Jam was invoked
  rule protect-subdir is now used to protect subproject variables
  rule tokens-to-simple-path converts path tokens to a simplified path.

tools/build/boost-base.jam
  Fixed bugs

tools/build/jam_src/makedebugjam.bat
  Fixed a bug which prevented a final debug build

tools/build/jam_src/search.c
  Fixed a bug of mine which caused LOCATE to be ignored (!).


[SVN r11348]
2001-10-06 18:19:15 +00:00
63 changed files with 1434 additions and 558 deletions

View File

@ -19,8 +19,6 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
alt="C++ Boost" width="276" height="86"></h3>
</td>
<td valign="top"><h3 align="center">Regex++, Appendices.</h3>
<p align="left"><i>(Version 3.20, 29th Sept 2001)</i>&nbsp;
</p>
<p align="left"><i>Copyright (c) 1998-2001 </i></p>
<p align="left"><i>Dr John Maddock</i></p>
<p align="left"><i>Permission to use, copy, modify,
@ -1295,21 +1293,22 @@ for forcing me to think about algorithms and their performance,
and to the folks at boost for forcing me to <i>think</i>, period.
The following people have all contributed useful comments or
fixes: Dave Abrahams, Mike Allison, Edan Ayal, Jayashree
Balasubramanian, Beman Dawes, Paul Baxter, David Bergman, David
Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno,
Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick
Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan
Hermelink, Max Leung, Wei-hao Lin, Jens Maurer, Heiko Schmidt,
Jason Shirk, Scobie Smith, Alexander Sokolovsky, Herv<72> Poirier,
Marc Recht, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to
the manuals supplied with the Henry Spencer, Perl and GNU regular
expression libraries - wherever possible I have tried to maintain
compatibility with these libraries and with the POSIX standard -
the code however is entirely my own, including any bugs! I can
absolutely guarantee that I will not fix any bugs I don't know
about, so if you have any comments or spot any bugs, please get
in touch. </p>
Balasubramanian, Jan B<>lsche, Beman Dawes, Paul Baxter, David
Bergman, David Dennerline, Edward Diener, Peter Dimov, Robert
Dunn, Fabio Forno, Tobias Gabrielsson, Rob Gillen, Marc Gregoire,
Chris Hecker, Nick Hodapp, Jesse Jones, Martin Jost, Boris
Krasnovskiy, Jan Hermelink, Max Leung, Wei-hao Lin, Jens Maurer,
Richard Peters, Heiko Schmidt, Jason Shirk, Gerald Slacik, Scobie
Smith, Mike Smyth, Alexander Sokolovsky, Herv<EFBFBD> Poirier, Michael
Raykh, Marc Recht, Scott VanCamp, Bruno Voigt, Alexey Voinov,
Jerry Waldorf, Rob Ward, Lealon Watts, Thomas Witt and Yuval
Yosef. I am also grateful to the manuals supplied with the Henry
Spencer, Perl and GNU regular expression libraries - wherever
possible I have tried to maintain compatibility with these
libraries and with the POSIX standard - the code however is
entirely my own, including any bugs! I can absolutely guarantee
that I will not fix any bugs I don't know about, so if you have
any comments or spot any bugs, please get in touch. </p>
<p>Useful further information can be found at: </p>

View File

@ -5,23 +5,25 @@ SOURCES = c_regex_traits c_regex_traits_common cpp_regex_traits
regex_synch w32_regex_traits wide_posix_api ;
lib libboost_regex$(SUFLIB) : ../src/$(SOURCES).cpp
:
<include>../../../
<define>BOOST_RE_NO_LIB=1
:
debug release
<runtime-link>dynamic
;
:
<include>$(BOOST_ROOT)
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug release
;
dll libboost_regex$(SUFDLL[1]) : ../src/$(SOURCES).cpp
:
<include>../../../
<define>BOOST_RE_BUILD_DLL=1
:
debug release
<runtime-link>dynamic
;
:
<include>$(BOOST_ROOT)
<define>BOOST_RE_BUILD_DLL=1
:
debug release
;

View File

@ -316,37 +316,37 @@ vc6-stlport-re300ls_clean :
#
########################################################
vc6-stlport/vc6-stlport-re300ddl/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/c_regex_traits.cpp
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/c_regex_traits.cpp
vc6-stlport/vc6-stlport-re300ddl/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/c_regex_traits_common.cpp
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/c_regex_traits_common.cpp
vc6-stlport/vc6-stlport-re300ddl/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/cpp_regex_traits.cpp
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/cpp_regex_traits.cpp
vc6-stlport/vc6-stlport-re300ddl/cregex.obj: ../src/cregex.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/cregex.cpp
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/cregex.cpp
vc6-stlport/vc6-stlport-re300ddl/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/fileiter.cpp
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/fileiter.cpp
vc6-stlport/vc6-stlport-re300ddl/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/posix_api.cpp
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/posix_api.cpp
vc6-stlport/vc6-stlport-re300ddl/regex.obj: ../src/regex.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/regex.cpp
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/regex.cpp
vc6-stlport/vc6-stlport-re300ddl/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/regex_debug.cpp
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/regex_debug.cpp
vc6-stlport/vc6-stlport-re300ddl/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/regex_synch.cpp
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/regex_synch.cpp
vc6-stlport/vc6-stlport-re300ddl/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/w32_regex_traits.cpp
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/w32_regex_traits.cpp
vc6-stlport/vc6-stlport-re300ddl/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/wide_posix_api.cpp
cl $(INCLUDES) /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddl/vc6-stlport-re300ddl.pch -Fo./vc6-stlport/vc6-stlport-re300ddl/ -Fdvc6-stlport/vc6-stlport-re300ddl.pdb ../src/wide_posix_api.cpp
vc6-stlport-re300ddl_dir :
if not exist "vc6-stlport\vc6-stlport-re300ddl\$(NULL)" mkdir vc6-stlport\vc6-stlport-re300ddl
@ -366,37 +366,37 @@ vc6-stlport-re300ddl_clean :
#
########################################################
vc6-stlport/vc6-stlport-re300ddm/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/c_regex_traits.cpp
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/c_regex_traits.cpp
vc6-stlport/vc6-stlport-re300ddm/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/c_regex_traits_common.cpp
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/c_regex_traits_common.cpp
vc6-stlport/vc6-stlport-re300ddm/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/cpp_regex_traits.cpp
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/cpp_regex_traits.cpp
vc6-stlport/vc6-stlport-re300ddm/cregex.obj: ../src/cregex.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/cregex.cpp
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/cregex.cpp
vc6-stlport/vc6-stlport-re300ddm/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/fileiter.cpp
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/fileiter.cpp
vc6-stlport/vc6-stlport-re300ddm/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/posix_api.cpp
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/posix_api.cpp
vc6-stlport/vc6-stlport-re300ddm/regex.obj: ../src/regex.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/regex.cpp
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/regex.cpp
vc6-stlport/vc6-stlport-re300ddm/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/regex_debug.cpp
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/regex_debug.cpp
vc6-stlport/vc6-stlport-re300ddm/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/regex_synch.cpp
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/regex_synch.cpp
vc6-stlport/vc6-stlport-re300ddm/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/w32_regex_traits.cpp
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/w32_regex_traits.cpp
vc6-stlport/vc6-stlport-re300ddm/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER)
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/wide_posix_api.cpp
cl $(INCLUDES) /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(CXXFLAGS) -Fpvc6-stlport/vc6-stlport-re300ddm/vc6-stlport-re300ddm.pch -Fo./vc6-stlport/vc6-stlport-re300ddm/ -Fdvc6-stlport/vc6-stlport-re300ddm.pdb ../src/wide_posix_api.cpp
vc6-stlport-re300ddm_dir :
if not exist "vc6-stlport\vc6-stlport-re300ddm\$(NULL)" mkdir vc6-stlport\vc6-stlport-re300ddm
@ -410,3 +410,4 @@ vc6-stlport-re300ddm_clean :
./vc6-stlport/vc6-stlport-re300ddm.lib : vc6-stlport/vc6-stlport-re300ddm/c_regex_traits.obj vc6-stlport/vc6-stlport-re300ddm/c_regex_traits_common.obj vc6-stlport/vc6-stlport-re300ddm/cpp_regex_traits.obj vc6-stlport/vc6-stlport-re300ddm/cregex.obj vc6-stlport/vc6-stlport-re300ddm/fileiter.obj vc6-stlport/vc6-stlport-re300ddm/posix_api.obj vc6-stlport/vc6-stlport-re300ddm/regex.obj vc6-stlport/vc6-stlport-re300ddm/regex_debug.obj vc6-stlport/vc6-stlport-re300ddm/regex_synch.obj vc6-stlport/vc6-stlport-re300ddm/w32_regex_traits.obj vc6-stlport/vc6-stlport-re300ddm/wide_posix_api.obj
link -lib /nologo /out:vc6-stlport/vc6-stlport-re300ddm.lib $(XSFLAGS) vc6-stlport/vc6-stlport-re300ddm/c_regex_traits.obj vc6-stlport/vc6-stlport-re300ddm/c_regex_traits_common.obj vc6-stlport/vc6-stlport-re300ddm/cpp_regex_traits.obj vc6-stlport/vc6-stlport-re300ddm/cregex.obj vc6-stlport/vc6-stlport-re300ddm/fileiter.obj vc6-stlport/vc6-stlport-re300ddm/posix_api.obj vc6-stlport/vc6-stlport-re300ddm/regex.obj vc6-stlport/vc6-stlport-re300ddm/regex_debug.obj vc6-stlport/vc6-stlport-re300ddm/regex_synch.obj vc6-stlport/vc6-stlport-re300ddm/w32_regex_traits.obj vc6-stlport/vc6-stlport-re300ddm/wide_posix_api.obj

View File

@ -1,4 +1,13 @@
Version 331:
FIXED: All known current bugs.
ADDED: Support for default SGI allocator when available (even if it's not
standard conformant).
Version 330:
BUG: Broken STLport-4.5 support.
BUG: Not all occurances of BOOST_RE_THREADS changed to use BOOST_HAS_THREADS
CHANGED: Completely redesigned config support (now fully integrated with boost).
FIXED: Support for building with _UNICODE defined.
FIXED: Bug when running on Windows XP (character classification bitmaps wrong).
@ -268,6 +277,8 @@ BUG: character sets don't function correctly when regbase::char_classes

View File

@ -1,147 +1,177 @@
subproject libs/regex/example ;
exe timer : timer/regex_timer.cpp
unit-test timer : timer/regex_timer.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
release
:
timer/input_script.txt
;
exe jgrep : jgrep/jgrep.cpp jgrep/main.cpp
unit-test jgrep : jgrep/jgrep.cpp jgrep/main.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
release
:
-n boost/ ../../../boost/regex.hpp
;
exe credit_card_example : snippets/credit_card_example.cpp
unit-test credit_card_example : snippets/credit_card_example.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
;
exe partial_regex_grep : snippets/partial_regex_grep.cpp
unit-test partial_regex_grep : snippets/partial_regex_grep.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
../index.htm
;
exe partial_regex_match : snippets/partial_regex_match.cpp
unit-test partial_regex_match : snippets/partial_regex_match.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
1234-5678-8765-4
;
exe regex_grep_example_1 : snippets/regex_grep_example_1.cpp
unit-test regex_grep_example_1 : snippets/regex_grep_example_1.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
../../../boost/smart_ptr.hpp
;
exe regex_grep_example_2 : snippets/regex_grep_example_2.cpp
unit-test regex_grep_example_2 : snippets/regex_grep_example_2.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
../../../boost/smart_ptr.hpp
;
exe regex_grep_example_3 : snippets/regex_grep_example_3.cpp
unit-test regex_grep_example_3 : snippets/regex_grep_example_3.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
../../../boost/smart_ptr.hpp
;
exe regex_grep_example_4 : snippets/regex_grep_example_4.cpp
unit-test regex_grep_example_4 : snippets/regex_grep_example_4.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
../../../boost/smart_ptr.hpp
;
exe regex_match_example : snippets/regex_match_example.cpp
unit-test regex_match_example : snippets/regex_match_example.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
-auto
;
exe regex_merge_example : snippets/regex_merge_example.cpp
unit-test regex_merge_example : snippets/regex_merge_example.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
../../../boost/smart_ptr.hpp
;
exe regex_search_example : snippets/regex_search_example.cpp
unit-test regex_search_example : snippets/regex_search_example.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
../../../boost/smart_ptr.hpp
;
exe regex_split_example_1 : snippets/regex_split_example_1.cpp
unit-test regex_split_example_1 : snippets/regex_split_example_1.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
-auto
;
exe regex_split_example_2 : snippets/regex_split_example_2.cpp
unit-test regex_split_example_2 : snippets/regex_split_example_2.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
../index.htm
;

View File

@ -0,0 +1,318 @@
/*
* (C) Copyright Christain Engstrom 2001.
* Permission to copy, use, modify, sell and distribute this software
* is granted provided this copyright notice appears in all copies.
* This software is provided "as is" without express or implied
* warranty, and with no claim as to its suitability for any purpose.
*/
#include "iso8859_1_regex_traits.hpp"
bool iso8859_1_regex_traits::is_class(char c, boost::uint_fast32_t f) const
{
static const boost::uint_fast32_t cntrl = base::char_class_cntrl;
static const boost::uint_fast32_t space = base::char_class_space;
static const boost::uint_fast32_t blank = base::char_class_blank;
static const boost::uint_fast32_t digit = base::char_class_digit;
static const boost::uint_fast32_t xdigit = base::char_class_xdigit;
static const boost::uint_fast32_t underscore = base::char_class_underscore;
static const boost::uint_fast32_t punct = base::char_class_punct;
static const boost::uint_fast32_t upper = base::char_class_upper |
base::char_class_alpha;
static const boost::uint_fast32_t lower = base::char_class_lower |
base::char_class_alpha;
static const boost::uint_fast32_t flag_table[UCHAR_MAX + 1] = {
// Hex Oct Dec Char
cntrl , // 0 0 0
cntrl , // 1 1 1
cntrl , // 2 2 2
cntrl , // 3 3 3
cntrl , // 4 4 4
cntrl , // 5 5 5
cntrl , // 6 6 6
cntrl , // 7 7 7
cntrl , // 8 10 8
cntrl | space | blank , // 9 11 9 <HT>
cntrl | space , // a 12 10 <LF>
cntrl | space , // b 13 11 <VT>
cntrl | space , // c 14 12 <FF>
cntrl | space , // d 15 13 <CR>
cntrl , // e 16 14
cntrl , // f 17 15
cntrl , // 10 20 16
cntrl , // 11 21 17
cntrl , // 12 22 18
cntrl , // 13 23 19
cntrl , // 14 24 20
cntrl , // 15 25 21
cntrl , // 16 26 22
cntrl , // 17 27 23
cntrl , // 18 30 24
cntrl , // 19 31 25
cntrl , // 1a 32 26
cntrl , // 1b 33 27
cntrl , // 1c 34 28
cntrl , // 1d 35 29
cntrl , // 1e 36 30
cntrl , // 1f 37 31
space | blank , // 20 40 32 | Space
punct , // 21 41 33 !
punct , // 22 42 34 "
punct , // 23 43 35 #
punct , // 24 44 36 $
punct , // 25 45 37 %
punct , // 26 46 38 &
punct , // 27 47 39 '
punct , // 28 50 40 (
punct , // 29 51 41 )
punct , // 2a 52 42 *
punct , // 2b 53 43 +
punct , // 2c 54 44
punct , // 2d 55 45 -
punct , // 2e 56 46 .
punct , // 2f 57 47 /
digit | xdigit , // 30 60 48 0
digit | xdigit , // 31 61 49 1
digit | xdigit , // 32 62 50 2
digit | xdigit , // 33 63 51 3
digit | xdigit , // 34 64 52 4
digit | xdigit , // 35 65 53 5
digit | xdigit , // 36 66 54 6
digit | xdigit , // 37 67 55 7
digit | xdigit , // 38 70 56 8
digit | xdigit , // 39 71 57 9
punct , // 3a 72 58 :
punct , // 3b 73 59 ;
punct , // 3c 74 60 <
punct , // 3d 75 61 =
punct , // 3e 76 62 >
punct , // 3f 77 63 ?
punct , // 40 100 64 @
upper | xdigit , // 41 101 65 A
upper | xdigit , // 42 102 66 B
upper | xdigit , // 43 103 67 C
upper | xdigit , // 44 104 68 D
upper | xdigit , // 45 105 69 E
upper | xdigit , // 46 106 70 F
upper , // 47 107 71 G
upper , // 48 110 72 H
upper , // 49 111 73 I
upper , // 4a 112 74 J
upper , // 4b 113 75 K
upper , // 4c 114 76 L
upper , // 4d 115 77 M
upper , // 4e 116 78 N
upper , // 4f 117 79 O
upper , // 50 120 80 P
upper , // 51 121 81 Q
upper , // 52 122 82 R
upper , // 53 123 83 S
upper , // 54 124 84 T
upper , // 55 125 85 U
upper , // 56 126 86 V
upper , // 57 127 87 W
upper , // 58 130 88 X
upper , // 59 131 89 Y
upper , // 5a 132 90 Z
punct , // 5b 133 91 [ | Left square bracket
punct , // 5c 134 92 \ | Backslash
punct , // 5d 135 93 ] | Right square bracket
punct , // 5e 136 94 ^ | Circumflex
punct | underscore , // 5f 137 95 _ | Underscore
punct , // 60 140 96 `
lower | xdigit , // 61 141 97 a
lower | xdigit , // 62 142 98 b
lower | xdigit , // 63 143 99 c
lower | xdigit , // 64 144 100 d
lower | xdigit , // 65 145 101 e
lower | xdigit , // 66 146 102 f
lower , // 67 147 103 g
lower , // 68 150 104 h
lower , // 69 151 105 i
lower , // 6a 152 106 j
lower , // 6b 153 107 k
lower , // 6c 154 108 l
lower , // 6d 155 109 m
lower , // 6e 156 110 n
lower , // 6f 157 111 o
lower , // 70 160 112 p
lower , // 71 161 113 q
lower , // 72 162 114 r
lower , // 73 163 115 s
lower , // 74 164 116 t
lower , // 75 165 117 u
lower , // 76 166 118 v
lower , // 77 167 119 w
lower , // 78 170 120 x
lower , // 79 171 121 y
lower , // 7a 172 122 z
punct , // 7b 173 123 {
punct , // 7c 174 124 |
punct , // 7d 175 125 }
punct , // 7e 176 126 ~
cntrl , // 7f 177 127
cntrl , // 80 200 128
cntrl , // 81 201 129
cntrl , // 82 202 130
cntrl , // 83 203 131
cntrl , // 84 204 132
cntrl , // 85 205 133
cntrl , // 86 206 134
cntrl , // 87 207 135
cntrl , // 88 210 136
cntrl , // 89 211 137
cntrl , // 8a 212 138
cntrl , // 8b 213 139
cntrl , // 8c 214 140
cntrl , // 8d 215 141
cntrl , // 8e 216 142
cntrl , // 8f 217 143
cntrl , // 90 220 144
cntrl , // 91 221 145
cntrl , // 92 222 146
cntrl , // 93 223 147
cntrl , // 94 224 148
cntrl , // 95 225 149
cntrl , // 96 226 150
cntrl , // 97 227 151
cntrl , // 98 230 152
cntrl , // 99 231 153
cntrl , // 9a 232 154
cntrl , // 9b 233 155
cntrl , // 9c 234 156
cntrl , // 9d 235 157
cntrl , // 9e 236 158
cntrl , // 9f 237 159
punct , // a0 240 160 <20> | Non-breaking space
punct , // a1 241 161 <20> | Inverted exclamation mark
punct , // a2 242 162 <20> | Cent sign
punct , // a3 243 163 <20> | Pound sign
punct , // a4 244 164 <20> | Currency sign
punct , // a5 245 165 <20> | Yen sign
punct , // a6 246 166 <20> | Broken bar
punct , // a7 247 167 <20> | Section sign
punct , // a8 250 168 <20> | Diaeresis
punct , // a9 251 169 <20> | Copyright sign
punct , // aa 252 170 <20> | Feminine ordinal indicator
punct , // ab 253 171 <20> | Left-pointing double angle
punct , // ac 254 172 <20> | Not sign
punct , // ad 255 173 <20> | Soft hyphen
punct , // ae 256 174 <20> | Registered trademark sign
punct , // af 257 175 <20> | Macron
punct , // b0 260 176 <20> | Degree sign
punct , // b1 261 177 <20> | Plus-minus sign
punct , // b2 262 178 <20> | Superscript two
punct , // b3 263 179 <20> | Superscript three
punct , // b4 264 180 <20> | Acute accent
punct , // b5 265 181 <20> | Micro sign
punct , // b6 266 182 <20> | Pilcrow sign
punct , // b7 267 183 <20> | Middle dot
punct , // b8 270 184 <20> | Cedilla
punct , // b9 271 185 <20> | Superscript one
punct , // ba 272 186 <20> | Masculine ordinal indicator
punct , // bb 273 187 <20> | Right-pointing double angle
punct , // bc 274 188 <20> | Fraction one quarter
punct , // bd 275 189 <20> | Fraction one half
punct , // be 276 190 <20> | Fraction three quarters
punct , // bf 277 191 <20> | Inverted question mark
upper , // c0 300 192 <20> | "A" with grave accent
upper , // c1 301 193 <20> | "A" with acute accent
upper , // c2 302 194 <20> | "A" with circumflex
upper , // c3 303 195 <20> | "A" with tilde
upper , // c4 304 196 <20> | "A" with diaeresis
upper , // c5 305 197 <20> | "A" with ring above
upper , // c6 306 198 <20> | "AE" ligature
upper , // c7 307 199 <20> | "C" with cedilla
upper , // c8 310 200 <20> | "E" with grave accent
upper , // c9 311 201 <20> | "E" with acute accent
upper , // ca 312 202 <20> | "E" with circumflex
upper , // cb 313 203 <20> | "E" with diaeresis
upper , // cc 314 204 <20> | "I" with grave accent
upper , // cd 315 205 <20> | "I" with acute accent
upper , // ce 316 206 <20> | "I" with circumflex
upper , // cf 317 207 <20> | "I" with diaeresis
upper , // d0 320 208 <20> | Upper Icelandic D (Eth)
upper , // d1 321 209 <20> | "N" with tilde
upper , // d2 322 210 <20> | "O" with grave accent
upper , // d3 323 211 <20> | "O" with acute accent
upper , // d4 324 212 <20> | "O" with circumflex
upper , // d5 325 213 <20> | "O" with tilde
upper , // d6 326 214 <20> | "O" with diaeresis
punct , // d7 327 215 <20> | Multiplication sign
upper , // d8 330 216 <20> | "O" with stroke
upper , // d9 331 217 <20> | "U" with grave accent
upper , // da 332 218 <20> | "U" with acute accent
upper , // db 333 219 <20> | "U" with circumflex
upper , // dc 334 220 <20> | "U" with diaeresis
upper , // dd 335 221 <20> | "Y" with acute accent
upper , // de 336 222 <20> | Upper Icelandic T (Thorn)
lower , // df 337 223 <20> | German sharp s
lower , // e0 340 224 <20> | "a" with grave accent
lower , // e1 341 225 <20> | "a" with acute accent
lower , // e2 342 226 <20> | "a" with circumflex
lower , // e3 343 227 <20> | "a" with tilde
lower , // e4 344 228 <20> | "a" with diaeresis
lower , // e5 345 229 <20> | "a" with ring above
lower , // e6 346 230 <20> | Latin small ligature ae
lower , // e7 347 231 <20> | "c" with cedilla
lower , // e8 350 232 <20> | "e" with grave accent
lower , // e9 351 233 <20> | "e" with acute accent
lower , // ea 352 234 <20> | "e" with circumflex
lower , // eb 353 235 <20> | "e" with diaeresis
lower , // ec 354 236 <20> | "i" with grave accent
lower , // ed 355 237 <20> | "i" with acute accent
lower , // ee 356 238 <20> | "i" with circumflex
lower , // ef 357 239 <20> | "i" with diaeresis
lower , // f0 360 240 <20> | Lower Icelandic d (eth)
lower , // f1 361 241 <20> | "n" with tilde
lower , // f2 362 242 <20> | "o" with grave accent
lower , // f3 363 243 <20> | "o" with acute accent
lower , // f4 364 244 <20> | "o" with circumflex
lower , // f5 365 245 <20> | "o" with tilde
lower , // f6 366 246 <20> | "o" with diaeresis
punct , // f7 367 247 <20> | Division sign
lower , // f8 370 248 <20> | "o" with oblique bar
lower , // f9 371 249 <20> | "u" with grave accent
lower , // fa 372 250 <20> | "u" with acute accent
lower , // fb 373 251 <20> | "u" with circumflex
lower , // fc 374 252 <20> | "u" with diaeresis
lower , // fd 375 253 <20> | "y" with acute accent
lower , // fe 376 254 <20> | Lower Icelandic t (thorn)
lower // ff 377 255 <20> | "y" with diaeresis
};
return (flag_table[unsigned char(c)] & f) != 0;
}
//============================================================================
char iso8859_1_regex_traits::translate(char c, bool icase) const
{
//----------------------------------------------------------------------------
// "ABCDEFGHIJKLMNOPQRSTUVWXYZ" -> "abcdefghijklmnopqrstuvwxyz"
// "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" -> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
//----------------------------------------------------------------------------
static const char lower_case_map[UCHAR_MAX + 1] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,120,121,122, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
240,241,242,243,244,245,246,215,248,249,250,251,252,253,254,223,
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
return icase ? lower_case_map[unsigned char(c)] : c;
}

View File

@ -0,0 +1,25 @@
/*
* (C) Copyright Christain Engstrom 2001.
* Permission to copy, use, modify, sell and distribute this software
* is granted provided this copyright notice appears in all copies.
* This software is provided "as is" without express or implied
* warranty, and with no claim as to its suitability for any purpose.
*/
#ifndef BOOST_ISO8859_1_REGEX_TRAITS_HPP
#define BOOST_ISO8859_1_REGEX_TRAITS_HPP
class iso8859_1_regex_traits : public boost::c_regex_traits<char> {
private:
typedef boost::c_regex_traits<char> base;
public:
iso8859_1_regex_traits() {}
~iso8859_1_regex_traits() {}
bool is_class(char c, boost::uint_fast32_t f) const;
char translate(char c, bool icase) const;
};
#endif

View File

@ -0,0 +1,49 @@
I have written a class iso8859_1_regex_traits, which I enclose. Any
comments will be very welcome.
The class is derived from boost::c_regex_traits<char>, and just redefines
the member function is_class so that it will handle the character classes
for all the 8 bit characters in the ISO8859-1 (Latin 1) alphabet. The
enclosed file iso8859_1.txt lists the character classes for all the 256
characters.
For the 7 bit ASCII characters up to octal 177, the character classes are
identical to the ones returned by boost::c_regex_traits<char> and
boost::w32_regex_traits<char>. (I have only tried this under Windows.)
For the characters above octal 177, iso8859_1_regex_traits differs from
boost::w32_regex_traits<char> in the following ways:
1) The characters between octal 200 and octal 237 all belong to the
character class cntrl only, whereas most of them belong to print graph punct
in Windows. This reflects a true difference between the ISO8859-1 and
Windows character sets, so it should be pretty uncontroversial.
2) The superscript digits <20><><EFBFBD> (octal 271, 262 and 263) belong to print graph
punct only in iso8859_1_regex_traits. In w32_regex_traits these characters
are defined to belong to digit as well, which automatically makes them
members of alnum and word too. I consider this to be a mistake made by
those who defined the Windows locale, as I can see few, if any, uses for a
character class defined in this manner, and the definition precludes the use
of the digit character class for many normal and useful purposes, such as
checking if a string contains an integer number. (Please note that this
criticism is directed towards Microsoft itself rather than towards the regex
package, since this definition is a part of Visual C++.)
3) The non-breaking space character (octal 240) belongs to print graph punct
in iso8859_1_regex_traits. In w32_regex_traits it is instead defined to
belong print blank space, i.e.: it is defined in exactly the same way as the
ordinary octal 40 space character. Again I consider this to be a mistake in
the Windows locale, that renders the space character class fairly useless
for any applications where non-breaking spaces might occur. After all, the
whole point in having both ordinary and non-breaking spaces in the character
set is that programs should be able to treat them differently, but with the
Windows locale, this is not possible.
As stated above I look forward to any comments, both relating to the
implementation as such and to the choices I have made in the definition of
the character classes.
Christian Engstr<74>m

View File

@ -10,9 +10,9 @@ boost::regex e("<[^>]*>");
// count how many:
unsigned int tags = 0;
// saved position of partial match:
char* next_pos = 0;
const char* next_pos = 0;
bool grep_callback(const boost::match_results<char*>& m)
bool grep_callback(const boost::match_results<const char*>& m)
{
if(m[0].matched == false)
{
@ -38,15 +38,16 @@ void search(std::istream& is)
// copy forward whatever we have left:
memmove(buf, next_pos, leftover);
// fill the rest from the stream:
unsigned read = is.readsome(buf + leftover, size);
is.read(buf + leftover, size);
unsigned read = is.gcount();
// check to see if we've run out of text:
have_more = read == size;
// reset next_pos:
next_pos = buf + sizeof(buf);
// and then grep:
boost::regex_grep(grep_callback,
buf,
buf + read + leftover,
boost::regex_grep<bool(*)(const boost::cmatch&), const char*>(grep_callback,
static_cast<const char*>(buf),
static_cast<const char*>(buf + read + leftover),
e,
boost::match_default | boost::match_partial);
}

View File

@ -29,7 +29,10 @@ int main(int argc, char* argv[])
{
try{
std::string input;
std::cin >> input;
if(argc > 1)
input = argv[1];
else
std::cin >> input;
if(is_possible_card_number(input))
{
std::cout << "Matched OK..." << std::endl;

View File

@ -31,7 +31,29 @@
typedef std::map<std::string, int, std::less<std::string> > map_type;
boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)");
const char* re =
// possibly leading whitespace:
"^[[:space:]]*"
// possible template declaration:
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
// class or struct:
"(class|struct)[[:space:]]*"
// leading declspec macros etc:
"("
"\\<\\w+\\>"
"("
"[[:blank:]]*\\([^)]*\\)"
")?"
"[[:space:]]*"
")*"
// the class name
"(\\<\\w*\\>)[[:space:]]*"
// template specialisation parameters
"(<[^;:{]+>)?[[:space:]]*"
// terminate in { or :
"(\\{|:[^;\\{()]*\\{)";
boost::regex expression(re);
class IndexClassesPred
{

View File

@ -32,7 +32,30 @@
typedef std::map<std::string, int, std::less<std::string> > map_type;
boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)");
const char* re =
// possibly leading whitespace:
"^[[:space:]]*"
// possible template declaration:
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
// class or struct:
"(class|struct)[[:space:]]*"
// leading declspec macros etc:
"("
"\\<\\w+\\>"
"("
"[[:blank:]]*\\([^)]*\\)"
")?"
"[[:space:]]*"
")*"
// the class name
"(\\<\\w*\\>)[[:space:]]*"
// template specialisation parameters
"(<[^;:{]+>)?[[:space:]]*"
// terminate in { or :
"(\\{|:[^;\\{()]*\\{)";
boost::regex expression(re);
map_type class_index;
std::string::const_iterator base;

View File

@ -33,6 +33,29 @@
typedef std::map<std::string, int, std::less<std::string> > map_type;
const char* re =
// possibly leading whitespace:
"^[[:space:]]*"
// possible template declaration:
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
// class or struct:
"(class|struct)[[:space:]]*"
// leading declspec macros etc:
"("
"\\<\\w+\\>"
"("
"[[:blank:]]*\\([^)]*\\)"
")?"
"[[:space:]]*"
")*"
// the class name
"(\\<\\w*\\>)[[:space:]]*"
// template specialisation parameters
"(<[^;:{]+>)?[[:space:]]*"
// terminate in { or :
"(\\{|:[^;\\{()]*\\{)";
class class_index
{
boost::regex expression;
@ -45,7 +68,7 @@ public:
void IndexClasses(const std::string& file);
class_index()
: index(),
expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)")
expression(re)
{}
};

View File

@ -21,6 +21,8 @@
* using a C++ Builder closure as a callback.
*/
#ifdef __BORLANDC__
#include <string>
#include <map>
#include <boost/regex.hpp>
@ -33,6 +35,29 @@
typedef std::map<std::string, int, std::less<std::string> > map_type;
const char* re =
// possibly leading whitespace:
"^[[:space:]]*"
// possible template declaration:
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
// class or struct:
"(class|struct)[[:space:]]*"
// leading declspec macros etc:
"("
"\\<\\w+\\>"
"("
"[[:blank:]]*\\([^)]*\\)"
")?"
"[[:space:]]*"
")*"
// the class name
"(\\<\\w*\\>)[[:space:]]*"
// template specialisation parameters
"(<[^;:{]+>)?[[:space:]]*"
// terminate in { or :
"(\\{|:[^;\\{()]*\\{)";
class class_index
{
boost::regex expression;
@ -47,7 +72,7 @@ public:
void IndexClasses(const std::string& file);
class_index()
: index(),
expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)")
expression(re)
{}
};
@ -117,5 +142,13 @@ int main(int argc, const char** argv)
return 0;
}
#else // __BORLANDC__
int main()
{
return 0;
};
#endif

View File

@ -68,30 +68,35 @@ istream& getline(istream& is, std::string& s)
}
#endif
int main()
int main(int argc)
{
std::string in, out;
while(true)
{
cout << "enter test string" << endl;
getline(cin, in);
if(in == "quit")
break;
int result;
result = process_ftp(in.c_str(), &out);
if(result != -1)
{
cout << "Match found:" << endl;
cout << "Response code: " << result << endl;
cout << "Message text: " << out << endl;
}
else
{
cout << "Match not found" << endl;
}
cout << endl;
}
return 0;
std::string in, out;
do
{
if(argc == 1)
{
cout << "enter test string" << endl;
getline(cin, in);
if(in == "quit")
break;
}
else
in = "100 this is an ftp message text";
int result;
result = process_ftp(in.c_str(), &out);
if(result != -1)
{
cout << "Match found:" << endl;
cout << "Response code: " << result << endl;
cout << "Message text: " << out << endl;
}
else
{
cout << "Match not found" << endl;
}
cout << endl;
} while(argc == 1);
return 0;
}

View File

@ -72,12 +72,12 @@ int main(int argc, const char** argv)
// strip '<' and '>' first by outputting to a
// temporary string stream
std::ostringstream t(std::ios::out | std::ios::binary);
std::ostream_iterator<char, char> oi(t);
std::ostream_iterator<char> oi(t);
boost::regex_merge(oi, in.begin(), in.end(), e2, pre_format);
// then output to final output stream
// adding syntax highlighting:
std::string s(t.str());
std::ostream_iterator<char, char> out(os);
std::ostream_iterator<char> out(os);
boost::regex_merge(out, s.begin(), s.end(), e1, format_string);
os << footer_text;
}

View File

@ -31,7 +31,30 @@
typedef std::map<std::string, int, std::less<std::string> > map_type;
boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)");
const char* re =
// possibly leading whitespace:
"^[[:space:]]*"
// possible template declaration:
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
// class or struct:
"(class|struct)[[:space:]]*"
// leading declspec macros etc:
"("
"\\<\\w+\\>"
"("
"[[:blank:]]*\\([^)]*\\)"
")?"
"[[:space:]]*"
")*"
// the class name
"(\\<\\w*\\>)[[:space:]]*"
// template specialisation parameters
"(<[^;:{]+>)?[[:space:]]*"
// terminate in { or :
"(\\{|:[^;\\{()]*\\{)";
boost::regex expression(re);
void IndexClasses(map_type& m, const std::string& file)
{

View File

@ -51,14 +51,19 @@ istream& getline(istream& is, std::string& s)
#endif
int main()
int main(int argc)
{
string s;
list<string> l;
do{
cout << "Enter text to split (or \"quit\" to exit): ";
getline(cin, s);
if(s == "quit") break;
if(argc == 1)
{
cout << "Enter text to split (or \"quit\" to exit): ";
getline(cin, s);
if(s == "quit") break;
}
else
s = "This is a string of tokens";
unsigned result = tokenise(l, s);
cout << result << " tokens found" << endl;
cout << "The remaining text is: \"" << s << "\"" << endl;
@ -68,6 +73,6 @@ int main()
l.pop_front();
cout << s << endl;
}
}while(true);
}while(argc == 1);
return 0;
}

View File

@ -52,7 +52,7 @@ int main(int argc, char** argv)
{
std::string s;
std::list<std::string> l;
int i;
int i;
for(i = 1; i < argc; ++i)
{
std::cout << "Findings URL's in " << argv[i] << ":" << std::endl;

View File

@ -0,0 +1,7 @@
abc
aaaaaaaaaaabcccccccc
quit
^([0-9]+)(\-| |$)(.*)$
100- this is a line of ftp response which contains a message string
quit
quit

View File

@ -15,19 +15,24 @@
#ifdef BOOST_RE_OLD_IOSTREAM
#include <iostream.h>
#include <fstream.h>
#else
#include <iostream>
#include <fstream>
using std::cout;
using std::cin;
using std::cerr;
using std::istream;
using std::ostream;
using std::endl;
using std::ifstream;
using std::streambuf;
#endif
#include <algorithm>
#include <string>
#include <deque>
#include <iterator>
#include <boost/config.hpp>
#include <boost/regex.hpp>
#include <boost/timer.hpp>
@ -54,8 +59,19 @@ ostream& operator << (ostream& os, const std::wstring& s)
#endif
template <class S>
class string_out_iterator
class string_out_iterator
#ifndef BOOST_NO_STD_ITERATOR
: public std::iterator<std::output_iterator_tag, void, void, void, void>
#endif // ndef BOOST_NO_STD_ITERATOR
{
#ifdef BOOST_NO_STD_ITERATOR
typedef std::output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
#endif // BOOST_NO_STD_ITERATOR
S* out;
public:
string_out_iterator(S& s) : out(&s) {}
@ -87,8 +103,21 @@ istream& getline(istream& is, std::string& s)
#endif
int main()
int main(int argc, char**argv)
{
ifstream ifs;
streambuf* pbuf = 0;
if(argc == 2)
{
ifs.open(argv[1]);
if(ifs.bad())
{
cout << "Bad filename: " << argv[1] << endl;
return -1;
}
pbuf = cin.rdbuf(ifs.rdbuf());
}
boost::regex ex;
boost::match_results<std::string::const_iterator> sm;
#ifndef BOOST_NO_WREGEX
@ -106,11 +135,14 @@ int main()
double tim;
bool result;
int iters = 100;
double wait_time = std::min(t.elapsed_min() * 1000, 1.0);
while(true)
{
cout << "Enter expression (or \"quit\" to exit): ";
getline(cin, s1);
if(argc == 2)
cout << endl << s1 << endl;
if(s1 == "quit")
break;
#ifndef BOOST_NO_WREGEX
@ -143,6 +175,8 @@ int main()
{
cout << "Enter string to search (or \"quit\" to exit): ";
getline(cin, s2);
if(argc == 2)
cout << endl << s2 << endl;
if(s2 == "quit")
break;
@ -175,7 +209,7 @@ int main()
result = regex_search(s2, sm, ex);
}
tim = t.elapsed();
}while((tim < t.elapsed_min() * 1000) || (tim < 1));
}while(tim < wait_time);
cout << "regex time: " << (tim * 1000000 / iters) << "us" << endl;
if(result)
@ -209,7 +243,7 @@ int main()
result = regex_search(ws2, wsm, wex);
}
tim = t.elapsed();
}while((tim < t.elapsed_min() * 1000) || (tim < 1));
}while(tim < wait_time);
cout << "wregex time: " << (tim * 1000000 / iters) << "us" << endl;
if(result)
{
@ -247,7 +281,7 @@ int main()
result = regex_search(ds.begin(), ds.end(), dm, ex);
}
tim = t.elapsed();
}while((tim < t.elapsed_min() * 1000) || (tim < 1));
}while(tim < wait_time);
cout << "regex time (search over std::deque<char>): " << (tim * 1000000 / iters) << "us" << endl;
if(result)
@ -284,7 +318,7 @@ int main()
result = regexec(&r, s2.c_str(), nsubs, matches.get(), 0);
}
tim = t.elapsed();
}while((tim < t.elapsed_min() * 1000) || (tim < 1));
}while(tim < wait_time);
cout << "POSIX regexec time: " << (tim * 1000000 / iters) << "us" << endl;
if(result == 0)
@ -313,6 +347,10 @@ int main()
}
regfree(&r);
}
if(pbuf)
cin.rdbuf(pbuf);
return 0;
}

View File

@ -19,8 +19,6 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
alt="C++ Boost" width="276" height="86"></h3>
</td>
<td valign="top"><h3 align="center">Regex++, FAQ.</h3>
<p align="left"><i>(Version 3.20, 29th Sept 2001)</i>&nbsp;
</p>
<p align="left"><i>Copyright (c) 1998-2001 </i></p>
<p align="left"><i>Dr John Maddock</i></p>
<p align="left"><i>Permission to use, copy, modify,

View File

@ -20,8 +20,6 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
</td>
<td valign="top"><h3 align="center">Regex++, Format
String Reference.</h3>
<p align="left"><i>(Version 3.20, 29th Sept 2001)</i>&nbsp;
</p>
<p align="left"><i>Copyright (c) 1998-2001 </i></p>
<p align="left"><i>Dr John Maddock</i></p>
<p align="left"><i>Permission to use, copy, modify,

View File

@ -20,8 +20,6 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
</td>
<td valign="top"><h3 align="center">Regex++, RegEx Class
Reference. </h3>
<p align="left"><i>(Version 3.20, 29th Sept 2001)</i>&nbsp;
</p>
<p align="left"><i>Copyright (c) 1998-2001 </i></p>
<p align="left"><i>Dr John Maddock</i></p>
<p align="left"><i>Permission to use, copy, modify,
@ -94,10 +92,13 @@ are allowed. </p>
</i>&nbsp;&nbsp; <i>//
</i></font>&nbsp;&nbsp; <b>unsigned</b> <b>int</b> Position(<b>int</b> i = 0)<b>const</b>;
&nbsp;&nbsp; <b>unsigned</b> <b>int</b> Length(<b>int</b> i = 0)<b>const</b>;
<strong>bool</strong> Matched(<strong>int</strong> i = 0)<strong>const</strong>;
&nbsp;&nbsp; <b>unsigned</b> <b>int</b> Line()<b>const</b>;
&nbsp;&nbsp; <b>unsigned int</b> Marks() const;
&nbsp;&nbsp; std::string What(<b>int</b> i)<b>const</b>;
&nbsp;&nbsp; std::string <b>operator</b>[](<b>int</b> i)<b>const</b> ;
<strong>static const unsigned int</strong> npos;
}; &nbsp; &nbsp; </pre>
<p>Member functions for class RegEx are defined as follows: <br>
@ -497,8 +498,8 @@ are allowed. </p>
Position(<b>int</b> i = 0)<b>const</b>;</td>
<td valign="top" width="42%">Returns the position of what
matched sub-expression <i>i</i>. If <i>i = 0</i> then
returns the position of the whole match. Returns -1 if
the supplied index is invalid, or if the specified sub-expression
returns the position of the whole match. Returns RegEx::npos
if the supplied index is invalid, or if the specified sub-expression
did not participate in the match.</td>
<td valign="top" width="7%">&nbsp;</td>
</tr>
@ -508,18 +509,26 @@ are allowed. </p>
Length(<b>int</b> i = 0)<b>const</b>;</td>
<td valign="top" width="42%">Returns the length of what
matched sub-expression <i>i</i>. If <i>i = 0</i> then
returns the length of the whole match. Returns -1 if the
supplied index is invalid, or if the specified sub-expression
returns the length of the whole match. Returns RegEx::npos
if the supplied index is invalid, or if the specified sub-expression
did not participate in the match.</td>
<td valign="top" width="7%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><strong>bool</strong> Matched(<strong>int</strong> i
= 0)<strong>const</strong>;</td>
<td>Returns true if sub-expression <em>i</em> was
matched, false otherwise.</td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign="top" width="7%">&nbsp;</td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
Line()<b>const</b>;</td>
<td valign="top" width="42%">Returns the line on which
the match occurred, indexes start from 1 not zero, if no
match occurred then returns (unsigned)-1.</td>
match occurred then returns RegEx::npos.</td>
<td valign="top" width="7%">&nbsp;</td>
</tr>
<tr>

View File

@ -271,11 +271,14 @@ public:
//
unsigned int Position(int i = 0)const;
unsigned int Length(int i = 0)const;
bool Matched(int i = 0)const;
unsigned int Line()const;
unsigned int Marks()const;
std::string What(int i = 0)const;
std::string operator[](int i)const { return What(i); }
static const unsigned int npos;
friend struct re_detail::pred1;
friend struct re_detail::pred2;
friend struct re_detail::pred3;

View File

@ -47,6 +47,7 @@
#include <boost/regex/pattern_except.hpp>
#include <boost/regex/regex_traits.hpp>
#include <boost/type_traits/cv_traits.hpp>
#include <boost/scoped_array.hpp>
namespace boost{
@ -216,7 +217,7 @@ struct re_syntax_base
// marks start or end of (...)
struct re_brace : public re_syntax_base
{
unsigned int index;
int index;
};
//
@ -890,7 +891,7 @@ protected:
// protected contructor for derived class...
match_results_base(bool){}
void BOOST_REGEX_CALL free();
void BOOST_REGEX_CALL m_free();
public:
@ -906,7 +907,7 @@ public:
~match_results_base()
{
free();
m_free();
}
size_type BOOST_REGEX_CALL size()const
@ -1096,7 +1097,7 @@ inline match_results_base<iterator, Allocator>& BOOST_REGEX_CALL match_results_b
{
if(ref != m.ref)
{
free();
m_free();
ref = m.ref;
++(ref->count);
}
@ -1105,7 +1106,7 @@ inline match_results_base<iterator, Allocator>& BOOST_REGEX_CALL match_results_b
template <class iterator, class Allocator>
void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::free()
void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::m_free()
{
if(--(ref->count) == 0)
{
@ -1162,7 +1163,7 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_size(size_typ
new (p1) sub_match<iterator>();
++p1;
}
free();
m_free();
}
catch(...)
{
@ -1204,7 +1205,7 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_size(size_typ
new (p1) sub_match<iterator>(j);
++p1;
}
free();
m_free();
}
catch(...)
{
@ -1462,7 +1463,7 @@ namespace re_detail{
template <class iterator, class charT, class traits_type, class Allocator>
iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
iterator last,
re_set_long* set_,
const re_set_long* set_,
const reg_expression<charT, traits_type, Allocator>& e);
} // namepsace re_detail

View File

@ -48,7 +48,6 @@
# include <stdexcept>
# include <iterator>
# include <boost/config.hpp>
# include <boost/smart_ptr.hpp>
# include <boost/cstdint.hpp>
# include <boost/detail/allocator.hpp>
#else
@ -270,7 +269,7 @@ using std::distance;
# define BOOST_REGEX_USE_C_LOCALE
#endif
#ifdef BOOST_REGEX_USE_WIN32_LOCALE
#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
# include <windows.h>
#endif

View File

@ -47,10 +47,10 @@ struct kmp_translator
template <class charT, class traits_type, class Allocator>
bool BOOST_REGEX_CALL re_maybe_set_member(charT c,
re_set_long* set_,
const re_set_long* set_,
const reg_expression<charT, traits_type, Allocator>& e)
{
const charT* p = (const charT*)(set_+1);
const charT* p = reinterpret_cast<const charT*>(set_+1);
bool icase = e.flags() & regbase::icase;
charT col = e.get_traits().translate(c, icase);
for(unsigned int i = 0; i < set_->csingles; ++i)
@ -130,7 +130,7 @@ reg_expression<charT, traits, Allocator>::reg_expression(const reg_expression<ch
}
else
{
_flags = regbase::use_except;
_flags = e.flags() & ~(regbase::use_except);
fail(e.error_code());
}
}
@ -410,7 +410,7 @@ charT BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::parse_escape(co
template <class charT, class traits, class Allocator>
void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_maps()
{
re_detail::re_syntax_base* record = (re_detail::re_syntax_base*)data.data();
re_detail::re_syntax_base* record = static_cast<re_detail::re_syntax_base*>(data.data());
// always compile the first _map:
std::memset(startmap, 0, 256);
record->can_be_null = 0;
@ -420,10 +420,10 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_maps()
{
if((record->type == re_detail::syntax_element_alt) || (record->type == re_detail::syntax_element_rep))
{
std::memset(&(((re_detail::re_jump*)record)->_map), 0, 256);
std::memset(&(static_cast<re_detail::re_jump*>(record)->_map), 0, 256);
record->can_be_null = 0;
compile_map(record->next.p, ((re_detail::re_jump*)record)->_map, &(record->can_be_null), re_detail::mask_take, ((re_detail::re_jump*)record)->alt.p);
compile_map(((re_detail::re_jump*)record)->alt.p, ((re_detail::re_jump*)record)->_map, &(record->can_be_null), re_detail::mask_skip);
compile_map(record->next.p, static_cast<re_detail::re_jump*>(record)->_map, &(record->can_be_null), re_detail::mask_take, static_cast<re_detail::re_jump*>(record)->alt.p);
compile_map(static_cast<re_detail::re_jump*>(record)->alt.p, static_cast<re_detail::re_jump*>(record)->_map, &(record->can_be_null), re_detail::mask_skip);
}
else
{
@ -444,6 +444,12 @@ bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::probe_start(
switch(node->type)
{
case re_detail::syntax_element_startmark:
if(static_cast<const re_detail::re_brace*>(node)->index == -1)
{
return probe_start(node->next.p->next.p, cc, terminal)
&& probe_start(static_cast<const re_detail::re_jump*>(node->next.p)->alt.p, cc, terminal);
}
// fall through:
case re_detail::syntax_element_endmark:
case re_detail::syntax_element_start_line:
case re_detail::syntax_element_word_boundary:
@ -454,7 +460,7 @@ bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::probe_start(
case re_detail::syntax_element_literal:
// only the first character of the literal can match:
// note these have already been translated:
if(*(charT*)(((re_detail::re_literal*)node)+1) == traits_inst.translate(cc, (_flags & regbase::icase)))
if(*reinterpret_cast<charT*>(static_cast<re_detail::re_literal*>(node)+1) == traits_inst.translate(cc, (_flags & regbase::icase)))
return true;
return false;
case re_detail::syntax_element_end_line:
@ -493,13 +499,13 @@ bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::probe_start(
// we can not be null,
// we need to add already translated values in the set
// to values in the _map
return re_detail::re_maybe_set_member(cc, (re_detail::re_set_long*)node, *this) || (re_detail::re_is_set_member((const charT*)&cc, (const charT*)(&cc+1), (re_detail::re_set_long*)node, *this) != &cc);
return re_detail::re_maybe_set_member(cc, static_cast<const re_detail::re_set_long*>(node), *this) || (re_detail::re_is_set_member(static_cast<const charT*>(&cc), static_cast<const charT*>(&cc+1), static_cast<re_detail::re_set_long*>(node), *this) != &cc);
case re_detail::syntax_element_set:
// set all the elements that are set in corresponding set:
c = (traits_size_type)(traits_uchar_type)traits_inst.translate(cc, (_flags & regbase::icase));
return ((re_detail::re_set*)node)->_map[c] != 0;
return static_cast<re_detail::re_set*>(node)->_map[c] != 0;
case re_detail::syntax_element_jump:
if(((re_detail::re_jump*)node)->alt.p < node)
if(static_cast<re_detail::re_jump*>(node)->alt.p < node)
{
// backwards jump,
// caused only by end of repeat section, we'll treat this
@ -513,27 +519,27 @@ bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::probe_start(
// repeat that we're jumping to has non-zero minimum count
// then we need to add in the possiblity that we could still
// skip that repeat.
re_detail::re_syntax_base* next = ((re_detail::re_jump*)node)->alt.p;
re_detail::re_syntax_base* next = static_cast<re_detail::re_jump*>(node)->alt.p;
bool b = probe_start(next, cc, terminal);
if((next->type == re_detail::syntax_element_rep) && (((re_detail::re_repeat*)next)->min != 0))
if((next->type == re_detail::syntax_element_rep) && (static_cast<re_detail::re_repeat*>(next)->min != 0))
{
b = b || probe_start(((re_detail::re_jump*)next)->alt.p, cc, terminal);
b = b || probe_start(static_cast<re_detail::re_jump*>(next)->alt.p, cc, terminal);
}
return b;
}
}
else
// take the jump and compile:
return probe_start(((re_detail::re_jump*)node)->alt.p, cc, terminal);
return probe_start(static_cast<re_detail::re_jump*>(node)->alt.p, cc, terminal);
case re_detail::syntax_element_alt:
// we need to take the OR of the two alternatives:
return probe_start(((re_detail::re_jump*)node)->alt.p, cc, terminal) || probe_start(node->next.p, cc, terminal);
return probe_start(static_cast<re_detail::re_jump*>(node)->alt.p, cc, terminal) || probe_start(node->next.p, cc, terminal);
case re_detail::syntax_element_rep:
// we need to take the OR of the two alternatives
if(((re_detail::re_repeat*)node)->min == 0)
return probe_start(node->next.p, cc, ((re_detail::re_jump*)node)->alt.p) || probe_start(((re_detail::re_jump*)node)->alt.p, cc, terminal);
if(static_cast<re_detail::re_repeat*>(node)->min == 0)
return probe_start(node->next.p, cc, static_cast<re_detail::re_jump*>(node)->alt.p) || probe_start(static_cast<re_detail::re_jump*>(node)->alt.p, cc, terminal);
else
return probe_start(node->next.p, cc, ((re_detail::re_jump*)node)->alt.p);
return probe_start(node->next.p, cc, static_cast<re_detail::re_jump*>(node)->alt.p);
case re_detail::syntax_element_combining:
return !traits_inst.is_combining(traits_inst.translate(cc, (_flags & regbase::icase)));
}
@ -561,7 +567,7 @@ bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::probe_start_null
case re_detail::syntax_element_backref:
return true;
case re_detail::syntax_element_jump:
if(((re_detail::re_jump*)node)->alt.p < node)
if(static_cast<re_detail::re_jump*>(node)->alt.p < node)
{
// backwards jump,
// caused only by end of repeat section, we'll treat this
@ -572,17 +578,17 @@ bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::probe_start_null
if(node->next.p == terminal)
return true;
else
return probe_start_null(((re_detail::re_jump*)node)->alt.p, terminal);
return probe_start_null(static_cast<re_detail::re_jump*>(node)->alt.p, terminal);
}
else
// take the jump and compile:
return probe_start_null(((re_detail::re_jump*)node)->alt.p, terminal);
return probe_start_null(static_cast<re_detail::re_jump*>(node)->alt.p, terminal);
case re_detail::syntax_element_alt:
// we need to take the OR of the two alternatives:
return probe_start_null(((re_detail::re_jump*)node)->alt.p, terminal) || probe_start_null(node->next.p, terminal);
return probe_start_null(static_cast<re_detail::re_jump*>(node)->alt.p, terminal) || probe_start_null(node->next.p, terminal);
case re_detail::syntax_element_rep:
// only need to consider skipping the repeat:
return probe_start_null(((re_detail::re_jump*)node)->alt.p, terminal);
return probe_start_null(static_cast<re_detail::re_jump*>(node)->alt.p, terminal);
default:
break;
}
@ -611,18 +617,18 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::move_offsets(re_
{
// move all offsets starting with j->link forward by size
// called after an insert:
j = (re_detail::re_syntax_base*)((const char*)data.data() + j->next.i);
j = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + j->next.i);
while(true)
{
switch(j->type)
{
case re_detail::syntax_element_rep:
((re_detail::re_jump*)j)->alt.i += size;
static_cast<re_detail::re_jump*>(j)->alt.i += size;
j->next.i += size;
break;
case re_detail::syntax_element_jump:
case re_detail::syntax_element_alt:
((re_detail::re_jump*)j)->alt.i += size;
static_cast<re_detail::re_jump*>(j)->alt.i += size;
j->next.i += size;
break;
default:
@ -631,7 +637,7 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::move_offsets(re_
}
if(j->next.i == size)
break;
j = (re_detail::re_syntax_base*)((const char*)data.data() + j->next.i);
j = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + j->next.i);
}
}
@ -984,7 +990,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
++csingles;
const traits_string_type& s = singles.peek();
unsigned len = (s.size() + 1) * sizeof(charT);
std::memcpy((charT*)data.extend(len), s.c_str(), len);
std::memcpy(reinterpret_cast<charT*>(data.extend(len)), s.c_str(), len);
singles.pop();
}
while(ranges.empty() == false)
@ -1032,11 +1038,11 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
++cequivalents;
const traits_string_type& s = equivalents.peek();
unsigned len = (re_detail::re_strlen(s.c_str()) + 1) * sizeof(charT);
std::memcpy((charT*)data.extend(len), s.c_str(), len);
std::memcpy(reinterpret_cast<charT*>(data.extend(len)), s.c_str(), len);
equivalents.pop();
}
re_detail::re_set_long* dat = (re_detail::re_set_long*)((unsigned char*)data.data() + base);
re_detail::re_set_long* dat = reinterpret_cast<re_detail::re_set_long*>(reinterpret_cast<unsigned char*>(data.data()) + base);
dat->type = re_detail::syntax_element_long_set;
dat->csingles = csingles;
dat->cranges = cranges;
@ -1050,7 +1056,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
template <class charT, class traits, class Allocator>
re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_set_aux(re_detail::jstack<traits_string_type, Allocator>& singles, re_detail::jstack<traits_string_type, Allocator>& ranges, re_detail::jstack<boost::uint_fast32_t, Allocator>& classes, re_detail::jstack<traits_string_type, Allocator>& equivalents, bool isnot, const re_detail::_narrow_type&)
{
re_detail::re_set* dat = (re_detail::re_set*)data.extend(sizeof(re_detail::re_set));
re_detail::re_set* dat = reinterpret_cast<re_detail::re_set*>(data.extend(sizeof(re_detail::re_set)));
std::memset(dat, 0, sizeof(re_detail::re_set));
while(singles.empty() == false)
@ -1148,7 +1154,7 @@ inline
#endif
re_detail::re_syntax_base* add_offset(void* base, std::ptrdiff_t off)
{
return (re_detail::re_syntax_base*)((char*)base + off);
return reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(base) + off);
}
@ -1157,7 +1163,7 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_apply(re_d
{
typedef typename boost::detail::rebind_allocator<bool, Allocator>::type b_alloc;
register unsigned char* base = (unsigned char*)b;
register unsigned char* base = reinterpret_cast<unsigned char*>(b);
register re_detail::re_syntax_base* ptr = b;
bool* pb = 0;
b_alloc a(data.allocator());
@ -1174,30 +1180,32 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_apply(re_d
switch(ptr->type)
{
case re_detail::syntax_element_rep:
((re_detail::re_jump*)ptr)->alt.p = add_offset(base, ((re_detail::re_jump*)ptr)->alt.i);
jm_assert(data.size() > static_cast<re_detail::re_jump*>(ptr)->alt.i);
static_cast<re_detail::re_jump*>(ptr)->alt.p = add_offset(base, static_cast<re_detail::re_jump*>(ptr)->alt.i);
#ifdef BOOST_REGEX_DEBUG
if((re_detail::padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p) && (((re_detail::re_jump*)ptr)->alt.p != b))
if((re_detail::padding_mask & reinterpret_cast<int>(static_cast<re_detail::re_jump*>(ptr)->alt.p)) && (static_cast<re_detail::re_jump*>(ptr)->alt.p != b))
{
jm_trace("padding mis-aligment in repeat jump to object type: " << ((re_detail::re_jump*)ptr)->alt.p->type)
jm_trace("padding mis-aligment in repeat jump to object type: " << static_cast<re_detail::re_jump*>(ptr)->alt.p->type)
//jm_assert(0 == (padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p));
}
#endif
((re_detail::re_repeat*)ptr)->id = repeats;
static_cast<re_detail::re_repeat*>(ptr)->id = repeats;
++repeats;
goto rebase;
case re_detail::syntax_element_jump:
case re_detail::syntax_element_alt:
((re_detail::re_jump*)ptr)->alt.p = add_offset(base, ((re_detail::re_jump*)ptr)->alt.i);
jm_assert(data.size() > static_cast<re_detail::re_jump*>(ptr)->alt.i);
static_cast<re_detail::re_jump*>(ptr)->alt.p = add_offset(base, static_cast<re_detail::re_jump*>(ptr)->alt.i);
#ifdef BOOST_REGEX_DEBUG
if((re_detail::padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p) && (((re_detail::re_jump*)ptr)->alt.p != b))
if((re_detail::padding_mask & reinterpret_cast<int>(static_cast<re_detail::re_jump*>(ptr)->alt.p) && (static_cast<re_detail::re_jump*>(ptr)->alt.p != b)))
{
jm_trace("padding mis-aligment in alternation jump to object type: " << ((re_detail::re_jump*)ptr)->alt.p->type)
jm_trace("padding mis-aligment in alternation jump to object type: " << static_cast<re_detail::re_jump*>(ptr)->alt.p->type)
//jm_assert(0 == (padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p));
}
#endif
goto rebase;
case re_detail::syntax_element_backref:
if((((re_detail::re_brace*)ptr)->index >= cbraces) || (pb[((re_detail::re_brace*)ptr)->index] == false) )
if((static_cast<re_detail::re_brace*>(ptr)->index >= (int)cbraces) || (pb[static_cast<re_detail::re_brace*>(ptr)->index] == false) )
{
fail(REG_ESUBREG);
a.deallocate(pb, cbraces);
@ -1205,13 +1213,15 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_apply(re_d
}
goto rebase;
case re_detail::syntax_element_endmark:
pb[((re_detail::re_brace*)ptr)->index] = true;
if(static_cast<re_detail::re_brace*>(ptr)->index > 0)
pb[static_cast<re_detail::re_brace*>(ptr)->index] = true;
goto rebase;
default:
rebase:
jm_assert(data.size() > ptr->next.i);
ptr->next.p = add_offset(base, ptr->next.i);
#ifdef BOOST_REGEX_DEBUG
if((re_detail::padding_mask & (int)(ptr->next.p)) && (((re_detail::re_jump*)ptr)->alt.p != b))
if((re_detail::padding_mask & (int)(ptr->next.p)) && (static_cast<re_detail::re_jump*>(ptr)->alt.p != b))
{
jm_trace("padding mis-alignment in next record of type " << ptr->next.p->type)
jm_assert(0 == (re_detail::padding_mask & (int)(ptr->next.p)));
@ -1258,7 +1268,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
const charT* ptr = p;
marks = 0;
re_detail::jstack<unsigned int, Allocator> mark(64, data.allocator());
re_detail::jstack<unsigned int, Allocator> markid(64, data.allocator());
re_detail::jstack<int, Allocator> markid(64, data.allocator());
unsigned int last_mark_popped = 0;
register traits_size_type c;
register re_detail::re_syntax_base* dat;
@ -1300,7 +1310,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
// extend:
dat = add_simple(dat, re_detail::syntax_element_startmark, sizeof(re_detail::re_brace));
markid.push(marks);
((re_detail::re_brace*)dat)->index = marks++;
static_cast<re_detail::re_brace*>(dat)->index = marks++;
mark.push(data.index(dat));
++ptr;
//
@ -1316,15 +1326,37 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
switch(syntax)
{
case traits_type::syntax_colon:
((re_detail::re_brace*)dat)->index = 0;
static_cast<re_detail::re_brace*>(dat)->index = 0;
--marks;
markid.pop();
markid.push(0);
++ptr;
continue;
case traits_type::syntax_equal:
static_cast<re_detail::re_brace*>(dat)->index = -1;
markid.pop();
markid.push(-1);
common_forward_assert:
--marks;
++ptr;
// extend:
dat = add_simple(dat, re_detail::syntax_element_jump, re_detail::re_jump_size);
data.align();
//
// we don't know what value to put here yet,
// use an arbitrarily large value for now
// and check it later:
static_cast<re_detail::re_jump*>(dat)->alt.i = INT_MAX/2;
mark.push(data.size() - re_detail::re_jump_size);
continue;
case traits_type::syntax_not:
static_cast<re_detail::re_brace*>(dat)->index = -2;
markid.pop();
markid.push(-2);
goto common_forward_assert;
case traits_type::syntax_hash:
// comment just skip it:
((re_detail::re_brace*)dat)->index = 0;
static_cast<re_detail::re_brace*>(dat)->index = 0;
--marks;
markid.pop();
mark.pop();
@ -1365,7 +1397,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
// see if we have an empty alternative:
if(mark.peek() == data.index(dat) )
{
re_detail::re_syntax_base* para = (re_detail::re_syntax_base*)((char*)data.data() + mark.peek());
re_detail::re_syntax_base* para = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + mark.peek());
if(para->type == re_detail::syntax_element_jump)
{
fail(REG_EMPTY);
@ -1374,21 +1406,21 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
}
// pop any pushed alternatives and set the target end destination:
dat = (re_detail::re_syntax_base*)((unsigned char*)data.data() + mark.peek());
dat = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<unsigned char*>(data.data()) + mark.peek());
while(dat->type == re_detail::syntax_element_jump)
{
((re_detail::re_jump*)dat)->alt.i = data.size();
static_cast<re_detail::re_jump*>(dat)->alt.i = data.size();
mark.pop();
if(mark.empty())
{
fail(REG_EPAREN);
return error_code();
}
dat = (re_detail::re_jump*)((unsigned char*)data.data() + mark.peek());
dat = reinterpret_cast<re_detail::re_jump*>(reinterpret_cast<unsigned char*>(data.data()) + mark.peek());
}
dat = add_simple(0, re_detail::syntax_element_endmark, sizeof(re_detail::re_brace));
((re_detail::re_brace*)dat)->index = markid.peek();
static_cast<re_detail::re_brace*>(dat)->index = markid.peek();
markid.pop();
last_mark_popped = mark.peek();
mark.pop();
@ -1461,7 +1493,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
break;
}
dat = add_simple(dat, re_detail::syntax_element_backref, sizeof(re_detail::re_brace));
((re_detail::re_brace*)dat)->index = i;
static_cast<re_detail::re_brace*>(dat)->index = i;
++ptr;
continue;
}
@ -1610,16 +1642,16 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
offset = last_mark_popped;
break;
case re_detail::syntax_element_literal:
if(((re_detail::re_literal*)dat)->length > 1)
if(static_cast<re_detail::re_literal*>(dat)->length > 1)
{
// update previous:
charT lit = *(charT*)((char*)dat + sizeof(re_detail::re_literal) + ((((re_detail::re_literal*)dat)->length-1)*sizeof(charT)));
--((re_detail::re_literal*)dat)->length;
charT lit = *reinterpret_cast<charT*>(reinterpret_cast<char*>(dat) + sizeof(re_detail::re_literal) + ((static_cast<re_detail::re_literal*>(dat)->length-1)*sizeof(charT)));
--static_cast<re_detail::re_literal*>(dat)->length;
dat = add_simple(dat, re_detail::syntax_element_literal, sizeof(re_detail::re_literal) + sizeof(charT));
((re_detail::re_literal*)dat)->length = 1;
*((charT*)(((re_detail::re_literal*)dat)+1)) = lit;
static_cast<re_detail::re_literal*>(dat)->length = 1;
*reinterpret_cast<charT*>(static_cast<re_detail::re_literal*>(dat)+1) = lit;
}
offset = (char*)dat - (char*)data.data();
offset = reinterpret_cast<char*>(dat) - reinterpret_cast<char*>(data.data());
break;
case re_detail::syntax_element_backref:
case re_detail::syntax_element_long_set:
@ -1627,7 +1659,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
case re_detail::syntax_element_wild:
case re_detail::syntax_element_combining:
// we're repeating a single item:
offset = (char*)dat - (char*)data.data();
offset = reinterpret_cast<char*>(dat) - reinterpret_cast<char*>(data.data());
break;
default:
fail(REG_BADRPT);
@ -1639,17 +1671,17 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
// add the trailing jump:
dat = add_simple(dat, re_detail::syntax_element_jump, re_detail::re_jump_size);
((re_detail::re_jump*)dat)->alt.i = 0;
static_cast<re_detail::re_jump*>(dat)->alt.i = 0;
// now insert the leading repeater:
dat = (re_detail::re_syntax_base*)data.insert(offset, re_detail::re_repeater_size);
dat->next.i = ((char*)dat - (char*)data.data()) + re_detail::re_repeater_size;
dat = static_cast<re_detail::re_syntax_base*>(data.insert(offset, re_detail::re_repeater_size));
dat->next.i = (reinterpret_cast<char*>(dat) - reinterpret_cast<char*>(data.data())) + re_detail::re_repeater_size;
dat->type = re_detail::syntax_element_rep;
((re_detail::re_repeat*)dat)->alt.i = data.size();
((re_detail::re_repeat*)dat)->min = rep_min;
((re_detail::re_repeat*)dat)->max = rep_max;
((re_detail::re_repeat*)dat)->leading = false;
((re_detail::re_repeat*)dat)->greedy = true;
static_cast<re_detail::re_repeat*>(dat)->alt.i = data.size();
static_cast<re_detail::re_repeat*>(dat)->min = rep_min;
static_cast<re_detail::re_repeat*>(dat)->max = rep_max;
static_cast<re_detail::re_repeat*>(dat)->leading = false;
static_cast<re_detail::re_repeat*>(dat)->greedy = true;
move_offsets(dat, re_detail::re_repeater_size);
++ptr;
//
@ -1660,12 +1692,12 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
if(traits_type::syntax_question == traits_inst.syntax_type(c))
{
// OK repeat is non-greedy:
((re_detail::re_repeat*)dat)->greedy = false;
static_cast<re_detail::re_repeat*>(dat)->greedy = false;
++ptr;
}
}
dat = (re_detail::re_syntax_base*)((char*)data.data() + data.size() - re_detail::re_jump_size);
((re_detail::re_repeat*)dat)->alt.i = offset;
dat = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + data.size() - re_detail::re_jump_size);
static_cast<re_detail::re_repeat*>(dat)->alt.i = offset;
continue;
}
case traits_type::syntax_plus:
@ -1736,7 +1768,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
// we don't know what value to put here yet,
// use an arbitrarily large value for now
// and check it later (TODO!)
((re_detail::re_jump*)dat)->alt.i = INT_MAX/2;
static_cast<re_detail::re_jump*>(dat)->alt.i = INT_MAX/2;
// now work out where to insert:
unsigned int offset = 0;
@ -1744,15 +1776,15 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
{
// we have a '(' or '|' to go back to:
offset = mark.peek();
re_detail::re_syntax_base* base = (re_detail::re_syntax_base*)((unsigned char*)data.data() + offset);
re_detail::re_syntax_base* base = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<unsigned char*>(data.data()) + offset);
offset = base->next.i;
}
re_detail::re_jump* j = (re_detail::re_jump*)data.insert(offset, re_detail::re_jump_size);
re_detail::re_jump* j = static_cast<re_detail::re_jump*>(data.insert(offset, re_detail::re_jump_size));
j->type = re_detail::syntax_element_alt;
j->next.i = offset + re_detail::re_jump_size;
j->alt.i = data.size();
move_offsets(j, re_detail::re_jump_size);
dat = (re_detail::re_syntax_base*)((unsigned char*)data.data() + data.size() - re_detail::re_jump_size);
dat = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<unsigned char*>(data.data()) + data.size() - re_detail::re_jump_size);
mark.push(data.size() - re_detail::re_jump_size);
++ptr;
break;
@ -1801,7 +1833,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
if(mark.empty() == false)
if(mark.peek() == data.index(dat) )
{
re_detail::re_syntax_base* para = (re_detail::re_syntax_base*)((char*)data.data() + mark.peek());
re_detail::re_syntax_base* para = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + mark.peek());
if(para->type == re_detail::syntax_element_jump)
{
fail(REG_EMPTY);
@ -1814,18 +1846,18 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
if(mark.empty() == false)
{
// pop any pushed alternatives and set the target end destination:
dat = (re_detail::re_syntax_base*)((unsigned char*)data.data() + mark.peek());
dat = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<unsigned char*>(data.data()) + mark.peek());
while(dat->type == re_detail::syntax_element_jump)
{
((re_detail::re_jump*)dat)->alt.i = data.size();
static_cast<re_detail::re_jump*>(dat)->alt.i = data.size();
mark.pop();
if(mark.empty() == true)
break;
dat = (re_detail::re_jump*)((unsigned char*)data.data() + mark.peek());
dat = reinterpret_cast<re_detail::re_jump*>(reinterpret_cast<unsigned char*>(data.data()) + mark.peek());
}
}
dat = (re_detail::re_brace*)data.extend(sizeof(re_detail::re_syntax_base));
dat = static_cast<re_detail::re_brace*>(data.extend(sizeof(re_detail::re_syntax_base)));
dat->type = re_detail::syntax_element_match;
dat->next.i = 0;
@ -1837,10 +1869,10 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
//
// allocate space for start _map:
startmap = (unsigned char*)data.extend(256 + ((end - base + 1) * sizeof(charT)));
startmap = reinterpret_cast<unsigned char*>(data.extend(256 + ((end - base + 1) * sizeof(charT))));
//
// and copy the expression we just compiled:
_expression = (charT*)((const char*)startmap + 256);
_expression = reinterpret_cast<charT*>(reinterpret_cast<char*>(startmap) + 256);
_expression_len = end - base;
std::memcpy(_expression, base, _expression_len * sizeof(charT));
*(_expression + _expression_len) = charT(0);
@ -1848,7 +1880,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
//
// now we need to apply fixups to the array
// so that we can use pointers and not indexes
fixup_apply((re_detail::re_syntax_base*)data.data(), marks);
fixup_apply(static_cast<re_detail::re_syntax_base*>(data.data()), marks);
// check for error during fixup:
if(_flags & regbase::failbit)
@ -1863,7 +1895,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
re_detail::kmp_free(pkmp, data.allocator());
pkmp = 0;
}
re_detail::re_syntax_base* sbase = (re_detail::re_syntax_base*)data.data();
re_detail::re_syntax_base* sbase = static_cast<re_detail::re_syntax_base*>(data.data());
_restart_type = probe_restart(sbase);
_leading_len = fixup_leading_rep(sbase, 0);
if((sbase->type == re_detail::syntax_element_literal) && (sbase->next.p->type == re_detail::syntax_element_match))
@ -1871,8 +1903,8 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
_restart_type = restart_fixed_lit;
if(0 == pkmp)
{
charT* p1 = (charT*)((char*)sbase + sizeof(re_detail::re_literal));
charT* p2 = p1 + ((re_detail::re_literal*)sbase)->length;
charT* p1 = reinterpret_cast<charT*>(reinterpret_cast<char*>(sbase) + sizeof(re_detail::re_literal));
charT* p2 = p1 + static_cast<re_detail::re_literal*>(sbase)->length;
pkmp = re_detail::kmp_compile(p1, p2, charT(), re_detail::kmp_translator<traits>(_flags&regbase::icase, &traits_inst), data.allocator());
}
}
@ -1892,7 +1924,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
}
if(size < sizeof(re_detail::re_syntax_base))
size = sizeof(re_detail::re_syntax_base);
dat = (re_detail::re_syntax_base*)data.extend(size);
dat = static_cast<re_detail::re_syntax_base*>(data.extend(size));
dat->type = type;
dat->next.i = 0;
return dat;
@ -1904,17 +1936,17 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
if(dat && (dat->type == re_detail::syntax_element_literal))
{
// add another charT to the list:
std::ptrdiff_t pos = (unsigned char*)dat - (unsigned char*)data.data();
*(charT*)data.extend(sizeof(charT)) = traits_inst.translate(c, (_flags & regbase::icase));
dat = (re_detail::re_syntax_base*)((unsigned char*)data.data() + pos);
++(((re_detail::re_literal*)dat)->length);
std::ptrdiff_t pos = reinterpret_cast<unsigned char*>(dat) - reinterpret_cast<unsigned char*>(data.data());
*reinterpret_cast<charT*>(data.extend(sizeof(charT))) = traits_inst.translate(c, (_flags & regbase::icase));
dat = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<unsigned char*>(data.data()) + pos);
++(static_cast<re_detail::re_literal*>(dat)->length);
}
else
{
// extend:
dat = add_simple(dat, re_detail::syntax_element_literal, sizeof(re_detail::re_literal) + sizeof(charT));
((re_detail::re_literal*)dat)->length = 1;
*((charT*)(((re_detail::re_literal*)dat)+1)) = traits_inst.translate(c, (_flags & regbase::icase));
static_cast<re_detail::re_literal*>(dat)->length = 1;
*reinterpret_cast<charT*>(reinterpret_cast<re_detail::re_literal*>(dat)+1) = traits_inst.translate(c, (_flags & regbase::icase));
}
return dat;
}
@ -1950,15 +1982,15 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_le
switch(dat->type)
{
case re_detail::syntax_element_literal:
len += ((re_detail::re_literal*)dat)->length;
if((leading_lit) && (((re_detail::re_literal*)dat)->length > 2))
len += static_cast<re_detail::re_literal*>(dat)->length;
if((leading_lit) && (static_cast<re_detail::re_literal*>(dat)->length > 2))
{
// we can do a literal search for the leading literal string
// using Knuth-Morris-Pratt (or whatever), and only then check for
// matches. We need a decent length string though to make it
// worth while.
_leading_string = (charT*)((char*)dat + sizeof(re_detail::re_literal));
_leading_string_len = ((re_detail::re_literal*)dat)->length;
_leading_string = reinterpret_cast<charT*>(reinterpret_cast<char*>(dat) + sizeof(re_detail::re_literal));
_leading_string_len = static_cast<re_detail::re_literal*>(dat)->length;
_restart_type = restart_lit;
leading_lit = false;
const charT* p1 = _leading_string;
@ -1982,8 +2014,8 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_le
{
// we need to verify that there are no multi-character
// collating elements inside the repeat:
const charT* p = (const charT*)((const char*)dat + sizeof(re_detail::re_set_long));
unsigned int csingles = ((re_detail::re_set_long*)dat)->csingles;
const charT* p = reinterpret_cast<const charT*>(reinterpret_cast<const char*>(dat) + sizeof(re_detail::re_set_long));
unsigned int csingles = static_cast<re_detail::re_set_long*>(dat)->csingles;
for(unsigned int i = 0; i < csingles; ++i)
{
if(re_detail::re_strlen(p) > 1)
@ -2000,9 +2032,9 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_le
leading_lit = false;
break;
case re_detail::syntax_element_rep:
if((len == 0) && (1 == fixup_leading_rep(dat->next.p, ((re_detail::re_repeat*)dat)->alt.p) ))
if((len == 0) && (1 == fixup_leading_rep(dat->next.p, static_cast<re_detail::re_repeat*>(dat)->alt.p) ))
{
((re_detail::re_repeat*)dat)->leading = true;
static_cast<re_detail::re_repeat*>(dat)->leading = true;
return len;
}
return len;

View File

@ -50,7 +50,7 @@ template <class charT, class Allocator>
void kmp_free(kmp_info<charT>* pinfo, const Allocator& a)
{
typedef typename boost::detail::rebind_allocator<char, Allocator>::type atype;
atype(a).deallocate((char*)pinfo, pinfo->size);
atype(a).deallocate(reinterpret_cast<char*>(pinfo), pinfo->size);
}
template <class iterator, class charT, class Trans, class Allocator>
@ -66,10 +66,10 @@ kmp_info<charT>* kmp_compile(iterator first, iterator last, charT, Trans transla
//
// allocate struct and fill it in:
//
kmp_info<charT>* pinfo = (kmp_info<charT>*)atype(a).allocate(size);
kmp_info<charT>* pinfo = reinterpret_cast<kmp_info<charT>*>(atype(a).allocate(size));
pinfo->size = size;
pinfo->len = m;
charT* p = (charT*)((char*)pinfo + sizeof(kmp_info<charT>) + sizeof(int)*(m+1));
charT* p = reinterpret_cast<charT*>(reinterpret_cast<char*>(pinfo) + sizeof(kmp_info<charT>) + sizeof(int)*(m+1));
pinfo->pstr = p;
while(first != last)
{

View File

@ -28,10 +28,10 @@
#ifndef BOOST_REGEX_NO_LIB
#if defined(BOOST_MSVC) && !defined(BOOST_REGEX_BUILD_DLL)
#ifdef __SGI_STL_PORT
#if defined(__SGI_STL_PORT) || defined(_STLP_VERSION)
#ifdef _DLL
// All these are multithreaded:
#if defined(_DEBUG) && defined(__STL_DEBUG)
#if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
#pragma comment(lib, "vc6-stlport-re300ddl.lib")
#elif defined(_DEBUG)
#pragma comment(lib, "vc6-stlport-re300dl.lib")
@ -43,7 +43,7 @@
#endif // _DEBUG
#else // _DLL
#ifdef _MT
#if defined(_DEBUG) && defined(__STL_DEBUG)
#if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
#pragma comment(lib, "vc6-stlport-re300ddm.lib")
#elif defined(_DEBUG)
#pragma comment(lib, "vc6-stlport-re300dm.lib")

View File

@ -34,13 +34,34 @@ namespace boost{
#pragma option push -a4 -b -Ve -pc -w-8026
#endif
//
// Unfortunately Rogue Waves standard library appears to have a bug
// in std::basic_string::compare that results in eroneous answers
// in some cases (tested with Borland C++ 5.1, Rogue Wave lib version
// 0x020101) the test case was:
// {39135,0} < {0xff,0}
// which succeeds when it should not.
//
#ifndef _RWSTD_VER
# define STR_COMP(s,p) s.compare(p)
#else
template <class C, class T, class A>
inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
{ return s.compare(p); }
inline int string_compare(const std::string& s, const char* p)
{ return std::strcmp(s.c_str(), p); }
inline int string_compare(const std::wstring& s, const wchar_t* p)
{ return std::wcscmp(s.c_str(), p); }
# define STR_COMP(s,p) string_compare(s,p)
#endif
template <class iterator, class charT, class traits_type, class Allocator>
iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
iterator last,
re_set_long* set_,
const re_set_long* set_,
const reg_expression<charT, traits_type, Allocator>& e)
{
const charT* p = (const charT*)(set_+1);
const charT* p = reinterpret_cast<const charT*>(set_+1);
iterator ptr;
unsigned int i;
bool icase = e.flags() & regbase::icase;
@ -104,11 +125,11 @@ iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
traits_inst.transform(s1, s2);
for(i = 0; i < set_->cranges; ++i)
{
if(s1 <= p)
if(STR_COMP(s1, p) <= 0)
{
while(*p)++p;
++p;
if(s1 >= p)
if(STR_COMP(s1, p) >= 0)
return set_->isnot ? next : ++next;
}
else
@ -129,7 +150,7 @@ iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
traits_inst.transform_primary(s1, s2);
for(i = 0; i < set_->cequivalents; ++i)
{
if(s1 == p)
if(STR_COMP(s1, p) == 0)
return set_->isnot ? next : ++next;
// skip string
while(*p)++p;
@ -163,9 +184,9 @@ public:
~_priv_match_data()
{
free();
m_free();
}
void free();
void m_free();
void set_accumulator_size(unsigned int size);
int* get_accumulators()
{
@ -191,7 +212,7 @@ void _priv_match_data<iterator, Allocator>::set_accumulator_size(unsigned int si
{
if(size > caccumulators)
{
free();
m_free();
caccumulators = size;
accumulators = i_alloc(temp_match.allocator()).allocate(caccumulators);
loop_starts = it_alloc(temp_match.allocator()).allocate(caccumulators);
@ -201,7 +222,7 @@ void _priv_match_data<iterator, Allocator>::set_accumulator_size(unsigned int si
}
template <class iterator, class Allocator>
void _priv_match_data<iterator, Allocator>::free()
void _priv_match_data<iterator, Allocator>::m_free()
{
if(caccumulators)
{
@ -281,6 +302,7 @@ bool query_match_aux(iterator first,
const re_syntax_base* ptr = access::first(e);
bool match_found = false;
bool have_partial_match = false;
bool unwind_stack = false;
bool need_push_match = (e.mark_count() > 1);
int cur_acc = -1; // no active accumulator
pd.set_accumulator_size(access::repeat_count(e));
@ -336,19 +358,52 @@ bool query_match_aux(iterator first,
}
goto failure;
case syntax_element_startmark:
if(((re_brace*)ptr)->index > 0)
temp_match.set_first(first, ((re_brace*)ptr)->index);
start_mark_jump:
if(static_cast<const re_brace*>(ptr)->index > 0)
{
temp_match.set_first(first, static_cast<const re_brace*>(ptr)->index);
}
else if(
(static_cast<const re_brace*>(ptr)->index == -1)
|| (static_cast<const re_brace*>(ptr)->index == -2)
)
{
matches.push(temp_match);
for(k = 0; k <= cur_acc; ++k)
prev_pos.push(start_loop[k]);
prev_pos.push(first);
prev_record.push(ptr);
for(k = 0; k <= cur_acc; ++k)
prev_acc.push(accumulators[k]);
prev_acc.push(cur_acc);
prev_acc.push(match_found);
match_found = false;
// skip next jump and fall through:
ptr = ptr->next.p;
}
ptr = ptr->next.p;
break;
case syntax_element_endmark:
if(((re_brace*)ptr)->index > 0)
temp_match.set_second(first, ((re_brace*)ptr)->index);
end_mark_jump:
if(static_cast<const re_brace*>(ptr)->index > 0)
{
temp_match.set_second(first, static_cast<const re_brace*>(ptr)->index);
}
else if(
(static_cast<const re_brace*>(ptr)->index == -1)
|| (static_cast<const re_brace*>(ptr)->index == -2)
)
{
match_found = true;
unwind_stack = true;
goto failure;
}
ptr = ptr->next.p;
break;
case syntax_element_literal:
{
unsigned int len = ((re_literal*)ptr)->length;
charT* what = (charT*)(((re_literal*)ptr) + 1);
unsigned int len = static_cast<const re_literal*>(ptr)->length;
const charT* what = reinterpret_cast<const charT*>(static_cast<const re_literal*>(ptr) + 1);
//
// compare string with what we stored in
// our records:
@ -527,8 +582,8 @@ bool query_match_aux(iterator first,
case syntax_element_backref:
{
// compare with what we previously matched:
iterator i = temp_match[((re_brace*)ptr)->index].first;
iterator j = temp_match[((re_brace*)ptr)->index].second;
iterator i = temp_match[static_cast<const re_brace*>(ptr)->index].first;
iterator j = temp_match[static_cast<const re_brace*>(ptr)->index].second;
while(i != j)
{
if((first == last) || (traits_inst.translate(*first, icase) != traits_inst.translate(*i, icase)))
@ -542,7 +597,7 @@ bool query_match_aux(iterator first,
case syntax_element_long_set:
{
// let the traits class do the work:
iterator t = re_is_set_member(first, last, (re_set_long*)ptr, e);
iterator t = re_is_set_member(first, last, static_cast<const re_set_long*>(ptr), e);
if(t != first)
{
ptr = ptr->next.p;
@ -553,7 +608,7 @@ bool query_match_aux(iterator first,
}
case syntax_element_set:
// lookup character in table:
if(((re_set*)ptr)->_map[(traits_uchar_type)traits_inst.translate(*first, icase)])
if(static_cast<const re_set*>(ptr)->_map[(traits_uchar_type)traits_inst.translate(*first, icase)])
{
ptr = ptr->next.p;
++first;
@ -561,16 +616,16 @@ bool query_match_aux(iterator first,
}
goto failure;
case syntax_element_jump:
ptr = ((re_jump*)ptr)->alt.p;
ptr = static_cast<const re_jump*>(ptr)->alt.p;
continue;
case syntax_element_alt:
{
// alt_jump:
if(access::can_start(*first, ((re_jump*)ptr)->_map, (unsigned char)mask_take))
if(access::can_start(*first, static_cast<const re_jump*>(ptr)->_map, (unsigned char)mask_take))
{
// we can take the first alternative,
// see if we need to push next alternative:
if(access::can_start(*first, ((re_jump*)ptr)->_map, mask_skip))
if(access::can_start(*first, static_cast<const re_jump*>(ptr)->_map, mask_skip))
{
if(need_push_match)
matches.push(temp_match);
@ -585,9 +640,9 @@ bool query_match_aux(iterator first,
ptr = ptr->next.p;
continue;
}
if(access::can_start(*first, ((re_jump*)ptr)->_map, mask_skip))
if(access::can_start(*first, static_cast<const re_jump*>(ptr)->_map, mask_skip))
{
ptr = ((re_jump*)ptr)->alt.p;
ptr = static_cast<const re_jump*>(ptr)->alt.p;
continue;
}
goto failure; // neither option is possible
@ -597,16 +652,16 @@ bool query_match_aux(iterator first,
// repeater_jump:
// if we're moving to a higher id (nested repeats etc)
// zero out our accumualtors:
if(cur_acc < ((re_repeat*)ptr)->id)
if(cur_acc < static_cast<const re_repeat*>(ptr)->id)
{
cur_acc = ((re_repeat*)ptr)->id;
cur_acc = static_cast<const re_repeat*>(ptr)->id;
accumulators[cur_acc] = 0;
start_loop[cur_acc] = first;
}
cur_acc = ((re_repeat*)ptr)->id;
cur_acc = static_cast<const re_repeat*>(ptr)->id;
if(((re_repeat*)ptr)->leading)
if(static_cast<const re_repeat*>(ptr)->leading)
*restart = first;
//charT c = traits_inst.translate(*first);
@ -615,17 +670,17 @@ bool query_match_aux(iterator first,
// if that is the case then repeat as many times as possible,
// as long as the repeat is greedy:
if((((re_repeat*)ptr)->alt.p->type == syntax_element_match)
&& (((re_repeat*)ptr)->greedy == true))
if((static_cast<const re_repeat*>(ptr)->alt.p->type == syntax_element_match)
&& (static_cast<const re_repeat*>(ptr)->greedy == true))
{
// see if we can take the repeat:
if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max)
&& access::can_start(*first, ((re_repeat*)ptr)->_map, mask_take))
if(((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->max)
&& access::can_start(*first, static_cast<const re_repeat*>(ptr)->_map, mask_take))
{
// push terminating match as fallback:
if((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min)
if((unsigned int)accumulators[cur_acc] >= static_cast<const re_repeat*>(ptr)->min)
{
if((prev_record.empty() == false) && (prev_record.peek() == ((re_repeat*)ptr)->alt.p))
if((prev_record.empty() == false) && (prev_record.peek() == static_cast<const re_repeat*>(ptr)->alt.p))
{
// we already have the required fallback
// don't add any more, just update this one:
@ -638,7 +693,7 @@ bool query_match_aux(iterator first,
if(need_push_match)
matches.push(temp_match);
prev_pos.push(first);
prev_record.push(((re_repeat*)ptr)->alt.p);
prev_record.push(static_cast<const re_repeat*>(ptr)->alt.p);
}
}
// move to next item in list:
@ -652,10 +707,10 @@ bool query_match_aux(iterator first,
goto failure;
}
// see if we can skip the repeat:
if(((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min)
&& access::can_start(*first, ((re_repeat*)ptr)->_map, mask_skip))
if(((unsigned int)accumulators[cur_acc] >= static_cast<const re_repeat*>(ptr)->min)
&& access::can_start(*first, static_cast<const re_repeat*>(ptr)->_map, mask_skip))
{
ptr = ((re_repeat*)ptr)->alt.p;
ptr = static_cast<const re_repeat*>(ptr)->alt.p;
continue;
}
// otherwise fail:
@ -664,16 +719,16 @@ bool query_match_aux(iterator first,
// OK if we get to here then the repeat is either non-terminal or non-greedy,
// see if we can skip the repeat:
if(((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min)
&& access::can_start(*first, ((re_repeat*)ptr)->_map, mask_skip))
if(((unsigned int)accumulators[cur_acc] >= static_cast<const re_repeat*>(ptr)->min)
&& access::can_start(*first, static_cast<const re_repeat*>(ptr)->_map, mask_skip))
{
// see if we can push failure info:
if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max)
&& access::can_start(*first, ((re_repeat*)ptr)->_map, mask_take))
if(((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->max)
&& access::can_start(*first, static_cast<const re_repeat*>(ptr)->_map, mask_take))
{
// check to see if the last loop matched a NULL string
// if so then we really don't want to loop again:
if(((unsigned int)accumulators[cur_acc] == ((re_repeat*)ptr)->min)
if(((unsigned int)accumulators[cur_acc] == static_cast<const re_repeat*>(ptr)->min)
|| (first != start_loop[cur_acc]))
{
if(need_push_match)
@ -683,20 +738,20 @@ bool query_match_aux(iterator first,
for(k = 0; k <= cur_acc; ++k)
prev_acc.push(accumulators[k]);
// for non-greedy repeats save whether we have a match already:
if(((re_repeat*)ptr)->greedy == false)
if(static_cast<const re_repeat*>(ptr)->greedy == false)
{
prev_acc.push(match_found);
match_found = false;
}
}
}
ptr = ((re_repeat*)ptr)->alt.p;
ptr = static_cast<const re_repeat*>(ptr)->alt.p;
continue;
}
// otherwise see if we can take the repeat:
if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max)
&& access::can_start(*first, ((re_repeat*)ptr)->_map, mask_take) &&
if(((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->max)
&& access::can_start(*first, static_cast<const re_repeat*>(ptr)->_map, mask_take) &&
((first != start_loop[cur_acc]) || !accumulators[cur_acc]))
{
// move to next item in list:
@ -752,13 +807,9 @@ bool query_match_aux(iterator first,
case syntax_element_match:
goto match_jump;
case syntax_element_startmark:
temp_match.set_first(first, ((re_brace*)ptr)->index);
ptr = ptr->next.p;
break;
goto start_mark_jump;
case syntax_element_endmark:
temp_match.set_second(first, ((re_brace*)ptr)->index);
ptr = ptr->next.p;
break;
goto end_mark_jump;
case syntax_element_start_line:
goto outer_line_check;
case syntax_element_end_line:
@ -790,7 +841,7 @@ bool query_match_aux(iterator first,
ptr = ptr->next.p;
break;
case syntax_element_jump:
ptr = ((re_jump*)ptr)->alt.p;
ptr = static_cast<const re_jump*>(ptr)->alt.p;
continue;
case syntax_element_alt:
if(ptr->can_be_null & mask_take)
@ -814,33 +865,33 @@ bool query_match_aux(iterator first,
}
if(ptr->can_be_null & mask_skip)
{
ptr = ((re_jump*)ptr)->alt.p;
ptr = static_cast<const re_jump*>(ptr)->alt.p;
continue;
}
goto failure; // neither option is possible
case syntax_element_rep:
// if we're moving to a higher id (nested repeats etc)
// zero out our accumualtors:
if(cur_acc < ((re_repeat*)ptr)->id)
if(cur_acc < static_cast<const re_repeat*>(ptr)->id)
{
cur_acc = ((re_repeat*)ptr)->id;
cur_acc = static_cast<const re_repeat*>(ptr)->id;
accumulators[cur_acc] = 0;
start_loop[cur_acc] = first;
}
cur_acc = ((re_repeat*)ptr)->id;
cur_acc = static_cast<const re_repeat*>(ptr)->id;
// see if we can skip the repeat:
if(((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min)
if(((unsigned int)accumulators[cur_acc] >= static_cast<const re_repeat*>(ptr)->min)
&& ((ptr->can_be_null & mask_skip) || (flags & match_partial)))
{
// don't push failure info, there's no point:
ptr = ((re_repeat*)ptr)->alt.p;
ptr = static_cast<const re_repeat*>(ptr)->alt.p;
continue;
}
// otherwise see if we can take the repeat:
if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max)
if(((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->max)
&& (((ptr->can_be_null & (mask_take | mask_skip)) == (mask_take | mask_skip))) || (flags & match_partial))
{
// move to next item in list:
@ -884,7 +935,7 @@ bool query_match_aux(iterator first,
{
case syntax_element_alt:
// get next alternative:
ptr = ((re_jump*)ptr)->alt.p;
ptr = static_cast<const re_jump*>(ptr)->alt.p;
if(need_push_match)
matches.pop(temp_match);
prev_acc.pop(cur_acc);
@ -894,6 +945,7 @@ bool query_match_aux(iterator first,
for(k = cur_acc; k >= 0; --k)
prev_pos.pop(start_loop[k]);
prev_record.pop();
if(unwind_stack) goto failure; // unwinding forward assert
goto retry;
case syntax_element_rep:
{
@ -903,8 +955,8 @@ bool query_match_aux(iterator first,
if(need_push_match)
matches.pop(temp_match);
prev_pos.pop(first);
cur_acc = ((re_repeat*)ptr)->id;
if(((re_repeat*)ptr)->greedy == false)
cur_acc = static_cast<const re_repeat*>(ptr)->id;
if(static_cast<const re_repeat*>(ptr)->greedy == false)
{
saved_matched = prev_acc.peek();
prev_acc.pop();
@ -912,11 +964,12 @@ bool query_match_aux(iterator first,
for(k = cur_acc; k >= 0; --k)
prev_acc.pop(accumulators[k]);
prev_record.pop();
if((unsigned int)++accumulators[cur_acc] > ((re_repeat*)ptr)->max)
if(unwind_stack) goto failure; // unwinding forward assert
if((unsigned int)++accumulators[cur_acc] > static_cast<const re_repeat*>(ptr)->max)
goto failure; // repetions exhausted.
//
// if the repeat is non-greedy, and we found a match then fail again:
if((((re_repeat*)ptr)->greedy == false) && (match_found == true))
if((static_cast<const re_repeat*>(ptr)->greedy == false) && (match_found == true))
{
goto failure;
}
@ -926,11 +979,42 @@ bool query_match_aux(iterator first,
start_loop[cur_acc] = first;
goto retry;
}
case syntax_element_startmark:
{
bool saved_matched = match_found;
matches.pop(temp_match);
match_found = prev_acc.peek();
prev_acc.pop();
prev_acc.pop(cur_acc);
for(k = cur_acc; k >= 0; --k)
prev_acc.pop(accumulators[k]);
prev_pos.pop(first);
for(k = cur_acc; k >= 0; --k)
prev_pos.pop(start_loop[k]);
prev_record.pop();
unwind_stack = false;
if(static_cast<const re_brace*>(ptr)->index == -1)
{
if (saved_matched == false)
goto failure;
ptr = static_cast<const re_jump*>(ptr->next.p)->alt.p->next.p;
goto retry;
}
if(static_cast<const re_brace*>(ptr)->index == -2)
{
if (saved_matched == true)
goto failure;
ptr = static_cast<const re_jump*>(ptr->next.p)->alt.p->next.p;
goto retry;
}
else goto failure;
}
case syntax_element_match:
if(need_push_match)
matches.pop(temp_match);
prev_pos.pop(first);
prev_record.pop();
if(unwind_stack) goto failure; // unwinding forward assert
goto retry;
default:
jm_assert(0);
@ -1051,10 +1135,6 @@ namespace{
template <class Predicate, class I, class charT, class traits, class A, class A2>
unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<charT, traits, A>& e, unsigned flags, A2 a)
{
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable: 4800)
#endif
typedef access_t<charT, traits, A> access;
if(e.flags() & regbase::failbit)

View File

@ -157,7 +157,7 @@ public:
size_type BOOST_REGEX_CALL index(void* ptr)
{
return (unsigned char*)ptr - (unsigned char*)data();
return reinterpret_cast<unsigned char*>(ptr) - reinterpret_cast<unsigned char*>(data());
}
void BOOST_REGEX_CALL clear()
@ -168,7 +168,7 @@ public:
void BOOST_REGEX_CALL align()
{
// move end up to a boundary:
end = (unsigned char*)start + ((((unsigned char*)end - (unsigned char*)start) + padding_mask) & ~padding_mask);
end = reinterpret_cast<unsigned char*>(start) + (((reinterpret_cast<unsigned char*>(end) - reinterpret_cast<unsigned char*>(start)) + padding_mask) & ~padding_mask);
}
Allocator BOOST_REGEX_CALL allocator()const;

View File

@ -69,8 +69,9 @@ bool split_pred<OutputIterator, charT, Traits1, Alloc1, Alloc2>::operator()
{
*(*p_out) = static_cast<string_type>(what[i]);
++(*p_out);
return --*p_max;
if(0 == --*p_max) return false;
}
return *p_max != 0;
}
else
{

View File

@ -84,8 +84,8 @@ public:
node* BOOST_REGEX_CALL get_node()
{
node* new_stack = (node*)alloc_inst.allocate(sizeof(node) + sizeof(T) * block_size);
new_stack->last = (T*)(new_stack+1);
node* new_stack = reinterpret_cast<node*>(alloc_inst.allocate(sizeof(node) + sizeof(T) * block_size));
new_stack->last = reinterpret_cast<T*>(new_stack+1);
new_stack->start = new_stack->end = new_stack->last + block_size;
new_stack->next = 0;
return new_stack;
@ -196,13 +196,13 @@ jstack<T, Allocator>::~jstack()
{
condemned = unused;
unused = unused->next;
alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size);
alloc_inst.deallocate(reinterpret_cast<unsigned char*>(condemned), sizeof(node) + sizeof(T) * block_size);
}
while(m_stack != &base)
{
condemned = m_stack;
m_stack = m_stack->next;
alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size);
alloc_inst.deallocate(reinterpret_cast<unsigned char*>(condemned), sizeof(node) + sizeof(T) * block_size);
}
}

View File

@ -189,13 +189,13 @@ typedef lock_guard<critical_section> cs_guard;
BOOST_REGEX_DECL extern critical_section* p_re_lock;
BOOST_REGEX_DECL extern unsigned int re_lock_count;
#define BOOST_RE_GUARD(inst) boost::re_detail::critical_section::rw_guard g(inst);
#define BOOST_REGEX_GUARD(inst) boost::re_detail::critical_section::rw_guard g(inst);
#else // BOOST_RE_THREADS
#else // BOOST_HAS_THREADS
#define BOOST_RE_GUARD(inst)
#define BOOST_REGEX_GUARD(inst)
#endif // BOOST_RE_THREADS
#endif // BOOST_HAS_THREADS
#ifdef __BORLANDC__
#pragma option pop

View File

@ -118,7 +118,10 @@ struct BOOST_REGEX_DECL regex_traits_base
syntax_Z = 51, // for \Z
syntax_G = 52, // for \G
syntax_max = 53
// new extentions:
syntax_not = 53, // for (?!...)
syntax_max = 54
};
};
@ -239,7 +242,7 @@ public:
}
~c_regex_traits()
{
free();
m_free();
}
struct sentry
{
@ -250,7 +253,7 @@ public:
static void BOOST_REGEX_CALL update();
private:
static void BOOST_REGEX_CALL init();
static void BOOST_REGEX_CALL free();
static void BOOST_REGEX_CALL m_free();
static c_regex_traits<char> i;
static unsigned sort_type;
@ -307,7 +310,7 @@ public:
c_regex_traits<wchar_t>()
{ init(); }
~c_regex_traits<wchar_t>()
{ free(); }
{ m_free(); }
struct sentry
{
sentry(const c_regex_traits<wchar_t>&)
@ -319,7 +322,7 @@ public:
static unsigned int BOOST_REGEX_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2);
private:
static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
static void BOOST_REGEX_CALL free();
static void BOOST_REGEX_CALL m_free();
static void BOOST_REGEX_CALL init();
static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
static c_regex_traits<wchar_t> init_;
@ -733,7 +736,7 @@ public:
return true;
if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
return true;
if((f & char_class_unicode) && (c > (size_type)(uchar_type)255))
if((f & char_class_unicode) && ((uchar_type)c > (uchar_type)255))
return true;
return false;
}

View File

@ -21,7 +21,7 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
alt="C++ Boost" width="277" height="86"></h3>
</td>
<td valign="top"><h3 align="center">Regex++, Index.</h3>
<p align="left"><i>(Version 3.20, 29th Sept 2001)</i>&nbsp;
<p align="left"><i>(Version 3.31, 16th Dec 2001)</i>&nbsp;
</p>
<p align="left"><i>Copyright (c) 1998-2001 </i></p>
<p align="left"><i>Dr John Maddock</i></p>

View File

@ -21,8 +21,6 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
alt="C++ Boost" width="276" height="86"></h3>
</td>
<td valign="top"><h3 align="center">Regex++, Introduction.</h3>
<p align="left"><i>(Version 3.20, 29th Sept 2001)</i>&nbsp;
</p>
<p align="left"><i>Copyright (c) 1998-2001 </i></p>
<p align="left"><i>Dr John Maddock</i></p>
<p align="left"><i>Permission to use, copy, modify,
@ -158,12 +156,14 @@ result of a match contains a number of sub-expression matches in
addition to the overall match. When the library needs to report a
regular expression match it does so using an instance of the
class <a href="template_class_ref.htm#reg_match">match_results</a>,
as before there are typedefs of this class for the two most
common cases: </p>
as before there are typedefs of this class for the most common
cases: </p>
<pre><b>namespace </b>boost{
<b>typedef</b> match_results&lt;<b>const</b> <b>char</b>*&gt; cmatch;
<b>typedef</b> match_results&lt;<b>const</b> <b>wchar_t</b>*&gt; wcmatch;
<strong>typedef</strong> match_results&lt;std::string::const_iterator&gt; smatch;
<strong>typedef</strong> match_results&lt;std::wstring::const_iterator&gt; wsmatch;
}</pre>
<p>The algorithms <a href="template_class_ref.htm#reg_search">regex_search</a>

View File

@ -176,11 +176,11 @@ function vc6_gen()
if test "$is_stlport" == yes; then
# debug STLPort mode:
debug="yes"
opts="/nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c"
opts="/nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D__STL_DEBUG /D_STLP_DEBUG /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /FD /GZ /c"
libname="$prefix""re300ddl"
vc6_gen_dll
libname="$prefix""re300ddm"
opts="/nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c"
opts="/nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /D__STL_DEBUG /D_STLP_DEBUG /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c"
vc6_gen_lib
fi
@ -1067,5 +1067,6 @@ rm -f $tout $iout

View File

@ -19,9 +19,7 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
alt="C++ Boost" width="276" height="86"></h3>
</td>
<td valign="top"><h3 align="center">Regex++, POSIX API
Reference.</h3>
<p align="left"><i>(Version 3.20, 29th Sept 2001)</i>&nbsp;
</p>
Reference. </h3>
<p align="left"><i>Copyright (c) 1998-2001 </i></p>
<p align="left"><i>Dr John Maddock</i></p>
<p align="left"><i>Permission to use, copy, modify,

View File

@ -31,6 +31,7 @@
#include <boost/regex/regex_traits.hpp>
#include <boost/regex/detail/regex_synch.hpp>
#include <boost/regex/detail/regex_cstring.hpp>
#include <boost/scoped_array.hpp>
#include "primary_transform.hpp"
@ -178,7 +179,7 @@ unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsig
template <class charT>
unsigned int BOOST_REGEX_CALL re_get_message(charT* buf, unsigned int len, unsigned int id)
{
unsigned int size = _re_get_message((char*)0, 0, id);
unsigned int size = _re_get_message(static_cast<char*>(0), 0, id);
if(len < size)
return size;
boost::scoped_array<char> cb(new char[size]);
@ -342,7 +343,14 @@ void BOOST_REGEX_CALL re_message_update()
message_cat = (nl_catd)-1;
}
if(*boost::re_detail::c_traits_base::get_catalogue())
{
message_cat = catopen(boost::re_detail::c_traits_base::get_catalogue(), 0);
if(message_cat == (nl_catd)-1)
{
std::string m("Unable to open message catalog: ");
throw std::runtime_error(m + boost::re_detail::c_traits_base::get_catalogue());
}
}
#endif
for(int i = 0; i < boost::REG_E_UNKNOWN; ++i)
{
@ -381,7 +389,7 @@ void BOOST_REGEX_CALL re_message_free()
const char* BOOST_REGEX_CALL re_get_error_str(unsigned int id)
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
boost::re_detail::cs_guard g(*boost::re_detail::p_re_lock);
#endif
if(re_custom_error_messages[id] == 0)
@ -444,7 +452,7 @@ void BOOST_REGEX_CALL c_traits_base::do_update_ctype()
for(i = 1; i < syntax_max; ++i)
{
char* ptr = buf;
re_get_message((char*)buf, map_size, i+100);
re_get_message(static_cast<char*>(buf), map_size, i+100);
for(; *ptr; ++ptr)
{
syntax_map[(unsigned char)*ptr] = (unsigned char)i;
@ -549,7 +557,7 @@ bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_collatename(std::basic_str
{
BOOST_RE_GUARD_STACK
std::basic_string<wchar_t> s(first, last);
unsigned int len = strnarrow((char*)0, 0, s.c_str());
unsigned int len = strnarrow(static_cast<char*>(0), 0, s.c_str());
scoped_array<char> buf(new char[len]);
strnarrow(buf.get(), len, s.c_str());
std::string t_out;
@ -559,7 +567,7 @@ bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_collatename(std::basic_str
{
if(t_out[0])
{
len = strwiden((wchar_t*)0, 0, t_out.c_str());
len = strwiden(static_cast<wchar_t*>(0), 0, t_out.c_str());
scoped_array<wchar_t> wb(new wchar_t[len]);
strwiden(wb.get(), len, t_out.c_str());
out = wb.get();
@ -576,7 +584,7 @@ c_regex_traits<char> c_regex_traits<char>::i;
void BOOST_REGEX_CALL c_regex_traits<char>::init()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::re_init_threads();
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
@ -602,7 +610,7 @@ void BOOST_REGEX_CALL c_regex_traits<char>::init()
void BOOST_REGEX_CALL c_regex_traits<char>::update()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
re_message_update();
@ -619,10 +627,10 @@ void BOOST_REGEX_CALL c_regex_traits<char>::update()
sort_type = re_detail::find_sort_syntax(&i, &sort_delim);
}
void BOOST_REGEX_CALL c_regex_traits<char>::free()
void BOOST_REGEX_CALL c_regex_traits<char>::m_free()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
re_message_free();
@ -634,7 +642,7 @@ void BOOST_REGEX_CALL c_regex_traits<char>::free()
delete ctype_name;
delete collate_name;
}
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
g.acquire(false);
re_detail::re_free_threads();
#endif
@ -746,7 +754,7 @@ void BOOST_REGEX_CALL c_regex_traits<wchar_t>::init()
{
BOOST_RE_GUARD_STACK
re_detail::re_init_threads();
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
re_message_init();
@ -771,14 +779,14 @@ bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::do_lookup_collate(std::basic_stri
{
BOOST_RE_GUARD_STACK
std::basic_string<wchar_t> s(first, last);
unsigned int len = strnarrow((char*)0, 0, s.c_str());
unsigned int len = strnarrow(static_cast<char*>(0), 0, s.c_str());
scoped_array<char> buf(new char[len]);
strnarrow(buf.get(), len, s.c_str());
std::string t_out;
bool result = base_type::do_lookup_collate(t_out, buf.get());
if(result)
{
len = strwiden((wchar_t*)0, 0, t_out.c_str());
len = strwiden(static_cast<wchar_t*>(0), 0, t_out.c_str());
scoped_array<wchar_t> wb(new wchar_t[len]);
strwiden(wb.get(), len, t_out.c_str());
out = wb.get();
@ -790,7 +798,7 @@ bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::do_lookup_collate(std::basic_stri
void BOOST_REGEX_CALL c_regex_traits<wchar_t>::update()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
re_message_update();
@ -826,7 +834,7 @@ void BOOST_REGEX_CALL c_regex_traits<wchar_t>::update()
for(i = 1; i < syntax_max; ++i)
{
wchar_t* ptr = buf;
re_get_message((wchar_t*)buf, 256, i+100);
re_get_message(static_cast<wchar_t*>(buf), 256, i+100);
for(; *ptr; ++ptr)
{
sm.c = *ptr;
@ -838,10 +846,10 @@ void BOOST_REGEX_CALL c_regex_traits<wchar_t>::update()
}
}
void BOOST_REGEX_CALL c_regex_traits<wchar_t>::free()
void BOOST_REGEX_CALL c_regex_traits<wchar_t>::m_free()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
--nlsw_count;
@ -854,7 +862,7 @@ void BOOST_REGEX_CALL c_regex_traits<wchar_t>::free()
delete wlocale_name;
delete syntax;
}
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
g.acquire(false);
re_detail::re_free_threads();
#endif
@ -981,7 +989,7 @@ int BOOST_REGEX_CALL c_regex_traits<wchar_t>::toi(const wchar_t*& first, const w
boost::uint_fast32_t BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_classname(const wchar_t* first, const wchar_t* last)
{
std::basic_string<wchar_t> s(first, last);
unsigned int len = strnarrow((char*)0, 0, s.c_str());
unsigned int len = strnarrow(static_cast<char*>(0), 0, s.c_str());
scoped_array<char> buf(new char[len]);
strnarrow(buf.get(), len, s.c_str());
len = do_lookup_class(buf.get());

View File

@ -194,6 +194,8 @@ const mss default_messages[] = {
{ 100 + c_regex_traits<char>::syntax_Z, "Z", },
{ 100 + c_regex_traits<char>::syntax_G, "G", },
{ 100 + c_regex_traits<char>::syntax_not, "!", },
{ 0, "", },
};

View File

@ -36,6 +36,7 @@
#include <map>
#include <boost/regex/regex_traits.hpp>
#include <boost/cregex.hpp>
#include <boost/scoped_array.hpp>
#include "primary_transform.hpp"
@ -189,8 +190,19 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
{
is.imbue(l);
#ifndef BOOST_NO_STD_MESSAGES
const std::messages<char>* pm = &BOOST_USE_FACET(std::messages<char>, l);
std::messages<char>::catalog cat = regex_message_catalogue.size() ? pm->open(regex_message_catalogue, l) : -1;
const std::messages<char>* pm = 0;
std::messages<char>::catalog cat = -1;
if(regex_message_catalogue.size())
{
pm = &BOOST_USE_FACET(std::messages<char>, l);
cat = pm->open(regex_message_catalogue, l);
if(cat < 0)
{
std::string m("Unable to open message catalog: ");
throw std::runtime_error(m + regex_message_catalogue);
}
}
#endif
std::memset(syntax_map, cpp_regex_traits<char>::syntax_char, 256);
unsigned int i;
@ -222,39 +234,26 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
std::string c1, c2;
i = 400;
if((int)cat >= 0)
c2 = pm->get(cat, 0, i, c1);
while(c2.size())
{
const char* p1, *p2, *p3, *p4;;
p1 = c2.c_str();
while(*p1 && std::isspace((char)*p1, l))++p1;
p2 = p1;
while(*p2 && !std::isspace((char)*p2, l))++p2;
p3 = p2;
while(*p3 && std::isspace((char)*p3, l))++p3;
p4 = p3;
while(*p4 && !std::isspace((char)*p4, l))++p4;
collating_elements[std::string(p1, p2)] = std::string(p3, p4);
++i;
c2 = pm->get(cat, 0, i, c1);
while(c2.size())
{
const char* p1, *p2, *p3, *p4;;
p1 = c2.c_str();
while(*p1 && std::isspace((char)*p1, l))++p1;
p2 = p1;
while(*p2 && !std::isspace((char)*p2, l))++p2;
p3 = p2;
while(*p3 && std::isspace((char)*p3, l))++p3;
p4 = p3;
while(*p4 && !std::isspace((char)*p4, l))++p4;
collating_elements[std::string(p1, p2)] = std::string(p3, p4);
++i;
c2 = pm->get(cat, 0, i, c1);
}
}
#endif
/*
std::string n("zero");
std::map<std::string, std::string, std::less<std::string > >::const_iterator pos = collating_elements.find(n);
if(pos != collating_elements.end())
_zero = *(*pos).second.c_str();
else
_zero = '0';
n = "ten";
pos = collating_elements.find(n);
if(pos != collating_elements.end())
_ten = *(*pos).second.c_str();
else
_ten = 'a';
*/
std::string m;
std::string s;
#ifndef BOOST_NO_STD_MESSAGES
@ -335,7 +334,7 @@ int BOOST_REGEX_CALL cpp_regex_traits<char>::toi(char c)const
int BOOST_REGEX_CALL cpp_regex_traits<char>::toi(const char*& first, const char* last, int radix)const
{
pmd->sbuf.pubsetbuf((char*)first, last-first);
pmd->sbuf.pubsetbuf(const_cast<char*>(first), last-first);
pmd->is.clear();
if(std::abs(radix) == 16) pmd->is >> std::hex;
else if(std::abs(radix) == 8) pmd->is >> std::oct;
@ -562,7 +561,16 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
const cvt_type& cvt = BOOST_USE_FACET(cvt_type, l);
#ifndef BOOST_NO_STD_MESSAGES
const std::messages<wchar_t>& msgs = BOOST_USE_FACET(std::messages<wchar_t>, l);
std::messages<wchar_t>::catalog cat = regex_message_catalogue.size() ? msgs.open(regex_message_catalogue, l) : -1;
std::messages<wchar_t>::catalog cat = -1;
if(regex_message_catalogue.size())
{
cat = msgs.open(regex_message_catalogue, l);
if(cat < 0)
{
std::string m("Unable to open message catalog: ");
throw std::runtime_error(m + regex_message_catalogue);
}
}
#endif
scoped_array<char> a;
unsigned array_size = 0;
@ -602,22 +610,24 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
string_type c1, c2;
i = 400;
if((int)cat >= 0)
c2 = msgs.get(cat, 0, i, c1);
while(c2.size())
{
const wchar_t* p1, *p2, *p3, *p4;;
p1 = c2.c_str();
while(*p1 && std::isspace((wchar_t)*p1, l))++p1;
p2 = p1;
while(*p2 && !std::isspace((wchar_t)*p2, l))++p2;
p3 = p2;
while(*p3 && std::isspace((wchar_t)*p3, l))++p3;
p4 = p3;
while(*p4 && !std::isspace((wchar_t)*p4, l))++p4;
collating_elements[std::basic_string<wchar_t>(p1, p2)] = std::basic_string<wchar_t>(p3, p4);
++i;
c2 = msgs.get(cat, 0, i, c1);
while(c2.size())
{
const wchar_t* p1, *p2, *p3, *p4;;
p1 = c2.c_str();
while(*p1 && std::isspace((wchar_t)*p1, l))++p1;
p2 = p1;
while(*p2 && !std::isspace((wchar_t)*p2, l))++p2;
p3 = p2;
while(*p3 && std::isspace((wchar_t)*p3, l))++p3;
p4 = p3;
while(*p4 && !std::isspace((wchar_t)*p4, l))++p4;
collating_elements[std::basic_string<wchar_t>(p1, p2)] = std::basic_string<wchar_t>(p3, p4);
++i;
c2 = msgs.get(cat, 0, i, c1);
}
}
if((int)cat >= 0)
@ -697,7 +707,7 @@ int BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::toi(wchar_t c)const
int BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::toi(const wchar_t*& first, const wchar_t* last, int radix)const
{
pmd->sbuf.pubsetbuf((wchar_t*)first, last-first);
pmd->sbuf.pubsetbuf(const_cast<wchar_t*>(first), last-first);
pmd->is.clear();
if(std::abs(radix) == 16) pmd->is >> std::hex;
else if(std::abs(radix) == 8) pmd->is >> std::oct;

View File

@ -25,7 +25,7 @@
#include <boost/cregex.hpp>
#include <boost/regex.hpp>
#if !defined(BOOST_RE_NO_STRING_H)
#if !defined(BOOST_NO_STD_STRING)
#include <map>
#include <list>
#include <boost/regex/detail/fileiter.hpp>
@ -465,18 +465,18 @@ unsigned int RegEx::Position(int i)const
switch(pdata->t)
{
case re_detail::RegExData::type_pc:
return pdata->m[i].matched ? pdata->m[i].first - pdata->pbase : (unsigned int)-1;
return pdata->m[i].matched ? pdata->m[i].first - pdata->pbase : RegEx::npos;
case re_detail::RegExData::type_pf:
return pdata->fm[i].matched ? pdata->fm[i].first - pdata->fbase : (unsigned int)-1;
return pdata->fm[i].matched ? pdata->fm[i].first - pdata->fbase : RegEx::npos;
case re_detail::RegExData::type_copy:
{
std::map<int, int, std::less<int> >::iterator pos = pdata->positions.find(i);
if(pos == pdata->positions.end())
return (unsigned int)-1;
return RegEx::npos;
return (*pos).second;
}
}
return (unsigned int)-1;
return RegEx::npos;
}
unsigned int RegEx::Line()const
@ -485,15 +485,15 @@ unsigned int RegEx::Line()const
switch(pdata->t)
{
case re_detail::RegExData::type_pc:
return pdata->m[0].matched ? pdata->m.line() : (unsigned int)-1;
return pdata->m[0].matched ? pdata->m.line() : RegEx::npos;
case re_detail::RegExData::type_pf:
return pdata->fm[0].matched ? pdata->fm.line() : (unsigned int)-1;
return pdata->fm[0].matched ? pdata->fm.line() : RegEx::npos;
case re_detail::RegExData::type_copy:
{
return pdata->line;
}
}
return (unsigned int)-1;
return RegEx::npos;
}
unsigned int RegEx::Marks()const
@ -509,20 +509,41 @@ unsigned int RegEx::Length(int i)const
switch(pdata->t)
{
case re_detail::RegExData::type_pc:
return pdata->m[i].matched ? pdata->m[i].second - pdata->m[i].first : (unsigned)-1;
return pdata->m[i].matched ? pdata->m[i].second - pdata->m[i].first : RegEx::npos;
case re_detail::RegExData::type_pf:
return pdata->fm[i].matched ? pdata->fm[i].second - pdata->fm[i].first : (unsigned)-1;
return pdata->fm[i].matched ? pdata->fm[i].second - pdata->fm[i].first : RegEx::npos;
case re_detail::RegExData::type_copy:
{
std::map<int, std::string, std::less<int> >::iterator pos = pdata->strings.find(i);
if(pos == pdata->strings.end())
return (unsigned)-1;
return RegEx::npos;
return (*pos).second.size();
}
}
return (unsigned)-1;
return RegEx::npos;
}
bool RegEx::Matched(int i)const
{
BOOST_RE_GUARD_STACK
switch(pdata->t)
{
case re_detail::RegExData::type_pc:
return pdata->m[i].matched;
case re_detail::RegExData::type_pf:
return pdata->fm[i].matched;
case re_detail::RegExData::type_copy:
{
std::map<int, std::string, std::less<int> >::iterator pos = pdata->strings.find(i);
if(pos == pdata->strings.end())
return false;
return true;
}
}
return false;
}
std::string RegEx::What(int i)const
{
BOOST_RE_GUARD_STACK
@ -548,6 +569,8 @@ std::string RegEx::What(int i)const
return result;
}
const unsigned int RegEx::npos = ~0u;
} // namespace boost

View File

@ -83,7 +83,7 @@ void mapfile::open(const char* file)
hfile = 0;
throw std::runtime_error("Unable to create file mapping.");
}
_first = (const char*)MapViewOfFile(hmap, FILE_MAP_READ, 0, 0, 0);
_first = static_cast<const char*>(MapViewOfFile(hmap, FILE_MAP_READ, 0, 0, 0));
if(_first == 0)
{
CloseHandle(hmap);
@ -227,7 +227,7 @@ void mapfile::lock(pointer* node)const
if(condemed.empty())
{
*node = new char[sizeof(int) + buf_size];
*((int*)(*node)) = 1;
*(reinterpret_cast<int*>(*node)) = 1;
}
else
{
@ -235,7 +235,7 @@ void mapfile::lock(pointer* node)const
condemed.pop_front();
*node = *p;
*p = 0;
*((int*)(*node)) = 1;
*(reinterpret_cast<int*>(*node)) = 1;
}
std::fseek(hfile, (node - _first) * buf_size, SEEK_SET);
if(node == _last - 1)
@ -245,13 +245,13 @@ void mapfile::lock(pointer* node)const
}
else
{
if(*((int*)(*node)) == 0)
if(*reinterpret_cast<int*>(*node) == 0)
{
*((int*)(*node)) = 1;
*reinterpret_cast<int*>(*node) = 1;
condemed.remove(node);
}
else
++(*((int*)(*node)));
++(*reinterpret_cast<int*>(*node));
}
}
}
@ -263,7 +263,7 @@ void mapfile::unlock(pointer* node)const
assert(node <= _last);
if(node < _last)
{
if(--(*((int*)(*node))) == 0)
if(--(*reinterpret_cast<int*>(*node)) == 0)
{
condemed.push_back(node);
}

View File

@ -79,9 +79,9 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char
try{
expression->re_magic = magic_value;
((regex*)(expression->guts))->set_expression(ptr, p2, flags);
expression->re_nsub = ((regex*)(expression->guts))->mark_count() - 1;
result = ((regex*)(expression->guts))->error_code();
static_cast<regex*>(expression->guts)->set_expression(ptr, p2, flags);
expression->re_nsub = static_cast<regex*>(expression->guts)->mark_count() - 1;
result = static_cast<regex*>(expression->guts)->error_code();
} catch(...)
{
result = REG_E_UNKNOWN;
@ -132,7 +132,7 @@ BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorA(int code, const regex_
{
std::string p;
if((e) && (e->re_magic == magic_value))
p = ((regex*)(e->guts))->get_traits().error_string(code);
p = static_cast<regex*>(e->guts)->get_traits().error_string(code);
else
{
boost::regex_traits<char> t;
@ -177,7 +177,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, cons
try{
if(expression->re_magic == magic_value)
{
result = regex_search(start, end, m, *(regex*)(expression->guts), flags);
result = regex_search(start, end, m, *static_cast<regex*>(expression->guts), flags);
}
else
return result;
@ -211,7 +211,7 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA* expression)
BOOST_RE_GUARD_STACK
if(expression->re_magic == magic_value)
{
delete (regex*)(expression->guts);
delete static_cast<regex*>(expression->guts);
}
expression->re_magic = 0;
}

View File

@ -45,7 +45,7 @@ regbase::regbase(const regbase& b)
} // namespace boost
#if defined(BOOST_RE_USE_VCL) && defined(BOOST_RE_BUILD_DLL)
#if defined(BOOST_RE_USE_VCL) && defined(BOOST_REGEX_BUILD_DLL)
int WINAPI DllEntryPoint(HINSTANCE , unsigned long , void*)
{

View File

@ -24,14 +24,16 @@
#define BOOST_REGEX_SOURCE
#include <boost/regex/config.hpp>
#include <boost/regex/detail/regex_raw_buffer.hpp>
#include <boost/regex.hpp>
#ifdef BOOST_REGEX_DEBUG
#ifdef BOOST_MSVC
#include <crtdbg.h>
#endif
#ifdef BOOST_REGEX_DEBUG
#include <boost/regex/detail/regex_raw_buffer.hpp>
#include <boost/regex.hpp>
#ifndef BOOST_RE_OLD_IOSTREAM
#include <ostream>
#else

View File

@ -31,6 +31,7 @@
#include <boost/regex/regex_traits.hpp>
#include <boost/regex/detail/regex_synch.hpp>
#include <boost/regex/detail/regex_cstring.hpp>
#include <boost/scoped_array.hpp>
#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
@ -165,7 +166,7 @@ unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsig
template <class charT>
unsigned int BOOST_REGEX_CALL get_message(charT* buf, unsigned int len, unsigned int id)
{
unsigned int size = _re_get_message((char*)0, 0, id);
unsigned int size = _re_get_message(static_cast<char*>(0), 0, id);
if(len < size)
return size;
boost::scoped_array<char> cb(new char[size]);
@ -199,7 +200,7 @@ unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsig
const char* BOOST_REGEX_CALL re_get_error_str(unsigned int id)
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
boost::re_detail::cs_guard g(*boost::re_detail::p_re_lock);
#endif
if(re_custom_error_messages[id] == 0)
@ -230,10 +231,17 @@ void BOOST_REGEX_CALL w32_traits_base::do_init()
if(is_init == 0)
{
//
// upadte the messages first:
// update the messages first:
is_init = true;
if(*regex_message_catalogue)
{
hresmod = LoadLibraryA(regex_message_catalogue);
if(hresmod == NULL)
{
std::string s("Unable to open dll: ");
throw std::runtime_error(s + regex_message_catalogue);
}
}
unsigned int i;
for(i = 0; i < REG_E_UNKNOWN; ++i)
{
@ -441,7 +449,7 @@ bool BOOST_REGEX_CALL w32_traits_base::do_lookup_collate(std::string& buf, const
std::string BOOST_REGEX_CALL w32_traits_base::set_message_catalogue(const std::string& l)
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
if(sizeof(regex_message_catalogue) <= l.size())
@ -462,7 +470,7 @@ w32_regex_traits<char> w32_regex_traits<char>::i;
void BOOST_REGEX_CALL w32_regex_traits<char>::update()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
do_init();
@ -471,7 +479,7 @@ void BOOST_REGEX_CALL w32_regex_traits<char>::update()
w32_regex_traits<char>::w32_regex_traits()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::re_init_threads();
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
@ -481,12 +489,12 @@ w32_regex_traits<char>::w32_regex_traits()
w32_regex_traits<char>::~w32_regex_traits()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
if(--entry_count == 0)
do_free();
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
g.acquire(false);
re_detail::re_free_threads();
#endif
@ -570,7 +578,7 @@ bool BOOST_REGEX_CALL w32_regex_traits<wchar_t>::lookup_collatename(std::basic_s
{
BOOST_RE_GUARD_STACK
std::basic_string<wchar_t> s(first, last);
unsigned int len = strnarrow((char*)0, 0, s.c_str());
unsigned int len = strnarrow(static_cast<char*>(0), 0, s.c_str());
scoped_array<char> buf(new char[len]);
strnarrow(buf.get(), len, s.c_str());
std::string t_out;
@ -580,7 +588,7 @@ bool BOOST_REGEX_CALL w32_regex_traits<wchar_t>::lookup_collatename(std::basic_s
{
if(t_out[0])
{
len = strwiden((wchar_t*)0, 0, t_out.c_str());
len = strwiden(static_cast<wchar_t*>(0), 0, t_out.c_str());
scoped_array<wchar_t> wb(new wchar_t[len]);
strwiden(wb.get(), len, t_out.c_str());
out = wb.get();
@ -599,7 +607,7 @@ unsigned int BOOST_REGEX_CALL w32_regex_traits<wchar_t>::syntax_type(size_type c
last = syntax->end();
while(first != last)
{
if((uchar_type)(*first).c == c)
if((size_type)(uchar_type)((*first).c) == c)
return (*first).type;
++first;
}
@ -610,14 +618,14 @@ bool BOOST_REGEX_CALL w32_regex_traits<wchar_t>::do_lookup_collate(std::basic_st
{
BOOST_RE_GUARD_STACK
std::basic_string<wchar_t> s(first, last);
unsigned int len = strnarrow((char*)0, 0, s.c_str());
unsigned int len = strnarrow(static_cast<char*>(0), 0, s.c_str());
scoped_array<char> buf(new char[len]);
strnarrow(buf.get(), len, s.c_str());
std::string t_out;
bool result = base_type::do_lookup_collate(t_out, buf.get());
if(result)
{
len = strwiden((wchar_t*)0, 0, t_out.c_str());
len = strwiden(static_cast<wchar_t*>(0), 0, t_out.c_str());
scoped_array<wchar_t> wb(new wchar_t[len]);
strwiden(wb.get(), len, t_out.c_str());
out = wb.get();
@ -629,7 +637,7 @@ bool BOOST_REGEX_CALL w32_regex_traits<wchar_t>::do_lookup_collate(std::basic_st
void BOOST_REGEX_CALL w32_regex_traits<wchar_t>::update()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
do_init();
@ -638,7 +646,7 @@ void BOOST_REGEX_CALL w32_regex_traits<wchar_t>::update()
w32_regex_traits<wchar_t>::w32_regex_traits()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::re_init_threads();
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
@ -648,12 +656,12 @@ w32_regex_traits<wchar_t>::w32_regex_traits()
w32_regex_traits<wchar_t>::~w32_regex_traits()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
if(--entry_count == 0)
do_free();
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
g.acquire(false);
re_detail::re_free_threads();
#endif
@ -683,7 +691,7 @@ void BOOST_REGEX_CALL w32_regex_traits<wchar_t>::transform(std::basic_string<wch
n = LCMapStringW(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, 0, 0);
else
{
n = strnarrow((char*)0, 0, in.c_str());
n = strnarrow(static_cast<char*>(0), 0, in.c_str());
alt.reset(new char[n+1]);
strnarrow(alt.get(), n+1, in.c_str());
n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, alt.get(), -1, 0, 0);
@ -700,7 +708,7 @@ void BOOST_REGEX_CALL w32_regex_traits<wchar_t>::transform(std::basic_string<wch
// the sort order remains unchanged when we compare.
scoped_array<char> t(new char[n+1]);
if(isPlatformNT)
n = LCMapStringW(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, (wchar_t*)t.get(), n);
n = LCMapStringW(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, reinterpret_cast<wchar_t*>(t.get()), n);
else
n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, alt.get(), -1, t.get(), n);
int i = -1;
@ -773,7 +781,7 @@ int BOOST_REGEX_CALL w32_regex_traits<wchar_t>::toi(const wchar_t*& first, const
boost::uint_fast32_t BOOST_REGEX_CALL w32_regex_traits<wchar_t>::lookup_classname(const wchar_t* first, const wchar_t* last)
{
std::basic_string<wchar_t> s(first, last);
unsigned int len = strnarrow((char*)0, 0, s.c_str());
unsigned int len = strnarrow(static_cast<char*>(0), 0, s.c_str());
scoped_array<char> buf(new char[len]);
strnarrow(buf.get(), len, s.c_str());
len = do_lookup_class(buf.get());
@ -784,7 +792,7 @@ wchar_t BOOST_REGEX_CALL w32_regex_traits<wchar_t>::wtolower(wchar_t c)
{
BOOST_RE_GUARD_STACK
if(isPlatformNT)
return LOWORD(CharLowerW((wchar_t*)(MAKELONG(c, 0))));
return LOWORD(CharLowerW(reinterpret_cast<wchar_t*>(static_cast<unsigned short>(c))));
return c;
}

View File

@ -28,9 +28,7 @@
#include <boost/regex.hpp>
#ifndef BOOST_RE_NO_WCHAR_H
#include <cwchar>
#endif
#include <cstring>
#include <cstdio>
@ -89,9 +87,9 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha
try{
expression->re_magic = wmagic_value;
((wregex*)(expression->guts))->set_expression(ptr, p2, flags);
expression->re_nsub = ((wregex*)(expression->guts))->mark_count() - 1;
result = ((wregex*)(expression->guts))->error_code();
static_cast<wregex*>(expression->guts)->set_expression(ptr, p2, flags);
expression->re_nsub = static_cast<wregex*>(expression->guts)->mark_count() - 1;
result = static_cast<wregex*>(expression->guts)->error_code();
} catch(...)
{
result = REG_E_UNKNOWN;
@ -145,10 +143,10 @@ BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorW(int code, const regex_
regex_traits<wchar_t> rt;
const regex_traits<wchar_t>* pt = &rt;
if(e && (e->re_magic == wmagic_value))
pt = &((wregex*)(e->guts))->get_traits();
pt = &static_cast<wregex*>(e->guts)->get_traits();
(void)pt; // warning suppression
std::string p = pt->error_string(code);
unsigned int len = pt->strwiden((wchar_t*)0, 0, p.c_str());
unsigned int len = pt->strwiden(static_cast<wchar_t*>(0), 0, p.c_str());
if(len < buf_size)
{
pt->strwiden(buf, buf_size, p.c_str());
@ -187,7 +185,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, cons
try{
if(expression->re_magic == wmagic_value)
{
result = regex_search(start, end, m, *(wregex*)(expression->guts), flags);
result = regex_search(start, end, m, *static_cast<wregex*>(expression->guts), flags);
}
else
return result;
@ -221,7 +219,7 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW* expression)
BOOST_RE_GUARD_STACK
if(expression->re_magic == wmagic_value)
{
delete (wregex*)(expression->guts);
delete static_cast<wregex*>(expression->guts);
}
expression->re_magic = 0;
}

View File

@ -20,8 +20,6 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
</td>
<td valign="top"><h3 align="center">Regex++, Regular
Expression Syntax.</h3>
<p align="left"><i>(Version 3.20, 29th Sept 2001)</i>&nbsp;
</p>
<p align="left"><i>Copyright (c) 1998-2001 </i></p>
<p align="left"><i>Dr John Maddock</i></p>
<p align="left"><i>Permission to use, copy, modify,
@ -51,10 +49,10 @@ expression compilation. </p>
<p>All characters are literals except: &quot;.&quot;,
&quot;*&quot;, &quot;?&quot;, &quot;+&quot;, &quot;(&quot;,
&quot;)&quot;, &quot;{&quot;, &quot;}&quot;, &quot;[&quot;,
&quot;]&quot;, &quot;^&quot; and &quot;$&quot;. These characters
are literals when preceded by a &quot;\&quot;. A literal is a
character that matches itself, or matches the result of
traits_type::translate(), where traits_type is the traits
&quot;]&quot;, &quot;^&quot;, &quot;$&quot; and &quot;\&quot;.
These characters are literals when preceded by a &quot;\&quot;. A
literal is a character that matches itself, or matches the result
of traits_type::translate(), where traits_type is the traits
template parameter to class reg_expression. <br>
&nbsp; <br>
&nbsp; </p>

View File

@ -21,8 +21,6 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
</td>
<td valign="top"><h3 align="center"><i>Regex++ template
class reference.</i></h3>
<p align="left"><i>(Version 3.20, 29th Sept 2001)</i>&nbsp;
</p>
<p align="left"><i>Copyright (c) 1998-2001 </i></p>
<p align="left"><i>Dr John Maddock</i></p>
<p align="left"><i>Permission to use, copy, modify,
@ -801,6 +799,15 @@ to the <i>reg_expression</i> template. </p>
<p>The requirements for custom traits classes are <a
href="traits_class_ref.htm">documented separately here....</a> </p>
<p>There is also an example of a custom traits class supplied by <a
href="mailto:christian.engstrom@glindra.org">Christian Engstr<74>m</a>,
see <a
href="example/iso8859_1_regex_traits/iso8859_1_regex_traits.cpp">iso8859_1_regex_traits.cpp</a>
and <a
href="example/iso8859_1_regex_traits/iso8859_1_regex_traits.hpp">iso8859_1_regex_traits.hpp</a>,
see <a href="example/iso8859_1_regex_traits/readme.txt">the
readme file</a> for more details.</p>
<hr>
<h3><a name="reg_match"></a><i>Class match_results</i></h3>
@ -871,7 +878,9 @@ each sub-expression match being contained in an object of type <i>sub_match</i>.
&nbsp;&nbsp; <b>bool</b> <b>operator</b>&lt;(<b>const</b> match_results&amp; that)<b>const</b>;
};
<strong>typedef</strong> match_results&lt;<strong>const</strong> <strong>char</strong>*&gt; cmatch;
<strong>typedef</strong> match_results&lt;<strong>const</strong> <strong>wchar_t</strong>*&gt; wcmatch; </pre>
<strong>typedef</strong> match_results&lt;<strong>const</strong> <strong>wchar_t</strong>*&gt; wcmatch;
<strong>typedef</strong> match_results&lt;std::string::const_iterator&gt; smatch;
<strong>typedef</strong> match_results&lt;std::wstring::const_iterator&gt; wsmatch; </pre>
<p>Class match_results is used for reporting what matched a
regular expression, it is passed to the matching algorithms <a
@ -1128,10 +1137,10 @@ properties. </p>
<p>The algorithm regex _match determines whether a given regular
expression matches a given sequence denoted by a pair of
bidirectional-iterators, the algorithm is defined as follows,
note that the result is true only if the expression matches the
whole of the input sequence, the main use of this function is
data input validation: </p>
bidirectional-iterators, the algorithm is defined as follows, <em>note
that the result is true only if the expression matches the whole
of the input sequence</em>, the main use of this function is data
input validation: </p>
<pre><b>template</b> &lt;<b>class</b> iterator, <b>class</b> Allocator, <b>class</b> charT, <b>class</b> traits, <b>class</b> Allocator2&gt;
<b>bool</b> regex_match(iterator first,&nbsp;
@ -1205,7 +1214,12 @@ return true or false and do not indicate what matched: </p>
will be less than or equal to last. m[1] denotes the
first subexpression m[2] the second subexpression and so
on. If no match occurred then m[0].first = m[0].second =
last.</td>
last.<p>Note that since the match_results structure
stores only iterators, and not strings, the iterators/strings
passed to regex_match must be valid for as long as the
result is to be used. For that reason never pass
temporary string objects to regex_match.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
@ -1456,7 +1470,13 @@ upon your compilers capabilities]: </p>
that matched, m[0].first and m[0].second will be less
than or equal to last. m[1] denotes the first sub-expression
m[2] the second sub-expression and so on. If no match
occurred then m[0].first = m[0].second = last.</td>
occurred then m[0].first = m[0].second = last.<p>Note
that since the match_results structure stores only
iterators, and not strings, the iterators/strings passed
to regex_search must be valid for as long as the result
is to be used. For that reason never pass temporary
string objects to regex_search.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
@ -1985,7 +2005,7 @@ not match are copied to the output unchanged only if the flags
parameter does not have the flag <a href="#format_flags">format_no_copy</a>
set. If the flag <a href="#format_flags">format_first_only</a> is
set then only the first occurance is replaced rather than all
occurances.</p>
occurrences.</p>
<pre><b>template</b> &lt;<b>class</b> OutputIterator, <b>class</b> iterator, <b>class</b> traits, <b>class</b> Allocator, <b>class</b> charT&gt;
OutputIterator regex_merge(OutputIterator out,&nbsp;

View File

@ -1,14 +1,22 @@
subproject libs/regex/test ;
local test-dir = $(BOOST_ROOT)$(SLASH)libs$(SLASH)regex$(SLASH)test$(SLASH)regress$(SLASH) ;
local test-files = $(test-dir)tests.txt
# dwa -- not sure if this is generally applicable
# $(test-dir)test1252.txt
;
unit-test regress : regress/parse.cpp regress/regress.cpp regress/tests.cpp
<lib>../build/libboost_regex$(SUFLIB)
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
$(test-files)
;
unit-test wregress : regress/parse.cpp regress/regress.cpp regress/tests.cpp
@ -17,9 +25,11 @@ unit-test wregress : regress/parse.cpp regress/regress.cpp regress/tests.cpp
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>TEST_UNICODE=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
$(test-files)
;
unit-test posix_api_check_c : c_compiler_checks/posix_api_check.c
@ -27,9 +37,10 @@ unit-test posix_api_check_c : c_compiler_checks/posix_api_check.c
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
;
unit-test wide_posix_api_check_c : c_compiler_checks/wide_posix_api_check.c
@ -37,9 +48,10 @@ unit-test wide_posix_api_check_c : c_compiler_checks/wide_posix_api_check.c
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
;
unit-test posix_api_check : c_compiler_checks/posix_api_check.cpp
@ -47,9 +59,10 @@ unit-test posix_api_check : c_compiler_checks/posix_api_check.cpp
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
;
unit-test wide_posix_api_check : c_compiler_checks/wide_posix_api_check.cpp
@ -57,10 +70,17 @@ unit-test wide_posix_api_check : c_compiler_checks/wide_posix_api_check.cpp
:
<include>../../../
<define>BOOST_REGEX_NO_LIB=1
<define>BOOST_REGEX_STATIC_LINK=1
:
debug
<runtime-link>dynamic
:
;

View File

@ -60,5 +60,7 @@ int main()
}
assert(matches[0].rm_so == matches[0].rm_eo == 1);
regfree(&re);
printf("no errors found\n");
return 0;
}

View File

@ -60,5 +60,7 @@ int main()
}
assert(matches[0].rm_so == matches[0].rm_eo == 1);
regfree(&re);
printf("no errors found\n");
return 0;
}

View File

@ -62,6 +62,8 @@ int main()
}
assert(matches[0].rm_so == matches[0].rm_eo == 1);
regfree(&re);
printf("no errors found\n");
return 0;
}

View File

@ -62,6 +62,8 @@ int main()
}
assert(matches[0].rm_so == matches[0].rm_eo == 1);
regfree(&re);
printf("no errors found\n");
return 0;
}

View File

@ -37,11 +37,16 @@ using namespace boost;
flag_info flag_data[] = {
{ BOOST_RE_STR("REG_BASIC"), 9, REG_BASIC, 0 },
{ BOOST_RE_STR("REG_EXTENDED"), 12, REG_EXTENDED, 0 },
{ BOOST_RE_STR("REG_ESCAPE_IN_LISTS"), 19, REG_ESCAPE_IN_LISTS, 0 },
{ BOOST_RE_STR("REG_ICASE"), 9, REG_ICASE, 0 },
{ BOOST_RE_STR("REG_NOSUB"), 9, REG_NOSUB, 0 },
{ BOOST_RE_STR("REG_NEWLINE"), 11, REG_NEWLINE, 0 },
{ BOOST_RE_STR("REG_NEWLINE"), 11, REG_NEWLINE, 0 },
{ BOOST_RE_STR("REG_NOCOLLATE"), 13, REG_NOCOLLATE, 0 },
{ BOOST_RE_STR("REG_NOSPEC"), 10, REG_NOSPEC, 0 },
{ BOOST_RE_STR("REG_NEWLINE_ALT"), 15, REG_NEWLINE_ALT , 0 },
{ BOOST_RE_STR("REG_PERL"), 8, REG_PERL, 0 },
{ BOOST_RE_STR("REG_AWK"), 7, REG_AWK, 0 },
{ BOOST_RE_STR("REG_EGREP"), 9, REG_EGREP, 0 },
{ BOOST_RE_STR("REG_NOTBOL"), 10, REG_NOTBOL, 1 },
{ BOOST_RE_STR("REG_NOTEOL"), 10, REG_NOTEOL, 1 },

View File

@ -46,6 +46,9 @@ using std::endl;
#if defined(BOOST_MSVC) && defined(_DEBUG)
#include <CRTDBG.H>
#endif
#ifdef TIME_TEST
#include <boost/timer.hpp>
#endif
//
@ -82,6 +85,9 @@ int cpp_main(int argc, char * argv[])
tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
tmpFlag &= ~_CRTDBG_CHECK_CRT_DF;
_CrtSetDbgFlag( tmpFlag );
#endif
#ifdef TIME_TEST
boost::timer tim;
#endif
if(argc < 2)
usage();
@ -113,6 +119,10 @@ int cpp_main(int argc, char * argv[])
}
cout << line << " lines, " << tests << " tests completed in file " << argv[i] << endl;
}
#ifdef TIME_TEST
double elapsed_time = tim.elapsed();
cout << "Elapsed time = " << elapsed_time << "s" << endl;
#endif
return error_count;
}
@ -208,17 +218,23 @@ jm_debug_alloc::jm_debug_alloc()
jm_debug_alloc::jm_debug_alloc(const jm_debug_alloc& d)
{
blocks = d.blocks;
count = d.count;
++(*count);
guard = this;
if(&d != this)
{
blocks = d.blocks;
count = d.count;
++(*count);
guard = this;
}
}
jm_debug_alloc& jm_debug_alloc::operator=(const jm_debug_alloc& d)
{
free_();
blocks = d.blocks;
count = d.count;
++(*count);
if(&d != this)
{
free_();
blocks = d.blocks;
count = d.count;
++(*count);
}
return *this;
}

View File

@ -365,7 +365,7 @@ void cpp_tests(const reg_expression<C, T, A>& e, bool recurse = true)
}
}
}
if((false == recurse) && (matches[0] == 0) && (matches[1] == search_text.size()))
if((false == recurse) && (matches[0] == 0) && (matches[1] == static_cast<int>(search_text.size())))
{
//
// match expected on whole string, so all versions

View File

@ -503,8 +503,10 @@ a(b+|((c)*))+d abcd 0 4 2 3 2 3 2 3
'([^\\']|\\.)*' '\\n' 0 4 1 3
; now try and test some unicode specific characters:
- match_default normal REG_EXTENDED REG_UNICODE_ONLY
- match_default normal REG_PERL REG_UNICODE_ONLY
[[:unicode:]]+ a\0300\0400z 1 3
[\x10-\xff] \39135\12409 -1 -1
[\01-\05]{5} \36865\36865\36865\36865\36865 -1 -1
; finally try some case insensitive matches:
- match_default normal REG_EXTENDED REG_ICASE
@ -867,16 +869,34 @@ a+(?#b+)b+ xaaabbba 1 7
(xyz)(.*)abc xyz -1 -1 0 3 3 3
(xyz)(.*)abc xy -1 -1 -1 -1 -1 -1
;
; forward lookahead asserts added 21/01/02
- match_default normal REG_EXTENDED REG_NO_POSIX_TEST
((?:(?!a|b)\w)+)(\w+) " xxxabaxxx " 2 11 2 5 5 11
/\*(?:(?!\*/).)*\*/ " /**/ " 2 6
/\*(?:(?!\*/).)*\*/ " /***/ " 2 7
/\*(?:(?!\*/).)*\*/ " /********/ " 2 12
/\*(?:(?!\*/).)*\*/ " /* comment */ " 2 15
<\s*a[^>]*>((?:(?!<\s*/\s*a\s*>).)*)<\s*/\s*a\s*> " <a href=\"here\">here</a> " 1 24 16 20
<\s*a[^>]*>((?:(?!<\s*/\s*a\s*>).)*)<\s*/\s*a\s*> " <a href=\"here\">here< / a > " 1 28 16 20
<\s*a[^>]*>((?:(?!<\s*/\s*a\s*>).)*)(?=<\s*/\s*a\s*>) " <a href=\"here\">here</a> " 1 20 16 20
<\s*a[^>]*>((?:(?!<\s*/\s*a\s*>).)*)(?=<\s*/\s*a\s*>) " <a href=\"here\">here< / a > " 1 20 16 20
; filename matching:
^(?!^(?:PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(?:\..+)?$)[^\x00-\x1f\\?*:\"|/]+$ command.com 0 11
^(?!^(?:PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(?:\..+)?$)[^\x00-\x1f\\?*:\"|/]+$ PRN -1 -1
^(?!^(?:PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(?:\..+)?$)[^\x00-\x1f\\?*:\"|/]+$ COM2 -1 -1
; password checking:
^(?=.*\d).{4,8}$ abc3 0 4
^(?=.*\d).{4,8}$ abc3def4 0 8
^(?=.*\d).{4,8}$ ab2 -1 -1
^(?=.*\d).{4,8}$ abcdefg -1 -1
^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$ abc3 -1 -1
^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$ abC3 0 4
^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$ ABCD3 -1 -1

View File

@ -22,53 +22,40 @@ CFLAGS= $(INCLUDES) /Oityb1 /GF /Gy -GX -GR -I..\..\..\..\ $(CXXFLAGS)
LFLAGS= -link /LIBPATH:..\..\build\vc6-stlport user32.lib $(XLFLAGS)
all :: r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1ls.exe r2ls.exe r3ls.exe r4ls.exe r5ls.exe r6ls.exe r1md.exe r2md.exe r3md.exe r4md.exe r5md.exe r6md.exe r1lmd.exe r2lmd.exe r3lmd.exe r4lmd.exe r5lmd.exe r6lmd.exe r1mdd.exe r2mdd.exe r3mdd.exe r4mdd.exe r5mdd.exe r6mdd.exe r1lmdd.exe r2lmdd.exe r3lmdd.exe
all :: r1m.exe r2m.exe r4m.exe r5m.exe r1l.exe r2l.exe r4l.exe r5l.exe r1ls.exe r2ls.exe r4ls.exe r5ls.exe r1md.exe r2md.exe r4md.exe r5md.exe r1lmd.exe r2lmd.exe r4lmd.exe r5lmd.exe r1mdd.exe r2mdd.exe r4mdd.exe r5mdd.exe r1lmdd.exe r2lmdd.exe
echo testing static multi-threaded version....
r1m tests.txt test1252.txt
r2m tests.txt
r3m tests.txt
r4m tests.txt test1252.txt
r5m tests.txt
r6m tests.txt
echo testing DLL version....
r1l tests.txt test1252.txt
r2l tests.txt
r3l tests.txt
r4l tests.txt test1252.txt
r5l tests.txt
r6l tests.txt
echo testing static version with dll runtime....
r1ls tests.txt test1252.txt
r2ls tests.txt
r3ls tests.txt
r4ls tests.txt test1252.txt
r5ls tests.txt
r6ls tests.txt
echo testing static multi-threaded debug version....
r1md tests.txt test1252.txt
r2md tests.txt
r3md tests.txt
r4md tests.txt test1252.txt
r5md tests.txt
r6md tests.txt
echo testing dll debug version....
r1lmd tests.txt test1252.txt
r2lmd tests.txt
r3lmd tests.txt
r4lmd tests.txt test1252.txt
r5lmd tests.txt
r6lmd tests.txt
echo testing static multi-threaded stl-debug version....
r1mdd tests.txt test1252.txt
r2mdd tests.txt
r3mdd tests.txt
r4mdd tests.txt test1252.txt
r5mdd tests.txt
r6mdd tests.txt
echo testing dll stl-debug version....
r1lmdd tests.txt test1252.txt
r2lmdd tests.txt
r3lmdd tests.txt
r1m.exe : tests.cpp parse.cpp regress.cpp
@ -165,40 +152,41 @@ r6lmd.exe : tests.cpp parse.cpp regress.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r6lmd.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
r1lmdd.exe : tests.cpp parse.cpp regress.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r1lmdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r1lmdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
r2lmdd.exe : tests.cpp parse.cpp regress.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r2lmdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r2lmdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
r3lmdd.exe : tests.cpp parse.cpp regress.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r3lmdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r3lmdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
r4lmdd.exe : tests.cpp parse.cpp regress.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r4lmdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r4lmdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
r5lmdd.exe : tests.cpp parse.cpp regress.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r5lmdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r5lmdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
r6lmdd.exe : tests.cpp parse.cpp regress.cpp
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r6lmdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r6lmdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
r1mdd.exe : tests.cpp parse.cpp regress.cpp
cl /MTd /D_MT $(CFLAGS) -o r1mdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MTd /D_MT $(CFLAGS) -o r1mdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
r2mdd.exe : tests.cpp parse.cpp regress.cpp
cl /MTd /D_MT $(CFLAGS) -o r2mdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MTd /D_MT $(CFLAGS) -o r2mdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
r3mdd.exe : tests.cpp parse.cpp regress.cpp
cl /MTd /D_MT $(CFLAGS) -o r3mdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MTd /D_MT $(CFLAGS) -o r3mdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
r4mdd.exe : tests.cpp parse.cpp regress.cpp
cl /MTd /D_MT $(CFLAGS) -o r4mdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MTd /D_MT $(CFLAGS) -o r4mdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
r5mdd.exe : tests.cpp parse.cpp regress.cpp
cl /MTd /D_MT $(CFLAGS) -o r5mdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MTd /D_MT $(CFLAGS) -o r5mdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
r6mdd.exe : tests.cpp parse.cpp regress.cpp
cl /MTd /D_MT $(CFLAGS) -o r6mdd.exe -D__STL_DEBUG -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
cl /MTd /D_MT $(CFLAGS) -o r6mdd.exe -D__STL_DEBUG /D_STLP_DEBUG -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)

View File

@ -20,8 +20,6 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
</td>
<td valign="top"><h3 align="center">Regex++, Traits Class
Reference. </h3>
<p align="left"><i>(Version 3.20, 29th Sept 2001)</i>&nbsp;
</p>
<p align="left"><i>Copyright (c) 1998-2001 </i></p>
<p align="left"><i>Dr John Maddock</i></p>
<p align="left"><i>Permission to use, copy, modify,
@ -996,12 +994,23 @@ class does not contain instance data:<br>
</tr>
</table>
<p><a name="intro"></a><br>
<p>There is also an example of a custom traits class supplied by <a
href="mailto:christian.engstrom@glindra.org">Christian Engstr<74>m</a>,
see <a
href="example/iso8859_1_regex_traits/iso8859_1_regex_traits.cpp">iso8859_1_regex_traits.cpp</a>
and <a
href="example/iso8859_1_regex_traits/iso8859_1_regex_traits.hpp">iso8859_1_regex_traits.hpp</a>.
This example inherits from c_regex_traits and provides it's own
implementations of two locale specific functions. This ensures
that the class gives consistent behaviour (albeit tied to one
locale) on all platforms. A fuller desciption by the author is
available in the <a
href="example/iso8859_1_regex_traits/readme.txt">readme file</a>.<br>
</p>
<hr>
<p><i>Copyright</i> <a href="mailto:John_Maddock@compuserve.com"><i>Dr
John Maddock</i></a> <i>1998-2000 all rights reserved.</i> </p>
John Maddock</i></a> <i>1998-2001 all rights reserved.</i> </p>
</body>
</html>