summaryrefslogtreecommitdiffstats
path: root/generic/tclProc.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-09-14 18:35:56 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-09-14 18:35:56 (GMT)
commitdc74c2b374a963186c53482685a2c91773ade3da (patch)
tree28c1fdc6337644a54db7b5bca28532e98ecda291 /generic/tclProc.c
parent9e5a076c152f19abbf9f1b67392bd2072bac77c7 (diff)
downloadtcl-dc74c2b374a963186c53482685a2c91773ade3da.zip
tcl-dc74c2b374a963186c53482685a2c91773ade3da.tar.gz
tcl-dc74c2b374a963186c53482685a2c91773ade3da.tar.bz2
* generic/tclBasic.c: Updated several callers to use
* generic/tclCmdMZ.c: TclFormatToErrorInfo(). * generic/tclIOUtil.c: * generic/tclNamesp.c: * generic/tclProc.c:
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r--generic/tclProc.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 8626eaf..3a962d2 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.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: tclProc.c,v 1.78 2005/07/21 14:38:50 dkf Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.79 2005/09/14 18:35:56 dgp Exp $
*/
#include "tclInt.h"
@@ -1488,19 +1488,14 @@ TclProcCompileProc(interp, procPtr, bodyPtr, nsPtr, description, procName)
if (result != TCL_OK) {
if (result == TCL_ERROR) {
- Tcl_Obj *errorLine = Tcl_NewIntObj(interp->errorLine);
- Tcl_Obj *message =
- Tcl_NewStringObj("\n (compiling ", -1);
-
- Tcl_IncrRefCount(message);
- Tcl_AppendStringsToObj(message, description, " \"", NULL);
- TclAppendLimitedToObj(message, procName, -1, 50, NULL);
- Tcl_AppendToObj(message, "\", line ", -1);
- Tcl_AppendObjToObj(message, errorLine);
- Tcl_DecrRefCount(errorLine);
- Tcl_AppendToObj(message, ")", -1);
- TclAppendObjToErrorInfo(interp, message);
- Tcl_DecrRefCount(message);
+ int length = strlen(procName);
+ int limit = 50;
+ int overflow = (length > limit);
+
+ TclFormatToErrorInfo(interp,
+ "\n (compiling %s \"%.*s%s\", line %d)",
+ description, (overflow ? limit : length), procName,
+ (overflow ? "..." : ""), interp->errorLine);
}
return result;
}
@@ -1546,7 +1541,7 @@ ProcessProcResultCode(interp, procName, nameLen, returnCode)
int returnCode; /* The unexpected result code. */
{
Interp *iPtr = (Interp *) interp;
- Tcl_Obj *message, *errorLine;
+ int overflow, limit = 60;
if (returnCode == TCL_OK) {
return TCL_OK;
@@ -1563,16 +1558,10 @@ ProcessProcResultCode(interp, procName, nameLen, returnCode)
((returnCode == TCL_BREAK) ? "break" : "continue"),
"\" outside of a loop", NULL);
}
- errorLine = Tcl_NewIntObj(interp->errorLine);
- message = Tcl_NewStringObj("\n (procedure \"", -1);
- Tcl_IncrRefCount(message);
- TclAppendLimitedToObj(message, procName, nameLen, 60, NULL);
- Tcl_AppendToObj(message, "\" line ", -1);
- Tcl_AppendObjToObj(message, errorLine);
- Tcl_DecrRefCount(errorLine);
- Tcl_AppendToObj(message, ")", -1);
- TclAppendObjToErrorInfo(interp, message);
- Tcl_DecrRefCount(message);
+ overflow = (nameLen > limit);
+ TclFormatToErrorInfo(interp, "\n (procedure \"%.*s%s\" line %d)",
+ (overflow ? limit : nameLen), procName,
+ (overflow ? "..." : ""), interp->errorLine);
return TCL_ERROR;
}