diff options
-rw-r--r-- | ChangeLog | 51 | ||||
-rw-r--r-- | compat/strftime.c | 6 | ||||
-rw-r--r-- | doc/tclvars.n | 4 | ||||
-rw-r--r-- | generic/tcl.h | 5 | ||||
-rw-r--r-- | generic/tclCmdAH.c | 13 | ||||
-rw-r--r-- | generic/tclDate.c | 4 | ||||
-rw-r--r-- | generic/tclGetDate.y | 4 | ||||
-rw-r--r-- | generic/tclInt.decls | 5 | ||||
-rw-r--r-- | generic/tclIntPlatDecls.h | 10 | ||||
-rw-r--r-- | generic/tclStubInit.c | 4 | ||||
-rw-r--r-- | mac/tclMacAppInit.c | 3 | ||||
-rw-r--r-- | mac/tclMacApplication.r | 46 | ||||
-rw-r--r-- | mac/tclMacFile.c | 87 | ||||
-rw-r--r-- | mac/tclMacInt.h | 5 | ||||
-rw-r--r-- | mac/tclMacLibrary.r | 22 | ||||
-rw-r--r-- | mac/tclMacOSA.r | 6 | ||||
-rw-r--r-- | mac/tclMacPort.h | 29 | ||||
-rw-r--r-- | mac/tclMacResource.r | 40 | ||||
-rw-r--r-- | mac/tclMacTime.c | 229 | ||||
-rw-r--r-- | tests/cmdAH.test | 4 | ||||
-rw-r--r-- | tests/cmdMZ.test | 4 | ||||
-rw-r--r-- | tests/exec.test | 6 | ||||
-rw-r--r-- | tests/fileName.test | 83 |
23 files changed, 474 insertions, 196 deletions
@@ -1,3 +1,54 @@ +2001-10-17 Daniel Steffen <das@users.sourceforge.net> + + Backport of mac specific changes added to 8.4 since 8.3.3: + + * generic/tcl.h: removed line continuation in #if clause as this + breaks the mac resource compiler (note that *.r files include tcl.h) + + * compat/strftime.c: + * mac/tclMacTime.c: + * mac/tclMacPort.h: + * generic/tclInt.decls: + * generic/tclIntPlatDecls.h: + * generic/tclStubInit.c: timezone support for mac via + TclpGetTZName() like on windows, using an inverse timezone table + adapted from tclDate.c to map gmtoffset in seconds gotten from + the MacOS APIs to a timezone string, as there is no good way to get + this info from MacOS. I had to make up some unusual timezones and + arbitrarily decide on the most standard of the multiple choices + + * generic/tclCmdAH.c: + * generic/tclDate.c: + * generic/tclGetDate.y: + * mac/tclMacInt.h: + * mac/tclMacFile.c: default mac epoch changed to standard unix + epoch and related mac time/date handling changes from TIP17. + + * mac/tclMacFile.c: glob -dir compatibility for unix style + relative paths, from TIP17 + + * mac/tclMacAppInit.c: support for WASTE text library using + temporary memory, setting has no effect if WASTE is not used. + + * tests/cmdAH.test: access time not available on the mac, skip the + atime touch test + + * mac/tclMacApplication.r: + * mac/tclMacLibrary.r: + * mac/tclMacOSA.r: + * mac/tclMacResource.r: updated copyrights/dates in version + strings; reorganized resources among these files to avoid + multiple copies in applications and shared libraries, the script + libraries are now no longer duplicated in Tclsh but are only + included in the resources of Tcl.shlb. + + * tests/cmdMZ.test: + * tests/exec.test: + * tests/fileName.test: added missing cleanups/tests/catches that + caused tests to fail on the mac. + + * doc/tclvars.n: documentation error, env(PWD) should be env(HOME) + 2001-10-17 Jeff Hobbs <jeffh@ActiveState.com> * unix/tclUnixFCmd.c: minor casts to prevent warnings diff --git a/compat/strftime.c b/compat/strftime.c index 2203536..075229a 100644 --- a/compat/strftime.c +++ b/compat/strftime.c @@ -8,7 +8,7 @@ * source. See the copyright notice below for details on redistribution * restrictions. The "license.terms" file does not apply to this file. * - * RCS: @(#) $Id: strftime.c,v 1.7 2000/01/15 01:50:43 hobbs Exp $ + * RCS: @(#) $Id: strftime.c,v 1.7.2.1 2001/10/17 19:29:24 das Exp $ */ /* @@ -45,7 +45,7 @@ */ #if defined(LIBC_SCCS) -static char *rcsid = "$Id: strftime.c,v 1.7 2000/01/15 01:50:43 hobbs Exp $"; +static char *rcsid = "$Id: strftime.c,v 1.7.2.1 2001/10/17 19:29:24 das Exp $"; #endif /* LIBC_SCCS */ #include <time.h> @@ -324,7 +324,6 @@ _fmt(format, t) if (!_conv((t->tm_year + TM_YEAR_BASE), 4, '0')) return(0); continue; -#ifndef MAC_TCL case 'Z': { char *name = TclpGetTZName(t->tm_isdst); if (name && !_add(name)) { @@ -332,7 +331,6 @@ _fmt(format, t) } continue; } -#endif case '%': /* * X311J/88-090 (4.12.3.5): if conversion char is diff --git a/doc/tclvars.n b/doc/tclvars.n index 1471130..f6617c7 100644 --- a/doc/tclvars.n +++ b/doc/tclvars.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: tclvars.n,v 1.7.2.1 2001/04/03 22:06:44 hobbs Exp $ +'\" RCS: @(#) $Id: tclvars.n,v 1.7.2.2 2001/10/17 19:29:24 das Exp $ '\" .so man.macros .TH tclvars n 8.0 Tcl "Tcl Built-In Commands" @@ -87,7 +87,7 @@ The path to the trash directory. \fBSTART_UP_FOLDER\fR The path to the start up directory. .TP -\fBPWD\fR +\fBHOME\fR The path to the application's default directory. .PP You can also create your own environment variables for the Macintosh. diff --git a/generic/tcl.h b/generic/tcl.h index 977f5b4..357bdbb 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -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: tcl.h,v 1.70.2.8 2001/10/15 17:39:34 hobbs Exp $ + * RCS: @(#) $Id: tcl.h,v 1.70.2.9 2001/10/17 19:29:24 das Exp $ */ #ifndef _TCL @@ -70,8 +70,7 @@ extern "C" { */ #ifndef __WIN32__ -# if defined(_WIN32) || defined(WIN32) || \ - defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__) +# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__) # define __WIN32__ # ifndef WIN32 # define WIN32 diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 2ece9ff..370d545 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -11,11 +11,14 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdAH.c,v 1.12.2.1 2001/09/20 01:13:16 hobbs Exp $ + * RCS: @(#) $Id: tclCmdAH.c,v 1.12.2.2 2001/10/17 19:29:24 das Exp $ */ #include "tclInt.h" #include "tclPort.h" +#ifdef MAC_TCL +#include "tclMacInt.h" +#endif #include <locale.h> typedef int (StatProc)_ANSI_ARGS_((CONST char *path, struct stat *buf)); @@ -842,6 +845,10 @@ Tcl_FileObjCmd(dummy, interp, objc, objv) } tval.actime = buf.st_atime; tval.modtime = buf.st_mtime; +#ifdef MAC_TCL + tval.actime += TclpGetGMTOffset(); + tval.modtime += TclpGetGMTOffset(); +#endif fileName = Tcl_GetString(objv[2]); if (utime(fileName, &tval) != 0) { Tcl_AppendStringsToObj(resultPtr, @@ -1029,6 +1036,10 @@ Tcl_FileObjCmd(dummy, interp, objc, objv) } tval.actime = buf.st_atime; tval.modtime = buf.st_mtime; +#ifdef MAC_TCL + tval.actime += TclpGetGMTOffset(); + tval.modtime += TclpGetGMTOffset(); +#endif fileName = Tcl_GetString(objv[2]); if (utime(fileName, &tval) != 0) { Tcl_AppendStringsToObj(resultPtr, diff --git a/generic/tclDate.c b/generic/tclDate.c index 44bc69f..979609c 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -10,13 +10,13 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDate.c,v 1.17.2.1 2000/08/07 21:30:36 hobbs Exp $ + * RCS: @(#) $Id: tclDate.c,v 1.17.2.2 2001/10/17 19:29:25 das Exp $ */ #include "tclInt.h" #include "tclPort.h" -#ifdef MAC_TCL +#if defined(MAC_TCL) && !defined(TCL_MAC_USE_MSL_EPOCH) # define EPOCH 1904 # define START_OF_TIME 1904 # define END_OF_TIME 2039 diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 6f15698..1b110b9 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -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: tclGetDate.y,v 1.15.2.1 2000/08/07 21:30:36 hobbs Exp $ + * RCS: @(#) $Id: tclGetDate.y,v 1.15.2.2 2001/10/17 19:29:25 das Exp $ */ %{ @@ -33,7 +33,7 @@ #include "tclInt.h" #include "tclPort.h" -#ifdef MAC_TCL +#if defined(MAC_TCL) && !defined(TCL_MAC_USE_MSL_EPOCH) # define EPOCH 1904 # define START_OF_TIME 1904 # define END_OF_TIME 2039 diff --git a/generic/tclInt.decls b/generic/tclInt.decls index dfa914b..0aad6e9 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -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: tclInt.decls,v 1.20.2.5 2001/10/15 20:27:23 andreas_kupries Exp $ +# RCS: @(#) $Id: tclInt.decls,v 1.20.2.6 2001/10/17 19:29:25 das Exp $ library tcl @@ -740,6 +740,9 @@ declare 23 mac { # declare 24 mac { # int TclMacReadlink(char *path, char *buf, int size) # } +declare 24 mac { + char * TclpGetTZName(int isdst) +} declare 25 mac { int TclMacChmod(char *path, int mode) } diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 59eee54..2bc9f05 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -9,7 +9,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.8.2.4 2001/09/10 17:15:13 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.8.2.5 2001/10/17 19:29:25 das Exp $ */ #ifndef _TCLINTPLATDECLS @@ -194,7 +194,8 @@ EXTERN int TclMacCreateEnv _ANSI_ARGS_((void)); /* 23 */ EXTERN FILE * TclMacFOpenHack _ANSI_ARGS_((CONST char * path, CONST char * mode)); -/* Slot 24 is reserved */ +/* 24 */ +EXTERN char * TclpGetTZName _ANSI_ARGS_((int isdst)); /* 25 */ EXTERN int TclMacChmod _ANSI_ARGS_((char * path, int mode)); #endif /* MAC_TCL */ @@ -524,7 +525,10 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define TclMacFOpenHack \ (tclIntPlatStubsPtr->tclMacFOpenHack) /* 23 */ #endif -/* Slot 24 is reserved */ +#ifndef TclpGetTZName +#define TclpGetTZName \ + (tclIntPlatStubsPtr->tclpGetTZName) /* 24 */ +#endif #ifndef TclMacChmod #define TclMacChmod \ (tclIntPlatStubsPtr->tclMacChmod) /* 25 */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 7cee438..f81cbee 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStubInit.c,v 1.35.2.6 2001/10/15 20:27:23 andreas_kupries Exp $ + * RCS: @(#) $Id: tclStubInit.c,v 1.35.2.7 2001/10/17 19:29:25 das Exp $ */ #include "tclInt.h" @@ -312,7 +312,7 @@ TclIntPlatStubs tclIntPlatStubs = { TclMacUnRegisterResourceFork, /* 21 */ TclMacCreateEnv, /* 22 */ TclMacFOpenHack, /* 23 */ - NULL, /* 24 */ + TclpGetTZName, /* 24 */ TclMacChmod, /* 25 */ #endif /* MAC_TCL */ }; diff --git a/mac/tclMacAppInit.c b/mac/tclMacAppInit.c index 57f210c..ae62daa 100644 --- a/mac/tclMacAppInit.c +++ b/mac/tclMacAppInit.c @@ -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: tclMacAppInit.c,v 1.5.12.1 2001/04/04 21:22:18 hobbs Exp $ + * RCS: @(#) $Id: tclMacAppInit.c,v 1.5.12.2 2001/10/17 19:29:25 das Exp $ */ #include "tcl.h" @@ -189,6 +189,7 @@ MacintoshInit() SIOUXSettings.autocloseonquit = true; SIOUXSettings.showstatusline = true; SIOUXSettings.asktosaveonclose = false; + SIOUXSettings.wasteusetempmemory = true; InstallConsole(0); SIOUXSetTitle("\pTcl Interpreter"); diff --git a/mac/tclMacApplication.r b/mac/tclMacApplication.r index 3b287e3..a13a667 100644 --- a/mac/tclMacApplication.r +++ b/mac/tclMacApplication.r @@ -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: tclMacApplication.r,v 1.3.2.1 2001/04/04 21:22:18 hobbs Exp $ + * RCS: @(#) $Id: tclMacApplication.r,v 1.3.2.2 2001/10/17 19:29:25 das Exp $ */ #include <Types.r> @@ -42,21 +42,21 @@ resource 'vers' (1) { TCL_MAJOR_VERSION, MINOR_VERSION, RELEASE_LEVEL, 0x00, verUS, TCL_PATCH_LEVEL, - TCL_PATCH_LEVEL ", by Ray Johnson & Jim Ingham" "\n" "© 2000 Ajuba Solutions" + TCL_PATCH_LEVEL ", by Ray Johnson & Jim Ingham" "\n" "© 2001 Tcl Core Team" }; resource 'vers' (2) { TCL_MAJOR_VERSION, MINOR_VERSION, RELEASE_LEVEL, 0x00, verUS, TCL_PATCH_LEVEL, - "Tcl Shell " TCL_PATCH_LEVEL " © 1993-2000" + "Tcl Shell " TCL_PATCH_LEVEL " © 1993-2001" }; #define TCL_APP_CREATOR 'Tcl ' type TCL_APP_CREATOR as 'STR '; resource TCL_APP_CREATOR (0, purgeable) { - "Tcl Shell " TCL_PATCH_LEVEL " © 1993-2000" + "Tcl Shell " TCL_PATCH_LEVEL " © 1993-2001" }; /* @@ -73,3 +73,41 @@ resource 'kind' (128, "Tcl kind", purgeable) { 'APPL', "Tcl Shell", } }; + +/* + * The following resource is used when creating the 'env' variable in + * the Macintosh environment. The creation mechanisim looks for the + * 'STR#' resource named "Tcl Environment Variables" rather than a + * specific resource number. (In other words, feel free to change the + * resource id if it conflicts with your application.) Each string in + * the resource must be of the form "KEYWORD=SOME STRING". See Tcl + * documentation for futher information about the env variable. + * + * A good example of something you may want to set is: "TCL_LIBRARY=My + * disk:etc." + */ + +resource 'STR#' (128, "Tcl Environment Variables") { + { + /* + "SCHEDULE_NAME=Agent Controller Schedule", + "SCHEDULE_PATH=Lozoya:System Folder:Tcl Lib:Tcl-Scheduler" + */ + }; +}; + +data 'alis' (1000, "Library Folder") { + $"0000 0000 00BA 0002 0001 012F 0000 0000" /* ........../.... */ + $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */ + $"0000 0000 0000 985C FB00 4244 0000 0000" /* ......ς\.BD.... */ + $"0002 1328 5375 7070 6F72 7420 4C69 6272" /* ...(Support Libr */ + $"6172 6965 7329 0000 0000 0000 0000 0000" /* aries).......... */ + $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */ + $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */ + $"0000 0076 8504 B617 A796 003D 0027 025B" /* ...vΦ..ίρ.=.'.[ */ + $"01E4 0001 0001 0000 0000 0000 0000 0000" /* ............... */ + $"0000 0000 0000 0000 0001 2F00 0002 0015" /* ........../..... */ + $"2F3A 2853 7570 706F 7274 204C 6962 7261" /* /:(Support Libra */ + $"7269 6573 2900 FFFF 0000" /* ries)... */ +}; + diff --git a/mac/tclMacFile.c b/mac/tclMacFile.c index b6ae7a2..7fd820a 100644 --- a/mac/tclMacFile.c +++ b/mac/tclMacFile.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: tclMacFile.c,v 1.9 1999/12/12 22:46:45 hobbs Exp $ + * RCS: @(#) $Id: tclMacFile.c,v 1.9.2.1 2001/10/17 19:29:25 das Exp $ */ /* @@ -31,13 +31,6 @@ #include <MoreFilesExtras.h> #include <FSpCompat.h> -/* - * Static variables used by the TclpStat function. - */ -static int initialized = false; -static long gmt_offset; -TCL_DECLARE_MUTEX(gmtMutex) - /* *---------------------------------------------------------------------- @@ -134,7 +127,7 @@ TclpMatchFilesTypes( char *fname, *patternEnd = tail; char savedChar; int fnameLen, result = TCL_OK; - int baseLength = Tcl_DStringLength(dirPtr); + int baseLength; CInfoPBRec pb; OSErr err; FSSpec dirSpec; @@ -146,21 +139,55 @@ TclpMatchFilesTypes( Tcl_Obj *resultPtr; OSType okType = 0; OSType okCreator = 0; + Tcl_DString dsOrig; + + Tcl_DStringInit(&dsOrig); + Tcl_DStringAppend(&dsOrig, Tcl_DStringValue(dirPtr), + Tcl_DStringLength(dirPtr)); + baseLength = Tcl_DStringLength(&dsOrig); /* * Make sure that the directory part of the name really is a * directory. */ - Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(dirPtr), - Tcl_DStringLength(dirPtr), &fileString); + Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&dsOrig), + Tcl_DStringLength(&dsOrig), &fileString); - FSpLocationFromPath(fileString.length, fileString.string, &dirSpec); + err = FSpLocationFromPath(Tcl_DStringLength(&fileString), + Tcl_DStringValue(&fileString), &dirSpec); Tcl_DStringFree(&fileString); + if (err == noErr) + err = FSpGetDirectoryID(&dirSpec, &dirID, &isDirectory); + if ((err != noErr) || !isDirectory) { + /* + * Check if we had a relative path (unix style relative path + * compatibility for glob) + */ + Tcl_DStringFree(&dsOrig); + Tcl_DStringAppend(&dsOrig, ":", 1); + Tcl_DStringAppend(&dsOrig, Tcl_DStringValue(dirPtr), + Tcl_DStringLength(dirPtr)); + baseLength = Tcl_DStringLength(&dsOrig); + Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&dsOrig), + Tcl_DStringLength(&dsOrig), &fileString); + + err = FSpLocationFromPath(Tcl_DStringLength(&fileString), + Tcl_DStringValue(&fileString), &dirSpec); + Tcl_DStringFree(&fileString); + if (err == noErr) err = FSpGetDirectoryID(&dirSpec, &dirID, &isDirectory); if ((err != noErr) || !isDirectory) { - return TCL_OK; + Tcl_DStringFree(&dsOrig); + return TCL_OK; + } + } + + /* Make sure we have a trailing directory delimiter */ + if (Tcl_DStringValue(&dsOrig)[baseLength-1] != ':') { + Tcl_DStringAppend(&dsOrig, ":", 1); + baseLength++; } /* @@ -218,10 +245,10 @@ TclpMatchFilesTypes( Tcl_ExternalToUtfDString(NULL, (char *) fileName + 1, fileName[0], &fileString); if (Tcl_StringMatch(Tcl_DStringValue(&fileString), pattern)) { - Tcl_DStringSetLength(dirPtr, baseLength); - Tcl_DStringAppend(dirPtr, Tcl_DStringValue(&fileString), -1); - fname = Tcl_DStringValue(dirPtr); - fnameLen = Tcl_DStringLength(dirPtr); + Tcl_DStringSetLength(&dsOrig, baseLength); + Tcl_DStringAppend(&dsOrig, Tcl_DStringValue(&fileString), -1); + fname = Tcl_DStringValue(&dsOrig); + fnameLen = Tcl_DStringLength(&dsOrig); if (tail == NULL) { int typeOk = 1; if (types != NULL) { @@ -296,8 +323,8 @@ TclpMatchFilesTypes( } } } else if ((pb.hFileInfo.ioFlAttrib & ioDirMask) != 0) { - Tcl_DStringAppend(dirPtr, ":", 1); - result = TclDoGlob(interp, separators, dirPtr, tail, types); + Tcl_DStringAppend(&dsOrig, ":", 1); + result = TclDoGlob(interp, separators, &dsOrig, tail, types); if (result != TCL_OK) { Tcl_DStringFree(&fileString); break; @@ -309,6 +336,7 @@ TclpMatchFilesTypes( } *patternEnd = savedChar; + Tcl_DStringFree(&dsOrig); return result; } @@ -811,25 +839,14 @@ TclpStat( /* * The times returned by the Mac file system are in the * local time zone. We convert them to GMT so that the - * epoch starts from GMT. This is also consistant with + * epoch starts from GMT. This is also consistent with * what is returned from "clock seconds". */ - Tcl_MutexLock(&gmtMutex); - if (initialized == false) { - MachineLocation loc; - - ReadLocation(&loc); - gmt_offset = loc.u.gmtDelta & 0x00ffffff; - if (gmt_offset & 0x00800000) { - gmt_offset = gmt_offset | 0xff000000; - } - initialized = true; - } - Tcl_MutexUnlock(&gmtMutex); - - bufPtr->st_atime = bufPtr->st_mtime = fpb.ioFlMdDat - gmt_offset; - bufPtr->st_ctime = fpb.ioFlCrDat - gmt_offset; + bufPtr->st_atime = bufPtr->st_mtime = fpb.ioFlMdDat + - TclpGetGMTOffset() + tcl_mac_epoch_offset; + bufPtr->st_ctime = fpb.ioFlCrDat - TclpGetGMTOffset() + + tcl_mac_epoch_offset; } } diff --git a/mac/tclMacInt.h b/mac/tclMacInt.h index ee10e37..49ee4f7 100644 --- a/mac/tclMacInt.h +++ b/mac/tclMacInt.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacInt.h,v 1.6.2.1 2001/04/04 21:22:19 hobbs Exp $ + * RCS: @(#) $Id: tclMacInt.h,v 1.6.2.2 2001/10/17 19:29:25 das Exp $ */ #ifndef _TCLMACINT @@ -66,7 +66,8 @@ */ EXTERN char * TclMacGetFontEncoding _ANSI_ARGS_((int fontId)); -EXTERN int TclMacHaveThreads(void); +EXTERN int TclMacHaveThreads _ANSI_ARGS_((void)); +EXTERN long TclpGetGMTOffset _ANSI_ARGS_((void)); # undef TCL_STORAGE_CLASS # define TCL_STORAGE_CLASS DLLIMPORT diff --git a/mac/tclMacLibrary.r b/mac/tclMacLibrary.r index 018e61b..9fb353f 100644 --- a/mac/tclMacLibrary.r +++ b/mac/tclMacLibrary.r @@ -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: tclMacLibrary.r,v 1.4.2.1 2001/04/04 21:22:19 hobbs Exp $ + * RCS: @(#) $Id: tclMacLibrary.r,v 1.4.2.2 2001/10/17 19:29:25 das Exp $ */ #include <Types.r> @@ -42,14 +42,14 @@ resource 'vers' (1) { TCL_MAJOR_VERSION, MINOR_VERSION, RELEASE_LEVEL, 0x00, verUS, TCL_PATCH_LEVEL, - TCL_PATCH_LEVEL ", by Ray Johnson & Jim Ingham" "\n" "© 2000 Ajuba Solutions" + TCL_PATCH_LEVEL ", by Ray Johnson & Jim Ingham" "\n" "© 2001 Tcl Core Team" }; resource 'vers' (2) { TCL_MAJOR_VERSION, MINOR_VERSION, RELEASE_LEVEL, 0x00, verUS, TCL_PATCH_LEVEL, - "Tcl Library " TCL_PATCH_LEVEL " © 1993-2000" + "Tcl Library " TCL_PATCH_LEVEL " © 1993-2001" }; /* @@ -96,7 +96,7 @@ resource 'FREF' (TCL_LIBRARY_RESOURCES, purgeable) type TCL_CREATOR as 'STR '; resource TCL_CREATOR (0, purgeable) { - "Tcl Library " TCL_PATCH_LEVEL " © 1993-2000" + "Tcl Library " TCL_PATCH_LEVEL " © 1993-2001" }; /* @@ -130,20 +130,6 @@ resource 'STR ' (-16397, purgeable) { }; /* - * The mechanisim below loads Tcl source into the resource fork of the - * application. The example below creates a TEXT resource named - * "Init" from the file "init.tcl". This allows applications to use - * Tcl to define the behavior of the application without having to - * require some predetermined file structure - all needed Tcl "files" - * are located within the application. To source a file for the - * resource fork the source command has been modified to support - * sourcing from resources. In the below case "source -rsrc {Init}" - * will load the TEXT resource named "Init". - */ - -#include "tclMacTclCode.r" - -/* * The following are icons for the shared library. */ diff --git a/mac/tclMacOSA.r b/mac/tclMacOSA.r index dc7fc5f..94eb683 100644 --- a/mac/tclMacOSA.r +++ b/mac/tclMacOSA.r @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacOSA.r,v 1.3.2.1 2001/04/04 21:22:19 hobbs Exp $ + * RCS: @(#) $Id: tclMacOSA.r,v 1.3.2.2 2001/10/17 19:29:25 das Exp $ */ #include <Types.r> @@ -39,14 +39,14 @@ resource 'vers' (1) { SCRIPT_MAJOR_VERSION, MINOR_VERSION, RELEASE_LEVEL, 0x00, verUS, SCRIPT_PATCH_LEVEL, - SCRIPT_PATCH_LEVEL ", by Jim Ingham © Cygnus Solutions" "\n" "© 2000 Ajuba Solutions" + SCRIPT_PATCH_LEVEL ", by Jim Ingham © Cygnus Solutions" "\n" "© 2001 Tcl Core Team" }; resource 'vers' (2) { SCRIPT_MAJOR_VERSION, MINOR_VERSION, RELEASE_LEVEL, 0x00, verUS, SCRIPT_PATCH_LEVEL, - "Tclapplescript " SCRIPT_PATCH_LEVEL " © 1996-2000" + "Tclapplescript " SCRIPT_PATCH_LEVEL " © 1996-2001" }; /* diff --git a/mac/tclMacPort.h b/mac/tclMacPort.h index 72fc683..fe92b46 100644 --- a/mac/tclMacPort.h +++ b/mac/tclMacPort.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: tclMacPort.h,v 1.10.2.2 2001/09/01 22:53:45 davygrvy Exp $ + * RCS: @(#) $Id: tclMacPort.h,v 1.10.2.3 2001/10/17 19:29:25 das Exp $ */ @@ -212,20 +212,39 @@ extern char **environ; #define TCL_SHLIB_EXT ".shlb" /* - * The following define is bogus and needs to be fixed. It claims that + * The following define is defined as a workaround on the mac. It claims that * struct tm has the timezone string in it, which is not true. However, * the code that works around this fact does not compile on the Mac, since * it relies on the fact that time.h has a "timezone" variable, which the * Metrowerks time.h does not have... * - * The Mac timezone stuff never worked (clock format 0 -format %Z returns "Z") - * so this just keeps the status quo. The real answer is to not use the - * MSL strftime, and provide the needed compat functions... + * The Mac timezone stuff is implemented via the TclpGetTZName() routine in + * tclMacTime.c * */ #define HAVE_TM_ZONE + +/* + * If we're using the Metrowerks MSL, we need to convert time_t values from + * the mac epoch to the msl epoch (== unix epoch) by adding the offset from + * <time.mac.h> to mac time_t values, as MSL is using its epoch for file + * access routines such as stat or utime + */ + +#ifdef __MSL__ +#include <time.mac.h> +#ifdef _mac_msl_epoch_offset_ +#define tcl_mac_epoch_offset _mac_msl_epoch_offset_ +#define TCL_MAC_USE_MSL_EPOCH /* flag for TclDate.c */ +#else +#define tcl_mac_epoch_offset 0L +#endif +#else +#define tcl_mac_epoch_offset 0L +#endif + /* * The following macros have trivial definitions, allowing generic code to * address platform-specific issues. diff --git a/mac/tclMacResource.r b/mac/tclMacResource.r index 80b2dda..4d66e80 100644 --- a/mac/tclMacResource.r +++ b/mac/tclMacResource.r @@ -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: tclMacResource.r,v 1.4.2.1 2001/04/04 21:22:19 hobbs Exp $ + * RCS: @(#) $Id: tclMacResource.r,v 1.4.2.2 2001/10/17 19:29:25 das Exp $ */ #include <Types.r> @@ -55,41 +55,3 @@ #include "tclMacTclCode.r" -/* - * The following resource is used when creating the 'env' variable in - * the Macintosh environment. The creation mechanisim looks for the - * 'STR#' resource named "Tcl Environment Variables" rather than a - * specific resource number. (In other words, feel free to change the - * resource id if it conflicts with your application.) Each string in - * the resource must be of the form "KEYWORD=SOME STRING". See Tcl - * documentation for futher information about the env variable. - * - * A good example of something you may want to set is: "TCL_LIBRARY=My - * disk:etc." - */ - -resource 'STR#' (128, "Tcl Environment Variables") { - { - /* - "SCHEDULE_NAME=Agent Controller Schedule", - "SCHEDULE_PATH=Lozoya:System Folder:Tcl Lib:Tcl-Scheduler" - */ - }; -}; - -data 'alis' (1000, "Library Folder") { - $"0000 0000 00BA 0002 0001 012F 0000 0000" /* ........../.... */ - $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */ - $"0000 0000 0000 985C FB00 4244 0000 0000" /* ......ς\.BD.... */ - $"0002 1328 5375 7070 6F72 7420 4C69 6272" /* ...(Support Libr */ - $"6172 6965 7329 0000 0000 0000 0000 0000" /* aries).......... */ - $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */ - $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */ - $"0000 0076 8504 B617 A796 003D 0027 025B" /* ...vΦ..ίρ.=.'.[ */ - $"01E4 0001 0001 0000 0000 0000 0000 0000" /* ............... */ - $"0000 0000 0000 0000 0001 2F00 0002 0015" /* ........../..... */ - $"2F3A 2853 7570 706F 7274 204C 6962 7261" /* /:(Support Libra */ - $"7269 6573 2900 FFFF 0000" /* ries)... */ -}; - - diff --git a/mac/tclMacTime.c b/mac/tclMacTime.c index 1a2d1ed..fd70156 100644 --- a/mac/tclMacTime.c +++ b/mac/tclMacTime.c @@ -9,11 +9,12 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacTime.c,v 1.3 1999/03/10 05:52:51 stanton Exp $ + * RCS: @(#) $Id: tclMacTime.c,v 1.3.14.1 2001/10/17 19:29:25 das Exp $ */ #include "tclInt.h" #include "tclPort.h" +#include "tclMacInt.h" #include <OSUtils.h> #include <Timer.h> #include <time.h> @@ -26,6 +27,90 @@ static int initalized = false; static unsigned long baseSeconds; static UnsignedWide microOffset; +static int gmt_initialized = false; +static long gmt_offset; +static int gmt_isdst; +TCL_DECLARE_MUTEX(gmtMutex) + +static int gmt_lastGetDateUseGMT = 0; + +typedef struct _TABLE { + char *name; + int type; + time_t value; +} TABLE; + + +#define HOUR(x) ((time_t) (3600 * x)) + +#define tZONE 0 +#define tDAYZONE 1 + + +/* + * inverse timezone table, adapted from tclDate.c by removing duplicates and + * adding some made up names for unusual daylight savings + */ +static TABLE invTimezoneTable[] = { + { "Z", -1, HOUR( 36) }, /* Unknown */ + { "GMT", tZONE, HOUR( 0) }, /* Greenwich Mean */ + { "BST", tDAYZONE, HOUR( 0) }, /* British Summer */ + { "WAT", tZONE, HOUR( 1) }, /* West Africa */ + { "WADST", tDAYZONE, HOUR( 1) }, /* West Africa Daylight*/ + { "AT", tZONE, HOUR( 2) }, /* Azores Daylight*/ + { "ADST", tDAYZONE, HOUR( 2) }, /* Azores */ + { "NFT", tZONE, HOUR( 7/2) }, /* Newfoundland */ + { "NDT", tDAYZONE, HOUR( 7/2) }, /* Newfoundland Daylight */ + { "AST", tZONE, HOUR( 4) }, /* Atlantic Standard */ + { "ADT", tDAYZONE, HOUR( 4) }, /* Atlantic Daylight */ + { "EST", tZONE, HOUR( 5) }, /* Eastern Standard */ + { "EDT", tDAYZONE, HOUR( 5) }, /* Eastern Daylight */ + { "CST", tZONE, HOUR( 6) }, /* Central Standard */ + { "CDT", tDAYZONE, HOUR( 6) }, /* Central Daylight */ + { "MST", tZONE, HOUR( 7) }, /* Mountain Standard */ + { "MDT", tDAYZONE, HOUR( 7) }, /* Mountain Daylight */ + { "PST", tZONE, HOUR( 8) }, /* Pacific Standard */ + { "PDT", tDAYZONE, HOUR( 8) }, /* Pacific Daylight */ + { "YST", tZONE, HOUR( 9) }, /* Yukon Standard */ + { "YDT", tDAYZONE, HOUR( 9) }, /* Yukon Daylight */ + { "HST", tZONE, HOUR(10) }, /* Hawaii Standard */ + { "HDT", tDAYZONE, HOUR(10) }, /* Hawaii Daylight */ + { "NT", tZONE, HOUR(11) }, /* Nome */ + { "NST", tDAYZONE, HOUR(11) }, /* Nome Daylight*/ + { "IDLW", tZONE, HOUR(12) }, /* International Date Line West */ + { "CET", tZONE, -HOUR( 1) }, /* Central European */ + { "CEST", tDAYZONE, -HOUR( 1) }, /* Central European Summer */ + { "EET", tZONE, -HOUR( 2) }, /* Eastern Europe, USSR Zone 1 */ + { "EEST", tDAYZONE, -HOUR( 2) }, /* Eastern Europe, USSR Zone 1 Daylight*/ + { "BT", tZONE, -HOUR( 3) }, /* Baghdad, USSR Zone 2 */ + { "BDST", tDAYZONE, -HOUR( 3) }, /* Baghdad, USSR Zone 2 Daylight*/ + { "IT", tZONE, -HOUR( 7/2) }, /* Iran */ + { "IDST", tDAYZONE, -HOUR( 7/2) }, /* Iran Daylight*/ + { "ZP4", tZONE, -HOUR( 4) }, /* USSR Zone 3 */ + { "ZP4S", tDAYZONE, -HOUR( 4) }, /* USSR Zone 3 */ + { "ZP5", tZONE, -HOUR( 5) }, /* USSR Zone 4 */ + { "ZP5S", tDAYZONE, -HOUR( 5) }, /* USSR Zone 4 */ + { "IST", tZONE, -HOUR(11/2) }, /* Indian Standard */ + { "ISDST", tDAYZONE, -HOUR(11/2) }, /* Indian Standard */ + { "ZP6", tZONE, -HOUR( 6) }, /* USSR Zone 5 */ + { "ZP6S", tDAYZONE, -HOUR( 6) }, /* USSR Zone 5 */ + { "WAST", tZONE, -HOUR( 7) }, /* West Australian Standard */ + { "WADT", tDAYZONE, -HOUR( 7) }, /* West Australian Daylight */ + { "JT", tZONE, -HOUR(15/2) }, /* Java (3pm in Cronusland!) */ + { "JDST", tDAYZONE, -HOUR(15/2) }, /* Java (3pm in Cronusland!) */ + { "CCT", tZONE, -HOUR( 8) }, /* China Coast, USSR Zone 7 */ + { "CCST", tDAYZONE, -HOUR( 8) }, /* China Coast, USSR Zone 7 */ + { "JST", tZONE, -HOUR( 9) }, /* Japan Standard, USSR Zone 8 */ + { "JSDST", tDAYZONE, -HOUR( 9) }, /* Japan Standard, USSR Zone 8 */ + { "CAST", tZONE, -HOUR(19/2) }, /* Central Australian Standard */ + { "CADT", tDAYZONE, -HOUR(19/2) }, /* Central Australian Daylight */ + { "EAST", tZONE, -HOUR(10) }, /* Eastern Australian Standard */ + { "EADT", tDAYZONE, -HOUR(10) }, /* Eastern Australian Daylight */ + { "NZT", tZONE, -HOUR(12) }, /* New Zealand */ + { "NZDT", tDAYZONE, -HOUR(12) }, /* New Zealand Daylight */ + { NULL } +}; + /* * Prototypes for procedures that are private to this file: */ @@ -36,6 +121,43 @@ static void SubtractUnsignedWide _ANSI_ARGS_((UnsignedWide *x, /* *----------------------------------------------------------------------------- * + * TclpGetGMTOffset -- + * + * This procedure gets the offset seconds that needs to be _added_ to tcl time + * in seconds (i.e. GMT time) to get local time needed as input to various + * Mac OS APIs, to convert Mac OS API output to tcl time, _subtract_ this value. + * + * Results: + * Number of seconds separating GMT time and mac. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +long +TclpGetGMTOffset() +{ + if (gmt_initialized == false) { + MachineLocation loc; + + Tcl_MutexLock(&gmtMutex); + ReadLocation(&loc); + gmt_offset = loc.u.gmtDelta & 0x00ffffff; + if (gmt_offset & 0x00800000) { + gmt_offset = gmt_offset | 0xff000000; + } + gmt_isdst=(loc.u.dlsDelta < 0); + gmt_initialized = true; + Tcl_MutexUnlock(&gmtMutex); + } + return (gmt_offset); +} + +/* + *----------------------------------------------------------------------------- + * * TclpGetSeconds -- * * This procedure returns the number of seconds from the epoch. On @@ -57,21 +179,9 @@ unsigned long TclpGetSeconds() { unsigned long seconds; - MachineLocation loc; - long int offset; - - ReadLocation(&loc); - offset = loc.u.gmtDelta & 0x00ffffff; - if (offset & 0x00800000) { - offset = offset | 0xff000000; - } - if (ReadDateTime(&seconds) == noErr) { - return (seconds - offset); - } else { - panic("Can't get time."); - return 0; - } + GetDateTime(&seconds); + return (seconds - TclpGetGMTOffset() + tcl_mac_epoch_offset); } /* @@ -123,22 +233,15 @@ int TclpGetTimeZone ( unsigned long currentTime) /* Ignored on Mac. */ { - MachineLocation loc; - long int offset; - - ReadLocation(&loc); - offset = loc.u.gmtDelta & 0x00ffffff; - if (offset & 0x00700000) { - offset |= 0xff000000; - } + long offset; /* * Convert the Mac offset from seconds to minutes and * add an hour if we have daylight savings time. */ - offset = -offset; + offset = -TclpGetGMTOffset(); offset /= 60; - if (loc.u.dlsDelta < 0) { + if (gmt_isdst) { offset += 60; } @@ -172,24 +275,11 @@ TclpGetTime( #endif if (initalized == false) { - MachineLocation loc; - long int offset; - - ReadLocation(&loc); - offset = loc.u.gmtDelta & 0x00ffffff; - if (offset & 0x00800000) { - offset = offset | 0xff000000; - } - if (ReadDateTime(&baseSeconds) != noErr) { - /* - * This should never happen! - */ - return; - } + GetDateTime(&baseSeconds); /* * Remove the local offset that ReadDateTime() adds. */ - baseSeconds -= offset; + baseSeconds -= TclpGetGMTOffset() - tcl_mac_epoch_offset; Microseconds(µOffset); initalized = true; } @@ -246,24 +336,15 @@ TclpGetDate( { const time_t *tp = (const time_t *)time; DateTimeRec dtr; - MachineLocation loc; - long int offset; + unsigned long offset=0L; static struct tm statictime; static const short monthday[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; - ReadLocation(&loc); - - if (useGMT) { - SecondsToDate(*tp, &dtr); - } else { - offset = loc.u.gmtDelta & 0x00ffffff; - if (offset & 0x00700000) { - offset |= 0xff000000; - } - - SecondsToDate(*tp + offset, &dtr); - } + if(useGMT) + SecondsToDate(*tp - tcl_mac_epoch_offset, &dtr); + else + SecondsToDate(*tp + TclpGetGMTOffset() - tcl_mac_epoch_offset, &dtr); statictime.tm_sec = dtr.second; statictime.tm_min = dtr.minute; @@ -277,10 +358,48 @@ TclpGetDate( if (1 < statictime.tm_mon && !(statictime.tm_year & 3)) { ++statictime.tm_yday; } - statictime.tm_isdst = loc.u.dlsDelta; + if(useGMT) + statictime.tm_isdst = 0; + else + statictime.tm_isdst = gmt_isdst; + gmt_lastGetDateUseGMT=useGMT; /* hack to make TclpGetTZName below work */ return(&statictime); } +/* + *---------------------------------------------------------------------- + * + * TclpGetTZName -- + * + * Gets the current timezone string. + * + * Results: + * Returns a pointer to a static string, or NULL on failure. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +TclpGetTZName(int dst) +{ + register TABLE *tp; + long zonevalue=-TclpGetGMTOffset(); + + if(gmt_lastGetDateUseGMT) /* hack: if last TclpGetDate was called */ + zonevalue=0; /* with useGMT==1 then we're using GMT */ + + for (tp = invTimezoneTable; tp->name; tp++) { + if ((tp->value == zonevalue) && (tp->type == dst)) break; + } + if(!tp->name) + tp = invTimezoneTable; /* default to unknown */ + + return tp->name; +} + #ifdef NO_LONG_LONG /* *---------------------------------------------------------------------- diff --git a/tests/cmdAH.test b/tests/cmdAH.test index ebf27e6..187e025 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -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: cmdAH.test,v 1.10.2.1 2001/04/03 22:54:38 hobbs Exp $ +# RCS: @(#) $Id: cmdAH.test,v 1.10.2.2 2001/10/17 19:29:25 das Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -1174,7 +1174,7 @@ test cmdAH-20.3 {Tcl_FileObjCmd: atime} { test cmdAH-20.4 {Tcl_FileObjCmd: atime} { list [catch {file atime $file notint} msg] $msg } {1 {expected integer but got "notint"}} -test cmdAH-20.5 {Tcl_FileObjCmd: atime touch} { +test cmdAH-20.5 {Tcl_FileObjCmd: atime touch} {unixOrPc} { if {[string equal $tcl_platform(platform) "windows"]} { set old [pwd] cd $::tcltest::temporaryDirectory diff --git a/tests/cmdMZ.test b/tests/cmdMZ.test index 546d193..acc74d6 100644 --- a/tests/cmdMZ.test +++ b/tests/cmdMZ.test @@ -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: cmdMZ.test,v 1.7.2.1 2001/08/24 16:19:10 dgp Exp $ +# RCS: @(#) $Id: cmdMZ.test,v 1.7.2.2 2001/10/17 19:29:25 das Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -78,7 +78,7 @@ test cmdMZ-3.1 {Tcl_SourceObjCmd: error conditions} {macOnly} { } {1 {wrong # args: should be "source fileName" or "source -rsrc name ?fileName?" or "source -rsrcid id ?fileName?"}} test cmdMZ-3.2 {Tcl_SourceObjCmd: error conditions} {macOnly} { list [catch {source a b} msg] $msg -} {1 {wrong # args: should be "source fileName" or "source -rsrc name ?fileName?" or "source -rsrcid id ?fileName?"}} +} {1 {bad argument: should be "source fileName" or "source -rsrc name ?fileName?" or "source -rsrcid id ?fileName?"}} test cmdMZ-3.3 {Tcl_SourceObjCmd: error conditions} {unixOrPc} { list [catch {source} msg] $msg } {1 {wrong # args: should be "source fileName"}} diff --git a/tests/exec.test b/tests/exec.test index af8bf32..b9cb88f 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -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: exec.test,v 1.8 2000/04/10 17:18:58 ericm Exp $ +# RCS: @(#) $Id: exec.test,v 1.8.2.1 2001/10/17 19:29:25 das Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -228,7 +228,9 @@ test exec-4.5 {redirecting output and stderr to file} {execCommandExists stdio} # I/O redirection: input from file. +if { [set ::tcltest::testConstraints(execCommandExists)] } { exec $::tcltest::tcltest echo "Just a few thoughts" > gorp.file +} test exec-5.1 {redirecting input from file} {execCommandExists stdio} { exec $::tcltest::tcltest cat < gorp.file } {Just a few thoughts} @@ -432,7 +434,9 @@ test exec-11.5 {commands in background} {execCommandExists stdio} { # Make sure that background commands are properly reaped when # they eventually die. +if { [set ::tcltest::testConstraints(execCommandExists)] } { exec $::tcltest::tcltest sleep 3 +} test exec-12.1 {reaping background processes} \ {execCommandExists stdio unixOnly nonPortable} { for {set i 0} {$i < 20} {incr i} { diff --git a/tests/fileName.test b/tests/fileName.test index 5986136..22fc467 100644 --- a/tests/fileName.test +++ b/tests/fileName.test @@ -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: fileName.test,v 1.8 2000/04/10 17:18:59 ericm Exp $ +# RCS: @(#) $Id: fileName.test,v 1.8.2.1 2001/10/17 19:29:25 das Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -1124,7 +1124,7 @@ test filename-11.16 {Tcl_GlobCmd} { set globname "globTest" set horribleglobname "glob\[\{Test" -test filename-11.17 {Tcl_GlobCmd} { +test filename-11.17 {Tcl_GlobCmd} {unixOrPc} { list [catch {lsort [glob -directory $globname *]} msg] $msg } [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname a3]\ @@ -1132,7 +1132,17 @@ test filename-11.17 {Tcl_GlobCmd} { [file join $globname x,z1.c]\ [file join $globname x1.c]\ [file join $globname y1.c] [file join $globname z1.c]]]] -test filename-11.18 {Tcl_GlobCmd} { +test filename-11.17.1 {Tcl_GlobCmd} {macOnly} { + list [catch {lsort [glob -directory $globname *]} msg] $msg +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ + [file join $globname .1]\ + [file join $globname a3]\ + [file join $globname "weird name.c"]\ + [file join $globname x,z1.c]\ + [file join $globname x1.c]\ + [file join $globname y1.c] [file join $globname z1.c]]]] +test filename-11.18 {Tcl_GlobCmd} [file join $globname .1]\ + { list [catch {lsort [glob -path $globname/ *]} msg] $msg } [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname a3]\ @@ -1140,10 +1150,29 @@ test filename-11.18 {Tcl_GlobCmd} { [file join $globname x,z1.c]\ [file join $globname x1.c]\ [file join $globname y1.c] [file join $globname z1.c]]]] -test filename-11.19 {Tcl_GlobCmd} { +test filename-11.18.1 {Tcl_GlobCmd} {macOnly} { + list [catch {lsort [glob -path $globname/ *]} msg] $msg +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ + [file join $globname .1]\ + [file join $globname a3]\ + [file join $globname "weird name.c"]\ + [file join $globname x,z1.c]\ + [file join $globname x1.c]\ + [file join $globname y1.c] [file join $globname z1.c]]]] +test filename-11.19 {Tcl_GlobCmd} {unixOrPc} { + list [catch {lsort [glob -join -path \ + [string range $globname 0 5] * *]} msg] $msg +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ + [file join $globname a3]\ + [file join $globname "weird name.c"]\ + [file join $globname x,z1.c]\ + [file join $globname x1.c]\ + [file join $globname y1.c] [file join $globname z1.c]]]] +test filename-11.19.1 {Tcl_GlobCmd} {macOnly} { list [catch {lsort [glob -join -path \ [string range $globname 0 5] * *]} msg] $msg } [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ + [file join $globname .1]\ [file join $globname a3]\ [file join $globname "weird name.c"]\ [file join $globname x,z1.c]\ @@ -1161,15 +1190,24 @@ test filename-11.21 {Tcl_GlobCmd} { file rename globTest $horribleglobname set globname $horribleglobname -test filename-11.22 {Tcl_GlobCmd} { +test filename-11.22 {Tcl_GlobCmd} {unixOrPc} { + list [catch {lsort [glob -dir $globname *]} msg] $msg +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ + [file join $globname a3]\ + [file join $globname "weird name.c"]\ + [file join $globname x,z1.c]\ + [file join $globname x1.c]\ + [file join $globname y1.c] [file join $globname z1.c]]]] +test filename-11.22.1 {Tcl_GlobCmd} {macOnly} { list [catch {lsort [glob -dir $globname *]} msg] $msg } [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ + [file join $globname .1]\ [file join $globname a3]\ [file join $globname "weird name.c"]\ [file join $globname x,z1.c]\ [file join $globname x1.c]\ [file join $globname y1.c] [file join $globname z1.c]]]] -test filename-11.23 {Tcl_GlobCmd} { +test filename-11.23 {Tcl_GlobCmd} {unixOrPc} { list [catch {lsort [glob -path $globname/ *]} msg] $msg } [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname a3]\ @@ -1177,7 +1215,16 @@ test filename-11.23 {Tcl_GlobCmd} { [file join $globname x,z1.c]\ [file join $globname x1.c]\ [file join $globname y1.c] [file join $globname z1.c]]]] -test filename-11.24 {Tcl_GlobCmd} { +test filename-11.23.1 {Tcl_GlobCmd} {macOnly} { + list [catch {lsort [glob -path $globname/ *]} msg] $msg +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ + [file join $globname .1]\ + [file join $globname a3]\ + [file join $globname "weird name.c"]\ + [file join $globname x,z1.c]\ + [file join $globname x1.c]\ + [file join $globname y1.c] [file join $globname z1.c]]]] +test filename-11.24 {Tcl_GlobCmd} {unixOrPc} { list [catch {lsort [glob -join -path \ [string range $globname 0 5] * *]} msg] $msg } [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ @@ -1186,6 +1233,16 @@ test filename-11.24 {Tcl_GlobCmd} { [file join $globname x,z1.c]\ [file join $globname x1.c]\ [file join $globname y1.c] [file join $globname z1.c]]]] +test filename-11.24.1 {Tcl_GlobCmd} {macOnly} { + list [catch {lsort [glob -join -path \ + [string range $globname 0 5] * *]} msg] $msg +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ + [file join $globname .1]\ + [file join $globname a3]\ + [file join $globname "weird name.c"]\ + [file join $globname x,z1.c]\ + [file join $globname x1.c]\ + [file join $globname y1.c] [file join $globname z1.c]]]] test filename-11.25 {Tcl_GlobCmd} { list [catch {lsort [glob -type d -dir $globname *]} msg] $msg } [list 0 [lsort [list [file join $globname a1]\ @@ -1398,9 +1455,17 @@ test filename-14.23 {slash globbing} {unixOrPc} { test filename-14.24 {slash globbing} {pcOnly} { glob {\\} } / -test filename-14.25 {type specific globbing} { +test filename-14.25 {type specific globbing} {unixOrPc} { + list [catch {lsort [glob -dir globTest -types f *]} msg] $msg +} [list 0 [lsort [list \ + [file join $globname "weird name.c"]\ + [file join $globname x,z1.c]\ + [file join $globname x1.c]\ + [file join $globname y1.c] [file join $globname z1.c]]]] +test filename-14.25.1 {type specific globbing} {macOnly} { list [catch {lsort [glob -dir globTest -types f *]} msg] $msg } [list 0 [lsort [list \ + [file join $globname .1]\ [file join $globname "weird name.c"]\ [file join $globname x,z1.c]\ [file join $globname x1.c]\ @@ -1526,7 +1591,7 @@ test filename-16.13 {windows specific globbing} {pcOnly sharedCdrive} { } //[info hostname]/c/globTest # cleanup -file delete -force //[info hostname]/c/globTest +catch {file delete -force //[info hostname]/c/globTest} cd $temp file delete -force globTest set env(HOME) $oldhome |