diff options
Diffstat (limited to 'generic')
-rwxr-xr-x | generic/tclInt.decls | 38 | ||||
-rw-r--r-- | generic/tclIntPlatDecls.h | 87 | ||||
-rw-r--r-- | generic/tclStubInit.c | 31 |
3 files changed, 104 insertions, 52 deletions
diff --git a/generic/tclInt.decls b/generic/tclInt.decls index e438588..ef2f6df 100755 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -953,12 +953,14 @@ declare 0 unix { declare 1 unix { void TclWinConvertWSAError(unsigned int errCode) } +# On non-cygwin, this is actually a reference to TclpCreateCommandChannel declare 2 unix { - Tcl_Channel TclpCreateCommandChannel(TclFile readFile, - TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr) + struct servent *TclWinGetServByName(const char *nm, const char *proto) } +# On non-cygwin, this is actually a reference to TclpCreatePipe declare 3 unix { - int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) + int TclWinGetSockOpt(void *s, int level, int optname, + char *optval, int *optlen) } # On non-cygwin, this is actually a reference to TclpCreateProcess declare 4 unix { @@ -1005,8 +1007,10 @@ declare 11 unix { declare 12 unix { struct tm *TclpGmtime_unix(TclpTime_t_CONST clock) } +# On cygwin, this is a reference to TclpCreateCommandChannel +# Otherwise, this is a reference to TclpInetNtoa declare 13 unix { - char *TclpInetNtoa(struct in_addr addr) + void TclIntPlatReserved13(void) } #On cygwin, TclpCreateProcess is here declare 15 unix { @@ -1050,26 +1054,26 @@ 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 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 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 35 unix { + char *TclpInetNtoa(struct in_addr addr) +} declare 36 unix { - TclFile TclpMakeFile (Tcl_Channel channel, int direction) + TclFile TclpMakeFile(Tcl_Channel channel, int direction) } declare 37 unix { - TclFile TclpOpenFile (const char *fname, int mode) + TclFile TclpOpenFile(const char *fname, int mode) } declare 38 unix { int TclUnixWaitForFile(int fd, int mask, int timeout) diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 6d3ed94..63f9fe6 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -32,13 +32,11 @@ EXTERN void TclWinConvertError _ANSI_ARGS_((unsigned int errCode)); EXTERN void TclWinConvertWSAError _ANSI_ARGS_(( unsigned int errCode)); /* 2 */ -EXTERN Tcl_Channel TclpCreateCommandChannel _ANSI_ARGS_(( - TclFile readFile, TclFile writeFile, - TclFile errorFile, int numPids, - Tcl_Pid *pidPtr)); +EXTERN struct servent * TclWinGetServByName _ANSI_ARGS_((CONST char *nm, + CONST char *proto)); /* 3 */ -EXTERN int TclpCreatePipe _ANSI_ARGS_((TclFile *readPipe, - TclFile *writePipe)); +EXTERN int TclWinGetSockOpt _ANSI_ARGS_((VOID *s, int level, + int optname, char *optval, int *optlen)); /* 4 */ EXTERN VOID * TclWinGetTclInstance _ANSI_ARGS_((void)); /* Slot 5 is reserved */ @@ -59,7 +57,7 @@ EXTERN struct tm * TclpLocaltime_unix _ANSI_ARGS_(( /* 12 */ EXTERN struct tm * TclpGmtime_unix _ANSI_ARGS_((TclpTime_t_CONST clock)); /* 13 */ -EXTERN char * TclpInetNtoa _ANSI_ARGS_((struct in_addr addr)); +EXTERN void TclIntPlatReserved13 _ANSI_ARGS_((void)); /* Slot 14 is reserved */ /* 15 */ EXTERN int TclMacOSXGetFileAttribute _ANSI_ARGS_(( @@ -99,14 +97,21 @@ 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 */ +/* 32 */ +EXTERN Tcl_Channel TclpCreateCommandChannel _ANSI_ARGS_(( + TclFile readFile, TclFile writeFile, + TclFile errorFile, int numPids, + Tcl_Pid *pidPtr)); +/* 33 */ +EXTERN int TclpCreatePipe _ANSI_ARGS_((TclFile *readPipe, + TclFile *writePipe)); /* 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 */ +/* 35 */ +EXTERN char * TclpInetNtoa _ANSI_ARGS_((struct in_addr addr)); /* 36 */ EXTERN TclFile TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel, int direction)); @@ -267,8 +272,8 @@ typedef struct TclIntPlatStubs { #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ void (*tclWinConvertError) _ANSI_ARGS_((unsigned int errCode)); /* 0 */ void (*tclWinConvertWSAError) _ANSI_ARGS_((unsigned int errCode)); /* 1 */ - Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)); /* 2 */ - int (*tclpCreatePipe) _ANSI_ARGS_((TclFile *readPipe, TclFile *writePipe)); /* 3 */ + struct servent * (*tclWinGetServByName) _ANSI_ARGS_((CONST char *nm, CONST char *proto)); /* 2 */ + int (*tclWinGetSockOpt) _ANSI_ARGS_((VOID *s, int level, int optname, char *optval, int *optlen)); /* 3 */ VOID * (*tclWinGetTclInstance) _ANSI_ARGS_((void)); /* 4 */ VOID *reserved5; unsigned short (*tclWinNToHS) _ANSI_ARGS_((unsigned short ns)); /* 6 */ @@ -278,7 +283,7 @@ typedef struct TclIntPlatStubs { 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 (*tclIntPlatReserved13) _ANSI_ARGS_((void)); /* 13 */ VOID *reserved14; int (*tclMacOSXGetFileAttribute) _ANSI_ARGS_((Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr)); /* 15 */ VOID *reserved16; @@ -297,10 +302,10 @@ 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; + Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)); /* 32 */ + int (*tclpCreatePipe) _ANSI_ARGS_((TclFile *readPipe, TclFile *writePipe)); /* 33 */ int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp *interp, int argc, CONST char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)); /* 34 */ - VOID *reserved35; + char * (*tclpInetNtoa) _ANSI_ARGS_((struct in_addr addr)); /* 35 */ 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 */ @@ -391,13 +396,13 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinConvertWSAError \ (tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */ #endif -#ifndef TclpCreateCommandChannel -#define TclpCreateCommandChannel \ - (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */ +#ifndef TclWinGetServByName +#define TclWinGetServByName \ + (tclIntPlatStubsPtr->tclWinGetServByName) /* 2 */ #endif -#ifndef TclpCreatePipe -#define TclpCreatePipe \ - (tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */ +#ifndef TclWinGetSockOpt +#define TclWinGetSockOpt \ + (tclIntPlatStubsPtr->tclWinGetSockOpt) /* 3 */ #endif #ifndef TclWinGetTclInstance #define TclWinGetTclInstance \ @@ -432,9 +437,9 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpGmtime_unix \ (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */ #endif -#ifndef TclpInetNtoa -#define TclpInetNtoa \ - (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ +#ifndef TclIntPlatReserved13 +#define TclIntPlatReserved13 \ + (tclIntPlatStubsPtr->tclIntPlatReserved13) /* 13 */ #endif /* Slot 14 is reserved */ #ifndef TclMacOSXGetFileAttribute @@ -490,13 +495,22 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclpCloseFile \ (tclIntPlatStubsPtr->tclpCloseFile) /* 31 */ #endif -/* Slot 32 is reserved */ -/* Slot 33 is reserved */ +#ifndef TclpCreateCommandChannel +#define TclpCreateCommandChannel \ + (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 32 */ +#endif +#ifndef TclpCreatePipe +#define TclpCreatePipe \ + (tclIntPlatStubsPtr->tclpCreatePipe) /* 33 */ +#endif #ifndef TclpCreateProcess #define TclpCreateProcess \ (tclIntPlatStubsPtr->tclpCreateProcess) /* 34 */ #endif -/* Slot 35 is reserved */ +#ifndef TclpInetNtoa +#define TclpInetNtoa \ + (tclIntPlatStubsPtr->tclpInetNtoa) /* 35 */ +#endif #ifndef TclpMakeFile #define TclpMakeFile \ (tclIntPlatStubsPtr->tclpMakeFile) /* 36 */ @@ -734,6 +748,7 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #undef TclpLocaltime_unix #undef TclpGmtime_unix +#undef TclIntPlatReserved13 #if !defined(__WIN32__) && !defined(MAC_TCL) # undef TclpGetPid @@ -743,6 +758,7 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; # undef TclpCreateProcess # undef TclpMakeFile # undef TclpOpenFile +# undef TclpCreateCommandChannel # ifdef __CYGWIN__ # define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \ CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \ @@ -751,6 +767,8 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; int direction))) tclIntPlatStubsPtr->tclMacOSXMatchType) # define TclpOpenFile ((TclFile (*) _ANSI_ARGS_((CONST char *, int))) \ tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) +# define TclpCreateCommandChannel ((Tcl_Channel (*) _ANSI_ARGS_((TclFile, TclFile, \ + TclFile, int, Tcl_Pid *))) tclIntPlatStubsPtr->tclIntPlatReserved13) # else # define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \ CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \ @@ -758,11 +776,16 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; # define TclpMakeFile ((TclFile (*) _ANSI_ARGS_((Tcl_Channel channel, \ int direction))) tclIntPlatStubsPtr->tclWinNToHS) # define TclpOpenFile ((TclFile (*) _ANSI_ARGS_((CONST char *, int))) \ - tclIntPlatStubsPtr->tclWinNToHS) + tclIntPlatStubsPtr->tclWinSetSockOpt) +# define TclpCreateCommandChannel ((Tcl_Channel (*) _ANSI_ARGS_((TclFile, TclFile, \ + TclFile, int, Tcl_Pid *))) tclIntPlatStubsPtr->tclWinGetServByName) # undef TclpCreateTempFile # undef TclGetAndDetachPids # undef TclpCloseFile +# undef TclpCreatePipe +# undef TclpInetNtoa +# undef TclUnixWaitForFile # define TclpCreateTempFile ((TclFile (*) _ANSI_ARGS_((CONST char *))) \ tclIntPlatStubsPtr->tclWinGetPlatformId) @@ -770,6 +793,12 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; tclIntPlatStubsPtr->tclWinConvertError) # define TclpCloseFile ((int (*) _ANSI_ARGS_((TclFile))) \ tclIntPlatStubsPtr->tclWinConvertWSAError) +# define TclpCreatePipe ((int (*)_ANSI_ARGS_((TclFile *, TclFile *))) \ + tclIntPlatStubsPtr->tclWinGetSockOpt) +# define TclpInetNtoa ((char *(*) _ANSI_ARGS_((struct in_addr addr))) \ + tclIntPlatStubsPtr->tclIntPlatReserved13) +# define TclUnixWaitForFile (int (*) _ANSI_ARGS_((int, int, int))) \ + tclIntPlatStubsPtr->tclpGetPid) # endif # endif #endif diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index bd3dd05..fedce5e 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -82,9 +82,12 @@ int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); #define TclWinGetTclInstance winGetTclInstance #define TclWinNToHS winNToHS #define TclWinSetSockOpt winSetSockOpt +#define TclWinGetSockOpt winGetSockOpt +#define TclWinGetServByName winGetServByName #define TclWinNoBackslash winNoBackslash #define TclWinSetInterfaces (void (*) (int)) doNothing #define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing +#define TclIntPlatReserved13 (void (*) ()) TclpCreateCommandChannel #define TclWinFlushDirtyChannels doNothing #define TclWinResetInterfaces doNothing #define TclpGetPid getPid @@ -120,6 +123,19 @@ TclWinSetSockOpt(void *s, int level, int optname, return setsockopt((int) s, level, optname, optval, optlen); } +static int +TclWinGetSockOpt(void *s, int level, int optname, + char *optval, int optlen) +{ + return getsockopt((int) s, level, optname, optval, optlen); +} + +struct servent * +TclWinGetServByName(const char *name, const char *proto) +{ + return getservbyname(name, proto); +} + static char * TclWinNoBackslash(char *path) { @@ -190,6 +206,9 @@ Tcl_WinTCharToUtf( # define TclWinGetTclInstance (void *(*)()) TclpCreateProcess # define TclWinNToHS (unsigned short (*) _ANSI_ARGS_((unsigned short ns))) TclpMakeFile # define TclWinSetSockOpt (int (*) _ANSI_ARGS_((void *, int, int, CONST char *, int))) TclpOpenFile +# define TclWinGetSockOpt (int (*) _ANSI_ARGS_((void *, int, int, char *, int))) TclpCreatePipe +# define TclWinGetServByName (struct servent *(*) _ANSI_ARGS_((const char *nm, const char *proto))) TclpCreateCommandChannel +# define TclIntPlatReserved13 (void (*) ()) TclpInetNtoa # define TclWinAddProcess 0 # define TclWinNoBackslash 0 # define TclWinSetInterfaces 0 @@ -458,8 +477,8 @@ TclIntPlatStubs tclIntPlatStubs = { #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ TclWinConvertError, /* 0 */ TclWinConvertWSAError, /* 1 */ - TclpCreateCommandChannel, /* 2 */ - TclpCreatePipe, /* 3 */ + TclWinGetServByName, /* 2 */ + TclWinGetSockOpt, /* 3 */ TclWinGetTclInstance, /* 4 */ NULL, /* 5 */ TclWinNToHS, /* 6 */ @@ -469,7 +488,7 @@ TclIntPlatStubs tclIntPlatStubs = { TclpReaddir, /* 10 */ TclpLocaltime_unix, /* 11 */ TclpGmtime_unix, /* 12 */ - TclpInetNtoa, /* 13 */ + TclIntPlatReserved13, /* 13 */ NULL, /* 14 */ TclMacOSXGetFileAttribute, /* 15 */ NULL, /* 16 */ @@ -488,10 +507,10 @@ TclIntPlatStubs tclIntPlatStubs = { TclWinCPUID, /* 29 */ TclGetAndDetachPids, /* 30 */ TclpCloseFile, /* 31 */ - NULL, /* 32 */ - NULL, /* 33 */ + TclpCreateCommandChannel, /* 32 */ + TclpCreatePipe, /* 33 */ TclpCreateProcess, /* 34 */ - NULL, /* 35 */ + TclpInetNtoa, /* 35 */ TclpMakeFile, /* 36 */ TclpOpenFile, /* 37 */ TclUnixWaitForFile, /* 38 */ |