diff options
author | nijtmans <nijtmans> | 2009-12-21 23:25:39 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2009-12-21 23:25:39 (GMT) |
commit | f7e02c57c848c495a77975b927a0f4076bf4822c (patch) | |
tree | 86d9a8cc06d969564b99b6d5ed25975042f9300a /generic | |
parent | e3f5e21f00d98dacf701c346899ada0ef3327513 (diff) | |
download | tcl-f7e02c57c848c495a77975b927a0f4076bf4822c.zip tcl-f7e02c57c848c495a77975b927a0f4076bf4822c.tar.gz tcl-f7e02c57c848c495a77975b927a0f4076bf4822c.tar.bz2 |
Various CYGWIN-related fixes. In the win32 configure script, CYGWIN is still not enabled yet, but at least it is a step in the right direction.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/rege_dfa.c | 22 | ||||
-rw-r--r-- | generic/tcl.h | 8 | ||||
-rw-r--r-- | generic/tclEnv.c | 19 | ||||
-rw-r--r-- | generic/tclFileName.c | 19 | ||||
-rw-r--r-- | generic/tclOOInt.h | 3 | ||||
-rw-r--r-- | generic/tclPathObj.c | 18 | ||||
-rw-r--r-- | generic/tclPlatDecls.h | 8 | ||||
-rw-r--r-- | generic/tclPort.h | 12 | ||||
-rw-r--r-- | generic/tclThreadStorage.c | 4 |
9 files changed, 78 insertions, 35 deletions
diff --git a/generic/rege_dfa.c b/generic/rege_dfa.c index fbeae20..e233680 100644 --- a/generic/rege_dfa.c +++ b/generic/rege_dfa.c @@ -318,32 +318,32 @@ newdfa( struct vars *v, struct cnfa *cnfa, struct colormap *cm, - struct smalldfa *small) /* preallocated space, may be NULL */ + struct smalldfa *sml) /* preallocated space, may be NULL */ { struct dfa *d; size_t nss = cnfa->nstates * 2; int wordsper = (cnfa->nstates + UBITS - 1) / UBITS; - struct smalldfa *smallwas = small; + struct smalldfa *smallwas = sml; assert(cnfa != NULL && cnfa->nstates != 0); if (nss <= FEWSTATES && cnfa->ncolors <= FEWCOLORS) { assert(wordsper == 1); - if (small == NULL) { - small = (struct smalldfa *) MALLOC(sizeof(struct smalldfa)); - if (small == NULL) { + if (sml == NULL) { + sml = (struct smalldfa *) MALLOC(sizeof(struct smalldfa)); + if (sml == NULL) { ERR(REG_ESPACE); return NULL; } } - d = &small->dfa; - d->ssets = small->ssets; - d->statesarea = small->statesarea; + d = &sml->dfa; + d->ssets = sml->ssets; + d->statesarea = sml->statesarea; d->work = &d->statesarea[nss]; - d->outsarea = small->outsarea; - d->incarea = small->incarea; + d->outsarea = sml->outsarea; + d->incarea = sml->incarea; d->cptsmalloced = 0; - d->mallocarea = (smallwas == NULL) ? (char *)small : NULL; + d->mallocarea = (smallwas == NULL) ? (char *)sml : NULL; } else { d = (struct dfa *)MALLOC(sizeof(struct dfa)); if (d == NULL) { diff --git a/generic/tcl.h b/generic/tcl.h index a13b897..fb4cbdc 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -14,7 +14,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.293 2009/11/30 23:10:38 nijtmans Exp $ + * RCS: @(#) $Id: tcl.h,v 1.294 2009/12/21 23:25:39 nijtmans Exp $ */ #ifndef _TCL @@ -129,6 +129,12 @@ extern "C" { #define TCL_DECLARE_MUTEX(name) #endif +#if defined(__CYGWIN__) && defined(__WIN32__) +/* Cygwin/win32 needs winsock2.h to be included BEFORE stdio.h, + * otherwise there will be symbol conflicts with sys/types.h! */ +# include <winsock2.h> +#endif + /* * Tcl's public routine Tcl_FSSeek() uses the values SEEK_SET, SEEK_CUR, and * SEEK_END, all #define'd by stdio.h . diff --git a/generic/tclEnv.c b/generic/tclEnv.c index ac47ee9..40650de 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.39 2009/01/04 22:55:12 ferrieux Exp $ + * RCS: @(#) $Id: tclEnv.c,v 1.40 2009/12/21 23:25:40 nijtmans Exp $ */ #include "tclInt.h" @@ -45,8 +45,13 @@ static char * EnvTraceProc(ClientData clientData, Tcl_Interp *interp, static void ReplaceString(const char *oldStr, char *newStr); MODULE_SCOPE void TclSetEnv(const char *name, const char *value); MODULE_SCOPE void TclUnsetEnv(const char *name); -#if defined(__CYGWIN__) && defined(__WIN32__) -static void TclCygwinPutenv(const char *string); + +#if defined(__CYGWIN__) +/* On Cygwin, the environment is imported from the Cygwin DLL. */ + DLLIMPORT extern int cygwin_posix_to_win32_path_list_buf_size(char *value); + DLLIMPORT extern void cygwin_posix_to_win32_path_list(char *buf, char *value); +# define putenv TclCygwinPutenv +static void TclCygwinPutenv(char *string); #endif /* @@ -394,7 +399,7 @@ TclUnsetEnv( * that no = should be included, and Windows requires it. */ -#ifdef WIN32 +#if defined(__WIN32__) || defined(__CYGWIN__) string = ckalloc((unsigned) length+2); memcpy(string, name, (size_t) length); string[length] = '='; @@ -688,7 +693,7 @@ TclFinalizeEnvironment(void) } } -#if defined(__CYGWIN__) && defined(__WIN32__) +#if defined(__CYGWIN__) #include <windows.h> @@ -701,7 +706,7 @@ TclFinalizeEnvironment(void) static void TclCygwinPutenv( - const char *str) + char *str) { char *name, *value; @@ -780,7 +785,7 @@ TclCygwinPutenv( SetEnvironmentVariable(name, buf); } } -#endif /* __CYGWIN__ && __WIN32__ */ +#endif /* __CYGWIN__ */ /* * Local Variables: diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 1070c42..664ba94 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.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: tclFileName.c,v 1.98 2009/08/21 19:06:06 dgp Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.99 2009/12/21 23:25:40 nijtmans Exp $ */ #include "tclInt.h" @@ -1331,8 +1331,8 @@ Tcl_GlobObjCmd( if (dir == PATH_GENERAL) { int pathlength; - char *last; - char *first = Tcl_GetStringFromObj(pathOrDir,&pathlength); + const char *last; + const char *first = Tcl_GetStringFromObj(pathOrDir,&pathlength); /* * Find the last path separator in the path @@ -1433,7 +1433,7 @@ Tcl_GlobObjCmd( while (--length >= 0) { int len; - char *str; + const char *str; Tcl_ListObjIndex(interp, typePtr, length, &look); str = Tcl_GetStringFromObj(look, &len); @@ -2445,7 +2445,6 @@ DoGlob( #if defined(__CYGWIN__) && defined(__WIN32__) { - extern int cygwin_conv_to_win32_path(const char *, char *); char winbuf[MAX_PATH+1]; cygwin_conv_to_win32_path(Tcl_DStringValue(&append), winbuf); @@ -2463,6 +2462,16 @@ DoGlob( Tcl_DStringAppend(&append, ".", 1); } } +#if defined(__CYGWIN__) && !defined(__WIN32__) + DLLIMPORT extern int cygwin_conv_to_posix_path(const char *, char *); + { + char winbuf[MAXPATHLEN+1]; + + cygwin_conv_to_posix_path(Tcl_DStringValue(&append), winbuf); + Tcl_DStringFree(&append); + Tcl_DStringAppend(&append, winbuf, -1); + } +#endif /* __CYGWIN__ && __WIN32__ */ break; } diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index 17db3f1..86bc9d3 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclOOInt.h,v 1.12 2009/07/12 14:51:30 dkf Exp $ + * RCS: @(#) $Id: tclOOInt.h,v 1.13 2009/12/21 23:25:39 nijtmans Exp $ */ #ifndef TCL_OO_INTERNAL_H @@ -589,6 +589,7 @@ MODULE_SCOPE int TclOOUpcatchCmd(ClientData ignored, * but all arguments are used multiple times and so must have no side effects. */ +#undef DUPLICATE /* prevent possible conflict with definition in WINAPI nb30.h */ #define DUPLICATE(target,source,type) \ do { \ register unsigned len = sizeof(type) * ((target).num=(source).num);\ diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 6d36fe4..610c05e 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.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: tclPathObj.c,v 1.84 2009/10/27 20:31:08 dgp Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.85 2009/12/21 23:25:39 nijtmans Exp $ */ #include "tclInt.h" @@ -2369,7 +2369,10 @@ SetFsPathFromAny( FsPath *fsPathPtr; Tcl_Obj *transPtr; char *name; - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey); +#if defined(__CYGWIN__) && defined(__WIN32__) + int copied = 0; +#endif + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey); if (pathPtr->typePtr == &tclFsPathType) { return TCL_OK; @@ -2514,7 +2517,6 @@ SetFsPathFromAny( #if defined(__CYGWIN__) && defined(__WIN32__) { - extern int cygwin_conv_to_win32_path(const char *, char *); char winbuf[MAX_PATH+1]; /* @@ -2527,6 +2529,11 @@ SetFsPathFromAny( if (len > 0) { cygwin_conv_to_win32_path(name, winbuf); TclWinNoBackslash(winbuf); + if (Tcl_IsShared(transPtr)) { + copied = 1; + transPtr = Tcl_DuplicateObj(transPtr); + Tcl_IncrRefCount(transPtr); + } Tcl_SetStringObj(transPtr, winbuf, -1); } } @@ -2557,6 +2564,11 @@ SetFsPathFromAny( SETPATHOBJ(pathPtr, fsPathPtr); PATHFLAGS(pathPtr) = 0; pathPtr->typePtr = &tclFsPathType; +#if defined(__CYGWIN__) && defined(__WIN32__) + if (copied) { + Tcl_DecrRefCount(transPtr); + } +#endif return TCL_OK; } diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h index a868584..44358c2 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.33 2008/10/22 20:23:59 nijtmans Exp $ + * RCS: @(#) $Id: tclPlatDecls.h,v 1.34 2009/12/21 23:25:40 nijtmans Exp $ */ #ifndef _TCLPLATDECLS @@ -26,9 +26,7 @@ /* * Pull in the typedef of TCHAR for windows. */ -#if defined(__CYGWIN__) - typedef char TCHAR; -#elif defined(__WIN32__) && !defined(_TCHAR_DEFINED) +#if defined(__WIN32__) && !defined(_TCHAR_DEFINED) # include <tchar.h> # ifndef _TCHAR_DEFINED /* Borland seems to forget to set this. */ @@ -39,6 +37,8 @@ /* MSVC++ misses this. */ typedef _TCHAR TCHAR; # endif +#elif defined(__CYGWIN__) + typedef char TCHAR; #endif /* !BEGIN!: Do not edit below this line. */ diff --git a/generic/tclPort.h b/generic/tclPort.h index d145468..0b4eda9 100644 --- a/generic/tclPort.h +++ b/generic/tclPort.h @@ -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: tclPort.h,v 1.16 2008/11/04 23:57:41 hobbs Exp $ + * RCS: @(#) $Id: tclPort.h,v 1.17 2009/12/21 23:25:39 nijtmans Exp $ */ #ifndef _TCLPORT @@ -27,6 +27,16 @@ # include "tclUnixPort.h" #endif +#if defined(__CYGWIN__) +# define USE_PUTENV 1 +# define USE_PUTENV_FOR_UNSET 1 +/* On Cygwin, the environment is imported from the Cygwin DLL. */ + DLLIMPORT extern char **__cygwin_environ; + DLLIMPORT extern int cygwin_conv_to_win32_path(const char *, char *); +# define environ __cygwin_environ +# define timezone _timezone +#endif + #if !defined(LLONG_MIN) # ifdef TCL_WIDE_INT_IS_LONG # define LLONG_MIN LONG_MIN diff --git a/generic/tclThreadStorage.c b/generic/tclThreadStorage.c index 1a0a89d..ea2eeb1 100644 --- a/generic/tclThreadStorage.c +++ b/generic/tclThreadStorage.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: tclThreadStorage.c,v 1.20 2009/03/16 00:43:09 mistachkin Exp $ + * RCS: @(#) $Id: tclThreadStorage.c,v 1.21 2009/12/21 23:25:40 nijtmans Exp $ */ #include "tclInt.h" @@ -43,7 +43,7 @@ static struct TSDMaster { * increasing value. */ Tcl_Mutex mutex; /* Protection for the rest of this structure, * which holds per-process data. */ -} tsdMaster = { NULL, 0 }; +} tsdMaster = { NULL, 0, NULL }; /* * The type of the data held per thread in a system TSD. |