summaryrefslogtreecommitdiffstats
path: root/generic/tkMain.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-06-08 20:53:38 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-06-08 20:53:38 (GMT)
commitfdeacfff80a809cc26b4720c429274a5ed6331b4 (patch)
tree977529b36dc0a15ced58f91aaca5c7cb0610c7e6 /generic/tkMain.c
parent38172ef34fbe08d6cfd4eb8e4ed8d1fa21d69c8f (diff)
downloadtk-fdeacfff80a809cc26b4720c429274a5ed6331b4.zip
tk-fdeacfff80a809cc26b4720c429274a5ed6331b4.tar.gz
tk-fdeacfff80a809cc26b4720c429274a5ed6331b4.tar.bz2
Implement TkCygwinMainEx for loading Cygwin's Tk_MainEx from the Tk dll
Diffstat (limited to 'generic/tkMain.c')
-rw-r--r--generic/tkMain.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/generic/tkMain.c b/generic/tkMain.c
index f400c05..6b9a393 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkMain.c --
*
* This file contains a generic main program for Tk-based applications.
@@ -41,7 +41,7 @@ typedef struct ThreadSpecificData {
* into Tcl commands. */
Tcl_DString line; /* Used to read the next line from the
* terminal input. */
- int tty; /* Non-zero means standard input is a
+ int tty; /* Non-zero means standard input is a
* terminal-like device. Zero means it's
* a file. */
} ThreadSpecificData;
@@ -155,15 +155,20 @@ Tk_MainEx(argc, argv, appInitProc, interp)
abort();
}
-#if defined(__WIN32__) && !defined(STATIC_BUILD)
+#if defined(__WIN32__) && !defined(__WIN64__) && !defined(STATIC_BUILD)
+ extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *);
+
if (tclStubsPtr->reserved9) {
/* We are running win32 Tk under Cygwin, so let's check
* whether the env("DISPLAY") variable or the -display
* argument is set. If so, we really want to run the
- * Tk_MainEx function of libtk.dll, not this one. */
- if (Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY)) {
+ * Tk_MainEx function of libtk8.?.dll, not this one. */
+ if (Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY)) {
loadCygwinTk:
- Tcl_Panic("Should load libtk.dll now, not yet implemented");
+ if (TkCygwinMainEx(argc, argv, appInitProc, interp)) {
+ /* Should never reach here. */
+ return;
+ }
} else {
int i;
@@ -176,9 +181,9 @@ Tk_MainEx(argc, argv, appInitProc, interp)
}
#endif
- tsdPtr = (ThreadSpecificData *)
+ tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
+
Tcl_FindExecutable(argv[0]);
tsdPtr->interp = interp;
Tcl_Preserve((ClientData) interp);
@@ -197,7 +202,7 @@ Tk_MainEx(argc, argv, appInitProc, interp)
TkMacOSXDefaultStartupScript();
}
#endif
-
+
#ifdef TCL_MEM_DEBUG
Tcl_InitMemory(interp);
#endif
@@ -223,7 +228,7 @@ Tk_MainEx(argc, argv, appInitProc, interp)
argv++;
}
}
-
+
/*
* Make command-line arguments available in the Tcl variables "argc"
* and "argv".
@@ -264,7 +269,7 @@ Tk_MainEx(argc, argv, appInitProc, interp)
* of length 0, (e.g. /dev/null, which is what Finder sets when double
* clicking Wish) then use the GUI console.
*/
-
+
if (!tsdPtr->tty) {
struct stat st;
@@ -375,7 +380,7 @@ StdinProc(clientData, mask)
char *cmd;
int code, count;
Tcl_Channel chan = (Tcl_Channel) clientData;
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_Interp *interp = tsdPtr->interp;
@@ -389,7 +394,7 @@ StdinProc(clientData, mask)
Tcl_DeleteChannelHandler(chan, StdinProc, (ClientData) chan);
}
return;
- }
+ }
}
(void) Tcl_DStringAppend(&tsdPtr->command, Tcl_DStringValue(
@@ -412,7 +417,7 @@ StdinProc(clientData, mask)
Tcl_CreateChannelHandler(chan, 0, StdinProc, (ClientData) chan);
code = Tcl_RecordAndEval(interp, cmd, TCL_EVAL_GLOBAL);
-
+
chan = Tcl_GetStdChannel(TCL_STDIN);
if (chan) {
Tcl_CreateChannelHandler(chan, TCL_READABLE, StdinProc,
@@ -496,7 +501,7 @@ defaultPrompt:
* is possible that someone has transferred stderr out of
* this interpreter with "interp transfer".
*/
-
+
errChannel = Tcl_GetChannel(interp, "stderr", NULL);
if (errChannel != (Tcl_Channel) NULL) {
Tcl_WriteObj(errChannel, Tcl_GetObjResult(interp));