summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-03-23 12:58:38 (GMT)
committernijtmans <nijtmans>2010-03-23 12:58:38 (GMT)
commitddc540e0328b146dd871015f3c32296da797920a (patch)
treeaff7dbfe0bd97a4d49dca1356f58e5452e89f3a8
parent6838a5c3396760aa126ef99f25c1bb7b992700ba (diff)
downloadtcl-ddc540e0328b146dd871015f3c32296da797920a.zip
tcl-ddc540e0328b146dd871015f3c32296da797920a.tar.gz
tcl-ddc540e0328b146dd871015f3c32296da797920a.tar.bz2
Make error message in "try" implementation
exactly the same as the one in "return"
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclCmdMZ.c18
-rw-r--r--generic/tclCompCmdsSZ.c6
-rw-r--r--libtommath/mtest/mpi.c8
-rw-r--r--tests/error.test6
5 files changed, 27 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 9085a07..1223c14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-?? Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tclCmdMZ.c Make error message in "try" implementation
+ * generic/tclCompCmdsSZ.c exactly the same as the one in "return"
+ * tests/error.test
+ * libtommath/mtests/mpi.c Single "const" addition
+
2010-03-22 Don Porter <dgp@users.sourceforge.net>
* generic/tclCmdMZ.c: [Bug 2973361]: Compute the correct integer
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index ebfd7e7..3f1618d 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdMZ.c,v 1.206 2010/03/22 22:47:03 dgp Exp $
+ * RCS: @(#) $Id: tclCmdMZ.c,v 1.207 2010/03/23 12:58:38 nijtmans Exp $
*/
#include "tclInt.h"
@@ -4159,13 +4159,13 @@ TclNRTryObjCmd(
{
Tcl_Obj *bodyObj, *handlersObj, *finallyObj = NULL;
int i, bodyShared, haveHandlers, dummy, code;
- static const char *handlerNames[] = {
+ static const char *const handlerNames[] = {
"finally", "on", "trap", NULL
};
enum Handlers {
TryFinally, TryOn, TryTrap
};
- static const char *exceptionNames[] = {
+ static const char *const returnCodes[] = {
"ok", "error", "return", "break", "continue", NULL
};
@@ -4218,12 +4218,14 @@ TclNRTryObjCmd(
return TCL_ERROR;
}
if (Tcl_GetIntFromObj(NULL, objv[i+1], &code) != TCL_OK
- && Tcl_GetIndexFromObj(NULL, objv[i+1], exceptionNames,
+ && Tcl_GetIndexFromObj(NULL, objv[i+1], returnCodes,
"code", 0, &code) != TCL_OK) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad code '%s': must be integer, \"ok\", \"error\", "
- "\"return\", \"break\" or \"continue\"",
- Tcl_GetString(objv[i+1])));
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "bad completion code \"",
+ TclGetString(objv[i+1]),
+ "\": must be ok, error, return, break, "
+ "continue, or an integer", NULL);
+ Tcl_SetErrorCode(interp, "TCL", "RESULT", "ILLEGAL_CODE", NULL);
Tcl_DecrRefCount(handlersObj);
return TCL_ERROR;
}
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index f6f8efb..d8fdcd1 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompCmdsSZ.c,v 1.5 2010/03/19 11:54:07 dkf Exp $
+ * RCS: @(#) $Id: tclCompCmdsSZ.c,v 1.6 2010/03/23 12:58:39 nijtmans Exp $
*/
#include "tclInt.h"
@@ -1992,7 +1992,7 @@ TclCompileTryCmd(
} else if (tokenPtr[1].size == 2
&& !strncmp(tokenPtr[1].start, "on", 2)) {
int code;
- static const char *codes[] = {
+ static const char *const returnCodes[] = {
"ok", "error", "return", "break", "continue", NULL
};
@@ -2008,7 +2008,7 @@ TclCompileTryCmd(
goto failedToCompile;
}
if (Tcl_GetIntFromObj(NULL, tmpObj, &code) != TCL_OK
- && Tcl_GetIndexFromObj(NULL, tmpObj, codes, "",
+ && Tcl_GetIndexFromObj(NULL, tmpObj, returnCodes, "",
TCL_EXACT, &code) != TCL_OK) {
TclDecrRefCount(tmpObj);
goto failedToCompile;
diff --git a/libtommath/mtest/mpi.c b/libtommath/mtest/mpi.c
index 1b6f114..2122389 100644
--- a/libtommath/mtest/mpi.c
+++ b/libtommath/mtest/mpi.c
@@ -6,7 +6,7 @@
Arbitrary precision integer arithmetic library
- $Id: mpi.c,v 1.1.1.2 2005/09/26 16:32:17 kennykb Exp $
+ $Id: mpi.c,v 1.2 2010/03/23 12:58:41 nijtmans Exp $
*/
#include "mpi.h"
@@ -91,7 +91,7 @@ static unsigned int s_mp_defprec = MP_DEFPREC;
/* {{{ Constant strings */
/* Constant strings returned by mp_strerror() */
-static const char *mp_err_string[] = {
+static const char *const mp_err_string[] = {
"unknown result code", /* say what? */
"boolean true", /* MP_OKAY, MP_YES */
"boolean false", /* MP_NO */
@@ -3981,5 +3981,5 @@ int s_mp_outlen(int bits, int r)
/* crc==4242132123, version==2, Sat Feb 02 06:43:52 2002 */
/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/mtest/mpi.c,v $ */
-/* $Revision: 1.1.1.2 $ */
-/* $Date: 2005/09/26 16:32:17 $ */
+/* $Revision: 1.2 $ */
+/* $Date: 2010/03/23 12:58:41 $ */
diff --git a/tests/error.test b/tests/error.test
index 95cd4c2..9e192ef 100644
--- a/tests/error.test
+++ b/tests/error.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: error.test,v 1.27 2010/03/18 14:35:04 dkf Exp $
+# RCS: @(#) $Id: error.test,v 1.28 2010/03/23 12:58:39 nijtmans Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -883,10 +883,10 @@ rename addmsg {}
test error-20.1 {bad code name in on handler} -body {
try { list a b c } on foo {} {}
-} -returnCodes error -match glob -result {bad code *}
+} -returnCodes error -match glob -result {bad completion code *}
test error-20.2 {bad code value in on handler} -body {
try { list a b c } on 34985723094872345 {} {}
-} -returnCodes error -match glob -result {bad code *}
+} -returnCodes error -match glob -result {bad completion code *}
test error-21.1 {memory leaks in try: Bug 2910044} memory {
leaktest {