From f620a59f25eb5dcfba070eeff799fc947e81da02 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 23 Mar 2012 15:26:25 +0000 Subject: Revert some cygwin-related signature changes from [835f8e1e9d] (2010-02-01) They were an attempt to make the cygwin port compile again, but since cygwin is based on unix this serves no purpose any more. Add tclWinError.c to the CYGWIN build. --- ChangeLog | 10 ++++++++++ generic/tclInt.decls | 14 +++++++------- generic/tclIntPlatDecls.h | 20 ++++++++++---------- unix/Makefile.in | 4 ++++ unix/configure | 2 +- unix/tcl.m4 | 2 +- win/tclWinError.c | 41 +++++++++++++++++++++++++++++------------ 7 files changed, 62 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a4b653..55df617 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2012-03-20 Jan Nijtmans + * generic/tclInt.decls Revert some cygwin-related signature changes from + * generic/tclIntPlatDecls.h [835f8e1e9d] (2010-02-01). They were an attempt to + * win/tclWinError.c make the cygwin port compile again, but since cygwin + is based on unix this serves no purpose any more. + * unix/Makefile.in Add tclWinError.c to the CYGWIN build. + * unix/tcl.m4 + * unix/configure + +2012-03-20 Jan Nijtmans + * generic/tcl.decls: [Bug 3508771] load tclreg.dll in cygwin tclsh * generic/tclInt.decls: Implement TclWinGetPlatformId, Tcl_WinUtfToTChar, * generic/tclIntPlatDecls.h: Tcl_WinTCharToUtf (and a dummy TclWinCPUID) for diff --git a/generic/tclInt.decls b/generic/tclInt.decls index d06faf2..eb9da09 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -683,12 +683,12 @@ declare 169 generic { } declare 170 generic { int TclCheckInterpTraces(Tcl_Interp *interp, CONST char *command, - int numChars, Command *cmdPtr, int result, int traceFlags, + int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *CONST objv[]) } declare 171 generic { int TclCheckExecutionTraces(Tcl_Interp *interp, CONST char *command, - int numChars, Command *cmdPtr, int result, int traceFlags, + int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *CONST objv[]) } declare 172 generic { @@ -955,17 +955,17 @@ interface tclIntPlat # Windows specific functions declare 0 win { - void TclWinConvertError(unsigned long errCode) + void TclWinConvertError(DWORD errCode) } declare 1 win { - void TclWinConvertWSAError(unsigned long errCode) + void TclWinConvertWSAError(DWORD errCode) } declare 2 win { struct servent *TclWinGetServByName(CONST char *nm, CONST char *proto) } declare 3 win { - int TclWinGetSockOpt(int s, int level, int optname, + int TclWinGetSockOpt(SOCKET s, int level, int optname, char FAR *optval, int FAR *optlen) } declare 4 win { @@ -979,7 +979,7 @@ declare 6 win { u_short TclWinNToHS(u_short ns) } declare 7 win { - int TclWinSetSockOpt(int s, int level, int optname, + int TclWinSetSockOpt(SOCKET s, int level, int optname, CONST char FAR *optval, int optlen) } declare 8 win { @@ -1027,7 +1027,7 @@ declare 19 win { TclFile TclpOpenFile(CONST char *fname, int mode) } declare 20 win { - void TclWinAddProcess(void *hProcess, unsigned long id) + void TclWinAddProcess(HANDLE hProcess, DWORD id) } # removed permanently for 8.4 diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 37b6379..4c7c8bb 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -144,12 +144,12 @@ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs); #ifndef TclWinConvertError_TCL_DECLARED #define TclWinConvertError_TCL_DECLARED /* 0 */ -EXTERN void TclWinConvertError(unsigned long errCode); +EXTERN void TclWinConvertError(DWORD errCode); #endif #ifndef TclWinConvertWSAError_TCL_DECLARED #define TclWinConvertWSAError_TCL_DECLARED /* 1 */ -EXTERN void TclWinConvertWSAError(unsigned long errCode); +EXTERN void TclWinConvertWSAError(DWORD errCode); #endif #ifndef TclWinGetServByName_TCL_DECLARED #define TclWinGetServByName_TCL_DECLARED @@ -160,7 +160,7 @@ EXTERN struct servent * TclWinGetServByName(CONST char *nm, #ifndef TclWinGetSockOpt_TCL_DECLARED #define TclWinGetSockOpt_TCL_DECLARED /* 3 */ -EXTERN int TclWinGetSockOpt(int s, int level, int optname, +EXTERN int TclWinGetSockOpt(SOCKET s, int level, int optname, char FAR *optval, int FAR *optlen); #endif #ifndef TclWinGetTclInstance_TCL_DECLARED @@ -177,7 +177,7 @@ EXTERN u_short TclWinNToHS(u_short ns); #ifndef TclWinSetSockOpt_TCL_DECLARED #define TclWinSetSockOpt_TCL_DECLARED /* 7 */ -EXTERN int TclWinSetSockOpt(int s, int level, int optname, +EXTERN int TclWinSetSockOpt(SOCKET s, int level, int optname, CONST char FAR *optval, int optlen); #endif #ifndef TclpGetPid_TCL_DECLARED @@ -237,7 +237,7 @@ EXTERN TclFile TclpOpenFile(CONST char *fname, int mode); #ifndef TclWinAddProcess_TCL_DECLARED #define TclWinAddProcess_TCL_DECLARED /* 20 */ -EXTERN void TclWinAddProcess(VOID *hProcess, unsigned long id); +EXTERN void TclWinAddProcess(HANDLE hProcess, DWORD id); #endif /* Slot 21 is reserved */ #ifndef TclpCreateTempFile_TCL_DECLARED @@ -449,14 +449,14 @@ typedef struct TclIntPlatStubs { int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */ #endif /* UNIX */ #ifdef __WIN32__ /* WIN */ - void (*tclWinConvertError) (unsigned long errCode); /* 0 */ - void (*tclWinConvertWSAError) (unsigned long errCode); /* 1 */ + void (*tclWinConvertError) (DWORD errCode); /* 0 */ + void (*tclWinConvertWSAError) (DWORD errCode); /* 1 */ struct servent * (*tclWinGetServByName) (CONST char *nm, CONST char *proto); /* 2 */ - int (*tclWinGetSockOpt) (int s, int level, int optname, char FAR *optval, int FAR *optlen); /* 3 */ + int (*tclWinGetSockOpt) (SOCKET s, int level, int optname, char FAR *optval, int FAR *optlen); /* 3 */ HINSTANCE (*tclWinGetTclInstance) (void); /* 4 */ VOID *reserved5; u_short (*tclWinNToHS) (u_short ns); /* 6 */ - int (*tclWinSetSockOpt) (int s, int level, int optname, CONST char FAR *optval, int optlen); /* 7 */ + int (*tclWinSetSockOpt) (SOCKET s, int level, int optname, CONST char FAR *optval, int optlen); /* 7 */ unsigned long (*tclpGetPid) (Tcl_Pid pid); /* 8 */ int (*tclWinGetPlatformId) (void); /* 9 */ VOID *reserved10; @@ -469,7 +469,7 @@ typedef struct TclIntPlatStubs { VOID *reserved17; TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 18 */ TclFile (*tclpOpenFile) (CONST char *fname, int mode); /* 19 */ - void (*tclWinAddProcess) (VOID *hProcess, unsigned long id); /* 20 */ + void (*tclWinAddProcess) (HANDLE hProcess, DWORD id); /* 20 */ VOID *reserved21; TclFile (*tclpCreateTempFile) (CONST char *contents); /* 22 */ char * (*tclpGetTZName) (int isdst); /* 23 */ diff --git a/unix/Makefile.in b/unix/Makefile.in index 382a41b..c88736c 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1441,6 +1441,10 @@ tclMacOSXFCmd.o: $(MAC_OSX_DIR)/tclMacOSXFCmd.c tclMacOSXNotify.o: $(MAC_OSX_DIR)/tclMacOSXNotify.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tclMacOSXNotify.c +# The following is a CYGWIN only source: +tclWinError.o: $(TOP_DIR)/win/tclWinError.c + $(CC) -c $(CC_SWITCHES) $(TOP_DIR)/win/tclWinError.c + # DTrace support $(TCL_OBJS) $(STUB_LIB_OBJS) $(TCLSH_OBJS) $(TCLTEST_OBJS) $(XTTEST_OBJS): @DTRACE_HDR@ diff --git a/unix/configure b/unix/configure index 43c2d1c..66ef3b6 100755 --- a/unix/configure +++ b/unix/configure @@ -6931,7 +6931,7 @@ fi SHLIB_CFLAGS="" SHLIB_LD='${CC} -shared' SHLIB_SUFFIX=".dll" - DL_OBJS="tclLoadDl.o" + DL_OBJS="tclLoadDl.o tclWinError.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 37c7c74..fe9b136 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1241,7 +1241,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ SHLIB_CFLAGS="" SHLIB_LD='${CC} -shared' SHLIB_SUFFIX=".dll" - DL_OBJS="tclLoadDl.o" + DL_OBJS="tclLoadDl.o tclWinError.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" diff --git a/win/tclWinError.c b/win/tclWinError.c index ca1b0e8..b49271e 100644 --- a/win/tclWinError.c +++ b/win/tclWinError.c @@ -11,12 +11,21 @@ */ #include "tclInt.h" +#include "tclPort.h" + +#ifndef WSAEWOULDBLOCK +# define WSAEWOULDBLOCK 10035L +#endif + +#ifndef __WIN32__ +# define DWORD unsigned int +#endif /* * The following table contains the mapping from Win32 errors to errno errors. */ -static char errorTable[] = { +static CONST unsigned char errorTable[] = { 0, EINVAL, /* ERROR_INVALID_FUNCTION 1 */ ENOENT, /* ERROR_FILE_NOT_FOUND 2 */ @@ -284,17 +293,15 @@ static char errorTable[] = { EINVAL, /* 264 */ EINVAL, /* 265 */ EINVAL, /* 266 */ - ENOTDIR, /* ERROR_DIRECTORY 267 */ + ENOTDIR /* ERROR_DIRECTORY 267 */ }; -static const unsigned int tableLen = sizeof(errorTable); - /* * The following table contains the mapping from WinSock errors to * errno errors. */ -static int wsaErrorTable[] = { +static CONST int wsaErrorTable[] = { EWOULDBLOCK, /* WSAEWOULDBLOCK */ EINPROGRESS, /* WSAEINPROGRESS */ EALREADY, /* WSAEALREADY */ @@ -331,7 +338,7 @@ static int wsaErrorTable[] = { EUSERS, /* WSAEUSERS */ EDQUOT, /* WSAEDQUOT */ ESTALE, /* WSAESTALE */ - EREMOTE, /* WSAEREMOTE */ + EREMOTE /* WSAEREMOTE */ }; /* @@ -352,9 +359,9 @@ static int wsaErrorTable[] = { void TclWinConvertError( - unsigned long errCode) /* Win32 error code. */ + DWORD errCode) /* Win32 error code. */ { - if (errCode >= tableLen) { + if (errCode >= sizeof(errorTable)/sizeof(errorTable[0])) { Tcl_SetErrno(EINVAL); } else { Tcl_SetErrno(errorTable[errCode]); @@ -379,11 +386,21 @@ TclWinConvertError( void TclWinConvertWSAError( - unsigned long errCode) /* Win32 error code. */ + DWORD errCode) /* Win32 error code. */ { - if ((errCode >= WSAEWOULDBLOCK) && (errCode <= WSAEREMOTE)) { - Tcl_SetErrno(wsaErrorTable[errCode - WSAEWOULDBLOCK]); - } else { + errCode -= WSAEWOULDBLOCK; + if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) { Tcl_SetErrno(EINVAL); + } else { + Tcl_SetErrno(wsaErrorTable[errCode]); } } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * tab-width: 8 + * End: + */ -- cgit v0.12