diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | generic/tclInt.decls | 166 | ||||
-rw-r--r-- | generic/tclIntPlatDecls.h | 403 | ||||
-rw-r--r-- | generic/tclStubInit.c | 153 |
4 files changed, 565 insertions, 167 deletions
@@ -1,3 +1,13 @@ +2012-03-25 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclInt.decls: [Bug 3508771] load tclreg.dll in cygwin tclsh + * generic/tclIntPlatDecls.h: Implement TclWinConvertError, TclWinConvertWSAError, + * generic/tclStubInit.c: and various more win32-specific internal functions for + * unix/Makefile.in: Cygwin, so win32 extensions using those can be + * unix/tcl.m4: loaded in the cygwin version of tclsh. + * unix/configure: + * win/tclWinError.c: + 2012-03-23 Jan Nijtmans <nijtmans@users.sf.net> * generic/tclInt.decls Revert some cygwin-related signature changes from diff --git a/generic/tclInt.decls b/generic/tclInt.decls index eb9da09..948dd93 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -951,6 +951,117 @@ declare 249 { interface tclIntPlat +######################## +# Mac specific internals + +declare 0 mac { + VOID *TclpSysAlloc(long size, int isBin) +} +declare 1 mac { + void TclpSysFree(VOID *ptr) +} +declare 2 mac { + VOID *TclpSysRealloc(VOID *cp, unsigned int size) +} +declare 3 mac { + void TclpExit(int status) +} + +# Prototypes for functions found in the tclMacUtil.c compatability library. + +declare 4 mac { + int FSpGetDefaultDir(FSSpecPtr theSpec) +} +declare 5 mac { + int FSpSetDefaultDir(FSSpecPtr theSpec) +} +declare 6 mac { + OSErr FSpFindFolder(short vRefNum, OSType folderType, + Boolean createFolder, FSSpec *spec) +} +declare 7 mac { + void GetGlobalMouseTcl(Point *mouse) +} + +# The following routines are utility functions in Tcl. They are exported +# here because they are needed in Tk. They are not officially supported, +# however. The first set are from the MoreFiles package. + +declare 8 mac { + pascal OSErr FSpGetDirectoryIDTcl(CONST FSSpec *spec, long *theDirID, + Boolean *isDirectory) +} +declare 9 mac { + pascal short FSpOpenResFileCompatTcl(CONST FSSpec *spec, + SignedByte permission) +} +declare 10 mac { + pascal void FSpCreateResFileCompatTcl(CONST FSSpec *spec, OSType creator, + OSType fileType, ScriptCode scriptTag) +} + +# Like the MoreFiles routines these fix problems in the standard +# Mac calls. These routines are from tclMacUtils.h. + +declare 11 mac { + int FSpLocationFromPath(int length, CONST char *path, FSSpecPtr theSpec) +} +declare 12 mac { + OSErr FSpPathFromLocation(FSSpecPtr theSpec, int *length, + Handle *fullPath) +} + +# Prototypes of Mac only internal functions. + +declare 13 mac { + void TclMacExitHandler(void) +} +declare 14 mac { + void TclMacInitExitToShell(int usePatch) +} +declare 15 mac { + OSErr TclMacInstallExitToShellPatch(ExitToShellProcPtr newProc) +} +declare 16 mac { + int TclMacOSErrorToPosixError(int error) +} +declare 17 mac { + void TclMacRemoveTimer(VOID *timerToken) +} +declare 18 mac { + VOID *TclMacStartTimer(long ms) +} +declare 19 mac { + int TclMacTimerExpired(VOID *timerToken) +} +declare 20 mac { + int TclMacRegisterResourceFork(short fileRef, Tcl_Obj *tokenPtr, + int insert) +} +declare 21 mac { + short TclMacUnRegisterResourceFork(char *tokenPtr, Tcl_Obj *resultPtr) +} +declare 22 mac { + int TclMacCreateEnv(void) +} +declare 23 mac { + FILE *TclMacFOpenHack(CONST char *path, CONST char *mode) +} +# Replaced in 8.1 by TclpReadLink: +# declare 24 mac { +# int TclMacReadlink(char *path, char *buf, int size) +# } +declare 24 mac { + char *TclpGetTZName(int isdst) +} +declare 25 mac { + int TclMacChmod(CONST char *path, int mode) +} +# version of FSpLocationFromPath that doesn't resolve the last path component +declare 26 mac { + int FSpLLocationFromPath(int length, CONST char *path, FSSpecPtr theSpec) +} + ################################ # Windows specific functions @@ -1073,11 +1184,13 @@ declare 29 win { # Pipe channel functions +# On non-cygwin, this is actually a reference to TclGetAndDetachPids declare 0 unix { - void TclGetAndDetachPids(Tcl_Interp *interp, Tcl_Channel chan) + void TclWinConvertError(unsigned int errCode) } +# On non-cygwin, this is actually a reference to TclpCloseFile declare 1 unix { - int TclpCloseFile(TclFile file) + void TclWinConvertWSAError(unsigned int errCode) } declare 2 unix { Tcl_Channel TclpCreateCommandChannel(TclFile readFile, @@ -1086,20 +1199,23 @@ declare 2 unix { declare 3 unix { int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) } +# On non-cygwin, this is actually a reference to TclpCreateProcess declare 4 unix { - int TclpCreateProcess(Tcl_Interp *interp, int argc, CONST char **argv, - TclFile inputFile, TclFile outputFile, TclFile errorFile, - Tcl_Pid *pidPtr) + int TclWinGetTclInstance(void) } # Signature changed in 8.1: # declare 5 unix { # TclFile TclpCreateTempFile(char *contents, Tcl_DString *namePtr) # } + +# On non-cygwin, this is actually a reference to TclpMakeFile declare 6 unix { - TclFile TclpMakeFile(Tcl_Channel channel, int direction) + unsigned short TclWinNToHS(unsigned short ns) } +# On non-cygwin, this is actually a reference to TclpOpenFile declare 7 unix { - TclFile TclpOpenFile(CONST char *fname, int mode) + int TclWinSetSockOpt(int s, int level, int optname, + CONST char *optval, int optlen) } declare 8 unix { int TclUnixWaitForFile(int fd, int mask, int timeout) @@ -1119,9 +1235,11 @@ declare 10 unix { } # Slots 11 and 12 are forwarders for functions that were promoted to # generic Stubs +# On cygwin, this is actually a reference to TclGetAndDetachPids declare 11 unix { struct tm *TclpLocaltime_unix(CONST time_t *clock) } +# On cygwin, this is actually a reference to TclpCloseFile declare 12 unix { struct tm *TclpGmtime_unix(CONST time_t *clock) } @@ -1139,7 +1257,8 @@ declare 14 unix { ################################ # Mac OS X specific functions -declare 15 macosx { +#On cygwin, TclpCreateProcess is here +declare 15 {unix macosx} { int TclMacOSXGetFileAttribute(Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr) } @@ -1151,21 +1270,46 @@ declare 17 macosx { int TclMacOSXCopyFileAttributes(CONST char *src, CONST char *dst, CONST Tcl_StatBuf *statBufPtr) } -declare 18 macosx { +#On cygwin, TclpMakeFile is here +declare 18 {unix macosx} { int TclMacOSXMatchType(Tcl_Interp *interp, CONST char *pathName, CONST char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types) } -declare 19 macosx { +#On cygwin, TclpOpenFile is here +declare 19 {unix macosx} { void TclMacOSXNotifierAddRunLoopMode(CONST void *runLoopMode) } - +declare 20 unix { + void TclWinAddProcess(void *hProcess, unsigned long id) +} declare 22 unix { TclFile TclpCreateTempFile(CONST char *contents) } +declare 23 unix { + char *TclpGetTZName(int isdst) +} +declare 24 unix { + char *TclWinNoBackslash(char *path) +} +declare 26 unix { + void TclWinSetInterfaces(int wide) +} +declare 27 unix { + void TclWinFlushDirtyChannels(void) +} +declare 28 unix { + void TclWinResetInterfaces(void) +} declare 29 unix { int TclWinCPUID(unsigned int index, unsigned int *regs) } +declare 30 unix { + void TclGetAndDetachPids(Tcl_Interp *interp, Tcl_Channel chan) +} +declare 31 unix { + int TclpCloseFile(TclFile file) +} # Local Variables: diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 4c7c8bb..8375058 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -24,6 +24,16 @@ # endif #endif +#if !defined(__WIN32__) /* 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 @@ -37,16 +47,15 @@ */ #if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ -#ifndef TclGetAndDetachPids_TCL_DECLARED -#define TclGetAndDetachPids_TCL_DECLARED +#ifndef TclWinConvertError_TCL_DECLARED +#define TclWinConvertError_TCL_DECLARED /* 0 */ -EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, - Tcl_Channel chan); +EXTERN void TclWinConvertError(unsigned int errCode); #endif -#ifndef TclpCloseFile_TCL_DECLARED -#define TclpCloseFile_TCL_DECLARED +#ifndef TclWinConvertWSAError_TCL_DECLARED +#define TclWinConvertWSAError_TCL_DECLARED /* 1 */ -EXTERN int TclpCloseFile(TclFile file); +EXTERN void TclWinConvertWSAError(unsigned int errCode); #endif #ifndef TclpCreateCommandChannel_TCL_DECLARED #define TclpCreateCommandChannel_TCL_DECLARED @@ -60,24 +69,22 @@ EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile, /* 3 */ EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe); #endif -#ifndef TclpCreateProcess_TCL_DECLARED -#define TclpCreateProcess_TCL_DECLARED +#ifndef TclWinGetTclInstance_TCL_DECLARED +#define TclWinGetTclInstance_TCL_DECLARED /* 4 */ -EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc, - CONST char **argv, TclFile inputFile, - TclFile outputFile, TclFile errorFile, - Tcl_Pid *pidPtr); +EXTERN int TclWinGetTclInstance(void); #endif /* Slot 5 is reserved */ -#ifndef TclpMakeFile_TCL_DECLARED -#define TclpMakeFile_TCL_DECLARED +#ifndef TclWinNToHS_TCL_DECLARED +#define TclWinNToHS_TCL_DECLARED /* 6 */ -EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction); +EXTERN unsigned short TclWinNToHS(unsigned short ns); #endif -#ifndef TclpOpenFile_TCL_DECLARED -#define TclpOpenFile_TCL_DECLARED +#ifndef TclWinSetSockOpt_TCL_DECLARED +#define TclWinSetSockOpt_TCL_DECLARED /* 7 */ -EXTERN TclFile TclpOpenFile(CONST char *fname, int mode); +EXTERN int TclWinSetSockOpt(int s, int level, int optname, + CONST char *optval, int optlen); #endif #ifndef TclUnixWaitForFile_TCL_DECLARED #define TclUnixWaitForFile_TCL_DECLARED @@ -116,29 +123,82 @@ EXTERN int TclUnixCopyFile(CONST char *src, CONST char *dst, CONST Tcl_StatBuf *statBufPtr, int dontCopyAtts); #endif -/* Slot 15 is reserved */ +#ifndef TclMacOSXGetFileAttribute_TCL_DECLARED +#define TclMacOSXGetFileAttribute_TCL_DECLARED +/* 15 */ +EXTERN int TclMacOSXGetFileAttribute(Tcl_Interp *interp, + int objIndex, Tcl_Obj *fileName, + Tcl_Obj **attributePtrPtr); +#endif /* Slot 16 is reserved */ /* Slot 17 is reserved */ -/* Slot 18 is reserved */ -/* Slot 19 is reserved */ -/* Slot 20 is reserved */ +#ifndef TclMacOSXMatchType_TCL_DECLARED +#define TclMacOSXMatchType_TCL_DECLARED +/* 18 */ +EXTERN int TclMacOSXMatchType(Tcl_Interp *interp, + CONST char *pathName, CONST char *fileName, + Tcl_StatBuf *statBufPtr, + Tcl_GlobTypeData *types); +#endif +#ifndef TclMacOSXNotifierAddRunLoopMode_TCL_DECLARED +#define TclMacOSXNotifierAddRunLoopMode_TCL_DECLARED +/* 19 */ +EXTERN void TclMacOSXNotifierAddRunLoopMode( + CONST VOID *runLoopMode); +#endif +#ifndef TclWinAddProcess_TCL_DECLARED +#define TclWinAddProcess_TCL_DECLARED +/* 20 */ +EXTERN void TclWinAddProcess(VOID *hProcess, unsigned long id); +#endif /* Slot 21 is reserved */ #ifndef TclpCreateTempFile_TCL_DECLARED #define TclpCreateTempFile_TCL_DECLARED /* 22 */ EXTERN TclFile TclpCreateTempFile(CONST char *contents); #endif -/* Slot 23 is reserved */ -/* Slot 24 is reserved */ +#ifndef TclpGetTZName_TCL_DECLARED +#define TclpGetTZName_TCL_DECLARED +/* 23 */ +EXTERN char * TclpGetTZName(int isdst); +#endif +#ifndef TclWinNoBackslash_TCL_DECLARED +#define TclWinNoBackslash_TCL_DECLARED +/* 24 */ +EXTERN char * TclWinNoBackslash(char *path); +#endif /* Slot 25 is reserved */ -/* Slot 26 is reserved */ -/* Slot 27 is reserved */ -/* Slot 28 is reserved */ +#ifndef TclWinSetInterfaces_TCL_DECLARED +#define TclWinSetInterfaces_TCL_DECLARED +/* 26 */ +EXTERN void TclWinSetInterfaces(int wide); +#endif +#ifndef TclWinFlushDirtyChannels_TCL_DECLARED +#define TclWinFlushDirtyChannels_TCL_DECLARED +/* 27 */ +EXTERN void TclWinFlushDirtyChannels(void); +#endif +#ifndef TclWinResetInterfaces_TCL_DECLARED +#define TclWinResetInterfaces_TCL_DECLARED +/* 28 */ +EXTERN void TclWinResetInterfaces(void); +#endif #ifndef TclWinCPUID_TCL_DECLARED #define TclWinCPUID_TCL_DECLARED /* 29 */ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); #endif +#ifndef TclGetAndDetachPids_TCL_DECLARED +#define TclGetAndDetachPids_TCL_DECLARED +/* 30 */ +EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, + Tcl_Channel chan); +#endif +#ifndef TclpCloseFile_TCL_DECLARED +#define TclpCloseFile_TCL_DECLARED +/* 31 */ +EXTERN int TclpCloseFile(TclFile file); +#endif #endif /* UNIX */ #ifdef __WIN32__ /* WIN */ #ifndef TclWinConvertError_TCL_DECLARED @@ -278,16 +338,15 @@ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); #endif #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ -#ifndef TclGetAndDetachPids_TCL_DECLARED -#define TclGetAndDetachPids_TCL_DECLARED +#ifndef TclWinConvertError_TCL_DECLARED +#define TclWinConvertError_TCL_DECLARED /* 0 */ -EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, - Tcl_Channel chan); +EXTERN void TclWinConvertError(unsigned int errCode); #endif -#ifndef TclpCloseFile_TCL_DECLARED -#define TclpCloseFile_TCL_DECLARED +#ifndef TclWinConvertWSAError_TCL_DECLARED +#define TclWinConvertWSAError_TCL_DECLARED /* 1 */ -EXTERN int TclpCloseFile(TclFile file); +EXTERN void TclWinConvertWSAError(unsigned int errCode); #endif #ifndef TclpCreateCommandChannel_TCL_DECLARED #define TclpCreateCommandChannel_TCL_DECLARED @@ -301,24 +360,22 @@ EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile, /* 3 */ EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe); #endif -#ifndef TclpCreateProcess_TCL_DECLARED -#define TclpCreateProcess_TCL_DECLARED +#ifndef TclWinGetTclInstance_TCL_DECLARED +#define TclWinGetTclInstance_TCL_DECLARED /* 4 */ -EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc, - CONST char **argv, TclFile inputFile, - TclFile outputFile, TclFile errorFile, - Tcl_Pid *pidPtr); +EXTERN int TclWinGetTclInstance(void); #endif /* Slot 5 is reserved */ -#ifndef TclpMakeFile_TCL_DECLARED -#define TclpMakeFile_TCL_DECLARED +#ifndef TclWinNToHS_TCL_DECLARED +#define TclWinNToHS_TCL_DECLARED /* 6 */ -EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction); +EXTERN unsigned short TclWinNToHS(unsigned short ns); #endif -#ifndef TclpOpenFile_TCL_DECLARED -#define TclpOpenFile_TCL_DECLARED +#ifndef TclWinSetSockOpt_TCL_DECLARED +#define TclWinSetSockOpt_TCL_DECLARED /* 7 */ -EXTERN TclFile TclpOpenFile(CONST char *fname, int mode); +EXTERN int TclWinSetSockOpt(int s, int level, int optname, + CONST char *optval, int optlen); #endif #ifndef TclUnixWaitForFile_TCL_DECLARED #define TclUnixWaitForFile_TCL_DECLARED @@ -392,24 +449,59 @@ EXTERN int TclMacOSXMatchType(Tcl_Interp *interp, EXTERN void TclMacOSXNotifierAddRunLoopMode( CONST VOID *runLoopMode); #endif -/* Slot 20 is reserved */ +#ifndef TclWinAddProcess_TCL_DECLARED +#define TclWinAddProcess_TCL_DECLARED +/* 20 */ +EXTERN void TclWinAddProcess(VOID *hProcess, unsigned long id); +#endif /* Slot 21 is reserved */ #ifndef TclpCreateTempFile_TCL_DECLARED #define TclpCreateTempFile_TCL_DECLARED /* 22 */ EXTERN TclFile TclpCreateTempFile(CONST char *contents); #endif -/* Slot 23 is reserved */ -/* Slot 24 is reserved */ +#ifndef TclpGetTZName_TCL_DECLARED +#define TclpGetTZName_TCL_DECLARED +/* 23 */ +EXTERN char * TclpGetTZName(int isdst); +#endif +#ifndef TclWinNoBackslash_TCL_DECLARED +#define TclWinNoBackslash_TCL_DECLARED +/* 24 */ +EXTERN char * TclWinNoBackslash(char *path); +#endif /* Slot 25 is reserved */ -/* Slot 26 is reserved */ -/* Slot 27 is reserved */ -/* Slot 28 is reserved */ +#ifndef TclWinSetInterfaces_TCL_DECLARED +#define TclWinSetInterfaces_TCL_DECLARED +/* 26 */ +EXTERN void TclWinSetInterfaces(int wide); +#endif +#ifndef TclWinFlushDirtyChannels_TCL_DECLARED +#define TclWinFlushDirtyChannels_TCL_DECLARED +/* 27 */ +EXTERN void TclWinFlushDirtyChannels(void); +#endif +#ifndef TclWinResetInterfaces_TCL_DECLARED +#define TclWinResetInterfaces_TCL_DECLARED +/* 28 */ +EXTERN void TclWinResetInterfaces(void); +#endif #ifndef TclWinCPUID_TCL_DECLARED #define TclWinCPUID_TCL_DECLARED /* 29 */ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); #endif +#ifndef TclGetAndDetachPids_TCL_DECLARED +#define TclGetAndDetachPids_TCL_DECLARED +/* 30 */ +EXTERN void TclGetAndDetachPids(Tcl_Interp *interp, + Tcl_Channel chan); +#endif +#ifndef TclpCloseFile_TCL_DECLARED +#define TclpCloseFile_TCL_DECLARED +/* 31 */ +EXTERN int TclpCloseFile(TclFile file); +#endif #endif /* MACOSX */ typedef struct TclIntPlatStubs { @@ -417,14 +509,14 @@ typedef struct TclIntPlatStubs { struct TclIntPlatStubHooks *hooks; #if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ - void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 0 */ - int (*tclpCloseFile) (TclFile file); /* 1 */ + void (*tclWinConvertError) (unsigned int errCode); /* 0 */ + void (*tclWinConvertWSAError) (unsigned int errCode); /* 1 */ Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */ int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */ - int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 4 */ + int (*tclWinGetTclInstance) (void); /* 4 */ VOID *reserved5; - TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */ - TclFile (*tclpOpenFile) (CONST char *fname, int mode); /* 7 */ + unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */ + int (*tclWinSetSockOpt) (int s, int level, int optname, CONST char *optval, int optlen); /* 7 */ int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */ int (*tclWinGetPlatformId) (void); /* 9 */ Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ @@ -432,21 +524,23 @@ typedef struct TclIntPlatStubs { struct tm * (*tclpGmtime_unix) (CONST time_t *clock); /* 12 */ char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */ int (*tclUnixCopyFile) (CONST char *src, CONST char *dst, CONST Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */ - VOID *reserved15; + int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */ VOID *reserved16; VOID *reserved17; - VOID *reserved18; - VOID *reserved19; - VOID *reserved20; + int (*tclMacOSXMatchType) (Tcl_Interp *interp, CONST char *pathName, CONST char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types); /* 18 */ + void (*tclMacOSXNotifierAddRunLoopMode) (CONST VOID *runLoopMode); /* 19 */ + void (*tclWinAddProcess) (VOID *hProcess, unsigned long id); /* 20 */ VOID *reserved21; TclFile (*tclpCreateTempFile) (CONST char *contents); /* 22 */ - VOID *reserved23; - VOID *reserved24; + char * (*tclpGetTZName) (int isdst); /* 23 */ + char * (*tclWinNoBackslash) (char *path); /* 24 */ VOID *reserved25; - VOID *reserved26; - VOID *reserved27; - VOID *reserved28; + void (*tclWinSetInterfaces) (int wide); /* 26 */ + void (*tclWinFlushDirtyChannels) (void); /* 27 */ + void (*tclWinResetInterfaces) (void); /* 28 */ int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ + void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 30 */ + int (*tclpCloseFile) (TclFile file); /* 31 */ #endif /* UNIX */ #ifdef __WIN32__ /* WIN */ void (*tclWinConvertError) (DWORD errCode); /* 0 */ @@ -481,14 +575,14 @@ typedef struct TclIntPlatStubs { int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ - void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 0 */ - int (*tclpCloseFile) (TclFile file); /* 1 */ + void (*tclWinConvertError) (unsigned int errCode); /* 0 */ + void (*tclWinConvertWSAError) (unsigned int errCode); /* 1 */ Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */ int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */ - int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 4 */ + int (*tclWinGetTclInstance) (void); /* 4 */ VOID *reserved5; - TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 6 */ - TclFile (*tclpOpenFile) (CONST char *fname, int mode); /* 7 */ + unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */ + int (*tclWinSetSockOpt) (int s, int level, int optname, CONST char *optval, int optlen); /* 7 */ int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */ int (*tclWinGetPlatformId) (void); /* 9 */ Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ @@ -501,16 +595,18 @@ typedef struct TclIntPlatStubs { int (*tclMacOSXCopyFileAttributes) (CONST char *src, CONST char *dst, CONST Tcl_StatBuf *statBufPtr); /* 17 */ int (*tclMacOSXMatchType) (Tcl_Interp *interp, CONST char *pathName, CONST char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types); /* 18 */ void (*tclMacOSXNotifierAddRunLoopMode) (CONST VOID *runLoopMode); /* 19 */ - VOID *reserved20; + void (*tclWinAddProcess) (VOID *hProcess, unsigned long id); /* 20 */ VOID *reserved21; TclFile (*tclpCreateTempFile) (CONST char *contents); /* 22 */ - VOID *reserved23; - VOID *reserved24; + char * (*tclpGetTZName) (int isdst); /* 23 */ + char * (*tclWinNoBackslash) (char *path); /* 24 */ VOID *reserved25; - VOID *reserved26; - VOID *reserved27; - VOID *reserved28; + void (*tclWinSetInterfaces) (int wide); /* 26 */ + void (*tclWinFlushDirtyChannels) (void); /* 27 */ + void (*tclWinResetInterfaces) (void); /* 28 */ int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ + void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 30 */ + int (*tclpCloseFile) (TclFile file); /* 31 */ #endif /* MACOSX */ } TclIntPlatStubs; @@ -529,13 +625,13 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; */ #if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ -#ifndef TclGetAndDetachPids -#define TclGetAndDetachPids \ - (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */ +#ifndef TclWinConvertError +#define TclWinConvertError \ + (tclIntPlatStubsPtr->tclWinConvertError) /* 0 */ #endif -#ifndef TclpCloseFile -#define TclpCloseFile \ - (tclIntPlatStubsPtr->tclpCloseFile) /* 1 */ +#ifndef TclWinConvertWSAError +#define TclWinConvertWSAError \ + (tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */ #endif #ifndef TclpCreateCommandChannel #define TclpCreateCommandChannel \ @@ -545,18 +641,18 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpCreatePipe \ (tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */ #endif -#ifndef TclpCreateProcess -#define TclpCreateProcess \ - (tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */ +#ifndef TclWinGetTclInstance +#define TclWinGetTclInstance \ + (tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */ #endif /* Slot 5 is reserved */ -#ifndef TclpMakeFile -#define TclpMakeFile \ - (tclIntPlatStubsPtr->tclpMakeFile) /* 6 */ +#ifndef TclWinNToHS +#define TclWinNToHS \ + (tclIntPlatStubsPtr->tclWinNToHS) /* 6 */ #endif -#ifndef TclpOpenFile -#define TclpOpenFile \ - (tclIntPlatStubsPtr->tclpOpenFile) /* 7 */ +#ifndef TclWinSetSockOpt +#define TclWinSetSockOpt \ + (tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */ #endif #ifndef TclUnixWaitForFile #define TclUnixWaitForFile \ @@ -586,27 +682,62 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclUnixCopyFile \ (tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */ #endif -/* Slot 15 is reserved */ +#ifndef TclMacOSXGetFileAttribute +#define TclMacOSXGetFileAttribute \ + (tclIntPlatStubsPtr->tclMacOSXGetFileAttribute) /* 15 */ +#endif /* Slot 16 is reserved */ /* Slot 17 is reserved */ -/* Slot 18 is reserved */ -/* Slot 19 is reserved */ -/* Slot 20 is reserved */ +#ifndef TclMacOSXMatchType +#define TclMacOSXMatchType \ + (tclIntPlatStubsPtr->tclMacOSXMatchType) /* 18 */ +#endif +#ifndef TclMacOSXNotifierAddRunLoopMode +#define TclMacOSXNotifierAddRunLoopMode \ + (tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */ +#endif +#ifndef TclWinAddProcess +#define TclWinAddProcess \ + (tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */ +#endif /* Slot 21 is reserved */ #ifndef TclpCreateTempFile #define TclpCreateTempFile \ (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */ #endif -/* Slot 23 is reserved */ -/* Slot 24 is reserved */ +#ifndef TclpGetTZName +#define TclpGetTZName \ + (tclIntPlatStubsPtr->tclpGetTZName) /* 23 */ +#endif +#ifndef TclWinNoBackslash +#define TclWinNoBackslash \ + (tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */ +#endif /* Slot 25 is reserved */ -/* Slot 26 is reserved */ -/* Slot 27 is reserved */ -/* Slot 28 is reserved */ +#ifndef TclWinSetInterfaces +#define TclWinSetInterfaces \ + (tclIntPlatStubsPtr->tclWinSetInterfaces) /* 26 */ +#endif +#ifndef TclWinFlushDirtyChannels +#define TclWinFlushDirtyChannels \ + (tclIntPlatStubsPtr->tclWinFlushDirtyChannels) /* 27 */ +#endif +#ifndef TclWinResetInterfaces +#define TclWinResetInterfaces \ + (tclIntPlatStubsPtr->tclWinResetInterfaces) /* 28 */ +#endif #ifndef TclWinCPUID #define TclWinCPUID \ (tclIntPlatStubsPtr->tclWinCPUID) /* 29 */ #endif +#ifndef TclGetAndDetachPids +#define TclGetAndDetachPids \ + (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 30 */ +#endif +#ifndef TclpCloseFile +#define TclpCloseFile \ + (tclIntPlatStubsPtr->tclpCloseFile) /* 31 */ +#endif #endif /* UNIX */ #ifdef __WIN32__ /* WIN */ #ifndef TclWinConvertError @@ -713,13 +844,13 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #endif #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ -#ifndef TclGetAndDetachPids -#define TclGetAndDetachPids \ - (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 0 */ +#ifndef TclWinConvertError +#define TclWinConvertError \ + (tclIntPlatStubsPtr->tclWinConvertError) /* 0 */ #endif -#ifndef TclpCloseFile -#define TclpCloseFile \ - (tclIntPlatStubsPtr->tclpCloseFile) /* 1 */ +#ifndef TclWinConvertWSAError +#define TclWinConvertWSAError \ + (tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */ #endif #ifndef TclpCreateCommandChannel #define TclpCreateCommandChannel \ @@ -729,18 +860,18 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpCreatePipe \ (tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */ #endif -#ifndef TclpCreateProcess -#define TclpCreateProcess \ - (tclIntPlatStubsPtr->tclpCreateProcess) /* 4 */ +#ifndef TclWinGetTclInstance +#define TclWinGetTclInstance \ + (tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */ #endif /* Slot 5 is reserved */ -#ifndef TclpMakeFile -#define TclpMakeFile \ - (tclIntPlatStubsPtr->tclpMakeFile) /* 6 */ +#ifndef TclWinNToHS +#define TclWinNToHS \ + (tclIntPlatStubsPtr->tclWinNToHS) /* 6 */ #endif -#ifndef TclpOpenFile -#define TclpOpenFile \ - (tclIntPlatStubsPtr->tclpOpenFile) /* 7 */ +#ifndef TclWinSetSockOpt +#define TclWinSetSockOpt \ + (tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */ #endif #ifndef TclUnixWaitForFile #define TclUnixWaitForFile \ @@ -790,22 +921,48 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclMacOSXNotifierAddRunLoopMode \ (tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */ #endif -/* Slot 20 is reserved */ +#ifndef TclWinAddProcess +#define TclWinAddProcess \ + (tclIntPlatStubsPtr->tclWinAddProcess) /* 20 */ +#endif /* Slot 21 is reserved */ #ifndef TclpCreateTempFile #define TclpCreateTempFile \ (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */ #endif -/* Slot 23 is reserved */ -/* Slot 24 is reserved */ +#ifndef TclpGetTZName +#define TclpGetTZName \ + (tclIntPlatStubsPtr->tclpGetTZName) /* 23 */ +#endif +#ifndef TclWinNoBackslash +#define TclWinNoBackslash \ + (tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */ +#endif /* Slot 25 is reserved */ -/* Slot 26 is reserved */ -/* Slot 27 is reserved */ -/* Slot 28 is reserved */ +#ifndef TclWinSetInterfaces +#define TclWinSetInterfaces \ + (tclIntPlatStubsPtr->tclWinSetInterfaces) /* 26 */ +#endif +#ifndef TclWinFlushDirtyChannels +#define TclWinFlushDirtyChannels \ + (tclIntPlatStubsPtr->tclWinFlushDirtyChannels) /* 27 */ +#endif +#ifndef TclWinResetInterfaces +#define TclWinResetInterfaces \ + (tclIntPlatStubsPtr->tclWinResetInterfaces) /* 28 */ +#endif #ifndef TclWinCPUID #define TclWinCPUID \ (tclIntPlatStubsPtr->tclWinCPUID) /* 29 */ #endif +#ifndef TclGetAndDetachPids +#define TclGetAndDetachPids \ + (tclIntPlatStubsPtr->tclGetAndDetachPids) /* 30 */ +#endif +#ifndef TclpCloseFile +#define TclpCloseFile \ + (tclIntPlatStubsPtr->tclpCloseFile) /* 31 */ +#endif #endif /* MACOSX */ #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 245aa85..7e98a75 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -31,8 +31,6 @@ #undef Tcl_ValidateAllMemory #undef Tcl_FindHashEntry #undef Tcl_CreateHashEntry -#define TclpLocaltime_unix TclpLocaltime -#define TclpGmtime_unix TclpGmtime /* * Keep a record of the original Notifier procedures, created in the @@ -68,6 +66,15 @@ MODULE_SCOPE TclTomMathStubs tclTomMathStubs; #define TclWinGetPlatformId winGetPlatformId #define Tcl_WinUtfToTChar winUtfToTChar #define Tcl_WinTCharToUtf winTCharToUtf +#define TclWinGetTclInstance winGetTclInstance +#define TclWinNToHS winNToHS +#define TclWinSetSockOpt winSetSockOpt +#define TclWinAddProcess winAddProcess +#define TclpGetTZName pGetTZName +#define TclWinNoBackslash winNoBackslash +#define TclWinSetInterfaces (void (*) _ANSI_ARGS_((int))) doNothing +#define TclWinFlushDirtyChannels doNothing +#define TclWinResetInterfaces doNothing static Tcl_Encoding winTCharEncoding; @@ -79,6 +86,59 @@ TclWinGetPlatformId() return 2; /* VER_PLATFORM_WIN32_NT */; } +static int TclWinGetTclInstance() +{ + Tcl_Panic("TclWinGetTclInstance not yet implemented for CYGWIN"); + return 0; +} + +static unsigned short +TclWinNToHS(unsigned short ns) +{ + Tcl_Panic("TclWinNToHS not yet implemented for CYGWIN"); + return (unsigned short) -1; +} +static int +TclWinSetSockOpt(int s, int level, int optname, + const char *optval, int optlen) +{ + Tcl_Panic("TclWinSetSockOpt not yet implemented for CYGWIN"); + return -1; +} + +static void +TclWinAddProcess(void *hProcess, unsigned long id) +{ + Tcl_Panic("TclWinAddProcess not yet implemented for CYGWIN"); +} + +static char * +TclpGetTZName(int isdst) +{ + /* TODO: implementation */ + Tcl_Panic("TclpGetTZName not yet implemented for CYGWIN"); + return 0; +} + +static char * +TclWinNoBackslash(char *path) +{ + char *p; + + for (p = path; *p != '\0'; p++) { + if (*p == '\\') { + *p = '/'; + } + } + return path; +} + +static void +doNothing(void) +{ + /* dummy implementation, no need to do anything */ +} + static char * Tcl_WinUtfToTChar(string, len, dsPtr) CONST char *string; @@ -86,20 +146,20 @@ Tcl_WinUtfToTChar(string, len, dsPtr) Tcl_DString *dsPtr; { if (!winTCharEncoding) { - winTCharEncoding = Tcl_GetEncoding(NULL, "unicode"); + winTCharEncoding = Tcl_GetEncoding(0, "unicode"); } return Tcl_UtfToExternalDString(winTCharEncoding, string, len, dsPtr); } static char * -Tcl_WinTCharToUtf(string, len, dsPtr) - CONST char *string; - int len; - Tcl_DString *dsPtr; +Tcl_WinTCharToUtf( + CONST char *string, + int len, + Tcl_DString *dsPtr) { if (!winTCharEncoding) { - winTCharEncoding = Tcl_GetEncoding(NULL, "unicode"); + winTCharEncoding = Tcl_GetEncoding(0, "unicode"); } return Tcl_ExternalToUtfDString(winTCharEncoding, string, len, dsPtr); @@ -109,13 +169,36 @@ Tcl_WinTCharToUtf(string, len, dsPtr) Tcl_Interp *, CONST char *, int, int, char *))) Tcl_WinUtfToTChar #define Tcl_MacOSXOpenVersionedBundleResources (int (*) _ANSI_ARGS_(( \ Tcl_Interp *, CONST char *, CONST char *, int, int, char *))) Tcl_WinTCharToUtf +#define TclMacOSXGetFileAttribute (int (*) _ANSI_ARGS_((Tcl_Interp *, \ + int, Tcl_Obj *, Tcl_Obj **))) TclpCreateProcess +#define TclMacOSXMatchType (int (*) _ANSI_ARGS_((Tcl_Interp *, CONST char *, \ + CONST char *, Tcl_StatBuf *, Tcl_GlobTypeData *))) TclpMakeFile +#define TclMacOSXNotifierAddRunLoopMode (void (*) _ANSI_ARGS_((CONST void *))) TclpOpenFile +#define TclpLocaltime_unix (struct tm *(*) _ANSI_ARGS_((CONST time_t *))) TclGetAndDetachPids +#define TclpGmtime_unix (struct tm *(*) _ANSI_ARGS_((CONST time_t *))) TclpCloseFile #elif !defined(__WIN32__) /* UNIX and MAC */ +# define TclWinConvertError (void (*) _ANSI_ARGS_((unsigned int))) TclGetAndDetachPids +# define TclWinConvertWSAError (void (*) _ANSI_ARGS_((unsigned int))) TclpCloseFile # define TclWinGetPlatformId (int (*)()) TclpCreateTempFile +# define TclWinGetTclInstance (int (*)()) TclpCreateProcess +# define TclWinNToHS (unsigned short (*) _ANSI_ARGS_((unsigned short ns))) TclpMakeFile +# define TclWinSetSockOpt (int (*) _ANSI_ARGS_((int, int, int, const char *, int))) TclpOpenFile +# define TclWinAddProcess 0 +# define TclpGetTZName 0 +# define TclWinNoBackslash 0 +# define TclWinSetInterfaces 0 +# define TclWinFlushDirtyChannels 0 +# define TclWinResetInterfaces 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 */ # ifndef MAC_OSX_TCL # define Tcl_MacOSXOpenBundleResources 0 # define Tcl_MacOSXOpenVersionedBundleResources 0 # endif +# define TclpLocaltime_unix TclpLocaltime +# define TclpGmtime_unix TclpGmtime #endif /* @@ -385,14 +468,14 @@ TclIntPlatStubs tclIntPlatStubs = { TCL_STUB_MAGIC, NULL, #if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ - TclGetAndDetachPids, /* 0 */ - TclpCloseFile, /* 1 */ + TclWinConvertError, /* 0 */ + TclWinConvertWSAError, /* 1 */ TclpCreateCommandChannel, /* 2 */ TclpCreatePipe, /* 3 */ - TclpCreateProcess, /* 4 */ + TclWinGetTclInstance, /* 4 */ NULL, /* 5 */ - TclpMakeFile, /* 6 */ - TclpOpenFile, /* 7 */ + TclWinNToHS, /* 6 */ + TclWinSetSockOpt, /* 7 */ TclUnixWaitForFile, /* 8 */ TclWinGetPlatformId, /* 9 */ TclpReaddir, /* 10 */ @@ -400,21 +483,23 @@ TclIntPlatStubs tclIntPlatStubs = { TclpGmtime_unix, /* 12 */ TclpInetNtoa, /* 13 */ TclUnixCopyFile, /* 14 */ - NULL, /* 15 */ + TclMacOSXGetFileAttribute, /* 15 */ NULL, /* 16 */ NULL, /* 17 */ - NULL, /* 18 */ - NULL, /* 19 */ - NULL, /* 20 */ + TclMacOSXMatchType, /* 18 */ + TclMacOSXNotifierAddRunLoopMode, /* 19 */ + TclWinAddProcess, /* 20 */ NULL, /* 21 */ TclpCreateTempFile, /* 22 */ - NULL, /* 23 */ - NULL, /* 24 */ + TclpGetTZName, /* 23 */ + TclWinNoBackslash, /* 24 */ NULL, /* 25 */ - NULL, /* 26 */ - NULL, /* 27 */ - NULL, /* 28 */ + TclWinSetInterfaces, /* 26 */ + TclWinFlushDirtyChannels, /* 27 */ + TclWinResetInterfaces, /* 28 */ TclWinCPUID, /* 29 */ + TclGetAndDetachPids, /* 30 */ + TclpCloseFile, /* 31 */ #endif /* UNIX */ #ifdef __WIN32__ /* WIN */ TclWinConvertError, /* 0 */ @@ -449,14 +534,14 @@ TclIntPlatStubs tclIntPlatStubs = { TclWinCPUID, /* 29 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ - TclGetAndDetachPids, /* 0 */ - TclpCloseFile, /* 1 */ + TclWinConvertError, /* 0 */ + TclWinConvertWSAError, /* 1 */ TclpCreateCommandChannel, /* 2 */ TclpCreatePipe, /* 3 */ - TclpCreateProcess, /* 4 */ + TclWinGetTclInstance, /* 4 */ NULL, /* 5 */ - TclpMakeFile, /* 6 */ - TclpOpenFile, /* 7 */ + TclWinNToHS, /* 6 */ + TclWinSetSockOpt, /* 7 */ TclUnixWaitForFile, /* 8 */ TclWinGetPlatformId, /* 9 */ TclpReaddir, /* 10 */ @@ -469,16 +554,18 @@ TclIntPlatStubs tclIntPlatStubs = { TclMacOSXCopyFileAttributes, /* 17 */ TclMacOSXMatchType, /* 18 */ TclMacOSXNotifierAddRunLoopMode, /* 19 */ - NULL, /* 20 */ + TclWinAddProcess, /* 20 */ NULL, /* 21 */ TclpCreateTempFile, /* 22 */ - NULL, /* 23 */ - NULL, /* 24 */ + TclpGetTZName, /* 23 */ + TclWinNoBackslash, /* 24 */ NULL, /* 25 */ - NULL, /* 26 */ - NULL, /* 27 */ - NULL, /* 28 */ + TclWinSetInterfaces, /* 26 */ + TclWinFlushDirtyChannels, /* 27 */ + TclWinResetInterfaces, /* 28 */ TclWinCPUID, /* 29 */ + TclGetAndDetachPids, /* 30 */ + TclpCloseFile, /* 31 */ #endif /* MACOSX */ }; |