diff options
42 files changed, 668 insertions, 1547 deletions
diff --git a/doc/tclvars.n b/doc/tclvars.n index 2c51750..7c88903 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.9 2001/09/17 11:51:58 msofer Exp $ +'\" RCS: @(#) $Id: tclvars.n,v 1.10 2001/11/23 01:29:19 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/tclIOUtil.c b/generic/tclIOUtil.c index b9bfbe1..4ac9a84 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,11 +17,14 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.25 2001/11/02 12:06:27 vincentdarley Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.26 2001/11/23 01:27:00 das Exp $ */ #include "tclInt.h" #include "tclPort.h" +#ifdef MAC_TCL +#include "tclMacInt.h" +#endif /* * Prototypes for procedures defined later in this file. The last diff --git a/generic/tclInt.h b/generic/tclInt.h index db8e17c..adaffdb 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.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: tclInt.h,v 1.70 2001/11/21 02:36:20 hobbs Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.71 2001/11/23 01:26:52 das Exp $ */ #ifndef _TCLINT @@ -1799,7 +1799,6 @@ EXTERN int TclpFindVariable _ANSI_ARGS_((CONST char *name, EXTERN void TclpFree _ANSI_ARGS_((char *ptr)); EXTERN unsigned long TclpGetClicks _ANSI_ARGS_((void)); EXTERN Tcl_Channel TclpGetDefaultStdChannel _ANSI_ARGS_((int type)); -EXTERN long TclpGetGMTOffset _ANSI_ARGS_((void)); EXTERN unsigned long TclpGetSeconds _ANSI_ARGS_((void)); EXTERN int TclpGetTimeZone _ANSI_ARGS_((unsigned long time)); EXTERN char * TclpGetUserHome _ANSI_ARGS_((CONST char *name, diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index a81803b..bec446e 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.12 2001/09/10 17:17:41 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.13 2001/11/23 01:26:55 das Exp $ */ #ifndef _TCLINTPLATDECLS @@ -149,15 +149,15 @@ EXTERN OSErr FSpFindFolder _ANSI_ARGS_((short vRefNum, OSType folderType, Boolean createFolder, FSSpec * spec)); /* 7 */ -EXTERN void GetGlobalMouse _ANSI_ARGS_((Point * mouse)); +EXTERN void GetGlobalMouseTcl _ANSI_ARGS_((Point * mouse)); /* 8 */ -EXTERN pascal OSErr FSpGetDirectoryID _ANSI_ARGS_((CONST FSSpec * spec, +EXTERN pascal OSErr FSpGetDirectoryIDTcl _ANSI_ARGS_((CONST FSSpec * spec, long * theDirID, Boolean * isDirectory)); /* 9 */ -EXTERN pascal short FSpOpenResFileCompat _ANSI_ARGS_(( +EXTERN pascal short FSpOpenResFileCompatTcl _ANSI_ARGS_(( CONST FSSpec * spec, SignedByte permission)); /* 10 */ -EXTERN pascal void FSpCreateResFileCompat _ANSI_ARGS_(( +EXTERN pascal void FSpCreateResFileCompatTcl _ANSI_ARGS_(( CONST FSSpec * spec, OSType creator, OSType fileType, ScriptCode scriptTag)); /* 11 */ @@ -193,7 +193,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 */ @@ -252,10 +253,10 @@ typedef struct TclIntPlatStubs { int (*fSpGetDefaultDir) _ANSI_ARGS_((FSSpecPtr theSpec)); /* 4 */ int (*fSpSetDefaultDir) _ANSI_ARGS_((FSSpecPtr theSpec)); /* 5 */ OSErr (*fSpFindFolder) _ANSI_ARGS_((short vRefNum, OSType folderType, Boolean createFolder, FSSpec * spec)); /* 6 */ - void (*getGlobalMouse) _ANSI_ARGS_((Point * mouse)); /* 7 */ - pascal OSErr (*fSpGetDirectoryID) _ANSI_ARGS_((CONST FSSpec * spec, long * theDirID, Boolean * isDirectory)); /* 8 */ - pascal short (*fSpOpenResFileCompat) _ANSI_ARGS_((CONST FSSpec * spec, SignedByte permission)); /* 9 */ - pascal void (*fSpCreateResFileCompat) _ANSI_ARGS_((CONST FSSpec * spec, OSType creator, OSType fileType, ScriptCode scriptTag)); /* 10 */ + void (*getGlobalMouseTcl) _ANSI_ARGS_((Point * mouse)); /* 7 */ + pascal OSErr (*fSpGetDirectoryIDTcl) _ANSI_ARGS_((CONST FSSpec * spec, long * theDirID, Boolean * isDirectory)); /* 8 */ + pascal short (*fSpOpenResFileCompatTcl) _ANSI_ARGS_((CONST FSSpec * spec, SignedByte permission)); /* 9 */ + pascal void (*fSpCreateResFileCompatTcl) _ANSI_ARGS_((CONST FSSpec * spec, OSType creator, OSType fileType, ScriptCode scriptTag)); /* 10 */ int (*fSpLocationFromPath) _ANSI_ARGS_((int length, CONST char * path, FSSpecPtr theSpec)); /* 11 */ OSErr (*fSpPathFromLocation) _ANSI_ARGS_((FSSpecPtr theSpec, int * length, Handle * fullPath)); /* 12 */ void (*tclMacExitHandler) _ANSI_ARGS_((void)); /* 13 */ @@ -455,21 +456,21 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr; #define FSpFindFolder \ (tclIntPlatStubsPtr->fSpFindFolder) /* 6 */ #endif -#ifndef GetGlobalMouse -#define GetGlobalMouse \ - (tclIntPlatStubsPtr->getGlobalMouse) /* 7 */ +#ifndef GetGlobalMouseTcl +#define GetGlobalMouseTcl \ + (tclIntPlatStubsPtr->getGlobalMouseTcl) /* 7 */ #endif -#ifndef FSpGetDirectoryID -#define FSpGetDirectoryID \ - (tclIntPlatStubsPtr->fSpGetDirectoryID) /* 8 */ +#ifndef FSpGetDirectoryIDTcl +#define FSpGetDirectoryIDTcl \ + (tclIntPlatStubsPtr->fSpGetDirectoryIDTcl) /* 8 */ #endif -#ifndef FSpOpenResFileCompat -#define FSpOpenResFileCompat \ - (tclIntPlatStubsPtr->fSpOpenResFileCompat) /* 9 */ +#ifndef FSpOpenResFileCompatTcl +#define FSpOpenResFileCompatTcl \ + (tclIntPlatStubsPtr->fSpOpenResFileCompatTcl) /* 9 */ #endif -#ifndef FSpCreateResFileCompat -#define FSpCreateResFileCompat \ - (tclIntPlatStubsPtr->fSpCreateResFileCompat) /* 10 */ +#ifndef FSpCreateResFileCompatTcl +#define FSpCreateResFileCompatTcl \ + (tclIntPlatStubsPtr->fSpCreateResFileCompatTcl) /* 10 */ #endif #ifndef FSpLocationFromPath #define FSpLocationFromPath \ @@ -523,7 +524,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/tclMain.c b/generic/tclMain.c index 8ad20d5..8b4ef51 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.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: tclMain.c,v 1.13 2001/09/24 21:10:32 dgp Exp $ + * RCS: @(#) $Id: tclMain.c,v 1.14 2001/11/23 01:28:53 das Exp $ */ #include "tcl.h" @@ -38,7 +38,11 @@ int (*tclDummyLinkVarPtr)() = Tcl_LinkVar; * on some systems, so it's better just to leave it out. */ +#if !defined(MAC_TCL) extern int isatty _ANSI_ARGS_((int fd)); +#else +#include <unistd.h> +#endif extern char * strcpy _ANSI_ARGS_((char *dst, CONST char *src)); static char *tclStartupScriptFileName = NULL; diff --git a/generic/tclObj.c b/generic/tclObj.c index 66f5240..8ebb2db 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -11,10 +11,11 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.25 2001/11/16 20:14:27 msofer Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.26 2001/11/23 01:28:58 das Exp $ */ #include "tclInt.h" +#include "tclCompile.h" #include "tclPort.h" /* diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index a483664..0a03bc9 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.64 2001/11/21 02:36:20 hobbs Exp $ + * RCS: @(#) $Id: tclStubInit.c,v 1.65 2001/11/23 01:29:01 das Exp $ */ #include "tclInt.h" @@ -301,10 +301,10 @@ TclIntPlatStubs tclIntPlatStubs = { FSpGetDefaultDir, /* 4 */ FSpSetDefaultDir, /* 5 */ FSpFindFolder, /* 6 */ - GetGlobalMouse, /* 7 */ - FSpGetDirectoryID, /* 8 */ - FSpOpenResFileCompat, /* 9 */ - FSpCreateResFileCompat, /* 10 */ + GetGlobalMouseTcl, /* 7 */ + FSpGetDirectoryIDTcl, /* 8 */ + FSpOpenResFileCompatTcl, /* 9 */ + FSpCreateResFileCompatTcl, /* 10 */ FSpLocationFromPath, /* 11 */ FSpPathFromLocation, /* 12 */ TclMacExitHandler, /* 13 */ @@ -318,7 +318,7 @@ TclIntPlatStubs tclIntPlatStubs = { TclMacUnRegisterResourceFork, /* 21 */ TclMacCreateEnv, /* 22 */ TclMacFOpenHack, /* 23 */ - NULL, /* 24 */ + TclpGetTZName, /* 24 */ TclMacChmod, /* 25 */ #endif /* MAC_TCL */ }; diff --git a/generic/tclTest.c b/generic/tclTest.c index ca41034..029d0b9 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -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: tclTest.c,v 1.33 2001/11/21 02:36:20 hobbs Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.34 2001/11/23 01:29:07 das Exp $ */ #define TCL_TEST @@ -315,6 +315,8 @@ static int TestFilesystemObjCmd _ANSI_ARGS_((ClientData dummy, static void TestReport _ANSI_ARGS_((CONST char* cmd, Tcl_Obj* arg1, Tcl_Obj* arg2)); +static Tcl_Obj *TestReportGetNativePath(Tcl_Obj* pathObjPtr); + static Tcl_FSStatProc TestReportStat; static Tcl_FSAccessProc TestReportAccess; static Tcl_FSOpenFileChannelProc TestReportOpenFileChannel; @@ -5287,12 +5289,12 @@ TestReportInFilesystem(Tcl_Obj *pathPtr, ClientData *clientDataPtr) { * Simple helper function to extract the native vfs representation of a * path object, or NULL if no such representation exists. */ -Tcl_Obj* +static Tcl_Obj* TestReportGetNativePath(Tcl_Obj* pathObjPtr) { return (Tcl_Obj*) Tcl_FSGetInternalRep(pathObjPtr, &testReportingFilesystem); } -void +static void TestReportFreeInternalRep(ClientData clientData) { Tcl_Obj *nativeRep = (Tcl_Obj*)clientData; if (nativeRep != NULL) { @@ -5301,7 +5303,7 @@ TestReportFreeInternalRep(ClientData clientData) { } } -ClientData +static ClientData TestReportDupInternalRep(ClientData clientData) { Tcl_Obj *original = (Tcl_Obj*)clientData; Tcl_IncrRefCount(original); diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 78f376b..f549630 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.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: tclThreadTest.c,v 1.11 2001/03/31 07:55:50 hobbs Exp $ + * RCS: @(#) $Id: tclThreadTest.c,v 1.12 2001/11/23 01:29:15 das Exp $ */ #include "tclInt.h" @@ -126,7 +126,7 @@ EXTERN int TclThreadSend _ANSI_ARGS_((Tcl_Interp *interp, Tcl_ThreadId id, #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT -Tcl_ThreadCreateType NewThread _ANSI_ARGS_((ClientData clientData)); +Tcl_ThreadCreateType NewTestThread _ANSI_ARGS_((ClientData clientData)); static void ListRemove _ANSI_ARGS_((ThreadSpecificData *tsdPtr)); static void ListUpdateInner _ANSI_ARGS_((ThreadSpecificData *tsdPtr)); static int ThreadEventProc _ANSI_ARGS_((Tcl_Event *evPtr, int mask)); @@ -418,7 +418,7 @@ TclCreateThread(interp, script, joinable) joinable = joinable ? TCL_THREAD_JOINABLE : TCL_THREAD_NOFLAGS; Tcl_MutexLock(&threadMutex); - if (Tcl_CreateThread(&id, NewThread, (ClientData) &ctrl, + if (Tcl_CreateThread(&id, NewTestThread, (ClientData) &ctrl, TCL_THREAD_STACK_DEFAULT, joinable) != TCL_OK) { Tcl_MutexUnlock(&threadMutex); Tcl_AppendResult(interp,"can't create a new thread",0); @@ -440,7 +440,7 @@ TclCreateThread(interp, script, joinable) /* *------------------------------------------------------------------------ * - * NewThread -- + * NewTestThread -- * * This routine is the "main()" for a new thread whose task is to * execute a single TCL script. The argument to this function is @@ -466,7 +466,7 @@ TclCreateThread(interp, script, joinable) *------------------------------------------------------------------------ */ Tcl_ThreadCreateType -NewThread(clientData) +NewTestThread(clientData) ClientData clientData; { ThreadCtrl *ctrlPtr = (ThreadCtrl*)clientData; diff --git a/mac/MW_TclBuildLibHeader.h b/mac/MW_TclBuildLibHeader.h new file mode 100644 index 0000000..f6a6f61 --- /dev/null +++ b/mac/MW_TclBuildLibHeader.h @@ -0,0 +1,7 @@ +#if __POWERPC__ +#include "MW_TclBuildLibHeaderPPC" +#elif __CFM68K__ +#include "MW_TclBuildLibHeaderCFM68K" +#else +#include "MW_TclBuildLibHeader68K" +#endif diff --git a/mac/MW_TclBuildLibHeader.pch b/mac/MW_TclBuildLibHeader.pch new file mode 100644 index 0000000..a727451 --- /dev/null +++ b/mac/MW_TclBuildLibHeader.pch @@ -0,0 +1,35 @@ +/* + * MW_TclBuildLibHeader.pch -- + * + * This file is the source for a pre-compilied header that gets used + * for all files in the Tcl projects. This make compilies go a bit + * faster. This file is only intended to be used in the MetroWerks + * CodeWarrior environment. It essentially acts as a place to set + * compiler flags. See MetroWerks documention for more details. + * + * Copyright (c) 1995-1997 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * RCS: @(#) $Id$ + */ + +/* + * To use the compilied header you need to set the "Prefix file" in + * the "C/C++ Language" preference panel to point to the created + * compilied header. The name of the header depends on the + * architecture we are compiling for (see the code below). For + * example, for a 68k app the prefix file should be: MW_TclHeader68K. + */ +#if __POWERPC__ +#pragma precompile_target "MW_TclBuildLibHeaderPPC" +#elif __CFM68K__ +#pragma precompile_target "MW_TclBuildLibHeaderCFM68K" +#else +#pragma precompile_target "MW_TclBuildLibHeader68K" +#endif + +#define BUILD_tcl 1 + +#include "MW_TclHeaderCommon.h" diff --git a/mac/MW_TclHeaderCommon.h b/mac/MW_TclHeaderCommon.h new file mode 100644 index 0000000..56ea59c --- /dev/null +++ b/mac/MW_TclHeaderCommon.h @@ -0,0 +1,54 @@ +/* + * MW_TclHeaderCommon.h -- + * + * Common includes for precompiled headers + * + * Copyright (c) 1998 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * RCS: @(#) $Id$ + */ + +#pragma once + +#include "tclMacCommonPch.h" + +/* + * Place any includes below that will are needed by the majority of the + * and is OK to be in any file in the system. + */ + +#include "tcl.h" + +#ifdef BUILD_tcl +# undef TCL_STORAGE_CLASS +# define TCL_STORAGE_CLASS DLLEXPORT +#endif +#include "tclMac.h" +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#include "tclInt.h" + + +#if PRAGMA_IMPORT +#pragma import on +#endif + +#include <MoreFiles.h> +#include <MoreFilesExtras.h> +#include <FSpCompat.h> +#include <FileCopy.h> +#include <FullPath.h> +#include <IterateDirectory.h> +#include <MoreDesktopMgr.h> +#include <DirectoryCopy.h> +#include <Search.h> + +#ifdef PRAGMA_IMPORT_OFF +#pragma import off +#elif PRAGMA_IMPORT +#pragma import reset +#endif diff --git a/mac/MW_TclStaticHeader.h b/mac/MW_TclStaticHeader.h new file mode 100644 index 0000000..0c1abc2 --- /dev/null +++ b/mac/MW_TclStaticHeader.h @@ -0,0 +1,7 @@ +#if __POWERPC__ +#include "MW_TclStaticHeaderPPC" +#elif __CFM68K__ +#include "MW_TclStaticHeaderCFM68K" +#else +#include "MW_TclStaticHeader68K" +#endif diff --git a/mac/MW_TclStaticHeader.pch b/mac/MW_TclStaticHeader.pch new file mode 100644 index 0000000..f23021f --- /dev/null +++ b/mac/MW_TclStaticHeader.pch @@ -0,0 +1,35 @@ +/* + * MW_TclStaticHeader.pch -- + * + * This file is the source for a pre-compilied header that gets used + * for all files in the Tcl projects. This make compilies go a bit + * faster. This file is only intended to be used in the MetroWerks + * CodeWarrior environment. It essentially acts as a place to set + * compiler flags. See MetroWerks documention for more details. + * + * Copyright (c) 1995-1997 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * RCS: @(#) $Id$ + */ + +/* + * To use the compilied header you need to set the "Prefix file" in + * the "C/C++ Language" preference panel to point to the created + * compilied header. The name of the header depends on the + * architecture we are compiling for (see the code below). For + * example, for a 68k app the prefix file should be: MW_TclHeader68K. + */ +#if __POWERPC__ +#pragma precompile_target "MW_TclStaticHeaderPPC" +#elif __CFM68K__ +#pragma precompile_target "MW_TclStaticHeaderCFM68K" +#else +#pragma precompile_target "MW_TclStaticHeader68K" +#endif + +#define STATIC_BUILD 1 + +#include "MW_TclHeaderCommon.h" diff --git a/mac/tclMac.h b/mac/tclMac.h index a051cc8..b937342 100644 --- a/mac/tclMac.h +++ b/mac/tclMac.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: tclMac.h,v 1.4 1999/03/10 05:52:51 stanton Exp $ + * RCS: @(#) $Id: tclMac.h,v 1.5 2001/11/23 01:27:05 das Exp $ */ #ifndef _TCLMAC @@ -21,18 +21,8 @@ #include <Files.h> #include <Events.h> -/* - * "export" is a MetroWerks specific pragma. It flags the linker that - * any symbols that are defined when this pragma is on will be exported - * to shared libraries that link with this library. - */ - -#pragma export on - typedef int (*Tcl_MacConvertEventPtr) _ANSI_ARGS_((EventRecord *eventPtr)); #include "tclPlatDecls.h" -#pragma export reset - #endif /* _TCLMAC */ diff --git a/mac/tclMacAlloc.c b/mac/tclMacAlloc.c index c5daa8b..3e6a948 100644 --- a/mac/tclMacAlloc.c +++ b/mac/tclMacAlloc.c @@ -14,12 +14,13 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacAlloc.c,v 1.4 1999/05/11 07:11:51 jingham Exp $ + * RCS: @(#) $Id: tclMacAlloc.c,v 1.5 2001/11/23 01:27:09 das Exp $ */ #include "tclInt.h" #include "tclMacInt.h" #include <Memory.h> +#include <Gestalt.h> #include <stdlib.h> #include <string.h> @@ -30,12 +31,13 @@ */ #define MEMORY_ALL_SYS 1 /* All memory should come from the system heap. */ +#define MEMORY_DONT_USE_TEMPMEM 2 /* Don't use temporary memory but system memory. */ /* * Amount of space to leave in the application heap for the Toolbox to work. */ -#define TOOLBOX_SPACE (32 * 1024) +#define TOOLBOX_SPACE (512 * 1024) static int memoryFlags = 0; static Handle toolGuardHandle = NULL; @@ -49,6 +51,15 @@ static Handle toolGuardHandle = NULL; * the way out. If we can't, we go to the * system heap directly. */ +static int tclUseMemTracking = 0; /* Are we tracking memory allocations? + * On recent versions of the MacOS this + * is no longer necessary, as we can use + * temporary memory which is freed by the + * OS after a quit or crash. */ + +static size_t tclExtraHdlSize = 0; /* Size of extra memory allocated at the start + * of each block when using memory tracking + * ( == 0 otherwise) */ /* * The following typedef and variable are used to keep track of memory @@ -59,10 +70,11 @@ static Handle toolGuardHandle = NULL; typedef struct listEl { Handle memoryHandle; struct listEl * next; + struct listEl * prec; } ListEl; -ListEl * systemMemory = NULL; -ListEl * appMemory = NULL; +static ListEl * systemMemory = NULL; +static ListEl * appMemory = NULL; /* * Prototypes for functions used only in this file. @@ -99,13 +111,28 @@ TclpSysRealloc( Handle hand; void *newPtr; int maxsize; + OSErr err; - hand = * (Handle *) ((Ptr) oldPtr - sizeof(Handle)); + if (tclUseMemTracking) { + hand = ((ListEl *) ((Ptr) oldPtr - tclExtraHdlSize))->memoryHandle; + } else { + hand = RecoverHandle((Ptr) oldPtr); + } maxsize = GetHandleSize(hand) - sizeof(Handle); if (maxsize < size) { + HUnlock(hand); + SetHandleSize(hand,size + tclExtraHdlSize); + err = MemError(); + HLock(hand); + if(err==noErr){ + newPtr=(*hand + tclExtraHdlSize); + } else { newPtr = TclpSysAlloc(size, 1); - memcpy(newPtr, oldPtr, maxsize); + if(newPtr!=NULL) { + memmove(newPtr, oldPtr, maxsize); TclpSysFree(oldPtr); + } + } } else { newPtr = oldPtr; } @@ -136,6 +163,31 @@ TclpSysAlloc( { Handle hand = NULL; ListEl * newMemoryRecord; + int isSysMem = 0; + static int initialized=0; + + if (!initialized) { + long response = 0; + OSErr err = noErr; + int useTempMem = 0; + + /* Check if we can use temporary memory */ + initialized=1; + err = Gestalt(gestaltOSAttr, &response); + if (err == noErr) { + useTempMem = response & (1 << gestaltRealTempMemory); + } + tclUseMemTracking = !useTempMem || (memoryFlags & MEMORY_DONT_USE_TEMPMEM); + if(tclUseMemTracking) { + tclExtraHdlSize = sizeof(ListEl); + /* + * We are allocating memory directly from the system + * heap. We need to install an exit handle + * to ensure the memory is cleaned up. + */ + TclMacInstallExitToShellPatch(CleanUpExitProc); + } + } if (!(memoryFlags & MEMORY_ALL_SYS)) { @@ -157,6 +209,7 @@ TclpSysAlloc( if (toolGuardHandle == NULL) { toolGuardHandle = NewHandle(TOOLBOX_SPACE); if (toolGuardHandle != NULL) { + HLock(toolGuardHandle); HPurge(toolGuardHandle); } } @@ -167,55 +220,55 @@ TclpSysAlloc( if (toolGuardHandle != NULL) { HLock(toolGuardHandle); - hand = NewHandle(size + sizeof(Handle)); + hand = NewHandle(size + tclExtraHdlSize); HUnlock(toolGuardHandle); } } - if (hand != NULL) { - newMemoryRecord = (ListEl *) NewPtr(sizeof(ListEl)); - if (newMemoryRecord == NULL) { - DisposeHandle(hand); - return NULL; - } - newMemoryRecord->memoryHandle = hand; - newMemoryRecord->next = appMemory; - appMemory = newMemoryRecord; - } else { + if (hand == NULL) { /* * Ran out of memory in application space. Lets try to get * more memory from system. Otherwise, we return NULL to * denote failure. */ + if(!tclUseMemTracking) { + /* Use Temporary Memory instead of System Heap when available */ + OSErr err; + isBin = 1; /* always HLockHi TempMemHandles */ + hand = TempNewHandle(size + tclExtraHdlSize,&err); + if(err!=noErr) { hand=NULL; } + } else { + /* Use system heap when tracking memory */ + isSysMem=1; isBin = 0; - hand = NewHandleSys(size + sizeof(Handle)); - if (hand == NULL) { - return NULL; + hand = NewHandleSys(size + tclExtraHdlSize); } - if (systemMemory == NULL) { - /* - * This is the first time we've attempted to allocate memory - * directly from the system heap. We need to now install the - * exit handle to ensure the memory is cleaned up. - */ - TclMacInstallExitToShellPatch(CleanUpExitProc); } - newMemoryRecord = (ListEl *) NewPtrSys(sizeof(ListEl)); - if (newMemoryRecord == NULL) { - DisposeHandle(hand); + if (hand == NULL) { return NULL; } - newMemoryRecord->memoryHandle = hand; - newMemoryRecord->next = systemMemory; - systemMemory = newMemoryRecord; - } if (isBin) { HLockHi(hand); } else { HLock(hand); } - (** (Handle **) hand) = hand; - - return (*hand + sizeof(Handle)); + if(tclUseMemTracking) { + /* Only need to do this when tracking memory */ + newMemoryRecord = (ListEl *) *hand; + newMemoryRecord->memoryHandle = hand; + newMemoryRecord->prec = NULL; + if(isSysMem) { + newMemoryRecord->next = systemMemory; + systemMemory = newMemoryRecord; + } else { + newMemoryRecord->next = appMemory; + appMemory = newMemoryRecord; + } + if(newMemoryRecord->next!=NULL) { + newMemoryRecord->next->prec=newMemoryRecord; + } + } + + return (*hand + tclExtraHdlSize); } /* @@ -238,13 +291,27 @@ void TclpSysFree( void * ptr) /* Free this system memory. */ { - Handle hand; - OSErr err; + if(tclUseMemTracking) { + /* Only need to do this when tracking memory */ + ListEl *memRecord; - hand = * (Handle *) ((Ptr) ptr - sizeof(Handle)); - DisposeHandle(hand); - *hand = NULL; - err = MemError(); + memRecord = (ListEl *) ((Ptr) ptr - tclExtraHdlSize); + /* Remove current record from linked list */ + if(memRecord->next!=NULL) { + memRecord->next->prec=memRecord->prec; + } + if(memRecord->prec!=NULL) { + memRecord->prec->next=memRecord->next; + } + if(memRecord==appMemory) { + appMemory=memRecord->next; + } else if(memRecord==systemMemory) { + systemMemory=memRecord->next; + } + DisposeHandle(memRecord->memoryHandle); + } else { + DisposeHandle(RecoverHandle((Ptr) ptr)); + } } /* @@ -271,13 +338,13 @@ CleanUpExitProc() { ListEl * memRecord; + if(tclUseMemTracking) { + /* Only need to do this when tracking memory */ while (systemMemory != NULL) { memRecord = systemMemory; systemMemory = memRecord->next; - if (*(memRecord->memoryHandle) != NULL) { - DisposeHandle(memRecord->memoryHandle); - } - DisposePtr((void *) memRecord); + DisposeHandle(memRecord->memoryHandle); + } } } @@ -304,21 +371,18 @@ FreeAllMemory() { ListEl * memRecord; + if(tclUseMemTracking) { + /* Only need to do this when tracking memory */ while (systemMemory != NULL) { memRecord = systemMemory; systemMemory = memRecord->next; - if (*(memRecord->memoryHandle) != NULL) { - DisposeHandle(memRecord->memoryHandle); - } - DisposePtr((void *) memRecord); + DisposeHandle(memRecord->memoryHandle); } while (appMemory != NULL) { memRecord = appMemory; appMemory = memRecord->next; - if (*(memRecord->memoryHandle) != NULL) { - DisposeHandle(memRecord->memoryHandle); - } - DisposePtr((void *) memRecord); + DisposeHandle(memRecord->memoryHandle); + } } } diff --git a/mac/tclMacAppInit.c b/mac/tclMacAppInit.c index 678198d..65f79e8 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.8 2001/06/17 03:48:19 dgp Exp $ + * RCS: @(#) $Id: tclMacAppInit.c,v 1.9 2001/11/23 01:27:13 das Exp $ */ #include "tcl.h" @@ -22,7 +22,7 @@ # include <console.h> #elif defined(__MWERKS__) # include <SIOUX.h> -short InstallConsole _ANSI_ARGS_((short fd)); +EXTERN short InstallConsole _ANSI_ARGS_((short fd)); #endif #ifdef TCL_TEST @@ -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 f69b3b6..c5b29a1 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 1999/08/16 00:09:09 jingham Exp $ + * RCS: @(#) $Id: tclMacApplication.r,v 1.4 2001/11/23 01:27:16 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 © Scriptics Inc" + 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 " © 1996-1997 Sun Microsystems, 1998-1999 Scriptics Inc" + "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 " © 1996-1999" + "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/tclMacChan.c b/mac/tclMacChan.c index e728c7f..fc5e914 100644 --- a/mac/tclMacChan.c +++ b/mac/tclMacChan.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: tclMacChan.c,v 1.7 2001/08/30 08:53:15 vincentdarley Exp $ + * RCS: @(#) $Id: tclMacChan.c,v 1.8 2001/11/23 01:27:21 das Exp $ */ #include "tclInt.h" @@ -136,7 +136,7 @@ static int StdReady _ANSI_ARGS_((ClientData instanceData, static Tcl_ChannelType consoleChannelType = { "file", /* Type name. */ - StdIOBlockMode, /* Set blocking/nonblocking mode.*/ + (Tcl_ChannelTypeVersion)StdIOBlockMode, /* Set blocking/nonblocking mode.*/ StdIOClose, /* Close proc. */ StdIOInput, /* Input proc. */ StdIOOutput, /* Output proc. */ @@ -153,7 +153,7 @@ static Tcl_ChannelType consoleChannelType = { static Tcl_ChannelType fileChannelType = { "file", /* Type name. */ - FileBlockMode, /* Set blocking or + (Tcl_ChannelTypeVersion)FileBlockMode, /* Set blocking or * non-blocking mode.*/ FileClose, /* Close proc. */ FileInput, /* Input proc. */ diff --git a/mac/tclMacCommonPch.h b/mac/tclMacCommonPch.h index b06a494..c0deb9d 100755 --- a/mac/tclMacCommonPch.h +++ b/mac/tclMacCommonPch.h @@ -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: tclMacCommonPch.h,v 1.2 1998/11/11 07:46:04 jingham Exp $ + * RCS: @(#) $Id: tclMacCommonPch.h,v 1.3 2001/11/23 01:27:24 das Exp $ */ #if !__option(enumsalwaysint) @@ -50,17 +50,6 @@ /* -* The following defines control the behavior of the Macintosh -* Universial Headers. -*/ - - -#define SystemSevenOrLater 1 -#define STRICT_CONTROLS 1 -#define STRICT_WINDOWS 1 - - -/* * Define the following symbol if you want * comprehensive debugging turned on. */ @@ -75,14 +64,8 @@ #endif - /* -* For a while, we will continue to use the old routine names, so that -* people with older versions of CodeWarrior will still be able to compile -* the source (albeit they will have to update the project files themselves). -* -* At some point, we will convert over to the new routine names. +* for Metrowerks Pro 6 MSL */ - -#define OLDROUTINENAMES 1 +#include <UseDLLPrefix.h> diff --git a/mac/tclMacFCmd.c b/mac/tclMacFCmd.c index ebc9319..ac28522 100644 --- a/mac/tclMacFCmd.c +++ b/mac/tclMacFCmd.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: tclMacFCmd.c,v 1.10 2001/08/30 08:53:15 vincentdarley Exp $ + * RCS: @(#) $Id: tclMacFCmd.c,v 1.11 2001/11/23 01:27:29 das Exp $ */ #include "tclInt.h" @@ -32,16 +32,16 @@ */ static int GetFileFinderAttributes _ANSI_ARGS_((Tcl_Interp *interp, - int objIndex, CONST char *fileName, + int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr)); static int GetFileReadOnly _ANSI_ARGS_((Tcl_Interp *interp, - int objIndex, CONST char *fileName, + int objIndex, Tcl_Obj *fileName, Tcl_Obj **readOnlyPtrPtr)); static int SetFileFinderAttributes _ANSI_ARGS_((Tcl_Interp *interp, - int objIndex, CONST char *fileName, + int objIndex, Tcl_Obj *fileName, Tcl_Obj *attributePtr)); static int SetFileReadOnly _ANSI_ARGS_((Tcl_Interp *interp, - int objIndex, CONST char *fileName, + int objIndex, Tcl_Obj *fileName, Tcl_Obj *readOnlyPtr)); /* @@ -716,7 +716,7 @@ DoCopyDirectory( err = FSpDirCreateCompat(&tmpDirSpec, smSystemScript, &tmpDirID); } if (err == noErr) { - err = FSpDirectoryCopy(&srcFileSpec, &tmpDirSpec, NULL, 0, true, + err = FSpDirectoryCopy(&srcFileSpec, &tmpDirSpec, NULL, NULL, 0, true, CopyErrHandler); } @@ -1157,18 +1157,17 @@ static int GetFileFinderAttributes( Tcl_Interp *interp, /* The interp to report errors with. */ int objIndex, /* The index of the attribute option. */ - CONST char *fileName, /* The name of the file (UTF-8). */ + Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */ { OSErr err; FSSpec fileSpec; FInfo finfo; - Tcl_DString pathString; + char *native; - Tcl_UtfToExternalDString(NULL, fileName, -1, &pathString); - err = FSpLocationFromPath(Tcl_DStringLength(&pathString), - Tcl_DStringValue(&pathString), &fileSpec); - Tcl_DStringFree(&pathString); + native=Tcl_FSGetNativePath(fileName); + err = FSpLocationFromPath(strlen(native), + native, &fileSpec); if (err == noErr) { err = FSpGetFInfo(&fileSpec, &finfo); @@ -1204,7 +1203,7 @@ GetFileFinderAttributes( if (err != noErr) { errno = TclMacOSErrorToPosixError(err); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), - "could not read \"", fileName, "\": ", + "could not read \"", Tcl_GetString(fileName), "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } @@ -1236,18 +1235,17 @@ static int GetFileReadOnly( Tcl_Interp *interp, /* The interp to report errors with. */ int objIndex, /* The index of the attribute. */ - CONST char *fileName, /* The name of the file (UTF-8). */ + Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj **readOnlyPtrPtr) /* A pointer to return the object with. */ { OSErr err; FSSpec fileSpec; CInfoPBRec paramBlock; - Tcl_DString pathString; + char *native; - Tcl_UtfToExternalDString(NULL, fileName, -1, &pathString); - err = FSpLocationFromPath(Tcl_DStringLength(&pathString), - Tcl_DStringValue(&pathString), &fileSpec); - Tcl_DStringFree(&pathString); + native=Tcl_FSGetNativePath(fileName); + err = FSpLocationFromPath(strlen(native), + native, &fileSpec); if (err == noErr) { if (err == noErr) { @@ -1273,7 +1271,7 @@ GetFileReadOnly( if (err != noErr) { errno = TclMacOSErrorToPosixError(err); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), - "could not read \"", fileName, "\": ", + "could not read \"", Tcl_GetString(fileName), "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } @@ -1301,18 +1299,17 @@ static int SetFileFinderAttributes( Tcl_Interp *interp, /* The interp to report errors with. */ int objIndex, /* The index of the attribute. */ - CONST char *fileName, /* The name of the file (UTF-8). */ + Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr) /* The command line object. */ { OSErr err; FSSpec fileSpec; FInfo finfo; - Tcl_DString pathString; + char *native; - Tcl_UtfToExternalDString(NULL, fileName, -1, &pathString); - err = FSpLocationFromPath(Tcl_DStringLength(&pathString), - Tcl_DStringValue(&pathString), &fileSpec); - Tcl_DStringFree(&pathString); + native=Tcl_FSGetNativePath(fileName); + err = FSpLocationFromPath(strlen(native), + native, &fileSpec); if (err == noErr) { err = FSpGetFInfo(&fileSpec, &finfo); @@ -1357,7 +1354,7 @@ SetFileFinderAttributes( Tcl_Obj *resultPtr = Tcl_GetObjResult(interp); Tcl_AppendStringsToObj(resultPtr, "cannot set ", tclpFileAttrStrings[objIndex], ": \"", - fileName, "\" is a directory", (char *) NULL); + Tcl_GetString(fileName), "\" is a directory", (char *) NULL); return TCL_ERROR; } } @@ -1365,7 +1362,7 @@ SetFileFinderAttributes( if (err != noErr) { errno = TclMacOSErrorToPosixError(err); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), - "could not read \"", fileName, "\": ", + "could not read \"", Tcl_GetString(fileName), "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } @@ -1393,19 +1390,18 @@ static int SetFileReadOnly( Tcl_Interp *interp, /* The interp to report errors with. */ int objIndex, /* The index of the attribute. */ - CONST char *fileName, /* The name of the file (UTF-8). */ + Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj *readOnlyPtr) /* The command line object. */ { OSErr err; FSSpec fileSpec; HParamBlockRec paramBlock; int hidden; - Tcl_DString pathString; + char *native; - Tcl_UtfToExternalDString(NULL, fileName, -1, &pathString); - err = FSpLocationFromPath(Tcl_DStringLength(&pathString), - Tcl_DStringValue(&pathString), &fileSpec); - Tcl_DStringFree(&pathString); + native=Tcl_FSGetNativePath(fileName); + err = FSpLocationFromPath(strlen(native), + native, &fileSpec); if (err == noErr) { if (Tcl_GetBooleanFromObj(interp, readOnlyPtr, &hidden) != TCL_OK) { @@ -1440,7 +1436,7 @@ SetFileReadOnly( if (err != noErr) { errno = TclMacOSErrorToPosixError(err); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), - "could not read \"", fileName, "\": ", + "could not read \"", Tcl_GetString(fileName), "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } @@ -1625,20 +1621,23 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint) Tcl_UtfToExternalDString(NULL,&path[lastCheckpoint], fileNameLen,&nativeds); fileNameLen=Tcl_DStringLength(&nativeds); - if(fileNameLen > MAXMACFILENAMELEN) - fileNameLen=MAXMACFILENAMELEN; + if(fileNameLen > MAXMACFILENAMELEN) { + err = bdNamErr; + } else { fileName[0]=fileNameLen; strncpy((char *) fileName + 1, Tcl_DStringValue(&nativeds), fileNameLen); + } Tcl_DStringFree(&nativeds); } + if(err == noErr) err=FSMakeFSSpecCompat(vRefNum, dirID, fileNamePtr, &fileSpec); if(err != noErr) { if(err != fnfErr) { /* - * this can if trying to get parent of a root + * this can occur if trying to get parent of a root * volume via '::' or when using an illegal - * filename revert to last checkpoint and stop + * filename; revert to last checkpoint and stop * processing path further */ err=FSMakeFSSpecCompat(vRefNum, dirID, NULL, &fileSpec); @@ -1687,11 +1686,11 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint) Tcl_ExternalToUtfDString(NULL,*newPathHandle,newPathLen,&nativeds); if (cur != 0) { /* not at end, append remaining path */ - if ( newPathLen==0 || *(*newPathHandle+(newPathLen-1))!=':') { + if ( newPathLen==0 || (*(*newPathHandle+(newPathLen-1))!=':' && path[nextCheckpoint] !=':')) { Tcl_DStringAppend(&nativeds, ":" , 1); } - Tcl_DStringAppend(&nativeds, &path[nextCheckpoint+1], - strlen(&path[nextCheckpoint+1])); + Tcl_DStringAppend(&nativeds, &path[nextCheckpoint], + strlen(&path[nextCheckpoint])); } DisposeHandle(newPathHandle); diff --git a/mac/tclMacFile.c b/mac/tclMacFile.c index cb85d59..0084da5 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.12 2001/08/30 08:53:15 vincentdarley Exp $ + * RCS: @(#) $Id: tclMacFile.c,v 1.13 2001/11/23 01:27:32 das Exp $ */ /* @@ -177,7 +177,7 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) */ Tcl_DStringFree(&dsOrig); Tcl_DStringAppend(&dsOrig, ":", 1); - Tcl_DStringAppend(&dsOrig, fileName2, -1); + Tcl_DStringAppend(&dsOrig, Tcl_GetString(fileNamePtr), -1); baseLength = Tcl_DStringLength(&dsOrig); Tcl_UtfToExternalDString(NULL, Tcl_DStringValue(&dsOrig), @@ -234,9 +234,9 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) &fileString); if (Tcl_StringMatch(Tcl_DStringValue(&fileString), pattern)) { int typeOk = 1; + Tcl_Obj *tempName; Tcl_DStringSetLength(&dsOrig, baseLength); Tcl_DStringAppend(&dsOrig, Tcl_DStringValue(&fileString), -1); - Tcl_Obj *tempName; fname = Tcl_DStringValue(&dsOrig); fnameLen = Tcl_DStringLength(&dsOrig); @@ -282,13 +282,10 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) } } if (typeOk == 1 && types->type != 0) { - if (types->perm == 0) { - /* We haven't yet done a stat on the file */ if (TclpObjStat(tempName, &buf) != 0) { /* Posix error occurred */ typeOk = 0; } - } if (typeOk) { /* * In order bcdpfls as in 'find -t' diff --git a/mac/tclMacInt.h b/mac/tclMacInt.h index 77d274c..ab7bc7f 100644 --- a/mac/tclMacInt.h +++ b/mac/tclMacInt.h @@ -8,24 +8,22 @@ * 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 1999/08/16 00:09:18 jingham Exp $ + * RCS: @(#) $Id: tclMacInt.h,v 1.7 2001/11/23 01:27:36 das Exp $ */ #ifndef _TCLMACINT #define _TCLMACINT -#ifndef _TCL -# include "tcl.h" +#ifndef _TCLINT +#include "tclInt.h" #endif -#ifndef _TCLMAC -# include "tclMac.h" +#ifndef _TCLPORT +#include "tclPort.h" #endif #include <Events.h> #include <Files.h> -#pragma export on - /* * Defines to control stack behavior. * @@ -46,6 +44,11 @@ #define TCL_MAC_STACK_THRESHOLD 16384 +#ifdef BUILD_tcl +# undef TCL_STORAGE_CLASS +# define TCL_STORAGE_CLASS DLLEXPORT +#endif + /* * This flag is passed to TclMacRegisterResourceFork * by a file (usually a library) whose resource fork @@ -63,12 +66,12 @@ */ 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 -#include "tclPort.h" -#include "tclPlatDecls.h" #include "tclIntPlatDecls.h" -#pragma export reset - #endif /* _TCLMACINT */ diff --git a/mac/tclMacLibrary.c b/mac/tclMacLibrary.c index 989329f..59d4612 100644 --- a/mac/tclMacLibrary.c +++ b/mac/tclMacLibrary.c @@ -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: tclMacLibrary.c,v 1.4 2000/02/10 09:59:10 jingham Exp $ + * RCS: @(#) $Id: tclMacLibrary.c,v 1.5 2001/11/23 01:27:39 das Exp $ */ /* @@ -26,6 +26,15 @@ #include <Strings.h> #include "tclMacInt.h" +#if defined(TCL_REGISTER_LIBRARY) && defined(USE_TCL_STUBS) +#error "Can't use TCL_REGISTER_LIBRARY and USE_TCL_STUBS at the same time!" +/* + * Can't register a library with Tcl when using stubs in the current + * implementation, since Tcl_InitStubs hasn't been called yet + * when OpenLibraryResource is executing. + */ +#endif + /* * These function are not currently defined in any header file. The * only place they should be used is in the Initialization and diff --git a/mac/tclMacLibrary.r b/mac/tclMacLibrary.r index c526f17..2468c98 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 1999/08/16 00:09:22 jingham Exp $ + * RCS: @(#) $Id: tclMacLibrary.r,v 1.5 2001/11/23 01:27:42 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 © Scriptics Inc." + 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 " © 1996-1997 Sun Microsystems, 1998-1999 Scriptics Inc." + "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 " © 1996-1999" + "Tcl Library " TCL_PATCH_LEVEL " © 1993-2001" }; /* @@ -125,24 +125,10 @@ resource 'kind' (TCL_LIBRARY_RESOURCES, "Tcl kind", purgeable) { resource 'STR ' (-16397, purgeable) { "Tcl Library\n\n" "This is the core library needed to run Tool Command Language programs. " - "To work properly, it should be placed in the ÔTool Command LanguageÕ folder " + "To work properly, it should be placed in the ŒTool Command Language¹ folder " "within the Extensions folder." }; -/* - * 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/tclMacLoad.c b/mac/tclMacLoad.c index f3419f2..8490fa9 100644 --- a/mac/tclMacLoad.c +++ b/mac/tclMacLoad.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: tclMacLoad.c,v 1.7 2001/09/28 01:21:53 dgp Exp $ + * RCS: @(#) $Id: tclMacLoad.c,v 1.8 2001/11/23 01:27:45 das Exp $ */ #include <CodeFragments.h> @@ -108,7 +108,7 @@ TclpLoadFile( Tcl_PackageInitProc **proc2Ptr, /* Where to return the addresses corresponding * to sym1 and sym2. */ - ClientData *clientDataPtr; /* Filled with token for dynamically loaded + ClientData *clientDataPtr, /* Filled with token for dynamically loaded * file which will be passed back to * (*unloadProcPtr)() to unload the file. */ Tcl_FSUnloadFileProc **unloadProcPtr) @@ -125,19 +125,11 @@ TclpLoadFile( Handle fragResource; UInt32 offset = 0; UInt32 length = kCFragGoesToEOF; - char packageName[255]; + StringPtr fragName=NULL; Str255 errName; + Tcl_DString ds; char *native; - /* - * First thing we must do is infer the package name from the sym1 - * variable. This is kind of dumb since the caller actually knows - * this value, it just doesn't give it to us. - */ - strcpy(packageName, sym1); - Tcl_UtfToLower(packageName); - *(Tcl_UtfAtIndex(packageName, Tcl_NumUtfChars(packageName, -1) - 5)) = 0; - native = Tcl_FSGetNativePath(pathPtr); err = FSpLocationFromPath(strlen(native), native, &fileSpec); @@ -147,6 +139,14 @@ TclpLoadFile( } /* + * First thing we must do is infer the package name from the sym1 + * variable. This is kind of dumb since the caller actually knows + * this value, it just doesn't give it to us. + */ + native = Tcl_UtfToExternalDString(NULL, sym1, -1, &ds); + native[strlen(native) - 5] = 0; + + /* * See if this fragment has a 'cfrg' resource. It will tell us where * to look for the fragment in the file. If it doesn't exist we will * assume we have a ppc frag using the whole data fork. If it does @@ -173,10 +173,11 @@ TclpLoadFile( index++, itemStart += srcItem->itemSize) { srcItem = (CfrgItem*)itemStart; if (srcItem->archType != OUR_ARCH_TYPE) continue; - if (!strncasecmp(packageName, (char *) srcItem->name + 1, - srcItem->name[0])) { + if (!strncasecmp(native, (char *) srcItem->name + 1, + strlen(native))) { offset = srcItem->codeOffset; length = srcItem->codeLength; + fragName=srcItem->name; } } } @@ -190,6 +191,7 @@ TclpLoadFile( CloseResFile(fragFileRef); UseResFile(saveFileRef); } + Tcl_DStringFree(&ds); /* * Now we can attempt to load the fragement using the offset & length @@ -197,9 +199,11 @@ TclpLoadFile( * as we are going to search for specific entry points passed to us. */ - c2pstr(packageName); - err = GetDiskFragment(&fileSpec, offset, length, (StringPtr) packageName, + err = GetDiskFragment(&fileSpec, offset, length, fragName, kLoadCFrag, &connID, &dummy, errName); + + *clientDataPtr = (ClientData) connID; + if (err != fragNoErr) { p2cstr(errName); Tcl_AppendResult(interp, "couldn't load file \"", @@ -208,9 +212,12 @@ TclpLoadFile( return TCL_ERROR; } - c2pstr(sym1); - err = FindSymbol(connID, (StringPtr) sym1, (Ptr *) proc1Ptr, &symClass); - p2cstr((StringPtr) sym1); + *unloadProcPtr = &TclpUnloadFile; + + native = Tcl_UtfToExternalDString(NULL, sym1, -1, &ds); + c2pstr(native); + err = FindSymbol(connID, (StringPtr) native, (Ptr *) proc1Ptr, &symClass); + Tcl_DStringFree(&ds); if (err != fragNoErr || symClass == kDataCFragSymbol) { Tcl_SetResult(interp, "could not find Initialization routine in library", @@ -218,16 +225,14 @@ TclpLoadFile( return TCL_ERROR; } - c2pstr(sym2); - err = FindSymbol(connID, (StringPtr) sym2, (Ptr *) proc2Ptr, &symClass); - p2cstr((StringPtr) sym2); + native = Tcl_UtfToExternalDString(NULL, sym2, -1, &ds); + c2pstr(native); + err = FindSymbol(connID, (StringPtr) native, (Ptr *) proc2Ptr, &symClass); + Tcl_DStringFree(&ds); if (err != fragNoErr || symClass == kDataCFragSymbol) { *proc2Ptr = NULL; } - *clientDataPtr = (ClientData) connID; - *unloadProcPtr = &TclpUnloadFile; - return TCL_OK; } @@ -256,6 +261,7 @@ TclpUnloadFile(clientData) * a token that represents the loaded * file. */ { + CloseConnection((CFragConnectionID*) &clientData); } /* diff --git a/mac/tclMacMSLPrefix.h b/mac/tclMacMSLPrefix.h deleted file mode 100644 index 1d11099..0000000 --- a/mac/tclMacMSLPrefix.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * tclMacMSLPrefix.h -- - * - * A wrapper for the MSL ansi_prefix.mac.h file. This just turns export on - * after including the MSL prefix file, so we can export symbols from the MSL - * and through the Tcl shared libraries - * - * - * Copyright (c) 1997 Sun Microsystems, Inc. - * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id: tclMacMSLPrefix.h,v 1.2 1998/09/14 18:40:05 stanton Exp $ - */ - -#include <ansi_prefix.mac.h> -/* - * "export" is a MetroWerks specific pragma. It flags the linker that - * any symbols that are defined when this pragma is on will be exported - * to shared libraries that link with this library. - */ - -#pragma export on diff --git a/mac/tclMacMath.h b/mac/tclMacMath.h index 14af9a8..6366dc3 100644 --- a/mac/tclMacMath.h +++ b/mac/tclMacMath.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: tclMacMath.h,v 1.2 1998/09/14 18:40:05 stanton Exp $ + * RCS: @(#) $Id: tclMacMath.h,v 1.3 2001/11/23 01:27:50 das Exp $ */ #ifndef _TCLMACMATH @@ -135,7 +135,7 @@ #endif #endif -#if (defined(THINK_C) || defined(__MWERKS__)) +#if (defined(THINK_C)) #pragma export on double hypotd(double x, double y); #define hypot hypotd diff --git a/mac/tclMacNotify.c b/mac/tclMacNotify.c index 50844cd..f27645e 100644 --- a/mac/tclMacNotify.c +++ b/mac/tclMacNotify.c @@ -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: tclMacNotify.c,v 1.7 2001/11/21 02:36:21 hobbs Exp $ + * RCS: @(#) $Id: tclMacNotify.c,v 1.8 2001/11/23 01:27:53 das Exp $ */ #include "tclInt.h" @@ -266,7 +266,7 @@ HandleMacEvents(void) * system event queue unless we call WaitNextEvent. */ - GetGlobalMouse(¤tMouse); + GetGlobalMouseTcl(¤tMouse); if ((notifier.eventProcPtr != NULL) && !EqualPt(currentMouse, notifier.lastMousePosition)) { notifier.lastMousePosition = currentMouse; @@ -296,7 +296,7 @@ HandleMacEvents(void) */ while (needsUpdate || (GetEvQHdr()->qHead != NULL)) { - GetGlobalMouse(¤tMouse); + GetGlobalMouseTcl(¤tMouse); SetRect(&mouseRect, currentMouse.h, currentMouse.v, currentMouse.h + 1, currentMouse.v + 1); RectRgn(notifier.utilityRgn, &mouseRect); @@ -481,7 +481,7 @@ Tcl_WaitForEvent( * the current mouse position. */ - GetGlobalMouse(¤tMouse); + GetGlobalMouseTcl(¤tMouse); SetRect(&mouseRect, currentMouse.h, currentMouse.v, currentMouse.h + 1, currentMouse.v + 1); RectRgn(notifier.utilityRgn, &mouseRect); diff --git a/mac/tclMacOSA.c b/mac/tclMacOSA.c index 5036a8e..dce052e 100644 --- a/mac/tclMacOSA.c +++ b/mac/tclMacOSA.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: tclMacOSA.c,v 1.6 1999/12/21 23:58:13 hobbs Exp $ + * RCS: @(#) $Id: tclMacOSA.c,v 1.7 2001/11/23 01:27:57 das Exp $ */ #define MAC_TCL @@ -2120,7 +2120,7 @@ tclOSAStore( return TCL_ERROR; } - FSpCreateResFileCompat(&fileSpec, + FSpCreateResFileCompatTcl(&fileSpec, 'WiSH', 'osas', smSystemScript); myErr = ResError(); @@ -2132,7 +2132,7 @@ tclOSAStore( goto rezEvalCleanUp; } - fileRef = FSpOpenResFileCompat(&fileSpec, fsRdWrPerm); + fileRef = FSpOpenResFileCompatTcl(&fileSpec, fsRdWrPerm); if (fileRef == -1) { Tcl_AppendResult(interp, "Error reading the file: \"", fileName, "\".", NULL); @@ -2307,7 +2307,7 @@ tclOSALoad( return TCL_ERROR; } - fileRef = FSpOpenResFileCompat(&fileSpec, fsRdPerm); + fileRef = FSpOpenResFileCompatTcl(&fileSpec, fsRdPerm); if (fileRef == -1) { Tcl_AppendResult(interp, "Error reading the file: \"", fileName, "\".", NULL); diff --git a/mac/tclMacOSA.exp b/mac/tclMacOSA.exp deleted file mode 100644 index 4cde512..0000000 --- a/mac/tclMacOSA.exp +++ /dev/null @@ -1 +0,0 @@ -Tclapplescript_Init diff --git a/mac/tclMacOSA.r b/mac/tclMacOSA.r index 7343764..ebbb0de 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 1999/08/16 00:09:26 jingham Exp $ + * RCS: @(#) $Id: tclMacOSA.r,v 1.4 2001/11/23 01:28:04 das Exp $ */ #include <Types.r> @@ -20,12 +20,12 @@ */ #define SCRIPT_MAJOR_VERSION 1 /* Major number */ -#define SCRIPT_MINOR_VERSION 0 /* Minor number */ -#define SCRIPT_RELEASE_SERIAL 2 /* Really minor number! */ -#define RELEASE_LEVEL alpha /* alpha, beta, or final */ -#define SCRIPT_VERSION "1.0" -#define SCRIPT_PATCH_LEVEL "1.0a2" -#define FINAL 0 /* Change to 1 if final version. */ +#define SCRIPT_MINOR_VERSION 1 /* Minor number */ +#define SCRIPT_RELEASE_SERIAL 0 /* Really minor number! */ +#define RELEASE_LEVEL final /* alpha, beta, or final */ +#define SCRIPT_VERSION "1.1" +#define SCRIPT_PATCH_LEVEL "1.1.0" +#define FINAL 1 /* Change to 1 if final version. */ #if FINAL # define MINOR_VERSION (SCRIPT_MINOR_VERSION * 16) + SCRIPT_RELEASE_SERIAL @@ -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" + 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-1999" + "Tclapplescript " SCRIPT_PATCH_LEVEL " © 1996-2001" }; /* @@ -60,7 +60,7 @@ resource 'STR ' (-16397, purgeable) { "TclAppleScript Library\n\n" "This library provides the ability to run AppleScript " " commands from Tcl/Tk programs. To work properly, it " - "should be placed in the ÔTool Command LanguageÕ folder " + "should be placed in the ŒTool Command Language¹ folder " "within the Extensions folder." }; @@ -71,6 +71,6 @@ resource 'STR ' (-16397, purgeable) { data 'TEXT' (4000,"pkgIndex",purgeable, preload) { "# Tcl package index file, version 1.0\n" - "package ifneeded Tclapplescript 1.0 [list tclPkgSetup $dir Tclapplescript 1.0 {{Tclapplescript" + "package ifneeded Tclapplescript 1.1 [list tclPkgSetup $dir Tclapplescript 1.1 {{Tclapplescript" ".shlb load AppleScript}}]\n" }; diff --git a/mac/tclMacPanic.c b/mac/tclMacPanic.c index 0987fa3..d916cab 100644 --- a/mac/tclMacPanic.c +++ b/mac/tclMacPanic.c @@ -11,12 +11,13 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacPanic.c,v 1.5 2001/06/17 03:48:19 dgp Exp $ + * RCS: @(#) $Id: tclMacPanic.c,v 1.6 2001/11/23 01:28:08 das Exp $ */ #include <Events.h> #include <Controls.h> +#include <ControlDefinitions.h> #include <Windows.h> #include <TextEdit.h> #include <Fonts.h> @@ -59,7 +60,7 @@ */ /* VARARGS ARGSUSED */ -static void +void TclpPanic TCL_VARARGS_DEF(CONST char *, format) { va_list varg; @@ -128,7 +129,7 @@ TclpPanic TCL_VARARGS_DEF(CONST char *, format) part = FindControl(event.where, macWinPtr, &okButtonHandle); - if ((inButton == part) && + if ((kControlButtonPart == part) && (TrackControl(okButtonHandle, event.where, NULL))) { done = true; @@ -152,7 +153,7 @@ TclpPanic TCL_VARARGS_DEF(CONST char *, format) if (stopIconHandle != NULL) { PlotIcon(&iconRect, stopIconHandle); } - TextBox(msg, strlen(msg), &textRect, teFlushDefault); + TETextBox(msg, strlen(msg), &textRect, teFlushDefault); DrawControls(macWinPtr); EndUpdate(macWinPtr); } @@ -169,130 +170,3 @@ TclpPanic TCL_VARARGS_DEF(CONST char *, format) #endif } -/* - * NOTE: The rest of this file is *identical* to the file - * generic/tclPanic.c. Someone with the right set of development tools on - * the Mac should be able to build the Tcl library using that file, and - * remove the rest of this one. - */ - -#include "tclInt.h" -#include "tclPort.h" - -/* - * The panicProc variable contains a pointer to an application - * specific panic procedure. - */ - -static Tcl_PanicProc *panicProc = NULL; - -/* - * The platformPanicProc variable contains a pointer to a platform - * specific panic procedure, if any. ( TclpPanic may be NULL via - * a macro. ) - */ - -static Tcl_PanicProc * CONST platformPanicProc = TclpPanic; - - -/* - *---------------------------------------------------------------------- - * - * Tcl_SetPanicProc -- - * - * Replace the default panic behavior with the specified functiion. - * - * Results: - * None. - * - * Side effects: - * Sets the panicProc variable. - * - *---------------------------------------------------------------------- - */ - -void -Tcl_SetPanicProc(proc) - Tcl_PanicProc *proc; -{ - panicProc = proc; -} - -/* - *---------------------------------------------------------------------- - * - * Tcl_PanicVA -- - * - * Print an error message and kill the process. - * - * Results: - * None. - * - * Side effects: - * The process dies, entering the debugger if possible. - * - *---------------------------------------------------------------------- - */ - -void -Tcl_PanicVA (format, argList) - CONST char *format; /* Format string, suitable for passing to - * fprintf. */ - va_list argList; /* Variable argument list. */ -{ - char *arg1, *arg2, *arg3, *arg4; /* Additional arguments (variable in - * number) to pass to fprintf. */ - char *arg5, *arg6, *arg7, *arg8; - - arg1 = va_arg(argList, char *); - arg2 = va_arg(argList, char *); - arg3 = va_arg(argList, char *); - arg4 = va_arg(argList, char *); - arg5 = va_arg(argList, char *); - arg6 = va_arg(argList, char *); - arg7 = va_arg(argList, char *); - arg8 = va_arg(argList, char *); - - if (panicProc != NULL) { - (void) (*panicProc)(format, arg1, arg2, arg3, arg4, - arg5, arg6, arg7, arg8); - } else if (platformPanicProc != NULL) { - (void) (*platformPanicProc)(format, arg1, arg2, arg3, arg4, - arg5, arg6, arg7, arg8); - } else { - (void) fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, arg6, - arg7, arg8); - (void) fprintf(stderr, "\n"); - (void) fflush(stderr); - abort(); - } -} - -/* - *---------------------------------------------------------------------- - * - * Tcl_Panic -- - * - * Print an error message and kill the process. - * - * Results: - * None. - * - * Side effects: - * The process dies, entering the debugger if possible. - * - *---------------------------------------------------------------------- - */ - - /* VARARGS ARGSUSED */ -void -Tcl_Panic TCL_VARARGS_DEF(CONST char *,arg1) -{ - va_list argList; - CONST char *format; - - format = TCL_VARARGS_START(CONST char *,arg1,argList); - Tcl_PanicVA(format, argList); - va_end (argList); -} - diff --git a/mac/tclMacPort.h b/mac/tclMacPort.h index 142a570..abc30aa 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.13 2001/08/30 08:53:15 vincentdarley Exp $ + * RCS: @(#) $Id: tclMacPort.h,v 1.14 2001/11/23 01:28:12 das Exp $ */ @@ -55,7 +55,7 @@ * However, MetroWerks has screwed that file up a couple of times * and all we need are the defines. */ - +#ifndef _FCNTL # define O_RDWR 0x0 /* open the file in read/write mode */ # define O_RDONLY 0x1 /* open the file in read only mode */ # define O_WRONLY 0x2 /* open the file in write only mode */ @@ -63,7 +63,7 @@ # define O_CREAT 0x0200 /* create the file if it doesn't exist */ # define O_EXCL 0x0400 /* if the file exists don't create it again */ # define O_TRUNC 0x0800 /* truncate the file after opening it */ - +#endif /* * MetroWerks stat.h file is rather weak. The defines * after the include are needed to fill in the missing @@ -98,6 +98,7 @@ # define S_IXOTH 00001 /* execute permission: other */ # endif +#if __MSL__ < 0x6000 # define isatty(arg) 1 /* @@ -109,6 +110,7 @@ # define X_OK 0x01 /* test for execute or search permission */ # define W_OK 0x02 /* test for write permission */ # define R_OK 0x04 /* test for read permission */ +#endif #endif /* __MWERKS__ */ @@ -148,6 +150,11 @@ #define WTERMSIG(status) (1) #define WSTOPSIG(status) (1) +#ifdef BUILD_tcl +# undef TCL_STORAGE_CLASS +# define TCL_STORAGE_CLASS DLLEXPORT +#endif + /* * Make sure that MAXPATHLEN is defined. */ @@ -205,15 +212,14 @@ 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 * */ @@ -296,9 +302,11 @@ typedef int TclpMutex; #endif /* TCL_THREADS */ typedef pascal void (*ExitToShellProcPtr)(void); -#include "tclMac.h" -#include "tclMacInt.h" -/* #include "tclPlatDecls.h" - #include "tclIntPlatDecls.h" */ + +#include "tclMac.h" // contains #include "tclPlatDecls.h" +#include "tclIntPlatDecls.h" + +# undef TCL_STORAGE_CLASS +# define TCL_STORAGE_CLASS DLLIMPORT #endif /* _MACPORT */ diff --git a/mac/tclMacResource.r b/mac/tclMacResource.r index acfae99..b022078 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 1999/08/16 00:09:30 jingham Exp $ + * RCS: @(#) $Id: tclMacResource.r,v 1.5 2001/11/23 01:28:26 das Exp $ */ #include <Types.r> @@ -40,20 +40,6 @@ # define MINOR_VERSION TCL_MINOR_VERSION * 16 #endif -resource 'vers' (1) { - TCL_MAJOR_VERSION, MINOR_VERSION, - RELEASE_LEVEL, 0x00, verUS, - TCL_PATCH_LEVEL, - TCL_PATCH_LEVEL ", by Ray Johnson & Jim Ingham © Scriptics Inc." -}; - -resource 'vers' (2) { - TCL_MAJOR_VERSION, MINOR_VERSION, - RELEASE_LEVEL, 0x00, verUS, - TCL_PATCH_LEVEL, - "Simple Tcl Shell " TCL_PATCH_LEVEL " © 1996 - 1999" -}; - /* * The mechanisim below loads Tcl source into the resource fork of the @@ -69,22 +55,3 @@ resource 'vers' (2) { #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" - }; -}; - diff --git a/mac/tclMacShLib.exp b/mac/tclMacShLib.exp deleted file mode 100644 index 9689ccd..0000000 --- a/mac/tclMacShLib.exp +++ /dev/null @@ -1,1063 +0,0 @@ -AddrToName -AddrToStr -BuildAFPVolMountInfo -BumpDate -ChangeCreatorType -ChangeFDFlags -CheckObjectLock -CheckVolLock -ClearHasBeenInited -ClearHasCustomIcon -ClearIsInvisible -ClearIsStationery -ClearNameLocked -CloseResolver -ConfigureMemory -CopyDirectoryAccess -CopyFileMgrAttributes -CopyFork -CreateFileIDRef -DTCopyComment -DTGetIcon -DTOpen -DTSetComment -DeleteDirectory -DeleteDirectoryContents -DeleteFileIDRef -DetermineVRefNum -DirectoryCopy -EnumCache -##EnvStr -ExchangeFiles -FSMakeFSSpecCompat -FSReadNoCache -FSWriteNoCache -FSWriteVerify -FSpBumpDate -FSpCatMoveCompat -FSpChangeCreatorType -FSpChangeFDFlags -FSpCheckObjectLock -FSpClearHasBeenInited -FSpClearHasCustomIcon -FSpClearIsInvisible -FSpClearIsStationery -FSpClearNameLocked -FSpCopyDirectoryAccess -FSpCopyFile -FSpCopyFileMgrAttributes -FSpCreateCompat -FSpCreateFileIDRef -FSpCreateMinimum -FSpCreateResFileCompat -FSpDTCopyComment -FSpDTSetComment -FSpDeleteCompat -FSpDirCreateCompat -FSpDirectoryCopy -FSpExchangeFilesCompat -FSpFileCopy -FSpFilteredDirectoryCopy -FSpFindFolder -FSpGetDInfo -FSpGetDefaultDir -FSpGetDirAccess -FSpGetDirectoryID -FSpGetFInfoCompat -FSpGetFLockCompat -FSpGetFileLocation -FSpGetFileSize -FSpGetForeignPrivs -FSpGetFullPath -FSpGetIOACUser -FSpLocationFromFullPath -FSpLocationFromPath -FSpMoveRename -FSpMoveRenameCompat -FSpOpenAware -FSpOpenDFCompat -FSpOpenRFAware -FSpOpenRFCompat -FSpOpenResFileCompat -FSpPathFromLocation -FSpRenameCompat -FSpResolveFileIDRef -FSpRstFLockCompat -FSpSetDInfo -FSpSetDefaultDir -FSpSetDirAccess -FSpSetFInfoCompat -FSpSetFLockCompat -FSpSetForeignPrivs -FSpSetHasCustomIcon -FSpSetIsInvisible -FSpSetIsStationery -FSpSetNameLocked -FSpShare -FSpUnshare -FileCopy -FilteredDirectoryCopy -FindDrive -FlushFile -FreeAllMemory -GetCPanelFolder -GetCatInfoNoName -GetDInfo -GetDirItems -GetDirName -GetDirectoryID -GetDiskBlocks -GetDriverName -GetFileLocation -GetFileSize -GetFilenameFromPathname -GetForeignPrivs -GetFullPath -GetGlobalMouse -GetIOACUser -GetObjectLocation -GetParentID -GetSystemFolder -GetTempBuffer -GetTrapType -GetUGEntries -GetUGEntry -GetVolMountInfo -GetVolMountInfoSize -GetVolumeInfoNoName -HCopyFile -HCreateMinimum -HGetDirAccess -HGetLogInInfo -HGetVInfo -HGetVolParms -HInfo -HMapID -HMapName -HMoveRename -HMoveRenameCompat -HOpenAware -HOpenRFAware -hypotd -HSetDirAccess -InstallConsole -LocationFromFullPath -LockRange -MXInfo -NumToolboxTraps -OnLine -OpenOurRF -OpenResolver -PBXGetVolInfoSync -ReadCharsFromConsole -RemoveConsole -ResolveFileIDRef -RestoreDefault -RetrieveAFPVolMountInfo -SIOUXBigRect -SIOUXCantSaveAlert -SIOUXDoAboutBox -SIOUXDoContentClick -SIOUXDoEditClear -SIOUXDoEditCopy -SIOUXDoEditCut -SIOUXDoEditPaste -SIOUXDoEditSelectAll -SIOUXDoMenuChoice -SIOUXDoPageSetup -SIOUXDoPrintText -SIOUXDoSaveText -SIOUXDragRect -SIOUXDrawGrowBox -SIOUXHandleOneEvent -SIOUXIsAppWindow -SIOUXMyGrowWindow -SIOUXQuitting -SIOUXSetTitle -SIOUXSettings -SIOUXSetupMenus -SIOUXSetupTextWindow -SIOUXState -SIOUXTextWindow -SIOUXUpdateMenuItems -SIOUXUpdateScrollbar -SIOUXUpdateStatusLine -SIOUXUpdateWindow -SIOUXUseWaitNextEvent -SIOUXYesNoCancelAlert -SIOUXisinrange -SIOUXselstart -SearchFolderForDNRP -SetDInfo -SetDefault -SetForeignPrivs -SetHasCustomIcon -SetIsInvisible -SetIsStationery -SetNameLocked -Share -StrToAddr -TclAllocateFreeObjects -TclChdir -TclCleanupByteCode -TclCleanupCommand -TclCompileBreakCmd -TclCompileCatchCmd -TclCompileContinueCmd -TclCompileDollarVar -TclCompileExpr -TclCompileExprCmd -TclCompileForCmd -TclCompileForeachCmd -TclCompileIfCmd -TclCompileIncrCmd -TclCompileQuotes -TclCompileSetCmd -TclCompileString -TclCompileWhileCmd -TclCopyAndCollapse -TclCopyChannel -TclCreateAuxData -TclCreateExecEnv -TclDate_TclDates -TclDate_TclDatev -TclDateact -TclDatechar -TclDatechk -TclDatedebug -TclDatedef -TclDateerrflag -TclDateexca -TclDatelval -TclDatenerrs -TclDatepact -TclDateparse -TclDatepgo -TclDateps -TclDatepv -TclDater1 -TclDater2 -TclDates -TclDatestate -TclDatetmp -TclDatev -TclDateval -TclDeleteCompiledLocalVars -TclDeleteExecEnv -TclDeleteVars -TclDoGlob -TclEmitForwardJump -TclExecuteByteCode -TclExpandCodeArray -TclExpandJumpFixupArray -TclExprFloatError -TclFileAttrsCmd -TclFileCopyCmd -TclFileDeleteCmd -TclFileMakeDirsCmd -TclFileRenameCmd -TclFindElement -TclFindProc -TclFixupForwardJump -TclFormatInt -TclFreeCompileEnv -TclFreeJumpFixupArray -TclFreeObj -TclFreePackageInfo -TclGetCwd -TclGetDate -TclGetDefaultStdChannel -TclGetElementOfIndexedArray -TclGetEnv -TclGetExceptionRangeForPc -TclGetExtension -TclGetFrame -TclGetIndexedScalar -TclGetIntForIndex -TclGetLoadedPackages -TclGetLong -TclGetNamespaceForQualName -TclGetOpenMode -TclGetOriginalCommand -TclGetRegError -TclGetSrcInfoForPc -TclGetUserHome -TclGlobalInvoke -TclGuessPackageName -TclHasSockets -TclHideUnsafeCommands -TclInExit -TclIncrElementOfIndexedArray -TclIncrIndexedScalar -TclIncrVar2 -TclInitByteCodeObj -TclInitCompileEnv -TclInitJumpFixupArray -TclInitNamespaces -TclInterpInit -TclInvoke -TclInvokeObjectCommand -TclInvokeStringCommand -TclIsProc -TclLoadFile -TclLooksLikeInt -TclLookupVar -TclMacCreateEnv -TclMacExitHandler -TclMacFOpenHack -TclMacInitExitToShell -TclMacInstallExitToShellPatch -TclMacOSErrorToPosixError -TclMacReadlink -TclMacRemoveTimer -TclMacStartTimer -TclMacTimerExpired -TclMatchFiles -TclNeedSpace -TclObjIndexForString -TclObjInterpProc -TclObjInvoke -TclObjInvokeGlobal -TclPlatformExit -TclPlatformInit -TclPreventAliasLoop -TclPrintByteCodeObj -TclPrintInstruction -TclPrintSource -TclRegComp -TclRegError -TclRegExec -TclRenameCommand -TclResetShadowedCmdRefs -TclServiceIdle -TclSetElementOfIndexedArray -TclSetEnv -TclSetIndexedScalar -TclSetupEnv -TclSockGetPort -TclTeardownNamespace -TclTestChannelCmd -TclTestChannelEventCmd -TclUnsetEnv -TclUpdateReturnInfo -TclWordEnd -Tcl_AddErrorInfo -Tcl_AddObjErrorInfo -Tcl_AfterCmd -Tcl_Alloc -Tcl_AllowExceptions -Tcl_AppendAllObjTypes -Tcl_AppendElement -Tcl_AppendObjCmd -Tcl_AppendResult -Tcl_AppendStringsToObj -Tcl_AppendToObj -Tcl_ArrayObjCmd -Tcl_AsyncCreate -Tcl_AsyncDelete -Tcl_AsyncInvoke -Tcl_AsyncMark -Tcl_AsyncReady -Tcl_BackgroundError -Tcl_Backslash -Tcl_BeepObjCmd -Tcl_BinaryObjCmd -Tcl_BreakCmd -Tcl_CallWhenDeleted -Tcl_CancelIdleCall -Tcl_CaseObjCmd -Tcl_CatchObjCmd -Tcl_ClockObjCmd -Tcl_Close -Tcl_CommandComplete -Tcl_Concat -Tcl_ConcatObj -Tcl_ConcatObjCmd -Tcl_ContinueCmd -Tcl_ConvertCountedElement -Tcl_ConvertElement -Tcl_ConvertToType -Tcl_CreateAlias -Tcl_CreateAliasObj -Tcl_CreateChannel -Tcl_CreateChannelHandler -Tcl_CreateCloseHandler -Tcl_CreateCommand -Tcl_CreateEventSource -Tcl_CreateExitHandler -Tcl_CreateInterp -Tcl_CreateMathFunc -Tcl_CreateNamespace -Tcl_CreateObjCommand -Tcl_CreateSlave -Tcl_CreateTimerHandler -Tcl_CreateTrace -Tcl_DStringAppend -Tcl_DStringAppendElement -Tcl_DStringEndSublist -Tcl_DStringFree -Tcl_DStringGetResult -Tcl_DStringInit -Tcl_DStringResult -Tcl_DStringSetLength -Tcl_DStringStartSublist -Tcl_DbCkalloc -Tcl_DbCkfree -Tcl_DbCkrealloc -Tcl_DbDecrRefCount -Tcl_DbIsShared -Tcl_DbIncrRefCount -Tcl_DbNewBooleanObj -Tcl_DbNewDoubleObj -Tcl_DbNewListObj -Tcl_DbNewLongObj -Tcl_DbNewObj -Tcl_DbNewStringObj -Tcl_DeleteAssocData -Tcl_DeleteChannelHandler -Tcl_DeleteCloseHandler -Tcl_DeleteCommand -Tcl_DeleteCommandFromToken -Tcl_DeleteEventSource -Tcl_DeleteEvents -Tcl_DeleteExitHandler -Tcl_DeleteHashEntry -Tcl_DeleteHashTable -Tcl_DeleteInterp -Tcl_DeleteNamespace -Tcl_DeleteTimerHandler -Tcl_DeleteTrace -Tcl_DoOneEvent -Tcl_DoWhenIdle -Tcl_DontCallWhenDeleted -Tcl_DumpActiveMemory -Tcl_DuplicateObj -Tcl_EchoCmd -Tcl_Eof -Tcl_ErrnoId -Tcl_ErrnoMsg -Tcl_ErrorObjCmd -Tcl_Eval -Tcl_EvalFile -Tcl_EvalObj -Tcl_EvalObjCmd -Tcl_EventuallyFree -Tcl_ExecCmd -Tcl_Exit -Tcl_ExitObjCmd -Tcl_ExposeCommand -Tcl_ExprBoolean -Tcl_ExprBooleanObj -Tcl_ExprDouble -Tcl_ExprDoubleObj -Tcl_ExprLong -Tcl_ExprLongObj -Tcl_ExprObjCmd -Tcl_ExprString -Tcl_FconfigureCmd -Tcl_FcopyObjCmd -Tcl_FileEventCmd -Tcl_FileObjCmd -Tcl_Finalize -Tcl_FindCommand -Tcl_FindExecutable -Tcl_FindNamespace -Tcl_FindNamespaceVar -Tcl_FirstHashEntry -Tcl_Flush -Tcl_FlushObjCmd -Tcl_ForCmd -Tcl_ForeachObjCmd -Tcl_ForgetImport -Tcl_FormatCmd -Tcl_Free -Tcl_FreeResult -Tcl_GetAlias -Tcl_GetAliasObj -Tcl_GetAssocData -Tcl_GetBoolean -Tcl_GetBooleanFromObj -Tcl_GetChannel -Tcl_GetChannelBufferSize -Tcl_GetChannelHandle -Tcl_GetChannelInstanceData -Tcl_GetChannelMode -Tcl_GetChannelName -Tcl_GetChannelOption -Tcl_GetChannelType -Tcl_GetCommandFromObj -Tcl_GetCommandFullName -Tcl_GetCommandInfo -Tcl_GetCommandName -Tcl_GetCurrentNamespace -Tcl_GetDouble -Tcl_GetDoubleFromObj -Tcl_GetErrno -Tcl_GetGlobalNamespace -Tcl_GetHostName -Tcl_GetIndexFromObj -Tcl_GetInt -Tcl_GetIntFromObj -Tcl_GetInterpPath -Tcl_GetLongFromObj -Tcl_GetMaster -Tcl_GetOSTypeFromObj -Tcl_GetObjResult -Tcl_GetObjType -Tcl_GetPathType -Tcl_GetServiceMode -Tcl_GetSlave -Tcl_GetStdChannel -Tcl_GetStringFromObj -Tcl_GetStringResult -Tcl_GetTime -Tcl_GetVar -Tcl_GetVar2 -Tcl_GetVariableFullName -Tcl_Gets -Tcl_GetsObj -Tcl_GetsObjCmd -Tcl_GlobCmd -Tcl_GlobalEval -Tcl_GlobalEvalObj -Tcl_GlobalObjCmd -Tcl_HashStats -Tcl_HideCommand -Tcl_IfCmd -Tcl_Import -Tcl_IncrCmd -Tcl_InfoObjCmd -Tcl_Init -Tcl_InitHashTable -Tcl_InitMemory -Tcl_InputBlocked -Tcl_InputBuffered -Tcl_InterpDeleted -Tcl_InterpObjCmd -Tcl_IsSafe -Tcl_JoinObjCmd -Tcl_JoinPath -Tcl_LappendObjCmd -Tcl_LindexObjCmd -Tcl_LinkVar -Tcl_LinsertObjCmd -Tcl_ListObjAppendElement -Tcl_ListObjAppendList -Tcl_ListObjCmd -Tcl_ListObjGetElements -Tcl_ListObjIndex -Tcl_ListObjLength -Tcl_ListObjReplace -Tcl_LlengthObjCmd -Tcl_LoadCmd -Tcl_LrangeObjCmd -Tcl_LreplaceObjCmd -Tcl_LsCmd -Tcl_LsearchObjCmd -Tcl_LsortObjCmd -Tcl_MacConvertTextResource -Tcl_MacEvalResource -Tcl_MacFindResource -Tcl_MacSetEventProc -Tcl_MacSourceObjCmd -Tcl_Main -Tcl_MakeSafe -Tcl_MakeTcpClientChannel -Tcl_Merge -Tcl_NamespaceObjCmd -Tcl_NewBooleanObj -Tcl_NewDoubleObj -Tcl_NewIntObj -Tcl_NewListObj -Tcl_NewLongObj -Tcl_NewOSTypeObj -Tcl_NewObj -Tcl_NewStringObj -Tcl_NextHashEntry -Tcl_NotifyChannel -Tcl_ObjGetVar2 -Tcl_ObjSetVar2 -Tcl_OpenCmd -Tcl_OpenFileChannel -Tcl_OpenTcpClient -Tcl_OpenTcpServer -Tcl_PackageCmd -Tcl_ParseVar -Tcl_PidObjCmd -Tcl_PkgProvide -Tcl_PkgRequire -Tcl_PopCallFrame -Tcl_PosixError -Tcl_Preserve -Tcl_PrintDouble -Tcl_ProcObjCmd -Tcl_PushCallFrame -Tcl_PutEnv -Tcl_PutsObjCmd -Tcl_PwdCmd -Tcl_QueueEvent -Tcl_Read -Tcl_ReadObjCmd -Tcl_Realloc -Tcl_RecordAndEval -Tcl_RegExpCompile -Tcl_RegExpExec -Tcl_RegExpMatch -Tcl_RegExpRange -Tcl_RegexpCmd -Tcl_RegisterChannel -Tcl_RegisterObjType -Tcl_RegsubCmd -Tcl_Release -Tcl_RenameObjCmd -Tcl_ResetResult -Tcl_ResourceObjCmd -Tcl_ReturnObjCmd -Tcl_ScanCmd -Tcl_ScanCountedElement -Tcl_ScanElement -Tcl_Seek -Tcl_SeekCmd -Tcl_ServiceAll -Tcl_ServiceEvent -Tcl_SetAssocData -Tcl_SetBooleanObj -Tcl_SetChannelBufferSize -Tcl_SetChannelOption -Tcl_SetCmd -Tcl_SetCommandInfo -Tcl_SetDoubleObj -Tcl_SetErrno -Tcl_SetErrorCode -Tcl_SetIntObj -Tcl_SetListObj -Tcl_SetLongObj -Tcl_SetMaxBlockTime -Tcl_SetOSTypeObj -Tcl_SetObjErrorCode -Tcl_SetObjLength -Tcl_SetObjResult -Tcl_SetPanicProc -Tcl_SetRecursionLimit -Tcl_SetResult -Tcl_SetServiceMode -Tcl_SetStdChannel -Tcl_SetStringObj -Tcl_SetTimer -Tcl_SetVar -Tcl_SetVar2 -Tcl_SignalId -Tcl_SignalMsg -Tcl_Sleep -Tcl_SocketCmd -Tcl_SourceObjCmd -Tcl_SourceRCFile -Tcl_SplitList -Tcl_SplitPath -Tcl_StaticPackage -Tcl_StringMatch -Tcl_StringObjCmd -Tcl_SubstCmd -Tcl_SwitchObjCmd -Tcl_Tell -Tcl_TellCmd -Tcl_TimeObjCmd -Tcl_TraceCmd -Tcl_TraceVar -Tcl_TraceVar2 -Tcl_TranslateFileName -Tcl_Ungets -Tcl_UnlinkVar -Tcl_UnregisterChannel -Tcl_UnsetObjCmd -Tcl_UnsetVar -Tcl_UnsetVar2 -Tcl_UntraceVar -Tcl_UntraceVar2 -Tcl_UpVar -Tcl_UpVar2 -Tcl_UpdateCmd -Tcl_UpdateLinkedVar -Tcl_UplevelObjCmd -Tcl_UpvarObjCmd -Tcl_ValidateAllMemory -Tcl_VarEval -Tcl_VarTraceInfo -Tcl_VarTraceInfo2 -Tcl_VariableObjCmd -Tcl_VwaitCmd -Tcl_WaitForEvent -Tcl_WaitPid -Tcl_WhileCmd -Tcl_Write -Tcl_WrongNumArgs -TclpAlloc -TclpCopyDirectory -TclpCopyFile -TclpCreateDirectory -TclpDeleteFile -TclpFree -TclpGetClicks -TclpGetDate -TclpGetSeconds -TclpGetTime -TclpGetTimeZone -TclpListVolumes -TclpRealloc -TclpRemoveDirectory -TclpRenameFile -TrapExists -TruncPString -UnlockRange -UnmountAndEject -Unshare -VolumeMount -WriteCharsToConsole -XGetVInfo -_Ctype -_Stderr -_Stoul -abort -abs -acosf -appMemory -asctime -asinf -atan -atan2 -atan2_d_dd -atan2_d_pdpd -atan2_r_prpr -atan2_r_rr -atan2f -atan_d_d -atan_d_pd -atan_r_pr -atan_r_r -atanf -atexit -atof -atoi -atol -bsearch -builtinFuncTable -calloc -ccommand -ceilf -chdir -clearerr -clock -close -closeUPP -completeUPP -cos -cos_d_d -cos_d_pd -cos_r_pr -cos_r_r -cosf -coshf -creat -ctime -cuserid -difftime -div -environ -errno -exec -exit -exp -exp_d_d -exp_d_pd -exp_r_pr -exp_r_r -expf -fabsf -fclose -fcntl -fdopen -feof -ferror -fflush -fgetc -fgetpos -fgets -fileno -floorf -fmodf -fopen -fprintf -fputc -fputs -fread -free -freopen -frexpf -fscanf -fseek -fsetpos -fstat -ftell -fwrite -getStdChannelsProc -getc -getchar -getcwd -getenv -getlogin -gets -gmtime -instructionTable -isalnum -isalpha -isatty -iscntrl -isdigit -isgraph -islower -isprint -ispunct -isspace -isupper -isxdigit -labs -ldexpf -ldiv -localeconv -localtime -log -log10 -log10_d_d -log10_d_pd -log10f -log_d_d -log_d_pd -logf -longjmp -lseek -malloc -mblen -mbstowcs -mbtowc -memchr -memcmp -memcpy -memmove -memset -mkdir -mktime -open -panic -panicProc -perror -pow -power_d_dd -powf -printf -putc -putchar -puts -qsort -raise -rand -read -realloc -remove -rename -resultUPP -rewind -rmdir -scanf -setbuf -setlocale -setvbuf -signal -sin -sin_d_d -sin_d_pd -sin_r_pr -sin_r_r -sinf -sinhf -sleep -sprintf -sqrt -sqrt_d_d -sqrt_d_pd -sqrt_r_pr -sqrt_r_r -sqrtf -srand -sscanf -stat -strcasecmp -strcat -strchr -strcmp -strcoll -strcpy -strcspn -strerror -strftime -strlen -strncasecmp -strncat -strncmp -strncpy -strpbrk -strrchr -strspn -strstr -strtod -strtok -strtol -strtoul -strxfrm -system -systemMemory -tanf -tanhf -tclBooleanType -tclByteCodeType -tclCmdNameType -tclDoubleType -tclDummyLinkVarPtr -tclExecutableName -tclFreeObjList -tclIndexType -tclIntType -tclListType -tclMemDumpFileName -tclNsNameType -tclPlatform -tclStringType -tclTraceCompile -tclTraceExec -tclTypeTable -tcl_MathInProgress -tclpFileAttrProcs -tclpFileAttrStrings -tell -time -tmpfile -tmpnam -tolower -toupper -ttyname -uname -ungetc -unlink -utime -utimes -vfprintf -vprintf -vsprintf -wcstombs -wctob -wctomb -write -#DTGetAPPL -#DTGetComment -#FSpDTGetAPPL -#FSpDTGetComment -#TclMacInitializeFragment -#TclMacTerminateFragment -#_Aldata -#_Assert -#_Atcount -#_Atfuns -#_Clocale -#_Closreg -#_Costate -#_Daysto -#_Dbl -#_Defloc -#_Environ -#_Environ1 -#_Fgpos -#_Files -#_Flt -#_Fopen -#_Foprep -#_Fread -#_Freeloc -#_Frprep -#_Fspos -#_Fwprep -#_Fwrite -#_Genld -#_Gentime -#_Getdst -#_Getfld -#_Getfloat -#_Getint -#_Getloc -#_Getmem -#_Getstr -#_Gettime -#_Getzone -#_Isdst -#_Ldbl -#_Ldtob -#_Litob -#_Locale -#_Locsum -#_Loctab -#_Locterm -#_Locvar -#_MWERKS_Atcount -#_MWERKS_Atfuns -#_Makeloc -#_Makestab -#_Makewct -#_Mbcurmax -#_Mbstate -#_Mbtowc -#_Nnl -#_PJP_C_Copyright -#_Printf -#_Putfld -#_Putstr -#_Puttxt -#_Randseed -#_Readloc -#_Scanf -#_Setloc -#_Skip -#_Stdin -#_Stdout -#_Stod -#_Stof -#_Stoflt -#_Stold -#_Strerror -#_Strftime -#_Strxfrm -#_Times -#_Tolower -#_Toupper -#_Ttotm -#_WCostate -#_Wcstate -#_Wctob -#_Wctomb -#_Wctrans -#_Wctype -#__CheckForSystem7 -#__RemoveConsoleHandler__ -#__aborting -#__ctopstring -#__cvt_fp2unsigned -#__getcreator -#__gettype -#__initialize -#__myraise -#__ptmf_null -#__ptr_glue -#__system7present -#__terminate -#__ttyname -#_atexit -#_exit -#_fcreator -#_ftype diff --git a/mac/tclMacSock.c b/mac/tclMacSock.c index dc1116c..7c71109 100644 --- a/mac/tclMacSock.c +++ b/mac/tclMacSock.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: tclMacSock.c,v 1.8 2001/04/04 14:49:35 dgp Exp $ + * RCS: @(#) $Id: tclMacSock.c,v 1.9 2001/11/23 01:28:30 das Exp $ */ #include "tclInt.h" @@ -196,7 +196,7 @@ pascal void NotifyRoutine ( static Tcl_ChannelType tcpChannelType = { "tcp", /* Type name. */ - TcpBlockMode, /* Set blocking or + (Tcl_ChannelTypeVersion)TcpBlockMode, /* Set blocking or * non-blocking mode.*/ TcpClose, /* Close proc. */ TcpInput, /* Input proc. */ diff --git a/mac/tclMacThrd.c b/mac/tclMacThrd.c index e4abb26..3fdafe3 100644 --- a/mac/tclMacThrd.c +++ b/mac/tclMacThrd.c @@ -129,7 +129,7 @@ Tcl_CreateThread(idPtr, proc, clientData, stackSize, flags) #if TARGET_CPU_68K && TARGET_RT_MAC_CFM { ThreadEntryProcPtr entryProc; - entryProc = NewThreadEntryProc(proc); + entryProc = NewThreadEntryUPP(proc); NewThread(kCooperativeThread, entryProc, (void *) clientData, stackSize, kCreateIfNeeded, NULL, (ThreadID *) idPtr); diff --git a/mac/tclMacTime.c b/mac/tclMacTime.c index 1fc1231..25e42ca 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.5 2001/11/21 02:36:21 hobbs Exp $ + * RCS: @(#) $Id: tclMacTime.c,v 1.6 2001/11/23 01:28:42 das Exp $ */ #include "tclInt.h" #include "tclPort.h" +#include "tclMacInt.h" #include <OSUtils.h> #include <Timer.h> #include <time.h> @@ -33,6 +34,83 @@ 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: */ @@ -288,6 +366,40 @@ TclpGetDate( 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/mac/tclMacUnix.c b/mac/tclMacUnix.c index 483780c..a777254 100644 --- a/mac/tclMacUnix.c +++ b/mac/tclMacUnix.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: tclMacUnix.c,v 1.3 1999/04/16 00:47:22 stanton Exp $ + * RCS: @(#) $Id: tclMacUnix.c,v 1.4 2001/11/23 01:28:46 das Exp $ */ #include <Files.h> @@ -206,7 +206,7 @@ Tcl_LsObjCmd( resultObjPtr = Tcl_GetObjResult(interp); Tcl_IncrRefCount(resultObjPtr); - if (Tcl_ListObjGetElements(interp, resultObjPtr, &objc, &objv) != TCL_OK) { + if (Tcl_ListObjGetElements(interp, resultObjPtr, &objc, (Tcl_Obj ***)&objv) != TCL_OK) { Tcl_DecrRefCount(resultObjPtr); return TCL_ERROR; } diff --git a/mac/tclMacUtil.c b/mac/tclMacUtil.c index 51759ef..c505c64 100644 --- a/mac/tclMacUtil.c +++ b/mac/tclMacUtil.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: tclMacUtil.c,v 1.4 2000/04/17 01:52:56 jingham Exp $ + * RCS: @(#) $Id: tclMacUtil.c,v 1.5 2001/11/23 01:28:49 das Exp $ */ #include "tcl.h" @@ -53,7 +53,7 @@ *---------------------------------------------------------------------- */ -#if defined(THINK_C) || defined(__MWERKS__) +#if defined(THINK_C) double hypotd(double x, double y); double @@ -420,7 +420,7 @@ FSpPathFromLocation( /* *---------------------------------------------------------------------- * - * GetGlobalMouse -- + * GetGlobalMouseTcl -- * * This procedure obtains the current mouse position in global * coordinates. @@ -435,7 +435,7 @@ FSpPathFromLocation( */ void -GetGlobalMouse( +GetGlobalMouseTcl( Point *mouse) /* Mouse position. */ { EventRecord event; @@ -443,3 +443,21 @@ GetGlobalMouse( OSEventAvail(0, &event); *mouse = event.where; } + +pascal OSErr FSpGetDirectoryIDTcl (CONST FSSpec * spec, + long * theDirID, Boolean * isDirectory) +{ + return(FSpGetDirectoryID(spec, theDirID, isDirectory)); +} + +pascal short FSpOpenResFileCompatTcl (CONST FSSpec * spec, SignedByte permission) +{ + return(FSpOpenResFileCompat(spec,permission)); +} + +pascal void FSpCreateResFileCompatTcl ( + CONST FSSpec * spec, OSType creator, + OSType fileType, ScriptCode scriptTag) +{ + FSpCreateResFileCompat (spec,creator,fileType,scriptTag); +} diff --git a/tests/tcltest.test b/tests/tcltest.test index 92cca87..7e55e25 100755 --- a/tests/tcltest.test +++ b/tests/tcltest.test @@ -6,7 +6,7 @@ # Copyright (c) 2000 by Ajuba Solutions # All rights reserved. # -# RCS: @(#) $Id: tcltest.test,v 1.16 2001/08/22 23:55:27 hobbs Exp $ +# RCS: @(#) $Id: tcltest.test,v 1.17 2001/11/23 01:29:11 das Exp $ set tcltestVersion [package require tcltest] namespace import -force ::tcltest::* @@ -465,6 +465,9 @@ makeFile { makeFile {} thisdirectoryisafile set normaldirectory [tcltest::makeDirectory normaldirectory] +if {$::tcl_platform(platform) == "macintosh"} { +set normaldirectory [file normalize $normaldirectory] +} # -tmpdir, tcltest::temporaryDirectory test tcltest-8.1 {tcltest a.tcl -tmpdir a} {unixOrPc} { @@ -498,7 +501,7 @@ switch $tcl_platform(platform) { file attributes $notWriteableDir -permissions 00555 } default { - file attributes $notWriteableDir -readonly 1 + catch {file attributes $notWriteableDir -readonly 1} } } @@ -514,7 +517,7 @@ test tcltest-8.4 {tcltest a.tcl -tmpdir notWriteableDir} {unixOrPc} { list [regexp {not writeable} [join $msg]] } {1} -test tcltest-8.5 {tcltest a.tcl -tmpdir normaldirectory} { +test tcltest-8.5 {tcltest a.tcl -tmpdir normaldirectory} {unixOrPc} { catch {exec $::tcltest::tcltest a.tcl -tmpdir $normaldirectory} msg # The join is necessary because the message can be split on multiple lines file exists [file join $normaldirectory a.tmp] @@ -551,13 +554,13 @@ test tcltest-8.6a {tcltest::temporaryDirectory - test format 2} -setup { } -result "$normaldirectory $current $current" # -testdir, tcltest::testsDirectory -test tcltest-8.10 {tcltest a.tcl -testdir thisdirectorydoesnotexist} { +test tcltest-8.10 {tcltest a.tcl -testdir thisdirectorydoesnotexist} {unixOrPc} { file delete -force thisdirectorydoesnotexist catch {exec $::tcltest::tcltest a.tcl -testdir thisdirectorydoesnotexist} msg list [regexp "does not exist" [join $msg]] } {1} -test tcltest-8.11 {tcltest a.tcl -testdir thisdirectoryisafile} { +test tcltest-8.11 {tcltest a.tcl -testdir thisdirectoryisafile} {unixOrPc} { catch {exec $::tcltest::tcltest a.tcl -testdir thisdirectoryisafile} msg # The join is necessary because the message can be split on multiple lines list [regexp "not a directory" [join $msg]] @@ -570,7 +573,7 @@ test tcltest-8.12 {tcltest a.tcl -testdir notReadableDir} {unixOnly} { } {1} -test tcltest-8.13 {tcltest a.tcl -testdir normaldirectory} { +test tcltest-8.13 {tcltest a.tcl -testdir normaldirectory} {unixOrPc} { catch {exec $::tcltest::tcltest a.tcl -testdir normaldirectory} msg # The join is necessary because the message can be split on multiple lines regexp "testdir: $normaldirectory" [join $msg] @@ -625,7 +628,7 @@ switch $tcl_platform(platform) { file attributes $notWriteableDir -permissions 777 } default { - file attributes $notWriteableDir -readonly 0 + catch {file attributes $notWriteableDir -readonly 0} } } |