From 123f5954787216f58928f41149aecdfd49f112f0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 19 Mar 2012 16:12:35 +0000 Subject: bug 3508771: load tclreg.dll in cygwin tclsh (works on cygwin, on other UNIX not yet complete) --- generic/tclInt.decls | 7 ++++++- generic/tclIntPlatDecls.h | 43 +++++++++++++++++++++++++++++++++++++------ generic/tclStubInit.c | 24 +++++++++++++++++++++++- 3 files changed, 66 insertions(+), 8 deletions(-) diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 4fb88c6..e3d3a08 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -982,8 +982,9 @@ declare 8 unix { # Added in 8.1: +# On non-cygwin, this is actually a reference to TclpCreateTempFile declare 9 unix { - TclFile TclpCreateTempFile(CONST char *contents) + int TclWinGetPlatformId(void) } # Added in 8.4: @@ -1007,3 +1008,7 @@ declare 13 unix { char * TclpInetNtoa(struct in_addr addr) } +declare 22 unix { + TclFile TclpCreateTempFile(CONST char *contents) +} + diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 35bacf1..a3898ab 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -55,8 +55,7 @@ EXTERN TclFile TclpOpenFile _ANSI_ARGS_((CONST char * fname, EXTERN int TclUnixWaitForFile _ANSI_ARGS_((int fd, int mask, int timeout)); /* 9 */ -EXTERN TclFile TclpCreateTempFile _ANSI_ARGS_(( - CONST char * contents)); +EXTERN int TclWinGetPlatformId _ANSI_ARGS_((void)); /* 10 */ EXTERN Tcl_DirEntry * TclpReaddir _ANSI_ARGS_((DIR * dir)); /* 11 */ @@ -66,6 +65,17 @@ EXTERN struct tm * TclpLocaltime_unix _ANSI_ARGS_(( EXTERN struct tm * TclpGmtime_unix _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 13 */ EXTERN char * TclpInetNtoa _ANSI_ARGS_((struct in_addr addr)); +/* Slot 14 is reserved */ +/* Slot 15 is reserved */ +/* Slot 16 is reserved */ +/* Slot 17 is reserved */ +/* Slot 18 is reserved */ +/* Slot 19 is reserved */ +/* Slot 20 is reserved */ +/* Slot 21 is reserved */ +/* 22 */ +EXTERN TclFile TclpCreateTempFile _ANSI_ARGS_(( + CONST char * contents)); #endif /* UNIX */ #ifdef __WIN32__ /* 0 */ @@ -229,11 +239,20 @@ typedef struct TclIntPlatStubs { TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 6 */ TclFile (*tclpOpenFile) _ANSI_ARGS_((CONST char * fname, int mode)); /* 7 */ int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 8 */ - TclFile (*tclpCreateTempFile) _ANSI_ARGS_((CONST char * contents)); /* 9 */ + int (*tclWinGetPlatformId) _ANSI_ARGS_((void)); /* 9 */ Tcl_DirEntry * (*tclpReaddir) _ANSI_ARGS_((DIR * dir)); /* 10 */ struct tm * (*tclpLocaltime_unix) _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 11 */ struct tm * (*tclpGmtime_unix) _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 12 */ char * (*tclpInetNtoa) _ANSI_ARGS_((struct in_addr addr)); /* 13 */ + void *reserved14; + void *reserved15; + void *reserved16; + void *reserved17; + void *reserved18; + void *reserved19; + void *reserved20; + void *reserved21; + TclFile (*tclpCreateTempFile) _ANSI_ARGS_((CONST char * contents)); /* 22 */ #endif /* UNIX */ #ifdef __WIN32__ void (*tclWinConvertError) _ANSI_ARGS_((DWORD errCode)); /* 0 */ @@ -346,9 +365,9 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclUnixWaitForFile \ (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */ #endif -#ifndef TclpCreateTempFile -#define TclpCreateTempFile \ - (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */ +#ifndef TclWinGetPlatformId +#define TclWinGetPlatformId \ + (tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */ #endif #ifndef TclpReaddir #define TclpReaddir \ @@ -366,6 +385,18 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpInetNtoa \ (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ #endif +/* Slot 14 is reserved */ +/* Slot 15 is reserved */ +/* Slot 16 is reserved */ +/* Slot 17 is reserved */ +/* Slot 18 is reserved */ +/* Slot 19 is reserved */ +/* Slot 20 is reserved */ +/* Slot 21 is reserved */ +#ifndef TclpCreateTempFile +#define TclpCreateTempFile \ + (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */ +#endif #endif /* UNIX */ #ifdef __WIN32__ #ifndef TclWinConvertError diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index a81f3e8..91f176c 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -57,6 +57,19 @@ Tcl_NotifierProcs tclOriginalNotifier = { NULL }; +#ifdef __CYGWIN__ +#define TclWinGetPlatformId winGetPlatformId +static int +TclWinGetPlatformId() +{ + /* Don't bother to determine the real platform on cygwin, + * because VER_PLATFORM_WIN32_NT is the only supported platform */ + return 2; /* VER_PLATFORM_WIN32_NT */; +} +#elif !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ +#define TclWinGetPlatformId (int (*)()) TclpCreateTempFile +#endif + /* * WARNING: The contents of this file is automatically generated by the * tools/genStubs.tcl script. Any modifications to the function declarations @@ -307,11 +320,20 @@ TclIntPlatStubs tclIntPlatStubs = { TclpMakeFile, /* 6 */ TclpOpenFile, /* 7 */ TclUnixWaitForFile, /* 8 */ - TclpCreateTempFile, /* 9 */ + TclWinGetPlatformId, /* 9 */ TclpReaddir, /* 10 */ TclpLocaltime_unix, /* 11 */ TclpGmtime_unix, /* 12 */ TclpInetNtoa, /* 13 */ + NULL, /* 14 */ + NULL, /* 15 */ + NULL, /* 16 */ + NULL, /* 17 */ + NULL, /* 18 */ + NULL, /* 19 */ + NULL, /* 20 */ + NULL, /* 21 */ + TclpCreateTempFile, /* 22 */ #endif /* UNIX */ #ifdef __WIN32__ TclWinConvertError, /* 0 */ -- cgit v0.12