summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-08-04 13:04:41 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-08-04 13:04:41 (GMT)
commit911e356870519d1379c9246402fcfdd3076c484c (patch)
tree5461b99cb700bf228c1f2b4c16f4b7dbfa8c453d /unix
parentc1c198bb1f699e668cb78c2bf0275ceb6eb25435 (diff)
downloadtcl-911e356870519d1379c9246402fcfdd3076c484c.zip
tcl-911e356870519d1379c9246402fcfdd3076c484c.tar.gz
tcl-911e356870519d1379c9246402fcfdd3076c484c.tar.bz2
more result generation conversion
Diffstat (limited to 'unix')
-rw-r--r--unix/tclLoadDl.c10
-rw-r--r--unix/tclLoadNext.c27
-rw-r--r--unix/tclLoadOSF.c12
-rw-r--r--unix/tclLoadShl.c11
4 files changed, 31 insertions, 29 deletions
diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c
index d86e7fd..4f9c6b8 100644
--- a/unix/tclLoadDl.c
+++ b/unix/tclLoadDl.c
@@ -112,8 +112,9 @@ TclpDlopen(
const char *errorStr = dlerror();
- Tcl_AppendResult(interp, "couldn't load file \"",
- Tcl_GetString(pathPtr), "\": ", errorStr, NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "couldn't load file \"%s\": %s",
+ Tcl_GetString(pathPtr), errorStr));
return TCL_ERROR;
}
newHandle = ckalloc(sizeof(*newHandle));
@@ -175,9 +176,8 @@ FindSymbol(
}
Tcl_DStringFree(&ds);
if (proc == NULL && interp != NULL) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "cannot find symbol \"", symbol, "\": ",
- dlerror(), NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "cannot find symbol \"%s\": %s", symbol, dlerror());
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol,
NULL);
}
diff --git a/unix/tclLoadNext.c b/unix/tclLoadNext.c
index c74a29a..06df2db 100644
--- a/unix/tclLoadNext.c
+++ b/unix/tclLoadNext.c
@@ -16,10 +16,9 @@
/* Static procedures defined within this file */
-static void* FindSymbol(Tcl_Interp* interp, Tcl_LoadHandle loadHandle,
- const char* symbol);
-static void UnloadFile(Tcl_LoadHandle loadHandle);
-
+static void * FindSymbol(Tcl_Interp *interp,
+ Tcl_LoadHandle loadHandle, const char* symbol);
+static void UnloadFile(Tcl_LoadHandle loadHandle);
/*
*----------------------------------------------------------------------
@@ -93,15 +92,15 @@ TclpDlopen(
char *data;
int len, maxlen;
- NXGetMemoryBuffer(errorStream,&data,&len,&maxlen);
- Tcl_AppendResult(interp, "couldn't load file \"", fileName, "\": ",
- data, NULL);
+ NXGetMemoryBuffer(errorStream, &data, &len, &maxlen);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "couldn't load file \"%s\": %s", fileName, data));
NXCloseMemory(errorStream, NX_FREEBUFFER);
return TCL_ERROR;
}
NXCloseMemory(errorStream, NX_FREEBUFFER);
- newHandle = ckalloc(sizeof(*newHandle));
+ newHandle = ckalloc(sizeof(Tcl_LoadHandle));
newHandle->clientData = INT2PTR(1);
newHandle->findSymbolProcPtr = &FindSymbol;
newHandle->unloadFileProcPtr = &UnloadFile;
@@ -127,25 +126,25 @@ TclpDlopen(
*----------------------------------------------------------------------
*/
-static void*
+static void *
FindSymbol(
Tcl_Interp *interp,
Tcl_LoadHandle loadHandle,
const char *symbol)
{
Tcl_PackageInitProc *proc = NULL;
- if (symbol) {
+
+ if (symbol) {
char sym[strlen(symbol) + 2];
sym[0] = '_';
sym[1] = 0;
strcat(sym, symbol);
- rld_lookup(NULL, sym, (unsigned long *)&proc);
+ rld_lookup(NULL, sym, (unsigned long *) &proc);
}
if (proc == NULL && interp != NULL) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "cannot find symbol \"", symbol,
- "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "cannot find symbol \"%s\"", symbol));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol, NULL);
}
return proc;
diff --git a/unix/tclLoadOSF.c b/unix/tclLoadOSF.c
index fbd4d5f..6515b89 100644
--- a/unix/tclLoadOSF.c
+++ b/unix/tclLoadOSF.c
@@ -103,8 +103,9 @@ TclpDlopen(
}
if (lm == LDR_NULL_MODULE) {
- Tcl_AppendResult(interp, "couldn't load file \"", fileName, "\": ",
- Tcl_PosixError(interp), NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "couldn't load file \"%s\": %s",
+ fileName, Tcl_PosixError(interp));
return TCL_ERROR;
}
@@ -155,10 +156,11 @@ FindSymbol(
Tcl_LoadHandle loadHandle,
const char *symbol)
{
- void* retval = ldr_lookup_package((char *)loadHandle, symbol);
+ void *retval = ldr_lookup_package((char *) loadHandle, symbol);
+
if (retval == NULL && interp != NULL) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "cannot find symbol\"", symbol, "\"", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "cannot find symbol \"%s\"", symbol));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol, NULL);
}
return retval;
diff --git a/unix/tclLoadShl.c b/unix/tclLoadShl.c
index eddd80a..968f232 100644
--- a/unix/tclLoadShl.c
+++ b/unix/tclLoadShl.c
@@ -100,8 +100,9 @@ TclpDlopen(
}
if (handle == NULL) {
- Tcl_AppendResult(interp, "couldn't load file \"", fileName, "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "couldn't load file \"%s\": %s",
+ fileName, Tcl_PosixError(interp)));
return TCL_ERROR;
}
newHandle = ckalloc(sizeof(*newHandle));
@@ -155,9 +156,9 @@ FindSymbol(
Tcl_DStringFree(&newName);
}
if (proc == NULL && interp != NULL) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "cannot find symbol\"", symbol, "\": ",
- Tcl_PosixError(interp), NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "cannot find symbol \"%s\": %s",
+ symbol, Tcl_PosixError(interp)));
}
return proc;
}