summaryrefslogtreecommitdiffstats
path: root/mac/tclMacLoad.c
diff options
context:
space:
mode:
authordas <das>2002-10-09 11:54:02 (GMT)
committerdas <das>2002-10-09 11:54:02 (GMT)
commit5451c5041622ded8cdbc5b63e4b5a1ed14a31de6 (patch)
treefcd14750217863bb89fa52d2ccf756a933b9a514 /mac/tclMacLoad.c
parent22cf6ccfd778871f2ac0415b10e303a0af281e06 (diff)
downloadtcl-5451c5041622ded8cdbc5b63e4b5a1ed14a31de6.zip
tcl-5451c5041622ded8cdbc5b63e4b5a1ed14a31de6.tar.gz
tcl-5451c5041622ded8cdbc5b63e4b5a1ed14a31de6.tar.bz2
* generic/tclInt.decls: made TclSetPreInitScript() declaration
generic as it is used on mac & aqua as well. * generic/tclIntDecls.h: * generic/tclStubInit.c: regen. * generic/tclCompile.h: added prototype for TclCompileVariableCmd. * mac/tclMacPort.h: removed incorrect <fcntl.h> definitions and obsolete <stat.h> definitions. * mac/tclMacChan.c: removed obsolete GetOpenMode() and replaced associated constants with the <fcntl.h> analogues (they existing defs were inconsistent with <fcntl.h> which was causing havoc when Tcl_GetOpenMode was used instead of private GetOpenMode). * mac/tclMacFCmd.c: removed GenerateUniqueName(), use equivalent (and identiaclly named) routine from MoreFiles instead. * mac/tclMacLoad.c: CONSTification, fixes to Vince's last changes. * mac/tclMacFile.c: * mac/tclMacTest.c: * mac/tclMacUnix.c: CONSTification. * mac/tclMacOSA.c: CONSTificcation, sprintf fixes, UH 3.4.x changes; fix for missing autoname token from TclOSACompileCmd. (bdesgraupes) * mac/AppleScript.html(AppleScript delete): doc fix. (bdesgraupes) * mac/tcltkMacBuildSupport.sea.hqx: updated MoreFiles to 1.5.3, updated build instructions for 8.4. * mac/tclMacProjects.sea.hqx: rebuilt archive.
Diffstat (limited to 'mac/tclMacLoad.c')
-rw-r--r--mac/tclMacLoad.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/mac/tclMacLoad.c b/mac/tclMacLoad.c
index 3c2ec37..379b450 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.15 2002/07/18 16:26:04 vincentdarley Exp $
+ * RCS: @(#) $Id: tclMacLoad.c,v 1.16 2002/10/09 11:54:26 das Exp $
*/
#include <CodeFragments.h>
@@ -92,8 +92,8 @@ typedef struct TclMacLoadInfo {
FSSpec fileSpec;
} TclMacLoadInfo;
-static int TryToLoad(Tcl_Interp *interp, TclMacLoadInfo *loadInfo,
- CONST char *sym /* native */)
+static int TryToLoad(Tcl_Interp *interp, TclMacLoadInfo *loadInfo, Tcl_Obj *pathPtr,
+ CONST char *sym /* native */);
/*
@@ -123,14 +123,13 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
- Tcl_FSUnloadFileProc **unloadProcPtr)
+ Tcl_FSUnloadFileProc **unloadProcPtr;
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for
* this file. */
{
OSErr err;
FSSpec fileSpec;
- Tcl_DString ds;
CONST char *native;
TclMacLoadInfo *loadInfo;
@@ -147,8 +146,8 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
loadInfo->fileSpec = fileSpec;
loadInfo->connID = NULL;
- if (TryToLoad(interp, loadInfo, NULL) != TCL_OK) {
- ckfree(loadInfo);
+ if (TryToLoad(interp, loadInfo, pathPtr, NULL) != TCL_OK) {
+ ckfree((char*) loadInfo);
return TCL_ERROR;
}
@@ -163,9 +162,10 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
* loaded.
*/
static int
-TryToLoad(Tcl_Interp *interp, TclMacLoadInfo *loadInfo,
+TryToLoad(Tcl_Interp *interp, TclMacLoadInfo *loadInfo, Tcl_Obj *pathPtr,
CONST char *sym /* native */)
{
+ OSErr err;
CFragConnectionID connID;
Ptr dummy;
short fragFileRef, saveFileRef;
@@ -189,7 +189,7 @@ TryToLoad(Tcl_Interp *interp, TclMacLoadInfo *loadInfo,
saveFileRef = CurResFile();
SetResLoad(false);
- fragFileRef = FSpOpenResFile(&fileSpec, fsRdPerm);
+ fragFileRef = FSpOpenResFile(&loadInfo->fileSpec, fsRdPerm);
SetResLoad(true);
if (fragFileRef != -1) {
if (sym != NULL) {
@@ -237,14 +237,20 @@ TryToLoad(Tcl_Interp *interp, TclMacLoadInfo *loadInfo,
* as we are going to search for specific entry points passed to us.
*/
- err = GetDiskFragment(&fileSpec, offset, length, fragName,
+ err = GetDiskFragment(&loadInfo->fileSpec, offset, length, fragName,
kLoadCFrag, &connID, &dummy, errName);
if (err != fragNoErr) {
p2cstr(errName);
+ if(pathPtr) {
Tcl_AppendResult(interp, "couldn't load file \"",
Tcl_GetString(pathPtr),
"\": ", errName, (char *) NULL);
+ } else if(sym) {
+ Tcl_AppendResult(interp, "couldn't load library \"",
+ sym,
+ "\": ", errName, (char *) NULL);
+ }
return TCL_ERROR;
}
@@ -290,7 +296,7 @@ TclpFindSymbol(interp, loadHandle, symbol)
*/
Tcl_UtfToExternalDString(NULL, symbol, -1, &ds);
Tcl_DStringSetLength(&ds, Tcl_DStringLength(&ds) - 5);
- res = TryToLoad(interp, loadInfo, Tcl_DStringValue(&ds));
+ res = TryToLoad(interp, loadInfo, NULL, Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
if (res != TCL_OK) {
return NULL;
@@ -340,7 +346,7 @@ TclpUnloadFile(loadHandle)
if (loadInfo->loaded) {
CloseConnection((CFragConnectionID*) &(loadInfo->connID));
}
- ckfree(loadInfo);
+ ckfree((char*)loadInfo);
}
/*