diff --git a/src/cpp_regex_traits.cpp b/src/cpp_regex_traits.cpp index bf353d40..047ed6a2 100644 --- a/src/cpp_regex_traits.cpp +++ b/src/cpp_regex_traits.cpp @@ -239,9 +239,11 @@ message_data::message_data(const std::locale& l, const std::string& regex_ // // for some reason Borland C++ Builder 6 won't let us use // std::isspace(char, std::locale) unless we call it - // unqualifed - weird. + // unqualifed - weird. This seems to be affecting other + // STLport users as well (gcc3.1+STLport5), so enable the + // workaround for all STLport users... // -#if defined(__BORLANDC__) && (__BORLANDC__ == 0x560) +#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) using namespace std; # define BOOST_REGEX_STD #else diff --git a/src/cregex.cpp b/src/cregex.cpp index 08d325ab..e4d4bea8 100644 --- a/src/cregex.cpp +++ b/src/cregex.cpp @@ -78,16 +78,28 @@ public: }; regex e; cmatch m; +#ifndef BOOST_REGEX_NO_FILEITER match_results fm; +#endif type t; const char* pbase; unsigned line; +#ifndef BOOST_REGEX_NO_FILEITER mapfile::iterator fbase; +#endif std::map > strings; std::map > positions; void update(); void clean(); - RegExData() : e(), m(), fm(), t(type_copy), pbase(0), line(0), fbase(), strings(), positions() {} + RegExData() : e(), m(), +#ifndef BOOST_REGEX_NO_FILEITER + fm(), +#endif + t(type_copy), pbase(0), line(0), +#ifndef BOOST_REGEX_NO_FILEITER + fbase(), +#endif + strings(), positions() {} }; void RegExData::update() @@ -104,6 +116,7 @@ void RegExData::update() } line = m.line(); } +#ifndef BOOST_REGEX_NO_FILEITER else { for(unsigned int i = 0; i < fm.size(); ++i) @@ -113,14 +126,17 @@ void RegExData::update() } line = fm.line(); } +#endif t = type_copy; } void RegExData::clean() { BOOST_RE_GUARD_STACK +#ifndef BOOST_REGEX_NO_FILEITER fbase = mapfile::iterator(); fm = match_results(); +#endif } } // namespace @@ -310,6 +326,7 @@ unsigned int RegEx::Grep(std::vector& v, const char* p, unsigned in pdata->update(); return result; } +#ifndef BOOST_REGEX_NO_FILEITER namespace re_detail{ struct pred4 { @@ -431,6 +448,7 @@ unsigned int RegEx::FindFiles(FindFilesCallback cb, const char* files, bool recu return result; } +#endif std::string RegEx::Merge(const std::string& in, const std::string& fmt, bool copy, unsigned int flags) @@ -472,8 +490,10 @@ std::size_t RegEx::Position(int i)const { case re_detail::RegExData::type_pc: return pdata->m[i].matched ? pdata->m[i].first - pdata->pbase : RegEx::npos; +#ifndef BOOST_REGEX_NO_FILEITER case re_detail::RegExData::type_pf: return pdata->fm[i].matched ? pdata->fm[i].first - pdata->fbase : RegEx::npos; +#endif case re_detail::RegExData::type_copy: { std::map >::iterator pos = pdata->positions.find(i); @@ -492,8 +512,10 @@ unsigned int RegEx::Line()const { case re_detail::RegExData::type_pc: return pdata->m[0].matched ? pdata->m.line() : RegEx::npos; +#ifndef BOOST_REGEX_NO_FILEITER case re_detail::RegExData::type_pf: return pdata->fm[0].matched ? pdata->fm.line() : RegEx::npos; +#endif case re_detail::RegExData::type_copy: { return pdata->line; @@ -516,8 +538,10 @@ std::size_t RegEx::Length(int i)const { case re_detail::RegExData::type_pc: return pdata->m[i].matched ? pdata->m[i].second - pdata->m[i].first : RegEx::npos; +#ifndef BOOST_REGEX_NO_FILEITER case re_detail::RegExData::type_pf: return pdata->fm[i].matched ? pdata->fm[i].second - pdata->fm[i].first : RegEx::npos; +#endif case re_detail::RegExData::type_copy: { std::map >::iterator pos = pdata->strings.find(i); @@ -536,8 +560,10 @@ bool RegEx::Matched(int i)const { case re_detail::RegExData::type_pc: return pdata->m[i].matched; +#ifndef BOOST_REGEX_NO_FILEITER case re_detail::RegExData::type_pf: return pdata->fm[i].matched; +#endif case re_detail::RegExData::type_copy: { std::map >::iterator pos = pdata->strings.find(i); diff --git a/src/fileiter.cpp b/src/fileiter.cpp index 30b3b621..5a2e088b 100644 --- a/src/fileiter.cpp +++ b/src/fileiter.cpp @@ -27,6 +27,8 @@ #include #include +#ifndef BOOST_REGEX_NO_FILEITER + #if defined(__CYGWIN__) || defined(__CYGWIN32__) #include #endif @@ -76,7 +78,7 @@ void mapfile::open(const char* file) if(hfile != INVALID_HANDLE_VALUE) { hmap = CreateFileMapping(hfile, 0, PAGE_READONLY, 0, 0, 0); - if(hmap == INVALID_HANDLE_VALUE) + if((hmap == INVALID_HANDLE_VALUE) || (hmap == NULL)) { CloseHandle(hfile); hmap = 0; @@ -888,6 +890,7 @@ bool _fi_FindClose(_fi_find_handle dat) } // namespace re_detail } // namspace boost +#endif // BOOST_REGEX_NO_FILEITER