summaryrefslogtreecommitdiffstats
path: root/win/tclWin32Dll.c
diff options
context:
space:
mode:
authorstanton <stanton>1999-03-10 05:52:45 (GMT)
committerstanton <stanton>1999-03-10 05:52:45 (GMT)
commit0b4be24161f5971f3181adec27a32becf7cb8870 (patch)
tree92131df26a09a5f7b28f854fb7c0a62ba26cb8ac /win/tclWin32Dll.c
parenta5bface5b6607af37870fc5f5ee5019f6d5fb3f1 (diff)
downloadtcl-0b4be24161f5971f3181adec27a32becf7cb8870.zip
tcl-0b4be24161f5971f3181adec27a32becf7cb8870.tar.gz
tcl-0b4be24161f5971f3181adec27a32becf7cb8870.tar.bz2
Merged stubs changes into mainline for 8.0
Diffstat (limited to 'win/tclWin32Dll.c')
-rw-r--r--win/tclWin32Dll.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index 9de0589..16c47c1 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWin32Dll.c,v 1.4 1998/09/14 18:40:19 stanton Exp $
+ * RCS: @(#) $Id: tclWin32Dll.c,v 1.5 1999/03/10 05:52:53 stanton Exp $
*/
#include "tclWinInt.h"
@@ -378,6 +378,41 @@ TclWinGetTclInstance()
/*
*----------------------------------------------------------------------
*
+ * TclpCheckStackSpace --
+ *
+ * Detect if we are about to blow the stack. Called before an
+ * evaluation can happen when nesting depth is checked.
+ *
+ * Results:
+ * 1 if there is enough stack space to continue; 0 if not.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclpCheckStackSpace()
+{
+ /*
+ * We can recurse only if there is at least TCL_WIN_STACK_THRESHOLD
+ * bytes of stack space left. alloca() is cheap on windows; basically
+ * it just subtracts from the stack pointer causing the OS to throw an
+ * exception if the stack pointer is set below the bottom of the stack.
+ */
+
+ try {
+ alloca(TCL_WIN_STACK_THRESHOLD);
+ return 1;
+ } except (1) {}
+
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TclWinGetPlatformId --
*
* Determines whether running under NT, 95, or Win32s, to allow