Import Tk 8.6.11

This commit is contained in:
Steve Dower
2021-03-30 00:54:10 +01:00
parent 42c69189d9
commit 070b8750b0
403 changed files with 21608 additions and 16269 deletions

View File

@@ -14,30 +14,7 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
/**
* On Windows, this file needs to be compiled twice, once with
* TK_ASCII_MAIN defined. This way both Tk_MainEx and Tk_MainExW
* can be implemented, sharing the same source code.
*/
#if defined(TK_ASCII_MAIN)
# ifdef UNICODE
# undef UNICODE
# undef _UNICODE
# else
# define UNICODE
# define _UNICODE
# endif
#endif
#include "tkInt.h"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#ifdef NO_STDLIB_H
# include "../compat/stdlib.h"
#else
# include <stdlib.h>
#endif
extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *);
@@ -55,6 +32,9 @@ static const char DEFAULT_PRIMARY_PROMPT[] = "% ";
* to strcmp here.
*/
#ifdef _WIN32
#ifdef __cplusplus
extern "C" {
#endif
/* Little hack to eliminate the need for "tclInt.h" here:
Just copy a small portion of TclIntPlatStubs, just
enough to make it work. See [600b72bfbc] */
@@ -65,6 +45,9 @@ typedef struct {
int (*tclpIsAtty) (int fd); /* 16 */
} TclIntPlatStubs;
extern const TclIntPlatStubs *tclIntPlatStubsPtr;
#ifdef __cplusplus
}
#endif
# include "tkWinInt.h"
#else
# define TCHAR char
@@ -78,12 +61,6 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
#include "tkMacOSXInt.h"
#endif
/*
* Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise
* NewNativeObj is needed (which provides proper conversion from native
* encoding to UTF-8).
*/
static inline Tcl_Obj *
NewNativeObj(
TCHAR *string)
@@ -91,8 +68,9 @@ NewNativeObj(
Tcl_Obj *obj;
Tcl_DString ds;
#ifdef UNICODE
Tcl_WinTCharToUtf(string, -1, &ds);
#if defined(_WIN32) && defined(UNICODE)
Tcl_DStringInit(&ds);
Tcl_WCharToUtfDString(string, wcslen(string), &ds);
#else
Tcl_ExternalToUtfDString(NULL, (char *) string, -1, &ds);
#endif
@@ -422,21 +400,22 @@ Tk_MainEx(
*----------------------------------------------------------------------
*/
/* ARGSUSED */
static void
StdinProc(
ClientData clientData, /* The state of interactive cmd line */
int mask) /* Not used. */
{
char *cmd;
int code, count;
InteractiveState *isPtr = clientData;
int code;
int count;
InteractiveState *isPtr = (InteractiveState *)clientData;
Tcl_Channel chan = isPtr->input;
Tcl_Interp *interp = isPtr->interp;
(void)mask;
count = Tcl_Gets(chan, &isPtr->line);
if (count == -1 && !isPtr->gotPartial) {
if ((count == -1) && !isPtr->gotPartial) {
if (isPtr->tty) {
Tcl_Exit(0);
} else {