summaryrefslogtreecommitdiffstats
path: root/win/tclWin32Dll.c
diff options
context:
space:
mode:
authorstanton <stanton@noemail.net>1999-03-10 05:52:44 (GMT)
committerstanton <stanton@noemail.net>1999-03-10 05:52:44 (GMT)
commit3590769e600141e2a2a0e8413790130248ed65ee (patch)
tree92131df26a09a5f7b28f854fb7c0a62ba26cb8ac /win/tclWin32Dll.c
parent6aec87e7efaa5196e38566cf45beecc6c2496510 (diff)
downloadtcl-3590769e600141e2a2a0e8413790130248ed65ee.zip
tcl-3590769e600141e2a2a0e8413790130248ed65ee.tar.gz
tcl-3590769e600141e2a2a0e8413790130248ed65ee.tar.bz2
Merged stubs changes into mainline for 8.0
FossilOrigin-Name: 19696933517612024e7dbcfee6e3c8d3b4e41772
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