summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-07-23 12:42:52 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-07-23 12:42:52 (GMT)
commit4ddfe70ae216fd2931131fd6a31a975c7219e8c2 (patch)
treef1bc85172decf95c80e947cc3c75f8d579149da0
parent53dc25e532b83e02c84f5991389720106c6d9018 (diff)
downloadtcl-4ddfe70ae216fd2931131fd6a31a975c7219e8c2.zip
tcl-4ddfe70ae216fd2931131fd6a31a975c7219e8c2.tar.gz
tcl-4ddfe70ae216fd2931131fd6a31a975c7219e8c2.tar.bz2
implement for Cygwin as well
-rw-r--r--generic/tcl.h2
-rw-r--r--unix/Makefile.in5
-rwxr-xr-xunix/configure2
-rw-r--r--unix/tcl.m42
-rw-r--r--win/tclWinPanic.c33
5 files changed, 31 insertions, 13 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index af5e8f0..e593910 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -2397,7 +2397,7 @@ const char * Tcl_InitStubs(Tcl_Interp *interp, const char *version,
int exact);
const char * TclTomMathInitializeStubs(Tcl_Interp *interp,
const char *version, int epoch, int revision);
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
void Tcl_ConsolePanic(const char *format, ...);
#else
#define Tcl_ConsolePanic ((Tcl_PanicProc *)0)
diff --git a/unix/Makefile.in b/unix/Makefile.in
index b5ca879..bc66f19 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -1580,10 +1580,13 @@ tclMacOSXFCmd.o: $(MAC_OSX_DIR)/tclMacOSXFCmd.c
tclMacOSXNotify.o: $(MAC_OSX_DIR)/tclMacOSXNotify.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tclMacOSXNotify.c
-# The following is a CYGWIN only source:
+# The following are CYGWIN only sources:
tclWinError.o: $(TOP_DIR)/win/tclWinError.c
$(CC) -c $(CC_SWITCHES) $(TOP_DIR)/win/tclWinError.c
+tclWinPanic.o: $(TOP_DIR)/win/tclWinPanic.c
+ $(CC) -c $(CC_SWITCHES) $(TOP_DIR)/win/tclWinPanic.c
+
# DTrace support
$(TCL_OBJS) $(STUB_LIB_OBJS) $(TCLSH_OBJS) $(TCLTEST_OBJS) $(XTTEST_OBJS): @DTRACE_HDR@
diff --git a/unix/configure b/unix/configure
index ef47ac5..54b1a87 100755
--- a/unix/configure
+++ b/unix/configure
@@ -7170,7 +7170,7 @@ fi
SHLIB_CFLAGS=""
SHLIB_LD='${CC} -shared'
SHLIB_SUFFIX=".dll"
- DL_OBJS="tclLoadDl.o tclWinError.o"
+ DL_OBJS="tclLoadDl.o tclWinError.o tclWinPanic.o"
DL_LIBS="-ldl"
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index b9b6532..d1f9b66 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1224,7 +1224,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
SHLIB_CFLAGS=""
SHLIB_LD='${CC} -shared'
SHLIB_SUFFIX=".dll"
- DL_OBJS="tclLoadDl.o tclWinError.o"
+ DL_OBJS="tclLoadDl.o tclWinError.o tclWinPanic.o"
DL_LIBS="-ldl"
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
diff --git a/win/tclWinPanic.c b/win/tclWinPanic.c
index bc59d75..3c2e072 100644
--- a/win/tclWinPanic.c
+++ b/win/tclWinPanic.c
@@ -34,11 +34,13 @@ Tcl_ConsolePanic(
const char *format, ...)
{
#define TCL_MAX_WARN_LEN 26000
- DWORD dummy;
va_list argList;
WCHAR msgString[TCL_MAX_WARN_LEN];
char buf[TCL_MAX_WARN_LEN * TCL_UTF_MAX];
+#ifndef __CYGWIN__
HANDLE handle = GetStdHandle(STD_ERROR_HANDLE);
+ DWORD dummy;
+#endif
va_start(argList, format);
vsnprintf(buf+3, sizeof(buf)-3, format, argList);
@@ -56,23 +58,36 @@ Tcl_ConsolePanic(
if (IsDebuggerPresent()) {
OutputDebugStringW(msgString);
+#ifdef __CYGWIN__
+ } else {
+ buf[0] = 0xEF; buf[1] = 0xBB; buf[2] = 0xBF; /* UTF-8 bom */
+ write(2, buf, strlen(buf));
+ fsync(2);
+#else
} else if (_isatty(2)) {
WriteConsoleW(handle, msgString, wcslen(msgString), &dummy, 0);
} else {
buf[0] = 0xEF; buf[1] = 0xBB; buf[2] = 0xBF; /* UTF-8 bom */
WriteFile(handle, buf, strlen(buf), &dummy, 0);
FlushFileBuffers(handle);
+#endif
}
-#if defined(__GNUC__)
- __builtin_trap();
-#elif defined(_WIN64)
- __debugbreak();
-#elif defined(_MSC_VER)
- _asm {int 3}
+#if defined(_WIN32) || defined(__CYGWIN__)
+# if defined(__GNUC__)
+ __builtin_trap();
+# elif defined(_WIN64)
+ __debugbreak();
+# elif defined(_MSC_VER)
+ _asm {int 3}
+# else
+ DebugBreak();
+# endif
+#endif
+#if defined(_WIN32)
+ ExitProcess(1);
#else
- DebugBreak();
+ abort();
#endif
- ExitProcess(1);
}
/*
* Local Variables: