Moved static stables into the function bodies to fix a gcc on MacOS X and IMB compiler bug.

Fixed config system for dll builds - the default linkage option is now static linking.
Fixed makefiles - dll builds now work.
Added Misc fixes for the example programs.


[SVN r19044]
This commit is contained in:
John Maddock
2003-07-11 11:51:35 +00:00
parent c32c644a38
commit cb9409160a
30 changed files with 1064 additions and 920 deletions

View File

@ -209,7 +209,7 @@ using std::distance;
# define BOOST_REGEX_HAS_DLL_RUNTIME
#endif
#if defined(BOOST_REGEX_HAS_DLL_RUNTIME) && !defined(BOOST_REGEX_STATIC_LINK)
#if defined(BOOST_REGEX_HAS_DLL_RUNTIME) && defined(BOOST_REGEX_DYN_LINK)
# if defined(BOOST_REGEX_SOURCE)
# define BOOST_REGEX_DECL __declspec(dllexport)
# define BOOST_REGEX_BUILD_DLL
@ -233,11 +233,7 @@ using std::distance;
****************************************************************************/
#if defined(_MSC_VER) && (_MSC_VER >= 1200) && defined(_MSC_EXTENSIONS)
# if defined(_DEBUG)
# define BOOST_REGEX_CALL __cdecl
# else
# define BOOST_REGEX_CALL __fastcall
# endif
# define BOOST_REGEX_CALL __fastcall
# define BOOST_REGEX_CCALL __cdecl
#endif
@ -570,5 +566,40 @@ BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void*);
}} // namespaces
#endif
/*****************************************************************************
*
* Diagnostics:
*
****************************************************************************/
#if defined(BOOST_REGEX_DIAG)
# pragma message ("BOOST_REGEX_DECL set as: " BOOST_STRINGIZE(BOOST_REGEX_DECL))
# pragma message ("BOOST_REGEX_CALL set as: " BOOST_STRINGIZE(BOOST_REGEX_CALL))
# pragma message ("BOOST_REGEX_CCALL set as: " BOOST_STRINGIZE(BOOST_REGEX_CCALL))
#ifdef BOOST_REGEX_USE_C_LOCALE
# pragma message ("Using C locale in regex traits class")
#elif BOOST_REGEX_USE_CPP_LOCALE
# pragma message ("Using C++ locale in regex traits class")
#else
# pragma message ("Using Win32 locale in regex traits class")
#endif
#ifdef BOOST_REGEX_DYN_LINK
# pragma message ("Dynamic linking enabled")
#endif
#ifdef BOOST_REGEX_NO_LIB
# pragma message ("Auto-linking disabled")
#endif
#ifdef BOOST_REGEX_NO_EXTERNAL_TEMPLATES
# pragma message ("Extern templates disabled")
#endif
#ifdef BOOST_REGEX_V3
# pragma message ("Using Version 3 regex code")
#else
# pragma message ("Using Version 4 regex code")
#endif
#endif
#endif

View File

@ -166,7 +166,9 @@ BOOST_LIB_DEBUG_OPT: nothing for release builds,
&& defined(BOOST_LIB_DEBUG_OPT)
# pragma comment(lib, BOOST_LIB_PREFIX BOOST_LIB_NAME "_" BOOST_LIB_TOOLSET "_" BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT BOOST_LIB_DEBUG_OPT ".lib")
//# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_LIB_NAME "_" BOOST_LIB_TOOLSET "_" BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT BOOST_LIB_DEBUG_OPT ".lib")
#ifdef BOOST_REGEX_DIAG
# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_LIB_NAME "_" BOOST_LIB_TOOLSET "_" BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT BOOST_LIB_DEBUG_OPT ".lib")
#endif
#endif

View File

@ -28,8 +28,14 @@
// locale:
// #define BOOST_REGEX_USE_CPP_LOCALE
// define this if the runtime library is a dll, and you
// want BOOST_REGEX_DYN_LINK to set up dll exports/imports
// with __declspec(dllexport)/__declspec(dllimport.)
// #define BOOST_REGEX_HAS_DLL_RUNTIME
// define this if you want to dynamically link to regex,
// if the runtime library is also a dll (Probably Win32 specific):
// if the runtime library is also a dll (Probably Win32 specific,
// and has no effect unless BOOST_REGEX_HAS_DLL_RUNTIME is set):
// #define BOOST_REGEX_DYN_LINK
// define this if you don't want the lib to automatically

View File

@ -376,12 +376,6 @@ private:
// the first repeat being examined (top of linked list):
repeater_count<BidiIterator> rep_obj;
// table of functions to match states:
static const matcher_proc_type s_match_vtable[];
// table of functions to search for matching attempt start:
static const matcher_proc_type s_find_vtable[];
#ifdef BOOST_REGEX_NON_RECURSIVE
//
// additional members for non-recursive version:
@ -423,8 +417,6 @@ private:
bool m_recursive_result;
// how many memory blocks have we used up?:
unsigned used_block_count;
// table of pointers to unwind proceedures:
static const unwind_proc_type s_unwind_table[];
#endif
// these operations aren't allowed, so are declared private:

View File

@ -145,6 +145,17 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match()
template <class BidiIterator, class Allocator, class traits, class Allocator2>
bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find()
{
static matcher_proc_type const s_find_vtable[] =
{
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_any,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_word,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_line,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_buf,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_prefix,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit,
};
#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
__try{
#endif
@ -772,62 +783,6 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit
return false;
}
template <class BidiIterator, class Allocator, class traits, class Allocator2>
typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::matcher_proc_type const
perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_match_vtable[] =
{
(&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark),
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_endmark,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_literal,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_start_line,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_end_line,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_wild,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_match,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_boundary,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_within_word,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_start,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_start,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_backref,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_jump,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_alt,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_combining,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_soft_buffer_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_restart_continue,
#if 0
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
#else
#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300)
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast,
#else
(::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_slow),
#endif
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_repeat,
#endif
};
template <class BidiIterator, class Allocator, class traits, class Allocator2>
typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::matcher_proc_type const
perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_find_vtable[] =
{
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_any,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_word,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_line,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_buf,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_prefix,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit,
};
} // namespace re_detail
} // namespace boost

View File

@ -117,6 +117,36 @@ struct saved_single_repeat : public saved_state
template <class BidiIterator, class Allocator, class traits, class Allocator2>
bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_all_states()
{
static matcher_proc_type const s_match_vtable[] =
{
(&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark),
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_endmark,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_literal,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_start_line,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_end_line,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_wild,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_match,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_boundary,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_within_word,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_start,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_start,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_backref,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_jump,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_alt,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_combining,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_soft_buffer_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_restart_continue,
(::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_slow),
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_repeat,
};
push_recursion_stopper();
do{
while(pstate)
@ -707,6 +737,24 @@ unwinding does in the recursive implementation.
template <class BidiIterator, class Allocator, class traits, class Allocator2>
bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind(bool have_match)
{
static unwind_proc_type const s_unwind_table[] =
{
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_paren,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_recursion_stopper,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_assertion,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_alt,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_repeater_counter,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_extra_block,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_greedy_single_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_slow_dot_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_fast_dot_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_char_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_short_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_long_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_non_greedy_repeat,
};
m_recursive_result = have_match;
unwind_proc_type unwinder;
bool cont;
@ -1182,27 +1230,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_non_greed
return r;
}
template <class BidiIterator, class Allocator, class traits, class Allocator2>
typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_proc_type const
perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_unwind_table[] =
{
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_paren,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_recursion_stopper,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_assertion,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_alt,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_repeater_counter,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_extra_block,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_greedy_single_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_slow_dot_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_fast_dot_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_char_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_short_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_long_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_non_greedy_repeat,
};
}
} // namespace re_detail
} // namespace boost
#ifdef __BORLANDC__

View File

@ -51,6 +51,36 @@ public:
template <class BidiIterator, class Allocator, class traits, class Allocator2>
bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_all_states()
{
static matcher_proc_type const s_match_vtable[] =
{
(&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark),
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_endmark,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_literal,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_start_line,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_end_line,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_wild,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_match,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_boundary,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_within_word,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_start,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_start,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_backref,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_jump,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_alt,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_combining,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_soft_buffer_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_restart_continue,
(::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_slow),
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_repeat,
};
if(state_count > max_state_count)
raise_error(traits_inst, REG_ESPACE);
while(pstate)

View File

@ -103,7 +103,6 @@ inline bool regex_search(const std::basic_string<wchar_t>& s,
#endif
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template <class BidiIterator, class charT, class traits, class Allocator2>
bool regex_search(BidiIterator first, BidiIterator last,
const reg_expression<charT, traits, Allocator2>& e,
@ -118,6 +117,8 @@ bool regex_search(BidiIterator first, BidiIterator last,
return matcher.find();
}
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template <class charT, class traits, class Allocator2>
inline bool regex_search(const charT* str,
const reg_expression<charT, traits, Allocator2>& e,

View File

@ -25,10 +25,21 @@
#include <boost/shared_ptr.hpp>
#include <boost/detail/workaround.hpp>
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300)
//
// Borland C++ Builder 6, and Visual C++ 6,
// can't cope with the array template constructor
// so we have a template member that will accept any type as
// argument, and then assert that is really is an array:
//
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_array.hpp>
#endif
namespace boost{
template <class BidirectionalIterator,
template <class BidirectionalIterator,
class charT,
class traits,
class Allocator>
@ -50,13 +61,29 @@ public:
: end(last), pre(p), flags(f){ subs.push_back(sub); }
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f)
: end(last), pre(p), subs(v), flags(f){}
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <class T>
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f)
: end(last), pre(p), flags(f)
{
// assert that T really is an array:
BOOST_STATIC_ASSERT(::boost::is_array<T>::value);
const std::size_t array_size = sizeof(T) / sizeof(submatches[0]);
for(std::size_t i = 0; i < array_size; ++i)
{
subs.push_back(submatches[i]);
}
}
#else
template <std::size_t CN>
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const int (&submatches)[CN], match_flag_type f)
: end(last), pre(p), flags(f)
{
{
for(std::size_t i = 0; i < CN; ++i)
subs.push_back(submatches[i]);
{
subs.push_back(submatches[i]);
}
}
#endif
@ -110,7 +137,7 @@ public:
else if((last_end != end) && (subs[0] == -1))
{
N =-1;
result =value_type(last_end, end);
result = value_type(last_end, end);
return true;
}
return false;
@ -150,9 +177,19 @@ public:
if(!pdata->init(a))
pdata.reset();
}
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <class T>
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
const T& submatches, match_flag_type m = match_default)
: pdata(new impl(&re, b, submatches, m))
{
if(!pdata->init(a))
pdata.reset();
}
#else
template <std::size_t N>
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
const int (&submatches)[N], match_flag_type m = match_default)
: pdata(new impl(&re, b, submatches, m))
{