diff options
author | das <das> | 2002-04-08 09:04:31 (GMT) |
---|---|---|
committer | das <das> | 2002-04-08 09:04:31 (GMT) |
commit | 2024eae67e8a0249d280bd2f8423ecd91033040b (patch) | |
tree | 388b7f23b6b3cafb2c20243044e6b0a315a7ec0f /mac/tkMacAppInit.c | |
parent | edf6ae717ffa12d49b2c5163c7d44c7fa3693020 (diff) | |
download | tk-2024eae67e8a0249d280bd2f8423ecd91033040b.zip tk-2024eae67e8a0249d280bd2f8423ecd91033040b.tar.gz tk-2024eae67e8a0249d280bd2f8423ecd91033040b.tar.bz2 |
2002-04-08 Daniel Steffen <das@users.sourceforge.net>
* mac/tkMacProjects.sea.hqx: added tkPanedWindow.c to projects
* mac/tkMacAppInit.c: fixes to MSL stdin/stdout hookup to the
TkConsole when using shared MSL libraries; fix for crashing
bug on exit: writing to stdin/sterr when console has already
been destroyed. (both fixes need support in MSL, see
'CW Pro6 changes' in tcl/mac/tcltkMacBuildSupport.sea.hqx)
* mac/tkMacDialog.c: fixes to Navigation Services Dialog filter.
* mac/tkMacDraw.c: add panic for overwide TkImages that would
crash Tk on mac otherwise.
Diffstat (limited to 'mac/tkMacAppInit.c')
-rw-r--r-- | mac/tkMacAppInit.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/mac/tkMacAppInit.c b/mac/tkMacAppInit.c index c625609..50f6156 100644 --- a/mac/tkMacAppInit.c +++ b/mac/tkMacAppInit.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: tkMacAppInit.c,v 1.13 2002/01/15 20:48:30 dgp Exp $ + * RCS: @(#) $Id: tkMacAppInit.c,v 1.14 2002/04/08 09:04:34 das Exp $ */ #include <Gestalt.h> @@ -25,6 +25,7 @@ #include "tkMacInt.h" #include "tclInt.h" #include "tclMac.h" +#include "tclMacInt.h" #ifdef TK_TEST extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp)); @@ -49,6 +50,9 @@ void RemoveConsole _ANSI_ARGS_((void)); long WriteCharsToConsole _ANSI_ARGS_((char *buff, long n)); long ReadCharsFromConsole _ANSI_ARGS_((char *buff, long n)); extern char * __ttyname _ANSI_ARGS_((long fildes)); +int kbhit _ANSI_ARGS_((void)); +int getch _ANSI_ARGS_((void)); +void clrscr _ANSI_ARGS_((void)); short SIOUXHandleOneEvent _ANSI_ARGS_((EventRecord *event)); /* @@ -57,6 +61,10 @@ short SIOUXHandleOneEvent _ANSI_ARGS_((EventRecord *event)); static int MacintoshInit _ANSI_ARGS_((void)); static int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp)); +static void SetupSIOUX _ANSI_ARGS_((void)); + +static int inMacExit = 0; +static pascal void NoMoreOutput() { inMacExit = 1; } /* *---------------------------------------------------------------------- @@ -319,6 +327,8 @@ SetupMainInterp( if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { goto error; } + SetupSIOUX(); + TclMacInstallExitToShellPatch(NoMoreOutput); } /* @@ -368,8 +378,15 @@ RemoveConsole(void) long WriteCharsToConsole(char *buffer, long n) { - TkConsolePrint(gStdoutInterp, TCL_STDOUT, buffer, n); - return n; + if (!inMacExit) { + Tcl_DString ds; + Tcl_ExternalToUtfDString(NULL, buffer, n, &ds); + TkConsolePrint(gStdoutInterp, TCL_STDOUT, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); + Tcl_DStringFree(&ds); + return n; + } else { + return 0; + } } long @@ -390,8 +407,37 @@ __ttyname(long fildes) return (0L); } +int kbhit(void) +{ + return 0; +} + +int getch(void) +{ + return 0; +} + +void clrscr(void) +{ + return; +} + short SIOUXHandleOneEvent(EventRecord *event) { return 0; } +static void SetupSIOUX(void) { +#ifndef STATIC_BUILD + extern DLLIMPORT void SetupConsolePlugins(void*, void*, void*, void*, + void*, void*, void*, void*); + SetupConsolePlugins( &InstallConsole, + &RemoveConsole, + &WriteCharsToConsole, + &ReadCharsFromConsole, + &__ttyname, + &kbhit, + &getch, + &clrscr); +#endif +} |