summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--mac/tclMacApplication.r8
-rw-r--r--mac/tclMacInit.c85
-rw-r--r--mac/tclMacLibrary.r8
-rw-r--r--mac/tclMacOSA.r8
-rw-r--r--mac/tclMacResource.r17
-rw-r--r--mac/tclMacTclCode.r12
7 files changed, 95 insertions, 58 deletions
diff --git a/ChangeLog b/ChangeLog
index c298a9a..e309eda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2001-12-28 Daniel Steffen <das@users.sourceforge.net>
+
+ * mac/tclMacInit.c:
+ * mac/tclMacTclCode.r: synced up tclInit features to unix/win:
+ implemented TclSetPreInitScript support, use of existing tclInit
+ proc if defined, check of default encoding dir if set. Changed
+ script library resource names to lowercase (i.e. same as
+ corresponding files). Used Tcl_JoinPath instead of string append.
+ Check that system encoding could be loaded before utf translating
+ the LibraryPath.
+ * mac/tclMacApplication.r:
+ * mac/tclMacLibrary.r:
+ * mac/tclMacOSA.r:
+ * mac/tclMacResource.r: minor version resources cleanup
+
2001-12-21 Mo DeJong <mdejong@users.sourceforge.net>
* unix/tcl.m4 (SC_PATH_TCLCONFIG, SC_PATH_TKCONFIG):
diff --git a/mac/tclMacApplication.r b/mac/tclMacApplication.r
index c5b29a1..b848da1 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.4 2001/11/23 01:27:16 das Exp $
+ * RCS: @(#) $Id: tclMacApplication.r,v 1.5 2001/12/27 22:46:15 das Exp $
*/
#include <Types.r>
@@ -34,20 +34,22 @@
#if (TCL_RELEASE_LEVEL == 2)
# define MINOR_VERSION (TCL_MINOR_VERSION * 16) + TCL_RELEASE_SERIAL
+# define RELEASE_CODE 0x00
#else
# define MINOR_VERSION TCL_MINOR_VERSION * 16
+# define RELEASE_CODE TCL_RELEASE_SERIAL
#endif
resource 'vers' (1) {
TCL_MAJOR_VERSION, MINOR_VERSION,
- RELEASE_LEVEL, 0x00, verUS,
+ RELEASE_LEVEL, RELEASE_CODE, verUS,
TCL_PATCH_LEVEL,
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,
+ RELEASE_LEVEL, RELEASE_CODE, verUS,
TCL_PATCH_LEVEL,
"Tcl Shell " TCL_PATCH_LEVEL " © 1993-2001"
};
diff --git a/mac/tclMacInit.c b/mac/tclMacInit.c
index eb6a066..b10a0bd 100644
--- a/mac/tclMacInit.c
+++ b/mac/tclMacInit.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: tclMacInit.c,v 1.5 2001/07/31 19:12:07 vincentdarley Exp $
+ * RCS: @(#) $Id: tclMacInit.c,v 1.6 2001/12/27 22:46:19 das Exp $
*/
#include <AppleEvents.h>
@@ -25,6 +25,7 @@
#include "tclInt.h"
#include "tclMacInt.h"
#include "tclPort.h"
+#include "tclInitScript.h"
/*
* The following string is the startup script executed in new
@@ -33,9 +34,10 @@
* init.tcl script does all of the real work of initialization.
*/
-static char initCmd[] = "\
+static char initCmd[] = "if {[info proc tclInit]==\"\"} {\n\
+proc tclInit {} {\n\
+global tcl_pkgPath env\n\
proc sourcePath {file} {\n\
- set dirs {}\n\
foreach i $::auto_path {\n\
set init [file join $i $file.tcl]\n\
if {[catch {uplevel #0 [list source $init]}] == 0} {\n\
@@ -46,25 +48,28 @@ proc sourcePath {file} {\n\
return\n\
}\n\
rename sourcePath {}\n\
- set msg \"can't find $file resource or a usable $file.tcl file\n\"\n\
- append msg \"in the following directories:\n\"\n\
- append msg \" $::auto_path\n\"\n\
- append msg \" perhaps you need to install Tcl or set your \n\"\n\
- append msg \"TCL_LIBRARY environment variable?\"\n\
+ set msg \"Can't find $file resource or a usable $file.tcl file\"\n\
+ append msg \" in the following directories:\"\n\
+ append msg \" $::auto_path\"\n\
+ append msg \" perhaps you need to install Tcl or set your\"\n\
+ append msg \" TCL_LIBRARY environment variable?\"\n\
error $msg\n\
}\n\
if {[info exists env(EXT_FOLDER)]} {\n\
- lappend tcl_pkgPath [file join $env(EXT_FOLDER) {:Tool Command Language}]\n\
+ lappend tcl_pkgPath [file join $env(EXT_FOLDER) {Tool Command Language}]\n\
}\n\
if {[info exists tcl_pkgPath] == 0} {\n\
set tcl_pkgPath {no extension folder}\n\
}\n\
-sourcePath Init\n\
-sourcePath Auto\n\
-sourcePath Package\n\
-sourcePath History\n\
-sourcePath Word\n\
-rename sourcePath {}";
+sourcePath init\n\
+sourcePath auto\n\
+sourcePath package\n\
+sourcePath history\n\
+sourcePath word\n\
+sourcePath parray\n\
+rename sourcePath {}\n\
+} }\n\
+tclInit";
/*
* The following structures are used to map the script/language codes of a
@@ -356,13 +361,23 @@ TclpInitLibraryPath(argv0)
pathPtr = Tcl_NewObj();
+ /*
+ * Look for the library relative to default encoding dir.
+ */
+
+ str = Tcl_GetDefaultEncodingDir();
+ if ((str != NULL) && (str[0] != '\0')) {
+ objPtr = Tcl_NewStringObj(str, -1);
+ Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
+ }
+
str = TclGetEnv("TCL_LIBRARY", &ds);
if ((str != NULL) && (str[0] != '\0')) {
/*
* If TCL_LIBRARY is set, search there.
*/
- objPtr = Tcl_NewStringObj(str, -1);
+ objPtr = Tcl_NewStringObj(str, Tcl_DStringLength(&ds));
Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
Tcl_DStringFree(&ds);
}
@@ -374,18 +389,27 @@ TclpInitLibraryPath(argv0)
/*
* lappend path [file join $env(EXT_FOLDER) \
- * ":Tool Command Language:tcl[info version]"
+ * "Tool Command Language" "tcl[info version]"
*/
str = TclGetEnv("EXT_FOLDER", &ds);
if ((str != NULL) && (str[0] != '\0')) {
- objPtr = Tcl_NewStringObj(str, -1);
- if (str[strlen(str) - 1] != ':') {
- Tcl_AppendToObj(objPtr, ":", 1);
- }
- Tcl_AppendToObj(objPtr, "Tool Command Language:tcl" TCL_VERSION, -1);
- Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
- Tcl_DStringFree(&ds);
+ Tcl_DString libPath, path;
+ char *argv[3];
+
+ argv[0] = str;
+ argv[1] = "Tool Command Language";
+ Tcl_DStringInit(&libPath);
+ Tcl_DStringAppend(&libPath, "tcl", -1);
+ Tcl_DStringAppend(&libPath, TCL_VERSION, -1);
+ argv[2] = Tcl_DStringValue(&libPath);
+ Tcl_DStringInit(&path);
+ str = Tcl_JoinPath(3, argv, &path);
+ objPtr = Tcl_NewStringObj(str, Tcl_DStringLength(&path));
+ Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
+ Tcl_DStringFree(&ds);
+ Tcl_DStringFree(&libPath);
+ Tcl_DStringFree(&path);
}
TclSetLibraryPath(pathPtr);
}
@@ -419,7 +443,7 @@ TclpSetInitialEncodings()
{
CONST char *encoding;
Tcl_Obj *pathPtr;
- int fontId;
+ int fontId, err;
fontId = 0;
GetFinderFont(&fontId);
@@ -428,9 +452,9 @@ TclpSetInitialEncodings()
encoding = "macRoman";
}
- Tcl_SetSystemEncoding(NULL, encoding);
+ err = Tcl_SetSystemEncoding(NULL, encoding);
- if (libraryPathEncodingFixed == 0) {
+ if (err == TCL_OK && libraryPathEncodingFixed == 0) {
/*
* Until the system encoding was actually set, the library path was
@@ -472,6 +496,7 @@ TclpSetInitialEncodings()
Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
}
+ Tcl_InvalidateStringRep(pathPtr);
}
libraryPathEncodingFixed = 1;
}
@@ -669,6 +694,12 @@ Tcl_Init(
{
Tcl_Obj *pathPtr;
+ if (tclPreInitScript != NULL) {
+ if (Tcl_Eval(interp, tclPreInitScript) == TCL_ERROR) {
+ return (TCL_ERROR);
+ };
+ }
+
/*
* For Macintosh applications the Init function may be contained in
* the application resources. If it exists we use it - otherwise we
diff --git a/mac/tclMacLibrary.r b/mac/tclMacLibrary.r
index 2468c98..8aa8c25 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.5 2001/11/23 01:27:42 das Exp $
+ * RCS: @(#) $Id: tclMacLibrary.r,v 1.6 2001/12/27 22:46:22 das Exp $
*/
#include <Types.r>
@@ -34,20 +34,22 @@
#if (TCL_RELEASE_LEVEL == 2)
# define MINOR_VERSION (TCL_MINOR_VERSION * 16) + TCL_RELEASE_SERIAL
+# define RELEASE_CODE 0x00
#else
# define MINOR_VERSION TCL_MINOR_VERSION * 16
+# define RELEASE_CODE TCL_RELEASE_SERIAL
#endif
resource 'vers' (1) {
TCL_MAJOR_VERSION, MINOR_VERSION,
- RELEASE_LEVEL, 0x00, verUS,
+ RELEASE_LEVEL, RELEASE_CODE, verUS,
TCL_PATCH_LEVEL,
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,
+ RELEASE_LEVEL, RELEASE_CODE, verUS,
TCL_PATCH_LEVEL,
"Tcl Library " TCL_PATCH_LEVEL " © 1993-2001"
};
diff --git a/mac/tclMacOSA.r b/mac/tclMacOSA.r
index ebbb0de..c994e60 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.4 2001/11/23 01:28:04 das Exp $
+ * RCS: @(#) $Id: tclMacOSA.r,v 1.5 2001/12/27 22:46:24 das Exp $
*/
#include <Types.r>
@@ -29,22 +29,24 @@
#if FINAL
# define MINOR_VERSION (SCRIPT_MINOR_VERSION * 16) + SCRIPT_RELEASE_SERIAL
+# define RELEASE_CODE 0x00
#else
# define MINOR_VERSION SCRIPT_MINOR_VERSION * 16
+# define RELEASE_CODE SCRIPT_RELEASE_SERIAL
#endif
#define RELEASE_CODE 0x00
resource 'vers' (1) {
SCRIPT_MAJOR_VERSION, MINOR_VERSION,
- RELEASE_LEVEL, 0x00, verUS,
+ RELEASE_LEVEL, RELEASE_CODE, verUS,
SCRIPT_PATCH_LEVEL,
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,
+ RELEASE_LEVEL, RELEASE_CODE, verUS,
SCRIPT_PATCH_LEVEL,
"Tclapplescript " SCRIPT_PATCH_LEVEL " © 1996-2001"
};
diff --git a/mac/tclMacResource.r b/mac/tclMacResource.r
index b022078..b8ccedf 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.5 2001/11/23 01:28:26 das Exp $
+ * RCS: @(#) $Id: tclMacResource.r,v 1.6 2001/12/27 22:46:28 das Exp $
*/
#include <Types.r>
@@ -26,21 +26,6 @@
#define RESOURCE_INCLUDED
#include "tcl.h"
-#if (TCL_RELEASE_LEVEL == 0)
-# define RELEASE_LEVEL alpha
-#elif (TCL_RELEASE_LEVEL == 1)
-# define RELEASE_LEVEL beta
-#elif (TCL_RELEASE_LEVEL == 2)
-# define RELEASE_LEVEL final
-#endif
-
-#if (TCL_RELEASE_LEVEL == 2)
-# define MINOR_VERSION (TCL_MINOR_VERSION * 16) + TCL_RELEASE_SERIAL
-#else
-# define MINOR_VERSION TCL_MINOR_VERSION * 16
-#endif
-
-
/*
* The mechanisim below loads Tcl source into the resource fork of the
* application. The example below creates a TEXT resource named
diff --git a/mac/tclMacTclCode.r b/mac/tclMacTclCode.r
index c3a0c22..13b23e2 100644
--- a/mac/tclMacTclCode.r
+++ b/mac/tclMacTclCode.r
@@ -29,9 +29,9 @@
* will load the TEXT resource named "Init".
*/
-read 'TEXT' (TCL_LIBRARY_RESOURCES, "Init", purgeable) "::library:init.tcl";
-read 'TEXT' (TCL_LIBRARY_RESOURCES + 1, "Auto", purgeable) "::library:auto.tcl";
-read 'TEXT' (TCL_LIBRARY_RESOURCES + 2, "Package", purgeable,preload) "::library:package.tcl";
-read 'TEXT' (TCL_LIBRARY_RESOURCES + 3, "History", purgeable) "::library:history.tcl";
-read 'TEXT' (TCL_LIBRARY_RESOURCES + 4, "Word", purgeable,preload) "::library:word.tcl";
-read 'TEXT' (TCL_LIBRARY_RESOURCES + 5, "Parray", purgeable,preload) "::library:parray.tcl";
+read 'TEXT' (TCL_LIBRARY_RESOURCES, "init", purgeable) "::library:init.tcl";
+read 'TEXT' (TCL_LIBRARY_RESOURCES + 1, "auto", purgeable) "::library:auto.tcl";
+read 'TEXT' (TCL_LIBRARY_RESOURCES + 2, "package", purgeable,preload) "::library:package.tcl";
+read 'TEXT' (TCL_LIBRARY_RESOURCES + 3, "history", purgeable) "::library:history.tcl";
+read 'TEXT' (TCL_LIBRARY_RESOURCES + 4, "word", purgeable,preload) "::library:word.tcl";
+read 'TEXT' (TCL_LIBRARY_RESOURCES + 5, "parray", purgeable,preload) "::library:parray.tcl";