From 58a583664298876013604422673a4bec6f17546d Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 26 Sep 2000 11:48:28 +0000 Subject: [PATCH] Initial boost-regex++ release [SVN r7845] --- .gitattributes | 96 + appendix.htm | 1937 ++++++++ c++boost.gif | Bin 0 -> 1875 bytes changes.txt | 213 + clean | 55 + compiler_tests | 124 + configure | 4148 +++++++++++++++++ configure.in | 1747 +++++++ .../posix_api_compiler_check.c | 64 + .../wide_posix_api_compiler_check.c | 67 + demo/jgrep/bc55.mak | 49 + demo/jgrep/bcb4.mak | 49 + demo/jgrep/bcb5.mak | 47 + demo/jgrep/gcc.mak | 27 + demo/jgrep/jgrep.cpp | 126 + demo/jgrep/jgrep.h | 53 + demo/jgrep/main.cpp | 284 ++ demo/jgrep/makefile.in | 41 + demo/jgrep/sunpro.mak | 20 + demo/jgrep/vc6-stlport.mak | 16 + demo/jgrep/vc6.mak | 15 + demo/regress/bc55.mak | 127 + demo/regress/bcb4.mak | 179 + demo/regress/bcb5.mak | 179 + demo/regress/egcs.mak | 50 + demo/regress/gcc.mak | 50 + demo/regress/makefile.in | 78 + demo/regress/out.txt | 342 ++ demo/regress/parse.cpp | 326 ++ demo/regress/r1.cpp | 24 + demo/regress/r1lm.cpp | 24 + demo/regress/r2.cpp | 28 + demo/regress/r3.cpp | 26 + demo/regress/r4.cpp | 26 + demo/regress/r5.cpp | 27 + demo/regress/r6.cpp | 27 + demo/regress/regress.cpp | 246 + demo/regress/regress.h | 325 ++ demo/regress/sunpro.mak | 28 + demo/regress/test1252.txt | 32 + demo/regress/tests.cpp | 729 +++ demo/regress/tests.txt | 857 ++++ demo/regress/vc6-stlport.mak | 125 + demo/regress/vc6.mak | 173 + demo/snippets/snip1.cpp | 99 + demo/snippets/snip10.cpp | 45 + demo/snippets/snip2.cpp | 105 + demo/snippets/snip3.cpp | 106 + demo/snippets/snip4.cpp | 130 + demo/snippets/snip5.cpp | 98 + demo/snippets/snip6.cpp | 117 + demo/snippets/snip7.cpp | 120 + demo/snippets/snip8.cpp | 73 + demo/snippets/snip9.cpp | 84 + demo/timer/bc55.mak | 43 + demo/timer/bcb4.mak | 43 + demo/timer/bcb5.mak | 43 + demo/timer/gcc.mak | 33 + demo/timer/makefile.in | 37 + demo/timer/regex_timer.cpp | 322 ++ demo/timer/sunpro.mak | 23 + demo/timer/vc6-stlport.mak | 30 + demo/timer/vc6.mak | 29 + dmi.sh | 14 + faq.htm | 141 + format_string.htm | 202 + hl_ref.htm | 548 +++ include/boost/cregex.hpp | 302 ++ include/boost/pattern_except.hpp | 61 + include/boost/re_detail/fileiter.hpp | 416 ++ include/boost/re_detail/regex_compile.hpp | 2005 ++++++++ include/boost/re_detail/regex_config.hpp | 1205 +++++ include/boost/re_detail/regex_cstring.hpp | 138 + include/boost/re_detail/regex_format.hpp | 574 +++ include/boost/re_detail/regex_kmp.hpp | 118 + .../boost/re_detail/regex_library_include.hpp | 147 + include/boost/re_detail/regex_match.hpp | 1796 +++++++ include/boost/re_detail/regex_options.hpp | 467 ++ include/boost/re_detail/regex_raw_buffer.hpp | 251 + include/boost/re_detail/regex_split.hpp | 154 + include/boost/re_detail/regex_stack.hpp | 229 + include/boost/re_detail/regex_synch.hpp | 181 + include/boost/regex.h | 95 + include/boost/regex.hpp | 1462 ++++++ include/boost/regex_traits.hpp | 786 ++++ index.htm | 117 + introduction.htm | 416 ++ jm_opt.in | 467 ++ lib/bc55.mak | 347 ++ lib/bcb4.mak | 500 ++ lib/bcb5.mak | 500 ++ lib/gcc.mak | 132 + lib/makefile.in | 74 + lib/makefile.org | 18 + lib/sunpro.mak | 76 + lib/vc6-stlport.mak | 248 + lib/vc6.mak | 351 ++ licence.txt | 19 + makefile.in | 28 + makefile_gen | 610 +++ old_include/cregex | 3 + old_include/cregex.h | 134 + old_include/fileiter.h | 25 + old_include/regex | 3 + old_include/regex.h | 481 ++ old_include/tests/snip1.cpp | 62 + old_include/tests/snip2.cpp | 69 + old_include/tests/snip3.cpp | 70 + old_include/tests/snip4.cpp | 90 + old_include/tests/snip5.cpp | 36 + old_include/tests/snip6.cpp | 85 + old_include/tests/snip7.cpp | 87 + posix_ref.htm | 277 ++ readme.txt | 24 + src/c_regex_traits.cpp | 1022 ++++ src/c_regex_traits_common.cpp | 550 +++ src/cpp_regex_traits.cpp | 793 ++++ src/cregex.cpp | 592 +++ src/fileiter.cpp | 832 ++++ src/posix_api.cpp | 220 + src/primary_transform.hpp | 118 + src/regex.cpp | 59 + src/regex_debug.cpp | 198 + src/regex_synch.cpp | 64 + src/w32_regex_traits.cpp | 1065 +++++ src/wide_posix_api.cpp | 247 + syntax.htm | 787 ++++ template_class_ref.htm | 2271 +++++++++ traits_class_ref.htm | 871 ++++ 129 files changed, 41116 insertions(+) create mode 100644 .gitattributes create mode 100644 appendix.htm create mode 100644 c++boost.gif create mode 100644 changes.txt create mode 100644 clean create mode 100644 compiler_tests create mode 100644 configure create mode 100644 configure.in create mode 100644 demo/c_compiler_checks/posix_api_compiler_check.c create mode 100644 demo/c_compiler_checks/wide_posix_api_compiler_check.c create mode 100644 demo/jgrep/bc55.mak create mode 100644 demo/jgrep/bcb4.mak create mode 100644 demo/jgrep/bcb5.mak create mode 100644 demo/jgrep/gcc.mak create mode 100644 demo/jgrep/jgrep.cpp create mode 100644 demo/jgrep/jgrep.h create mode 100644 demo/jgrep/main.cpp create mode 100644 demo/jgrep/makefile.in create mode 100644 demo/jgrep/sunpro.mak create mode 100644 demo/jgrep/vc6-stlport.mak create mode 100644 demo/jgrep/vc6.mak create mode 100644 demo/regress/bc55.mak create mode 100644 demo/regress/bcb4.mak create mode 100644 demo/regress/bcb5.mak create mode 100644 demo/regress/egcs.mak create mode 100644 demo/regress/gcc.mak create mode 100644 demo/regress/makefile.in create mode 100644 demo/regress/out.txt create mode 100644 demo/regress/parse.cpp create mode 100644 demo/regress/r1.cpp create mode 100644 demo/regress/r1lm.cpp create mode 100644 demo/regress/r2.cpp create mode 100644 demo/regress/r3.cpp create mode 100644 demo/regress/r4.cpp create mode 100644 demo/regress/r5.cpp create mode 100644 demo/regress/r6.cpp create mode 100644 demo/regress/regress.cpp create mode 100644 demo/regress/regress.h create mode 100644 demo/regress/sunpro.mak create mode 100644 demo/regress/test1252.txt create mode 100644 demo/regress/tests.cpp create mode 100644 demo/regress/tests.txt create mode 100644 demo/regress/vc6-stlport.mak create mode 100644 demo/regress/vc6.mak create mode 100644 demo/snippets/snip1.cpp create mode 100644 demo/snippets/snip10.cpp create mode 100644 demo/snippets/snip2.cpp create mode 100644 demo/snippets/snip3.cpp create mode 100644 demo/snippets/snip4.cpp create mode 100644 demo/snippets/snip5.cpp create mode 100644 demo/snippets/snip6.cpp create mode 100644 demo/snippets/snip7.cpp create mode 100644 demo/snippets/snip8.cpp create mode 100644 demo/snippets/snip9.cpp create mode 100644 demo/timer/bc55.mak create mode 100644 demo/timer/bcb4.mak create mode 100644 demo/timer/bcb5.mak create mode 100644 demo/timer/gcc.mak create mode 100644 demo/timer/makefile.in create mode 100644 demo/timer/regex_timer.cpp create mode 100644 demo/timer/sunpro.mak create mode 100644 demo/timer/vc6-stlport.mak create mode 100644 demo/timer/vc6.mak create mode 100644 dmi.sh create mode 100644 faq.htm create mode 100644 format_string.htm create mode 100644 hl_ref.htm create mode 100644 include/boost/cregex.hpp create mode 100644 include/boost/pattern_except.hpp create mode 100644 include/boost/re_detail/fileiter.hpp create mode 100644 include/boost/re_detail/regex_compile.hpp create mode 100644 include/boost/re_detail/regex_config.hpp create mode 100644 include/boost/re_detail/regex_cstring.hpp create mode 100644 include/boost/re_detail/regex_format.hpp create mode 100644 include/boost/re_detail/regex_kmp.hpp create mode 100644 include/boost/re_detail/regex_library_include.hpp create mode 100644 include/boost/re_detail/regex_match.hpp create mode 100644 include/boost/re_detail/regex_options.hpp create mode 100644 include/boost/re_detail/regex_raw_buffer.hpp create mode 100644 include/boost/re_detail/regex_split.hpp create mode 100644 include/boost/re_detail/regex_stack.hpp create mode 100644 include/boost/re_detail/regex_synch.hpp create mode 100644 include/boost/regex.h create mode 100644 include/boost/regex.hpp create mode 100644 include/boost/regex_traits.hpp create mode 100644 index.htm create mode 100644 introduction.htm create mode 100644 jm_opt.in create mode 100644 lib/bc55.mak create mode 100644 lib/bcb4.mak create mode 100644 lib/bcb5.mak create mode 100644 lib/gcc.mak create mode 100644 lib/makefile.in create mode 100644 lib/makefile.org create mode 100644 lib/sunpro.mak create mode 100644 lib/vc6-stlport.mak create mode 100644 lib/vc6.mak create mode 100644 licence.txt create mode 100644 makefile.in create mode 100644 makefile_gen create mode 100644 old_include/cregex create mode 100644 old_include/cregex.h create mode 100644 old_include/fileiter.h create mode 100644 old_include/regex create mode 100644 old_include/regex.h create mode 100644 old_include/tests/snip1.cpp create mode 100644 old_include/tests/snip2.cpp create mode 100644 old_include/tests/snip3.cpp create mode 100644 old_include/tests/snip4.cpp create mode 100644 old_include/tests/snip5.cpp create mode 100644 old_include/tests/snip6.cpp create mode 100644 old_include/tests/snip7.cpp create mode 100644 posix_ref.htm create mode 100644 readme.txt create mode 100644 src/c_regex_traits.cpp create mode 100644 src/c_regex_traits_common.cpp create mode 100644 src/cpp_regex_traits.cpp create mode 100644 src/cregex.cpp create mode 100644 src/fileiter.cpp create mode 100644 src/posix_api.cpp create mode 100644 src/primary_transform.hpp create mode 100644 src/regex.cpp create mode 100644 src/regex_debug.cpp create mode 100644 src/regex_synch.cpp create mode 100644 src/w32_regex_traits.cpp create mode 100644 src/wide_posix_api.cpp create mode 100644 syntax.htm create mode 100644 template_class_ref.htm create mode 100644 traits_class_ref.htm diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..3e84d7c7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,96 @@ +* text=auto !eol svneol=native#text/plain +*.gitattributes text svneol=native#text/plain + +# Scriptish formats +*.bat text svneol=native#text/plain +*.bsh text svneol=native#text/x-beanshell +*.cgi text svneol=native#text/plain +*.cmd text svneol=native#text/plain +*.js text svneol=native#text/javascript +*.php text svneol=native#text/x-php +*.pl text svneol=native#text/x-perl +*.pm text svneol=native#text/x-perl +*.py text svneol=native#text/x-python +*.sh eol=lf svneol=LF#text/x-sh +configure eol=lf svneol=LF#text/x-sh + +# Image formats +*.bmp binary svneol=unset#image/bmp +*.gif binary svneol=unset#image/gif +*.ico binary svneol=unset#image/ico +*.jpeg binary svneol=unset#image/jpeg +*.jpg binary svneol=unset#image/jpeg +*.png binary svneol=unset#image/png +*.tif binary svneol=unset#image/tiff +*.tiff binary svneol=unset#image/tiff +*.svg text svneol=native#image/svg%2Bxml + +# Data formats +*.pdf binary svneol=unset#application/pdf +*.avi binary svneol=unset#video/avi +*.doc binary svneol=unset#application/msword +*.dsp text svneol=crlf#text/plain +*.dsw text svneol=crlf#text/plain +*.eps binary svneol=unset#application/postscript +*.gz binary svneol=unset#application/gzip +*.mov binary svneol=unset#video/quicktime +*.mp3 binary svneol=unset#audio/mpeg +*.ppt binary svneol=unset#application/vnd.ms-powerpoint +*.ps binary svneol=unset#application/postscript +*.psd binary svneol=unset#application/photoshop +*.rdf binary svneol=unset#text/rdf +*.rss text svneol=unset#text/xml +*.rtf binary svneol=unset#text/rtf +*.sln text svneol=native#text/plain +*.swf binary svneol=unset#application/x-shockwave-flash +*.tgz binary svneol=unset#application/gzip +*.vcproj text svneol=native#text/xml +*.vcxproj text svneol=native#text/xml +*.vsprops text svneol=native#text/xml +*.wav binary svneol=unset#audio/wav +*.xls binary svneol=unset#application/vnd.ms-excel +*.zip binary svneol=unset#application/zip + +# Text formats +.htaccess text svneol=native#text/plain +*.bbk text svneol=native#text/xml +*.cmake text svneol=native#text/plain +*.css text svneol=native#text/css +*.dtd text svneol=native#text/xml +*.htm text svneol=native#text/html +*.html text svneol=native#text/html +*.ini text svneol=native#text/plain +*.log text svneol=native#text/plain +*.mak text svneol=native#text/plain +*.qbk text svneol=native#text/plain +*.rst text svneol=native#text/plain +*.sql text svneol=native#text/x-sql +*.txt text svneol=native#text/plain +*.xhtml text svneol=native#text/xhtml%2Bxml +*.xml text svneol=native#text/xml +*.xsd text svneol=native#text/xml +*.xsl text svneol=native#text/xml +*.xslt text svneol=native#text/xml +*.xul text svneol=native#text/xul +*.yml text svneol=native#text/plain +boost-no-inspect text svneol=native#text/plain +CHANGES text svneol=native#text/plain +COPYING text svneol=native#text/plain +INSTALL text svneol=native#text/plain +Jamfile text svneol=native#text/plain +Jamroot text svneol=native#text/plain +Jamfile.v2 text svneol=native#text/plain +Jamrules text svneol=native#text/plain +Makefile* text svneol=native#text/plain +README text svneol=native#text/plain +TODO text svneol=native#text/plain + +# Code formats +*.c text svneol=native#text/plain +*.cpp text svneol=native#text/plain +*.h text svneol=native#text/plain +*.hpp text svneol=native#text/plain +*.ipp text svneol=native#text/plain +*.tpp text svneol=native#text/plain +*.jam text svneol=native#text/plain +*.java text svneol=native#text/plain diff --git a/appendix.htm b/appendix.htm new file mode 100644 index 00000000..3cbd9db9 --- /dev/null +++ b/appendix.htm @@ -0,0 +1,1937 @@ + + + + + + + + +Regex++, Appendices + + + +  + + + + +

+C++ Boost

+
+

Regex++, Appendices.

+
+
+(version 3.01, 18 April 2000) +
+
Copyright (c) 1998-2000
+Dr John Maddock
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Dr John Maddock makes no representations
+about the suitability of this software for any purpose.  
+It is provided "as is" without express or implied warranty.
+ +
+
+

Appendix 1: Implementation notes

+This is the first port of regex++ to the boost library, and is based on regex++ +2.x, see changes.txt for a full list of changes from the previous version. +There are no known functionality bugs except that POSIX style equivalence +classes are only guaranteed correct if the Win32 localization model is used +(the default for Win32 builds of the library).

There are some aspects of the +code that C++ puritans will consider to be poor style, in particular the use of +goto in some of the algorithms. The code could be cleaned up, by changing to a +recursive implementation, although it is likely to be slower in that case.

+

The performance of the algorithms should be satisfactory in most cases. For +example the times taken to match the ftp response expression +"^([0-9]+)(\-| |$)(.*)$" against the string "100- this is a line +of ftp response which contains a message string" are: BSD implementation +450 micro seconds, GNU implementation 271 micro seconds, regex++ 127 micro +seconds (Pentium P90, Win32 console app under MS Windows 95).

+

However it should be noted that there are some "pathological" +expressions which may require exponential time for matching; these all involve +nested repetition operators, for example attempting to match the expression +"(a*a)*b" against N letter a's requires time proportional to +2N. These expressions can (almost) always be rewritten in +such a way as to avoid the problem, for example "(a*a)*b" could be +rewritten as "a*b" which requires only time linearly proportional to +N to solve. In the general case, non-nested repeat expressions require +time proportional to N2, however if the clauses are mutually +exclusive then they can be matched in linear time - this is the case with +"a*b", for each character the matcher will either match an +"a" or a "b" or fail, where as with "a*a" the +matcher can't tell which branch to take (the first "a" or the second) +and so has to try both. Be careful how you write your regular expressions +and avoid nested repeats if you can! New to this version, some previously +pathological cases have been fixed - in particular searching for expressions +which contain leading repeats and/or leading literal strings should be much +faster than before. Literal strings are now searched for using the +Knuth/Morris/Pratt algorithm (this is used in preference to the Boyer/More +algorithm because it allows the tracking of newline characters).

+

Some aspects of the POSIX regular expression syntax are implementation +defined:

+ +
+

Appendix 2: Thread safety

+Class reg_expression<> and its typedefs regex and wregex are thread safe, +in that compiled regular expressions can safely be shared between threads. The +matching algorithms regex_match, regex_search, regex_grep, regex_format and +regex_merge are all re-entrant and thread safe. Class match_results is now +thread safe, in that the results of a match can be safely copied from one +thread to another (for example one thread may find matches and push +match_results instances onto a queue, while another thread pops them off the +other end), otherwise use a separate instance of match_results per thread. +

The POSIX API functions are all re-entrant and thread safe, regular +expressions compiled with regcomp can also be shared between threads. +

+

The class RegEx is only thread safe if each thread gets its own RegEx +instance (apartment threading) - this is a consequence of RegEx handling both +compiling and matching regular expressions.

+

Finally note that changing the global locale invalidates all compiled +regular expressions, therefore calling set_locale from one thread while +another uses regular expressions will produce unpredictable results. +

+

There is also a requirement that there is only one thread executing prior to +the start of main().
+

+
+

Appendix 3: Localization

+ Regex++ provides extensive support for run-time localization, the +localization model used can be split into two parts: front-end and back-end. +

Front-end localization deals with everything which the user sees - error +messages, and the regular expression syntax itself. For example a French +application could change [[:word:]] to [[:mot:]] and \w to \m. Modifying the +front end locale requires active support from the developer, by providing the +library with a message catalogue to load, containing the localized strings. +Front-end locale is affected by the LC_MESSAGES category only.

+

Back-end localization deals with everything that occurs after the expression +has been parsed - in other words everything that the user does not see or +interact with directly. It deals with case conversion, collation, and character +class membership. The back-end locale does not require any intervention from +the developer - the library will acquire all the information it requires for +the current locale from the underlying operating system / run time library. +This means that if the program user does not interact with regular expressions +directly - for example if the expressions are embedded in your C++ code - then +no explicit localization is required, as the library will take care of +everything for you. For example embedding the expression [[:word:]]+ in your +code will always match a whole word, if the program is run on a machine with, +for example, a Greek locale, then it will still match a whole word, but in +Greek characters rather than Latin ones. The back-end locale is affected by the +LC_TYPE and LC_COLLATE categories.

+

There are three separate localization mechanisms supported by regex++:

+

Win32 localization model.

+

This is the default model when the library is compiled under Win32, and is +encapsulated by the traits class +w32_regex_traits. When +this model is in effect there is a single global locale as defined by the +user's control panel settings, and returned by GetUserDefaultLCID. All the +settings used by regex++ are acquired directly from the operating system +bypassing the C run time library. Front-end localization requires a resource +dll, containing a string table with the user-defined strings. The traits class +exports the function:

+

static std::string set_message_catalogue(const std::string& s);

+

which needs to be called with a string identifying the name of the resource +dll, before your code compiles any regular expressions (but not +necessarily before you construct any reg_expression instances):

+

boost::w32_regex_traits<char>::set_message_calalogue("mydll.dll"); +

+

Note that this API sets the dll name for both the narrow and wide +character specializations of w32_regex_traits.

+

This model does not currently support thread specific locales (via +SetThreadLocale under Windows NT), the library provides full Unicode support +under NT, under Windows 9x the library degrades gracefully - characters 0 to +255 are supported, the remainder are treated as "unknown" graphic +characters.

+

C localization model.

+

This is the default model when the library is compiled under an operating +system other than Win32, and is encapsulated by the traits class c_regex_traits, Win32 +users can force this model to take effect by defining the pre-processor symbol +BOOST_RE_LOCALE_C. When this model is in effect there is a single global +locale, as set by setlocale. All settings are acquired from your run +time library, consequently Unicode support is dependent upon your run time +library implementation. Front end localization requires a POSIX message +catalogue. The traits class exports the function:

+

static std::string set_message_catalogue(const std::string& s);

+

which needs to be called with a string identifying the name of the message +catalogue, before your code compiles any regular expressions (but not +necessarily before you construct any reg_expression instances):

+

boost::c_regex_traits<char>::set_message_calalogue("mycatalogue"); +

+

Note that this API sets the dll name for both the narrow and wide +character specializations of c_regex_traits. If your run time library does not +support POSIX message catalogues, then you can either provide your own +implementation of <nl_types.h> or define BOOST_RE_NO_CAT to disable +front-end localization via message catalogues.

+

Note that calling setlocale invalidates all compiled regular +expressions, calling setlocale(LC_ALL, "C") will make this +library behave equivalent to most traditional regular expression libraries +including version 1 of this library.

+

C++ localization model.

+

This model is only in effect if the library is built with the pre-processor +symbol BOOST_RE_LOCALE_CPP defined. When this model is in effect each instance +of reg_expression<> has its own instance of std::locale, class +reg_expression<> also has a member function imbue which allows the +locale for the expression to be set on a per-instance basis. Front end +localization requires a POSIX message catalogue, which will be loaded via the +std::messages facet of the expression's locale, the traits class exports the +symbol:

+

static std::string set_message_catalogue(const std::string& s);

+

which needs to be called with a string identifying the name of the message +catalogue, before your code compiles any regular expressions (but not +necessarily before you construct any reg_expression instances):

+

boost::cpp_regex_traits<char>::set_message_calalogue("mycatalogue"); +

+

Note that calling reg_expression<>::imbue will invalidate any +expression currently compiled in that instance of reg_expression<>. This +model is the one which closest fits the ethos of the C++ standard library, +however it is the model which will produce the slowest code, and which is the +least well supported by current standard library implementations, for example I +have yet to find an implementation of std::locale which supports either message +catalogues, or locales other than "C" or "POSIX".

+

Finally note that if you build the library with a non-default localization +model, then the appropriate pre-processor symbol (BOOST_RE_LOCALE_C or +BOOST_RE_LOCALE_CPP) must be defined both when you build the support library, +and when you include <boost/regex.hpp> or <boost/cregex.hpp> in +your code. The best way to ensure this is to add the #define to +<boost/re_detail/jm_opt.h>.

+

Providing a message catalogue:

+

In order to localize the front end of the library, you need to provide the +library with the appropriate message strings contained either in a resource +dll's string table (Win32 model), or a POSIX message catalogue (C or C++ +models). In the latter case the messages must appear in message set zero of the +catalogue. The messages and their id's are as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+Message id +
+
+Meaning +
+
+Default value +
+
 
 
+101 +
+
+The character used to start a sub-expression. +
+
+"(" +
+
 
 
+102 +
+
+The character used to end a sub-expression declaration. +
+
+")" +
+
 
 
+103 +
+
+The character used to denote an end of line assertion. +
+
+"$" +
+
 
 
+104 +
+
+The character used to denote the start of line assertion. +
+
+"^" +
+
 
 
+105 +
+
+The character used to denote the "match any character expression". +
+
+"." +
+
 
 
+106 +
+
+The match zero or more times repetition operator. +
+
+"*" +
+
 
 
+107 +
+
+The match one or more repetition operator. +
+
+"+" +
+
 
 
+108 +
+
+The match zero or one repetition operator. +
+
+"?" +
+
 
 
+109 +
+
+The character set opening character. +
+
+"[" +
+
 
 
+110 +
+
+The character set closing character. +
+
+"]" +
+
 
 
+111 +
+
+The alternation operator. +
+
+"|" +
+
 
 
+112 +
+
+The escape character. +
+
+"\\" +
+
 
 
+113 +
+
+The hash character (not currently used). +
+
+"#" +
+
 
 
+114 +
+
+The range operator. +
+
+"-" +
+
 
 
+115 +
+
+The repetition operator opening character. +
+
+"{" +
+
 
 
+116 +
+
+The repetition operator closing character. +
+
+"}" +
+
 
 
+117 +
+
+The digit characters. +
+
+"0123456789" +
+
 
 
+118 +
+
+The character which when preceded by an escape character represents the word +boundary assertion. +
+
+"b" +
+
 
 
+119 +
+
+The character which when preceded by an escape character represents the +non-word boundary assertion. +
+
+"B" +
+
 
 
+120 +
+
+The character which when preceded by an escape character represents the +word-start boundary assertion. +
+
+"<" +
+
 
 
+121 +
+
+The character which when preceded by an escape character represents the +word-end boundary assertion. +
+
+">" +
+
 
 
+122 +
+
+The character which when preceded by an escape character represents any word +character. +
+
+"w" +
+
 
 
+123 +
+
+The character which when preceded by an escape character represents a non-word +character. +
+
+"W" +
+
 
 
+124 +
+
+The character which when preceded by an escape character represents a start of +buffer assertion. +
+
+"`A" +
+
 
 
+125 +
+
+The character which when preceded by an escape character represents an end of +buffer assertion. +
+
+"'z" +
+
 
 
+126 +
+
+The newline character. +
+
+"\n" +
+
 
 
+127 +
+
+The comma separator. +
+
+"," +
+
 
 
+128 +
+
+The character which when preceded by an escape character represents the bell +character. +
+
+"a" +
+
 
 
+129 +
+
+The character which when preceded by an escape character represents the form +feed character. +
+
+"f" +
+
 
 
+130 +
+
+The character which when preceded by an escape character represents the newline +character. +
+
+"n" +
+
 
 
+131 +
+
+The character which when preceded by an escape character represents the +carriage return character. +
+
+"r" +
+
 
 
+132 +
+
+The character which when preceded by an escape character represents the tab +character. +
+
+"t" +
+
 
 
+133 +
+
+The character which when preceded by an escape character represents the +vertical tab character. +
+
+"v" +
+
 
 
+134 +
+
+The character which when preceded by an escape character represents the start +of a hexadecimal character constant. +
+
+"x" +
+
 
 
+135 +
+
+The character which when preceded by an escape character represents the start +of an ASCII escape character. +
+
+"c" +
+
 
 
+136 +
+
+The colon character. +
+
+":" +
+
 
 
+137 +
+
+The equals character. +
+
+"=" +
+
 
 
+138 +
+
+The character which when preceded by an escape character represents the ASCII +escape character. +
+
+"e" +
+
 
 
+139 +
+
+The character which when preceded by an escape character represents any lower +case character. +
+
+"l" +
+
 
 
+140 +
+
+The character which when preceded by an escape character represents any +non-lower case character. +
+
+"L" +
+
 
 
+141 +
+
+The character which when preceded by an escape character represents any upper +case character. +
+
+"u" +
+
 
 
+142 +
+
+The character which when preceded by an escape character represents any +non-upper case character. +
+
+"U" +
+
 
 
+143 +
+
+The character which when preceded by an escape character represents any space +character. +
+
+"s" +
+
 
 
+144 +
+
+The character which when preceded by an escape character represents any +non-space character. +
+
+"S" +
+
 
 
+145 +
+
+The character which when preceded by an escape character represents any digit +character. +
+
+"d" +
+
 
 
+146 +
+
+The character which when preceded by an escape character represents any +non-digit character. +
+
+"D" +
+
 
 
+147 +
+
+The character which when preceded by an escape character represents the end +quote operator. +
+
+"E" +
+
 
 
+148 +
+
+The character which when preceded by an escape character represents the start +quote operator. +
+
+"Q" +
+
 
 
+149 +
+
+The character which when preceded by an escape character represents a Unicode +combining character sequence. +
+
+"X" +
+
 
 
+150 +
+
+The character which when preceded by an escape character represents any single +character. +
+
+"C" +
+
 
 
+151 +
+
+The character which when preceded by an escape character represents end of +buffer operator. +
+
+"Z" +
+
 
 
+152 +
+
+The character which when preceded by an escape character represents the +continuation assertion. +
+
+"G" +
+
 
+

Custom error messages are loaded as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+Message ID +
+
+Error message ID +
+
+Default string +
+
 
 
+201 +
+
+REG_NOMATCH +
+
+"No match" +
+
 
 
+202 +
+
+REG_BADPAT +
+
+"Invalid regular expression" +
+
 
 
+203 +
+
+REG_ECOLLATE +
+
+"Invalid collation character" +
+
 
 
+204 +
+
+REG_ECTYPE +
+
+"Invalid character class name" +
+
 
 
+205 +
+
+REG_EESCAPE +
+
+"Trailing backslash" +
+
 
 
+206 +
+
+REG_ESUBREG +
+
+"Invalid back reference" +
+
 
 
+207 +
+
+REG_EBRACK +
+
+"Unmatched [ or [^" +
+
 
 
+208 +
+
+REG_EPAREN +
+
+"Unmatched ( or \\(" +
+
 
 
+209 +
+
+REG_EBRACE +
+
+"Unmatched \\{" +
+
 
 
+210 +
+
+REG_BADBR +
+
+"Invalid content of \\{\\}" +
+
 
 
+211 +
+
+REG_ERANGE +
+
+"Invalid range end" +
+
 
 
+212 +
+
+REG_ESPACE +
+
+"Memory exhausted" +
+
 
 
+213 +
+
+REG_BADRPT +
+
+"Invalid preceding regular expression" +
+
 
 
+214 +
+
+REG_EEND +
+
+"Premature end of regular expression" +
+
 
 
+215 +
+
+REG_ESIZE +
+
+"Regular expression too big" +
+
 
 
+216 +
+
+REG_ERPAREN +
+
+"Unmatched ) or \\)" +
+
 
 
+217 +
+
+REG_EMPTY +
+
+"Empty expression" +
+
 
 
+218 +
+
+REG_E_UNKNOWN +
+
+"Unknown error" +
+
 
+

Custom character class names are loaded as followed:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+Message ID +
+
+Description +
+
+Equivalent default class name +
+
 
 
+300 +
+
+The character class name for alphanumeric characters. +
+
+"alnum" +
+
 
 
+301 +
+
+The character class name for alphabetic characters. +
+
+"alpha" +
+
 
 
+302 +
+
+The character class name for control characters. +
+
+"cntrl" +
+
 
 
+303 +
+
+The character class name for digit characters. +
+
+"digit" +
+
 
 
+304 +
+
+The character class name for graphics characters. +
+
+"graph" +
+
 
 
+305 +
+
+The character class name for lower case characters. +
+
+"lower" +
+
 
 
+306 +
+
+The character class name for printable characters. +
+
+"print" +
+
 
 
+307 +
+
+The character class name for punctuation characters. +
+
+"punct" +
+
 
 
+308 +
+
+The character class name for space characters. +
+
+"space" +
+
 
 
+309 +
+
+The character class name for upper case characters. +
+
+"upper" +
+
 
 
+310 +
+
+The character class name for hexadecimal characters. +
+
+"xdigit" +
+
 
 
+311 +
+
+The character class name for blank characters. +
+
+"blank" +
+
 
 
+312 +
+
+The character class name for word characters. +
+
+"word" +
+
 
 
+313 +
+
+The character class name for Unicode characters. +
+
+"unicode" +
+
 
+

Finally, custom collating element names are loaded starting from +message id 400, and terminating when the first load thereafter fails. Each +message looks something like: "tagname string" where tagname +is the name used inside [[.tagname.]] and string is the actual text of +the collating element. Note that the value of collating element [[.zero.]] is +used for the conversion of strings to numbers - if you replace this with +another value then that will be used for string parsing - for example use the +Unicode character 0x0660 for [[.zero.]] if you want to use Unicode Arabic-Indic +digits in your regular expressions in place of Latin digits.

+

Note that the POSIX defined names for character classes and collating +elements are always available - even if custom names are defined, in contrast, +custom error messages, and custom syntax messages replace the default ones. +
+

+
+

Appendix 4: Demo Applications

+There are three demo applications that ship with this library, they all come +with makefiles for Borland, Microsoft and gcc compilers, otherwise you will +have to create your own makefiles.
regress.exe:
+

A regression test application that gives the matching/searching algorithms a +full workout. The presence of this program is your guarantee that the library +will behave as claimed - at least as far as those items tested are concerned - +if anyone spots anything that isn't being tested I'd be glad to hear about it. +

+

Files: parse.cpp, +regress.cpp, +tests.cpp.

+
jgrep.exe
+

A simple grep implementation, run with no command line options to find out +its usage. Look at fileiter.cpp/fileiter.hpp and +the mapfile class to see an example of a "smart" bidirectional +iterator that can be used with regex++ or any other STL algorithm.

+

Files: jgrep.cpp, +main.cpp.

+
timer.exe
+

A simple interactive expression matching application, the results of all +matches are timed, allowing the programmer to optimize their regular +expressions where performance is critical.

+

Files: regex_timer.cpp.
+

+

The snippets demos contain the code examples used in the documentation:

+

snip1.cpp: ftp based regex_match +example.

+

snip2.cpp: regex_search example: +searches a cpp file for class definitions.

+

snip3.cpp: regex_grep example 1: +searches a cpp file for class definitions.

+

snip4.cpp: regex_merge example: +converts a C++ file to syntax highlighted HTML.

+

snip5.cpp: regex_grep example 2: +searches a cpp file for class definitions, using a global callback function. +

+

snip6.cpp: regex_grep example 2: +searches a cpp file for class definitions, using a bound member function +callback.

+

snip7.cpp: regex_grep example 2: +searches a cpp file for class definitions, using a C++ Builder closure as a +callback.

+

snip8.cpp: regex_split example: split +a string into tokens.

+

snip9.cpp: regex_split example: spit +out linked URL's.

+
+

Appendix 5: Header Files

+There are two main headers used by this library: <boost/regex.hpp> +provides full access to the entire library, while <boost/cregex.hpp> +provides access to just the high level class RegEx, and the POSIX API +functions.
+
+

Appendix 6: Redistributables

+ If you are using Microsoft or Borland C++ and link to a dll version of +the run time library, then you will also link to one of the dll versions of +regex++. While these dll's are redistributable, there are no +"standard" versions, so when installing on the users PC, you should +place these in a directory private to your application, and not in the PC's +directory path. Note that if you link to a static version of your run time +library, then you will also link to a static version of regex++ and no dll's +will need to be distributed. The possible regex++ dll's are as follows:
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+Development Tool +
+
+Run Time Library +
+
+Regex++ Dll +
+
 
 
+Microsoft Visual C++ 6 +
+
+Msvcp60.dll and msvcrt.dll +
+
+Mre200l.dll +
+
 
 
+Microsoft Visual C++ 6 +
+
+Msvcp60d.dll and msvcrtd.dll +
+
+Mre300dl.dll +
+
 
 
+Borland C++ Builder 4 +
+
+Cw3245.dll +
+
+bcb4re300l.dll +
+
 
 
+Borland C++ Builder 4 +
+
+Cw3245mt.dll +
+
+bcb4re300lm.dll +
+
 
 
+Borland C++ Builder 4 +
+
+Cp3245mt.dll and vcl40.bpl +
+
+bcb4re300lv.dll +
+
 
 Borland C++ Builder 5cp3250.dllbcb5re300l.dll 
 Borland C++ Builder 5cp3250mt.dllbcb5re300lm.dll 
 Borland C++ Builder 5cw3250mt.dllbcb5re300lv.dll 
+

Note: you can disable automatic library selection by defining the symbol +BOOST_RE_NO_LIB when compiling, this is useful if you want to statically link +even though you're using the dll version of your run time library, or if you +need to debug regex++.
+

+
+

Notes for upgraders

+This version of regex++ is the first to be ported to the +boost project, and as a result has a number +of changes to comply with the boost coding guidelines.

Headers have been +changed from <header> or <header.h> to <boost/header.hpp> +

+

The library namespace has changed from "jm", to "boost". +

+

The reg_xxx algorithms have been renamed regex_xxx (to improve naming +consistency).

+

Algorithm query_match has been renamed regex_match, and only returns true if +the expression matches the whole of the input string (think input data +validation).

+

Compiling existing code:

+

The directory, libs/regex/old_include contains a set of headers that make +this version of regex++ compatible with previous ones, either add this +directory to your include path, or copy these headers to the root directory of +your boost installation. The contents of these headers are deprecated and +undocumented - really these are just here for existing code - for new projects +use the new header forms.
+

+
+

Further Information

+The author can be contacted at John_Maddock@compuserve.com, the +home page for this library is at +http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm, +and the official boost version can be obtained from +www.boost.org/libraries.

I am +indebted to Robert Sedgewick's "Algorithms in C++" for forcing me to +think about algorithms and their performance, and to the folks at boost for +forcing me to think, period. The following people have all contributed +useful comments or fixes: Mike Allison, Edan Ayal, Jayashree Balasubramanian, +Beman Dawes, Paul Baxter, Edward Diener, Robert Dunn, Fabio Forno, Rob Gillen, +Chris Hecker, Jesse Jones, Jan Hermelink, Max Leung, Wei-hao Lin, Jens Maurer, +Scobie Smith, Hervé Poirier, Marc Recht, Alexey Voinov, Jerry Waldorf, +Rob Ward, Lealon Watts 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.

+

Useful further information can be found at:

+

The Open Unix +Specification contains a wealth of useful material, including the regular +expression syntax, and specifications for +<regex.h> +and <nl_types.h>. +

+

The Pattern +Matching Pointers site is a "must visit" resource for anyone +interested in pattern matching.

+

Glimpse and Agrep, use a +simplified regular expression syntax to achieve faster search times.

+

Udi Manber and +Ricardo Baeza-Yates both have a +selection of useful pattern matching papers available from their respective web +sites.
+

+
+

Copyright Dr John +Maddock 1998-2000 all rights reserved.

+ + + diff --git a/c++boost.gif b/c++boost.gif new file mode 100644 index 0000000000000000000000000000000000000000..b1550824db7333faf854122f458dd62b7987c1d4 GIT binary patch literal 1875 zcmZ?wbhEHb6lDx!_|CwzZQFbH(K6ngWKJ ziiVnsJ(`+|nwo~1nogRU#hRMcnwmYDhC!N^Q#37?YC7%JbULQ#bxbqrnr8BQL(ODE zLoY+8V}?P;41=y2MlCgrx@H*l+%Wl?Ve)gs?C+L}mX?N=mWDx=hSipqQ!JgPSURn> z^vbpjT56g6-Lm?-WzTmf!(=DJY9}WzC#NVUr)(#u7ALR0PC?a9L35m__ikjmUwbv`^m{;;Wuj=n!J>P?zs)M|u zg1oYWg0h2x<^%<;4T`!KlsqLUd1+Ac+Mw)XLD|=WvhM|DKM$(D7F7K{sO5W5&-0+3 z??H3EM|mYj1#OK2ftIN3wNcggqSpRT4$4lBTAG}kot#{qoIE8tyC*q&PIC6vOS7xD zW>??KZaJ6Tb1u8*UUtv(>?z-~m%h(F_CNdD|Kj4M#l`1}=X@_-`@MMU_u_NktBZT8 zpp&i(JHp3~FQ z(gOl>dV03@^c?G%^1f%zxt=-KdX`@6S^B(Z>-#A^bEeFhGiA=&DRcHtS^9j+()UxA zexI`S-juEHr|f+`W$$+oI`@ChoO5&5URye6?b11Wmo7cFbm_UJOYbdRyLai)y3n&#m2hZSB_QYmePqd+hz%bMM!l`@Z(t_qETz@7;S2jPC8- z`+V=-_j~t#-+S!X-gEc%o_oLd-1lQ!uN`~-{oJ{G=gz%9ckkZ0d+*QP`+n{H_iNw3 z-@Etx-o5Y7LE!uQ=ilFd2LZ*OEQ|~c{~2^ZSpk$M7&!hh{O6SM*s$PWGl#HN%!v&P z54Q^_d(H9KxaerNgmKoL6B`#F?^kf{lJVTM)Z?TNcv$a| zX8p~bZNB0Df&T~6_*U;Ue!k)Nx4)0STN=lnoy=Uk&wHlPgHtoufA^>{GB7Z*NC+qx zEcpIN;8}uG+nxy)Z*Fk5pN`YwZ+XkW@@A=`LV`o-eI~Cj)^QWQ-oG;S@4wD($Mp*; zKP`6s{@DHBpR&r|f1Y;l*S~LH`{mvB-SzM1@2UKMVR3)O&lAhfXRyDTtWf>OAmU!t zs=u54Gam$&%`7~<@(I8EdENsIoYf18T1uH!F5G5d%-B3PRcBIqc*K(2v|IK+EpEtF zvVWTFZ*Tf*@q*YTCzbu}KZ#iM+uB`wtUT%073U>3|4u$WZ{ub)vwzYj1 zuldQd;&D~NvF-O#<}b8Nu8>@&;-9;Xcf)NZMy&}m=Ir4$;7VZmncQc2tKjgwqRO9N zm2B@69PXQ`ze#LXi_kW+n@esNs@-bIFpJ8}njN-lZftLp)yfr%lw4wFt350_kh}L| z+bR2hhkXvb%G=Y~cylrH%;s)`%pM)00cDHCB8v?zgnNb(GKA z#VV6;>)Rcd&s%@~^7x$1zd6b0?C$^iIo0ykHf4VM&pV8lZu@Lu*+1oT!|Hxpf4|Hp zebJ9zByaeB$KplThPhp@+}w7ws^{-I@aj&~7QP3E9IP%KooDK%P!P@VoTuVR?H94` zCpNd97&Ruj`*iYECj5P=JLyHiW`FayIluYr-`yzgH@o}hbD!0}CB}K?FTZT=v;Hk} z*Wb!~J9CMZ>G{tyuKeBLtiR*imCgMV{z~j#(jUWiC!yMCQ>B4B)0tJb8Fs#D?q0)q z;wM8smqL1^eT~I-iGN!rN2$G9{?}&G>8NXw2Oq>Pd~2*xz3{8?!x??n>n!ZQoBUAi z{}dgt z+CLsYPp}lKr}0kz_UE(Cjeixn=arWW*d5?Mdt3Fq+0Tf_yms$*G@rM4{ATfKgFi9M z=WOo^IQyI4zjJt>-Hn*T{Dw!KeD?kQBBq$%>gJQnz2<*jxcxrVXp+6cL-y^1<5sr{ z`AbdC%KXfjzPTZlzxu=CroTTf_WNC*B_^p;##iY5_F7rj>MP4aUq9$&K4+pK&+5n2 z!p(61TN3}pH%Ikq4zMyjF=2>~Y^(eCN8^~qA4a>{2K|ohC)^DWE#y!Acv#~4jpK$J hCh})UD9aza;A&SA$Xgq+QGWk|V|EKZcGtx$1^_e_#zg=C literal 0 HcmV?d00001 diff --git a/changes.txt b/changes.txt new file mode 100644 index 00000000..82ed0ad3 --- /dev/null +++ b/changes.txt @@ -0,0 +1,213 @@ +Version 301: +First boost release version, +CHANGED: reg_match to match_results +CHANGED: Documentation updated to reflect changes, provided links to sources from docs. +CHANGED: RegEx(const char*) constructor to explicit. +CHANGED: Return type of RegEx::Split to unsigned int. +ADDED: Exception documentation for OS errors. +REMOVED: BOOST_RE_NO_EXCEPTIONS macro. +FIXED: mapfile::open/close to check for OS errors. +FIXED: Non-exception safe code in cpp_regex_traits. +FIXED: Removed undefined symbol INFINITE from re_thrd.hpp +FIXED: Bug in configure script thread detection code. +CHANGED: "depreciated" to "deprecated" +FIXED: Documentation error for bad_expression. +CHANGED: regbase::flag_type to unsigned int +ADDED: explicit constructors to reg_expression/match_results +ADDED: extra signatures for regex_format/regex_merge for std::string arguments. +REMOVED: bad_pattern/bad_expression::what from regex.cpp +REMOVED: Implicit conversion operators from sub_match (except for conversion to basic_string). + +Version 300: +Candidate release boost version, +ADDED: Support for non-greedy repeats. +ADDED: Support for non-marking grouping. +ADDED: Auto-detection of STLPort STL versions. +CHANGED: Re-written and re-organised traits classes. +CHANGED: Regression test make files for more rigorous testing of all build versions. + +Version 249: +Pre-release boost version, +CHANGED: All macro prefixes to BOOST_RE_ +CHANGED: namespaces to boost +CHANGED: Header file extentions to .hpp +DEPRECIATED: Old style algorithms, replaced with more consistant naming style. +DEPRECIATED: Standard library independant compiles no longer possible, bespoke + classes replaced with standard library/boost equivalents where available. + +Version 221: +ADDED: C++ Builder 3 workaround in boost/detail/jgrep.hpp + +Version 220: +ADDED: Merge functions to class RegEx + + +Version 218: +FIXED: All known bugs prior to this version. +FIXED: Added workaround for gcc optimisation bug to jm/regmatch.h +ADDED: Cygwin mount point support. + +Version 217: +BUG: configure script did not correctly identify template + friend support, or template function partial ordering support. + +FIXED: All known bugs prior to this version. + +Version 216: +BUG: Some RegEx::Grep variants buggy. +BUG: FileIterator leaked memory. +BUG: Memory alignment problems with gcc/sparc platform + +CHANGED: RegEx callback declarations to cope with VC6 builds using + non-default calling conventions. +CHANGED: Some configuration options to try and keep Mingwin32 port + of gcc 2.95 happy. +FIXED: Bug in RegEx::What introduced in version 214 fix :-( + +Version 215: +CHANGED: Added #pragma push/pop to fix C++ Builder 3 problems. +CHANGED: Wide to narrow character conversions, to be more conformant with standard. +CHANGED: Minor documentation updates. + +Version 214: +FIXED All known bugs rpior to this point. +CHANGED: Minor changes to keep VC5 and GCC 2.95 happy. + +Version 213: +BUG: Far eastern versions of Win32 could not compile + re_nlsw.cpp due to string literal - code page + interactions. + +ADDED: Convenience conversion operators to sub_match<>. +CHANGED: Removed REG_E_MEMORY as it duplicates REG_ESPACE. +ADDED: Additional tests to regress. +CHANGED: RegEx::GrepFiles and RegEx::FindFiles previously had undefined + behaviour if the callback returned false, changed to abort + the whole search if the callback returns false. + +FIXED: All known bugs prior to this release. + +Version 212: +BUG: Use of catopen in re_mss.cpp causes problems on some systems. +BUG: Comparison operators for reg_expression and reg_match should be const. +BUG: Missing output iterator increment in regfmt.h. + +ADDED: REG_NOCOLLATE, so that locale dependent collation can be turned off for + the POSIX C API's as well as the underlying templates. +CHANGED: Misc. documentation updates. +FIXED: Linking problem for some egcs ports. +CHANGED: Tightened up exception safety. +ADDED: Convenience interfaces to query_match, reg_search, reg_grep, reg_format and reg_merge. +ADDED: Convenience std::string overloads of reg_expression members. +FIXED: All bugs found prior to this release. + + +Version 211: +BUG: RegEx::GrepFiles fails to log sub-expression matches correctly. +BUG: file_iterator/directory_iterator fail to find all files when using '*'. + +CHANGED: Changes required to make the code compile with HP's aCC compiler. +CHANGED: Using declarations, to hide implimentation details. +CHANGED: Behavior of ^ and $ to follow Unicode newline guidelines and account + for \r\n sequences. + +Version 210: +FIXED: All known bugs prior to this point. +ADDED: configure shell script for porting to Unix style systems. +CHANGED: jm::reg_match_base::pair to jm::sub_match, for easier porting. + +Version 200: +BUG: RegEx::GrepFiles buggy +BUG: RegEx::FindFiles buggy +BUG: non-portable header file usage in fileiter.h +BUG: non-portable enum declarations in headers. +BUG: non-portable use of isspace in regfacet.cpp +BUG: Missing regfac.obj from bcb makefiles. +BUG: non-portable declaration of type jm::reg_match_base::reference. +BUG: missing declaration required by some systems. +BUG: Use of JM_NO_WCSTRING incomplete. +BUG: Misspelled JM_NO_EXCEPTIONS in places. +BUG: regfmt.h has typo on line 538. +BUG: reg_format and reg_merge not portable to all output iterator types. +BUG: non-portable use of typedefs. +BUG: non-portable use of friend declarations. + +CHANGED: Allocator usage, to improve efficiency with instance based allocators. +CHANGED: regress.h, various fixes for various Borland C++ versions, allocators cleaned up. +ADDED: Win32 specific localisation code. +ADDED: C and C++ specific localisation code. +ADDED: collating element and equivalence class support. +CHANGED: Character class declarations. +CHANGED: Behaviour of ranges to deal with locales. +ADDED: Support for some perl escape sequences (but not yet (?...) ). +CHANGED: regbase::icase flag now turns on case insensitivity, + traits class char_regex_traits_i is now deprecated. +CHANGED: reg_grep now takes a predicate not an output iterator, + allows user code to terminate search midway through, + and to use regular callback function with grep. +CHANGED: Modified search heuristics to improve certain expression + types, especially expressions which start with a literal + string, or a single character repeat. The latter are much + less likely to become pathological now. +ADDED: High level C++ class RegEx. + +Version 111: +BUG: Wouldn't compile directly on C++ Builder 4 when it was released + (not really a bug - more an incompatability) + +FIXED: All bugs discovered prior to this version (below). + +Version 110: +BUG: reg_match::maybe_assign could lead to pointer + overrun in certain (rare) circumstances. + +FIXED: All bugs discovered prior to this version (below). +FIXED: Support for VC++, GCC, EGCS. +CHANGED: Regress.h to work around various compiler bugs. + +Version 100: +BUG: Literal "," not recognised as a literal. + +FIXED: All bugs discovered prior to this version (below). +ADDED: Regress.exe, regression test application. + +Version 095 +BUG: wide character sets that start with ^ not recognised, + for example [^[:space:]] will not find anything. +BUG: reg_grep fails if match occurs at first character. +BUG: If regcomp fails, internal data not freed. +BUG: reg_grep fails to reinitialise match after assignment + to output iterator. Line start optimised search restarts + from the wrong location if the match is longer than one line. +BUG: POSIX API functions can propagate C++ exceptions if the + default allocator can throw exceptions. +BUG: character sets don't function correctly when regbase::char_classes + is not set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clean b/clean new file mode 100644 index 00000000..dba30b6b --- /dev/null +++ b/clean @@ -0,0 +1,55 @@ + +do_erase() +{ + args="$1""$2" + rm -f $args +} + +do_clean() +{ + echo cleaning directory "$1" + do_erase $1 '*.bak' + do_erase $1 '*.~*' + do_erase $1 '*.il?' + do_erase $1 '*.obj' + do_erase $1 '*.csm' + do_erase $1 '*.exe' + do_erase $1 '*.tds' + do_erase $1 '*.pch' + do_erase $1 '*.id?' + do_erase $1 '*.s' + do_erase $1 '*.o' + do_erase $1 'makefile' + do_erase $1 '*.ZIP' + do_erase $1 '*.zip' + do_erase $1 '*.tar' + do_erase $1 '*.gz' + do_erase $1 'config.cache' + do_erase $1 'config.log' + do_erase $1 'config.status' + do_erase $1 '*.pdb' + do_erase $1 '*.tr2' + do_erase $1 '*.exe' + do_erase $1 '*.a' + do_erase $1 '*.lib' + do_erase $1 '*.exp' + do_erase $1 '*.ii' + do_erase $1 '*.s' + do_erase $1 '*.tds' + + path="$1"'*' + for file in $path + do + if test -d "$file"; then + file=$file'/' + do_clean $file + fi + done +} + +do_clean './' +cat jm_opt.in > ../../boost/re_detail/regex_options.hpp +rm -f ./lib/out.txt + + + diff --git a/compiler_tests b/compiler_tests new file mode 100644 index 00000000..ca2dbb29 --- /dev/null +++ b/compiler_tests @@ -0,0 +1,124 @@ +#!bash + +# +# set up compilers here: +root_path="$PATH" +root_include="$INCLUDE" +root_lib="$LIB" + +function bcb4() +{ + PATH="//e/cbuilder4/bin:$root_path" + INCLUDE="$root_include" + LIB="$root_lib" +} + +function bcb5() +{ + PATH="//e/cbuilder5/bin:$root_path" + INCLUDE="$root_include" + LIB="$root_lib" +} + +function bc55() +{ + PATH="//e/bcb550/bin:$root_path" + INCLUDE="$root_include" + LIB="$root_lib" +} + +function cygwin() +{ + PATH="/cygnus/cygwin-b20/H-i586-cygwin32/bin:$root_path" + INCLUDE="$root_include" + LIB="$root_lib" +} + +function mwin() +{ + PATH="//e/gcc2.95.2/bin:$root_path" + INCLUDE="$root_include" + LIB="$root_lib" +} + +function vc6() +{ + PATH="$root_path" + INCLUDE="$root_include" + LIB="$root_lib" +} + +function vc6p4() +{ + PATH="$root_path" + INCLUDE="e:\\stlport\\stlport;$root_include" + LIB="e:\\stlport\\lib;$root_lib" +} + +function vc6p3() +{ + PATH="$root_path" + INCLUDE="e:\stlport321\stlport;$root_include" + LIB="$root_lib" +} + +# +# function run performs and logs each command +function run() +{ + eval "$1" >> $out 2>&1 +} + +# +# set output file: +out=compiler_log.txt +echo > $out +# +# and set up tail to follow output +tail -f "$out" & + +# +# start with Borland C++ command line tools v5.5: +bc55 +cd lib +out=../compiler_log.txt +run 'make -fbc55.mak' + +cd ../demo/jgrep +out=../../compiler_log.txt +rm -f *.o *.obj *.exe +run 'make -fbc55.mak' + +cd ../timer +out=../../compiler_log.txt +rm -f *.o *.obj *.exe +run 'make -fbc55.mak' + +cd ../regress +out=../../compiler_log.txt +rm -f *.o *.obj *.exe +run 'make -fbc55.mak' + +cd ../snippets +out=../../compiler_log.txt +rm -f *.o *.obj *.exe +run 'bcc32 -O2 -I../../../../ snip1.cpp' +run 'bcc32 -O2 -I../../../../ snip2.cpp' +run 'bcc32 -O2 -I../../../../ snip3.cpp' +run 'bcc32 -O2 -I../../../../ snip4.cpp' +run 'bcc32 -O2 -I../../../../ snip5.cpp' +run 'bcc32 -O2 -I../../../../ snip6.cpp' +run 'bcc32 -O2 -I../../../../ snip7.cpp' +run 'bcc32 -O2 -I../../../../ snip8.cpp' +run 'bcc32 -O2 -I../../../../ snip9.cpp' + + +kill $! + + + + + + + + diff --git a/configure b/configure new file mode 100644 index 00000000..d8525ec1 --- /dev/null +++ b/configure @@ -0,0 +1,4148 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help +--enable-extension=" +ac_help="$ac_help +--enable-sizeof-short=" +ac_help="$ac_help +--enable-sizeof-int=" +ac_help="$ac_help +--enable-sizeof-long=" +ac_help="$ac_help +--enable-force-cross forces cross compile mode" +ac_help="$ac_help +--disable-mutable turns off mutable support" +ac_help="$ac_help +--disable-ms-windows turns off native MS Windows support (when available)" +ac_help="$ac_help +--disable-threads turns off multi-threading support (when available)" +ac_help="$ac_help +--disable-wstring turns off wide character string support" +ac_help="$ac_help +--disable-member-templates turns off member template class and function support" +ac_help="$ac_help +--disable-template-returns turns off support for templates specialised by return type" +ac_help="$ac_help +--disable-int64 turns off support for 64-bit integer types" +ac_help="$ac_help +--disable-messages turns off support for POSIX message categories, when available." +ac_help="$ac_help +--disable-nested-template-prefix turns off use of \"template\" as the nested template class access specifier." +ac_help="$ac_help +--disable-fastcall turns off use __fastcall and __stdcall." + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=../../boost/regex.hpp + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +cat >> confdefs.h <<\EOF +#define BOOST_RE_AUTO_CONFIGURE +EOF + + +echo "$ac_t""*** $0: regex++ configuration utility ***" 1>&6 +if test "${CXXFLAGS}" = ""; then +echo "$ac_t""* Note: for best reliability - try \"CXXFLAGS=-treat_warnings_as_errors\" $0 " 1>&6 +echo "$ac_t""* Please don't forget specifying typical CXXFLAGS you'll be using - " 1>&6 +echo "$ac_t""* such as that enabling exceptions handling" 1>&6 +echo "$ac_t""* Add option forcing instantiation of all templates to CXXFLAGS if possible. " 1>&6 +echo "$ac_t""* Add option enabling merging of template instances between translation units" 1>&6 +echo "$ac_t""* to CXXFLAGS if possible. " 1>&6 +fi +echo "$ac_t""Please stand by while exploring compiler capabilities..." 1>&6 +echo "$ac_t""Be patient - this could take some time..." 1>&6 +echo "$ac_t""***" 1>&6 + +# Check whether --enable-extension or --disable-extension was given. +if test "${enable_extension+set}" = set; then + enableval="$enable_extension" + +case "$enableval" in + no) echo "$ac_t""Info :.cpp used as extension for tests" 1>&6 + ac_ext=cpp + ;; + *) echo "$ac_t""Argument : .$enableval used as extension" 1>&6 + ac_ext=$enableval +esac + +else + echo "$ac_t""Info : .cpp used as extension for tests" 1>&6 + ac_ext=cpp + + +fi + + +# Check whether --enable-sizeof-short or --disable-sizeof-short was given. +if test "${enable_sizeof_short+set}" = set; then + enableval="$enable_sizeof_short" + : +else + enable_sizeof_short=2 +fi + +# Check whether --enable-sizeof-int or --disable-sizeof-int was given. +if test "${enable_sizeof_int+set}" = set; then + enableval="$enable_sizeof_int" + : +else + enable_sizeof_int=4 +fi + +# Check whether --enable-sizeof-long or --disable-sizeof-long was given. +if test "${enable_sizeof_long+set}" = set; then + enableval="$enable_sizeof_long" + : +else + enable_sizeof_long=4 +fi + +# Check whether --enable-force-cross or --disable-force-cross was given. +if test "${enable_force_cross+set}" = set; then + enableval="$enable_force_cross" + : +fi + + + +# Save that, as it is being redefined several times +use_ac_ext=$ac_ext + +for ac_prog in $CCC c++ g++ gcc CC cxx cc++ +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:631: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:662: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cxx_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 +if test $ac_cv_prog_cxx_works = no; then + { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:702: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 +cross_compiling=$ac_cv_prog_cxx_cross + +echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 +echo "configure:707: checking whether we are using GNU C++" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes + ac_test_CXXFLAGS="${CXXFLAGS+set}" + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS= + echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 +echo "configure:731: checking whether ${CXX-g++} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 + if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" + elif test $ac_cv_prog_cxx_g = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-O2" + fi +else + GXX= + test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" +fi + +ac_ext=$use_ac_ext + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +ac_ext=$use_ac_ext + +echo $ac_n "checking for object file extention""... $ac_c" 1>&6 +echo "configure:770: checking for object file extention" >&5 +cat > "xyqtcz.$ac_ext" << EOF + +int main() +{ +} + +EOF + +if eval "$CXX $CXXFLAGS -c xyqtcz.$ac_ext"; then +rm -f "xyqtcz.$ac_ext" +ac_obj_ext=`find xyqtcz.* | sed 's/xyqtcz\(.*\)/\1/g'` +echo "$ac_t""yes - $ac_obj_ext" 1>&6 +rm -f "xyqtcz$ac_obj_ext" + +else + +echo "$ac_t""no - could not create or find object file" 1>&6 +rm -f "xyqtcz.$ac_ext" +ac_obj_ext='.o' + +fi + +echo $ac_n "checking for executable file extention""... $ac_c" 1>&6 +echo "configure:794: checking for executable file extention" >&5 +ac_exe_ext="" +for file in /bin/sh.* +do + +if test -x "$file"; then +ac_exe_ext=`echo "$file" | sed 's/\/bin\/sh\(.*\)/\1/g'` +fi + +done + +echo "$ac_t""yes - $ac_exe_ext" 1>&6 + + + + +# +# determine machine word sizes +# and set BOOST_RE_INT32 to be the +# equivalent of intfast32_t in +# +if test "$enable_force_cross" = "yes"; then +cross_compiling="yes" +echo forced cross compilation mode turned on +fi + +echo $ac_n "checking size of short""... $ac_c" 1>&6 +echo "configure:821: checking size of short" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_short="$enable_sizeof_short" +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(short)); + exit(0); +} +EOF +if { (eval echo configure:843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_short=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_short=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_short" 1>&6 +cat >> confdefs.h <&6 +echo "configure:864: checking size of int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_int="$enable_sizeof_int" +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(int)); + exit(0); +} +EOF +if { (eval echo configure:886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_int" 1>&6 +cat >> confdefs.h <&6 +echo "configure:907: checking size of long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_sizeof_long="$enable_sizeof_long" +else + cat > conftest.$ac_ext < +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long)); + exit(0); +} +EOF +if { (eval echo configure:929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_long" 1>&6 +cat >> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <<\EOF +#define BOOST_RE_INT32_LONG 1 +EOF + + else + { echo "configure: error: Cannot find any 32-bit integer type for your compiler" 1>&2; exit 1; } + fi + ac_ext=$use_ac_ext +fi +ac_ext=$use_ac_ext + + +ac_ext=$use_ac_ext + +echo $ac_n "checking for basic template compatibility""... $ac_c" 1>&6 +echo "configure:981: checking for basic template compatibility" >&5 +cat > conftest.$ac_ext < +struct binary_function { + typedef Arg1 first_argument_type; + typedef Arg2 second_argument_type; + typedef Result result_type; +}; +template +struct plus : public binary_function { + T operator()(const T& x, const T& y) const; +}; + +// +// non-inline +// link will fail if template is not instantiated +// +template +T plus::operator()(const T& x, const T& y) const +{ return x + y; } + +plus p; + +int main() { + +// check member function is actually instantiated +int i, j, k; +i = p(k, j); + +; return 0; } +EOF +if { (eval echo configure:1015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + ac_cv_compat="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Your compiler won't be able to compile this implementation. Sorry." 1>&2; exit 1; } + ac_cv_compat="no" + +fi +rm -f conftest* +echo "$ac_t""$ac_cv_compat" 1>&6 + +echo $ac_n "checking for exception support""... $ac_c" 1>&6 +echo "configure:1030: checking for exception support" >&5 +cat > conftest.$ac_ext < + +int f1()throw() +{ + return 23; +} + +void do_throw() +{ + throw (int)25; +} + +int main() { + + try + { + f1(); + do_throw(); + } + catch(int i) + { + } + catch(...) + { + } + +; return 0; } +EOF +if { (eval echo configure:1063: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +{ echo "configure: error: Sorry" 1>&2; exit 1; } +fi +rm -f conftest* + + +# Check whether --enable-mutable or --disable-mutable was given. +if test "${enable_mutable+set}" = set; then + enableval="$enable_mutable" + : +fi + +if test "$enable_mutable" = "no"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_MUTABLE +EOF + +else + +echo $ac_n "checking for mutable keyword""... $ac_c" 1>&6 +echo "configure:1090: checking for mutable keyword" >&5 +cat > conftest.$ac_ext < + +class foo +{ + mutable int val; + public: + foo(int i) : val(i) {} + void set(int i)const; +}; + +void foo::set(int i)const +{ + val = i; +} + +int main() { + + const foo f(4); + f.set(3); + +; return 0; } +EOF +if { (eval echo configure:1117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_MUTABLE +EOF + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* +fi + +echo $ac_n "checking for default template parameter support""... $ac_c" 1>&6 +echo "configure:1133: checking for default template parameter support" >&5 +cat > conftest.$ac_ext < + +template +struct foo +{ + T val; + U alt; +}; + +int main() { + + foo f1; + foo f2; + foo f3; + foo f4; + +; return 0; } +EOF +if { (eval echo configure:1156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Sorry: you can't compile this library" 1>&2; exit 1; } +fi +rm -f conftest* + +echo $ac_n "checking for derived default template parameter support""... $ac_c" 1>&6 +echo "configure:1168: checking for derived default template parameter support" >&5 +cat > conftest.$ac_ext < + +template +class inner +{ +public: + typedef T inner_type; +}; + +template > +struct foo +{ + T val; + U alt; +}; + +int main() { + + foo > f1; + foo > f2; + foo f3; + foo f4; + +; return 0; } +EOF +if { (eval echo configure:1198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Sorry" 1>&2; exit 1; } +fi +rm -f conftest* + + +echo $ac_n "checking for function template partial ordering""... $ac_c" 1>&6 +echo "configure:1211: checking for function template partial ordering" >&5 +cat > conftest.$ac_ext < + +template +struct dummy{}; + +struct dummy2 +{ + int result()const { return 1; } +}; + +template +int foo(const T& t) +{ return t.result(); } + +template +int foo(const dummy& ) +{ return 0; } + + +int main() { + + dummy d; + dummy2 d2; + int i = foo(d); + i = foo(d2); + +; return 0; } +EOF +if { (eval echo configure:1244: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_PARTIAL_FUNC_SPEC +EOF + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +echo $ac_n "checking for template friend functions""... $ac_c" 1>&6 +echo "configure:1259: checking for template friend functions" >&5 +cat > conftest.$ac_ext < + +template +void foo(T2 t); + +template +struct dummy +{ + template friend void foo(T2); +private: + void foo2(); + void foo3()const; +}; + +template +void foo(T2 t) +{ + dummy d1; + d1.foo2(); + d1.foo3(); + dummy d2; + d2.foo2(); + d2.foo3(); +} + + + +int main() { + + foo(3); + foo(2.345); + +; return 0; } +EOF +if { (eval echo configure:1298: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_TEMPLATE_FRIEND +EOF + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + + + +# Check whether --enable-ms-windows or --disable-ms-windows was given. +if test "${enable_ms_windows+set}" = set; then + enableval="$enable_ms_windows" + : +fi + +# Check whether --enable-threads or --disable-threads was given. +if test "${enable_threads+set}" = set; then + enableval="$enable_threads" + : +fi + +if test "$enable_ms_windows" != "no"; then + +echo $ac_n "checking for MS Windows""... $ac_c" 1>&6 +echo "configure:1329: checking for MS Windows" >&5 +cat > conftest.$ac_ext < + +#if defined(__GNUC__) && (__GNUC_MINOR__ == 95) && (__GNUC__ == 2) +#error can't mix STL code with due to bug in gcc2.95.x +#endif + + + +int main() { + + int i = GetVersion(); + +; return 0; } +EOF +if { (eval echo configure:1348: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + iswin="true" +cat >> confdefs.h <<\EOF +#define BOOST_RE_PLATFORM_WINDOWS +EOF + +echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +enable_ms_windows="no" + +fi +rm -f conftest* +fi + +if test "$enable_ms_windows" != "no"; then +echo $ac_n "checking for MS Win32""... $ac_c" 1>&6 +echo "configure:1369: checking for MS Win32" >&5 +cat > conftest.$ac_ext < + +CRITICAL_SECTION cs; + +int main() { + + InitializeCriticalSection(&cs); + EnterCriticalSection(&cs); + LeaveCriticalSection(&cs); + DeleteCriticalSection(&cs); + +; return 0; } +EOF +if { (eval echo configure:1387: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +enable_ms_windows="no" + +fi +rm -f conftest* +fi + +if test "$enable_ms_windows" != "no"; then + +if test "$CXX" != "cl"; then +echo $ac_n "checking for main in -luser32""... $ac_c" 1>&6 +echo "configure:1405: checking for main in -luser32" >&5 +ac_lib_var=`echo user32'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-luser32 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -luser32" +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for main in -lkernel32""... $ac_c" 1>&6 +echo "configure:1441: checking for main in -lkernel32" >&5 +ac_lib_var=`echo kernel32'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lkernel32 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lkernel32" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +cat > conftest.$ac_ext < + +CRITICAL_SECTION cs; + +int main() { + + InitializeCriticalSection(&cs); + EnterCriticalSection(&cs); + LeaveCriticalSection(&cs); + DeleteCriticalSection(&cs); + HeapAlloc(0, 0, 20); + CharLower((LPTSTR)0); + LoadString(0, 0, 0, 0); + +; return 0; } +EOF +if { (eval echo configure:1498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + +if test "enable_threads" != "no"; then +# turn on threading support: +echo $ac_n "checking for mult-thread support""... $ac_c" 1>&6 +echo "configure:1504: checking for mult-thread support" >&5 +echo "$ac_t"""yes"" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_THREADS +EOF + +cat >> confdefs.h <<\EOF +#define BOOST_RE_PLATFORM_W32 +EOF + +fi + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + +# bu**er, windows is present but we can't link +echo "configure: warning: + MS Win32 seems to be present, but we can't link, + or find the default library names for kernal32.dll + and user32.dll. + $0 is disabling MS Windows support, re-run $0 with + the environment variable "LIBS" set to the library + files required to re-enable Win32 support." 1>&2 +enable_ms_windows="no" + + +fi +rm -f conftest* + + +fi + + +if test "$iswin" != "true"; then + +echo $ac_n "checking for MS DOS""... $ac_c" 1>&6 +echo "configure:1542: checking for MS DOS" >&5 +cat > conftest.$ac_ext < + +int main() { + + int i = _doserrno; + +; return 0; } +EOF +if { (eval echo configure:1555: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_PLATFORM_DOS +EOF + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +fi + + +echo $ac_n "checking for bool support""... $ac_c" 1>&6 +echo "configure:1573: checking for bool support" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_BOOL +EOF + +echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + + +# Check whether --enable-wstring or --disable-wstring was given. +if test "${enable_wstring+set}" = set; then + enableval="$enable_wstring" + : +fi + + +if test "$enable_wstring" = "no"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_WCHAR_H +EOF + +else + +echo $ac_n "checking for ""... $ac_c" 1>&6 +echo "configure:1616: checking for " >&5 +cat > conftest.$ac_ext < + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:1628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_WCHAR_H +EOF + +echo "$ac_t""no" 1>&6 + +fi +rm -f conftest* +fi + +if test "$enable_wstring" = "no"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_WCTYPE_H +EOF + +else + +echo $ac_n "checking for ""... $ac_c" 1>&6 +echo "configure:1653: checking for " >&5 +cat > conftest.$ac_ext < + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:1665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_WCTYPE_H +EOF + +echo "$ac_t""no" 1>&6 + +fi +rm -f conftest* +fi + + +if test "$enable_wstring" = "no"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_WCSTRING +EOF + +else + +echo $ac_n "checking for wide string functions""... $ac_c" 1>&6 +echo "configure:1691: checking for wide string functions" >&5 +cat > conftest.$ac_ext < +#endif +#ifndef BOOST_RE_NO_WCTYPE_H +#include +#endif +#include +#include +#include +#include +#include +template class std::basic_string; + +int main() { + + using namespace std; + wchar_t c[50]; + char d[50]; + wcscpy(c, L"abcd"); + wcscmp(L"", L""); + wcslen(L""); + wcsxfrm(0, L"", 0); + wcstombs(d, L"", 0); + mbstowcs(c, "", 0); + iswlower(L'c'); + +; return 0; } +EOF +if { (eval echo configure:1725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +enable_wstring="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_WCSTRING +EOF + +echo "$ac_t""no" 1>&6 +enable_wstring="no" +fi +rm -f conftest* +fi + +if test "$enable_wstring" != "no"; then +echo $ac_n "checking for swprintf support""... $ac_c" 1>&6 +echo "configure:1745: checking for swprintf support" >&5 +cat > conftest.$ac_ext < +#endif +#ifndef BOOST_RE_NO_WCTYPE_H +#include +#endif +#include +#include + +int main() { + + wchar_t c[50]; + swprintf(c, L"abcd"); + +; return 0; } +EOF +if { (eval echo configure:1767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_SWPRINTF +EOF + +echo "$ac_t""no" 1>&6 +enable_swprintf="no" +fi +rm -f conftest* +fi + +if test "$enable_wstring" != "no" && test "$enable_swprintf" = "no"; then +echo $ac_n "checking for wsprintf support""... $ac_c" 1>&6 +echo "configure:1786: checking for wsprintf support" >&5 +cat > conftest.$ac_ext < +#endif +#ifndef BOOST_RE_NO_WCTYPE_H +#include +#endif +#include +#include +#include + +int main() { + + wchar_t c[50]; + wsprintf(c, "abcd"); + +; return 0; } +EOF +if { (eval echo configure:1809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_WSPRINTF +EOF + +echo "$ac_t""no" 1>&6 +fi +rm -f conftest* +fi + + + +# Check whether --enable-member-templates or --disable-member-templates was given. +if test "${enable_member_templates+set}" = set; then + enableval="$enable_member_templates" + : +fi + +if test "$enable_member_templates" = "no"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_MEMBER_TEMPLATES +EOF + +else + +echo $ac_n "checking for member template classes and functions""... $ac_c" 1>&6 +echo "configure:1841: checking for member template classes and functions" >&5 +cat > conftest.$ac_ext < +class alloc +{ +public: + void* allocate(int); + void deallocate(void*); + alloc(); + alloc(const alloc&); + template + alloc(const alloc&) {} + alloc& operator=(const alloc&); + template + alloc& operator=(const alloc&) + { return *this; } + + template + struct rebind + { + typedef alloc other; + }; +}; + + +int main() { + + alloc ia; + alloc da(ia); + alloc fa; + fa.allocate(5); + fa = ia; + +; return 0; } +EOF +if { (eval echo configure:1880: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_MEMBER_TEMPLATES +EOF + +echo "$ac_t""no" 1>&6 +fi +rm -f conftest* +fi + + +# Check whether --enable-template-returns or --disable-template-returns was given. +if test "${enable_template_returns+set}" = set; then + enableval="$enable_template_returns" + : +fi + +if test "$enable_template_returns" = "no"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_TEMPLATE_RETURNS +EOF + +else + +echo $ac_n "checking for parameterised function returns""... $ac_c" 1>&6 +echo "configure:1911: checking for parameterised function returns" >&5 +cat > conftest.$ac_ext < +T coerse(int i) +{ return T(i); } + +int main() { + + double d = coerse(5); + int i = coerse(3); + +; return 0; } +EOF +if { (eval echo configure:1927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_TEMPLATE_RETURNS +EOF + +echo "$ac_t""no" 1>&6 +fi +rm -f conftest* +fi + + +# Check whether --enable-int64 or --disable-int64 was given. +if test "${enable_int64+set}" = set; then + enableval="$enable_int64" + : +fi + +if test "$enable_int64" = "no"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_INT64_T_0 1 +EOF + +else + +echo $ac_n "checking for 64-bit integral type""... $ac_c" 1>&6 +echo "configure:1958: checking for 64-bit integral type" >&5 + +if test "$ac_cv_sizeof_short" -eq 8; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_INT64_T_1 1 +EOF + +echo "$ac_t""yes - short" 1>&6 +have_int64="true" +fi +if test "$ac_cv_sizeof_int" -eq 8 && test "$have_int64" != "true"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_INT64_T_2 1 +EOF + +echo "$ac_t""yes - int" 1>&6 +have_int64="true" +fi +if test "$ac_cv_sizeof_long" -eq 8 && test "$have_int64" != "true"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_INT64_T_3 1 +EOF + +echo "$ac_t""yes - long" 1>&6 +have_int64="true" +fi +if test "$have_int64" != "true"; then +cat > conftest.$ac_ext < + +int64_t i = INT64_C(0x100000000); + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:1998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes - int64_t" 1>&6 +have_int64="true" +cat >> confdefs.h <<\EOF +#define BOOST_RE_INT64_T_4 1 +EOF + + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi + +if test "$have_int64" != "true"; then + +cat > conftest.$ac_ext < + +long long i = 0x100000000LL; + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2029: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes - long long" 1>&6 +have_int64="true" +cat >> confdefs.h <<\EOF +#define BOOST_RE_INT64_T_5 1 +EOF + + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + +fi + +if test "$have_int64" != "true"; then + +cat > conftest.$ac_ext < + +__int64 i = 0x100000000i64; + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes - __int64" 1>&6 +have_int64="true" +cat >> confdefs.h <<\EOF +#define BOOST_RE_INT64_T_6 1 +EOF + + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +if test "$have_int64" != "true"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_INT64_T 0 +EOF + +echo "$ac_t""no" 1>&6 +fi +fi + + +# Check whether --enable-messages or --disable-messages was given. +if test "${enable_messages+set}" = set; then + enableval="$enable_messages" + : +fi + +if test "$enable_messages" = "no" || test "$enable_ms_windows" != "no"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_CAT +EOF + +else + +echo $ac_n "checking for catopen in -lnl_types""... $ac_c" 1>&6 +echo "configure:2100: checking for catopen in -lnl_types" >&5 +ac_lib_var=`echo nl_types'_'catopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lnl_types $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo nl_types | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +echo $ac_n "checking for catopen in -lposix""... $ac_c" 1>&6 +echo "configure:2150: checking for catopen in -lposix" >&5 +ac_lib_var=`echo posix'_'catopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lposix $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo posix | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + +echo $ac_n "checking for POSIX message categories""... $ac_c" 1>&6 +echo "configure:2201: checking for POSIX message categories" >&5 +cat > conftest.$ac_ext < + +nl_catd message_cat = (nl_catd)-1; + +int main() { + + message_cat = catopen("some_name", 0); + catclose(message_cat); + +; return 0; } +EOF +if { (eval echo configure:2217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_CAT +EOF + +echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +fi + +if test "$enable_threads" != "no" && test "$enable_ms_windows" = "no"; then + +echo $ac_n "checking for pthread_mutex_init in -lpthread""... $ac_c" 1>&6 +echo "configure:2237: checking for pthread_mutex_init in -lpthread" >&5 +ac_lib_var=`echo pthread'_'pthread_mutex_init | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthread $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo pthread | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +echo $ac_n "checking for pthread_mutex_init in -lposix""... $ac_c" 1>&6 +echo "configure:2287: checking for pthread_mutex_init in -lposix" >&5 +ac_lib_var=`echo posix'_'pthread_mutex_init | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lposix $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo posix | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + +echo $ac_n "checking for POSIX threads""... $ac_c" 1>&6 +echo "configure:2338: checking for POSIX threads" >&5 +cat > conftest.$ac_ext < + +pthread_mutex_t m; + + +int main() { + + pthread_mutex_init(&m, NULL); + pthread_mutex_lock(&m); + pthread_mutex_unlock(&m); + pthread_mutex_destroy(&m); + +; return 0; } +EOF +if { (eval echo configure:2357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_THREADS +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +fi + + +# Check whether --enable-nested-template-prefix or --disable-nested-template-prefix was given. +if test "${enable_nested_template_prefix+set}" = set; then + enableval="$enable_nested_template_prefix" + : +fi + +if test "$enable_nested_template_prefix" = "no" || test "$enable_member_templates" = "no"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_NESTED_TEMPLATE_DECL +EOF + +else + +echo $ac_n "checking for template nested class access""... $ac_c" 1>&6 +echo "configure:2389: checking for template nested class access" >&5 +cat > conftest.$ac_ext < +class alloc +{ +public: + void* allocate(int); + void deallocate(void*); + alloc(); + alloc(const alloc&); + template + alloc(const alloc&) {} + alloc& operator=(const alloc&); + template + alloc& operator=(const alloc&) + { return *this; } + + template + struct rebind + { + typedef alloc other; + }; +}; + + +int main() { + + alloc ia; + alloc da(ia); + alloc fa; + fa.allocate(5); + fa = ia; + alloc::template rebind::other da2(ia); + +; return 0; } +EOF +if { (eval echo configure:2428: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + +echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_NESTED_TEMPLATE_DECL template +EOF + + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + +cat >> confdefs.h <<\EOF +#define BOOST_RE_NESTED_TEMPLATE_DECL +EOF + +echo "$ac_t""no" 1>&6 + +fi +rm -f conftest* + +fi + +echo $ac_n "checking for explicit template instantiation""... $ac_c" 1>&6 +echo "configure:2454: checking for explicit template instantiation" >&5 +cat > conftest.$ac_ext < + +template +class factorial +{ +public: + factorial(); + T operator()(T); +}; + +template +factorial::factorial() +{ +} + +template +T factorial::operator()(T t) +{ + T result = 1; + for(T i = 1; i <= t; ++i) + { + result *= i; + } + return result; +} + +template class factorial; +template class factorial; + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2494: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + +echo "$ac_t""yes" 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_TEMPLATE_INST +EOF + +echo "$ac_t""no" 1>&6 + +fi +rm -f conftest* + + +# Check whether --enable-fastcall or --disable-fastcall was given. +if test "${enable_fastcall+set}" = set; then + enableval="$enable_fastcall" + : +fi + +if test "$enable_fastcall" = "no" || test "$enable_ms_windows" != "no"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_CALL +EOF + +cat >> confdefs.h <<\EOF +#define BOOST_RE_CCALL +EOF + +else + +echo $ac_n "checking for __fastcall and __stdcall""... $ac_c" 1>&6 +echo "configure:2532: checking for __fastcall and __stdcall" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_CALL __fastcall +EOF + +cat >> confdefs.h <<\EOF +#define BOOST_RE_CCALL __stdcall +EOF + + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_CALL +EOF + +cat >> confdefs.h <<\EOF +#define BOOST_RE_CCALL +EOF + +echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +fi + +# move on to STL options: + + +echo $ac_n "checking for standard library namespace""... $ac_c" 1>&6 +echo "configure:2587: checking for standard library namespace" >&5 +cat > conftest.$ac_ext < +#include +#include +#include "confdefs.h" + +namespace jm{ + +struct dummy{}; + +}; // namespace + +jm::dummy d; + +std::list v; + + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes - std" 1>&6 +have_std_namespace="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no - either STL is not present or in a non-standard namespace." 1>&6 +{ echo "configure: error: Sorry, you can't compile this library unless the standard library is in namespace std." 1>&2; exit 1; } +fi +rm -f conftest* + +echo $ac_n "checking for ""... $ac_c" 1>&6 +echo "configure:2628: checking for " >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + +class bad_expression : public std::exception +{ + unsigned int code; +public: + bad_expression(unsigned int err) : code(err) {} + bad_expression(const bad_expression& e) : std::exception(e), code(e.code) {} + bad_expression& operator=(const bad_expression& e) + { + std::exception::operator=(e); + code = e.code; + return *this; + } + virtual const char* what()const throw(); +}; + + +std::exception e; +std::bad_exception e3; + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2660: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_EXCEPTION_H +EOF + + +fi +rm -f conftest* + +echo $ac_n "checking for ""... $ac_c" 1>&6 +echo "configure:2678: checking for " >&5 +cat > conftest.$ac_ext < + + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2691: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_ITERATOR_H +EOF + + +fi +rm -f conftest* + +echo $ac_n "checking for ""... $ac_c" 1>&6 +echo "configure:2709: checking for " >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2723: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +need_algo="yes" + +fi +rm -f conftest* + +if test "$enable_stl" != "no" && test "$need_algo" = "yes"; then +echo $ac_n "checking for ""... $ac_c" 1>&6 +echo "configure:2739: checking for " >&5 +cat > conftest.$ac_ext < + + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2752: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_USE_ALGO +EOF + + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no - disabling STL support" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_STL +EOF + +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_EXCEPTION_H +EOF + +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_ITERATOR_H +EOF + +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_MEMORY_H +EOF + +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_LOCALE_H +EOF + +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_STRING_H +EOF + +enable_stl="no" + +fi +rm -f conftest* + +fi + +echo $ac_n "checking for ""... $ac_c" 1>&6 +echo "configure:2797: checking for " >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + +std::allocator a; +std::allocator d(a); + +typedef std::allocator alloc_type; + +alloc_type::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other o(a); + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2817: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_MEMORY_H +EOF + + +fi +rm -f conftest* + + +if test "$enable_stl" != "no"; then +echo $ac_n "checking for ""... $ac_c" 1>&6 +echo "configure:2837: checking for " >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + +std::string a; +//std::wstring ws; + + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2854: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +{ echo "configure: error: Sorry: you can't compile this library without " 1>&2; exit 1; } + +fi +rm -f conftest* + +fi + +if test "$enable_stl" != "no"; then +echo $ac_n "checking for std::basic_string default arguments""... $ac_c" 1>&6 +echo "configure:2872: checking for std::basic_string default arguments" >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + +std::basic_string s1; +std::basic_string s2; + + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2889: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_STRING_DEF_ARGS +EOF + + +fi +rm -f conftest* + +fi + +ac_have_locale='no' +if test "$enable_stl" != "no"; then +echo $ac_n "checking for ""... $ac_c" 1>&6 +echo "configure:2911: checking for " >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + +std::locale l; + +int main() { + + +; return 0; } +EOF +if { (eval echo configure:2926: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +ac_have_locale='yes' + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_LOCALE_H +EOF + + +fi +rm -f conftest* + +fi + +if test "$enable_stl" != "no"; then +echo $ac_n "checking for ""... $ac_c" 1>&6 +echo "configure:2948: checking for " >&5 +cat > conftest.$ac_ext < +#include +#include "confdefs.h" + + +int main() { + + std::locale l; + std::cout.imbue(l); + std::cout << "some text" << std::endl; + +; return 0; } +EOF +if { (eval echo configure:2966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_OLD_IOSTREAM +EOF + + +fi +rm -f conftest* + +fi + +echo $ac_n "checking for std::distance""... $ac_c" 1>&6 +echo "configure:2986: checking for std::distance" >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + + +int main() { + + int i, *j, *k; + i = std::distance(j, k); + +; return 0; } +EOF +if { (eval echo configure:3002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_DISTANCE_T_1 1 +EOF + +have_dist="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + +if test "$enable_stl" != "no" && test "$have_dist" != "yes"; then +cat > conftest.$ac_ext < +#include "confdefs.h" + + +int main() { + + int i, *j, *k; + std::distance(j, k, i); + +; return 0; } +EOF +if { (eval echo configure:3033: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_DISTANCE_T_2 1 +EOF + +have_dist="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_DISTANCE_T_0 1 +EOF + +have_dist="yes" +fi +rm -f conftest* + +fi + +if test "$enable_stl" != "no" && test "$have_si" != "yes"; then +echo $ac_n "checking for standard iterator syntax""... $ac_c" 1>&6 +echo "configure:3059: checking for standard iterator syntax" >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + + +int main() { + + std::iterator oi; + std::iterator ii; + std::iterator fi; + std::iterator bi; + std::iterator ri; + +; return 0; } +EOF +if { (eval echo configure:3078: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_ITERATOR_T_1 1 +EOF + +have_si="yes" +have_oi="yes" +have_ii="yes" +have_fi="yes" +have_bi="yes" +have_ri="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + +fi + +if test "$enable_stl" != "no" && test "$have_si" != "yes"; then +cat > conftest.$ac_ext < +#include "confdefs.h" + + +int main() { + + std::iterator oi; + std::iterator ii; + std::iterator fi; + std::iterator bi; + std::iterator ri; + +; return 0; } +EOF +if { (eval echo configure:3119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_ITERATOR_T_2 1 +EOF + +have_si="yes" +have_oi="yes" +have_ii="yes" +have_fi="yes" +have_bi="yes" +have_ri="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* +cat >> confdefs.h <<\EOF +#define BOOST_RE_ITERATOR_T_0 1 +EOF + + +fi + + +if test "$have_oi" != "yes"; then +echo $ac_n "checking for output iterator syntax""... $ac_c" 1>&6 +echo "configure:3150: checking for output iterator syntax" >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + + +int main() { + + std::output_iterator oi; + +; return 0; } +EOF +if { (eval echo configure:3165: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_OI_T_3 1 +EOF + +have_oi="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_OI_T_0 1 +EOF + +have_oi="yes" +fi +rm -f conftest* + +fi + +if test "$enable_stl" != "no" && test "$have_ii" != "yes"; then +echo $ac_n "checking for input iterator syntax""... $ac_c" 1>&6 +echo "configure:3191: checking for input iterator syntax" >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + + +int main() { + + std::input_iterator oi; + +; return 0; } +EOF +if { (eval echo configure:3206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_II_T_3 1 +EOF + +have_ii="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + +fi + +if test "$enable_stl" != "no" && test "$have_ii" != "yes"; then +cat > conftest.$ac_ext < +#include "confdefs.h" + + +int main() { + + std::input_iterator oi; + +; return 0; } +EOF +if { (eval echo configure:3238: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_II_T_4 1 +EOF + +have_ii="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_II_T_0 1 +EOF + +have_ii="yes" +fi +rm -f conftest* + +fi + +if test "$enable_stl" != "no" && test "$have_fi" != "yes"; then +echo $ac_n "checking for forward iterator syntax""... $ac_c" 1>&6 +echo "configure:3264: checking for forward iterator syntax" >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + + +int main() { + + std::forward_iterator oi; + +; return 0; } +EOF +if { (eval echo configure:3279: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_FI_T_3 1 +EOF + +have_fi="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_FI_T_0 1 +EOF + +have_fi="yes" +fi +rm -f conftest* + +fi + +if test "$enable_stl" != "no" && test "$have_bi" != "yes"; then +echo $ac_n "checking for bidirectional iterator syntax""... $ac_c" 1>&6 +echo "configure:3305: checking for bidirectional iterator syntax" >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + + +int main() { + + std::bidirectional_iterator oi; + +; return 0; } +EOF +if { (eval echo configure:3320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_BI_T_ 1 +EOF + +have_bi="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_BI_T_0 1 +EOF + +have_bi="yes" +fi +rm -f conftest* + +fi + +if test "$enable_stl" != "no" && test "$have_ri" != "yes"; then +echo $ac_n "checking for random access iterator syntax""... $ac_c" 1>&6 +echo "configure:3346: checking for random access iterator syntax" >&5 +cat > conftest.$ac_ext < +#include "confdefs.h" + + +int main() { + + std::random_access_iterator oi; + +; return 0; } +EOF +if { (eval echo configure:3361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_RI_T_3 1 +EOF + +have_ri="yes" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_RI_T_0 1 +EOF + +have_ri="yes" +fi +rm -f conftest* + +fi + +if test "$enable_stl" != "no"; then +echo $ac_n "checking for output iterator assignment""... $ac_c" 1>&6 +echo "configure:3387: checking for output iterator assignment" >&5 +cat > conftest.$ac_ext < +#ifdef BOOST_RE_OLD_IOSTREAM +#include +std::ostream_iterator a(cout); +std::ostream_iterator b(cout); +#else +#include +std::ostream_iterator a(std::cout); +std::ostream_iterator b(std::cout); +#endif + +#include +#if !defined(BOOST_RE_NO_TRICKY_DEFAULT_PARAM) && !defined(BOOST_RE_NO_DEFAULT_PARAM) +typedef std::list list_type; +#else +typedef std::list list_type; +#endif + +list_type v; + +std:: back_insert_iterator c(v); +std:: back_insert_iterator d(v); + + +int main() { + + a = b; + c = d; + +; return 0; } +EOF +if { (eval echo configure:3424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_OI_ASSIGN +EOF + + +fi +rm -f conftest* + +fi + + + + + +# +# generate include dependencies +# +ac_all_h="" +ac_all_dep="" +for file in ../../boost/re_detail/*.hpp +do + if test "$file" != '../../boost/re_detail/*.hpp'; then + ac_all_h="$ac_all_h ../$file" + ac_all_dep="$ac_all_dep $file" + fi +done +#echo "$ac_all_h" + +# +# generate source dependencies +# +ac_all_o="" +ac_rules="" +ac_all_cpp="" +cat ./lib/makefile.org > ./lib/makefile.in +for file in src/*.cpp src/*.c +do + if test "$file" != 'src/*.cpp' && test "$file" != 'src/*.c'; then + ac_all_dep="$ac_all_dep $file" + ac_all_cpp="$ac_all_cpp $file" + root=`echo "$file" | sed 's/src\/\(.*\)\..*/\1/g'` + ac_all_o="$ac_all_o $root$ac_obj_ext" + echo >> ./lib/makefile.in + echo >> ./lib/makefile.in + echo "$root$ac_obj_ext"': $(ALL_H) '"../$file" >> ./lib/makefile.in + echo ' $(CPP) $(CPP_PROJ)'" ../$file" >> ./lib/makefile.in + echo ' $(AR) -rc lib$(LIBNAME).a'" $root$ac_obj_ext" >> ./lib/makefile.in + fi +done + +echo "$ac_rules" >> ./lib/makefile.in + + + + + + +if test "$enable_ms_windows" != "no"; then +ac_regress="r1$ac_exe_ext" +fi +ac_regress="$ac_regress r2$ac_exe_ext" +if test "$ac_have_locale" != "no"; then +ac_regress="$ac_regress r3$ac_exe_ext" +fi + +if test "$enable_wstring" != "no"; then +if test "$enable_ms_windows" != "no"; then +ac_regress="$ac_regress r4$ac_exe_ext" +fi +ac_regress="$ac_regress r5$ac_exe_ext" +if test "$ac_have_locale" != "no"; then +ac_regress="$ac_regress r6$ac_exe_ext" +fi +fi + + + +if test "$enable_ms_windows" = "no"; then +cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_W32 +EOF + +fi + + +# +# OK final test for possible link time problems: +# +cat > conf2.h << EOF + +#include "confdefs.h" +#include + +template +class factorial +{ +public: + factorial(); + T operator()(T); +}; + +template +factorial::factorial() +{ +} + +template +T factorial::operator()(T t) +{ + T result = 1; + for(T i = 1; i <= t; ++i) + { + result *= i; + } + return result; +} + +int conf2_test(); + + +EOF + +cat > conf2.cpp << EOF + +#include "conf2.h" + +int conf2_test() +{ + factorial f; + return f(8); +} + +EOF + +old_libs="$LIBS" + +LIBS="conf2.cpp $old_libs" + +echo $ac_n "checking for link time template merging""... $ac_c" 1>&6 +echo "configure:3572: checking for link time template merging" >&5 +cat > conftest.$ac_ext < g; + g(5); + conf2_test(); + +; return 0; } +EOF +if { (eval echo configure:3587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_TEMPLATE_MERGE +EOF + +echo "$ac_t""no" 1>&6 +echo "$ac_t"" Warning - $0 has determined that your compiler can not merge" 1>&6 +echo "$ac_t"" template instances, you may have problems linking to libregex++.a - " 1>&6 +echo "$ac_t"" see the FAQ for further details." 1>&6 + + +fi +rm -f conftest* + +if eval "$CXX $CXXFLAGS -c conf2.cpp" && eval "ar -rc libconf2.a conf2$ac_obj_ext"; then +LIBS="-L./ -lconf2 $old_libs" + +echo $ac_n "checking for link time template merging from archive files""... $ac_c" 1>&6 +echo "configure:3611: checking for link time template merging from archive files" >&5 +cat > conftest.$ac_ext < g; + g(5); + conf2_test(); + +; return 0; } +EOF +if { (eval echo configure:3626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_TEMPLATE_MERGE_A +EOF + +echo "$ac_t""no" 1>&6 +echo "$ac_t"" Warning - $0 has determined that your compiler can not merge " 1>&6 +echo "$ac_t"" template instances, if these are located inside an archive file," 1>&6 +echo "$ac_t"" you may have problems linking to libregex++.a - see the FAQ for" 1>&6 +echo "$ac_t"" further details." 1>&6 + + +fi +rm -f conftest* + +else + +echo "$ac_t""Unable to create library archive" 1>&6 + +fi + + +# +# cleanup +# +rm -f conf2.h +rm -f conf2.cpp +rm -f "conf2$ac_obj_ext" +rm -f libconf2.a +LIBS="$old_libs" + +cat > conf2.h << EOF + +#include "confdefs.h" +#include + +template +class factorial +{ +public: + factorial(); + T operator()(T); +}; + +template +factorial::factorial() +{ +} + +template +T factorial::operator()(T t) +{ + T result = 1; + switch(t) + { + case 2: + for(T i = 1; i <= 2; ++i) + { + result *= i; + } + return result; + case 3: + for(T i = 1; i <= 3; ++i) + { + result *= i; + } + return result; + case 4: + for(T i = 1; i <= 4; ++i) + { + result *= i; + } + return result; + case 5: + for(T i = 1; i <= 5; ++i) + { + result *= i; + } + return result; + case 6: + for(T i = 1; i <= 6; ++i) + { + result *= i; + } + return result; + case 7: + for(T i = 1; i <= 7; ++i) + { + result *= i; + } + return result; + default: + for(T i = 1; i <= t; ++i) + { + result *= i; + } + return result; + } + return 0; +} + +int conf2_test(); + + +EOF + +cat > conf2.cpp << EOF + +#include "conf2.h" + +int conf2_test() +{ + factorial f; + return f(8); +} + +EOF + +old_libs="$LIBS" + +LIBS="conf2.cpp $old_libs" + +echo $ac_n "checking for link time template merging of switch statements""... $ac_c" 1>&6 +echo "configure:3755: checking for link time template merging of switch statements" >&5 +cat > conftest.$ac_ext < g; + g(5); + conf2_test(); + +; return 0; } +EOF +if { (eval echo configure:3770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define BOOST_RE_NO_TEMPLATE_SWITCH_MERGE +EOF + +echo "$ac_t""no" 1>&6 +echo "$ac_t"" Warning - $0 has determined that your compiler can not merge" 1>&6 +echo "$ac_t"" template instances, if those instances contain switch statements, " 1>&6 +echo "$ac_t"" you may have problems linking to libregex++.a - " 1>&6 +echo "$ac_t"" see the FAQ for further details." 1>&6 + + +fi +rm -f conftest* + +# +# cleanup +# +rm -f conf2.h +rm -f conf2.cpp +LIBS="$old_libs" + + + +cat >> confdefs.h <<\EOF +#define BOOST_RE_AUTO_CONF 1 +EOF + + +echo "$ac_t""***" 1>&6 +echo "$ac_t""$0: setting up headers..." 1>&6 +echo "$ac_t""***" 1>&6 +trap '' 1 2 15 + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir + +trap 'rm -fr `echo "lib/makefile demo/jgrep/makefile demo/timer/makefile demo/regress/makefile makefile ../../boost/re_detail/regex_options.hpp:jm_opt.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CXX@%$CXX%g +s%@ac_exe_ext@%$ac_exe_ext%g +s%@ac_obj_ext@%$ac_obj_ext%g +s%@ac_all_o@%$ac_all_o%g +s%@ac_all_h@%$ac_all_h%g +s%@ac_all_cpp@%$ac_all_cpp%g +s%@ac_all_dep@%$ac_all_dep%g +s%@ac_regress@%$ac_regress%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +echo "$ac_t""***" 1>&6 +echo "$ac_t""$0: regex++ package tuned for use with \"${CXX}\" compiler." 1>&6 +echo "$ac_t""$0: To restore original settings - copy jm_opt.in to ../../boost/re_detail/regex_options.hpp" 1>&6 +echo "$ac_t""***" 1>&6 + +#post processing cleanup: +sed 's%^ *#[ ]*undef[ ][ ]*\(.*\)[ ]*$%/* #define \1 */%' ../../boost/re_detail/regex_options.hpp > jm_opt.out +cat jm_opt.out > ../../boost/re_detail/regex_options.hpp +sed 's%\(#[ ]*\)undef[ ]%\1define %' ../../boost/re_detail/regex_options.hpp > jm_opt.out +cat jm_opt.out > ../../boost/re_detail/regex_options.hpp +rm -f jm_opt.out + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/configure.in b/configure.in new file mode 100644 index 00000000..b78fa6dd --- /dev/null +++ b/configure.in @@ -0,0 +1,1747 @@ + +dnl Process this file with autoconf to produce a configure script. +AC_INIT(../../boost/regex.hpp) +AC_CONFIG_HEADER(../../boost/re_detail/regex_options.hpp:jm_opt.in) +AC_DEFINE(BOOST_RE_AUTO_CONFIGURE, []) +dnl Disable any caching here +define([AC_CACHE_LOAD], )dnl +define([AC_CACHE_SAVE], )dnl + +AC_MSG_RESULT(*** $0: regex++ configuration utility ***) +if test "${CXXFLAGS}" = ""; then +AC_MSG_RESULT(* Note: for best reliability - try \"CXXFLAGS=-treat_warnings_as_errors\" $0 ) +AC_MSG_RESULT(* Please don't forget specifying typical CXXFLAGS you'll be using - ) +AC_MSG_RESULT(* such as that enabling exceptions handling, etc. ) +AC_MSG_RESULT(* Add option forcing instantiation of all templates to CXXFLAGS if possible. ) +AC_MSG_RESULT(* Add option enabling merging of template instances between translation units) +AC_MSG_RESULT(* to CXXFLAGS if possible. ) +fi +AC_MSG_RESULT(Please stand by while exploring compiler capabilities...) +AC_MSG_RESULT(Be patient - this could take some time...) +AC_MSG_RESULT(***) + +AC_ARG_ENABLE(extension,[--enable-extension=], +[ +case "$enableval" in + no) AC_MSG_RESULT(Info :.cpp used as extension for tests) + ac_ext=cpp + ;; + *) AC_MSG_RESULT(Argument : .$enableval used as extension) + ac_ext=$enableval +esac +], +[AC_MSG_RESULT(Info : .cpp used as extension for tests) + ac_ext=cpp +] +) + +AC_ARG_ENABLE(sizeof-short, [--enable-sizeof-short=], [], [enable_sizeof_short=2]) +AC_ARG_ENABLE(sizeof-int, [--enable-sizeof-int=], [], [enable_sizeof_int=4]) +AC_ARG_ENABLE(sizeof-long, [--enable-sizeof-long=], [], [enable_sizeof_long=4]) +AC_ARG_ENABLE(force-cross, [--enable-force-cross forces cross compile mode]) + + +# Save that, as it is being redefined several times +use_ac_ext=$ac_ext + +AC_PROG_CXX +ac_ext=$use_ac_ext + +AC_LANG_CPLUSPLUS +ac_ext=$use_ac_ext + +AC_MSG_CHECKING(for object file extention) +cat > "xyqtcz.$ac_ext" << EOF + +int main() +{ +} + +EOF + +if eval "$CXX $CXXFLAGS -c xyqtcz.$ac_ext"; then +rm -f "xyqtcz.$ac_ext" +ac_obj_ext=`find xyqtcz.* | sed 's/xyqtcz\(.*\)/\1/g'` +AC_MSG_RESULT(yes - $ac_obj_ext) +rm -f "xyqtcz$ac_obj_ext" + +else + +AC_MSG_RESULT(no - could not create or find object file, defaulting to .o) +rm -f "xyqtcz.$ac_ext" +ac_obj_ext='.o' + +fi + +AC_MSG_CHECKING(for executable file extention) +ac_exe_ext="" +for file in /bin/sh.* +do + +if test -x "$file"; then +ac_exe_ext=`echo "$file" | sed 's/\/bin\/sh\(.*\)/\1/g'` +fi + +done + +AC_MSG_RESULT(yes - $ac_exe_ext) +AC_SUBST(ac_exe_ext) +AC_SUBST(ac_obj_ext) + + +# +# determine machine word sizes +# and set BOOST_RE_INT32 to be the +# equivalent of intfast32_t in +# +if test "$enable_force_cross" = "yes"; then +cross_compiling="yes" +echo forced cross compilation mode turned on +fi + +AC_CHECK_SIZEOF(short,"$enable_sizeof_short") +ac_ext=$use_ac_ext +AC_CHECK_SIZEOF(int,"$enable_sizeof_int") +ac_ext=$use_ac_ext +AC_CHECK_SIZEOF(long,"$enable_sizeof_long") +ac_ext=$use_ac_ext + +AC_DEFINE_UNQUOTED(BOOST_RE_SIZEOF_SHORT, [$ac_cv_sizeof_short]) +AC_DEFINE_UNQUOTED(BOOST_RE_SIZEOF_INT, [$ac_cv_sizeof_int]) +AC_DEFINE_UNQUOTED(BOOST_RE_SIZEOF_LONG, [$ac_cv_sizeof_long]) + + +if test "$ac_cv_sizeof_int" -lt 4; then + if test "$ac_cv_sizeof_long" -ge 4; then + AC_DEFINE(BOOST_RE_INT32_LONG) + else + AC_MSG_ERROR(Cannot find any 32-bit integer type for your compiler) + fi + ac_ext=$use_ac_ext +fi +ac_ext=$use_ac_ext + + +ac_ext=$use_ac_ext + +dnl checking for compiler capabilities +AC_MSG_CHECKING(for basic template compatibility) +AC_TRY_LINK( [ +template +struct binary_function { + typedef Arg1 first_argument_type; + typedef Arg2 second_argument_type; + typedef Result result_type; +}; +template +struct plus : public binary_function { + T operator()(const T& x, const T& y) const; +}; + +// +// non-inline +// link will fail if template is not instantiated +// +template +T plus::operator()(const T& x, const T& y) const +{ return x + y; } + +plus p; +], +[ +// check member function is actually instantiated +int i, j, k; +i = p(k, j); +], +[ac_cv_compat="yes"], +[AC_MSG_ERROR(Your compiler won't be able to compile this implementation. Sorry.) + ac_cv_compat="no"] +) +AC_MSG_RESULT($ac_cv_compat) + +AC_MSG_CHECKING(for exception support) +AC_TRY_COMPILE( +[ +#include + +int f1()throw() +{ + return 23; +} + +void do_throw() +{ + throw (int)25; +} +], +[ + try + { + f1(); + do_throw(); + } + catch(int i) + { + } + catch(...) + { + } +], +[AC_MSG_RESULT(yes)], +[AC_MSG_RESULT(no) +AC_MSG_ERROR(Sorry, without exception handling you can't compile this library)]) + + +AC_ARG_ENABLE(mutable, [--disable-mutable turns off mutable support]) +if test "$enable_mutable" = "no"; then +AC_DEFINE(BOOST_RE_NO_MUTABLE, []) +else + +AC_MSG_CHECKING(for mutable keyword) +AC_TRY_COMPILE( +[ +#include + +class foo +{ + mutable int val; + public: + foo(int i) : val(i) {} + void set(int i)const; +}; + +void foo::set(int i)const +{ + val = i; +} +], +[ + const foo f(4); + f.set(3); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_MUTABLE, []) AC_MSG_RESULT(no)]) +fi + +AC_MSG_CHECKING(for default template parameter support) +AC_TRY_COMPILE( +[ +#include + +template +struct foo +{ + T val; + U alt; +}; +], +[ + foo f1; + foo f2; + foo f3; + foo f4; +], +[AC_MSG_RESULT(yes)], +[AC_MSG_ERROR(Sorry: you can't compile this library)]) + +AC_MSG_CHECKING(for derived default template parameter support) +AC_TRY_COMPILE( +[ +#include + +template +class inner +{ +public: + typedef T inner_type; +}; + +template > +struct foo +{ + T val; + U alt; +}; +], +[ + foo > f1; + foo > f2; + foo f3; + foo f4; +], +[AC_MSG_RESULT(yes)], +[AC_MSG_ERROR(Sorry, you can't compile this library)]) + + +AC_MSG_CHECKING([for function template partial ordering]) +AC_TRY_COMPILE( +[ +#include + +template +struct dummy{}; + +struct dummy2 +{ + int result()const { return 1; } +}; + +template +int foo(const T& t) +{ return t.result(); } + +template +int foo(const dummy& ) +{ return 0; } + +], +[ + dummy d; + dummy2 d2; + int i = foo(d); + i = foo(d2); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_PARTIAL_FUNC_SPEC, []) AC_MSG_RESULT(no)]) + +AC_MSG_CHECKING([for template friend functions]) +AC_TRY_COMPILE( +[ +#include + +template +void foo(T2 t); + +template +struct dummy +{ + template friend void foo(T2); +private: + void foo2(); + void foo3()const; +}; + +template +void foo(T2 t) +{ + dummy d1; + d1.foo2(); + d1.foo3(); + dummy d2; + d2.foo2(); + d2.foo3(); +} + + +], +[ + foo(3); + foo(2.345); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_TEMPLATE_FRIEND, []) AC_MSG_RESULT(no)]) + + + +AC_ARG_ENABLE(ms-windows, [--disable-ms-windows turns off native MS Windows support (when available)]) +AC_ARG_ENABLE(threads, [--disable-threads turns off multi-threading support (when available)]) +if test "$enable_ms_windows" != "no"; then + +AC_MSG_CHECKING(for MS Windows) +AC_TRY_COMPILE( +[ +#include + +#if defined(__GNUC__) && (__GNUC_MINOR__ == 95) && (__GNUC__ == 2) +#error can't mix STL code with due to bug in gcc2.95.x +#endif + + +], +[ + int i = GetVersion(); +], +[iswin="true" +AC_DEFINE(BOOST_RE_PLATFORM_WINDOWS, []) +AC_MSG_RESULT(yes)], +[AC_MSG_RESULT(no) +enable_ms_windows="no"] +) +fi + +if test "$enable_ms_windows" != "no"; then +dnl Ok check for Win32, then linkage: +AC_MSG_CHECKING(for MS Win32) +AC_TRY_COMPILE( +[ +#include + +CRITICAL_SECTION cs; +], +[ + InitializeCriticalSection(&cs); + EnterCriticalSection(&cs); + LeaveCriticalSection(&cs); + DeleteCriticalSection(&cs); +], +[AC_MSG_RESULT(yes)], +[AC_MSG_RESULT(no) +enable_ms_windows="no"] +) +fi + +if test "$enable_ms_windows" != "no"; then + +if test "$CXX" != "cl"; then +AC_CHECK_LIB(user32, main, [LIBS="$LIBS -luser32"], []) +AC_CHECK_LIB(kernel32, main, [LIBS="$LIBS -lkernel32"], []) +fi + +AC_TRY_LINK( +[ +#include + +CRITICAL_SECTION cs; +], +[ + InitializeCriticalSection(&cs); + EnterCriticalSection(&cs); + LeaveCriticalSection(&cs); + DeleteCriticalSection(&cs); + HeapAlloc(0, 0, 20); + CharLower((LPTSTR)0); + LoadString(0, 0, 0, 0); +], +[ +if test "enable_threads" != "no"; then +# turn on threading support: +AC_MSG_CHECKING(for mult-thread support) +AC_MSG_RESULT("yes") +AC_DEFINE(BOOST_RE_THREADS, []) +AC_DEFINE(BOOST_RE_PLATFORM_W32, []) +fi +], +[ +# bu**er, windows is present but we can't link +AC_MSG_WARN([ + MS Win32 seems to be present, but we can't link, + or find the default library names for kernal32.dll + and user32.dll. + $0 is disabling MS Windows support, re-run $0 with + the environment variable "LIBS" set to the library + files required to re-enable Win32 support.]) +enable_ms_windows="no" +] +) + + +fi + + +if test "$iswin" != "true"; then + +AC_MSG_CHECKING(for MS DOS) +AC_TRY_COMPILE( +[ +#include +], +[ + int i = _doserrno; +], +[AC_DEFINE(BOOST_RE_PLATFORM_DOS, []) AC_MSG_RESULT(yes)], +[AC_MSG_RESULT(no)]) + +fi + + +AC_MSG_CHECKING(for bool support) +AC_TRY_COMPILE( +[ +], +[ + bool i = true; +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_BOOL,[]) +AC_MSG_RESULT(no)]) + + +AC_ARG_ENABLE(wstring, [--disable-wstring turns off wide character string support]) + +if test "$enable_wstring" = "no"; then +AC_DEFINE(BOOST_RE_NO_WCHAR_H, []) +else + +AC_MSG_CHECKING(for ) +AC_TRY_LINK( +[ +#include +], +[ +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_WCHAR_H,[]) +AC_MSG_RESULT(no)] +) +fi + +if test "$enable_wstring" = "no"; then +AC_DEFINE(BOOST_RE_NO_WCTYPE_H, []) +else + +AC_MSG_CHECKING(for ) +AC_TRY_LINK( +[ +#include +], +[ +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_WCTYPE_H,[]) +AC_MSG_RESULT(no)] +) +fi + + +if test "$enable_wstring" = "no"; then +AC_DEFINE(BOOST_RE_NO_WCSTRING, []) +else + +AC_MSG_CHECKING(for wide string functions) +AC_TRY_LINK( +[ +#include "confdefs.h" +#ifndef BOOST_RE_NO_WCHAR_H +#include +#endif +#ifndef BOOST_RE_NO_WCTYPE_H +#include +#endif +#include +#include +#include +#include +#include +template class std::basic_string; +], +[ + using namespace std; + wchar_t c[50]; + char d[50]; + wcscpy(c, L"abcd"); + wcscmp(L"", L""); + wcslen(L""); + wcsxfrm(0, L"", 0); + wcstombs(d, L"", 0); + mbstowcs(c, "", 0); + iswlower(L'c'); +], +[AC_MSG_RESULT(yes)] +enable_wstring="yes", +[AC_DEFINE(BOOST_RE_NO_WCSTRING,[]) +AC_MSG_RESULT(no)] +enable_wstring="no") +fi + +if test "$enable_wstring" != "no"; then +AC_MSG_CHECKING(for swprintf support) +AC_TRY_LINK( +[ +#include "confdefs.h" +#ifndef BOOST_RE_NO_WCHAR_H +#include +#endif +#ifndef BOOST_RE_NO_WCTYPE_H +#include +#endif +#include +#include +], +[ + wchar_t c[50]; + swprintf(c, L"abcd"); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_SWPRINTF,[]) +AC_MSG_RESULT(no)] +enable_swprintf="no") +fi + +if test "$enable_wstring" != "no" && test "$enable_swprintf" = "no"; then +AC_MSG_CHECKING(for wsprintf support) +AC_TRY_LINK( +[ +#include "confdefs.h" +#ifndef BOOST_RE_NO_WCHAR_H +#include +#endif +#ifndef BOOST_RE_NO_WCTYPE_H +#include +#endif +#include +#include +#include +], +[ + wchar_t c[50]; + wsprintf(c, "abcd"); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_WSPRINTF,[]) +AC_MSG_RESULT(no)]) +fi + + + +AC_ARG_ENABLE(member-templates, [--disable-member-templates turns off member template class and function support]) +if test "$enable_member_templates" = "no"; then +AC_DEFINE(BOOST_RE_NO_MEMBER_TEMPLATES, []) +else + +AC_MSG_CHECKING(for member template classes and functions) +AC_TRY_COMPILE( +[ + +template +class alloc +{ +public: + void* allocate(int); + void deallocate(void*); + alloc(); + alloc(const alloc&); + template + alloc(const alloc&) {} + alloc& operator=(const alloc&); + template + alloc& operator=(const alloc&) + { return *this; } + + template + struct rebind + { + typedef alloc other; + }; +}; + +], +[ + alloc ia; + alloc da(ia); + alloc fa; + fa.allocate(5); + fa = ia; +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_MEMBER_TEMPLATES,[]) +AC_MSG_RESULT(no)]) +fi + + +AC_ARG_ENABLE(template-returns, [--disable-template-returns turns off support for templates specialised by return type]) +if test "$enable_template_returns" = "no"; then +AC_DEFINE(BOOST_RE_NO_TEMPLATE_RETURNS, []) +else + +AC_MSG_CHECKING(for parameterised function returns) +AC_TRY_COMPILE( +[ +template +T coerse(int i) +{ return T(i); } +], +[ + double d = coerse(5); + int i = coerse(3); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_TEMPLATE_RETURNS,[]) +AC_MSG_RESULT(no)]) +fi + + +AC_ARG_ENABLE(int64, [--disable-int64 turns off support for 64-bit integer types]) +if test "$enable_int64" = "no"; then +AC_DEFINE(BOOST_RE_INT64_T_0) +else + +AC_MSG_CHECKING(for 64-bit integral type) + +if test "$ac_cv_sizeof_short" -eq 8; then +AC_DEFINE(BOOST_RE_INT64_T_1) +AC_MSG_RESULT(yes - short) +have_int64="true" +fi +if test "$ac_cv_sizeof_int" -eq 8 && test "$have_int64" != "true"; then +AC_DEFINE(BOOST_RE_INT64_T_2) +AC_MSG_RESULT(yes - int) +have_int64="true" +fi +if test "$ac_cv_sizeof_long" -eq 8 && test "$have_int64" != "true"; then +AC_DEFINE(BOOST_RE_INT64_T_3) +AC_MSG_RESULT(yes - long) +have_int64="true" +fi +if test "$have_int64" != "true"; then +AC_TRY_COMPILE( +[ +#include + +int64_t i = INT64_C(0x100000000); +], +[ +], +[AC_MSG_RESULT(yes - int64_t) +have_int64="true" +AC_DEFINE(BOOST_RE_INT64_T_4) +], +[]) +fi + +if test "$have_int64" != "true"; then + +AC_TRY_COMPILE( +[ +#include + +long long i = 0x100000000LL; +], +[ +], +[AC_MSG_RESULT(yes - long long) +have_int64="true" +AC_DEFINE(BOOST_RE_INT64_T_5) +], +[]) + +fi + +if test "$have_int64" != "true"; then + +AC_TRY_COMPILE( +[ +#include + +__int64 i = 0x100000000i64; +], +[ +], +[AC_MSG_RESULT(yes - __int64) +have_int64="true" +AC_DEFINE(BOOST_RE_INT64_T_6) +], +[]) +fi +if test "$have_int64" != "true"; then +AC_DEFINE(BOOST_RE_INT64_T,0) +AC_MSG_RESULT(no) +fi +fi + + +AC_ARG_ENABLE(messages, [--disable-messages turns off support for POSIX message categories, when available.]) +if test "$enable_messages" = "no" || test "$enable_ms_windows" != "no"; then +AC_DEFINE(BOOST_RE_NO_CAT, []) +else + +AC_CHECK_LIB(nl_types, catopen) +AC_CHECK_LIB(posix, catopen) + +AC_MSG_CHECKING(for POSIX message categories) +AC_TRY_LINK( +[ +#include + +nl_catd message_cat = (nl_catd)-1; +], +[ + message_cat = catopen("some_name", 0); + catclose(message_cat); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_CAT,[]) +AC_MSG_RESULT(no)]) + +fi + +if test "$enable_threads" != "no" && test "$enable_ms_windows" = "no"; then + +AC_CHECK_LIB(pthread, pthread_mutex_init) +AC_CHECK_LIB(posix, pthread_mutex_init) + +AC_MSG_CHECKING(for POSIX threads) +AC_TRY_LINK( +[ +#include + +pthread_mutex_t m; + +], +[ + pthread_mutex_init(&m, NULL); + pthread_mutex_lock(&m); + pthread_mutex_unlock(&m); + pthread_mutex_destroy(&m); +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_THREADS, [])], +[AC_MSG_RESULT(no)]) + +fi + + +AC_ARG_ENABLE(nested-template-prefix, [--disable-nested-template-prefix turns off use of \"template\" as the nested template class access specifier.]) +if test "$enable_nested_template_prefix" = "no" || test "$enable_member_templates" = "no"; then +AC_DEFINE(BOOST_RE_NESTED_TEMPLATE_DECL, []) +else + +AC_MSG_CHECKING(for template nested class access) +AC_TRY_COMPILE( +[ +template +class alloc +{ +public: + void* allocate(int); + void deallocate(void*); + alloc(); + alloc(const alloc&); + template + alloc(const alloc&) {} + alloc& operator=(const alloc&); + template + alloc& operator=(const alloc&) + { return *this; } + + template + struct rebind + { + typedef alloc other; + }; +}; + +], +[ + alloc ia; + alloc da(ia); + alloc fa; + fa.allocate(5); + fa = ia; + alloc::template rebind::other da2(ia); +], +[ +AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_NESTED_TEMPLATE_DECL,template) +], +[ +AC_DEFINE(BOOST_RE_NESTED_TEMPLATE_DECL,[]) +AC_MSG_RESULT(no) +]) + +fi + +AC_MSG_CHECKING(for explicit template instantiation) +AC_TRY_COMPILE( +[ +#include "confdefs.h" +#include + +template +class factorial +{ +public: + factorial(); + T operator()(T); +}; + +template +factorial::factorial() +{ +} + +template +T factorial::operator()(T t) +{ + T result = 1; + for(T i = 1; i <= t; ++i) + { + result *= i; + } + return result; +} + +template class factorial; +template class factorial; +], +[ +], +[ +AC_MSG_RESULT(yes) +], +[ +AC_DEFINE(BOOST_RE_NO_TEMPLATE_INST,[]) +AC_MSG_RESULT(no) +]) + + +AC_ARG_ENABLE(fastcall, [--disable-fastcall turns off use __fastcall and __stdcall.]) +if test "$enable_fastcall" = "no" || test "$enable_ms_windows" != "no"; then +AC_DEFINE(BOOST_RE_CALL, []) +AC_DEFINE(BOOST_RE_CCALL, []) +else + +AC_MSG_CHECKING(for __fastcall and __stdcall) +AC_TRY_COMPILE( +[ +void __fastcall f1(int) +{ +} + +void __stdcall f2(int) +{ +} + +], +[ + f1(2); + f2(3); +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_CALL, [__fastcall]) +AC_DEFINE(BOOST_RE_CCALL, [__stdcall]) +], +[AC_DEFINE(BOOST_RE_CALL, []) +AC_DEFINE(BOOST_RE_CCALL, []) +AC_MSG_RESULT(no)]) + +fi + +# move on to STL options: + + +AC_MSG_CHECKING(for standard library namespace) +AC_TRY_COMPILE( +[ +#include +#include +#include +#include "confdefs.h" + +namespace jm{ + +struct dummy{}; + +}; // namespace + +jm::dummy d; + +std::list v; + +], +[ +], +[AC_MSG_RESULT(yes - std) +have_std_namespace="yes" +], +[AC_MSG_RESULT(no - either STL is not present or in a non-standard namespace.) +AC_MSG_ERROR([Sorry, you can't compile this library unless the standard library is in namespace std.])]) + +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +class bad_expression : public std::exception +{ + unsigned int code; +public: + bad_expression(unsigned int err) : code(err) {} + bad_expression(const bad_expression& e) : std::exception(e), code(e.code) {} + bad_expression& operator=(const bad_expression& e) + { + std::exception::operator=(e); + code = e.code; + return *this; + } + virtual const char* what()const throw(); +}; + + +std::exception e; +std::bad_exception e3; +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_EXCEPTION_H, []) +]) + +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include + +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_ITERATOR_H, []) +]) + +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +need_algo="yes" +]) + +if test "$enable_stl" != "no" && test "$need_algo" = "yes"; then +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include + +], +[ +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_USE_ALGO, []) +], +[AC_MSG_RESULT(no - disabling STL support) +AC_DEFINE(BOOST_RE_NO_STL, []) +AC_DEFINE(BOOST_RE_NO_EXCEPTION_H, []) +AC_DEFINE(BOOST_RE_NO_ITERATOR_H, []) +AC_DEFINE(BOOST_RE_NO_MEMORY_H, []) +AC_DEFINE(BOOST_RE_NO_LOCALE_H, []) +AC_DEFINE(BOOST_RE_NO_STRING_H, []) +enable_stl="no" +]) + +fi + +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +std::allocator a; +std::allocator d(a); + +typedef std::allocator alloc_type; + +alloc_type::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other o(a); +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_MEMORY_H, []) +]) + + +if test "$enable_stl" != "no"; then +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +std::string a; +//std::wstring ws; + +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_MSG_ERROR(Sorry: you can't compile this library without ) +]) + +fi + +if test "$enable_stl" != "no"; then +AC_MSG_CHECKING(for std::basic_string default arguments) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +std::basic_string s1; +std::basic_string s2; + +], +[ +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_STRING_DEF_ARGS, []) +]) + +fi + +ac_have_locale='no' +if test "$enable_stl" != "no"; then +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +std::locale l; +], +[ +], +[AC_MSG_RESULT(yes) +ac_have_locale='yes' +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_LOCALE_H, []) +]) + +fi + +if test "$enable_stl" != "no"; then +AC_MSG_CHECKING(for ) +AC_TRY_COMPILE( +[ +#include +#include +#include "confdefs.h" + +], +[ + std::locale l; + std::cout.imbue(l); + std::cout << "some text" << std::endl; +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_OLD_IOSTREAM, []) +]) + +fi + +AC_MSG_CHECKING(for std::distance) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + int i, *j, *k; + i = std::distance(j, k); +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_DISTANCE_T_1) +have_dist="yes" +], +[]) + +if test "$enable_stl" != "no" && test "$have_dist" != "yes"; then +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + int i, *j, *k; + std::distance(j, k, i); +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_DISTANCE_T_2) +have_dist="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_DISTANCE_T_0) +have_dist="yes"]) + +fi + +if test "$enable_stl" != "no" && test "$have_si" != "yes"; then +AC_MSG_CHECKING(for standard iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::iterator oi; + std::iterator ii; + std::iterator fi; + std::iterator bi; + std::iterator ri; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_ITERATOR_T_1) +have_si="yes" +have_oi="yes" +have_ii="yes" +have_fi="yes" +have_bi="yes" +have_ri="yes" +], +[]) + +fi + +if test "$enable_stl" != "no" && test "$have_si" != "yes"; then +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::iterator oi; + std::iterator ii; + std::iterator fi; + std::iterator bi; + std::iterator ri; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_ITERATOR_T_2) +have_si="yes" +have_oi="yes" +have_ii="yes" +have_fi="yes" +have_bi="yes" +have_ri="yes" +], +[AC_MSG_RESULT(no)]) +AC_DEFINE(BOOST_RE_ITERATOR_T_0) + +fi + + +if test "$have_oi" != "yes"; then +AC_MSG_CHECKING(for output iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::output_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_OI_T_3) +have_oi="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_OI_T_0) +have_oi="yes"]) + +fi + +if test "$enable_stl" != "no" && test "$have_ii" != "yes"; then +AC_MSG_CHECKING(for input iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::input_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_II_T_3) +have_ii="yes" +], +[]) + +fi + +if test "$enable_stl" != "no" && test "$have_ii" != "yes"; then +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::input_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_II_T_4) +have_ii="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_II_T_0) +have_ii="yes"]) + +fi + +if test "$enable_stl" != "no" && test "$have_fi" != "yes"; then +AC_MSG_CHECKING(for forward iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::forward_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_FI_T_3) +have_fi="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_FI_T_0) +have_fi="yes"]) + +fi + +if test "$enable_stl" != "no" && test "$have_bi" != "yes"; then +AC_MSG_CHECKING(for bidirectional iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::bidirectional_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_BI_T_) +have_bi="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_BI_T_0) +have_bi="yes"]) + +fi + +if test "$enable_stl" != "no" && test "$have_ri" != "yes"; then +AC_MSG_CHECKING(for random access iterator syntax) +AC_TRY_COMPILE( +[ +#include +#include "confdefs.h" + +], +[ + std::random_access_iterator oi; +], +[AC_MSG_RESULT(yes) +AC_DEFINE(BOOST_RE_RI_T_3) +have_ri="yes" +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_RI_T_0) +have_ri="yes"]) + +fi + +if test "$enable_stl" != "no"; then +AC_MSG_CHECKING(for output iterator assignment) +AC_TRY_COMPILE( +[ +#include "confdefs.h" +#include +#ifdef BOOST_RE_OLD_IOSTREAM +#include +std::ostream_iterator a(cout); +std::ostream_iterator b(cout); +#else +#include +std::ostream_iterator a(std::cout); +std::ostream_iterator b(std::cout); +#endif + +#include +#if !defined(BOOST_RE_NO_TRICKY_DEFAULT_PARAM) && !defined(BOOST_RE_NO_DEFAULT_PARAM) +typedef std::list list_type; +#else +typedef std::list list_type; +#endif + +list_type v; + +std:: back_insert_iterator c(v); +std:: back_insert_iterator d(v); + +], +[ + a = b; + c = d; +], +[AC_MSG_RESULT(yes) +], +[AC_MSG_RESULT(no) +AC_DEFINE(BOOST_RE_NO_OI_ASSIGN, []) +]) + +fi + + + + + +# +# generate include dependencies +# +ac_all_h="" +ac_all_dep="" +for file in ../../boost/re_detail/*.hpp +do + if test "$file" != '../../boost/re_detail/*.hpp'; then + ac_all_h="$ac_all_h ../$file" + ac_all_dep="$ac_all_dep $file" + fi +done +#echo "$ac_all_h" + +# +# generate source dependencies +# +ac_all_o="" +ac_rules="" +ac_all_cpp="" +cat ./lib/makefile.org > ./lib/makefile.in +for file in src/*.cpp src/*.c +do + if test "$file" != 'src/*.cpp' && test "$file" != 'src/*.c'; then + dnl echo source dependency found "$file" + ac_all_dep="$ac_all_dep $file" + ac_all_cpp="$ac_all_cpp $file" + root=`echo "$file" | sed 's/src\/\(.*\)\..*/\1/g'` + dnl echo root file name is "$root" + ac_all_o="$ac_all_o $root$ac_obj_ext" + echo >> ./lib/makefile.in + echo >> ./lib/makefile.in + echo "$root$ac_obj_ext"': $(ALL_H) '"../$file" >> ./lib/makefile.in + echo ' $(CPP) $(CPP_PROJ)'" ../$file" >> ./lib/makefile.in + echo ' $(AR) -rc lib$(LIBNAME).a'" $root$ac_obj_ext" >> ./lib/makefile.in + fi +done + +echo "$ac_rules" >> ./lib/makefile.in + +AC_SUBST(ac_all_o) +AC_SUBST(ac_all_h) +AC_SUBST(ac_all_cpp) +AC_SUBST(ac_all_dep) + +if test "$enable_ms_windows" != "no"; then +ac_regress="r1$ac_exe_ext" +fi +ac_regress="$ac_regress r2$ac_exe_ext" +if test "$ac_have_locale" != "no"; then +ac_regress="$ac_regress r3$ac_exe_ext" +fi + +if test "$enable_wstring" != "no"; then +if test "$enable_ms_windows" != "no"; then +ac_regress="$ac_regress r4$ac_exe_ext" +fi +ac_regress="$ac_regress r5$ac_exe_ext" +if test "$ac_have_locale" != "no"; then +ac_regress="$ac_regress r6$ac_exe_ext" +fi +fi + +AC_SUBST(ac_regress) + +if test "$enable_ms_windows" = "no"; then +AC_DEFINE(BOOST_RE_NO_W32, []) +fi + + +# +# OK final test for possible link time problems: +# +cat > conf2.h << EOF + +#include "confdefs.h" +#include + +template +class factorial +{ +public: + factorial(); + T operator()(T); +}; + +template +factorial::factorial() +{ +} + +template +T factorial::operator()(T t) +{ + T result = 1; + for(T i = 1; i <= t; ++i) + { + result *= i; + } + return result; +} + +int conf2_test(); + + +EOF + +cat > conf2.cpp << EOF + +#include "conf2.h" + +int conf2_test() +{ + factorial f; + return f(8); +} + +EOF + +old_libs="$LIBS" + +LIBS="conf2.cpp $old_libs" + +AC_MSG_CHECKING(for link time template merging) +AC_TRY_LINK( +[ +#include "conf2.h" +], +[ + factorial g; + g(5); + conf2_test(); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_TEMPLATE_MERGE, []) +AC_MSG_RESULT(no) +AC_MSG_RESULT([ Warning - $0 has determined that your compiler can not merge]) +AC_MSG_RESULT([ template instances, you may have problems linking to libregex++.a - ]) +AC_MSG_RESULT([ see the FAQ for further details.]) +] +) + +if eval "$CXX $CXXFLAGS -c conf2.cpp" && eval "ar -rc libconf2.a conf2$ac_obj_ext"; then +LIBS="-L./ -lconf2 $old_libs" + +AC_MSG_CHECKING(for link time template merging from archive files) +AC_TRY_LINK( +[ +#include "conf2.h" +], +[ + factorial g; + g(5); + conf2_test(); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_TEMPLATE_MERGE_A, []) +AC_MSG_RESULT(no) +AC_MSG_RESULT([ Warning - $0 has determined that your compiler can not merge ]) +AC_MSG_RESULT([ template instances, if these are located inside an archive file,]) +AC_MSG_RESULT([ you may have problems linking to libregex++.a - see the FAQ for]) +AC_MSG_RESULT([ further details.]) +] +) + +else + +AC_MSG_RESULT(Unable to create library archive, library may not be fully configured.) + +fi + + +# +# cleanup +# +rm -f conf2.h +rm -f conf2.cpp +rm -f "conf2$ac_obj_ext" +rm -f libconf2.a +LIBS="$old_libs" + +cat > conf2.h << EOF + +#include "confdefs.h" +#include + +template +class factorial +{ +public: + factorial(); + T operator()(T); +}; + +template +factorial::factorial() +{ +} + +template +T factorial::operator()(T t) +{ + T result = 1; + switch(t) + { + case 2: + for(T i = 1; i <= 2; ++i) + { + result *= i; + } + return result; + case 3: + for(T i = 1; i <= 3; ++i) + { + result *= i; + } + return result; + case 4: + for(T i = 1; i <= 4; ++i) + { + result *= i; + } + return result; + case 5: + for(T i = 1; i <= 5; ++i) + { + result *= i; + } + return result; + case 6: + for(T i = 1; i <= 6; ++i) + { + result *= i; + } + return result; + case 7: + for(T i = 1; i <= 7; ++i) + { + result *= i; + } + return result; + default: + for(T i = 1; i <= t; ++i) + { + result *= i; + } + return result; + } + return 0; +} + +int conf2_test(); + + +EOF + +cat > conf2.cpp << EOF + +#include "conf2.h" + +int conf2_test() +{ + factorial f; + return f(8); +} + +EOF + +old_libs="$LIBS" + +LIBS="conf2.cpp $old_libs" + +AC_MSG_CHECKING(for link time template merging of switch statements) +AC_TRY_LINK( +[ +#include "conf2.h" +], +[ + factorial g; + g(5); + conf2_test(); +], +[AC_MSG_RESULT(yes)], +[AC_DEFINE(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE, []) +AC_MSG_RESULT(no) +AC_MSG_RESULT([ Warning - $0 has determined that your compiler can not merge]) +AC_MSG_RESULT([ template instances, if those instances contain switch statements, ]) +AC_MSG_RESULT([ you may have problems linking to libregex++.a - ]) +AC_MSG_RESULT([ see the FAQ for further details.]) +] +) + +# +# cleanup +# +rm -f conf2.h +rm -f conf2.cpp +LIBS="$old_libs" + + + +AC_DEFINE(BOOST_RE_AUTO_CONF) + +AC_MSG_RESULT(***) +AC_MSG_RESULT($0: setting up headers...) +AC_MSG_RESULT(***) +AC_OUTPUT(lib/makefile demo/jgrep/makefile demo/timer/makefile demo/regress/makefile makefile) +AC_MSG_RESULT(***) +AC_MSG_RESULT($0: regex++ package tuned for use with \"${CXX}\" compiler.) +AC_MSG_RESULT($0: To restore original settings - copy jm_opt.in to ../../boost/re_detail/regex_options.hpp) +AC_MSG_RESULT(***) + +#post processing cleanup: +sed 's%^[ ]*#[ ]*undef[ ][ ]*\(.*\)[ ]*$%/* #define \1 */%' ../../boost/re_detail/regex_options.hpp > jm_opt.out +cat jm_opt.out > ../../boost/re_detail/regex_options.hpp +sed 's%\(#[ ]*\)undef[ ]%\1define %' ../../boost/re_detail/regex_options.hpp > jm_opt.out +cat jm_opt.out > ../../boost/re_detail/regex_options.hpp +rm -f jm_opt.out + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo/c_compiler_checks/posix_api_compiler_check.c b/demo/c_compiler_checks/posix_api_compiler_check.c new file mode 100644 index 00000000..c6731ef7 --- /dev/null +++ b/demo/c_compiler_checks/posix_api_compiler_check.c @@ -0,0 +1,64 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE posix_api_compiler_check.c + * VERSION 3.01 + * DESCRIPTION: Verify that POSIX API calls compile: note this is a compile + * time check only. + */ + +#include +#include +#include +#include + +const char* expression = "^"; +const char* text = "\n "; +regmatch_t matches[1]; +int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB | + REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS | + REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP; + + +int main() +{ + regex_t re; + int result; + result = regcomp(&re, expression, REG_AWK); + if(result > REG_NOERROR) + { + char buf[256]; + regerror(result, &re, buf, sizeof(buf)); + printf(buf); + return result; + } + assert(re.re_nsub == 0); + matches[0].rm_so = 0; + matches[0].rm_eo = strlen(text); + result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND); + if(result > REG_NOERROR) + { + char buf[256]; + regerror(result, &re, buf, sizeof(buf)); + printf(buf); + regfree(&re); + return result; + } + assert(matches[0].rm_so == matches[0].rm_eo == 1); + regfree(&re); + return 0; +} diff --git a/demo/c_compiler_checks/wide_posix_api_compiler_check.c b/demo/c_compiler_checks/wide_posix_api_compiler_check.c new file mode 100644 index 00000000..c706f16f --- /dev/null +++ b/demo/c_compiler_checks/wide_posix_api_compiler_check.c @@ -0,0 +1,67 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE wide_posix_api_compiler_check.c + * VERSION 3.01 + * DESCRIPTION: Verify that POSIX API calls compile: note this is a compile + * time check only. + */ + +#include +#include +#include +#include +#define UNICODE +#include + +const wchar_t* expression = L"^"; +const wchar_t* text = L"\n "; +regmatch_t matches[1]; +int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB | + REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS | + REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP; + + +int main() +{ + regex_t re; + int result; + result = regcomp(&re, expression, REG_AWK); + if(result > REG_NOERROR) + { + wchar_t buf[256]; + regerror(result, &re, buf, sizeof(buf)); + wprintf(buf); + return result; + } + assert(re.re_nsub == 0); + matches[0].rm_so = 0; + matches[0].rm_eo = wcslen(text); + result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND); + if(result > REG_NOERROR) + { + wchar_t buf[256]; + regerror(result, &re, buf, sizeof(buf)); + wprintf(buf); + regfree(&re); + return result; + } + assert(matches[0].rm_so == matches[0].rm_eo == 1); + regfree(&re); + return 0; +} + diff --git a/demo/jgrep/bc55.mak b/demo/jgrep/bc55.mak new file mode 100644 index 00000000..c249519d --- /dev/null +++ b/demo/jgrep/bc55.mak @@ -0,0 +1,49 @@ + +# very basic makefile for jgrep.exe +# +# Borland C++ tools +# +# BCROOT defines the root directory of your bc builder install +# +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + +BCC32 = $(BCROOT)\bin\Bcc32.exe +LIBPATH=..\..\lib\bcb5 + +IDE_LinkFLAGS32 = -L$(BCROOT)\LIB +LINKOPTS= -ap -Tpe -x +COMPOPTS= -O2 -tWM- -DSTRICT; -I$(BCROOT)\include;../../../../; -D_NO_VCL + + + +jgrep.exe : jgrep.obj main.obj + $(BCC32) $(COMPOPTS) -e$@ -L$(LIBPATH) main.obj jgrep.obj + +jgrep.obj : jgrep.cpp + $(BCC32) -c @&&| + $(COMPOPTS) -o$@ jgrep.cpp +| + +main.obj : main.cpp + $(BCC32) -c @&&| + $(COMPOPTS) -o$@ main.cpp +| + + + + + + + + + + + + + + + + + diff --git a/demo/jgrep/bcb4.mak b/demo/jgrep/bcb4.mak new file mode 100644 index 00000000..32c1f1d4 --- /dev/null +++ b/demo/jgrep/bcb4.mak @@ -0,0 +1,49 @@ + +# very basic makefile for jgrep.exe +# +# Borland C++ tools +# +# BCROOT defines the root directory of your bc builder install +# +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + +BCC32 = $(BCROOT)\bin\Bcc32.exe +LIBPATH="..\..\lib\bcb4" + +IDE_LinkFLAGS32 = -L$(BCROOT)\LIB +LINKOPTS= -ap -Tpe -x +COMPOPTS= -O2 -tWM- -DSTRICT; -I$(BCROOT)\include;../../../../; -D_NO_VCL + + + +jgrep.exe : jgrep.obj main.obj + $(BCC32) @&&| +$(COMPOPTS) -e$@ -L$(LIBPATH) main.obj jgrep.obj +| + +jgrep.obj : jgrep.cpp + $(BCC32) -c @&&| + $(COMPOPTS) -o$@ jgrep.cpp +| + +main.obj : main.cpp + $(BCC32) -c @&&| + $(COMPOPTS) -o$@ main.cpp +| + + + + + + + + + + + + + + + diff --git a/demo/jgrep/bcb5.mak b/demo/jgrep/bcb5.mak new file mode 100644 index 00000000..a69b04a8 --- /dev/null +++ b/demo/jgrep/bcb5.mak @@ -0,0 +1,47 @@ + +# very basic makefile for jgrep.exe +# +# Borland C++ tools +# +# BCROOT defines the root directory of your bc builder install +# +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + +BCC32 = $(BCROOT)\bin\Bcc32.exe +LIBPATH=../../lib/bcb5 + +IDE_LinkFLAGS32 = -L$(BCROOT)\LIB +LINKOPTS= -ap -Tpe -x +COMPOPTS= -O2 -tWM- -DSTRICT; -I$(BCROOT)\include;../../../../; -D_NO_VCL + + + +jgrep.exe : jgrep.obj main.obj + $(BCC32) $(COMPOPTS) -e$@ -L..\..\lib\bcb5 main.obj jgrep.obj + +jgrep.obj : jgrep.cpp + $(BCC32) -c @&&| + $(COMPOPTS) -o$@ jgrep.cpp +| + +main.obj : main.cpp + $(BCC32) -c @&&| + $(COMPOPTS) -o$@ main.cpp +| + + + + + + + + + + + + + + + diff --git a/demo/jgrep/gcc.mak b/demo/jgrep/gcc.mak new file mode 100644 index 00000000..55662a6c --- /dev/null +++ b/demo/jgrep/gcc.mak @@ -0,0 +1,27 @@ + +# very basic makefile for jgrep +# +# GNU compiler g++ +# +CXX= -O2 -I../../../../ -I./ + +jgrep : jgrep.cpp main.cpp + g++ -ojgrep $(CXX) jgrep.cpp main.cpp -L../../lib/gcc -lregex++ + + + + + + + + + + + + + + + + + + diff --git a/demo/jgrep/jgrep.cpp b/demo/jgrep/jgrep.cpp new file mode 100644 index 00000000..ccf65b23 --- /dev/null +++ b/demo/jgrep/jgrep.cpp @@ -0,0 +1,126 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * FILE jgrep.cpp + * VERSION 3.01 + */ + +#include +#include +#ifdef JM_OLD_IOSTREAM +#include +#else +#include +using std::cout; +using std::cin; +using std::cerr; +using std::endl; +#endif +#pragma hrdstop + +#include + +#include "jgrep.h" + + +// +// class ogrep_predicate +// outputs the results of regex_grep to screen: +template +class ogrep_predicate +{ + unsigned int& lines; + const char* filename; + unsigned int last_line; + iterator end_of_storage; +public: + ogrep_predicate(unsigned int& i, const char* p, iterator e) : lines(i), filename(p), last_line(-1), end_of_storage(e) {} + ogrep_predicate(const ogrep_predicate& o) : lines(o.lines), filename(o.filename), last_line(o.last_line), end_of_storage(o.end_of_storage) {} + bool operator () (const boost::match_results& i); +}; + +// ideally we'd ignor the allocator type and use a template member function +// to deel with the allocator type passed to regex_grep, unfortunately most +// compilers don't support this feature yet, so we'll have to be sure that +// the allocator passed to instances of this class match that used in our +// regular expression classes. + +template +bool ogrep_predicate::operator()(const boost::match_results& i) +{ + if(last_line == (unsigned int)-1) + cout << "File " << filename << ":" << endl; + if(last_line != i.line()) + { + ++lines; + last_line = i.line(); + if(count_only == 0) + { + if(show_lines) + cout << i.line() << "\t"; + iterator ptr = i.line_start(); + while((ptr != end_of_storage) && (*ptr != '\n'))++ptr; + iterator pos = i.line_start(); + while(pos != ptr) + { + cout.put(*pos); + ++pos; + } + cout << endl; + } + } + return true; +} + + +void process_grep(const char* file) +{ + using namespace boost; + mapfile f(file); + unsigned int count = 0; + ogrep_predicate oi(count, file, f.end()); + if(files_only) + { + bool ok; + boost::match_results m; + ok = regex_search(f.begin(), f.end(), m, e, match_not_dot_newline | match_not_dot_null); + if(ok) + cout << "File " << file << endl; + } + else + { + regex_grep(oi, f.begin(), f.end(), e, match_not_dot_newline | match_not_dot_null); + if(count) + { + if(verbose || count_only) + { + cout << count << " lines match" << endl; + return; + } + } + else if(verbose) + { + cout << "File " << file << "(" << f.size() << "bytes):" << endl << "0 lines match" << endl; + } + } +} + + + + + + + diff --git a/demo/jgrep/jgrep.h b/demo/jgrep/jgrep.h new file mode 100644 index 00000000..7c41521b --- /dev/null +++ b/demo/jgrep/jgrep.h @@ -0,0 +1,53 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * FILE jgrep.h + * VERSION 3.01 + */ + +#ifndef _JGREP_H +#define _JGREP_H + +#include + +// case sensitive reg_expression determines our allocator type: +typedef boost::reg_expression re_type; +typedef re_type::allocator_type allocator_type; + +// now declare static (global) data, including an allocator +// instance which we'll pass to all instances that require an allocator. + +extern allocator_type a; + +extern re_type e; + +// flags for output: + +extern bool use_case; +extern bool show_lines; +extern bool count_only; +extern bool files_only; +extern bool recurse; +extern bool regularexs; +extern bool words_only; +extern bool verbose; + +void process_grep(const char* file); + +#endif + + + diff --git a/demo/jgrep/main.cpp b/demo/jgrep/main.cpp new file mode 100644 index 00000000..3d838a15 --- /dev/null +++ b/demo/jgrep/main.cpp @@ -0,0 +1,284 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * FILE main.cpp + * VERSION 3.01 + */ + + +#include +#include +#ifdef JM_OLD_IOSTREAM +#include +#else +#include +using std::cout; +using std::cin; +using std::cerr; +using std::endl; +#endif +#pragma hrdstop + +#include +#include "jgrep.h" + +#ifndef JM_ALGO_INCLUDED +// HP and SGI STL's use instead +// this will have been pulled in by +// for std::distance +#include +#endif + +allocator_type a; + +re_type e(a); +//rei_type ei(a); + +// flags for output: + +bool use_case = true; +bool show_lines = false; +bool count_only = false; +bool files_only = false; +bool recurse = false; +bool regularexs = true; +bool words_only = false; +bool verbose = false; + + +void usage() +{ + cout << +"jgrep version 0.95\n" +"usage: jgrep [-options] expression file [files...]\n" +"\n" +"options can be one of the following:\n" +"\n" +"-c prints a count of the number of matching lines only\n" +"-d recurses through subdirectories for matching files\n" +"-i causes case to be ignored when matching\n" +"-l lists the files which contain a match only\n" +"-n displays the line numbers of matches\n" +"-r- causes the expression to be interpreted as a literal string and not\n" +" as a regular expression\n" +"-w searches for matches that are whole words only\n" +"-z verbose mode\n" +"\n" +"expression: a regular expression, or a literal string if -r- is specified\n" +"\n" +"files: one or more files to search, the names can contain the wildcard\n" +" characters ? and *\n" << endl; + +} + +void parse_switch(const char* flag) +{ + ++flag; + while(*flag) + { + switch(*flag) + { + case '-': + switch(*(flag-1)) + { + case 'c': + count_only = false; + break; + case 'd': + recurse = false; + break; + case 'i': + use_case = false; + break; + case 'l': + files_only = false; + break; + case 'n': + show_lines = false; + break; + case 'r': + regularexs = false; + break; + case 'w': + words_only = false; + break; + case 'z': + verbose = false; + break; + default: + cout << "Undefined option -"; + cout.put(*flag); + cout << endl; + } + // turn off prev character: + break; + case 'c': + count_only = true; + break; + case 'd': + recurse = true; + break; + case 'i': + use_case = false; + break; + case 'l': + files_only = true; + break; + case 'n': + show_lines = true; + break; + case 'r': + regularexs = true; + break; + case 'w': + words_only = true; + break; + case 'z': + verbose = true; + break; + case '?': + usage(); + exit(0); + case '+': + break; + default: + cout << "Undefined option -"; + cout.put(*flag); + cout << endl; + } + ++flag; + } +} + +void HandleFile(const char* wild) +{ + using namespace boost; + jm_trace("Handling file " << wild); + file_iterator end; + file_iterator start(wild); + + if(recurse) + { + // go through sub directories: + char buf[MAX_PATH]; + std::strcpy(buf, start.root()); + int rootlen = strlen(buf); + if(*buf == 0) + { + std::strcpy(buf, "."); + std::strcat(buf, directory_iterator::separator()); + std::strcat(buf, "*"); + } + else + { + std::strcat(buf, directory_iterator::separator()); + std::strcat(buf, "*"); + } + jm_trace("Enumerating directories: " << buf); + directory_iterator dstart(buf); + directory_iterator dend; + + // now get the file mask bit of "wild": + const char* ptr = wild + rootlen; + if(*ptr) ++ptr; + jm_trace("File mask part is: " << ptr); + + while(dstart != dend) + { + std::sprintf(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); + HandleFile(buf); + ++dstart; + } + } + std::for_each(start, end, process_grep); +} + +int done = 0; + +void HandleArg(const char* arg) +{ + using namespace boost; + jm_trace("Handling argument: " << arg); + if(*arg == '-') + { + parse_switch(arg); + return; + } + if(done == 0) + { + // parse regular expression + if(regularexs) + { + if(words_only == 0) + { + e.set_expression(arg, use_case ? regbase::normal : regbase::normal | regbase::icase); + //ei.set_expression(arg); + } + else + { + char* buf = new char[std::strlen(arg) + 8]; + std::sprintf(buf, "\\<%s\\>", arg); + e.set_expression(buf, use_case ? regbase::normal : regbase::normal | regbase::icase); + //ei.set_expression(buf); + delete[] buf; + } + } + else + { + // we need to convert text to literal: + int len2 = std::strlen(arg); + int len = len2 * 5 + 6; + char buf[8]; + char* buf2 = new char[len]; + *buf2 = 0; + if(words_only) + std::strcpy(buf2, "\\<"); + for(int j = 0; j < len2; ++j) + { + std::sprintf(buf, "\\0%o", int(arg[j])); + std::strcat(buf2, buf); + } + if(words_only) + std::strcat(buf2, "\\>"); + e.set_expression(buf2, use_case ? regbase::normal : regbase::normal | regbase::icase); + //ei.set_expression(buf2); + delete[] buf2; + } + done = 1; + return; + } + // if we get to here we have one or more file names to process: + ++done; + HandleFile(arg); +} + +int main(int argc, char * argv[]) +{ + for(int i = 1; i < argc; ++i) + HandleArg(argv[i]); + if(done < 2) + usage(); + return 0; +} + + + + + + + + + diff --git a/demo/jgrep/makefile.in b/demo/jgrep/makefile.in new file mode 100644 index 00000000..5f996f34 --- /dev/null +++ b/demo/jgrep/makefile.in @@ -0,0 +1,41 @@ + +# very basic makefile for jgrep +# + +CXX=@CXX@ +CXXFLAGS=@CXXFLAGS@ +LIBS=@LIBS@ +EXE=@ac_exe_ext@ +OBJ=@ac_obj_ext@ + +LIBDEP=../../lib/libregex++.a ../../../../boost/re_detail/regex_options.hpp ../../../../boost/re_detail/regex_config.hpp + +jgrep$(EXE) : jgrep$(OBJ) main$(OBJ) + $(CXX) -o jgrep$(EXE) jgrep$(OBJ) main$(OBJ) -L../../lib -lregex++ $(LIBS) + +jgrep$(OBJ) : jgrep.cpp jgrep.h $(LIBDEP) + $(CXX) -c $(CXXFLAGS) -I../../../../ -I./ jgrep.cpp + +main$(OBJ) : main.cpp jgrep.h $(LIBDEP) + $(CXX) -c $(CXXFLAGS) -I../../../../ -I./ main.cpp + + + + + + + + + + + + + + + + + + + + + diff --git a/demo/jgrep/sunpro.mak b/demo/jgrep/sunpro.mak new file mode 100644 index 00000000..2ecd2b44 --- /dev/null +++ b/demo/jgrep/sunpro.mak @@ -0,0 +1,20 @@ +# Makefile for timer application +# +# for SUN workshop 5.0 C++ compiler +# + +CXX=CC +CPP_FLAGS = -O -I../../../../ -I./ + +%.o : %.cpp + $(CXX) -c -o $@ $(CPP_FLAGS) $< + +jgrep : jgrep.o main.o + $(CXX) -o $@ $(CPP_FLAGS) jgrep.o main.o -L../../lib -lregex++ + +clean: + rm -rf SunWS_cache + rm -f jgrep.o jgrep main.o + + + diff --git a/demo/jgrep/vc6-stlport.mak b/demo/jgrep/vc6-stlport.mak new file mode 100644 index 00000000..6a729c2a --- /dev/null +++ b/demo/jgrep/vc6-stlport.mak @@ -0,0 +1,16 @@ + +# +# very simple makefile for Visual C++ 6 + STLPort 4 +# + +jgrep.exe: main.cpp jgrep.cpp jgrep.h + cl -GX -GR -O2 -MT -I..\..\..\..\ jgrep.cpp main.cpp /link /LIBPATH:..\..\lib\vc6-stlport user32.lib + + + + + + + + + diff --git a/demo/jgrep/vc6.mak b/demo/jgrep/vc6.mak new file mode 100644 index 00000000..50b1df96 --- /dev/null +++ b/demo/jgrep/vc6.mak @@ -0,0 +1,15 @@ + +# +# very simple makefile for Visual C++ 6 +# + +jgrep.exe: main.cpp jgrep.cpp jgrep.h + cl -GX -GR -O2 -I..\..\..\..\ jgrep.cpp main.cpp /link /LIBPATH:..\..\lib\vc6 user32.lib + + + + + + + + diff --git a/demo/regress/bc55.mak b/demo/regress/bc55.mak new file mode 100644 index 00000000..d52a3370 --- /dev/null +++ b/demo/regress/bc55.mak @@ -0,0 +1,127 @@ + +# very basic makefile for regress +# +# Borland C++ tools +# +# BCROOT defines the root directory of your bcb install +# +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + +BCC32 = $(BCROOT)\bin\Bcc32.exe +TLINK32 = $(BCROOT)\bin\ILink32.exe + +IDE_LinkFLAGS32 = -L$(BCROOT)\LIB +LINKOPTS= -ap -Tpe -x +CFLAGS= -O2 -tWC -DSTRICT; -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\lib\bcb5 + +all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1lm.exe r2lm.exe r3lm.exe r4lm.exe r5lm.exe r6lm.exe + echo testing static single threaded version.... + r1 tests.txt test1252.txt + r2 tests.txt + r3 tests.txt + r4 tests.txt test1252.txt + r5 tests.txt + r6 tests.txt + 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 single threaded 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 dll multi-threaded version.... + r1lm tests.txt test1252.txt + r2lm tests.txt + r3lm tests.txt + r4lm tests.txt test1252.txt + r5lm tests.txt + r6lm tests.txt + + +r1.exe : r1.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r1.cpp + +r2.exe : r2.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r2.cpp + +r3.exe : r3.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r3.cpp + +r4.exe : r4.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r4.cpp + +r5.exe : r5.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r5.cpp + +r6.exe : r6.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r6.cpp + + +r1m.exe : r1.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er1m.exe r1.cpp + +r2m.exe : r2.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er2m.exe r2.cpp + +r3m.exe : r3.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er3m.exe r3.cpp + +r4m.exe : r4.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er4m.exe r4.cpp + +r5m.exe : r5.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er5m.exe r5.cpp + +r6m.exe : r6.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er6m.exe r6.cpp + + +r1l.exe : r1.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er1l.exe r1.cpp + +r2l.exe : r2.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er2l.exe r2.cpp + +r3l.exe : r3.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er3l.exe r3.cpp + +r4l.exe : r4.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er4l.exe r4.cpp + +r5l.exe : r5.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er5l.exe r5.cpp + +r6l.exe : r6.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er6l.exe r6.cpp + + +r1lm.exe : r1.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er1lm.exe r1.cpp + +r2lm.exe : r2.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er2lm.exe r2.cpp + +r3lm.exe : r3.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er3lm.exe r3.cpp + +r4lm.exe : r4.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er4lm.exe r4.cpp + +r5lm.exe : r5.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er5lm.exe r5.cpp + +r6lm.exe : r6.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er6lm.exe r6.cpp + + + + diff --git a/demo/regress/bcb4.mak b/demo/regress/bcb4.mak new file mode 100644 index 00000000..d7ff9448 --- /dev/null +++ b/demo/regress/bcb4.mak @@ -0,0 +1,179 @@ + +# very basic makefile for regress +# +# Borland C++ tools +# +# BCROOT defines the root directory of your bcb install +# +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + +BCC32 = $(BCROOT)\bin\Bcc32.exe +TLINK32 = $(BCROOT)\bin\ILink32.exe + +IDE_LinkFLAGS32 = -L$(BCROOT)\LIB +LINKOPTS= -ap -Tpe -x +CFLAGS= -O2 -tWC -DSTRICT; -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\lib\bcb4 + +all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1v.exe r2v.exe r3v.exe r4v.exe r5v.exe r6v.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1lm.exe r2lm.exe r3lm.exe r4lm.exe r5lm.exe r6lm.exe r1lv.exe r2lv.exe r3lv.exe r4lv.exe r5lv.exe r6lv.exe + echo testing static single threaded version.... + r1 tests.txt test1252.txt + r2 tests.txt + r3 tests.txt + r4 tests.txt test1252.txt + r5 tests.txt + r6 tests.txt + 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 static VCL version.... + r1v tests.txt test1252.txt + r2v tests.txt + r3v tests.txt + r4v tests.txt test1252.txt + r5v tests.txt + r6v tests.txt + echo testing dll single threaded 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 dll multi-threaded version.... + r1lm tests.txt test1252.txt + r2lm tests.txt + r3lm tests.txt + r4lm tests.txt test1252.txt + r5lm tests.txt + r6lm tests.txt + echo testing dll VCL version.... + r1lv tests.txt test1252.txt + r2lv tests.txt + r3lv tests.txt + r4lv tests.txt test1252.txt + r5lv tests.txt + r6lv tests.txt + + +r1.exe : r1.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r1.cpp + +r2.exe : r2.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r2.cpp + +r3.exe : r3.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r3.cpp + +r4.exe : r4.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r4.cpp + +r5.exe : r5.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r5.cpp + +r6.exe : r6.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r6.cpp + + +r1m.exe : r1.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er1m.exe r1.cpp + +r2m.exe : r2.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er2m.exe r2.cpp + +r3m.exe : r3.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er3m.exe r3.cpp + +r4m.exe : r4.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er4m.exe r4.cpp + +r5m.exe : r5.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er5m.exe r5.cpp + +r6m.exe : r6.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er6m.exe r6.cpp + + +r1v.exe : r1.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er1v.exe r1.cpp + +r2v.exe : r2.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er2v.exe r2.cpp + +r3v.exe : r3.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er3v.exe r3.cpp + +r4v.exe : r4.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er4v.exe r4.cpp + +r5v.exe : r5.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er5v.exe r5.cpp + +r6v.exe : r6.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er6v.exe r6.cpp + + +r1l.exe : r1.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er1l.exe r1.cpp + +r2l.exe : r2.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er2l.exe r2.cpp + +r3l.exe : r3.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er3l.exe r3.cpp + +r4l.exe : r4.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er4l.exe r4.cpp + +r5l.exe : r5.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er5l.exe r5.cpp + +r6l.exe : r6.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er6l.exe r6.cpp + + +r1lm.exe : r1.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er1lm.exe r1.cpp + +r2lm.exe : r2.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er2lm.exe r2.cpp + +r3lm.exe : r3.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er3lm.exe r3.cpp + +r4lm.exe : r4.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er4lm.exe r4.cpp + +r5lm.exe : r5.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er5lm.exe r5.cpp + +r6lm.exe : r6.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er6lm.exe r6.cpp + + +r1lv.exe : r1.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er1lv.exe r1.cpp + +r2lv.exe : r2.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er2lv.exe r2.cpp + +r3lv.exe : r3.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er3lv.exe r3.cpp + +r4lv.exe : r4.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er4lv.exe r4.cpp + +r5lv.exe : r5.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er5lv.exe r5.cpp + +r6lv.exe : r6.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er6lv.exe r6.cpp + + + + diff --git a/demo/regress/bcb5.mak b/demo/regress/bcb5.mak new file mode 100644 index 00000000..3bb3c930 --- /dev/null +++ b/demo/regress/bcb5.mak @@ -0,0 +1,179 @@ + +# very basic makefile for regress +# +# Borland C++ tools +# +# BCROOT defines the root directory of your bcb install +# +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + +BCC32 = $(BCROOT)\bin\Bcc32.exe +TLINK32 = $(BCROOT)\bin\ILink32.exe + +IDE_LinkFLAGS32 = -L$(BCROOT)\LIB +LINKOPTS= -ap -Tpe -x +CFLAGS= -O2 -tWC -DSTRICT; -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\lib\bcb5 + +all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1v.exe r2v.exe r3v.exe r4v.exe r5v.exe r6v.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1lm.exe r2lm.exe r3lm.exe r4lm.exe r5lm.exe r6lm.exe r1lv.exe r2lv.exe r3lv.exe r4lv.exe r5lv.exe r6lv.exe + echo testing static single threaded version.... + r1 tests.txt test1252.txt + r2 tests.txt + r3 tests.txt + r4 tests.txt test1252.txt + r5 tests.txt + r6 tests.txt + 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 static VCL version.... + r1v tests.txt test1252.txt + r2v tests.txt + r3v tests.txt + r4v tests.txt test1252.txt + r5v tests.txt + r6v tests.txt + echo testing dll single threaded 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 dll multi-threaded version.... + r1lm tests.txt test1252.txt + r2lm tests.txt + r3lm tests.txt + r4lm tests.txt test1252.txt + r5lm tests.txt + r6lm tests.txt + echo testing dll VCL version.... + r1lv tests.txt test1252.txt + r2lv tests.txt + r3lv tests.txt + r4lv tests.txt test1252.txt + r5lv tests.txt + r6lv tests.txt + + +r1.exe : r1.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r1.cpp + +r2.exe : r2.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r2.cpp + +r3.exe : r3.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r3.cpp + +r4.exe : r4.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r4.cpp + +r5.exe : r5.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r5.cpp + +r6.exe : r6.cpp + $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) r6.cpp + + +r1m.exe : r1.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er1m.exe r1.cpp + +r2m.exe : r2.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er2m.exe r2.cpp + +r3m.exe : r3.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er3m.exe r3.cpp + +r4m.exe : r4.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er4m.exe r4.cpp + +r5m.exe : r5.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er5m.exe r5.cpp + +r6m.exe : r6.cpp + $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er6m.exe r6.cpp + + +r1v.exe : r1.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er1v.exe r1.cpp + +r2v.exe : r2.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er2v.exe r2.cpp + +r3v.exe : r3.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er3v.exe r3.cpp + +r4v.exe : r4.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er4v.exe r4.cpp + +r5v.exe : r5.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er5v.exe r5.cpp + +r6v.exe : r6.cpp + $(BCC32) -tWM -tWV $(CFLAGS) -er6v.exe r6.cpp + + +r1l.exe : r1.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er1l.exe r1.cpp + +r2l.exe : r2.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er2l.exe r2.cpp + +r3l.exe : r3.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er3l.exe r3.cpp + +r4l.exe : r4.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er4l.exe r4.cpp + +r5l.exe : r5.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er5l.exe r5.cpp + +r6l.exe : r6.cpp + $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er6l.exe r6.cpp + + +r1lm.exe : r1.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er1lm.exe r1.cpp + +r2lm.exe : r2.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er2lm.exe r2.cpp + +r3lm.exe : r3.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er3lm.exe r3.cpp + +r4lm.exe : r4.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er4lm.exe r4.cpp + +r5lm.exe : r5.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er5lm.exe r5.cpp + +r6lm.exe : r6.cpp + $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er6lm.exe r6.cpp + + +r1lv.exe : r1.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er1lv.exe r1.cpp + +r2lv.exe : r2.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er2lv.exe r2.cpp + +r3lv.exe : r3.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er3lv.exe r3.cpp + +r4lv.exe : r4.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er4lv.exe r4.cpp + +r5lv.exe : r5.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er5lv.exe r5.cpp + +r6lv.exe : r6.cpp + $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er6lv.exe r6.cpp + + + + diff --git a/demo/regress/egcs.mak b/demo/regress/egcs.mak new file mode 100644 index 00000000..10965f8f --- /dev/null +++ b/demo/regress/egcs.mak @@ -0,0 +1,50 @@ + +# very basic makefile for regress.exe +# +# egcs compiler GCC +# +CXX= g++ -O2 -pedantic -Wall -I../../../../ -I./ + +total : r2.exe + r2 tests.txt + r5 tests.txt + +r2.exe : r2.cpp + $(CXX) -or2.exe r2.cpp -L../../lib -lregex++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo/regress/gcc.mak b/demo/regress/gcc.mak new file mode 100644 index 00000000..2af9d193 --- /dev/null +++ b/demo/regress/gcc.mak @@ -0,0 +1,50 @@ + +# very basic makefile for regression tests +# +# g++ 2.95 and greater +# +CXX= g++ -O2 -pedantic -Wall -I../../../../ -I./ -L../../lib/gcc + +total : r2 + ./r2 tests.txt + +r2 : r2.cpp + $(CXX) -o r2 r2.cpp -lregex++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo/regress/makefile.in b/demo/regress/makefile.in new file mode 100644 index 00000000..bc8183ab --- /dev/null +++ b/demo/regress/makefile.in @@ -0,0 +1,78 @@ + +# very basic makefile for regression tests +# +CXX=@CXX@ +CXXFLAGS=@CXXFLAGS@ +LIBS=@LIBS@ -L../../lib -lregex++ +EXE=@ac_exe_ext@ +OBJ=@ac_obj_ext@ + +total : @ac_regress@ + +LIBDEP=../../lib/libregex++.a ../../../../boost/re_detail/regex_options.hpp ../../../../boost/re_detail/regex_config.hpp + +r1$(EXE) :: r1$(OBJ) + $(CXX) -o r1$(EXE) r1$(OBJ) $(LIBS) + ./r1 tests.txt test1252.txt + +r2$(EXE) :: r2$(OBJ) + $(CXX) -o r2$(EXE) r2$(OBJ) $(LIBS) + ./r2 tests.txt + +r3$(EXE) :: r3$(OBJ) + $(CXX) -o r3$(EXE) r3$(OBJ) $(LIBS) + ./r3 tests.txt + +r4$(EXE) :: r4$(OBJ) + $(CXX) -o r4$(EXE) r4$(OBJ) $(LIBS) + ./r4 tests.txt test1252.txt + +r5$(EXE) :: r5$(OBJ) + $(CXX) -o r5$(EXE) r5$(OBJ) $(LIBS) + ./r5 tests.txt + +r6$(EXE) :: r6$(OBJ) + $(CXX) -o r6$(EXE) r6$(OBJ) $(LIBS) + ./r6 tests.txt + +r1$(OBJ) : parse.cpp regress.cpp tests.cpp r1.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) -DSTRICT -I../../../../ -I./ r1.cpp + +r2$(OBJ) : parse.cpp regress.cpp tests.cpp r2.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) -I../../../../ -I./ r2.cpp + +r3$(OBJ) : parse.cpp regress.cpp tests.cpp r3.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) -I../../../../ -I./ r3.cpp + +r4$(OBJ) : parse.cpp regress.cpp tests.cpp r4.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) -DSTRICT -I../../../../ -I./ r4.cpp + +r5$(OBJ) : parse.cpp regress.cpp tests.cpp r5.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) -I../../../../ -I./ r5.cpp + +r6$(OBJ) : parse.cpp regress.cpp tests.cpp r6.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) -I../../../../ -I./ r6.cpp + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo/regress/out.txt b/demo/regress/out.txt new file mode 100644 index 00000000..e48604e4 --- /dev/null +++ b/demo/regress/out.txt @@ -0,0 +1,342 @@ + +Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 +Copyright (C) Microsoft Corp 1988-1998. All rights reserved. + + cl /MT /D_MT -o r1m.exe -O2 -GX -GR -I..\..\..\.. r1.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r1.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r1.exe +/out:r1m.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r1.obj + cl /MT /D_MT -O2 -GX -GR -I..\..\..\.. -o r2m.exe r2.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r2.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r2.exe +/out:r2m.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r2.obj + cl /MT /D_MT -O2 -GX -GR -I..\..\..\.. -o r3m.exe r3.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r3.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r3.exe +/out:r3m.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r3.obj + cl /MT /D_MT -O2 -GX -GR -I..\..\..\.. -o r4m.exe r4.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r4.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r4.exe +/out:r4m.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r4.obj + cl /MT /D_MT -O2 -GX -GR -I..\..\..\.. -o r5m.exe r5.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r5.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r5.exe +/out:r5m.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r5.obj + cl /MT /D_MT -O2 -GX -GR -I..\..\..\.. -o r6m.exe r6.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r6.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r6.exe +/out:r6m.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r6.obj + cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r1l.exe r1.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r1.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r1.exe +/out:r1l.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r1.obj + cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r2l.exe r2.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r2.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r2.exe +/out:r2l.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r2.obj + cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r3l.exe r3.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r3.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r3.exe +/out:r3l.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r3.obj + cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r4l.exe r4.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r4.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r4.exe +/out:r4l.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r4.obj + cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r5l.exe r5.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r5.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r5.exe +/out:r5l.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r5.obj + cl /MD /D_MT /D_DLL -O2 -GX -GR -I..\..\..\.. -o r6l.exe r6.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r6.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r6.exe +/out:r6l.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r6.obj + cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r1md.exe r1.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r1.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r1.exe +/out:r1md.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r1.obj +LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library + cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r2md.exe r2.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r2.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r2.exe +/out:r2md.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r2.obj +LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library + cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r3md.exe r3.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r3.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r3.exe +/out:r3md.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r3.obj +LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library + cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r4md.exe r4.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r4.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r4.exe +/out:r4md.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r4.obj +LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library + cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r5md.exe r5.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r5.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r5.exe +/out:r5md.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r5.obj +LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library + cl /MTd /D_MT /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r6md.exe r6.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r6.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r6.exe +/out:r6md.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r6.obj +LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library + cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r1lmd.exe r1.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r1.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r1.exe +/out:r1lmd.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r1.obj + cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r2lmd.exe r2.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r2.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r2.exe +/out:r2lmd.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r2.obj + cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r3lmd.exe r3.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r3.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r3.exe +/out:r3lmd.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r3.obj + cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r4lmd.exe r4.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r4.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r4.exe +/out:r4lmd.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r4.obj + cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r5lmd.exe r5.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r5.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r5.exe +/out:r5lmd.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r5.obj + cl /MDd /D_MT /D_DLL /D_DEBUG -O2 -GX -GR -I..\..\..\.. -o r6lmd.exe r6.cpp -link /LIBPATH:..\..\lib\vc6-stlport user32.lib +Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86 +Copyright (C) Microsoft Corp 1984-1998. All rights reserved. + +r6.cpp +Microsoft (R) Incremental Linker Version 6.00.8447 +Copyright (C) Microsoft Corp 1992-1998. All rights reserved. + +/out:r6.exe +/out:r6lmd.exe +/LIBPATH:..\..\lib\vc6-stlport +user32.lib +r6.obj + echo testing static multi-threaded version.... +testing static multi-threaded version.... + r1m tests.txt test1252.txt +858 lines, 625 tests completed in file tests.txt +33 lines, 10 tests completed in file test1252.txt + r2m tests.txt +858 lines, 625 tests completed in file tests.txt + r3m tests.txt +Error in line 259 of file tests.txt +Expression: [[:print:]]+ +Search text: +a b + +Flags: REG_EXTENDED | basic | escape_in_lists | char_classes | intervals | bk_refs | normal | basic | extended +regex++ API result mismatch in sub-expression 0, found (0,5) expected (1,4) +regex++ API result mismatch in sub-expression 0, found (0,5) expected (1,4) +regex++ API result mismatch in sub-expression 0, found (0,5) expected (1,4) +858 lines, 625 tests completed in file tests.txt +NMAKE : fatal error U1077: 'd:\boost\regexpp\libs\regex\demo\regress\r3m.exe' : return code '0x1' +Stop. diff --git a/demo/regress/parse.cpp b/demo/regress/parse.cpp new file mode 100644 index 00000000..74886e11 --- /dev/null +++ b/demo/regress/parse.cpp @@ -0,0 +1,326 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * + * FILE parse.cpp + * VERSION 3.01 + * + * Input parsing functions for regress. + * + */ + +#include +#include "regress.h" + +#ifndef BOOST_RE_ALGO_INCLUDED +#include +#endif + +using namespace boost; + +// +// start by defining all our flag types: + +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_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_NOSPEC"), 10, REG_NOSPEC, 0 }, + + { BOOST_RE_STR("REG_NOTBOL"), 10, REG_NOTBOL, 1 }, + { BOOST_RE_STR("REG_NOTEOL"), 10, REG_NOTEOL, 1 }, + { BOOST_RE_STR("REG_STARTEND"), 12, REG_STARTEND, 1 }, + + { BOOST_RE_STR("basic"), 5, regbase::basic, 2 }, + { BOOST_RE_STR("escape_in_lists"), 15, regbase::escape_in_lists, 2 }, + { BOOST_RE_STR("char_classes"), 12, regbase::char_classes, 2 }, + { BOOST_RE_STR("intervals"), 9, regbase::intervals, 2 }, + { BOOST_RE_STR("limited_ops"), 11, regbase::limited_ops, 2 }, + { BOOST_RE_STR("newline_alt"), 11, regbase::newline_alt, 2 }, + { BOOST_RE_STR("bk_plus_qm"), 10, regbase::bk_plus_qm, 2 }, + { BOOST_RE_STR("bk_braces"), 9, regbase::bk_braces, 2 }, + { BOOST_RE_STR("bk_parens"), 9, regbase::bk_parens, 2 }, + { BOOST_RE_STR("bk_refs"), 7, regbase::bk_refs, 2 }, + { BOOST_RE_STR("bk_vbar"), 7, regbase::bk_vbar, 2 }, + { BOOST_RE_STR("use_except"), 10, regbase::use_except, 2 }, + { BOOST_RE_STR("literal"), 7, regbase::literal, 2 }, + { BOOST_RE_STR("normal"), 6, regbase::normal, 2 }, + { BOOST_RE_STR("basic"), 5, regbase::basic, 2 }, + { BOOST_RE_STR("extended"), 8, regbase::extended, 2 }, + + { BOOST_RE_STR("match_default"), 13, match_default, 3 }, + { BOOST_RE_STR("match_not_bol"), 13, match_not_bol, 3 }, + { BOOST_RE_STR("match_not_eol"), 13, match_not_eol, 3 }, + { BOOST_RE_STR("match_not_bob"), 13, match_not_bob, 3 }, + { BOOST_RE_STR("match_not_eob"), 13, match_not_eob, 3 }, + { BOOST_RE_STR("match_not_bow"), 13, match_not_bow, 3 }, + { BOOST_RE_STR("match_not_eow"), 13, match_not_eow, 3 }, + { BOOST_RE_STR("match_not_dot_newline"), 21, match_not_dot_newline, 3 }, + { BOOST_RE_STR("match_not_dot_null"), 18, match_not_dot_null, 3 }, + { BOOST_RE_STR("match_prev_avail"), 16, match_prev_avail, 3 }, + { BOOST_RE_STR("match_any"), 9, match_any, 3 }, + { BOOST_RE_STR("match_not_null"), 14, match_not_null, 3 }, + { BOOST_RE_STR("match_continuous"), 16, match_continuous, 3 }, + + { BOOST_RE_STR("format_sed"), 10, format_sed, 3 }, + { BOOST_RE_STR("format_perl"), 11, format_perl, 3 }, + { BOOST_RE_STR("format_no_copy"), 14, format_no_copy, 3 }, + + { BOOST_RE_STR("REG_NO_POSIX_TEST"), 17, REG_NO_POSIX_TEST, 4 }, + { BOOST_RE_STR("REG_UNICODE_ONLY"), 16, REG_UNICODE_ONLY, 4 }, + { BOOST_RE_STR("REG_GREP"), 8, REG_GREP, 4 }, + { BOOST_RE_STR("REG_MERGE"), 9, REG_MERGE, 4 }, + { BOOST_RE_STR("REG_MERGE_COPY"), 14, REG_MERGE_COPY, 4 }, + + { BOOST_RE_STR(""), 0, 0, 0 }, + }; + +// basically we create a simple token parser +// using regular expressions + +const char_t* expression_text = BOOST_RE_STR("(;.*)|") // comment + BOOST_RE_STR("(^[[:blank:]]*-)|") // - + BOOST_RE_STR("([^\"[:space:]][^[:space:]]*)|") // token + BOOST_RE_STR("(\"(([^\"]|\\\\\")*)\")") // "token" + ; + +typedef reg_expression re_parse_t; +typedef re_parse_t::allocator_type parse_alloc; +typedef match_results parse_grep; +typedef string_type::const_iterator parse_iterator; + +re_parse_t parse_expression(expression_text, regbase::normal); + +// +// now define our grep predicate function object: +class parse_function +{ + int mode; +public: + parse_function() : mode(0) {} + parse_function(const parse_function& o) : mode(o.mode) {} + bool operator()(const parse_grep& i); +}; + +bool parse_function::operator()(const parse_grep& g) +{ + parse_iterator i, j; + // determine what caused the match: + if(g[1].matched) + { + // we have a comment: + return true; + } + else if(g[2].matched) + { + // we have the start of a line of flags + mode = -1; + for(int i = 0; i < 5; ++i) + flags[i] = 0; + return true; + } + else if(g[3].matched) + { + // token: + i = g[3].first; + j = g[3].second; + } + else + { + // token delimited by "" + i = g[5].first; + j = g[5].second; + } + + // now we need to switch depending upon what mode we are in: + switch(mode) + { + case -1: + { + // parse the flag: + unsigned int id = 0; + while(flag_data[id].len != 0) + { + if(static_cast(j - i) != flag_data[id].len) + { + ++id; + continue; + } + if(std::equal(i, j, flag_data[id].name) == true) + { + flags[flag_data[id].id] |= flag_data[id].value; + return true; + } + ++id; + } + cout << "Warning: Unknown flag: "; + string_type t(i, j); + cout << t.c_str(); + cout << endl; + return true; + } + case 0: + // set the expression text: + expression = string_type(i, j); + do_test = true; + break; + case 1: + // set the text to match: + search_text = string_type(i, j); + jm_trace("Initial search text: " << search_text); + expand_escapes(search_text); + jm_trace("Search text after escapes expanded: " << search_text); + break; + case 2: + // maybe set format string: + if(flags[4] & REG_MERGE) + { + format_string = string_type(i, j); + break; + } + else + { + matches[mode - 2] = to_int(i, j); + break; + } + case 3: + // maybe set format result: + if(flags[4] & REG_MERGE) + { + merge_string = string_type(i, j); + expand_escapes(merge_string); + break; + } + else + { + matches[mode - 2] = to_int(i, j); + break; + } + default: + jm_assert(mode >= 2); + // set the relevent int value: + matches[mode - 2] = to_int(i, j); + } + ++mode; + return true; +} + +void parse_input_line(const string_type& s) +{ + // set matches back to starting values: + for(int i = 0; i < MAX_MATCHES; ++i) + { + matches[i] = -2; + } + parse_function op; + do_test = false; + regex_grep(op, s.begin(), s.end(), parse_expression); + jm_trace("expression: " << expression); + jm_trace("search string: " << search_text); +} + +int to_int(string_type::const_iterator i, string_type::const_iterator j) +{ + int val = 0; + bool neg = false; + if((i != j) && (*i == BOOST_RE_STR('-'))) + { + neg = true; + ++i; + } + while (i != j) + { + val *= 10; + val += *i - BOOST_RE_STR('0'); + ++i; + } + if(neg) + val *= -1; + return val; +} + +void expand_escapes(string_type& s) +{ + for(unsigned int i = 0; i < s.size(); ++i) + { + if(s[i] == BOOST_RE_STR('\\')) + { + switch(s[i+1]) + { + case BOOST_RE_STR('a'): + s.erase(s.begin() + i); + s[i] = BOOST_RE_STR('\a'); + break; + case BOOST_RE_STR('b'): + s.erase(s.begin() + i); + s[i] = BOOST_RE_STR('\b'); + break; + case BOOST_RE_STR('f'): + s.erase(s.begin() + i); + s[i] = BOOST_RE_STR('\f'); + break; + case BOOST_RE_STR('n'): + s.erase(s.begin() + i); + s[i] = BOOST_RE_STR('\n'); + break; + case BOOST_RE_STR('r'): + s.erase(s.begin() + i); + s[i] = BOOST_RE_STR('\r'); + break; + case BOOST_RE_STR('t'): + s.erase(s.begin() + i); + s[i] = BOOST_RE_STR('\t'); + break; + case BOOST_RE_STR('v'): + s.erase(s.begin() + i); + s[i] = BOOST_RE_STR('\v'); + break; + default: + if( (s[i + 1] >= BOOST_RE_STR('0')) && (s[i + 1] <= BOOST_RE_STR('9')) ) + { + int val = 0; + unsigned int pos = i; + ++i; + while( (s[i] >= BOOST_RE_STR('0')) && (s[i] <= BOOST_RE_STR('9')) && (i < s.size())) + { + val *= 10; + val += s[i] - BOOST_RE_STR('0'); + ++i; + } + s.erase(s.begin() + pos, s.begin() + i); + if(0 == val) + { + s.insert(s.begin()+pos, ' '); + s[pos] = 0; + } + else + s.insert(s.begin() + pos, val); + i = pos; + } + else + { + s.erase(s.begin() + i); + } + } + } + } +} + + + diff --git a/demo/regress/r1.cpp b/demo/regress/r1.cpp new file mode 100644 index 00000000..9940ddb3 --- /dev/null +++ b/demo/regress/r1.cpp @@ -0,0 +1,24 @@ + +// +// master include file for different regression builds... +// +// r1.cpp +// narrow char's, locale Win32 + +#define BOOST_RE_TEST_LOCALE_W32 + +#include "parse.cpp" +#include "regress.cpp" +#include "tests.cpp" + + + + + + + + + + + + diff --git a/demo/regress/r1lm.cpp b/demo/regress/r1lm.cpp new file mode 100644 index 00000000..9940ddb3 --- /dev/null +++ b/demo/regress/r1lm.cpp @@ -0,0 +1,24 @@ + +// +// master include file for different regression builds... +// +// r1.cpp +// narrow char's, locale Win32 + +#define BOOST_RE_TEST_LOCALE_W32 + +#include "parse.cpp" +#include "regress.cpp" +#include "tests.cpp" + + + + + + + + + + + + diff --git a/demo/regress/r2.cpp b/demo/regress/r2.cpp new file mode 100644 index 00000000..b9691a45 --- /dev/null +++ b/demo/regress/r2.cpp @@ -0,0 +1,28 @@ + +// +// master include file for different regression builds... +// +// r1.cpp +// narrow char's, locale C, force no Win32 + +#define BOOST_RE_TEST_LOCALE_C + + +#include "parse.cpp" +#include "regress.cpp" +#include "tests.cpp" + + + + + + + + + + + + + + + diff --git a/demo/regress/r3.cpp b/demo/regress/r3.cpp new file mode 100644 index 00000000..31d5be38 --- /dev/null +++ b/demo/regress/r3.cpp @@ -0,0 +1,26 @@ + +// +// master include file for different regression builds... +// +// r1.cpp +// narrow char's, locale CPP + +#define BOOST_RE_TEST_LOCALE_CPP + +#include "parse.cpp" +#include "regress.cpp" +#include "tests.cpp" + + + + + + + + + + + + + + diff --git a/demo/regress/r4.cpp b/demo/regress/r4.cpp new file mode 100644 index 00000000..9ad26684 --- /dev/null +++ b/demo/regress/r4.cpp @@ -0,0 +1,26 @@ + +// +// master include file for different regression builds... +// +// r1.cpp +// wide char's, locale Win32 + +#define BOOST_RE_TEST_LOCALE_W32 +#define TEST_UNICODE + +#include "parse.cpp" +#include "regress.cpp" +#include "tests.cpp" + + + + + + + + + + + + + diff --git a/demo/regress/r5.cpp b/demo/regress/r5.cpp new file mode 100644 index 00000000..b4657de2 --- /dev/null +++ b/demo/regress/r5.cpp @@ -0,0 +1,27 @@ + +// +// master include file for different regression builds... +// +// r1.cpp +// wide char's, locale C + +#define BOOST_RE_TEST_LOCALE_C +#define TEST_UNICODE + +#include "parse.cpp" +#include "regress.cpp" +#include "tests.cpp" + + + + + + + + + + + + + + diff --git a/demo/regress/r6.cpp b/demo/regress/r6.cpp new file mode 100644 index 00000000..ecf4c0dd --- /dev/null +++ b/demo/regress/r6.cpp @@ -0,0 +1,27 @@ + +// +// master include file for different regression builds... +// +// r1.cpp +// wide char's, locale CPP + +#define BOOST_RE_TEST_LOCALE_CPP +#define TEST_UNICODE + +#include "parse.cpp" +#include "regress.cpp" +#include "tests.cpp" + + + + + + + + + + + + + + diff --git a/demo/regress/regress.cpp b/demo/regress/regress.cpp new file mode 100644 index 00000000..4a052354 --- /dev/null +++ b/demo/regress/regress.cpp @@ -0,0 +1,246 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * + * FILE regress.cpp + * VERSION 3.01 + * + * main() and associated code for regress. + * + */ + +#include +#include +#ifdef BOOST_RE_OLD_IOSTREAM +#include +#else +#include +using std::ifstream; +using std::ofstream; +//using std::cin; +//using std::cout; +using std::endl; +#endif + +#ifdef __BORLANDC__ +#pragma hrdstop +#endif + +#include "regress.h" + + +// +// declare all our globals here: +// + +string_type expression; +string_type search_text; +string_type format_string; +string_type merge_string; +int matches[MAX_MATCHES]; + +char file[MAX_PATH]; +int line; +bool do_test = false; +unsigned int flags[5]; +unsigned error_count = 0; + +void usage() +{ + cout << + +"Usage: regress filename [filename2...]\n" +"see tests.txt for an example test script\n" +"and the script format.\n"; + +} + +int main(int argc, char * argv[]) +{ + if(argc < 2) + usage(); + int i; + for(i = 1; i < argc; ++i) + { + reset_error(); + ifstream is(argv[i]); + if(is.good() == false) + { + cout << "Error unable to open file: " << argv[i] << endl << endl; + continue; + } + std::strcpy(file, argv[i]); + line = 0; + unsigned int tests = 0; + while(is.good()) + { + string_type s; + get_line(is, s); + ++line; + jm_trace("Reading test script line " << line << " " << s); + parse_input_line(s); + if(do_test) + { + run_tests(); + ++tests; + } + } + cout << line << " lines, " << tests << " tests completed in file " << argv[i] << endl; + } + return error_count; +} + +#ifdef TEST_UNICODE + +ostream& operator << (ostream& os, const wchar_t* s) +{ + while(*s) + { + os.put((char)*s); + ++s; + } + return os; +} + +ostream& operator << (ostream& os, const std::wstring& s) +{ + os << s.c_str(); + return os; +} + +istream& get_line(istream& is, nstring_type& s, char delim) +{ + char c = (char)is.get(); + s.erase(s.begin(), s.end()); + while((c != delim) && (c != EOF)) + { + s.append(1, c); + c = (char)is.get(); + } + return is; +} + +istream& get_line(istream& is, string_type& s, char delim) +{ + nstring_type t; + get_line(is, t, delim); + s.erase(s.begin(), s.end()); + const char* i, *j; + i = t.c_str(); + j = t.c_str() + t.size(); + wchar_t* buf = new wchar_t[MB_CUR_MAX + 1]; + int cchars; + while(i != j) + { + cchars = mbtowc(buf, i, j - i); + if(cchars == -1) + break; + if(cchars == 0) + break; + s.insert(s.end(), buf, buf + cchars); + i += cchars; + } + delete[] buf; + return is; +} + + +#else + +istream& get_line(istream& is, string_type& s, char delim) +{ + char c = (char)is.get(); + s.erase(s.begin(), s.end()); + while((c != delim) && (c != EOF)) + { + s.append(1, c); + c = (char)is.get(); + } + return is; +} + +#endif + +jm_debug_alloc::jm_debug_alloc() +{ + blocks = new int; + count = new int; + *blocks = 0; + *count = 1; + guard = this; +} + +jm_debug_alloc::jm_debug_alloc(const jm_debug_alloc& d) +{ + 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); + return *this; +} + +jm_debug_alloc::~jm_debug_alloc() +{ + if(guard != this) + { + cout << "Error: attempt to destroy object already destroyed" << endl; + } + else + { + free(); + guard = 0; + } +} +void jm_debug_alloc::free() +{ + if(--(*count) == 0) + { + if(*blocks) + { + begin_error(); + cout << "Error: " << *blocks << " blocks not freed by allocator" << endl; + } + delete count; + delete blocks; + } +} + +jm_debug_alloc::pointer jm_debug_alloc::allocate(size_type n, void* hint) +{ + pointer p = new char[n + maxi(sizeof(size_type), boost::re_detail::padding_size)]; + *(size_type*)p = n; + ++(*blocks); + return p + maxi(sizeof(size_type), boost::re_detail::padding_size); +} +void jm_debug_alloc::deallocate(pointer p, size_type n) +{ + p -= maxi(sizeof(size_type), boost::re_detail::padding_size); + if(*(size_type*)p != n) + { + begin_error(); + cout << "Error: size mismatch in allocate/deallocate calls" << endl; + } + --(*blocks); + delete[] p; +} + diff --git a/demo/regress/regress.h b/demo/regress/regress.h new file mode 100644 index 00000000..aaefe559 --- /dev/null +++ b/demo/regress/regress.h @@ -0,0 +1,325 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * + * FILE regress.h + * VERSION 3.01 + * + * Function and data declarations for regress. + * + */ + +#ifndef _REGRESS_H +#define _REGRESS_H + +#include + +#ifdef BOOST_RE_OLD_IOSTREAM +#include +#else +#include +using std::cout; +using std::cerr; +using std::cin; +using std::istream; +using std::ostream; +using std::endl; +#endif + +#include +#include +#include + + +#ifdef TEST_UNICODE +#ifdef __GNUC__ +#define char_t wchar_t +#else +typedef wchar_t char_t; +#endif +#define NO_POSIX_TEST +typedef std::basic_string string_type; +typedef std::basic_string nstring_type; +inline istream& get_line(istream& is, nstring_type& s, char delim = '\n'); +istream& get_line(istream& is, string_type& s, char delim = L'\n'); +#define BOOST_RE_STR(x) L##x +ostream& operator << (ostream& os, const string_type& s); + +#else +#ifdef __GNUC__ +#define char_t char +#else +typedef char char_t; +#endif +typedef std::basic_string string_type; +inline istream& get_line(istream& is, string_type& s, char delim = '\n'); +#define BOOST_RE_STR(x) x + +#endif + +ostream& operator << (ostream& os, const wchar_t* s); +void parse_input_line(const string_type& s); +void expand_escapes(string_type& s); +void run_tests(); +void begin_error(); +void reset_error(); +int to_int(string_type::const_iterator i, string_type::const_iterator j); + +#define MAX_MATCHES 30 +extern string_type expression; +extern string_type search_text; +extern string_type format_string; +extern string_type merge_string; +extern int matches[MAX_MATCHES]; + +#ifndef MAX_PATH +#define MAX_PATH 260 +#endif + +extern char file[MAX_PATH]; +extern int line; +extern bool do_test; +extern unsigned int flags[5]; +extern unsigned error_count; + +struct flag_info +{ + const char_t* name; // printable flag name + unsigned int len; // length of name + unsigned int value; // value of the flag + unsigned int id; // index to assign value to +}; + +extern flag_info flag_data[]; + +// +// class jm_debug_alloc +// NB this is a byte based allocator +// +class jm_debug_alloc +{ +private: + int* blocks, *count; + jm_debug_alloc* guard; +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef char* pointer; + typedef const char* const_pointer; + typedef char& reference; + typedef const char& const_reference; + typedef char value_type; + + + #ifndef BOOST_RE_NO_MEMBER_TEMPLATES + template + struct rebind + { + typedef boost::re_detail::re_alloc_binder other; + }; + #endif + + jm_debug_alloc(); + + jm_debug_alloc(const jm_debug_alloc& d); + jm_debug_alloc& operator=(const jm_debug_alloc& d); + + ~jm_debug_alloc(); + void free(); + static pointer address(reference x) + { + return &x; + } + static const_pointer address(const_reference x) + { + return &x; + } + unsigned maxi(unsigned i, unsigned j) + { + return i < j ? j : i; + } + pointer allocate(size_type n, void* hint = 0); + void deallocate(pointer p, size_type n); + + static size_type max_size() + { + return UINT_MAX; + } + + static void construct(pointer , const char& ) + { + } + + static void destroy(pointer ) + { + } +}; + +#ifdef __BORLANDC__ +#if __BORLANDC__ < 0x520 + +#define BOOST_RE_BORLAND_FIX + +#endif +#endif + + + +// +// class debug_iterator +// +template +struct debug_iterator : public BOOST_RE_RA_ITERATOR(T, ptrdiff_t) +{ + typedef std::ptrdiff_t difference_type; + typedef char_t value_type; + typedef char_t* pointer; + typedef char_t& reference; + typedef std::random_access_iterator_tag iterator_category; + typedef debug_iterator self; + typedef size_t size_type; + + T cur; + T first; + T last; + + debug_iterator(T c, T f, T l) + : cur(c), first(f), last(l) {} + debug_iterator() : cur(), first(), last() {} + debug_iterator(const debug_iterator& x) + : cur(x.cur), first(x.first), last(x.last) {} + + reference operator*() const + { + if(cur == last) + { + begin_error(); + cout << "Error: attempt to dereference iterator past range" << endl; + } + return *cur; + } + + operator T()const { return cur; } + + difference_type operator-(const self& x) const { + return (difference_type)(cur - x.cur); + } + + self& operator++() + { + if(cur == last) + { + begin_error(); + cout << "Error: attempt to increment iterator past range" << endl; + return *this; + } + ++cur; + return *this; + } + self operator++(int) + { + self tmp = *this; + ++*this; + return tmp; + } + + self& operator--() + { + if(cur == first) + { + begin_error(); + cout << "Error: attempt to decrement iterator past range" << endl; + return *this; + } + --cur; + return *this; + } + self operator--(int) + { + self tmp = *this; + --*this; + return tmp; + } + + self& operator+=(difference_type n) + { + if((last - cur) < n) + { + begin_error(); + cout << "Error: attempt to increment iterator past range" << endl; + return *this; + } + cur += n; + return *this; + } + + self operator+(difference_type n) const + { + self tmp = *this; + return tmp += n; + } + + self& operator-=(difference_type n) { return *this += -n; } + + self operator-(difference_type n) const + { + self tmp = *this; + return tmp -= n; + } + + reference operator[](difference_type n) const { return *(cur + n); } + + bool operator==(const self& x) const { return cur == x.cur; } + bool operator!=(const self& x) const { return !(*this == x); } + bool operator<(const self& x) const { + return (cur < x.cur); + } +}; + +#if defined(__SGI_STL_PORT) && (__SGI_STL_PORT >= 0x400) +namespace std{ +template +inline random_access_iterator_tag __STL_CALL +__iterator_category(const debug_iterator&) { + return random_access_iterator_tag(); +} +} +#endif + +#ifdef BOOST_RE_TEST_LOCALE_W32 +typedef boost::reg_expression, jm_debug_alloc> re_type; +#elif defined(BOOST_RE_TEST_LOCALE_CPP) +typedef boost::reg_expression, jm_debug_alloc> re_type; +#else +typedef boost::reg_expression, jm_debug_alloc> re_type; +#endif + +#define REG_NO_POSIX_TEST 1 +#define REG_UNICODE_ONLY 2 +#define REG_GREP 4 +#define REG_MERGE 8 +#define REG_MERGE_COPY 16 + +#endif + + + + + + + + + diff --git a/demo/regress/sunpro.mak b/demo/regress/sunpro.mak new file mode 100644 index 00000000..ca16decb --- /dev/null +++ b/demo/regress/sunpro.mak @@ -0,0 +1,28 @@ +# Makefile for timer application +# +# for SUN workshop 5.0 C++ compiler +# + +CXX=CC +CPP_FLAGS = -O -I../../../../ -I./ + +all: r2 r5 + r2 tests.txt + r5 tests.txt + +%.o : %.cpp + $(CXX) -c -o $@ $(CPP_FLAGS) $< + +r2 : r2.o + $(CXX) -o $@ $(CPP_FLAGS) r2.o -L../../lib -lregex++ + +r5 : r5.o + $(CXX) -o $@ $(CPP_FLAGS) r5.o -L../../lib -lregex++ + +clean: + rm -rf SunWS_cache + rm -f r2.o r2 r5 r5.o + + + + diff --git a/demo/regress/test1252.txt b/demo/regress/test1252.txt new file mode 100644 index 00000000..3c849b26 --- /dev/null +++ b/demo/regress/test1252.txt @@ -0,0 +1,32 @@ +; +; This file tests code page 1252 - US / Western European code page. +; +; See tests.txt for a desciption of the scipt format. +; + +- match_default extended REG_EXTENDED + +; start by testing character classes: +[[:lower:]]+ Þßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ÷ 1 32 +[[:upper:]]+ ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞß 1 31 +[[:punct:]]+ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À 0 31 +[[:print:]]+ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ 0 94 +[[:graph:]]+ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ 0 94 +[a-z]+ ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ 0 31 +[a-z]+ ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ 1 31 +[[:word:]]+ ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ 0 61 +;and equivalence classes: +[[=a=]]+ aAàáâãäåÀÁÂÃÄÅ 0 14 + +; and then test case mapping: +- match_default extended REG_EXTENDED REG_ICASE +;[A-Z]+ ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ 0 31 +;[a-z]+ ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ 1 31 +ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ 1 30 + + + + + + + diff --git a/demo/regress/tests.cpp b/demo/regress/tests.cpp new file mode 100644 index 00000000..13b35f3b --- /dev/null +++ b/demo/regress/tests.cpp @@ -0,0 +1,729 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * + * FILE tests.cpp + * VERSION 3.01 + * + * the actual tests conducted by regress. + * + */ + + +#include +#include "regress.h" + +using namespace boost; + +template +bool compare_result(const M1& sm, const M2& m) +{ + if(sm.size() != m.size()) + return false; + if(sm.line() != m.line()) + return false; + for(unsigned int i = 0; i < sm.size(); ++i) + { + if(sm.position(i) != m.position(i)) + return false; + if(sm.length(i) != m.length(i)) + return false; + } + return true; +} + +template +bool compare_result(const M1& sm, const M1& m) +{ + return sm == m; +} + + +template +void cpp_eh_tests(const reg_expression& ) +{ +#ifndef __GNUC__ + bool thrown = false; + // try set_expression form first: + try + { + A a; + reg_expression e(a); + e.set_expression(expression.c_str(), flags[2] | regbase::use_except); + } + catch(const boost::bad_expression&) + { + thrown = true; + } + catch(...){} + if(!thrown) + { + begin_error(); + cout << "Error: expected exception not thrown" << endl; + } + + // now try constructor form: + thrown = false; + try + { + A a; + reg_expression e(expression.c_str(), flags[2] | regbase::use_except, a); + } + catch(const boost::bad_expression&) + { + thrown = true; + } + catch(...){} + if(!thrown) + { + begin_error(); + cout << "Error: expected exception not thrown" << endl; + } +#endif +} + +template +iterator find_last_line(iterator start, iterator end) +{ + iterator result = start; + while(start != end) + { + if(*start == '\n') + { + ++start; + result = start; + } + else + ++start; + } + return result; +} + +template +unsigned int count_lines(iterator start, iterator end) +{ + unsigned int result = 0; + while(start != end) + { + if(*start == '\n') + ++result; + ++start; + } + return result; +} + +template +class grep_test_predicate +{ + int match_id; + iterator base, term; +public: + grep_test_predicate(iterator i, iterator j) : base(i), term(j) { match_id = 0; } + ~grep_test_predicate(){} + bool operator()(const boost::match_results< iterator, Alloc >& m); +}; + +template +bool grep_test_predicate::operator()(const boost::match_results< iterator, Alloc >& m) +{ + int start, end; + start = m[0].first - base; + end = m[0].second - base; + if((matches[match_id] != start) || (matches[match_id + 1] != end)) + { + begin_error(); + cout << "regex++ grep match error: found [" << start << "," << end << "] expected [" << matches[match_id] << "," << matches[match_id+1] << "]" << endl; + } + + // + // check $`: + start = m[-1].first - base; + end = m[-1].second - base; + if(match_id && + ( (end != matches[match_id]) || (start != matches[match_id - 1]) ) + ) + { + begin_error(); + cout << "regex++ grep error in $`: found [" << start << "," << end << "] expected [" << matches[match_id-1] << "," << matches[match_id] << "]" << endl; + } + else if((!match_id) && ((start != 0) || (end != matches[0]))) + { + begin_error(); + cout << "regex++ grep error in $`: found [" << start << "," << end << "] expected [" << 0 << "," << matches[0] << "]" << endl; + } + + // + // check $': + start = m[-2].first - base; + end = m[-2].second - base; + if((start != matches[match_id + 1]) || (end != (term-base))) + { + begin_error(); + cout << "regex++ grep error in $': found [" << start << "," << end << "] expected [" << matches[match_id + 1] << "," << (term-base) << "]" << endl; + } + + // + // now check line() + start = m.line(); + end = count_lines(base, iterator(m[0].first)) + 1; + if(start != end) + { + begin_error(); + cout << "regex++ grep error in line(): found " << start << " expected " << end << endl; + } + + // + // now check line_start() + start = m.line_start() - base; + end = find_last_line(base, iterator(m[0].first)) - base; + if(start != end) + { + begin_error(); + cout << "regex++ grep error in line_start(): found " << start << " expected " << end << endl; + } + + match_id += 2; + return true; +} + +template +void cpp_tests(const reg_expression& e, bool recurse = true) +{ + typedef A allocator_type; + if(flags[4] & REG_MERGE) + { + // + // test merge code: + // + string_type s; + s = regex_merge(search_text, e, format_string.c_str(), flags[3]); + if(s != merge_string) + { + begin_error(); + cout << "merge result mismatch: found \"" << s.c_str() << "\" expected \"" << merge_string.c_str() << "\"" << endl; + } + return; + } + + + if(recurse) + { + // copy and assign test: + reg_expression e2(e); + cpp_tests(e2, false); + e2 = e; + cpp_tests(e2, false); + } + + if(e.error_code()) + { + // verify that we don't expect expression to compile + if(search_text != BOOST_RE_STR("!")) + { + begin_error(); + cout << "Expression did not compile using regex++ API" << endl; + } + else if(recurse) + cpp_eh_tests(e); + } + else if(flags[4] & REG_GREP) + { + // try to do grep: + debug_iterator x(search_text.begin(), search_text.begin(), search_text.end()); + debug_iterator y(search_text.end(), search_text.begin(), search_text.end()); + grep_test_predicate, allocator_type> oi(x, y); + regex_grep(oi, x, y, e, flags[3]); +#if !defined(BOOST_RE_NO_PARTIAL_FUNC_SPEC) && !defined(BOOST_RE_NO_STRING_H) && !defined(BOOST_RE_NO_STRING_DEF_ARGS) + if(!recurse) + { + std::basic_string s(search_text.begin(), search_text.end()); + grep_test_predicate::const_iterator, reg_expression::allocator_type> oi2(s.begin(), s.end()); + regex_grep(oi2, s, e, flags[3]); + grep_test_predicate::allocator_type> oi3(s.c_str(), s.c_str()+s.size()); + regex_grep(oi3, s.c_str(), e, flags[3]); + } +#endif + } + else + { + // try to find match + match_results< debug_iterator, reg_expression::allocator_type> m; + debug_iterator x(search_text.begin(), search_text.begin(), search_text.end()); + debug_iterator y(search_text.end(), search_text.begin(), search_text.end()); + if(regex_search(x, y, m, e, flags[3])) + { + // match found compare what matched with what we expect: + int j = 0; + for(unsigned int i = 0; i < m.size(); ++i, j += 2) + { + if(m[i].matched == false) + { + if(matches[j] != -1) + { + begin_error(); + cout << "regex++ API result mismatch in sub-expression " << i << + ", found (" << (m[i].first - x) << "," << + (m[i].second - x) << ") expected (" << + matches[j] << "," << matches[j+1] << ")" << endl; + } + } + else if(((m[i].first - x) != matches[j]) || ((m[i].second - x) != matches[j+1])) + { + begin_error(); + cout << "regex++ API result mismatch in sub-expression " << i << + ", found (" << (m[i].first - x) << "," << + (m[i].second - x) << ") expected (" << + matches[j] << "," << matches[j+1] << ")" << endl; + } + } + // + // now check $` and $': + // + if((m[-1].first != x) || (m[-1].second != m[0].first)) + { + begin_error(); + cout << "regex++ API result mismatch in $` (match -1), found (" << + (m[-1].first - x) << "," << (m[-1].second - x) << ") expected (0" << + "," << matches[0] << ")" << endl; + } + if((m[-2].first != m[0].second) || (m[-2].second != y)) + { + begin_error(); + cout << "regex++ API result mismatch in $' (match -2), found (" << + (m[-2].first - x) << "," << (m[-2].second - x) << ") expected (" << + matches[1] << "," << (y-x) << ")" << endl; + } + + // + // now try alternative forms of regex_search if available: +#if !defined(BOOST_RE_NO_PARTIAL_FUNC_SPEC) && !defined(BOOST_RE_NO_STRING_H) && !defined(BOOST_RE_NO_STRING_DEF_ARGS) + if(!recurse) + { + std::basic_string s(search_text.begin(), search_text.end()); + match_results::const_iterator> sm; + if(regex_search(s, sm, e, flags[3])) + { + if(compare_result(sm, m) == false) + { + begin_error(); + cout << "regex++ API result mismatch in regex_search(const std::string&, match_results&, const reg_expression&, int)" << endl; + } + } + else + { + begin_error(); + cout << "regex++ API result mismatch in regex_search(const std::string&, match_results&, const reg_expression&, int)" << endl; + } + if(s.find(char_t(0)) == std::basic_string::npos) + { + match_results ssm; + if(regex_search(search_text.c_str(), ssm, e, flags[3])) + { + if(compare_result(ssm, m) == false) + { + begin_error(); + cout << "regex++ API result mismatch in regex_search(const char_t*, match_results&, const reg_expression&, int)" << endl; + } + } + else + { + begin_error(); + cout << "regex++ API result mismatch in regex_search(const char_t*, match_results&, const reg_expression&, int)" << endl; + } + } + } + if((false == recurse) && (matches[0] == 0) && (matches[1] == search_text.size())) + { + // + // match expected on whole string, so all versions + // of regex_match should also succeed: + // + match_results< debug_iterator, reg_expression::allocator_type> m1; + debug_iterator x1(search_text.begin(), search_text.begin(), search_text.end()); + debug_iterator y1(search_text.end(), search_text.begin(), search_text.end()); + if(regex_match(x1, y1, m1, e, flags[3])) + { + if(compare_result(m1, m) == false) + { + begin_error(); + cout << "regex++ API result mismatch in regex_match(iterator, iterator, match_results&, const reg_expression&, int)" << endl; + } + } + else + { + begin_error(); + cout << "regex++ API result mismatch in regex_match(iterator, iterator, match_results&, const reg_expression&, int)" << endl; + } + std::basic_string s(search_text.begin(), search_text.end()); + match_results::const_iterator> sm; + if(regex_match(s, sm, e, flags[3])) + { + if(compare_result(sm, m) == false) + { + begin_error(); + cout << "regex++ API result mismatch in regex_match(const std::string&, match_results&, const reg_expression&, int)" << endl; + } + } + else + { + begin_error(); + cout << "regex++ API result mismatch in regex_match(const std::string&, match_results&, const reg_expression&, int)" << endl; + } + if(s.find(char_t(0)) == std::basic_string::npos) + { + match_results ssm; + if(regex_match(search_text.c_str(), ssm, e, flags[3])) + { + if(compare_result(ssm, m) == false) + { + begin_error(); + cout << "regex++ API result mismatch in regex_match(const char_t*, match_results&, const reg_expression&, int)" << endl; + } + } + else + { + begin_error(); + cout << "regex++ API result mismatch in regex_match(const char_t*, match_results&, const reg_expression&, int)" << endl; + } + } + } +#endif + } + else + { + // match not found + if(matches[0] != -1) + { + begin_error(); + cout << "Match expected but not found using regex++ API" << endl; + } + } + } +} + +#if !defined(TEST_UNICODE) + +unsigned int hl_match_id; + +bool hl_grep_test_proc(const RegEx& e) +{ + int start, end; + start = e.Position(0); + end = start + e.Length(); + if((matches[hl_match_id] != start) || (matches[hl_match_id + 1] != end)) + { + begin_error(); + cout << "class RegEx grep match error: found [" << start << "," << end << "] expected [" << matches[hl_match_id] << "," << matches[hl_match_id+1] << "]" << endl; + } + + // + // check $`: + start = e.Position(-1); + end = start + e.Length(-1); + if(start == -1) + { + if(hl_match_id && + ( matches[hl_match_id] != matches[hl_match_id - 1] ) + ) + { + begin_error(); + cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << matches[hl_match_id-1] << "," << matches[hl_match_id] << "]" << endl; + } + else if((!hl_match_id) && (0 != matches[0])) + { + begin_error(); + cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << 0 << "," << matches[0] << "]" << endl; + } + } + else + { + if(hl_match_id && + ( (end != matches[hl_match_id]) || (start != matches[hl_match_id - 1]) ) + ) + { + begin_error(); + cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << matches[hl_match_id-1] << "," << matches[hl_match_id] << "]" << endl; + } + else if((!hl_match_id) && ((start != 0) || (end != matches[0]))) + { + begin_error(); + cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << 0 << "," << matches[0] << "]" << endl; + } + } + + // + // check $': + start = e.Position(-2); + end = start + e.Length(-2); + if(start == -1) + { + if(matches[hl_match_id + 1] != search_text.size()) + { + begin_error(); + cout << "class RegEx grep error in $': found [" << start << "," << end << "] expected [" << matches[hl_match_id + 1] << "," << (search_text.size()) << "]" << endl; + } + } + else if((start != matches[hl_match_id + 1]) || (end != search_text.size())) + { + begin_error(); + cout << "class RegEx grep error in $': found [" << start << "," << end << "] expected [" << matches[hl_match_id + 1] << "," << (search_text.size()) << "]" << endl; + } + + hl_match_id += 2; + return true; +} + +void cpp_hl_tests(RegEx& e, bool recurse = true) +{ + if(flags[4] & REG_MERGE) + return; + + if(recurse) + { + // copy and assign test: + RegEx e2(e); + cpp_hl_tests(e2, false); + e2 = e; + cpp_hl_tests(e2, false); + } + + if(flags[4] & REG_GREP) + { + // try to do grep: + hl_match_id = 0; + GrepCallback cb = hl_grep_test_proc; + e.Grep(cb, search_text.c_str(), flags[3]); + } + else + { + if(e.Search(search_text.c_str(), flags[3])) + { + unsigned int i = 0; + unsigned int j = 0; + while(matches[j] != -2) + { + if( (matches[j] != e.Position(i)) || (matches[j+1] - matches[j] != e.Length(i)) ) + { + begin_error(); + cout << "RegEx::Search error in subexpression " << i << ": found [" << e.Position(i) << "," << (e.Position(i) + e.Length(i)) << "] expected [" << matches[j] << "," << matches[j+1] << "]" << endl; + } + ++i; + j += 2; + } + } + else + { + if(matches[0] != -1) + { + begin_error(); + cout << "match expected but not found with RexEx::Search" << endl; + } + } + + if((matches[0] == 0) && (e.Match(search_text.c_str(), flags[3]))) + { + unsigned int i = 0; + unsigned int j = 0; + while(matches[j] != -2) + { + if( (matches[j] != e.Position(i)) || (matches[j+1] - matches[j] != e.Length(i)) ) + { + begin_error(); + cout << "RegEx::Match error in subexpression " << i << ": found [" << e.Position(i) << "," << (e.Position(i) + e.Length(i)) << "] expected [" << matches[j] << "," << matches[j+1] << "]" << endl; + } + ++i; + j += 2; + } + } + } +} +#endif + +template +bool has_nulls(iterator i, iterator j) +{ + while(i != j) + { + if(*i == 0) + return true; + ++i; + } + return false; +} + +#ifdef TEST_UNICODE +#undef regcomp +#undef regerror +#undef regexec +#undef regfree +#undef regex_t +#define regcomp regcompW +#define regerror regerrorW +#define regexec regexecW +#define regfree regfreeW +#define regex_t regex_tW +#endif + + +void run_tests() +{ +#ifndef TEST_UNICODE + if(flags[4] & REG_UNICODE_ONLY) + return; +#endif +#ifndef NO_CPP_TEST + try + { + unsigned int f = flags[2] & ~regbase::use_except; + if(flags[0] & REG_ICASE) + f |= regbase::icase; + re_type e(expression.c_str(), f); + cpp_tests(e, true); + } + #ifndef BOOST_RE_NO_EXCEPTION_H + catch(const std::exception& e) + { + // + // this is only an error if the expression is expected to be valid: + if(search_text != BOOST_RE_STR("!")) + { + begin_error(); + cout << "Unexpected exception thrown from C++ library: " << e.what() << endl; + } + } + #endif + catch(...) + { + begin_error(); + cout << "Unexpected exception thrown from C++ library" << endl; + } +#endif + +#if !defined(TEST_UNICODE) + try + { + if((flags[2] == regbase::normal) && (has_nulls(search_text.begin(), search_text.end()) == false)) + { + RegEx e; + e.SetExpression(expression.c_str(), flags[0] & REG_ICASE); + cpp_hl_tests(e, true); + } + } + catch(const std::exception& e) + { + if(search_text != BOOST_RE_STR("!")) + { + begin_error(); + cout << "Expression did not compile with class RegEx" << endl; + } + } + catch(...) + { + begin_error(); + cout << "Unexpected exception thrown from RegEx::SetExpression" << endl; + } +#endif + + if(flags[4] & (REG_NO_POSIX_TEST | REG_GREP | REG_MERGE | REG_MERGE_COPY)) + return; + regex_t posix_expression; + regmatch_t m[MAX_MATCHES]; + if(regcomp(&posix_expression, expression.c_str(), flags[0]) == 0) + { + if(flags[1] & REG_STARTEND) + { + m[0].rm_so = 0; + m[0].rm_eo = search_text.size(); + } + if(regexec(&posix_expression, search_text.c_str(), MAX_MATCHES, m, flags[1])) + { + // match not found + if(matches[0] != -1) + { + begin_error(); + cout << "Match expected but not found using POSIX API" << endl; + } + } + else + { + // match found compare what matched with what we expect: + int j = 0; + for(unsigned int i = 0; i <= posix_expression.re_nsub; ++i, j += 2) + { + if((m[i].rm_so != matches[j]) || (m[i].rm_eo != matches[j+1])) + { + begin_error(); + cout << "POSIX API result mismatch in sub-expression " << i << ", found (" << m[i].rm_so << "," << m[i].rm_eo << + ") expected (" << matches[j] << "," << matches[j+1] << ")" << endl; + } + } + } + regfree(&posix_expression); + } + else + { + // expression did not compile + if(search_text != BOOST_RE_STR("!")) + { + begin_error(); + cout << "Expression did not compile using POSIX API" << endl; + } + } +} + + + +// +// error reporting: +int last_line = 0; + +void begin_error() +{ + if(line != last_line) + { + cout << "Error in line " << line << " of file " << file << endl; + cout << "Expression: " << expression.c_str() << endl; + cout << "Search text: " << search_text.c_str() << endl; + cout << "Flags: "; + bool started = false; + unsigned int id = 0; + while(flag_data[id].len != 0) + { + if(flags[flag_data[id].id] & flag_data[id].value) + { + if(started) + cout << " | "; + cout << flag_data[id].name; + started = true; + } + ++id; + } + cout << endl; + last_line = line; + ++error_count; + } +} + +void reset_error() +{ + last_line = 0; +} + + + + + + diff --git a/demo/regress/tests.txt b/demo/regress/tests.txt new file mode 100644 index 00000000..ffdb5bdf --- /dev/null +++ b/demo/regress/tests.txt @@ -0,0 +1,857 @@ +; +; +; this file contains a script of tests to run through regress.exe +; +; comments start with a semicolon and proceed to the end of the line +; +; changes to regular expression compile flags start with a "-" as the first +; non-whitespace character and consist of a list of the printable names +; of the flags, for example "match_default" +; +; Other lines contain a test to perform using the current flag status +; the first token contains the expression to compile, the second the string +; to match it against. If the second string is "!" then the expression should +; not compile, that is the first string is an invalid regular expression. +; This is then followed by a list of integers that specify what should match, +; each pair represents the starting and ending positions of a subexpression +; starting with the zeroth subexpression (the whole match). +; A value of -1 indicates that the subexpression should not take part in the +; match at all, if the first value is -1 then no part of the expression should +; match the string. +; + +- match_default normal REG_EXTENDED + +; +; try some really simple literals: +a a 0 1 +Z Z 0 1 +Z aaa -1 -1 +Z xxxxZZxxx 4 5 + +; and some simple brackets: +(a) zzzaazz 3 4 3 4 +() zzz 0 0 0 0 +() "" 0 0 0 0 +( ! +) ! +(aa ! +aa) ! +a b -1 -1 +\(\) () 0 2 +\(a\) (a) 0 3 +\() ! +(\) ! +; now try escaped brackets: +- match_default bk_parens REG_BASIC +\(a\) zzzaazz 3 4 3 4 +\(\) zzz 0 0 0 0 +\(\) "" 0 0 0 0 +\( ! +\) ! +\(aa ! +aa\) ! +() () 0 2 +(a) (a) 0 3 +(\) ! +\() ! + +; now move on to "." wildcards +- match_default normal REG_EXTENDED REG_STARTEND +. a 0 1 +. \n 0 1 +. \r 0 1 +. \0 0 1 +- match_default normal match_not_dot_newline REG_EXTENDED REG_STARTEND REG_NEWLINE +. a 0 1 +. \n -1 -1 +. \r -1 -1 +. \0 0 1 +- match_default normal match_not_dot_null match_not_dot_newline REG_EXTENDED REG_STARTEND REG_NEWLINE +. \n -1 -1 +. \r -1 -1 +; this *WILL* produce an error from the POSIX API functions: +- match_default normal match_not_dot_null match_not_dot_newline REG_EXTENDED REG_STARTEND REG_NEWLINE REG_NO_POSIX_TEST +. \0 -1 -1 + + +; +; now move on to the repetion ops, +; starting with operator * +- match_default normal REG_EXTENDED +a* b 0 0 +ab* a 0 1 +ab* ab 0 2 +ab* sssabbbbbbsss 3 10 +ab*c* a 0 1 +ab*c* abbb 0 4 +ab*c* accc 0 4 +ab*c* abbcc 0 5 +*a ! +\<* ! +\>* ! +\n* \n\n 0 2 +\** ** 0 2 +\* * 0 1 + +; now try operator + +ab+ a -1 -1 +ab+ ab 0 2 +ab+ sssabbbbbbsss 3 10 +ab+c+ a -1 -1 +ab+c+ abbb -1 -1 +ab+c+ accc -1 -1 +ab+c+ abbcc 0 5 ++a ! +\<+ ! +\>+ ! +\n+ \n\n 0 2 +\+ + 0 1 +\+ ++ 0 1 +\++ ++ 0 2 +- match_default normal bk_plus_qm REG_EXTENDED REG_NO_POSIX_TEST ++ + 0 1 +\+ ! +a\+ aa 0 2 + +; now try operator ? +- match_default normal REG_EXTENDED +a? b 0 0 +ab? a 0 1 +ab? ab 0 2 +ab? sssabbbbbbsss 3 5 +ab?c? a 0 1 +ab?c? abbb 0 2 +ab?c? accc 0 2 +ab?c? abcc 0 3 +?a ! +\? ! +\n? \n\n 0 1 +\? ? 0 1 +\? ?? 0 1 +\?? ?? 0 1 +- match_default normal bk_plus_qm REG_EXTENDED REG_NO_POSIX_TEST +? ? 0 1 +\? ! +a\? aa 0 1 +a\? b 0 0 + +- match_default normal limited_ops +a? a? 0 2 +a+ a+ 0 2 +a\? a? 0 2 +a\+ a+ 0 2 + +; now try operator {} +- match_default normal REG_EXTENDED +a{2} a -1 -1 +a{2} aa 0 2 +a{2} aaa 0 2 +a{2,} a -1 -1 +a{2,} aa 0 2 +a{2,} aaaaa 0 5 +a{2,4} a -1 -1 +a{2,4} aa 0 2 +a{2,4} aaa 0 3 +a{2,4} aaaa 0 4 +a{2,4} aaaaa 0 4 +; spaces are now allowed inside {} +"a{ 2 , 4 }" aaaaa 0 4 +a{} ! +"a{ }" ! +a{2 ! +a} ! +\{\} {} 0 2 + +- match_default normal bk_braces +a\{2\} a -1 -1 +a\{2\} aa 0 2 +a\{2\} aaa 0 2 +a\{2,\} a -1 -1 +a\{2,\} aa 0 2 +a\{2,\} aaaaa 0 5 +a\{2,4\} a -1 -1 +a\{2,4\} aa 0 2 +a\{2,4\} aaa 0 3 +a\{2,4\} aaaa 0 4 +a\{2,4\} aaaaa 0 4 +"a\{ 2 , 4 \}" aaaaa 0 4 +{} {} 0 2 + +; now test the alternation operator | +- match_default normal REG_EXTENDED +a|b a 0 1 +a|b b 0 1 +a(b|c) ab 0 2 1 2 +a(b|c) ac 0 2 1 2 +a(b|c) ad -1 -1 -1 -1 +|c ! +c| ! +(|) ! +(a|) ! +(|a) ! +a\| a| 0 2 +- match_default normal limited_ops +a| a| 0 2 +a\| a| 0 2 +| | 0 1 +- match_default normal bk_vbar REG_NO_POSIX_TEST +a| a| 0 2 +a\|b a 0 1 +a\|b b 0 1 + +; now test the set operator [] +- match_default normal REG_EXTENDED +; try some literals first +[abc] a 0 1 +[abc] b 0 1 +[abc] c 0 1 +[abc] d -1 -1 +[^bcd] a 0 1 +[^bcd] b -1 -1 +[^bcd] d -1 -1 +[^bcd] e 0 1 +a[b]c abc 0 3 +a[ab]c abc 0 3 +a[^ab]c adc 0 3 +a[]b]c a]c 0 3 +a[[b]c a[c 0 3 +a[-b]c a-c 0 3 +a[^]b]c adc 0 3 +a[^-b]c adc 0 3 +a[b-]c a-c 0 3 +a[b ! +a[] ! + +; then some ranges +[b-e] a -1 -1 +[b-e] b 0 1 +[b-e] e 0 1 +[b-e] f -1 -1 +[^b-e] a 0 1 +[^b-e] b -1 -1 +[^b-e] e -1 -1 +[^b-e] f 0 1 +a[1-3]c a2c 0 3 +a[3-1]c ! +a[1-3-5]c ! +a[1- ! + +; and some classes +a[[:alpha:]]c abc 0 3 +a[[:unknown:]]c ! +a[[: ! +a[[:alpha ! +a[[:alpha:] ! +a[[:alpha,:] ! +a[[:]:]]b ! +a[[:-:]]b ! +a[[:alph:]] ! +a[[:alphabet:]] ! +[[:alnum:]]+ -%@a0X- 3 6 +[[:alpha:]]+ -%@aX0- 3 5 +[[:blank:]]+ "a \tb" 1 4 +[[:cntrl:]]+ a\n\tb 1 3 +[[:digit:]]+ a019b 1 4 +[[:graph:]]+ " a%b " 1 4 +[[:lower:]]+ AabC 1 3 +[[:print:]]+ "\na b\n" 1 4 +[[:punct:]]+ " %-&\t" 1 4 +[[:space:]]+ "a \n\t\rb" 1 5 +[[:upper:]]+ aBCd 1 3 +[[:xdigit:]]+ p0f3Cx 1 5 + +; now test flag settings: +- escape_in_lists REG_NO_POSIX_TEST +[\n] \n 0 1 +- REG_NO_POSIX_TEST +[\n] \n -1 -1 +[\n] \\ 0 1 +[[:class:] : 0 1 +[[:class:] [ 0 1 +[[:class:] c 0 1 + +; line anchors +- match_default normal REG_EXTENDED +^ab ab 0 2 +^ab xxabxx -1 -1 +^ab xx\nabzz 3 5 +ab$ ab 0 2 +ab$ abxx -1 -1 +ab$ ab\nzz 0 2 +- match_default match_not_bol match_not_eol normal REG_EXTENDED REG_NOTBOL REG_NOTEOL +^ab ab -1 -1 +^ab xxabxx -1 -1 +^ab xx\nabzz 3 5 +ab$ ab -1 -1 +ab$ abxx -1 -1 +ab$ ab\nzz 0 2 + +; back references +- match_default normal REG_EXTENDED +a(b)\2c ! +a(b\1)c ! +a(b*)c\1d abbcbbd 0 7 1 3 +a(b*)c\1d abbcbd -1 -1 +a(b*)c\1d abbcbbbd -1 -1 +^(.)\1 abc -1 -1 +a([bc])\1d abcdabbd 4 8 5 6 +; strictly speaking this is at best ambiguous, at worst wrong, this is what most +; re implimentations will match though. +a(([bc])\2)*d abbccd 0 6 3 5 3 4 + +a(([bc])\2)*d abbcbd -1 -1 +a((b)*\2)*d abbbd 0 5 1 4 2 3 +(ab*)[ab]*\1 ababaaa 0 7 0 1 +(a)\1bcd aabcd 0 5 0 1 +(a)\1bc*d aabcd 0 5 0 1 +(a)\1bc*d aabd 0 4 0 1 +(a)\1bc*d aabcccd 0 7 0 1 +(a)\1bc*[ce]d aabcccd 0 7 0 1 +^(a)\1b(c)*cd$ aabcccd 0 7 0 1 4 5 + +; +; characters by code: +- match_default normal REG_EXTENDED REG_STARTEND +\0101 A 0 1 +\00 \0 0 1 +\0 \0 0 1 +\0172 z 0 1 + +; +; word operators: +\w a 0 1 +\w z 0 1 +\w A 0 1 +\w Z 0 1 +\w _ 0 1 +\w } -1 -1 +\w ` -1 -1 +\w [ -1 -1 +\w @ -1 -1 +; non-word: +\W a -1 -1 +\W z -1 -1 +\W A -1 -1 +\W Z -1 -1 +\W _ -1 -1 +\W } 0 1 +\W ` 0 1 +\W [ 0 1 +\W @ 0 1 +; word start: +\ abc 0 3 +abc\> abcd -1 -1 +abc\> abc\n 0 3 +abc\> abc:: 0 3 +; word boundary: +\babcd " abcd" 2 6 +\bab cab -1 -1 +\bab "\nab" 1 3 +\btag ::tag 2 5 +abc\b abc 0 3 +abc\b abcd -1 -1 +abc\b abc\n 0 3 +abc\b abc:: 0 3 +; within word: +\B ab 1 1 +a\Bb ab 0 2 +a\B ab 0 1 +a\B a -1 -1 +a\B "a " -1 -1 + +; +; buffer operators: +\`abc abc 0 3 +\`abc \nabc -1 -1 +\`abc " abc" -1 -1 +abc\' abc 0 3 +abc\' abc\n -1 -1 +abc\' "abc " -1 -1 + +; +; extra escape sequences: +\a \a 0 1 +\f \f 0 1 +\n \n 0 1 +\r \r 0 1 +\t \t 0 1 +\v \v 0 1 + + +; +; now follows various complex expressions designed to try and bust the matcher: +a(((b)))c abc 0 3 1 2 1 2 1 2 +a(b|(c))d abd 0 3 1 2 -1 -1 +a(b|(c))d acd 0 3 1 2 1 2 +a(b*|c)d abbd 0 4 1 3 +; just gotta have one DFA-buster, of course +a[ab]{20} aaaaabaaaabaaaabaaaab 0 21 +; and an inline expansion in case somebody gets tricky +a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] aaaaabaaaabaaaabaaaab 0 21 +; and in case somebody just slips in an NFA... +a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) aaaaabaaaabaaaabaaaabweeknights 0 31 21 24 24 31 +; one really big one +1234567890123456789012345678901234567890123456789012345678901234567890 a1234567890123456789012345678901234567890123456789012345678901234567890b 1 71 +; fish for problems as brackets go past 8 +[ab][cd][ef][gh][ij][kl][mn] xacegikmoq 1 8 +[ab][cd][ef][gh][ij][kl][mn][op] xacegikmoq 1 9 +[ab][cd][ef][gh][ij][kl][mn][op][qr] xacegikmoqy 1 10 +[ab][cd][ef][gh][ij][kl][mn][op][q] xacegikmoqy 1 10 +; and as parenthesis go past 9: +(a)(b)(c)(d)(e)(f)(g)(h) zabcdefghi 1 9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 +(a)(b)(c)(d)(e)(f)(g)(h)(i) zabcdefghij 1 10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 +(a)(b)(c)(d)(e)(f)(g)(h)(i)(j) zabcdefghijk 1 11 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 +(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k) zabcdefghijkl 1 12 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 +(a)d|(b)c abc 1 3 -1 -1 1 2 +"_+((www)|(ftp)|(mailto)):_*" "_wwwnocolon _mailto:" 12 20 13 19 -1 -1 -1 -1 13 19 + +; subtleties of matching +a(b)?c\1d acd 0 3 -1 -1 +a(b?c)+d accd 0 4 2 3 +(wee|week)(knights|night) weeknights 0 10 0 3 3 10 +.* abc 0 3 +a(b|(c))d abd 0 3 1 2 -1 -1 +a(b|(c))d acd 0 3 1 2 1 2 +a(b*|c|e)d abbd 0 4 1 3 +a(b*|c|e)d acd 0 3 1 2 +a(b*|c|e)d ad 0 2 1 1 +a(b?)c abc 0 3 1 2 +a(b?)c ac 0 2 1 1 +a(b+)c abc 0 3 1 2 +a(b+)c abbbc 0 5 1 4 +a(b*)c ac 0 2 1 1 +(a|ab)(bc([de]+)f|cde) abcdef 0 6 0 1 1 6 3 5 +a([bc]?)c abc 0 3 1 2 +a([bc]?)c ac 0 2 1 1 +a([bc]+)c abc 0 3 1 2 +a([bc]+)c abcc 0 4 1 3 +a([bc]+)bc abcbc 0 5 1 3 +a(bb+|b)b abb 0 3 1 2 +a(bbb+|bb+|b)b abb 0 3 1 2 +a(bbb+|bb+|b)b abbb 0 4 1 3 +a(bbb+|bb+|b)bb abbb 0 4 1 2 +(.*).* abcdef 0 6 0 6 +(a*)* bc 0 0 0 0 + +; do we get the right subexpression when it is used more than once? +a(b|c)*d ad 0 2 -1 -1 +a(b|c)*d abcd 0 4 2 3 +a(b|c)+d abd 0 3 1 2 +a(b|c)+d abcd 0 4 2 3 +a(b|c?)+d ad 0 2 1 1 +a(b|c?)+d abcd 0 4 2 3 +a(b|c){0,0}d ad 0 2 -1 -1 +a(b|c){0,1}d ad 0 2 -1 -1 +a(b|c){0,1}d abd 0 3 1 2 +a(b|c){0,2}d ad 0 2 -1 -1 +a(b|c){0,2}d abcd 0 4 2 3 +a(b|c){0,}d ad 0 2 -1 -1 +a(b|c){0,}d abcd 0 4 2 3 +a(b|c){1,1}d abd 0 3 1 2 +a(b|c){1,2}d abd 0 3 1 2 +a(b|c){1,2}d abcd 0 4 2 3 +a(b|c){1,}d abd 0 3 1 2 +a(b|c){1,}d abcd 0 4 2 3 +a(b|c){2,2}d acbd 0 4 2 3 +a(b|c){2,2}d abcd 0 4 2 3 +a(b|c){2,4}d abcd 0 4 2 3 +a(b|c){2,4}d abcbd 0 5 3 4 +a(b|c){2,4}d abcbcd 0 6 4 5 +a(b|c){2,}d abcd 0 4 2 3 +a(b|c){2,}d abcbd 0 5 3 4 +a(b+|((c)*))+d abd 0 3 1 2 -1 -1 -1 -1 +a(b+|((c)*))+d abcd 0 4 2 3 2 3 2 3 + +- match_default normal REG_EXTENDED REG_STARTEND REG_NOSPEC literal +\**?/{} \\**?/{} 0 7 + +- match_default normal REG_EXTENDED REG_NO_POSIX_TEST ; we disable POSIX testing because it can't handle escapes in sets +; try to match C++ syntax elements: +; line comment: +//[^\n]* "++i //here is a line comment\n" 4 28 +; block comment: +/\*([^*]|\*+[^*/])*\*+/ "/* here is a block comment */" 0 29 26 27 +/\*([^*]|\*+[^*/])*\*+/ "/**/" 0 4 -1 -1 +/\*([^*]|\*+[^*/])*\*+/ "/***/" 0 5 -1 -1 +/\*([^*]|\*+[^*/])*\*+/ "/****/" 0 6 -1 -1 +/\*([^*]|\*+[^*/])*\*+/ "/*****/" 0 7 -1 -1 +/\*([^*]|\*+[^*/])*\*+/ "/*****/*/" 0 7 -1 -1 +; preprossor directives: +^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol" 0 19 -1 -1 +^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol(x) #x" 0 25 -1 -1 +^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol(x) \\ \r\n foo();\\\r\n printf(#x);" 0 53 28 42 +; literals: +((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFF 0 4 0 4 0 4 -1 -1 -1 -1 -1 -1 -1 -1 +((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 35 0 2 0 2 -1 -1 0 2 -1 -1 -1 -1 -1 -1 +((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFu 0 5 0 4 0 4 -1 -1 -1 -1 -1 -1 -1 -1 +((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFL 0 5 0 4 0 4 -1 -1 4 5 -1 -1 -1 -1 +((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFFFFFFFFFFFFFFFuint64 0 24 0 18 0 18 -1 -1 19 24 19 24 22 24 +; strings: +'([^\\']|\\.)*' '\\x3A' 0 6 4 5 +'([^\\']|\\.)*' '\\'' 0 4 1 3 +'([^\\']|\\.)*' '\\n' 0 4 1 3 + +; now try and test some unicode specific characters: +- match_default normal REG_EXTENDED REG_UNICODE_ONLY +[[:unicode:]]+ a\0300\0400z 1 3 + +; finally try some case insensitive matches: +- match_default normal REG_EXTENDED REG_ICASE +; upper and lower have no meaning here so they fail, however these +; may compile with other libraries... +;[[:lower:]] ! +;[[:upper:]] ! +0123456789@abcdefghijklmnopqrstuvwxyz\[\\\]\^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ\{\|\} 0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]\^_`abcdefghijklmnopqrstuvwxyz\{\|\} 0 72 + +; known and suspected bugs: +- match_default normal REG_EXTENDED +\( ( 0 1 +\) ) 0 1 +\$ $ 0 1 +\^ ^ 0 1 +\. . 0 1 +\* * 0 1 +\+ + 0 1 +\? ? 0 1 +\[ [ 0 1 +\] ] 0 1 +\| | 0 1 +\\ \\ 0 1 +# # 0 1 +\# # 0 1 +a- a- 0 2 +\- - 0 1 +\{ { 0 1 +\} } 0 1 +0 0 0 1 +1 1 0 1 +9 9 0 1 +b b 0 1 +B B 0 1 +< < 0 1 +> > 0 1 +w w 0 1 +W W 0 1 +` ` 0 1 +' ' 0 1 +\n \n 0 1 +, , 0 1 +a a 0 1 +f f 0 1 +n n 0 1 +r r 0 1 +t t 0 1 +v v 0 1 +c c 0 1 +x x 0 1 +: : 0 1 +(\.[[:alnum:]]+){2} "w.a.b " 1 5 3 5 + +- match_default normal REG_EXTENDED REG_ICASE +a A 0 1 +A a 0 1 +[abc]+ abcABC 0 6 +[ABC]+ abcABC 0 6 +[a-z]+ abcABC 0 6 +[A-Z]+ abzANZ 0 6 +[a-Z]+ abzABZ 0 6 +[A-z]+ abzABZ 0 6 +[[:lower:]]+ abyzABYZ 0 8 +[[:upper:]]+ abzABZ 0 6 +[[:word:]]+ abcZZZ 0 6 +[[:alpha:]]+ abyzABYZ 0 8 +[[:alnum:]]+ 09abyzABYZ 0 10 + +; updated tests for version 2: +- match_default normal REG_EXTENDED +\x41 A 0 1 +\xff \255 0 1 +\xFF \255 0 1 +- match_default normal REG_EXTENDED REG_NO_POSIX_TEST +\c@ \0 0 1 +- match_default normal REG_EXTENDED +\cA \1 0 1 +\cz \58 0 1 +\c= ! +\c? ! +=: =: 0 2 + +; word start: +[[:<:]]abcd " abcd" 2 6 +[[:<:]]ab cab -1 -1 +[[:<:]]ab "\nab" 1 3 +[[:<:]]tag ::tag 2 5 +;word end: +abc[[:>:]] abc 0 3 +abc[[:>:]] abcd -1 -1 +abc[[:>:]] abc\n 0 3 +abc[[:>:]] abc:: 0 3 + +; collating elements and rewritten set code: +- match_default normal REG_EXTENDED REG_STARTEND +[[.zero.]] 0 0 1 +[[.one.]] 1 0 1 +[[.two.]] 2 0 1 +[[.three.]] 3 0 1 +[[.a.]] baa 1 2 +[[.right-curly-bracket.]] } 0 1 +[[.NUL.]] \0 0 1 +[[:<:]z] ! +[a[:>:]] ! +[[=a=]] a 0 1 +[[=right-curly-bracket=]] } 0 1 +- match_default normal REG_EXTENDED REG_STARTEND REG_ICASE +[[.A.]] A 0 1 +[[.A.]] a 0 1 +[[.A.]-b]+ AaBb 0 4 +[A-[.b.]]+ AaBb 0 4 +[[.a.]-B]+ AaBb 0 4 +[a-[.B.]]+ AaBb 0 4 +- match_default normal REG_EXTENDED REG_NO_POSIX_TEST +[\x61] a 0 1 +[\x61-c]+ abcd 0 3 +[a-\x63]+ abcd 0 3 +- match_default normal REG_EXTENDED REG_STARTEND +[[.a.]-c]+ abcd 0 3 +[a-[.c.]]+ abcd 0 3 +[[:alpha:]-a] ! +[a-[:alpha:]] ! + +; try mutli-character ligatures: +[[.ae.]] ae 0 2 +[[.ae.]] aE -1 -1 +[[.AE.]] AE 0 2 +[[.Ae.]] Ae 0 2 +[[.ae.]-b] a -1 -1 +[[.ae.]-b] b 0 1 +[[.ae.]-b] ae 0 2 +[a-[.ae.]] a 0 1 +[a-[.ae.]] b -1 -1 +[a-[.ae.]] ae 0 2 +- match_default normal REG_EXTENDED REG_STARTEND REG_ICASE +[[.ae.]] AE 0 2 +[[.ae.]] Ae 0 2 +[[.AE.]] Ae 0 2 +[[.Ae.]] aE 0 2 +[[.AE.]-B] a -1 -1 +[[.Ae.]-b] b 0 1 +[[.Ae.]-b] B 0 1 +[[.ae.]-b] AE 0 2 + +- match_default normal REG_EXTENDED REG_STARTEND +;extended perl style escape sequences: +\e \27 0 1 +\x1b \27 0 1 +\x{1b} \27 0 1 +\x{} ! +\x{ ! +\x} ! +\x ! +\x{yy ! +\x{1b ! + +- match_default normal REG_EXTENDED REG_STARTEND REG_NO_POSIX_TEST +\l+ ABabcAB 2 5 +[\l]+ ABabcAB 2 5 +[a-\l] ! +[\l-a] ! +[\L] ! +\L+ abABCab 2 5 +\u+ abABCab 2 5 +[\u]+ abABCab 2 5 +[\U] ! +\U+ ABabcAB 2 5 +\d+ ab012ab 2 5 +[\d]+ ab012ab 2 5 +[\D] ! +\D+ 01abc01 2 5 +\s+ "ab ab" 2 5 +[\s]+ "ab ab" 2 5 +[\S] ! +\S+ " abc " 2 5 +- match_default normal REG_EXTENDED REG_STARTEND +\Qabc ! +\Qabc\E abcd 0 3 +\Qabc\Ed abcde 0 4 +\Q+*?\\E +*?\\ 0 4 + +\C+ abcde 0 5 +\X+ abcde 0 5 + +- match_default normal REG_EXTENDED REG_STARTEND REG_UNICODE_ONLY +\X+ a\768\769 0 3 +\X+ \2309\2307 0 2 ;DEVANAGARI script +\X+ \2489\2494 0 2 ;BENGALI script + +- match_default normal REG_EXTENDED REG_STARTEND +\Aabc abc 0 3 +\Aabc aabc -1 -1 +abc\z abc 0 3 +abc\z abcd -1 -1 +abc\Z abc\n\n 0 3 +abc\Z abc 0 3 + + +\Gabc abc 0 3 +\Gabc dabcd -1 -1 +a\Gbc abc -1 -1 +a\Aab abc -1 -1 + +; +; now test grep, +; basically check all our restart types - line, word, etc +; checking each one for null and non-null matches. +; +- match_default normal REG_EXTENDED REG_STARTEND REG_GREP +a " a a a aa" 1 2 3 4 5 6 7 8 8 9 +a+b+ "aabaabbb ab" 0 3 3 8 9 11 +a(b*|c|e)d adabbdacd 0 2 2 6 6 9 +a "\na\na\na\naa" 1 2 3 4 5 6 7 8 8 9 + +^ " \n\n \n\n\n" 0 0 4 4 5 5 8 8 9 9 10 10 +^ab "ab \nab ab\n" 0 2 5 7 +^[^\n]*\n " \n \n\n \n" 0 4 4 7 7 8 8 11 +\]*>(.*?)<\s*/tag\s*> " here is some text " 1 29 6 23 +<\s*tag[^>]*>(.*?)<\s*/tag\s*> " < tag attr=\"something\">here is some text< /tag > " 1 49 24 41 + +; +; non-marking parenthesis added 25/04/00 +- match_default normal REG_EXTENDED +(?:abc)+ xxabcabcxx 2 8 +(?:a+)(b+) xaaabbbx 1 7 4 7 +(a+)(?:b+) xaaabbba 1 7 1 4 +(?:(a+)b+) xaaabbba 1 7 1 4 +(?:a+(b+)) xaaabbba 1 7 4 7 +a+(?#b+)b+ xaaabbba 1 7 + + + + + + + + + diff --git a/demo/regress/vc6-stlport.mak b/demo/regress/vc6-stlport.mak new file mode 100644 index 00000000..0e4acb3e --- /dev/null +++ b/demo/regress/vc6-stlport.mak @@ -0,0 +1,125 @@ + +# very basic makefile for regression tests +# +# Visual C++ 6 + full stlport 4.x +# +# we don't test single threaded builds as stlport doesn't support these... +# +CFLAGS= -O2 -GX -GR -I..\..\..\..\ + +LFLAGS= -link /LIBPATH:..\..\lib\vc6-stlport user32.lib + +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 r1md.exe r2md.exe r3md.exe r4md.exe r5md.exe r6md.exe r1lmd.exe r2lmd.exe r3lmd.exe r4lmd.exe r5lmd.exe r6lmd.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 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 + + +r1m.exe : r1.cpp + cl /MT /D_MT -o r1m.exe $(CFLAGS) r1.cpp $(LFLAGS) + +r2m.exe : r2.cpp + cl /MT /D_MT $(CFLAGS) -o r2m.exe r2.cpp $(LFLAGS) + +r3m.exe : r3.cpp + cl /MT /D_MT $(CFLAGS) -o r3m.exe r3.cpp $(LFLAGS) + +r4m.exe : r4.cpp + cl /MT /D_MT $(CFLAGS) -o r4m.exe r4.cpp $(LFLAGS) + +r5m.exe : r5.cpp + cl /MT /D_MT $(CFLAGS) -o r5m.exe r5.cpp $(LFLAGS) + +r6m.exe : r6.cpp + cl /MT /D_MT $(CFLAGS) -o r6m.exe r6.cpp $(LFLAGS) + + +r1l.exe : r1.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r1l.exe r1.cpp $(LFLAGS) + +r2l.exe : r2.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r2l.exe r2.cpp $(LFLAGS) + +r3l.exe : r3.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r3l.exe r3.cpp $(LFLAGS) + +r4l.exe : r4.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r4l.exe r4.cpp $(LFLAGS) + +r5l.exe : r5.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r5l.exe r5.cpp $(LFLAGS) + +r6l.exe : r6.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r6l.exe r6.cpp $(LFLAGS) + + +r1md.exe : r1.cpp + cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r1md.exe r1.cpp $(LFLAGS) + +r2md.exe : r2.cpp + cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r2md.exe r2.cpp $(LFLAGS) + +r3md.exe : r3.cpp + cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r3md.exe r3.cpp $(LFLAGS) + +r4md.exe : r4.cpp + cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r4md.exe r4.cpp $(LFLAGS) + +r5md.exe : r5.cpp + cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r5md.exe r5.cpp $(LFLAGS) + +r6md.exe : r6.cpp + cl /MTd /D_MT /D_DEBUG $(CFLAGS) -o r6md.exe r6.cpp $(LFLAGS) + + +r1lmd.exe : r1.cpp + cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r1lmd.exe r1.cpp $(LFLAGS) + +r2lmd.exe : r2.cpp + cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r2lmd.exe r2.cpp $(LFLAGS) + +r3lmd.exe : r3.cpp + cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r3lmd.exe r3.cpp $(LFLAGS) + +r4lmd.exe : r4.cpp + cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r4lmd.exe r4.cpp $(LFLAGS) + +r5lmd.exe : r5.cpp + cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r5lmd.exe r5.cpp $(LFLAGS) + +r6lmd.exe : r6.cpp + cl /MDd /D_MT /D_DLL /D_DEBUG $(CFLAGS) -o r6lmd.exe r6.cpp $(LFLAGS) + + + + + + + + + diff --git a/demo/regress/vc6.mak b/demo/regress/vc6.mak new file mode 100644 index 00000000..8a21e2e2 --- /dev/null +++ b/demo/regress/vc6.mak @@ -0,0 +1,173 @@ + +# very basic makefile for regression tests +# +# Visual C++ 6 +# +CFLAGS= -O2 -GX -GR -I..\..\..\..\ + +LFLAGS= -link /LIBPATH:..\..\lib\vc6 user32.lib + +all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1d.exe r2d.exe r3d.exe r4d.exe r5d.exe r6d.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 + echo testing static single threaded version.... + r1 tests.txt test1252.txt + r2 tests.txt + r3 tests.txt + r4 tests.txt test1252.txt + r5 tests.txt + r6 tests.txt + 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 single threaded debug version.... + r1d tests.txt test1252.txt + r2d tests.txt + r3d tests.txt + r4d tests.txt test1252.txt + r5d tests.txt + r6d 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 + + +r1.exe : r1.cpp + cl /ML $(CFLAGS) r1.cpp $(LFLAGS) + +r2.exe : r2.cpp + cl /ML $(CFLAGS) r2.cpp $(LFLAGS) + +r3.exe : r3.cpp + cl /ML $(CFLAGS) r3.cpp $(LFLAGS) + +r4.exe : r4.cpp + cl /ML $(CFLAGS) r4.cpp $(LFLAGS) + +r5.exe : r5.cpp + cl /ML $(CFLAGS) r5.cpp $(LFLAGS) + +r6.exe : r6.cpp + cl /ML $(CFLAGS) r6.cpp $(LFLAGS) + + +r1m.exe : r1.cpp + cl /MT /D_MT -o r1m.exe $(CFLAGS) r1.cpp $(LFLAGS) + +r2m.exe : r2.cpp + cl /MT /D_MT $(CFLAGS) -o r2m.exe r2.cpp $(LFLAGS) + +r3m.exe : r3.cpp + cl /MT /D_MT $(CFLAGS) -o r3m.exe r3.cpp $(LFLAGS) + +r4m.exe : r4.cpp + cl /MT /D_MT $(CFLAGS) -o r4m.exe r4.cpp $(LFLAGS) + +r5m.exe : r5.cpp + cl /MT /D_MT $(CFLAGS) -o r5m.exe r5.cpp $(LFLAGS) + +r6m.exe : r6.cpp + cl /MT /D_MT $(CFLAGS) -o r6m.exe r6.cpp $(LFLAGS) + + +r1l.exe : r1.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r1l.exe r1.cpp $(LFLAGS) + +r2l.exe : r2.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r2l.exe r2.cpp $(LFLAGS) + +r3l.exe : r3.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r3l.exe r3.cpp $(LFLAGS) + +r4l.exe : r4.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r4l.exe r4.cpp $(LFLAGS) + +r5l.exe : r5.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r5l.exe r5.cpp $(LFLAGS) + +r6l.exe : r6.cpp + cl /MD /D_MT /D_DLL $(CFLAGS) -o r6l.exe r6.cpp $(LFLAGS) + + +r1d.exe : r1.cpp + cl /MLd $(CFLAGS) -o r1d.exe r1.cpp $(LFLAGS) + +r2d.exe : r2.cpp + cl /MLd $(CFLAGS) -o r2d.exe r2.cpp $(LFLAGS) + +r3d.exe : r3.cpp + cl /MLd $(CFLAGS) -o r3d.exe r3.cpp $(LFLAGS) + +r4d.exe : r4.cpp + cl /MLd $(CFLAGS) -o r4d.exe r4.cpp $(LFLAGS) + +r5d.exe : r5.cpp + cl /MLd $(CFLAGS) -o r5d.exe r5.cpp $(LFLAGS) + +r6d.exe : r6.cpp + cl /MLd $(CFLAGS) -o r6d.exe r6.cpp $(LFLAGS) + + +r1md.exe : r1.cpp + cl /MTd /D_MT $(CFLAGS) -o r1md.exe r1.cpp $(LFLAGS) + +r2md.exe : r2.cpp + cl /MTd /D_MT $(CFLAGS) -o r2md.exe r2.cpp $(LFLAGS) + +r3md.exe : r3.cpp + cl /MTd /D_MT $(CFLAGS) -o r3md.exe r3.cpp $(LFLAGS) + +r4md.exe : r4.cpp + cl /MTd /D_MT $(CFLAGS) -o r4md.exe r4.cpp $(LFLAGS) + +r5md.exe : r5.cpp + cl /MTd /D_MT $(CFLAGS) -o r5md.exe r5.cpp $(LFLAGS) + +r6md.exe : r6.cpp + cl /MTd /D_MT $(CFLAGS) -o r6md.exe r6.cpp $(LFLAGS) + + +r1lmd.exe : r1.cpp + cl /MDd /D_MT /D_DLL $(CFLAGS) -o r1lmd.exe r1.cpp $(LFLAGS) + +r2lmd.exe : r2.cpp + cl /MDd /D_MT /D_DLL $(CFLAGS) -o r2lmd.exe r2.cpp $(LFLAGS) + +r3lmd.exe : r3.cpp + cl /MDd /D_MT /D_DLL $(CFLAGS) -o r3lmd.exe r3.cpp $(LFLAGS) + +r4lmd.exe : r4.cpp + cl /MDd /D_MT /D_DLL $(CFLAGS) -o r4lmd.exe r4.cpp $(LFLAGS) + +r5lmd.exe : r5.cpp + cl /MDd /D_MT /D_DLL $(CFLAGS) -o r5lmd.exe r5.cpp $(LFLAGS) + +r6lmd.exe : r6.cpp + cl /MDd /D_MT /D_DLL $(CFLAGS) -o r6lmd.exe r6.cpp $(LFLAGS) + + + + + + + diff --git a/demo/snippets/snip1.cpp b/demo/snippets/snip1.cpp new file mode 100644 index 00000000..df4d5ed1 --- /dev/null +++ b/demo/snippets/snip1.cpp @@ -0,0 +1,99 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE snip1.cpp + * VERSION 3.00 + * DESCRIPTION: ftp based regex_match example. + */ + +#include +#include +#include +#include + +using namespace std; +using namespace boost; + +regex expression("^([0-9]+)(\\-| |$)(.*)$"); + +// process_ftp: +// on success returns the ftp response code, and fills +// msg with the ftp response message. +int process_ftp(const char* response, std::string* msg) +{ + cmatch what; + if(regex_match(response, what, expression)) + { + // what[0] contains the whole string + // what[1] contains the response code + // what[2] contains the separator character + // what[3] contains the text message. + if(msg) + msg->assign(what[3].first, what[3].second); + return std::atoi(what[1].first); + } + // failure did not match + if(msg) + msg->erase(); + return -1; +} + +#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550)) +// +// problem with std::getline under MSVC6sp3 +istream& getline(istream& is, std::string& s) +{ + s.erase(); + char c = is.get(); + while(c != '\n') + { + s.append(1, c); + c = is.get(); + } + return is; +} +#endif + +int main() +{ + 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; +} + + + + diff --git a/demo/snippets/snip10.cpp b/demo/snippets/snip10.cpp new file mode 100644 index 00000000..de196f2a --- /dev/null +++ b/demo/snippets/snip10.cpp @@ -0,0 +1,45 @@ + +#include +#include + +bool validate_card_format(const std::string& s) +{ + static const boost::regex e("(\\d{4}[- ]){3}\\d{4}"); + return regex_match(s, e); +} + +const boost::regex e("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z"); +const std::string machine_format("\\1\\2\\3\\4"); +const std::string human_format("\\1-\\2-\\3-\\4"); + +std::string machine_readable_card_number(const std::string& s) +{ + return regex_merge(s, e, machine_format, boost::match_default | boost::format_sed); +} + +std::string human_readable_card_number(const std::string& s) +{ + return regex_merge(s, e, human_format, boost::match_default | boost::format_sed); +} + +#include +using namespace std; + +int main() +{ + string s[4] = { "0000111122223333", "0000 1111 2222 3333", + "0000-1111-2222-3333", "000-1111-2222-3333", }; + for(int i = 0; i < 4; ++i) + { + cout << "validate_card_format(\"" << s[i] << "\") returned " << validate_card_format(s[i]) << endl; + } + for(int i = 0; i < 4; ++i) + { + cout << "machine_readable_card_number(\"" << s[i] << "\") returned " << machine_readable_card_number(s[i]) << endl; + } + for(int i = 0; i < 4; ++i) + { + cout << "human_readable_card_number(\"" << s[i] << "\") returned " << human_readable_card_number(s[i]) << endl; + } + return 0; +} diff --git a/demo/snippets/snip2.cpp b/demo/snippets/snip2.cpp new file mode 100644 index 00000000..d4bb4aeb --- /dev/null +++ b/demo/snippets/snip2.cpp @@ -0,0 +1,105 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE snip2.cpp + * VERSION 3.00 + * DESCRIPTION: regex_search example: searches a cpp file for class definitions. + */ + +#include +#include +#include + +// purpose: +// takes the contents of a file in the form of a string +// and searches for all the C++ class definitions, storing +// their locations in a map of strings/int's + +typedef std::map > map_type; + +boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)"); + +void IndexClasses(map_type& m, const std::string& file) +{ + std::string::const_iterator start, end; + start = file.begin(); + end = file.end(); + boost::match_results what; + unsigned int flags = boost::match_default; + while(regex_search(start, end, what, expression, flags)) + { + // what[0] contains the whole string + // what[5] contains the class name. + // what[6] contains the template specialisation if any. + // add class name and position to map: + m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = + what[5].first - file.begin(); + // update search position: + start = what[0].second; + // update flags: + flags |= boost::match_prev_avail; + flags |= boost::match_not_bob; + } +} + + +#include +#include + +using namespace std; + +void load_file(std::string& s, std::istream& is) +{ + s.erase(); + s.reserve(is.rdbuf()->in_avail()); + char c; + while(is.get(c)) + { + if(s.capacity() == s.size()) + s.reserve(s.capacity() * 3); + s.append(1, c); + } +} + +int main(int argc, const char** argv) +{ + std::string text; + for(int i = 1; i < argc; ++i) + { + cout << "Processing file " << argv[i] << endl; + map_type m; + std::ifstream fs(argv[i]); + load_file(text, fs); + IndexClasses(m, text); + cout << m.size() << " matches found" << endl; + map_type::iterator c, d; + c = m.begin(); + d = m.end(); + while(c != d) + { + cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; + ++c; + } + } + return 0; +} + + + + + + diff --git a/demo/snippets/snip3.cpp b/demo/snippets/snip3.cpp new file mode 100644 index 00000000..5e0fcae4 --- /dev/null +++ b/demo/snippets/snip3.cpp @@ -0,0 +1,106 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE snip3.cpp + * VERSION 3.00 + * DESCRIPTION: regex_grep example 1: searches a cpp file for class definitions. + */ + +#include +#include +#include + +// purpose: +// takes the contents of a file in the form of a string +// and searches for all the C++ class definitions, storing +// their locations in a map of strings/int's + +typedef std::map > map_type; + +boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)"); + +class IndexClassesPred +{ + map_type& m; + std::string::const_iterator base; +public: + IndexClassesPred(map_type& a, std::string::const_iterator b) : m(a), base(b) {} + bool operator()(const boost::match_results& what) + { + // what[0] contains the whole string + // what[5] contains the class name. + // what[6] contains the template specialisation if any. + // add class name and position to map: + m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = + what[5].first - base; + return true; + } +}; + +void IndexClasses(map_type& m, const std::string& file) +{ + std::string::const_iterator start, end; + start = file.begin(); + end = file.end(); + regex_grep(IndexClassesPred(m, start), start, end, expression); +} + + +#include +#include + +using namespace std; + +void load_file(std::string& s, std::istream& is) +{ + s.erase(); + s.reserve(is.rdbuf()->in_avail()); + char c; + while(is.get(c)) + { + if(s.capacity() == s.size()) + s.reserve(s.capacity() * 3); + s.append(1, c); + } +} + +int main(int argc, const char** argv) +{ + std::string text; + for(int i = 1; i < argc; ++i) + { + cout << "Processing file " << argv[i] << endl; + map_type m; + std::ifstream fs(argv[i]); + load_file(text, fs); + IndexClasses(m, text); + cout << m.size() << " matches found" << endl; + map_type::iterator c, d; + c = m.begin(); + d = m.end(); + while(c != d) + { + cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; + ++c; + } + } + return 0; +} + + + + diff --git a/demo/snippets/snip4.cpp b/demo/snippets/snip4.cpp new file mode 100644 index 00000000..37d2b376 --- /dev/null +++ b/demo/snippets/snip4.cpp @@ -0,0 +1,130 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE snip4.cpp + * VERSION 3.00 + * DESCRIPTION: regex_merge example: + * converts a C++ file to syntax highlighted HTML. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +// purpose: +// takes the contents of a file and transform to +// syntax highlighted code in html format + +boost::regex e1, e2; +extern const char* expression_text; +extern const char* format_string; +extern const char* pre_expression; +extern const char* pre_format; +extern const char* header_text; +extern const char* footer_text; + +void load_file(std::string& s, std::istream& is) +{ + s.erase(); + s.reserve(is.rdbuf()->in_avail()); + char c; + while(is.get(c)) + { + if(s.capacity() == s.size()) + s.reserve(s.capacity() * 3); + s.append(1, c); + } +} + +int main(int argc, const char** argv) +{ + e1.set_expression(expression_text); + e2.set_expression(pre_expression); + for(int i = 1; i < argc; ++i) + { + std::cout << "Processing file " << argv[i] << std::endl; + std::ifstream fs(argv[i]); + std::string in; + load_file(in, fs); + std::string out_name(std::string(argv[i]) + std::string(".htm")); + std::ofstream os(out_name.c_str()); + os << header_text; + // strip '<' and '>' first by outputting to a + // temporary string stream + std::ostringstream t(std::ios::out | std::ios::binary); + std::ostream_iterator oi(t); + 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 out(os); + regex_merge(out, s.begin(), s.end(), e1, format_string); + os << footer_text; + } + return 0; +} + +extern const char* pre_expression = "(<)|(>)|\\r"; +extern const char* pre_format = "(?1<)(?2>)"; + + +const char* expression_text = // preprocessor directives: index 1 + "(^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*)|" + // comment: index 3 + "(//[^\\n]*|/\\*([^*]|\\*+[^*/])*\\*+/)|" + // literals: index 5 + "\\<([+-]?((0x[[:xdigit:]]+)|(([[:digit:]]*\\.)?[[:digit:]]+([eE][+-]?[[:digit:]]+)?))u?((int(8|16|32|64))|L)?)\\>|" + // string literals: index 14 + "('([^\\\\']|\\\\.)*'|\"([^\\\\\"]|\\\\.)*\")|" + // keywords: index 17 + "\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import" + "|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall" + "|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool" + "|break|case|catch|cdecl|char|class|const|const_cast|continue|default|delete" + "|do|double|dynamic_cast|else|enum|explicit|extern|false|float|for|friend|goto" + "|if|inline|int|long|mutable|namespace|new|operator|pascal|private|protected" + "|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast" + "|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned" + "|using|virtual|void|volatile|wchar_t|while)\\>" + ; + +const char* format_string = "(?1$&)" + "(?3$&)" + "(?5$&)" + "(?14$&)" + "(?17$&)"; + +const char* header_text = "\n\n" + "Auto-generated html formated source\n" + "\n" + "\n" + "\n" + "

\n
";
+
+const char* footer_text = "
\n\n\n"; + + + + + + + diff --git a/demo/snippets/snip5.cpp b/demo/snippets/snip5.cpp new file mode 100644 index 00000000..e46df428 --- /dev/null +++ b/demo/snippets/snip5.cpp @@ -0,0 +1,98 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE snip5.cpp + * VERSION 3.00 + * DESCRIPTION: regex_grep example 2: searches a cpp file for class definitions, + * using a global callback function. + */ + +#include +#include +#include + +// purpose: +// takes the contents of a file in the form of a string +// and searches for all the C++ class definitions, storing +// their locations in a map of strings/int's + +typedef std::map > map_type; + +boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)"); +map_type class_index; +std::string::const_iterator base; + +bool grep_callback(const boost::match_results& what) +{ + // what[0] contains the whole string + // what[5] contains the class name. + // what[6] contains the template specialisation if any. + // add class name and position to map: + class_index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = + what[5].first - base; + return true; +} + +void IndexClasses(const std::string& file) +{ + std::string::const_iterator start, end; + start = file.begin(); + end = file.end(); + base = start; + regex_grep(grep_callback, start, end, expression); +} + +#include +#include + +using namespace std; + +void load_file(std::string& s, std::istream& is) +{ + s.erase(); + s.reserve(is.rdbuf()->in_avail()); + char c; + while(is.get(c)) + { + if(s.capacity() == s.size()) + s.reserve(s.capacity() * 3); + s.append(1, c); + } +} + +int main(int argc, const char** argv) +{ + std::string text; + for(int i = 1; i < argc; ++i) + { + cout << "Processing file " << argv[i] << endl; + std::ifstream fs(argv[i]); + load_file(text, fs); + IndexClasses(text); + cout << class_index.size() << " matches found" << endl; + map_type::iterator c, d; + c = class_index.begin(); + d = class_index.end(); + while(c != d) + { + cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; + ++c; + } + class_index.erase(class_index.begin(), class_index.end()); + } + return 0; +} diff --git a/demo/snippets/snip6.cpp b/demo/snippets/snip6.cpp new file mode 100644 index 00000000..cac9b72a --- /dev/null +++ b/demo/snippets/snip6.cpp @@ -0,0 +1,117 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE snip6.cpp + * VERSION 3.00 + * DESCRIPTION: regex_grep example 2: searches a cpp file for class definitions, + * using a bound member function callback. + */ + +#include +#include +#include +#include + +// purpose: +// takes the contents of a file in the form of a string +// and searches for all the C++ class definitions, storing +// their locations in a map of strings/int's + +typedef std::map > map_type; + +class class_index +{ + boost::regex expression; + map_type index; + std::string::const_iterator base; + + bool grep_callback(boost::match_results what); +public: + map_type& get_map() { return index; } + void IndexClasses(const std::string& file); + class_index() + : index(), + expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)") + {} +}; + +bool class_index::grep_callback(boost::match_results what) +{ + // what[0] contains the whole string + // what[5] contains the class name. + // what[6] contains the template specialisation if any. + // add class name and position to map: + index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = + what[5].first - base; + return true; +} + +void class_index::IndexClasses(const std::string& file) +{ + std::string::const_iterator start, end; + start = file.begin(); + end = file.end(); + base = start; + regex_grep(std::bind1st(std::mem_fun(&class_index::grep_callback), this), + start, + end, + expression); +} + + +#include +#include + +using namespace std; + +void load_file(std::string& s, std::istream& is) +{ + s.erase(); + s.reserve(is.rdbuf()->in_avail()); + char c; + while(is.get(c)) + { + if(s.capacity() == s.size()) + s.reserve(s.capacity() * 3); + s.append(1, c); + } +} + +int main(int argc, const char** argv) +{ + std::string text; + for(int i = 1; i < argc; ++i) + { + cout << "Processing file " << argv[i] << endl; + std::ifstream fs(argv[i]); + load_file(text, fs); + class_index i; + i.IndexClasses(text); + cout << i.get_map().size() << " matches found" << endl; + map_type::iterator c, d; + c = i.get_map().begin(); + d = i.get_map().end(); + while(c != d) + { + cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; + ++c; + } + } + return 0; +} + + diff --git a/demo/snippets/snip7.cpp b/demo/snippets/snip7.cpp new file mode 100644 index 00000000..420b4d42 --- /dev/null +++ b/demo/snippets/snip7.cpp @@ -0,0 +1,120 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE snip7.cpp + * VERSION 3.00 + * DESCRIPTION: regex_grep example 2: searches a cpp file for class definitions, + * using a C++ Builder closure as a callback. + */ + +#include +#include +#include +#include + +// purpose: +// takes the contents of a file in the form of a string +// and searches for all the C++ class definitions, storing +// their locations in a map of strings/int's + +typedef std::map > map_type; + +class class_index +{ + boost::regex expression; + map_type index; + std::string::const_iterator base; + typedef boost::match_results arg_type; + + bool grep_callback(const boost::match_results& what); +public: + map_type& get_map() { return index; } + typedef bool (__closure* grep_callback_type)(const arg_type&); + void IndexClasses(const std::string& file); + class_index() + : index(), + expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)") + {} +}; + +bool class_index::grep_callback(const boost::match_results& what) +{ + // what[0] contains the whole string + // what[5] contains the class name. + // what[6] contains the template specialisation if any. + // add class name and position to map: + index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = + what[5].first - base; + return true; +} + +void class_index::IndexClasses(const std::string& file) +{ + std::string::const_iterator start, end; + start = file.begin(); + end = file.end(); + base = start; + class_index::grep_callback_type cl = &(this->grep_callback); + regex_grep(cl, + start, + end, + expression); +} + + +#include +#include + +using namespace std; + +void load_file(std::string& s, std::istream& is) +{ + s.erase(); + s.reserve(is.rdbuf()->in_avail()); + char c; + while(is.get(c)) + { + if(s.capacity() == s.size()) + s.reserve(s.capacity() * 3); + s.append(1, c); + } +} + +int main(int argc, const char** argv) +{ + std::string text; + for(int i = 1; i < argc; ++i) + { + cout << "Processing file " << argv[i] << endl; + std::ifstream fs(argv[i]); + load_file(text, fs); + class_index i; + i.IndexClasses(text); + cout << i.get_map().size() << " matches found" << endl; + map_type::iterator c, d; + c = i.get_map().begin(); + d = i.get_map().end(); + while(c != d) + { + cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; + ++c; + } + } + return 0; +} + + diff --git a/demo/snippets/snip8.cpp b/demo/snippets/snip8.cpp new file mode 100644 index 00000000..3ed73c42 --- /dev/null +++ b/demo/snippets/snip8.cpp @@ -0,0 +1,73 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE snip8.cpp + * VERSION 3.00 + * DESCRIPTION: regex_split example: split a string into tokens. + */ + + +#include +#include + + +unsigned tokenise(std::list& l, std::string& s) +{ + return boost::regex_split(std::back_inserter(l), s); +} + +#include +using namespace std; + + +#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550)) +// +// problem with std::getline under MSVC6sp3 +istream& getline(istream& is, std::string& s) +{ + s.erase(); + char c = is.get(); + while(c != '\n') + { + s.append(1, c); + c = is.get(); + } + return is; +} +#endif + + +int main() +{ + string s; + list l; + do{ + cout << "Enter text to split (or \"quit\" to exit): "; + getline(cin, s); + if(s == "quit") break; + unsigned result = tokenise(l, s); + cout << result << " tokens found" << endl; + cout << "The remaining text is: \"" << s << "\"" << endl; + while(l.size()) + { + s = *(l.begin()); + l.pop_front(); + cout << s << endl; + } + }while(true); + return 0; +} diff --git a/demo/snippets/snip9.cpp b/demo/snippets/snip9.cpp new file mode 100644 index 00000000..2718a726 --- /dev/null +++ b/demo/snippets/snip9.cpp @@ -0,0 +1,84 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE snip9.cpp + * VERSION 3.00 + * DESCRIPTION: regex_split example: spit out linked URL's. + */ + + +#include +#include +#include +#include + +boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"", + boost::regbase::normal | boost::regbase::icase); + +void load_file(std::string& s, std::istream& is) +{ + s.erase(); + // + // attempt to grow string buffer to match file size, + // this doesn't always work... + s.reserve(is.rdbuf()->in_avail()); + char c; + while(is.get(c)) + { + // use logarithmic growth stategy, in case + // in_avail (above) returned zero: + if(s.capacity() == s.size()) + s.reserve(s.capacity() * 3); + s.append(1, c); + } +} + +int main(int argc, char** argv) +{ + std::string s; + std::list l; + + for(int i = 1; i < argc; ++i) + { + std::cout << "Findings URL's in " << argv[i] << ":" << std::endl; + s.erase(); + std::ifstream is(argv[i]); + load_file(s, is); + boost::regex_split(std::back_inserter(l), s, e); + while(l.size()) + { + s = *(l.begin()); + l.pop_front(); + std::cout << s << std::endl; + } + } + // + // alternative method: + // split one match at a time and output direct to + // cout via ostream_iterator.... + // + for(int i = 1; i < argc; ++i) + { + std::cout << "Findings URL's in " << argv[i] << ":" << std::endl; + s.erase(); + std::ifstream is(argv[i]); + load_file(s, is); + while(boost::regex_split(std::ostream_iterator(std::cout), s, e, boost::match_default, 1)) std::cout << std::endl; + } + + return 0; +} diff --git a/demo/timer/bc55.mak b/demo/timer/bc55.mak new file mode 100644 index 00000000..ab367bbc --- /dev/null +++ b/demo/timer/bc55.mak @@ -0,0 +1,43 @@ + +# very basic makefile for timer.exe +# +# Borland C++ tools +# +# BCROOT defines the root directory of your bc builder install +# + +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + +BCC32 = $(BCROOT)\bin\Bcc32.exe + +IDE_LinkFLAGS32 = -L$(BCROOT)\LIB +COMPOPTS= -O2 -tWC -tWM- -D_NO_VCL; -I../../../../; -L..\..\lib\bcb5 + + +timer.exe : ..\..\..\timer\timer.cpp regex_timer.cpp + $(BCC32) @&&| + $(COMPOPTS) -e$@ ..\..\..\timer\timer.cpp regex_timer.cpp +| + + + + + + + + + + + + + + + + + + + + + diff --git a/demo/timer/bcb4.mak b/demo/timer/bcb4.mak new file mode 100644 index 00000000..9f61c328 --- /dev/null +++ b/demo/timer/bcb4.mak @@ -0,0 +1,43 @@ + +# very basic makefile for timer.exe +# +# Borland C++ tools +# +# BCROOT defines the root directory of your bc builder install +# + +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + +BCC32 = $(BCROOT)\bin\Bcc32.exe + +IDE_LinkFLAGS32 = -L$(BCROOT)\LIB +COMPOPTS= -O2 -tWC -tWM- -D_NO_VCL; -I../../../../; -L..\..\lib\bcb4 + + +timer.exe : ..\..\..\timer\timer.cpp regex_timer.cpp + $(BCC32) @&&| + $(COMPOPTS) -e$@ ..\..\..\timer\timer.cpp regex_timer.cpp +| + + + + + + + + + + + + + + + + + + + + + diff --git a/demo/timer/bcb5.mak b/demo/timer/bcb5.mak new file mode 100644 index 00000000..ab367bbc --- /dev/null +++ b/demo/timer/bcb5.mak @@ -0,0 +1,43 @@ + +# very basic makefile for timer.exe +# +# Borland C++ tools +# +# BCROOT defines the root directory of your bc builder install +# + +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + +BCC32 = $(BCROOT)\bin\Bcc32.exe + +IDE_LinkFLAGS32 = -L$(BCROOT)\LIB +COMPOPTS= -O2 -tWC -tWM- -D_NO_VCL; -I../../../../; -L..\..\lib\bcb5 + + +timer.exe : ..\..\..\timer\timer.cpp regex_timer.cpp + $(BCC32) @&&| + $(COMPOPTS) -e$@ ..\..\..\timer\timer.cpp regex_timer.cpp +| + + + + + + + + + + + + + + + + + + + + + diff --git a/demo/timer/gcc.mak b/demo/timer/gcc.mak new file mode 100644 index 00000000..fa1db656 --- /dev/null +++ b/demo/timer/gcc.mak @@ -0,0 +1,33 @@ + +# very basic makefile for timer.exe +# +# egcs compiler GCC +# +CXX= -O2 -I../../../../ -I./ + +timer : regex_timer.o timer.o + g++ -o -L../../lib/gcc timer regex_timer.o timer.o -lregex++ + +timer.o : ../../../timer/timer.cpp + g++ -c $(CXX) ../../../timer/timer.cpp + +regex_timer.o : regex_timer.cpp + g++ -c $(CXX) regex_timer.cpp + + + + + + + + + + + + + + + + + + diff --git a/demo/timer/makefile.in b/demo/timer/makefile.in new file mode 100644 index 00000000..b476703a --- /dev/null +++ b/demo/timer/makefile.in @@ -0,0 +1,37 @@ + +# very basic makefile for timer +# +CXX=@CXX@ +CXXFLAGS=@CXXFLAGS@ +LIBS=@LIBS@ +EXE=@ac_exe_ext@ +OBJ=@ac_obj_ext@ + +LIBDEP=../../lib/libregex++.a ../../../../boost/re_detail/regex_options.hpp ../../../../boost/re_detail/regex_config.hpp + +regex_timer$(EXE) : regex_timer$(OBJ) timer$(OBJ) + $(CXX) -o timer$(EXE) timer$(OBJ) regex_timer$(OBJ) -L../../lib -lregex++ $(LIBS) + +regex_timer$(OBJ) : regex_timer.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) -DSTRICT -I../../../../ -I./ regex_timer.cpp + +timer$(OBJ) : ../../../timer/timer.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) -DSTRICT -I../../../../ -I./ ../../../timer/timer.cpp + + + + + + + + + + + + + + + + + + diff --git a/demo/timer/regex_timer.cpp b/demo/timer/regex_timer.cpp new file mode 100644 index 00000000..929e6677 --- /dev/null +++ b/demo/timer/regex_timer.cpp @@ -0,0 +1,322 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + +#ifdef BOOST_RE_OLD_IOSTREAM +#include +#else +#include +using std::cout; +using std::cin; +using std::cerr; +using std::istream; +using std::ostream; +using std::endl; +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_MSVC +// no Koenig lookup, use using declaration instead: +using namespace boost; +#endif + +#ifndef BOOST_RE_NO_WCSTRING +ostream& operator << (ostream& os, const std::wstring& s) +{ + std::wstring::const_iterator i, j; + i = s.begin(); + j = s.end(); + while(i != j) + { + os.put(*i); + ++i; + } + return os; +} +#endif + +template +class string_out_iterator +{ + S* out; +public: + string_out_iterator(S& s) : out(&s) {} + string_out_iterator& operator++() { return *this; } + string_out_iterator& operator++(int) { return *this; } + string_out_iterator& operator*() { return *this; } + string_out_iterator& operator=(typename S::value_type v) + { + out->append(1, v); + return *this; + } +}; + +#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550)) || defined(__SGI_STL_PORT) +// +// problem with std::getline under MSVC6sp3 +// and C++ Builder 5.5, is this really that hard? +istream& getline(istream& is, std::string& s) +{ + s.erase(); + char c = is.get(); + while(c != '\n') + { + s.append(1, c); + c = is.get(); + } + return is; +} +#endif + + +int main() +{ + boost::regex ex; + boost::match_results sm; +#ifndef BOOST_RE_NO_WCSTRING + std::wstring ws1, ws2; + boost::wregex wex; + boost::match_results wsm; +#endif + boost::match_results::iterator> dm; + std::string s1, s2, ts; + std::deque ds; + boost::regex_t r; + boost::scoped_array matches; + size_t nsubs; + boost::timer t; + double tim; + bool result; + int iters = 100; + + while(true) + { + cout << "Enter expression (or \"quit\" to exit): "; + getline(cin, s1); + if(s1 == "quit") + break; +#ifndef BOOST_RE_NO_WCSTRING + ws1.erase(); + std::copy(s1.begin(), s1.end(), string_out_iterator(ws1)); +#endif + try{ + ex.assign(s1.begin(), s1.end()); +#ifndef BOOST_RE_NO_WCSTRING + wex.assign(ws1.begin(), ws1.end()); +#endif + } + catch(std::exception& e) + { + cout << "Error in expression: \"" << e.what() << "\"" << endl; + continue; + } + int code = regcomp(&r, s1.c_str(), boost::REG_PERL); + if(code != 0) + { + char buf[256]; + regerror(code, &r, buf, 256); + cout << "regcomp error: \"" << buf << "\"" << endl; + continue; + } + nsubs = r.re_nsub + 1; + matches.reset(new boost::regmatch_t[nsubs]); + + while(true) + { + cout << "Enter string to search (or \"quit\" to exit): "; + getline(cin, s2); + if(s2 == "quit") + break; + +#ifndef BOOST_RE_NO_WCSTRING + ws2.erase(); + std::copy(s2.begin(), s2.end(), string_out_iterator(ws2)); +#endif + ds.erase(ds.begin(), ds.end()); + std::copy(s2.begin(), s2.end(), std::back_inserter(ds)); + + int i; + iters = 10; + tim = 1.1; + +#if defined(_WIN32) && defined(BOOST_RE_LOCALE_W32) + MSG msg; + PeekMessage(&msg, 0, 0, 0, 0); + Sleep(0); +#endif + + // cache load: + regex_search(s2, sm, ex); + + // measure time interval for reg_expression + do{ + iters *= (tim > 0.001) ? (1.1/tim) : 100; + t.restart(); + for(i =0; i < iters; ++i) + { + result = regex_search(s2, sm, ex); + } + tim = t.elapsed(); + }while((tim < t.elapsed_min() * 1000) || (tim < 1)); + + cout << "regex time: " << (tim * 1000000 / iters) << "us" << endl; + if(result) + { + for(i = 0; i < sm.size(); ++i) + { + ts = sm[i]; + cout << "\tmatch " << i << ": \""; + cout << ts; + cout << "\" (matched=" << sm[i].matched << ")" << endl; + } + cout << "\tmatch $`: \""; + cout << std::string(sm[-1]); + cout << "\" (matched=" << sm[-1].matched << ")" << endl; + cout << "\tmatch $': \""; + cout << std::string(sm[-2]); + cout << "\" (matched=" << sm[-2].matched << ")" << endl << endl; + } + +#ifndef BOOST_RE_NO_WCSTRING + // measure time interval for boost::wregex + iters = 10; + tim = 1.1; + // cache load: + regex_search(ws2, wsm, wex); + do{ + iters *= (tim > 0.001) ? (1.1/tim) : 100; + t.restart(); + for(i = 0; i < iters; ++i) + { + result = regex_search(ws2, wsm, wex); + } + tim = t.elapsed(); + }while((tim < t.elapsed_min() * 1000) || (tim < 1)); + cout << "wregex time: " << (tim * 1000000 / iters) << "us" << endl; + if(result) + { + std::wstring tw; + for(i = 0; i < wsm.size(); ++i) + { + tw.erase(); + std::copy(wsm[i].first, wsm[i].second, string_out_iterator(tw)); + cout << "\tmatch " << i << ": \"" << tw; + cout << "\" (matched=" << sm[i].matched << ")" << endl; + } + cout << "\tmatch $`: \""; + tw.erase(); + std::copy(wsm[-1].first, wsm[-1].second, string_out_iterator(tw)); + cout << tw; + cout << "\" (matched=" << sm[-1].matched << ")" << endl; + cout << "\tmatch $': \""; + tw.erase(); + std::copy(wsm[-2].first, wsm[-2].second, string_out_iterator(tw)); + cout << tw; + cout << "\" (matched=" << sm[-2].matched << ")" << endl << endl; + } +#endif + + // measure time interval for reg_expression using a deque + iters = 10; + tim = 1.1; + // cache load: + regex_search(ds.begin(), ds.end(), dm, ex); + do{ + iters *= (tim > 0.001) ? (1.1/tim) : 100; + t.restart(); + for(i = 0; i < iters; ++i) + { + result = regex_search(ds.begin(), ds.end(), dm, ex); + } + tim = t.elapsed(); + }while((tim < t.elapsed_min() * 1000) || (tim < 1)); + cout << "regex time (search over std::deque): " << (tim * 1000000 / iters) << "us" << endl; + + if(result) + { + for(i = 0; i < dm.size(); ++i) + { + ts.erase(); + std::copy(dm[i].first, dm[i].second, string_out_iterator(ts)); + cout << "\tmatch " << i << ": \"" << ts; + cout << "\" (matched=" << sm[i].matched << ")" << endl; + } + cout << "\tmatch $`: \""; + ts.erase(); + std::copy(dm[-1].first, dm[-1].second, string_out_iterator(ts)); + cout << ts; + cout << "\" (matched=" << sm[-1].matched << ")" << endl; + cout << "\tmatch $': \""; + ts.erase(); + std::copy(dm[-2].first, dm[-2].second, string_out_iterator(ts)); + cout << ts; + cout << "\" (matched=" << sm[-2].matched << ")" << endl << endl; + } + + // measure time interval for POSIX matcher: + iters = 10; + tim = 1.1; + // cache load: + regexec(&r, s2.c_str(), nsubs, matches.get(), 0); + do{ + iters *= (tim > 0.001) ? (1.1/tim) : 100; + t.restart(); + for(i = 0; i < iters; ++i) + { + result = regexec(&r, s2.c_str(), nsubs, matches.get(), 0); + } + tim = t.elapsed(); + }while((tim < t.elapsed_min() * 1000) || (tim < 1)); + cout << "POSIX regexec time: " << (tim * 1000000 / iters) << "us" << endl; + + if(result == 0) + { + for(i = 0; i < nsubs; ++i) + { + if(matches[i].rm_so >= 0) + { + ts.assign(s2.begin() + matches[i].rm_so, s2.begin() + matches[i].rm_eo); + cout << "\tmatch " << i << ": \"" << ts << "\" (matched=" << (matches[i].rm_so != -1) << ")"<< endl; + } + else + cout << "\tmatch " << i << ": \"\" (matched=" << (matches[i].rm_so != -1) << ")" << endl; // no match + } + cout << "\tmatch $`: \""; + ts.erase(); + ts.assign(s2.begin(), s2.begin() + matches[0].rm_so); + cout << ts; + cout << "\" (matched=" << (matches[0].rm_so != 0) << ")" << endl; + cout << "\tmatch $': \""; + ts.erase(); + ts.assign(s2.begin() + matches[0].rm_eo, s2.end()); + cout << ts; + cout << "\" (matched=" << (matches[0].rm_eo != s2.size()) << ")" << endl << endl; + } + } + regfree(&r); + } + return 0; +} + + + + + + diff --git a/demo/timer/sunpro.mak b/demo/timer/sunpro.mak new file mode 100644 index 00000000..6b7175b6 --- /dev/null +++ b/demo/timer/sunpro.mak @@ -0,0 +1,23 @@ +# Makefile for timer application +# +# for SUN workshop 5.0 C++ compiler +# + +CXX=CC +CPP_FLAGS = -O -I../../../../ -I./ + +%.o : %.cpp + $(CXX) -c -o $@ $(CPP_FLAGS) $< + +timer : regex_timer.o timer.o + $(CXX) -o $@ $(CPP_FLAGS) timer.o regex_timer.o -L../../lib -lregex++ + +timer.o : ../../../timer/timer.cpp + $(CXX) -c $(CPPFLAGS) ../../../timer/timer.cpp + +clean: + rm -rf SunWS_cache + rm -f timer.o timer + + + diff --git a/demo/timer/vc6-stlport.mak b/demo/timer/vc6-stlport.mak new file mode 100644 index 00000000..b3419d70 --- /dev/null +++ b/demo/timer/vc6-stlport.mak @@ -0,0 +1,30 @@ +# +# very basic VC6 makefile for timer +# +CXX=cl +CXXFLAGS=-O2 -MT -GX -DSTRICT -I../../../../ -I./ +LIBS=/link /LIBPATH:..\..\lib\vc6-stlport kernel32.lib user32.lib +EXE=.exe +OBJ=.obj + +LIBDEP= ../../../../boost/re_detail/regex_options.hpp ../../../../boost/re_detail/regex_config.hpp + +regex_timer$(EXE) : regex_timer$(OBJ) timer$(OBJ) + $(CXX) -o timer$(EXE) timer$(OBJ) regex_timer$(OBJ) $(LIBS) + +regex_timer$(OBJ) : regex_timer.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) regex_timer.cpp + +timer$(OBJ) : ../../../timer/timer.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) ../../../timer/timer.cpp + + + + + + + + + + + diff --git a/demo/timer/vc6.mak b/demo/timer/vc6.mak new file mode 100644 index 00000000..ad1ea295 --- /dev/null +++ b/demo/timer/vc6.mak @@ -0,0 +1,29 @@ +# +# very basic VC6 makefile for timer +# +CXX=cl +CXXFLAGS=-O2 -GX -DSTRICT -I../../../../ -I./ +LIBS=/link /LIBPATH:..\..\lib\vc6 kernel32.lib user32.lib +EXE=.exe +OBJ=.obj + +LIBDEP= ../../../../boost/re_detail/regex_options.hpp ../../../../boost/re_detail/regex_config.hpp + +regex_timer$(EXE) : regex_timer$(OBJ) timer$(OBJ) + $(CXX) -o timer$(EXE) timer$(OBJ) regex_timer$(OBJ) $(LIBS) + +regex_timer$(OBJ) : regex_timer.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) regex_timer.cpp + +timer$(OBJ) : ../../../timer/timer.cpp $(LIBDEP) + $(CXX) -c $(CXXFLAGS) ../../../timer/timer.cpp + + + + + + + + + + diff --git a/dmi.sh b/dmi.sh new file mode 100644 index 00000000..d8f69a57 --- /dev/null +++ b/dmi.sh @@ -0,0 +1,14 @@ +#! /bin/sh + +if test "$#" != "1"; then +exit 1 +fi + +cd "$1" + +if eval make; then +exit 0 +fi + +exit 1 + diff --git a/faq.htm b/faq.htm new file mode 100644 index 00000000..a6fab8b3 --- /dev/null +++ b/faq.htm @@ -0,0 +1,141 @@ + + + + + + + + +Regex++ - FAQ + + + +  + + + + +

+C++ Boost

+
+

Regex++, FAQ.

+
+
+(version 3.01, 18 April 2000) +
+
Copyright (c) 1998-2000
+Dr John Maddock
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Dr John Maddock makes no representations
+about the suitability of this software for any purpose.  
+It is provided "as is" without express or implied warranty.
+ +
+

Q. Configure says that my compiler is unable to merge +template instances, what does this mean?

+

A. When you compile template code, you can end up with the same template +instances in multiple translation units - this will lead to link time errors +unless your compiler/linker is smart enough to merge these template instances +into a single record in the executable file. If you see this warning after +running configure, then you can still link to libregex++.a if:

+
    +
  1. You use only the low-level template classes (reg_expression<> +match_results<> etc), from a single translation unit, and use no other part +of regex++.
  2. +
  3. You use only the POSIX API functions (regcomp regexec etc), and no other +part of regex++.
  4. +
  5. You use only the high level class RegEx, and no other part of regex++. +
  6. +
+Another option is to create a master include file, which #include's all the +regex++ source files, and all the source files in which you use regex++. You +then compile and link this master file as a single translation unit.

Q. Configure says that my compiler is unable to merge template +instances from archive files, what does this mean?

+

A. When you compile template code, you can end up with the same template +instances in multiple translation units - this will lead to link time errors +unless your compiler/linker is smart enough to merge these template instances +into a single record in the executable file. Some compilers are able to do this +for normal .cpp or .o files, but fail if the object file has been placed in a +library archive. If you see this warning after running configure, then you can +still link to libregex++.a if:

+
    +
  1. You use only the low-level template classes (reg_expression<> +match_results<> etc), and use no other part of regex++.
  2. +
  3. You use only the POSIX API functions (regcomp regexec etc), and no other +part of regex++.
  4. +
  5. You use only the high level class RegEx, and no other part of regex++. +
  6. +
+Another option is to add the regex++ source files directly to your project +instead of linking to libregex++.a, generally you should do this only if you +are getting link time errors with libregex++.a.

Q. +Configure says that my compiler can't merge templates containing switch +statements, what does this mean?

+

A. Some compilers can't merge templates that contain static data - this +includes switch statements which implicitly generate static data as well as +code. Principally this affects the egcs compiler - but note gcc 2.81 also +suffers from this problem - the compiler will compile and link the code - but +the code will not run because the code and the static data it uses have become +separated. The default behaviour of regex++ is to try and fix this problem by +declaring "problem" templates inside unnamed namespaces, so that the +templates have internal linkage. Note that this can result in a great deal of +code bloat. If the compiler doesn't support namespaces, or if code bloat +becomes a problem, then follow the guidelines above for placing all the +templates used in a single translation unit, and edit jm_opt.h so that +BOOST_RE_NO_TEMPLATE_SWITCH_MERGE is no longer defined.

+

Q. I can't get regex++ to work with escape characters, +what's going on?

+

A. If you embed regular expressions in C++ code, then remember that escape +characters are processed twice: once by the C++ compiler, and once by the +regex++ expression compiler, so to pass the regular expression \d+ to regex++, +you need to embed "\\d+" in your code. Likewise to match a literal +backslash you will need to embed "\\\\" in your code.

+

Q. Why don't character ranges work properly? +
+A. The POSIX standard specifies that character range expressions are locale +sensitive - so for example the expression [A-Z] will match any collating +element that collates between 'A' and 'Z'. That means that for most locales +other than "C" or "POSIX", [A-Z] would match the single +character 't' for example, which is not what most people expect - or at least +not what most people have come to expect from regular expression engines. For +this reason, the default behaviour of regex++ is to turn locale sensitive +collation off by setting the regbase::nocollate compile time flag (this is set +by regbase::normal). However if you set a non-default compile time flag - for +example regbase::extended or regbase::basic, then locale dependent collation +will be enabled, this also applies to the POSIX API functions which use either +regbase::extended or regbase::basic internally, in the latter case use +REG_NOCOLLATE in combination with either REG_BASIC or REG_EXTENDED when +invoking regcomp if you don't want locale sensitive collation. [Note - when +regbase::nocollate in effect, the library behaves "as if" the +LC_COLLATE locale category were always "C", regardless of what its +actually set to - end note].

+

 Q. Why can't I use the "convenience" +versions of query_match/reg_search/reg_grep/reg_format/reg_merge?

+

A. These versions may or may not be available depending upon the +capabilities of your compiler, the rules determining the format of these +functions are quite complex - and only the versions visible to a standard +compliant compiler are given in the help. To find out what your compiler +supports, run <boost/regex.hpp> through your C++ pre-processor, and +search the output file for the function that you are interested in.

+

Q. Why are there no throw specifications on any of the +functions? What exceptions can the library throw?

+

A. Not all compilers support (or honor) throw specifications, others support +them but with reduced efficiency. Throw specifications may be added at a later +date as compilers begin to handle this better. The library should throw only +three types of exception: boost::bad_expression can be thrown by reg_expression +when compiling a regular expression; boost::bad_pattern can be thrown by the +class sub_match's conversion operators; finally std::bad_alloc can be thrown by +just about any of the functions in this library.
+

+
+

Copyright Dr John +Maddock 1998-2000 all rights reserved.

+ + + diff --git a/format_string.htm b/format_string.htm new file mode 100644 index 00000000..37c83590 --- /dev/null +++ b/format_string.htm @@ -0,0 +1,202 @@ + + + + + + + + +Regex++, Format String Reference + + + +  + + + + +

+C++ Boost

+
+

Regex++, Format String Reference.

+
+
+(version 3.01, 18 April 2000) +
+
Copyright (c) 1998-2000
+Dr John Maddock
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Dr John Maddock makes no representations
+about the suitability of this software for any purpose.  
+It is provided "as is" without express or implied warranty.
+ +
+
+

Format String Syntax

+Format strings are used by the algorithms +regex_format and +regex_merge, and are used to +transform one string into another.

There are three kind of format string: +sed, perl and extended, the extended syntax is the default so this is covered +first.

+

Extended format syntax

+

In format strings, all characters are treated as literals except: ()$\?: +

+

To use any of these as literals you must prefix them with the escape +character \

+

The following special sequences are recognized:

+

Grouping:

+

Use the parenthesis characters ( and ) to group sub-expressions within the +format string, use \( and \) to represent literal '(' and ')'.

+

Sub-expression expansions:

+

The following perl like expressions expand to a particular matched +sub-expression:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 $`Expands to all the text from the end of the +previous match to the start of the current match, if there was no previous +match in the current operation, then everything from the start of the input +string to the start of the match. 
 $'Expands to all the text from the end of the match +to the end of the input string. 
 $&Expands to all of the current match. 
 $0Expands to all of the current match. 
 $NExpands to the text that matched sub-expression +N. 
+

Conditional expressions:

+

Conditional expressions allow two different format strings to be selected +dependent upon whether a sub-expression participated in the match or not:

+

?Ntrue_expression:false_expression

+

Executes true_expression if sub-expression N participated in the +match, otherwise executes false_expression.

+

Example: suppose we search for "(while)|(for)" then the format +string "?1WHILE:FOR" would output what matched, but in upper case. +

+

Escape sequences:

+

The following escape sequences are also allowed:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 \aThe bell character. 
 \fThe form feed character. 
 \nThe newline character. 
 \rThe carriage return character. 
 \tThe tab character. 
 \vA vertical tab character. 
 \xA hexadecimal character - for example \x0D. 
 \x{}A possible unicode hexadecimal character - for +example \x{1A0} 
 \cxThe ASCII escape character x, for example \c@ is +equivalent to escape-@. 
 \eThe ASCII escape character. 
 \ddAn octal character constant, for example \10. 
+

Perl format strings

+

Perl format strings are the same as the default syntax except that the +characters ()?: have no special meaning.

+

Sed format strings

+

Sed format strings use only the characters \ and & as special +characters.

+

\n where n is a digit, is expanded to the nth sub-expression.

+

& is expanded to the whole of the match (equivalent to \0).

+

Other escape sequences are expanded as per the default syntax.
+

+
+

Copyright Dr John +Maddock 1998-2000 all rights reserved.

+ + + diff --git a/hl_ref.htm b/hl_ref.htm new file mode 100644 index 00000000..4fb57cd7 --- /dev/null +++ b/hl_ref.htm @@ -0,0 +1,548 @@ + + + + + + +Regex++, RegEx Class Reference + + + + +

 

+ + + + + + +

C++ Boost

+

Regex++, + RegEx Class Reference.

+

(version 3.01, 18 April 2000)

+
Copyright (c) 1998-2000
+Dr John Maddock
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Dr John Maddock makes no representations
+about the suitability of this software for any purpose.  
+It is provided "as is" without express or implied warranty.
+
+ +
+ +

Class RegEx

+ +

#include <boost/cregex.hpp>

+ +

The class RegEx provides a high level simplified interface to +the regular expression library, this class only handles narrow +character strings, and regular expressions always follow the +"normal" syntax - that is the same as the standard +POSIX extended syntax, but with locale specific collation +disabled, and escape characters inside character set declarations +are allowed.

+ +
typedef bool (*GrepCallback)(const RegEx& expression);
+typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression);
+typedef bool (*FindFilesCallback)(const char* file);
+
+class  RegEx
+{
+public:
+   RegEx();
+   RegEx(const RegEx& o);
+   ~RegEx();
+   RegEx(const char* c, bool icase = false);
+   explicit RegEx(const std::string& s, bool icase = false);
+   RegEx& operator=(const RegEx& o);
+   RegEx& operator=(const char* p);
+   RegEx& operator=(const std::string& s);
+   unsigned int SetExpression(const char* p, bool icase = false);
+   unsigned int SetExpression(const std::string& s, bool icase = false);
+   std::string Expression()const;
+   //
+   // now matching operators: 
+   // 
+   bool Match(const char* p, unsigned int flags = match_default);
+   bool Match(const std::string& s, unsigned int flags = match_default); 
+   bool Search(const char* p, unsigned int flags = match_default); 
+   bool Search(const std::string& s, unsigned int flags = match_default); 
+   unsigned int Grep(GrepCallback cb, const char* p, unsigned int flags = match_default); 
+   unsigned int Grep(GrepCallback cb, const std::string& s, unsigned int flags = match_default); 
+   unsigned int Grep(std::vector<std::string>& v, const char* p, unsigned int flags = match_default); 
+   unsigned int Grep(std::vector<std::string>& v, const std::string& s, unsigned int flags = match_default); 
+   unsigned int Grep(std::vector<unsigned int>& v, const char* p, unsigned int flags = match_default); 
+   unsigned int Grep(std::vector<unsigned int>& v, const std::string& s, unsigned int flags = match_default); 
+   unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); 
+   unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default); 
+   unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); 
+   unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default); 
+   std::string Merge(const std::string& in, const std::string& fmt, bool copy = true, unsigned int flags = match_default); 
+   std::string Merge(const char* in, const char* fmt, bool copy = true, unsigned int flags = match_default); 
+   unsigned Split(std::vector<std::string>& v, std::string& s, unsigned flags = match_default, unsigned max_count = ~0); 
+   // 
+   // now operators for returning what matched in more detail: 
+   // 
+   unsigned int Position(int i = 0)const; 
+   unsigned int Length(int i = 0)const; 
+   unsigned int Line()const; 
+   unsigned int Marks() const; 
+   std::string What(int i)const; 
+   std::string operator[](int i)const ; 
+};     
+ +

Member functions for class RegEx are defined as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 RegEx();Default constructor, + constructs an instance of RegEx without any valid + expression. 
 RegEx(const RegEx& + o);Copy constructor, all the + properties of parameter o are copied. 
 RegEx(const char* + c, bool icase = false);Constructs an instance of + RegEx, setting the expression to c, if icase + is true then matching is insensitive to case, + otherwise it is sensitive to case. Throws bad_expression + on failure. 
 RegEx(const std::string& + s, bool icase = false);Constructs an instance of + RegEx, setting the expression to s, if icase is + true then matching is insensitive to case, + otherwise it is sensitive to case. Throws bad_expression + on failure. 
 RegEx& operator=(const + RegEx& o);Default assignment operator. 
 RegEx& operator=(const + char* p);Assignment operator, + equivalent to calling SetExpression(p, false). + Throws bad_expression on failure. 
 RegEx& operator=(const + std::string& s);Assignment operator, + equivalent to calling SetExpression(s, false). + Throws bad_expression on failure. 
 unsigned int + SetExpression(constchar* p, bool icase = false);Sets the current expression + to p, if icase is true then matching + is insensitive to case, otherwise it is sensitive to case. + Throws bad_expression on failure. 
 unsigned int + SetExpression(const std::string& s, bool + icase = false);Sets the current expression + to s, if icase is true then matching + is insensitive to case, otherwise it is sensitive to case. + Throws bad_expression on failure. 
 std::string Expression()const;Returns a copy of the + current regular expression. 
 bool Match(const + char* p, unsigned int flags = match_default);Attempts to match the + current expression against the text p using the + match flags flags - see match flags. + Returns true if the expression matches the whole + of the input string. 
 bool Match(const + std::string& s, unsigned int flags = + match_default) ;Attempts to match the + current expression against the text s using the + match flags flags - see match flags. + Returns true if the expression matches the whole + of the input string. 
 bool Search(const + char* p, unsigned int flags = match_default);Attempts to find a match for + the current expression somewhere in the text p + using the match flags flags - see match flags. + Returns true if the match succeeds. 
 bool Search(const + std::string& s, unsigned int flags = + match_default) ;Attempts to find a match for + the current expression somewhere in the text s + using the match flags flags - see match flags. + Returns true if the match succeeds. 
 unsigned int + Grep(GrepCallback cb, const char* p, unsigned + int flags = match_default);Finds all matches of the + current expression in the text p using the match + flags flags - see match flags. + For each match found calls the call-back function cb + as: cb(*this);

If at any stage the call-back function + returns false then the grep operation terminates, + otherwise continues until no further matches are found. + Returns the number of matches found.

+
 
 unsigned int + Grep(GrepCallback cb, const std::string& s, unsigned + int flags = match_default);Finds all matches of the + current expression in the text s using the match + flags flags - see match flags. + For each match found calls the call-back function cb + as: cb(*this);

If at any stage the call-back function + returns false then the grep operation terminates, + otherwise continues until no further matches are found. + Returns the number of matches found.

+
 
 unsigned int + Grep(std::vector<std::string>& v, const char* + p, unsigned int flags = match_default);Finds all matches of the + current expression in the text p using the match + flags flags - see match flags. + For each match pushes a copy of what matched onto v. + Returns the number of matches found. 
 unsigned int + Grep(std::vector<std::string>& v, const + std::string& s, unsigned int flags = + match_default);Finds all matches of the + current expression in the text s using the match + flags flags - see match flags. + For each match pushes a copy of what matched onto v. + Returns the number of matches found. 
 unsigned int + Grep(std::vector<unsigned int>& v, const + char* p, unsigned int flags = match_default);Finds all matches of the + current expression in the text p using the match + flags flags - see match flags. + For each match pushes the starting index of what matched + onto v. Returns the number of matches found. 
 unsigned int + Grep(std::vector<unsigned int>& v, const + std::string& s, unsigned int flags = + match_default);Finds all matches of the + current expression in the text s using the match + flags flags - see match flags. + For each match pushes the starting index of what matched + onto v. Returns the number of matches found. 
 unsigned int + GrepFiles(GrepFileCallback cb, const char* + files, bool recurse = false, unsigned + int flags = match_default);Finds all matches of the + current expression in the files files using the + match flags flags - see match flags. + For each match calls the call-back function cb. 

If + the call-back returns false then the algorithm returns + without considering further matches in the current file, + or any further files. 

+

The parameter files can include wild card + characters '*' and '?', if the parameter recurse + is true then searches sub-directories for matching file + names. 

+

Returns the total number of matches found.

+

May throw an exception derived from std::runtime_error + if file io fails.

+
 
 unsigned int + GrepFiles(GrepFileCallback cb, const std::string& + files, bool recurse = false, unsigned + int flags = match_default);Finds all matches of the + current expression in the files files using the + match flags flags - see match flags. + For each match calls the call-back function cb. 

If + the call-back returns false then the algorithm returns + without considering further matches in the current file, + or any further files. 

+

The parameter files can include wild card + characters '*' and '?', if the parameter recurse + is true then searches sub-directories for matching file + names. 

+

Returns the total number of matches found.

+

May throw an exception derived from std::runtime_error + if file io fails.

+
 
 unsigned int + FindFiles(FindFilesCallback cb, const char* + files, bool recurse = false, unsigned + int flags = match_default);Searches files to + find all those which contain at least one match of the + current expression using the match flags flags - + see match + flags. For each matching file calls the call-back + function cb. 

If the call-back returns false then + the algorithm returns without considering any further + files. 

+

The parameter files can include wild card + characters '*' and '?', if the parameter recurse + is true then searches sub-directories for matching file + names. 

+

Returns the total number of files found.

+

May throw an exception derived from std::runtime_error + if file io fails.

+
 
 unsigned int + FindFiles(FindFilesCallback cb, const std::string& + files, bool recurse = false, unsigned + int flags = match_default);Searches files to + find all those which contain at least one match of the + current expression using the match flags flags - + see match + flags. For each matching file calls the call-back + function cb. 

If the call-back returns false then + the algorithm returns without considering any further + files. 

+

The parameter files can include wild card + characters '*' and '?', if the parameter recurse + is true then searches sub-directories for matching file + names. 

+

Returns the total number of files found.

+

May throw an exception derived from std::runtime_error + if file io fails.

+
 
 std::string Merge(const + std::string& in, const std::string& fmt, bool + copy = true, unsigned int flags = + match_default);Performs a search and + replace operation: searches through the string in + for all occurrences of the current expression, for each + occurrence replaces the match with the format string fmt. + Uses flags to determine what gets matched. If copy + is true then all unmatched sections of input are copied + unchanged to output. Returns the new string. See also format string + syntax. 
 std::string Merge(const + char* in, const char* fmt, bool copy = true, + unsigned int flags = match_default);Performs a search and + replace operation: searches through the string in + for all occurrences of the current expression, for each + occurrence replaces the match with the format string fmt. + Uses flags to determine what gets matched. If copy + is true then all unmatched sections of input are copied + unchanged to output. Returns the new string. See also format string + syntax. 
 unsigned Split(std::vector<std::string>& + v, std::string& s, unsigned flags = match_default, + unsigned max_count = ~0);Splits the input string and pushes each + one onto the vector. If the expression contains no marked + sub-expressions, then one string is outputted for each + section of the input that does not match the expression. + If the expression does contain marked sub-expressions, + then outputs one string for each marked sub-expression + each time a match occurs. Outputs no more than max_count + strings. Before returning, deletes from the input + string s all of the input that has been processed + (all of the string if max_count was not reached). + Returns the number of strings pushed onto the vector. 
 unsigned int + Position(int i = 0)const;Returns the position of what + matched sub-expression i. If i = 0 then + returns the position of the whole match. Returns -1 if + the supplied index is invalid, or if the specified sub-expression + did not participate in the match. 
 unsigned int + Length(int i = 0)const;Returns the length of what + matched sub-expression i. If i = 0 then + returns the length of the whole match. Returns -1 if the + supplied index is invalid, or if the specified sub-expression + did not participate in the match. 
 unsigned int + Line()const;Returns the line on which + the match occurred, indexes start from 1 not zero, if no + match occurred then returns (unsigned)-1. 
 unsigned int Marks() + const;Returns the number of marked + sub-expressions contained in the expression. Note that + this includes the whole match (sub-expression zero), so + the value returned is always >= 1. 
 std::string What(int + i)const;Returns a copy of what + matched sub-expression i. If i = 0 then + returns a copy of the whole match. Returns a null string + if the index is invalid or if the specified sub-expression + did not participate in a match. 
 std::string operator[](int + i)const ;Returns what(i);

Can + be used to simplify access to sub-expression matches, and + make usage more perl-like.

+
 
+ +
+ +

Copyright Dr +John Maddock 1998-2000 all rights reserved.

+ + diff --git a/include/boost/cregex.hpp b/include/boost/cregex.hpp new file mode 100644 index 00000000..d7755c8c --- /dev/null +++ b/include/boost/cregex.hpp @@ -0,0 +1,302 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE cregex.cpp + * VERSION 3.01 + * DESCRIPTION: Declares POSIX API functions + * + boost::RegEx high level wrapper. + */ + +#ifndef BOOST_RE_CREGEX_HPP +#define BOOST_RE_CREGEX_HPP + +#include + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +/* include these defs only for POSIX compatablity */ +#ifdef __cplusplus +namespace boost{ +extern "C" { +#endif + +typedef int regoff_t; + +typedef struct +{ + unsigned int re_magic; + unsigned int re_nsub; /* number of parenthesized subexpressions */ + const char* re_endp; /* end pointer for REG_PEND */ + void* guts; /* none of your business :-) */ + unsigned int eflags; /* none of your business :-) */ +} regex_tA; + +#ifndef BOOST_RE_NO_WCSTRING +typedef struct +{ + unsigned int re_magic; + unsigned int re_nsub; /* number of parenthesized subexpressions */ + const wchar_t* re_endp; /* end pointer for REG_PEND */ + void* guts; /* none of your business :-) */ + unsigned int eflags; /* none of your business :-) */ +} regex_tW; +#endif + +typedef struct +{ + regoff_t rm_so; /* start of match */ + regoff_t rm_eo; /* end of match */ +} regmatch_t; + +/* regcomp() flags */ +typedef enum{ + REG_BASIC = 0000, + REG_EXTENDED = 0001, + REG_ICASE = 0002, + REG_NOSUB = 0004, + REG_NEWLINE = 0010, + REG_NOSPEC = 0020, + REG_PEND = 0040, + REG_DUMP = 0200, + REG_NOCOLLATE = 0400, + REG_ESCAPE_IN_LISTS = 01000, + REG_NEWLINE_ALT = 02000, + + REG_PERL = REG_EXTENDED | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS, + REG_AWK = REG_EXTENDED | REG_ESCAPE_IN_LISTS, + REG_GREP = REG_BASIC | REG_NEWLINE_ALT, + REG_EGREP = REG_EXTENDED | REG_NEWLINE_ALT, + + REG_ASSERT = 15, + REG_INVARG = 16, + REG_ATOI = 255, /* convert name to number (!) */ + REG_ITOA = 0400 /* convert number to name (!) */ +} reg_comp_flags; + +/* regexec() flags */ +typedef enum{ + REG_NOTBOL = 00001, + REG_NOTEOL = 00002, + REG_STARTEND = 00004 +} reg_exec_flags; + +BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompA(regex_tA*, const char*, int); +BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorA(int, const regex_tA*, char*, unsigned int); +BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecA(const regex_tA*, const char*, unsigned int, regmatch_t*, int); +BOOST_RE_IX_DECL void BOOST_RE_CCALL regfreeA(regex_tA*); + +#ifndef BOOST_RE_NO_WCSTRING +BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompW(regex_tW*, const wchar_t*, int); +BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorW(int, const regex_tW*, wchar_t*, unsigned int); +BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecW(const regex_tW*, const wchar_t*, unsigned int, regmatch_t*, int); +BOOST_RE_IX_DECL void BOOST_RE_CCALL regfreeW(regex_tW*); +#endif + +#ifdef UNICODE +#define regcomp regcompW +#define regerror regerrorW +#define regexec regexecW +#define regfree regfreeW +#define regex_t regex_tW +#else +#define regcomp regcompA +#define regerror regerrorA +#define regexec regexecA +#define regfree regfreeA +#define regex_t regex_tA +#endif + +/* regerror() flags */ +typedef enum +{ + REG_NOERROR = 0, /* Success. */ + REG_NOMATCH = 1, /* Didn't find a match (for regexec). */ + + /* POSIX regcomp return error codes. (In the order listed in the + standard.) */ + REG_BADPAT = 2, /* Invalid pattern. */ + REG_ECOLLATE = 3, /* Undefined collating element. */ + REG_ECTYPE = 4, /* Invalid character class name. */ + REG_EESCAPE = 5, /* Trailing backslash. */ + REG_ESUBREG = 6, /* Invalid back reference. */ + REG_EBRACK = 7, /* Unmatched left bracket. */ + REG_EPAREN = 8, /* Parenthesis imbalance. */ + REG_EBRACE = 9, /* Unmatched \{. */ + REG_BADBR = 10, /* Invalid contents of \{\}. */ + REG_ERANGE = 11, /* Invalid range end. */ + REG_ESPACE = 12, /* Ran out of memory. */ + REG_BADRPT = 13, /* No preceding re for repetition op. */ + REG_EEND = 14, /* unexpected end of expression */ + REG_ESIZE = 15, /* expression too big */ + REG_ERPAREN = 16, /* unmatched right parenthesis */ + REG_EMPTY = 17, /* empty expression */ + REG_E_MEMORY = REG_ESIZE, /* out of memory */ + REG_E_UNKNOWN = 18 /* unknown error */ +} reg_errcode_t; + +enum match_flags +{ + match_default = 0, + match_not_bol = 1, // first is not start of line + match_not_eol = match_not_bol << 1, // last is not end of line + match_not_bob = match_not_eol << 1, // first is not start of buffer + match_not_eob = match_not_bob << 1, // last is not end of buffer + match_not_bow = match_not_eob << 1, // first is not start of word + match_not_eow = match_not_bow << 1, // last is not end of word + match_not_dot_newline = match_not_eow << 1, // \n is not matched by '.' + match_not_dot_null = match_not_dot_newline << 1, // '\0' is not matched by '.' + match_prev_avail = match_not_dot_null << 1, // *--first is a valid expression + match_init = match_prev_avail << 1, // internal use + match_any = match_init << 1, // don't care what we match + match_not_null = match_any << 1, // string can't be null + match_continuous = match_not_null << 1, // each grep match must continue from + // uninterupted from the previous one + match_stop = match_continuous << 1, // stop after first match (grep) + match_max = match_stop +}; + + +#ifdef __cplusplus +} // extern "C" +} // namespace +#endif + + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + + +// +// C++ high level wrapper goes here: +// +#if defined(__cplusplus) && !defined(BOOST_RE_NO_STRING_H) +#include +#include +namespace boost{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b + #endif +#endif + +class RegEx; + +namespace re_detail{ + +class RegExData; +struct pred1; +struct pred2; +struct pred3; +struct pred4; + +} // namespace re_detail + +#if defined(BOOST_MSVC) || defined(__BORLANDC__) +typedef bool (__cdecl *GrepCallback)(const RegEx& expression); +typedef bool (__cdecl *GrepFileCallback)(const char* file, const RegEx& expression); +typedef bool (__cdecl *FindFilesCallback)(const char* file); +#else +typedef bool (*GrepCallback)(const RegEx& expression); +typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression); +typedef bool (*FindFilesCallback)(const char* file); +#endif + +class BOOST_RE_IX_DECL RegEx +{ +private: + re_detail::RegExData* pdata; +public: + RegEx(); + RegEx(const RegEx& o); + ~RegEx(); + explicit RegEx(const char* c, bool icase = false); + explicit RegEx(const std::string& s, bool icase = false); + RegEx& operator=(const RegEx& o); + RegEx& operator=(const char* p); + RegEx& operator=(const std::string& s){ return this->operator=(s.c_str()); } + unsigned int SetExpression(const char* p, bool icase = false); + unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); } + std::string Expression()const; + // + // now matching operators: + // + bool Match(const char* p, unsigned int flags = match_default); + bool Match(const std::string& s, unsigned int flags = match_default) { return Match(s.c_str(), flags); } + bool Search(const char* p, unsigned int flags = match_default); + bool Search(const std::string& s, unsigned int flags = match_default) { return Search(s.c_str(), flags); } + unsigned int Grep(GrepCallback cb, const char* p, unsigned int flags = match_default); + unsigned int Grep(GrepCallback cb, const std::string& s, unsigned int flags = match_default) { return Grep(cb, s.c_str(), flags); } + unsigned int Grep(std::vector& v, const char* p, unsigned int flags = match_default); + unsigned int Grep(std::vector& v, const std::string& s, unsigned int flags = match_default) { return Grep(v, s.c_str(), flags); } + unsigned int Grep(std::vector& v, const char* p, unsigned int flags = match_default); + unsigned int Grep(std::vector& v, const std::string& s, unsigned int flags = match_default) { return Grep(v, s.c_str(), flags); } + unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); + unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default) { return GrepFiles(cb, files.c_str(), recurse, flags); } + unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); + unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default) { return FindFiles(cb, files.c_str(), recurse, flags); } + + std::string Merge(const std::string& in, const std::string& fmt, + bool copy = true, unsigned int flags = match_default); + std::string Merge(const char* in, const char* fmt, + bool copy = true, unsigned int flags = match_default); + + unsigned int Split(std::vector& v, std::string& s, unsigned flags = match_default, unsigned max_count = ~0); + // + // now operators for returning what matched in more detail: + // + unsigned int Position(int i = 0)const; + unsigned int Length(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); } + + friend struct re_detail::pred1; + friend struct re_detail::pred2; + friend struct re_detail::pred3; + friend struct re_detail::pred4; +}; + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#endif + +#endif // include guard + + + + + + diff --git a/include/boost/pattern_except.hpp b/include/boost/pattern_except.hpp new file mode 100644 index 00000000..0ac760d7 --- /dev/null +++ b/include/boost/pattern_except.hpp @@ -0,0 +1,61 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE pattern_except.cpp + * VERSION 3.01 + * DESCRIPTION: Declares pattern-matching exception classes. + */ + +#ifndef BOOST_RE_PAT_EXCEPT_HPP +#define BOOST_RE_PAT_EXCEPT_HPP + +#include + +namespace boost{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +class BOOST_RE_IX_DECL bad_pattern : public std::runtime_error +{ +public: + explicit bad_pattern(const std::string& s) : std::runtime_error(s){}; + ~bad_pattern(); +}; + +class BOOST_RE_IX_DECL bad_expression : public bad_pattern +{ +public: + explicit bad_expression(const std::string& s) : bad_pattern(s) {} + ~bad_expression(); +}; + + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#endif diff --git a/include/boost/re_detail/fileiter.hpp b/include/boost/re_detail/fileiter.hpp new file mode 100644 index 00000000..6e2e7418 --- /dev/null +++ b/include/boost/re_detail/fileiter.hpp @@ -0,0 +1,416 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE fileiter.hpp + * VERSION 3.01 + * DESCRIPTION: Declares various platform independent file and + * directory iterators, plus binary file input in + * the form of class map_file. + */ + +#ifndef BOOST_RE_FILEITER_HPP +#define BOOST_RE_FILEITER_HPP + +#include + +#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && !defined(BOOST_RE_NO_W32) +#error "Sorry, can't mix with STL code and gcc compiler: if you ran configure, try again with configure --disable-ms-windows" +#define FI_WIN32_MAP +#define FI_POSIX_DIR +#elif (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(BOOST_RE_NO_W32) +#define FI_WIN32_MAP +#define FI_WIN32_DIR +#else +#define FI_POSIX_MAP +#define FI_POSIX_DIR +#endif + +#if defined(FI_WIN32_MAP)||defined(FI_WIN32_DIR) +#include +#endif + +#if defined(FI_WIN32_DIR) + +namespace boost{ + namespace re_detail{ + +typedef WIN32_FIND_DATA _fi_find_data; +typedef HANDLE _fi_find_handle; + + } // namespace re_detail + +} // namespace boost + +#define _fi_invalid_handle INVALID_HANDLE_VALUE +#define _fi_dir FILE_ATTRIBUTE_DIRECTORY + +#elif defined(FI_POSIX_DIR) + +#include +#include +#include +#include +#include +#include + +#if defined(__SUNPRO_CC) +using std::list; +#endif + +#ifndef MAX_PATH +#define MAX_PATH 256 +#endif + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +struct _fi_find_data +{ + unsigned dwFileAttributes; + char cFileName[MAX_PATH]; +}; + +struct _fi_priv_data; + +typedef _fi_priv_data* _fi_find_handle; +#define _fi_invalid_handle NULL +#define _fi_dir 1 + +_fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData); +bool _fi_FindNextFile(_fi_find_handle hFindFile, _fi_find_data* lpFindFileData); +bool _fi_FindClose(_fi_find_handle hFindFile); + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + + } // namespace re_detail +} // namespace boost + +#ifdef FindFirstFile + #undef FindFirstFile +#endif +#ifdef FindNextFile + #undef FindNextFile +#endif +#ifdef FindClose + #undef FindClose +#endif + +#define FindFirstFile _fi_FindFirstFile +#define FindNextFile _fi_FindNextFile +#define FindClose _fi_FindClose + +#endif + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b + #endif +#endif + +#ifdef FI_WIN32_MAP // win32 mapfile + +class BOOST_RE_IX_DECL mapfile +{ + HANDLE hfile; + HANDLE hmap; + const char* _first; + const char* _last; +public: + + typedef const char* iterator; + + mapfile(){ hfile = hmap = 0; _first = _last = 0; } + mapfile(const char* file){ hfile = hmap = 0; _first = _last = 0; open(file); } + ~mapfile(){ close(); } + void open(const char* file); + void close(); + const char* begin(){ return _first; } + const char* end(){ return _last; } + size_t size(){ return _last - _first; } + bool valid(){ return (hfile != 0) && (hfile != INVALID_HANDLE_VALUE); } +}; + + +#elif !defined(BOOST_RE_NO_STL) // use C API to emulate the memory map: + +class BOOST_RE_IX_DECL mapfile_iterator; + +class BOOST_RE_IX_DECL mapfile +{ + typedef char* pointer; + FILE* hfile; + long int _size; + pointer* _first; + pointer* _last; + mutable std::list condemed; + enum sizes + { + buf_size = 4096 + }; + void lock(pointer* node)const; + void unlock(pointer* node)const; +public: + + typedef mapfile_iterator iterator; + + mapfile(){ hfile = 0; _size = 0; _first = _last = 0; } + mapfile(const char* file){ hfile = 0; _size = 0; _first = _last = 0; open(file); } + ~mapfile(){ close(); } + void open(const char* file); + void close(); + iterator begin()const; + iterator end()const; + unsigned long size()const{ return _size; } + bool valid()const{ return hfile != 0; } + friend class mapfile_iterator; +}; + +class BOOST_RE_IX_DECL mapfile_iterator : public BOOST_RE_RA_ITERATOR(char, long) +{ + typedef mapfile::pointer internal_pointer; + internal_pointer* node; + const mapfile* file; + unsigned long offset; + long position()const + { + return file ? ((node - file->_first) * mapfile::buf_size + offset) : 0; + } + void position(long pos) + { + if(file) + { + node = file->_first + (pos / mapfile::buf_size); + offset = pos % mapfile::buf_size; + } + } +public: + typedef std::ptrdiff_t difference_type; + typedef char value_type; + typedef const char* pointer; + typedef const char& reference; + typedef std::random_access_iterator_tag iterator_category; + + mapfile_iterator() { node = 0; file = 0; offset = 0; } + mapfile_iterator(const mapfile* f, long position) + { + file = f; + node = f->_first + position / mapfile::buf_size; + offset = position % mapfile::buf_size; + if(file) + file->lock(node); + } + mapfile_iterator(const mapfile_iterator& i) + { + file = i.file; + node = i.node; + offset = i.offset; + if(file) + file->lock(node); + } + ~mapfile_iterator() + { + if(file && node) + file->unlock(node); + } + mapfile_iterator& operator = (const mapfile_iterator& i); + char operator* ()const + { + assert(node >= file->_first); + assert(node < file->_last); + return file ? *(*node + sizeof(int) + offset) : char(0); + } + mapfile_iterator& operator++ (); + mapfile_iterator operator++ (int); + mapfile_iterator& operator-- (); + mapfile_iterator operator-- (int); + + mapfile_iterator& operator += (long off) + { + position(position() + off); + return *this; + } + mapfile_iterator& operator -= (long off) + { + position(position() - off); + return *this; + } + + friend inline bool operator==(const mapfile_iterator& i, const mapfile_iterator& j) + { + return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset); + } +#ifndef BOOST_RE_NO_NOT_EQUAL + friend inline bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j) + { + return !(i == j); + } +#endif + friend inline bool operator<(const mapfile_iterator& i, const mapfile_iterator& j) + { + return i.position() < j.position(); + } + + friend mapfile_iterator operator + (const mapfile_iterator& i, long off); + friend mapfile_iterator operator - (const mapfile_iterator& i, long off); + friend inline long operator - (const mapfile_iterator& i, const mapfile_iterator& j) + { + return i.position() - j.position(); + } +}; + +#endif + +// _fi_sep determines the directory separator, either '\\' or '/' +BOOST_RE_IX_DECL extern const char* _fi_sep; + +struct file_iterator_ref +{ + _fi_find_handle hf; + _fi_find_data _data; + long count; +}; + + +class BOOST_RE_IX_DECL file_iterator : public BOOST_RE_INPUT_ITERATOR(const char*, std::ptrdiff_t) +{ + char* _root; + char* _path; + char* ptr; + file_iterator_ref* ref; + +public: + file_iterator(); + file_iterator(const char* wild); + ~file_iterator(); + file_iterator(const file_iterator&); + file_iterator& operator=(const file_iterator&); + const char* root()const { return _root; } + const char* path()const { return _path; } + const char* name()const { return ptr; } + _fi_find_data* data() { return &(ref->_data); } + void next(); + file_iterator& operator++() { next(); return *this; } + file_iterator operator++(int); + const char* operator*() { return path(); } + + friend inline bool operator == (const file_iterator& f1, const file_iterator& f2) + { + return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle)); + } +#ifndef BOOST_RE_NO_NOT_EQUAL + friend inline bool operator != (const file_iterator& f1, const file_iterator& f2) + { + return !(f1 == f2); + } +#endif +}; + +// dwa 9/13/00 - suppress unused parameter warning +inline bool operator < (const file_iterator&, const file_iterator&) +{ + return false; +} + + +class BOOST_RE_IX_DECL directory_iterator : public BOOST_RE_INPUT_ITERATOR(const char*, std::ptrdiff_t) +{ + char* _root; + char* _path; + char* ptr; + file_iterator_ref* ref; + +public: + directory_iterator(); + directory_iterator(const char* wild); + ~directory_iterator(); + directory_iterator(const directory_iterator& other); + directory_iterator& operator=(const directory_iterator& other); + + const char* root()const { return _root; } + const char* path()const { return _path; } + const char* name()const { return ptr; } + _fi_find_data* data() { return &(ref->_data); } + void next(); + directory_iterator& operator++() { next(); return *this; } + directory_iterator operator++(int); + const char* operator*() { return path(); } + + static const char* separator() { return _fi_sep; } + + friend inline bool operator == (const directory_iterator& f1, const directory_iterator& f2) + { + return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle)); + } + +#ifndef BOOST_RE_NO_NOT_EQUAL + friend inline bool operator != (const directory_iterator& f1, const directory_iterator& f2) + { + return !(f1 == f2); + } +#endif +}; + +inline bool operator < (const directory_iterator&, const directory_iterator&) +{ + return false; +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + + +} // namespace re_detail +using boost::re_detail::directory_iterator; +using boost::re_detail::file_iterator; +using boost::re_detail::mapfile; +} // namespace boost + +#endif // _FILEITER_H + + + + + + + + + + + + + + diff --git a/include/boost/re_detail/regex_compile.hpp b/include/boost/re_detail/regex_compile.hpp new file mode 100644 index 00000000..76500910 --- /dev/null +++ b/include/boost/re_detail/regex_compile.hpp @@ -0,0 +1,2005 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_compile.hpp + * VERSION 3.01 + * DESCRIPTION: Declares reg_expression<> member functions. This is + * an internal header file, do not include directly. + */ + +#ifndef BOOST_REGEX_COMPILE_HPP +#define BOOST_REGEX_COMPILE_HPP + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +template +struct kmp_translator +{ + typedef typename traits::char_type char_type; + bool icase; + const traits* pt; + kmp_translator(bool c, traits* p) : icase(c), pt(p) {} + char_type operator()(char_type c) + { + return pt->translate(c, icase); + } +}; + + +template +bool BOOST_RE_CALL re_maybe_set_member(charT c, + re_set_long* set_, + const reg_expression& e) +{ + const charT* p = (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) + { + if(col == *p) + return set_->isnot ? false : true; + + while(*p)++p; + ++p; // skip null + } + return set_->isnot ? true : false; +} + +} // namespace re_detail + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +// +// Ugly ugly hack, +// templates don't merge if they contain switch statements so declare these +// templates in unnamed namespace (ie with internal linkage), each translation +// unit then gets its own local copy, it works seemlessly but bloats the app. +namespace{ +#endif + +template +inline bool BOOST_RE_CALL reg_expression::can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_wide_type&) +{ + if((traits_size_type)(traits_uchar_type)c >= 256) + return true; + return BOOST_RE_MAKE_BOOL(_map[(traits_uchar_type)c] & mask); +} + +template +inline bool BOOST_RE_CALL reg_expression::can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_narrow_type&) +{ + return BOOST_RE_MAKE_BOOL(_map[(traits_uchar_type)c] & mask); +} + +template +CONSTRUCTOR_INLINE reg_expression::reg_expression(const Allocator& a) + : regbase(), data(a), pkmp(0), error_code_(REG_EMPTY) +{ +} + +template +CONSTRUCTOR_INLINE reg_expression::reg_expression(const charT* p, flag_type f, const Allocator& a) + : data(a), pkmp(0), error_code_(REG_EMPTY) +{ + set_expression(p, f); +} + +template +CONSTRUCTOR_INLINE reg_expression::reg_expression(const charT* p1, const charT* p2, flag_type f, const Allocator& a) + : data(a), pkmp(0), error_code_(REG_EMPTY) +{ + set_expression(p1, p2, f); +} + +template +CONSTRUCTOR_INLINE reg_expression::reg_expression(const charT* p, size_type len, flag_type f, const Allocator& a) + : data(a), pkmp(0), error_code_(REG_EMPTY) +{ + set_expression(p, p + len, f); +} + +template +reg_expression::reg_expression(const reg_expression& e) + : regbase(e), data(e.allocator()), pkmp(0), error_code_(REG_EMPTY) +{ + // + // we do a deep copy only if e is a valid expression, otherwise fail. + // + if(e.error_code() == 0) + { + const charT* pe = e.expression(); + set_expression(pe, pe + e._expression_len, e.flags()); + } + else + fail(e.error_code()); +} + +template +reg_expression::~reg_expression() +{ + if(pkmp) + re_detail::kmp_free(pkmp, data.allocator()); +} + +template +reg_expression& BOOST_RE_CALL reg_expression::operator=(const reg_expression& e) +{ + // + // we do a deep copy only if e is a valid expression, otherwise fail. + // + if(this == &e) return *this; + _flags = use_except; + fail(e.error_code()); + if(error_code() == 0) + set_expression(e._expression, e._expression + e._expression_len, e.flags()); + return *this; +} + +template +inline bool BOOST_RE_CALL reg_expression::operator==(const reg_expression& e)const +{ + return (_flags == e.flags()) + && (_expression_len == e._expression_len) + && (memcmp(_expression, e._expression, _expression_len * sizeof(charT)) == 0); +} + +template +bool BOOST_RE_CALL reg_expression::operator<(const reg_expression& e)const +{ + // + // we can't offer a diffinitive ordering, but we can be consistant: + if(_flags != e.flags()) return _flags < e.flags(); + if(_expression_len != e._expression_len) return _expression_len < e._expression_len; + return memcmp(expression(), e.expression(), _expression_len); +} + +template +Allocator BOOST_RE_CALL reg_expression::allocator()const +{ + return data.allocator(); +} + +template +Allocator BOOST_RE_CALL reg_expression::get_allocator()const +{ + return data.allocator(); +} + +template +unsigned int BOOST_RE_CALL reg_expression::parse_inner_set(const charT*& first, const charT* last) +{ + // + // we have an inner [...] construct + // + jm_assert(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_open_set); + const charT* base = first; + while( (first != last) + && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) != traits_type::syntax_close_set) ) + ++first; + if(first == last) + return 0; + ++first; + if((first-base) < 5) + return 0; + if(*(base+1) != *(first-2)) + return 0; + unsigned int result = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+1)); + if((result == traits_type::syntax_colon) && ((first-base) == 5)) + { + return traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+2)); + } + return ((result == traits_type::syntax_colon) || (result == traits_type::syntax_dot) || (result == traits_type::syntax_equal)) ? result : 0; +} + + +template +bool BOOST_RE_CALL reg_expression::skip_space(const charT*& first, const charT* last) +{ + // + // returns true if we get to last: + // + while((first != last) && (traits_inst.is_class(*first, traits_type::char_class_space) == true)) + { + ++first; + } + return first == last; +} + +template +void BOOST_RE_CALL reg_expression::parse_range(const charT*& ptr, const charT* end, unsigned& min, unsigned& max) +{ + // + // we have {x} or {x,} or {x,y} NB no spaces inside braces + // anything else is illegal + // On input ptr points to "{" + // + ++ptr; + if(skip_space(ptr, end)) + { + fail(REG_EBRACE); + return; + } + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_digit) + { + fail(REG_BADBR); + return; + } + min = traits_inst.toi(ptr, end, 10); + if(skip_space(ptr, end)) + { + fail(REG_EBRACE); + return; + } + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_comma) + { + //we have a second interval: + ++ptr; + if(skip_space(ptr, end)) + { + fail(REG_EBRACE); + return; + } + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_digit) + max = traits_inst.toi(ptr, end, 10); + else + max = (unsigned)-1; + } + else + max = min; + + // validate input: + if(skip_space(ptr, end)) + { + fail(REG_EBRACE); + return; + } + if(max < min) + { + fail(REG_ERANGE); + return; + } + if(_flags & bk_braces) + { + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_slash) + { + fail(REG_BADBR); + return; + } + else + { + // back\ is OK now check the } + ++ptr; + if((ptr == end) || (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_close_brace)) + { + fail(REG_BADBR); + return; + } + } + } + else if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_close_brace) + { + fail(REG_BADBR); + return; + } +} + +template +charT BOOST_RE_CALL reg_expression::parse_escape(const charT*& first, const charT* last) +{ + charT c(*first); + switch(traits_inst.syntax_type(*first)) + { + case traits_type::syntax_a: + c = '\a'; + ++first; + break; + case traits_type::syntax_f: + c = '\f'; + ++first; + break; + case traits_type::syntax_n: + c = '\n'; + ++first; + break; + case traits_type::syntax_r: + c = '\r'; + ++first; + break; + case traits_type::syntax_t: + c = '\t'; + ++first; + break; + case traits_type::syntax_v: + c = '\v'; + ++first; + break; + case traits_type::syntax_x: + ++first; + if(first == last) + { + fail(REG_EESCAPE); + break; + } + // maybe have \x{ddd} + if(traits_inst.syntax_type(*first) == traits_type::syntax_open_brace) + { + ++first; + if(first == last) + { + fail(REG_EESCAPE); + break; + } + if(traits_inst.is_class(*first, traits_type::char_class_xdigit) == false) + { + fail(REG_BADBR); + break; + } + c = (charT)traits_inst.toi(first, last, -16); + if((first == last) || (traits_inst.syntax_type(*first) != traits_type::syntax_close_brace)) + { + fail(REG_BADBR); + } + ++first; + break; + } + else + { + if(traits_inst.is_class(*first, traits_type::char_class_xdigit) == false) + { + fail(REG_BADBR); + break; + } + c = (charT)traits_inst.toi(first, last, -16); + } + break; + case traits_type::syntax_c: + ++first; + if(first == last) + { + fail(REG_EESCAPE); + break; + } + if(((traits_uchar_type)(*first) < (traits_uchar_type)'@') + || ((traits_uchar_type)(*first) > (traits_uchar_type)127) ) + { + fail(REG_EESCAPE); + return (charT)0; + } + c = (charT)((traits_uchar_type)(*first) - (traits_uchar_type)'@'); + ++first; + break; + case traits_type::syntax_e: + c = (charT)27; + ++first; + break; + case traits_type::syntax_digit: + c = (charT)traits_inst.toi(first, last, -8); + break; + default: + //c = *first; + ++first; + } + return c; +} + +template +void BOOST_RE_CALL reg_expression::compile_maps() +{ + re_detail::re_syntax_base* record = (re_detail::re_syntax_base*)data.data(); + // always compile the first _map: + std::memset(startmap, 0, 256); + record->can_be_null = 0; + compile_map(record, startmap, NULL, re_detail::mask_all); + + while(record->type != re_detail::syntax_element_match) + { + 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); + 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); + } + else + { + record->can_be_null = 0; + compile_map(record, NULL, &(record->can_be_null), re_detail::mask_all); + } + record = record->next.p; + } + record->can_be_null = re_detail::mask_all; +} + +template +bool BOOST_RE_CALL reg_expression::probe_start( + re_detail::re_syntax_base* node, charT cc, re_detail::re_syntax_base* terminal) const +{ + unsigned int c; + + switch(node->type) + { + case re_detail::syntax_element_startmark: + case re_detail::syntax_element_endmark: + case re_detail::syntax_element_start_line: + case re_detail::syntax_element_word_boundary: + case re_detail::syntax_element_buffer_start: + case re_detail::syntax_element_restart_continue: + // doesn't tell us anything about the next character, so: + return probe_start(node->next.p, cc, terminal); + 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))) + return true; + return false; + case re_detail::syntax_element_end_line: + // next character (if there is one!) must be a newline: + if(traits_inst.is_separator(traits_inst.translate(cc, (_flags & regbase::icase)))) + return true; + return false; + case re_detail::syntax_element_wild: + return true; + case re_detail::syntax_element_match: + return true; + case re_detail::syntax_element_within_word: + case re_detail::syntax_element_word_start: + return traits_inst.is_class(traits_inst.translate(cc, (_flags & regbase::icase)), traits_type::char_class_word); + case re_detail::syntax_element_word_end: + // what follows must not be a word character, + return traits_inst.is_class(traits_inst.translate(cc, (_flags & regbase::icase)), traits_type::char_class_word) ? false : true; + case re_detail::syntax_element_buffer_end: + // we can be null, nothing must follow, + // NB we assume that this is followed by + // re_detail::syntax_element_match, if its not then we can + // never match anything anyway!! + return false; + case re_detail::syntax_element_soft_buffer_end: + // we can be null, only newlines must follow, + // NB we assume that this is followed by + // re_detail::syntax_element_match, if its not then we can + // never match anything anyway!! + return traits_inst.is_separator(traits_inst.translate(cc, (_flags & regbase::icase))); + case re_detail::syntax_element_backref: + // there's no easy way to determine this + // which is not to say it can't be done! + // for now: + return true; + case re_detail::syntax_element_long_set: + // 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); + 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; + case re_detail::syntax_element_jump: + if(((re_detail::re_jump*)node)->alt.p < node) + { + // backwards jump, + // caused only by end of repeat section, we'll treat this + // the same as a match, because the sub-expression has matched. + if(node->next.p == terminal) + return true; // null repeat - we can always take this + else + { + // + // take the jump, add in fix for the fact that if the + // 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; + bool b = probe_start(next, cc, terminal); + if((next->type == re_detail::syntax_element_rep) && (((re_detail::re_repeat*)next)->min != 0)) + { + b = b || probe_start(((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); + 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); + 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); + else + return probe_start(node->next.p, cc, ((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))); + } + return false; +} + +template +bool BOOST_RE_CALL reg_expression::probe_start_null(re_detail::re_syntax_base* node, re_detail::re_syntax_base* terminal)const +{ + switch(node->type) + { + case re_detail::syntax_element_startmark: + case re_detail::syntax_element_endmark: + case re_detail::syntax_element_start_line: + case re_detail::syntax_element_word_boundary: + case re_detail::syntax_element_buffer_start: + case re_detail::syntax_element_restart_continue: + case re_detail::syntax_element_end_line: + case re_detail::syntax_element_word_end: + // doesn't tell us anything about the next character, so: + return probe_start_null(node->next.p, terminal); + case re_detail::syntax_element_match: + case re_detail::syntax_element_buffer_end: + case re_detail::syntax_element_soft_buffer_end: + case re_detail::syntax_element_backref: + return true; + case re_detail::syntax_element_jump: + if(((re_detail::re_jump*)node)->alt.p < node) + { + // backwards jump, + // caused only by end of repeat section, we'll treat this + // the same as a match, because the sub-expression has matched. + // this is only caused by NULL repeats as in "(a*)*" or "(\<)*" + // these are really nonsensence and make the matching code much + // harder, it would be nice to get rid of them altogether. + if(node->next.p == terminal) + return true; + else + return probe_start_null(((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); + 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); + 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); + default: + break; + } + return false; +} + +template +void BOOST_RE_CALL reg_expression::compile_map( + re_detail::re_syntax_base* node, unsigned char* _map, + unsigned int* pnull, unsigned char mask, re_detail::re_syntax_base* terminal)const +{ + if(_map) + { + for(unsigned int i = 0; i < 256; ++i) + { + if(probe_start(node, (charT)i, terminal)) + _map[i] |= mask; + } + } + if(pnull && probe_start_null(node, terminal)) + *pnull |= mask; +} + +template +void BOOST_RE_CALL reg_expression::move_offsets(re_detail::re_syntax_base* j, unsigned size) +{ + // 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); + while(true) + { + switch(j->type) + { + case re_detail::syntax_element_rep: + ((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; + j->next.i += size; + break; + default: + j->next.i += size; + break; + } + if(j->next.i == size) + break; + j = (re_detail::re_syntax_base*)((const char*)data.data() + j->next.i); + } +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::compile_set_simple(re_detail::re_syntax_base* dat, unsigned long cls, bool isnot) +{ + re_detail::jstack singles(64, data.allocator()); + re_detail::jstack ranges(64, data.allocator()); + re_detail::jstack classes(64, data.allocator()); + re_detail::jstack equivalents(64, data.allocator()); + classes.push(cls); + if(dat) + { + data.align(); + dat->next.i = data.size(); + } + return compile_set_aux(singles, ranges, classes, equivalents, isnot, re_detail::is_byte::width_type()); +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::compile_set(const charT*& first, const charT* last) +{ + re_detail::jstack singles(64, data.allocator()); + re_detail::jstack ranges(64, data.allocator()); + re_detail::jstack classes(64, data.allocator()); + re_detail::jstack equivalents(64, data.allocator()); + bool has_digraphs = false; + jm_assert(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_open_set); + ++first; + bool started = false; + bool done = false; + bool isnot = false; + + enum last_type + { + last_single, + last_none, + last_dash + }; + + unsigned l = last_none; + traits_string_type s; + + while((first != last) && !done) + { + traits_size_type c = (traits_size_type)(traits_uchar_type)*first; + switch(traits_inst.syntax_type(c)) + { + case traits_type::syntax_caret: + if(!started && !isnot) + { + isnot = true; + } + else + { + s = (charT)c; + goto char_set_literal; + } + break; + case traits_type::syntax_open_set: + { + if((_flags & char_classes) == 0) + { + s = (charT)c; + goto char_set_literal; + } + // check to see if we really have a class: + const charT* base = first; + switch(parse_inner_set(first, last)) + { + case traits_type::syntax_colon: + { + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + jm_uintfast32_t id = traits_inst.lookup_classname(base+2, first-2); + if(_flags & regbase::icase) + { + if((id == traits_type::char_class_upper) || (id == traits_type::char_class_lower)) + { + id = traits_type::char_class_alpha; + } + } + if(id == 0) + { + fail(REG_ECTYPE); + return NULL; + } + classes.push(id); + started = true; + l = last_none; + } + break; + case traits_type::syntax_dot: + // + // we have a collating element [.collating-name.] + // + if(traits_inst.lookup_collatename(s, base+2, first-2)) + { + --first; + if(s.size() > 1) + has_digraphs = true; + if(s.size())goto char_set_literal; + } + fail(REG_ECOLLATE); + return NULL; + case traits_type::syntax_equal: + // + // we have an equivalence class [=collating-name=] + // + if(traits_inst.lookup_collatename(s, base+2, first-2)) + { + unsigned len = s.size(); + if(len) + { + unsigned i = 0; + while(i < len) + { + s[i] = traits_inst.translate(s[i], (_flags & regbase::icase)); + ++i; + } + traits_string_type s2; + traits_inst.transform_primary(s2, s); + equivalents.push(s2); + started = true; + l = last_none; + break; + } + } + fail(REG_ECOLLATE); + return NULL; + case traits_type::syntax_left_word: + if((started == false) && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_close_set)) + { + ++first; + return add_simple(0, re_detail::syntax_element_word_start); + } + fail(REG_EBRACK); + return NULL; + case traits_type::syntax_right_word: + if((started == false) && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_close_set)) + { + ++first; + return add_simple(0, re_detail::syntax_element_word_end); + } + fail(REG_EBRACK); + return NULL; + default: + if(started == false) + { + unsigned int t = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+1)); + if((t != traits_type::syntax_colon) && (t != traits_type::syntax_dot) && (t != traits_type::syntax_equal)) + { + first = base; + s = (charT)c; + goto char_set_literal; + } + } + fail(REG_EBRACK); + return NULL; + } + if(first == last) + { + fail(REG_EBRACK); + return NULL; + } + continue; + } + case traits_type::syntax_close_set: + if(started == false) + { + s = (charT)c; + goto char_set_literal; + } + done = true; + break; + case traits_type::syntax_dash: + if(!started) + { + s = (charT)c; + goto char_set_literal; + } + ++first; + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_close_set) + { + --first; + s = (charT)c; + goto char_set_literal; + } + if((singles.empty() == true) || (l != last_single)) + { + fail(REG_ERANGE); + return NULL; + } + ranges.push(singles.peek()); + if(singles.peek().size() <= 1) // leave digraphs and ligatures in place + singles.pop(); + l = last_dash; + continue; + case traits_type::syntax_slash: + if(_flags & regbase::escape_in_lists) + { + ++first; + if(first == last) + continue; + switch(traits_inst.syntax_type(*first)) + { + case traits_type::syntax_w: + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + classes.push(traits_type::char_class_word); + started = true; + l = last_none; + ++first; + continue; + case traits_type::syntax_d: + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + classes.push(traits_type::char_class_digit); + started = true; + l = last_none; + ++first; + continue; + case traits_type::syntax_s: + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + classes.push(traits_type::char_class_space); + started = true; + l = last_none; + ++first; + continue; + case traits_type::syntax_l: + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + classes.push(traits_type::char_class_lower); + started = true; + l = last_none; + ++first; + continue; + case traits_type::syntax_u: + if(l == last_dash) + { + fail(REG_ERANGE); + return NULL; + } + classes.push(traits_type::char_class_upper); + started = true; + l = last_none; + ++first; + continue; + case traits_type::syntax_W: + case traits_type::syntax_D: + case traits_type::syntax_S: + case traits_type::syntax_U: + case traits_type::syntax_L: + fail(REG_EESCAPE); + return NULL; + default: + c = parse_escape(first, last); + --first; + s = (charT)c; + goto char_set_literal; + } + } + else + { + s = (charT)c; + goto char_set_literal; + } + default: + s = (charT)c; + char_set_literal: + unsigned i = 0; + // get string length to stop us going past the end of string (DWA) + unsigned len = s.size(); + while(i < len) + { + s[i] = traits_inst.translate(s[i], (_flags & regbase::icase)); + ++i; + } + started = true; + if(l == last_dash) + { + ranges.push(s); + l = last_none; + if(s.size() > 1) // add ligatures to singles list as well + singles.push(s); + } + else + { + singles.push(s); + l = last_single; + } + } + ++first; + } + if(!done) + return NULL; + + re_detail::re_syntax_base* result; + if(has_digraphs) + result = compile_set_aux(singles, ranges, classes, equivalents, isnot, re_detail::_wide_type()); + else + result = compile_set_aux(singles, ranges, classes, equivalents, isnot, re_detail::is_byte::width_type()); + #ifdef __BORLANDC__ + // delayed throw: + if((result == 0) && (_flags & regbase::use_except)) + fail(error_code()); + #endif + return result; +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::compile_set_aux(re_detail::jstack& singles, re_detail::jstack& ranges, re_detail::jstack& classes, re_detail::jstack& equivalents, bool isnot, const re_detail::_wide_type&) +{ + size_type base = data.size(); + data.extend(sizeof(re_detail::re_set_long)); + unsigned int csingles = 0; + unsigned int cranges = 0; + jm_uintfast32_t cclasses = 0; + unsigned int cequivalents = 0; + bool nocollate_state = flags() & regbase::nocollate; + + while(singles.empty() == false) + { + ++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); + singles.pop(); + } + while(ranges.empty() == false) + { + traits_string_type c1, c2; + if(nocollate_state) + c1 = ranges.peek(); + else + traits_inst.transform(c1, ranges.peek()); + ranges.pop(); + if(nocollate_state) + c2 = ranges.peek(); + else + traits_inst.transform(c2, ranges.peek()); + ranges.pop(); + if(c1 < c2) + { + // for some reason bc5 crashes when throwing exceptions + // from here - probably an EH-compiler bug, but hard to + // be sure... + // delay throw to later: + #ifdef __BORLANDC__ + jm_uintfast32_t f = _flags; + _flags &= ~regbase::use_except; + #endif + fail(REG_ERANGE); + #ifdef __BORLANDC__ + _flags = f; + #endif + return NULL; + } + ++cranges; + unsigned len = (re_detail::re_strlen(c1.c_str()) + 1) * sizeof(charT); + std::memcpy(data.extend(len), c1.c_str(), len); + len = (re_detail::re_strlen(c2.c_str()) + 1) * sizeof(charT); + std::memcpy(data.extend(len), c2.c_str(), len); + } + while(classes.empty() == false) + { + cclasses |= classes.peek(); + classes.pop(); + } + while(equivalents.empty() == false) + { + ++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); + equivalents.pop(); + } + + re_detail::re_set_long* dat = (re_detail::re_set_long*)((unsigned char*)data.data() + base); + dat->type = re_detail::syntax_element_long_set; + dat->csingles = csingles; + dat->cranges = cranges; + dat->cclasses = cclasses; + dat->cequivalents = cequivalents; + dat->isnot = isnot; + dat->next.i = 0; + return dat; +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::compile_set_aux(re_detail::jstack& singles, re_detail::jstack& ranges, re_detail::jstack& classes, re_detail::jstack& equivalents, bool isnot, const re_detail::_narrow_type&) +{ + re_detail::re_set* dat = (re_detail::re_set*)data.extend(sizeof(re_detail::re_set)); + std::memset(dat, 0, sizeof(re_detail::re_set)); + + while(singles.empty() == false) + { + dat->_map[(traits_size_type)(traits_uchar_type)*(singles.peek().c_str())] = re_detail::mask_all; + singles.pop(); + } + while(ranges.empty() == false) + { + traits_string_type c1, c2, c3, c4; + + if(flags() & regbase::nocollate) + c1 = ranges.peek(); + else + traits_inst.transform(c1, ranges.peek()); + ranges.pop(); + if(flags() & regbase::nocollate) + c2 = ranges.peek(); + else + traits_inst.transform(c2, ranges.peek()); + ranges.pop(); + + if(c1 < c2) + { + // for some reason bc5 crashes when throwing exceptions + // from here - probably an EH-compiler bug, but hard to + // be sure... + // delay throw to later: + #ifdef __BORLANDC__ + jm_uintfast32_t f = _flags; + _flags &= ~regbase::use_except; + #endif + fail(REG_ERANGE); + #ifdef __BORLANDC__ + _flags = f; + #endif + return NULL; + } + for(unsigned int i = 0; i < 256; ++i) + { + c4 = (charT)i; + if(flags() & regbase::nocollate) + c3 = c4; + else + traits_inst.transform(c3, c4); + if((c3 <= c1) && (c3 >= c2)) + dat->_map[i] = re_detail::mask_all; + } + } + while(equivalents.empty() == false) + { + traits_string_type c1, c2; + for(unsigned int i = 0; i < 256; ++i) + { + c2 = (charT)i; + traits_inst.transform_primary(c1, c2); + if(c1 == equivalents.peek()) + dat->_map[i] = re_detail::mask_all; + } + equivalents.pop(); + } + + jm_uintfast32_t flags = 0; + while(classes.empty() == false) + { + flags |= classes.peek(); + classes.pop(); + } + if(flags) + { + for(unsigned int i = 0; i < 256; ++i) + { + if(traits_inst.is_class(charT(i), flags)) + dat->_map[(traits_uchar_type)traits_inst.translate((charT)i, (_flags & regbase::icase))] = re_detail::mask_all; + } + } + + if(isnot) + { + for(unsigned int i = 0; i < 256; ++i) + { + dat->_map[i] = !dat->_map[i]; + } + } + + dat->type = re_detail::syntax_element_set; + dat->next.i = 0; + return dat; +} + + +template +void BOOST_RE_CALL reg_expression::fixup_apply(re_detail::re_syntax_base* b, unsigned cbraces) +{ + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(bool, Allocator) b_alloc; + + register unsigned char* base = (unsigned char*)b; + register re_detail::re_syntax_base* ptr = b; + bool* pb = 0; + b_alloc a(data.allocator()); + try + { + pb = a.allocate(cbraces); + for(unsigned i = 0; i < cbraces; ++i) + pb[i] = false; + + repeats = 0; + + while(ptr->next.i) + { + switch(ptr->type) + { + case re_detail::syntax_element_rep: + ((re_detail::re_jump*)ptr)->alt.p = (re_detail::re_syntax_base*)(base + ((re_detail::re_jump*)ptr)->alt.i); +#ifdef BOOST_RE_DEBUG + if((re_detail::padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p) && (((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_assert(0 == (padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p)); + } +#endif + ((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 = (re_detail::re_syntax_base*)(base + ((re_detail::re_jump*)ptr)->alt.i); +#ifdef BOOST_RE_DEBUG + if((re_detail::padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p) && (((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_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) ) + { + fail(REG_ESUBREG); + a.deallocate(pb, cbraces); + return; + } + goto rebase; + case re_detail::syntax_element_endmark: + pb[((re_detail::re_brace*)ptr)->index] = true; + goto rebase; + default: + rebase: + ptr->next.p = (re_detail::re_syntax_base*)(base + ptr->next.i); +#ifdef BOOST_RE_DEBUG + if((re_detail::padding_mask & (int)(ptr->next.p)) && (((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))); + } +#endif + ptr = ptr->next.p; + } + } + a.deallocate(pb, cbraces); + pb = 0; + } + catch(...) + { + if(pb) + a.deallocate(pb, cbraces); + throw; + } +} + + +template +unsigned int BOOST_RE_CALL reg_expression::set_expression(const charT* p, const charT* end, flag_type f) +{ + if(p == expression()) + { + traits_string_type s(p, end); + return set_expression(s.c_str(), s.c_str() + s.size(), f); + } + typedef typename traits_type::sentry sentry_t; + sentry_t sent(traits_inst); + if(sent){ + + const charT* base = p; + data.clear(); + _flags = f; + fail(REG_NOERROR); // clear any error + + if(p >= end) + { + fail(REG_EMPTY); + return error_code(); + } + + const charT* ptr = p; + marks = 0; + re_detail::jstack mark(64, data.allocator()); + re_detail::jstack markid(64, data.allocator()); + unsigned int last_mark_popped = 0; + register traits_size_type c; + register re_detail::re_syntax_base* dat; + + unsigned rep_min, rep_max; + + // + // set up header: + // + ++marks; + dat = 0; + + if(_flags & regbase::literal) + { + while(ptr != end) + { + dat = add_literal(dat, traits_inst.translate(*ptr, (_flags & regbase::icase))); + ++ptr; + } + } + + while (ptr < end) + { + c = (traits_size_type)(traits_uchar_type)*ptr; + switch(traits_inst.syntax_type(c)) + { + case traits_type::syntax_open_bracket: + if(_flags & bk_parens) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + open_bracked_jump: + // 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++; + mark.push(data.index(dat)); + ++ptr; + // + // check for perl like (?...) extention syntax + c = (traits_size_type)(traits_uchar_type)*ptr; + if(((_flags & bk_parens) == 0) && (traits_type::syntax_question == traits_inst.syntax_type(c))) + { + ++ptr; + c = (traits_size_type)(traits_uchar_type)*ptr; + switch(traits_inst.syntax_type(c)) + { + case traits_type::syntax_colon: + ((re_detail::re_brace*)dat)->index = 0; + --marks; + markid.pop(); + markid.push(0); + ++ptr; + continue; + case traits_type::syntax_hash: + // comment just skip it: + ((re_detail::re_brace*)dat)->index = 0; + --marks; + markid.pop(); + mark.pop(); + do{ + ++ptr; + c = (traits_size_type)(traits_uchar_type)*ptr; + }while(traits_type::syntax_close_bracket != traits_inst.syntax_type(c)); + ++ptr; + continue; + default: + // + // error, return to standard parsing and let that handle the error: + --ptr; + continue; + } + } + break; + case traits_type::syntax_close_bracket: + if(_flags & bk_parens) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + + close_bracked_jump: + if(dat) + { + data.align(); + dat->next.i = data.size(); + } + + if(mark.empty()) + { + fail(REG_EPAREN); + return error_code(); + } + // 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()); + if(para->type == re_detail::syntax_element_jump) + { + fail(REG_EMPTY); + return error_code(); + } + } + + // pop any pushed alternatives and set the target end destination: + dat = (re_detail::re_syntax_base*)((unsigned char*)data.data() + mark.peek()); + while(dat->type == re_detail::syntax_element_jump) + { + ((re_detail::re_jump*)dat)->alt.i = data.size(); + mark.pop(); + dat = (re_detail::re_jump*)((unsigned char*)data.data() + mark.peek()); + if(mark.empty()) + { + fail(REG_EPAREN); + return error_code(); + } + } + + dat = add_simple(0, re_detail::syntax_element_endmark, sizeof(re_detail::re_brace)); + ((re_detail::re_brace*)dat)->index = markid.peek(); + markid.pop(); + last_mark_popped = mark.peek(); + mark.pop(); + ++ptr; + break; + case traits_type::syntax_char: + dat = add_literal(dat, (charT)c); + ++ptr; + break; + case traits_type::syntax_slash: + if(++ptr == end) + { + fail(REG_EESCAPE); + return error_code(); + } + c = (traits_size_type)(traits_uchar_type)*ptr; + switch(traits_inst.syntax_type(c)) + { + case traits_type::syntax_open_bracket: + if(_flags & bk_parens) + goto open_bracked_jump; + break; + case traits_type::syntax_close_bracket: + if(_flags & bk_parens) + goto close_bracked_jump; + break; + case traits_type::syntax_plus: + if((_flags & bk_plus_qm) && ((_flags & limited_ops) == 0)) + { + rep_min = 1; + rep_max = (unsigned)-1; + goto repeat_jump; + } + break; + case traits_type::syntax_question: + if((_flags & bk_plus_qm) && ((_flags & limited_ops) == 0)) + { + rep_min = 0; + rep_max = 1; + goto repeat_jump; + } + break; + case traits_type::syntax_or: + if(((_flags & bk_vbar) == 0) || (_flags & limited_ops)) + break; + goto alt_string_jump; + case traits_type::syntax_open_brace: + if( ((_flags & bk_braces) == 0) || ((_flags & intervals) == 0)) + break; + + // we have {x} or {x,} or {x,y}: + parse_range(ptr, end, rep_min, rep_max); + goto repeat_jump; + + case traits_type::syntax_digit: + if(_flags & bk_refs) + { + // update previous: + int i = traits_inst.toi((charT)c); + if(i == 0) + { + // we can have \025 which means take char whose + // code is 25 (octal), so parse string: + c = traits_inst.toi(ptr, end, -8); + --ptr; + break; + } + dat = add_simple(dat, re_detail::syntax_element_backref, sizeof(re_detail::re_brace)); + ((re_detail::re_brace*)dat)->index = i; + ++ptr; + continue; + } + break; + case traits_type::syntax_b: // re_detail::syntax_element_word_boundary + dat = add_simple(dat, re_detail::syntax_element_word_boundary); + ++ptr; + continue; + case traits_type::syntax_B: + dat = add_simple(dat, re_detail::syntax_element_within_word); + ++ptr; + continue; + case traits_type::syntax_left_word: + dat = add_simple(dat, re_detail::syntax_element_word_start); + ++ptr; + continue; + case traits_type::syntax_right_word: + dat = add_simple(dat, re_detail::syntax_element_word_end); + ++ptr; + continue; + case traits_type::syntax_w: //re_detail::syntax_element_word_char + dat = compile_set_simple(dat, traits_type::char_class_word); + ++ptr; + continue; + case traits_type::syntax_W: + dat = compile_set_simple(dat, traits_type::char_class_word, true); + ++ptr; + continue; + case traits_type::syntax_d: //re_detail::syntax_element_word_char + dat = compile_set_simple(dat, traits_type::char_class_digit); + ++ptr; + continue; + case traits_type::syntax_D: + dat = compile_set_simple(dat, traits_type::char_class_digit, true); + ++ptr; + continue; + case traits_type::syntax_s: //re_detail::syntax_element_word_char + dat = compile_set_simple(dat, traits_type::char_class_space); + ++ptr; + continue; + case traits_type::syntax_S: + dat = compile_set_simple(dat, traits_type::char_class_space, true); + ++ptr; + continue; + case traits_type::syntax_l: //re_detail::syntax_element_word_char + dat = compile_set_simple(dat, traits_type::char_class_lower); + ++ptr; + continue; + case traits_type::syntax_L: + dat = compile_set_simple(dat, traits_type::char_class_lower, true); + ++ptr; + continue; + case traits_type::syntax_u: //re_detail::syntax_element_word_char + dat = compile_set_simple(dat, traits_type::char_class_upper); + ++ptr; + continue; + case traits_type::syntax_U: + dat = compile_set_simple(dat, traits_type::char_class_upper, true); + ++ptr; + continue; + case traits_type::syntax_Q: + ++ptr; + while(true) + { + if(ptr == end) + { + fail(REG_EESCAPE); + return error_code(); + } + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_slash) + { + ++ptr; + if((ptr != end) && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_E)) + break; + else + { + dat = add_literal(dat, *(ptr-1)); + continue; + } + } + dat = add_literal(dat, *ptr); + ++ptr; + } + ++ptr; + continue; + case traits_type::syntax_C: + dat = add_simple(dat, re_detail::syntax_element_wild); + ++ptr; + continue; + case traits_type::syntax_X: + dat = add_simple(dat, re_detail::syntax_element_combining); + ++ptr; + continue; + case traits_type::syntax_Z: + dat = add_simple(dat, re_detail::syntax_element_soft_buffer_end); + ++ptr; + continue; + case traits_type::syntax_G: + dat = add_simple(dat, re_detail::syntax_element_restart_continue); + ++ptr; + continue; + case traits_type::syntax_start_buffer: + dat = add_simple(dat, re_detail::syntax_element_buffer_start); + ++ptr; + continue; + case traits_type::syntax_end_buffer: + dat = add_simple(dat, re_detail::syntax_element_buffer_end); + ++ptr; + continue; + default: + c = (traits_size_type)(traits_uchar_type)parse_escape(ptr, end); + dat = add_literal(dat, (charT)c); + continue; + } + dat = add_literal(dat, (charT)c); + ++ptr; + break; + case traits_type::syntax_dollar: + dat = add_simple(dat, re_detail::syntax_element_end_line, sizeof(re_detail::re_syntax_base)); + ++ptr; + continue; + case traits_type::syntax_caret: + dat = add_simple(dat, re_detail::syntax_element_start_line, sizeof(re_detail::re_syntax_base)); + ++ptr; + continue; + case traits_type::syntax_dot: + dat = add_simple(dat, re_detail::syntax_element_wild, sizeof(re_detail::re_syntax_base)); + ++ptr; + continue; + case traits_type::syntax_star: + rep_min = 0; + rep_max = (unsigned)-1; + + repeat_jump: + { + unsigned offset; + if(dat == 0) + { + fail(REG_BADRPT); + return error_code(); + } + switch(dat->type) + { + case re_detail::syntax_element_endmark: + offset = last_mark_popped; + break; + case re_detail::syntax_element_literal: + if(((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; + 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; + } + offset = (char*)dat - (char*)data.data(); + break; + case re_detail::syntax_element_backref: + case re_detail::syntax_element_long_set: + case re_detail::syntax_element_set: + case re_detail::syntax_element_wild: + case re_detail::syntax_element_combining: + // we're repeating a single item: + offset = (char*)dat - (char*)data.data(); + break; + default: + fail(REG_BADRPT); + return error_code(); + } + data.align(); + dat->next.i = data.size(); + //unsigned pos = (char*)dat - (char*)data.data(); + + // add the trailing jump: + add_simple(dat, re_detail::syntax_element_jump, re_detail::re_jump_size); + + // 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->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; + move_offsets(dat, re_detail::re_repeater_size); + ++ptr; + // + // now check to see if we have a non-greedy repeat: + if((ptr != end) && (_flags & (limited_ops | bk_plus_qm | bk_braces)) == 0) + { + c = (traits_size_type)(traits_uchar_type)*ptr; + if(traits_type::syntax_question == traits_inst.syntax_type(c)) + { + // OK repeat is non-greedy: + ((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; + continue; + } + case traits_type::syntax_plus: + if(_flags & (bk_plus_qm | limited_ops)) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + rep_min = 1; + rep_max = (unsigned)-1; + goto repeat_jump; + case traits_type::syntax_question: + if(_flags & (bk_plus_qm | limited_ops)) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + rep_min = 0; + rep_max = 1; + goto repeat_jump; + case traits_type::syntax_open_set: + // update previous: + if(dat) + { + data.align(); + dat->next.i = data.size(); + } + // extend: + dat = compile_set(ptr, end); + if(dat == 0) + { + if((_flags & regbase::failbit) == 0) + fail(REG_EBRACK); + return error_code(); + } + break; + case traits_type::syntax_or: + { + if(_flags & (bk_vbar | limited_ops)) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + + alt_string_jump: + + // update previous: + if(dat == 0) + { + // start of pattern can't have empty "|" + fail(REG_EMPTY); + return error_code(); + } + // see if we have an empty alternative: + if(mark.empty() == false) + if(mark.peek() == data.index(dat)) + { + fail(REG_EMPTY); + return error_code(); + } + // extend: + /*dat = */add_simple(dat, re_detail::syntax_element_jump, re_detail::re_jump_size); + data.align(); + + // now work out where to insert: + unsigned int offset = 0; + if(mark.empty() == false) + { + // 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); + offset = base->next.i; + } + re_detail::re_jump* j = (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); + mark.push(data.size() - re_detail::re_jump_size); + ++ptr; + break; + } + case traits_type::syntax_open_brace: + if((_flags & bk_braces) || ((_flags & intervals) == 0)) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + // we have {x} or {x,} or {x,y}: + parse_range(ptr, end, rep_min, rep_max); + goto repeat_jump; + case traits_type::syntax_newline: + if(_flags & newline_alt) + goto alt_string_jump; + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + case traits_type::syntax_close_brace: + if(_flags & bk_braces) + { + dat = add_literal(dat, (charT)c); + ++ptr; + continue; + } + fail(REG_BADPAT); + return error_code(); + default: + dat = add_literal(dat, (charT)c); + ++ptr; + break; + } // switch + } // while + + // + // update previous: + if(dat) + { + data.align(); + dat->next.i = data.size(); + } + + // see if we have an empty alternative: + 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()); + if(para->type == re_detail::syntax_element_jump) + { + fail(REG_EMPTY); + return error_code(); + } + } + // + // set up tail: + // + 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()); + while(dat->type == re_detail::syntax_element_jump) + { + ((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 = (re_detail::re_brace*)data.extend(sizeof(re_detail::re_syntax_base)); + dat->type = re_detail::syntax_element_match; + dat->next.i = 0; + + if(mark.empty() == false) + { + fail(REG_EPAREN); + return error_code(); + } + + // + // allocate space for start _map: + startmap = (unsigned char*)data.extend(256 + ((end - base + 1) * sizeof(charT))); + // + // and copy the expression we just compiled: + _expression = (charT*)((const char*)startmap + 256); + _expression_len = end - base; + std::memcpy(_expression, base, _expression_len * sizeof(charT)); + *(_expression + _expression_len) = charT(0); + + // + // 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); + + // check for error during fixup: + if(_flags & regbase::failbit) + return error_code(); + + // + // finally compile the maps so that we can make intelligent choices + // whenever we encounter an alternative: + compile_maps(); + if(pkmp) + { + re_detail::kmp_free(pkmp, data.allocator()); + pkmp = 0; + } + re_detail::re_syntax_base* sbase = (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)) + { + _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; + pkmp = re_detail::kmp_compile(p1, p2, charT(), re_detail::kmp_translator(_flags®base::icase, &traits_inst), data.allocator()); + } + } + return error_code(); + + } // sentry + return REG_EMPTY; +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::add_simple(re_detail::re_syntax_base* dat, re_detail::syntax_element_type type, unsigned int size) +{ + if(dat) + { + data.align(); + dat->next.i = data.size(); + } + 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->type = type; + dat->next.i = 0; + return dat; +} + +template +re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::add_literal(re_detail::re_syntax_base* dat, charT c) +{ + 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); + } + 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)); + } + return dat; +} + +template +unsigned int BOOST_RE_CALL reg_expression::probe_restart(re_detail::re_syntax_base* dat) +{ + switch(dat->type) + { + case re_detail::syntax_element_startmark: + case re_detail::syntax_element_endmark: + return probe_restart(dat->next.p); + case re_detail::syntax_element_start_line: + return regbase::restart_line; + case re_detail::syntax_element_word_start: + return regbase::restart_word; + case re_detail::syntax_element_buffer_start: + return regbase::restart_buf; + case re_detail::syntax_element_restart_continue: + return regbase::restart_continue; + default: + return regbase::restart_any; + } +} + +template +unsigned int BOOST_RE_CALL reg_expression::fixup_leading_rep(re_detail::re_syntax_base* dat, re_detail::re_syntax_base* end) +{ + unsigned int len = 0; + bool leading_lit = end ? false : true; + while(dat != end) + { + 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)) + { + // 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; + _restart_type = restart_lit; + leading_lit = false; + const charT* p1 = _leading_string; + const charT* p2 = _leading_string + _leading_string_len; + pkmp = re_detail::kmp_compile(p1, p2, charT(), re_detail::kmp_translator(_flags®base::icase, &traits_inst), data.allocator()); + } + break; + case re_detail::syntax_element_wild: + ++len; + leading_lit = false; + break; + case re_detail::syntax_element_match: + return len; + case re_detail::syntax_element_backref: + //case re_detail::syntax_element_jump: + case re_detail::syntax_element_alt: + case re_detail::syntax_element_combining: + return 0; + case re_detail::syntax_element_long_set: + { + // 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; + for(unsigned int i = 0; i < csingles; ++i) + { + if(re_detail::re_strlen(p) > 1) + return 0; + while(*p)++p; + ++p; + } + ++len; + leading_lit = false; + break; + } + case re_detail::syntax_element_set: + ++len; + leading_lit = false; + break; + case re_detail::syntax_element_rep: + if(1 == fixup_leading_rep(dat->next.p, ((re_detail::re_repeat*)dat)->alt.p) ) + { + ((re_detail::re_repeat*)dat)->leading = true; + return len; + } + return 0; + default: + break; + } + dat = dat->next.p; + } + return len; +} + +template +void BOOST_RE_CALL reg_expression::fail(unsigned int err) +{ + error_code_ = err; + if(err) + throw bad_expression(traits_inst.error_string(err)); +} + + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +} // namespace +#endif + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + + +#endif // BOOST_REGEX_COMPILE_HPP + + + + + + + + diff --git a/include/boost/re_detail/regex_config.hpp b/include/boost/re_detail/regex_config.hpp new file mode 100644 index 00000000..7bb16bf0 --- /dev/null +++ b/include/boost/re_detail/regex_config.hpp @@ -0,0 +1,1205 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_config.hpp + * VERSION 3.01 + * DESCRIPTION: auto-configure options for regular expression code. + */ + +#ifndef BOOST_REGEX_CONFIG_HPP +#define BOOST_REGEX_CONFIG_HPP + +/************************************************************************ + +The purpose of this header is to provide compiler and STL configuration +options. Options fall into three categaries (namespaces, compiler and STL), +throughout, the defaults assume that the compiler and STL are fully C++ standard +compliant, features that are not supported on your system may be selectively +turned off by defining the appropriate macros. Borland C++, Borland C++ Builder, +and Microsoft Visual C++ should be auto-recognised and configured. The HP aCC and +SunPro C++ compiler should also be supported - but run configure for best results. +The SGI, HP, Microsoft and Rogue Wave STL's should be auto-recognised and configured. +Do not change this file unless you really really have to, add options to + instead. See for a full list of macros and their usage. + +************************************************************************/ + +#include + +#ifdef __cplusplus +#include +#include +#include +#include +#include +#include +#include +#else +#include +#endif + +/* this will increase in future versions: */ +#define BOOST_RE_VERSION 300 + +// fix: +#if defined(_UNICODE) && !defined(UNICODE) +#define UNICODE +#endif + +#ifndef BOOST_RE_AUTO_CONFIGURE +#if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(__GNUC__) + #define BOOST_RE_PLATFORM_W32 +#endif +#ifdef __BORLANDC__ + + #if __BORLANDC__ < 0x500 + #define BOOST_RE_NO_NAMESPACES + #define BOOST_RE_NO_BOOL + #define BOOST_RE_NO_MUTABLE + #endif + + #if __BORLANDC__ < 0x520 + #define BOOST_RE_NO_WCSTRING + #define BOOST_RE_NO_INT64 + // Early versions of Borlands namespace code can't cope with iterators + // that are in different namespaces from STL code. + #define boost std + #define BOOST_RE_NO_NOT_EQUAL + #endif + + #if __BORLANDC__ < 0x530 + #define BOOST_RE_NO_WCTYPE_H + #define BOOST_RE_NO_WCHAR_H + #define BOOST_RE_OLD_IOSTREAM + #define BOOST_RE_NO_TRICKY_DEFAULT_PARAM + #define BOOST_RE_NO_EXCEPTION_H + #ifndef __WIN32__ + #define BOOST_RE_NO_WCSTRING + #endif + #define BOOST_RE_NO_LOCALE_H + #define BOOST_RE_NO_TEMPLATE_RETURNS + // + // this is a hack to get around buggy namespace support in the + // 0x520 compiler version + #define BOOST_RE_NO_USING + #define BOOST_RE_USING_HACK + #define BOOST_RE_OLD_IOSTREAM + #endif + + #if __BORLANDC__ < 0x540 + #define BOOST_RE_NO_MEMBER_TEMPLATES + // inline contructors exhibit strange behaviour + // under Builder 3 and C++ 5.x when throwing exceptions + #define INLINE_EXCEPTION_BUG + #define BOOST_RE_NESTED_TEMPLATE_DECL + #define BOOST_RE_NO_PARTIAL_FUNC_SPEC + #define BOOST_RE_NO_STRING_DEF_ARGS + #define BOOST_RE_NO_TYPEINFO // bad_cast etc not in namespace std. + #endif + // + // Builder 4 seems to have broken template friend support: + #define BOOST_RE_NO_TEMPLATE_FRIEND + + #if (__BORLANDC__ == 0x550) || (__BORLANDC__ == 0x551) + // problems with std::basic_string and dll RTL: + #if defined(_RTLDLL) && defined(_RWSTD_COMPILE_INSTANTIATE) + #ifdef BOOST_RE_BUILD_DLL + #error _RWSTD_COMPILE_INSTANTIATE must not be defined when building regex++ as a DLL + #else + #pragma warn defining _RWSTD_COMPILE_INSTANTIATE when linking to the DLL version of the RTL may produce memory corruption problems in std::basic_string, as a result of separate versions of basic_string's static data in the RTL and you're exe/dll: be warned!! + #endif + #endif + #ifndef _RTLDLL + // this is harmless for a staic link: + #define _RWSTD_COMPILE_INSTANTIATE + #endif + #endif + + #ifndef _CPPUNWIND + #error exception handling support required + #endif + + #ifdef _Windows + #define BOOST_RE_PLATFORM_WINDOWS + #else + #define BOOST_RE_PLATFORM_DOS + #endif + + #ifndef __WIN32__ + #define BOOST_RE_CALL + #define BOOST_RE_CCALL + #else + #define BOOST_RE_CALL __fastcall + #define BOOST_RE_CCALL __stdcall + #endif + + #define BOOST_RE_INT64t __int64 + #define BOOST_RE_IMM64(val) val##i64 + #define BOOST_RE_NO_CAT + + #ifdef __MT__ + #define BOOST_RE_THREADS + #endif + + // + // VCL support: + // if we're building a console app then there can't be any VCL (can there?) + #if !defined(__CONSOLE__) && !defined(_NO_VCL) + #define BOOST_RE_USE_VCL + #endif + // + // import export options: + #ifdef _RTLDLL + #ifdef BOOST_RE_BUILD_DLL + #define BOOST_RE_IX_DECL __declspec( dllexport ) + #elif !defined(BOOST_REGEX_LIBRARY_INCLUDE_HPP) && !defined(BOOST_RE_NO_LIB) + #define BOOST_RE_IX_DECL __declspec( dllimport ) + #endif + #endif + #include + +#include +#include + +#endif + +// +// only want "real" Visual C++ here: +#if defined(BOOST_MSVC) && !defined(__WATCOMC__) && !defined(__BORLANDC__) && !defined(__GNUC__) && !defined(__MWERKS__) && !defined (__ICL) + #define BOOST_RE_CALL __fastcall + #define BOOST_RE_CCALL __stdcall + + #if BOOST_MSVC < 1100 + #define BOOST_RE_NO_NAMESPACES + #define BOOST_RE_NO_DEFAULT_PARAM + #define BOOST_RE_NO_BOOL + #define BOOST_RE_NO_MUTABLE + #define BOOST_RE_NO_WCSTRING + #define BOOST_RE_NO_LOCALE_H + #define BOOST_RE_NO_TEMPLATE_RETURNS + #define BOOST_RE_NO_INT64 + #endif + + #if BOOST_MSVC < 1200 + #define BOOST_RE_NESTED_TEMPLATE_DECL + #define BOOST_RE_NO_STRING_DEF_ARGS + #endif + + #ifndef _CPPUNWIND + #error exception handling support required + #endif + + #define BOOST_RE_PLATFORM_WINDOWS + // + // no support for nested template classes yet.... + // although this part of VC6 is badly documented + #define BOOST_RE_NO_MEMBER_TEMPLATES + #define BOOST_RE_INT64t __int64 + #define BOOST_RE_IMM64(val) val##i64 + #define BOOST_RE_NO_CAT + #define BOOST_RE_NO_PARTIAL_FUNC_SPEC + #define BOOST_RE_NO_TEMPLATE_FRIEND + + #ifdef _MT + #define BOOST_RE_THREADS + #endif + +#ifdef __cplusplus +#include +#include +#endif +#pragma warning(disable: 4786) +#pragma warning(disable: 4800) +#pragma warning(disable: 4200) +#pragma warning(disable: 4097) +#pragma warning(disable: 4127) + + // + // import export options: + #ifdef _DLL + #ifdef BOOST_RE_BUILD_DLL + #define BOOST_RE_IX_DECL __declspec( dllexport ) + #elif !defined(BOOST_REGEX_LIBRARY_INCLUDE_HPP) && !defined(BOOST_RE_NO_LIB) + #define BOOST_RE_IX_DECL __declspec( dllimport ) + #endif + #endif + #include + +#endif + +#ifdef __GNUC__ + #if (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 91)) + #define BOOST_RE_NO_NAMESPACES + #define BOOST_RE_NO_MUTABLE + #define BOOST_RE_NO_MEMBER_TEMPLATES + #define BOOST_RE_NO_PARTIAL_FUNC_SPEC + #define BOOST_RE_NO_TEMPLATE_FRIEND + #endif + #ifndef __STL_USE_NAMESPACES + //#define BOOST_RE_NO_EXCEPTION_H + #endif + #define BOOST_RE_INT64t long long + #define BOOST_RE_IMM64(val) val##LL + + #ifdef _WIN32 + /* there seems to be a problem with in gcc */ + #define BOOST_RE_LOCALE_C + #define BOOST_RE_NO_W32 + #define BOOST_RE_NO_WCTYPE_H + #define BOOST_RE_NO_TEMPLATE_SWITCH_MERGE + #endif + #define BOOST_RE_NO_CAT + #define BOOST_RE_OLD_IOSTREAM + #define BOOST_RE_NESTED_TEMPLATE_DECL + #define BOOST_RE_NO_WCSTRING + +#endif + +#ifdef __SUNPRO_CC + #if (__SUNPRO_CC < 0x500) + #define BOOST_RE_NO_NAMESPACES + #define BOOST_RE_NO_MUTABLE + #define BOOST_RE_NO_MEMBER_TEMPLATES + #define BOOST_RE_OLD_IOSTREAM + #endif + #ifndef __STL_USE_NAMESPACES + #define BOOST_RE_NO_EXCEPTION_H + #endif + #define BOOST_RE_INT64t long long + #define BOOST_RE_IMM64(val) val##LL + #define BOOST_RE_NESTED_TEMPLATE_DECL + #define BOOST_RE_NO_SWPRINTF + #define BOOST_RE_NO_TEMPLATE_FRIEND +#endif + +#ifdef __HP_aCC + // putative HP aCC support, run configure for + // support tailored to your system.... + #define BOOST_RE_NO_NAMESPACES + #define BOOST_RE_NO_MUTABLE + #define BOOST_RE_NO_MEMBER_TEMPLATES + #define BOOST_RE_OLD_IOSTREAM + #ifndef __STL_USE_NAMESPACES + #define BOOST_RE_NO_EXCEPTION_H + #endif + #define BOOST_RE_INT64t long long + #define BOOST_RE_IMM64(val) val##LL + #define BOOST_RE_NESTED_TEMPLATE_DECL + #define BOOST_RE_NO_TEMPLATE_FRIEND +#endif + + + +#endif // BOOST_RE_AUTO_CONFIGURE + +#ifdef __cplusplus +#ifndef BOOST_RE_NO_WCSTRING +#ifndef BOOST_RE_NO_WCTYPE_H +#include +#endif +#ifndef BOOST_RE_NO_WCHAR_H +#include +#endif +#endif +#endif + +#ifdef BOOST_RE_NO_NAMESPACES +#define BOOST_RE_MAYBE_ACCESS_SPEC :: +#else +#define BOOST_RE_MAYBE_ACCESS_SPEC +#endif + +#if !defined(BOOST_RE_INT64t) || !defined(BOOST_RE_IMM64) +#define BOOST_RE_NO_INT64 +#endif + +#ifndef BOOST_RE_INT32_LONG +typedef unsigned int jm_uintfast32_t; +#else +typedef unsigned long jm_uintfast32_t; +#endif + +#ifndef BOOST_RE_NESTED_TEMPLATE_DECL +#define BOOST_RE_NESTED_TEMPLATE_DECL template +#endif + +#ifndef BOOST_RE_IX_DECL +#define BOOST_RE_IX_DECL +#endif + +#ifndef MB_CUR_MAX +// yuk! +// better make a conservative guess! +#define MB_CUR_MAX 10 +#endif + + +/* everything else is C++: */ + +#ifdef __cplusplus + +/* define macro's to make default parameter declaration easier: */ + +#ifdef BOOST_RE_NO_DEFAULT_PARAM + #define BOOST_RE_DEFAULT_PARAM(x) + #define BOOST_RE_TRICKY_DEFAULT_PARAM(x) +#elif defined(BOOST_RE_NO_TRICKY_DEFAULT_PARAM) + #define BOOST_RE_DEFAULT_PARAM(x) = x + #define BOOST_RE_TRICKY_DEFAULT_PARAM(x) +#else + #define BOOST_RE_DEFAULT_PARAM(x) = x + #define BOOST_RE_TRICKY_DEFAULT_PARAM(x) = x +#endif + +/* STL configuration goes here: */ + +#ifndef BOOST_RE_AUTO_CONFIGURE +#ifdef BOOST_RE_NO_STL + #define BOOST_RE_NO_EXCEPTION_H + #define BOOST_RE_NO_ITERATOR_H + #define BOOST_RE_NO_MEMORY_H + #define BOOST_RE_NO_LOCALE_H + #define BOOST_RE_NO_STRING_H +#endif + +#ifndef BOOST_RE_NO_EXCEPTION_H + #include +#endif + +#ifndef BOOST_RE_NO_ITERATOR_H + #include + + #if defined(__SGI_STL_INTERNAL_ITERATOR_H) || defined(__SGI_STL_ITERATOR_H) + + /* we are using SGI's STL + some of these (std) + may be guesswork: */ + + # if !defined (__SGI_STL_OWN_IOSTREAMS) || defined (__STL_HAS_NO_NEW_IOSTREAMS) || defined (__STL_USE_NO_IOSTREAMS) + // Old IO streams: + #define BOOST_RE_NO_LOCALE_H + #define BOOST_RE_OLD_IOSTREAM + #else + #ifdef __STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS + #define BOOST_RE_USE_FACET(l, m) (*std::_Use_facet(l)) + #endif + #endif + #if !defined(__STL_MEMBER_TEMPLATE_CLASSES) || !defined(__STL_MEMBER_TEMPLATES) + #define BOOST_RE_NO_MEMBER_TEMPLATES + #endif + #define BOOST_RE_NO_TYPEINFO + + #ifdef __STL_NO_BOOL + #define BOOST_RE_NO_BOOL + #endif + #ifdef __STL_LIMITED_DEFAULT_TEMPLATES + #define BOOST_RE_NO_TRICKY_DEFAULT_PARAM + #define BOOST_RE_NO_STRING_DEF_ARGS + #endif + #ifndef __STL_USE_EXCEPTIONS + #error exception handling support required + #endif + + #include + #include + + #define BOOST_RE_ALGO_INCLUDED + + #define BOOST_RE_DISTANCE(i, j, n) do { n = 0; std::distance(i, j, n); } while(false) + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::output_iterator + #define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator + #define BOOST_RE_FWD_ITERATOR(T, D) std::forward_iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::bidirectional_iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::random_access_iterator + + #if defined(__STL_USE_STD_ALLOCATORS) || (defined(__SGI_STL_PORT ) && !defined(__STL_MEMBER_TEMPLATE_CLASSES) && !defined(__STL_MEMBER_TEMPLATES)) + + /* new style allocator's with nested template classes */ + #undef BOOST_RE_NO_MEMBER_TEMPLATES + #define REBIND_INSTANCE(x, y, inst) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other(inst) + #define REBIND_TYPE(x, y) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( std::allocator ) + #define BOOST_RE_DEF_ALLOC(x) std::allocator + + #else /* __STL_USE_STD_ALLOCATORS */ + #define BOOST_RE_OLD_ALLOCATORS + #define REBIND_INSTANCE(x, y, inst) BOOST_RE_MAYBE_ACCESS_SPEC boost::re_detail::re_alloc_binder(inst) + #define REBIND_TYPE(x, y) BOOST_RE_MAYBE_ACCESS_SPEC re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) jm_def_alloc + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC + #endif /* __STL_USE_STD_ALLOCATORS */ + + #define BOOST_RE_STL_DONE + #ifndef __SGI_STL_PORT + //#define BOOST_RE_NO_NOT_EQUAL + #endif + + #elif defined(__STD_ITERATOR__) + + /* Rogue Wave STL */ + + #if defined(RWSTD_NO_MEMBER_TEMPLATES) || defined(RWSTD_NO_MEM_CLASS_TEMPLATES) + #define BOOST_RE_NO_MEMBER_TEMPLATES + #endif + #ifdef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE + #define BOOST_RE_NO_TEMPLATE_RETURNS + #endif + + #ifdef RWSTD_NO_EXCEPTIONS + #error exception handling support required + #endif + + #ifdef RWSTD_NO_MUTABLE + #define BOOST_RE_NO_MUTABLE + #endif + + #ifdef RWSTD_NO_DEFAULT_TEMPLATES + #define BOOST_RE_NO_DEFAULT_PARAM + #define BOOST_RE_NO_TRICKY_DEFAULT_PARAM + #define BOOST_RE_NO_STRING_DEF_ARGS + #endif + + #ifdef _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES + #define BOOST_RE_NO_TRICKY_DEFAULT_PARAM + #define BOOST_RE_NO_STRING_DEF_ARGS + #endif + + #ifdef RWSTD_NO_BOOL + #define BOOST_RE_NO_BOOL + #endif + + #if _RWSTD_VER > 0x020000 + #ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC + #define BOOST_RE_DISTANCE(i, j, n) do { n = 0; std::distance(i, j, n); } while(false) + #else + #define BOOST_RE_DISTANCE(i, j, n) (n = std::distance(i, j)) + #endif + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_FWD_ITERATOR(T, D) std::iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::iterator + #else + #define BOOST_RE_DISTANCE(i, j, n) std::distance(i, j, n)do { n = 0; std::distance(i, j, n); } while(false) + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::output_iterator + #if _RWSTD_VER >= 0x0200 + #define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator + #else + #define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator + #endif + #define BOOST_RE_FWD_ITERATOR(T, D) std::forward_iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::bidirectional_iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::random_access_iterator + #endif + + #include + + #ifdef _RWSTD_ALLOCATOR + + /* new style allocator */ + + #define REBIND_INSTANCE(x, y, inst) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other(inst) + #define REBIND_TYPE(x, y) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( std::allocator ) + #define BOOST_RE_DEF_ALLOC(x) std::allocator + + #else + /* + // old style allocator + // this varies a great deal between versions, and there is no way + // that I can tell of differentiating between them, so use our + // own default allocator... + */ + #define BOOST_RE_OLD_ALLOCATORS + #define REBIND_INSTANCE(x, y, inst) BOOST_RE_MAYBE_ACCESS_SPEC boost::re_detail::re_alloc_binder(inst) + #define REBIND_TYPE(x, y) BOOST_RE_MAYBE_ACCESS_SPEC re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) jm_def_alloc + + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC + + #endif + + #define BOOST_RE_STL_DONE + #if _RWSTD_VER < 0x020100 + #define BOOST_RE_NO_OI_ASSIGN + #endif + + #elif defined (ITERATOR_H) + + /* HP STL */ + + #define BOOST_RE_NO_LOCALE_H + + #include + #define BOOST_RE_ALGO_INCLUDED + + #define BOOST_RE_DISTANCE(i, j, n) std::distance(i, j, n)do { n = 0; std::distance(i, j, n); } while(false) + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::output_iterator + #define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator + #define BOOST_RE_FWD_ITERATOR(T, D) std::forward_iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::bidirectional_iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::random_access_iterator + + /* old style allocator */ + #define BOOST_RE_OLD_ALLOCATORS + #define REBIND_INSTANCE(x, y, inst) BOOST_RE_MAYBE_ACCESS_SPEC boost::re_detail::re_alloc_binder(inst) + #define REBIND_TYPE(x, y) BOOST_RE_MAYBE_ACCESS_SPEC re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) jm_def_alloc + + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC + #define BOOST_RE_NO_NOT_EQUAL + + #define BOOST_RE_STL_DONE + + #elif defined (BOOST_MSVC) + + /* assume we're using MS's own STL (VC++ 5/6) */ + #define BOOST_RE_NO_OI_ASSIGN + + #define BOOST_RE_DISTANCE(i, j, n) n = std::distance(i, j) + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_FWD_ITERATOR(T, D) std::iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::iterator + + /* MS's allocators are rather ambiguous about their properties + at least as far as MSDN is concerned, so play safe: */ + #define BOOST_RE_OLD_ALLOCATORS + #define REBIND_INSTANCE(x, y, inst) BOOST_RE_MAYBE_ACCESS_SPEC boost::re_detail::re_alloc_binder(inst) + #define REBIND_TYPE(x, y) BOOST_RE_MAYBE_ACCESS_SPEC re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) jm_def_alloc + + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC + + #define BOOST_RE_STL_DONE + + #define BOOST_RE_USE_FACET(l, type) std::use_facet(l, (type*)0, true) + #define BOOST_RE_HAS_FACET(l, type) std::has_facet(l, (type*)0) + + + + #else + + /* unknown STL version + try the defaults: */ + + #define BOOST_RE_DISTANCE(i, j, n) std::distance(i, j, n)do { n = 0; std::distance(i, j, n); } while(false) + /* these may be suspect for older libraries */ + #define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator + #define BOOST_RE_FWD_ITERATOR(T, D) std::iterator + #define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator + #define BOOST_RE_RA_ITERATOR(T, D) std::iterator + + #endif /* config */ + +#else /* no at all */ + + #define BOOST_RE_DISTANCE(i, j, n) (n = j - i) + #define BOOST_RE_OUTPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base + #define BOOST_RE_INPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base + #define BOOST_RE_FWD_ITERATOR(T, D) boost::re_detail::dummy_iterator_base + #define BOOST_RE_BIDI_ITERATOR(T, D) boost::re_detail::dummy_iterator_base + #define BOOST_RE_RA_ITERATOR(T, D) boost::re_detail::dummy_iterator_base + + +#endif + +/* now do allocator if not already done */ + +#ifndef BOOST_RE_STL_DONE + + #ifdef BOOST_RE_NO_MEMORY_H + + /* old style allocator */ + + #define BOOST_RE_OLD_ALLOCATORS + + #define REBIND_INSTANCE(x, y, inst) BOOST_RE_MAYBE_ACCESS_SPEC boost::re_detail::re_alloc_binder(inst) + #define REBIND_TYPE(x, y) BOOST_RE_MAYBE_ACCESS_SPEC re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) jm_def_alloc + + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC + + #else + + /* new style allocator's with nested template classes */ + + #define REBIND_INSTANCE(x, y, inst) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other(inst) + #define REBIND_TYPE(x, y) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( std::allocator ) + #define BOOST_RE_DEF_ALLOC(x) std::allocator + + #endif + +#endif +#endif // BOOST_RE_AUTO_CONFIGURE + + + +/* namespace configuration goes here: */ +#define BOOST_RE_USING(x) using namespace x; + + +/* locale configuration goes here */ +#if !defined(BOOST_RE_NO_LOCALE_H) + #include + #define LOCALE_INSTANCE(i) std::locale i; + #define MAYBE_PASS_LOCALE(i) , i + #ifndef BOOST_RE_NO_TEMPLATE_RETURNS + #ifndef BOOST_RE_USE_FACET + #define BOOST_RE_USE_FACET(l, type) std::use_facet< type >(l) + #endif + #ifndef BOOST_RE_HAS_FACET + #define BOOST_RE_HAS_FACET(l, type) std::has_facet< type >(l) + #endif + #else + #ifndef BOOST_RE_USE_FACET + #define BOOST_RE_USE_FACET(l, type) std::use_facet(l, (type*)0) + #endif + #ifndef BOOST_RE_HAS_FACET + #define BOOST_RE_HAS_FACET(l, type) std::has_facet(l, (type*)0) + #endif + #endif +#else + #define LOCALE_INSTANCE(i) + #define MAYBE_PASS_LOCALE(i) +#endif + +/* compiler configuration goes here: */ + +#ifdef BOOST_RE_NO_MUTABLE + #define BOOST_RE_MUTABLE +#else + #define BOOST_RE_MUTABLE mutable +#endif + +#if defined( BOOST_RE_NO_BOOL) && !defined(bool) + #define bool int + #define true 1 + #define false 0 +#endif + +#ifndef BOOST_RE_CALL +#define BOOST_RE_CALL +#endif + +#ifndef BOOST_RE_CCALL +#define BOOST_RE_CCALL +#endif + +#ifndef BOOST_RE_DECL +#define BOOST_RE_DECL +#endif + +#if defined(BOOST_RE_NO_DEFAULT_PARAM) || defined(BOOST_RE_NO_TRICKY_DEFAULT_PARAM) +#define BOOST_RE_NO_STRING_DEF_ARGS +#endif + + + +/* add our class def's if they are needed: */ + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b + #endif +#endif + +// add our destroy functions: + +template +inline void BOOST_RE_CALL jm_destroy(T* t) +{ + t->~T(); + (void)t; // suppress incorrect MSVC compiler warning +} +#if 0 +inline void BOOST_RE_CALL jm_destroy(char* t){} +inline void BOOST_RE_CALL jm_destroy(short* t){} +inline void BOOST_RE_CALL jm_destroy(unsigned short* t){} +inline void BOOST_RE_CALL jm_destroy(int* t){} +inline void BOOST_RE_CALL jm_destroy(unsigned int* t){} +inline void BOOST_RE_CALL jm_destroy(long* t){} +inline void BOOST_RE_CALL jm_destroy(unsigned long* t){} +#endif + +template +inline void BOOST_RE_CALL jm_construct(void* p, const T& t) +{ + new (p) T(t); +} + + +template +class re_alloc_binder : public Allocator +{ +public: + typedef T value_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; + typedef size_t size_type; + typedef std::ptrdiff_t difference_type; + + re_alloc_binder(const Allocator& i); + re_alloc_binder(const re_alloc_binder& o) : Allocator(o) {} + + T* BOOST_RE_CALL allocate(size_t n, size_t /* hint */ = 0) + { return 0 == n ? 0 : (T*) this->Allocator::allocate(n * sizeof(T)); } + void BOOST_RE_CALL deallocate(T *p, size_t n) + { if (0 != n) this->Allocator::deallocate((char*)p, n * sizeof (T)); } + + pointer BOOST_RE_CALL address(reference x) const { return &x; } + const_pointer BOOST_RE_CALL address(const_reference x) const { return &x; } + static size_type BOOST_RE_CALL max_size() { return -1; } + static void BOOST_RE_CALL construct(pointer p, const T& val) { jm_construct(p, val); } + void BOOST_RE_CALL destroy(pointer p) { jm_destroy(p); } + + const Allocator& BOOST_RE_CALL instance()const { return *this; } + +#ifndef BOOST_RE_NO_MEMBER_TEMPLATES + + template + struct rebind + { + typedef re_alloc_binder other; + }; + + template + BOOST_RE_CALL re_alloc_binder(const re_alloc_binder& o) throw() + : Allocator(o.instance()) + { + } +#endif +}; + +template +inline re_alloc_binder::re_alloc_binder(const Allocator &i) + : Allocator(i) +{} + + +// +// class jm_def_alloc +// basically a standard allocator that only allocates bytes... +// think of it as allocator, with a non-standard +// rebind::other typedef. +// +class jm_def_alloc +{ +public: + typedef char value_type; + typedef char* pointer; + typedef const char* const_pointer; + typedef char& reference; + typedef const char& const_reference; + typedef size_t size_type; + typedef std::ptrdiff_t difference_type; + + pointer BOOST_RE_CALL address(reference x) const { return &x; } + const_pointer BOOST_RE_CALL address(const_reference x) const { return &x; } + static size_type BOOST_RE_CALL max_size() { return (size_type)-1; } + static void BOOST_RE_CALL construct(pointer , const char& ) { } + void BOOST_RE_CALL destroy(pointer ) { } + static void * BOOST_RE_CALL allocate(size_t n, size_t /* hint */ = 0) + { + return ::operator new(n); + } + static void BOOST_RE_CALL deallocate(void *p, size_t /*n*/ ) + { + ::operator delete(p); + } + +#ifndef BOOST_RE_NO_MEMBER_TEMPLATES + template + struct rebind + { + typedef re_alloc_binder other; + }; + + template + BOOST_RE_CALL jm_def_alloc(const re_alloc_binder& ) throw() { } +#endif + jm_def_alloc(const jm_def_alloc&) {} + jm_def_alloc() {} +}; + +template +struct dummy_iterator_base +{ + typedef T value_type; + typedef std::ptrdiff_t difference_type; + typedef T* pointer; + typedef T& reference; + //typedef Category iterator_category; +}; + +// we need to absolutely sure that int values are correctly +// translated to bool (true or false) values... +// note that the original HP STL redefines the bool type regardless +// of whether the compiler supports it.... yuk + +#if defined(BOOST_RE_NO_BOOL) || defined(ITERATOR_H) || defined(bool) +#define BOOST_RE_MAKE_BOOL(x) boost::re_detail::boolify(x) + +template +inline bool BOOST_RE_CALL boolify(I val) +{ + return val ? true : false; +} + +#else +#define BOOST_RE_MAKE_BOOL(x) x +#endif + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace re_detail +#ifdef BOOST_RE_NEED_BINDER +using re_detail::re_alloc_binder; +#endif +#ifdef BOOST_RE_NEED_ALLOC +using re_detail::jm_def_alloc; +#endif +} // namespace boost + +#ifdef __GNUC__ +#define INLINE_EXCEPTION_BUG +#endif + +#if !defined(INLINE_EXCEPTION_BUG) || defined(BOOST_RE_NO_TEMPLATE_MERGE) + #define CONSTRUCTOR_INLINE inline +#else + #define CONSTRUCTOR_INLINE +#endif + +#if defined(BOOST_RE_PLATFORM_W32) && !defined(BOOST_RE_LOCALE_W32) && !defined(BOOST_RE_LOCALE_C) && !defined(BOOST_RE_LOCALE_CPP) && !defined(BOOST_RE_NO_W32) +#define BOOST_RE_LOCALE_W32 +#endif + +#if !defined(BOOST_RE_LOCALE_W32) && !defined(BOOST_RE_LOCALE_C) && !defined(BOOST_RE_LOCALE_CPP) +#define BOOST_RE_LOCALE_C +#endif + +#if defined(BOOST_RE_OLD_ALLOCATORS) +#define BOOST_RE_MAYBE_TYPENAME +#else +#define BOOST_RE_MAYBE_TYPENAME typename +#endif + +#if defined(_WIN32) && !defined(BOOST_RE_NO_W32) +#include +#endif + + +/* now do debugging stuff: */ + +#ifdef BOOST_RE_DEBUG + +#ifdef BOOST_RE_OLD_IOSTREAM +#include +#else +#include +using std::cout; +using std::cin; +using std::cerr; +using std::endl; +using std::hex; +using std::dec; +#endif + + #ifndef jm_assert + #define jm_assert(x) if((x) == 0){ cerr << "Assertion failed: " << #x << " in file " << __FILE__ << "and line " << __LINE__ << endl; exit(-1); } + #endif + #ifndef jm_trace + #define jm_trace(x) cerr << x << endl; + #endif + #ifndef jm_instrument + #define jm_instrument jm_trace(__FILE__<<"#"<<__LINE__) + #endif + +namespace boost{ + namespace re_detail{ +class debug_guard +{ +public: + char g1[32]; + const char* pc; + char* pnc; + const char* file; + int line; + char g2[32]; + debug_guard(const char* f, int l, const char* p1 = 0, char* p2 = 0); + ~debug_guard(); +}; + +#define BOOST_RE_GUARD_STACK boost::re_detail::debug_guard sg(__FILE__, __LINE__); +#define BOOST_RE_GUARD_GLOBAL(x) const char g1##x[] = { 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, }; char g2##x[32]; boost::debug_guard g3##x(__FILE__, __LINE__, g1##x, g2##x); + + } // namespace re_detail +} // namespace boost + + #ifdef __BORLANDC__ + #pragma message "macro allocator: " BOOST_RE_DEF_ALLOC_PARAM(wchar_t) + #pragma message "macro jm_input_iterator: " BOOST_RE_INPUT_ITERATOR(char, std::ptrdiff_t) + #pragma message "macro jm_output_iterator: " BOOST_RE_OUTPUT_ITERATOR(char, std::ptrdiff_t) + #pragma message "macro jm_fwd_iterator: " BOOST_RE_FWD_ITERATOR(char, std::ptrdiff_t) + #pragma message "macro jm_bidi_iterator: " BOOST_RE_BIDI_ITERATOR(char, std::ptrdiff_t) + #pragma message "macro jm_ra_iterator: " BOOST_RE_RA_ITERATOR(char, std::ptrdiff_t) + #ifdef BOOST_RE_LOCALE_CPP + #pragma message "locale support enabled" + #endif + #endif + +#else + + #define jm_assert(x) + #define jm_trace(x) + #define BOOST_RE_GUARD_STACK + #define BOOST_RE_GUARD_GLOBAL(x) + #ifndef jm_instrument + #define jm_instrument + #endif + + +#endif + +// +// compiler fixes: + +// fix for namespace problems: +// +// the following are defined as macros which are +// incompatable with std::something syntax, no +// choice but to undef them? +#ifdef memcpy +#undef memcpy +#endif +#ifdef memmove +#undef memmove +#endif +#ifdef memset +#undef memset +#endif +#ifdef sprintf +#undef sprintf +#endif +#ifdef strcat +#undef strcat +#endif +#ifdef strcmp +#undef strcmp +#endif +#ifdef strcpy +#undef strcpy +#endif +#ifdef strlen +#undef strlen +#endif +#ifdef swprintf +#undef swprintf +#endif +#ifdef wcslen +#undef wcslen +#endif +#ifdef wcscpy +#undef wcscpy +#endif +#ifdef wcscmp +#undef wcscmp +#endif +#ifdef isalpha +#undef isalpha +#endif +#ifdef iscntrl +#undef iscntrl +#endif +#ifdef isdigit +#undef isdigit +#endif +#ifdef islower +#undef islower +#endif +#ifdef isupper +#undef isupper +#endif +#ifdef ispunct +#undef ispunct +#endif +#ifdef isspace +#undef isspace +#endif +#ifdef isxdigit +#undef isxdigit +#endif + +#ifdef tolower +#undef tolower +#endif +#ifdef iswalpha +#undef iswalpha +#endif +#ifdef iswcntrl +#undef iswcntrl +#endif +#ifdef iswdigit +#undef iswdigit +#endif +#ifdef iswlower +#undef iswlower +#endif +#ifdef iswpunct +#undef iswpunct +#endif +#ifdef iswspace +#undef iswspace +#endif +#ifdef iswupper +#undef iswupper +#endif +#ifdef iswxdigit +#undef iswxdigit +#endif +#ifdef towlower +#undef towlower +#endif +#ifdef wcsxfrm +#undef wcsxfrm +#endif + +#if defined(BOOST_NO_STDC_NAMESPACE) || (defined(__STL_NO_USING_FOR_GLOBAL_FUNCTIONS) && defined(__SGI_STL_PORT)) +// +// fix namespaces: +namespace std{ + using ::ptrdiff_t; + using ::size_t; + using ::memcpy; + using ::memmove; + using ::memset; + using ::sprintf; + using ::strcat; + using ::strcmp; + using ::strcpy; + using ::strlen; + using ::swprintf; + using ::wcslen; + using ::wcscpy; + using ::wcscmp; + using ::isalpha; + using ::iscntrl; + using ::isdigit; + using ::islower; + using ::isupper; + using ::ispunct; + using ::isspace; + using ::isxdigit; + using ::tolower; + using ::iswalpha; + using ::iswcntrl; + using ::iswdigit; + using ::iswlower; + using ::iswpunct; + using ::iswspace; + using ::iswupper; + using ::iswxdigit; + using ::towlower; + using ::wcsxfrm; + using ::mbstate_t; +} + +#endif + +#if defined(__SGI_STL_PORT) && defined(BOOST_MSVC) && !defined(_MT) && (__SGI_STL_PORT >= 0x400) +#error STLPort libraries require multithread support to be turned on. +#endif + + +#endif /* __cplusplus */ + +#ifndef BOOST_RE_CALL +#define BOOST_RE_CALL +#endif + +#ifndef BOOST_RE_CCALL +#define BOOST_RE_CCALL +#endif + +#ifndef BOOST_RE_DECL +#define BOOST_RE_DECL +#endif + + +#endif // BOOST_REGEX_CONFIG_HPP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/include/boost/re_detail/regex_cstring.hpp b/include/boost/re_detail/regex_cstring.hpp new file mode 100644 index 00000000..ad551a81 --- /dev/null +++ b/include/boost/re_detail/regex_cstring.hpp @@ -0,0 +1,138 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_cstring.hpp + * VERSION 3.01 + * DESCRIPTION: This is an internal header file, do not include directly. + * String support and helper functions, for regular + * expression library. + */ + +#ifndef BOOST_REGEX_CSTRING_HPP +#define BOOST_REGEX_CSTRING_HPP + +#ifndef BOOST_REGEX_CONFIG_HPP +#include +#endif + +#include + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +// +// start by defining some template function aliases for C API functions: +// + +template +size_t BOOST_RE_CALL re_strlen(const charT *s) +{ + size_t len = 0; + while(*s) + { + ++s; + ++len; + } + return len; +} + +inline size_t BOOST_RE_CALL re_strlen(const char *s) +{ + return std::strlen(s); +} + +#ifndef BOOST_RE_NO_WCSTRING + +inline size_t BOOST_RE_CALL re_strlen(const wchar_t *s) +{ + return std::wcslen(s); +} + +#endif + +#ifndef BOOST_RE_NO_WCSTRING +BOOST_RE_IX_DECL void BOOST_RE_CALL re_transform(std::basic_string& out, const std::basic_string& in); +#endif +BOOST_RE_IX_DECL void BOOST_RE_CALL re_transform(std::string& out, const std::string& in); + +template +void BOOST_RE_CALL re_trunc_primary(std::basic_string& s) +{ + for(unsigned int i = 0; i < s.size(); ++i) + { + if(s[i] <= 1) + { + s.erase(i); + break; + } + } +} + +inline char* BOOST_RE_CALL re_strcpy(char *s1, const char *s2) +{ + #if defined(__BORLANDC__) && defined(strcpy) + return ::strcpy(s1, s2); + #else + return std::strcpy(s1, s2); + #endif +} + +#ifndef BOOST_RE_NO_WCSTRING + +inline wchar_t* BOOST_RE_CALL re_strcpy(wchar_t *s1, const wchar_t *s2) +{ + return std::wcscpy(s1, s2); +} + +#endif + + +template +charT* BOOST_RE_CALL re_strdup(const charT* p) +{ + charT* buf = new charT[re_strlen(p) + 1]; + re_strcpy(buf, p); + return buf; +} + +template +inline void BOOST_RE_CALL re_strfree(charT* p) +{ + delete[] p; +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace re_detail +} // namespace boost + +#endif // BOOST_REGEX_CSTRING_HPP + + + diff --git a/include/boost/re_detail/regex_format.hpp b/include/boost/re_detail/regex_format.hpp new file mode 100644 index 00000000..7a3d7cd6 --- /dev/null +++ b/include/boost/re_detail/regex_format.hpp @@ -0,0 +1,574 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_format.hpp + * VERSION 3.01 + * DESCRIPTION: Provides formatting output routines for search and replace + * operations. Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_FORMAT_HPP +#define BOOST_REGEX_FORMAT_HPP + + +namespace boost{ + +enum format_flags_t{ + format_all = 0, // enable all extentions to sytax + format_sed = match_max << 1, // sed style replacement. + format_perl = format_sed << 1, // perl style replacement. + format_no_copy = format_perl << 1, // don't copy non-matching segments. + format_is_if = format_no_copy << 1 // internal use only. +}; + +namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +template +O BOOST_RE_CALL re_copy_out(O out, I first, I last) +{ + while(first != last) + { + *out = *first; + ++out; + ++first; + } + return out; +} + +template +void BOOST_RE_CALL re_skip_format(const charT*& fmt, const traits_type& traits_inst) +{ + // dwa 9/13/00 - suppress incorrect unused parameter warning for MSVC + (void)traits_inst; + + unsigned int parens = 0; + unsigned int c; + while(*fmt) + { + c = traits_inst.syntax_type(*fmt); + if((c == traits_type::syntax_colon) && (parens == 0)) + { + ++fmt; + return; + } + else if(c == traits_type::syntax_close_bracket) + { + if(parens == 0) + { + ++fmt; + return; + } + --parens; + } + else if(c == traits_type::syntax_open_bracket) + ++parens; + else if(c == traits_type::syntax_slash) + { + ++fmt; + if(*fmt == 0) + return; + } + ++fmt; + } +} + +#ifdef BOOST_RE_NO_OI_ASSIGN + +// +// ugly hack for buggy output iterators + +template +inline void oi_assign(T* p, T v) +{ + jm_destroy(p); + jm_construct(p, v); +} + +#else + +template +inline void oi_assign(T* p, T v) +{ + // + // if you get a compile time error in here then you either + // need to rewrite your output iterator to make it assignable + // (as is required by the standard), or define BOOST_RE_NO_OI_ASSIGN + // to use the ugly hack above + *p = v; +} + +#endif + + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +// +// Ugly ugly hack, +// template don't merge if they contain switch statements so declare these +// templates in unnamed namespace (ie with internal linkage), each translation +// unit then gets its own local copy, it works seemlessly but bloats the app. +namespace{ +#endif + +// +// algorithm reg_format: +// takes the result of a match and a format string +// and merges them to produce a new string which +// is sent to an OutputIterator, +// _reg_format_aux does the actual work: +// +template +OutputIterator BOOST_RE_CALL _reg_format_aux(OutputIterator out, + const match_results& m, + const charT*& fmt, + unsigned flags, const traits_type& traits_inst) +{ + const charT* fmt_end = fmt; + while(*fmt_end) ++ fmt_end; + + while(*fmt) + { + switch(traits_inst.syntax_type(*fmt)) + { + case traits_type::syntax_dollar: + if(flags & format_sed) + { + // no perl style replacement, + // $ is an ordinary character: + goto default_opt; + } + ++fmt; + if(*fmt == 0) // oops trailing $ + { + --fmt; + *out = *fmt; + ++out; + return out; + } + switch(traits_inst.syntax_type(*fmt)) + { + case traits_type::syntax_start_buffer: + oi_assign(&out, re_copy_out(out, iterator(m[-1].first), iterator(m[-1].second))); + ++fmt; + continue; + case traits_type::syntax_end_buffer: + oi_assign(&out, re_copy_out(out, iterator(m[-2].first), iterator(m[-2].second))); + ++fmt; + continue; + case traits_type::syntax_digit: + { +expand_sub: + unsigned int index = traits_inst.toi(fmt, fmt_end, 10); + oi_assign(&out, re_copy_out(out, iterator(m[index].first), iterator(m[index].second))); + continue; + } + } + // anything else: + if(*fmt == '&') + { + oi_assign(&out, re_copy_out(out, iterator(m[0].first), iterator(m[0].second))); + ++fmt; + } + else + { + // probably an error, treat as a literal '$' + --fmt; + *out = *fmt; + ++out; + ++fmt; + } + continue; + case traits_type::syntax_slash: + { + // escape sequence: + ++fmt; + charT c(*fmt); + if(*fmt == 0) + { + --fmt; + *out = *fmt; + ++out; + ++fmt; + return out; + } + switch(traits_inst.syntax_type(*fmt)) + { + case traits_type::syntax_a: + c = '\a'; + ++fmt; + break; + case traits_type::syntax_f: + c = '\f'; + ++fmt; + break; + case traits_type::syntax_n: + c = '\n'; + ++fmt; + break; + case traits_type::syntax_r: + c = '\r'; + ++fmt; + break; + case traits_type::syntax_t: + c = '\t'; + ++fmt; + break; + case traits_type::syntax_v: + c = '\v'; + ++fmt; + break; + case traits_type::syntax_x: + ++fmt; + if(fmt == fmt_end) + { + *out = *--fmt; + ++out; + return out; + } + // maybe have \x{ddd} + if(traits_inst.syntax_type(*fmt) == traits_type::syntax_open_brace) + { + ++fmt; + if(fmt == fmt_end) + { + fmt -= 2; + *out = *fmt; + ++out; + ++fmt; + continue; + } + if(traits_inst.is_class(*fmt, traits_type::char_class_xdigit) == false) + { + fmt -= 2; + *out = *fmt; + ++out; + ++fmt; + continue; + } + c = (charT)traits_inst.toi(fmt, fmt_end, -16); + if(traits_inst.syntax_type(*fmt) != traits_type::syntax_close_brace) + { + while(traits_inst.syntax_type(*fmt) != traits_type::syntax_slash) + --fmt; + ++fmt; + *out = *fmt; + ++out; + ++fmt; + continue; + } + ++fmt; + break; + } + else + { + if(traits_inst.is_class(*fmt, traits_type::char_class_xdigit) == false) + { + --fmt; + *out = *fmt; + ++out; + ++fmt; + continue; + } + c = (charT)traits_inst.toi(fmt, fmt_end, -16); + } + break; + case traits_type::syntax_c: + ++fmt; + if(fmt == fmt_end) + { + --fmt; + *out = *fmt; + ++out; + return out; + } + if(((typename traits_type::uchar_type)(*fmt) < (typename traits_type::uchar_type)'@') + || ((typename traits_type::uchar_type)(*fmt) > (typename traits_type::uchar_type)127) ) + { + --fmt; + *out = *fmt; + ++out; + ++fmt; + break; + } + c = (charT)((typename traits_type::uchar_type)(*fmt) - (typename traits_type::uchar_type)'@'); + ++fmt; + break; + case traits_type::syntax_e: + c = (charT)27; + ++fmt; + break; + case traits_type::syntax_digit: + if(flags & format_sed) + goto expand_sub; + else + c = (charT)traits_inst.toi(fmt, fmt_end, -8); + break; + default: + //c = *fmt; + ++fmt; + } + *out = c; + ++out; + continue; + } + case traits_type::syntax_open_bracket: + if(flags & (format_sed|format_perl)) + { + *out = *fmt; + ++out; + ++fmt; + continue; + } + else + { + ++fmt; // recurse + oi_assign(&out, _reg_format_aux(out, m, fmt, flags, traits_inst)); + continue; + } + case traits_type::syntax_close_bracket: + if(flags & (format_sed|format_perl)) + { + *out = *fmt; + ++out; + ++fmt; + continue; + } + else + { + ++fmt; // return from recursion + return out; + } + case traits_type::syntax_colon: + if(flags & format_is_if) + { + ++fmt; + return out; + } + *out = *fmt; + ++out; + ++fmt; + continue; + case traits_type::syntax_question: + { + if(flags & (format_sed|format_perl)) + { + *out = *fmt; + ++out; + ++fmt; + continue; + } + else + { + ++fmt; + if(*fmt == 0) + { + --fmt; + *out = *fmt; + ++out; + ++fmt; + return out; + } + unsigned int id = traits_inst.toi(fmt, fmt_end, 10); + if(m[id].matched) + { + oi_assign(&out, _reg_format_aux(out, m, fmt, flags | format_is_if, traits_inst)); + if(traits_inst.syntax_type(*(fmt-1)) == traits_type::syntax_colon) + re_skip_format(fmt, traits_inst); + } + else + { + re_skip_format(fmt, traits_inst); + if(traits_inst.syntax_type(*(fmt-1)) == traits_type::syntax_colon) + oi_assign(&out, _reg_format_aux(out, m, fmt, flags | format_is_if, traits_inst)); + } + return out; + } + } + default: +default_opt: + if((flags & format_sed) && (*fmt == '&')) + { + oi_assign(&out, re_copy_out(out, iterator(m[0].first), iterator(m[0].second))); + ++fmt; + continue; + } + *out = *fmt; + ++out; + ++fmt; + } + } + + return out; +} + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +} // namespace +#endif + +template +class string_out_iterator +{ + S* out; +public: + string_out_iterator(S& s) : out(&s) {} + string_out_iterator& operator++() { return *this; } + string_out_iterator& operator++(int) { return *this; } + string_out_iterator& operator*() { return *this; } + string_out_iterator& operator=(typename S::value_type v) + { + out->append(1, v); + return *this; + } +}; + +template +class merge_out_predicate +{ + OutputIterator* out; + iterator* last; + const charT* fmt; + unsigned flags; + const traits_type* pt; + +public: + merge_out_predicate(OutputIterator& o, iterator& pi, const charT* f, unsigned format_flags, const traits_type& p) + : out(&o), last(&pi), fmt(f), flags(format_flags), pt(&p){} + + ~merge_out_predicate() {} + bool BOOST_RE_CALL operator()(const boost::match_results& m) + { + const charT* f = fmt; + if(0 == (flags & format_no_copy)) + oi_assign(out, re_copy_out(*out, iterator(m[-1].first), iterator(m[-1].second))); + oi_assign(out, _reg_format_aux(*out, m, f, flags, *pt)); + *last = m[-2].first; + return true; + } +}; + +} // namespace re_detail + +template +OutputIterator BOOST_RE_CALL regex_format(OutputIterator out, + const match_results& m, + const charT* fmt, + unsigned flags = 0 + ) +{ + regex_traits t; + return re_detail::_reg_format_aux(out, m, fmt, flags, t); +} + +template +OutputIterator BOOST_RE_CALL regex_format(OutputIterator out, + const match_results& m, + const std::basic_string& fmt, + unsigned flags = 0 + ) +{ + regex_traits t; + return re_detail::_reg_format_aux(out, m, fmt.c_str(), flags, t); +} + +template +std::basic_string BOOST_RE_CALL regex_format(const match_results& m, const charT* fmt, unsigned flags = 0) +{ + std::basic_string result; + re_detail::string_out_iterator > i(result); + regex_format(i, m, fmt, flags); + return result; +} + +template +std::basic_string BOOST_RE_CALL regex_format(const match_results& m, const std::basic_string& fmt, unsigned flags = 0) +{ + std::basic_string result; + re_detail::string_out_iterator > i(result); + regex_format(i, m, fmt.c_str(), flags); + return result; +} + +template +OutputIterator BOOST_RE_CALL regex_merge(OutputIterator out, + iterator first, + iterator last, + const reg_expression& e, + const charT* fmt, + unsigned int flags = match_default) +{ + iterator l = first; + re_detail::merge_out_predicate oi(out, l, fmt, flags, e.get_traits()); + regex_grep(oi, first, last, e, flags); + return (flags & format_no_copy) ? out : re_detail::re_copy_out(out, l, last); +} + +template +inline OutputIterator BOOST_RE_CALL regex_merge(OutputIterator out, + iterator first, + iterator last, + const reg_expression& e, + const std::basic_string& fmt, + unsigned int flags = match_default) +{ + return regex_merge(out, first, last, e, fmt.c_str(), flags); +} + +template +std::basic_string BOOST_RE_CALL regex_merge(const std::basic_string& s, + const reg_expression& e, + const charT* fmt, + unsigned int flags = match_default) +{ + std::basic_string result; + re_detail::string_out_iterator > i(result); + regex_merge(i, s.begin(), s.end(), e, fmt, flags); + return result; +} + +template +std::basic_string BOOST_RE_CALL regex_merge(const std::basic_string& s, + const reg_expression& e, + const std::basic_string& fmt, + unsigned int flags = match_default) +{ + std::basic_string result; + re_detail::string_out_iterator > i(result); + regex_merge(i, s.begin(), s.end(), e, fmt.c_str(), flags); + return result; +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#endif // BOOST_REGEX_FORMAT_HPP + + + + diff --git a/include/boost/re_detail/regex_kmp.hpp b/include/boost/re_detail/regex_kmp.hpp new file mode 100644 index 00000000..8a4cf0cf --- /dev/null +++ b/include/boost/re_detail/regex_kmp.hpp @@ -0,0 +1,118 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_kmp.hpp + * VERSION 3.01 + * DESCRIPTION: Provides Knuth Morris Pratt search operations. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_KMP_HPP +#define BOOST_REGEX_KMP_HPP + +#ifdef BOOST_REGEX_CONFIG_HPP +#include +#endif + + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +template +struct kmp_info +{ + unsigned int size; + unsigned int len; + const charT* pstr; + int kmp_next[1]; +}; + +template +void kmp_free(kmp_info* pinfo, Allocator a) +{ + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) atype; + atype(a).deallocate((char*)pinfo, pinfo->size); +} + +template +kmp_info* kmp_compile(iterator first, iterator last, charT, Trans translate, Allocator a) +{ + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) atype; + int i, j, m; + i = 0; + BOOST_RE_DISTANCE(first, last, m); + ++m; + unsigned int size = sizeof(kmp_info) + sizeof(int)*m + sizeof(charT)*m; + --m; + // + // allocate struct and fill it in: + // + kmp_info* pinfo = (kmp_info*)atype(a).allocate(size); + pinfo->size = size; + pinfo->len = m; + charT* p = (charT*)((char*)pinfo + sizeof(kmp_info) + sizeof(int)*(m+1)); + pinfo->pstr = p; + while(first != last) + { + *p = translate(*first); + ++first; + ++p; + } + *p = 0; + // + // finally do regular kmp compile: + // + j = pinfo->kmp_next[0] = -1; + while (i < m) + { + while ((j > -1) && (pinfo->pstr[i] != pinfo->pstr[j])) + j = pinfo->kmp_next[j]; + ++i; + ++j; + if (pinfo->pstr[i] == pinfo->pstr[j]) + pinfo->kmp_next[i] = pinfo->kmp_next[j]; + else + pinfo->kmp_next[i] = j; + } + + return pinfo; +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + + } // namepsace re_detail +} // namespace boost + +#endif // BOOST_REGEX_KMP_HPP + + + + + diff --git a/include/boost/re_detail/regex_library_include.hpp b/include/boost/re_detail/regex_library_include.hpp new file mode 100644 index 00000000..ae3521d7 --- /dev/null +++ b/include/boost/re_detail/regex_library_include.hpp @@ -0,0 +1,147 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_libary_include.hpp + * VERSION 3.01 + * DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + + +#ifndef BOOST_REGEX_LIBRARY_INCLUDE_HPP +#define BOOST_REGEX_LIBRARY_INCLUDE_HPP +#ifndef BOOST_RE_NO_LIB + +#if defined(BOOST_MSVC) && !defined(BOOST_RE_BUILD_DLL) +#ifdef __SGI_STL_PORT + #ifdef _DLL + #ifdef _DEBUG + #pragma comment(lib, "vc6-stlport-re300dl.lib") + #else // DEBUG + #pragma comment(lib, "vc6-stlport-re300l.lib") + #endif // _DEBUG + #else // _DLL + #ifdef _MT + #ifdef _DEBUG + #pragma comment(lib, "vc6-stlport-re300dm.lib") + #else //_DEBUG + #pragma comment(lib, "vc6-stlport-re300m.lib") + #endif //_DEBUG + #else //_MT + #ifdef _DEBUG + #pragma comment(lib, "vc6-stlport-re300d.lib") + #else //_DEBUG + #pragma comment(lib, "vc6-stlport-re300.lib") + #endif //_DEBUG + #endif //_MT + #endif //_DLL +#else + #ifdef _DLL + #ifdef _DEBUG + #pragma comment(lib, "vc6-re300dl.lib") + #else // DEBUG + #pragma comment(lib, "vc6-re300l.lib") + #endif // _DEBUG + #else // _DLL + #ifdef _MT + #ifdef _DEBUG + #pragma comment(lib, "vc6-re300dm.lib") + #else //_DEBUG + #pragma comment(lib, "vc6-re300m.lib") + #endif //_DEBUG + #else //_MT + #ifdef _DEBUG + #pragma comment(lib, "vc6-re300d.lib") + #else //_DEBUG + #pragma comment(lib, "vc6-re300.lib") + #endif //_DEBUG + #endif //_MT + #endif //_DLL +#endif // __SGI_STL_PORT +#endif //BOOST_MSVC + + +#if defined(__BORLANDC__) && !defined(BOOST_RE_BUILD_DLL) + + #if __BORLANDC__ < 0x550 + + #ifdef BOOST_RE_USE_VCL + + #ifdef _RTLDLL + #pragma comment(lib, "bcb4re300lv.lib") + #else + #pragma comment(lib, "bcb4re300v.lib") + #endif + + #else // VCL + + #ifdef _RTLDLL + #ifdef __MT__ + #pragma comment(lib, "bcb4re300lm.lib") + #else // __MT__ + #pragma comment(lib, "bcb4re300l.lib") + #endif // __MT__ + #else //_RTLDLL + #ifdef __MT__ + #pragma comment(lib, "bcb4re300m.lib") + #else // __MT__ + #pragma comment(lib, "bcb4re300.lib") + #endif // __MT__ + #endif // _RTLDLL + + #endif // VCL + + #else // C++ Builder 5: + + #ifdef BOOST_RE_USE_VCL + + #ifdef _RTLDLL + #pragma comment(lib, "bcb5re300lv.lib") + #else + #pragma comment(lib, "bcb5re300v.lib") + #endif + + #else // VCL + + #ifdef _RTLDLL + #ifdef __MT__ + #pragma comment(lib, "bcb5re300lm.lib") + #else // __MT__ + #pragma comment(lib, "bcb5re300l.lib") + #endif // __MT__ + #else //_RTLDLL + #ifdef __MT__ + #pragma comment(lib, "bcb5re300m.lib") + #else // __MT__ + #pragma comment(lib, "bcb5re300.lib") + #endif // __MT__ + #endif // _RTLDLL + + #endif // VCL + + #endif + +#endif //__BORLANDC__ + +#endif //BOOST_RE_NO_LIB + +#endif // BOOST_REGEX_LIBRARY_INCLUDE_HPP + + + + diff --git a/include/boost/re_detail/regex_match.hpp b/include/boost/re_detail/regex_match.hpp new file mode 100644 index 00000000..7aae87ab --- /dev/null +++ b/include/boost/re_detail/regex_match.hpp @@ -0,0 +1,1796 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_match.hpp + * VERSION 3.01 + * DESCRIPTION: Regular expression matching algorithms. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + + +#ifndef BOOST_REGEX_MATCH_HPP +#define BOOST_REGEX_MATCH_HPP + + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +template +iterator BOOST_RE_CALL re_is_set_member(iterator next, + iterator last, + re_set_long* set_, + const reg_expression& e) +{ + const charT* p = (const charT*)(set_+1); + iterator ptr; + unsigned int i; + bool icase = e.flags() & regbase::icase; + + if(next == last) return next; + + typedef typename traits_type::string_type traits_string_type; + const traits_type& traits_inst = e.get_traits(); + + // dwa 9/13/00 suppress incorrect MSVC warning - it claims this is never + // referenced + (void)traits_inst; + + // try and match a single character, could be a multi-character + // collating element... + for(i = 0; i < set_->csingles; ++i) + { + ptr = next; + if(*p == 0) + { + // treat null string as special case: + if(traits_inst.translate(*ptr, icase) != *p) + { + while(*p == 0)++p; + continue; + } + return set_->isnot ? next : (ptr == next) ? ++next : ptr; + } + else + { + while(*p && (ptr != last)) + { + if(traits_inst.translate(*ptr, icase) != *p) + break; + ++p; + ++ptr; + } + + if(*p == 0) // if null we've matched + return set_->isnot ? next : (ptr == next) ? ++next : ptr; + + while(*p)++p; + ++p; // skip null + } + } + + charT col = traits_inst.translate(*next, icase); + + + if(set_->cranges || set_->cequivalents) + { + traits_string_type s2(1, col); + traits_string_type s1; + // + // try and match a range, NB only a single character can match + if(set_->cranges) + { + if(e.flags() & regbase::nocollate) + s1 = s2; + else + traits_inst.transform(s1, s2); + for(i = 0; i < set_->cranges; ++i) + { + if(s1 <= p) + { + while(*p)++p; + ++p; + if(s1 >= p) + return set_->isnot ? next : ++next; + } + else + { + // skip first string + while(*p)++p; + ++p; + } + // skip second string + while(*p)++p; + ++p; + } + } + // + // try and match an equivalence class, NB only a single character can match + if(set_->cequivalents) + { + traits_inst.transform_primary(s1, s2); + for(i = 0; i < set_->cequivalents; ++i) + { + if(s1 == p) + return set_->isnot ? next : ++next; + // skip string + while(*p)++p; + ++p; + } + } + } + + if(traits_inst.is_class(col, set_->cclasses) == true) + return set_->isnot ? next : ++next; + return set_->isnot ? ++next : next; +} + +template +class _priv_match_data +{ +public: + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(int, Allocator) i_alloc; + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(iterator, Allocator) it_alloc; + + match_results_base temp_match; + // failure stacks: + jstack, Allocator> matches; + jstack prev_pos; + jstack prev_record; + jstack prev_acc; + int* accumulators; + unsigned int caccumulators; + iterator* loop_starts; + + _priv_match_data(const match_results_base&); + + ~_priv_match_data() + { + free(); + } + void free(); + void set_accumulator_size(unsigned int size); + int* get_accumulators() + { + return accumulators; + } + iterator* get_loop_starts() + { + return loop_starts; + } +}; + +template +_priv_match_data::_priv_match_data(const match_results_base& m) + : temp_match(m), matches(64, m.allocator()), prev_pos(64, m.allocator()), prev_record(64, m.allocator()) +{ + accumulators = 0; + caccumulators = 0; + loop_starts = 0; +} + +template +void _priv_match_data::set_accumulator_size(unsigned int size) +{ + if(size > caccumulators) + { + free(); + caccumulators = size; + accumulators = i_alloc(temp_match.allocator()).allocate(caccumulators); + loop_starts = it_alloc(temp_match.allocator()).allocate(caccumulators); + for(unsigned i = 0; i < caccumulators; ++i) + new (loop_starts + i) iterator(); + } +} + +template +void _priv_match_data::free() +{ + if(caccumulators) + { + //REBIND_INSTANCE(int, Allocator, temp_match.allocator()).deallocate(accumulators, caccumulators); + i_alloc temp1(temp_match.allocator()); + temp1.deallocate(accumulators, caccumulators); + for(unsigned i = 0; i < caccumulators; ++i) + jm_destroy(loop_starts + i); + //REBIND_INSTANCE(iterator, Allocator, temp_match.allocator()).deallocate(loop_starts, caccumulators); + it_alloc temp2(temp_match.allocator()); + temp2.deallocate(loop_starts, caccumulators); + } +} + +template +struct access_t : public reg_expression +{ + typedef typename is_byte::width_type width_type; + typedef reg_expression base_type; + typedef charT char_type; + typedef traits traits_type; + typedef Allocator alloc_type; + + static int repeat_count(const base_type& b) + { return base_type::repeat_count(b); } + static unsigned int restart_type(const base_type& b) + { return base_type::restart_type(b); } + static const re_syntax_base* first(const base_type& b) + { return base_type::first(b); } + static const unsigned char* get_map(const base_type& b) + { return base_type::get_map(b); } + static unsigned int leading_length(const base_type& b) + { return base_type::leading_length(b); } + static const kmp_info* get_kmp(const base_type& b) + { return base_type::get_kmp(b); } + static bool can_start(char_type c, const unsigned char* _map, unsigned char mask) + { + return reg_expression::can_start(c, _map, mask, width_type()); + } +}; + + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +// +// Ugly ugly hack, +// template don't merge if they contain switch statements so declare these +// templates in unnamed namespace (ie with internal linkage), each translation +// unit then gets its own local copy, it works seemlessly but bloats the app. +namespace{ +#endif + +template +bool query_match_aux(iterator first, + iterator last, + match_results& m, + const reg_expression& e, + unsigned flags, + _priv_match_data& pd, + iterator* restart) +{ + typedef access_t access; + + if(e.flags() & regbase::failbit) + return false; + + typedef typename traits::size_type traits_size_type; + typedef typename traits::uchar_type traits_uchar_type; + typedef typename is_byte::width_type width_type; + + // declare some local aliases to reduce pointer loads + // good optimising compilers should make this unnecessary!! + jstack, Allocator>& matches = pd.matches; + jstack& prev_pos = pd.prev_pos; + jstack& prev_record = pd.prev_record; + jstack& prev_acc = pd.prev_acc; + match_results_base& temp_match = pd.temp_match; + temp_match.set_first(first); + + const re_syntax_base* ptr = access::first(e); + bool match_found = false; + bool need_push_match = (e.mark_count() > 1); + int cur_acc = -1; // no active accumulator + pd.set_accumulator_size(access::repeat_count(e)); + int* accumulators = pd.get_accumulators(); + iterator* start_loop = pd.get_loop_starts(); + int k; // for loops + bool icase = e.flags() & regbase::icase; + *restart = first; + iterator base = first; + const traits& traits_inst = e.get_traits(); + // dwa 9/13/00 suppress incorrect MSVC warning - it claims this is never + // referenced + (void)traits_inst; + + // prepare m for failure: + /* + if((flags & match_init) == 0) + { + m.init_fail(first, last); + } */ + + retry: + + while(first != last) + { + jm_assert(ptr); + switch(ptr->type) + { + case syntax_element_match: + match_jump: + { + // match found, save then fallback in case we missed a + // longer one. + if((flags & match_not_null) && (first == temp_match[0].first)) + goto failure; + temp_match.set_second(first); + m.maybe_assign(temp_match); + match_found = true; + if((flags & match_any) || ((first == last) && (need_push_match == false))) + { + // either we don't care what we match or we've matched + // the whole string and can't match anything longer. + while(matches.empty() == false) + matches.pop(); + while(prev_pos.empty() == false) + prev_pos.pop(); + while(prev_record.empty() == false) + prev_record.pop(); + while(prev_acc.empty() == false) + prev_acc.pop(); + return true; + } + } + goto failure; + case syntax_element_startmark: + if(((re_brace*)ptr)->index > 0) + temp_match.set_first(first, ((re_brace*)ptr)->index); + ptr = ptr->next.p; + break; + case syntax_element_endmark: + if(((re_brace*)ptr)->index > 0) + temp_match.set_second(first, ((re_brace*)ptr)->index); + ptr = ptr->next.p; + break; + case syntax_element_literal: + { + unsigned int len = ((re_literal*)ptr)->length; + charT* what = (charT*)(((re_literal*)ptr) + 1); + // + // compare string with what we stored in + // our records: + for(unsigned int i = 0; i < len; ++i, ++first) + { + if((first == last) || (traits_inst.translate(*first, icase) != what[i])) + goto failure; + } + ptr = ptr->next.p; + break; + } + case syntax_element_start_line: + outer_line_check: + if(first == temp_match[0].first) + { + // we're at the start of the buffer + if(flags & match_prev_avail) + { + inner_line_check: + // check the previous value even though its before + // the start of our "buffer". + iterator t(first); + --t; + if(traits::is_separator(*t) && !((*t == '\r') && (*first == '\n')) ) + { + ptr = ptr->next.p; + continue; + } + goto failure; + } + if((flags & match_not_bol) == 0) + { + ptr = ptr->next.p; + continue; + } + goto failure; + } + // we're in the middle of the string + goto inner_line_check; + case syntax_element_end_line: + // we're not yet at the end so *first is always valid: + if(traits::is_separator(*first)) + { + if((first != base) || (flags & match_prev_avail)) + { + // check that we're not in the middle of \r\n sequence + iterator t(first); + --t; + if((*t == '\r') && (*first == '\n')) + { + goto failure; + } + } + ptr = ptr->next.p; + continue; + } + goto failure; + case syntax_element_wild: + // anything except possibly NULL or \n: + if(traits::is_separator(*first)) + { + if(flags & match_not_dot_newline) + goto failure; + ptr = ptr->next.p; + ++first; + continue; + } + if(*first == charT(0)) + { + if(flags & match_not_dot_null) + goto failure; + ptr = ptr->next.p; + ++first; + continue; + } + ptr = ptr->next.p; + ++first; + break; + case syntax_element_word_boundary: + { + // prev and this character must be opposites: + bool b = traits_inst.is_class(*first, traits::char_class_word); + if((first == temp_match[0].first) && ((flags & match_prev_avail) == 0)) + { + if(flags & match_not_bow) + b ^= true; + else + b ^= false; + } + else + { + --first; + b ^= traits_inst.is_class(*first, traits::char_class_word); + ++first; + } + if(b) + { + ptr = ptr->next.p; + continue; + } + goto failure; + } + case syntax_element_within_word: + // both prev and this character must be traits::char_class_word: + if(traits_inst.is_class(*first, traits::char_class_word)) + { + bool b; + if((first == temp_match[0].first) && ((flags & match_prev_avail) == 0)) + b = false; + else + { + --first; + b = traits_inst.is_class(*first, traits::char_class_word); + ++first; + } + if(b) + { + ptr = ptr->next.p; + continue; + } + } + goto failure; + case syntax_element_word_start: + if((first == temp_match[0].first) && ((flags & match_prev_avail) == 0)) + { + // start of buffer: + if(flags & match_not_bow) + goto failure; + if(traits_inst.is_class(*first, traits::char_class_word)) + { + ptr = ptr->next.p; + continue; + } + goto failure; + } + // otherwise inside buffer: + if(traits_inst.is_class(*first, traits::char_class_word)) + { + iterator t(first); + --t; + if(traits_inst.is_class(*t, traits::char_class_word) == false) + { + ptr = ptr->next.p; + continue; + } + } + goto failure; // if we fall through to here then we've failed + case syntax_element_word_end: + if((first == temp_match[0].first) && ((flags & match_prev_avail) == 0)) + goto failure; // start of buffer can't be end of word + + // otherwise inside buffer: + if(traits_inst.is_class(*first, traits::char_class_word) == false) + { + iterator t(first); + --t; + if(traits_inst.is_class(*t, traits::char_class_word)) + { + ptr = ptr->next.p; + continue; + } + } + goto failure; // if we fall through to here then we've failed + case syntax_element_buffer_start: + if((first != temp_match[0].first) || (flags & match_not_bob)) + goto failure; + // OK match: + ptr = ptr->next.p; + break; + case syntax_element_buffer_end: + if((first != last) || (flags & match_not_eob)) + goto failure; + // OK match: + ptr = ptr->next.p; + break; + 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; + while(i != j) + { + if((first == last) || (traits_inst.translate(*first, icase) != traits_inst.translate(*i, icase))) + goto failure; + ++i; + ++first; + } + ptr = ptr->next.p; + break; + } + 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); + if(t != first) + { + ptr = ptr->next.p; + first = t; + continue; + } + goto failure; + } + case syntax_element_set: + // lookup character in table: + if(((re_set*)ptr)->_map[(traits_uchar_type)traits_inst.translate(*first, icase)]) + { + ptr = ptr->next.p; + ++first; + continue; + } + goto failure; + case syntax_element_jump: + ptr = ((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)) + { + // 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(need_push_match) + 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); + } + ptr = ptr->next.p; + continue; + } + if(access::can_start(*first, ((re_jump*)ptr)->_map, mask_skip)) + { + ptr = ((re_jump*)ptr)->alt.p; + continue; + } + goto failure; // neither option is possible + } + case syntax_element_rep: + { + // repeater_jump: + // if we're moving to a higher id (nested repeats etc) + // zero out our accumualtors: + if(cur_acc < ((re_repeat*)ptr)->id) + { + cur_acc = ((re_repeat*)ptr)->id; + accumulators[cur_acc] = 0; + start_loop[cur_acc] = iterator(); + } + + cur_acc = ((re_repeat*)ptr)->id; + + if(((re_repeat*)ptr)->leading) + *restart = first; + + //charT c = traits_inst.translate(*first); + + // first of all test for special case where this is last element, + // 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)) + { + // 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)) + { + // push terminating match as fallback: + if((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min) + { + if((prev_record.empty() == false) && (prev_record.peek() == ((re_repeat*)ptr)->alt.p)) + { + // we already have the required fallback + // don't add any more, just update this one: + if(need_push_match) + matches.peek() = temp_match; + prev_pos.peek() = first; + } + else + { + if(need_push_match) + matches.push(temp_match); + prev_pos.push(first); + prev_record.push(((re_repeat*)ptr)->alt.p); + } + } + // move to next item in list: + if(first != start_loop[cur_acc]) + { + ++accumulators[cur_acc]; + ptr = ptr->next.p; + start_loop[cur_acc] = first; + continue; + } + 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)) + { + ptr = ((re_repeat*)ptr)->alt.p; + continue; + } + // otherwise fail: + goto failure; + } + + // 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)) + { + // 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)) + { + // 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) + || (first != start_loop[cur_acc])) + { + if(need_push_match) + matches.push(temp_match); + prev_pos.push(first); + prev_record.push(ptr); + 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) + { + prev_acc.push(match_found); + match_found = false; + } + } + } + ptr = ((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) && + (first != start_loop[cur_acc])) + { + // move to next item in list: + ++accumulators[cur_acc]; + ptr = ptr->next.p; + start_loop[cur_acc] = first; + continue; + } + + // if we get here then neither option is allowed so fail: + goto failure; + + } + case syntax_element_combining: + if(traits_inst.is_combining(traits_inst.translate(*first, icase))) + goto failure; + ++first; + while((first != last) && traits_inst.is_combining(traits_inst.translate(*first, icase)))++first; + ptr = ptr->next.p; + continue; + case syntax_element_soft_buffer_end: + { + if(flags & match_not_eob) + goto failure; + iterator p(first); + while((p != last) && traits_inst.is_separator(traits_inst.translate(*first, icase)))++p; + if(p != last) + goto failure; + ptr = ptr->next.p; + continue; + } + case syntax_element_restart_continue: + if(first != temp_match[-1].first) + goto failure; + ptr = ptr->next.p; + continue; + default: + jm_assert(0); // should never get to here!! + return false; + } + } + + // + // if we get to here then we've run out of characters to match against, + // we could however still have non-character regex items left + if(ptr->can_be_null == 0) + goto failure; + while(true) + { + jm_assert(ptr); + switch(ptr->type) + { + 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; + case syntax_element_endmark: + temp_match.set_second(first, ((re_brace*)ptr)->index); + ptr = ptr->next.p; + break; + case syntax_element_start_line: + goto outer_line_check; + case syntax_element_end_line: + // we're at the end so *first is never valid: + if((flags & match_not_eol) == 0) + { + ptr = ptr->next.p; + continue; + } + goto failure; + case syntax_element_word_boundary: + case syntax_element_word_end: + if(((flags & match_not_eow) == 0) && (first != temp_match[0].first)) + { + iterator t(first); + --t; + if(traits_inst.is_class(*t, traits::char_class_word)) + { + ptr = ptr->next.p; + continue; + } + } + goto failure; + case syntax_element_buffer_end: + case syntax_element_soft_buffer_end: + if(flags & match_not_eob) + goto failure; + // OK match: + ptr = ptr->next.p; + break; + case syntax_element_jump: + ptr = ((re_jump*)ptr)->alt.p; + continue; + case syntax_element_alt: + if(ptr->can_be_null & mask_take) + { + // we can test the first alternative, + // see if we need to push next alternative: + if(ptr->can_be_null & mask_skip) + { + if(need_push_match) + 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); + } + ptr = ptr->next.p; + continue; + } + if(ptr->can_be_null & mask_skip) + { + ptr = ((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) + { + cur_acc = ((re_repeat*)ptr)->id; + accumulators[cur_acc] = 0; + start_loop[cur_acc] = first; + } + + cur_acc = ((re_repeat*)ptr)->id; + + // see if we can skip the repeat: + if(((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min) + && (ptr->can_be_null & mask_skip)) + { + // don't push failure info, there's no point: + ptr = ((re_repeat*)ptr)->alt.p; + continue; + } + + // otherwise see if we can take the repeat: + if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max) + && ((ptr->can_be_null & (mask_take | mask_skip)) == (mask_take | mask_skip))) + { + // move to next item in list: + ++accumulators[cur_acc]; + ptr = ptr->next.p; + start_loop[cur_acc] = first; + continue; + } + + // if we get here then neither option is allowed so fail: + goto failure; + case syntax_element_restart_continue: + if(first != temp_match[-1].first) + goto failure; + ptr = ptr->next.p; + continue; + default: + goto failure; + } + } + + failure: + + if(prev_record.empty() == false) + { + ptr = prev_record.peek(); + switch(ptr->type) + { + case syntax_element_alt: + // get next alternative: + ptr = ((re_jump*)ptr)->alt.p; + if(need_push_match) + matches.pop(temp_match); + 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(); + goto retry; + case syntax_element_rep: + { + // we're doing least number of repeats first, + // increment count and repeat again: + bool saved_matched = match_found; + if(need_push_match) + matches.pop(temp_match); + prev_pos.pop(first); + cur_acc = ((re_repeat*)ptr)->id; + if(((re_repeat*)ptr)->greedy == false) + { + saved_matched = prev_acc.peek(); + prev_acc.pop(); + } + 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) + 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)) + { + goto failure; + } + else if (match_found == false) + match_found = saved_matched; + ptr = ptr->next.p; + start_loop[cur_acc] = first; + goto retry; + } + case syntax_element_match: + if(need_push_match) + matches.pop(temp_match); + prev_pos.pop(first); + prev_record.pop(); + goto retry; + default: + jm_assert(0); + // mustn't get here!! + } + } + + if(match_found) + return true; + + // if we get to here then everything has failed + // and no match was found: + return false; +} +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +} // namespace +#endif + + +template +void _skip_and_inc(unsigned int& clines, iterator& last_line, iterator& first, const iterator last) +{ + while(first != last) + { + if(*first == '\n') + { + last_line = ++first; + ++clines; + } + else + ++first; + } +} + +template +void _skip_and_dec(unsigned int& clines, iterator& last_line, iterator& first, iterator base, unsigned int len) +{ + bool need_line = false; + for(unsigned int i = 0; i < len; ++i) + { + --first; + if(*first == '\n') + { + need_line = true; + --clines; + } + } + + if(need_line) + { + last_line = first; + + if(last_line != base) + --last_line; + else + return; + + while((last_line != base) && (*last_line != '\n')) + --last_line; + if(*last_line == '\n') + ++last_line; + } +} + +template +inline void _inc_one(unsigned int& clines, iterator& last_line, iterator& first) +{ + if(*first == '\n') + { + last_line = ++first; + ++clines; + } + else + ++first; +} + +template +struct grep_search_predicate +{ + match_results* pm; + grep_search_predicate(match_results* p) : pm(p) {} + bool operator()(const match_results& m) + { + *pm = static_cast&>(m); + return false; + } +}; + +#if !defined(BOOST_RE_NO_TEMPLATE_RETURNS) && !defined(BOOST_RE_NO_PARTIAL_FUNC_SPEC) + +template +inline const match_results_base& grep_out_type(const grep_search_predicate& o, const Allocator&) +{ + return *(o.pm); +} + +#endif + +template +inline const Allocator& grep_out_type(const T&, const Allocator& a) +{ + return a; +} + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +// +// Ugly ugly hack, +// template don't merge if they contain switch statements so declare these +// templates in unnamed namespace (ie with internal linkage), each translation +// unit then gets its own local copy, it works seemlessly but bloats the app. +namespace{ +#endif + +// +// reg_grep2: +// find all non-overlapping matches within the sequence first last: +// +template +unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression& e, unsigned flags, A2 a) +{ + typedef access_t access; + + if(e.flags() & regbase::failbit) + return 0; + + typedef typename traits::size_type traits_size_type; + typedef typename traits::uchar_type traits_uchar_type; + typedef typename is_byte::width_type width_type; + + match_results m(grep_out_type(foo, a)); + I restart; + m.set_size(e.mark_count(), first, last); + m.set_line(1, first); + m.set_base(first); + + unsigned int clines = 1; + unsigned int cmatches = 0; + I last_line = first; + I next_base; + I base = first; + bool need_init; + const traits& traits_inst = e.get_traits(); + // dwa 9/13/00 suppress incorrect MSVC warning - it claims this is never + // referenced + (void)traits_inst; + + flags |= match_init; + + _priv_match_data pd(m); + + const unsigned char* _map = access::get_map(e); + unsigned int type; + + if(first == last) + { + // special case, only test if can_be_null, + // don't dereference any pointers!! + if(access::first(e)->can_be_null) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + foo(m); + ++cmatches; + } + } + return cmatches; + } + + // try one time whatever: + if( access::can_start(*first, _map, (unsigned char)mask_any) ) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + // trying to match again with match_not_null set if this + // is a null match... + need_init = true; + if(first == m[0].second) + { + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + if(query_match_aux(first, last, m, e, flags | match_not_null, pd, &restart)) + { + ++cmatches; + if(foo(m) == false) + return cmatches; + } + else + { + need_init = false; + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart); + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + if(need_init) + { + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + } + } + else + { + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart); + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + else + _inc_one(clines, last_line, first); + flags |= match_prev_avail | match_not_bob; + + + // depending on what the first record is we may be able to + // optimise the search: + type = (flags & match_continuous) ? regbase::restart_continue : access::restart_type(e); + + if(type == regbase::restart_buf) + return cmatches; + + switch(type) + { + case regbase::restart_lit: + case regbase::restart_fixed_lit: + { + const kmp_info* info = access::get_kmp(e); + int len = info->len; + const charT* x = info->pstr; + int j = 0; + bool icase = e.flags() & regbase::icase; + while (first != last) + { + while((j > -1) && (x[j] != traits_inst.translate(*first, icase))) + j = info->kmp_next[j]; + _inc_one(clines, last_line, first); + ++j; + if(j >= len) + { + if(type == regbase::restart_fixed_lit) + { + _skip_and_dec(clines, last_line, first, base, j); + restart = first; + restart += len; + m.set_first(first); + m.set_second(restart); + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + _skip_and_inc(clines, last_line, first, restart); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + j = 0; + } + else + { + restart = first; + _skip_and_dec(clines, last_line, first, base, j); + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + j = 0; + } + else + { + for(int k = 0; (restart != first) && (k < j); ++k, --restart); + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + j = 0; //we could do better than this... + } + } + } + } + break; + } + case regbase::restart_any: + { + while(first != last) + { + if( access::can_start(*first, _map, (unsigned char)mask_any) ) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + // trying to match again with match_not_null set if this + // is a null match... + need_init = true; + if(first == m[0].second) + { + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + if(query_match_aux(first, last, m, e, flags | match_not_null, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + } + else + { + need_init = false; + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart); + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + if(need_init) + { + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + } + continue; + } + else + { + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart); + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + else + _inc_one(clines, last_line, first); + } + } + break; + case regbase::restart_word: + { + // do search optimised for word starts: + while(first != last) + { + --first; + if(*first == '\n') + --clines; + // skip the word characters: + while((first != last) && traits_inst.is_class(*first, traits::char_class_word)) + ++first; + // now skip the white space: + while((first != last) && (traits_inst.is_class(*first, traits::char_class_word) == false)) + { + #ifdef __GNUC__ + // + // hack to work around gcc optimisation bug + // just expand the contents of _inc_one here: + if(*first == '\n') + { + last_line = ++first; + ++clines; + } + else + ++first; + #else + _inc_one(clines, last_line, first); + #endif + } + if(first == last) + break; + + if( access::can_start(*first, _map, (unsigned char)mask_any) ) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + // trying to match again with match_not_null set if this + // is a null match... + need_init = true; + if(first == m[0].second) + { + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + if(query_match_aux(first, last, m, e, flags | match_not_null, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + } + else + { + need_init = false; + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart); + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + if(need_init) + { + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + } + } + else + { + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart); + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + else + _inc_one(clines, last_line, first); + } + } + break; + case regbase::restart_line: + { + // do search optimised for line starts: + while(first != last) + { + // find first charcter after a line break: + --first; + if(*first == '\n') + --clines; + while((first != last) && (*first != '\n')) + ++first; + if(first == last) + break; + ++first; + if(first == last) + break; + + ++clines; + last_line = first; + + if( access::can_start(*first, _map, (unsigned char)mask_any) ) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + // trying to match again with match_not_null set if this + // is a null match... + need_init = true; + if(first == m[0].second) + { + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + if(query_match_aux(first, last, m, e, flags | match_not_null, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + } + else + { + need_init = false; + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart); + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + if(need_init) + { + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + } + } + else + { + for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart); + if(restart != last) + ++restart; + _skip_and_inc(clines, last_line, first, restart); + } + } + else + _inc_one(clines, last_line, first); + } + } + break; + case regbase::restart_continue: + { + while(first != last) + { + if( access::can_start(*first, _map, (unsigned char)mask_any) ) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + // update to end of what matched + // trying to match again with match_not_null set if this + // is a null match... + if(first == m[0].second) + { + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + if(query_match_aux(first, last, m, e, flags | match_not_null, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + } + else + return cmatches; // can't continue from null match + } + _skip_and_inc(clines, last_line, first, m[0].second); + next_base = m[0].second; + pd.temp_match.init_fail(next_base, last); + m.init_fail(next_base, last); + continue; + } + } + return cmatches; + } + } + break; + } + + + // finally check trailing null string: + if(access::first(e)->can_be_null) + { + if(query_match_aux(first, last, m, e, flags, pd, &restart)) + { + m.set_line(clines, last_line); + ++cmatches; + if(foo(m) == false) + return cmatches; + } + } + + return cmatches; +} +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +} // namespace {anon} +#endif + +} // namespace re_detail + +// +// proc regex_match +// returns true if the specified regular expression matches +// the whole of the input. Fills in what matched in m. +// +template +bool regex_match(iterator first, iterator last, match_results& m, const reg_expression& e, unsigned flags = match_default) +{ + // prepare m for failure: + if((flags & match_init) == 0) + { + m.set_size(e.mark_count(), first, last); + m.set_base(first); + m.set_line(1, first); + } + re_detail::_priv_match_data pd(m); + iterator restart; + bool result = re_detail::query_match_aux(first, last, m, e, flags, pd, &restart); + if(result && (last == m[0].second)) + return true; + return false; +} +template +bool regex_match(iterator first, iterator last, const reg_expression& e, unsigned flags = match_default) +{ + match_results m; + return regex_match(first, last, e, flags); +} +// +// query_match convenience interfaces: +#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC +// +// this isn't really a partial specialisation, but template function +// overloading - if the compiler doesn't support partial specialisation +// then it really won't support this either: +template +inline bool regex_match(const charT* str, + match_results& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_match(str, str + traits::length(str), m, e, flags); +} + +template +inline bool regex_match(const std::basic_string& s, + match_results::const_iterator, Allocator>& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_match(s.begin(), s.end(), m, e, flags); +} +template +inline bool regex_match(const charT* str, + const reg_expression& e, + unsigned flags = match_default) +{ + match_results m; + return regex_match(str, str + traits::length(str), m, e, flags); +} + +template +inline bool regex_match(const std::basic_string& s, + const reg_expression& e, + unsigned flags = match_default) +{ + typedef typename std::basic_string::const_iterator iterator; + match_results m; + return regex_match(s.begin(), s.end(), m, e, flags); +} +#else // partial ordering +inline bool regex_match(const char* str, + cmatch& m, + const regex& e, + unsigned flags = match_default) +{ + return regex_match(str, str + regex::traits_type::length(str), m, e, flags); +} +inline bool regex_match(const char* str, + const regex& e, + unsigned flags = match_default) +{ + match_results m; + return regex_match(str, str + regex::traits_type::length(str), m, e, flags); +} +#ifndef BOOST_RE_NO_WCSTRING +inline bool regex_match(const wchar_t* str, + wcmatch& m, + const wregex& e, + unsigned flags = match_default) +{ + return regex_match(str, str + wregex::traits_type::length(str), m, e, flags); +} +inline bool regex_match(const wchar_t* str, + const wregex& e, + unsigned flags = match_default) +{ + match_results m; + return regex_match(str, str + wregex::traits_type::length(str), m, e, flags); +} +#endif +inline bool regex_match(const std::string& s, + match_results& m, + const regex& e, + unsigned flags = match_default) +{ + return regex_match(s.begin(), s.end(), m, e, flags); +} +inline bool regex_match(const std::string& s, + const regex& e, + unsigned flags = match_default) +{ + match_results m; + return regex_match(s.begin(), s.end(), m, e, flags); +} +#if !defined(BOOST_RE_NO_WCSTRING) +inline bool regex_match(const std::basic_string& s, + match_results::const_iterator, wregex::allocator_type>& m, + const wregex& e, + unsigned flags = match_default) +{ + return regex_match(s.begin(), s.end(), m, e, flags); +} +inline bool regex_match(const std::basic_string& s, + const wregex& e, + unsigned flags = match_default) +{ + match_results::const_iterator, wregex::allocator_type> m; + return regex_match(s.begin(), s.end(), m, e, flags); +} +#endif + +#endif + +template +bool regex_search(iterator first, iterator last, match_results& m, const reg_expression& e, unsigned flags = match_default) +{ + if(e.flags() & regbase::failbit) + return false; + + typedef typename traits::size_type traits_size_type; + typedef typename traits::uchar_type traits_uchar_type; + + return re_detail::reg_grep2(re_detail::grep_search_predicate(&m), first, last, e, flags, m.allocator()); +} + +// +// regex_search convenience interfaces: +#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC +// +// this isn't really a partial specialisation, but template function +// overloading - if the compiler doesn't support partial specialisation +// then it really won't support this either: +template +inline bool regex_search(const charT* str, + match_results& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_search(str, str + traits::length(str), m, e, flags); +} + +template +inline bool regex_search(const std::basic_string& s, + match_results::const_iterator, Allocator>& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_search(s.begin(), s.end(), m, e, flags); +} +#else // partial specialisation +inline bool regex_search(const char* str, + cmatch& m, + const regex& e, + unsigned flags = match_default) +{ + return regex_search(str, str + regex::traits_type::length(str), m, e, flags); +} +#ifndef BOOST_RE_NO_WCSTRING +inline bool regex_search(const wchar_t* str, + wcmatch& m, + const wregex& e, + unsigned flags = match_default) +{ + return regex_search(str, str + wregex::traits_type::length(str), m, e, flags); +} +#endif +inline bool regex_search(const std::string& s, + match_results& m, + const regex& e, + unsigned flags = match_default) +{ + return regex_search(s.begin(), s.end(), m, e, flags); +} +#if !defined(BOOST_RE_NO_WCSTRING) +inline bool regex_search(const std::basic_string& s, + match_results::const_iterator, wregex::allocator_type>& m, + const wregex& e, + unsigned flags = match_default) +{ + return regex_search(s.begin(), s.end(), m, e, flags); +} +#endif + +#endif + + +// +// regex_grep: +// find all non-overlapping matches within the sequence first last: +// +template +inline unsigned int regex_grep(Predicate foo, iterator first, iterator last, const reg_expression& e, unsigned flags = match_default) +{ + return re_detail::reg_grep2(foo, first, last, e, flags, e.allocator()); +} + +// +// regex_grep convenience interfaces: +#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC +// +// this isn't really a partial specialisation, but template function +// overloading - if the compiler doesn't support partial specialisation +// then it really won't support this either: +template +inline unsigned int regex_grep(Predicate foo, const charT* str, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_grep(foo, str, str + traits::length(str), e, flags); +} + +template +inline unsigned int regex_grep(Predicate foo, const std::basic_string& s, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_grep(foo, s.begin(), s.end(), e, flags); +} +#else // partial specialisation +inline unsigned int regex_grep(bool (*foo)(const cmatch&), const char* str, + const regex& e, + unsigned flags = match_default) +{ + return regex_grep(foo, str, str + regex::traits_type::length(str), e, flags); +} +#ifndef BOOST_RE_NO_WCSTRING +inline unsigned int regex_grep(bool (*foo)(const wcmatch&), const wchar_t* str, + const wregex& e, + unsigned flags = match_default) +{ + return regex_grep(foo, str, str + wregex::traits_type::length(str), e, flags); +} +#endif +inline unsigned int regex_grep(bool (*foo)(const match_results&), const std::string& s, + const regex& e, + unsigned flags = match_default) +{ + return regex_grep(foo, s.begin(), s.end(), e, flags); +} +#if !defined(BOOST_RE_NO_WCSTRING) +inline unsigned int regex_grep(bool (*foo)(const match_results::const_iterator, wregex::allocator_type>&), + const std::basic_string& s, + const wregex& e, + unsigned flags = match_default) +{ + return regex_grep(foo, s.begin(), s.end(), e, flags); +} +#endif + +#endif + + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#endif // BOOST_REGEX_MATCH_HPP + + + + + + + + + + diff --git a/include/boost/re_detail/regex_options.hpp b/include/boost/re_detail/regex_options.hpp new file mode 100644 index 00000000..1b86792d --- /dev/null +++ b/include/boost/re_detail/regex_options.hpp @@ -0,0 +1,467 @@ + +#ifndef BOOST_RE_OPT_H +#define BOOST_RE_OPT_H + +#undef BOOST_RE_AUTO_CONFIGURE +#ifdef BOOST_RE_AUTO_CONFIGURE + +/* Compiler options: */ + +/* BOOST_NO_STDC_NAMESPACE C library not in namespace std */ +#undef BOOST_NO_STDC_NAMESPACE + +/* BOOST_RE_NO_MUTABLE Disables use of mutable keyword. */ +#undef BOOST_RE_NO_MUTABLE + +/* BOOST_RE_INT32_LONG If 32-bit integers are long */ +#undef BOOST_RE_INT32_LONG + +/* BOOST_RE_NO_TEMPLATE_FRIEND If template friend declarations are not supported */ +#undef BOOST_RE_NO_TEMPLATE_FRIEND + +/* BOOST_RE_PLATFORM_WINDOWS Platform is MS Windows. */ +#undef BOOST_RE_PLATFORM_WINDOWS + +/* BOOST_RE_PLATFORM_DOS Platform if MSDOS. */ +#undef BOOST_RE_PLATFORM_DOS + +/* BOOST_RE_PLATFORM_W32 Platform is MS Win32 */ +#undef BOOST_RE_PLATFORM_W32 + +/* BOOST_RE_NO_W32 Disable Win32 support even when present */ +#undef BOOST_RE_NO_W32 + +/* BOOST_RE_NO_BOOL If bool is not a distict type. */ +#undef BOOST_RE_NO_BOOL + +/* BOOST_RE_NO_WCHAR_H If there is no */ +#undef BOOST_RE_NO_WCHAR_H + +/* BOOST_RE_NO_WCTYPE_H If there is no */ +#undef BOOST_RE_NO_WCTYPE_H + +/* BOOST_RE_NO_WCSTRING If there are no wcslen and wcsncmp functions available. */ +#undef BOOST_RE_NO_WCSTRING + +/* BOOST_RE_NO_SWPRINTF If there is no swprintf available. */ +#undef BOOST_RE_NO_SWPRINTF + +/* BOOST_RE_NO_WSPRINTF If there is no wsprintf available. */ +#undef BOOST_RE_NO_WSPRINTF + +/* BOOST_RE_NO_MEMBER_TEMPLATES If member function templates or nested template classes are not allowed. */ +#undef BOOST_RE_NO_MEMBER_TEMPLATES + +/* BOOST_RE_NO_TEMPLATE_RETURNS If template functions based on return type are not supported. */ +#undef BOOST_RE_NO_TEMPLATE_RETURNS + +/* BOOST_RE_NO_PARTIAL_FUNC_SPEC If partial template function specialisation is not supported */ +#undef BOOST_RE_NO_PARTIAL_FUNC_SPEC + +/* BOOST_RE_NO_INT64 If 64bit integers are not supported. */ +/* BOOST_RE_INT64t The type of a 64-bit signed integer if available. */ +/* BOOST_RE_IMM64(val) Declares a 64-bit immediate value by appending any + necessary suffix to val. */ +/* BOOST_RE_INT64_T 0 = NA + 1 = short + 2 = int + 3 = long + 4 = int64_t + 5 = long long + 6 = __int64 */ +#undef BOOST_RE_INT64_T_0 +#undef BOOST_RE_INT64_T_1 +#undef BOOST_RE_INT64_T_2 +#undef BOOST_RE_INT64_T_3 +#undef BOOST_RE_INT64_T_4 +#undef BOOST_RE_INT64_T_5 +#undef BOOST_RE_INT64_T_6 + +/* BOOST_RE_NO_CAT Define if the compiler does not support POSIX style + message categories (catopen catgets catclose). */ +#undef BOOST_RE_NO_CAT + +/* BOOST_RE_THREADS Define if the compiler supports multiple threads in + the current translation mode. */ +#undef BOOST_RE_THREADS + +/* BOOST_RE_NESTED_TEMPLATE_DECL Defaults to template, the standard prefix when accessing + nested template classes, can be redefined to nothing if + the compiler does not support this. */ +#undef BOOST_RE_NESTED_TEMPLATE_DECL + +/* BOOST_RE_NO_TEMPLATE_INST If explicit template instantiation with the "template class X" + syntax is not supported */ +#undef BOOST_RE_NO_TEMPLATE_INST + +/* BOOST_RE_NO_TEMPLATE_MERGE If template in separate translation units don't merge at link time */ +#undef BOOST_RE_NO_TEMPLATE_MERGE + +/* BOOST_RE_NO_TEMPLATE_MERGE_A If template merging from library archives is not supported */ +#undef BOOST_RE_NO_TEMPLATE_MERGE_A + +/* BOOST_RE_NO_TEMPLATE_SWITCH_MERGE If merging of templates containing switch statements is not supported */ +#undef BOOST_RE_NO_TEMPLATE_SWITCH_MERGE + +/* BOOST_RE_CALL Optionally define a calling convention for C++ functions */ +#undef BOOST_RE_CALL + +/* BOOST_RE_CCALL Optionally define a calling convention for C functions */ +#undef BOOST_RE_CCALL + +/* BOOST_RE_SIZEOF_SHORT sizeof(short) */ +#undef BOOST_RE_SIZEOF_SHORT + +/* BOOST_RE_SIZEOF_INT sizeof(int) */ +#undef BOOST_RE_SIZEOF_INT + +/* BOOST_RE_SIZEOF_LONG sizeof(long) */ +#undef BOOST_RE_SIZEOF_LONG + +/* BOOST_RE_SIZEOF_WCHAR_T sizeof(wchar_t) */ +#undef BOOST_RE_SIZEOF_WCHAR_T + + +/* STL options: */ + +/* BOOST_RE_NO_EXCEPTION_H Define if you do not a compliant + header file. */ +#undef BOOST_RE_NO_EXCEPTION_H + +/* BOOST_RE_NO_ITERATOR_H Define if you do not have a version of . */ +#undef BOOST_RE_NO_ITERATOR_H + +/* BOOST_RE_NO_MEMORY_H Define if does not fully comply with the + latest standard, and is not auto-recognised, + that means nested template classes + which hardly any compilers support at present. */ +#undef BOOST_RE_NO_MEMORY_H + +/* BOOST_RE_NO_LOCALE_H Define if there is no verion of the standard + header available. */ +#undef BOOST_RE_NO_LOCALE_H + +/* BOOST_RE_NO_STL Disables the use of any supporting STL code. */ +#undef BOOST_RE_NO_STL + +/* BOOST_RE_NO_NOT_EQUAL Disables the generation of operator!= if this + clashes with the STL version. */ + +/* BOOST_RE_NO_STRING_DEF_ARGS Define if std::basic_string not allowed - in + other words if the template is missing its required + default arguments. */ +#undef BOOST_RE_NO_STRING_DEF_ARGS + +/* BOOST_RE_USE_ALGO If not is present */ +#undef BOOST_RE_USE_ALGO + +/* BOOST_RE_OLD_IOSTREAM If the new iostreamm classes are not available */ +#undef BOOST_RE_OLD_IOSTREAM + +/* BOOST_RE_DISTANCE_T For std::distance: + 0 = NA + 1 = std::distance(i, j, n) + 2 = n = std::distance(i, j) */ +#undef BOOST_RE_DISTANCE_T_0 +#undef BOOST_RE_DISTANCE_T_1 +#undef BOOST_RE_DISTANCE_T_2 + +/* BOOST_RE_ITERATOR_T Defines generic standard iterator type if available, use this as + a shortcut to define all the other iterator types. + 1 = std::iterator + 2 = std::iterator */ +#undef BOOST_RE_ITERATOR_T_0 +#undef BOOST_RE_ITERATOR_T_1 +#undef BOOST_RE_ITERATOR_T_2 + +/* BOOST_RE_OI_T For output iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::output_iterator */ +#undef BOOST_RE_OI_T_0 +#undef BOOST_RE_OI_T_1 +#undef BOOST_RE_OI_T_2 +#undef BOOST_RE_OI_T_3 + +/* BOOST_RE_II_T For input iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::input_iterator + 4 = std::input_iterator */ +#undef BOOST_RE_II_T_0 +#undef BOOST_RE_II_T_1 +#undef BOOST_RE_II_T_2 +#undef BOOST_RE_II_T_3 +#undef BOOST_RE_II_T_4 + + +/* BOOST_RE_FI_T For forward iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::forward_iterator */ +#undef BOOST_RE_FI_T_0 +#undef BOOST_RE_FI_T_1 +#undef BOOST_RE_FI_T_2 +#undef BOOST_RE_FI_T_3 + +/* BOOST_RE_BI_T For bidirectional iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::bidirectional_iterator */ +#undef BOOST_RE_BI_T_0 +#undef BOOST_RE_BI_T_1 +#undef BOOST_RE_BI_T_2 +#undef BOOST_RE_BI_T_3 + +/* BOOST_RE_RI_T For random access iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::random_access_iterator */ +#undef BOOST_RE_RI_T_0 +#undef BOOST_RE_RI_T_1 +#undef BOOST_RE_RI_T_2 +#undef BOOST_RE_RI_T_3 + +/* BOOST_RE_NO_OI_ASSIGN If output iterators ostream_iterator<>, back_insert_iterator<> and + front_insert_iterator<> do not have assignment operators */ +#undef BOOST_RE_NO_OI_ASSIGN + + +#ifdef BOOST_RE_INT64_T_0 +#define BOOST_RE_NO_INT64 +#elif defined(BOOST_RE_INT64_T_1) +#define BOOST_RE_INT64t short +#define BOOST_RE_IMM64(val) val +#elif defined(BOOST_RE_INT64_T_2) +#define BOOST_RE_INT64t int +#define BOOST_RE_IMM64(val) val +#elif defined(BOOST_RE_INT64_T_3) +#define BOOST_RE_INT64t long +#define BOOST_RE_IMM64(val) val##L +#elif defined(BOOST_RE_INT64_T_4) +#define BOOST_RE_INT64t int64_t +#define BOOST_RE_IMM64(val) INT64_C(val) +#elif defined(BOOST_RE_INT64_T_5) +#define BOOST_RE_INT64t long long +#define BOOST_RE_IMM64(val) val##LL +#elif defined(BOOST_RE_INT64_T_6) +#define BOOST_RE_INT64t __int64 +#define BOOST_RE_IMM64(val) val##i64 +#else +syntax error: unknown value for BOOST_RE_INT64_T +#endif + +#ifdef BOOST_RE_DISTANCE_T_0 +# define BOOST_RE_DISTANCE(i, j, n) n = j - i +#elif defined(BOOST_RE_DISTANCE_T_1) +# define BOOST_RE_DISTANCE(i, j, n) n = std::distance(i, j) +#elif defined(BOOST_RE_DISTANCE_T_2) +# define BOOST_RE_DISTANCE(i, j, n) (n = 0, std::distance(i, j, n)) +#else +syntax erorr +#endif + +#ifdef BOOST_RE_ITERATOR_T_0 +#ifndef BOOST_RE_OI_T_0 +#define BOOST_RE_OI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_II_T_0 +#define BOOST_RE_II_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_FI_T_0 +#define BOOST_RE_FI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_BI_T_0 +#define BOOST_RE_BI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_RI_T_0 +#define BOOST_RE_RI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_1 +#ifndef BOOST_RE_OI_T_1 +#define BOOST_RE_OI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_II_T_1 +#define BOOST_RE_II_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_FI_T_1 +#define BOOST_RE_FI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_BI_T_1 +#define BOOST_RE_BI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_RI_T_1 +#define BOOST_RE_RI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_2 +#ifndef BOOST_RE_OI_T_2 +#define BOOST_RE_OI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_II_T_2 +#define BOOST_RE_II_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_FI_T_2 +#define BOOST_RE_FI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_BI_T_2 +#define BOOST_RE_BI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_RI_T_2 +#define BOOST_RE_RI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_3 +#ifndef BOOST_RE_OI_T_3 +#define BOOST_RE_OI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_II_T_3 +#define BOOST_RE_II_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_FI_T_3 +#define BOOST_RE_FI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_BI_T_3 +#define BOOST_RE_BI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_RI_T_3 +#define BOOST_RE_RI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_4 +#ifndef BOOST_RE_OI_T_4 +#define BOOST_RE_OI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_II_T_4 +#define BOOST_RE_II_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_FI_T_4 +#define BOOST_RE_FI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_BI_T_4 +#define BOOST_RE_BI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_RI_T_4 +#define BOOST_RE_RI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#endif + +#ifdef BOOST_RE_OI_T_0 +# define BOOST_RE_OUTPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_OI_T_1) +# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_OI_T_2) +# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_OI_T_3) +# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::output_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_II_T_0 +# define BOOST_RE_INPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_II_T_1) +#define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_II_T_2) +#define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_II_T_3) +# define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator +#elif defined(BOOST_RE_II_T_4) +# define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_FI_T_0 +# define BOOST_RE_FWD_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_FI_T_1) +# define BOOST_RE_FWD_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_FI_T_2) +# define BOOST_RE_FWD_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_FI_T_3) +# define BOOST_RE_FWD_ITERATOR(T, D) std::forward_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_BI_T_0 +# define BOOST_RE_BIDI_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_BI_T_1) +# define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_BI_T_2) +# define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_BI_T_3) +# define BOOST_RE_BIDI_ITERATOR(T, D) std::bidirectional_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_RI_T_0 +# define BOOST_RE_RA_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_RI_T_1) +# define BOOST_RE_RA_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_RI_T_2) +# define BOOST_RE_RA_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_RI_T_3) +# define BOOST_RE_RA_ITERATOR(T, D) std::random_access_iterator +#else +syntax error +#endif + + +#ifndef BOOST_RE_NO_EXCEPTION_H +#include +#endif + +#ifndef BOOST_RE_NO_ITERATOR_H +#include +#ifdef BOOST_RE_USE_ALGO +#include +#else +#include +#endif +#endif + +#if defined(BOOST_RE_NO_MEMORY_H) || defined(__GNUC__) + #define BOOST_RE_OLD_ALLOCATORS + #define REBIND_INSTANCE(x, y, inst) re_alloc_binder(inst) + #define REBIND_TYPE(x, y) re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_DEFAULT_PARAM( boost::re_detail::jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) boost::re_detail::jm_def_alloc + + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC +#else +#include + #define REBIND_INSTANCE(x, y, inst) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other(inst) + #define REBIND_TYPE(x, y) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( std::allocator ) + #define BOOST_RE_DEF_ALLOC(x) std::allocator +#endif + + +#endif // BOOST_RE_AUTO_CONFIGURE + + +#endif /* BOOST_RE_OPT_H */ + + + + + + + + + + + diff --git a/include/boost/re_detail/regex_raw_buffer.hpp b/include/boost/re_detail/regex_raw_buffer.hpp new file mode 100644 index 00000000..03efe0c6 --- /dev/null +++ b/include/boost/re_detail/regex_raw_buffer.hpp @@ -0,0 +1,251 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_raw_buffer.hpp + * VERSION 3.01 + * DESCRIPTION: Raw character buffer for regex code. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_RAW_BUFFER_HPP +#define BOOST_REGEX_RAW_BUFFER_HPP + +#ifndef BOOST_REGEX_CONFIG_HPP +#include +#endif + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +struct empty_padding{}; + +union padding +{ + void* p; + unsigned int i; +}; + +template +struct padding3 +{ + enum{ + padding_size = 8, + padding_mask = 7 + }; +}; + +template<> +struct padding3<2> +{ + enum{ + padding_size = 2, + padding_mask = 1 + }; +}; + +template<> +struct padding3<4> +{ + enum{ + padding_size = 4, + padding_mask = 3 + }; +}; + +template<> +struct padding3<8> +{ + enum{ + padding_size = 8, + padding_mask = 7 + }; +}; + +template<> +struct padding3<16> +{ + enum{ + padding_size = 16, + padding_mask = 15 + }; +}; + +enum{ + padding_size = padding3::padding_size, + padding_mask = padding3::padding_mask +}; + +// +// class raw_storage +// basically this is a simplified vector +// this is used by reg_expression for expression storage +// + +template +class raw_storage +{ +public: + typedef Allocator allocator_type; + typedef typename REBIND_TYPE(unsigned char, allocator_type)::size_type size_type; + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(unsigned char, allocator_type) alloc_inst_type; + typedef typename REBIND_TYPE(unsigned char, allocator_type)::pointer pointer; +private: + // + // empty member optimisation: + struct alloc_data : public alloc_inst_type + { + typename alloc_inst_type::pointer last; + alloc_data(const Allocator& a) : alloc_inst_type(a){} + } alloc_inst; + raw_storage::pointer start, end; +public: + + raw_storage(const Allocator& a = Allocator()); + raw_storage(size_type n, const Allocator& a = Allocator()); + + ~raw_storage() + { + alloc_inst.deallocate(start, (alloc_inst.last - start)); + } + + void BOOST_RE_CALL resize(size_type n); + + void* BOOST_RE_CALL extend(size_type n) + { + if(size_type(alloc_inst.last - end) < n) + resize(n + (end - start)); + register void* result = end; + end += n; + return result; + } + + void* BOOST_RE_CALL insert(size_type pos, size_type n); + + size_type BOOST_RE_CALL size() + { + return end - start; + } + + size_type BOOST_RE_CALL capacity() + { + return alloc_inst.last - start; + } + + void* BOOST_RE_CALL data()const + { + return start; + } + + size_type BOOST_RE_CALL index(void* ptr) + { + return (unsigned char*)ptr - (unsigned char*)data(); + } + + void BOOST_RE_CALL clear() + { + end = start; + } + + void BOOST_RE_CALL align() + { + // move end up to a boundary: + end = (unsigned char*)start + ((((unsigned char*)end - (unsigned char*)start) + padding_mask) & ~padding_mask); + } + + Allocator BOOST_RE_CALL allocator()const; +}; + +template +CONSTRUCTOR_INLINE raw_storage::raw_storage(const Allocator& a) + : alloc_inst(a) +{ + start = end = alloc_inst.allocate(1024); + alloc_inst.last = start + 1024; +} + +template +CONSTRUCTOR_INLINE raw_storage::raw_storage(size_type n, const Allocator& a) + : alloc_inst(a) +{ + start = end = alloc_inst.allocate(n); + alloc_inst.last = start + n; +} + +template +Allocator BOOST_RE_CALL raw_storage::allocator()const +{ + return alloc_inst; +} + +template +void BOOST_RE_CALL raw_storage::resize(size_type n) +{ + register size_type newsize = (alloc_inst.last - start) * 2; + register size_type datasize = end - start; + if(newsize < n) + newsize = n; + // extend newsize to WORD/DWORD boundary: + newsize = (newsize + padding_mask) & ~(padding_mask); + + // allocate and copy data: + register unsigned char* ptr = alloc_inst.allocate(newsize); + std::memcpy(ptr, start, datasize); + + // get rid of old buffer: + alloc_inst.deallocate(start, (alloc_inst.last - start)); + + // and set up pointers: + start = ptr; + end = ptr + datasize; + alloc_inst.last = ptr + newsize; +} + +template +void* BOOST_RE_CALL raw_storage::insert(size_type pos, size_type n) +{ + jm_assert(pos <= size_type(end - start)); + if(size_type(alloc_inst.last - end) < n) + resize(n + (end - start)); + register void* result = start + pos; + std::memmove(start + pos + n, start + pos, (end - start) - pos); + end += n; + return result; +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace re_detail +} // namespace boost + +#endif + + + + diff --git a/include/boost/re_detail/regex_split.hpp b/include/boost/re_detail/regex_split.hpp new file mode 100644 index 00000000..bbce7f08 --- /dev/null +++ b/include/boost/re_detail/regex_split.hpp @@ -0,0 +1,154 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_split.hpp + * VERSION 3.01 + * DESCRIPTION: Implements regex_split and associated functions. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_SPLIT_HPP +#define BOOST_REGEX_SPLIT_HPP + +namespace boost{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +namespace re_detail{ + +template +const reg_expression& get_default_expression(charT) +{ + static const charT expression_text[] = { '\\', 's', '+', '\00', }; + static const reg_expression e(expression_text); + return e; +} + +template +class split_pred +{ + typedef std::basic_string string_type; + typedef typename string_type::const_iterator iterator_type; + iterator_type* p_last; + OutputIterator* p_out; + std::size_t* p_max; + std::size_t initial_max; +public: + split_pred(iterator_type* a, OutputIterator* b, std::size_t* c) + : p_last(a), p_out(b), p_max(c), initial_max(*c) {} + + bool operator()(const match_results& what); +}; + +template +bool split_pred::operator() + (const match_results& what) +{ + *p_last = what[0].second; + if(what.size() > 1) + { + // output sub-expressions only: + for(unsigned i = 1; i < what.size(); ++i) + { + (*p_out) = static_cast(what[i]); + ++(*p_out); + return --*p_max; + } + } + else + { + // output $` only if it's not-null or not at the start of the input: + const sub_match& sub = what[-1]; + if((sub.first != sub.second) || (*p_max != initial_max)) + { + (*p_out) = static_cast(sub); + ++(*p_out); + return --*p_max; + } + } + // + // initial null, do nothing: + return true; +} + +} // namespace re_detail + +template +std::size_t regex_split(OutputIterator out, + std::basic_string& s, + const reg_expression& e, + unsigned flags, + std::size_t max_split) +{ + typedef typename std::basic_string::const_iterator ci_t; + ci_t last = s.begin(); + std::size_t init_size = max_split; + re_detail::split_pred pred(&last, &out, &max_split); + ci_t i, j; + i = s.begin(); + j = s.end(); + regex_grep(pred, i, j, e, flags); + // + // if there is still input left, do a final push as long as max_split + // is not exhausted, and we're not splitting sub-expressions rather + // than whitespace: + if(max_split && (last != s.end()) && (e.mark_count() == 1)) + { + out = std::basic_string((ci_t)last, (ci_t)s.end()); + ++out; + last = s.end(); + } + // + // delete from the string everything that has been processed so far: + s.erase(0, last - s.begin()); + // + // return the number of new records pushed: + return init_size - max_split; +} + +template +inline std::size_t regex_split(OutputIterator out, + std::basic_string& s, + const reg_expression& e, + unsigned flags = match_default) +{ + return regex_split(out, s, e, flags, UINT_MAX); +} + +template +inline std::size_t regex_split(OutputIterator out, + std::basic_string& s) +{ + return regex_split(out, s, re_detail::get_default_expression(charT(0)), match_default, UINT_MAX); +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#endif diff --git a/include/boost/re_detail/regex_stack.hpp b/include/boost/re_detail/regex_stack.hpp new file mode 100644 index 00000000..be2facf2 --- /dev/null +++ b/include/boost/re_detail/regex_stack.hpp @@ -0,0 +1,229 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_stack.hpp + * VERSION 3.01 + * DESCRIPTION: Implements customised internal regex stacks. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_STACK_HPP +#define BOOST_REGEX_STACK_HPP + +#ifndef BOOST_REGEX_CONFIG_HPP +#include +#endif +#ifndef BOOST_REGEX_RAW_BUFFER_HPP +#include +#endif + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +// +// class jstack +// simplified stack optimised for push/peek/pop +// operations, we could use std::stack> instead... +// +template +class jstack +{ +private: + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(unsigned char, Allocator) allocator_type; + typedef typename REBIND_TYPE(T, Allocator)::size_type size_type; + typedef T value_type; + struct node + { + node* next; + T* start; // first item + T* end; // last item + T* last; // end of storage + }; + + // + // empty base member optimisation: + struct data : public allocator_type + { + padding buf[(sizeof(T) * 16 + sizeof(padding) - 1) / sizeof(padding)]; + data(const Allocator& a) : allocator_type(a){} + }; + + data alloc_inst; + mutable node* stack; + mutable node* unused; + node base; + size_type block_size; + + void BOOST_RE_CALL pop_aux()const; + void BOOST_RE_CALL push_aux(); + +public: + jstack(size_type n = 64, const Allocator& a = Allocator()); + + ~jstack(); + + node* BOOST_RE_CALL get_node() + { + node* new_stack = (node*)alloc_inst.allocate(sizeof(node) + sizeof(T) * block_size); + new_stack->last = (T*)(new_stack+1); + new_stack->start = new_stack->end = new_stack->last + block_size; + new_stack->next = 0; + return new_stack; + } + + bool BOOST_RE_CALL empty() + { + return (stack->start == stack->end) && (stack->next == 0); + } + + bool BOOST_RE_CALL good() + { + return (stack->start != stack->end) || (stack->next != 0); + } + + T& BOOST_RE_CALL peek() + { + if(stack->start == stack->end) + pop_aux(); + return *stack->end; + } + + const T& BOOST_RE_CALL peek()const + { + if(stack->start == stack->end) + pop_aux(); + return *stack->end; + } + + void BOOST_RE_CALL pop() + { + if(stack->start == stack->end) + pop_aux(); + jm_destroy(stack->end); + ++(stack->end); + } + + void BOOST_RE_CALL pop(T& t) + { + if(stack->start == stack->end) + pop_aux(); + t = *stack->end; + jm_destroy(stack->end); + ++(stack->end); + } + + void BOOST_RE_CALL push(const T& t) + { + if(stack->end == stack->last) + push_aux(); + --(stack->end); + jm_construct(stack->end, t); + } + +}; + +template +jstack::jstack(size_type n, const Allocator& a) + : alloc_inst(a) +{ + unused = 0; + block_size = n; + stack = &base; + base.last = reinterpret_cast(alloc_inst.buf); + base.end = base.start = base.last + 16; + base.next = 0; +} + +template +void BOOST_RE_CALL jstack::push_aux() +{ + // make sure we have spare space on TOS: + register node* new_node; + if(unused) + { + new_node = unused; + unused = new_node->next; + new_node->next = stack; + stack = new_node; + } + else + { + new_node = get_node(); + new_node->next = stack; + stack = new_node; + } +} + +template +void BOOST_RE_CALL jstack::pop_aux()const +{ + // make sure that we have a valid item + // on TOS: + jm_assert(stack->next); + register node* p = stack; + stack = p->next; + p->next = unused; + unused = p; +} + +template +jstack::~jstack() +{ + node* condemned; + while(good()) + pop(); + while(unused) + { + condemned = unused; + unused = unused->next; + alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size); + } + while(stack != &base) + { + condemned = stack; + stack = stack->next; + alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size); + } +} + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace re_detail +} // namespace boost + +#endif + + + + + + + + diff --git a/include/boost/re_detail/regex_synch.hpp b/include/boost/re_detail/regex_synch.hpp new file mode 100644 index 00000000..3f30eeaa --- /dev/null +++ b/include/boost/re_detail/regex_synch.hpp @@ -0,0 +1,181 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex_synch.hpp + * VERSION 3.01 + * DESCRIPTION: Thread synchronisation for regex code. + * Note this is an internal header file included + * by regex.hpp, do not include on its own. + */ + +#ifndef BOOST_REGEX_SYNCH_HPP +#define BOOST_REGEX_SYNCH_HPP + +#ifndef BOOST_REGEX_CONFIG_HPP +#include +#endif + +#if defined(BOOST_RE_PLATFORM_W32) && defined(BOOST_RE_THREADS) +#include +#endif + +#if !defined(BOOST_RE_PLATFORM_W32) && defined(BOOST_RE_THREADS) +#include +#endif + + +namespace boost{ + namespace re_detail{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +void BOOST_RE_CALL re_init_threads(); +void BOOST_RE_CALL re_free_threads(); + +#ifdef BOOST_RE_THREADS + +#ifndef BOOST_RE_PLATFORM_W32 + +typedef pthread_mutex_t CRITICAL_SECTION; + +inline void BOOST_RE_CALL InitializeCriticalSection(CRITICAL_SECTION* ps) +{ + pthread_mutex_init(ps, NULL); +} + +inline void BOOST_RE_CALL DeleteCriticalSection(CRITICAL_SECTION* ps) +{ + pthread_mutex_destroy(ps); +} + +inline void BOOST_RE_CALL EnterCriticalSection(CRITICAL_SECTION* ps) +{ + pthread_mutex_lock(ps); +} + +inline void BOOST_RE_CALL LeaveCriticalSection(CRITICAL_SECTION* ps) +{ + pthread_mutex_unlock(ps); +} + +#endif + +template +class lock_guard +{ + typedef Lock lock_type; +public: + lock_guard(lock_type& m, bool aq = true) + : mut(m), owned(false){ acquire(aq); } + + ~lock_guard() + { acquire(false); } + + void BOOST_RE_CALL acquire(bool aq = true) + { + if(aq && !owned) + { + mut.acquire(true); + owned = true; + } + else if(!aq && owned) + { + mut.acquire(false); + owned = false; + } + } +private: + lock_type& mut; + bool owned; +}; + + +class critical_section +{ +public: + critical_section() + { InitializeCriticalSection(&hmutex);} + + critical_section(const critical_section&) + { InitializeCriticalSection(&hmutex);} + + const critical_section& BOOST_RE_CALL operator=(const critical_section&) + {return *this;} + + ~critical_section() + {DeleteCriticalSection(&hmutex);} + +private: + + void BOOST_RE_CALL acquire(bool aq) + { if(aq) EnterCriticalSection(&hmutex); + else LeaveCriticalSection(&hmutex); + } + + CRITICAL_SECTION hmutex; + +public: + typedef lock_guard ro_guard; + typedef lock_guard rw_guard; + + friend lock_guard; +}; + +inline bool BOOST_RE_CALL operator==(const critical_section&, const critical_section&) +{ + return false; +} + +inline bool BOOST_RE_CALL operator<(const critical_section&, const critical_section&) +{ + return true; +} + +typedef lock_guard cs_guard; + +BOOST_RE_IX_DECL extern critical_section* p_re_lock; +BOOST_RE_IX_DECL extern unsigned int re_lock_count; + +#define BOOST_RE_GUARD(inst) boost::re_detail::critical_section::rw_guard g(inst); + +#else // BOOST_RE_THREADS + +#define BOOST_RE_GUARD(inst) + +#endif // BOOST_RE_THREADS + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace re_detail +} // namespace boost + +#endif // sentry + + + + + diff --git a/include/boost/regex.h b/include/boost/regex.h new file mode 100644 index 00000000..e0a2ccd8 --- /dev/null +++ b/include/boost/regex.h @@ -0,0 +1,95 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex.h + * VERSION 3.00 + * DESCRIPTION: Declares POSIX API functions + */ + +#ifndef BOOST_RE_REGEX_H +#define BOOST_RE_REGEX_H + +#include + +// +// add using declarations to bring POSIX API functions into +// global scope, only if this is C++ (and not C). +// +#ifdef __cplusplus + +using boost::regoff_t; +using boost::regex_tA; +using boost::regex_tW; +using boost::regmatch_t; +using boost::REG_BASIC; +using boost::REG_EXTENDED; +using boost::REG_ICASE; +using boost::REG_NOSUB; +using boost::REG_NEWLINE; +using boost::REG_NOSPEC; +using boost::REG_PEND; +using boost::REG_DUMP; +using boost::REG_NOCOLLATE; +using boost::REG_ESCAPE_IN_LISTS; +using boost::REG_NEWLINE_ALT; +using boost::REG_PERL; +using boost::REG_AWK; +using boost::REG_GREP; +using boost::REG_EGREP; +using boost::REG_ASSERT; +using boost::REG_INVARG; +using boost::REG_ATOI; +using boost::REG_ITOA; +using boost::reg_comp_flags; +using boost::reg_exec_flags; +using boost::regcompA; +using boost::regerrorA; +using boost::regexecA; +using boost::regfreeA; + +#ifndef BOOST_RE_NO_WCSTRING +using boost::regcompW; +using boost::regerrorW; +using boost::regexecW; +using boost::regfreeW; +#endif + +using boost::REG_NOERROR; +using boost::REG_NOMATCH; +using boost::REG_BADPAT; +using boost::REG_ECOLLATE; +using boost::REG_ECTYPE; +using boost::REG_EESCAPE; +using boost::REG_ESUBREG; +using boost::REG_EBRACK; +using boost::REG_EPAREN; +using boost::REG_EBRACE; +using boost::REG_BADBR; +using boost::REG_ERANGE; +using boost::REG_ESPACE; +using boost::REG_BADRPT; +using boost::REG_EEND; +using boost::REG_ESIZE; +using boost::REG_ERPAREN; +using boost::REG_EMPTY; +using boost::REG_E_MEMORY; +using boost::REG_E_UNKNOWN; +using boost::reg_errcode_t; + +#endif // __cplusplus + +#endif // BOOST_RE_REGEX_H diff --git a/include/boost/regex.hpp b/include/boost/regex.hpp new file mode 100644 index 00000000..4baa930b --- /dev/null +++ b/include/boost/regex.hpp @@ -0,0 +1,1462 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex.cpp + * VERSION 3.01 + * DESCRIPTION: Declares boost::reg_expression<> and associated + * functions and classes. This header is the main + * entry point for the template regex code. + */ + + +/* start with C compatability API */ + +#ifndef BOOST_RE_REGEX_HPP +#define BOOST_RE_REGEX_HPP + +#include + +#ifdef __cplusplus + +// what follows is all C++ don't include in C builds!! + +#include +#include +#if !defined(BOOST_RE_NO_TYPEINFO) +#include +#endif +#include +#include +#include +#include +#include +#include +#include + + +namespace boost{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +namespace re_detail{ + +struct re_set_long; +struct re_syntax_base; + +} // namespace re_detail + +namespace deprecated{ +// +// class char_regex_traits_i +// provides case insensitive traits classes (deprecated): +template +class char_regex_traits_i : public regex_traits {}; + +template<> +class char_regex_traits_i : public regex_traits +{ +public: + typedef char char_type; + typedef unsigned char uchar_type; + typedef unsigned int size_type; + typedef regex_traits base_type; + + char BOOST_RE_CALL translate(char c, bool)const + { + return static_cast*>(this)->translate(c, true); + } +}; + +#ifndef BOOST_RE_NO_WCSTRING +template<> +class char_regex_traits_i : public regex_traits +{ +public: + typedef wchar_t char_type; + typedef unsigned short uchar_type; + typedef unsigned int size_type; + typedef regex_traits base_type; + + wchar_t BOOST_RE_CALL translate(wchar_t c, bool)const + { + return static_cast*>(this)->translate(c, true); + } + jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const + { + jm_uintfast32_t result = static_cast*>(this)->lookup_classname(first, last); + if((result & base_type::char_class_upper) == base_type::char_class_upper) + result |= base_type::char_class_alpha; + return result; + } +}; +#endif +} // namespace deprecated + + +namespace re_detail{ + +enum mask_type +{ + mask_take = 1, + mask_skip = 2, + mask_any = mask_skip | mask_take, + mask_all = mask_any +}; + +struct _narrow_type{}; +struct _wide_type{}; + +template +class is_byte; + +template<> +class is_byte +{ +public: + typedef _narrow_type width_type; +}; + +template<> +class is_byte +{ +public: + typedef _narrow_type width_type; +}; + +template<> +class is_byte +{ +public: + typedef _narrow_type width_type; +}; + +template +class is_byte +{ +public: + typedef _wide_type width_type; +}; + + +// +// compiled structures +// +// the following defs describe the format of the compiled string +// + +// +// enum syntax_element_type +// describes the type of a record +enum syntax_element_type +{ + syntax_element_startmark = 0, + syntax_element_endmark = syntax_element_startmark + 1, + syntax_element_literal = syntax_element_endmark + 1, + syntax_element_start_line = syntax_element_literal + 1, + syntax_element_end_line = syntax_element_start_line + 1, + syntax_element_wild = syntax_element_end_line + 1, + syntax_element_match = syntax_element_wild + 1, + syntax_element_word_boundary = syntax_element_match + 1, + syntax_element_within_word = syntax_element_word_boundary + 1, + syntax_element_word_start = syntax_element_within_word + 1, + syntax_element_word_end = syntax_element_word_start + 1, + syntax_element_buffer_start = syntax_element_word_end + 1, + syntax_element_buffer_end = syntax_element_buffer_start + 1, + syntax_element_backref = syntax_element_buffer_end + 1, + syntax_element_long_set = syntax_element_backref + 1, + syntax_element_set = syntax_element_long_set + 1, + syntax_element_jump = syntax_element_set + 1, + syntax_element_alt = syntax_element_jump + 1, + syntax_element_rep = syntax_element_alt + 1, + syntax_element_combining = syntax_element_rep + 1, + syntax_element_soft_buffer_end = syntax_element_combining + 1, + syntax_element_restart_continue = syntax_element_soft_buffer_end + 1 +}; + +union offset_type +{ + re_syntax_base* p; + unsigned i; +}; + +// +// struct re_syntax_base +// base class for all syntax types: +struct re_syntax_base +{ + syntax_element_type type; + offset_type next; + unsigned int can_be_null; +}; + +// +// struct re_brace +// marks start or end of (...) +struct re_brace : public re_syntax_base +{ + unsigned int index; +}; + +// +// struct re_literal +// marks a literal string and +// is followed by an array of charT[length]: +struct re_literal : public re_syntax_base +{ + unsigned int length; +}; + +// +// struct re_long_set +// provides data for sets [...] containing +// wide characters +struct re_set_long : public re_syntax_base +{ + unsigned int csingles, cranges, cequivalents; + jm_uintfast32_t cclasses; + bool isnot; +}; + +// +// struct re_set +// provides a map of bools for sets containing +// narrow, single byte characters. +struct re_set : public re_syntax_base +{ + unsigned char _map[256]; +}; + +// +// struct re_jump +// provides alternative next destination +struct re_jump : public re_syntax_base +{ + offset_type alt; + unsigned char _map[256]; +}; + +// +// struct re_repeat +// provides repeat expressions +struct re_repeat : public re_jump +{ + unsigned min, max; + int id; + bool leading; + bool greedy; +}; + + +// +// enum re_jump_size_type +// provides compiled size of re_jump +// allowing for trailing alignment +// provide this so we know how many +// bytes to insert +enum re_jump_size_type +{ + re_jump_size = (sizeof(re_jump) + padding_mask) & ~(padding_mask), + re_repeater_size = (sizeof(re_repeat) + padding_mask) & ~(padding_mask) +}; + +} // namespace re_detail + +// +// class basic_regex +// handles error codes and flags + +class BOOST_RE_IX_DECL regbase +{ +public: + enum flag_type_ + { + escape_in_lists = 1, // '\' special inside [...] + char_classes = escape_in_lists << 1, // [[:CLASS:]] allowed + intervals = char_classes << 1, // {x,y} allowed + limited_ops = intervals << 1, // all of + ? and | are normal characters + newline_alt = limited_ops << 1, // \n is the same as | + bk_plus_qm = newline_alt << 1, // uses \+ and \? + bk_braces = bk_plus_qm << 1, // uses \{ and \} + bk_parens = bk_braces << 1, // uses \( and \) + bk_refs = bk_parens << 1, // \d allowed + bk_vbar = bk_refs << 1, // uses \| + + use_except = bk_vbar << 1, // exception on error + failbit = use_except << 1, // error flag + literal = failbit << 1, // all characters are literals + icase = literal << 1, // characters are matched regardless of case + nocollate = icase << 1, // don't use locale specific collation + + basic = char_classes | intervals | limited_ops | bk_braces | bk_parens | bk_refs, + extended = char_classes | intervals | bk_refs, + normal = escape_in_lists | char_classes | intervals | bk_refs | nocollate, + emacs = bk_braces | bk_parens | bk_refs | bk_vbar, + awk = extended | escape_in_lists, + grep = basic | newline_alt, + egrep = extended | newline_alt, + sed = basic, + perl = normal + }; + typedef unsigned int flag_type; + + enum restart_info + { + restart_any = 0, + restart_word = 1, + restart_line = 2, + restart_buf = 3, + restart_continue = 4, + restart_lit = 5, + restart_fixed_lit = 6 + }; + + flag_type BOOST_RE_CALL flags()const + { + return _flags; + } + + regbase(); + regbase(const regbase& b); +protected: + flag_type _flags; +}; + +// +// some forward declarations: +namespace re_detail{ +template +class _priv_match_data; + +#if defined(BOOST_NO_STD_ITERATOR_TRAITS) || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template +struct regex_iterator_traits +{ + typedef typename T::iterator_category iterator_category; + typedef typename T::value_type value_type; + typedef typename T::difference_type difference_type; + typedef typename T::pointer pointer; + typedef typename T::reference reference; +}; + +template +struct pointer_iterator_traits +{ + typedef std::ptrdiff_t difference_type; + typedef T value_type; + typedef T* pointer; + typedef T& reference; + typedef std::random_access_iterator_tag iterator_category; +}; +template +struct const_pointer_iterator_traits +{ + typedef std::ptrdiff_t difference_type; + typedef T value_type; + typedef const T* pointer; + typedef const T& reference; + typedef std::random_access_iterator_tag iterator_category; +}; + +template<> +struct regex_iterator_traits : pointer_iterator_traits{}; +template<> +struct regex_iterator_traits : const_pointer_iterator_traits{}; +template<> +struct regex_iterator_traits : pointer_iterator_traits{}; +template<> +struct regex_iterator_traits : const_pointer_iterator_traits{}; + +#if defined(__SGI_STL_PORT) && defined(__STL_DEBUG) +template<> +struct regex_iterator_traits : pointer_iterator_traits{}; +template<> +struct regex_iterator_traits : const_pointer_iterator_traits{}; +#ifndef BOOST_NO_WSTRING +template<> +struct regex_iterator_traits : pointer_iterator_traits{}; +template<> +struct regex_iterator_traits : const_pointer_iterator_traits{}; +#endif // BOOST_NO_WSTRING +#endif // stport + +#else + +template +struct regex_iterator_traits : public std::iterator_traits {}; + +#endif + +template +struct def_alloc_param_traits +{ + typedef typename regex_iterator_traits::value_type const_value_type; + typedef typename remove_cv::type type; +}; + +} + +template ::type) > +class match_results; + +// +// class reg_expression +// represents the compiled +// regular expression: +// + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +// +// Ugly ugly hack, +// template don't merge if they contain switch statements so declare these +// templates in unnamed namespace (ie with internal linkage), each translation +// unit then gets its own local copy, it works seemlessly but bloats the app. +namespace{ +#endif + +template ), class Allocator BOOST_RE_DEF_ALLOC_PARAM(charT) > +class reg_expression : public regbase +{ + typedef typename traits::size_type traits_size_type; + typedef typename traits::uchar_type traits_uchar_type; + typedef typename traits::string_type traits_string_type; +public: + // typedefs: + typedef charT char_type; + typedef traits traits_type; + + // locale_type + // placeholder for actual locale type used by the + // traits class to localise *this. + typedef typename traits::locale_type locale_type; + // value_type + typedef charT value_type; + // reference, const_reference + typedef charT& reference; + typedef const charT& const_reference; + // iterator, const_iterator + typedef const charT* const_iterator; + typedef const_iterator iterator; + // difference_type + typedef typename Allocator::difference_type difference_type; + // size_type + typedef typename Allocator::size_type size_type; + // allocator_type + typedef Allocator allocator_type; + typedef Allocator alloc_type; + // flag_type + typedef regbase::flag_type flag_type; + +public: + explicit reg_expression(const Allocator& a = Allocator()); + explicit reg_expression(const charT* p, flag_type f = regbase::normal, const Allocator& a = Allocator()); + reg_expression(const charT* p1, const charT* p2, flag_type f = regbase::normal, const Allocator& a = Allocator()); + reg_expression(const charT* p, size_type len, flag_type f, const Allocator& a = Allocator()); + reg_expression(const reg_expression&); + ~reg_expression(); + reg_expression& BOOST_RE_CALL operator=(const reg_expression&); + reg_expression& BOOST_RE_CALL operator=(const charT* ptr) + { + set_expression(ptr, regbase::normal | regbase::use_except); + return *this; + } + + // + // assign: + reg_expression& assign(const reg_expression& that) + { return *this = that; } + reg_expression& assign(const charT* ptr, flag_type f = regbase::normal) + { + set_expression(ptr, f | regbase::use_except); + return *this; + } + + reg_expression& assign(const charT* first, + const charT* last, + flag_type f = regbase::normal) + { + set_expression(first, last, f | regbase::use_except); + return *this; + } +#ifndef BOOST_RE_NO_MEMBER_TEMPLATES + + template + unsigned int BOOST_RE_CALL set_expression(const std::basic_string& p, flag_type f = regbase::normal) + { return set_expression(p.data(), p.data() + p.size(), f); } + + template + explicit reg_expression(const std::basic_string& p, flag_type f = regbase::normal, const Allocator& a = Allocator()) + : data(a), pkmp(0) { set_expression(p, f); } + + template + reg_expression(I first, I last, flag_type f = regbase::normal, const Allocator& a = Allocator()) + : data(a), pkmp(0) + { + size_type len = last-first; + scoped_array a(new charT[len]); + std::copy(first, last, a.get()); + set_expression(a.get(), a.get() + len, f | regbase::use_except); + } + + template + reg_expression& BOOST_RE_CALL operator=(const std::basic_string& p) + { + set_expression(p.c_str(), p.c_str() + p.size(), regbase::normal | regbase::use_except); + return *this; + } + + template + reg_expression& BOOST_RE_CALL assign( + const std::basic_string& s, + flag_type f = regbase::normal) + { + set_expression(p.c_str(), p.c_str() + p.size(), f | regbase::use_except); + return *this; + } + + template + reg_expression& BOOST_RE_CALL assign(fwd_iterator first, + fwd_iterator last, + flag_type f = regbase::normal) + { + size_type len = last-first; + scoped_array a(new charT[len]); + std::copy(first, last, a.get()); + set_expression(a.get(), a.get() + len, f | regbase::use_except); + return *this; + } +#elif !defined(BOOST_RE_NO_STRING_DEF_ARGS) + unsigned int BOOST_RE_CALL set_expression(const std::basic_string& p, flag_type f = regbase::normal) + { return set_expression(p.data(), p.data() + p.size(), f); } + + reg_expression(const std::basic_string& p, flag_type f = regbase::normal, const Allocator& a = Allocator()) + : data(a), pkmp(0) { set_expression(p, f); } + + reg_expression& BOOST_RE_CALL operator=(const std::basic_string& p) + { + set_expression(p.c_str(), p.c_str() + p.size(), regbase::normal | regbase::use_except); + return *this; + } + + reg_expression& BOOST_RE_CALL assign( + const std::basic_string& s, + flag_type f = regbase::normal) + { + set_expression(s.c_str(), s.c_str() + s.size(), f | regbase::use_except); + return *this; + } + +#endif + + + // + // allocator access: + Allocator BOOST_RE_CALL get_allocator()const; + // + // locale: + locale_type BOOST_RE_CALL imbue(locale_type l){ return traits_inst.imbue(l); } + locale_type BOOST_RE_CALL getloc()const{ return traits_inst.getloc(); } + // + // flags: + flag_type BOOST_RE_CALL getflags()const + { return flags(); } + // + // str: + std::basic_string BOOST_RE_CALL str()const + { return std::basic_string(_expression, _expression_len); } + // + // begin, end: + const_iterator BOOST_RE_CALL begin()const + { return _expression; } + const_iterator BOOST_RE_CALL end()const + { return _expression + _expression_len; } + // + // swap: + void BOOST_RE_CALL swap(reg_expression&)throw(); + // + // size: + size_type BOOST_RE_CALL size()const + { return _expression_len; } + // + // max_size: + size_type BOOST_RE_CALL max_size()const + { return UINT_MAX; } + // + // empty: + bool BOOST_RE_CALL empty()const + { return this->error_code(); } + + unsigned BOOST_RE_CALL mark_count()const { return marks; } + bool BOOST_RE_CALL operator==(const reg_expression&)const; + bool BOOST_RE_CALL operator<(const reg_expression&)const; + // + // The following are deprecated as public interfaces + // but are available for compatability with earlier versions. + allocator_type BOOST_RE_CALL allocator()const; + const charT* BOOST_RE_CALL expression()const { return _expression; } + unsigned int BOOST_RE_CALL set_expression(const charT* p, const charT* end, flag_type f = regbase::normal); + unsigned int BOOST_RE_CALL set_expression(const charT* p, flag_type f = regbase::normal) { return set_expression(p, p + traits_type::length(p), f); } + // + // this should be private but template friends don't work: + const traits_type& get_traits()const { return traits_inst; } + unsigned int BOOST_RE_CALL error_code()const + { + return error_code_; + } + +private: + re_detail::raw_storage data; + unsigned _restart_type; + unsigned marks; + int repeats; + unsigned char* startmap; + charT* _expression; + unsigned _expression_len; + unsigned int _leading_len; + const charT* _leading_string; + unsigned int _leading_string_len; + re_detail::kmp_info* pkmp; + traits_type traits_inst; + unsigned error_code_; + + void BOOST_RE_CALL compile_maps(); + void BOOST_RE_CALL compile_map(re_detail::re_syntax_base* node, unsigned char* _map, unsigned int* pnull, unsigned char mask, re_detail::re_syntax_base* terminal = NULL)const; + bool BOOST_RE_CALL probe_start(re_detail::re_syntax_base* node, charT c, re_detail::re_syntax_base* terminal)const; + bool BOOST_RE_CALL probe_start_null(re_detail::re_syntax_base* node, re_detail::re_syntax_base* terminal)const; + void BOOST_RE_CALL fixup_apply(re_detail::re_syntax_base* b, unsigned cbraces); + void BOOST_RE_CALL move_offsets(re_detail::re_syntax_base* j, unsigned size); + re_detail::re_syntax_base* BOOST_RE_CALL compile_set(const charT*& first, const charT* last); + re_detail::re_syntax_base* BOOST_RE_CALL compile_set_aux(re_detail::jstack& singles, re_detail::jstack& ranges, re_detail::jstack& classes, re_detail::jstack& equivalents, bool isnot, const re_detail::_narrow_type&); + re_detail::re_syntax_base* BOOST_RE_CALL compile_set_aux(re_detail::jstack& singles, re_detail::jstack& ranges, re_detail::jstack& classes, re_detail::jstack& equivalents, bool isnot, const re_detail::_wide_type&); + re_detail::re_syntax_base* BOOST_RE_CALL compile_set_simple(re_detail::re_syntax_base* dat, unsigned long cls, bool isnot = false); + unsigned int BOOST_RE_CALL parse_inner_set(const charT*& first, const charT* last); + + re_detail::re_syntax_base* BOOST_RE_CALL add_simple(re_detail::re_syntax_base* dat, re_detail::syntax_element_type type, unsigned int size = sizeof(re_detail::re_syntax_base)); + re_detail::re_syntax_base* BOOST_RE_CALL add_literal(re_detail::re_syntax_base* dat, charT c); + charT BOOST_RE_CALL parse_escape(const charT*& first, const charT* last); + void BOOST_RE_CALL parse_range(const charT*& first, const charT* last, unsigned& min, unsigned& max); + bool BOOST_RE_CALL skip_space(const charT*& first, const charT* last); + unsigned int BOOST_RE_CALL probe_restart(re_detail::re_syntax_base* dat); + unsigned int BOOST_RE_CALL fixup_leading_rep(re_detail::re_syntax_base* dat, re_detail::re_syntax_base* end); + void BOOST_RE_CALL fail(unsigned int err); + +protected: + static int BOOST_RE_CALL repeat_count(const reg_expression& e) + { return e.repeats; } + static unsigned int BOOST_RE_CALL restart_type(const reg_expression& e) + { return e._restart_type; } + static const re_detail::re_syntax_base* BOOST_RE_CALL first(const reg_expression& e) + { return (const re_detail::re_syntax_base*)e.data.data(); } + static const unsigned char* BOOST_RE_CALL get_map(const reg_expression& e) + { return e.startmap; } + static unsigned int BOOST_RE_CALL leading_length(const reg_expression& e) + { return e._leading_len; } + static const re_detail::kmp_info* get_kmp(const reg_expression& e) + { return e.pkmp; } + static bool BOOST_RE_CALL can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_wide_type&); + static bool BOOST_RE_CALL can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_narrow_type&); +}; + +template +void BOOST_RE_CALL reg_expression::swap(reg_expression& that)throw() +{ + // this is not as efficient as it should be, + // however swapping traits classes is problematic + // so just use 'brute force' method for now: + reg_expression e(that); + that = *this; + *this = e; +} + + +#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES) +} // namespace +#endif + +// +// class match_results and match_results_base +// handles what matched where + +template +struct sub_match +{ + typedef typename re_detail::regex_iterator_traits::value_type value_type; +#if defined(BOOST_NO_STD_ITERATOR_TRAITS) || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + typedef std::ptrdiff_t difference_type; +#else + typedef typename re_detail::regex_iterator_traits::difference_type difference_type; +#endif + typedef iterator iterator_type; + + iterator first; + iterator second; + bool matched; + + operator std::basic_string ()const + { + std::basic_string result; + unsigned len; + BOOST_RE_DISTANCE((iterator)first, (iterator)second, len); + result.reserve(len); + iterator i = first; + while(i != second) + { + result.append(1, *i); + ++i; + } + return result; + } + #ifndef BOOST_OLD_REGEX_H + // + // the following are deprecated, do not use!! + // + operator int()const; + operator unsigned int()const; + operator short()const + { + return (short)(int)(*this); + } + operator unsigned short()const + { + return (unsigned short)(unsigned int)(*this); + } + #endif + sub_match() { matched = false; } + sub_match(iterator i) : first(i), second(i), matched(false) {} + + bool operator==(const sub_match& that)const + { + return (first == that.first) && (second == that.second) && (matched == that.matched); + } + bool BOOST_RE_CALL operator !=(const sub_match& that)const + { return !(*this == that); } + + difference_type BOOST_RE_CALL length()const + { + difference_type n; + BOOST_RE_DISTANCE((iterator)first, (iterator)second, n); + return n; + } +}; + +#ifndef BOOST_OLD_REGEX_H +namespace re_detail{ +template +int do_toi(iterator i, iterator j, char c, int radix) +{ + std::string s(i, j); + char* p; + int result = std::strtol(s.c_str(), &p, radix); + if(*p)throw bad_pattern("Bad sub-expression"); + return result; +} + +// +// helper: +template +int do_toi(I& i, I j, charT c) +{ + int result = 0; + while((i != j) && (isdigit(*i))) + { + result = result*10 + (*i - '0'); + ++i; + } + return result; +} +} + + +template +sub_match::operator int()const +{ + iterator i = first; + iterator j = second; + if(i == j)throw bad_pattern("Bad sub-expression"); + int neg = 1; + if((i != j) && (*i == '-')) + { + neg = -1; + ++i; + } + neg *= re_detail::do_toi(i, j, *i); + if(i != j)throw bad_pattern("Bad sub-expression"); + return neg; +} +template +sub_match::operator unsigned int()const +{ + iterator i = first; + iterator j = second; + if(i == j) + throw bad_pattern("Bad sub-expression"); + return re_detail::do_toi(i, j, *first); +} +#endif + +namespace re_detail{ + +template ::type) > +class match_results_base +{ +public: + typedef Allocator alloc_type; + typedef typename REBIND_TYPE(iterator, Allocator)::size_type size_type; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::value_type char_type; +#else + typedef std::ptrdiff_t difference_type; +#endif + typedef sub_match value_type; + typedef iterator iterator_type; + +protected: + typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) c_alloc; + + struct reference : public c_alloc + { + unsigned int cmatches; + unsigned count; + sub_match head, tail, null; + unsigned int lines; + iterator line_pos, base; + reference(const Allocator& a) : c_alloc(a) { } + + bool operator==(const reference& that)const + { + return (cmatches == that.cmatches) && + (count == that.count) && + (head == that.head) && + (tail == that.tail) && + (lines == that.lines) && + (base == that.base); + } + bool operator!=(const reference& that)const + { return !(*this == that); } + }; + + reference* ref; + + void BOOST_RE_CALL cow(); + + // protected contructor for derived class... + match_results_base(bool){} + void BOOST_RE_CALL free(); + +public: + + match_results_base(const Allocator& a = Allocator()); + + match_results_base(const match_results_base& m) + { + ref = m.ref; + ++(ref->count); + } + + match_results_base& BOOST_RE_CALL operator=(const match_results_base& m); + + ~match_results_base() + { + free(); + } + + size_type BOOST_RE_CALL size()const + { + return (*this)[0].matched ? ref->cmatches : 0; + } + + const sub_match& BOOST_RE_CALL operator[](int n) const + { + if((n >= 0) && ((unsigned int)n < ref->cmatches)) + return *(sub_match*)((char*)ref + sizeof(reference) + sizeof(sub_match)*n); + return (n == -1) ? ref->head : (n == -2) ? ref->tail : ref->null; + } + + Allocator BOOST_RE_CALL allocator()const; + + difference_type BOOST_RE_CALL length(unsigned int sub = 0)const + { + jm_assert(ref->cmatches); + const sub_match& m = (*this)[sub]; + if(m.matched == false) + return 0; + difference_type n; + BOOST_RE_DISTANCE((iterator)m.first, (iterator)m.second, n); + return n; + } + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + std::basic_string str(int i)const + { + return static_cast >((*this)[i]); + } +#else + std::basic_string str(int i)const + { + return static_cast >((*this)[i]); + } +#endif + + unsigned int BOOST_RE_CALL line()const + { + return ref->lines; + } + + difference_type BOOST_RE_CALL position(unsigned int sub = 0)const + { + jm_assert(ref->cmatches); + const sub_match& s = (*this)[sub]; + if(s.matched == false) + return -1; + difference_type n; + BOOST_RE_DISTANCE((iterator)ref->base, (iterator)s.first, n); + return n; + } + + iterator BOOST_RE_CALL line_start()const + { + return ref->line_pos; + } + + void swap(match_results_base& that) + { + reference* t = that.ref; + that.ref = ref; + ref = t; + } + + bool operator==(const match_results_base& that)const; + bool operator<(const match_results_base& that)const + { return position() < that.position(); } + + friend class match_results; + + void BOOST_RE_CALL set_size(size_type n); + void BOOST_RE_CALL set_size(size_type n, iterator i, iterator j); + void BOOST_RE_CALL maybe_assign(const match_results_base& m); + void BOOST_RE_CALL init_fail(iterator i, iterator j); + + void BOOST_RE_CALL set_first(iterator i); + void BOOST_RE_CALL set_first(iterator i, size_t pos); + + void BOOST_RE_CALL set_second(iterator i) + { + cow(); + ((sub_match*)(ref+1))->second = i; + ((sub_match*)(ref+1))->matched = true; + ref->tail.first = i; + ref->tail.matched = (ref->tail.first == ref->tail.second) ? false : true; + } + + void BOOST_RE_CALL set_second(iterator i, size_t pos) + { + cow(); + ((sub_match*)((char*)ref + sizeof(reference) + sizeof(sub_match) * pos))->second = i; + ((sub_match*)((char*)ref + sizeof(reference) + sizeof(sub_match) * pos))->matched = true; + if(pos == 0) + { + ref->tail.first = i; + ref->tail.matched = (ref->tail.first == ref->tail.second) ? false : true; + } + } + + void BOOST_RE_CALL set_line(unsigned int i, iterator pos) + { + ref->lines = i; + ref->line_pos = pos; + } + + void BOOST_RE_CALL set_base(iterator pos) + { + ref->base = pos; + } +}; + +template +void BOOST_RE_CALL match_results_base::set_first(iterator i) +{ + cow(); + ref->head.second = i; + ref->head.matched = (ref->head.first == ref->head.second) ? false : true; + sub_match* p1 = (sub_match*)(ref+1); + sub_match* p2 = p1 + ref->cmatches; + p1->first = i; + p1->matched = false; + ++p1; + while(p1 != p2) + { + p1->matched = false; + p1->first = ref->tail.second; + p1->second = ref->tail.second; + ++p1; + } +} + +template +void BOOST_RE_CALL match_results_base::set_first(iterator i, size_t pos) +{ + cow(); + ((sub_match*)((char*)ref + sizeof(reference) + sizeof(sub_match) * pos))->first = i; + if(pos == 0) + { + ref->head.second = i; + ref->head.matched = (ref->head.first == ref->head.second) ? false : true; + sub_match* p1 = (sub_match*)(ref+1); + sub_match* p2 = p1 + ref->cmatches; + p1->first = i; + p1->matched = false; + ++p1; + while(p1 != p2) + { + p1->matched = false; + p1->first = ref->tail.second; + p1->second = ref->tail.second; + ++p1; + } + } +} + + +template +match_results_base::match_results_base(const Allocator& a) +{ + ref = (reference*)c_alloc(a).allocate(sizeof(sub_match) + sizeof(reference)); + try + { + new (ref) reference(a); + ref->cmatches = 1; + ref->count = 1; + // construct the sub_match: + try + { + new ((sub_match*)(ref+1)) sub_match(); + } + catch(...) + { + jm_destroy(ref); + throw; + } + } + catch(...) + { + c_alloc(a).deallocate((char*)(void*)ref, sizeof(sub_match) + sizeof(reference)); + throw; + } +} + +template +Allocator BOOST_RE_CALL match_results_base::allocator()const +{ + return *((c_alloc*)ref); +} + +template +inline match_results_base& BOOST_RE_CALL match_results_base::operator=(const match_results_base& m) +{ + if(ref != m.ref) + { + free(); + ref = m.ref; + ++(ref->count); + } + return *this; +} + + +template +void BOOST_RE_CALL match_results_base::free() +{ + if(--(ref->count) == 0) + { + c_alloc a(*ref); + sub_match* p1, *p2; + p1 = (sub_match*)(ref+1); + p2 = p1 + ref->cmatches; + while(p1 != p2) + { + jm_destroy(p1); + ++p1; + } + jm_destroy(ref); + a.deallocate((char*)(void*)ref, sizeof(sub_match) * ref->cmatches + sizeof(reference)); + } +} + +template +bool match_results_base::operator==(const match_results_base& that)const +{ + if(*ref != *(that.ref)) + return false; + const sub_match* p1 = (sub_match*)(ref+1); + const sub_match* p2 = p1 + ref->cmatches; + const sub_match* p3 = (sub_match*)(that.ref+1); + while(p1 != p2) + { + if(*p1 != *p3) + return false; + ++p1; + ++p3; + } + return true; +} + +template +void BOOST_RE_CALL match_results_base::set_size(size_type n) +{ + if(ref->cmatches != n) + { + reference* newref = (reference*)ref->allocate(sizeof(sub_match) * n + sizeof(reference)); + try + { + new (newref) reference(*ref); + newref->count = 1; + newref->cmatches = n; + sub_match* p1, *p2; + p1 = (sub_match*)(newref+1); + p2 = p1 + newref->cmatches; + try + { + while(p1 != p2) + { + new (p1) sub_match(); + ++p1; + } + free(); + } + catch(...) + { + p2 = (sub_match*)(newref+1); + while(p2 != p1) + { + jm_destroy(p2); + ++p2; + } + jm_destroy(ref); + throw; + } + ref = newref; + } + catch(...) + { + ref->deallocate((char*)(void*)newref, sizeof(sub_match) * n + sizeof(reference)); + throw; + } + } +} + +template +void BOOST_RE_CALL match_results_base::set_size(size_type n, iterator i, iterator j) +{ + if(ref->cmatches != n) + { + reference* newref = (reference*)ref->allocate(sizeof(sub_match) * n + sizeof(reference));; + try{ + new (newref) reference(*ref); + newref->count = 1; + newref->cmatches = n; + sub_match* p1 = (sub_match*)(newref+1); + sub_match* p2 = p1 + newref->cmatches; + try + { + while(p1 != p2) + { + new (p1) sub_match(j); + ++p1; + } + free(); + } + catch(...) + { + p2 = (sub_match*)(newref+1); + while(p2 != p1) + { + jm_destroy(p2); + ++p2; + } + jm_destroy(ref); + throw; + } + ref = newref; + } + catch(...) + { + ref->deallocate((char*)(void*)newref, sizeof(sub_match) * n + sizeof(reference)); + throw; + } + } + else + { + cow(); + // set iterators to be i, matched to false: + sub_match* p1, *p2; + p1 = (sub_match*)(ref+1); + p2 = p1 + ref->cmatches; + while(p1 != p2) + { + p1->first = j; + p1->second = j; + p1->matched = false; + ++p1; + } + } + ref->head.first = i; + ref->tail.second = j; + ref->head.matched = ref->tail.matched = true; + ref->null.first = ref->null.second = j; + ref->null.matched = false; +} + +template +inline void BOOST_RE_CALL match_results_base::init_fail(iterator i, iterator j) +{ + set_size(ref->cmatches, i, j); +} + +template +void BOOST_RE_CALL match_results_base::maybe_assign(const match_results_base& m) +{ + sub_match* p1, *p2; + p1 = (sub_match*)(ref+1); + p2 = (sub_match*)(m.ref+1); + iterator base = (*this)[-1].first; + unsigned int len1 = 0; + unsigned int len2 = 0; + unsigned int base1 = 0; + unsigned int base2 = 0; + unsigned int i; + for(i = 0; i < ref->cmatches; ++i) + { + // + // leftmost takes priority over longest: + BOOST_RE_DISTANCE(base, p1->first, base1); + BOOST_RE_DISTANCE(base, p2->first, base2); + if(base1 < base2) return; + if(base2 < base1) break; + + BOOST_RE_DISTANCE(p1->first, p1->second, len1); + BOOST_RE_DISTANCE(p2->first, p2->second, len2); + if((len1 != len2) || ((p1->matched == false) && (p2->matched == true))) + break; + if((p1->matched == true) && (p2->matched == false)) + return; + ++p1; + ++p2; + } + if(i == ref->cmatches) + return; + if(base2 < base1) + *this = m; + else if((len2 > len1) || ((p1->matched == false) && (p2->matched == true)) ) + *this = m; +} + +template +void BOOST_RE_CALL match_results_base::cow() +{ + if(ref->count > 1) + { + reference* newref = (reference*)ref->allocate(sizeof(sub_match) * ref->cmatches + sizeof(reference)); + try{ + new (newref) reference(*ref); + newref->count = 1; + sub_match* p1 = (sub_match*)(newref+1); + sub_match* p2 = p1 + newref->cmatches; + sub_match* p3 = (sub_match*)(ref+1); + try{ + while(p1 != p2) + { + new (p1) sub_match(*p3); + ++p1; + ++p3; + } + } + catch(...) + { + p2 = (sub_match*)(newref+1); + while(p2 != p1) + { + jm_destroy(p2); + ++p2; + } + jm_destroy(ref); + throw; + } + --(ref->count); + ref = newref; + } + catch(...) + { + ref->deallocate((char*)(void*)newref, sizeof(sub_match) * ref->cmatches + sizeof(reference)); + throw; + } + } +} + +} // namespace re_detail + +// +// class match_results +// encapsulates match_results_base, does a deep copy rather than +// reference counting to ensure thread safety when copying +// other match_results instances + +template +class match_results : public re_detail::match_results_base +{ + typedef re_detail::match_results_base base_type; +public: + explicit match_results(const Allocator& a = Allocator()) + : re_detail::match_results_base(a){} + + match_results(const re_detail::match_results_base& m) + : re_detail::match_results_base(m){} + + match_results& operator=(const re_detail::match_results_base& m) + { + // shallow copy + base_type::operator=(m); + return *this; + } + + match_results(const match_results& m); + match_results& operator=(const match_results& m); + /* + bool operator==(const match_results& that)const + { return re_detail::match_results_base::operator==(that); } + bool operator<(const match_results& that) const + { return position() < that.position(); } + */ +}; + +template +match_results::match_results(const match_results& m) + : re_detail::match_results_base(false) +{ + this->ref = + reinterpret_cast::reference *> + (m.ref->allocate(sizeof(sub_match) * m.ref->cmatches + + sizeof(typename re_detail::match_results_base::reference))); + try{ + new (this->ref) typename re_detail::match_results_base::reference(*m.ref); + this->ref->count = 1; + sub_match* p1 = (sub_match*)(this->ref+1); + sub_match* p2 = p1 + this->ref->cmatches; + sub_match* p3 = (sub_match*)(m.ref+1); + try{ + while(p1 != p2) + { + new (p1) sub_match(*p3); + ++p1; + ++p3; + } + } + catch(...) + { + p2 = (sub_match*)(this->ref+1); + while(p2 != p1) + { + re_detail::jm_destroy(p2); + ++p2; + } + re_detail::jm_destroy(ref); + throw; + } + } + catch(...) + { + m.ref->deallocate((char*)(void*)this->ref, sizeof(sub_match) * m.ref->cmatches + sizeof(typename re_detail::match_results_base::reference)); + throw; + } +} + +template +match_results& match_results::operator=(const match_results& m) +{ + match_results t(m); + this->swap(t); + return *this; +} + +namespace re_detail{ +template +iterator BOOST_RE_CALL re_is_set_member(iterator next, + iterator last, + re_set_long* set_, + const reg_expression& e); +} // namepsace re_detail + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#include + +namespace boost{ + +typedef reg_expression, BOOST_RE_DEF_ALLOC(char)> regex; +#ifndef BOOST_RE_NO_WCSTRING +typedef reg_expression, BOOST_RE_DEF_ALLOC(wchar_t)> wregex; +#endif + +typedef match_results cmatch; +#ifndef BOOST_RE_NO_WCSTRING +typedef match_results wcmatch; +#endif + +} // namespace boost + +#include +#include +#include + + +#endif // __cplusplus + +#endif // include + + + + + + + + + + + + + + + + + + + + + + diff --git a/include/boost/regex_traits.hpp b/include/boost/regex_traits.hpp new file mode 100644 index 00000000..8fbee338 --- /dev/null +++ b/include/boost/regex_traits.hpp @@ -0,0 +1,786 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE regex.cpp + * VERSION 3.01 + * DESCRIPTION: Declares regular expression traits classes. + */ + +#ifndef BOOST_REGEX_TRAITS_HPP +#define BOOST_REGEX_TRAITS_HPP + +#include +#include + +namespace boost{ + +#ifdef __BORLANDC__ + #if __BORLANDC__ == 0x530 + #pragma option push -a4 -b -Ve + #elif __BORLANDC__ > 0x530 + #pragma option push -a8 -b -Ve + #endif +#endif + +template +class c_regex_traits; + +namespace re_detail{ + +struct mss +{ + unsigned int id; + const char* what; +}; + +BOOST_RE_IX_DECL bool BOOST_RE_CALL re_lookup_def_collate_name(std::string& buf, const char* name); +BOOST_RE_IX_DECL unsigned int BOOST_RE_CALL re_get_default_message(char* buf, unsigned int len, unsigned int id); +extern BOOST_RE_IX_DECL const char *re_default_error_messages[]; +BOOST_RE_IX_DECL bool BOOST_RE_CALL re_lookup_def_collate_name(std::string& buf, const char* name); +BOOST_RE_IX_DECL bool BOOST_RE_CALL is_combining(wchar_t c); +//extern BOOST_RE_IX_DECL const wchar_t combining_ranges[]; + +#ifndef BOOST_RE_NO_WCSTRING +extern BOOST_RE_IX_DECL wchar_t wide_lower_case_map[]; +extern BOOST_RE_IX_DECL unsigned short wide_unicode_classes[]; +#endif + + +struct BOOST_RE_IX_DECL regex_traits_base +{ + enum char_syntax_type + { + syntax_char = 0, + syntax_open_bracket = 1, // ( + syntax_close_bracket = 2, // ) + syntax_dollar = 3, // $ + syntax_caret = 4, // ^ + syntax_dot = 5, // . + syntax_star = 6, // * + syntax_plus = 7, // + + syntax_question = 8, // ? + syntax_open_set = 9, // [ + syntax_close_set = 10, // ] + syntax_or = 11, // | + syntax_slash = 12, // + syntax_hash = 13, // # + syntax_dash = 14, // - + syntax_open_brace = 15, // { + syntax_close_brace = 16, // } + syntax_digit = 17, // 0-9 + syntax_b = 18, // for \b + syntax_B = 19, // for \B + syntax_left_word = 20, // for \< + syntax_right_word = 21, // for \> + syntax_w = 22, // for \w + syntax_W = 23, // for \W + syntax_start_buffer = 24, // for \` + syntax_end_buffer = 25, // for \' + syntax_newline = 26, // for newline alt + syntax_comma = 27, // for {x,y} + + syntax_a = 28, // for \a + syntax_f = 29, // for \f + syntax_n = 30, // for \n + syntax_r = 31, // for \r + syntax_t = 32, // for \t + syntax_v = 33, // for \v + syntax_x = 34, // for \xdd + syntax_c = 35, // for \cx + syntax_colon = 36, // for [:...:] + syntax_equal = 37, // for [=...=] + + // perl ops: + syntax_e = 38, // for \e + syntax_l = 39, // for \l + syntax_L = 40, // for \L + syntax_u = 41, // for \u + syntax_U = 42, // for \U + syntax_s = 43, // for \s + syntax_S = 44, // for \S + syntax_d = 45, // for \d + syntax_D = 46, // for \D + syntax_E = 47, // for \Q\E + syntax_Q = 48, // for \Q\E + syntax_X = 49, // for \X + syntax_C = 50, // for \C + syntax_Z = 51, // for \Z + syntax_G = 52, // for \G + + syntax_max = 53 + }; +}; + +struct BOOST_RE_IX_DECL c_traits_base : public regex_traits_base +{ +public: + enum{ + char_class_none = 0, + char_class_alpha = 1, + char_class_cntrl = char_class_alpha << 1, + char_class_digit = char_class_cntrl << 1, + char_class_lower = char_class_digit << 1, + char_class_punct = char_class_lower << 1, + char_class_space = char_class_punct << 1, + char_class_upper = char_class_space << 1, + char_class_xdigit = char_class_upper << 1, + char_class_blank = char_class_xdigit << 1, + char_class_unicode = char_class_blank << 1, + char_class_underscore = char_class_unicode << 1, + + char_class_alnum = char_class_alpha | char_class_digit, + char_class_graph = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore, + char_class_print = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore | char_class_blank, + char_class_word = char_class_alpha | char_class_digit | char_class_underscore + }; + static std::string set_message_catalogue(const std::string& s); +protected: + static char regex_message_catalogue[200]; + enum syntax_map_size + { + map_size = UCHAR_MAX + 1 + }; + + static unsigned char syntax_map[map_size]; + static unsigned short class_map[map_size]; + static char lower_case_map[map_size]; + + static jm_uintfast32_t BOOST_RE_CALL do_lookup_class(const char* p); + static bool BOOST_RE_CALL do_lookup_collate(std::string& buf, const char* p); + static void BOOST_RE_CALL do_update_ctype(); + static void BOOST_RE_CALL do_update_collate(); +public: + static std::string error_string(unsigned id); + static char* get_catalogue() { return regex_message_catalogue; } +}; + +} // namespace re_detail + + +template<> +class BOOST_RE_IX_DECL c_regex_traits : public re_detail::c_traits_base +{ +public: + typedef char char_type; + typedef unsigned char uchar_type; + typedef unsigned int size_type; + typedef std::string string_type; + typedef int locale_type; + + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::strlen(p); + } + static unsigned int BOOST_RE_CALL syntax_type(size_type c) + { + return syntax_map[c]; + } + static char BOOST_RE_CALL translate(char c, bool icase) + { + return icase ? lower_case_map[(size_type)(uchar_type)c] : c; + } + static void BOOST_RE_CALL transform(std::string& out, const std::string& in); + + static void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in); + + static bool BOOST_RE_CALL is_separator(char c) + { + return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r')); + } + + static bool BOOST_RE_CALL is_combining(char) + { + return false; + } + + static bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f) + { + return BOOST_RE_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f); + } + + static int BOOST_RE_CALL toi(char c); + static int BOOST_RE_CALL toi(const char*& first, const char* last, int radix); + + static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last) + { + std::string s(first, last); + return do_lookup_class(s.c_str()); + } + + static bool BOOST_RE_CALL lookup_collatename(std::string& buf, const char* first, const char* last) + { + std::string s(first, last); + return do_lookup_collate(buf, s.c_str()); + } + + static locale_type imbue(locale_type l){ return l; } + locale_type BOOST_RE_CALL getloc()const{ return locale_type(); } + + c_regex_traits() + { + init(); + } + ~c_regex_traits() + { + free(); + } + struct sentry + { + sentry(const c_regex_traits&) + { c_regex_traits::update(); } + operator void*() { return this; } + }; + static void update(); +private: + static void init(); + static void free(); + static c_regex_traits i; + + static unsigned sort_type; + static char sort_delim; +}; + +#ifndef BOOST_RE_NO_WCSTRING +template<> +class BOOST_RE_IX_DECL c_regex_traits : public re_detail::c_traits_base +{ +public: + typedef wchar_t char_type; + typedef unsigned short uchar_type; + typedef unsigned int size_type; + typedef std::basic_string string_type; + typedef int locale_type; + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::wcslen(p); + } + static unsigned int BOOST_RE_CALL syntax_type(size_type c); + static wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase) + { + return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : std::towlower(c)) : c; + } + + static void BOOST_RE_CALL transform(std::basic_string& out, const std::basic_string& in); + + static void BOOST_RE_CALL transform_primary(std::basic_string& out, const std::basic_string& in); + + static bool BOOST_RE_CALL is_separator(wchar_t c) + { + return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029)); + } + + static bool BOOST_RE_CALL is_combining(wchar_t c) + { return re_detail::is_combining(c); } + + static bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f) + { + return BOOST_RE_MAKE_BOOL(((uchar_type)c < 256) ? (re_detail::wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f)); + } + + static int BOOST_RE_CALL toi(wchar_t c); + static int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix); + + static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last); + + static bool BOOST_RE_CALL lookup_collatename(std::basic_string& s, const wchar_t* first, const wchar_t* last); + + static locale_type imbue(locale_type l){ return l; } + locale_type BOOST_RE_CALL getloc()const{ return locale_type(); } + c_regex_traits() + { init(); } + ~c_regex_traits() + { free(); } + struct sentry + { + sentry(const c_regex_traits&) + { c_regex_traits::update(); } + operator void*() { return this; } + }; + static void BOOST_RE_CALL update(); + static unsigned int BOOST_RE_CALL strnarrow(char *s1, unsigned int len, const wchar_t *s2); + static unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2); +private: + static bool BOOST_RE_CALL do_iswclass(wchar_t c, jm_uintfast32_t f); + static void BOOST_RE_CALL free(); + static void BOOST_RE_CALL init(); + static bool BOOST_RE_CALL do_lookup_collate(std::basic_string& out, const wchar_t* first, const wchar_t* last); + static c_regex_traits init_; + + static unsigned sort_type; + static wchar_t sort_delim; +}; +#endif + +#if defined(_WIN32) && !defined(BOOST_RE_NO_W32) + +namespace re_detail{ + +struct BOOST_RE_IX_DECL w32_traits_base : public regex_traits_base +{ + enum{ + char_class_none = 0, + char_class_alnum = C1_ALPHA | C1_DIGIT, + char_class_alpha = C1_ALPHA, + char_class_cntrl = C1_CNTRL, + char_class_digit = C1_DIGIT, + char_class_graph = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA, + char_class_lower = C1_LOWER, + char_class_print = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_BLANK | C1_ALPHA, + char_class_punct = C1_PUNCT, + char_class_space = C1_SPACE, + char_class_upper = C1_UPPER, + char_class_xdigit = C1_XDIGIT, + char_class_blank = C1_BLANK, + char_class_underscore = 0x0200, + char_class_word = C1_ALPHA | C1_DIGIT | char_class_underscore, + char_class_unicode = 0x0400 + }; +public: + static std::string set_message_catalogue(const std::string& s); +protected: + static char regex_message_catalogue[200]; + enum syntax_map_size + { + map_size = UCHAR_MAX + 1 + }; + + static unsigned char syntax_map[map_size]; + static unsigned short class_map[map_size]; + static char lower_case_map[map_size]; + + static jm_uintfast32_t BOOST_RE_CALL do_lookup_class(const char* p); + static bool BOOST_RE_CALL do_lookup_collate(std::string& buf, const char* p); + static void BOOST_RE_CALL do_free(); + static void BOOST_RE_CALL do_init(); +public: + static std::string error_string(unsigned id); + static char* get_catalogue() { return regex_message_catalogue; } +}; + +} // namespace re_detail + +template +class w32_regex_traits; + +template<> +class BOOST_RE_IX_DECL w32_regex_traits : public re_detail::w32_traits_base +{ +public: + typedef char char_type; + typedef unsigned char uchar_type; + typedef unsigned int size_type; + typedef std::string string_type; + typedef int locale_type; + + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::strlen(p); + } + static unsigned int BOOST_RE_CALL syntax_type(size_type c) + { + return syntax_map[c]; + } + static char BOOST_RE_CALL translate(char c, bool icase) + { + return icase ? lower_case_map[(size_type)(uchar_type)c] : c; + } + static void BOOST_RE_CALL transform(std::string& out, const std::string& in); + + static void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in); + + static bool BOOST_RE_CALL is_separator(char c) + { + return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r')); + } + + static bool BOOST_RE_CALL is_combining(char) + { + return false; + } + + static bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f) + { + return BOOST_RE_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f); + } + + static int BOOST_RE_CALL toi(char c); + static int BOOST_RE_CALL toi(const char*& first, const char* last, int radix); + + static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last) + { + std::string s(first, last); + return do_lookup_class(s.c_str()); + } + + static bool BOOST_RE_CALL lookup_collatename(std::string& buf, const char* first, const char* last) + { + std::string s(first, last); + return do_lookup_collate(buf, s.c_str()); + } + + static locale_type imbue(locale_type l){ return l; } + locale_type BOOST_RE_CALL getloc()const{ return locale_type(); } + + struct sentry + { + sentry(const w32_regex_traits&) + { w32_regex_traits::update(); } + ~sentry(){} + operator void*() { return this; } + }; + static void update(); + w32_regex_traits(); + ~w32_regex_traits(); +private: + static w32_regex_traits i; +}; + +#ifndef BOOST_RE_NO_WCSTRING +template<> +class BOOST_RE_IX_DECL w32_regex_traits : public re_detail::w32_traits_base +{ +public: + typedef wchar_t char_type; + typedef unsigned short uchar_type; + typedef unsigned int size_type; + typedef std::basic_string string_type; + typedef int locale_type; + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::wcslen(p); + } + static unsigned int BOOST_RE_CALL syntax_type(size_type c); + static wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase) + { + return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : wtolower(c)) : c; + } + + static void BOOST_RE_CALL transform(std::basic_string& out, const std::basic_string& in); + + static void BOOST_RE_CALL transform_primary(std::basic_string& out, const std::basic_string& in); + + static bool BOOST_RE_CALL is_separator(wchar_t c) + { + return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029)); + } + + static bool BOOST_RE_CALL is_combining(wchar_t c) + { return re_detail::is_combining(c); } + + static bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f) + { + return BOOST_RE_MAKE_BOOL(((uchar_type)c < 256) ? (wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f)); + } + + static int BOOST_RE_CALL toi(wchar_t c); + static int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix); + + static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last); + + static bool BOOST_RE_CALL lookup_collatename(std::basic_string& s, const wchar_t* first, const wchar_t* last); + + static locale_type imbue(locale_type l){ return l; } + locale_type BOOST_RE_CALL getloc()const{ return locale_type(); } + + struct sentry + { + sentry(const w32_regex_traits&) + { w32_regex_traits::update(); } + ~sentry(){} + operator void*() { return this; } + }; + static void BOOST_RE_CALL update(); + w32_regex_traits(); + ~w32_regex_traits(); + static unsigned int BOOST_RE_CALL strnarrow(char *s1, unsigned int len, const wchar_t *s2); + static unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2); + +private: + static bool BOOST_RE_CALL do_iswclass(wchar_t c, jm_uintfast32_t f); + static bool BOOST_RE_CALL do_lookup_collate(std::basic_string& out, const wchar_t* first, const wchar_t* last); + static w32_regex_traits init_; + static wchar_t BOOST_RE_CALL wtolower(wchar_t c); + static unsigned short wide_unicode_classes[]; +}; +#endif // Wide strings +#endif // Win32 + +#ifndef BOOST_RE_NO_LOCALE_H + +} // namspace boost + +#include + +namespace boost{ + +namespace re_detail +{ + +template +struct message_data; + +template <> +struct message_data; + +template <> +struct message_data; + +struct BOOST_RE_IX_DECL cpp_regex_traits_base : public regex_traits_base +{ + enum char_class_type + { + char_class_none = 0, + char_class_alnum = std::ctype_base::alnum, + char_class_alpha = std::ctype_base::alpha, + char_class_cntrl = std::ctype_base::cntrl, + char_class_digit = std::ctype_base::digit, + char_class_graph = std::ctype_base::graph, + char_class_lower = std::ctype_base::lower, + char_class_print = std::ctype_base::print, + char_class_punct = std::ctype_base::punct, + char_class_space = std::ctype_base::space, + char_class_upper = std::ctype_base::upper, + char_class_xdigit = std::ctype_base::xdigit, + char_class_blank = 1<<12, + char_class_underscore = 1<<13, + char_class_word = std::ctype_base::alnum | char_class_underscore, + char_class_unicode = 1<<14, + char_class_all_base = char_class_alnum | char_class_alpha | char_class_cntrl + | char_class_digit | char_class_graph | char_class_lower + | char_class_print | char_class_punct | char_class_space + | char_class_upper | char_class_xdigit + }; + + static std::string set_message_catalogue(const std::string& s); +protected: + static char regex_message_cat[200]; +}; + +} // namespace re_detail + +template +class cpp_regex_traits; + +template<> +class BOOST_RE_IX_DECL cpp_regex_traits : public re_detail::cpp_regex_traits_base +{ +private: + re_detail::message_data* pmd; + const unsigned char* psyntax; + char* lower_map; + const std::ctype* pctype; + const std::collate* pcollate; + std::locale locale_inst; + unsigned sort_type; + char sort_delim; + + cpp_regex_traits(const cpp_regex_traits&); + cpp_regex_traits& operator=(const cpp_regex_traits&); + +public: + typedef char char_type; + typedef unsigned char uchar_type; + typedef unsigned int size_type; + typedef std::string string_type; + typedef std::locale locale_type; + + cpp_regex_traits(); + ~cpp_regex_traits(); + + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::strlen(p); + } + unsigned int BOOST_RE_CALL syntax_type(size_type c)const + { + return psyntax[c]; + } + char BOOST_RE_CALL translate(char c, bool icase)const + { + return icase ? lower_map[(size_type)(uchar_type)c] : c; + } + void BOOST_RE_CALL transform(std::string& out, const std::string& in)const + { + out = pcollate->transform(in.c_str(), in.c_str() + in.size()).c_str(); + } + + void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in)const; + + static bool BOOST_RE_CALL is_separator(char c) + { + return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r')); + } + + static bool BOOST_RE_CALL is_combining(char) + { + return false; + } + + bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f)const + { + if(pctype->is((std::ctype::mask)(f & char_class_all_base), c)) + return true; + if((f & char_class_underscore) && (c == '_')) + return true; + if((f & char_class_blank) && ((c == ' ') || (c == '\t'))) + return true; + return false; + } + + int BOOST_RE_CALL toi(char c)const; + int BOOST_RE_CALL toi(const char*& first, const char* last, int radix)const; + + jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last)const; + bool BOOST_RE_CALL lookup_collatename(std::string& s, const char* first, const char* last)const; + + std::string BOOST_RE_CALL error_string(unsigned id)const; + locale_type BOOST_RE_CALL imbue(locale_type l); + locale_type BOOST_RE_CALL BOOST_RE_CALL getloc()const{ return locale_inst; } + + struct sentry + { + sentry(const cpp_regex_traits&){} + operator void*() { return this; } + }; +}; + +#ifndef BOOST_RE_NO_WCSTRING +template<> +class BOOST_RE_IX_DECL cpp_regex_traits : public re_detail::cpp_regex_traits_base +{ +public: + typedef wchar_t char_type; + typedef unsigned short uchar_type; + typedef unsigned int size_type; + typedef std::basic_string string_type; + typedef std::locale locale_type; + +private: + re_detail::message_data* pmd; + const unsigned char* psyntax; + wchar_t* lower_map; + const std::ctype* pctype; + const std::collate* pcollate; + const std::codecvt* pcdv; + std::locale locale_inst; + unsigned int BOOST_RE_CALL do_syntax_type(size_type c)const; + unsigned sort_type; + wchar_t sort_delim; + + cpp_regex_traits(const cpp_regex_traits&); + cpp_regex_traits& operator=(const cpp_regex_traits&); + +public: + + static size_t BOOST_RE_CALL length(const char_type* p) + { + return std::wcslen(p); + } + unsigned int BOOST_RE_CALL syntax_type(size_type c)const + { + return (c < UCHAR_MAX) ? psyntax[c] : do_syntax_type(c); + } + wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase)const + { + return icase ? (((uchar_type)c) <= UCHAR_MAX) ? lower_map[c] : pctype->tolower(c) : c; + } + void BOOST_RE_CALL transform(std::basic_string& out, const std::basic_string& in)const + { + out = pcollate->transform(in.c_str(), in.c_str() + in.size()); + } + + void BOOST_RE_CALL transform_primary(std::basic_string& out, const std::basic_string& in)const; + + static bool BOOST_RE_CALL is_separator(wchar_t c) + { + return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029)); + } + + static bool BOOST_RE_CALL is_combining(wchar_t c) + { return re_detail::is_combining(c); } + + bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f)const + { + if(pctype->is((std::ctype::mask)(f & char_class_all_base), c)) + return true; + if((f & char_class_underscore) && (c == '_')) + return true; + if((f & char_class_blank) && ((c == ' ') || (c == '\t'))) + return true; + if((f & char_class_unicode) && (c > (size_type)(uchar_type)255)) + return true; + return false; + } + + int BOOST_RE_CALL toi(wchar_t c)const; + int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix)const; + + jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const; + bool BOOST_RE_CALL lookup_collatename(std::basic_string& s, const wchar_t* first, const wchar_t* last)const; + + std::string BOOST_RE_CALL error_string(unsigned id)const; + cpp_regex_traits(); + ~cpp_regex_traits(); + locale_type BOOST_RE_CALL imbue(locale_type l); + locale_type BOOST_RE_CALL BOOST_RE_CALL getloc()const{ return locale_inst; } + unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2)const; + + struct sentry + { + sentry(const cpp_regex_traits&){} + operator void*() { return this; } + }; +}; +#endif // BOOST_RE_NO_WCSTRING + +#endif // BOOST_RE_NO_LOCALE_H + +#ifdef BOOST_RE_LOCALE_W32 + +template +class regex_traits : public w32_regex_traits +{ +}; + +#elif defined(BOOST_RE_LOCALE_C) + +template +class regex_traits : public c_regex_traits +{ +}; + +#elif defined(BOOST_RE_LOCALE_CPP) + +template +class regex_traits : public cpp_regex_traits +{ +}; + +#else +#error No default localisation model defined +#endif + +#ifdef __BORLANDC__ + #if __BORLANDC__ > 0x520 + #pragma option pop + #endif +#endif + +} // namespace boost + +#endif // include + diff --git a/index.htm b/index.htm new file mode 100644 index 00000000..caf0449a --- /dev/null +++ b/index.htm @@ -0,0 +1,117 @@ + + + + + + + + + +regex++, Index + + + +  + + + + +

+C++ Boost

+
+

Regex++, Index.

+
+
+(version 3.01, 18 April 2000) +
+
Copyright (c) 1998-2000
+Dr John Maddock
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Dr John Maddock makes no representations
+about the suitability of this software for any purpose.  
+It is provided "as is" without express or implied warranty.
+ +
+
+
+

Contents

+
+ +
+

Copyright Dr John +Maddock 1998-2000 all rights reserved.

+ + + diff --git a/introduction.htm b/introduction.htm new file mode 100644 index 00000000..98974a23 --- /dev/null +++ b/introduction.htm @@ -0,0 +1,416 @@ + + + + + + + +regex++, Introduction + + + + +

 

+ + + + + + +

C++ Boost

+

Regex++, + Introduction.

+

(version 3.01, 18 April 2000)

+
Copyright (c) 1998-2000
+Dr John Maddock
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Dr John Maddock makes no representations
+about the suitability of this software for any purpose.  
+It is provided "as is" without express or implied warranty.
+
+ +
+ +

Introduction

+ +

Regular expressions are a form of pattern-matching that are +often used in text processing; many users will be familiar with +the Unix utilities grep, sed and awk, and +the programming language perl, each of which make +extensive use of regular expressions. Traditionally C++ users +have been limited to the POSIX C API's for manipulating regular +expressions, and while regex++ does provide these API's, they do +not represent the best way to use the library. For example regex++ +can cope with wide character strings, or search and replace +operations (in a manner analogous to either sed or perl), +something that traditional C libraries can not do.

+ +

The class boost::reg_expression +is the key class in this library; it represents a "machine +readable" regular expression, and is very closely modelled +on std::basic_string, think of it as a string plus the actual +state-machine required by the regular expression algorithms. Like +std::basic_string there are two typedefs that are almost always +the means by which this class is referenced:

+ +
namespace boost{
+
+template <class charT, 
+          class traits = regex_traits<charT>, 
+          class Allocator = std::allocator<charT> >
+class reg_expression;
+
+typedef reg_expression<char> regex;
+typedef reg_expression<wchar_t> wregex;
+
+}
+ +

To see how this library can be used, imagine that we are +writing a credit card processing application. Credit card numbers +generally come as a string of 16-digits, separated into groups of +4-digits, and separated by either a space or a hyphen. Before +storing a credit card number in a database (not necessarily +something your customers will appreciate!), we may want to verify +that the number is in the correct format. To match any digit we +could use the regular expression [0-9], however ranges of +characters like this are actually locale dependent. Instead we +should use the POSIX standard form [[:digit:]], or the regex++ +and perl shorthand for this \d (note that many older libraries +tended to be hard-coded to the C-locale, consequently this was +not an issue for them). That leaves us with the following regular +expression to validate credit card number formats:

+ +

(\d{4}[- ]){3}\d

+ +

Here the parenthesis act to group (and mark for future +reference) sub-expressions, and the {4} means "repeat +exactly 4 times". This is an example of the extended regular +expression syntax used by perl, awk and egrep. Regex++ also +supports the older "basic" syntax used by sed and grep, +but this is generally less useful, unless you already have some +basic regular expressions that you need to reuse.

+ +

Now lets take that expression and place it in some C++ code to +validate the format of a credit card number:

+ +
bool validate_card_format(const std::string s)
+{
+   static const boost::regex e("(\\d{4}[- ]){3}\\d{4}");
+   return regex_match(s, e);
+}
+ +

Note how we had to add some extra escapes to the expression: +remember that the escape is seen once by the C++ compiler, before +it gets to be seen by the regular expression engine, consequently +escapes in regular expressions have to be doubled up when +embedding them in C/C++ code.

+ +

Those of you who are familiar with credit card processing, +will have realised that while the format used above is suitable +for human readable card numbers, it does not represent the format +required by online credit card systems; these require the number +as a string of 16 (or possibly 15) digits, without any +intervening spaces. What we need is a means to convert easily +between the two formats, and this is where search and replace +comes in. Those who are familiar with the utilities sed +and perl will already be ahead here; we need two strings - +one a regular expression - the other a "format string" that provides a +description of the text to replace the match with. In regex++ +this search and replace operation is performed with the algorithm +regex_merge, for our credit card example we can write two +algorithms like this to provide the format conversions:

+ +
+// match any format with the regular expression:
+const boost::regex e("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z");
+const std::string machine_format("\\1\\2\\3\\4");
+const std::string human_format("\\1-\\2-\\3-\\4");
+
+std::string machine_readable_card_number(const std::string s)
+{
+   return regex_merge(s, e, machine_format, boost::match_default | boost::format_sed);
+}
+
+std::string human_readable_card_number(const std::string s)
+{
+   return regex_merge(s, e, human_format, boost::match_default | boost::format_sed);
+}
+ +

Here we've used marked sub-expressions in the regular +expression to split out the four parts of the card number as +separate fields, the format string then uses the sed-like syntax +to replace the matched text with the reformatted version.

+ +

In the examples above, we haven't directly manipulated the +results of a regular expression match, however in general the +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 match_results, +as before there are typedefs of this class for the two most +common cases:

+ +
namespace boost{
+typedef match_results<const char*> cmatch;
+typedef match_results<const wchar_t*> wcmatch;
+}
+ +

The algorithms regex_search +and regex_grep (i.e. +finding all matches in a string) make use of match_results to +report what matched.

+ +

Note that these algorithms are not restricted to searching +regular C-strings, any bidirectional iterator type can be +searched, allowing for the possibility of seamlessly searching +almost any kind of data.

+ +

For search and replace operations in addition to the algorithm +regex_merge that +we have already seen, the algorithm regex_format takes +the result of a match and a format string, and produces a new +string by merging the two.

+ +

For those that dislike templates, there is a high level +wrapper class RegEx that is an encapsulation of the lower level +template code - it provides a simplified interface for those that +don't need the full power of the library, and supports only +narrow characters, and the "extended" regular +expression syntax.

+ +

The POSIX API functions: +regcomp, regexec, regfree and regerror, are available in both +narrow character and Unicode versions, and are provided for those +who need compatibility with these API's.

+ +

Finally, note that the library now has run-time localization support, and +recognizes the full POSIX regular expression syntax - including +advanced features like multi-character collating elements and +equivalence classes - as well as providing compatibility with +other regular expression libraries including GNU and BSD4 regex +packages, and to a more limited extent perl 5.

+ +

Installation and Configuration +Options

+ +

When you extract the library from its zip file, you must +preserve its internal directory structure (for example by using +the -d option when extracting). If you didn't do that when +extracting, then you'd better stop reading this, delete the files +you just extracted, and try again!

+ +

Currently the library will automatically detect and configure +itself for Borland, Microsoft and gcc compilers only. The library +will also detect the HP, SGI, Rogue Wave, or Microsoft STL +implementations. If the STL type is detected, then the library +will attempt to extract suitable compiler configuration options +from the STL used. Otherwise the library will assume that the +compiler is fully compliant with the C++ standard: unless various +options are defined to depreciate features not implemented by +your compiler. These options are documented in <boost/re_detail/regex_options.hpp>, +if you want to add permanent configuration options add them to +<boost/re_detail/regex_options.hpp> which is provided for +this purpose - this will allow you to keep your configuration +options between library versions by retaining <boost/re_detail/regex_options.hpp>. +

+ +

The library will encase all code inside namespace boost.

+ +

Unlike some other template libraries, this library consists of +a mixture of template code (in the headers) and static code and +data (in cpp files). Consequently it is necessary to build the +library's support code into a library or archive file before you +can use it, instructions for specific platforms are as follows:

+ +

Borland C++ Builder:

+ +
    +
  • Open up a console window and change to the <boost>\libs\regex\lib + directory.
  • +
  • Select the appropriate makefile (bcb4.mak for C++ Builder + 4, bcb5.mak for C++ Builder 5, and bcc55.mak for the 5.5 + command line tools).
  • +
  • Invoke the makefile (pass the full path to your version + of make if you have more than one version installed, the + makefile relies on the path to make to obtain your C++ + Builder installation directory and tools) for example:
  • +
+ +
make -fbcb5.mak
+ +

The build process will build a variety of .lib and .dll files +(the exact number depends upon the version of Borland's tools you +are using) the .lib and dll files will be in a sub-directory +called bcb4 or bcb5 depending upon the makefile used. To install +the libraries into your development system use:

+ +

make -fbcb5.mak install

+ +

library files will be copied to <BCROOT>/lib and the dll's +to <BCROOT>/bin, where <BCROOT> corresponds to the +install path of your Borland C++ tools.

+ +

You may also remove tempory files created during the build +process (excluding lib and dll files) by using:

+ +

make -fbcb5.mak clean

+ +

Finally when you use regex++ it is only necessary for you to +add the <boost> root director to your list of include +directories for that project. It is not necessary for you to +manually add a .lib file to the project; the headers will +automatically select the correct .lib file for your build mode +and tell the linker to include it. There is one caveat however: +the library can not tell the difference between VCL and non-VCL +enabled builds when building a GUI application from the command +line, if you build from the command line with the 5.5 command +line tools then you must define the pre-processor symbol _NO_VCL +in order to ensure that the correct link libraries are selected: +the C++ Builder IDE normally sets this automatically. Hint, users +of the 5.5 command line tools may want to add a -D_NO_VCL to bcc32.cfg +in order to set this option permanently.

+ +

Microsoft Visual C++ 6

+ +

You need version 6 of MSVC to build this library. If you are +using VC5 then you may want to look at one of the previous +releases of this library +

+ +

Open up a command prompt, which has the necessary MSVC +environment variables defined (for example by using the batch +file Vcvars32.bat installed by the Visual Studio installation), +and change to the <boost>\libs\regex\lib directory.

+ +

Select the correct makefile - vc6.mak for "vanilla" +Visual C++ 6 or vc6-stlport.mak if you are using STLPort.

+ +

Invoke the makefile like this:

+ +

make -fvc6.mak

+ +

You will now have a collaction of lib and dll files in a +"vc6" subdirectory, to install these into your +development system use:

+ +

make -fvc6.mak install

+ +

The lib files will be copied to your <VC6>\lib directory +and the dll files to <VC6>\bin, where <VC6> is the +root of your Visual C++ 6 installation.

+ +

You can delete all the temporary files created during the +build (excluding lib and dll files) using:

+ +

make -fvc6.mak clean

+ +

Finally when you use regex++ it is only necessary for you to +add the <boost> root directory to your list of include +directories for that project. It is not necessary for you to +manually add a .lib file to the project; the headers will +automatically select the correct .lib file for your build mode +and tell the linker to include it.

+ +

Note: if you have replaced the C++ standard library that comes +with VC6, then when you build the library you must ensure that +the environment variables "INCLUDE" and "LIB" +have been updated to reflect the include and library paths for +the new library - see vcvars32.bat (part of your Visual Studio +installation) for more details.

+ +

If you are building with the full STLPort v4, then use the vc6-stlport.mak +file provided (The full STLPort libraries appear not to support +single-thread static builds).

+ +

GCC(2.95)

+ +

There is a conservative makefile for the g++ compiler. From +the command prompt change to the <boost>\libs\regex\lib +directory and type:

+ +

make -f gcc.mak

+ +

At the end of the build process you should have a gcc sub-directory +containing release and debug versions of the library (libregex++.a +and libregex++debug.a). When you build projects that use regex++, +you will need to add the boost install directory to your list of +include paths and add <boost>/libs/gcc/regex++ to your list +of library files.

+ +

Otherwise: run configure, this will set up the headers and +generate makefiles, from the command prompt change to the <boost>\libs\regex +directory and type:

+ +
configure
+make
+ +

Other make options include:

+ +

Make jgrep: builds the jgrep demo.

+ +

Make test: builds and runs the regression tests.

+ +

Make timer: builds the timer demo program.

+ +

Note: gcc2.95.x on Win32 is only supported as cygwin and not +mingw32 (sorry but compiler related bugs prevent this).

+ +

Other compilers:

+ +

Run configure, this will set up the headers and generate +makefiles: from the command prompt change to the <boost>\libs\regex +directory and type:

+ +
configure
+make
+ +

Other make options include:

+ +

Make jgrep: builds the jgrep demo.

+ +

Make test: builds and runs the regression tests.

+ +

Make timer: builds the timer demo program.

+ +

Troubleshooting:

+ +

If make fails after running configure, you may need to +manually disable some options: configure uses simple tests to +determine what features your compiler supports, it does not +stress the compiler's internals to any degree as the actual regex++ +code can do. Other compiler features may be implemented (and +therefore detected by configure) but known to be buggy, again in +this case it may be necessary to disable the feature in order to +compile regex++ to stable code. The output file from configure is +<boost>/boost/re_detail/regex_options.hpp, this file lists +all the macros that can be defined to configure regex++ along +with a description to illustrate their usage, experiment changing +options in regex_options.hpp one at a time until you achieve the +effect you require. If you mail me questions about configure +output, be sure to include both regex_options.hpp and config.log +with your message.
+

+ +
+ +

Copyright Dr +John Maddock 1998-2000 all rights reserved.

+ + diff --git a/jm_opt.in b/jm_opt.in new file mode 100644 index 00000000..1b86792d --- /dev/null +++ b/jm_opt.in @@ -0,0 +1,467 @@ + +#ifndef BOOST_RE_OPT_H +#define BOOST_RE_OPT_H + +#undef BOOST_RE_AUTO_CONFIGURE +#ifdef BOOST_RE_AUTO_CONFIGURE + +/* Compiler options: */ + +/* BOOST_NO_STDC_NAMESPACE C library not in namespace std */ +#undef BOOST_NO_STDC_NAMESPACE + +/* BOOST_RE_NO_MUTABLE Disables use of mutable keyword. */ +#undef BOOST_RE_NO_MUTABLE + +/* BOOST_RE_INT32_LONG If 32-bit integers are long */ +#undef BOOST_RE_INT32_LONG + +/* BOOST_RE_NO_TEMPLATE_FRIEND If template friend declarations are not supported */ +#undef BOOST_RE_NO_TEMPLATE_FRIEND + +/* BOOST_RE_PLATFORM_WINDOWS Platform is MS Windows. */ +#undef BOOST_RE_PLATFORM_WINDOWS + +/* BOOST_RE_PLATFORM_DOS Platform if MSDOS. */ +#undef BOOST_RE_PLATFORM_DOS + +/* BOOST_RE_PLATFORM_W32 Platform is MS Win32 */ +#undef BOOST_RE_PLATFORM_W32 + +/* BOOST_RE_NO_W32 Disable Win32 support even when present */ +#undef BOOST_RE_NO_W32 + +/* BOOST_RE_NO_BOOL If bool is not a distict type. */ +#undef BOOST_RE_NO_BOOL + +/* BOOST_RE_NO_WCHAR_H If there is no */ +#undef BOOST_RE_NO_WCHAR_H + +/* BOOST_RE_NO_WCTYPE_H If there is no */ +#undef BOOST_RE_NO_WCTYPE_H + +/* BOOST_RE_NO_WCSTRING If there are no wcslen and wcsncmp functions available. */ +#undef BOOST_RE_NO_WCSTRING + +/* BOOST_RE_NO_SWPRINTF If there is no swprintf available. */ +#undef BOOST_RE_NO_SWPRINTF + +/* BOOST_RE_NO_WSPRINTF If there is no wsprintf available. */ +#undef BOOST_RE_NO_WSPRINTF + +/* BOOST_RE_NO_MEMBER_TEMPLATES If member function templates or nested template classes are not allowed. */ +#undef BOOST_RE_NO_MEMBER_TEMPLATES + +/* BOOST_RE_NO_TEMPLATE_RETURNS If template functions based on return type are not supported. */ +#undef BOOST_RE_NO_TEMPLATE_RETURNS + +/* BOOST_RE_NO_PARTIAL_FUNC_SPEC If partial template function specialisation is not supported */ +#undef BOOST_RE_NO_PARTIAL_FUNC_SPEC + +/* BOOST_RE_NO_INT64 If 64bit integers are not supported. */ +/* BOOST_RE_INT64t The type of a 64-bit signed integer if available. */ +/* BOOST_RE_IMM64(val) Declares a 64-bit immediate value by appending any + necessary suffix to val. */ +/* BOOST_RE_INT64_T 0 = NA + 1 = short + 2 = int + 3 = long + 4 = int64_t + 5 = long long + 6 = __int64 */ +#undef BOOST_RE_INT64_T_0 +#undef BOOST_RE_INT64_T_1 +#undef BOOST_RE_INT64_T_2 +#undef BOOST_RE_INT64_T_3 +#undef BOOST_RE_INT64_T_4 +#undef BOOST_RE_INT64_T_5 +#undef BOOST_RE_INT64_T_6 + +/* BOOST_RE_NO_CAT Define if the compiler does not support POSIX style + message categories (catopen catgets catclose). */ +#undef BOOST_RE_NO_CAT + +/* BOOST_RE_THREADS Define if the compiler supports multiple threads in + the current translation mode. */ +#undef BOOST_RE_THREADS + +/* BOOST_RE_NESTED_TEMPLATE_DECL Defaults to template, the standard prefix when accessing + nested template classes, can be redefined to nothing if + the compiler does not support this. */ +#undef BOOST_RE_NESTED_TEMPLATE_DECL + +/* BOOST_RE_NO_TEMPLATE_INST If explicit template instantiation with the "template class X" + syntax is not supported */ +#undef BOOST_RE_NO_TEMPLATE_INST + +/* BOOST_RE_NO_TEMPLATE_MERGE If template in separate translation units don't merge at link time */ +#undef BOOST_RE_NO_TEMPLATE_MERGE + +/* BOOST_RE_NO_TEMPLATE_MERGE_A If template merging from library archives is not supported */ +#undef BOOST_RE_NO_TEMPLATE_MERGE_A + +/* BOOST_RE_NO_TEMPLATE_SWITCH_MERGE If merging of templates containing switch statements is not supported */ +#undef BOOST_RE_NO_TEMPLATE_SWITCH_MERGE + +/* BOOST_RE_CALL Optionally define a calling convention for C++ functions */ +#undef BOOST_RE_CALL + +/* BOOST_RE_CCALL Optionally define a calling convention for C functions */ +#undef BOOST_RE_CCALL + +/* BOOST_RE_SIZEOF_SHORT sizeof(short) */ +#undef BOOST_RE_SIZEOF_SHORT + +/* BOOST_RE_SIZEOF_INT sizeof(int) */ +#undef BOOST_RE_SIZEOF_INT + +/* BOOST_RE_SIZEOF_LONG sizeof(long) */ +#undef BOOST_RE_SIZEOF_LONG + +/* BOOST_RE_SIZEOF_WCHAR_T sizeof(wchar_t) */ +#undef BOOST_RE_SIZEOF_WCHAR_T + + +/* STL options: */ + +/* BOOST_RE_NO_EXCEPTION_H Define if you do not a compliant + header file. */ +#undef BOOST_RE_NO_EXCEPTION_H + +/* BOOST_RE_NO_ITERATOR_H Define if you do not have a version of . */ +#undef BOOST_RE_NO_ITERATOR_H + +/* BOOST_RE_NO_MEMORY_H Define if does not fully comply with the + latest standard, and is not auto-recognised, + that means nested template classes + which hardly any compilers support at present. */ +#undef BOOST_RE_NO_MEMORY_H + +/* BOOST_RE_NO_LOCALE_H Define if there is no verion of the standard + header available. */ +#undef BOOST_RE_NO_LOCALE_H + +/* BOOST_RE_NO_STL Disables the use of any supporting STL code. */ +#undef BOOST_RE_NO_STL + +/* BOOST_RE_NO_NOT_EQUAL Disables the generation of operator!= if this + clashes with the STL version. */ + +/* BOOST_RE_NO_STRING_DEF_ARGS Define if std::basic_string not allowed - in + other words if the template is missing its required + default arguments. */ +#undef BOOST_RE_NO_STRING_DEF_ARGS + +/* BOOST_RE_USE_ALGO If not is present */ +#undef BOOST_RE_USE_ALGO + +/* BOOST_RE_OLD_IOSTREAM If the new iostreamm classes are not available */ +#undef BOOST_RE_OLD_IOSTREAM + +/* BOOST_RE_DISTANCE_T For std::distance: + 0 = NA + 1 = std::distance(i, j, n) + 2 = n = std::distance(i, j) */ +#undef BOOST_RE_DISTANCE_T_0 +#undef BOOST_RE_DISTANCE_T_1 +#undef BOOST_RE_DISTANCE_T_2 + +/* BOOST_RE_ITERATOR_T Defines generic standard iterator type if available, use this as + a shortcut to define all the other iterator types. + 1 = std::iterator + 2 = std::iterator */ +#undef BOOST_RE_ITERATOR_T_0 +#undef BOOST_RE_ITERATOR_T_1 +#undef BOOST_RE_ITERATOR_T_2 + +/* BOOST_RE_OI_T For output iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::output_iterator */ +#undef BOOST_RE_OI_T_0 +#undef BOOST_RE_OI_T_1 +#undef BOOST_RE_OI_T_2 +#undef BOOST_RE_OI_T_3 + +/* BOOST_RE_II_T For input iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::input_iterator + 4 = std::input_iterator */ +#undef BOOST_RE_II_T_0 +#undef BOOST_RE_II_T_1 +#undef BOOST_RE_II_T_2 +#undef BOOST_RE_II_T_3 +#undef BOOST_RE_II_T_4 + + +/* BOOST_RE_FI_T For forward iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::forward_iterator */ +#undef BOOST_RE_FI_T_0 +#undef BOOST_RE_FI_T_1 +#undef BOOST_RE_FI_T_2 +#undef BOOST_RE_FI_T_3 + +/* BOOST_RE_BI_T For bidirectional iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::bidirectional_iterator */ +#undef BOOST_RE_BI_T_0 +#undef BOOST_RE_BI_T_1 +#undef BOOST_RE_BI_T_2 +#undef BOOST_RE_BI_T_3 + +/* BOOST_RE_RI_T For random access iterators: + 0 = NA + 1 = std::iterator + 2 = std::iterator + 3 = std::random_access_iterator */ +#undef BOOST_RE_RI_T_0 +#undef BOOST_RE_RI_T_1 +#undef BOOST_RE_RI_T_2 +#undef BOOST_RE_RI_T_3 + +/* BOOST_RE_NO_OI_ASSIGN If output iterators ostream_iterator<>, back_insert_iterator<> and + front_insert_iterator<> do not have assignment operators */ +#undef BOOST_RE_NO_OI_ASSIGN + + +#ifdef BOOST_RE_INT64_T_0 +#define BOOST_RE_NO_INT64 +#elif defined(BOOST_RE_INT64_T_1) +#define BOOST_RE_INT64t short +#define BOOST_RE_IMM64(val) val +#elif defined(BOOST_RE_INT64_T_2) +#define BOOST_RE_INT64t int +#define BOOST_RE_IMM64(val) val +#elif defined(BOOST_RE_INT64_T_3) +#define BOOST_RE_INT64t long +#define BOOST_RE_IMM64(val) val##L +#elif defined(BOOST_RE_INT64_T_4) +#define BOOST_RE_INT64t int64_t +#define BOOST_RE_IMM64(val) INT64_C(val) +#elif defined(BOOST_RE_INT64_T_5) +#define BOOST_RE_INT64t long long +#define BOOST_RE_IMM64(val) val##LL +#elif defined(BOOST_RE_INT64_T_6) +#define BOOST_RE_INT64t __int64 +#define BOOST_RE_IMM64(val) val##i64 +#else +syntax error: unknown value for BOOST_RE_INT64_T +#endif + +#ifdef BOOST_RE_DISTANCE_T_0 +# define BOOST_RE_DISTANCE(i, j, n) n = j - i +#elif defined(BOOST_RE_DISTANCE_T_1) +# define BOOST_RE_DISTANCE(i, j, n) n = std::distance(i, j) +#elif defined(BOOST_RE_DISTANCE_T_2) +# define BOOST_RE_DISTANCE(i, j, n) (n = 0, std::distance(i, j, n)) +#else +syntax erorr +#endif + +#ifdef BOOST_RE_ITERATOR_T_0 +#ifndef BOOST_RE_OI_T_0 +#define BOOST_RE_OI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_II_T_0 +#define BOOST_RE_II_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_FI_T_0 +#define BOOST_RE_FI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_BI_T_0 +#define BOOST_RE_BI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#ifndef BOOST_RE_RI_T_0 +#define BOOST_RE_RI_T_0 BOOST_RE_ITERATOR_T_0 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_1 +#ifndef BOOST_RE_OI_T_1 +#define BOOST_RE_OI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_II_T_1 +#define BOOST_RE_II_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_FI_T_1 +#define BOOST_RE_FI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_BI_T_1 +#define BOOST_RE_BI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#ifndef BOOST_RE_RI_T_1 +#define BOOST_RE_RI_T_1 BOOST_RE_ITERATOR_T_1 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_2 +#ifndef BOOST_RE_OI_T_2 +#define BOOST_RE_OI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_II_T_2 +#define BOOST_RE_II_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_FI_T_2 +#define BOOST_RE_FI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_BI_T_2 +#define BOOST_RE_BI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#ifndef BOOST_RE_RI_T_2 +#define BOOST_RE_RI_T_2 BOOST_RE_ITERATOR_T_2 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_3 +#ifndef BOOST_RE_OI_T_3 +#define BOOST_RE_OI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_II_T_3 +#define BOOST_RE_II_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_FI_T_3 +#define BOOST_RE_FI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_BI_T_3 +#define BOOST_RE_BI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#ifndef BOOST_RE_RI_T_3 +#define BOOST_RE_RI_T_3 BOOST_RE_ITERATOR_T_3 +#endif +#endif + +#ifdef BOOST_RE_ITERATOR_T_4 +#ifndef BOOST_RE_OI_T_4 +#define BOOST_RE_OI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_II_T_4 +#define BOOST_RE_II_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_FI_T_4 +#define BOOST_RE_FI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_BI_T_4 +#define BOOST_RE_BI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#ifndef BOOST_RE_RI_T_4 +#define BOOST_RE_RI_T_4 BOOST_RE_ITERATOR_T_4 +#endif +#endif + +#ifdef BOOST_RE_OI_T_0 +# define BOOST_RE_OUTPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_OI_T_1) +# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_OI_T_2) +# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_OI_T_3) +# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::output_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_II_T_0 +# define BOOST_RE_INPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_II_T_1) +#define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_II_T_2) +#define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_II_T_3) +# define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator +#elif defined(BOOST_RE_II_T_4) +# define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_FI_T_0 +# define BOOST_RE_FWD_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_FI_T_1) +# define BOOST_RE_FWD_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_FI_T_2) +# define BOOST_RE_FWD_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_FI_T_3) +# define BOOST_RE_FWD_ITERATOR(T, D) std::forward_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_BI_T_0 +# define BOOST_RE_BIDI_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_BI_T_1) +# define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_BI_T_2) +# define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_BI_T_3) +# define BOOST_RE_BIDI_ITERATOR(T, D) std::bidirectional_iterator +#else +syntax error +#endif + +#ifdef BOOST_RE_RI_T_0 +# define BOOST_RE_RA_ITERATOR(T, D) boost::re_detail::dummy_iterator_base +#elif defined(BOOST_RE_RI_T_1) +# define BOOST_RE_RA_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_RI_T_2) +# define BOOST_RE_RA_ITERATOR(T, D) std::iterator +#elif defined(BOOST_RE_RI_T_3) +# define BOOST_RE_RA_ITERATOR(T, D) std::random_access_iterator +#else +syntax error +#endif + + +#ifndef BOOST_RE_NO_EXCEPTION_H +#include +#endif + +#ifndef BOOST_RE_NO_ITERATOR_H +#include +#ifdef BOOST_RE_USE_ALGO +#include +#else +#include +#endif +#endif + +#if defined(BOOST_RE_NO_MEMORY_H) || defined(__GNUC__) + #define BOOST_RE_OLD_ALLOCATORS + #define REBIND_INSTANCE(x, y, inst) re_alloc_binder(inst) + #define REBIND_TYPE(x, y) re_alloc_binder + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_DEFAULT_PARAM( boost::re_detail::jm_def_alloc ) + #define BOOST_RE_DEF_ALLOC(x) boost::re_detail::jm_def_alloc + + #define BOOST_RE_NEED_BINDER + #define BOOST_RE_NEED_ALLOC +#else +#include + #define REBIND_INSTANCE(x, y, inst) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other(inst) + #define REBIND_TYPE(x, y) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind::other + #define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( std::allocator ) + #define BOOST_RE_DEF_ALLOC(x) std::allocator +#endif + + +#endif // BOOST_RE_AUTO_CONFIGURE + + +#endif /* BOOST_RE_OPT_H */ + + + + + + + + + + + diff --git a/lib/bc55.mak b/lib/bc55.mak new file mode 100644 index 00000000..49a7bc9d --- /dev/null +++ b/lib/bc55.mak @@ -0,0 +1,347 @@ +# +# auto generated makefile for C++ Builder +# +# usage: +# make +# brings libraries up to date +# make install +# brings libraries up to date and copies binaries to your C++ Builder /lib and /bin directories (recomended) +# make clean +# removes all temporary files. + +# +# Add additional compiler options here: +# +XCFLAGS= +# +# add additional linker flags here: +# +XLFLAGS= +# +# add additional static-library creation flags here: +# +XSFLAGS= + +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + + +ALL_HEADER=../../../boost/cregex.hpp ../../../boost/pattern_except.hpp ../../../boost/regex.hpp ../../../boost/regex_traits.hpp ../../../boost/re_detail/fileiter.hpp ../../../boost/re_detail/jm_opt.hpp ../../../boost/re_detail/regex_compile.hpp ../../../boost/re_detail/regex_config.hpp ../../../boost/re_detail/regex_cstring.hpp ../../../boost/re_detail/regex_format.hpp ../../../boost/re_detail/regex_kmp.hpp ../../../boost/re_detail/regex_library_include.hpp ../../../boost/re_detail/regex_match.hpp ../../../boost/re_detail/regex_options.hpp ../../../boost/re_detail/regex_raw_buffer.hpp ../../../boost/re_detail/regex_split.hpp ../../../boost/re_detail/regex_stack.hpp ../../../boost/re_detail/regex_synch.hpp + +all : bcb5 bcb5\bcb5re300 bcb5\bcb5re300.lib bcb5\bcb5re300m bcb5\bcb5re300m.lib bcb5\bcb5re300lm bcb5\bcb5re300lm.lib bcb5\bcb5re300l bcb5\bcb5re300l.lib + +clean : bcb5re300_clean bcb5re300m_clean bcb5re300lm_clean bcb5re300l_clean + +install : all + copy bcb5\bcb5re300.lib $(BCROOT)\lib + copy bcb5\bcb5re300m.lib $(BCROOT)\lib + copy bcb5\bcb5re300lm.lib $(BCROOT)\lib + copy bcb5\bcb5re300lm.dll $(BCROOT)\bin + copy bcb5\bcb5re300l.lib $(BCROOT)\lib + copy bcb5\bcb5re300l.dll $(BCROOT)\bin + +bcb5 : + -mkdir bcb5 + + +######################################################## +# +# section for bcb5re300.lib +# +######################################################## +bcb5\bcb5re300\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb5\bcb5re300\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb5\bcb5re300\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb5\bcb5re300\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\cregex.obj ../src/cregex.cpp +| + +bcb5\bcb5re300\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\fileiter.obj ../src/fileiter.cpp +| + +bcb5\bcb5re300\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\posix_api.obj ../src/posix_api.cpp +| + +bcb5\bcb5re300\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\regex.obj ../src/regex.cpp +| + +bcb5\bcb5re300\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\regex_debug.obj ../src/regex_debug.cpp +| + +bcb5\bcb5re300\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\regex_synch.obj ../src/regex_synch.cpp +| + +bcb5\bcb5re300\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb5\bcb5re300\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb5\bcb5re300 : + -mkdir bcb5\bcb5re300 + +bcb5re300_clean : + del bcb5\bcb5re300\*.obj + del bcb5\bcb5re300\*.il? + del bcb5\bcb5re300\*.csm + del bcb5\bcb5re300\*.tds + +bcb5\bcb5re300.lib : bcb5\bcb5re300\c_regex_traits.obj bcb5\bcb5re300\c_regex_traits_common.obj bcb5\bcb5re300\cpp_regex_traits.obj bcb5\bcb5re300\cregex.obj bcb5\bcb5re300\fileiter.obj bcb5\bcb5re300\posix_api.obj bcb5\bcb5re300\regex.obj bcb5\bcb5re300\regex_debug.obj bcb5\bcb5re300\regex_synch.obj bcb5\bcb5re300\w32_regex_traits.obj bcb5\bcb5re300\wide_posix_api.obj + tlib @&&| +/P32 /u /a $(XSFLAGS) bcb5\bcb5re300.lib +bcb5\bcb5re300\c_regex_traits.obj +bcb5\bcb5re300\c_regex_traits_common.obj +bcb5\bcb5re300\cpp_regex_traits.obj +bcb5\bcb5re300\cregex.obj +bcb5\bcb5re300\fileiter.obj +bcb5\bcb5re300\posix_api.obj +bcb5\bcb5re300\regex.obj +bcb5\bcb5re300\regex_debug.obj +bcb5\bcb5re300\regex_synch.obj +bcb5\bcb5re300\w32_regex_traits.obj +bcb5\bcb5re300\wide_posix_api.obj +| + +######################################################## +# +# section for bcb5re300m.lib +# +######################################################## +bcb5\bcb5re300m\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb5\bcb5re300m\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb5\bcb5re300m\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb5\bcb5re300m\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\cregex.obj ../src/cregex.cpp +| + +bcb5\bcb5re300m\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\fileiter.obj ../src/fileiter.cpp +| + +bcb5\bcb5re300m\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\posix_api.obj ../src/posix_api.cpp +| + +bcb5\bcb5re300m\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\regex.obj ../src/regex.cpp +| + +bcb5\bcb5re300m\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\regex_debug.obj ../src/regex_debug.cpp +| + +bcb5\bcb5re300m\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\regex_synch.obj ../src/regex_synch.cpp +| + +bcb5\bcb5re300m\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb5\bcb5re300m\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb5\bcb5re300m : + -mkdir bcb5\bcb5re300m + +bcb5re300m_clean : + del bcb5\bcb5re300m\*.obj + del bcb5\bcb5re300m\*.il? + del bcb5\bcb5re300m\*.csm + del bcb5\bcb5re300m\*.tds + +bcb5\bcb5re300m.lib : bcb5\bcb5re300m\c_regex_traits.obj bcb5\bcb5re300m\c_regex_traits_common.obj bcb5\bcb5re300m\cpp_regex_traits.obj bcb5\bcb5re300m\cregex.obj bcb5\bcb5re300m\fileiter.obj bcb5\bcb5re300m\posix_api.obj bcb5\bcb5re300m\regex.obj bcb5\bcb5re300m\regex_debug.obj bcb5\bcb5re300m\regex_synch.obj bcb5\bcb5re300m\w32_regex_traits.obj bcb5\bcb5re300m\wide_posix_api.obj + tlib @&&| +/P32 /u /a $(XSFLAGS) bcb5\bcb5re300m.lib +bcb5\bcb5re300m\c_regex_traits.obj +bcb5\bcb5re300m\c_regex_traits_common.obj +bcb5\bcb5re300m\cpp_regex_traits.obj +bcb5\bcb5re300m\cregex.obj +bcb5\bcb5re300m\fileiter.obj +bcb5\bcb5re300m\posix_api.obj +bcb5\bcb5re300m\regex.obj +bcb5\bcb5re300m\regex_debug.obj +bcb5\bcb5re300m\regex_synch.obj +bcb5\bcb5re300m\w32_regex_traits.obj +bcb5\bcb5re300m\wide_posix_api.obj +| + +######################################################## +# +# section for bcb5re300lm.lib +# +######################################################## +bcb5\bcb5re300lm\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb5\bcb5re300lm\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb5\bcb5re300lm\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb5\bcb5re300lm\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\cregex.obj ../src/cregex.cpp +| + +bcb5\bcb5re300lm\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\fileiter.obj ../src/fileiter.cpp +| + +bcb5\bcb5re300lm\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\posix_api.obj ../src/posix_api.cpp +| + +bcb5\bcb5re300lm\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\regex.obj ../src/regex.cpp +| + +bcb5\bcb5re300lm\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\regex_debug.obj ../src/regex_debug.cpp +| + +bcb5\bcb5re300lm\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\regex_synch.obj ../src/regex_synch.cpp +| + +bcb5\bcb5re300lm\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb5\bcb5re300lm\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb5\bcb5re300lm : + -mkdir bcb5\bcb5re300lm + +bcb5re300lm_clean : + del bcb5\bcb5re300lm\*.obj + del bcb5\bcb5re300lm\*.il? + del bcb5\bcb5re300lm\*.csm + del bcb5\bcb5re300lm\*.tds + del bcb5\*.tds + +bcb5\bcb5re300lm.lib : bcb5\bcb5re300lm\c_regex_traits.obj bcb5\bcb5re300lm\c_regex_traits_common.obj bcb5\bcb5re300lm\cpp_regex_traits.obj bcb5\bcb5re300lm\cregex.obj bcb5\bcb5re300lm\fileiter.obj bcb5\bcb5re300lm\posix_api.obj bcb5\bcb5re300lm\regex.obj bcb5\bcb5re300lm\regex_debug.obj bcb5\bcb5re300lm\regex_synch.obj bcb5\bcb5re300lm\w32_regex_traits.obj bcb5\bcb5re300lm\wide_posix_api.obj + bcc32 @&&| +-DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; -ebcb5\bcb5re300lm.dll bcb5\bcb5re300lm\c_regex_traits.obj bcb5\bcb5re300lm\c_regex_traits_common.obj bcb5\bcb5re300lm\cpp_regex_traits.obj bcb5\bcb5re300lm\cregex.obj bcb5\bcb5re300lm\fileiter.obj bcb5\bcb5re300lm\posix_api.obj bcb5\bcb5re300lm\regex.obj bcb5\bcb5re300lm\regex_debug.obj bcb5\bcb5re300lm\regex_synch.obj bcb5\bcb5re300lm\w32_regex_traits.obj bcb5\bcb5re300lm\wide_posix_api.obj $(XLFLAGS) +| + implib bcb5\bcb5re300lm.lib -c bcb5\bcb5re300lm.dll + +######################################################## +# +# section for bcb5re300l.lib +# +######################################################## +bcb5\bcb5re300l\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb5\bcb5re300l\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb5\bcb5re300l\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb5\bcb5re300l\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\cregex.obj ../src/cregex.cpp +| + +bcb5\bcb5re300l\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\fileiter.obj ../src/fileiter.cpp +| + +bcb5\bcb5re300l\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\posix_api.obj ../src/posix_api.cpp +| + +bcb5\bcb5re300l\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\regex.obj ../src/regex.cpp +| + +bcb5\bcb5re300l\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\regex_debug.obj ../src/regex_debug.cpp +| + +bcb5\bcb5re300l\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\regex_synch.obj ../src/regex_synch.cpp +| + +bcb5\bcb5re300l\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb5\bcb5re300l\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb5\bcb5re300l : + -mkdir bcb5\bcb5re300l + +bcb5re300l_clean : + del bcb5\bcb5re300l\*.obj + del bcb5\bcb5re300l\*.il? + del bcb5\bcb5re300l\*.csm + del bcb5\bcb5re300l\*.tds + del bcb5\*.tds + +bcb5\bcb5re300l.lib : bcb5\bcb5re300l\c_regex_traits.obj bcb5\bcb5re300l\c_regex_traits_common.obj bcb5\bcb5re300l\cpp_regex_traits.obj bcb5\bcb5re300l\cregex.obj bcb5\bcb5re300l\fileiter.obj bcb5\bcb5re300l\posix_api.obj bcb5\bcb5re300l\regex.obj bcb5\bcb5re300l\regex_debug.obj bcb5\bcb5re300l\regex_synch.obj bcb5\bcb5re300l\w32_regex_traits.obj bcb5\bcb5re300l\wide_posix_api.obj + bcc32 @&&| +-DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; -ebcb5\bcb5re300l.dll bcb5\bcb5re300l\c_regex_traits.obj bcb5\bcb5re300l\c_regex_traits_common.obj bcb5\bcb5re300l\cpp_regex_traits.obj bcb5\bcb5re300l\cregex.obj bcb5\bcb5re300l\fileiter.obj bcb5\bcb5re300l\posix_api.obj bcb5\bcb5re300l\regex.obj bcb5\bcb5re300l\regex_debug.obj bcb5\bcb5re300l\regex_synch.obj bcb5\bcb5re300l\w32_regex_traits.obj bcb5\bcb5re300l\wide_posix_api.obj $(XLFLAGS) +| + implib bcb5\bcb5re300l.lib -c bcb5\bcb5re300l.dll + diff --git a/lib/bcb4.mak b/lib/bcb4.mak new file mode 100644 index 00000000..8b408f88 --- /dev/null +++ b/lib/bcb4.mak @@ -0,0 +1,500 @@ +# +# auto generated makefile for C++ Builder +# +# usage: +# make +# brings libraries up to date +# make install +# brings libraries up to date and copies binaries to your C++ Builder /lib and /bin directories (recomended) +# make clean +# removes all temporary files. + +# +# Add additional compiler options here: +# +XCFLAGS= +# +# add additional linker flags here: +# +XLFLAGS= +# +# add additional static-library creation flags here: +# +XSFLAGS= + +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + + +ALL_HEADER=../../../boost/cregex.hpp ../../../boost/pattern_except.hpp ../../../boost/regex.hpp ../../../boost/regex_traits.hpp ../../../boost/re_detail/fileiter.hpp ../../../boost/re_detail/jm_opt.hpp ../../../boost/re_detail/regex_compile.hpp ../../../boost/re_detail/regex_config.hpp ../../../boost/re_detail/regex_cstring.hpp ../../../boost/re_detail/regex_format.hpp ../../../boost/re_detail/regex_kmp.hpp ../../../boost/re_detail/regex_library_include.hpp ../../../boost/re_detail/regex_match.hpp ../../../boost/re_detail/regex_options.hpp ../../../boost/re_detail/regex_raw_buffer.hpp ../../../boost/re_detail/regex_split.hpp ../../../boost/re_detail/regex_stack.hpp ../../../boost/re_detail/regex_synch.hpp + +all : bcb4 bcb4\bcb4re300 bcb4\bcb4re300.lib bcb4\bcb4re300m bcb4\bcb4re300m.lib bcb4\bcb4re300v bcb4\bcb4re300v.lib bcb4\bcb4re300lv bcb4\bcb4re300lv.lib bcb4\bcb4re300lm bcb4\bcb4re300lm.lib bcb4\bcb4re300l bcb4\bcb4re300l.lib + +clean : bcb4re300_clean bcb4re300m_clean bcb4re300v_clean bcb4re300lv_clean bcb4re300lm_clean bcb4re300l_clean + +install : all + copy bcb4\bcb4re300.lib $(BCROOT)\lib + copy bcb4\bcb4re300m.lib $(BCROOT)\lib + copy bcb4\bcb4re300v.lib $(BCROOT)\lib + copy bcb4\bcb4re300lv.lib $(BCROOT)\lib + copy bcb4\bcb4re300lv.dll $(BCROOT)\bin + copy bcb4\bcb4re300lm.lib $(BCROOT)\lib + copy bcb4\bcb4re300lm.dll $(BCROOT)\bin + copy bcb4\bcb4re300l.lib $(BCROOT)\lib + copy bcb4\bcb4re300l.dll $(BCROOT)\bin + +bcb4 : + -mkdir bcb4 + + +######################################################## +# +# section for bcb4re300.lib +# +######################################################## +bcb4\bcb4re300\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb4\bcb4re300\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb4\bcb4re300\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb4\bcb4re300\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300\cregex.obj ../src/cregex.cpp +| + +bcb4\bcb4re300\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300\fileiter.obj ../src/fileiter.cpp +| + +bcb4\bcb4re300\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300\posix_api.obj ../src/posix_api.cpp +| + +bcb4\bcb4re300\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300\regex.obj ../src/regex.cpp +| + +bcb4\bcb4re300\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300\regex_debug.obj ../src/regex_debug.cpp +| + +bcb4\bcb4re300\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300\regex_synch.obj ../src/regex_synch.cpp +| + +bcb4\bcb4re300\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb4\bcb4re300\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb4\bcb4re300 : + -mkdir bcb4\bcb4re300 + +bcb4re300_clean : + del bcb4\bcb4re300\*.obj + del bcb4\bcb4re300\*.il? + del bcb4\bcb4re300\*.csm + del bcb4\bcb4re300\*.tds + +bcb4\bcb4re300.lib : bcb4\bcb4re300\c_regex_traits.obj bcb4\bcb4re300\c_regex_traits_common.obj bcb4\bcb4re300\cpp_regex_traits.obj bcb4\bcb4re300\cregex.obj bcb4\bcb4re300\fileiter.obj bcb4\bcb4re300\posix_api.obj bcb4\bcb4re300\regex.obj bcb4\bcb4re300\regex_debug.obj bcb4\bcb4re300\regex_synch.obj bcb4\bcb4re300\w32_regex_traits.obj bcb4\bcb4re300\wide_posix_api.obj + tlib @&&| +/P32 /u /a $(XSFLAGS) bcb4\bcb4re300.lib +bcb4\bcb4re300\c_regex_traits.obj +bcb4\bcb4re300\c_regex_traits_common.obj +bcb4\bcb4re300\cpp_regex_traits.obj +bcb4\bcb4re300\cregex.obj +bcb4\bcb4re300\fileiter.obj +bcb4\bcb4re300\posix_api.obj +bcb4\bcb4re300\regex.obj +bcb4\bcb4re300\regex_debug.obj +bcb4\bcb4re300\regex_synch.obj +bcb4\bcb4re300\w32_regex_traits.obj +bcb4\bcb4re300\wide_posix_api.obj +| + +######################################################## +# +# section for bcb4re300m.lib +# +######################################################## +bcb4\bcb4re300m\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300m\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb4\bcb4re300m\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300m\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb4\bcb4re300m\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300m\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb4\bcb4re300m\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300m\cregex.obj ../src/cregex.cpp +| + +bcb4\bcb4re300m\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300m\fileiter.obj ../src/fileiter.cpp +| + +bcb4\bcb4re300m\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300m\posix_api.obj ../src/posix_api.cpp +| + +bcb4\bcb4re300m\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300m\regex.obj ../src/regex.cpp +| + +bcb4\bcb4re300m\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300m\regex_debug.obj ../src/regex_debug.cpp +| + +bcb4\bcb4re300m\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300m\regex_synch.obj ../src/regex_synch.cpp +| + +bcb4\bcb4re300m\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300m\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb4\bcb4re300m\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300m\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb4\bcb4re300m : + -mkdir bcb4\bcb4re300m + +bcb4re300m_clean : + del bcb4\bcb4re300m\*.obj + del bcb4\bcb4re300m\*.il? + del bcb4\bcb4re300m\*.csm + del bcb4\bcb4re300m\*.tds + +bcb4\bcb4re300m.lib : bcb4\bcb4re300m\c_regex_traits.obj bcb4\bcb4re300m\c_regex_traits_common.obj bcb4\bcb4re300m\cpp_regex_traits.obj bcb4\bcb4re300m\cregex.obj bcb4\bcb4re300m\fileiter.obj bcb4\bcb4re300m\posix_api.obj bcb4\bcb4re300m\regex.obj bcb4\bcb4re300m\regex_debug.obj bcb4\bcb4re300m\regex_synch.obj bcb4\bcb4re300m\w32_regex_traits.obj bcb4\bcb4re300m\wide_posix_api.obj + tlib @&&| +/P32 /u /a $(XSFLAGS) bcb4\bcb4re300m.lib +bcb4\bcb4re300m\c_regex_traits.obj +bcb4\bcb4re300m\c_regex_traits_common.obj +bcb4\bcb4re300m\cpp_regex_traits.obj +bcb4\bcb4re300m\cregex.obj +bcb4\bcb4re300m\fileiter.obj +bcb4\bcb4re300m\posix_api.obj +bcb4\bcb4re300m\regex.obj +bcb4\bcb4re300m\regex_debug.obj +bcb4\bcb4re300m\regex_synch.obj +bcb4\bcb4re300m\w32_regex_traits.obj +bcb4\bcb4re300m\wide_posix_api.obj +| + +######################################################## +# +# section for bcb4re300v.lib +# +######################################################## +bcb4\bcb4re300v\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300v\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb4\bcb4re300v\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300v\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb4\bcb4re300v\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300v\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb4\bcb4re300v\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300v\cregex.obj ../src/cregex.cpp +| + +bcb4\bcb4re300v\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300v\fileiter.obj ../src/fileiter.cpp +| + +bcb4\bcb4re300v\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300v\posix_api.obj ../src/posix_api.cpp +| + +bcb4\bcb4re300v\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300v\regex.obj ../src/regex.cpp +| + +bcb4\bcb4re300v\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300v\regex_debug.obj ../src/regex_debug.cpp +| + +bcb4\bcb4re300v\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300v\regex_synch.obj ../src/regex_synch.cpp +| + +bcb4\bcb4re300v\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300v\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb4\bcb4re300v\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb4\bcb4re300v\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb4\bcb4re300v : + -mkdir bcb4\bcb4re300v + +bcb4re300v_clean : + del bcb4\bcb4re300v\*.obj + del bcb4\bcb4re300v\*.il? + del bcb4\bcb4re300v\*.csm + del bcb4\bcb4re300v\*.tds + +bcb4\bcb4re300v.lib : bcb4\bcb4re300v\c_regex_traits.obj bcb4\bcb4re300v\c_regex_traits_common.obj bcb4\bcb4re300v\cpp_regex_traits.obj bcb4\bcb4re300v\cregex.obj bcb4\bcb4re300v\fileiter.obj bcb4\bcb4re300v\posix_api.obj bcb4\bcb4re300v\regex.obj bcb4\bcb4re300v\regex_debug.obj bcb4\bcb4re300v\regex_synch.obj bcb4\bcb4re300v\w32_regex_traits.obj bcb4\bcb4re300v\wide_posix_api.obj + tlib @&&| +/P32 /u /a $(XSFLAGS) bcb4\bcb4re300v.lib +bcb4\bcb4re300v\c_regex_traits.obj +bcb4\bcb4re300v\c_regex_traits_common.obj +bcb4\bcb4re300v\cpp_regex_traits.obj +bcb4\bcb4re300v\cregex.obj +bcb4\bcb4re300v\fileiter.obj +bcb4\bcb4re300v\posix_api.obj +bcb4\bcb4re300v\regex.obj +bcb4\bcb4re300v\regex_debug.obj +bcb4\bcb4re300v\regex_synch.obj +bcb4\bcb4re300v\w32_regex_traits.obj +bcb4\bcb4re300v\wide_posix_api.obj +| + +######################################################## +# +# section for bcb4re300lv.lib +# +######################################################## +bcb4\bcb4re300lv\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lv\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb4\bcb4re300lv\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lv\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb4\bcb4re300lv\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lv\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb4\bcb4re300lv\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lv\cregex.obj ../src/cregex.cpp +| + +bcb4\bcb4re300lv\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lv\fileiter.obj ../src/fileiter.cpp +| + +bcb4\bcb4re300lv\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lv\posix_api.obj ../src/posix_api.cpp +| + +bcb4\bcb4re300lv\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lv\regex.obj ../src/regex.cpp +| + +bcb4\bcb4re300lv\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lv\regex_debug.obj ../src/regex_debug.cpp +| + +bcb4\bcb4re300lv\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lv\regex_synch.obj ../src/regex_synch.cpp +| + +bcb4\bcb4re300lv\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lv\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb4\bcb4re300lv\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lv\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb4\bcb4re300lv : + -mkdir bcb4\bcb4re300lv + +bcb4re300lv_clean : + del bcb4\bcb4re300lv\*.obj + del bcb4\bcb4re300lv\*.il? + del bcb4\bcb4re300lv\*.csm + del bcb4\bcb4re300lv\*.tds + del bcb4\*.tds + +bcb4\bcb4re300lv.lib : bcb4\bcb4re300lv\c_regex_traits.obj bcb4\bcb4re300lv\c_regex_traits_common.obj bcb4\bcb4re300lv\cpp_regex_traits.obj bcb4\bcb4re300lv\cregex.obj bcb4\bcb4re300lv\fileiter.obj bcb4\bcb4re300lv\posix_api.obj bcb4\bcb4re300lv\regex.obj bcb4\bcb4re300lv\regex_debug.obj bcb4\bcb4re300lv\regex_synch.obj bcb4\bcb4re300lv\w32_regex_traits.obj bcb4\bcb4re300lv\wide_posix_api.obj + bcc32 @&&| +-DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; -ebcb4\bcb4re300lv.dll bcb4\bcb4re300lv\c_regex_traits.obj bcb4\bcb4re300lv\c_regex_traits_common.obj bcb4\bcb4re300lv\cpp_regex_traits.obj bcb4\bcb4re300lv\cregex.obj bcb4\bcb4re300lv\fileiter.obj bcb4\bcb4re300lv\posix_api.obj bcb4\bcb4re300lv\regex.obj bcb4\bcb4re300lv\regex_debug.obj bcb4\bcb4re300lv\regex_synch.obj bcb4\bcb4re300lv\w32_regex_traits.obj bcb4\bcb4re300lv\wide_posix_api.obj $(XLFLAGS) +| + implib bcb4\bcb4re300lv.lib -c bcb4\bcb4re300lv.dll + +######################################################## +# +# section for bcb4re300lm.lib +# +######################################################## +bcb4\bcb4re300lm\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lm\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb4\bcb4re300lm\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lm\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb4\bcb4re300lm\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lm\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb4\bcb4re300lm\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lm\cregex.obj ../src/cregex.cpp +| + +bcb4\bcb4re300lm\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lm\fileiter.obj ../src/fileiter.cpp +| + +bcb4\bcb4re300lm\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lm\posix_api.obj ../src/posix_api.cpp +| + +bcb4\bcb4re300lm\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lm\regex.obj ../src/regex.cpp +| + +bcb4\bcb4re300lm\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lm\regex_debug.obj ../src/regex_debug.cpp +| + +bcb4\bcb4re300lm\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lm\regex_synch.obj ../src/regex_synch.cpp +| + +bcb4\bcb4re300lm\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lm\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb4\bcb4re300lm\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300lm\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb4\bcb4re300lm : + -mkdir bcb4\bcb4re300lm + +bcb4re300lm_clean : + del bcb4\bcb4re300lm\*.obj + del bcb4\bcb4re300lm\*.il? + del bcb4\bcb4re300lm\*.csm + del bcb4\bcb4re300lm\*.tds + del bcb4\*.tds + +bcb4\bcb4re300lm.lib : bcb4\bcb4re300lm\c_regex_traits.obj bcb4\bcb4re300lm\c_regex_traits_common.obj bcb4\bcb4re300lm\cpp_regex_traits.obj bcb4\bcb4re300lm\cregex.obj bcb4\bcb4re300lm\fileiter.obj bcb4\bcb4re300lm\posix_api.obj bcb4\bcb4re300lm\regex.obj bcb4\bcb4re300lm\regex_debug.obj bcb4\bcb4re300lm\regex_synch.obj bcb4\bcb4re300lm\w32_regex_traits.obj bcb4\bcb4re300lm\wide_posix_api.obj + bcc32 @&&| +-DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; -ebcb4\bcb4re300lm.dll bcb4\bcb4re300lm\c_regex_traits.obj bcb4\bcb4re300lm\c_regex_traits_common.obj bcb4\bcb4re300lm\cpp_regex_traits.obj bcb4\bcb4re300lm\cregex.obj bcb4\bcb4re300lm\fileiter.obj bcb4\bcb4re300lm\posix_api.obj bcb4\bcb4re300lm\regex.obj bcb4\bcb4re300lm\regex_debug.obj bcb4\bcb4re300lm\regex_synch.obj bcb4\bcb4re300lm\w32_regex_traits.obj bcb4\bcb4re300lm\wide_posix_api.obj $(XLFLAGS) +| + implib bcb4\bcb4re300lm.lib -c bcb4\bcb4re300lm.dll + +######################################################## +# +# section for bcb4re300l.lib +# +######################################################## +bcb4\bcb4re300l\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300l\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb4\bcb4re300l\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300l\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb4\bcb4re300l\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300l\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb4\bcb4re300l\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300l\cregex.obj ../src/cregex.cpp +| + +bcb4\bcb4re300l\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300l\fileiter.obj ../src/fileiter.cpp +| + +bcb4\bcb4re300l\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300l\posix_api.obj ../src/posix_api.cpp +| + +bcb4\bcb4re300l\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300l\regex.obj ../src/regex.cpp +| + +bcb4\bcb4re300l\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300l\regex_debug.obj ../src/regex_debug.cpp +| + +bcb4\bcb4re300l\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300l\regex_synch.obj ../src/regex_synch.cpp +| + +bcb4\bcb4re300l\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300l\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb4\bcb4re300l\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb4\bcb4re300l\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb4\bcb4re300l : + -mkdir bcb4\bcb4re300l + +bcb4re300l_clean : + del bcb4\bcb4re300l\*.obj + del bcb4\bcb4re300l\*.il? + del bcb4\bcb4re300l\*.csm + del bcb4\bcb4re300l\*.tds + del bcb4\*.tds + +bcb4\bcb4re300l.lib : bcb4\bcb4re300l\c_regex_traits.obj bcb4\bcb4re300l\c_regex_traits_common.obj bcb4\bcb4re300l\cpp_regex_traits.obj bcb4\bcb4re300l\cregex.obj bcb4\bcb4re300l\fileiter.obj bcb4\bcb4re300l\posix_api.obj bcb4\bcb4re300l\regex.obj bcb4\bcb4re300l\regex_debug.obj bcb4\bcb4re300l\regex_synch.obj bcb4\bcb4re300l\w32_regex_traits.obj bcb4\bcb4re300l\wide_posix_api.obj + bcc32 @&&| +-DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; -ebcb4\bcb4re300l.dll bcb4\bcb4re300l\c_regex_traits.obj bcb4\bcb4re300l\c_regex_traits_common.obj bcb4\bcb4re300l\cpp_regex_traits.obj bcb4\bcb4re300l\cregex.obj bcb4\bcb4re300l\fileiter.obj bcb4\bcb4re300l\posix_api.obj bcb4\bcb4re300l\regex.obj bcb4\bcb4re300l\regex_debug.obj bcb4\bcb4re300l\regex_synch.obj bcb4\bcb4re300l\w32_regex_traits.obj bcb4\bcb4re300l\wide_posix_api.obj $(XLFLAGS) +| + implib bcb4\bcb4re300l.lib -c bcb4\bcb4re300l.dll + diff --git a/lib/bcb5.mak b/lib/bcb5.mak new file mode 100644 index 00000000..7a4e63cb --- /dev/null +++ b/lib/bcb5.mak @@ -0,0 +1,500 @@ +# +# auto generated makefile for C++ Builder +# +# usage: +# make +# brings libraries up to date +# make install +# brings libraries up to date and copies binaries to your C++ Builder /lib and /bin directories (recomended) +# make clean +# removes all temporary files. + +# +# Add additional compiler options here: +# +XCFLAGS= +# +# add additional linker flags here: +# +XLFLAGS= +# +# add additional static-library creation flags here: +# +XSFLAGS= + +!ifndef BCROOT +BCROOT=$(MAKEDIR)\.. +!endif + + +ALL_HEADER=../../../boost/cregex.hpp ../../../boost/pattern_except.hpp ../../../boost/regex.hpp ../../../boost/regex_traits.hpp ../../../boost/re_detail/fileiter.hpp ../../../boost/re_detail/jm_opt.hpp ../../../boost/re_detail/regex_compile.hpp ../../../boost/re_detail/regex_config.hpp ../../../boost/re_detail/regex_cstring.hpp ../../../boost/re_detail/regex_format.hpp ../../../boost/re_detail/regex_kmp.hpp ../../../boost/re_detail/regex_library_include.hpp ../../../boost/re_detail/regex_match.hpp ../../../boost/re_detail/regex_options.hpp ../../../boost/re_detail/regex_raw_buffer.hpp ../../../boost/re_detail/regex_split.hpp ../../../boost/re_detail/regex_stack.hpp ../../../boost/re_detail/regex_synch.hpp + +all : bcb5 bcb5\bcb5re300 bcb5\bcb5re300.lib bcb5\bcb5re300m bcb5\bcb5re300m.lib bcb5\bcb5re300v bcb5\bcb5re300v.lib bcb5\bcb5re300lv bcb5\bcb5re300lv.lib bcb5\bcb5re300lm bcb5\bcb5re300lm.lib bcb5\bcb5re300l bcb5\bcb5re300l.lib + +clean : bcb5re300_clean bcb5re300m_clean bcb5re300v_clean bcb5re300lv_clean bcb5re300lm_clean bcb5re300l_clean + +install : all + copy bcb5\bcb5re300.lib $(BCROOT)\lib + copy bcb5\bcb5re300m.lib $(BCROOT)\lib + copy bcb5\bcb5re300v.lib $(BCROOT)\lib + copy bcb5\bcb5re300lv.lib $(BCROOT)\lib + copy bcb5\bcb5re300lv.dll $(BCROOT)\bin + copy bcb5\bcb5re300lm.lib $(BCROOT)\lib + copy bcb5\bcb5re300lm.dll $(BCROOT)\bin + copy bcb5\bcb5re300l.lib $(BCROOT)\lib + copy bcb5\bcb5re300l.dll $(BCROOT)\bin + +bcb5 : + -mkdir bcb5 + + +######################################################## +# +# section for bcb5re300.lib +# +######################################################## +bcb5\bcb5re300\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb5\bcb5re300\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb5\bcb5re300\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb5\bcb5re300\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\cregex.obj ../src/cregex.cpp +| + +bcb5\bcb5re300\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\fileiter.obj ../src/fileiter.cpp +| + +bcb5\bcb5re300\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\posix_api.obj ../src/posix_api.cpp +| + +bcb5\bcb5re300\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\regex.obj ../src/regex.cpp +| + +bcb5\bcb5re300\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\regex_debug.obj ../src/regex_debug.cpp +| + +bcb5\bcb5re300\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\regex_synch.obj ../src/regex_synch.cpp +| + +bcb5\bcb5re300\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb5\bcb5re300\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb5\bcb5re300 : + -mkdir bcb5\bcb5re300 + +bcb5re300_clean : + del bcb5\bcb5re300\*.obj + del bcb5\bcb5re300\*.il? + del bcb5\bcb5re300\*.csm + del bcb5\bcb5re300\*.tds + +bcb5\bcb5re300.lib : bcb5\bcb5re300\c_regex_traits.obj bcb5\bcb5re300\c_regex_traits_common.obj bcb5\bcb5re300\cpp_regex_traits.obj bcb5\bcb5re300\cregex.obj bcb5\bcb5re300\fileiter.obj bcb5\bcb5re300\posix_api.obj bcb5\bcb5re300\regex.obj bcb5\bcb5re300\regex_debug.obj bcb5\bcb5re300\regex_synch.obj bcb5\bcb5re300\w32_regex_traits.obj bcb5\bcb5re300\wide_posix_api.obj + tlib @&&| +/P32 /u /a $(XSFLAGS) bcb5\bcb5re300.lib +bcb5\bcb5re300\c_regex_traits.obj +bcb5\bcb5re300\c_regex_traits_common.obj +bcb5\bcb5re300\cpp_regex_traits.obj +bcb5\bcb5re300\cregex.obj +bcb5\bcb5re300\fileiter.obj +bcb5\bcb5re300\posix_api.obj +bcb5\bcb5re300\regex.obj +bcb5\bcb5re300\regex_debug.obj +bcb5\bcb5re300\regex_synch.obj +bcb5\bcb5re300\w32_regex_traits.obj +bcb5\bcb5re300\wide_posix_api.obj +| + +######################################################## +# +# section for bcb5re300m.lib +# +######################################################## +bcb5\bcb5re300m\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb5\bcb5re300m\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb5\bcb5re300m\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb5\bcb5re300m\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\cregex.obj ../src/cregex.cpp +| + +bcb5\bcb5re300m\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\fileiter.obj ../src/fileiter.cpp +| + +bcb5\bcb5re300m\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\posix_api.obj ../src/posix_api.cpp +| + +bcb5\bcb5re300m\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\regex.obj ../src/regex.cpp +| + +bcb5\bcb5re300m\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\regex_debug.obj ../src/regex_debug.cpp +| + +bcb5\bcb5re300m\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\regex_synch.obj ../src/regex_synch.cpp +| + +bcb5\bcb5re300m\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb5\bcb5re300m\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300m\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb5\bcb5re300m : + -mkdir bcb5\bcb5re300m + +bcb5re300m_clean : + del bcb5\bcb5re300m\*.obj + del bcb5\bcb5re300m\*.il? + del bcb5\bcb5re300m\*.csm + del bcb5\bcb5re300m\*.tds + +bcb5\bcb5re300m.lib : bcb5\bcb5re300m\c_regex_traits.obj bcb5\bcb5re300m\c_regex_traits_common.obj bcb5\bcb5re300m\cpp_regex_traits.obj bcb5\bcb5re300m\cregex.obj bcb5\bcb5re300m\fileiter.obj bcb5\bcb5re300m\posix_api.obj bcb5\bcb5re300m\regex.obj bcb5\bcb5re300m\regex_debug.obj bcb5\bcb5re300m\regex_synch.obj bcb5\bcb5re300m\w32_regex_traits.obj bcb5\bcb5re300m\wide_posix_api.obj + tlib @&&| +/P32 /u /a $(XSFLAGS) bcb5\bcb5re300m.lib +bcb5\bcb5re300m\c_regex_traits.obj +bcb5\bcb5re300m\c_regex_traits_common.obj +bcb5\bcb5re300m\cpp_regex_traits.obj +bcb5\bcb5re300m\cregex.obj +bcb5\bcb5re300m\fileiter.obj +bcb5\bcb5re300m\posix_api.obj +bcb5\bcb5re300m\regex.obj +bcb5\bcb5re300m\regex_debug.obj +bcb5\bcb5re300m\regex_synch.obj +bcb5\bcb5re300m\w32_regex_traits.obj +bcb5\bcb5re300m\wide_posix_api.obj +| + +######################################################## +# +# section for bcb5re300v.lib +# +######################################################## +bcb5\bcb5re300v\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300v\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb5\bcb5re300v\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300v\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb5\bcb5re300v\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300v\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb5\bcb5re300v\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300v\cregex.obj ../src/cregex.cpp +| + +bcb5\bcb5re300v\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300v\fileiter.obj ../src/fileiter.cpp +| + +bcb5\bcb5re300v\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300v\posix_api.obj ../src/posix_api.cpp +| + +bcb5\bcb5re300v\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300v\regex.obj ../src/regex.cpp +| + +bcb5\bcb5re300v\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300v\regex_debug.obj ../src/regex_debug.cpp +| + +bcb5\bcb5re300v\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300v\regex_synch.obj ../src/regex_synch.cpp +| + +bcb5\bcb5re300v\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300v\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb5\bcb5re300v\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; $(XCFLAGS) -obcb5\bcb5re300v\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb5\bcb5re300v : + -mkdir bcb5\bcb5re300v + +bcb5re300v_clean : + del bcb5\bcb5re300v\*.obj + del bcb5\bcb5re300v\*.il? + del bcb5\bcb5re300v\*.csm + del bcb5\bcb5re300v\*.tds + +bcb5\bcb5re300v.lib : bcb5\bcb5re300v\c_regex_traits.obj bcb5\bcb5re300v\c_regex_traits_common.obj bcb5\bcb5re300v\cpp_regex_traits.obj bcb5\bcb5re300v\cregex.obj bcb5\bcb5re300v\fileiter.obj bcb5\bcb5re300v\posix_api.obj bcb5\bcb5re300v\regex.obj bcb5\bcb5re300v\regex_debug.obj bcb5\bcb5re300v\regex_synch.obj bcb5\bcb5re300v\w32_regex_traits.obj bcb5\bcb5re300v\wide_posix_api.obj + tlib @&&| +/P32 /u /a $(XSFLAGS) bcb5\bcb5re300v.lib +bcb5\bcb5re300v\c_regex_traits.obj +bcb5\bcb5re300v\c_regex_traits_common.obj +bcb5\bcb5re300v\cpp_regex_traits.obj +bcb5\bcb5re300v\cregex.obj +bcb5\bcb5re300v\fileiter.obj +bcb5\bcb5re300v\posix_api.obj +bcb5\bcb5re300v\regex.obj +bcb5\bcb5re300v\regex_debug.obj +bcb5\bcb5re300v\regex_synch.obj +bcb5\bcb5re300v\w32_regex_traits.obj +bcb5\bcb5re300v\wide_posix_api.obj +| + +######################################################## +# +# section for bcb5re300lv.lib +# +######################################################## +bcb5\bcb5re300lv\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lv\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb5\bcb5re300lv\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lv\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb5\bcb5re300lv\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lv\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb5\bcb5re300lv\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lv\cregex.obj ../src/cregex.cpp +| + +bcb5\bcb5re300lv\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lv\fileiter.obj ../src/fileiter.cpp +| + +bcb5\bcb5re300lv\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lv\posix_api.obj ../src/posix_api.cpp +| + +bcb5\bcb5re300lv\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lv\regex.obj ../src/regex.cpp +| + +bcb5\bcb5re300lv\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lv\regex_debug.obj ../src/regex_debug.cpp +| + +bcb5\bcb5re300lv\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lv\regex_synch.obj ../src/regex_synch.cpp +| + +bcb5\bcb5re300lv\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lv\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb5\bcb5re300lv\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lv\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb5\bcb5re300lv : + -mkdir bcb5\bcb5re300lv + +bcb5re300lv_clean : + del bcb5\bcb5re300lv\*.obj + del bcb5\bcb5re300lv\*.il? + del bcb5\bcb5re300lv\*.csm + del bcb5\bcb5re300lv\*.tds + del bcb5\*.tds + +bcb5\bcb5re300lv.lib : bcb5\bcb5re300lv\c_regex_traits.obj bcb5\bcb5re300lv\c_regex_traits_common.obj bcb5\bcb5re300lv\cpp_regex_traits.obj bcb5\bcb5re300lv\cregex.obj bcb5\bcb5re300lv\fileiter.obj bcb5\bcb5re300lv\posix_api.obj bcb5\bcb5re300lv\regex.obj bcb5\bcb5re300lv\regex_debug.obj bcb5\bcb5re300lv\regex_synch.obj bcb5\bcb5re300lv\w32_regex_traits.obj bcb5\bcb5re300lv\wide_posix_api.obj + bcc32 @&&| +-DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; -ebcb5\bcb5re300lv.dll bcb5\bcb5re300lv\c_regex_traits.obj bcb5\bcb5re300lv\c_regex_traits_common.obj bcb5\bcb5re300lv\cpp_regex_traits.obj bcb5\bcb5re300lv\cregex.obj bcb5\bcb5re300lv\fileiter.obj bcb5\bcb5re300lv\posix_api.obj bcb5\bcb5re300lv\regex.obj bcb5\bcb5re300lv\regex_debug.obj bcb5\bcb5re300lv\regex_synch.obj bcb5\bcb5re300lv\w32_regex_traits.obj bcb5\bcb5re300lv\wide_posix_api.obj $(XLFLAGS) +| + implib bcb5\bcb5re300lv.lib -c bcb5\bcb5re300lv.dll + +######################################################## +# +# section for bcb5re300lm.lib +# +######################################################## +bcb5\bcb5re300lm\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb5\bcb5re300lm\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb5\bcb5re300lm\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb5\bcb5re300lm\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\cregex.obj ../src/cregex.cpp +| + +bcb5\bcb5re300lm\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\fileiter.obj ../src/fileiter.cpp +| + +bcb5\bcb5re300lm\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\posix_api.obj ../src/posix_api.cpp +| + +bcb5\bcb5re300lm\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\regex.obj ../src/regex.cpp +| + +bcb5\bcb5re300lm\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\regex_debug.obj ../src/regex_debug.cpp +| + +bcb5\bcb5re300lm\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\regex_synch.obj ../src/regex_synch.cpp +| + +bcb5\bcb5re300lm\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb5\bcb5re300lm\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300lm\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb5\bcb5re300lm : + -mkdir bcb5\bcb5re300lm + +bcb5re300lm_clean : + del bcb5\bcb5re300lm\*.obj + del bcb5\bcb5re300lm\*.il? + del bcb5\bcb5re300lm\*.csm + del bcb5\bcb5re300lm\*.tds + del bcb5\*.tds + +bcb5\bcb5re300lm.lib : bcb5\bcb5re300lm\c_regex_traits.obj bcb5\bcb5re300lm\c_regex_traits_common.obj bcb5\bcb5re300lm\cpp_regex_traits.obj bcb5\bcb5re300lm\cregex.obj bcb5\bcb5re300lm\fileiter.obj bcb5\bcb5re300lm\posix_api.obj bcb5\bcb5re300lm\regex.obj bcb5\bcb5re300lm\regex_debug.obj bcb5\bcb5re300lm\regex_synch.obj bcb5\bcb5re300lm\w32_regex_traits.obj bcb5\bcb5re300lm\wide_posix_api.obj + bcc32 @&&| +-DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; -ebcb5\bcb5re300lm.dll bcb5\bcb5re300lm\c_regex_traits.obj bcb5\bcb5re300lm\c_regex_traits_common.obj bcb5\bcb5re300lm\cpp_regex_traits.obj bcb5\bcb5re300lm\cregex.obj bcb5\bcb5re300lm\fileiter.obj bcb5\bcb5re300lm\posix_api.obj bcb5\bcb5re300lm\regex.obj bcb5\bcb5re300lm\regex_debug.obj bcb5\bcb5re300lm\regex_synch.obj bcb5\bcb5re300lm\w32_regex_traits.obj bcb5\bcb5re300lm\wide_posix_api.obj $(XLFLAGS) +| + implib bcb5\bcb5re300lm.lib -c bcb5\bcb5re300lm.dll + +######################################################## +# +# section for bcb5re300l.lib +# +######################################################## +bcb5\bcb5re300l\c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\c_regex_traits.obj ../src/c_regex_traits.cpp +| + +bcb5\bcb5re300l\c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\c_regex_traits_common.obj ../src/c_regex_traits_common.cpp +| + +bcb5\bcb5re300l\cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\cpp_regex_traits.obj ../src/cpp_regex_traits.cpp +| + +bcb5\bcb5re300l\cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\cregex.obj ../src/cregex.cpp +| + +bcb5\bcb5re300l\fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\fileiter.obj ../src/fileiter.cpp +| + +bcb5\bcb5re300l\posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\posix_api.obj ../src/posix_api.cpp +| + +bcb5\bcb5re300l\regex.obj: ../src/regex.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\regex.obj ../src/regex.cpp +| + +bcb5\bcb5re300l\regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\regex_debug.obj ../src/regex_debug.cpp +| + +bcb5\bcb5re300l\regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\regex_synch.obj ../src/regex_synch.cpp +| + +bcb5\bcb5re300l\w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\w32_regex_traits.obj ../src/w32_regex_traits.cpp +| + +bcb5\bcb5re300l\wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + bcc32 @&&| +-c -DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; $(XCFLAGS) -obcb5\bcb5re300l\wide_posix_api.obj ../src/wide_posix_api.cpp +| + +bcb5\bcb5re300l : + -mkdir bcb5\bcb5re300l + +bcb5re300l_clean : + del bcb5\bcb5re300l\*.obj + del bcb5\bcb5re300l\*.il? + del bcb5\bcb5re300l\*.csm + del bcb5\bcb5re300l\*.tds + del bcb5\*.tds + +bcb5\bcb5re300l.lib : bcb5\bcb5re300l\c_regex_traits.obj bcb5\bcb5re300l\c_regex_traits_common.obj bcb5\bcb5re300l\cpp_regex_traits.obj bcb5\bcb5re300l\cregex.obj bcb5\bcb5re300l\fileiter.obj bcb5\bcb5re300l\posix_api.obj bcb5\bcb5re300l\regex.obj bcb5\bcb5re300l\regex_debug.obj bcb5\bcb5re300l\regex_synch.obj bcb5\bcb5re300l\w32_regex_traits.obj bcb5\bcb5re300l\wide_posix_api.obj + bcc32 @&&| +-DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I$(BCROOT)\include;../../../; -L$(BCROOT)\lib;$(BCROOT)\lib\release; -ebcb5\bcb5re300l.dll bcb5\bcb5re300l\c_regex_traits.obj bcb5\bcb5re300l\c_regex_traits_common.obj bcb5\bcb5re300l\cpp_regex_traits.obj bcb5\bcb5re300l\cregex.obj bcb5\bcb5re300l\fileiter.obj bcb5\bcb5re300l\posix_api.obj bcb5\bcb5re300l\regex.obj bcb5\bcb5re300l\regex_debug.obj bcb5\bcb5re300l\regex_synch.obj bcb5\bcb5re300l\w32_regex_traits.obj bcb5\bcb5re300l\wide_posix_api.obj $(XLFLAGS) +| + implib bcb5\bcb5re300l.lib -c bcb5\bcb5re300l.dll + diff --git a/lib/gcc.mak b/lib/gcc.mak new file mode 100644 index 00000000..28eca81d --- /dev/null +++ b/lib/gcc.mak @@ -0,0 +1,132 @@ +# +# auto generated makefile for gcc compiler +# +# usage: +# make +# brings libraries up to date +# make clean +# deletes temporary object files (but not archives). +# + +# +# Add additional compiler options here: +# +XCFLAGS= +# +# add additional linker flags here: +# +XLFLAGS= +# +# add additional static-library creation flags here: +# +XSFLAGS= + + + +ALL_HEADER=../../../boost/cregex.hpp ../../../boost/pattern_except.hpp ../../../boost/regex.hpp ../../../boost/regex_traits.hpp ../../../boost/re_detail/fileiter.hpp ../../../boost/re_detail/jm_opt.hpp ../../../boost/re_detail/regex_compile.hpp ../../../boost/re_detail/regex_config.hpp ../../../boost/re_detail/regex_cstring.hpp ../../../boost/re_detail/regex_format.hpp ../../../boost/re_detail/regex_kmp.hpp ../../../boost/re_detail/regex_library_include.hpp ../../../boost/re_detail/regex_match.hpp ../../../boost/re_detail/regex_options.hpp ../../../boost/re_detail/regex_raw_buffer.hpp ../../../boost/re_detail/regex_split.hpp ../../../boost/re_detail/regex_stack.hpp ../../../boost/re_detail/regex_synch.hpp + +all : gcc gcc gcc/regex++ ./gcc/libregex++.a gcc gcc/regex++debug ./gcc/libregex++debug.a + +gcc : + mkdir -p gcc + +clean : regex++_clean regex++debug_clean + +install : all + + + +######################################################## +# +# section for libregex++.a +# +######################################################## +gcc/regex++/c_regex_traits.o: ../src/c_regex_traits.cpp $(ALL_HEADER) + g++ -o gcc/regex++/c_regex_traits.o -c -O2 -I../../../ $(XCFLAGS) ../src/c_regex_traits.cpp + +gcc/regex++/c_regex_traits_common.o: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + g++ -o gcc/regex++/c_regex_traits_common.o -c -O2 -I../../../ $(XCFLAGS) ../src/c_regex_traits_common.cpp + +gcc/regex++/cpp_regex_traits.o: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + g++ -o gcc/regex++/cpp_regex_traits.o -c -O2 -I../../../ $(XCFLAGS) ../src/cpp_regex_traits.cpp + +gcc/regex++/cregex.o: ../src/cregex.cpp $(ALL_HEADER) + g++ -o gcc/regex++/cregex.o -c -O2 -I../../../ $(XCFLAGS) ../src/cregex.cpp + +gcc/regex++/fileiter.o: ../src/fileiter.cpp $(ALL_HEADER) + g++ -o gcc/regex++/fileiter.o -c -O2 -I../../../ $(XCFLAGS) ../src/fileiter.cpp + +gcc/regex++/posix_api.o: ../src/posix_api.cpp $(ALL_HEADER) + g++ -o gcc/regex++/posix_api.o -c -O2 -I../../../ $(XCFLAGS) ../src/posix_api.cpp + +gcc/regex++/regex.o: ../src/regex.cpp $(ALL_HEADER) + g++ -o gcc/regex++/regex.o -c -O2 -I../../../ $(XCFLAGS) ../src/regex.cpp + +gcc/regex++/regex_debug.o: ../src/regex_debug.cpp $(ALL_HEADER) + g++ -o gcc/regex++/regex_debug.o -c -O2 -I../../../ $(XCFLAGS) ../src/regex_debug.cpp + +gcc/regex++/regex_synch.o: ../src/regex_synch.cpp $(ALL_HEADER) + g++ -o gcc/regex++/regex_synch.o -c -O2 -I../../../ $(XCFLAGS) ../src/regex_synch.cpp + +gcc/regex++/w32_regex_traits.o: ../src/w32_regex_traits.cpp $(ALL_HEADER) + g++ -o gcc/regex++/w32_regex_traits.o -c -O2 -I../../../ $(XCFLAGS) ../src/w32_regex_traits.cpp + +gcc/regex++/wide_posix_api.o: ../src/wide_posix_api.cpp $(ALL_HEADER) + g++ -o gcc/regex++/wide_posix_api.o -c -O2 -I../../../ $(XCFLAGS) ../src/wide_posix_api.cpp + +gcc/regex++ : + mkdir -p gcc/regex++ + +regex++_clean : + rm -f gcc/regex++/*.o + +./gcc/libregex++.a : gcc/regex++/c_regex_traits.o gcc/regex++/c_regex_traits_common.o gcc/regex++/cpp_regex_traits.o gcc/regex++/cregex.o gcc/regex++/fileiter.o gcc/regex++/posix_api.o gcc/regex++/regex.o gcc/regex++/regex_debug.o gcc/regex++/regex_synch.o gcc/regex++/w32_regex_traits.o gcc/regex++/wide_posix_api.o + ar -r $(XSFLAGS) gcc/libregex++.a gcc/regex++/c_regex_traits.o gcc/regex++/c_regex_traits_common.o gcc/regex++/cpp_regex_traits.o gcc/regex++/cregex.o gcc/regex++/fileiter.o gcc/regex++/posix_api.o gcc/regex++/regex.o gcc/regex++/regex_debug.o gcc/regex++/regex_synch.o gcc/regex++/w32_regex_traits.o gcc/regex++/wide_posix_api.o + +######################################################## +# +# section for libregex++debug.a +# +######################################################## +gcc/regex++debug/c_regex_traits.o: ../src/c_regex_traits.cpp $(ALL_HEADER) + g++ -o gcc/regex++debug/c_regex_traits.o -c -I../../../ -g $(XCFLAGS) ../src/c_regex_traits.cpp + +gcc/regex++debug/c_regex_traits_common.o: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + g++ -o gcc/regex++debug/c_regex_traits_common.o -c -I../../../ -g $(XCFLAGS) ../src/c_regex_traits_common.cpp + +gcc/regex++debug/cpp_regex_traits.o: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + g++ -o gcc/regex++debug/cpp_regex_traits.o -c -I../../../ -g $(XCFLAGS) ../src/cpp_regex_traits.cpp + +gcc/regex++debug/cregex.o: ../src/cregex.cpp $(ALL_HEADER) + g++ -o gcc/regex++debug/cregex.o -c -I../../../ -g $(XCFLAGS) ../src/cregex.cpp + +gcc/regex++debug/fileiter.o: ../src/fileiter.cpp $(ALL_HEADER) + g++ -o gcc/regex++debug/fileiter.o -c -I../../../ -g $(XCFLAGS) ../src/fileiter.cpp + +gcc/regex++debug/posix_api.o: ../src/posix_api.cpp $(ALL_HEADER) + g++ -o gcc/regex++debug/posix_api.o -c -I../../../ -g $(XCFLAGS) ../src/posix_api.cpp + +gcc/regex++debug/regex.o: ../src/regex.cpp $(ALL_HEADER) + g++ -o gcc/regex++debug/regex.o -c -I../../../ -g $(XCFLAGS) ../src/regex.cpp + +gcc/regex++debug/regex_debug.o: ../src/regex_debug.cpp $(ALL_HEADER) + g++ -o gcc/regex++debug/regex_debug.o -c -I../../../ -g $(XCFLAGS) ../src/regex_debug.cpp + +gcc/regex++debug/regex_synch.o: ../src/regex_synch.cpp $(ALL_HEADER) + g++ -o gcc/regex++debug/regex_synch.o -c -I../../../ -g $(XCFLAGS) ../src/regex_synch.cpp + +gcc/regex++debug/w32_regex_traits.o: ../src/w32_regex_traits.cpp $(ALL_HEADER) + g++ -o gcc/regex++debug/w32_regex_traits.o -c -I../../../ -g $(XCFLAGS) ../src/w32_regex_traits.cpp + +gcc/regex++debug/wide_posix_api.o: ../src/wide_posix_api.cpp $(ALL_HEADER) + g++ -o gcc/regex++debug/wide_posix_api.o -c -I../../../ -g $(XCFLAGS) ../src/wide_posix_api.cpp + +gcc/regex++debug : + mkdir -p gcc/regex++debug + +regex++debug_clean : + rm -f gcc/regex++debug/*.o + +./gcc/libregex++debug.a : gcc/regex++debug/c_regex_traits.o gcc/regex++debug/c_regex_traits_common.o gcc/regex++debug/cpp_regex_traits.o gcc/regex++debug/cregex.o gcc/regex++debug/fileiter.o gcc/regex++debug/posix_api.o gcc/regex++debug/regex.o gcc/regex++debug/regex_debug.o gcc/regex++debug/regex_synch.o gcc/regex++debug/w32_regex_traits.o gcc/regex++debug/wide_posix_api.o + ar -r $(XSFLAGS) gcc/libregex++debug.a gcc/regex++debug/c_regex_traits.o gcc/regex++debug/c_regex_traits_common.o gcc/regex++debug/cpp_regex_traits.o gcc/regex++debug/cregex.o gcc/regex++debug/fileiter.o gcc/regex++debug/posix_api.o gcc/regex++debug/regex.o gcc/regex++debug/regex_debug.o gcc/regex++debug/regex_synch.o gcc/regex++debug/w32_regex_traits.o gcc/regex++debug/wide_posix_api.o + diff --git a/lib/makefile.in b/lib/makefile.in new file mode 100644 index 00000000..9a9d5585 --- /dev/null +++ b/lib/makefile.in @@ -0,0 +1,74 @@ + +LIBNAME=regex++ + +CPP=@CXX@ +AR=ar + +CPP_PROJ=@CXXFLAGS@ -I../../../ -c + +ALL_O=@ac_all_o@ +ALL_H=@ac_all_h@ + +lib$(LIBNAME).a : $(ALL_O) + + + + + + + + +c_regex_traits.o: $(ALL_H) ../src/c_regex_traits.cpp + $(CPP) $(CPP_PROJ) ../src/c_regex_traits.cpp + $(AR) -rc lib$(LIBNAME).a c_regex_traits.o + + +c_regex_traits_common.o: $(ALL_H) ../src/c_regex_traits_common.cpp + $(CPP) $(CPP_PROJ) ../src/c_regex_traits_common.cpp + $(AR) -rc lib$(LIBNAME).a c_regex_traits_common.o + + +cpp_regex_traits.o: $(ALL_H) ../src/cpp_regex_traits.cpp + $(CPP) $(CPP_PROJ) ../src/cpp_regex_traits.cpp + $(AR) -rc lib$(LIBNAME).a cpp_regex_traits.o + + +cregex.o: $(ALL_H) ../src/cregex.cpp + $(CPP) $(CPP_PROJ) ../src/cregex.cpp + $(AR) -rc lib$(LIBNAME).a cregex.o + + +fileiter.o: $(ALL_H) ../src/fileiter.cpp + $(CPP) $(CPP_PROJ) ../src/fileiter.cpp + $(AR) -rc lib$(LIBNAME).a fileiter.o + + +posix_api.o: $(ALL_H) ../src/posix_api.cpp + $(CPP) $(CPP_PROJ) ../src/posix_api.cpp + $(AR) -rc lib$(LIBNAME).a posix_api.o + + +regex.o: $(ALL_H) ../src/regex.cpp + $(CPP) $(CPP_PROJ) ../src/regex.cpp + $(AR) -rc lib$(LIBNAME).a regex.o + + +regex_debug.o: $(ALL_H) ../src/regex_debug.cpp + $(CPP) $(CPP_PROJ) ../src/regex_debug.cpp + $(AR) -rc lib$(LIBNAME).a regex_debug.o + + +regex_synch.o: $(ALL_H) ../src/regex_synch.cpp + $(CPP) $(CPP_PROJ) ../src/regex_synch.cpp + $(AR) -rc lib$(LIBNAME).a regex_synch.o + + +w32_regex_traits.o: $(ALL_H) ../src/w32_regex_traits.cpp + $(CPP) $(CPP_PROJ) ../src/w32_regex_traits.cpp + $(AR) -rc lib$(LIBNAME).a w32_regex_traits.o + + +wide_posix_api.o: $(ALL_H) ../src/wide_posix_api.cpp + $(CPP) $(CPP_PROJ) ../src/wide_posix_api.cpp + $(AR) -rc lib$(LIBNAME).a wide_posix_api.o + diff --git a/lib/makefile.org b/lib/makefile.org new file mode 100644 index 00000000..c302316c --- /dev/null +++ b/lib/makefile.org @@ -0,0 +1,18 @@ + +LIBNAME=regex++ + +CPP=@CXX@ +AR=ar + +CPP_PROJ=@CXXFLAGS@ -I../../../ -c + +ALL_O=@ac_all_o@ +ALL_H=@ac_all_h@ + +lib$(LIBNAME).a : $(ALL_O) + + + + + + diff --git a/lib/sunpro.mak b/lib/sunpro.mak new file mode 100644 index 00000000..75f451b6 --- /dev/null +++ b/lib/sunpro.mak @@ -0,0 +1,76 @@ +# Makefile for regex++ library +# +# for SUN workshop 5.0 C++ compiler +# + +LIBNAME=regex++ + +CPP=CC +CPP_FLAGS=-O -c + +AR=CC -O -xar -o +AR_SO=CC -G -o + +INTDIR=. +OUTDIR=. + +CPP_PROJ= $(CPP_FLAGS) -I../../../ $(CFGX) + +LIB32_OBJS= \ + $(INTDIR)/posix_api.o \ + $(INTDIR)/wide_posix_api.o \ + $(INTDIR)/regex_synch.o \ + $(INTDIR)/regex.o \ + $(INTDIR)/fileiter.o \ + $(INTDIR)/cregex.o \ + $(INTDIR)/c_regex_traits_common.o \ + $(INTDIR)/c_regex_traits.o + $(INTDIR)/cpp_regex_traits.o + $(INTDIR)/w32_regex_traits.o + +all: $(OUTDIR)/lib$(LIBNAME).a +clean: + rm -f *.o + rm -rf SunWS_cache + +$(OUTDIR)/lib$(LIBNAME).a :: $(LIB32_OBJS) + $(AR) lib$(LIBNAME).a posix_api.o wide_posix_api.o re_strw.o regex_synch.o regex.o fileiter.o cregex.o c_regex_traits.o c_regex_traits_common.o cpp_regex_traits.o + +$(INTDIR)/posix_api.o : ../src/posix_api.cpp + $(CPP) $(CPP_PROJ) ../src/posix_api.cpp + +$(INTDIR)/wide_posix_api.o : ../src/wide_posix_api.cpp + $(CPP) $(CPP_PROJ) ../src/wide_posix_api.cpp + + +$(INTDIR)/re_strw.o : ../src/re_strw.cpp + $(CPP) $(CPP_PROJ) ../src/re_strw.cpp + + +$(INTDIR)/regex_synch.o : ../src/regex_synch.cpp + $(CPP) $(CPP_PROJ) ../src/regex_synch.cpp + + +$(INTDIR)/regex.o : ../src/regex.cpp + $(CPP) $(CPP_PROJ) ../src/regex.cpp + +$(INTDIR)/fileiter.o : ../src/fileiter.cpp + $(CPP) $(CPP_PROJ) ../src/fileiter.cpp + +$(INTDIR)/cregex.o : ../src/cregex.cpp + $(CPP) $(CPP_PROJ) ../src/cregex.cpp + +$(INTDIR)/c_regex_traits.o : ../src/c_regex_traits.cpp + $(CPP) $(CPP_PROJ) ../src/c_regex_traits.cpp + +$(INTDIR)/c_regex_traits_common.o : ../src/c_regex_traits_common.cpp + $(CPP) $(CPP_PROJ) ../src/c_regex_traits_common.cpp + +$(INTDIR)/cpp_regex_traits.o : ../src/cpp_regex_traits.cpp + $(CPP) $(CPP_PROJ) ../src/cpp_regex_traits.cpp + + + + + + diff --git a/lib/vc6-stlport.mak b/lib/vc6-stlport.mak new file mode 100644 index 00000000..6a600944 --- /dev/null +++ b/lib/vc6-stlport.mak @@ -0,0 +1,248 @@ +# +# auto generated makefile for VC6 compiler +# +# usage: +# make +# brings libraries up to date +# make install +# brings libraries up to date and copies binaries to your VC6 /lib and /bin directories (recomended) +# + +# +# Add additional compiler options here: +# +XCFLAGS= +# +# add additional linker flags here: +# +XLFLAGS= +# +# add additional static-library creation flags here: +# +XSFLAGS= + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + + +ALL_HEADER=../../../boost/cregex.hpp ../../../boost/pattern_except.hpp ../../../boost/regex.hpp ../../../boost/regex_traits.hpp ../../../boost/re_detail/fileiter.hpp ../../../boost/re_detail/jm_opt.hpp ../../../boost/re_detail/regex_compile.hpp ../../../boost/re_detail/regex_config.hpp ../../../boost/re_detail/regex_cstring.hpp ../../../boost/re_detail/regex_format.hpp ../../../boost/re_detail/regex_kmp.hpp ../../../boost/re_detail/regex_library_include.hpp ../../../boost/re_detail/regex_match.hpp ../../../boost/re_detail/regex_options.hpp ../../../boost/re_detail/regex_raw_buffer.hpp ../../../boost/re_detail/regex_split.hpp ../../../boost/re_detail/regex_stack.hpp ../../../boost/re_detail/regex_synch.hpp + +all : main_dir vc6-stlport-re300m_dir ./vc6-stlport/vc6-stlport-re300m.lib vc6-stlport-re300dm_dir ./vc6-stlport/vc6-stlport-re300dm.lib vc6-stlport-re300dl_dir ./vc6-stlport/vc6-stlport-re300dl.lib vc6-stlport-re300l_dir ./vc6-stlport/vc6-stlport-re300l.lib + +clean : vc6-stlport-re300m_clean vc6-stlport-re300dm_clean vc6-stlport-re300dl_clean vc6-stlport-re300l_clean + +install : all + copy vc6-stlport\vc6-stlport-re300m.lib "$(MSVCDIR)\lib" + copy vc6-stlport\vc6-stlport-re300dm.lib "$(MSVCDIR)\lib" + copy vc6-stlport\vc6-stlport-re300dl.lib "$(MSVCDIR)\lib" + copy vc6-stlport\vc6-stlport-re300dl.dll "$(MSVCDIR)\bin" + copy vc6-stlport\vc6-stlport-re300l.lib "$(MSVCDIR)\lib" + copy vc6-stlport\vc6-stlport-re300l.dll "$(MSVCDIR)\bin" + +main_dir : + if not exist "vc6-stlport\$(NULL)" mkdir vc6-stlport + + +######################################################## +# +# section for vc6-stlport-re300m.lib +# +######################################################## +vc6-stlport/vc6-stlport-re300m/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300m/vc6-stlport-re300m.pch -Fo./vc6-stlport/vc6-stlport-re300m/ -Fdvc6-stlport/vc6-stlport-re300m.pdb ../src/c_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300m/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300m/vc6-stlport-re300m.pch -Fo./vc6-stlport/vc6-stlport-re300m/ -Fdvc6-stlport/vc6-stlport-re300m.pdb ../src/c_regex_traits_common.cpp + +vc6-stlport/vc6-stlport-re300m/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300m/vc6-stlport-re300m.pch -Fo./vc6-stlport/vc6-stlport-re300m/ -Fdvc6-stlport/vc6-stlport-re300m.pdb ../src/cpp_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300m/cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300m/vc6-stlport-re300m.pch -Fo./vc6-stlport/vc6-stlport-re300m/ -Fdvc6-stlport/vc6-stlport-re300m.pdb ../src/cregex.cpp + +vc6-stlport/vc6-stlport-re300m/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300m/vc6-stlport-re300m.pch -Fo./vc6-stlport/vc6-stlport-re300m/ -Fdvc6-stlport/vc6-stlport-re300m.pdb ../src/fileiter.cpp + +vc6-stlport/vc6-stlport-re300m/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300m/vc6-stlport-re300m.pch -Fo./vc6-stlport/vc6-stlport-re300m/ -Fdvc6-stlport/vc6-stlport-re300m.pdb ../src/posix_api.cpp + +vc6-stlport/vc6-stlport-re300m/regex.obj: ../src/regex.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300m/vc6-stlport-re300m.pch -Fo./vc6-stlport/vc6-stlport-re300m/ -Fdvc6-stlport/vc6-stlport-re300m.pdb ../src/regex.cpp + +vc6-stlport/vc6-stlport-re300m/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300m/vc6-stlport-re300m.pch -Fo./vc6-stlport/vc6-stlport-re300m/ -Fdvc6-stlport/vc6-stlport-re300m.pdb ../src/regex_debug.cpp + +vc6-stlport/vc6-stlport-re300m/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300m/vc6-stlport-re300m.pch -Fo./vc6-stlport/vc6-stlport-re300m/ -Fdvc6-stlport/vc6-stlport-re300m.pdb ../src/regex_synch.cpp + +vc6-stlport/vc6-stlport-re300m/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300m/vc6-stlport-re300m.pch -Fo./vc6-stlport/vc6-stlport-re300m/ -Fdvc6-stlport/vc6-stlport-re300m.pdb ../src/w32_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300m/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300m/vc6-stlport-re300m.pch -Fo./vc6-stlport/vc6-stlport-re300m/ -Fdvc6-stlport/vc6-stlport-re300m.pdb ../src/wide_posix_api.cpp + +vc6-stlport-re300m_dir : + if not exist "vc6-stlport\vc6-stlport-re300m\$(NULL)" mkdir vc6-stlport\vc6-stlport-re300m + +vc6-stlport-re300m_clean : + del vc6-stlport\vc6-stlport-re300m\*.obj + del vc6-stlport\vc6-stlport-re300m\*.idb + del vc6-stlport\vc6-stlport-re300m\*.exp + +./vc6-stlport/vc6-stlport-re300m.lib : vc6-stlport/vc6-stlport-re300m/c_regex_traits.obj vc6-stlport/vc6-stlport-re300m/c_regex_traits_common.obj vc6-stlport/vc6-stlport-re300m/cpp_regex_traits.obj vc6-stlport/vc6-stlport-re300m/cregex.obj vc6-stlport/vc6-stlport-re300m/fileiter.obj vc6-stlport/vc6-stlport-re300m/posix_api.obj vc6-stlport/vc6-stlport-re300m/regex.obj vc6-stlport/vc6-stlport-re300m/regex_debug.obj vc6-stlport/vc6-stlport-re300m/regex_synch.obj vc6-stlport/vc6-stlport-re300m/w32_regex_traits.obj vc6-stlport/vc6-stlport-re300m/wide_posix_api.obj + link -lib /nologo /out:vc6-stlport/vc6-stlport-re300m.lib $(XSFLAGS) vc6-stlport/vc6-stlport-re300m/c_regex_traits.obj vc6-stlport/vc6-stlport-re300m/c_regex_traits_common.obj vc6-stlport/vc6-stlport-re300m/cpp_regex_traits.obj vc6-stlport/vc6-stlport-re300m/cregex.obj vc6-stlport/vc6-stlport-re300m/fileiter.obj vc6-stlport/vc6-stlport-re300m/posix_api.obj vc6-stlport/vc6-stlport-re300m/regex.obj vc6-stlport/vc6-stlport-re300m/regex_debug.obj vc6-stlport/vc6-stlport-re300m/regex_synch.obj vc6-stlport/vc6-stlport-re300m/w32_regex_traits.obj vc6-stlport/vc6-stlport-re300m/wide_posix_api.obj + +######################################################## +# +# section for vc6-stlport-re300dm.lib +# +######################################################## +vc6-stlport/vc6-stlport-re300dm/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dm/vc6-stlport-re300dm.pch -Fo./vc6-stlport/vc6-stlport-re300dm/ -Fdvc6-stlport/vc6-stlport-re300dm.pdb ../src/c_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300dm/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dm/vc6-stlport-re300dm.pch -Fo./vc6-stlport/vc6-stlport-re300dm/ -Fdvc6-stlport/vc6-stlport-re300dm.pdb ../src/c_regex_traits_common.cpp + +vc6-stlport/vc6-stlport-re300dm/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dm/vc6-stlport-re300dm.pch -Fo./vc6-stlport/vc6-stlport-re300dm/ -Fdvc6-stlport/vc6-stlport-re300dm.pdb ../src/cpp_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300dm/cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dm/vc6-stlport-re300dm.pch -Fo./vc6-stlport/vc6-stlport-re300dm/ -Fdvc6-stlport/vc6-stlport-re300dm.pdb ../src/cregex.cpp + +vc6-stlport/vc6-stlport-re300dm/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dm/vc6-stlport-re300dm.pch -Fo./vc6-stlport/vc6-stlport-re300dm/ -Fdvc6-stlport/vc6-stlport-re300dm.pdb ../src/fileiter.cpp + +vc6-stlport/vc6-stlport-re300dm/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dm/vc6-stlport-re300dm.pch -Fo./vc6-stlport/vc6-stlport-re300dm/ -Fdvc6-stlport/vc6-stlport-re300dm.pdb ../src/posix_api.cpp + +vc6-stlport/vc6-stlport-re300dm/regex.obj: ../src/regex.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dm/vc6-stlport-re300dm.pch -Fo./vc6-stlport/vc6-stlport-re300dm/ -Fdvc6-stlport/vc6-stlport-re300dm.pdb ../src/regex.cpp + +vc6-stlport/vc6-stlport-re300dm/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dm/vc6-stlport-re300dm.pch -Fo./vc6-stlport/vc6-stlport-re300dm/ -Fdvc6-stlport/vc6-stlport-re300dm.pdb ../src/regex_debug.cpp + +vc6-stlport/vc6-stlport-re300dm/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dm/vc6-stlport-re300dm.pch -Fo./vc6-stlport/vc6-stlport-re300dm/ -Fdvc6-stlport/vc6-stlport-re300dm.pdb ../src/regex_synch.cpp + +vc6-stlport/vc6-stlport-re300dm/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dm/vc6-stlport-re300dm.pch -Fo./vc6-stlport/vc6-stlport-re300dm/ -Fdvc6-stlport/vc6-stlport-re300dm.pdb ../src/w32_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300dm/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dm/vc6-stlport-re300dm.pch -Fo./vc6-stlport/vc6-stlport-re300dm/ -Fdvc6-stlport/vc6-stlport-re300dm.pdb ../src/wide_posix_api.cpp + +vc6-stlport-re300dm_dir : + if not exist "vc6-stlport\vc6-stlport-re300dm\$(NULL)" mkdir vc6-stlport\vc6-stlport-re300dm + +vc6-stlport-re300dm_clean : + del vc6-stlport\vc6-stlport-re300dm\*.obj + del vc6-stlport\vc6-stlport-re300dm\*.idb + del vc6-stlport\vc6-stlport-re300dm\*.exp + +./vc6-stlport/vc6-stlport-re300dm.lib : vc6-stlport/vc6-stlport-re300dm/c_regex_traits.obj vc6-stlport/vc6-stlport-re300dm/c_regex_traits_common.obj vc6-stlport/vc6-stlport-re300dm/cpp_regex_traits.obj vc6-stlport/vc6-stlport-re300dm/cregex.obj vc6-stlport/vc6-stlport-re300dm/fileiter.obj vc6-stlport/vc6-stlport-re300dm/posix_api.obj vc6-stlport/vc6-stlport-re300dm/regex.obj vc6-stlport/vc6-stlport-re300dm/regex_debug.obj vc6-stlport/vc6-stlport-re300dm/regex_synch.obj vc6-stlport/vc6-stlport-re300dm/w32_regex_traits.obj vc6-stlport/vc6-stlport-re300dm/wide_posix_api.obj + link -lib /nologo /out:vc6-stlport/vc6-stlport-re300dm.lib $(XSFLAGS) vc6-stlport/vc6-stlport-re300dm/c_regex_traits.obj vc6-stlport/vc6-stlport-re300dm/c_regex_traits_common.obj vc6-stlport/vc6-stlport-re300dm/cpp_regex_traits.obj vc6-stlport/vc6-stlport-re300dm/cregex.obj vc6-stlport/vc6-stlport-re300dm/fileiter.obj vc6-stlport/vc6-stlport-re300dm/posix_api.obj vc6-stlport/vc6-stlport-re300dm/regex.obj vc6-stlport/vc6-stlport-re300dm/regex_debug.obj vc6-stlport/vc6-stlport-re300dm/regex_synch.obj vc6-stlport/vc6-stlport-re300dm/w32_regex_traits.obj vc6-stlport/vc6-stlport-re300dm/wide_posix_api.obj + +######################################################## +# +# section for vc6-stlport-re300dl.lib +# +######################################################## +vc6-stlport/vc6-stlport-re300dl/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dl/vc6-stlport-re300dl.pch -Fo./vc6-stlport/vc6-stlport-re300dl/ -Fdvc6-stlport/vc6-stlport-re300dl.pdb ../src/c_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300dl/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dl/vc6-stlport-re300dl.pch -Fo./vc6-stlport/vc6-stlport-re300dl/ -Fdvc6-stlport/vc6-stlport-re300dl.pdb ../src/c_regex_traits_common.cpp + +vc6-stlport/vc6-stlport-re300dl/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dl/vc6-stlport-re300dl.pch -Fo./vc6-stlport/vc6-stlport-re300dl/ -Fdvc6-stlport/vc6-stlport-re300dl.pdb ../src/cpp_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300dl/cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dl/vc6-stlport-re300dl.pch -Fo./vc6-stlport/vc6-stlport-re300dl/ -Fdvc6-stlport/vc6-stlport-re300dl.pdb ../src/cregex.cpp + +vc6-stlport/vc6-stlport-re300dl/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dl/vc6-stlport-re300dl.pch -Fo./vc6-stlport/vc6-stlport-re300dl/ -Fdvc6-stlport/vc6-stlport-re300dl.pdb ../src/fileiter.cpp + +vc6-stlport/vc6-stlport-re300dl/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dl/vc6-stlport-re300dl.pch -Fo./vc6-stlport/vc6-stlport-re300dl/ -Fdvc6-stlport/vc6-stlport-re300dl.pdb ../src/posix_api.cpp + +vc6-stlport/vc6-stlport-re300dl/regex.obj: ../src/regex.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dl/vc6-stlport-re300dl.pch -Fo./vc6-stlport/vc6-stlport-re300dl/ -Fdvc6-stlport/vc6-stlport-re300dl.pdb ../src/regex.cpp + +vc6-stlport/vc6-stlport-re300dl/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dl/vc6-stlport-re300dl.pch -Fo./vc6-stlport/vc6-stlport-re300dl/ -Fdvc6-stlport/vc6-stlport-re300dl.pdb ../src/regex_debug.cpp + +vc6-stlport/vc6-stlport-re300dl/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dl/vc6-stlport-re300dl.pch -Fo./vc6-stlport/vc6-stlport-re300dl/ -Fdvc6-stlport/vc6-stlport-re300dl.pdb ../src/regex_synch.cpp + +vc6-stlport/vc6-stlport-re300dl/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dl/vc6-stlport-re300dl.pch -Fo./vc6-stlport/vc6-stlport-re300dl/ -Fdvc6-stlport/vc6-stlport-re300dl.pdb ../src/w32_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300dl/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300dl/vc6-stlport-re300dl.pch -Fo./vc6-stlport/vc6-stlport-re300dl/ -Fdvc6-stlport/vc6-stlport-re300dl.pdb ../src/wide_posix_api.cpp + +vc6-stlport-re300dl_dir : + if not exist "vc6-stlport\vc6-stlport-re300dl\$(NULL)" mkdir vc6-stlport\vc6-stlport-re300dl + +vc6-stlport-re300dl_clean : + del vc6-stlport\vc6-stlport-re300dl\*.obj + del vc6-stlport\vc6-stlport-re300dl\*.idb + del vc6-stlport\vc6-stlport-re300dl\*.exp + +./vc6-stlport/vc6-stlport-re300dl.lib : vc6-stlport/vc6-stlport-re300dl/c_regex_traits.obj vc6-stlport/vc6-stlport-re300dl/c_regex_traits_common.obj vc6-stlport/vc6-stlport-re300dl/cpp_regex_traits.obj vc6-stlport/vc6-stlport-re300dl/cregex.obj vc6-stlport/vc6-stlport-re300dl/fileiter.obj vc6-stlport/vc6-stlport-re300dl/posix_api.obj vc6-stlport/vc6-stlport-re300dl/regex.obj vc6-stlport/vc6-stlport-re300dl/regex_debug.obj vc6-stlport/vc6-stlport-re300dl/regex_synch.obj vc6-stlport/vc6-stlport-re300dl/w32_regex_traits.obj vc6-stlport/vc6-stlport-re300dl/wide_posix_api.obj + link @<< + kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"vc6-stlport/vc6-stlport-re300dl.pdb" /debug /machine:I386 /out:"vc6-stlport/vc6-stlport-re300dl.dll" /implib:"vc6-stlport/vc6-stlport-re300dl.lib" /pdbtype:sept $(XLFLAGS) vc6-stlport/vc6-stlport-re300dl/c_regex_traits.obj vc6-stlport/vc6-stlport-re300dl/c_regex_traits_common.obj vc6-stlport/vc6-stlport-re300dl/cpp_regex_traits.obj vc6-stlport/vc6-stlport-re300dl/cregex.obj vc6-stlport/vc6-stlport-re300dl/fileiter.obj vc6-stlport/vc6-stlport-re300dl/posix_api.obj vc6-stlport/vc6-stlport-re300dl/regex.obj vc6-stlport/vc6-stlport-re300dl/regex_debug.obj vc6-stlport/vc6-stlport-re300dl/regex_synch.obj vc6-stlport/vc6-stlport-re300dl/w32_regex_traits.obj vc6-stlport/vc6-stlport-re300dl/wide_posix_api.obj +<< + +######################################################## +# +# section for vc6-stlport-re300l.lib +# +######################################################## +vc6-stlport/vc6-stlport-re300l/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300l/vc6-stlport-re300l.pch -Fo./vc6-stlport/vc6-stlport-re300l/ -Fdvc6-stlport/vc6-stlport-re300l.pdb ../src/c_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300l/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300l/vc6-stlport-re300l.pch -Fo./vc6-stlport/vc6-stlport-re300l/ -Fdvc6-stlport/vc6-stlport-re300l.pdb ../src/c_regex_traits_common.cpp + +vc6-stlport/vc6-stlport-re300l/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300l/vc6-stlport-re300l.pch -Fo./vc6-stlport/vc6-stlport-re300l/ -Fdvc6-stlport/vc6-stlport-re300l.pdb ../src/cpp_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300l/cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300l/vc6-stlport-re300l.pch -Fo./vc6-stlport/vc6-stlport-re300l/ -Fdvc6-stlport/vc6-stlport-re300l.pdb ../src/cregex.cpp + +vc6-stlport/vc6-stlport-re300l/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300l/vc6-stlport-re300l.pch -Fo./vc6-stlport/vc6-stlport-re300l/ -Fdvc6-stlport/vc6-stlport-re300l.pdb ../src/fileiter.cpp + +vc6-stlport/vc6-stlport-re300l/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300l/vc6-stlport-re300l.pch -Fo./vc6-stlport/vc6-stlport-re300l/ -Fdvc6-stlport/vc6-stlport-re300l.pdb ../src/posix_api.cpp + +vc6-stlport/vc6-stlport-re300l/regex.obj: ../src/regex.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300l/vc6-stlport-re300l.pch -Fo./vc6-stlport/vc6-stlport-re300l/ -Fdvc6-stlport/vc6-stlport-re300l.pdb ../src/regex.cpp + +vc6-stlport/vc6-stlport-re300l/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300l/vc6-stlport-re300l.pch -Fo./vc6-stlport/vc6-stlport-re300l/ -Fdvc6-stlport/vc6-stlport-re300l.pdb ../src/regex_debug.cpp + +vc6-stlport/vc6-stlport-re300l/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300l/vc6-stlport-re300l.pch -Fo./vc6-stlport/vc6-stlport-re300l/ -Fdvc6-stlport/vc6-stlport-re300l.pdb ../src/regex_synch.cpp + +vc6-stlport/vc6-stlport-re300l/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300l/vc6-stlport-re300l.pch -Fo./vc6-stlport/vc6-stlport-re300l/ -Fdvc6-stlport/vc6-stlport-re300l.pdb ../src/w32_regex_traits.cpp + +vc6-stlport/vc6-stlport-re300l/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6-stlport/vc6-stlport-re300l/vc6-stlport-re300l.pch -Fo./vc6-stlport/vc6-stlport-re300l/ -Fdvc6-stlport/vc6-stlport-re300l.pdb ../src/wide_posix_api.cpp + +vc6-stlport-re300l_dir : + if not exist "vc6-stlport\vc6-stlport-re300l\$(NULL)" mkdir vc6-stlport\vc6-stlport-re300l + +vc6-stlport-re300l_clean : + del vc6-stlport\vc6-stlport-re300l\*.obj + del vc6-stlport\vc6-stlport-re300l\*.idb + del vc6-stlport\vc6-stlport-re300l\*.exp + +./vc6-stlport/vc6-stlport-re300l.lib : vc6-stlport/vc6-stlport-re300l/c_regex_traits.obj vc6-stlport/vc6-stlport-re300l/c_regex_traits_common.obj vc6-stlport/vc6-stlport-re300l/cpp_regex_traits.obj vc6-stlport/vc6-stlport-re300l/cregex.obj vc6-stlport/vc6-stlport-re300l/fileiter.obj vc6-stlport/vc6-stlport-re300l/posix_api.obj vc6-stlport/vc6-stlport-re300l/regex.obj vc6-stlport/vc6-stlport-re300l/regex_debug.obj vc6-stlport/vc6-stlport-re300l/regex_synch.obj vc6-stlport/vc6-stlport-re300l/w32_regex_traits.obj vc6-stlport/vc6-stlport-re300l/wide_posix_api.obj + link @<< + kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"vc6-stlport/vc6-stlport-re300l.pdb" /debug /machine:I386 /out:"vc6-stlport/vc6-stlport-re300l.dll" /implib:"vc6-stlport/vc6-stlport-re300l.lib" /pdbtype:sept $(XLFLAGS) vc6-stlport/vc6-stlport-re300l/c_regex_traits.obj vc6-stlport/vc6-stlport-re300l/c_regex_traits_common.obj vc6-stlport/vc6-stlport-re300l/cpp_regex_traits.obj vc6-stlport/vc6-stlport-re300l/cregex.obj vc6-stlport/vc6-stlport-re300l/fileiter.obj vc6-stlport/vc6-stlport-re300l/posix_api.obj vc6-stlport/vc6-stlport-re300l/regex.obj vc6-stlport/vc6-stlport-re300l/regex_debug.obj vc6-stlport/vc6-stlport-re300l/regex_synch.obj vc6-stlport/vc6-stlport-re300l/w32_regex_traits.obj vc6-stlport/vc6-stlport-re300l/wide_posix_api.obj +<< + diff --git a/lib/vc6.mak b/lib/vc6.mak new file mode 100644 index 00000000..33015cb0 --- /dev/null +++ b/lib/vc6.mak @@ -0,0 +1,351 @@ +# +# auto generated makefile for VC6 compiler +# +# usage: +# make +# brings libraries up to date +# make install +# brings libraries up to date and copies binaries to your VC6 /lib and /bin directories (recomended) +# + +# +# Add additional compiler options here: +# +XCFLAGS= +# +# add additional linker flags here: +# +XLFLAGS= +# +# add additional static-library creation flags here: +# +XSFLAGS= + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + + +ALL_HEADER=../../../boost/cregex.hpp ../../../boost/pattern_except.hpp ../../../boost/regex.hpp ../../../boost/regex_traits.hpp ../../../boost/re_detail/fileiter.hpp ../../../boost/re_detail/jm_opt.hpp ../../../boost/re_detail/regex_compile.hpp ../../../boost/re_detail/regex_config.hpp ../../../boost/re_detail/regex_cstring.hpp ../../../boost/re_detail/regex_format.hpp ../../../boost/re_detail/regex_kmp.hpp ../../../boost/re_detail/regex_library_include.hpp ../../../boost/re_detail/regex_match.hpp ../../../boost/re_detail/regex_options.hpp ../../../boost/re_detail/regex_raw_buffer.hpp ../../../boost/re_detail/regex_split.hpp ../../../boost/re_detail/regex_stack.hpp ../../../boost/re_detail/regex_synch.hpp + +all : main_dir vc6-re300_dir ./vc6/vc6-re300.lib vc6-re300m_dir ./vc6/vc6-re300m.lib vc6-re300d_dir ./vc6/vc6-re300d.lib vc6-re300dm_dir ./vc6/vc6-re300dm.lib vc6-re300dl_dir ./vc6/vc6-re300dl.lib vc6-re300l_dir ./vc6/vc6-re300l.lib + +clean : vc6-re300_clean vc6-re300m_clean vc6-re300d_clean vc6-re300dm_clean vc6-re300dl_clean vc6-re300l_clean + +install : all + copy vc6\vc6-re300.lib "$(MSVCDIR)\lib" + copy vc6\vc6-re300m.lib "$(MSVCDIR)\lib" + copy vc6\vc6-re300d.lib "$(MSVCDIR)\lib" + copy vc6\vc6-re300d.pdb "$(MSVCDIR)\lib" + copy vc6\vc6-re300dm.lib "$(MSVCDIR)\lib" + copy vc6\vc6-re300dm.pdb "$(MSVCDIR)\lib" + copy vc6\vc6-re300dl.lib "$(MSVCDIR)\lib" + copy vc6\vc6-re300dl.dll "$(MSVCDIR)\bin" + copy vc6\vc6-re300dl.pdb "$(MSVCDIR)\lib" + copy vc6\vc6-re300l.lib "$(MSVCDIR)\lib" + copy vc6\vc6-re300l.dll "$(MSVCDIR)\bin" + +main_dir : + if not exist "vc6\$(NULL)" mkdir vc6 + + +######################################################## +# +# section for vc6-re300.lib +# +######################################################## +vc6/vc6-re300/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + cl /c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD $(XCFLAGS) -Fpvc6/vc6-re300/vc6-re300.pch -Fo./vc6/vc6-re300/ -Fdvc6/vc6-re300.pdb ../src/c_regex_traits.cpp + +vc6/vc6-re300/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + cl /c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD $(XCFLAGS) -Fpvc6/vc6-re300/vc6-re300.pch -Fo./vc6/vc6-re300/ -Fdvc6/vc6-re300.pdb ../src/c_regex_traits_common.cpp + +vc6/vc6-re300/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + cl /c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD $(XCFLAGS) -Fpvc6/vc6-re300/vc6-re300.pch -Fo./vc6/vc6-re300/ -Fdvc6/vc6-re300.pdb ../src/cpp_regex_traits.cpp + +vc6/vc6-re300/cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + cl /c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD $(XCFLAGS) -Fpvc6/vc6-re300/vc6-re300.pch -Fo./vc6/vc6-re300/ -Fdvc6/vc6-re300.pdb ../src/cregex.cpp + +vc6/vc6-re300/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + cl /c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD $(XCFLAGS) -Fpvc6/vc6-re300/vc6-re300.pch -Fo./vc6/vc6-re300/ -Fdvc6/vc6-re300.pdb ../src/fileiter.cpp + +vc6/vc6-re300/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + cl /c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD $(XCFLAGS) -Fpvc6/vc6-re300/vc6-re300.pch -Fo./vc6/vc6-re300/ -Fdvc6/vc6-re300.pdb ../src/posix_api.cpp + +vc6/vc6-re300/regex.obj: ../src/regex.cpp $(ALL_HEADER) + cl /c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD $(XCFLAGS) -Fpvc6/vc6-re300/vc6-re300.pch -Fo./vc6/vc6-re300/ -Fdvc6/vc6-re300.pdb ../src/regex.cpp + +vc6/vc6-re300/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + cl /c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD $(XCFLAGS) -Fpvc6/vc6-re300/vc6-re300.pch -Fo./vc6/vc6-re300/ -Fdvc6/vc6-re300.pdb ../src/regex_debug.cpp + +vc6/vc6-re300/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + cl /c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD $(XCFLAGS) -Fpvc6/vc6-re300/vc6-re300.pch -Fo./vc6/vc6-re300/ -Fdvc6/vc6-re300.pdb ../src/regex_synch.cpp + +vc6/vc6-re300/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + cl /c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD $(XCFLAGS) -Fpvc6/vc6-re300/vc6-re300.pch -Fo./vc6/vc6-re300/ -Fdvc6/vc6-re300.pdb ../src/w32_regex_traits.cpp + +vc6/vc6-re300/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + cl /c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD $(XCFLAGS) -Fpvc6/vc6-re300/vc6-re300.pch -Fo./vc6/vc6-re300/ -Fdvc6/vc6-re300.pdb ../src/wide_posix_api.cpp + +vc6-re300_dir : + if not exist "vc6\vc6-re300\$(NULL)" mkdir vc6\vc6-re300 + +vc6-re300_clean : + del vc6\vc6-re300\*.obj + del vc6\vc6-re300\*.idb + del vc6\vc6-re300\*.exp + +./vc6/vc6-re300.lib : vc6/vc6-re300/c_regex_traits.obj vc6/vc6-re300/c_regex_traits_common.obj vc6/vc6-re300/cpp_regex_traits.obj vc6/vc6-re300/cregex.obj vc6/vc6-re300/fileiter.obj vc6/vc6-re300/posix_api.obj vc6/vc6-re300/regex.obj vc6/vc6-re300/regex_debug.obj vc6/vc6-re300/regex_synch.obj vc6/vc6-re300/w32_regex_traits.obj vc6/vc6-re300/wide_posix_api.obj + link -lib /nologo /out:vc6/vc6-re300.lib $(XSFLAGS) vc6/vc6-re300/c_regex_traits.obj vc6/vc6-re300/c_regex_traits_common.obj vc6/vc6-re300/cpp_regex_traits.obj vc6/vc6-re300/cregex.obj vc6/vc6-re300/fileiter.obj vc6/vc6-re300/posix_api.obj vc6/vc6-re300/regex.obj vc6/vc6-re300/regex_debug.obj vc6/vc6-re300/regex_synch.obj vc6/vc6-re300/w32_regex_traits.obj vc6/vc6-re300/wide_posix_api.obj + +######################################################## +# +# section for vc6-re300m.lib +# +######################################################## +vc6/vc6-re300m/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300m/vc6-re300m.pch -Fo./vc6/vc6-re300m/ -Fdvc6/vc6-re300m.pdb ../src/c_regex_traits.cpp + +vc6/vc6-re300m/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300m/vc6-re300m.pch -Fo./vc6/vc6-re300m/ -Fdvc6/vc6-re300m.pdb ../src/c_regex_traits_common.cpp + +vc6/vc6-re300m/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300m/vc6-re300m.pch -Fo./vc6/vc6-re300m/ -Fdvc6/vc6-re300m.pdb ../src/cpp_regex_traits.cpp + +vc6/vc6-re300m/cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300m/vc6-re300m.pch -Fo./vc6/vc6-re300m/ -Fdvc6/vc6-re300m.pdb ../src/cregex.cpp + +vc6/vc6-re300m/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300m/vc6-re300m.pch -Fo./vc6/vc6-re300m/ -Fdvc6/vc6-re300m.pdb ../src/fileiter.cpp + +vc6/vc6-re300m/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300m/vc6-re300m.pch -Fo./vc6/vc6-re300m/ -Fdvc6/vc6-re300m.pdb ../src/posix_api.cpp + +vc6/vc6-re300m/regex.obj: ../src/regex.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300m/vc6-re300m.pch -Fo./vc6/vc6-re300m/ -Fdvc6/vc6-re300m.pdb ../src/regex.cpp + +vc6/vc6-re300m/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300m/vc6-re300m.pch -Fo./vc6/vc6-re300m/ -Fdvc6/vc6-re300m.pdb ../src/regex_debug.cpp + +vc6/vc6-re300m/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300m/vc6-re300m.pch -Fo./vc6/vc6-re300m/ -Fdvc6/vc6-re300m.pdb ../src/regex_synch.cpp + +vc6/vc6-re300m/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300m/vc6-re300m.pch -Fo./vc6/vc6-re300m/ -Fdvc6/vc6-re300m.pdb ../src/w32_regex_traits.cpp + +vc6/vc6-re300m/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + cl /nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300m/vc6-re300m.pch -Fo./vc6/vc6-re300m/ -Fdvc6/vc6-re300m.pdb ../src/wide_posix_api.cpp + +vc6-re300m_dir : + if not exist "vc6\vc6-re300m\$(NULL)" mkdir vc6\vc6-re300m + +vc6-re300m_clean : + del vc6\vc6-re300m\*.obj + del vc6\vc6-re300m\*.idb + del vc6\vc6-re300m\*.exp + +./vc6/vc6-re300m.lib : vc6/vc6-re300m/c_regex_traits.obj vc6/vc6-re300m/c_regex_traits_common.obj vc6/vc6-re300m/cpp_regex_traits.obj vc6/vc6-re300m/cregex.obj vc6/vc6-re300m/fileiter.obj vc6/vc6-re300m/posix_api.obj vc6/vc6-re300m/regex.obj vc6/vc6-re300m/regex_debug.obj vc6/vc6-re300m/regex_synch.obj vc6/vc6-re300m/w32_regex_traits.obj vc6/vc6-re300m/wide_posix_api.obj + link -lib /nologo /out:vc6/vc6-re300m.lib $(XSFLAGS) vc6/vc6-re300m/c_regex_traits.obj vc6/vc6-re300m/c_regex_traits_common.obj vc6/vc6-re300m/cpp_regex_traits.obj vc6/vc6-re300m/cregex.obj vc6/vc6-re300m/fileiter.obj vc6/vc6-re300m/posix_api.obj vc6/vc6-re300m/regex.obj vc6/vc6-re300m/regex_debug.obj vc6/vc6-re300m/regex_synch.obj vc6/vc6-re300m/w32_regex_traits.obj vc6/vc6-re300m/wide_posix_api.obj + +######################################################## +# +# section for vc6-re300d.lib +# +######################################################## +vc6/vc6-re300d/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300d/vc6-re300d.pch -Fo./vc6/vc6-re300d/ -Fdvc6/vc6-re300d.pdb ../src/c_regex_traits.cpp + +vc6/vc6-re300d/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + cl /nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300d/vc6-re300d.pch -Fo./vc6/vc6-re300d/ -Fdvc6/vc6-re300d.pdb ../src/c_regex_traits_common.cpp + +vc6/vc6-re300d/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300d/vc6-re300d.pch -Fo./vc6/vc6-re300d/ -Fdvc6/vc6-re300d.pdb ../src/cpp_regex_traits.cpp + +vc6/vc6-re300d/cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + cl /nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300d/vc6-re300d.pch -Fo./vc6/vc6-re300d/ -Fdvc6/vc6-re300d.pdb ../src/cregex.cpp + +vc6/vc6-re300d/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + cl /nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300d/vc6-re300d.pch -Fo./vc6/vc6-re300d/ -Fdvc6/vc6-re300d.pdb ../src/fileiter.cpp + +vc6/vc6-re300d/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + cl /nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300d/vc6-re300d.pch -Fo./vc6/vc6-re300d/ -Fdvc6/vc6-re300d.pdb ../src/posix_api.cpp + +vc6/vc6-re300d/regex.obj: ../src/regex.cpp $(ALL_HEADER) + cl /nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300d/vc6-re300d.pch -Fo./vc6/vc6-re300d/ -Fdvc6/vc6-re300d.pdb ../src/regex.cpp + +vc6/vc6-re300d/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + cl /nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300d/vc6-re300d.pch -Fo./vc6/vc6-re300d/ -Fdvc6/vc6-re300d.pdb ../src/regex_debug.cpp + +vc6/vc6-re300d/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + cl /nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300d/vc6-re300d.pch -Fo./vc6/vc6-re300d/ -Fdvc6/vc6-re300d.pdb ../src/regex_synch.cpp + +vc6/vc6-re300d/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300d/vc6-re300d.pch -Fo./vc6/vc6-re300d/ -Fdvc6/vc6-re300d.pdb ../src/w32_regex_traits.cpp + +vc6/vc6-re300d/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + cl /nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300d/vc6-re300d.pch -Fo./vc6/vc6-re300d/ -Fdvc6/vc6-re300d.pdb ../src/wide_posix_api.cpp + +vc6-re300d_dir : + if not exist "vc6\vc6-re300d\$(NULL)" mkdir vc6\vc6-re300d + +vc6-re300d_clean : + del vc6\vc6-re300d\*.obj + del vc6\vc6-re300d\*.idb + del vc6\vc6-re300d\*.exp + +./vc6/vc6-re300d.lib : vc6/vc6-re300d/c_regex_traits.obj vc6/vc6-re300d/c_regex_traits_common.obj vc6/vc6-re300d/cpp_regex_traits.obj vc6/vc6-re300d/cregex.obj vc6/vc6-re300d/fileiter.obj vc6/vc6-re300d/posix_api.obj vc6/vc6-re300d/regex.obj vc6/vc6-re300d/regex_debug.obj vc6/vc6-re300d/regex_synch.obj vc6/vc6-re300d/w32_regex_traits.obj vc6/vc6-re300d/wide_posix_api.obj + link -lib /nologo /out:vc6/vc6-re300d.lib $(XSFLAGS) vc6/vc6-re300d/c_regex_traits.obj vc6/vc6-re300d/c_regex_traits_common.obj vc6/vc6-re300d/cpp_regex_traits.obj vc6/vc6-re300d/cregex.obj vc6/vc6-re300d/fileiter.obj vc6/vc6-re300d/posix_api.obj vc6/vc6-re300d/regex.obj vc6/vc6-re300d/regex_debug.obj vc6/vc6-re300d/regex_synch.obj vc6/vc6-re300d/w32_regex_traits.obj vc6/vc6-re300d/wide_posix_api.obj + +######################################################## +# +# section for vc6-re300dm.lib +# +######################################################## +vc6/vc6-re300dm/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dm/vc6-re300dm.pch -Fo./vc6/vc6-re300dm/ -Fdvc6/vc6-re300dm.pdb ../src/c_regex_traits.cpp + +vc6/vc6-re300dm/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dm/vc6-re300dm.pch -Fo./vc6/vc6-re300dm/ -Fdvc6/vc6-re300dm.pdb ../src/c_regex_traits_common.cpp + +vc6/vc6-re300dm/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dm/vc6-re300dm.pch -Fo./vc6/vc6-re300dm/ -Fdvc6/vc6-re300dm.pdb ../src/cpp_regex_traits.cpp + +vc6/vc6-re300dm/cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dm/vc6-re300dm.pch -Fo./vc6/vc6-re300dm/ -Fdvc6/vc6-re300dm.pdb ../src/cregex.cpp + +vc6/vc6-re300dm/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dm/vc6-re300dm.pch -Fo./vc6/vc6-re300dm/ -Fdvc6/vc6-re300dm.pdb ../src/fileiter.cpp + +vc6/vc6-re300dm/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dm/vc6-re300dm.pch -Fo./vc6/vc6-re300dm/ -Fdvc6/vc6-re300dm.pdb ../src/posix_api.cpp + +vc6/vc6-re300dm/regex.obj: ../src/regex.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dm/vc6-re300dm.pch -Fo./vc6/vc6-re300dm/ -Fdvc6/vc6-re300dm.pdb ../src/regex.cpp + +vc6/vc6-re300dm/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dm/vc6-re300dm.pch -Fo./vc6/vc6-re300dm/ -Fdvc6/vc6-re300dm.pdb ../src/regex_debug.cpp + +vc6/vc6-re300dm/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dm/vc6-re300dm.pch -Fo./vc6/vc6-re300dm/ -Fdvc6/vc6-re300dm.pdb ../src/regex_synch.cpp + +vc6/vc6-re300dm/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dm/vc6-re300dm.pch -Fo./vc6/vc6-re300dm/ -Fdvc6/vc6-re300dm.pdb ../src/w32_regex_traits.cpp + +vc6/vc6-re300dm/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + cl /nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dm/vc6-re300dm.pch -Fo./vc6/vc6-re300dm/ -Fdvc6/vc6-re300dm.pdb ../src/wide_posix_api.cpp + +vc6-re300dm_dir : + if not exist "vc6\vc6-re300dm\$(NULL)" mkdir vc6\vc6-re300dm + +vc6-re300dm_clean : + del vc6\vc6-re300dm\*.obj + del vc6\vc6-re300dm\*.idb + del vc6\vc6-re300dm\*.exp + +./vc6/vc6-re300dm.lib : vc6/vc6-re300dm/c_regex_traits.obj vc6/vc6-re300dm/c_regex_traits_common.obj vc6/vc6-re300dm/cpp_regex_traits.obj vc6/vc6-re300dm/cregex.obj vc6/vc6-re300dm/fileiter.obj vc6/vc6-re300dm/posix_api.obj vc6/vc6-re300dm/regex.obj vc6/vc6-re300dm/regex_debug.obj vc6/vc6-re300dm/regex_synch.obj vc6/vc6-re300dm/w32_regex_traits.obj vc6/vc6-re300dm/wide_posix_api.obj + link -lib /nologo /out:vc6/vc6-re300dm.lib $(XSFLAGS) vc6/vc6-re300dm/c_regex_traits.obj vc6/vc6-re300dm/c_regex_traits_common.obj vc6/vc6-re300dm/cpp_regex_traits.obj vc6/vc6-re300dm/cregex.obj vc6/vc6-re300dm/fileiter.obj vc6/vc6-re300dm/posix_api.obj vc6/vc6-re300dm/regex.obj vc6/vc6-re300dm/regex_debug.obj vc6/vc6-re300dm/regex_synch.obj vc6/vc6-re300dm/w32_regex_traits.obj vc6/vc6-re300dm/wide_posix_api.obj + +######################################################## +# +# section for vc6-re300dl.lib +# +######################################################## +vc6/vc6-re300dl/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dl/vc6-re300dl.pch -Fo./vc6/vc6-re300dl/ -Fdvc6/vc6-re300dl.pdb ../src/c_regex_traits.cpp + +vc6/vc6-re300dl/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dl/vc6-re300dl.pch -Fo./vc6/vc6-re300dl/ -Fdvc6/vc6-re300dl.pdb ../src/c_regex_traits_common.cpp + +vc6/vc6-re300dl/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dl/vc6-re300dl.pch -Fo./vc6/vc6-re300dl/ -Fdvc6/vc6-re300dl.pdb ../src/cpp_regex_traits.cpp + +vc6/vc6-re300dl/cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dl/vc6-re300dl.pch -Fo./vc6/vc6-re300dl/ -Fdvc6/vc6-re300dl.pdb ../src/cregex.cpp + +vc6/vc6-re300dl/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dl/vc6-re300dl.pch -Fo./vc6/vc6-re300dl/ -Fdvc6/vc6-re300dl.pdb ../src/fileiter.cpp + +vc6/vc6-re300dl/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dl/vc6-re300dl.pch -Fo./vc6/vc6-re300dl/ -Fdvc6/vc6-re300dl.pdb ../src/posix_api.cpp + +vc6/vc6-re300dl/regex.obj: ../src/regex.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dl/vc6-re300dl.pch -Fo./vc6/vc6-re300dl/ -Fdvc6/vc6-re300dl.pdb ../src/regex.cpp + +vc6/vc6-re300dl/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dl/vc6-re300dl.pch -Fo./vc6/vc6-re300dl/ -Fdvc6/vc6-re300dl.pdb ../src/regex_debug.cpp + +vc6/vc6-re300dl/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dl/vc6-re300dl.pch -Fo./vc6/vc6-re300dl/ -Fdvc6/vc6-re300dl.pdb ../src/regex_synch.cpp + +vc6/vc6-re300dl/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dl/vc6-re300dl.pch -Fo./vc6/vc6-re300dl/ -Fdvc6/vc6-re300dl.pdb ../src/w32_regex_traits.cpp + +vc6/vc6-re300dl/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + cl /nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c $(XCFLAGS) -Fpvc6/vc6-re300dl/vc6-re300dl.pch -Fo./vc6/vc6-re300dl/ -Fdvc6/vc6-re300dl.pdb ../src/wide_posix_api.cpp + +vc6-re300dl_dir : + if not exist "vc6\vc6-re300dl\$(NULL)" mkdir vc6\vc6-re300dl + +vc6-re300dl_clean : + del vc6\vc6-re300dl\*.obj + del vc6\vc6-re300dl\*.idb + del vc6\vc6-re300dl\*.exp + +./vc6/vc6-re300dl.lib : vc6/vc6-re300dl/c_regex_traits.obj vc6/vc6-re300dl/c_regex_traits_common.obj vc6/vc6-re300dl/cpp_regex_traits.obj vc6/vc6-re300dl/cregex.obj vc6/vc6-re300dl/fileiter.obj vc6/vc6-re300dl/posix_api.obj vc6/vc6-re300dl/regex.obj vc6/vc6-re300dl/regex_debug.obj vc6/vc6-re300dl/regex_synch.obj vc6/vc6-re300dl/w32_regex_traits.obj vc6/vc6-re300dl/wide_posix_api.obj + link @<< + kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"vc6/vc6-re300dl.pdb" /debug /machine:I386 /out:"vc6/vc6-re300dl.dll" /implib:"vc6/vc6-re300dl.lib" /pdbtype:sept $(XLFLAGS) vc6/vc6-re300dl/c_regex_traits.obj vc6/vc6-re300dl/c_regex_traits_common.obj vc6/vc6-re300dl/cpp_regex_traits.obj vc6/vc6-re300dl/cregex.obj vc6/vc6-re300dl/fileiter.obj vc6/vc6-re300dl/posix_api.obj vc6/vc6-re300dl/regex.obj vc6/vc6-re300dl/regex_debug.obj vc6/vc6-re300dl/regex_synch.obj vc6/vc6-re300dl/w32_regex_traits.obj vc6/vc6-re300dl/wide_posix_api.obj +<< + +######################################################## +# +# section for vc6-re300l.lib +# +######################################################## +vc6/vc6-re300l/c_regex_traits.obj: ../src/c_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300l/vc6-re300l.pch -Fo./vc6/vc6-re300l/ -Fdvc6/vc6-re300l.pdb ../src/c_regex_traits.cpp + +vc6/vc6-re300l/c_regex_traits_common.obj: ../src/c_regex_traits_common.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300l/vc6-re300l.pch -Fo./vc6/vc6-re300l/ -Fdvc6/vc6-re300l.pdb ../src/c_regex_traits_common.cpp + +vc6/vc6-re300l/cpp_regex_traits.obj: ../src/cpp_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300l/vc6-re300l.pch -Fo./vc6/vc6-re300l/ -Fdvc6/vc6-re300l.pdb ../src/cpp_regex_traits.cpp + +vc6/vc6-re300l/cregex.obj: ../src/cregex.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300l/vc6-re300l.pch -Fo./vc6/vc6-re300l/ -Fdvc6/vc6-re300l.pdb ../src/cregex.cpp + +vc6/vc6-re300l/fileiter.obj: ../src/fileiter.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300l/vc6-re300l.pch -Fo./vc6/vc6-re300l/ -Fdvc6/vc6-re300l.pdb ../src/fileiter.cpp + +vc6/vc6-re300l/posix_api.obj: ../src/posix_api.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300l/vc6-re300l.pch -Fo./vc6/vc6-re300l/ -Fdvc6/vc6-re300l.pdb ../src/posix_api.cpp + +vc6/vc6-re300l/regex.obj: ../src/regex.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300l/vc6-re300l.pch -Fo./vc6/vc6-re300l/ -Fdvc6/vc6-re300l.pdb ../src/regex.cpp + +vc6/vc6-re300l/regex_debug.obj: ../src/regex_debug.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300l/vc6-re300l.pch -Fo./vc6/vc6-re300l/ -Fdvc6/vc6-re300l.pdb ../src/regex_debug.cpp + +vc6/vc6-re300l/regex_synch.obj: ../src/regex_synch.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300l/vc6-re300l.pch -Fo./vc6/vc6-re300l/ -Fdvc6/vc6-re300l.pdb ../src/regex_synch.cpp + +vc6/vc6-re300l/w32_regex_traits.obj: ../src/w32_regex_traits.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300l/vc6-re300l.pch -Fo./vc6/vc6-re300l/ -Fdvc6/vc6-re300l.pdb ../src/w32_regex_traits.cpp + +vc6/vc6-re300l/wide_posix_api.obj: ../src/wide_posix_api.cpp $(ALL_HEADER) + cl /nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c $(XCFLAGS) -Fpvc6/vc6-re300l/vc6-re300l.pch -Fo./vc6/vc6-re300l/ -Fdvc6/vc6-re300l.pdb ../src/wide_posix_api.cpp + +vc6-re300l_dir : + if not exist "vc6\vc6-re300l\$(NULL)" mkdir vc6\vc6-re300l + +vc6-re300l_clean : + del vc6\vc6-re300l\*.obj + del vc6\vc6-re300l\*.idb + del vc6\vc6-re300l\*.exp + +./vc6/vc6-re300l.lib : vc6/vc6-re300l/c_regex_traits.obj vc6/vc6-re300l/c_regex_traits_common.obj vc6/vc6-re300l/cpp_regex_traits.obj vc6/vc6-re300l/cregex.obj vc6/vc6-re300l/fileiter.obj vc6/vc6-re300l/posix_api.obj vc6/vc6-re300l/regex.obj vc6/vc6-re300l/regex_debug.obj vc6/vc6-re300l/regex_synch.obj vc6/vc6-re300l/w32_regex_traits.obj vc6/vc6-re300l/wide_posix_api.obj + link @<< + kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"vc6/vc6-re300l.pdb" /debug /machine:I386 /out:"vc6/vc6-re300l.dll" /implib:"vc6/vc6-re300l.lib" /pdbtype:sept $(XLFLAGS) vc6/vc6-re300l/c_regex_traits.obj vc6/vc6-re300l/c_regex_traits_common.obj vc6/vc6-re300l/cpp_regex_traits.obj vc6/vc6-re300l/cregex.obj vc6/vc6-re300l/fileiter.obj vc6/vc6-re300l/posix_api.obj vc6/vc6-re300l/regex.obj vc6/vc6-re300l/regex_debug.obj vc6/vc6-re300l/regex_synch.obj vc6/vc6-re300l/w32_regex_traits.obj vc6/vc6-re300l/wide_posix_api.obj +<< + diff --git a/licence.txt b/licence.txt new file mode 100644 index 00000000..90ca57a5 --- /dev/null +++ b/licence.txt @@ -0,0 +1,19 @@ +Copyright (c) 1998-2000 +Dr John Maddock + +Permission to use, copy, modify, distribute and sell this software +and its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and +that both that copyright notice and this permission notice appear +in supporting documentation. Dr John Maddock makes no representations +about the suitability of this software for any purpose. +It is provided "as is" without express or implied warranty. + +Footnotes: +1) Localised versions may translate the above notice into the native + language of the version. +2) The above notice applies to source code and documentation, users + who are distributing only binary forms, need only indicate, somewhere + in their documentation or in their help|about notice that the product + uses this library and that the copyright is Dr John Maddock 1998-2000 + diff --git a/makefile.in b/makefile.in new file mode 100644 index 00000000..11b629fd --- /dev/null +++ b/makefile.in @@ -0,0 +1,28 @@ + +ALL_DEP=@ac_all_dep@ + +base: ./lib/libregex++.a + +./lib/libregex++.a: $(ALL_DEP) + sh dmi.sh lib + + +jgrep : base + sh dmi.sh demo/jgrep + + +test : base + sh dmi.sh demo/regress + +regress : test + +timer : base + sh dmi.sh demo/timer + +install : base + echo no install option available + +all : base jgrep test timer + + + diff --git a/makefile_gen b/makefile_gen new file mode 100644 index 00000000..b4223fd3 --- /dev/null +++ b/makefile_gen @@ -0,0 +1,610 @@ +#! /bin/bash + +libname="" +src="" +header="" +all_dep="" + +# current makefile: +out="" +# temporary file: +tout="" +# install target temp file: +iout="" +# debug flag: +debug="no" +# compile options: +opts="" +# main output sub-directory: +subdir="" +# vcl flag: +use_vcl="yes" + + +function vc6_gen_lib() +{ + all_dep="$all_dep $libname""_dir ./$subdir/$libname.lib" + echo " copy $subdir\\$libname.lib "'"$'"(MSVCDIR)\\lib"'"' >> $iout + if test $debug == "yes"; then + echo " copy $subdir\\$libname.pdb "'"$'"(MSVCDIR)\\lib"'"' >> $iout + fi +# +# set up section comments: + cat >> $tout << EOF +######################################################## +# +# section for $libname.lib +# +######################################################## +EOF +# +# process source files: + all_obj="" + for file in $src + do + obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1obj/g'` + obj="$subdir/$libname/$obj" + all_obj="$all_obj $obj" + echo "$obj: $file \$(ALL_HEADER)" >> $tout + echo " cl $opts \$(XCFLAGS) -Fp$subdir/$libname/$libname.pch -Fo./$subdir/$libname/ -Fd$subdir/$libname.pdb $file" >> $tout + echo "" >> $tout + done +# +# now for the directories for this library: + echo "$libname"_dir : >> $tout + echo " if not exist \"$subdir\\$libname\\\$(NULL)\" mkdir $subdir\\$libname" >> $tout + echo "" >> $tout +# +# now for the clean options for this library: + all_clean="$all_clean $libname""_clean" + echo "$libname"_clean : >> $tout + echo " del $subdir\\$libname\\"'*.obj' >> $tout + echo " del $subdir\\$libname\\"'*.idb' >> $tout + echo " del $subdir\\$libname\\"'*.exp' >> $tout + echo "" >> $tout +# +# now for the main target for this library: + echo ./$subdir/$libname.lib : $all_obj >> $tout + echo " link -lib /nologo /out:$subdir/$libname.lib \$(XSFLAGS) $all_obj" >> $tout + echo "" >> $tout +} + +function vc6_gen_dll() +{ + all_dep="$all_dep $libname""_dir ./$subdir/$libname.lib" + echo " copy $subdir\\$libname.lib "'"$'"(MSVCDIR)\\lib"'"' >> $iout + echo " copy $subdir\\$libname.dll "'"$'"(MSVCDIR)\\bin"'"' >> $iout + if test $debug == "yes"; then + echo " copy $subdir\\$libname.pdb "'"$'"(MSVCDIR)\\lib"'"' >> $iout + fi +# +# set up section comments: + cat >> $tout << EOF +######################################################## +# +# section for $libname.lib +# +######################################################## +EOF +# +# process source files: + all_obj="" + for file in $src + do + obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1obj/g'` + obj="$subdir/$libname/$obj" + all_obj="$all_obj $obj" + echo "$obj: $file \$(ALL_HEADER)" >> $tout + echo " cl $opts \$(XCFLAGS) -Fp$subdir/$libname/$libname.pch -Fo./$subdir/$libname/ -Fd$subdir/$libname.pdb $file" >> $tout + echo "" >> $tout + done +# +# now for the directories for this library: + echo "$libname"_dir : >> $tout + echo " if not exist \"$subdir\\$libname\\\$(NULL)\" mkdir $subdir\\$libname" >> $tout + echo "" >> $tout +# +# now for the clean options for this library: + all_clean="$all_clean $libname""_clean" + echo "$libname"_clean : >> $tout + echo " del $subdir\\$libname\\"'*.obj' >> $tout + echo " del $subdir\\$libname\\"'*.idb' >> $tout + echo " del $subdir\\$libname\\"'*.exp' >> $tout + echo "" >> $tout +# +# now for the main target for this library: + echo ./$subdir/$libname.lib : $all_obj >> $tout + echo " link @<<" >> $tout + echo " kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:\"$subdir/$libname.pdb\" /debug /machine:I386 /out:\"$subdir/$libname.dll\" /implib:\"$subdir/$libname.lib\" /pdbtype:sept \$(XLFLAGS) $all_obj" >> $tout + echo "<<" >> $tout + echo "" >> $tout +} + +is_stlport="no" + +function vc6_gen() +{ + tout="temp" + iout="temp_install" + all_dep="main_dir" + all_clean="" + echo > $out + echo > $tout + rm -f $iout + + if test "$is_stlport" == yes; then + prefix='vc6-stlport-' + else + prefix='vc6-' + fi + + if test "$no_single" != "yes"; then + libname="$prefix""re300" + opts="/c /nologo /ML /W3 /GX /O2 /I..\..\..\ /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD" + vc6_gen_lib + fi + + libname="$prefix""re300m" + opts="/nologo /MT /W3 /GX /O2 /I..\..\..\ /D_MT /DWIN32 /DNDEBUG /D_MBCS /D_LIB /YX /FD /c" + vc6_gen_lib + + if test "$no_single" != "yes"; then + debug="yes" + libname="$prefix""re300d" + opts="/nologo /MLd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c " + vc6_gen_lib + fi + + libname="$prefix""re300dm" + opts="/nologo /MTd /W3 /Gm /GX /Zi /Od /I..\..\..\ /DWIN32 /D_MT /D_DEBUG /D_MBCS /D_LIB /YX /FD /GZ /c" + vc6_gen_lib + + libname="$prefix""re300dl" + opts="/nologo /MDd /W3 /Gm /GX /Zi /Od /I../../../ /D_DEBUG /DWIN32 /D_WINDOWS /D_MBCS /DUSRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /GZ /c" + vc6_gen_dll + + debug="no" + opts="/nologo /MD /W3 /GX /O2 /I../../../ /DNDEBUG /DWIN32 /D_WINDOWS /D_MBCS /D_USRDLL /DBOOST_RE_DLL_EXPORTS /DBOOST_RE_BUILD_DLL /YX /FD /c" + libname="$prefix""re300l" + vc6_gen_dll + + cat > $out << EOF +# +# auto generated makefile for VC6 compiler +# +# usage: +# make +# brings libraries up to date +# make install +# brings libraries up to date and copies binaries to your VC6 /lib and /bin directories (recomended) +# + +# +# Add additional compiler options here: +# +XCFLAGS= +# +# add additional linker flags here: +# +XLFLAGS= +# +# add additional static-library creation flags here: +# +XSFLAGS= + +!IF "\$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +EOF + echo "" >> $out + echo "ALL_HEADER=$header" >> $out + echo "" >> $out + echo "all : $all_dep" >> $out + echo >> $out + echo "clean : $all_clean" >> $out + echo >> $out + echo "install : all" >> $out + cat $iout >> $out + echo >> $out + echo main_dir : >> $out + echo " if not exist \"$subdir\\\$(NULL)\" mkdir $subdir" >> $out + echo "" >> $out + + cat $tout >> $out +} + + +############################################################### +# +# gcc generator section: +# +############################################################### + +function gcc_gen_lib() +{ + all_dep="$all_dep $subdir $subdir/$libname ./$subdir/lib$libname.a" +# +# set up section comments: + cat >> $tout << EOF +######################################################## +# +# section for lib$libname.a +# +######################################################## +EOF +# +# process source files: + all_obj="" + for file in $src + do + obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1o/g'` + obj="$subdir/$libname/$obj" + all_obj="$all_obj $obj" + echo "$obj: $file \$(ALL_HEADER)" >> $tout + echo " g++ -o $obj $opts \$(XCFLAGS) $file" >> $tout + echo "" >> $tout + done +# +# now for the directories for this library: + echo "$subdir/$libname : " >> $tout + echo " mkdir -p $subdir/$libname" >> $tout + echo "" >> $tout +# +# now for the clean options for this library: + all_clean="$all_clean $libname""_clean" + echo "$libname"_clean : >> $tout + echo " rm -f $subdir/$libname/*.o" >> $tout + echo "" >> $tout +# +# now for the main target for this library: + echo ./$subdir/lib$libname.a : $all_obj >> $tout + echo " ar -r \$(XSFLAGS) $subdir/lib$libname.a $all_obj" >> $tout + echo "" >> $tout +} + +function gcc_gen() +{ + out="lib/gcc.mak" + tout="temp" + iout="temp_install" + subdir="gcc" + all_dep="" + all_clean="" + echo > $out + echo > $tout + echo > $iout + + libname="regex++" + opts="-c -O2 -I../../../" + gcc_gen_lib + libname="regex++debug" + opts="-c -I../../../ -g" + gcc_gen_lib + + + cat > $out << EOF +# +# auto generated makefile for gcc compiler +# +# usage: +# make +# brings libraries up to date +# make clean +# deletes temporary object files (but not archives). +# + +# +# Add additional compiler options here: +# +XCFLAGS= +# +# add additional linker flags here: +# +XLFLAGS= +# +# add additional static-library creation flags here: +# +XSFLAGS= + + +EOF + echo "" >> $out + echo "ALL_HEADER=$header" >> $out + echo "" >> $out + echo "all : $subdir $all_dep" >> $out + echo >> $out + echo "$subdir :" >> $out + echo " mkdir -p $subdir" >> $out + echo >> $out + echo "clean : $all_clean" >> $out + echo >> $out + echo "install : all" >> $out + cat $iout >> $out + echo >> $out + cat $tout >> $out +} + +####################################################################### +# +# section for C++ Builder +# +####################################################################### + +function bcb_gen_lib() +{ + all_dep="$all_dep $subdir\\$libname $subdir\\$libname.lib" + echo " copy $subdir\\$libname.lib \$(BCROOT)\\lib" >> $iout +# +# set up section comments: + cat >> $tout << EOF +######################################################## +# +# section for $libname.lib +# +######################################################## +EOF +# +# process source files: + all_obj="" + all_lib_obj="" + for file in $src + do + obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1obj/g'` + obj="$subdir\\$libname\\$obj" + all_obj="$all_obj $obj" + all_lib_obj="$all_lib_obj +$obj" + echo "$obj: $file \$(ALL_HEADER)" >> $tout + echo " bcc32 @&&|" >> $tout + echo "-c $opts \$(XCFLAGS) -o$obj $file" >> $tout + echo "|" >> $tout + echo "" >> $tout + done +# +# now for the directories for this library: + echo "$subdir\\$libname : " >> $tout + echo " -mkdir $subdir\\$libname" >> $tout + echo "" >> $tout +# +# now for the clean options for this library: + all_clean="$all_clean $libname""_clean" + echo "$libname"_clean : >> $tout + echo " del $subdir\\$libname\\"'*.obj' >> $tout + echo " del $subdir\\$libname\\"'*.il?' >> $tout + echo " del $subdir\\$libname\\"'*.csm' >> $tout + echo " del $subdir\\$libname\\"'*.tds' >> $tout + echo "" >> $tout +# +# now for the main target for this library: + echo $subdir\\$libname.lib : $all_obj >> $tout + echo " tlib @&&|" >> $tout + echo "/P32 /u /a \$(XSFLAGS) $subdir\\$libname.lib $all_lib_obj" >> $tout + echo "|" >> $tout + echo "" >> $tout +} + +function bcb_gen_dll() +{ + all_dep="$all_dep $subdir\\$libname $subdir\\$libname.lib" + echo " copy $subdir\\$libname.lib \$(BCROOT)\\lib" >> $iout + echo " copy $subdir\\$libname.dll \$(BCROOT)\\bin" >> $iout +# +# set up section comments: + cat >> $tout << EOF +######################################################## +# +# section for $libname.lib +# +######################################################## +EOF +# +# process source files: + all_obj="" + for file in $src + do + obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1obj/g'` + obj="$subdir\\$libname\\$obj" + all_obj="$all_obj $obj" + echo "$obj: $file \$(ALL_HEADER)" >> $tout + echo " bcc32 @&&|" >> $tout + echo "-c $opts \$(XCFLAGS) -o$obj $file" >> $tout + echo "|" >> $tout + echo "" >> $tout + done +# +# now for the directories for this library: + echo "$subdir\\$libname :" >> $tout + echo " -mkdir $subdir\\$libname" >> $tout + echo "" >> $tout +# +# now for the clean options for this library: + all_clean="$all_clean $libname""_clean" + echo "$libname"_clean : >> $tout + echo " del $subdir\\$libname\\"'*.obj' >> $tout + echo " del $subdir\\$libname\\"'*.il?' >> $tout + echo " del $subdir\\$libname\\"'*.csm' >> $tout + echo " del $subdir\\$libname\\"'*.tds' >> $tout + echo " del $subdir\\"'*.tds' >> $tout + echo "" >> $tout +# +# now for the main target for this library: + echo $subdir\\$libname.lib : $all_obj >> $tout + echo " bcc32 @&&|" >> $tout + echo "$opts -e$subdir\\$libname.dll $all_obj \$(XLFLAGS)" >> $tout + echo "|" >> $tout + echo " implib $subdir\\$libname.lib -c $subdir\\$libname.dll" >> $tout + echo "" >> $tout +} + + + +function bcb_gen() +{ + tout="temp" + iout="temp_install" + all_dep="$subdir" + all_clean="" + echo > $out + echo > $tout + rm -f $iout + + libname="$subdir""re300" + opts="-tWM- -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I\$(BCROOT)\include;../../../;" + bcb_gen_lib + + libname="$subdir""re300m" + opts="-tWM -D_NO_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../;" + bcb_gen_lib + + if test $use_vcl == "yes"; then + + libname="$subdir""re300v" + opts="-tWM -tWV -DJM_USE_VCL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I\$(BCROOT)\include;../../../;" + bcb_gen_lib + + libname="$subdir""re300lv" + opts="-DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -tWV -DJM_USE_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8037 -w-8057 -DSTRICT; -I\$(BCROOT)\include;../../../; -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" + bcb_gen_dll + + fi + + libname="$subdir""re300lm" + opts="-DBOOST_RE_BUILD_DLL -tWD -tWM -tWR -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../; -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" + bcb_gen_dll + + libname="$subdir""re300l" + opts="-DBOOST_RE_BUILD_DLL -tWD -tWR -tWM- -D_NO_VCL -D_RTLDLL -O2 -w-inl -w-aus -w-rch -w-8012 -w-8057 -w-8037 -DSTRICT; -I\$(BCROOT)\include;../../../; -L\$(BCROOT)\lib;\$(BCROOT)\lib\release;" + bcb_gen_dll + + + cat > $out << EOF +# +# auto generated makefile for C++ Builder +# +# usage: +# make +# brings libraries up to date +# make install +# brings libraries up to date and copies binaries to your C++ Builder /lib and /bin directories (recomended) +# make clean +# removes all temporary files. + +# +# Add additional compiler options here: +# +XCFLAGS= +# +# add additional linker flags here: +# +XLFLAGS= +# +# add additional static-library creation flags here: +# +XSFLAGS= + +!ifndef BCROOT +BCROOT=\$(MAKEDIR)\\.. +!endif + +EOF + echo "" >> $out + echo "ALL_HEADER=$header" >> $out + echo "" >> $out + echo "all : $all_dep" >> $out + echo >> $out + echo "clean : $all_clean" >> $out + echo >> $out + echo "install : all" >> $out + cat $iout >> $out + echo >> $out + echo $subdir : >> $out + echo " -mkdir $subdir" >> $out + echo "" >> $out + + cat $tout >> $out +} + + + + +# +# locate all the header dependencies: +header="../../../boost/cregex.hpp ../../../boost/pattern_except.hpp ../../../boost/regex.hpp ../../../boost/regex_traits.hpp" + +for file in ../../boost/re_detail/*.hpp +do + +if test $file != '../../boost/re_detail/*.hpp'; then + header="$header ../$file" +fi + +done + +for file in ../../boost/re_detail/*.hxx +do + +if test $file != '../../boost/re_detail/*.hxx'; then + header="$header $file" +fi + +done + +# +# locate all the source files: +for file in src/*.cpp +do + +if test $file != 'src/*.cpp'; then + src="$src ../$file" +fi + +done + +# +# generate vc6 makefile: +out="lib/vc6.mak" +subdir="vc6" +vc6_gen +# +# generate vc6-stlport makefile: +is_stlport="yes" +out="lib/vc6-stlport.mak" +no_single="yes" +subdir="vc6-stlport" +vc6_gen +# +# generate gcc makefile: +gcc_gen +# +# generate C++ Builder 4 files: +out="lib/bcb4.mak" +subdir="bcb4" +bcb_gen +# +# generate C++ Builder 5 files: +out="lib/bcb5.mak" +subdir="bcb5" +bcb_gen +# +# generate C++ Builder 5 command line tools files: +use_vcl="no" +out="lib/bc55.mak" +subdir="bcb5" +bcb_gen + + +# +# remove tmep files; +rm -f $tout $iout + + + + + + + + + + diff --git a/old_include/cregex b/old_include/cregex new file mode 100644 index 00000000..7a59629d --- /dev/null +++ b/old_include/cregex @@ -0,0 +1,3 @@ +#include + + diff --git a/old_include/cregex.h b/old_include/cregex.h new file mode 100644 index 00000000..5a70cfc1 --- /dev/null +++ b/old_include/cregex.h @@ -0,0 +1,134 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * FILE cregex.h + * VERSION 2.21 + * deprecated regular expression matching algorithms + */ + +#ifndef BOOST_OLD_CREGEX_H +#define BOOST_OLD_CREGEX_H + +#include + +// +// macro defs: +#define JM_STD std +#define JM_CSTD std +#define JM jm + +#define JM_RA_ITERATOR(a,b) BOOST_RE_RA_ITERATOR(a,b) + +#ifdef BOOST_RE_OLD_IOSTREAM +#define JM_OLD_IOSTREAM +#endif +#ifdef BOOST_RE_NO_MEMBER_TEMPLATES +#define JM_NO_MEMBER_TEMPLATES +#endif + +#ifdef __cplusplus + +namespace jm = boost; + +#if !defined(BOOST_RE_NO_USING) +using boost::regex_tA; +using boost::regex_t; +using boost::regoff_t; +using boost::regmatch_t; +using boost::regcompA; +using boost::regerrorA; +using boost::regexecA; +using boost::regfreeA; + +#ifndef BOOST_RE_NO_WCSTRING +using boost::regex_tW; +using boost::regcompW; +using boost::regerrorW; +using boost::regexecW; +using boost::regfreeW; +#endif + +using boost::RegEx; +using boost::GrepCallback; +using boost::GrepFileCallback; +using boost::FindFilesCallback; + +using boost::match_flags; +using boost::reg_errcode_t; + +using boost::REG_NOERROR; +using boost::REG_NOMATCH; +using boost::REG_BADPAT; +using boost::REG_ECOLLATE; +using boost::REG_ECTYPE; +using boost::REG_EESCAPE; +using boost::REG_ESUBREG; +using boost::REG_EBRACK; +using boost::REG_EPAREN; +using boost::REG_EBRACE; +using boost::REG_BADBR; +using boost::REG_ERANGE; +using boost::REG_ESPACE; +using boost::REG_BADRPT; +using boost::REG_EEND; +using boost::REG_ESIZE; +using boost::REG_ERPAREN; +using boost::REG_EMPTY; +using boost::REG_E_MEMORY; +using boost::REG_E_UNKNOWN; +using boost::match_default; +using boost::match_not_bol; +using boost::match_not_eol; +using boost::match_not_bob; +using boost::match_not_eob; +using boost::match_not_bow; +using boost::match_not_eow; +using boost::match_not_dot_newline; +using boost::match_not_dot_null; +using boost::match_prev_avail; +using boost::match_init; +using boost::match_any; +using boost::match_not_null; +using boost::match_continuous; +using boost::match_stop; + +using boost::REG_BASIC; +using boost::REG_EXTENDED; +using boost::REG_ICASE; +using boost::REG_NOSUB; +using boost::REG_NEWLINE; +using boost::REG_NOSPEC; +using boost::REG_PEND; +using boost::REG_DUMP; +using boost::REG_NOCOLLATE; + +using boost::REG_ASSERT; +using boost::REG_INVARG; +using boost::REG_ATOI; +using boost::REG_ITOA; + +using boost::REG_NOTBOL; +using boost::REG_NOTEOL; +using boost::REG_STARTEND; + +#endif // BOOST_RE_NO_USING +#endif // __cplusplus + +#ifdef BOOST_RE_USING_HACK +using namespace boost; +#endif + +#endif // include guard diff --git a/old_include/fileiter.h b/old_include/fileiter.h new file mode 100644 index 00000000..d5dff800 --- /dev/null +++ b/old_include/fileiter.h @@ -0,0 +1,25 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + +#ifndef BOOST_FILEITER_H +#define BOOST_FILEITER_H + +#include + +using boost::re_detail::directory_iterator; +using boost::re_detail::file_iterator; +using boost::re_detail::mapfile; + +#endif diff --git a/old_include/regex b/old_include/regex new file mode 100644 index 00000000..2709369e --- /dev/null +++ b/old_include/regex @@ -0,0 +1,3 @@ +#include + + diff --git a/old_include/regex.h b/old_include/regex.h new file mode 100644 index 00000000..a83e09d9 --- /dev/null +++ b/old_include/regex.h @@ -0,0 +1,481 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * FILE regex.h + * VERSION 2.21 + * deprecated regular expression matching algorithms + */ + +#ifndef BOOST_OLD_REGEX_H +#define BOOST_OLD_REGEX_H + +#include +#include + +namespace boost{ + +namespace deprecated{ +// +// class reg_match: +// old name for match_results, this ones just a thin wrapper: +// +template ::type)> +class reg_match : public boost::match_results +{ + typedef boost::match_results base_type; + typedef boost::re_detail::match_results_base ancestor; +public: + reg_match(const Allocator& a = Allocator()) + : base_type(a){} + + reg_match(const ancestor& m) + : base_type(m){} + + reg_match& operator=(const ancestor& m) + { + // shallow copy + ancestor::operator=(m); + return *this; + } + + reg_match(const base_type& m) + : base_type(m){} + reg_match& operator=(const base_type& m) + { + // deep copy + base_type::operator=(m); + return *this; + } +}; +// +// proc query_match +// returns true if the specified regular expression matches +// at position first. Fills in what matched in m. +// +template +bool query_match(iterator first, iterator last, boost::match_results& m, const reg_expression& e, unsigned flags = match_default) +{ + // prepare m for failure: + if((flags & match_init) == 0) + { + m.set_size(e.mark_count(), first, last); + m.set_base(first); + m.set_line(1, first); + } + boost::re_detail::_priv_match_data pd(m); + iterator restart; + return boost::re_detail::query_match_aux(first, last, m, e, flags, pd, &restart); +} + +// +// query_match convenience interfaces: +#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC +// +// this isn't really a partial specialisation, but template function +// overloading - if the compiler doesn't support partial specialisation +// then it really won't support this either: +template +inline bool query_match(const charT* str, + boost::match_results& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return query_match(str, str + traits::length(str), m, e, flags); +} + +template +inline bool query_match(const std::basic_string& s, + boost::match_results::const_iterator, Allocator>& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return query_match(s.begin(), s.end(), m, e, flags); +} +#else // partial ordering +inline bool query_match(const char* str, + cmatch& m, + const regex& e, + unsigned flags = match_default) +{ + return query_match(str, str + regex::traits_type::length(str), m, e, flags); +} +#ifndef BOOST_RE_NO_WCSTRING +inline bool query_match(const wchar_t* str, + wcmatch& m, + const wregex& e, + unsigned flags = match_default) +{ + return query_match(str, str + wregex::traits_type::length(str), m, e, flags); +} +#endif +inline bool query_match(const std::string& s, + boost::match_results& m, + const regex& e, + unsigned flags = match_default) +{ + return query_match(s.begin(), s.end(), m, e, flags); +} +#if !defined(BOOST_RE_NO_WCSTRING) +inline bool query_match(const std::basic_string& s, + boost::match_results::const_iterator, wregex::allocator_type>& m, + const wregex& e, + unsigned flags = match_default) +{ + return query_match(s.begin(), s.end(), m, e, flags); +} +#endif + +#endif + + +template +bool reg_search(iterator first, iterator last, boost::match_results& m, const reg_expression& e, unsigned flags = match_default) +{ + if(e.flags() & regbase::failbit) + return false; + + typedef typename traits::size_type traits_size_type; + typedef typename traits::uchar_type traits_uchar_type; + + return boost::re_detail::reg_grep2(boost::re_detail::grep_search_predicate(&m), first, last, e, flags, m.allocator()); +} + +// +// reg_search convenience interfaces: +#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC +// +// this isn't really a partial specialisation, but template function +// overloading - if the compiler doesn't support partial specialisation +// then it really won't support this either: +template +inline bool reg_search(const charT* str, + boost::match_results& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return reg_search(str, str + traits::length(str), m, e, flags); +} + +#ifndef BOOST_RE_NO_STRING_H +template +inline bool reg_search(const std::basic_string& s, + boost::match_results::const_iterator, Allocator>& m, + const reg_expression& e, + unsigned flags = match_default) +{ + return reg_search(s.begin(), s.end(), m, e, flags); +} +#endif +#else // partial specialisation +inline bool reg_search(const char* str, + cmatch& m, + const regex& e, + unsigned flags = match_default) +{ + return reg_search(str, str + regex::traits_type::length(str), m, e, flags); +} +#ifndef BOOST_RE_NO_WCSTRING +inline bool reg_search(const wchar_t* str, + wcmatch& m, + const wregex& e, + unsigned flags = match_default) +{ + return reg_search(str, str + wregex::traits_type::length(str), m, e, flags); +} +#endif +#ifndef BOOST_RE_NO_STRING_H +inline bool reg_search(const std::string& s, + boost::match_results& m, + const regex& e, + unsigned flags = match_default) +{ + return reg_search(s.begin(), s.end(), m, e, flags); +} +#if !defined(BOOST_RE_NO_STRING_DEF_ARGS) && !defined(BOOST_RE_NO_WCSTRING) +inline bool reg_search(const std::basic_string& s, + boost::match_results::const_iterator, wregex::allocator_type>& m, + const wregex& e, + unsigned flags = match_default) +{ + return reg_search(s.begin(), s.end(), m, e, flags); +} +#endif + +#endif + +#endif + + +// +// reg_grep: +// find all non-overlapping matches within the sequence first last: +// +template +inline unsigned int reg_grep(Predicate foo, iterator first, iterator last, const reg_expression& e, unsigned flags = match_default) +{ + return boost::re_detail::reg_grep2(foo, first, last, e, flags, e.allocator()); +} + +// +// reg_grep convenience interfaces: +#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC +// +// this isn't really a partial specialisation, but template function +// overloading - if the compiler doesn't support partial specialisation +// then it really won't support this either: +template +inline unsigned int reg_grep(Predicate foo, const charT* str, + const reg_expression& e, + unsigned flags = match_default) +{ + return reg_grep(foo, str, str + traits::length(str), e, flags); +} + +#ifndef BOOST_RE_NO_STRING_H +template +inline unsigned int reg_grep(Predicate foo, const std::basic_string& s, + const reg_expression& e, + unsigned flags = match_default) +{ + return reg_grep(foo, s.begin(), s.end(), e, flags); +} +#endif +#else // partial specialisation +inline unsigned int reg_grep(bool (*foo)(const cmatch&), const char* str, + const regex& e, + unsigned flags = match_default) +{ + return reg_grep(foo, str, str + regex::traits_type::length(str), e, flags); +} +#ifndef BOOST_RE_NO_WCSTRING +inline unsigned int reg_grep(bool (*foo)(const wcmatch&), const wchar_t* str, + const wregex& e, + unsigned flags = match_default) +{ + return reg_grep(foo, str, str + wregex::traits_type::length(str), e, flags); +} +#endif +#ifndef BOOST_RE_NO_STRING_H +inline unsigned int reg_grep(bool (*foo)(const boost::match_results&), const std::string& s, + const regex& e, + unsigned flags = match_default) +{ + return reg_grep(foo, s.begin(), s.end(), e, flags); +} +#if !defined(BOOST_RE_NO_STRING_DEF_ARGS) && !defined(BOOST_RE_NO_WCSTRING) +inline unsigned int reg_grep(bool (*foo)(const boost::match_results::const_iterator, wregex::allocator_type>&), + const std::basic_string& s, + const wregex& e, + unsigned flags = match_default) +{ + return reg_grep(foo, s.begin(), s.end(), e, flags); +} +#endif + +#endif + +#endif + +// +// finally for compatablity with version 1.x of the library +// we need a form of reg_grep that takes an output iterator +// as its first argument: +// + +// +// struct grep_match: +// stores what matched during a reg_grep, +// the output iterator type passed to reg_grep must have an +// operator*() that returns a type with an +// operator=(const grep_match&); +// +template +struct grep_match +{ + unsigned int line; + iterator line_start; + reg_match what; + + grep_match(Allocator a = Allocator()) : what(a) {} + + grep_match(unsigned int l, iterator p1, const boost::match_results& m) + : what(m) { line = l; line_start = p1; } + + bool operator == (const grep_match& ) + { return false; } + + bool operator < (const grep_match&) + { return false; } +}; + +namespace re_detail{ + +template +struct grep_adaptor +{ + O oi; + reg_match m; + grep_adaptor(O i, A a) : m(a), oi(i) {} + bool operator()(const boost::re_detail::match_results_base& w) + { + m.what = w; + m.line = w.line(); + m.line_start = w.line_start(); + *oi = m; + ++oi; + return true; + } +}; + +} // namespace re_detail + +template +inline unsigned int reg_grep_old(Out oi, iterator first, iterator last, const reg_expression& e, unsigned flags = match_default) +{ + return boost::re_detail::reg_grep2(re_detail::grep_adaptor(oi, e.allocator()), first, last, e, flags, e.allocator()); +} + +template +OutputIterator BOOST_RE_CALL reg_format(OutputIterator out, + const boost::match_results& m, + const charT* fmt) +{ + // + // start by updating the locale: + // + return boost::re_detail::_reg_format_aux(out, m, fmt, 0); +} + +#ifndef BOOST_RE_NO_STRING_DEF_ARGS +template +std::basic_string BOOST_RE_CALL reg_format(const boost::match_results& m, const charT* fmt) +{ + std::basic_string result; + boost::re_detail::string_out_iterator > i(result); + reg_format(i, m, fmt); + return result; +} +#elif !defined(BOOST_RE_NO_STRING_H) +template +std::string BOOST_RE_CALL reg_format(const boost::match_results& m, const char* fmt) +{ + std::string result; + boost::re_detail::string_out_iterator i(result); + reg_format(i, m, fmt); + return result; +} +#endif + +template +OutputIterator BOOST_RE_CALL reg_merge(OutputIterator out, + iterator first, + iterator last, + const reg_expression& e, + const charT* fmt, + bool copy = true, + unsigned int flags = match_default) +{ + // + // start by updating the locale: + // + iterator l = first; + if(!copy) flags |= format_no_copy; + boost::re_detail::merge_out_predicate oi(out, l, fmt, flags, e.get_traits()); + regex_grep(oi, first, last, e, flags); + return copy ? boost::re_detail::re_copy_out(out, l, last) : out; +} + +#ifndef BOOST_RE_NO_STRING_DEF_ARGS +template +std::basic_string BOOST_RE_CALL reg_merge(const std::basic_string& s, + const reg_expression& e, + const charT* fmt, + bool copy = true, + unsigned int flags = match_default) +{ + std::basic_string result; + boost::re_detail::string_out_iterator > i(result); + reg_merge(i, s.begin(), s.end(), e, fmt, copy, flags); + return result; +} +#elif !defined(BOOST_RE_NO_STRING_H) +template +std::string BOOST_RE_CALL reg_merge(const std::string& s, + const reg_expression& e, + const char* fmt, + bool copy = true, + unsigned int flags = match_default) +{ + std::string result; + boost::re_detail::string_out_iterator i(result); + reg_merge(i, s.begin(), s.end(), e, fmt, copy, flags); + return result; +} +#endif + + +} // namespace deprecated + +using deprecated::query_match; +using deprecated::reg_search; +using deprecated::reg_grep; +using deprecated::reg_format; +using deprecated::reg_merge; +using re_detail::jm_def_alloc; +using deprecated::char_regex_traits_i; +using re_detail::re_alloc_binder; +using re_detail::padding_size; + + +} // namspace boost + +namespace jm = boost; + +#if !defined(BOOST_RE_NO_NAMESPACES) && !defined(BOOST_RE_NO_USING) + +using boost::bad_expression; +template +struct char_regex_traits : boost::regex_traits{}; +using boost::deprecated::char_regex_traits_i; +using boost::regbase; +using boost::reg_expression; +using boost::deprecated::reg_match; +//using boost::reg_match_base; +using boost::sub_match; +using boost::regex; +using boost::cmatch; +#ifndef BOOST_RE_NO_WCSTRING +using boost::wregex; +using boost::wcmatch; +#endif +using boost::deprecated::reg_match; +using boost::deprecated::query_match; +using boost::deprecated::reg_search; +using boost::deprecated::reg_grep; +using boost::deprecated::reg_format; +using boost::deprecated::reg_merge; +using boost::re_detail::jm_def_alloc; + +#endif + +#ifdef BOOST_RE_USING_HACK +using namespace boost; +using namespace boost::deprecated; +#endif + + + +#endif diff --git a/old_include/tests/snip1.cpp b/old_include/tests/snip1.cpp new file mode 100644 index 00000000..e45a9c6b --- /dev/null +++ b/old_include/tests/snip1.cpp @@ -0,0 +1,62 @@ +#include +#include +#include +#include + +using namespace std; + +regex expression("^([0-9]+)(\\-| |$)(.*)$"); + +// process_ftp: +// on success returns the ftp response code, and fills +// msg with the ftp response message. +int process_ftp(const char* response, std::string* msg) +{ + cmatch what; + if(query_match(response, response + strlen(response), what, expression)) + { + // what[0] contains the whole string + // what[1] contains the response code + // what[2] contains the separator character + // what[3] contains the text message. + if(msg) + msg->assign(what[3].first, what[3].second); + return atoi(what[1].first); + } + // failure did not match + if(msg) + msg->erase(); + return -1; +} + +int main() +{ + std::string in, out; + while(true) + { + cout << "enter test string" << endl; + std::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; +} + + + + + + diff --git a/old_include/tests/snip2.cpp b/old_include/tests/snip2.cpp new file mode 100644 index 00000000..4f24f3d3 --- /dev/null +++ b/old_include/tests/snip2.cpp @@ -0,0 +1,69 @@ +#include +#include +#include + +// purpose: +// takes the contents of a file in the form of a string +// and searches for all the C++ class definitions, storing +// their locations in a map of strings/int's + +typedef std::map > map_type; + +regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?(\\{|:[^;\\{()]*\\{)"); + +void IndexClasses(map_type& m, const std::string& file) +{ + std::string::const_iterator start, end; + start = file.begin(); + end = file.end(); + reg_match what; + unsigned int flags = match_default; + while(reg_search(start, end, what, expression, flags)) + { + // what[0] contains the whole string + // what[5] contains the class name. + // what[6] contains the template specialisation if any. + // add class name and position to map: + m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = + what[5].first - file.begin(); + // update search position: + start = what[0].second; + // update flags: + flags |= match_prev_avail; + flags |= ~match_not_bob; + } +} + + +#include +#include + +using namespace std; + +int main(int argc, const char** argv) +{ + for(int i = 1; i < argc; ++i) + { + cout << "Processing file " << argv[i] << endl; + map_type m; + mapfile f(argv[i]); + std::string text(f.begin(), f.end()); + IndexClasses(m, text); + cout << m.size() << " matches found" << endl; + map_type::iterator c, d; + c = m.begin(); + d = m.end(); + while(c != d) + { + cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; + ++c; + } + } + return 0; +} + + + + + + diff --git a/old_include/tests/snip3.cpp b/old_include/tests/snip3.cpp new file mode 100644 index 00000000..d8853e75 --- /dev/null +++ b/old_include/tests/snip3.cpp @@ -0,0 +1,70 @@ +#include +#include +#include + +// purpose: +// takes the contents of a file in the form of a string +// and searches for all the C++ class definitions, storing +// their locations in a map of strings/int's + +typedef std::map > map_type; + +regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?(\\{|:[^;\\{()]*\\{)"); + +class IndexClassesPred +{ + map_type& m; + std::string::const_iterator base; +public: + IndexClassesPred(map_type& a, std::string::const_iterator b) : m(a), base(b) {} + bool operator()(const reg_match& what) + { + // what[0] contains the whole string + // what[5] contains the class name. + // what[6] contains the template specialisation if any. + // add class name and position to map: + m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = + what[5].first - base; + return true; + } +}; + +void IndexClasses(map_type& m, const std::string& file) +{ + std::string::const_iterator start, end; + start = file.begin(); + end = file.end(); + reg_grep(IndexClassesPred(m, start), start, end, expression, match_default); +} + + +#include +#include + +using namespace std; + +int main(int argc, const char** argv) +{ + for(int i = 1; i < argc; ++i) + { + cout << "Processing file " << argv[i] << endl; + map_type m; + mapfile f(argv[i]); + std::string text(f.begin(), f.end()); + IndexClasses(m, text); + cout << m.size() << " matches found" << endl; + map_type::iterator c, d; + c = m.begin(); + d = m.end(); + while(c != d) + { + cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; + ++c; + } + } + return 0; +} + + + + diff --git a/old_include/tests/snip4.cpp b/old_include/tests/snip4.cpp new file mode 100644 index 00000000..abc78e00 --- /dev/null +++ b/old_include/tests/snip4.cpp @@ -0,0 +1,90 @@ +#include +#include +#include +#include +#include +#include +#include + +// purpose: +// takes the contents of a file and transform to +// syntax highlighted code in html format + +regex e1, e2; +extern const char* expression_text; +extern const char* format_string; +extern const char* pre_expression; +extern const char* pre_format; +extern const char* header_text; +extern const char* footer_text; + +int main(int argc, const char** argv) +{ + e1.set_expression(expression_text); + e2.set_expression(pre_expression); + for(int i = 1; i < argc; ++i) + { + std::cout << "Processing file " << argv[i] << std::endl; + mapfile in(argv[i]); + std::string out_name(std::string(argv[i]) + std::string(".htm")); + std::ofstream os(out_name.c_str()); + os << header_text; + // strip '<' and '>' first by outputting to a + // temporary string stream + std::ostringstream t(std::ios::out | std::ios::binary); + std::ostream_iterator oi(t); + reg_merge(oi, in.begin(), in.end(), e2, pre_format, true); + // then output to final output stream + // adding syntax highlighting: + std::string s(t.str()); + std::ostream_iterator out(os); + reg_merge(out, s.begin(), s.end(), e1, format_string, true); + os << footer_text; + } + return 0; +} + +extern const char* pre_expression = "(<)|(>)|\\r"; +extern const char* pre_format = "(?1<)(?2>)"; + + +const char* expression_text = // preprocessor directives: index 1 + "(^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*)|" + // comment: index 3 + "(//[^\\n]*|/\\*([^*]|\\*+[^*/])*\\*+/)|" + // literals: index 5 + "\\<([+-]?((0x[[:xdigit:]]+)|(([[:digit:]]*\\.)?[[:digit:]]+([eE][+-]?[[:digit:]]+)?))u?((int(8|16|32|64))|L)?)\\>|" + // string literals: index 14 + "('([^\\\\']|\\\\.)*'|\"([^\\\\\"]|\\\\.)*\")|" + // keywords: index 17 + "\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import" + "|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall" + "|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool" + "|break|case|catch|cdecl|char|class|const|const_cast|continue|default|delete" + "|do|double|dynamic_cast|else|enum|explicit|extern|false|float|for|friend|goto" + "|if|inline|int|long|mutable|namespace|new|operator|pascal|private|protected" + "|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast" + "|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned" + "|using|virtual|void|volatile|wchar_t|while)\\>" + ; + +const char* format_string = "(?1$&)" + "(?3$&)" + "(?5$&)" + "(?14$&)" + "(?17$&)"; + +const char* header_text = "\n\n" + "\n" + "\n" + "\n" + " \n
";
+
+const char* footer_text = "
\n\n\n"; + + + + + + + diff --git a/old_include/tests/snip5.cpp b/old_include/tests/snip5.cpp new file mode 100644 index 00000000..4fb12337 --- /dev/null +++ b/old_include/tests/snip5.cpp @@ -0,0 +1,36 @@ +#include +#include +#include + +// purpose: +// takes the contents of a file in the form of a string +// and searches for all the C++ class definitions, storing +// their locations in a map of strings/int's + +typedef std::map > map_type; + +regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?(\\{|:[^;\\{()]*\\{)"); +map_type class_index; +std::string::const_iterator base; + +bool grep_callback(const reg_match& what) +{ + // what[0] contains the whole string + // what[5] contains the class name. + // what[6] contains the template specialisation if any. + // add class name and position to map: + class_index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = + what[5].first - base; + return true; +} + +void IndexClasses(const std::string& file) +{ + std::string::const_iterator start, end; + start = file.begin(); + end = file.end(); + base = start; + reg_grep(grep_callback, start, end, expression, match_default); +} + + diff --git a/old_include/tests/snip6.cpp b/old_include/tests/snip6.cpp new file mode 100644 index 00000000..6a9c4a5d --- /dev/null +++ b/old_include/tests/snip6.cpp @@ -0,0 +1,85 @@ +#include +#include +#include +#include + +// purpose: +// takes the contents of a file in the form of a string +// and searches for all the C++ class definitions, storing +// their locations in a map of strings/int's + +typedef std::map > map_type; + +class class_index +{ + jm::regex expression; + map_type index; + std::string::const_iterator base; + + bool grep_callback(reg_match what); +public: + map_type& get_map() { return index; } + void IndexClasses(const std::string& file); + class_index() + : index(), + expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?" + "(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?" + "[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?" + "(\\{|:[^;\\{()]*\\{)" + ){} +}; + +bool class_index::grep_callback(reg_match what) +{ + // what[0] contains the whole string + // what[5] contains the class name. + // what[6] contains the template specialisation if any. + // add class name and position to map: + index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = + what[5].first - base; + return true; +} + +void class_index::IndexClasses(const std::string& file) +{ + std::string::const_iterator start, end; + start = file.begin(); + end = file.end(); + base = start; + reg_grep(std::bind1st(std::mem_fun(&class_index::grep_callback), this), + start, + end, + expression, + match_default); +} + + + +using namespace std; + +#include +#include + +int main(int argc, const char** argv) +{ + for(int i = 1; i < argc; ++i) + { + cout << "Processing file " << argv[i] << endl; + mapfile f(argv[i]); + std::string text(f.begin(), f.end()); + class_index i; + i.IndexClasses(text); + cout << i.get_map().size() << " matches found" << endl; + map_type::iterator c, d; + c = i.get_map().begin(); + d = i.get_map().end(); + while(c != d) + { + cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; + ++c; + } + } + return 0; +} + + diff --git a/old_include/tests/snip7.cpp b/old_include/tests/snip7.cpp new file mode 100644 index 00000000..d41e971d --- /dev/null +++ b/old_include/tests/snip7.cpp @@ -0,0 +1,87 @@ +#include +#include +#include +#include + +// purpose: +// takes the contents of a file in the form of a string +// and searches for all the C++ class definitions, storing +// their locations in a map of strings/int's + +typedef std::map > map_type; + +class class_index +{ + jm::regex expression; + map_type index; + std::string::const_iterator base; + typedef reg_match arg_type; + + bool grep_callback(const reg_match& what); +public: + map_type& get_map() { return index; } + typedef bool (__closure* grep_callback_type)(const arg_type&); + void IndexClasses(const std::string& file); + class_index() + : index(), + expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?" + "(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?" + "[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?" + "(\\{|:[^;\\{()]*\\{)" + ){} +}; + +bool class_index::grep_callback(const reg_match& what) +{ + // what[0] contains the whole string + // what[5] contains the class name. + // what[6] contains the template specialisation if any. + // add class name and position to map: + index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = + what[5].first - base; + return true; +} + +void class_index::IndexClasses(const std::string& file) +{ + std::string::const_iterator start, end; + start = file.begin(); + end = file.end(); + base = start; + class_index::grep_callback_type cl = &(this->grep_callback); + reg_grep(cl, + start, + end, + expression, + match_default); +} + + +using namespace std; + +#include +#include + +int main(int argc, const char** argv) +{ + for(int i = 1; i < argc; ++i) + { + cout << "Processing file " << argv[i] << endl; + mapfile f(argv[i]); + std::string text(f.begin(), f.end()); + class_index i; + i.IndexClasses(text); + cout << i.get_map().size() << " matches found" << endl; + map_type::iterator c, d; + c = i.get_map().begin(); + d = i.get_map().end(); + while(c != d) + { + cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; + ++c; + } + } + return 0; +} + + diff --git a/posix_ref.htm b/posix_ref.htm new file mode 100644 index 00000000..04a370d4 --- /dev/null +++ b/posix_ref.htm @@ -0,0 +1,277 @@ + + + + + + + + +Regex++, POSIX API Reference + + + +  + + + + +

+C++ Boost

+
+

Regex++, POSIX API Reference.

+
+
+(version 3.01, 18 April 2000) +
+
Copyright (c) 1998-2000
+Dr John Maddock
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Dr John Maddock makes no representations
+about the suitability of this software for any purpose.  
+It is provided "as is" without express or implied warranty.
+ +
+
+

POSIX compatibility library

+
#include <boost/cregex.hpp>
+or:
+#include <boost/regex.h>
+ +

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

+

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

+

The functions are defined as:

+
extern "C" {
+int regcompA(regex_tA*, const char*, int);
+unsigned int regerrorA(int, const regex_tA*, char*, unsigned int);
+int regexecA(const regex_tA*, const char*, unsigned int, regmatch_t*, int);
+void regfreeA(regex_tA*);
+
+int regcompW(regex_tW*, const wchar_t*, int);
+unsigned int regerrorW(int, const regex_tW*, wchar_t*, unsigned int);
+int regexecW(const regex_tW*, const wchar_t*, unsigned int, regmatch_t*, int);
+void regfreeW(regex_tW*);
+
+#ifdef UNICODE
+#define regcomp regcompW
+#define regerror regerrorW
+#define regexec regexecW
+#define regfree regfreeW
+#define regex_t regex_tW
+#else
+#define regcomp regcompA
+#define regerror regerrorA
+#define regexec regexecA
+#define regfree regfreeA
+#define regex_t regex_tA
+#endif
+}
+All the functions operate on structure regex_t, which exposes two public +members: +

unsigned int re_nsub this is filled in by regcomp and +indicates the number of sub-expressions contained in the regular expression. +

+

const TCHAR* re_endp points to the end of the expression to compile +when the flag REG_PEND is set.

+

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

+

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

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 REG_EXTENDEDCompiles modern regular expressions. Equivalent to +regbase::char_classes | regbase::intervals | regbase::bk_refs. 
 REG_BASICCompiles basic (obsolete) regular expression +syntax. Equivalent to regbase::char_classes | regbase::intervals | +regbase::limited_ops | regbase::bk_braces | regbase::bk_parens | +regbase::bk_refs. 
 REG_NOSPECAll characters are ordinary, the expression is a +literal string. 
 REG_ICASECompiles for matching that ignores character +case. 
 REG_NOSUBHas no effect in this library. 
 REG_NEWLINEWhen this flag is set a dot does not match the +newline character. 
 REG_PENDWhen this flag is set the re_endp parameter of the +regex_t structure must point to the end of the regular expression to +compile. 
 REG_NOCOLLATEWhen this flag is set then locale dependent +collation for character ranges is turned off. 
 REG_ESCAPE_IN_LISTS
+, , ,
When this flag is set, then escape sequences are +permitted in bracket expressions (character sets). 
 REG_NEWLINE_ALT When this flag is set then the newline character +is equivalent to the alternation operator |. 
 REG_PERL  A shortcut for perl-like behavior: +REG_EXTENDED | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS 
 REG_AWKA shortcut for awk-like behavior: REG_EXTENDED | +REG_ESCAPE_IN_LISTS 
 REG_GREPA shortcut for grep like behavior: REG_BASIC | +REG_NEWLINE_ALT 
 REG_EGREP A shortcut for egrep like behavior: +REG_EXTENDED | REG_NEWLINE_ALT 
+

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

+ + + + + + + + + + + + + + + + + + + + + + + + + +
 int codeThe error code. 
 const regex_t* eThe regular expression (can be null). 
 char* bufThe buffer to fill in with the error message. 
 unsigned int buf_sizeThe length of buf. 
+

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

+

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

+ + + + + + + + + + + + + + + + + + + +
 REG_NOTBOLParameter buf does not represent the start +of a line. 
 REG_NOTEOLParameter buf does not terminate at the end +of a line. 
 REG_STARTENDThe string searched starts at buf + +pmatch[0].rm_so and ends at buf + pmatch[0].rm_eo. 
+

Finally regfree frees all the memory that was allocated by +regcomp.

+

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

+
+

Copyright Dr John +Maddock 1998-2000 all rights reserved.

+ + + diff --git a/readme.txt b/readme.txt new file mode 100644 index 00000000..a3cfefd8 --- /dev/null +++ b/readme.txt @@ -0,0 +1,24 @@ +Copyright (c) 1998-2000 +Dr John Maddock + +Permission to use, copy, modify, distribute and sell this software +and its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and +that both that copyright notice and this permission notice appear +in supporting documentation. Dr John Maddock makes no representations +about the suitability of this software for any purpose. +It is provided "as is" without express or implied warranty. + +************************************************************************ + +Full instructions for use of this library can be accessed from +libs/regex/index.htm + +Installation instructions and library overview is are in +libs/regex/introduction.htm + +This library is part of boost (see www.boost.org), the latest version +of the library is available from the boost web site, or development +snapshots from the boost cvs repository at +http://sourceforge.net/project/?group_id=7586 + diff --git a/src/c_regex_traits.cpp b/src/c_regex_traits.cpp new file mode 100644 index 00000000..cebf0b7a --- /dev/null +++ b/src/c_regex_traits.cpp @@ -0,0 +1,1022 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE c_regex_traits.cpp + * VERSION 3.01 + * DESCRIPTION: Implements the c_regex_traits traits class + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "primary_transform.hpp" + + +#ifndef BOOST_RE_NO_CAT +#include +#endif + +#if defined(BOOST_MSVC) +namespace std{ + using ::setlocale; + using ::wcstombs; + using ::mbstowcs; +} +#endif + +namespace{ + +// +// character classes: +// +jm_uintfast32_t re_char_class_id[] = { + boost::re_detail::c_traits_base::char_class_alnum, + boost::re_detail::c_traits_base::char_class_alpha, + boost::re_detail::c_traits_base::char_class_cntrl, + boost::re_detail::c_traits_base::char_class_digit, + boost::re_detail::c_traits_base::char_class_graph, + boost::re_detail::c_traits_base::char_class_lower, + boost::re_detail::c_traits_base::char_class_print, + boost::re_detail::c_traits_base::char_class_punct, + boost::re_detail::c_traits_base::char_class_space, + boost::re_detail::c_traits_base::char_class_upper, + boost::re_detail::c_traits_base::char_class_xdigit, + boost::re_detail::c_traits_base::char_class_blank, + boost::re_detail::c_traits_base::char_class_word, + boost::re_detail::c_traits_base::char_class_unicode, +}; + +const char* re_char_class_names[] = { +"alnum", +"alpha", +"cntrl", +"digit", +"graph", +"lower", +"print", +"punct", +"space", +"upper", +"xdigit", +"blank", +"word", +"unicode", +}; + +std::string* re_cls_name; +std::string* pclasses; +unsigned int classes_count = 0; +const unsigned int re_classes_max = 14; + +// +// collate names: + +struct collate_name_t +{ + std::string name; + std::string value; + collate_name_t(){} + collate_name_t(const char* p1, const char* p2, const char* p3, const char* p4) + : name(p1, p2), value(p3, p4) {} +}; + +std::string* re_coll_name; +std::list* pcoll_names; +unsigned int collate_count = 0; + +// +// message handling: +#ifndef BOOST_RE_MESSAGE_BASE +#define BOOST_RE_MESSAGE_BASE 0 +#endif + +#if !defined(BOOST_RE_NO_CAT) +nl_catd message_cat = (nl_catd)-1; +#endif + +unsigned int message_count = 0; +std::string* mess_locale; + +BOOST_RE_IX_DECL char* re_custom_error_messages[] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +}; + +#if !defined(LC_MESSAGES) && defined(BOOST_RE_NO_CAT) +#define LC_MESSAGES LC_CTYPE +#endif + +char re_zero; +char re_ten; + +unsigned int entry_count = 0; + +std::string* ctype_name; +std::string* collate_name; +enum syntax_map_size +{ + map_size = UCHAR_MAX + 1 +}; + +#ifndef BOOST_RE_NO_WCSTRING + +BOOST_RE_IX_DECL wchar_t re_zero_w; +BOOST_RE_IX_DECL wchar_t re_ten_w; + +unsigned int nlsw_count = 0; +std::string* wlocale_name = 0; + +struct syntax_map_t +{ + wchar_t c; + unsigned int type; +}; + +std::list* syntax; + +#endif + + +unsigned int BOOST_RE_CALL _re_get_message(char* buf, unsigned int len, unsigned int id); + +template +unsigned int BOOST_RE_CALL re_get_message(charT* buf, unsigned int len, unsigned int id) +{ + unsigned int size = _re_get_message((char*)0, 0, id); + if(len < size) + return size; + boost::scoped_array cb(new char[size]); + _re_get_message(cb.get(), size, id); + size = boost::c_regex_traits::strwiden(buf, len, cb.get()); + return size; +} + +inline unsigned int BOOST_RE_CALL re_get_message(char* buf, unsigned int len, unsigned int id) +{ + return _re_get_message(buf, len, id); +} + +void BOOST_RE_CALL re_init_classes() +{ + BOOST_RE_GUARD_STACK + if(classes_count == 0) + { + re_cls_name = new std::string("xxxxxxxx"); + try{ + pclasses = new std::string[re_classes_max]; + } + catch(...) + { + delete re_cls_name; + throw; + } + } + ++classes_count; +} + +void BOOST_RE_CALL re_free_classes() +{ + BOOST_RE_GUARD_STACK + if(--classes_count == 0) + { + delete re_cls_name; + delete[] pclasses; + } +} + +void BOOST_RE_CALL re_update_classes() +{ + BOOST_RE_GUARD_STACK + if(*re_cls_name != std::setlocale(LC_CTYPE, NULL)) + { + *re_cls_name = std::setlocale(LC_CTYPE, NULL); + char buf[256]; + unsigned int i; + for(i = 0; i < re_classes_max; ++i) + { + re_get_message(buf, 256, i+300); + pclasses[i] = buf; + } + } +} + +void BOOST_RE_CALL re_init_collate() +{ + BOOST_RE_GUARD_STACK + if(collate_count == 0) + { + re_coll_name = new std::string("xxxxxxxx"); + try{ + pcoll_names = new std::list(); + } + catch(...) + { + delete re_coll_name; + throw; + } + } + ++collate_count; +} + +void BOOST_RE_CALL re_free_collate() +{ + BOOST_RE_GUARD_STACK + if(--collate_count == 0) + { + delete re_coll_name; + delete pcoll_names; + } +} + +void BOOST_RE_CALL re_update_collate() +{ + BOOST_RE_GUARD_STACK + if(*re_coll_name != std::setlocale(LC_COLLATE, NULL)) + { + *re_coll_name = std::setlocale(LC_COLLATE, NULL); + char buf[256]; + unsigned int i = 400; + re_get_message(buf, 256, i); + while(*buf) + { + char* p1, *p2, *p3, *p4;; + p1 = buf; + while(*p1 && isspace(*p1))++p1; + p2 = p1; + while(*p2 && !isspace(*p2))++p2; + p3 = p2; + while(*p3 && isspace(*p3))++p3; + p4 = p3; + while(*p4 && !isspace(*p4))++p4; + pcoll_names->push_back(collate_name_t(p1, p2, p3, p4)); + ++i; + re_get_message(buf, 256, i); + } + } +} + +unsigned int BOOST_RE_CALL _re_get_message(char* buf, unsigned int len, unsigned int id) +{ + BOOST_RE_GUARD_STACK + // get the customised message if any: + #if !defined(BOOST_RE_NO_CAT) + if(message_cat != (nl_catd)-1) + { + const char* m = catgets(message_cat, 0, id, NULL); + if(m) + { + unsigned int size = std::strlen(m) + 1; + if(size > len) + return size; + std::strcpy(buf, m); + return size; + } + } + #endif + + // + // now get the default message if any: + return boost::re_detail::re_get_default_message(buf, len, id); +} + +void BOOST_RE_CALL re_message_init() +{ + BOOST_RE_GUARD_STACK + if(message_count == 0) + { + mess_locale = new std::string("xxxxxxxxxxxxxxxx"); + } + ++message_count; +} + +void BOOST_RE_CALL re_message_update() +{ + BOOST_RE_GUARD_STACK + // + // called whenever the global locale changes: + // + std::string l(std::setlocale(LC_MESSAGES, NULL)); + if(*mess_locale != l) + { + *mess_locale = l; +#if !defined(BOOST_RE_NO_CAT) + if(message_cat != (nl_catd)-1) + { + catclose(message_cat); + 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); +#endif + for(int i = 0; i < boost::REG_E_UNKNOWN; ++i) + { + if(re_custom_error_messages[i]) + { + boost::re_detail::re_strfree(re_custom_error_messages[i]); + re_custom_error_messages[i] = 0; + } + } + } +} + +void BOOST_RE_CALL re_message_free() +{ + BOOST_RE_GUARD_STACK + --message_count; + if(message_count == 0) + { +#if !defined(BOOST_RE_NO_CAT) + if(message_cat != (nl_catd)-1) + catclose(message_cat); +#endif + delete mess_locale; + for(int i = 0; i < boost::REG_E_UNKNOWN; ++i) + { + if(re_custom_error_messages[i]) + { + boost::re_detail::re_strfree(re_custom_error_messages[i]); + re_custom_error_messages[i] = 0; + } + } + } +} + + +const char* BOOST_RE_CALL re_get_error_str(unsigned int id) +{ + BOOST_RE_GUARD_STACK +#ifdef BOOST_RE_THREADS + boost::re_detail::cs_guard g(*boost::re_detail::p_re_lock); +#endif + if(re_custom_error_messages[id] == 0) + { + char buf[256]; + _re_get_message(buf, 256, id + 200); + if(*buf) + { + re_custom_error_messages[id] = boost::re_detail::re_strdup(buf); + return re_custom_error_messages[id]; + } + return boost::re_detail::re_default_error_messages[id]; + } + return re_custom_error_messages[id]; +} + +} // namespace + +namespace boost{ +namespace re_detail{ + +char c_traits_base::regex_message_catalogue[200] = {0}; + +std::string c_traits_base::error_string(unsigned id) +{ + return re_get_error_str(id); +} + +void BOOST_RE_CALL c_traits_base::do_update_collate() +{ + BOOST_RE_GUARD_STACK + re_update_collate(); + std::string s; + const char* p = "zero"; + if(c_regex_traits::lookup_collatename(s, p, p+4)) + { + jm_assert(s.size() == 1); + re_zero = *s.c_str(); + } + else + re_zero = '0'; + + p = "ten"; + if(c_regex_traits::lookup_collatename(s, p, p+3)) + { + jm_assert(s.size() == 1); + re_ten = *s.c_str(); + } + else + re_ten = 'a'; +} + +void BOOST_RE_CALL c_traits_base::do_update_ctype() +{ + BOOST_RE_GUARD_STACK + // start by updating the syntax map: + unsigned int i; + char buf[map_size+2]; + std::memset(syntax_map, syntax_char, map_size); + for(i = 1; i < syntax_max; ++i) + { + char* ptr = buf; + re_get_message((char*)buf, map_size, i+100); + for(; *ptr; ++ptr) + { + syntax_map[(unsigned char)*ptr] = (unsigned char)i; + } + } + + // now update the character class map, + // and lower case map: + std::memset(class_map, 0, map_size); + for(i = 0; i < map_size; ++i) + { + if(std::isalpha((char)i)) + class_map[i] |= char_class_alpha; + if(std::iscntrl((char)i)) + class_map[i] |= char_class_cntrl; + if(std::isdigit((char)i)) + class_map[i] |= char_class_digit; + if(std::islower((char)i)) + class_map[i] |= char_class_lower; + if(std::isupper((char)i)) + class_map[i] |= char_class_upper; + if(std::ispunct((char)i)) + class_map[i] |= char_class_punct; + if(std::isspace((char)i)) + class_map[i] |= char_class_space; + if(std::isxdigit((char)i)) + class_map[i] |= char_class_xdigit; + } + class_map['_'] |= char_class_underscore; + class_map[' '] |= char_class_blank; + class_map['\t'] |= char_class_blank; + for(i = 0; i < map_size; ++i) + { + lower_case_map[i] = (char)std::tolower(i); + } + re_update_classes(); +} + +jm_uintfast32_t BOOST_RE_CALL c_traits_base::do_lookup_class(const char* p) +{ + BOOST_RE_GUARD_STACK + unsigned int i; + for(i = 0; i < re_classes_max; ++i) + { + if(pclasses[i] == p) + { + return re_char_class_id[i]; + } + } + for(i = 0; i < re_classes_max; ++i) + { + if(std::strcmp(re_char_class_names[i], p) == 0) + { + return re_char_class_id[i]; + } + } + return 0; +} + +bool BOOST_RE_CALL c_traits_base::do_lookup_collate(std::string& buf, const char* p) +{ + BOOST_RE_GUARD_STACK + std::list::iterator first, last; + first = pcoll_names->begin(); + last = pcoll_names->end(); + while(first != last) + { + if((*first).name == p) + { + buf = (*first).value; + return true; + } + ++first; + } + + bool result = re_detail::re_lookup_def_collate_name(buf, p); + if((result == 0) && (std::strlen(p) == 1)) + { + result = true; + buf = *p; + } + return result; +} + +std::string c_traits_base::set_message_catalogue(const std::string& l) +{ + if(sizeof(regex_message_catalogue) <= l.size()) + return l; + std::string old(regex_message_catalogue); + std::strcpy(regex_message_catalogue, l.c_str()); + return old; +} + +unsigned char c_traits_base::syntax_map[map_size]; +unsigned short c_traits_base::class_map[map_size]; +char c_traits_base::lower_case_map[map_size]; + +} // namespace re_detail + +#ifndef BOOST_RE_NO_WCSTRING +bool BOOST_RE_CALL c_regex_traits::lookup_collatename(std::basic_string& out, const wchar_t* first, const wchar_t* last) +{ + BOOST_RE_GUARD_STACK + std::basic_string s(first, last); + unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + scoped_array buf(new char[len]); + strnarrow(buf.get(), len, s.c_str()); + std::string t_out; + bool result = re_detail::c_traits_base::do_lookup_collate(t_out, buf.get()); + if(t_out.size() == 0) result = false; + if(result) + { + if(t_out[0]) + { + len = strwiden((wchar_t*)0, 0, t_out.c_str()); + scoped_array wb(new wchar_t[len]); + strwiden(wb.get(), len, t_out.c_str()); + out = wb.get(); + } + else + out.append(1, (wchar_t)0); + } + return result; +} +#endif + +c_regex_traits c_regex_traits::i; + +void c_regex_traits::init() +{ + BOOST_RE_GUARD_STACK +#ifdef BOOST_RE_THREADS + re_detail::re_init_threads(); + re_detail::cs_guard g(*re_detail::p_re_lock); +#endif + // just keep track of entry_count + if(entry_count == 0) + { + ctype_name = new std::string("xxxxxxxxxxxxxxxx"); + try{ + collate_name = new std::string("xxxxxxxxxxxxxxxx"); + } + catch(...) + { + delete ctype_name; + throw; + } + } + re_message_init(); + re_init_classes(); + re_init_collate(); + ++entry_count; +} + +void c_regex_traits::update() +{ + BOOST_RE_GUARD_STACK + #ifdef BOOST_RE_THREADS + re_detail::cs_guard g(*re_detail::p_re_lock); + #endif + re_message_update(); + if(*collate_name != std::setlocale(LC_COLLATE, NULL)) + { + do_update_collate(); + *collate_name = std::setlocale(LC_COLLATE, NULL); + } + if(*ctype_name != std::setlocale(LC_CTYPE, NULL)) + { + do_update_ctype(); + *ctype_name = std::setlocale(LC_CTYPE, NULL); + } + sort_type = re_detail::find_sort_syntax(&i, &sort_delim); +} + +void c_regex_traits::free() +{ + BOOST_RE_GUARD_STACK + #ifdef BOOST_RE_THREADS + re_detail::cs_guard g(*re_detail::p_re_lock); + #endif + re_message_free(); + re_free_classes(); + re_free_collate(); + --entry_count; + if(entry_count == 0) + { + delete ctype_name; + delete collate_name; + } +#ifdef BOOST_RE_THREADS + g.acquire(false); + re_detail::re_free_threads(); +#endif +} + +void BOOST_RE_CALL c_regex_traits::transform(std::string& out, const std::string& in) +{ + BOOST_RE_GUARD_STACK + size_t n = strxfrm(0, in.c_str(), 0); + if(n == (size_t)(-1)) + { + out = in; + return; + } + scoped_array buf(new char[n+1]); + n = strxfrm(buf.get(), in.c_str(), n+1); + if(n == (size_t)(-1)) + { + out = in; + return; + } + out = buf.get(); +} + +void BOOST_RE_CALL c_regex_traits::transform_primary(std::string& out, const std::string& in) +{ + transform(out, in); + switch(sort_type) + { + case re_detail::sort_C: + case re_detail::sort_unknown: + break; + case re_detail::sort_fixed: + out.erase((int)sort_delim); + break; + case re_detail::sort_delim: + for(unsigned int i = 0; i < out.size(); ++i) + { + if((out[i] == sort_delim) && (i+1 < out.size())) + { + out.erase(i+1); + break; + } + } + } +} + +unsigned c_regex_traits::sort_type; +char c_regex_traits::sort_delim; + + +int BOOST_RE_CALL c_regex_traits::toi(char c) +{ + if(is_class(c, char_class_digit)) + return c - re_zero; + if(is_class(c, char_class_xdigit)) + return 10 + translate(c, true) - translate(re_ten, true); + return -1; // error!! +} + +int BOOST_RE_CALL c_regex_traits::toi(const char*& first, const char* last, int radix) +{ + unsigned int maxval; + if(radix < 0) + { + // if radix is less than zero, then restrict + // return value to charT. NB assumes sizeof(charT) <= sizeof(int) + radix *= -1; + maxval = 1 << (sizeof(*first) * CHAR_BIT - 1); + maxval /= radix; + maxval *= 2; + maxval -= 1; + } + else + { + maxval = (unsigned int)-1; + maxval /= radix; + } + + unsigned int result = 0; + unsigned int type = (radix > 10) ? char_class_xdigit : char_class_digit; + while((first != last) && is_class(*first, type) && (result <= maxval)) + { + result *= radix; + result += toi(*first); + ++first; + } + return result; +} + +#ifndef BOOST_RE_NO_WCSTRING + +unsigned int BOOST_RE_CALL c_regex_traits::syntax_type(size_type c) +{ + BOOST_RE_GUARD_STACK + std::list::const_iterator first, last; + first = syntax->begin(); + last = syntax->end(); + while(first != last) + { + if((uchar_type)(*first).c == c) + return (*first).type; + ++first; + } + return 0; +} + +void BOOST_RE_CALL c_regex_traits::init() +{ + BOOST_RE_GUARD_STACK + re_detail::re_init_threads(); +#ifdef BOOST_RE_THREADS + re_detail::cs_guard g(*re_detail::p_re_lock); +#endif + re_message_init(); + re_init_classes(); + re_init_collate(); + if(nlsw_count == 0) + { + wlocale_name = new std::string("xxxxxxxxxxxxxxxx"); + try{ + syntax = new std::list(); + } + catch(...) + { + delete wlocale_name; + throw; + } + } + ++nlsw_count; +} + +bool BOOST_RE_CALL c_regex_traits::do_lookup_collate(std::basic_string& out, const wchar_t* first, const wchar_t* last) +{ + BOOST_RE_GUARD_STACK + std::basic_string s(first, last); + unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + scoped_array buf(new char[len]); + strnarrow(buf.get(), len, s.c_str()); + std::string t_out; + bool result = re_detail::c_traits_base::do_lookup_collate(t_out, buf.get()); + if(result) + { + len = strwiden((wchar_t*)0, 0, t_out.c_str()); + scoped_array wb(new wchar_t[len]); + strwiden(wb.get(), len, t_out.c_str()); + out = wb.get(); + } + return result; +} + + +void BOOST_RE_CALL c_regex_traits::update() +{ + BOOST_RE_GUARD_STACK +#ifdef BOOST_RE_THREADS + re_detail::cs_guard g(*re_detail::p_re_lock); +#endif + re_message_update(); + re_update_classes(); + re_update_collate(); + std::string l(std::setlocale(LC_CTYPE, NULL)); + if(*wlocale_name != l) + { + *wlocale_name = l; + std::basic_string s; + const wchar_t* p = L"zero"; + if(do_lookup_collate(s, p, p+4)) + { + jm_assert(s.size() == 1); + re_zero_w = *s.c_str(); + } + else + re_zero_w = L'0'; + + p = L"ten"; + if(do_lookup_collate(s, p, p+3)) + { + jm_assert(s.size() == 1); + re_ten_w = *s.c_str(); + } + else + re_ten_w = L'a'; + + unsigned int i; + wchar_t buf[256]; + syntax_map_t sm; + syntax->clear(); + for(i = 1; i < syntax_max; ++i) + { + wchar_t* ptr = buf; + re_get_message((wchar_t*)buf, 256, i+100); + for(; *ptr; ++ptr) + { + sm.c = *ptr; + sm.type = i; + syntax->push_back(sm); + } + } + sort_type = re_detail::find_sort_syntax(&init_, &sort_delim); + } +} + +void BOOST_RE_CALL c_regex_traits::free() +{ + BOOST_RE_GUARD_STACK +#ifdef BOOST_RE_THREADS + re_detail::cs_guard g(*re_detail::p_re_lock); +#endif + --nlsw_count; + re_message_free(); + re_free_classes(); + re_free_collate(); + if(nlsw_count == 0) + { + // cleanup: + delete wlocale_name; + delete syntax; + } +#ifdef BOOST_RE_THREADS + g.acquire(false); + re_detail::re_free_threads(); +#endif +} + +bool BOOST_RE_CALL c_regex_traits::do_iswclass(wchar_t c, jm_uintfast32_t f) +{ + BOOST_RE_GUARD_STACK + if(c < 256) + return BOOST_RE_MAKE_BOOL(re_detail::wide_unicode_classes[c] & f); + if((f & char_class_alpha) && std::iswalpha(c)) + return true; + if((f & char_class_cntrl) && std::iswcntrl(c)) + return true; + if((f & char_class_digit) && std::iswdigit(c)) + return true; + if((f & char_class_lower) && std::iswlower(c)) + return true; + if((f & char_class_punct) && std::iswpunct(c)) + return true; + if((f & char_class_space) && std::iswspace(c)) + return true; + if((f & char_class_upper) && std::iswupper(c)) + return true; + if((f & char_class_xdigit) && std::iswxdigit(c)) + return true; + if(f & char_class_unicode) + return true; + return false; +} + +void BOOST_RE_CALL c_regex_traits::transform(std::basic_string& out, const std::basic_string& in) +{ + BOOST_RE_GUARD_STACK +#ifndef BOOST_MSVC + size_t n = std::wcsxfrm(0, in.c_str(), 0); +#else + // broken wcsxfrm under VC6 doesn't check size of + // output buffer, we have no choice but to guess! + size_t n = 100 * in.size(); +#endif + if((n == (size_t)(-1)) || (n == 0)) + { + out = in; + return; + } + scoped_array buf(new wchar_t[n+1]); + n = std::wcsxfrm(buf.get(), in.c_str(), n+1); + if(n == (size_t)(-1)) + { + out = in; + return; + } + out = buf.get(); +} + +void BOOST_RE_CALL c_regex_traits::transform_primary(std::basic_string& out, const std::basic_string& in) +{ + transform(out, in); + switch(sort_type) + { + case re_detail::sort_C: + case re_detail::sort_unknown: + break; + case re_detail::sort_fixed: + if((unsigned)sort_delim < out.size()) + out.erase((int)sort_delim); + break; + case re_detail::sort_delim: + for(unsigned int i = 0; i < out.size(); ++i) + { + if((out[i] == sort_delim) && (i+1 < out.size())) + { + out.erase(i+1); + break; + } + } + } +} + +unsigned c_regex_traits::sort_type; +wchar_t c_regex_traits::sort_delim; + + +int BOOST_RE_CALL c_regex_traits::toi(wchar_t c) +{ + if(is_class(c, char_class_digit)) + return c - re_zero_w; + if(is_class(c, char_class_xdigit)) + return 10 + translate(c, true) - translate(re_ten_w, true); + return -1; // error!! +} + +int BOOST_RE_CALL c_regex_traits::toi(const wchar_t*& first, const wchar_t* last, int radix) +{ + unsigned int maxval; + if(radix < 0) + { + // if radix is less than zero, then restrict + // return value to charT. NB assumes sizeof(charT) <= sizeof(int) + radix *= -1; + maxval = 1 << (sizeof(*first) * CHAR_BIT - 1); + maxval /= radix; + maxval *= 2; + maxval -= 1; + } + else + { + maxval = (unsigned int)-1; + maxval /= radix; + } + + unsigned int result = 0; + unsigned int type = (radix > 10) ? char_class_xdigit : char_class_digit; + while((first != last) && is_class(*first, type) && (result <= maxval)) + { + result *= radix; + result += toi(*first); + ++first; + } + return result; +} + +jm_uintfast32_t BOOST_RE_CALL c_regex_traits::lookup_classname(const wchar_t* first, const wchar_t* last) +{ + std::basic_string s(first, last); + unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + scoped_array buf(new char[len]); + strnarrow(buf.get(), len, s.c_str()); + len = do_lookup_class(buf.get()); + return len; +} + +c_regex_traits c_regex_traits::init_; + +unsigned int BOOST_RE_CALL c_regex_traits::strnarrow(char *s1, unsigned int len, const wchar_t *s2) +{ + BOOST_RE_GUARD_STACK + unsigned int size = wcslen(s2) + 1; + if(size > len) + return size; + return std::wcstombs(s1, s2, len); +} + +unsigned int BOOST_RE_CALL c_regex_traits::strwiden(wchar_t *s1, unsigned int len, const char *s2) +{ + BOOST_RE_GUARD_STACK + unsigned int size = strlen(s2) + 1; + if(size > len) + return size; + size = std::mbstowcs(s1, s2, len); + s1[size] = 0; + return size + 1; +} + +#endif // BOOST_RE_NO_WCSTRING + + +} // namespace boost diff --git a/src/c_regex_traits_common.cpp b/src/c_regex_traits_common.cpp new file mode 100644 index 00000000..9f70e020 --- /dev/null +++ b/src/c_regex_traits_common.cpp @@ -0,0 +1,550 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE: c_regex_traits_common.cpp + * VERSION: 3.00 + * DESCRIPTION: Implements common code and data for the + * c_regex_traits traits classes. + */ + + +#include +#include +#include +#include +#include +#include + + +namespace boost{ + namespace re_detail{ + +// +// these are the POSIX collating names: +// +BOOST_RE_IX_DECL const char* def_coll_names[] = { +"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "alert", "backspace", "tab", "newline", +"vertical-tab", "form-feed", "carriage-return", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", +"SYN", "ETB", "CAN", "EM", "SUB", "ESC", "IS4", "IS3", "IS2", "IS1", "space", "exclamation-mark", +"quotation-mark", "number-sign", "dollar-sign", "percent-sign", "ampersand", "apostrophe", +"left-parenthesis", "right-parenthesis", "asterisk", "plus-sign", "comma", "hyphen", +"period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", +"colon", "semicolon", "less-than-sign", "equals-sign", "greater-than-sign", +"question-mark", "commercial-at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", +"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "left-square-bracket", "backslash", +"right-square-bracket", "circumflex", "underscore", "grave-accent", "a", "b", "c", "d", "e", "f", +"g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "left-curly-bracket", +"vertical-line", "right-curly-bracket", "tilde", "DEL", "", +}; + +// these multi-character collating elements +// should keep most Western-European locales +// happy - we should really localise these a +// little more - but this will have to do for +// now: + +BOOST_RE_IX_DECL const char* def_multi_coll[] = { + "ae", + "Ae", + "AE", + "ch", + "Ch", + "CH", + "ll", + "Ll", + "LL", + "ss", + "Ss", + "SS", + "nj", + "Nj", + "NJ", + "dz", + "Dz", + "DZ", + "lj", + "Lj", + "LJ", + "", +}; + + + +BOOST_RE_IX_DECL bool BOOST_RE_CALL re_lookup_def_collate_name(std::string& buf, const char* name) +{ + BOOST_RE_GUARD_STACK + unsigned int i = 0; + while(*def_coll_names[i]) + { + if(std::strcmp(def_coll_names[i], name) == 0) + { + buf = (char)i; + return true; + } + ++i; + } + i = 0; + while(*def_multi_coll[i]) + { + if(std::strcmp(def_multi_coll[i], name) == 0) + { + buf = def_multi_coll[i]; + return true; + } + ++i; + } + return false; +} + +// +// messages: +BOOST_RE_IX_DECL const char * re_default_error_messages[] = +{ "Success", /* REG_NOERROR */ + "No match", /* REG_NOMATCH */ + "Invalid regular expression", /* REG_BADPAT */ + "Invalid collation character", /* REG_ECOLLATE */ + "Invalid character class name", /* REG_ECTYPE */ + "Trailing backslash", /* REG_EESCAPE */ + "Invalid back reference", /* REG_ESUBREG */ + "Unmatched [ or [^", /* REG_EBRACK */ + "Unmatched ( or \\(", /* REG_EPAREN */ + "Unmatched \\{", /* REG_EBRACE */ + "Invalid content of \\{\\}", /* REG_BADBR */ + "Invalid range end", /* REG_ERANGE */ + "Memory exhausted", /* REG_ESPACE */ + "Invalid preceding regular expression", /* REG_BADRPT */ + "Premature end of regular expression", /* REG_EEND */ + "Regular expression too big", /* REG_ESIZE */ + "Unmatched ) or \\)", /* REG_ERPAREN */ + "Empty expression", /* REG_EMPTY */ + "Unknown error", /* REG_E_UNKNOWN */ + "", + "", + "", +}; + +const mss default_messages[] = { + { 100+ c_regex_traits::syntax_open_bracket, "(", }, + { 100+ c_regex_traits::syntax_close_bracket, ")", }, + { 100+ c_regex_traits::syntax_dollar, "$", }, + { 100+ c_regex_traits::syntax_caret, "^", }, + { 100+ c_regex_traits::syntax_dot, ".", }, + { 100+ c_regex_traits::syntax_star, "*", }, + { 100+ c_regex_traits::syntax_plus, "+", }, + { 100+ c_regex_traits::syntax_question, "?", }, + { 100+ c_regex_traits::syntax_open_set, "[", }, + { 100+ c_regex_traits::syntax_close_set, "]", }, + { 100+ c_regex_traits::syntax_or, "|", }, + { 100+ c_regex_traits::syntax_slash, "\\", }, + { 100+ c_regex_traits::syntax_hash, "#", }, + { 100+ c_regex_traits::syntax_dash, "-", }, + { 100+ c_regex_traits::syntax_open_brace, "{", }, + { 100+ c_regex_traits::syntax_close_brace, "}", }, + { 100+ c_regex_traits::syntax_digit, "0123456789", }, + { 100+ c_regex_traits::syntax_b, "b", }, + { 100+ c_regex_traits::syntax_B, "B", }, + { 100+ c_regex_traits::syntax_left_word, "<", }, + { 100+ c_regex_traits::syntax_right_word, ">", }, + { 100+ c_regex_traits::syntax_w, "w", }, + { 100+ c_regex_traits::syntax_W, "W", }, + { 100+ c_regex_traits::syntax_start_buffer, "`A", }, + { 100+ c_regex_traits::syntax_end_buffer, "'z", }, + { 100+ c_regex_traits::syntax_newline, "\n", }, + { 100+ c_regex_traits::syntax_comma, ",", }, + { 100+ c_regex_traits::syntax_a, "a", }, + { 100+ c_regex_traits::syntax_f, "f", }, + { 100+ c_regex_traits::syntax_n, "n", }, + { 100+ c_regex_traits::syntax_r, "r", }, + { 100+ c_regex_traits::syntax_t, "t", }, + { 100+ c_regex_traits::syntax_v, "v", }, + { 100+ c_regex_traits::syntax_x, "x", }, + { 100+ c_regex_traits::syntax_c, "c", }, + { 100+ c_regex_traits::syntax_colon, ":", }, + { 100+ c_regex_traits::syntax_equal, "=", }, + + { 100 + c_regex_traits::syntax_e, "e", }, + { 100 + c_regex_traits::syntax_l, "l", }, + { 100 + c_regex_traits::syntax_L, "L", }, + { 100 + c_regex_traits::syntax_u, "u", }, + { 100 + c_regex_traits::syntax_U, "U", }, + { 100 + c_regex_traits::syntax_s, "s", }, + { 100 + c_regex_traits::syntax_S, "S", }, + { 100 + c_regex_traits::syntax_d, "d", }, + { 100 + c_regex_traits::syntax_D, "D", }, + { 100 + c_regex_traits::syntax_E, "E", }, + { 100 + c_regex_traits::syntax_Q, "Q", }, + { 100 + c_regex_traits::syntax_X, "X", }, + { 100 + c_regex_traits::syntax_C, "C", }, + { 100 + c_regex_traits::syntax_Z, "Z", }, + { 100 + c_regex_traits::syntax_G, "G", }, + + { 0, "", }, + }; + +BOOST_RE_IX_DECL unsigned int BOOST_RE_CALL re_get_default_message(char* buf, unsigned int len, unsigned int id) +{ + BOOST_RE_GUARD_STACK + const mss* pm = default_messages; + while(pm->id) + { + if(pm->id == id) + { + unsigned int size = re_strlen(pm->what) + 1; + if(size > len) + return size; + re_strcpy(buf, pm->what); + return size; + } + ++pm; + } + if(buf && len) + *buf = 0; + return 1; +} + +const wchar_t combining_ranges[] = { 0x0300, 0x0361, + 0x0483, 0x0486, + 0x0903, 0x0903, + 0x093E, 0x0940, + 0x0949, 0x094C, + 0x0982, 0x0983, + 0x09BE, 0x09C0, + 0x09C7, 0x09CC, + 0x09D7, 0x09D7, + 0x0A3E, 0x0A40, + 0x0A83, 0x0A83, + 0x0ABE, 0x0AC0, + 0x0AC9, 0x0ACC, + 0x0B02, 0x0B03, + 0x0B3E, 0x0B3E, + 0x0B40, 0x0B40, + 0x0B47, 0x0B4C, + 0x0B57, 0x0B57, + 0x0B83, 0x0B83, + 0x0BBE, 0x0BBF, + 0x0BC1, 0x0BCC, + 0x0BD7, 0x0BD7, + 0x0C01, 0x0C03, + 0x0C41, 0x0C44, + 0x0C82, 0x0C83, + 0x0CBE, 0x0CBE, + 0x0CC0, 0x0CC4, + 0x0CC7, 0x0CCB, + 0x0CD5, 0x0CD6, + 0x0D02, 0x0D03, + 0x0D3E, 0x0D40, + 0x0D46, 0x0D4C, + 0x0D57, 0x0D57, + 0x0F7F, 0x0F7F, + 0x20D0, 0x20E1, + 0x3099, 0x309A, + 0xFE20, 0xFE23, + 0xffff, 0xffff, }; + +BOOST_RE_IX_DECL bool BOOST_RE_CALL is_combining(wchar_t c) +{ + BOOST_RE_GUARD_STACK + const wchar_t* p = combining_ranges + 1; + while(*p < c) p += 2; + --p; + if((c >= *p) && (c <= *(p+1))) + return true; + return false; +} + +BOOST_RE_IX_DECL unsigned short wide_unicode_classes[] = { + c_traits_base::char_class_cntrl, // '' 0 + c_traits_base::char_class_cntrl, // '' 1 + c_traits_base::char_class_cntrl, // '' 2 + c_traits_base::char_class_cntrl, // '' 3 + c_traits_base::char_class_cntrl, // '' 4 + c_traits_base::char_class_cntrl, // '' 5 + c_traits_base::char_class_cntrl, // '' 6 + c_traits_base::char_class_cntrl, // '' 7 + c_traits_base::char_class_cntrl, // '' 8 + c_traits_base::char_class_cntrl | c_traits_base::char_class_space | c_traits_base::char_class_blank, // '' 9 + c_traits_base::char_class_cntrl | c_traits_base::char_class_space, // '' 10 + c_traits_base::char_class_cntrl | c_traits_base::char_class_space, // '' 11 + c_traits_base::char_class_cntrl | c_traits_base::char_class_space, // '' 12 + c_traits_base::char_class_cntrl | c_traits_base::char_class_space, // '' 13 + c_traits_base::char_class_cntrl, // '.' 14 + c_traits_base::char_class_cntrl, // '.' 15 + c_traits_base::char_class_cntrl, // '.' 16 + c_traits_base::char_class_cntrl, // '.' 17 + c_traits_base::char_class_cntrl, // '.' 18 + c_traits_base::char_class_cntrl, // '.' 19 + c_traits_base::char_class_cntrl, // '.' 20 + c_traits_base::char_class_cntrl, // '.' 21 + c_traits_base::char_class_cntrl, // '.' 22 + c_traits_base::char_class_cntrl, // '.' 23 + c_traits_base::char_class_cntrl, // '.' 24 + c_traits_base::char_class_cntrl, // '' 25 + c_traits_base::char_class_cntrl, // '' 26 + c_traits_base::char_class_cntrl, // '' 27 + c_traits_base::char_class_cntrl, // '.' 28 + c_traits_base::char_class_cntrl, // '.' 29 + c_traits_base::char_class_cntrl, // '.' 30 + c_traits_base::char_class_cntrl, // '.' 31 + c_traits_base::char_class_space | c_traits_base::char_class_blank, // ' ' 32 + c_traits_base::char_class_punct, // '!' 33 + c_traits_base::char_class_punct, // '"' 34 + c_traits_base::char_class_punct, // '#' 35 + c_traits_base::char_class_punct, // '$' 36 + c_traits_base::char_class_punct, // '%' 37 + c_traits_base::char_class_punct, // '&' 38 + c_traits_base::char_class_punct, // ''' 39 + c_traits_base::char_class_punct, // '(' 40 + c_traits_base::char_class_punct, // ')' 41 + c_traits_base::char_class_punct, // '*' 42 + c_traits_base::char_class_punct, // '+' 43 + c_traits_base::char_class_punct, // ',' 44 + c_traits_base::char_class_punct, // '-' 45 + c_traits_base::char_class_punct, // '.' 46 + c_traits_base::char_class_punct, // '/' 47 + c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '0' 48 + c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '1' 49 + c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '2' 50 + c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '3' 51 + c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '4' 52 + c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '5' 53 + c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '6' 54 + c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '7' 55 + c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '8' 56 + c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '9' 57 + c_traits_base::char_class_punct, // ':' 58 + c_traits_base::char_class_punct, // ';' 59 + c_traits_base::char_class_punct, // '<' 60 + c_traits_base::char_class_punct, // '=' 61 + c_traits_base::char_class_punct, // '>' 62 + c_traits_base::char_class_punct, // '?' 63 + c_traits_base::char_class_punct, // '@' 64 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'A' 65 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'B' 66 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'C' 67 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'D' 68 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'E' 69 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'F' 70 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'G' 71 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'H' 72 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'I' 73 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'J' 74 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'K' 75 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'L' 76 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'M' 77 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'N' 78 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'O' 79 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'P' 80 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Q' 81 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'R' 82 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'S' 83 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'T' 84 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'U' 85 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'V' 86 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'W' 87 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'X' 88 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Y' 89 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Z' 90 + c_traits_base::char_class_punct, // '[' 91 + c_traits_base::char_class_punct, // '\' 92 + c_traits_base::char_class_punct, // ']' 93 + c_traits_base::char_class_punct, // '^' 94 + c_traits_base::char_class_punct | c_traits_base::char_class_underscore, // '_' 95 + c_traits_base::char_class_punct, // '`' 96 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'a' 97 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'b' 98 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'c' 99 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'd' 100 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'e' 101 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'f' 102 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'g' 103 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'h' 104 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'i' 105 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'j' 106 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'k' 107 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'l' 108 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'm' 109 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'n' 110 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'o' 111 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'p' 112 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'q' 113 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'r' 114 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 's' 115 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 't' 116 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'u' 117 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'v' 118 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'w' 119 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'x' 120 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'y' 121 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'z' 122 + c_traits_base::char_class_punct, // '{' 123 + c_traits_base::char_class_punct, // '|' 124 + c_traits_base::char_class_punct, // '}' 125 + c_traits_base::char_class_punct, // '~' 126 + + c_traits_base::char_class_cntrl, // '' 127 + c_traits_base::char_class_cntrl, // '€' 128 + c_traits_base::char_class_cntrl, // '' 129 + c_traits_base::char_class_cntrl, // '‚' 130 + c_traits_base::char_class_cntrl, // 'ƒ' 131 + c_traits_base::char_class_cntrl, // '„' 132 + c_traits_base::char_class_cntrl, // '…' 133 + c_traits_base::char_class_cntrl, // '†' 134 + c_traits_base::char_class_cntrl, // '‡' 135 + c_traits_base::char_class_cntrl, // 'ˆ' 136 + c_traits_base::char_class_cntrl, // '‰' 137 + c_traits_base::char_class_cntrl, // 'Š' 138 + c_traits_base::char_class_cntrl, // '‹' 139 + c_traits_base::char_class_cntrl, // 'Œ' 140 + c_traits_base::char_class_cntrl, // '' 141 + c_traits_base::char_class_cntrl, // 'Ž' 142 + c_traits_base::char_class_cntrl, // '' 143 + c_traits_base::char_class_cntrl, // '' 144 + c_traits_base::char_class_cntrl, // '‘' 145 + c_traits_base::char_class_cntrl, // '’' 146 + c_traits_base::char_class_cntrl, // '“' 147 + c_traits_base::char_class_cntrl, // '”' 148 + c_traits_base::char_class_cntrl, // '•' 149 + c_traits_base::char_class_cntrl, // '–' 150 + c_traits_base::char_class_cntrl, // '—' 151 + c_traits_base::char_class_cntrl, // '˜' 152 + c_traits_base::char_class_cntrl, // '™' 153 + c_traits_base::char_class_cntrl, // 'š' 154 + c_traits_base::char_class_cntrl, // '›' 155 + c_traits_base::char_class_cntrl, // 'œ' 156 + c_traits_base::char_class_cntrl, // '' 157 + c_traits_base::char_class_cntrl, // 'ž' 158 + c_traits_base::char_class_cntrl, // 'Ÿ' 159 + c_traits_base::char_class_space | c_traits_base::char_class_blank, // ' ' 160 + c_traits_base::char_class_punct, // '¡' 161 + c_traits_base::char_class_punct, // '¢' 162 + c_traits_base::char_class_punct, // '£' 163 + c_traits_base::char_class_punct, // '¤' 164 + c_traits_base::char_class_punct, // '¥' 165 + c_traits_base::char_class_punct, // '¦' 166 + c_traits_base::char_class_punct, // '§' 167 + c_traits_base::char_class_punct, // '¨' 168 + c_traits_base::char_class_punct, // '©' 169 + c_traits_base::char_class_punct, // 'ª' 170 + c_traits_base::char_class_punct, // '«' 171 + c_traits_base::char_class_punct, // '¬' 172 + c_traits_base::char_class_punct, // '­' 173 + c_traits_base::char_class_punct, // '®' 174 + c_traits_base::char_class_punct, // '¯' 175 + c_traits_base::char_class_punct, // '°' 176 + c_traits_base::char_class_punct, // '±' 177 + c_traits_base::char_class_punct, // '²' 178 + c_traits_base::char_class_punct, // '³' 179 + c_traits_base::char_class_punct, // '´' 180 + c_traits_base::char_class_punct, // 'µ' 181 + c_traits_base::char_class_punct, // '¶' 182 + c_traits_base::char_class_punct, // '·' 183 + c_traits_base::char_class_punct, // '¸' 184 + c_traits_base::char_class_punct, // '¹' 185 + c_traits_base::char_class_punct, // 'º' 186 + c_traits_base::char_class_punct, // '»' 187 + c_traits_base::char_class_punct, // '¼' 188 + c_traits_base::char_class_punct, // '½' 189 + c_traits_base::char_class_punct, // '¾' 190 + c_traits_base::char_class_punct, // '¿' 191 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'À' 192 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Á' 193 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Â' 194 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ã' 195 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ä' 196 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Å' 197 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Æ' 198 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ç' 199 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'È' 200 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'É' 201 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ê' 202 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ë' 203 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ì' 204 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Í' 205 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Î' 206 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ï' 207 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ð' 208 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ñ' 209 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ò' 210 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ó' 211 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ô' 212 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Õ' 213 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ö' 214 + c_traits_base::char_class_punct, // '×' 215 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ø' 216 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ù' 217 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ú' 218 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Û' 219 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ü' 220 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ý' 221 + c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Þ' 222 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ß' 223 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'à' 224 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'á' 225 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'â' 226 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ã' 227 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ä' 228 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'å' 229 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'æ' 230 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ç' 231 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'è' 232 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'é' 233 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ê' 234 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ë' 235 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ì' 236 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'í' 237 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'î' 238 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ï' 239 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ð' 240 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ñ' 241 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ò' 242 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ó' 243 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ô' 244 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'õ' 245 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ö' 246 + c_traits_base::char_class_punct, // '÷' 247 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ø' 248 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ù' 249 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ú' 250 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'û' 251 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ü' 252 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ý' 253 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'þ' 254 + c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ÿ' 255 +}; + +BOOST_RE_IX_DECL wchar_t wide_lower_case_map[] = { + 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, +}; + + + } // namespace re_detail +} // namespace boost diff --git a/src/cpp_regex_traits.cpp b/src/cpp_regex_traits.cpp new file mode 100644 index 00000000..48c08e25 --- /dev/null +++ b/src/cpp_regex_traits.cpp @@ -0,0 +1,793 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE: c_regex_traits.cpp + * VERSION: 3.00 + * DESCRIPTION: Implements the cpp_regex_traits traits class + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include "primary_transform.hpp" + +#ifndef BOOST_RE_NO_LOCALE_H + +#ifdef BOOST_MSVC +#pragma warning(disable:4786) +namespace std +{ + using ::abs; + using ::mbstate_t; +} +#endif + +namespace{ + const unsigned int re_classes_max = 14; + const unsigned int char_set_size = CHAR_MAX - CHAR_MIN + 1; + +jm_uintfast32_t re_char_class_id[] = { + boost::re_detail::cpp_regex_traits_base::char_class_alnum, + boost::re_detail::cpp_regex_traits_base::char_class_alpha, + boost::re_detail::cpp_regex_traits_base::char_class_cntrl, + boost::re_detail::cpp_regex_traits_base::char_class_digit, + boost::re_detail::cpp_regex_traits_base::char_class_graph, + boost::re_detail::cpp_regex_traits_base::char_class_lower, + boost::re_detail::cpp_regex_traits_base::char_class_print, + boost::re_detail::cpp_regex_traits_base::char_class_punct, + boost::re_detail::cpp_regex_traits_base::char_class_space, + boost::re_detail::cpp_regex_traits_base::char_class_upper, + boost::re_detail::cpp_regex_traits_base::char_class_xdigit, + boost::re_detail::cpp_regex_traits_base::char_class_blank, + boost::re_detail::cpp_regex_traits_base::char_class_word, + boost::re_detail::cpp_regex_traits_base::char_class_unicode, +}; + +const char* re_char_class_names[] = { +"alnum", +"alpha", +"cntrl", +"digit", +"graph", +"lower", +"print", +"punct", +"space", +"upper", +"xdigit", +"blank", +"word", +"unicode", +}; + +template > +class parser_buf : public ::std::basic_streambuf +{ + typedef ::std::basic_streambuf base_type; + typedef typename base_type::int_type int_type; + typedef typename base_type::char_type char_type; + typedef typename base_type::pos_type pos_type; + typedef ::std::streamsize streamsize; + typedef typename base_type::off_type off_type; +public: + parser_buf() : base_type() { setbuf(0, 0); } + const charT* getnext() { return this->gptr(); } +protected: + std::basic_streambuf* setbuf(char_type* s, streamsize n); + typename parser_buf::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which); + typename parser_buf::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which); +private: + parser_buf& operator=(const parser_buf&); + parser_buf(const parser_buf&); +}; + +template +std::basic_streambuf* +parser_buf::setbuf(char_type* s, streamsize n) +{ + this->setg(s, s, s + n); + return this; +} + +template +typename parser_buf::pos_type +parser_buf::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) +{ + if(which & ::std::ios_base::out) + return pos_type(off_type(-1)); + int size = egptr() - eback(); + int pos = gptr() - eback(); + charT* g = eback(); + switch(way) + { + case ::std::ios_base::beg: + if((off < 0) || (off > size)) + return pos_type(off_type(-1)); + else + this->setg(g, g + off, g + size); + case ::std::ios_base::end: + if((off < 0) || (off > size)) + return pos_type(off_type(-1)); + else + this->setg(g, g + size - off, g + size); + case ::std::ios_base::cur: + { + int newpos = pos + off; + if((newpos < 0) || (newpos > size)) + return pos_type(off_type(-1)); + else + this->setg(g, g + newpos, g + size); + } + } + return gptr() - eback(); +} + +template +typename parser_buf::pos_type +parser_buf::seekpos(pos_type sp, ::std::ios_base::openmode which) +{ + if(which & ::std::ios_base::out) + return pos_type(off_type(-1)); + int size = egptr() - eback(); + charT* g = eback(); + if(sp <= size) + { + this->setg(g, g + ::std::streamsize(sp), g + size); + } + return pos_type(off_type(-1)); +} + + +} // namespace + +namespace boost{ + namespace re_detail{ + +template <> +struct message_data +{ + unsigned char syntax_map[CHAR_MAX-CHAR_MIN]; + std::map > collating_elements; + std::map > classes; + //std::string _zero; + //std::string _ten; + parser_buf sbuf; + std::istream is; + std::string error_strings[boost::REG_E_UNKNOWN+1]; + + message_data(const std::locale& l, const std::string& regex_message_catalogue); +private: + message_data(const message_data&); + message_data& operator=(const message_data&); +}; + + +message_data::message_data(const std::locale& l, const std::string& regex_message_catalogue) + : is(&sbuf) +{ + is.imbue(l); + const std::messages* pm = &BOOST_RE_USE_FACET(l, std::messages); + std::messages::catalog cat = regex_message_catalogue.size() ? pm->open(regex_message_catalogue, l) : -1; + + std::memset(syntax_map, cpp_regex_traits::syntax_char, 256); + unsigned int i; + scoped_array a; + unsigned array_size = 0; + unsigned new_size; + for(i = 1; i < cpp_regex_traits::syntax_max; ++i) + { + new_size = re_get_default_message(0, 0, i+100); + if(new_size > array_size) + { + a.reset(new char[new_size]); + array_size = new_size; + } + re_get_default_message(a.get(), array_size, i+100); + std::string s = a.get(); + if((int)cat >= 0) + s = pm->get(cat, 0, i+100, s); + for(unsigned int j = 0; j < s.size(); ++j) + { + syntax_map[s[j]] = (unsigned char)(i); + } + } + + // load any custom collate names: + 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); + } +/* + std::string n("zero"); + std::map >::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; + if((int)cat >= 0) + { + for(i = 0; i < re_classes_max; ++i) + { + s = pm->get(cat, 0, i+300, m); + if(s.size()) + classes[s] = i; + } + for(i = 0; i <= boost::REG_E_UNKNOWN ; ++i) + { + s = pm->get(cat, 0, i+200, m); + error_strings[i] = s; + } + } + + if((int)cat >= 0) + pm->close(cat); +} + +std::string cpp_regex_traits_base::set_message_catalogue(const std::string& l) +{ + if(sizeof(regex_message_cat) <= l.size()) + return l; + std::string old(regex_message_cat); + std::strcpy(regex_message_cat, l.c_str()); + return old; +} + +char cpp_regex_traits_base::regex_message_cat[200] = {0}; + + +} // namespace re_detail + + +cpp_regex_traits::cpp_regex_traits() +{ + pmd = new re_detail::message_data(locale_inst, regex_message_cat); + psyntax = pmd->syntax_map; + try{ + lower_map = new char[char_set_size]; + } + catch(...) + { + delete pmd; + throw; + } + for(unsigned int i = 0; i < char_set_size; ++i) + lower_map[i] = static_cast(i); + pctype = &BOOST_RE_USE_FACET(locale_inst, std::ctype); + pctype->tolower(&lower_map[0], &lower_map[char_set_size]); + pcollate = &BOOST_RE_USE_FACET(locale_inst, std::collate); + sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim)); +} + +cpp_regex_traits::~cpp_regex_traits() +{ + delete pmd; + delete[] lower_map; +} + +int BOOST_RE_CALL cpp_regex_traits::toi(char c)const +{ + pmd->sbuf.pubsetbuf(&c, 1); + pmd->is.clear(); + pmd->is >> std::dec; + int val; + if(pmd->is >> val) + { + return val; + } + else + return 0; +} + +int BOOST_RE_CALL cpp_regex_traits::toi(const char*& first, const char* last, int radix)const +{ + pmd->sbuf.pubsetbuf((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; + else pmd->is >> std::dec; + int val; + if(pmd->is >> val) + { + first = first + ((last - first) - pmd->sbuf.in_avail()); + return val; + } + else + return 0; +} + +jm_uintfast32_t BOOST_RE_CALL cpp_regex_traits::lookup_classname(const char* first, const char* last)const +{ + BOOST_RE_GUARD_STACK + unsigned int i; + std::string s(first, last); + + std::map >::const_iterator pos = pmd->classes.find(s); + if(pos != pmd->classes.end()) + return re_char_class_id[(*pos).second]; + + for(i = 0; i < re_classes_max; ++i) + { + if(s == re_char_class_names[i]) + return re_char_class_id[i]; + } + return 0; +} + +bool BOOST_RE_CALL cpp_regex_traits::lookup_collatename(std::string& s, const char* first, const char* last)const +{ + BOOST_RE_GUARD_STACK + std::string name(first, last); + std::map >::const_iterator pos = pmd->collating_elements.find(name); + if(pos != pmd->collating_elements.end()) + { + s = (*pos).second; + return true; + } + return re_detail::re_lookup_def_collate_name(s, name.c_str()); +} + +void BOOST_RE_CALL cpp_regex_traits::transform_primary(std::string& out, const std::string& in)const +{ + transform(out, in); + switch(sort_type) + { + case re_detail::sort_C: + case re_detail::sort_unknown: + break; + case re_detail::sort_fixed: + if((unsigned)sort_delim < out.size()) + out.erase((int)sort_delim); + break; + case re_detail::sort_delim: + for(unsigned int i = 0; i < out.size(); ++i) + { + if((out[i] == sort_delim) && (i+1 < out.size())) + { + out.erase(i+1); + break; + } + } + } +} + + +std::string BOOST_RE_CALL cpp_regex_traits::error_string(unsigned id)const +{ + if((id <= boost::REG_E_UNKNOWN) && (pmd->error_strings[id].size())) + return pmd->error_strings[id]; + return boost::re_detail::re_default_error_messages[id]; +} + +cpp_regex_traits::locale_type BOOST_RE_CALL cpp_regex_traits::imbue(locale_type l) +{ + locale_type old_l(locale_inst); + locale_inst = l; + re_detail::message_data* npmd = new re_detail::message_data(locale_inst, regex_message_cat); + delete pmd; + pmd = npmd; + psyntax = pmd->syntax_map; + for(unsigned int i = 0; i < char_set_size; ++i) + lower_map[i] = static_cast(i); + pctype = &BOOST_RE_USE_FACET(locale_inst, std::ctype); + pctype->tolower(&lower_map[0], &lower_map[char_set_size]); + pcollate = &BOOST_RE_USE_FACET(locale_inst, std::collate); + sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim)); + return old_l; +} + +#ifndef BOOST_RE_NO_WCSTRING + +namespace re_detail{ + +std::string BOOST_RE_CALL to_narrow(const std::basic_string& is, const std::codecvt& cvt) +{ + BOOST_RE_GUARD_STACK + unsigned int bufsize = is.size() * 2; + // + // declare buffer first as VC6 workaround for internal compiler error! + char* pc = new char[bufsize]; + scoped_array t(pc); + //typedef std::codecvt cvt_type; + //const cvt_type& cvt = BOOST_RE_USE_FACET(l, cvt_type); + std::mbstate_t state = 0; + + const wchar_t* next_in; + char* next_out; + while(true) + { + switch(cvt.out(state, is.c_str(), is.c_str() + is.size(), next_in, t.get(), t.get() + bufsize, next_out)) + { + case std::codecvt_base::ok: + return std::string(t.get(), next_out); + case std::codecvt_base::partial: + bufsize *= 2; + t.reset(new char[bufsize]); + continue; + case std::codecvt_base::error: + // not much we can do here but guess: + case std::codecvt_base::noconv: + std::string out; + for(unsigned i = 0; i < is.size(); ++i) + { + out.append(1, (char)is[i]); + } + return out; + } + } +} + +std::wstring BOOST_RE_CALL to_wide(const std::string& is, const std::codecvt& cvt) +{ + BOOST_RE_GUARD_STACK + unsigned int bufsize = is.size() + 2; + unsigned int maxsize = is.size() * 100; + // + // declare buffer first as VC6 workaround for internal compiler error! + wchar_t* pc = new wchar_t[bufsize]; + scoped_array t(pc); + //typedef std::codecvt cvt_type; + //const cvt_type& cvt = BOOST_RE_USE_FACET(l, cvt_type); + std::mbstate_t state = 0; + + wchar_t* next_out; + const char* next_in; + while(true) + { + switch(cvt.in(state, is.c_str(), is.c_str() + is.size(), next_in, t.get(), t.get() + bufsize, next_out)) + { + case std::codecvt_base::ok: + return std::wstring(t.get(), next_out); + case std::codecvt_base::partial: + bufsize *= 2; + if(bufsize < maxsize) + { + t.reset(new wchar_t[bufsize]); + continue; + } + // + // error fall through: + case std::codecvt_base::error: + // not much we can do here but guess: + case std::codecvt_base::noconv: + std::wstring out; + for(unsigned i = 0; i < is.size(); ++i) + { + out.append(1, is[i]); + } + return out; + } + } +} + + + +template <> +struct message_data +{ + typedef std::messages::string_type string_type; + + string_type name; + + struct syntax_map + { + wchar_t c; + unsigned int type; + }; + + std::list syntax; + std::map classes; + std::map collating_elements; + unsigned char syntax_[CHAR_MAX-CHAR_MIN+1]; + + parser_buf sbuf; + std::wistream is; + std::string error_strings[boost::REG_E_UNKNOWN+1]; + + message_data(const std::locale& l, const std::string& regex_message_catalogue); +}; + +message_data::message_data(const std::locale& l, const std::string& regex_message_catalogue) + : is(&sbuf) +{ + is.imbue(l); + syntax_map m; + typedef std::codecvt cvt_type; + const cvt_type& cvt = BOOST_RE_USE_FACET(l, cvt_type); + const std::messages& msgs = BOOST_RE_USE_FACET(l, std::messages); + std::messages::catalog cat = regex_message_catalogue.size() ? msgs.open(regex_message_catalogue, l) : -1; + + scoped_array a; + unsigned array_size = 0; + unsigned new_size; + unsigned int i; + std::memset(syntax_, cpp_regex_traits::syntax_char, sizeof(syntax_)); + for(i = 1; i < cpp_regex_traits::syntax_max; ++i) + { + new_size = re_get_default_message(0, 0, i+100); + if(new_size > array_size) + { + a.reset(new char[new_size]); + array_size = new_size; + } + re_get_default_message(a.get(), array_size, i+100); + std::string ns = a.get(); + string_type s = to_wide(ns, cvt); + if((int)cat >= 0) + s = BOOST_RE_USE_FACET(l, std::messages).get(cat, 0, i+100, s); + for(unsigned int j = 0; j < s.size(); ++j) + { + if((s[j] <= UCHAR_MAX) && (s[j] >= 0)) + syntax_[s[j]] = static_cast(i); + else + { + m.c = s[j]; + m.type = i; + syntax.push_back(m); + } + } + } + + // load any custom collate names: + 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(p1, p2)] = std::basic_string(p3, p4); + + ++i; + c2 = msgs.get(cat, 0, i, c1); + } + + if((int)cat >= 0) + { + c2.erase(); + for(i = 0; i < re_classes_max; ++i) + { + c1 = msgs.get(cat, 0, i+300, c2); + if(c1.size()) + classes[c1] = i; + } + for(i = 0; i <= boost::REG_E_UNKNOWN ; ++i) + { + c1 = msgs.get(cat, 0, i+200, c2); + error_strings[i] = to_narrow(c1, cvt); + } + } + + if((int)cat >= 0) + msgs.close(cat); +} + +} // namespace re_detail + +unsigned int BOOST_RE_CALL cpp_regex_traits::do_syntax_type(size_type c)const +{ + std::list::syntax_map>::const_iterator i, j; + i = pmd->syntax.begin(); + j = pmd->syntax.end(); + while(i != j) + { + if(((uchar_type)(*i).c) == c) + return (*i).type; + ++i; + } + return 0; +} + +void BOOST_RE_CALL cpp_regex_traits::transform_primary(std::basic_string& out, const std::basic_string& in)const +{ + transform(out, in); + switch(sort_type) + { + case re_detail::sort_C: + case re_detail::sort_unknown: + break; + case re_detail::sort_fixed: + if((unsigned)sort_delim < out.size()) + out.erase((int)sort_delim); + break; + case re_detail::sort_delim: + for(unsigned int i = 0; i < out.size(); ++i) + { + if((out[i] == sort_delim) && (i+1 < out.size())) + { + out.erase(i+1); + break; + } + } + } +} + +int BOOST_RE_CALL cpp_regex_traits::toi(wchar_t c)const +{ + pmd->sbuf.pubsetbuf(&c, 1); + pmd->is.clear(); + pmd->is >> std::dec; + int val; + if(pmd->is >> val) + { + return val; + } + else + return 0; +} + +int BOOST_RE_CALL cpp_regex_traits::toi(const wchar_t*& first, const wchar_t* last, int radix)const +{ + pmd->sbuf.pubsetbuf((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; + else pmd->is >> std::dec; + int val; + if(pmd->is >> val) + { + first = first + ((last - first) - pmd->sbuf.in_avail()); + return val; + } + else + return 0; +} + +jm_uintfast32_t BOOST_RE_CALL cpp_regex_traits::lookup_classname(const wchar_t* first, const wchar_t* last)const +{ + BOOST_RE_GUARD_STACK + unsigned int i; + std::wstring s(first, last); + + std::map::const_iterator pos = pmd->classes.find(s); + if(pos != pmd->classes.end()) + return re_char_class_id[(*pos).second]; + + std::string ns = re_detail::to_narrow(s, *pcdv); + + for(i = 0; i < re_classes_max; ++i) + { + if(ns == re_char_class_names[i]) + return re_char_class_id[i]; + } + return 0; +} + +bool BOOST_RE_CALL cpp_regex_traits::lookup_collatename(std::basic_string& s, const wchar_t* first, const wchar_t* last)const +{ + BOOST_RE_GUARD_STACK + std::wstring name(first, last); + std::map::const_iterator pos = pmd->collating_elements.find(name); + if(pos != pmd->collating_elements.end()) + { + s = (*pos).second; + return true; + } + std::string ns = re_detail::to_narrow(name, *pcdv); + std::string ns2; + bool result = re_detail::re_lookup_def_collate_name(ns2, ns.c_str()); + s = re_detail::to_wide(ns2, *pcdv); + return result; +} + +std::string BOOST_RE_CALL cpp_regex_traits::error_string(unsigned id)const +{ + if((id <= boost::REG_E_UNKNOWN) && (pmd->error_strings[id].size())) + return pmd->error_strings[id]; + return boost::re_detail::re_default_error_messages[id]; +} + +cpp_regex_traits::cpp_regex_traits() +{ + pmd = new re_detail::message_data(locale_inst, std::string(regex_message_cat)); + psyntax = pmd->syntax_; + try{ + lower_map = new wchar_t[char_set_size]; + } + catch(...) + { + delete pmd; + throw; + } + for(unsigned int i = 0; i < char_set_size; ++i) + lower_map[i] = static_cast(i); + pctype = &BOOST_RE_USE_FACET(locale_inst, std::ctype); + pctype->tolower(&lower_map[0], &lower_map[char_set_size]); + pcollate = &BOOST_RE_USE_FACET(locale_inst, std::collate); + typedef std::codecvt cvt_t; + pcdv = &BOOST_RE_USE_FACET(locale_inst, cvt_t); + sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim)); +} + +cpp_regex_traits::~cpp_regex_traits() +{ + delete pmd; + delete[] lower_map; +} + +cpp_regex_traits::locale_type BOOST_RE_CALL cpp_regex_traits::imbue(locale_type l) +{ + locale_type old_l(locale_inst); + locale_inst = l; + re_detail::message_data* npmd = new re_detail::message_data(locale_inst, std::string(regex_message_cat)); + delete pmd; + pmd = npmd; + psyntax = pmd->syntax_; + for(unsigned int i = 0; i < char_set_size; ++i) + lower_map[i] = static_cast(i); + pctype = &BOOST_RE_USE_FACET(locale_inst, std::ctype); + pctype->tolower(&lower_map[0], &lower_map[char_set_size]); + pcollate = &BOOST_RE_USE_FACET(locale_inst, std::collate); + typedef std::codecvt cvt_t; + pcdv = &BOOST_RE_USE_FACET(locale_inst, cvt_t); + sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim)); + return old_l; +} + +unsigned int BOOST_RE_CALL cpp_regex_traits::strwiden(wchar_t *s1, unsigned int len, const char *s2)const +{ + std::string s(s2); + std::wstring ws = re_detail::to_wide(s2, *pcdv); + if(len > ws.size()) + wcscpy(s1, ws.c_str()); + return ws.size()+1; +} + +#endif // BOOST_RE_NO_WCSTRING + + +} // namespace boost + +#endif diff --git a/src/cregex.cpp b/src/cregex.cpp new file mode 100644 index 00000000..28be8568 --- /dev/null +++ b/src/cregex.cpp @@ -0,0 +1,592 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE: cregex.cpp + * VERSION: 3.00 + * DESCRIPTION: Implements high level class boost::RexEx + */ +#include +#include +#if !defined(BOOST_RE_NO_STRING_H) +#include +#include +#include +#include + +namespace boost{ + +#ifdef __BORLANDC__ +#if __BORLANDC__ < 0x530 +// +// we need to instantiate the vector classes we use +// since declaring a reference to type doesn't seem to +// do the job... +std::vector inst1; +std::vector inst2; +#endif +#endif + +namespace{ + +template +std::string to_string(iterator i, iterator j) +{ + BOOST_RE_GUARD_STACK + std::string s; + while(i != j) + { + s.append(1, *i); + ++i; + } + return s; +} + +inline std::string to_string(const char* i, const char* j) +{ + return std::string(i, j); +} + +} +namespace re_detail{ + +class RegExData +{ +public: + enum type + { + type_pc, + type_pf, + type_copy + }; + regex e; + cmatch m; + match_results fm; + type t; + const char* pbase; + unsigned line; + mapfile::iterator fbase; + std::map > strings; + std::map > positions; + void update(); + void clean(); +}; + +void RegExData::update() +{ + BOOST_RE_GUARD_STACK + strings.erase(strings.begin(), strings.end()); + positions.erase(positions.begin(), positions.end()); + if(t == type_pc) + { + for(unsigned int i = 0; i < m.size(); ++i) + { + if(m[i].matched) strings[i] = std::string(m[i].first, m[i].second); + positions[i] = m[i].matched ? m[i].first - pbase : -1; + } + line = m.line(); + } + else + { + for(unsigned int i = 0; i < fm.size(); ++i) + { + if(fm[i].matched) strings[i] = to_string(fm[i].first, fm[i].second); + positions[i] = fm[i].matched ? fm[i].first - fbase : -1; + } + line = fm.line(); + } + t = type_copy; +} + +void RegExData::clean() +{ + BOOST_RE_GUARD_STACK + fbase = mapfile::iterator(); + fm = match_results(); +} + +} // namespace + +RegEx::RegEx() +{ + BOOST_RE_GUARD_STACK + pdata = new re_detail::RegExData(); +} + +RegEx::RegEx(const RegEx& o) +{ + BOOST_RE_GUARD_STACK + pdata = new re_detail::RegExData(*(o.pdata)); +} + +RegEx::~RegEx() +{ + BOOST_RE_GUARD_STACK + delete pdata; +} + +RegEx::RegEx(const char* c, bool icase) +{ + BOOST_RE_GUARD_STACK + pdata = new re_detail::RegExData(); + SetExpression(c, icase); +} + +RegEx::RegEx(const std::string& s, bool icase) +{ + BOOST_RE_GUARD_STACK + pdata = new re_detail::RegExData(); + SetExpression(s.c_str(), icase); +} + +RegEx& RegEx::operator=(const RegEx& o) +{ + BOOST_RE_GUARD_STACK + *pdata = *(o.pdata); + return *this; +} + +RegEx& RegEx::operator=(const char* p) +{ + BOOST_RE_GUARD_STACK + SetExpression(p, false); + return *this; +} + +unsigned int RegEx::SetExpression(const char* p, bool icase) +{ + BOOST_RE_GUARD_STACK + jm_uintfast32_t f = icase ? regbase::normal | regbase::use_except | regbase::icase : regbase::normal | regbase::use_except; + return pdata->e.set_expression(p, f); +} + +std::string RegEx::Expression()const +{ + BOOST_RE_GUARD_STACK + return pdata->e.expression(); +} + +// +// now matching operators: +// +bool RegEx::Match(const char* p, unsigned int flags) +{ + BOOST_RE_GUARD_STACK + pdata->t = re_detail::RegExData::type_pc; + pdata->pbase = p; + const char* end = p; + while(*end)++end; + + if(regex_match(p, end, pdata->m, pdata->e, flags)) + { + pdata->update(); + return true; + } + return false; +} + +bool RegEx::Search(const char* p, unsigned int flags) +{ + BOOST_RE_GUARD_STACK + pdata->t = re_detail::RegExData::type_pc; + pdata->pbase = p; + const char* end = p; + while(*end)++end; + + if(regex_search(p, end, pdata->m, pdata->e, flags)) + { + pdata->update(); + return true; + } + return false; +} +namespace re_detail{ +struct pred1 +{ + GrepCallback cb; + RegEx* pe; + pred1(GrepCallback c, RegEx* i) : cb(c), pe(i) {} + bool operator()(const cmatch& m) + { + pe->pdata->m = m; + return cb(*pe); + } +}; +} +unsigned int RegEx::Grep(GrepCallback cb, const char* p, unsigned int flags) +{ + BOOST_RE_GUARD_STACK + pdata->t = re_detail::RegExData::type_pc; + pdata->pbase = p; + const char* end = p; + while(*end)++end; + + unsigned int result = regex_grep(re_detail::pred1(cb, this), p, end, pdata->e, flags); + if(result) + pdata->update(); + return result; +} +namespace re_detail{ +struct pred2 +{ + std::vector& v; + RegEx* pe; + pred2(std::vector& o, RegEx* e) : v(o), pe(e) {} + bool operator()(const cmatch& m) + { + pe->pdata->m = m; + v.push_back(std::string(m[0].first, m[0].second)); + return true; + } +private: + pred2& operator=(const pred2&); +}; +} + +unsigned int RegEx::Grep(std::vector& v, const char* p, unsigned int flags) +{ + BOOST_RE_GUARD_STACK + pdata->t = re_detail::RegExData::type_pc; + pdata->pbase = p; + const char* end = p; + while(*end)++end; + + unsigned int result = regex_grep(re_detail::pred2(v, this), p, end, pdata->e, flags); + if(result) + pdata->update(); + return result; +} +namespace re_detail{ +struct pred3 +{ + std::vector& v; + const char* base; + RegEx* pe; + pred3(std::vector& o, const char* pb, RegEx* p) : v(o), base(pb), pe(p) {} + bool operator()(const cmatch& m) + { + pe->pdata->m = m; + v.push_back(m[0].first - base); + return true; + } +private: + pred3& operator=(const pred3&); +}; +} +unsigned int RegEx::Grep(std::vector& v, const char* p, unsigned int flags) +{ + BOOST_RE_GUARD_STACK + pdata->t = re_detail::RegExData::type_pc; + pdata->pbase = p; + const char* end = p; + while(*end)++end; + + unsigned int result = regex_grep(re_detail::pred3(v, p, this), p, end, pdata->e, flags); + if(result) + pdata->update(); + return result; +} +namespace re_detail{ +struct pred4 +{ + GrepFileCallback cb; + RegEx* pe; + const char* file; + bool ok; + pred4(GrepFileCallback c, RegEx* i, const char* f) : cb(c), pe(i), file(f), ok(true) {} + bool operator()(const match_results& m) + { + pe->pdata->t = RegExData::type_pf; + pe->pdata->fm = m; + pe->pdata->update(); + ok = cb(file, *pe); + return ok; + } +}; +} +namespace{ +void BuildFileList(std::list* pl, const char* files, bool recurse) +{ + BOOST_RE_GUARD_STACK + file_iterator start(files); + file_iterator end; + if(recurse) + { + // go through sub directories: + char buf[MAX_PATH]; + std::strcpy(buf, start.root()); + if(*buf == 0) + { + std::strcpy(buf, "."); + std::strcat(buf, directory_iterator::separator()); + std::strcat(buf, "*"); + } + else + { + std::strcat(buf, directory_iterator::separator()); + std::strcat(buf, "*"); + } + directory_iterator dstart(buf); + directory_iterator dend; + + // now get the file mask bit of "files": + const char* ptr = files; + while(*ptr) ++ptr; + while((ptr != files) && (*ptr != *directory_iterator::separator()) && (*ptr != '/'))--ptr; + if(ptr != files) ++ptr; + + while(dstart != dend) + { + std::sprintf(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); + BuildFileList(pl, buf, recurse); + ++dstart; + } + } + while(start != end) + { + pl->push_back(*start); + ++start; + } +} +} + +unsigned int RegEx::GrepFiles(GrepFileCallback cb, const char* files, bool recurse, unsigned int flags) +{ + BOOST_RE_GUARD_STACK + unsigned int result = 0; + std::list file_list; + BuildFileList(&file_list, files, recurse); + std::list::iterator start, end; + start = file_list.begin(); + end = file_list.end(); + + while(start != end) + { + mapfile map((*start).c_str()); + pdata->t = re_detail::RegExData::type_pf; + pdata->fbase = map.begin(); + re_detail::pred4 pred(cb, this, (*start).c_str()); + int r = regex_grep(pred, map.begin(), map.end(), pdata->e, flags); + result += r; + ++start; + pdata->clean(); + if(pred.ok == false) + return result; + } + + return result; +} + + +unsigned int RegEx::FindFiles(FindFilesCallback cb, const char* files, bool recurse, unsigned int flags) +{ + BOOST_RE_GUARD_STACK + unsigned int result = 0; + std::list file_list; + BuildFileList(&file_list, files, recurse); + std::list::iterator start, end; + start = file_list.begin(); + end = file_list.end(); + + while(start != end) + { + mapfile map((*start).c_str()); + pdata->t = re_detail::RegExData::type_pf; + pdata->fbase = map.begin(); + + if(regex_search(map.begin(), map.end(), pdata->fm, pdata->e, flags)) + { + ++result; + if(false == cb((*start).c_str())) + return result; + } + //pdata->update(); + ++start; + //pdata->clean(); + } + + return result; +} + +std::string RegEx::Merge(const std::string& in, const std::string& fmt, + bool copy, unsigned int flags) +{ + std::string result; + re_detail::string_out_iterator i(result); + if(!copy) flags |= format_no_copy; + regex_merge(i, in.begin(), in.end(), pdata->e, fmt.c_str(), flags); + return result; +} + +std::string RegEx::Merge(const char* in, const char* fmt, + bool copy, unsigned int flags) +{ + std::string result; + if(!copy) flags |= format_no_copy; + re_detail::string_out_iterator i(result); + regex_merge(i, in, in + std::strlen(in), pdata->e, fmt, flags); + return result; +} + +unsigned int RegEx::Split(std::vector& v, + std::string& s, + unsigned flags, + unsigned max_count) +{ + return regex_split(std::back_inserter(v), s, pdata->e, flags, max_count); +} + + + +// +// now operators for returning what matched in more detail: +// +unsigned int RegEx::Position(int i)const +{ + BOOST_RE_GUARD_STACK + switch(pdata->t) + { + case re_detail::RegExData::type_pc: + return pdata->m[i].matched ? pdata->m[i].first - pdata->pbase : (unsigned int)-1; + case re_detail::RegExData::type_pf: + return pdata->fm[i].matched ? pdata->fm[i].first - pdata->fbase : (unsigned int)-1; + case re_detail::RegExData::type_copy: + { + std::map >::iterator pos = pdata->positions.find(i); + if(pos == pdata->positions.end()) + return (unsigned int)-1; + return (*pos).second; + } + } + return (unsigned int)-1; +} + +unsigned int RegEx::Line()const +{ + BOOST_RE_GUARD_STACK + switch(pdata->t) + { + case re_detail::RegExData::type_pc: + return pdata->m[0].matched ? pdata->m.line() : (unsigned int)-1; + case re_detail::RegExData::type_pf: + return pdata->fm[0].matched ? pdata->fm.line() : (unsigned int)-1; + case re_detail::RegExData::type_copy: + { + return pdata->line; + } + } + return (unsigned int)-1; +} + +unsigned int RegEx::Marks()const +{ + BOOST_RE_GUARD_STACK + return pdata->e.mark_count(); +} + + +unsigned int RegEx::Length(int i)const +{ + BOOST_RE_GUARD_STACK + switch(pdata->t) + { + case re_detail::RegExData::type_pc: + return pdata->m[i].matched ? pdata->m[i].second - pdata->m[i].first : 0; + case re_detail::RegExData::type_pf: + return pdata->fm[i].matched ? pdata->fm[i].second - pdata->fm[i].first : 0; + case re_detail::RegExData::type_copy: + { + std::map >::iterator pos = pdata->strings.find(i); + if(pos == pdata->strings.end()) + return 0; + return (*pos).second.size(); + } + } + return 0; +} + +std::string RegEx::What(int i)const +{ + BOOST_RE_GUARD_STACK + std::string result; + switch(pdata->t) + { + case re_detail::RegExData::type_pc: + if(pdata->m[i].matched) + result.assign(pdata->m[i].first, pdata->m[i].second); + break; + case re_detail::RegExData::type_pf: + if(pdata->m[i].matched) + result.assign(to_string(pdata->m[i].first, pdata->m[i].second)); + break; + case re_detail::RegExData::type_copy: + { + std::map >::iterator pos = pdata->strings.find(i); + if(pos != pdata->strings.end()) + result = (*pos).second; + break; + } + } + return result; +} + + +} // namespace boost + +#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x550) && (__BORLANDC__ <= 0x551) && !defined(_RWSTD_COMPILE_INSTANTIATE) +// +// this is an ugly hack to work around an ugly problem: +// by default this file will produce unresolved externals during +// linking unless _RWSTD_COMPILE_INSTANTIATE is defined (Borland bug). +// However if _RWSTD_COMPILE_INSTANTIATE is defined then we get separate +// copies of basic_string's static data in the RTL and this DLL, this messes +// with basic_string's memory management and results in run-time crashes, +// Oh sweet joy of Catch 22.... +// +namespace std{ +template<> template<> +basic_string& +basic_string::replace(char* f1, char* f2, const char* i1, const char* i2) +{ + unsigned insert_pos = f1 - begin(); + unsigned remove_len = f2 - f1; + unsigned insert_len = i2 - i1; + unsigned org_size = size(); + if(insert_len > remove_len) + { + append(insert_len-remove_len, ' '); + std::copy_backward(begin() + insert_pos + remove_len, begin() + org_size, end()); + std::copy(i1, i2, begin() + insert_pos); + } + else + { + std::copy(begin() + insert_pos + remove_len, begin() + org_size, begin() + insert_pos + insert_len); + std::copy(i1, i2, begin() + insert_pos); + erase(size() + insert_len - remove_len); + } + return *this; +} +} +#endif + +#endif + + + + + + + diff --git a/src/fileiter.cpp b/src/fileiter.cpp new file mode 100644 index 00000000..b38855a5 --- /dev/null +++ b/src/fileiter.cpp @@ -0,0 +1,832 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE: fileiter.cpp + * VERSION: 3.00 + * DESCRIPTION: Implements file io primitives + directory searching for class boost::RegEx. + */ + + +#include +#include +#include + +#if defined(__CYGWIN__) || defined(__CYGWIN32__) +#include +#endif + +namespace boost{ + namespace re_detail{ +// start with the operating system specific stuff: + +#if (defined(__BORLANDC__) || defined(FI_WIN32_DIR) || defined(BOOST_MSVC)) && !defined(BOOST_RE_NO_WIN32) + +// platform is DOS or Windows +// directories are separated with '\\' +// and names are insensitive of case + +const char* _fi_sep = "\\"; +const char* _fi_sep_alt = "/"; +#define FI_TRANSLATE(c) std::tolower(c) + +#else + +// platform is not DOS or Windows +// directories are separated with '/' +// and names are sensitive of case + +const char* _fi_sep = "/"; +const char* _fi_sep_alt = _fi_sep; +#define FI_TRANSLATE(c) c + +#endif + +#ifdef FI_WIN32_MAP + +void mapfile::open(const char* file) +{ + BOOST_RE_GUARD_STACK +#if defined(__CYGWIN__)||defined(__CYGWIN32__) + char win32file[ MAX_PATH ]; + cygwin_conv_to_win32_path( file, win32file ); + hfile = CreateFile(win32file, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); +#else + hfile = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); +#endif + if(hfile != INVALID_HANDLE_VALUE) + { + hmap = CreateFileMapping(hfile, NULL, PAGE_READONLY, 0, 0, 0); + if(hmap == INVALID_HANDLE_VALUE) + { + CloseHandle(hfile); + hmap = 0; + hfile = 0; + throw std::runtime_error("Unable to create file mapping."); + } + _first = (const char*)MapViewOfFile(hmap, FILE_MAP_READ, 0, 0, 0); + if(_first == 0) + { + CloseHandle(hmap); + CloseHandle(hfile); + hmap = 0; + hfile = 0; + throw std::runtime_error("Unable to create file mapping."); + } + _last = _first + GetFileSize(hfile, 0); + } + else + { + hfile = 0; + throw std::runtime_error("Unable to open file."); + } +} + +void mapfile::close() +{ + BOOST_RE_GUARD_STACK + if(hfile != INVALID_HANDLE_VALUE) + { + UnmapViewOfFile((void*)_first); + CloseHandle(hmap); + CloseHandle(hfile); + hmap = hfile = 0; + _first = _last = 0; + } +} + +#elif !defined(BOOST_RE_NO_STL) + +mapfile_iterator& mapfile_iterator::operator = (const mapfile_iterator& i) +{ + BOOST_RE_GUARD_STACK + if(file && node) + file->unlock(node); + file = i.file; + node = i.node; + offset = i.offset; + if(file) + file->lock(node); + return *this; +} + +mapfile_iterator& mapfile_iterator::operator++ () +{ + BOOST_RE_GUARD_STACK + if((++offset == mapfile::buf_size) && file) + { + ++node; + offset = 0; + file->lock(node); + file->unlock(node-1); + } + return *this; +} + +mapfile_iterator mapfile_iterator::operator++ (int) +{ + BOOST_RE_GUARD_STACK + mapfile_iterator temp(*this); + if((++offset == mapfile::buf_size) && file) + { + ++node; + offset = 0; + file->lock(node); + file->unlock(node-1); + } + return temp; +} + +mapfile_iterator& mapfile_iterator::operator-- () +{ + BOOST_RE_GUARD_STACK + if((offset == 0) && file) + { + --node; + offset = mapfile::buf_size - 1; + file->lock(node); + file->unlock(node + 1); + } + else + --offset; + return *this; +} + +mapfile_iterator mapfile_iterator::operator-- (int) +{ + BOOST_RE_GUARD_STACK + mapfile_iterator temp(*this); + if((offset == 0) && file) + { + --node; + offset = mapfile::buf_size - 1; + file->lock(node); + file->unlock(node + 1); + } + else + --offset; + return temp; +} + +mapfile_iterator operator + (const mapfile_iterator& i, long off) +{ + BOOST_RE_GUARD_STACK + mapfile_iterator temp(i); + temp += off; + return temp; +} + +mapfile_iterator operator - (const mapfile_iterator& i, long off) +{ + BOOST_RE_GUARD_STACK + mapfile_iterator temp(i); + temp -= off; + return temp; +} + +mapfile::iterator mapfile::begin()const +{ + BOOST_RE_GUARD_STACK + return mapfile_iterator(this, 0); +} + +mapfile::iterator mapfile::end()const +{ + BOOST_RE_GUARD_STACK + return mapfile_iterator(this, _size); +} + +void mapfile::lock(pointer* node)const +{ + BOOST_RE_GUARD_STACK + assert(node >= _first); + assert(node <= _last); + if(node < _last) + { + if(*node == 0) + { + if(condemed.empty()) + { + *node = new char[sizeof(int) + buf_size]; + *((int*)(*node)) = 1; + } + else + { + pointer* p = condemed.front(); + condemed.pop_front(); + *node = *p; + *p = 0; + *((int*)(*node)) = 1; + } + std::fseek(hfile, (node - _first) * buf_size, SEEK_SET); + if(node == _last - 1) + std::fread(*node + sizeof(int), _size % buf_size, 1, hfile); + else + std::fread(*node + sizeof(int), buf_size, 1, hfile); + } + else + { + if(*((int*)(*node)) == 0) + { + *((int*)(*node)) = 1; + condemed.remove(node); + } + else + ++(*((int*)(*node))); + } + } +} + +void mapfile::unlock(pointer* node)const +{ + BOOST_RE_GUARD_STACK + assert(node >= _first); + assert(node <= _last); + if(node < _last) + { + if(--(*((int*)(*node))) == 0) + { + condemed.push_back(node); + } + } +} + +long int get_file_length(FILE* hfile) +{ + BOOST_RE_GUARD_STACK + long int result; + std::fseek(hfile, 0, SEEK_END); + result = std::ftell(hfile); + std::fseek(hfile, 0, SEEK_SET); + return result; +} + + +void mapfile::open(const char* file) +{ + BOOST_RE_GUARD_STACK + hfile = std::fopen(file, "rb"); + try{ + if(hfile != 0) + { + _size = get_file_length(hfile); + long cnodes = (_size + buf_size - 1) / buf_size; + + // check that number of nodes is not too high: + if(cnodes > (long)((INT_MAX) / sizeof(pointer*))) + { + std::fclose(hfile); + hfile = 0; + _size = 0; + return; + } + + _first = new pointer[(int)cnodes]; + _last = _first + cnodes; + std::memset(_first, 0, cnodes*sizeof(pointer)); + } + else + { + throw std::runtime_error("Unable to open file."); + } + }catch(...) + { close(); throw; } +} + +void mapfile::close() +{ + BOOST_RE_GUARD_STACK + if(hfile != 0) + { + pointer* p = _first; + while(p != _last) + { + if(*p) + delete[] *p; + ++p; + } + delete[] _first; + _size = 0; + _first = _last = 0; + std::fclose(hfile); + hfile = 0; + condemed.erase(condemed.begin(), condemed.end()); + } +} + + +#endif + + +file_iterator::file_iterator() +{ + BOOST_RE_GUARD_STACK + _root = _path = 0; + ref = 0; + try{ + _root = new char[MAX_PATH]; + _path = new char[MAX_PATH]; + ptr = _path; + *_path = 0; + *_root = 0; + ref = new file_iterator_ref(); + ref->hf = _fi_invalid_handle; + ref->count = 1; + } + catch(...) + { + delete[] _root; + delete[] _path; + delete ref; + throw; + } +} + +file_iterator::file_iterator(const char* wild) +{ + BOOST_RE_GUARD_STACK + _root = _path = 0; + ref = 0; + try{ + _root = new char[MAX_PATH]; + _path = new char[MAX_PATH]; + std::strcpy(_root, wild); + ptr = _root; + while(*ptr)++ptr; + while((ptr > _root) && (*ptr != *_fi_sep) && (*ptr != *_fi_sep_alt))--ptr; + #if 0 + *ptr = 0; + std::strcpy(_path, _root); + if(*_path == 0) + std::strcpy(_path, "."); + std::strcat(_path, _fi_sep); + ptr = _path + std::strlen(_path); + #else + if((ptr == _root) && ( (*ptr== *_fi_sep) || (*ptr==*_fi_sep_alt) ) ) + { + _root[1]='\0'; + std::strcpy(_path, _root); + ptr = _path + std::strlen(_path); + } + else + { + *ptr = 0; + std::strcpy(_path, _root); + if(*_path == 0) + std::strcpy(_path, "."); + std::strcat(_path, _fi_sep); + ptr = _path + std::strlen(_path); + } + #endif + + ref = new file_iterator_ref(); + ref->hf = FindFirstFile(wild, &(ref->_data)); + ref->count = 1; + + if(ref->hf == _fi_invalid_handle) + { + *_path = 0; + ptr = _path; + } + else + { + std::strcpy(ptr, ref->_data.cFileName); + if(ref->_data.dwFileAttributes & _fi_dir) + next(); + } + } + catch(...) + { + delete[] _root; + delete[] _path; + delete ref; + throw; + } +} + +file_iterator::file_iterator(const file_iterator& other) +{ + BOOST_RE_GUARD_STACK + _root = _path = 0; + ref = 0; + try{ + _root = new char[MAX_PATH]; + _path = new char[MAX_PATH]; + std::strcpy(_root, other._root); + std::strcpy(_path, other._path); + ptr = _path + (other.ptr - other._path); + ref = other.ref; + } + catch(...) + { + delete[] _root; + delete[] _path; + throw; + } + ++(ref->count); +} + +file_iterator& file_iterator::operator=(const file_iterator& other) +{ + BOOST_RE_GUARD_STACK + std::strcpy(_root, other._root); + std::strcpy(_path, other._path); + ptr = _path + (other.ptr - other._path); + if(--(ref->count) == 0) + { + if(ref->hf != _fi_invalid_handle) + FindClose(ref->hf); + delete ref; + } + ref = other.ref; + ++(ref->count); + return *this; +} + + +file_iterator::~file_iterator() +{ + BOOST_RE_GUARD_STACK + delete[] _root; + delete[] _path; + if(--(ref->count) == 0) + { + if(ref->hf != _fi_invalid_handle) + FindClose(ref->hf); + delete ref; + } +} + +file_iterator file_iterator::operator++(int) +{ + BOOST_RE_GUARD_STACK + file_iterator temp(*this); + next(); + return temp; +} + + +void file_iterator::next() +{ + BOOST_RE_GUARD_STACK + if(ref->hf != _fi_invalid_handle) + { + bool cont = true; + while(cont) + { + cont = FindNextFile(ref->hf, &(ref->_data)); + if(cont && ((ref->_data.dwFileAttributes & _fi_dir) == 0)) + break; + } + if(!cont) + { + // end of sequence + FindClose(ref->hf); + ref->hf = _fi_invalid_handle; + *_path = 0; + ptr = _path; + } + else + std::strcpy(ptr, ref->_data.cFileName); + } +} + + + +directory_iterator::directory_iterator() +{ + BOOST_RE_GUARD_STACK + _root = _path = 0; + ref = 0; + try{ + _root = new char[MAX_PATH]; + _path = new char[MAX_PATH]; + ptr = _path; + *_path = 0; + *_root = 0; + ref = new file_iterator_ref(); + ref->hf = _fi_invalid_handle; + ref->count = 1; + } + catch(...) + { + delete[] _root; + delete[] _path; + delete ref; + throw; + } +} + +directory_iterator::directory_iterator(const char* wild) +{ + BOOST_RE_GUARD_STACK + _root = _path = 0; + ref = 0; + try{ + _root = new char[MAX_PATH]; + _path = new char[MAX_PATH]; + std::strcpy(_root, wild); + ptr = _root; + while(*ptr)++ptr; + while((ptr > _root) && (*ptr != *_fi_sep) && (*ptr != *_fi_sep_alt))--ptr; + #if 0 + *ptr = 0; + std::strcpy(_path, _root); + if(*_path == 0) + std::strcpy(_path, "."); + std::strcat(_path, _fi_sep); + ptr = _path + std::strlen(_path); + #else + if((ptr == _root) && ( (*ptr== *_fi_sep) || (*ptr==*_fi_sep_alt) ) ) + { + _root[1]='\0'; + std::strcpy(_path, _root); + ptr = _path + std::strlen(_path); + } + else + { + *ptr = 0; + std::strcpy(_path, _root); + if(*_path == 0) + std::strcpy(_path, "."); + std::strcat(_path, _fi_sep); + ptr = _path + std::strlen(_path); + } + #endif + ref = new file_iterator_ref(); + ref->count = 1; + ref->hf = FindFirstFile(wild, &(ref->_data)); + if(ref->hf == _fi_invalid_handle) + { + *_path = 0; + ptr = _path; + } + else + { + std::strcpy(ptr, ref->_data.cFileName); + if(((ref->_data.dwFileAttributes & _fi_dir) == 0) || (std::strcmp(ref->_data.cFileName, ".") == 0) || (std::strcmp(ref->_data.cFileName, "..") == 0)) + next(); + } + } + catch(...) + { + delete[] _root; + delete[] _path; + delete ref; + throw; + } +} + +directory_iterator::~directory_iterator() +{ + BOOST_RE_GUARD_STACK + delete[] _root; + delete[] _path; + if(--(ref->count) == 0) + { + if(ref->hf != _fi_invalid_handle) + FindClose(ref->hf); + delete ref; + } +} + +directory_iterator::directory_iterator(const directory_iterator& other) +{ + BOOST_RE_GUARD_STACK + _root = _path = 0; + ref = 0; + try{ + _root = new char[MAX_PATH]; + _path = new char[MAX_PATH]; + std::strcpy(_root, other._root); + std::strcpy(_path, other._path); + ptr = _path + (other.ptr - other._path); + ref = other.ref; + } + catch(...) + { + delete[] _root; + delete[] _path; + throw; + } + ++(ref->count); +} + +directory_iterator& directory_iterator::operator=(const directory_iterator& other) +{ + BOOST_RE_GUARD_STACK + std::strcpy(_root, other._root); + std::strcpy(_path, other._path); + ptr = _path + (other.ptr - other._path); + if(--(ref->count) == 0) + { + if(ref->hf != _fi_invalid_handle) + FindClose(ref->hf); + delete ref; + } + ref = other.ref; + ++(ref->count); + return *this; +} + +directory_iterator directory_iterator::operator++(int) +{ + BOOST_RE_GUARD_STACK + directory_iterator temp(*this); + next(); + return temp; +} + +void directory_iterator::next() +{ + BOOST_RE_GUARD_STACK + if(ref->hf != _fi_invalid_handle) + { + bool cont = true; + while(cont) + { + cont = FindNextFile(ref->hf, &(ref->_data)); + if(cont && (ref->_data.dwFileAttributes & _fi_dir)) + { + if(std::strcmp(ref->_data.cFileName, ".") && std::strcmp(ref->_data.cFileName, "..")) + break; + } + } + if(!cont) + { + // end of sequence + FindClose(ref->hf); + ref->hf = _fi_invalid_handle; + *_path = 0; + ptr = _path; + } + else + std::strcpy(ptr, ref->_data.cFileName); + } +} + + +#ifdef FI_POSIX_DIR + +struct _fi_priv_data +{ + char root[MAX_PATH]; + char* mask; + DIR* d; + _fi_priv_data(const char* p); +}; + +_fi_priv_data::_fi_priv_data(const char* p) +{ + BOOST_RE_GUARD_STACK + std::strcpy(root, p); + mask = root; + while(*mask) ++mask; + while((mask > root) && (*mask != *_fi_sep) && (*mask != *_fi_sep_alt)) --mask; + if(mask == root && ((*mask== *_fi_sep) || (*mask == *_fi_sep_alt)) ) + { + root[1] = '\0'; + std::strcpy(root+2, p+1); + mask = root+2; + } + else if(mask == root) + { + root[0] = '.'; + root[1] = '\0'; + std::strcpy(root+2, p); + mask = root+2; + } + else + { + *mask = 0; + ++mask; + } +} + +bool iswild(const char* mask, const char* name) +{ + BOOST_RE_GUARD_STACK + while(*mask && *name) + { + switch(*mask) + { + case '?': + ++name; + ++mask; + continue; + case '*': + ++mask; + if(*mask == 0) + return true; + while(*name) + { + if(iswild(mask, name)) + return true; + ++name; + } + return false; + case '.': + if(0 == *name) + { + ++mask; + continue; + } + // fall through: + default: + if(FI_TRANSLATE(*mask) != FI_TRANSLATE(*name)) + return false; + ++mask; + ++name; + continue; + } + } + if(*mask != *name) + return false; + return true; +} + +unsigned _fi_attributes(const char* root, const char* name) +{ + BOOST_RE_GUARD_STACK + char buf[MAX_PATH]; + if( ( (root[0] == *_fi_sep) || (root[0] == *_fi_sep_alt) ) && (root[1] == '\0') ) + std::sprintf(buf, "%s%s", root, name); + else + std::sprintf(buf, "%s%s%s", root, _fi_sep, name); + DIR* d = opendir(buf); + if(d) + { + closedir(d); + return _fi_dir; + } + return 0; +} + +_fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData) +{ + BOOST_RE_GUARD_STACK + _fi_find_handle dat = new _fi_priv_data(lpFileName); + + DIR* h = opendir(dat->root); + dat->d = h; + if(h != NULL) + { + if(_fi_FindNextFile(dat, lpFindFileData)) + return dat; + } + delete dat; + return NULL; +} + +bool _fi_FindNextFile(_fi_find_handle dat, _fi_find_data* lpFindFileData) +{ + BOOST_RE_GUARD_STACK + dirent* d; + do + { + d = readdir(dat->d); + } while(d && !iswild(dat->mask, d->d_name)); + + if(d) + { + std::strcpy(lpFindFileData->cFileName, d->d_name); + lpFindFileData->dwFileAttributes = _fi_attributes(dat->root, d->d_name); + return true; + } + return false; +} + +bool _fi_FindClose(_fi_find_handle dat) +{ + BOOST_RE_GUARD_STACK + closedir(dat->d); + delete dat; + return true; +} + +#endif + +} // namespace re_detail +} // namspace boost + + + + + + + + + diff --git a/src/posix_api.cpp b/src/posix_api.cpp new file mode 100644 index 00000000..f3f8170a --- /dev/null +++ b/src/posix_api.cpp @@ -0,0 +1,220 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE: posix_api.cpp + * VERSION: 3.00 + * DESCRIPTION: Implements the Posix API wrappers. + */ + +#include +#include + +namespace boost{ + +namespace{ + +unsigned int magic_value = 25631; + +const char* names[] = {"REG_NOERROR", "REG_NOMATCH", "REG_BADPAT", "REG_ECOLLATE", + "REG_ECTYPE", "REG_EESCAPE", "REG_ESUBREG", "REG_EBRACK", + "REG_EPAREN", "REG_EBRACE", "REG_BADBR", "REG_ERANGE", + "REG_ESPACE", "REG_BADRPT", "REG_EMPTY", "REG_E_UNKNOWN"}; +} // namespace + +BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompA(regex_tA* expression, const char* ptr, int f) +{ + BOOST_RE_GUARD_STACK + if(expression->re_magic != magic_value) + { + expression->guts = 0; + try{ + expression->guts = new regex(); + } catch(...) + { + delete (regex*)(expression->guts); + return REG_ESPACE; + } + } + // set default flags: + jm_uintfast32_t flags = (f & REG_EXTENDED) ? regbase::extended : regbase::basic; + expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : 0; + // and translate those that are actually set: + + if(f & REG_NOCOLLATE) + flags |= regbase::nocollate; + + if(f & REG_NOSUB) + expression->eflags |= match_any; + + if(f & REG_NOSPEC) + flags |= regbase::literal; + if(f & REG_ICASE) + flags |= regbase::icase; + if(f & REG_ESCAPE_IN_LISTS) + flags |= regbase::escape_in_lists; + if(f & REG_NEWLINE_ALT) + flags |= regbase::newline_alt; + + const char* p2; + if(f & REG_PEND) + p2 = expression->re_endp; + else p2 = ptr + std::strlen(ptr); + + int result; + + 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(); + } catch(...) + { + result = REG_E_UNKNOWN; + } + if(result) + regfreeA(expression); + return result; + +} + +BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorA(int code, const regex_tA* e, char* buf, unsigned int buf_size) +{ + BOOST_RE_GUARD_STACK + unsigned int result = 0; + if(code & REG_ITOA) + { + code &= ~REG_ITOA; + if(code <= REG_E_UNKNOWN) + { + result = std::strlen(names[code]) + 1; + if(buf_size >= result) + std::strcpy(buf, names[code]); + return result; + } + return result; + } + if(code == REG_ATOI) + { + char localbuf[5]; + if(e == 0) + return 0; + for(int i = 0; i <= REG_E_UNKNOWN; ++i) + { + if(std::strcmp(e->re_endp, names[i]) == 0) + { + std::sprintf(localbuf, "%d", i); + if(std::strlen(localbuf) < buf_size) + std::strcpy(buf, localbuf); + return std::strlen(localbuf) + 1; + } + } + std::sprintf(localbuf, "%d", 0); + if(std::strlen(localbuf) < buf_size) + std::strcpy(buf, localbuf); + return std::strlen(localbuf) + 1; + } + if(code <= REG_E_UNKNOWN) + { + std::string p; + if((e) && (e->re_magic == magic_value)) + p = ((regex*)(e->guts))->get_traits().error_string(code); + else + { + boost::regex_traits t; + p = t.error_string(code); + } + unsigned int len = p.size(); + if(len < buf_size) + { + std::strcpy(buf, p.c_str()); + } + return len + 1; + } + if(buf_size) + *buf = 0; + return 0; +} + +BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecA(const regex_tA* expression, const char* buf, unsigned int n, regmatch_t* array, int eflags) +{ + BOOST_RE_GUARD_STACK + bool result = false; + jm_uintfast32_t flags = match_default | expression->eflags; + const char* end; + const char* start; + cmatch m; + + if(eflags & REG_NOTBOL) + flags |= match_not_bol; + if(eflags & REG_NOTEOL) + flags |= match_not_eol; + if(eflags & REG_STARTEND) + { + start = buf + array[0].rm_so; + end = buf + array[0].rm_eo; + } + else + { + start = buf; + end = buf + std::strlen(buf); + } + + try{ + if(expression->re_magic == magic_value) + { + result = regex_search(start, end, m, *(regex*)(expression->guts), flags); + } + else + return result; + } catch(...) + { + return REG_E_UNKNOWN; + } + + if(result) + { + // extract what matched: + unsigned int i; + for(i = 0; (i < n) && (i < expression->re_nsub + 1); ++i) + { + array[i].rm_so = (m[i].matched == false) ? -1 : (m[i].first - buf); + array[i].rm_eo = (m[i].matched == false) ? -1 : (m[i].second - buf); + } + // and set anything else to -1: + for(i = expression->re_nsub + 1; i < n; ++i) + { + array[i].rm_so = -1; + array[i].rm_eo = -1; + } + return 0; + } + return REG_NOMATCH; +} + +BOOST_RE_IX_DECL void BOOST_RE_CCALL regfreeA(regex_tA* expression) +{ + BOOST_RE_GUARD_STACK + if(expression->re_magic == magic_value) + { + delete (regex*)(expression->guts); + } + expression->re_magic = 0; +} + +} // namespace boost + + diff --git a/src/primary_transform.hpp b/src/primary_transform.hpp new file mode 100644 index 00000000..2c3ab363 --- /dev/null +++ b/src/primary_transform.hpp @@ -0,0 +1,118 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE: primary_transform.hpp + * VERSION: 3.00 + * DESCRIPTION: Heuristically determines the sort string format in use + * by the current locale. + */ + +namespace boost{ + namespace re_detail{ + + +enum{ + sort_C, + sort_fixed, + sort_delim, + sort_unknown +}; + +template +unsigned count_chars(const S& s, charT c) +{ + unsigned int count = 0; + for(unsigned pos = 0; pos <= s.size(); ++pos) + { + if(s[pos] == c) ++count; + } + return count; +} + + +template +unsigned find_sort_syntax(const traits* pt, charT* delim) +{ + // + // compare 'a' with 'A' to see how similar they are, + // should really use a-accute but we can't portably do that, + // + typedef typename traits::string_type string_type; + typedef typename traits::char_type char_type; + + // Suppress incorrect warning for MSVC + (void)pt; + + string_type a(1, (char_type)'a'); + string_type sa; + pt->transform(sa, a); + if(sa == a) + { + *delim = 0; + return sort_C; + } + string_type A(1, (char_type)'A'); + string_type sA; + pt->transform(sA, A); + string_type c(1, (char_type)';'); + string_type sc; + pt->transform(sc, c); + + int pos = 0; + while((pos <= static_cast(sa.size())) && (pos <= static_cast(sA.size())) && (sa[pos] == sA[pos])) ++pos; + --pos; + if(pos < 0) + { + *delim = 0; + return sort_unknown; + } + // + // at this point sa[pos] is either the end of a fixed with field + // or the character that acts as a delimiter: + // + charT maybe_delim = sa[pos]; + if((pos != 0) && (count_chars(sa, maybe_delim) == count_chars(sA, maybe_delim)) && (count_chars(sa, maybe_delim) == count_chars(c, maybe_delim))) + { + *delim = maybe_delim; + return sort_delim; + } + // + // OK doen't look like a delimiter, try for fixed width field: + // + if((sa.size() == sA.size()) && (sa.size() == c.size())) + { + // note assumes that the fixed width field is less than + // numeric_limits::max(), should be true for all types + // I can't imagine 127 character fields... + *delim = static_cast(++pos); + return sort_fixed; + } + // + // don't know what it is: + // + *delim = 0; + return sort_unknown; +} + + + } // namespace re_detail +} // namespace boost + + + + + diff --git a/src/regex.cpp b/src/regex.cpp new file mode 100644 index 00000000..01c4ad3f --- /dev/null +++ b/src/regex.cpp @@ -0,0 +1,59 @@ +/* + * + * Copyright (c) 1998-200 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE: regex.cpp + * VERSION: 3.00 + * DESCRIPTION: Misc boost::regbase member funnctions. + */ + + +#include + + +namespace boost{ + + +// +// fix: these are declared out of line here to ensure +// that dll builds contain the Virtual table for these +// types - this ensures that exceptions can be thrown +// from the dll and caught in an exe. +bad_pattern::~bad_pattern(){} +bad_expression::~bad_expression(){} + +regbase::regbase() + : _flags(regbase::failbit){} + +regbase::regbase(const regbase& b) + : _flags(b._flags){} + +} // namespace boost + +#if defined(BOOST_RE_USE_VCL) && defined(BOOST_RE_BUILD_DLL) + +int WINAPI DllEntryPoint(HINSTANCE , unsigned long , void*) +{ + return 1; +} +#endif + + + + + + + diff --git a/src/regex_debug.cpp b/src/regex_debug.cpp new file mode 100644 index 00000000..5d898398 --- /dev/null +++ b/src/regex_debug.cpp @@ -0,0 +1,198 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE: regex_debug.cpp + * VERSION: 3.00 + * DESCRIPTION: Misc. debugging helpers. + */ + + +#include +#include + +#ifdef BOOST_MSVC +#include +#endif + +#ifdef BOOST_RE_DEBUG + +namespace { + +char b1[32] = {0,}; +char guard_pattern[32] += { 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, }; +char b2[32] = {0,}; + +static const int guard_size = 32; + +bool check_pattern(void* p) +{ + return p ? memcmp(p, guard_pattern, guard_size) : 0; +} + +inline unsigned maxi(unsigned i, unsigned j) +{ + return i < j ? j : i; +} + +unsigned int allocated = 0; + +struct init +{ + init(); + ~init(); +}; + +init::init() +{ +#ifdef BOOST_MSVC + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_DELAY_FREE_MEM_DF|_CRTDBG_LEAK_CHECK_DF); +#endif +} + +init::~init() +{ +} + + +init i; + +void* get_mem(size_t n) +{ + ++allocated; + char* p = (char*)malloc(n + guard_size * 2 + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size) + boost::re_detail::padding_size); + char* base = p; + p = (char*)((std::ptrdiff_t)(p + boost::re_detail::padding_mask) & ~boost::re_detail::padding_mask); + std::memcpy(p + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size), guard_pattern, guard_size); + std::memcpy(p + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size) + guard_size + n, guard_pattern, guard_size); + *(int*)p = n; + *(void**)(p + sizeof(int)) = base; + return p + guard_size + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size); +} + +void free_mem(void* b) +{ + if(b) + { + char* p = (char*)b; + p -= (guard_size + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size)); + if(check_pattern(p + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size)) || check_pattern(p + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size) + guard_size + *(int*)p)) + { + cerr << "Error: freed memory has been written past end..." << endl; + } + free(*(void**)(p + sizeof(int))); + --allocated; + } +} + +} // namespace + +void* operator new(size_t n) +{ + return get_mem(n); +} + +void* operator new[](size_t n) +{ + return get_mem(n); +} + +void operator delete(void* p) +{ + free_mem(p); +} + +void operator delete[](void* p) +{ + free_mem(p); +} + +#include + +namespace boost{ + namespace re_detail{ + +std::set >* patterns = 0; + +int pattern_count = 0; + +void check_patterns(const char* f, int l) +{ + if(pattern_count) + { + std::set >::iterator i, j; + i = patterns->begin(); + j = patterns->end(); + while(i != j) + { + if(check_pattern((void*)(*i)->g1) || check_pattern((*i)->g2) || check_pattern((void*)(*i)->pc) || check_pattern((*i)->pnc)) + { + cerr << "Error: static memory corruption at " << hex << *i << dec << " in " << (*i)->file << "@" << (*i)->line << " called from " << f << "@" << l << endl; + } + ++i; + } + } +} + +debug_guard::debug_guard(const char* f, int l, const char* p1, char* p2) +{ + if(++pattern_count == 1) + patterns = new std::set >; + file = f; + line = l; + std::memcpy(g1, guard_pattern, guard_size); + std::memcpy(g2, guard_pattern, guard_size); + if(p1) + { + pc = p1; + } + else + pc = 0; + if(p2) + { + pnc = p2; + std::memcpy(pnc, guard_pattern, guard_size); + } + else + pnc = 0; + patterns->insert(this); +} + +debug_guard::~debug_guard() +{ + check_patterns(file, line); + if(check_pattern(g1) || check_pattern(g2)) + { + cerr << "Error: memory corruption " << file << "@" << line << endl; + } + patterns->erase(this); + if(--pattern_count == 0) + { + delete patterns; + patterns = 0; + } +} + + } // namespace re_detail + +} // namespace boost + + + +#endif + diff --git a/src/regex_synch.cpp b/src/regex_synch.cpp new file mode 100644 index 00000000..a2ae33f6 --- /dev/null +++ b/src/regex_synch.cpp @@ -0,0 +1,64 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE: regex_synch.cpp + * VERSION: 3.00 + * DESCRIPTION: Thread synch helper functions, for regular + * expression library. + */ +#include + +namespace boost{ + namespace re_detail{ + +void BOOST_RE_CALL re_init_threads() +{ + BOOST_RE_GUARD_STACK +#ifdef BOOST_RE_THREADS + if(p_re_lock == 0) + p_re_lock = new critical_section(); + cs_guard g(*p_re_lock); + ++re_lock_count; +#endif +} + +void BOOST_RE_CALL re_free_threads() +{ + BOOST_RE_GUARD_STACK +#ifdef BOOST_RE_THREADS + cs_guard g(*p_re_lock); + --re_lock_count; + if(re_lock_count == 0) + { + g.acquire(false); + delete p_re_lock; + p_re_lock = 0; + } +#endif +} + +#ifdef BOOST_RE_THREADS + +BOOST_RE_IX_DECL critical_section* p_re_lock = 0; + +BOOST_RE_IX_DECL unsigned int re_lock_count = 0; + +#endif + + } // namespace re_detail +} // namespace boost + diff --git a/src/w32_regex_traits.cpp b/src/w32_regex_traits.cpp new file mode 100644 index 00000000..1b5fe881 --- /dev/null +++ b/src/w32_regex_traits.cpp @@ -0,0 +1,1065 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE: w32_regex_traits.cpp + * VERSION: 3.00 + * DESCRIPTION: Implements the w32_regex_traits traits class + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) && !defined(BOOST_RE_NO_W32) + +namespace{ + +// +// character classes: + +jm_uintfast32_t re_char_class_id[] = { + boost::re_detail::w32_traits_base::char_class_alnum, + boost::re_detail::w32_traits_base::char_class_alpha, + boost::re_detail::w32_traits_base::char_class_cntrl, + boost::re_detail::w32_traits_base::char_class_digit, + boost::re_detail::w32_traits_base::char_class_graph, + boost::re_detail::w32_traits_base::char_class_lower, + boost::re_detail::w32_traits_base::char_class_print, + boost::re_detail::w32_traits_base::char_class_punct, + boost::re_detail::w32_traits_base::char_class_space, + boost::re_detail::w32_traits_base::char_class_upper, + boost::re_detail::w32_traits_base::char_class_xdigit, + boost::re_detail::w32_traits_base::char_class_blank, + boost::re_detail::w32_traits_base::char_class_word, + boost::re_detail::w32_traits_base::char_class_unicode, +}; + +const char* re_char_class_names[] = { +"alnum", +"alpha", +"cntrl", +"digit", +"graph", +"lower", +"print", +"punct", +"space", +"upper", +"xdigit", +"blank", +"word", +"unicode", +}; + +std::string* pclasses = 0; +const unsigned int re_classes_max = 14; + +// +// collate names: + +struct collate_name_t +{ + std::string name; + std::string value; + collate_name_t(){} + collate_name_t(const char* p1, const char* p2, const char* p3, const char* p4) + : name(p1, p2), value(p3, p4) {} +}; + +std::list* pcoll_names = 0; + +// +// message handling: +#ifndef BOOST_RE_MESSAGE_BASE +#define BOOST_RE_MESSAGE_BASE 0 +#endif + +HINSTANCE hresmod = 0; + +BOOST_RE_IX_DECL char* re_custom_error_messages[] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +}; + +char re_zero; +char re_ten; + +unsigned int entry_count = 0; +bool is_init = false; + +enum syntax_map_size +{ + map_size = UCHAR_MAX + 1 +}; + +#ifndef BOOST_RE_NO_WCSTRING + +BOOST_RE_IX_DECL wchar_t re_zero_w; +BOOST_RE_IX_DECL wchar_t re_ten_w; + +bool isPlatformNT = false; + +struct syntax_map_t +{ + wchar_t c; + unsigned int type; +}; + +std::list* syntax; + +#endif + +unsigned int BOOST_RE_CALL _re_get_message(char* buf, unsigned int len, unsigned int id); + +template +unsigned int BOOST_RE_CALL get_message(charT* buf, unsigned int len, unsigned int id) +{ + unsigned int size = _re_get_message((char*)0, 0, id); + if(len < size) + return size; + boost::scoped_array cb(new char[size]); + _re_get_message(cb.get(), size, id); + size = boost::w32_regex_traits::strwiden(buf, len, cb.get()); + return size; +} + +inline unsigned int BOOST_RE_CALL get_message(char* buf, unsigned int len, unsigned int id) +{ + return _re_get_message(buf, len, id); +} + +unsigned int BOOST_RE_CALL _re_get_message(char* buf, unsigned int len, unsigned int id) +{ + BOOST_RE_GUARD_STACK + // get the customised message if any: + if(len < 255) + return 255; + unsigned int size = 0; + if(hresmod) + size = LoadStringA(hresmod, BOOST_RE_MESSAGE_BASE + id, buf, 255); + if(size) + return size; + + // + // now get the default message if any: + return boost::re_detail::re_get_default_message(buf, len, id); +} + +const char* BOOST_RE_CALL re_get_error_str(unsigned int id) +{ + BOOST_RE_GUARD_STACK +#ifdef BOOST_RE_THREADS + boost::re_detail::cs_guard g(*boost::re_detail::p_re_lock); +#endif + if(re_custom_error_messages[id] == 0) + { + char buf[256]; + _re_get_message(buf, 256, id + 200); + if(*buf) + { + re_custom_error_messages[id] = boost::re_detail::re_strdup(buf); + return re_custom_error_messages[id]; + } + return boost::re_detail::re_default_error_messages[id]; + } + return re_custom_error_messages[id]; +} + +} // namespace + +namespace boost{ + +namespace re_detail{ + +char w32_traits_base::regex_message_catalogue[200] = {0}; + +void BOOST_RE_CALL w32_traits_base::do_init() +{ + BOOST_RE_GUARD_STACK + if(is_init == 0) + { + // + // upadte the messages first: + is_init = true; + if(*regex_message_catalogue) + hresmod = LoadLibraryA(regex_message_catalogue); + unsigned int i; + for(i = 0; i < REG_E_UNKNOWN; ++i) + { + if(re_custom_error_messages[i]) + { + re_detail::re_strfree(re_custom_error_messages[i]); + re_custom_error_messages[i] = 0; + } + } +#ifndef BOOST_RE_NO_WCSTRING + // + // wide character strings: + syntax = new std::list(); + OSVERSIONINFO VersionInformation = {0}; + VersionInformation.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&VersionInformation); + if(VersionInformation.dwPlatformId == VER_PLATFORM_WIN32_NT) + isPlatformNT = true; +#endif + // + // now the character classes: + pclasses = new std::string[re_classes_max]; + char buf[map_size+2]; + for(i = 0; i < re_classes_max; ++i) + { + get_message(buf, 256, i+300); + pclasses[i] = buf; + } + // start by updating the syntax map: + std::memset(syntax_map, syntax_char, map_size); + for(i = 1; i < syntax_max; ++i) + { + char* ptr = buf; + get_message(buf, map_size, i+100); + for(; *ptr; ++ptr) + { + syntax_map[(unsigned char)*ptr] = (unsigned char)i; + } + } + + // now update the character class map, + // and lower case map: + for(i = 0; i < map_size; ++i) + { + buf[i] = (char)i; + } + buf[map_size] = (char)0; + GetStringTypeA(GetUserDefaultLCID(), CT_CTYPE1, buf, map_size, class_map); + class_map['_'] |= char_class_underscore; + LCMapStringA(GetUserDefaultLCID(), LCMAP_LOWERCASE, buf, map_size, lower_case_map, map_size); + // + // update our collating elements: + pcoll_names = new std::list(); + i = 400; + get_message(buf, 256, i); + while(*buf) + { + char* p1, *p2, *p3, *p4;; + p1 = buf; + while(*p1 && isspace(*p1))++p1; + p2 = p1; + while(*p2 && !isspace(*p2))++p2; + p3 = p2; + while(*p3 && isspace(*p3))++p3; + p4 = p3; + while(*p4 && !isspace(*p4))++p4; + pcoll_names->push_back(collate_name_t(p1, p2, p3, p4)); + ++i; + get_message(buf, 256, i); + } + std::string s; + const char* p = "zero"; + if(w32_regex_traits::lookup_collatename(s, p, p+4)) + { + jm_assert(s.size() == 1); + re_zero = *s.c_str(); + } + else + re_zero = '0'; + + p = "ten"; + if(w32_regex_traits::lookup_collatename(s, p, p+3)) + { + jm_assert(s.size() == 1); + re_ten = *s.c_str(); + } + else + re_ten = 'a'; +#ifndef BOOST_RE_NO_WCSTRING + // + // wide string data: + std::basic_string ws; + const wchar_t* wp = L"zero"; + if(w32_regex_traits::lookup_collatename(ws, wp, wp+4)) + { + jm_assert(ws.size() == 1); + re_zero_w = *ws.c_str(); + } + else + re_zero_w = L'0'; + + wp = L"ten"; + if(w32_regex_traits::lookup_collatename(ws, wp, wp+3)) + { + jm_assert(ws.size() == 1); + re_ten_w = *ws.c_str(); + } + else + re_ten_w = L'a'; + + wchar_t wbuf[256]; + syntax_map_t sm; + syntax->clear(); + for(i = 1; i < syntax_max; ++i) + { + wchar_t* ptr = wbuf; + get_message(wbuf, 256, i+100); + for(; *ptr; ++ptr) + { + sm.c = *ptr; + sm.type = i; + syntax->push_back(sm); + } + } +#endif // BOOST_RE_NO_WCSTRING + } +} + +void BOOST_RE_CALL w32_traits_base::do_free() +{ + BOOST_RE_GUARD_STACK + delete[] pclasses; + delete pcoll_names; + if(hresmod) + { + FreeLibrary(hresmod); + hresmod = 0; + } + for(int i = 0; i < REG_E_UNKNOWN; ++i) + { + if(re_custom_error_messages[i]) + { + re_detail::re_strfree(re_custom_error_messages[i]); + re_custom_error_messages[i] = 0; + } + } +} + +std::string w32_traits_base::error_string(unsigned id) +{ + return re_get_error_str(id); +} + +jm_uintfast32_t BOOST_RE_CALL w32_traits_base::do_lookup_class(const char* p) +{ + BOOST_RE_GUARD_STACK + unsigned int i; + for(i = 0; i < re_classes_max; ++i) + { + if(pclasses[i] == p) + { + return re_char_class_id[i]; + } + } + for(i = 0; i < re_classes_max; ++i) + { + if(std::strcmp(re_char_class_names[i], p) == 0) + { + return re_char_class_id[i]; + } + } + return 0; +} + +bool BOOST_RE_CALL w32_traits_base::do_lookup_collate(std::string& buf, const char* p) +{ + BOOST_RE_GUARD_STACK + std::list::iterator first, last; + first = pcoll_names->begin(); + last = pcoll_names->end(); + while(first != last) + { + if((*first).name == p) + { + buf = (*first).value; + return true; + } + ++first; + } + + bool result = re_detail::re_lookup_def_collate_name(buf, p); + if((result == 0) && (std::strlen(p) == 1)) + { + result = true; + buf = *p; + } + return result; +} + +std::string w32_traits_base::set_message_catalogue(const std::string& l) +{ + BOOST_RE_GUARD_STACK + #ifdef BOOST_RE_THREADS + re_detail::cs_guard g(*re_detail::p_re_lock); + #endif + if(sizeof(regex_message_catalogue) <= l.size()) + return l; + std::string old(regex_message_catalogue); + std::strcpy(regex_message_catalogue, l.c_str()); + return old; +} + +unsigned char w32_traits_base::syntax_map[map_size]; +unsigned short w32_traits_base::class_map[map_size]; +char w32_traits_base::lower_case_map[map_size]; + +} // namespace re_detail + +w32_regex_traits w32_regex_traits::i; + +void w32_regex_traits::update() +{ + BOOST_RE_GUARD_STACK + #ifdef BOOST_RE_THREADS + re_detail::cs_guard g(*re_detail::p_re_lock); + #endif + do_init(); +} + +w32_regex_traits::w32_regex_traits() +{ + BOOST_RE_GUARD_STACK + #ifdef BOOST_RE_THREADS + re_detail::re_init_threads(); + re_detail::cs_guard g(*re_detail::p_re_lock); + #endif + ++entry_count; +} + +w32_regex_traits::~w32_regex_traits() +{ + BOOST_RE_GUARD_STACK +#ifdef BOOST_RE_THREADS + re_detail::cs_guard g(*re_detail::p_re_lock); +#endif + if(--entry_count == 0) + do_free(); +#ifdef BOOST_RE_THREADS + g.acquire(false); + re_detail::re_free_threads(); +#endif +} + +void BOOST_RE_CALL w32_regex_traits::transform(std::string& out, const std::string& in) +{ + BOOST_RE_GUARD_STACK + size_t n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, 0, 0); + if(n == (size_t)(-1)) + { + out = in; + return; + } + scoped_array buf(new char[n+1]); + n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, buf.get(), n); + if(n == (size_t)(-1)) + { + out = in; + return; + } + out = buf.get(); +} + +void BOOST_RE_CALL w32_regex_traits::transform_primary(std::string& out, const std::string& in) +{ + transform(out, in); + for(unsigned int i = 0; i < out.size(); ++i) + { + if((out[i] == 1) && (i+1 < out.size())) + { + out.erase(i+1); + break; + } + } +} + + +int BOOST_RE_CALL w32_regex_traits::toi(char c) +{ + if(is_class(c, char_class_digit)) + return c - re_zero; + if(is_class(c, char_class_xdigit)) + return 10 + translate(c, true) - translate(re_ten, true); + return -1; // error!! +} + +int BOOST_RE_CALL w32_regex_traits::toi(const char*& first, const char* last, int radix) +{ + unsigned int maxval; + if(radix < 0) + { + // if radix is less than zero, then restrict + // return value to charT. NB assumes sizeof(charT) <= sizeof(int) + radix *= -1; + maxval = 1 << (sizeof(*first) * CHAR_BIT - 1); + maxval /= radix; + maxval *= 2; + maxval -= 1; + } + else + { + maxval = (unsigned int)-1; + maxval /= radix; + } + + unsigned int result = 0; + unsigned int type = (radix > 10) ? char_class_xdigit : char_class_digit; + while((first != last) && is_class(*first, type) && (result <= maxval)) + { + result *= radix; + result += toi(*first); + ++first; + } + return result; +} + +#ifndef BOOST_RE_NO_WCSTRING + +bool BOOST_RE_CALL w32_regex_traits::lookup_collatename(std::basic_string& out, const wchar_t* first, const wchar_t* last) +{ + BOOST_RE_GUARD_STACK + std::basic_string s(first, last); + unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + scoped_array buf(new char[len]); + strnarrow(buf.get(), len, s.c_str()); + std::string t_out; + bool result = re_detail::w32_traits_base::do_lookup_collate(t_out, buf.get()); + if(t_out.size() == 0) result = false; + if(result) + { + if(t_out[0]) + { + len = strwiden((wchar_t*)0, 0, t_out.c_str()); + scoped_array wb(new wchar_t[len]); + strwiden(wb.get(), len, t_out.c_str()); + out = wb.get(); + } + else + out.append(1,(wchar_t)0); + } + return result; +} + +unsigned int BOOST_RE_CALL w32_regex_traits::syntax_type(size_type c) +{ + BOOST_RE_GUARD_STACK + std::list::const_iterator first, last; + first = syntax->begin(); + last = syntax->end(); + while(first != last) + { + if((uchar_type)(*first).c == c) + return (*first).type; + ++first; + } + return 0; +} + +bool BOOST_RE_CALL w32_regex_traits::do_lookup_collate(std::basic_string& out, const wchar_t* first, const wchar_t* last) +{ + BOOST_RE_GUARD_STACK + std::basic_string s(first, last); + unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + scoped_array buf(new char[len]); + strnarrow(buf.get(), len, s.c_str()); + std::string t_out; + bool result = re_detail::w32_traits_base::do_lookup_collate(t_out, buf.get()); + if(result) + { + len = strwiden((wchar_t*)0, 0, t_out.c_str()); + scoped_array wb(new wchar_t[len]); + strwiden(wb.get(), len, t_out.c_str()); + out = wb.get(); + } + return result; +} + + +void BOOST_RE_CALL w32_regex_traits::update() +{ + BOOST_RE_GUARD_STACK +#ifdef BOOST_RE_THREADS + re_detail::cs_guard g(*re_detail::p_re_lock); +#endif + do_init(); +} + +w32_regex_traits::w32_regex_traits() +{ + BOOST_RE_GUARD_STACK +#ifdef BOOST_RE_THREADS + re_detail::re_init_threads(); + re_detail::cs_guard g(*re_detail::p_re_lock); +#endif + ++entry_count; +} + +w32_regex_traits::~w32_regex_traits() +{ + BOOST_RE_GUARD_STACK +#ifdef BOOST_RE_THREADS + re_detail::cs_guard g(*re_detail::p_re_lock); +#endif + if(--entry_count == 0) + do_free(); +#ifdef BOOST_RE_THREADS + g.acquire(false); + re_detail::re_free_threads(); +#endif +} + +bool BOOST_RE_CALL w32_regex_traits::do_iswclass(wchar_t c, jm_uintfast32_t f) +{ + BOOST_RE_GUARD_STACK + if(c < 256) + return BOOST_RE_MAKE_BOOL(re_detail::wide_unicode_classes[c] & f); + WORD mask; + if(isPlatformNT && GetStringTypeW(CT_CTYPE1, &c, 1, &mask)) + return BOOST_RE_MAKE_BOOL(mask & f); + else if(f & char_class_unicode) + return true; + else if((f & char_class_graph) == char_class_graph) + return true; + return false; +} + +void BOOST_RE_CALL w32_regex_traits::transform(std::basic_string& out, const std::basic_string& in) +{ + BOOST_RE_GUARD_STACK + scoped_array alt; + size_t n; + if(isPlatformNT) + n = LCMapStringW(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, 0, 0); + else + { + n = strnarrow((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); + } + if((n == (size_t)(-1)) || (n == 0)) + { + out = in; + return; + } + scoped_array buf(new wchar_t[n+1]); + // under win32 we get mapped to an array of bytes + // not characters; since the underlying engine has to + // deal with chars we widen the bytes to wchar_t to ensure + // the sort order remains unchanged when we compare. + scoped_array t(new char[n+1]); + if(isPlatformNT) + n = LCMapStringW(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, (wchar_t*)t.get(), n); + else + n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, alt.get(), -1, t.get(), n); + int i = -1; + do + { + ++i; + buf[i] = (wchar_t)(unsigned char)t[i]; + } while(t[i]); + if(n == (size_t)(-1)) + { + out = in; + return; + } + out = buf.get(); +} + +void BOOST_RE_CALL w32_regex_traits::transform_primary(std::basic_string& out, const std::basic_string& in) +{ + transform(out, in); + for(unsigned int i = 0; i < out.size(); ++i) + { + if((out[i] == 1) && ((i + 1) < out.size())) + { + out.erase(i+1); + break; + } + } +} + + +int BOOST_RE_CALL w32_regex_traits::toi(wchar_t c) +{ + if(is_class(c, char_class_digit)) + return c - re_zero_w; + if(is_class(c, char_class_xdigit)) + return 10 + translate(c, true) - translate(re_ten_w, true); + return -1; // error!! +} + +int BOOST_RE_CALL w32_regex_traits::toi(const wchar_t*& first, const wchar_t* last, int radix) +{ + unsigned int maxval; + if(radix < 0) + { + // if radix is less than zero, then restrict + // return value to charT. NB assumes sizeof(charT) <= sizeof(int) + radix *= -1; + maxval = 1 << (sizeof(*first) * CHAR_BIT - 1); + maxval /= radix; + maxval *= 2; + maxval -= 1; + } + else + { + maxval = (unsigned int)-1; + maxval /= radix; + } + + unsigned int result = 0; + unsigned int type = (radix > 10) ? char_class_xdigit : char_class_digit; + while((first != last) && is_class(*first, type) && (result <= maxval)) + { + result *= radix; + result += toi(*first); + ++first; + } + return result; +} + +jm_uintfast32_t BOOST_RE_CALL w32_regex_traits::lookup_classname(const wchar_t* first, const wchar_t* last) +{ + std::basic_string s(first, last); + unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + scoped_array buf(new char[len]); + strnarrow(buf.get(), len, s.c_str()); + len = re_detail::w32_traits_base::do_lookup_class(buf.get()); + return len; +} + +wchar_t BOOST_RE_CALL w32_regex_traits::wtolower(wchar_t c) +{ + BOOST_RE_GUARD_STACK + if(isPlatformNT) + return LOWORD(CharLowerW((wchar_t*)(MAKELONG(c, 0)))); + return c; +} + + +w32_regex_traits w32_regex_traits::init_; + +unsigned int BOOST_RE_CALL w32_regex_traits::strnarrow(char *s1, unsigned int len, const wchar_t *s2) +{ + BOOST_RE_GUARD_STACK + unsigned int size = WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, 0, NULL, NULL); + if(size > len) + return size; + return WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, len, NULL, NULL); +} + +unsigned int BOOST_RE_CALL w32_regex_traits::strwiden(wchar_t *s1, unsigned int len, const char *s2) +{ + BOOST_RE_GUARD_STACK + unsigned int size = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, s2, -1, s1, 0); + if(size > len) + return size; + return MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, s2, -1, s1, len); +} + +unsigned short w32_regex_traits::wide_unicode_classes[] = { + re_detail::w32_traits_base::char_class_cntrl, // '' 0 + re_detail::w32_traits_base::char_class_cntrl, // '' 1 + re_detail::w32_traits_base::char_class_cntrl, // '' 2 + re_detail::w32_traits_base::char_class_cntrl, // '' 3 + re_detail::w32_traits_base::char_class_cntrl, // '' 4 + re_detail::w32_traits_base::char_class_cntrl, // '' 5 + re_detail::w32_traits_base::char_class_cntrl, // '' 6 + re_detail::w32_traits_base::char_class_cntrl, // '' 7 + re_detail::w32_traits_base::char_class_cntrl, // '' 8 + re_detail::w32_traits_base::char_class_cntrl | re_detail::w32_traits_base::char_class_space | re_detail::w32_traits_base::char_class_blank, // '' 9 + re_detail::w32_traits_base::char_class_cntrl | re_detail::w32_traits_base::char_class_space, // '' 10 + re_detail::w32_traits_base::char_class_cntrl | re_detail::w32_traits_base::char_class_space, // '' 11 + re_detail::w32_traits_base::char_class_cntrl | re_detail::w32_traits_base::char_class_space, // '' 12 + re_detail::w32_traits_base::char_class_cntrl | re_detail::w32_traits_base::char_class_space, // '' 13 + re_detail::w32_traits_base::char_class_cntrl, // '.' 14 + re_detail::w32_traits_base::char_class_cntrl, // '.' 15 + re_detail::w32_traits_base::char_class_cntrl, // '.' 16 + re_detail::w32_traits_base::char_class_cntrl, // '.' 17 + re_detail::w32_traits_base::char_class_cntrl, // '.' 18 + re_detail::w32_traits_base::char_class_cntrl, // '.' 19 + re_detail::w32_traits_base::char_class_cntrl, // '.' 20 + re_detail::w32_traits_base::char_class_cntrl, // '.' 21 + re_detail::w32_traits_base::char_class_cntrl, // '.' 22 + re_detail::w32_traits_base::char_class_cntrl, // '.' 23 + re_detail::w32_traits_base::char_class_cntrl, // '.' 24 + re_detail::w32_traits_base::char_class_cntrl, // '' 25 + re_detail::w32_traits_base::char_class_cntrl, // '' 26 + re_detail::w32_traits_base::char_class_cntrl, // '' 27 + re_detail::w32_traits_base::char_class_cntrl, // '.' 28 + re_detail::w32_traits_base::char_class_cntrl, // '.' 29 + re_detail::w32_traits_base::char_class_cntrl, // '.' 30 + re_detail::w32_traits_base::char_class_cntrl, // '.' 31 + re_detail::w32_traits_base::char_class_space | re_detail::w32_traits_base::char_class_blank, // ' ' 32 + re_detail::w32_traits_base::char_class_punct, // '!' 33 + re_detail::w32_traits_base::char_class_punct, // '"' 34 + re_detail::w32_traits_base::char_class_punct, // '#' 35 + re_detail::w32_traits_base::char_class_punct, // '$' 36 + re_detail::w32_traits_base::char_class_punct, // '%' 37 + re_detail::w32_traits_base::char_class_punct, // '&' 38 + re_detail::w32_traits_base::char_class_punct, // ''' 39 + re_detail::w32_traits_base::char_class_punct, // '(' 40 + re_detail::w32_traits_base::char_class_punct, // ')' 41 + re_detail::w32_traits_base::char_class_punct, // '*' 42 + re_detail::w32_traits_base::char_class_punct, // '+' 43 + re_detail::w32_traits_base::char_class_punct, // ',' 44 + re_detail::w32_traits_base::char_class_punct, // '-' 45 + re_detail::w32_traits_base::char_class_punct, // '.' 46 + re_detail::w32_traits_base::char_class_punct, // '/' 47 + re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '0' 48 + re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '1' 49 + re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '2' 50 + re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '3' 51 + re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '4' 52 + re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '5' 53 + re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '6' 54 + re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '7' 55 + re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '8' 56 + re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '9' 57 + re_detail::w32_traits_base::char_class_punct, // ':' 58 + re_detail::w32_traits_base::char_class_punct, // ';' 59 + re_detail::w32_traits_base::char_class_punct, // '<' 60 + re_detail::w32_traits_base::char_class_punct, // '=' 61 + re_detail::w32_traits_base::char_class_punct, // '>' 62 + re_detail::w32_traits_base::char_class_punct, // '?' 63 + re_detail::w32_traits_base::char_class_punct, // '@' 64 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'A' 65 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'B' 66 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'C' 67 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'D' 68 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'E' 69 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'F' 70 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'G' 71 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'H' 72 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'I' 73 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'J' 74 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'K' 75 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'L' 76 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'M' 77 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'N' 78 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'O' 79 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'P' 80 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Q' 81 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'R' 82 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'S' 83 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'T' 84 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'U' 85 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'V' 86 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'W' 87 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'X' 88 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Y' 89 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Z' 90 + re_detail::w32_traits_base::char_class_punct, // '[' 91 + re_detail::w32_traits_base::char_class_punct, // '\' 92 + re_detail::w32_traits_base::char_class_punct, // ']' 93 + re_detail::w32_traits_base::char_class_punct, // '^' 94 + re_detail::w32_traits_base::char_class_punct | re_detail::w32_traits_base::char_class_underscore, // '_' 95 + re_detail::w32_traits_base::char_class_punct, // '`' 96 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'a' 97 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'b' 98 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'c' 99 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'd' 100 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'e' 101 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'f' 102 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'g' 103 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'h' 104 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'i' 105 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'j' 106 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'k' 107 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'l' 108 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'm' 109 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'n' 110 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'o' 111 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'p' 112 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'q' 113 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'r' 114 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 's' 115 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 't' 116 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'u' 117 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'v' 118 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'w' 119 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'x' 120 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'y' 121 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'z' 122 + re_detail::w32_traits_base::char_class_punct, // '{' 123 + re_detail::w32_traits_base::char_class_punct, // '|' 124 + re_detail::w32_traits_base::char_class_punct, // '}' 125 + re_detail::w32_traits_base::char_class_punct, // '~' 126 + + re_detail::w32_traits_base::char_class_cntrl, // '' 127 + re_detail::w32_traits_base::char_class_cntrl, // '€' 128 + re_detail::w32_traits_base::char_class_cntrl, // '' 129 + re_detail::w32_traits_base::char_class_cntrl, // '‚' 130 + re_detail::w32_traits_base::char_class_cntrl, // 'ƒ' 131 + re_detail::w32_traits_base::char_class_cntrl, // '„' 132 + re_detail::w32_traits_base::char_class_cntrl, // '…' 133 + re_detail::w32_traits_base::char_class_cntrl, // '†' 134 + re_detail::w32_traits_base::char_class_cntrl, // '‡' 135 + re_detail::w32_traits_base::char_class_cntrl, // 'ˆ' 136 + re_detail::w32_traits_base::char_class_cntrl, // '‰' 137 + re_detail::w32_traits_base::char_class_cntrl, // 'Š' 138 + re_detail::w32_traits_base::char_class_cntrl, // '‹' 139 + re_detail::w32_traits_base::char_class_cntrl, // 'Œ' 140 + re_detail::w32_traits_base::char_class_cntrl, // '' 141 + re_detail::w32_traits_base::char_class_cntrl, // 'Ž' 142 + re_detail::w32_traits_base::char_class_cntrl, // '' 143 + re_detail::w32_traits_base::char_class_cntrl, // '' 144 + re_detail::w32_traits_base::char_class_cntrl, // '‘' 145 + re_detail::w32_traits_base::char_class_cntrl, // '’' 146 + re_detail::w32_traits_base::char_class_cntrl, // '“' 147 + re_detail::w32_traits_base::char_class_cntrl, // '”' 148 + re_detail::w32_traits_base::char_class_cntrl, // '•' 149 + re_detail::w32_traits_base::char_class_cntrl, // '–' 150 + re_detail::w32_traits_base::char_class_cntrl, // '—' 151 + re_detail::w32_traits_base::char_class_cntrl, // '˜' 152 + re_detail::w32_traits_base::char_class_cntrl, // '™' 153 + re_detail::w32_traits_base::char_class_cntrl, // 'š' 154 + re_detail::w32_traits_base::char_class_cntrl, // '›' 155 + re_detail::w32_traits_base::char_class_cntrl, // 'œ' 156 + re_detail::w32_traits_base::char_class_cntrl, // '' 157 + re_detail::w32_traits_base::char_class_cntrl, // 'ž' 158 + re_detail::w32_traits_base::char_class_cntrl, // 'Ÿ' 159 + re_detail::w32_traits_base::char_class_space | re_detail::w32_traits_base::char_class_blank, // ' ' 160 + re_detail::w32_traits_base::char_class_punct, // '¡' 161 + re_detail::w32_traits_base::char_class_punct, // '¢' 162 + re_detail::w32_traits_base::char_class_punct, // '£' 163 + re_detail::w32_traits_base::char_class_punct, // '¤' 164 + re_detail::w32_traits_base::char_class_punct, // '¥' 165 + re_detail::w32_traits_base::char_class_punct, // '¦' 166 + re_detail::w32_traits_base::char_class_punct, // '§' 167 + re_detail::w32_traits_base::char_class_punct, // '¨' 168 + re_detail::w32_traits_base::char_class_punct, // '©' 169 + re_detail::w32_traits_base::char_class_punct, // 'ª' 170 + re_detail::w32_traits_base::char_class_punct, // '«' 171 + re_detail::w32_traits_base::char_class_punct, // '¬' 172 + re_detail::w32_traits_base::char_class_punct, // '­' 173 + re_detail::w32_traits_base::char_class_punct, // '®' 174 + re_detail::w32_traits_base::char_class_punct, // '¯' 175 + re_detail::w32_traits_base::char_class_punct, // '°' 176 + re_detail::w32_traits_base::char_class_punct, // '±' 177 + re_detail::w32_traits_base::char_class_punct, // '²' 178 + re_detail::w32_traits_base::char_class_punct, // '³' 179 + re_detail::w32_traits_base::char_class_punct, // '´' 180 + re_detail::w32_traits_base::char_class_punct, // 'µ' 181 + re_detail::w32_traits_base::char_class_punct, // '¶' 182 + re_detail::w32_traits_base::char_class_punct, // '·' 183 + re_detail::w32_traits_base::char_class_punct, // '¸' 184 + re_detail::w32_traits_base::char_class_punct, // '¹' 185 + re_detail::w32_traits_base::char_class_punct, // 'º' 186 + re_detail::w32_traits_base::char_class_punct, // '»' 187 + re_detail::w32_traits_base::char_class_punct, // '¼' 188 + re_detail::w32_traits_base::char_class_punct, // '½' 189 + re_detail::w32_traits_base::char_class_punct, // '¾' 190 + re_detail::w32_traits_base::char_class_punct, // '¿' 191 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'À' 192 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Á' 193 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Â' 194 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ã' 195 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ä' 196 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Å' 197 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Æ' 198 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ç' 199 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'È' 200 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'É' 201 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ê' 202 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ë' 203 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ì' 204 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Í' 205 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Î' 206 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ï' 207 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ð' 208 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ñ' 209 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ò' 210 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ó' 211 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ô' 212 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Õ' 213 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ö' 214 + re_detail::w32_traits_base::char_class_punct, // '×' 215 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ø' 216 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ù' 217 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ú' 218 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Û' 219 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ü' 220 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ý' 221 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Þ' 222 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ß' 223 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'à' 224 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'á' 225 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'â' 226 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ã' 227 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ä' 228 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'å' 229 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'æ' 230 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ç' 231 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'è' 232 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'é' 233 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ê' 234 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ë' 235 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ì' 236 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'í' 237 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'î' 238 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ï' 239 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ð' 240 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ñ' 241 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ò' 242 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ó' 243 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ô' 244 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'õ' 245 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ö' 246 + re_detail::w32_traits_base::char_class_punct, // '÷' 247 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ø' 248 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ù' 249 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ú' 250 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'û' 251 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ü' 252 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ý' 253 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'þ' 254 + re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ÿ' 255 +}; + + + +#endif // BOOST_RE_NO_WCSTRING + + +} // namespace boost + +#endif // #if defined(_WIN32) && !defined(BOOST_RE_NO_W32) + diff --git a/src/wide_posix_api.cpp b/src/wide_posix_api.cpp new file mode 100644 index 00000000..eff4a149 --- /dev/null +++ b/src/wide_posix_api.cpp @@ -0,0 +1,247 @@ +/* + * + * Copyright (c) 1998-2000 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + */ + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE: wide_posix_api.cpp + * VERSION: 3.00 + * DESCRIPTION: Implements the wide character POSIX API wrappers. + */ + +#include + +#ifndef BOOST_RE_NO_WCSTRING + +#include + +#ifndef BOOST_RE_NO_WCHAR_H +#include +#endif +#ifndef BOOST_RE_NO_WCTYPE_H +#include +#endif +#include +#include + +#if defined(BOOST_RE_NO_SWPRINTF) && !defined(BOOST_RE_NO_WSPRINTF) +#include +#endif + +namespace boost{ + +namespace { + +unsigned int wmagic_value = 28631; + +const wchar_t* wnames[] = {L"REG_NOERROR", L"REG_NOMATCH", L"REG_BADPAT", L"REG_ECOLLATE", + L"REG_ECTYPE", L"REG_EESCAPE", L"REG_ESUBREG", L"REG_EBRACK", + L"REG_EPAREN", L"REG_EBRACE", L"REG_BADBR", L"REG_ERANGE", + L"REG_ESPACE", L"REG_BADRPT", L"REG_EMPTY", L"REG_E_UNKNOWN"}; + +} + +BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompW(regex_tW* expression, const wchar_t* ptr, int f) +{ + BOOST_RE_GUARD_STACK + if(expression->re_magic != wmagic_value) + { + expression->guts = 0; + try{ + expression->guts = new wregex(); + } catch(...) + { + delete (wregex*)(expression->guts); + return REG_ESPACE; + } + } + // set default flags: + jm_uintfast32_t flags = (f & REG_EXTENDED) ? regbase::extended : regbase::basic; + expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : 0; + + // and translate those that are actually set: + if(f & REG_NOCOLLATE) + flags |= regbase::nocollate; + + if(f & REG_NOSUB) + expression->eflags |= match_any; + + if(f & REG_NOSPEC) + flags |= regbase::literal; + if(f & REG_ICASE) + flags |= regbase::icase; + if(f & REG_ESCAPE_IN_LISTS) + flags |= regbase::escape_in_lists; + if(f & REG_NEWLINE_ALT) + flags |= regbase::newline_alt; + + const wchar_t* p2; + if(f & REG_PEND) + p2 = expression->re_endp; + else p2 = ptr + std::wcslen(ptr); + + int result; + + 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(); + } catch(...) + { + result = REG_E_UNKNOWN; + } + if(result) + regfreeW(expression); + return result; + +} + +BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorW(int code, const regex_tW* e, wchar_t* buf, unsigned int buf_size) +{ + BOOST_RE_GUARD_STACK + unsigned int result = 0; + if(code & REG_ITOA) + { + code &= ~REG_ITOA; + if(code <= REG_E_UNKNOWN) + { + result = std::wcslen(wnames[code]) + 1; + if(buf_size >= result) + std::wcscpy(buf, wnames[code]); + return result; + } + return result; + } +#if !defined(BOOST_RE_NO_SWPRINTF) || !defined(BOOST_RE_NO_WSPRINTF) + if(code == REG_ATOI) + { + wchar_t localbuf[5]; + if(e == 0) + return 0; + for(int i = 0; i <= REG_E_UNKNOWN; ++i) + { + if(std::wcscmp(e->re_endp, wnames[i]) == 0) + { +#if defined(BOOST_RE_NO_SWPRINTF) + wsprintf(localbuf, "%d", i); +#else + std::swprintf(localbuf, L"%d", i); +#endif + if(std::wcslen(localbuf) < buf_size) + std::wcscpy(buf, localbuf); + return std::wcslen(localbuf) + 1; + } + } +#if defined(BOOST_RE_NO_SWPRINTF) + wsprintf(localbuf, "%d", 0); +#else + std::swprintf(localbuf, L"%d", 0); +#endif + if(std::wcslen(localbuf) < buf_size) + std::wcscpy(buf, localbuf); + return std::wcslen(localbuf) + 1; + } +#endif + if(code <= REG_E_UNKNOWN) + { + regex_traits rt; + const regex_traits* pt = &rt; + if(e && (e->re_magic == wmagic_value)) + pt = &((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()); + if(len < buf_size) + { + pt->strwiden(buf, buf_size, p.c_str()); + } + return len + 1; + } + if(buf_size) + *buf = 0; + return 0; +} + +BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecW(const regex_tW* expression, const wchar_t* buf, unsigned int n, regmatch_t* array, int eflags) +{ + BOOST_RE_GUARD_STACK + bool result = false; + jm_uintfast32_t flags = match_default | expression->eflags; + const wchar_t* end; + const wchar_t* start; + wcmatch m; + + if(eflags & REG_NOTBOL) + flags |= match_not_bol; + if(eflags & REG_NOTEOL) + flags |= match_not_eol; + if(eflags & REG_STARTEND) + { + start = buf + array[0].rm_so; + end = buf + array[0].rm_eo; + } + else + { + start = buf; + end = buf + std::wcslen(buf); + } + + try{ + if(expression->re_magic == wmagic_value) + { + result = regex_search(start, end, m, *(wregex*)(expression->guts), flags); + } + else + return result; + } catch(...) + { + return REG_E_UNKNOWN; + } + + if(result) + { + // extract what matched: + unsigned int i; + for(i = 0; (i < n) && (i < expression->re_nsub + 1); ++i) + { + array[i].rm_so = (m[i].matched == false) ? -1 : (m[i].first - buf); + array[i].rm_eo = (m[i].matched == false) ? -1 : (m[i].second - buf); + } + // and set anything else to -1: + for(i = expression->re_nsub + 1; i < n; ++i) + { + array[i].rm_so = -1; + array[i].rm_eo = -1; + } + return 0; + } + return REG_NOMATCH; +} + +BOOST_RE_IX_DECL void BOOST_RE_CCALL regfreeW(regex_tW* expression) +{ + BOOST_RE_GUARD_STACK + if(expression->re_magic == wmagic_value) + { + delete (wregex*)(expression->guts); + } + expression->re_magic = 0; +} + +} // namespace boost; + +#endif + + diff --git a/syntax.htm b/syntax.htm new file mode 100644 index 00000000..99035726 --- /dev/null +++ b/syntax.htm @@ -0,0 +1,787 @@ + + + + + + + + +Regex++, Regular Expression Syntax + + + +  + + + + +

+C++ Boost

+
+

Regex++, Regular Expression Syntax.

+
+
+(version 3.01, 18 April 2000) +
+
Copyright (c) 1998-2000
+Dr John Maddock
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Dr John Maddock makes no representations
+about the suitability of this software for any purpose.  
+It is provided "as is" without express or implied warranty.
+ +
+
+

Regular expression syntax

+This section covers the regular expression syntax used by this library, this is +a programmers guide, the actual syntax presented to your program's users will +depend upon the flags used during expression compilation.

Literals +

+

All characters are literals except: ".", "*", +"?", "+", "(", ")", "{", +"}", "[", "]", "^" and "$". +These characters are literals when preceded by a "\". 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.

+

Wildcard

+

The dot character "." matches any single character except : when +match_not_dot_null is passed to the matching algorithms, the dot does +not match a null character; when match_not_dot_newline is passed to the +matching algorithms, then the dot does not match a newline character.

+

Repeats

+

A repeat is an expression that is repeated an arbitrary number of times. An +expression followed by "*" can be repeated any number of times +including zero. An expression followed by "+" can be repeated any +number of times, but at least once, if the expression is compiled with the flag +regbase::bk_plus_qm then "+" is an ordinary character and +"\+" represents a repeat of once or more. An expression followed by +"?" may be repeated zero or one times only, if the expression is +compiled with the flag regbase::bk_plus_qm then "?" is an ordinary +character and "\?" represents the repeat zero or once operator. When +it is necessary to specify the minimum and maximum number of repeats +explicitly, the bounds operator "{}" may be used, thus +"a{2}" is the letter "a" repeated exactly twice, +"a{2,4}" represents the letter "a" repeated between 2 and 4 +times, and "a{2,}" represents the letter "a" repeated at +least twice with no upper limit. Note that there must be no white-space inside +the {}, and there is no upper limit on the values of the lower and upper +bounds. When the expression is compiled with the flag regbase::bk_braces then +"{" and "}" are ordinary characters and "\{" and +"\}" are used to delimit bounds instead. All repeat expressions refer +to the shortest possible previous sub-expression: a single character; a +character set, or a sub-expression grouped with "()" for example. +

+

Examples:

+

"ba*" will match all of "b", "ba", +"baaa" etc.

+

"ba+" will match "ba" or "baaaa" for example +but not "b".

+

"ba?" will match "b" or "ba".

+

"ba{2,4}" will match "baa", "baaa" and +"baaaa".

+

Non-greedy repeats

+

Whenever the "extended" regular expression syntax is in use (the +default) then non-greedy repeats are possible by appending a '?' after the +repeat; a non-greedy repeat is one which will match the shortest +possible string.

+

For example to match html tag pairs one could use something like:

+

"<\s*tagname[^>]*>(.*?)<\s*/tagname\s*>"

+

In this case $1 will contain the text between the tag pairs, and will be the +shortest possible matching string.

+

Parenthesis

+

Parentheses serve two purposes, to group items together into a +sub-expression, and to mark what generated the match. For example the +expression "(ab)*" would match all of the string "ababab". +The matching algorithms regex_match and +regex_search each take an +instance of match_results that +reports what caused the match, on exit from these functions the +match_results contains information +both on what the whole expression matched and on what each sub-expression +matched. In the example above match_results[1] would contain a pair of iterators +denoting the final "ab" of the matching string. It is permissible for +sub-expressions to match null strings. If a sub-expression takes no part in a +match - for example if it is part of an alternative that is not taken - then +both of the iterators that are returned for that sub-expression point to the +end of the input string, and the matched parameter for that +sub-expression is false. Sub-expressions are indexed from left to right +starting from 1, sub-expression 0 is the whole expression.

+

Non-Marking Parenthesis

+

Sometimes you need to group sub-expressions with parenthesis, but don't want +the parenthesis to spit out another marked sub-expression, in this case a +non-marking parenthesis (?:expression) can be used. For example the following +expression creates no sub-expressions:

+

"(?:abc)*"

+

Alternatives

+

Alternatives occur when the expression can match either one sub-expression +or another, each alternative is separated by a "|", or a +"\|" if the flag regbase::bk_vbar is set, or by a newline character +if the flag regbase::newline_alt is set. Each alternative is the largest +possible previous sub-expression; this is the opposite behaviour from +repetition operators.

+

Examples:

+

"a(b|c)" could match "ab" or "ac".

+

"abc|def" could match "abc" or "def".

+

Sets

+

A set is a set of characters that can match any single character that is a +member of the set. Sets are delimited by "[" and "]" and +can contain literals, character ranges, character classes, collating elements +and equivalence classes. Set declarations that start with "^" contain +the compliment of the elements that follow.

+

Examples:

+

Character literals:

+

"[abc]" will match either of "a", "b", or +"c".

+

"[^abc] will match any character other than "a", +"b", or "c".

+

Character ranges:

+

"[a-z]" will match any character in the range "a" to +"z".

+

"[^A-Z]" will match any character other than those in the range +"A" to "Z".

+

Note that character ranges are highly locale dependent: they match any +character that collates between the endpoints of the range, ranges will only +behave according to ASCII rules when the default "C" locale is in +effect. For example if the library is compiled with the Win32 localization +model, then [a-z] will match the ASCII characters a-z, and also 'A', 'B' etc, +but not 'Z' which collates just after 'z'. This locale specific behaviour can +be disabled by specifying regbase::nocollate when compiling, this is the +default behaviour when using regbase::normal, and forces ranges to collate +according to ASCII character code. Likewise, if you use the POSIX C API +functions then setting REG_NOCOLLATE turns off locale dependent collation.

+

Character classes are denoted using the syntax "[:classname:]" +within a set declaration, for example "[[:space:]]" is the set of all +whitespace characters. Character classes are only available if the flag +regbase::char_classes is set. The available character classes are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 alnumAny alpha numeric character. 
 alphaAny alphabetical character a-z and A-Z. Other +characters may also be included depending upon the locale. 
 blankAny blank character, either a space or a tab. 
 cntrlAny control character. 
 digitAny digit 0-9. 
 graphAny graphical character. 
 lowerAny lower case character a-z. Other characters may +also be included depending upon the locale. 
 printAny printable character. 
 punctAny punctuation character. 
 spaceAny whitespace character. 
 upperAny upper case character A-Z. Other characters may +also be included depending upon the locale. 
 xdigitAny hexadecimal digit character, 0-9, a-f and +A-F. 
 wordAny word character - all alphanumeric characters +plus the underscore. 
 unicodeAny character whose code is greater than 255, this +applies to the wide character traits classes only. 
+

There are some shortcuts that can be used in place of the character classes, +provided the flag regbase::escape_in_lists is set then you can use:

+

\w in place of [:word:]

+

\s in place of [:space:]

+

\d in place of [:digit:]

+

\l in place of [:lower:]

+

\u in place of [:upper:]

+

Collating elements take the general form [.tagname.] inside a set +declaration, where tagname is either a single character, or a name of a +collating element, for example [[.a.]] is equivalent to [a], and [[.comma.]] is +equivalent to [,]. The library supports all the standard POSIX collating +element names, and in addition the following digraphs: "ae", +"ch", "ll", "ss", "nj", "dz", +"lj", each in lower, upper and title case variations. Multi-character +collating elements can result in the set matching more than one character, for +example [[.ae.]] would match two characters, but note that [^[.ae.]] would only +match one character.

+

Equivalence classes take the general form [=tagname=] inside a set +declaration, where tagname is either a single character, or a name of a +collating element, and matches any character that is a member of the same +primary equivalence class as the collating element [.tagname.]. An equivalence +class is a set of characters that collate the same, a primary equivalence class +is a set of characters whose primary sort key are all the same (for example +strings are typically collated by character, then by accent, and then by case; +the primary sort key then relates to the character, the secondary to the +accentation, and the tertiary to the case). If there is no equivalence class +corresponding to tagname, then [=tagname=] is exactly the same as +[.tagname.]. Unfortunately there is no locale independent method of obtaining +the primary sort key for a character, except under Win32. For other operating +systems the library will "guess" the primary sort key from the full +sort key (obtained from strxfrm), so equivalence classes are probably +best considered broken under any operating system other than Win32.

+

To include a literal "-" in a set declaration then: make it the +first character after the opening "[" or "[^", the endpoint +of a range, a collating element, or if the flag regbase::escape_in_lists is set +then precede with an escape character as in "[\-]". To include a +literal "[" or "]" or "^" in a set then make them +the endpoint of a range, a collating element, or precede with an escape +character if the flag regbase::escape_in_lists is set.

+

Line anchors

+

An anchor is something that matches the null string at the start or end of a +line: "^" matches the null string at the start of a line, +"$" matches the null string at the end of a line.

+

Back references

+

A back reference is a reference to a previous sub-expression that has +already been matched, the reference is to what the sub-expression matched, not +to the expression itself. A back reference consists of the escape character +"\" followed by a digit "1" to "9", +"\1" refers to the first sub-expression, "\2" to the second +etc. For example the expression "(.*)\1" matches any string that is +repeated about its mid-point for example "abcabc" or +"xyzxyz". A back reference to a sub-expression that did not +participate in any match, matches the null string: NB this is different to some +other regular expression matchers. Back references are only available if the +expression is compiled with the flag regbase::bk_refs set.

+

Characters by code

+

This is an extension to the algorithm that is not available in other +libraries, it consists of the escape character followed by the digit +"0" followed by the octal character code. For example +"\023" represents the character whose octal code is 23. Where +ambiguity could occur use parentheses to break the expression up: +"\0103" represents the character whose code is 103, "(\010)3 +represents the character 10 followed by "3". To match characters by +their hexadecimal code, use \x followed by a string of hexadecimal digits, +optionally enclosed inside {}, for example \xf0 or \x{aff}, notice the latter +example is a Unicode character.

+

Word operators

+

The following operators are provided for compatibility with the GNU regular +expression library.

+

"\w" matches any single character that is a member of the +"word" character class, this is identical to the expression +"[[:word:]]".

+

"\W" matches any single character that is not a member of the +"word" character class, this is identical to the expression +"[^[:word:]]".

+

"\<" matches the null string at the start of a word.

+

"\>" matches the null string at the end of the word.

+

"\b" matches the null string at either the start or the end of a +word.

+

"\B" matches a null string within a word.

+

The start of the sequence passed to the matching algorithms is considered to +be a potential start of a word unless the flag match_not_bow is set. The end of +the sequence passed to the matching algorithms is considered to be a potential +end of a word unless the flag match_not_eow is set.

+

Buffer operators

+

The following operators are provide for compatibility with the GNU regular +expression library, and Perl regular expressions:

+

"\`" matches the start of a buffer.

+

"\A" matches the start of the buffer.

+

"\'" matches the end of a buffer.

+

"\z" matches the end of a buffer.

+

"\Z" matches the end of a buffer, or possibly one or more new line +characters followed by the end of the buffer.

+

A buffer is considered to consist of the whole sequence passed to the +matching algorithms, unless the flags match_not_bob or match_not_eob are set. +

+

Escape operator

+

The escape character "\" has several meanings.

+

Inside a set declaration the escape character is a normal character unless +the flag regbase::escape_in_lists is set in which case whatever follows the +escape is a literal character regardless of its normal meaning.

+

The escape operator may introduce an operator for example: back references, +or a word operator.

+

The escape operator may make the following character normal, for example +"\*" represents a literal "*" rather than the repeat +operator.

+

Single character escape sequences

+

The following escape sequences are aliases for single characters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+Escape sequence +
+
+Character code +
+
+Meaning +
+
 
 
+\a +
+
+0x07 +
+
+Bell character. +
+
 
 
+\f +
+
+0x08 +
+
+Form feed. +
+
 
 
+\n +
+
+0x0A +
+
+Newline character. +
+
 
 
+\r +
+
+0x0D +
+
+Carriage return. +
+
 
 
+\t +
+
+0x09 +
+
+Tab character. +
+
 
 
+\v +
+
+0x0B +
+
+Vertical tab. +
+
 
 
+\e +
+
+0x1B +
+
+ASCII Escape character. +
+
 
 
+\0dd +
+
+0dd +
+
+An octal character code, where dd is one or more octal digits. +
+
 
 
+\xXX +
+
+0xXX +
+
+A hexadecimal character code, where XX is one or more hexadecimal digits. +
+
 
 
+\x{XX} +
+
+0xXX +
+
+A hexadecimal character code, where XX is one or more hexadecimal digits, +optionally a unicode character. +
+
 
 
+\cZ +
+
+z-@ +
+
+An ASCII escape sequence control-Z, where Z is any ASCII character greater than +or equal to the character code for '@'. +
+
 
+

Miscellaneous escape sequences:

+

The following are provided mostly for perl compatibility, but note that +there are some differences in the meanings of \l \L \u and \U:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+\w +
+
+Equivalent to [[:word:]]. +
+
 
 
+\W +
+
+Equivalent to [^[:word:]]. +
+
 
 
+\s +
+
+Equivalent to [[:space:]]. +
+
 
 
+\S +
+
+Equivalent to [^[:space:]]. +
+
 
 
+\d +
+
+Equivalent to [[:digit:]]. +
+
 
 
+\D +
+
+Equivalent to [^[:digit:]]. +
+
 
 
+\l +
+
+Equivalent to [[:lower:]]. +
+
 
 
+\L +
+
+Equivalent to [^[:lower:]]. +
+
 
 
+\u +
+
+Equivalent to [[:upper:]]. +
+
 
 
+\U +
+
+Equivalent to [^[:upper:]]. +
+
 
 
+\C +
+
+Any single character, equivalent to '.'. +
+
 
 
+\X +
+
+Match any Unicode combining character sequence, for example "a\x +0301" (a letter a with an acute). +
+
 
 
+\Q +
+
+The begin quote operator, everything that follows is treated as a literal +character until a \E end quote operator is found. +
+
 
 
+\E +
+
+The end quote operator, terminates a sequence begun with \Q. +
+
 
+

What gets matched?

+

The regular expression library will match the first possible matching +string, if more than one string starting at a given location can match then it +matches the longest possible string, unless the flag match_any is set, in which +case the first match encountered is returned. Use of the match_any option can +reduce the time taken to find the match - but is only useful if the user is +less concerned about what matched - for example it would not be suitable for +search and replace operations. In cases where their are multiple possible +matches all starting at the same location, and all of the same length, then the +match chosen is the one with the longest first sub-expression, if that is the +same for two or more matches, then the second sub-expression will be examined +and so on.
+

+
+

Copyright Dr John +Maddock 1998-2000 all rights reserved.

+ + + diff --git a/template_class_ref.htm b/template_class_ref.htm new file mode 100644 index 00000000..7a417d5d --- /dev/null +++ b/template_class_ref.htm @@ -0,0 +1,2271 @@ + + + + + + +Regex++, template class and algorithm reference + + + + +

 

+ + + + + + +

C++ Boost

+

Regex++, + Template Class and Algorithm Reference.

+

(version 3.01, 18 April 2000)

+
Copyright (c) 1998-9
+Dr John Maddock
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Dr John Maddock makes no representations
+about the suitability of this software for any purpose.  
+It is provided "as is" without express or implied warranty.
+
+ +
+ +

class regbase

+ +

#include <boost/regex.hpp> +

+ +

Class regbase is the template argument independent base class +for reg_expression, the only public members are the flag_type +enumerated values that determine how regular expressions are +interpreted.

+ +
class regbase
+{
+public:
+   enum flag_type_
+   {
+      escape_in_lists = 1,                          // '\\' special inside [...] 
+      char_classes = escape_in_lists << 1,          // [[:CLASS:]] allowed 
+      intervals = char_classes << 1,                // {x,y} allowed 
+      limited_ops = intervals << 1,                 // all of + ? and | are normal characters 
+      newline_alt = limited_ops << 1,               // \n is the same as | 
+      bk_plus_qm = newline_alt << 1,                // uses \+ and \? 
+      bk_braces = bk_plus_qm << 1,                  // uses \{ and \} 
+      bk_parens = bk_braces << 1,                   // uses \( and \) 
+      bk_refs = bk_parens << 1,                     // \d allowed 
+      bk_vbar = bk_refs << 1,                       // uses \| 
+      use_except = bk_vbar << 1,                    // exception on error 
+      failbit = use_except << 1,                    // error flag 
+      literal = failbit << 1,                       // all characters are literals 
+      icase = literal << 1,                         // characters are matched regardless of case 
+      nocollate = icase << 1,                       // don't use locale specific collation 
+
+      basic = char_classes | intervals | limited_ops | bk_braces | bk_parens | bk_refs,
+      extended = char_classes | intervals | bk_refs,
+      normal = escape_in_lists | char_classes | intervals | bk_refs | nocollate,
+      emacs = bk_braces | bk_parens | bk_refs | bk_vbar,
+      awk = extended | escape_in_lists,
+      grep = basic | newline_alt,
+      egrep = extended | newline_alt,
+      sed = basic,
+      perl = normal
+   }; 
+   typedef unsigned int flag_type;
+};   
+ +

 

+ +

The enumerated type regbase::flag_type determines the +syntax rules for regular expression compilation, the various +flags have the following effects:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 regbase::escape_in_listsAllows the use of the escape + "\" character in sets of characters, for + example [\]] represents the set of characters containing + only "]". If this flag is not set then "\" + is an ordinary character inside sets. 
 regbase::char_classesWhen this bit is set, + character classes [:classname:] are allowed inside + character set declarations, for example "[[:word:]]" + represents the set of all characters that belong to the + character class "word". 
 regbase:: intervalsWhen this bit is set, + repetition intervals are allowed, for example "a{2,4}" + represents a repeat of between 2 and 4 letter a's. 
 regbase:: limited_opsWhen this bit is set all of + "+", "?" and "|" are + ordinary characters in all situations. 
 regbase:: newline_altWhen this bit is set, then + the newline character "\n" has the same effect + as the alternation operator "|". 
 regbase:: bk_plus_qmWhen this bit is set then + "\+" represents the one or more repetition + operator and "\?" represents the zero or one + repetition operator. When this bit is not set then "+" + and "?" are used instead. 
 regbase:: bk_bracesWhen this bit is set then + "\{" and "\}" are used for bounded + repetitions and "{" and "}" are + normal characters. This is the opposite of default + behavior. 
 regbase:: bk_parensWhen this bit is set then + "\(" and "\)" are used to group sub-expressions + and "(" and ")" are ordinary + characters, this is the opposite of default behaviour. 
 regbase:: bk_refsWhen this bit is set then + back references are allowed. 
 regbase:: bk_vbarWhen this bit is set then + "\|" represents the alternation operator and + "|" is an ordinary character. This is the + opposite of default behaviour. 
 regbase:: use_exceptWhen this bit is set then a bad_expression exception will + be thrown on error.  Use of this flag is deprecated + - reg_expression will always throw on error. 
 regbase:: failbitThis bit is set on error, if + regbase::use_except is not set, then this bit should be + checked to see if a regular expression is valid before + usage. 
 regbase::literalAll characters in the string + are treated as literals, there are no special characters + or escape sequences. 
 regbase::icaseAll characters in the string + are matched regardless of case. 
 regbase::nocollateLocale specific collation is + disabled when dealing with ranges in character set + declarations.  For example when this bit is set the + expression [a-c] would match the characters a, b and c + only regardless of locale, where as when this is not set + , then [a-c] matches any character which collates in the + range a to c. 
 regbase::basicEquivalent to the POSIX + basic regular expression syntax: char_classes | intervals + | limited_ops | bk_braces | bk_parens | bk_refs. 
 Regbase::extendedEquivalent to the POSIX + extended regular expression syntax: char_classes | + intervals | bk_refs. 
 regbase::normalThis is the + default setting, and represents how most people expect + the library to behave. Equivalent to the POSIX extended + syntax, but with locale specific collation disabled, and + escape characters inside set declarations enabled: + regbase::escape_in_lists | regbase::char_classes | + regbase::intervals | regbase::bk_refs | regbase::nocollate. 
 regbase::emacsProvides + compatability with the emacs editor, eqivalent to: bk_braces + | bk_parens | bk_refs | bk_vbar. 
 regbase::awk Provides + compatabilty with the Unix utility Awk, the same as POSIX + extended regular expressions, but allows escapes inside + bracket-expressions (character sets). Equivalent to + extended | escape_in_lists. 
 regbase::grepProvides + compatabilty with the Unix grep utility, the same as + POSIX basic regular expressions, but with the newline + character equivalent to the alternation operator. the + same as basic | newline_alt. 
 regbase::egrepProvides + compatabilty with the Unix egrep utility, the same as + POSIX extended regular expressions, but with the newline + character equivalent to the alternation operator. the + same as extended | newline_alt. 
 regbase::sedProvides + compatabilty with the Unix sed utility, the same as POSIX + basic regular expressions. 
 regbase::perlProvides + compatibility with the perl programming language, the + same as regbase::normal. 
+ +
+ +

Exception classes.

+ +

#include <boost/pat_except.hpp> +

+ +

An instance of bad_expression is thrown whenever a bad +regular expression is encountered.

+ +
namespace boost{
+
+class bad_pattern : public std::runtime_error
+{
+public:
+   explicit bad_pattern(const std::string& s) : std::runtime_error(s){};
+};
+
+class bad_expression : public bad_pattern
+{
+public:
+   bad_expression(const std::string& s) : bad_pattern(s) {}
+};
+
+
+} // namespace boost
+ +

Footnotes: the class bad_pattern forms the base class +for all pattern-matching exceptions, of which bad_expression +is one. The choice of std::runtime_error as the base class +for bad_pattern is moot, depending upon how the library is +used exceptions may be either logic errors (programmer supplied +expressions) or run time errors (user supplied expressions).
+

+ +
+ +

Class reg_expression

+ +

#include <boost/regex.hpp> +

+ +

The template class reg_expression encapsulates regular +expression parsing and compilation. The class derives from class regbase and takes three template +parameters:

+ +

charT: determines the character type, i.e. +either char or wchar_t.

+ +

traits: determines the behaviour of the +character type, for example whether character matching is case +sensitive or not, and which character class names are recognized. +A default traits class is provided: regex_traits<charT>. +

+ +

Allocator: the allocator class used to allocate +memory by the class.

+ +

For ease of use there are two typedefs that define the two +standard reg_expression instances, unless you want to use +custom allocators, you won't need to use anything other than +these:

+ +
namespace boost{
+template <class charT, class traits = regex_traits<charT>, class Allocator = std::allocator<charT>  >
+class reg_expression;
+typedef reg_expression<char> regex;
+typedef reg_expression<wchar_t> wregex;
+}
+ +

The definition of reg_expression follows: it is based +very closely on class basic_string, and fulfils the requirements +for a container of charT.

+ +
namespace boost{
+template <class charT, class traits = char_regex_traits<charT>, class Allocator = std::allocator<charT>  >
+class reg_expression : public regbase
+{
+public: 
+   // typedefs:  
+   typedef charT char_type; 
+   typedef traits traits_type; 
+   // locale_type 
+   // placeholder for actual locale type used by the 
+   // traits class to localise *this. 
+   typedef typename traits::locale_type locale_type; 
+   // value_type 
+   typedef charT value_type; 
+   // reference, const_reference 
+   typedef charT& reference; 
+   typedef const charT& const_reference; 
+   // iterator, const_iterator 
+   typedef const charT* const_iterator; 
+   typedef const_iterator iterator; 
+   // difference_type 
+   typedef typename Allocator::difference_type difference_type; 
+   // size_type 
+   typedef typename Allocator::size_type size_type; 
+   // allocator_type 
+   typedef Allocator allocator_type; 
+   typedef Allocator alloc_type; 
+   // flag_type 
+   typedef jm_uintfast32_t flag_type; 
+public: 
+   // constructorsexplicit reg_expression(const Allocator& a = Allocator()); 
+   explicit reg_expression(const charT* p, flag_type f = regbase::normal, const Allocator& a = Allocator()); 
+   reg_expression(const charT* p1, const charT* p2, flag_type f = regbase::normal, const Allocator& a = Allocator()); 
+   reg_expression(const charT* p, size_type len, flag_type f, const Allocator& a = Allocator()); 
+   reg_expression(const reg_expression&); 
+   template <class ST, class SA> 
+   explicit reg_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regbase::normal, const Allocator& a = Allocator()); 
+   template <class I> 
+   reg_expression(I first, I last, flag_type f = regbase::normal, const Allocator& a = Allocator()); 
+   ~reg_expression(); 
+   reg_expression& operator=(const reg_expression&); 
+   reg_expression& operator=(const charT* ptr); 
+   template <class ST, class SA> 
+   reg_expression& operator=(const std::basic_string<charT, ST, SA>& p); 
+   // 
+   // assign: 
+   reg_expression& assign(const reg_expression& that); 
+   reg_expression& assign(const charT* ptr, flag_type f = regbase::normal); 
+   reg_expression& assign(const charT* first, const charT* last, flag_type f = regbase::normal); 
+   template <class string_traits, class A> 
+   reg_expression& assign( 
+       const std::basic_string<charT, string_traits, A>& s, 
+       flag_type f = regbase::normal); 
+   template <class iterator> 
+   reg_expression& assign(iterator first, 
+                          iterator last, 
+                          flag_type f = regbase::normal); 
+   // 
+   // allocator access: 
+   Allocator get_allocator()const; 
+   // 
+   // locale: 
+   locale_type imbue(const locale_type& l); 
+   locale_type getloc()const; 
+   // 
+   // flags: 
+   flag_type getflags()const; 
+   // 
+   // str: 
+   std::basic_string<charT> str()const; 
+   // 
+   // begin, end: 
+   const_iterator begin()const; 
+   const_iterator end()const; 
+   // 
+   // swap: 
+   void swap(reg_expression&)throw(); 
+   // 
+   // size: 
+   size_type size()const; 
+   // 
+   // max_size: 
+   size_type max_size()const; 
+   // 
+   // empty: 
+   bool empty()const; 
+   unsigned mark_count()const; 
+   bool operator==(const reg_expression&)const; 
+   bool operator<(const reg_expression&)const; 
+};
+} // namespace boost 
+ +

Class reg_expression has the following public member functions: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 reg_expression(Allocator a = + Allocator()); Constructs a default + instance of reg_expression without any expression. 
 reg_expression(charT* p, unsigned + f = regbase::normal, Allocator a = Allocator()); Constructs an instance + of reg_expression from the expression denoted by the null + terminated string p, using the flags f to + determine regular expression syntax. See class regbase for allowable flag values. 
 reg_expression(charT* p1, + charT* p2, unsigned f = regbase::normal, Allocator + a = Allocator()); Constructs an instance + of reg_expression from the expression denoted by pair of + iterators p1 and p2, using the flags f + to determine regular expression syntax. See class regbase for allowable flag values. 
 reg_expression(charT* p, + size_type len, unsigned f, Allocator a = Allocator()); Constructs an instance + of reg_expression from the expression denoted by the + string p of length len, using the flags f + to determine regular expression syntax. See class regbase for allowable flag values. 
 template <class ST, + class SA>
+ reg_expression(const std::basic_string<charT, + ST, SA>& p, jm_uintfast32_t f = regbase::normal, const + Allocator& a = Allocator());
 Constructs an instance + of reg_expression from the expression denoted by the + string p, using the flags f to determine + regular expression syntax. See class regbase + for allowable flag values.

Note - this member may not + be available depending upon your compiler capabilities.

+
 
 template <class I>
+ reg_expression(I first, I last, flag_type f = regbase::normal, + const Allocator& a = Allocator());
 Constructs an instance + of reg_expression from the expression denoted by pair of + iterators p1 and p2, using the flags f + to determine regular expression syntax. See class regbase for allowable flag values. 
 reg_expression(const + reg_expression&);Copy constructor - copies an + existing regular expression. 
 reg_expression& operator=(const + reg_expression&);Copies an existing regular + expression. 
 reg_expression& operator=(const + charT* ptr);Equivalent to assign(ptr); 
 template <class ST, class + SA>

reg_expression& operator=(const std::basic_string<charT, + ST, SA>& p);

+
Equivalent to assign(p); 
 reg_expression& assign(const + reg_expression& that);Copies the regular + expression contained by that, throws bad_expression if that + does not contain a valid expression. Returns *this. 
 reg_expression& assign(const + charT* p, flag_type f = regbase::normal);Compiles a regular + expression from the expression denoted by the null + terminated string p, using the flags f to + determine regular expression syntax. See class regbase for allowable flag values. + Throws bad_expression if p + does not contain a valid expression. Returns *this. 
 reg_expression& assign(const + charT* first, const charT* last, flag_type f = + regbase::normal);Compiles a regular + expression from the expression denoted by the pair of + iterators first-last, using the flags f to + determine regular expression syntax. See class regbase for allowable flag values. + Throws bad_expression if first-last + does not contain a valid expression. Returns *this. 
 template <class + string_traits, class A>
+ reg_expression& assign(const std::basic_string<charT, + string_traits, A>& s, flag_type f = regbase::normal);
Compiles a regular + expression from the expression denoted by the string s, + using the flags f to determine regular expression + syntax. See class regbase for + allowable flag values. Throws bad_expression + if s does not contain a valid expression. Returns + *this. 
 template <class iterator> +
+ reg_expression& assign(iterator first, iterator last, + flag_type f = regbase::normal);
Compiles a regular + expression from the expression denoted by the pair of + iterators first-last, using the flags f to + determine regular expression syntax. See class regbase for allowable flag values. + Throws bad_expression if first-last + does not contain a valid expression. Returns *this. 
 Allocator get_allocator()const;Returns the allocator used + by the expression. 
 locale_type imbue(const + locale_type& l);Imbues the expression with + the specified locale, and invalidates the current + expression. 
 locale_type getloc()const;Returns the locale used by + the expression. 
 flag_type getflags()const;Returns the flags used to + compile the current expression. 
 std::basic_string<charT> + str()const;Returns the current + expression as a string. 
 const_iterator begin()const;Returns a pointer to the + first character of the current expression. 
 const_iterator end()const;Returns a pointer to the end + of the current expression. 
 size_type size()const;Returns the length of the + current expression. 
 size_type max_size()const;Returns the maximum length + of a regular expression text. 
 bool empty()const;Returns true if the object + contains no valid expression. 
 unsigned mark_count()const + ;Returns the number of sub-expressions + in the compiled regular expression. Note that this + includes the whole match (subexpression zero), so the + value returned is always >= 1. 
+ +
+ +

Class regex_traits

+ +

#include <boost/regex_traits.hpp> +

+ +

This is a preliminary version of the regular expression +traits class, and is subject to change.

+ +

The purpose of the traits class is to make it easier to +customise the behaviour of reg_expression and the +associated matching algorithms. Custom traits classes can handle +special character sets or define additional character classes, +for example one could define [[:kanji:]] as the set of all (Unicode) +kanji characters. This library provides three traits classes and +a wrapper class regex_traits, which inherits from one of +these depending upon the default localisation model in use, class +c_regex_traits encapsulates the global C locale, class w32_regex_traits +encapsulates the global Win32 locale (only available on Win32 +systems), and class cpp_regex_traits encapsulates the C++ +locale (only provided if std::locale is supported):

+ +
template <class charT> class c_regex_traits;
+template<> class c_regex_traits<char> { /*details*/ };
+template<> class c_regex_traits<wchar_t> { /*details*/ };
+
+template <class charT> class w32_regex_traits;
+template<> class w32_regex_traits<char> { /*details*/ };
+template<> class w32_regex_traits<wchar_t> { /*details*/ };
+
+template <class charT> class cpp_regex_traits;
+template<> class cpp_regex_traits<char> { /*details*/ };
+template<> class cpp_regex_traits<wchar_t> { /*details*/ };
+
+template <class charT> class regex_traits : public base_type { /*detailts*/ };
+ +

Where "base_type" defaults to w32_regex_traits +on Win32 systems, and c_regex_traits otherwise. The +default behaviour can be changed by defining one of BOOST_RE_LOCALE_C +(forces use of c_regex_traits by default), or BOOST_RE_LOCALE_CPP +(forces use of cpp_regex_traits by default). Alternatively +a specific traits class can be passed to the reg_expression +template.

+ +

The requirements for custom traits classes are documented separately here....
+

+ +
+ +

Class match_results

+ +

#include <boost/regex.hpp> +

+ +

Regular expressions are different from many simple pattern-matching +algorithms in that as well as finding an overall match they can +also produce sub-expression matches: each sub-expression being +delimited in the pattern by a pair of parenthesis (...). There +has to be some method for reporting sub-expression matches back +to the user: this is achieved this by defining a class match_results +that acts as an indexed collection of sub-expression matches, +each sub-expression match being contained in an object of type sub_match. +

+ +
// 
+// class sub_match: 
+// denotes one sub-expression match. 
+//         
+template <class iterator>
+struct sub_match
+{
+   typedef typename std::iterator_traits<iterator>::value_type       value_type;
+   typedef typename std::iterator_traits<iterator>::difference_type  difference_type;
+   typedef iterator                                                  iterator_type;
+   
+   iterator first;
+   iterator second;
+   bool matched;
+
+   operator std::basic_string<value_type>()const;
+
+   bool operator==(const sub_match& that)const;
+   bool operator !=(const sub_match& that)const;
+   difference_type length()const;
+};
+
+// 
+// class match_results: 
+// contains an indexed collection of matched sub-expressions. 
+// 
+template <class iterator, class Allocator = std::allocator<typename std::iterator_traits<iterator>::value_type > > 
+class match_results 
+{ 
+public: 
+   typedef Allocator                                                 alloc_type; 
+   typedef typename Allocator::template Rebind<iterator>::size_type  size_type; 
+   typedef typename std::iterator_traits<iterator>::value_type       char_type; 
+   typedef sub_match<iterator>                                       value_type; 
+   typedef typename std::iterator_traits<iterator>::difference_type  difference_type; 
+   typedef iterator                                                  iterator_type; 
+   explicit match_results(const Allocator& a = Allocator()); 
+   match_results(const match_results& m); 
+   match_results& operator=(const match_results& m); 
+   ~match_results(); 
+   size_type size()const; 
+   const sub_match<iterator>& operator[](int n) const; 
+   Allocator allocator()const; 
+   difference_type length(int sub = 0)const; 
+   difference_type position(unsigned int sub = 0)const; 
+   unsigned int line()const; 
+   iterator line_start()const; 
+   std::basic_string<char_type> str(int sub = 0)const; 
+   void swap(match_results& that); 
+   bool operator==(const match_results& that)const; 
+   bool operator<(const match_results& that)const; 
+};
+ +
typedef match_results<const char*> cmatch;
+typedef match_results<const wchar_t*> wcmatch; 
+ +

Class match_results is used for reporting what matched a +regular expression, it is passed to the matching algorithms regex_match and regex_search, +and is used by regex_grep to notify the +callback function (or function object) what matched. Note that +the default allocator parameter has been chosen to match the +default allocator parameter to reg_expression. match_results has +the following public member functions:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 match_results(Allocator a = + Allocator());Constructs an instance of + match_results, using allocator instance a. 
 match_results(const match_results& + m);Copy constructor. 
 match_results& operator=(const + match_results& m);Assignment operator. 
 const sub_match<iterator>& + operator[](size_type n) const;Returns what matched, item 0 + represents the whole string, item 1 the first sub-expression + and so on. 
 Allocator& allocator()const;Returns the allocator used + by the class. 
 difference_type length(unsigned + int sub = 0);Returns the length of the + matched subexpression, defaults to the length of the + whole match, in effect this is equivalent to operator[](sub).second + - operator[](sub).first. 
 difference_type position(unsigned + int sub = 0);Returns the position of the + matched sub-expression, defaults to the position of the + whole match. The returned value is the position of the + match relative to the start of the string. 
 unsigned int + line()const;Returns the index of the + line on which the match occurred, indices start with 1, + not zero. Equivalent to the number of newline characters + prior to operator[](0).first plus one. 
 iterator line_start()const;Returns an iterator denoting + the start of the line on which the match occurred. 
 size_type size()const;Returns how many sub-expressions + are present in the match, including sub-expression zero (the + whole match). Returns zero if no matches were found in + the search operation. 
+ +


+ +

The operator[] member function needs further explanation: it +returns a const reference to a structure of type sub_match<iterator>, +which has the following public members:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 typedef typename + std::iterator_traits<iterator>::value_type value_type;The type pointed to by the + iterators. 
 typedef typename + std::iterator_traits<iterator>::difference_type + difference_type;A type that represents the + difference between two iterators. 
 typedef iterator + iterator_type;The iterator type. 
 iterator firstAn iterator denoting the + position of the start of the match. 
 iterator secondAn iterator denoting the + position of the end of the match. 
 bool matchedA Boolean value denoting + whether this sub-expression participated in the match. 
 difference_type length()const;Returns the length of the + sub-expression match. 
 operator std::basic_string<value_type> + ()const;Converts the sub-expression + match into an instance of std::basic_string<>. Note + that this member may be either absent, or present to a + more limited degree depending upon your compiler + capabilities. 
+ +

Operator[] takes an integer as an argument that denotes the +sub-expression for which to return information, the argument can +take the following special values:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 -2Returns everything from the + end of the match, to the end of the input string, + equivalent to $' in perl. If this is a null string, then: +

first == second

+

And

+

matched == false.

+
 
 -1Returns everything from the + start of the input string (or the end of the last match + if this is a grep operation), to the start of this match. + Equivalent to $` in perl. If this is a null string, then: +

first == second

+

And

+

matched == false.

+
 
 0Returns the whole of what + matched, equivalent to $& in perl. The matched + parameter is always true. 
 0 < N < size()Returns what matched sub-expression + N, if this sub-expression did not participate in the + match then 

matched == false

+

otherwise:

+

matched == true.

+
 
 N < -2 or N >= size()Represents an out-of range + non-existent sub-expression. Returns a "null" + match in which

first == last

+

And

+

matched == false.

+
 
+ +

Note that as well as being parameterised for an allocator, +match_results<> also takes an iterator type, this allows +any pair of iterators to be searched for a given regular +expression, provided the iterators have at least bi-directional +properties.
+

+ +
+ +

Algorithm regex_match

+ +

#include <boost/regex.hpp> +

+ +

The algorithm regex _match determines whether a given regular +expression matches a given sequence denoted by a pair of +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:

+ +
template <class iterator, class Allocator, class charT, class traits, class Allocator2>
+bool regex_match(iterator first, 
+                 iterator last, 
+                 match_results<iterator, Allocator>& m, 
+                 const reg_expression<charT, traits, Allocator2>& e, 
+                 unsigned flags = match_default);
+ +

The library also defines the following convenience versions, +which take either a const charT*, or a const std::basic_string<>& +in place of a pair of iterators [note - these versions may not be +available, or may be available in a more limited form, depending +upon your compilers capabilities]:

+ +
template <class charT, class Allocator, class traits, class Allocator2>
+bool regex_match(const charT* str, 
+                 match_results<const charT*, Allocator>& m, 
+                 const reg_expression<charT, traits, Allocator2>& e, 
+                 unsigned flags = match_default)
+
+template <class ST, class SA, class Allocator, class charT, class traits, class Allocator2>
+bool regex_match(const std::basic_string<charT, ST, SA>& s, 
+                 match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m, 
+                 const reg_expression<charT, traits, Allocator2>& e, 
+                 unsigned flags = match_default);
+ +

Finally there is a set of convenience versions that simply +return true or false and do not indicate what matched:

+ +
template <class iterator, class Allocator, class charT, class traits, class Allocator2>
+bool regex_match(iterator first, 
+                 iterator last, 
+                 const reg_expression<charT, traits, Allocator2>& e, 
+                 unsigned flags = match_default);
+
+template <class charT, class Allocator, class traits, class Allocator2>
+bool regex_match(const charT* str, 
+                 const reg_expression<charT, traits, Allocator2>& e, 
+                 unsigned flags = match_default)
+
+template <class ST, class SA, class Allocator, class charT, class traits, class Allocator2>
+bool regex_match(const std::basic_string<charT, ST, SA>& s, 
+                 const reg_expression<charT, traits, Allocator2>& e, 
+                 unsigned flags = match_default);
+
+ +

The parameters for the main function version are as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 iterator firstDenotes the start of the range to be matched. 
 iterator lastDenotes the end of the range + to be matched. 
 match_results<iterator, + Allocator>& mAn instance of match_results + in which what matched will be reported. On exit if a + match occurred then m[0] denotes the whole of the string + that matched, m[0].first must be equal to first, m[0].second + 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. 
 const reg_expression<charT, + traits, Allocator2>& eContains the regular + expression to be matched. 
 unsigned flags = match_defaultDetermines the semantics + used for matching, a combination of one or more match_flags enumerators.
+ +

regex_match returns false if no match occurs or true if it +does. A match only occurs if it starts at first and +finishes at last. Example: the following example processes an ftp +response:

+ +
#include <stdlib.h> 
+#include <boost/regex.hpp> 
+#include <string> 
+#include <iostream> 
+
+using namespace boost; 
+
+regex expression("([0-9]+)(\\-| |$)(.*)"); 
+
+// process_ftp: 
+// on success returns the ftp response code, and fills 
+// msg with the ftp response message. 
+int process_ftp(const char* response, std::string* msg) 
+{ 
+   cmatch what; 
+   if(regex_match(response, what, expression)) 
+   { 
+      // what[0] contains the whole string 
+      // what[1] contains the response code 
+      // what[2] contains the separator character 
+      // what[3] contains the text message. 
+      if(msg) 
+         msg->assign(what[3].first, what[3].second); 
+      return std::atoi(what[1].first); 
+   } 
+   // failure did not match 
+   if(msg) 
+      msg->erase(); 
+   return -1; 
+}
+ +

The value of the flags parameter +passed to the algorithm must be a combination of one or more of +the following values:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 match_defaultThe default value, indicates + that first represents the start of a line, the + start of a buffer, and (possibly) the start of a word. + Also implies that last represents the end of a + line, the end of the buffer and (possibly) the end of a + word. Implies that a dot sub-expression "." + will match both the newline character and a null. 
 match_not_bolWhen this flag is set then first + does not represent the start of a new line. 
 match_not_eolWhen this flag is set then last + does not represent the end of a line. 
 match_not_bobWhen this flag is set then first + is not the beginning of a buffer. 
 match_not_eobWhen this flag is set then last + does not represent the end of a buffer. 
 match_not_bowWhen this flag is set then first + can never match the start of a word. 
 match_not_eowWhen this flag is set then last + can never match the end of a word. 
 match_not_dot_newlineWhen this flag is set then a + dot expression "." can not match the newline + character. 
 match_not_dot_nullWhen this flag is set then a + dot expression "." can not match a null + character. 
 match_prev_availWhen this flag + is set, then *--first is a valid expression and + the flags match_not_bol and match_not_bow have no effect, + since the value of the previous character can be used to + check these. 
 match_anyWhen this flag + is set, then the first string matched is returned, rather + than the longest possible match. This flag can + significantly reduce the time taken to find a match, but + what matches is undefined. 
 match_not_nullWhen this flag + is set, then the expression will never match a null + string. 
 match_continuousWhen this flags + is set, then during a grep operation, each successive + match must start from where the previous match finished. 
+ +
+ +

Algorithm regex_search

+ +

 #include <boost/regex.hpp> +

+ +

The algorithm regex_search will search a range denoted by a +pair of iterators for a given regular expression. The algorithm +uses various heuristics to reduce the search time by only +checking for a match if a match could conceivably start at that +position. The algorithm is defined as follows:

+ +
template <class iterator, class Allocator, class charT, class traits, class Allocator2>
+bool regex_search(iterator first, 
+                iterator last, 
+                match_results<iterator, Allocator>& m, 
+                const reg_expression<charT, traits, Allocator2>& e, 
+                unsigned flags = match_default);
+ +

The library also defines the following convenience versions, +which take either a const charT*, or a const std::basic_string<>& +in place of a pair of iterators [note - these versions may not be +available, or may be available in a more limited form, depending +upon your compilers capabilities]:

+ +
template <class charT, class Allocator, class traits, class Allocator2>
+bool regex_search(const charT* str, 
+                match_results<const charT*, Allocator>& m, 
+                const reg_expression<charT, traits, Allocator2>& e, 
+                unsigned flags = match_default);
+
+template <class ST, class SA, class Allocator, class charT, class traits, class Allocator2>
+bool regex_search(const std::basic_string<charT, ST, SA>& s, 
+                match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m, 
+                const reg_expression<charT, traits, Allocator2>& e, 
+                unsigned flags = match_default);
+ +

The parameters for the main function version are as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 iterator firstThe starting position of the + range to search. 
 iterator lastThe ending position of the + range to search. 
 match_results<iterator, + Allocator>& mAn instance of match_results + in which what matched will be reported. On exit if a + match occurred then m[0] denotes the whole of the string + 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. 
 const reg_expression<charT, + traits, Allocator2>& eThe regular expression to + search for. 
 unsigned flags = match_defaultThe flags that determine + what gets matched, a combination of one or more match_flags enumerators. 
+ +


+ +

Example: the following example, +takes the contents of a file in the form of a string, and +searches for all the C++ class declarations in the file. The code +will work regardless of the way that std::string is implemented, +for example it could easily be modified to work with the SGI rope +class, which uses a non-contiguous storage strategy.

+ +
#include <string> 
+#include <map> 
+#include <boost/regex.hpp> 
+
+// purpose: 
+// takes the contents of a file in the form of a string 
+// and searches for all the C++ class definitions, storing 
+// their locations in a map of strings/int's 
+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:]]*)?(\\{|:[^;\\{()]*\\{)"); 
+
+void IndexClasses(map_type& m, const std::string& file) 
+{ 
+   std::string::const_iterator start, end; 
+   start = file.begin(); 
+   end = file.end(); 
+      boost::match_results<std::string::const_iterator> what; 
+   unsigned int flags = boost::match_default; 
+   while(regex_search(start, end, what, expression, flags)) 
+   { 
+      // what[0] contains the whole string 
+      // what[5] contains the class name. 
+      // what[6] contains the template specialisation if any. 
+      // add class name and position to map: 
+      m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = 
+                what[5].first - file.begin(); 
+      // update search position: 
+      start = what[0].second; 
+      // update flags: 
+      flags |= boost::match_prev_avail; 
+      flags |= boost::match_not_bob; 
+   } 
+}
+ 
+ +
+ +

Algorithm regex_grep

+ +

#include <boost/regex.hpp> +

+ +

 Regex_grep allows you to search through an iterator +range and locate all the (non-overlapping) matches with a given +regular expression. The function is declared as:

+ +
template <class Predicate, class iterator, class charT, class traits, class Allocator>
+unsigned int regex_grep(Predicate foo, 
+                        iterator first, 
+                        iterator last, 
+                        const reg_expression<charT, traits, Allocator>& e, 
+                        unsigned flags = match_default)
+ +

The library also defines the following convenience versions, +which take either a const charT*, or a const std::basic_string<>& +in place of a pair of iterators [note - these versions may not be +available, or may be available in a more limited form, depending +upon your compilers capabilities]:

+ +
template <class Predicate, class charT, class Allocator, class traits>
+bool regex_grep(Predicate foo, 
+              const charT* str, 
+              const reg_expression<charT, traits, Allocator>& e, 
+              unsigned flags = match_default);
+
+template <class Predicate, class ST, class SA, class Allocator, class charT, class traits>
+bool regex_grep(Predicate foo, 
+              const std::basic_string<charT, ST, SA>& s, 
+              const reg_expression<charT, traits, Allocator>& e, 
+              unsigned flags = match_default);
+ +

The parameters for the primary version of regex_grep have the +following meanings:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 fooA predicate function object + or function pointer, see below for more information. 
 firstThe start of the range to + search. 
 lastThe end of the range to + search. 
 eThe regular expression to + search for. 
 flagsThe flags that determine how + matching is carried out, one of the match_flags + enumerators. 
+ +

 The algorithm finds all of the non-overlapping matches +of the expression e, for each match it fills a match_results<iterator, Allocator> +structure, which contains information on what matched, and calls +the predicate foo, passing the match_results<iterator, +Allocator> as a single argument. If the predicate returns true, +then the grep operation continues, otherwise it terminates +without searching for further matches.

+ +

The general form of the predicate is:

+ +
struct grep_predicate
+{
+   bool operator()(const match_results<iterator_type, expression_type::alloc_type>& m);
+};
+ +

For example the regular expression "a*b" would find +one match in the string "aaaaab" and two in the string +"aaabb".

+ +

Remember this algorithm can be used for a lot more than +implementing a version of grep, the predicate can be and do +anything that you want, grep utilities would output the results +to the screen, another program could index a file based on a +regular expression and store a set of bookmarks in a list, or a +text file conversion utility would output to file. The results of +one regex_grep can even be chained into another regex_grep to +create recursive parsers.

+ +

Example: convert the +example from regex_search to use regex_grep instead: +

+ +
#include <string> 
+#include <map> 
+#include <boost/regex.hpp> 
+
+// IndexClasses: 
+// takes the contents of a file in the form of a string 
+// and searches for all the C++ class definitions, storing 
+// their locations in a map of strings/int's 
+
+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:]]*)?(\\{|:[^;\\{()]*\\{)"); 
+
+class IndexClassesPred 
+{ 
+   map_type& m; 
+   std::string::const_iterator base; 
+public: 
+   IndexClassesPred(map_type& a, std::string::const_iterator b) : m(a), base(b) {} 
+   bool operator()(const match_results<std::string::const_iterator, regex::alloc_type>& what) 
+   { 
+      // what[0] contains the whole string 
+      // what[5] contains the class name. 
+      // what[6] contains the template specialisation if any. 
+      // add class name and position to map: 
+      m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = 
+                what[5].first - base; 
+      return true; 
+   } 
+}; 
+
+void IndexClasses(map_type& m, const std::string& file) 
+{ 
+   std::string::const_iterator start, end; 
+   start = file.begin(); 
+   end = file.end(); 
+   regex_grep(IndexClassesPred(m, start), start, end, expression; 
+} 
+ +

Example: Use regex_grep +to call a global callback function:

+ +
#include <string> 
+#include <map> 
+#include <boost/regex.hpp> 
+
+// purpose: 
+// takes the contents of a file in the form of a string 
+// and searches for all the C++ class definitions, storing 
+// their locations in a map of strings/int's 
+
+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:]]*)?(\\{|:[^;\\{()]*\\{)"); 
+
+map_type class_index; 
+std::string::const_iterator base; 
+
+bool grep_callback(const boost::match_results<std::string::const_iterator, boost::regex::alloc_type>& what) 
+{ 
+   // what[0] contains the whole string 
+   // what[5] contains the class name. 
+   // what[6] contains the template specialisation if any. 
+   // add class name and position to map: 
+   class_index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = 
+                what[5].first - base; 
+   return true; 
+} 
+
+void IndexClasses(const std::string& file) 
+{ 
+   std::string::const_iterator start, end; 
+   start = file.begin(); 
+   end = file.end(); 
+   base = start; 
+   regex_grep(grep_callback, start, end, expression, match_default); 
+}
+  
+ +

Example: use regex_grep +to call a class member function, use the standard library +adapters std::mem_fun and std::bind1st to convert +the member function into a predicate:

+ +
#include <string> 
+#include <map> 
+#include <boost/regex.hpp> 
+#include <functional> 
+
+// purpose: 
+// takes the contents of a file in the form of a string 
+// and searches for all the C++ class definitions, storing 
+// their locations in a map of strings/int's 
+
+typedef std::map<std::string, int, std::less<std::string> > map_type; 
+
+class class_index 
+{ 
+   boost::regex expression; 
+   map_type index; 
+   std::string::const_iterator base; 
+   bool grep_callback(boost::match_results<std::string::const_iterator, boost::regex::alloc_type> what); 
+public: 
+   void IndexClasses(const std::string& file); 
+   class_index() 
+      : index(), 
+        expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?" 
+                   "(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?" 
+                   "[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?" 
+                   "(\\{|:[^;\\{()]*\\{)" 
+                   ){} 
+}; 
+
+bool class_index::grep_callback(boost::match_results<std::string::const_iterator, boost::regex::alloc_type> what) 
+{ 
+   // what[0] contains the whole string 
+   // what[5] contains the class name. 
+   // what[6] contains the template specialisation if any. 
+   // add class name and position to map: 
+   index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = 
+               what[5].first - base; 
+   return true; 
+} 
+
+void class_index::IndexClasses(const std::string& file) 
+{ 
+   std::string::const_iterator start, end; 
+   start = file.begin(); 
+   end = file.end(); 
+   base = start; 
+   regex_grep(std::bind1st(std::mem_fun(&class_index::grep_callback), this), 
+              start, 
+              end, 
+              expression); 
+} 
+  
+ +

Finally, C++ Builder +users can use C++ Builder's closure type as a callback argument:

+ +
#include <string> 
+#include <map> 
+#include <boost/regex.hpp> 
+#include <functional> 
+
+// purpose: 
+// takes the contents of a file in the form of a string 
+// and searches for all the C++ class definitions, storing 
+// their locations in a map of strings/int's 
+
+typedef std::map<std::string, int, std::less<std::string> > map_type; 
+class class_index 
+{ 
+   boost::regex expression; 
+   map_type index; 
+   std::string::const_iterator base; 
+   typedef boost::match_results<std::string::const_iterator, boost::regex::alloc_type> arg_type; 
+   bool grep_callback(const arg_type& what); 
+public: 
+   typedef bool (__closure* grep_callback_type)(const arg_type&); 
+   void IndexClasses(const std::string& file); 
+   class_index() 
+      : index(), 
+        expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?" 
+                   "(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?" 
+                   "[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?" 
+                   "(\\{|:[^;\\{()]*\\{)" 
+                   ){} 
+}; 
+
+bool class_index::grep_callback(const arg_type& what) 
+{ 
+   // what[0] contains the whole string    
+// what[5] contains the class name.    
+// what[6] contains the template specialisation if any.    
+// add class name and position to map:    
+index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = 
+               what[5].first - base; 
+   return true; 
+} 
+
+void class_index::IndexClasses(const std::string& file) 
+{ 
+   std::string::const_iterator start, end; 
+   start = file.begin(); 
+   end = file.end(); 
+   base = start; 
+   class_index::grep_callback_type cl = &(this->grep_callback); 
+   regex_grep(cl, 
+            start, 
+            end, 
+            expression); 
+} 
+
+ +
+ +

 Algorithm regex_format

+ +

#include <boost/regex.hpp> +

+ +

The algorithm regex_format takes the results of a match and +creates a new string based upon a format string, regex_format +can be used for search and replace operations:

+ +
template <class OutputIterator, class iterator, class Allocator, class charT>
+OutputIterator regex_format(OutputIterator out,
+                            const match_results<iterator, Allocator>& m,
+                            const charT* fmt,
+                            unsigned flags = 0);
+
+template <class OutputIterator, class iterator, class Allocator, class charT>
+OutputIterator regex_format(OutputIterator out,
+                            const match_results<iterator, Allocator>& m,
+                            const std::basic_string<charT>& fmt,
+                            unsigned flags = 0);
+ +

The library also defines the following convenience variation +of regex_format, which returns the result directly as a string, +rather than outputting to an iterator [note - this version may +not be available, or may be available in a more limited form, +depending upon your compilers capabilities]:

+ +
template <class iterator, class Allocator, class charT>
+std::basic_string<charT> regex_format
+                                 (const match_results<iterator, Allocator>& m, 
+                                  const charT* fmt,
+                                  unsigned flags = 0);
+
+template <class iterator, class Allocator, class charT>
+std::basic_string<charT> regex_format
+                                 (const match_results<iterator, Allocator>& m, 
+                                  const std::basic_string<charT>& fmt,
+                                  unsigned flags = 0);
+ +

Parameters to the main version of the function are passed as +follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
 OutputIterator outAn output iterator type, the + output string is sent to this iterator. Typically this + would be a std::ostream_iterator. 
 const match_results<iterator, + Allocator>& mAn instance of match_results<> + obtained from one of the matching algorithms above, and + denoting what matched. 
 const charT* fmtA format string that + determines how the match is transformed into the new + string. 
 unsigned flagsOptional flags which + describe how the format string is to be interpreted. 
+ +

Format flags are defined as follows: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
 format_allEnables all syntax options (perl-like + plus extentions). 
 format_sedAllows only a sed-like + syntax. 
 format_perlAllows only a perl-like + syntax. 
 format_no_copyDisables copying of + unmatched sections to the output string during regex_merge operations. 
+ +


+ +

The format string syntax (and available options) is described +more fully under format +strings.
+

+ +
+ +

Algorithm regex_merge

+ +

#include <boost/regex.hpp> +

+ +

The algorithm regex_merge is a combination of regex_grep and regex_format. +That is, it greps through the string finding all the matches to +the regular expression, for each match it then calls regex_format +to format the string and sends the result to the output iterator. +Sections of text that do not match are copied to the output +unchanged only if the flags parameter does not have the flag format_no_copy set.

+ +
template <class OutputIterator, class iterator, class traits, class Allocator, class charT>
+OutputIterator regex_merge(OutputIterator out, 
+                          iterator first,
+                          iterator last,
+                          const reg_expression<charT, traits, Allocator>& e, 
+                          const charT* fmt, 
+                          unsigned int flags = match_default);
+
+template <class OutputIterator, class iterator, class traits, class Allocator, class charT>
+OutputIterator regex_merge(OutputIterator out, 
+                           iterator first,
+                           iterator last,
+                           const reg_expression<charT, traits, Allocator>& e, 
+                           std::basic_string<charT>& fmt, 
+                           unsigned int flags = match_default);
+ +

The library also defines the following convenience variation +of regex_merge, which returns the result directly as a string, +rather than outputting to an iterator [note - this version may +not be available, or may be available in a more limited form, +depending upon your compilers capabilities]:

+ +
template <class traits, class Allocator, class charT>
+std::basic_string<charT> regex_merge(const std::basic_string<charT>& text,
+                                     const reg_expression<charT, traits, Allocator>& e, 
+                                     const charT* fmt, 
+                                     unsigned int flags = match_default);
+
+template <class traits, class Allocator, class charT>
+std::basic_string<charT> regex_merge(const std::basic_string<charT>& text,
+                                     const reg_expression<charT, traits, Allocator>& e, 
+                                     const std::basic_string<charT>& fmt, 
+                                     unsigned int flags = match_default);
+ +

Parameters to the main version of the function are passed as +follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 OutputIterator outAn output iterator type, the + output string is sent to this iterator. Typically this + would be a std::ostream_iterator. 
 iterator firstThe start of the range of + text to grep. 
 iterator lastThe end of the range of text + to grep. 
 const reg_expression<charT, + traits, Allocator>& eThe expression to search for. 
 const charT* fmtThe format string to be + applied to sections of text that match. 
 unsigned int + flags = match_defaultFlags which determine how + the expression is matched - see match_flags, + and how the format string is interpreted - see format_flags. 
+ +

Example: the following example +takes C/C++ source code as input, and outputs syntax highlighted +HTML code.

+ +
#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <iterator>
+#include <boost/regex.hpp>
+#include <fstream>
+#include <iostream>
+
+// purpose:
+// takes the contents of a file and transform to
+// syntax highlighted code in html format
+
+boost::regex e1, e2;
+extern const char* expression_text;
+extern const char* format_string;
+extern const char* pre_expression;
+extern const char* pre_format;
+extern const char* header_text;
+extern const char* footer_text;
+
+void load_file(std::string& s, std::istream& is)
+{
+   s.erase();
+   s.reserve(is.rdbuf()->in_avail());
+   char c;
+   while(is.get(c))
+   {
+      if(s.capacity() == s.size())
+         s.reserve(s.capacity() * 3);
+      s.append(1, c);
+   }
+}
+
+int main(int argc, const char** argv)
+{
+   e1.set_expression(expression_text);
+   e2.set_expression(pre_expression);
+   for(int i = 1; i < argc; ++i)
+   {
+      std::cout << "Processing file " << argv[i] << std::endl;
+      std::ifstream fs(argv[i]);
+      std::string in;
+      load_file(in, fs);
+      std::string out_name(std::string(argv[i]) + std::string(".htm"));
+      std::ofstream os(out_name.c_str());
+      os << header_text;
+      // 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);
+      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);
+      regex_merge(out, s.begin(), s.end(), e1, format_string);
+      os << footer_text;
+   }
+   return 0;
+}
+
+extern const char* pre_expression = "(<)|(>)|\\r";
+extern const char* pre_format = "(?1<)(?2>)";
+
+
+const char* expression_text = // preprocessor directives: index 1
+                              "(^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*)|"
+                              // comment: index 3
+                              "(//[^\\n]*|/\\*([^*]|\\*+[^*/])*\\*+/)|"
+                              // literals: index 5
+                              "\\<([+-]?((0x[[:xdigit:]]+)|(([[:digit:]]*\\.)?[[:digit:]]+([eE][+-]?[[:digit:]]+)?))u?((int(8|16|32|64))|L)?)\\>|"
+                              // string literals: index 14
+                              "('([^\\\\']|\\\\.)*'|\"([^\\\\\"]|\\\\.)*\")|"
+                              // keywords: index 17
+                              "\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import"
+                              "|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall"
+                              "|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool"
+                              "|break|case|catch|cdecl|char|class|const|const_cast|continue|default|delete"
+                              "|do|double|dynamic_cast|else|enum|explicit|extern|false|float|for|friend|goto"
+                              "|if|inline|int|long|mutable|namespace|new|operator|pascal|private|protected"
+                              "|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast"
+                              "|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned"
+                              "|using|virtual|void|volatile|wchar_t|while)\\>"
+                              ;
+
+const char* format_string = "(?1<font color=\"#008040\">$&</font>)"
+                            "(?3<I><font color=\"#000080\">$&</font></I>)"
+                            "(?5<font color=\"#0000A0\">$&</font>)"
+                            "(?14<font color=\"#0000FF\">$&</font>)"
+                            "(?17<B>$&</B>)";
+
+const char* header_text = "<HTML>\n<HEAD>\n"
+                          "<TITLE>Auto-generated html formated source</TITLE>\n"
+                          "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1252\">\n"
+                          "</HEAD>\n"
+                          "<BODY LINK=\"#0000ff\" VLINK=\"#800080\" BGCOLOR=\"#ffff99\">\n"
+                          "<P> </P>\n<PRE>";
+
+const char* footer_text = "</PRE>\n</BODY>\n\n";
+
+
+ +
+ +

Algorithm regex_split

+ +

#include <boost/regex.hpp> +

+ +

Algorithm regex_split performs a similar operation to the perl +split operation, and comes in three overloaded forms:

+ +
template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2, class Alloc2>
+std::size_t regex_split(OutputIterator out, 
+                        std::basic_string<charT, Traits1, Alloc1>& s, 
+                        const reg_expression<charT, Traits2, Alloc2>& e,
+                        unsigned flags,
+                        std::size_t max_split);
+
+template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2, class Alloc2>
+std::size_t regex_split(OutputIterator out, 
+                        std::basic_string<charT, Traits1, Alloc1>& s, 
+                        const reg_expression<charT, Traits2, Alloc2>& e,
+                        unsigned flags = match_default);
+
+template <class OutputIterator, class charT, class Traits1, class Alloc1>
+std::size_t regex_split(OutputIterator out, 
+                        std::basic_string<charT, Traits1, Alloc1>& s);
+ +

Each version takes an output-iterator for output, and a string +for input. If the expression contains no marked sub-expressions, +then the algorithm writes one string onto the output-iterator for +each section of input that does not match the expression. If the +expression does contain marked sub-expressions, then each time a +match is found, one string for each marked sub-expression will be +written to the output-iterator. No more than max_split strings +will be written to the output-iterator. Before returning, all the +input processed will be deleted from the string s (if max_split +is not reached then all of s will be deleted). Returns +the number of strings written to the output-iterator. If the +parameter max_split is not specified then it defaults to +UINT_MAX. If no expression is specified, then it defaults to +"\s+", and splitting occurs on whitespace.

+ +

Example: the following +function will split the input string into a series of tokens, and +remove each token from the string s:

+ +
unsigned tokenise(std::list<std::string>& l, std::string& s)
+{
+   return boost::regex_split(std::back_inserter(l), s);
+}
+ +

Example: the following +short program will extract all of the URL's from a html file, and +print them out to cout:

+ +
#include <list>
+#include <fstream>
+#include <iostream>
+#include <boost/regex.hpp>
+
+boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"",
+               boost::regbase::normal | boost::regbase::icase);
+
+void load_file(std::string& s, std::istream& is)
+{
+   s.erase();
+   //
+   // attempt to grow string buffer to match file size,
+   // this doesn't always work...
+   s.reserve(is.rdbuf()-&gtin_avail());
+   char c;
+   while(is.get(c))
+   {
+      // use logarithmic growth stategy, in case
+      // in_avail (above) returned zero:
+      if(s.capacity() == s.size())
+         s.reserve(s.capacity() * 3);
+      s.append(1, c);
+   }
+}
+
+
+int main(int argc, char** argv)
+{
+   std::string s;
+   std::list<std::string> l;
+
+   for(int i = 1; i < argc; ++i)
+   {
+      std::cout << "Findings URL's in " << argv[i] << ":" << std::endl;
+      s.erase();
+      std::ifstream is(argv[i]);
+      load_file(s, is);
+      boost::regex_split(std::back_inserter(l), s, e);
+      while(l.size())
+      {
+         s = *(l.begin());
+         l.pop_front();
+         std::cout << s << std::endl;
+      }
+   }
+   return 0;
+}
+ +
+ +

Copyright Dr +John Maddock 1998-2000 all rights reserved.

+ + diff --git a/traits_class_ref.htm b/traits_class_ref.htm new file mode 100644 index 00000000..fb94ea91 --- /dev/null +++ b/traits_class_ref.htm @@ -0,0 +1,871 @@ + + + + + + + + + + regex++ traits-class reference + + + + + + + + +

C++ Boost

+

Regex++, Traits Class +Reference. (version 3.01, 18 April 2000) 

+
+Copyright (c) 1998-2000
+Dr John Maddock
+
+Permission to use, copy, modify, distribute and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation.  Dr John Maddock makes no representations
+about the suitability of this software for any purpose.  
+It is provided "as is" without express or implied warranty.
+
+ +
+
+

This section describes the traits class requirements of the reg_expression +template class, these requirements are somewhat complex (sorry), and subject to +change as uses ask for new features, however I will try to keep them stable for +a while, and ideally the requirements should lessen rather than increase.

+

The reg_expression traits classes encapsulate both the properties of +a character type, and the properties of the locale associated with that type. +The associated locale may be defined at run-time (via std::locale), or +hard-coded into the traits class and determined at compile time.

+

The following example class illustrates the interface required by a +"typical" traits class for use with class reg_expression:

+
+class mytraits
+{
+   typedef implementation_defined char_type;
+   typedef implementation_defined uchar_type;
+   typedef implementation_defined size_type;
+   typedef implementation_defined string_type;
+   typedef implementation_defined locale_type;
+   typedef implementation_defined uint32_t;
+   struct sentry
+   {
+      sentry(const mytraits&);
+      operator void*() { return this; }
+   };
+
+   enum char_syntax_type
+   {
+      syntax_char = 0,
+      syntax_open_bracket = 1,                  // (
+      syntax_close_bracket = 2,                 // )
+      syntax_dollar = 3,                        // $
+      syntax_caret = 4,                         // ^
+      syntax_dot = 5,                           // .
+      syntax_star = 6,                          // *
+      syntax_plus = 7,                          // +
+      syntax_question = 8,                      // ?
+      syntax_open_set = 9,                      // [
+      syntax_close_set = 10,                    // ]
+      syntax_or = 11,                           // |
+      syntax_slash = 12,                        //
+      syntax_hash = 13,                         // #
+      syntax_dash = 14,                         // -
+      syntax_open_brace = 15,                   // {
+      syntax_close_brace = 16,                  // }
+      syntax_digit = 17,                        // 0-9
+      syntax_b = 18,                            // for \b
+      syntax_B = 19,                            // for \B
+      syntax_left_word = 20,                    // for \<
+      syntax_right_word = 21,                   // for \
+      syntax_w = 22,                            // for \w
+      syntax_W = 23,                            // for \W
+      syntax_start_buffer = 24,                 // for \`
+      syntax_end_buffer = 25,                   // for \'
+      syntax_newline = 26,                      // for newline alt
+      syntax_comma = 27,                        // for {x,y}
+
+      syntax_a = 28,                            // for \a
+      syntax_f = 29,                            // for \f
+      syntax_n = 30,                            // for \n
+      syntax_r = 31,                            // for \r
+      syntax_t = 32,                            // for \t
+      syntax_v = 33,                            // for \v
+      syntax_x = 34,                            // for \xdd
+      syntax_c = 35,                            // for \cx
+      syntax_colon = 36,                        // for [:...:]
+      syntax_equal = 37,                        // for [=...=]
+   
+      // perl ops:
+      syntax_e = 38,                            // for \e
+      syntax_l = 39,                            // for \l
+      syntax_L = 40,                            // for \L
+      syntax_u = 41,                            // for \u
+      syntax_U = 42,                            // for \U
+      syntax_s = 43,                            // for \s
+      syntax_S = 44,                            // for \S
+      syntax_d = 45,                            // for \d
+      syntax_D = 46,                            // for \D
+      syntax_E = 47,                            // for \Q\E
+      syntax_Q = 48,                            // for \Q\E
+      syntax_X = 49,                            // for \X
+      syntax_C = 50,                            // for \C
+      syntax_Z = 51,                            // for \Z
+      syntax_G = 52,                            // for \G
+      syntax_bang = 53,                         // reserved for future use '!'
+      syntax_and = 54,                          // reserve for future use '&'
+   };
+
+   enum{
+      char_class_none = 0,
+      char_class_alpha,
+      char_class_cntrl,
+      char_class_digit,
+      char_class_lower,
+      char_class_punct,
+      char_class_space,
+      char_class_upper,
+      char_class_xdigit,
+      char_class_blank,
+      char_class_unicode,
+      char_class_alnum,
+      char_class_graph,
+      char_class_print,
+      char_class_word
+   };
+
+   static size_t length(const char_type* p);
+   unsigned int syntax_type(size_type c)const;
+   char_type translate(char_type c, bool icase)const;
+   void transform(string_type& out, const string_type& in)const;
+   void transform_primary(string_type& out, const string_type& in)const;
+   bool is_separator(char_type c)const;
+   bool is_combining(char_type)const;
+   bool is_class(char_type c, uint32_t f)const;
+   int toi(char_type c)const;
+   int toi(const char_type*& first, const char_type* last, int radix)const;
+   uint32_t lookup_classname(const char_type* first, const char_type* last)const;
+   bool lookup_collatename(string_type& buf, const char_type* first, const char_type* last)const;
+   locale_type imbue(locale_type l);
+   locale_type getloc()const;
+   std::string error_string(unsigned id)const;
+
+   mytraits();
+   ~mytraits();
+};
+
+ +

The member types required by a traits class are defined as follows:
+  

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  Member name Description  
  char_type The character type encapsulated +by this traits class, must be a POD type, and be convertible to uchar_type. + 
  uchar_type The unsigned type corresponding +to char_type, must be convertible to size_type.  
  size_type An unsigned integral type, with +at least as much precision as uchar_type.  
  string_type A type that offers the same +facilities as std::basic_string<char_type. This is used for collating +elements, and sort strings, if char_type has no locale dependent collation (it +is not a "character"), then it could be something simpler than +std::basic_string.  
  locale_type A type that encapsulates the +locale used by the traits class, probably std::locale but could be a platform +specific type, or a dummy type if per-instance locales are not supported by the +traits class.  
  uint32_t An unsigned integral type with +at least 32-bits of precision, used as a bitmask type for character +classification.  
  sentry A class or struct type which is +constructible from an instance of the traits class, and is convertible to +void*. An instance of type sentry will be constructed before compiling each +regular expression, it provides an opportunity to carry out prefix/suffix +operations on the traits class. 

For example a traits class that +encapsulates the global locale, can use this as an opportunity to synchronize +with the global locale (by updating any cached data).

+
 
+


+ The following member constants are used to represent the locale +independent syntax of a regular expression; the member function +syntax_type returns one of these values, and is used to convert a locale +dependent regular expression, into a locale-independent sequence of tokens.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  Member constant  English language +representation   
  syntax_char  All non-special +characters.   
  syntax_open_bracket   
  syntax_close_bracket   
  syntax_dollar   
  syntax_caret   
  syntax_dot   
  syntax_star   
  syntax_plus   
  syntax_question   
  syntax_open_set   
  syntax_close_set   
  syntax_or   
  syntax_slash   
  syntax_hash   
  syntax_dash   
  syntax_open_brace   
  syntax_close_brace   
  syntax_digit  0123456789   
  syntax_b   
  syntax_B   
  syntax_left_word   
  syntax_right_word     
  syntax_w   
  syntax_W   
  syntax_start_buffer   
  syntax_end_buffer   
  syntax_newline  \n   
  syntax_comma   
  syntax_a   
  syntax_f   
  syntax_n   
  syntax_r   
  syntax_t   
  syntax_v   
  syntax_x   
  syntax_c   
  syntax_colon   
  syntax_equal   
  syntax_e   
  syntax_l   
  syntax_L   
  syntax_u   
  syntax_U   
  syntax_s   
  syntax_S   
  syntax_d   
  syntax_D   
  syntax_E   
  syntax_Q   
  syntax_X   
  syntax_C   
  syntax_Z   
  syntax_G   
  syntax_bang   
  syntax_and   
+

+

The following member constants are used to represent particular character +classifications:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  Member constant  Description  
  char_class_none  No classification, must be zero. + 
  char_class_alpha  All alphabetic characters.  
  char_class_cntrl  All control characters.  
  char_class_digit  All decimal digits.  
  char_class_lower  All lower case characters.  
  char_class_punct  All punctuation characters. + 
  char_class_space  All white-space characters. + 
  char_class_upper  All upper case characters.  
  char_class_xdigit  All hexadecimal digit +characters.  
  char_class_blank  All blank characters (space + +tab).  
  char_class_unicode  All extended unicode characters +- those that can not be represented as a single narrow character.  
  char_class_alnum  All alpha-numeric characters. + 
  char_class_graph  All graphic characters.  
  char_class_print  All printable characters.  
  char_class_word  All word characters +(alphanumeric characters + the underscore).  
+

The following member functions are required by all regular expression traits +classes, those members that are declared here as const, could be +declared static instead if the class does not contain instance data:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  Member function Description  
  static size_t length(const +char_type* p); Returns the length of the +null-terminated string p.  
  unsigned int +syntax_type(size_type c)const;  Converts an input +character into a locale independent token (one of the syntax_xxx member +constants). Called when parsing the regular expression into a +locale-independent parse tree. 

Example: in English language regular +expressions we would use "[[:word:]]" to represent the character +class of all word characters, and "\w" as a shortcut for this. +Consequently syntax_type('w') returns syntax_w. In French language regular +expressions, we would use "[[:mot:]]" in place of +"[[:word:]]" and therefore "\m" in place of "\w", +therefore it is syntax_type('m') that returns syntax_w.

+
 
  char_type translate(char_type c, +bool icase)const;  Translates an input +character into a unique identifier that represents the equivalence class that +that character belongs to. If icase is true, then the returned value is +insensitive to case. 

[An equivalence class is the set of all +characters that must be treated as being equivalent to each other.]

+
 
  void transform(string_type& +out, const string_type& in)const;  Transforms the string +in, into a locale-dependent sort key, and stores the result in +out.  
  void +transform_primary(string_type& out, const string_type& in)const;  Transforms the string +in, into a locale-dependent primary sort key, and stores the result in +out.  
  bool is_separator(char_type +c)const;  Returns true only if +c is a line separator.  
  bool is_combining(char_type +c)const;  Returns true only if +c is a unicode combining character.  
  bool is_class(char_type c, +uint32_t f)const;  Returns true only if +c is a member of one of the character classes represented by the bitmap +f.  
  int toi(char_type c)const;  Converts the character +c to a decimal integer. 

[Precondition: +is_class(c,char_class_digit)==true]

+
 
  int toi(const char_type*& +first, const char_type* last, int radix)const;  Converts the string +[first-last) into an integral value using base radix. Stops when it +finds the first non-digit character, and sets first to point to that +character. 

[Precondition: is_class(*first,char_class_digit)==true] +

+
 
  uint32_t lookup_classname(const +char_type* first, const char_type* last)const;  Returns the bitmap +representing the character class [first-last), or char_class_none if +[first-last) is not recognized as a character class name.  
  bool +lookup_collatename(string_type& buf, const char_type* first, const +char_type* last)const; If the sequence [first-last) is +the name of a known collating element, then stores the collating element in +buf, and returns true, otherwise returns false.  
  locale_type imbue(locale_type +l);  Imbues the class with the +locale l.  
  locale_type getloc()const;  Returns the traits-class +locale.  
  std::string +error_string(unsigned id)const;  Returns the +locale-dependent error-string associated with the error-number id. The +parameter id is one of the REG_XXX error codes described by the POSIX +standard, and defined in <boost/cregex.hpp.  
  mytraits();  Constructor.  
  ~ mytraits();  Destructor.  
+

+


+

+
+

Copyright Dr John +Maddock 1998-2000 all rights reserved.

+ + +