diff options
-rwxr-xr-x[-rw-r--r--] | ChangeLog | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | generic/tcl.decls | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | generic/tcl.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | generic/tclCmdAH.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | generic/tclEnv.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | generic/tclFCmd.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | generic/tclFileName.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | generic/tclIOSock.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | generic/tclInt.decls | 30 | ||||
-rw-r--r-- | generic/tclIntPlatDecls.h | 78 | ||||
-rwxr-xr-x[-rw-r--r--] | generic/tclPipe.c | 2 | ||||
-rw-r--r-- | generic/tclStubInit.c | 18 | ||||
-rwxr-xr-x[-rw-r--r--] | mac/tclMacPort.h | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | tools/genStubs.tcl | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | unix/Makefile.in | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | unix/configure.in | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | unix/tcl.m4 | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | unix/tclUnixFile.c | 38 | ||||
-rwxr-xr-x[-rw-r--r--] | unix/tclUnixPort.h | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | win/configure.in | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | win/tcl.m4 | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | win/tclWinError.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | win/tclWinFile.c | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | win/tclWinPipe.c | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | win/tclWinPort.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | win/tclWinSock.c | 0 |
26 files changed, 138 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog index 3ef4bd8..3ef4bd8 100644..100755 --- a/ChangeLog +++ b/ChangeLog diff --git a/generic/tcl.decls b/generic/tcl.decls index a061c76..a061c76 100644..100755 --- a/generic/tcl.decls +++ b/generic/tcl.decls diff --git a/generic/tcl.h b/generic/tcl.h index 3c6ef5e..3c6ef5e 100644..100755 --- a/generic/tcl.h +++ b/generic/tcl.h diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 63d9111..63d9111 100644..100755 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 7108436..7108436 100644..100755 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index 3d6a169..3d6a169 100644..100755 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c diff --git a/generic/tclFileName.c b/generic/tclFileName.c index c70bed5..c70bed5 100644..100755 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 159f3da..159f3da 100644..100755 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c diff --git a/generic/tclInt.decls b/generic/tclInt.decls index d380270..e438588 100644..100755 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -856,7 +856,7 @@ declare 7 win { const char *optval, int optlen) } declare 8 win { - unsigned long TclpGetPid(Tcl_Pid pid) + int TclpGetPid(Tcl_Pid pid) } declare 9 win { int TclWinGetPlatformId(void) @@ -978,8 +978,9 @@ declare 7 unix { int TclWinSetSockOpt(void *s, int level, int optname, const char *optval, int optlen) } +# On non-cygwin, this is actually a reference to TclUnixWaitForFile declare 8 unix { - int TclUnixWaitForFile(int fd, int mask, int timeout) + int TclpGetPid(Tcl_Pid pid) } # Added in 8.1: @@ -1049,7 +1050,30 @@ declare 30 unix { declare 31 unix { int TclpCloseFile(TclFile file) } - +#declare 32 unix { +# Tcl_Channel TclpCreateCommandChannel(TclFile readFile, +# TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr) +#} +#declare 33 unix { +# int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) +#} +declare 34 unix { + int TclpCreateProcess (Tcl_Interp *interp, + int argc, const char **argv, TclFile inputFile, + TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr) +} +#declare 35 unix { +# char *TclpInetNtoa(struct in_addr addr) +#} +declare 36 unix { + TclFile TclpMakeFile (Tcl_Channel channel, int direction) +} +declare 37 unix { + TclFile TclpOpenFile (const char *fname, int mode) +} +declare 38 unix { + int TclUnixWaitForFile(int fd, int mask, int timeout) +} # Local Variables: # mode: tcl diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 7ce711d..6d3ed94 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -13,16 +13,6 @@ #ifndef _TCLINTPLATDECLS #define _TCLINTPLATDECLS -#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ -EXTERN int TclpCreateProcess _ANSI_ARGS_((Tcl_Interp *interp, - int argc, CONST char **argv, TclFile inputFile, - TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)); -EXTERN TclFile TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel, - int direction)); -EXTERN TclFile TclpOpenFile _ANSI_ARGS_((CONST char *fname, - int mode)); -#endif - /* * WARNING: This file is automatically generated by the tools/genStubs.tcl * script. Any modifications to the function declarations below should be made @@ -58,8 +48,7 @@ EXTERN unsigned short TclWinNToHS _ANSI_ARGS_((unsigned short ns)); EXTERN int TclWinSetSockOpt _ANSI_ARGS_((VOID *s, int level, int optname, CONST char *optval, int optlen)); /* 8 */ -EXTERN int TclUnixWaitForFile _ANSI_ARGS_((int fd, int mask, - int timeout)); +EXTERN int TclpGetPid _ANSI_ARGS_((Tcl_Pid pid)); /* 9 */ EXTERN int TclWinGetPlatformId _ANSI_ARGS_((void)); /* 10 */ @@ -110,6 +99,23 @@ EXTERN void TclGetAndDetachPids _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 31 */ EXTERN int TclpCloseFile _ANSI_ARGS_((TclFile file)); +/* Slot 32 is reserved */ +/* Slot 33 is reserved */ +/* 34 */ +EXTERN int TclpCreateProcess _ANSI_ARGS_((Tcl_Interp *interp, + int argc, CONST char **argv, + TclFile inputFile, TclFile outputFile, + TclFile errorFile, Tcl_Pid *pidPtr)); +/* Slot 35 is reserved */ +/* 36 */ +EXTERN TclFile TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel, + int direction)); +/* 37 */ +EXTERN TclFile TclpOpenFile _ANSI_ARGS_((CONST char *fname, + int mode)); +/* 38 */ +EXTERN int TclUnixWaitForFile _ANSI_ARGS_((int fd, int mask, + int timeout)); #endif /* UNIX */ #ifdef __WIN32__ /* 0 */ @@ -131,7 +137,7 @@ EXTERN u_short TclWinNToHS _ANSI_ARGS_((u_short ns)); EXTERN int TclWinSetSockOpt _ANSI_ARGS_((SOCKET s, int level, int optname, CONST char *optval, int optlen)); /* 8 */ -EXTERN unsigned long TclpGetPid _ANSI_ARGS_((Tcl_Pid pid)); +EXTERN int TclpGetPid _ANSI_ARGS_((Tcl_Pid pid)); /* 9 */ EXTERN int TclWinGetPlatformId _ANSI_ARGS_((void)); /* Slot 10 is reserved */ @@ -267,7 +273,7 @@ typedef struct TclIntPlatStubs { VOID *reserved5; unsigned short (*tclWinNToHS) _ANSI_ARGS_((unsigned short ns)); /* 6 */ int (*tclWinSetSockOpt) _ANSI_ARGS_((VOID *s, int level, int optname, CONST char *optval, int optlen)); /* 7 */ - int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 8 */ + int (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 8 */ 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 */ @@ -291,6 +297,13 @@ typedef struct TclIntPlatStubs { int (*tclWinCPUID) _ANSI_ARGS_((unsigned int index, unsigned int *regs)); /* 29 */ void (*tclGetAndDetachPids) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 30 */ int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 31 */ + VOID *reserved32; + VOID *reserved33; + int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)); /* 34 */ + VOID *reserved35; + TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 36 */ + TclFile (*tclpOpenFile) _ANSI_ARGS_((CONST char *fname, int mode)); /* 37 */ + int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 38 */ #endif /* UNIX */ #ifdef __WIN32__ void (*tclWinConvertError) _ANSI_ARGS_((DWORD errCode)); /* 0 */ @@ -301,7 +314,7 @@ typedef struct TclIntPlatStubs { VOID *reserved5; u_short (*tclWinNToHS) _ANSI_ARGS_((u_short ns)); /* 6 */ int (*tclWinSetSockOpt) _ANSI_ARGS_((SOCKET s, int level, int optname, CONST char *optval, int optlen)); /* 7 */ - unsigned long (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 8 */ + int (*tclpGetPid) _ANSI_ARGS_((Tcl_Pid pid)); /* 8 */ int (*tclWinGetPlatformId) _ANSI_ARGS_((void)); /* 9 */ VOID *reserved10; void (*tclGetAndDetachPids) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan)); /* 11 */ @@ -399,9 +412,9 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinSetSockOpt \ (tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */ #endif -#ifndef TclUnixWaitForFile -#define TclUnixWaitForFile \ - (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */ +#ifndef TclpGetPid +#define TclpGetPid \ + (tclIntPlatStubsPtr->tclpGetPid) /* 8 */ #endif #ifndef TclWinGetPlatformId #define TclWinGetPlatformId \ @@ -477,6 +490,25 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpCloseFile \ (tclIntPlatStubsPtr->tclpCloseFile) /* 31 */ #endif +/* Slot 32 is reserved */ +/* Slot 33 is reserved */ +#ifndef TclpCreateProcess +#define TclpCreateProcess \ + (tclIntPlatStubsPtr->tclpCreateProcess) /* 34 */ +#endif +/* Slot 35 is reserved */ +#ifndef TclpMakeFile +#define TclpMakeFile \ + (tclIntPlatStubsPtr->tclpMakeFile) /* 36 */ +#endif +#ifndef TclpOpenFile +#define TclpOpenFile \ + (tclIntPlatStubsPtr->tclpOpenFile) /* 37 */ +#endif +#ifndef TclUnixWaitForFile +#define TclUnixWaitForFile \ + (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 38 */ +#endif #endif /* UNIX */ #ifdef __WIN32__ #ifndef TclWinConvertError @@ -703,7 +735,14 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #undef TclpLocaltime_unix #undef TclpGmtime_unix -#if !defined(__WIN32__) && !defined(MAC_TCL) && defined(USE_TCL_STUBS) +#if !defined(__WIN32__) && !defined(MAC_TCL) +# undef TclpGetPid +# define TclpGetPid(pid) ((unsigned long) (pid)) + +# if defined(USE_TCL_STUBS) +# undef TclpCreateProcess +# undef TclpMakeFile +# undef TclpOpenFile # ifdef __CYGWIN__ # define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \ CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \ @@ -732,6 +771,7 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; # define TclpCloseFile ((int (*) _ANSI_ARGS_((TclFile))) \ tclIntPlatStubsPtr->tclWinConvertWSAError) # endif +# endif #endif #endif /* _TCLINTPLATDECLS */ diff --git a/generic/tclPipe.c b/generic/tclPipe.c index 1042e09..6e7029e 100644..100755 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -283,7 +283,7 @@ TclCleanupChildren(interp, numPids, pidPtr, errorChan) for (i = 0; i < numPids; i++) { /* * We need to get the resolved pid before we wait on it as - * the windows implimentation of Tcl_WaitPid deletes the + * the windows implementation of Tcl_WaitPid deletes the * information such that any following calls to TclpGetPid * fail. */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index a5408f4..ce3b952 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -31,6 +31,7 @@ #undef Tcl_ValidateAllMemory #undef Tcl_FindHashEntry #undef Tcl_CreateHashEntry +#undef TclpGetPid #undef TclSockMinimumBuffers /* @@ -86,6 +87,7 @@ int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); #define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing #define TclWinFlushDirtyChannels doNothing #define TclWinResetInterfaces doNothing +#define TclpGetPid getPid static Tcl_Encoding winTCharEncoding; @@ -131,6 +133,12 @@ TclWinNoBackslash(char *path) return path; } +static int +TclpGetPid(Tcl_Pid pid) +{ + return (int) (size_t) pid; +} + static void doNothing(void) { @@ -187,6 +195,7 @@ Tcl_WinTCharToUtf( # define TclWinSetInterfaces 0 # define TclWinFlushDirtyChannels 0 # define TclWinResetInterfaces 0 +# define TclpGetPid 0 # define TclMacOSXGetFileAttribute 0 /* Only implemented in Tcl >= 8.5 */ # define TclMacOSXMatchType 0 /* Only implemented in Tcl >= 8.5 */ # define TclMacOSXNotifierAddRunLoopMode 0 /* Only implemented in Tcl >= 8.5 */ @@ -455,7 +464,7 @@ TclIntPlatStubs tclIntPlatStubs = { NULL, /* 5 */ TclWinNToHS, /* 6 */ TclWinSetSockOpt, /* 7 */ - TclUnixWaitForFile, /* 8 */ + TclpGetPid, /* 8 */ TclWinGetPlatformId, /* 9 */ TclpReaddir, /* 10 */ TclpLocaltime_unix, /* 11 */ @@ -479,6 +488,13 @@ TclIntPlatStubs tclIntPlatStubs = { TclWinCPUID, /* 29 */ TclGetAndDetachPids, /* 30 */ TclpCloseFile, /* 31 */ + NULL, /* 32 */ + NULL, /* 33 */ + TclpCreateProcess, /* 34 */ + NULL, /* 35 */ + TclpMakeFile, /* 36 */ + TclpOpenFile, /* 37 */ + TclUnixWaitForFile, /* 38 */ #endif /* UNIX */ #ifdef __WIN32__ TclWinConvertError, /* 0 */ diff --git a/mac/tclMacPort.h b/mac/tclMacPort.h index f427899..c5c1743 100644..100755 --- a/mac/tclMacPort.h +++ b/mac/tclMacPort.h @@ -215,7 +215,6 @@ extern char **environ; * address platform-specific issues. */ -#define TclpGetPid(pid) ((unsigned long) (pid)) #define TclSetSystemEnv(a,b) #define tzset() diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index c2b0b27..c2b0b27 100644..100755 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl diff --git a/unix/Makefile.in b/unix/Makefile.in index b066e56..b066e56 100644..100755 --- a/unix/Makefile.in +++ b/unix/Makefile.in diff --git a/unix/configure.in b/unix/configure.in index fbf9f41..fbf9f41 100644..100755 --- a/unix/configure.in +++ b/unix/configure.in diff --git a/unix/tcl.m4 b/unix/tcl.m4 index c804072..c804072 100644..100755 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 5eac978..4ba2e47 100644..100755 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -22,7 +22,8 @@ static int NativeMatchType(CONST char* nativeName, Tcl_GlobTypeData *types); * TclpFindExecutable -- * * This procedure computes the absolute path name of the current - * application, given its argv[0] value. + * application, given its argv[0] value. For Cygwin, argv[0] is + * ignored and the path is determined the same as under win32. * * Results: * A dirty UTF string that is the path to the executable. At this @@ -45,18 +46,44 @@ TclpFindExecutable(argv0) CONST char *argv0; /* The value of the application's argv[0] * (native). */ { + int length; +#ifdef __CYGWIN__ + char buf[PATH_MAX * TCL_UTF_MAX + 1]; + char name[PATH_MAX * TCL_UTF_MAX + 1]; +#else CONST char *name, *p; Tcl_StatBuf statBuf; - int length; Tcl_DString buffer, nameString; +#endif - if (argv0 == NULL) { - return NULL; - } if (tclNativeExecutableName != NULL) { return tclNativeExecutableName; } +#ifdef __CYGWIN__ + + /* Make some symbols available without including <windows.h> */ +# define CP_UTF8 65001 + extern int cygwin_conv_to_full_posix_path(const char *, char *); + extern __stdcall int GetModuleFileNameW(void *, const char *, int); + extern __stdcall int WideCharToMultiByte(int, int, const char *, int, + const char *, int, const char *, const char *); + + GetModuleFileNameW(NULL, name, PATH_MAX); + WideCharToMultiByte(CP_UTF8, 0, name, -1, buf, PATH_MAX, NULL, NULL); + cygwin_conv_to_full_posix_path(buf, name); + length = strlen(name); + if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) { + /* Strip '.exe' part. */ + length -= 4; + } + tclNativeExecutableName = (char *) ckalloc(length + 1); + memcpy(tclNativeExecutableName, name, length); + buf[length] = '\0'; +#else + if (argv0 == NULL) { + return NULL; + } Tcl_DStringInit(&buffer); name = argv0; @@ -174,6 +201,7 @@ gotName: done: Tcl_DStringFree(&buffer); +#endif return tclNativeExecutableName; } diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index c0bf77d8..a26922c 100644..100755 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -658,7 +658,6 @@ extern int copyfile(const char *from, const char *to, void *state, * address platform-specific issues. */ -#define TclpGetPid(pid) ((unsigned long) (pid)) #define TclpReleaseFile(file) /* Nothing. */ /* diff --git a/win/configure.in b/win/configure.in index f839521..f839521 100644..100755 --- a/win/configure.in +++ b/win/configure.in diff --git a/win/tcl.m4 b/win/tcl.m4 index 708efc48..708efc48 100644..100755 --- a/win/tcl.m4 +++ b/win/tcl.m4 diff --git a/win/tclWinError.c b/win/tclWinError.c index d3126b1..d3126b1 100644..100755 --- a/win/tclWinError.c +++ b/win/tclWinError.c diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 69d1838..69d1838 100644..100755 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index f15daa5..a661343 100644..100755 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -871,7 +871,7 @@ TclpCloseFile( *-------------------------------------------------------------------------- */ -unsigned long +int TclpGetPid( Tcl_Pid pid) /* The HANDLE of the child process. */ { diff --git a/win/tclWinPort.h b/win/tclWinPort.h index aca3279..aca3279 100644..100755 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 06d0590..06d0590 100644..100755 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c |