Update of /cvsroot/boost/boost/boost/xpressive
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17638

Modified Files:
        xpressive_fwd.hpp basic_regex.hpp 
Log Message:
use MS stack guard when available

Index: xpressive_fwd.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/xpressive_fwd.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- xpressive_fwd.hpp   3 Jun 2007 02:23:49 -0000       1.14
+++ xpressive_fwd.hpp   5 Jun 2007 00:27:28 -0000       1.15
@@ -37,6 +37,19 @@
 # endif
 #endif
 
+// Stack protection under MS Windows
+// Config logic taken from boost/regex/config.hpp
+#ifndef BOOST_XPRESSIVE_HAS_MS_STACK_GUARD
+# if (defined(_WIN32) || defined(_WIN64) || defined(_WINCE))                   
 \
+     && !defined(__GNUC__)                                                     
 \
+     && !(defined(__BORLANDC__) && (__BORLANDC__ >= 0x600))                    
 \
+     && !(defined(__MWERKS__) && (__MWERKS__ <= 0x3003))
+#  define BOOST_XPRESSIVE_HAS_MS_STACK_GUARD 1
+# else
+#  define BOOST_XPRESSIVE_HAS_MS_STACK_GUARD 0
+# endif
+#endif
+
 #include <boost/xpressive/proto/proto_fwd.hpp>
 #include <boost/xpressive/proto/traits.hpp>
 
@@ -106,9 +119,6 @@
     template<typename BidiIter>
     struct sub_match;
 
-    template<typename Action, typename Saved = Action>
-    struct action;
-
     template<typename RegexTraits>
     struct compiler_traits;
 

Index: basic_regex.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/basic_regex.hpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- basic_regex.hpp     3 Jun 2007 06:33:57 -0000       1.20
+++ basic_regex.hpp     5 Jun 2007 00:27:28 -0000       1.21
@@ -15,10 +15,8 @@
 # pragma once
 #endif
 
-#ifdef BOOST_XPRESSIVE_DEBUG_TRACKING_POINTER
-# include <iosfwd>
-#endif
 #include <boost/mpl/bool.hpp>
+#include <boost/xpressive/xpressive_fwd.hpp>
 #include <boost/xpressive/regex_constants.hpp>
 #include <boost/xpressive/detail/detail_fwd.hpp>
 #include <boost/xpressive/detail/core/regex_impl.hpp>
@@ -29,6 +27,11 @@
 # include <boost/xpressive/proto/extends.hpp>
 #endif
 
+#if BOOST_XPRESSIVE_HAS_MS_STACK_GUARD
+# include <excpt.h>     // for _exception_code()
+# include <malloc.h>    // for _resetstkoflw()
+#endif
+
 namespace boost { namespace xpressive
 {
 
@@ -181,18 +184,6 @@
         return regex_compiler<BidiIter>().compile(begin, len, flags);
     }
 
-    //{{AFX_DEBUG
-    #ifdef BOOST_XPRESSIVE_DEBUG_TRACKING_POINTER
-    // BUGBUG debug only
-    /// INTERNAL ONLY
-    friend std::ostream &operator <<(std::ostream &sout, basic_regex<BidiIter> 
const &rex)
-    {
-        rex.dump_(sout);
-        return sout;
-    }
-    #endif
-    //}}AFX_DEBUG
-
 private:
     friend struct detail::core_access<BidiIter>;
 
@@ -212,7 +203,22 @@
     /// INTERNAL ONLY
     bool match_(detail::match_state<BidiIter> &state) const
     {
+        #if BOOST_XPRESSIVE_HAS_MS_STACK_GUARD
+        bool success = false, stack_error = false;
+        __try
+        {
+            success = proto::arg(*this)->xpr_->match(state);
+        }
+        __except(_exception_code() == 0xC00000FDUL)
+        {
+            stack_error = true;
+            _resetstkoflw();
+        }
+        detail::ensure(!stack_error, regex_constants::error_stack, "Regex 
stack space exhausted");
+        return success;
+        #else
         return proto::arg(*this)->xpr_->match(state);
+        #endif
     }
 
     // Returns true if this basic_regex object does not contain a valid 
regular expression.
@@ -241,26 +247,6 @@
     void dump_(std::ostream &sout) const;
 };
 
-//{{AFX_DEBUG
-#ifdef BOOST_XPRESSIVE_DEBUG_TRACKING_POINTER
-///////////////////////////////////////////////////////////////////////////////
-// dump_
-/// INTERNAL ONLY
-template<typename BidiIter>
-inline void basic_regex<BidiIter>::dump_(std::ostream &sout) const
-{
-    if(!proto::arg(*this))
-    {
-        sout << "<null> refs={} deps={}";
-    }
-    else
-    {
-        sout << *proto::arg(*this);
-    }
-}
-#endif
-//}}AFX_DEBUG
-
 ///////////////////////////////////////////////////////////////////////////////
 // swap
 /// \brief      Swaps the contents of two basic_regex objects.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to