summaryrefslogtreecommitdiffstats
path: root/generic/tclIndexObj.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-11-25 16:37:08 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-11-25 16:37:08 (GMT)
commit6ee1f25ba7a09bad8a410b44ff14dc80cfeb7bf1 (patch)
treeb31529be3473f6a2a50e3360557021e1ce66cdd0 /generic/tclIndexObj.c
parent16786015d10aff3dce40b31e1cd011edb3ee6bf6 (diff)
downloadtcl-6ee1f25ba7a09bad8a410b44ff14dc80cfeb7bf1.zip
tcl-6ee1f25ba7a09bad8a410b44ff14dc80cfeb7bf1.tar.gz
tcl-6ee1f25ba7a09bad8a410b44ff14dc80cfeb7bf1.tar.bz2
Fix [Bug 1066837] without reopening other bugs... What a horrid hack! :^/
Diffstat (limited to 'generic/tclIndexObj.c')
-rw-r--r--generic/tclIndexObj.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index cd4dc44..478e3a9 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.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: tclIndexObj.c,v 1.21 2004/10/29 15:39:05 dkf Exp $
+ * RCS: @(#) $Id: tclIndexObj.c,v 1.22 2004/11/25 16:37:15 dkf Exp $
*/
#include "tclInt.h"
@@ -449,6 +449,17 @@ Tcl_WrongNumArgs(interp, objc, objv, message)
register IndexRep *indexRep;
Interp *iPtr = (Interp *) interp;
char *elementStr;
+#ifndef AVOID_HACKS_FOR_ITCL
+ int isFirst = 1; /* Special flag used to inhibit the
+ * treating of the first word as a
+ * list element so the hacky way Itcl
+ * does error message generation for
+ * ensembles will still work.
+ * [Bug 1066837] */
+#define MAY_QUOTE_WORD (!isFirst)
+#else /* !AVOID_HACKS_FOR_ITCL */
+#define MAY_QUOTE_WORD 1
+#endif /* AVOID_HACKS_FOR_ITCL */
TclNewObj(objPtr);
Tcl_AppendToObj(objPtr, "wrong # args: should be \"", -1);
@@ -480,7 +491,7 @@ Tcl_WrongNumArgs(interp, objc, objv, message)
elementStr = Tcl_GetStringFromObj(
iPtr->ensembleRewrite.sourceObjs[i], &elemLen);
len = Tcl_ScanCountedElement(elementStr, elemLen, &flags);
- if (len != elemLen) {
+ if (MAY_QUOTE_WORD && len != elemLen) {
char *quotedElementStr = ckalloc((unsigned) len);
len = Tcl_ConvertCountedElement(elementStr, elemLen,
quotedElementStr, flags);
@@ -489,6 +500,9 @@ Tcl_WrongNumArgs(interp, objc, objv, message)
} else {
Tcl_AppendToObj(objPtr, elementStr, elemLen);
}
+#ifndef AVOID_HACKS_FOR_ITCL
+ isFirst = 0;
+#endif /* AVOID_HACKS_FOR_ITCL */
/*
* Add a space if the word is not the last one (which
@@ -525,7 +539,7 @@ Tcl_WrongNumArgs(interp, objc, objv, message)
elementStr = Tcl_GetStringFromObj(objv[i], &elemLen);
len = Tcl_ScanCountedElement(elementStr, elemLen, &flags);
- if (len != elemLen) {
+ if (MAY_QUOTE_WORD && len != elemLen) {
char *quotedElementStr = ckalloc((unsigned) len);
len = Tcl_ConvertCountedElement(elementStr, elemLen,
quotedElementStr, flags);
@@ -535,6 +549,9 @@ Tcl_WrongNumArgs(interp, objc, objv, message)
Tcl_AppendToObj(objPtr, elementStr, elemLen);
}
}
+#ifndef AVOID_HACKS_FOR_ITCL
+ isFirst = 0;
+#endif /* AVOID_HACKS_FOR_ITCL */
/*
* Append a space character (" ") if there is more text to follow
@@ -556,4 +573,5 @@ Tcl_WrongNumArgs(interp, objc, objv, message)
}
Tcl_AppendStringsToObj(objPtr, "\"", (char *) NULL);
Tcl_SetObjResult(interp, objPtr);
+#undef MAY_QUOTE_WORD
}