From 4823387a0b6e54dc2e2c9718e2b729224fb7260a Mon Sep 17 00:00:00 2001 From: nijtmans Date: Wed, 13 Jan 2010 06:46:56 +0000 Subject: Fix TCL_LL_MODIFIER for Cygwin and various other minor CYGWIN compilation problems --- ChangeLog | 17 +++++++++++++++++ generic/tcl.h | 4 ++-- generic/tclEnv.c | 12 +++++++++--- generic/tclInt.h | 5 ++--- generic/tclPlatDecls.h | 8 ++++---- unix/tclUnixChan.c | 6 +++--- win/cat.c | 8 ++++++-- win/tclWinConsole.c | 4 +--- win/tclWinFile.c | 6 +++--- win/tclWinPipe.c | 6 ++---- win/tclWinPort.h | 30 +++++++++++++++++------------- win/tclWinSerial.c | 18 ++++++++---------- win/tclWinThrd.c | 4 +--- 13 files changed, 75 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7fde17a..da37f80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2010-01-13 Jan Nijtmans + + * generic/tcl.h Fix TCL_LL_MODIFIER for Cygwin + * generic/tclEnv.c: Fix CYGWIN compilation problems, + * generic/tclInt.h and remove some unnecessary + * generic/tclPort.h double includes. + * generic/tclPlatDecls.h + * win/cat.c + * win/tclWinConsole.c + * win/tclWinFCmd.c + * win/tclWinFile.c + * win/tclWinPipe.c + * win/tclWinSerial.c + * win/tclWinThrd.c + * win/tclWinPort.h: Put win32 includes first + * unix/tclUnixChan.c Forgot one CONST change + 2010-01-12 Donal K. Fellows * tools/tcltk-man2html.tcl: Make the generation of the list of things diff --git a/generic/tcl.h b/generic/tcl.h index 75975bf..fb8a27b 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.295 2009/12/23 20:12:39 dkf Exp $ + * RCS: @(#) $Id: tcl.h,v 1.296 2010/01/13 06:46:56 nijtmans Exp $ */ #ifndef _TCL @@ -377,7 +377,7 @@ typedef long LONG; # if defined(__WIN32__) && !defined(__CYGWIN__) # define TCL_LL_MODIFIER "I64" # else -# define TCL_LL_MODIFIER "L" +# define TCL_LL_MODIFIER "ll" # endif typedef struct stat Tcl_StatBuf; # elif defined(__WIN32__) diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 40650de..f89ca41 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclEnv.c,v 1.40 2009/12/21 23:25:40 nijtmans Exp $ + * RCS: @(#) $Id: tclEnv.c,v 1.41 2010/01/13 06:46:56 nijtmans Exp $ */ #include "tclInt.h" @@ -695,8 +695,6 @@ TclFinalizeEnvironment(void) #if defined(__CYGWIN__) -#include - /* * When using cygwin, when an environment variable changes, we need to synch * with both the cygwin environment (in case the application C code calls @@ -757,11 +755,15 @@ TclCygwinPutenv( */ if (strcmp(name, "Path") == 0) { +#ifdef __WIN32__ SetEnvironmentVariable("PATH", NULL); +#endif unsetenv("PATH"); } +#ifdef __WIN32__ SetEnvironmentVariable(name, value); +#endif } else { char *buf; @@ -769,7 +771,9 @@ TclCygwinPutenv( * Eliminate any Path variable, to prevent any confusion. */ +#ifdef __WIN32__ SetEnvironmentVariable("Path", NULL); +#endif unsetenv("Path"); if (value == NULL) { @@ -782,7 +786,9 @@ TclCygwinPutenv( cygwin_posix_to_win32_path_list(value, buf); } +#ifdef __WIN32__ SetEnvironmentVariable(name, buf); +#endif } } #endif /* __CYGWIN__ */ diff --git a/generic/tclInt.h b/generic/tclInt.h index bf13446..36aa1ea 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.453 2009/12/11 04:47:13 msofer Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.454 2010/01/13 06:46:56 nijtmans Exp $ */ #ifndef _TCLINT @@ -40,6 +40,7 @@ #ifdef HAVE_TCL_CONFIG_H #include "tclConfig.h" #endif +#include "tclPort.h" #ifndef _TCL #include "tcl.h" #endif @@ -2927,7 +2928,6 @@ MODULE_SCOPE Tcl_Obj * TclPathPart(Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_PathPart portion); MODULE_SCOPE char * TclpReadlink(const char *fileName, Tcl_DString *linkPtr); -MODULE_SCOPE void TclpReleaseFile(TclFile file); MODULE_SCOPE void TclpSetInterfaces(void); MODULE_SCOPE void TclpSetVariables(Tcl_Interp *interp); MODULE_SCOPE void TclpUnloadFile(Tcl_LoadHandle loadHandle); @@ -4437,7 +4437,6 @@ typedef struct TEOV_callback { #define NRE_ASSERT(expr) #endif -#include "tclPort.h" #include "tclIntDecls.h" #include "tclIntPlatDecls.h" #include "tclTomMathDecls.h" diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h index 44358c2..bcd8fc3 100644 --- a/generic/tclPlatDecls.h +++ b/generic/tclPlatDecls.h @@ -6,7 +6,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclPlatDecls.h,v 1.34 2009/12/21 23:25:40 nijtmans Exp $ + * RCS: @(#) $Id: tclPlatDecls.h,v 1.35 2010/01/13 06:46:56 nijtmans Exp $ */ #ifndef _TCLPLATDECLS @@ -26,7 +26,9 @@ /* * Pull in the typedef of TCHAR for windows. */ -#if defined(__WIN32__) && !defined(_TCHAR_DEFINED) +#if defined(__CYGWIN__) + typedef char TCHAR; +#elif defined(__WIN32__) && !defined(_TCHAR_DEFINED) # include # ifndef _TCHAR_DEFINED /* Borland seems to forget to set this. */ @@ -37,8 +39,6 @@ /* MSVC++ misses this. */ typedef _TCHAR TCHAR; # endif -#elif defined(__CYGWIN__) - typedef char TCHAR; #endif /* !BEGIN!: Do not edit below this line. */ diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 209c51a..9b6cc95 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixChan.c,v 1.104 2010/01/10 22:58:41 nijtmans Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.105 2010/01/13 06:46:57 nijtmans Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -1538,7 +1538,7 @@ TclpOpenFileChannel( FileState *fsPtr; const char *native, *translation; char channelName[16 + TCL_INTEGER_SPACE]; - Tcl_ChannelType *channelTypePtr; + const Tcl_ChannelType *channelTypePtr; switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) { case O_RDONLY: @@ -1664,7 +1664,7 @@ Tcl_MakeFileChannel( FileState *fsPtr; char channelName[16 + TCL_INTEGER_SPACE]; int fd = PTR2INT(handle); - Tcl_ChannelType *channelTypePtr; + const Tcl_ChannelType *channelTypePtr; struct sockaddr sockaddr; socklen_t sockaddrLen = sizeof(sockaddr); diff --git a/win/cat.c b/win/cat.c index d1a7338..c91e0d2 100644 --- a/win/cat.c +++ b/win/cat.c @@ -8,11 +8,15 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: cat.c,v 1.4 2008/10/16 22:34:19 nijtmans Exp $ + * RCS: @(#) $Id: cat.c,v 1.5 2010/01/13 06:46:56 nijtmans Exp $ */ #include -#include +#ifdef __CYGWIN__ +# include +#else +# include +#endif #include int diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 16ea391..a47165c 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -9,13 +9,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinConsole.c,v 1.22 2010/01/10 22:58:39 nijtmans Exp $ + * RCS: @(#) $Id: tclWinConsole.c,v 1.23 2010/01/13 06:46:56 nijtmans Exp $ */ #include "tclWinInt.h" -#include -#include #include /* diff --git a/win/tclWinFile.c b/win/tclWinFile.c index c9d6e28..f18ca7e 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.101 2009/12/21 23:25:40 nijtmans Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.102 2010/01/13 06:46:56 nijtmans Exp $ */ /* #define _WIN32_WINNT 0x0500 */ @@ -226,7 +226,7 @@ WinLink( { WCHAR tempFileName[MAX_PATH]; TCHAR *tempFilePart; - int attr; + DWORD attr; /* * Get the full path referenced by the target. @@ -347,7 +347,7 @@ WinReadLink( { WCHAR tempFileName[MAX_PATH]; TCHAR *tempFilePart; - int attr; + DWORD attr; /* * Get the full path referenced by the target. diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 2b00ccf..8357637 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -9,13 +9,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPipe.c,v 1.72 2010/01/10 22:58:40 nijtmans Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.73 2010/01/13 06:46:56 nijtmans Exp $ */ #include "tclWinInt.h" -#include -#include #include /* @@ -2740,7 +2738,7 @@ Tcl_PidObjCmd( return TCL_ERROR; } if (objc == 1) { - wsprintfA(buf, "%lu", (unsigned long) _getpid()); + wsprintfA(buf, "%lu", (unsigned long) getpid()); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); } else { chan = Tcl_GetChannel(interp, Tcl_GetStringFromObj(objv[1], NULL), diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 01e5432..c7e343f 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -10,12 +10,22 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPort.h,v 1.52 2009/12/21 23:25:41 nijtmans Exp $ + * RCS: @(#) $Id: tclWinPort.h,v 1.53 2010/01/13 06:46:56 nijtmans Exp $ */ #ifndef _TCLWINPORT #define _TCLWINPORT +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN + +/* + * Ask for the winsock function typedefs, also. + */ +#define INCL_WINSOCK_API_TYPEDEFS 1 +#include + #ifdef CHECK_UNICODE_CALLS # define _UNICODE # define UNICODE @@ -32,13 +42,17 @@ *--------------------------------------------------------------------------- */ +#ifdef __CYGWIN__ +# include +# include +#else +# include +#endif #include #include - #include #include #include -#include #include #include #include @@ -71,16 +85,6 @@ #include -#define WIN32_LEAN_AND_MEAN -#include -#undef WIN32_LEAN_AND_MEAN - -/* - * Ask for the winsock function typedefs, also. - */ -#define INCL_WINSOCK_API_TYPEDEFS 1 -#include - /* * Define EINPROGRESS in terms of WSAEINPROGRESS. */ diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index ecefc2e..c3144e3 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -11,13 +11,11 @@ * * Serial functionality implemented by Rolf.Schroedter@dlr.de * - * RCS: @(#) $Id: tclWinSerial.c,v 1.40 2010/01/10 22:58:40 nijtmans Exp $ + * RCS: @(#) $Id: tclWinSerial.c,v 1.41 2010/01/13 06:46:56 nijtmans Exp $ */ #include "tclWinInt.h" -#include -#include #include /* @@ -1744,16 +1742,16 @@ SerialSetOptionProc( dcb.XonLim = (WORD) (infoPtr->sysBufRead*1/2); dcb.XoffLim = (WORD) (infoPtr->sysBufRead*1/4); - if (strnicmp(value, "NONE", vlen) == 0) { + if (strncasecmp(value, "NONE", vlen) == 0) { /* * Leave all handshake options disabled. */ - } else if (strnicmp(value, "XONXOFF", vlen) == 0) { + } else if (strncasecmp(value, "XONXOFF", vlen) == 0) { dcb.fOutX = dcb.fInX = TRUE; - } else if (strnicmp(value, "RTSCTS", vlen) == 0) { + } else if (strncasecmp(value, "RTSCTS", vlen) == 0) { dcb.fOutxCtsFlow = TRUE; dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; - } else if (strnicmp(value, "DTRDSR", vlen) == 0) { + } else if (strncasecmp(value, "DTRDSR", vlen) == 0) { dcb.fOutxDsrFlow = TRUE; dcb.fDtrControl = DTR_CONTROL_HANDSHAKE; } else { @@ -1863,7 +1861,7 @@ SerialSetOptionProc( result = TCL_ERROR; break; } - if (strnicmp(argv[i], "DTR", strlen(argv[i])) == 0) { + if (strncasecmp(argv[i], "DTR", strlen(argv[i])) == 0) { if (!EscapeCommFunction(infoPtr->handle, (DWORD) (flag ? SETDTR : CLRDTR))) { if (interp != NULL) { @@ -1872,7 +1870,7 @@ SerialSetOptionProc( result = TCL_ERROR; break; } - } else if (strnicmp(argv[i], "RTS", strlen(argv[i])) == 0) { + } else if (strncasecmp(argv[i], "RTS", strlen(argv[i])) == 0) { if (!EscapeCommFunction(infoPtr->handle, (DWORD) (flag ? SETRTS : CLRRTS))) { if (interp != NULL) { @@ -1881,7 +1879,7 @@ SerialSetOptionProc( result = TCL_ERROR; break; } - } else if (strnicmp(argv[i], "BREAK", strlen(argv[i])) == 0) { + } else if (strncasecmp(argv[i], "BREAK", strlen(argv[i])) == 0) { if (!EscapeCommFunction(infoPtr->handle, (DWORD) (flag ? SETBREAK : CLRBREAK))) { if (interp != NULL) { diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 2d483ae..67e7350 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -10,13 +10,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinThrd.c,v 1.51 2010/01/10 22:58:40 nijtmans Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.52 2010/01/13 06:46:56 nijtmans Exp $ */ #include "tclWinInt.h" -#include -#include #include /* -- cgit v0.12