summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclAssembly.c6
-rw-r--r--generic/tclCkalloc.c196
-rw-r--r--generic/tclCmdIL.c16
-rw-r--r--generic/tclCmdMZ.c93
-rw-r--r--generic/tclCompCmdsSZ.c2
-rw-r--r--generic/tclEnsemble.c6
-rw-r--r--generic/tclFileName.c2
-rw-r--r--generic/tclIO.c50
-rw-r--r--generic/tclIOCmd.c6
-rw-r--r--generic/tclIOUtil.c8
-rw-r--r--generic/tclIndexObj.c13
-rw-r--r--generic/tclInt.h8
-rw-r--r--generic/tclInterp.c14
-rw-r--r--generic/tclOOBasic.c2
-rw-r--r--generic/tclOODefineCmds.c2
-rw-r--r--generic/tclOOMethod.c4
-rw-r--r--generic/tclTest.c30
-rw-r--r--generic/tclTestObj.c8
-rw-r--r--generic/tclTimer.c2
-rw-r--r--generic/tclTrace.c8
-rw-r--r--generic/tclUtil.c6
-rw-r--r--generic/tclZlib.c22
22 files changed, 250 insertions, 254 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index d1866c8..f09a70e 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -1592,7 +1592,7 @@ AssembleOneLine(
if (opnd < 2) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj("operand must be >=2", -1));
+ Tcl_NewStringObj("operand should be >=2", -1));
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "OPERAND>=2", NULL);
}
goto cleanup;
@@ -2435,7 +2435,7 @@ CheckNonNegative(
Tcl_Obj* result; /* Error message */
if (value < 0) {
- result = Tcl_NewStringObj("operand must be nonnegative", -1);
+ result = Tcl_NewStringObj("operand should be nonnegative", -1);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "NONNEGATIVE", NULL);
return TCL_ERROR;
@@ -2468,7 +2468,7 @@ CheckStrictlyPositive(
Tcl_Obj* result; /* Error message */
if (value <= 0) {
- result = Tcl_NewStringObj("operand must be positive", -1);
+ result = Tcl_NewStringObj("operand should be positive", -1);
Tcl_SetObjResult(interp, result);
Tcl_SetErrorCode(interp, "TCL", "ASSEM", "POSITIVE", NULL);
return TCL_ERROR;
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c
index 70e64f0..42c878f 100644
--- a/generic/tclCkalloc.c
+++ b/generic/tclCkalloc.c
@@ -132,9 +132,9 @@ static int ckallocInit = 0;
*/
static int CheckmemCmd(ClientData clientData, Tcl_Interp *interp,
- int argc, const char *argv[]);
+ int argc, Tcl_Obj *const argv[]);
static int MemoryCmd(ClientData clientData, Tcl_Interp *interp,
- int argc, const char *argv[]);
+ int argc, Tcl_Obj *const argv[]);
static void ValidateMemory(struct mem_header *memHeaderP,
const char *file, int line, int nukeGuards);
@@ -814,28 +814,41 @@ MemoryCmd(
ClientData clientData,
Tcl_Interp *interp,
int argc,
- const char *argv[])
+ Tcl_Obj *const argv[])
{
const char *fileName;
FILE *fileP;
Tcl_DString buffer;
- int result;
+ int result, idx;
size_t len;
+ static const char *subcommands[] = {
+ "active", "display", "break_on_malloc", "info", "init", "objs",
+ "onexit", "tag", "trace", "trace_on_at_malloc", "validate",
+ NULL
+ };
+ enum MemSubcommands {
+ OPT_ACTIVE, OPT_DISPLAY, OPT_BREAK, OPT_INFO, OPT_INIT, OPT_OBJS,
+ OPT_ONEXIT, OPT_TAG, OPT_TRACE, OPT_TRACEON, OPT_VALIDATE
+ };
if (argc < 2) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "wrong # args: should be \"%s option [args..]\"", argv[0]));
+ Tcl_WrongNumArgs(interp, 1, argv, "option [args..]");
return TCL_ERROR;
}
- if (strcmp(argv[1], "active") == 0 || strcmp(argv[1], "display") == 0) {
+ if (Tcl_GetIndexFromObj(interp, argv[1], subcommands, "option", 0,
+ &idx) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ switch ((enum MemSubcommands) idx) {
+ case OPT_ACTIVE:
+ case OPT_DISPLAY:
if (argc != 3) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "wrong # args: should be \"%s %s file\"",
- argv[0], argv[1]));
- return TCL_ERROR;
+ goto missingFile;
}
- fileName = Tcl_TranslateFileName(interp, argv[2], &buffer);
+ fileName = Tcl_TranslateFileName(interp, Tcl_GetString(argv[2]),
+ &buffer);
if (fileName == NULL) {
return TCL_ERROR;
}
@@ -843,21 +856,18 @@ MemoryCmd(
Tcl_DStringFree(&buffer);
if (result != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf("error accessing %s: %s",
- argv[2], Tcl_PosixError(interp)));
+ Tcl_GetString(argv[2]), Tcl_PosixError(interp)));
return TCL_ERROR;
}
return TCL_OK;
- }
- if (strcmp(argv[1],"break_on_malloc") == 0) {
+
+ case OPT_BREAK:
if (argc != 3) {
- goto argError;
+ goto missingCount;
}
- if (Tcl_GetInt(interp, argv[2], &break_on_malloc) != TCL_OK) {
- return TCL_ERROR;
- }
- return TCL_OK;
- }
- if (strcmp(argv[1],"info") == 0) {
+ return Tcl_GetIntFromObj(interp, argv[2], &break_on_malloc);
+
+ case OPT_INFO:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%-25s %10d\n%-25s %10d\n%-25s %10d\n%-25s %10lu\n%-25s %10d\n%-25s %10lu\n",
"total mallocs", total_mallocs, "total frees", total_frees,
@@ -866,21 +876,19 @@ MemoryCmd(
"maximum packets allocated", maximum_malloc_packets,
"maximum bytes allocated", (unsigned long)maximum_bytes_malloced));
return TCL_OK;
- }
- if (strcmp(argv[1], "init") == 0) {
+
+ case OPT_INIT:
if (argc != 3) {
- goto bad_suboption;
+ goto missingBoolean;
}
- init_malloced_bodies = (strcmp(argv[2],"on") == 0);
- return TCL_OK;
- }
- if (strcmp(argv[1], "objs") == 0) {
+ return Tcl_GetBooleanFromObj(interp, argv[2], &init_malloced_bodies);
+
+ case OPT_OBJS:
if (argc != 3) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "wrong # args: should be \"%s objs file\"", argv[0]));
- return TCL_ERROR;
+ goto missingFile;
}
- fileName = Tcl_TranslateFileName(interp, argv[2], &buffer);
+ fileName = Tcl_TranslateFileName(interp, Tcl_GetString(argv[2]),
+ &buffer);
if (fileName == NULL) {
return TCL_ERROR;
}
@@ -895,14 +903,13 @@ MemoryCmd(
fclose(fileP);
Tcl_DStringFree(&buffer);
return TCL_OK;
- }
- if (strcmp(argv[1],"onexit") == 0) {
+
+ case OPT_ONEXIT:
if (argc != 3) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "wrong # args: should be \"%s onexit file\"", argv[0]));
- return TCL_ERROR;
+ goto missingFile;
}
- fileName = Tcl_TranslateFileName(interp, argv[2], &buffer);
+ fileName = Tcl_TranslateFileName(interp, Tcl_GetString(argv[2]),
+ &buffer);
if (fileName == NULL) {
return TCL_ERROR;
}
@@ -910,61 +917,50 @@ MemoryCmd(
strcpy(onExitMemDumpFileName,fileName);
Tcl_DStringFree(&buffer);
return TCL_OK;
- }
- if (strcmp(argv[1],"tag") == 0) {
+
+ case OPT_TAG:
if (argc != 3) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "wrong # args: should be \"%s tag string\"", argv[0]));
+ Tcl_WrongNumArgs(interp, 2, argv, "string");
return TCL_ERROR;
}
if ((curTagPtr != NULL) && (curTagPtr->refCount == 0)) {
TclpFree((char *) curTagPtr);
}
- len = strlen(argv[2]);
+ len = strlen(Tcl_GetString(argv[2]));
curTagPtr = (MemTag *) TclpAlloc(TAG_SIZE(len));
curTagPtr->refCount = 0;
- memcpy(curTagPtr->string, argv[2], len + 1);
+ memcpy(curTagPtr->string, Tcl_GetString(argv[2]), len + 1);
return TCL_OK;
- }
- if (strcmp(argv[1],"trace") == 0) {
+
+ case OPT_TRACE:
if (argc != 3) {
- goto bad_suboption;
+ goto missingBoolean;
}
- alloc_tracing = (strcmp(argv[2],"on") == 0);
- return TCL_OK;
- }
+ return Tcl_GetBooleanFromObj(interp, argv[2], &alloc_tracing);
- if (strcmp(argv[1],"trace_on_at_malloc") == 0) {
+ case OPT_TRACEON:
if (argc != 3) {
- goto argError;
+ goto missingCount;
}
- if (Tcl_GetInt(interp, argv[2], &trace_on_at_malloc) != TCL_OK) {
- return TCL_ERROR;
- }
- return TCL_OK;
- }
- if (strcmp(argv[1],"validate") == 0) {
+ return Tcl_GetIntFromObj(interp, argv[2], &trace_on_at_malloc);
+
+ case OPT_VALIDATE:
if (argc != 3) {
- goto bad_suboption;
+ goto missingBoolean;
}
- validate_memory = (strcmp(argv[2],"on") == 0);
- return TCL_OK;
+ return Tcl_GetBooleanFromObj(interp, argv[2], &validate_memory);
}
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad option \"%s\": should be active, break_on_malloc, info, "
- "init, objs, onexit, tag, trace, trace_on_at_malloc, or validate",
- argv[1]));
+ missingCount:
+ Tcl_WrongNumArgs(interp, 2, argv, "count");
return TCL_ERROR;
- argError:
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "wrong # args: should be \"%s %s count\"", argv[0], argv[1]));
+ missingFile:
+ Tcl_WrongNumArgs(interp, 2, argv, "file");
return TCL_ERROR;
- bad_suboption:
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "wrong # args: should be \"%s %s on|off\"", argv[0], argv[1]));
+ missingBoolean:
+ Tcl_WrongNumArgs(interp, 2, argv, "on|off");
return TCL_ERROR;
}
@@ -991,15 +987,23 @@ CheckmemCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Interpreter for evaluation. */
int argc, /* Number of arguments. */
- const char *argv[]) /* String values of arguments. */
+ Tcl_Obj *const argv[]) /* Values of arguments. */
{
+ char *bytes;
+ int len;
+
if (argc != 2) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "wrong # args: should be \"%s fileName\"", argv[0]));
+ Tcl_WrongNumArgs(interp, 1, argv, "fileName");
return TCL_ERROR;
}
+ bytes = Tcl_GetStringFromObj(argv[1], &len);
+ if (len > 99) {
+ Tcl_SetResult(interp, "string too long for internal buffer",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
tclMemDumpFileName = dumpFile;
- strcpy(tclMemDumpFileName, argv[1]);
+ strcpy(tclMemDumpFileName, bytes);
return TCL_OK;
}
@@ -1025,8 +1029,8 @@ Tcl_InitMemory(
* added */
{
TclInitDbCkalloc();
- Tcl_CreateCommand(interp, "memory", MemoryCmd, NULL, NULL);
- Tcl_CreateCommand(interp, "checkmem", CheckmemCmd, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "memory", MemoryCmd, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "checkmem", CheckmemCmd, NULL, NULL);
}
@@ -1054,9 +1058,7 @@ char *
Tcl_Alloc(
unsigned int size)
{
- char *result;
-
- result = TclpAlloc(size);
+ char *result = (char *) TclpAlloc(size);
/*
* Most systems will not alloc(0), instead bumping it to one so that NULL
@@ -1080,9 +1082,7 @@ Tcl_DbCkalloc(
const char *file,
int line)
{
- char *result;
-
- result = (char *) TclpAlloc(size);
+ char *result = (char *) TclpAlloc(size);
if ((result == NULL) && size) {
fflush(stdout);
@@ -1106,10 +1106,7 @@ char *
Tcl_AttemptAlloc(
unsigned int size)
{
- char *result;
-
- result = TclpAlloc(size);
- return result;
+ return (char *) TclpAlloc(size);
}
char *
@@ -1118,10 +1115,7 @@ Tcl_AttemptDbCkalloc(
const char *file,
int line)
{
- char *result;
-
- result = (char *) TclpAlloc(size);
- return result;
+ return (char *) TclpAlloc(size);
}
/*
@@ -1140,9 +1134,7 @@ Tcl_Realloc(
char *ptr,
unsigned int size)
{
- char *result;
-
- result = TclpRealloc(ptr, size);
+ char *result = (char *) TclpRealloc(ptr, size);
if ((result == NULL) && size) {
Tcl_Panic("unable to realloc %u bytes", size);
@@ -1157,9 +1149,7 @@ Tcl_DbCkrealloc(
const char *file,
int line)
{
- char *result;
-
- result = (char *) TclpRealloc(ptr, size);
+ char *result = (char *) TclpRealloc(ptr, size);
if ((result == NULL) && size) {
fflush(stdout);
@@ -1184,10 +1174,7 @@ Tcl_AttemptRealloc(
char *ptr,
unsigned int size)
{
- char *result;
-
- result = TclpRealloc(ptr, size);
- return result;
+ return (char *) TclpRealloc(ptr, size);
}
char *
@@ -1197,10 +1184,7 @@ Tcl_AttemptDbCkrealloc(
const char *file,
int line)
{
- char *result;
-
- result = (char *) TclpRealloc(ptr, size);
- return result;
+ return (char *) TclpRealloc(ptr, size);
}
/*
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index f870245..02bb3a4 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -2620,7 +2620,7 @@ Tcl_LrepeatObjCmd(
}
if (elementCount < 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad count \"%d\": must be integer >= 0", elementCount));
+ "bad count \"%d\": should be integer >= 0", elementCount));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LREPEAT", "NEGARG",
NULL);
return TCL_ERROR;
@@ -3061,7 +3061,7 @@ Tcl_LsearchObjCmd(
Tcl_DecrRefCount(startPtr);
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "\"-index\" option must be followed by list index",
+ "\"-index\" option should be followed by list index",
-1));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
return TCL_ERROR;
@@ -3699,7 +3699,7 @@ Tcl_LsortObjCmd(
case LSORT_COMMAND:
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "\"-command\" option must be followed "
+ "\"-command\" option should be followed "
"by comparison command", -1));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
sortInfo.resultCode = TCL_ERROR;
@@ -3724,7 +3724,7 @@ Tcl_LsortObjCmd(
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "\"-index\" option must be followed by list index",
+ "\"-index\" option should be followed by list index",
-1));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
sortInfo.resultCode = TCL_ERROR;
@@ -3775,7 +3775,7 @@ Tcl_LsortObjCmd(
case LSORT_STRIDE:
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "\"-stride\" option must be "
+ "\"-stride\" option should be "
"followed by stride length", -1));
Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL);
sortInfo.resultCode = TCL_ERROR;
@@ -3787,7 +3787,7 @@ Tcl_LsortObjCmd(
}
if (groupSize < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "stride length must be at least 2", -1));
+ "stride length should be at least 2", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT",
"BADSTRIDE", NULL);
sortInfo.resultCode = TCL_ERROR;
@@ -3884,7 +3884,7 @@ Tcl_LsortObjCmd(
if (group) {
if (length % groupSize) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "list size must be a multiple of the stride length",
+ "list size should be a multiple of the stride length",
-1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT", "BADSTRIDE",
NULL);
@@ -3905,7 +3905,7 @@ Tcl_LsortObjCmd(
if (groupOffset < 0 || groupOffset >= groupSize) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"when used with \"-stride\", the leading \"-index\""
- " value must be within the group", -1));
+ " value should be within the group", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT",
"BADINDEX", NULL);
sortInfo.resultCode = TCL_ERROR;
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 0f7f20a..c409c24 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -1861,16 +1861,13 @@ StringMapCmd(
}
if (objc == 4) {
- const char *string = TclGetStringFromObj(objv[1], &length2);
+ static const char *opt[] = { "-nocase", NULL };
+ int idx;
- if ((length2 > 1) &&
- strncmp(string, "-nocase", (size_t) length2) == 0) {
+ if (Tcl_GetIndexFromObj(interp, objv[1], opt, "option",
+ TCL_MULTIPLE_CHARS, &idx) == TCL_OK) {
nocase = 1;
} else {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad option \"%s\": must be -nocase", string));
- Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "option",
- string, NULL);
return TCL_ERROR;
}
}
@@ -2127,17 +2124,13 @@ StringMatchCmd(
}
if (objc == 4) {
- int length;
- const char *string = TclGetStringFromObj(objv[1], &length);
+ static const char *opt[] = { "-nocase", NULL };
+ int idx;
- if ((length > 1) &&
- strncmp(string, "-nocase", (size_t) length) == 0) {
+ if (Tcl_GetIndexFromObj(interp, objv[1], opt, "option",
+ TCL_MULTIPLE_CHARS, &idx) == TCL_OK) {
nocase = TCL_MATCH_NOCASE;
} else {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad option \"%s\": must be -nocase", string));
- Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "option",
- string, NULL);
return TCL_ERROR;
}
}
@@ -2573,6 +2566,8 @@ StringEqualCmd(
int length1, length2, i, match, length, nocase = 0, reqlength = -1;
typedef int (*strCmpFn_t)(const char *, const char *, unsigned int);
strCmpFn_t strCmpFn;
+ static const char *opts[] = { "-length", "-nocase", NULL };
+ enum opts { OPT_LENGTH, OPT_NOCASE };
if (objc < 3 || objc > 6) {
str_cmp_args:
@@ -2582,25 +2577,24 @@ StringEqualCmd(
}
for (i = 1; i < objc-2; i++) {
- string2 = TclGetStringFromObj(objv[i], &length2);
- if ((length2 > 1) && !strncmp(string2, "-nocase", (size_t)length2)) {
+ int idx;
+
+ if (Tcl_GetIndexFromObj(interp, objv[i], opts, "option", 0,
+ &idx) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ switch ((enum opts) idx) {
+ case OPT_NOCASE:
nocase = 1;
- } else if ((length2 > 1)
- && !strncmp(string2, "-length", (size_t)length2)) {
- if (i+1 >= objc-2) {
+ break;
+ case OPT_LENGTH:
+ if (i >= objc-3) {
goto str_cmp_args;
}
- i++;
- if (TclGetIntFromObj(interp, objv[i], &reqlength) != TCL_OK) {
+ if (TclGetIntFromObj(interp, objv[++i], &reqlength) != TCL_OK) {
return TCL_ERROR;
}
- } else {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad option \"%s\": must be -nocase or -length",
- string2));
- Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "option",
- string2, NULL);
- return TCL_ERROR;
+ break;
}
}
@@ -2723,6 +2717,8 @@ StringCmpCmd(
int length1, length2, i, match, length, nocase = 0, reqlength = -1;
typedef int (*strCmpFn_t)(const char *, const char *, unsigned int);
strCmpFn_t strCmpFn;
+ static const char *opts[] = { "-length", "-nocase", NULL };
+ enum opts { OPT_LENGTH, OPT_NOCASE };
if (objc < 3 || objc > 6) {
str_cmp_args:
@@ -2732,25 +2728,24 @@ StringCmpCmd(
}
for (i = 1; i < objc-2; i++) {
- string2 = TclGetStringFromObj(objv[i], &length2);
- if ((length2 > 1) && !strncmp(string2, "-nocase", (size_t)length2)) {
+ int idx;
+
+ if (Tcl_GetIndexFromObj(interp, objv[i], opts, "option", 0,
+ &idx) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ switch ((enum opts) idx) {
+ case OPT_NOCASE:
nocase = 1;
- } else if ((length2 > 1)
- && !strncmp(string2, "-length", (size_t)length2)) {
- if (i+1 >= objc-2) {
+ break;
+ case OPT_LENGTH:
+ if (i >= objc-3) {
goto str_cmp_args;
}
- i++;
- if (TclGetIntFromObj(interp, objv[i], &reqlength) != TCL_OK) {
+ if (TclGetIntFromObj(interp, objv[++i], &reqlength) != TCL_OK) {
return TCL_ERROR;
}
- } else {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad option \"%s\": must be -nocase or -length",
- string2));
- Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "option",
- string2, NULL);
- return TCL_ERROR;
+ break;
}
}
@@ -4019,7 +4014,7 @@ Tcl_ThrowObjCmd(
return TCL_ERROR;
} else if (len < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "type must be non-empty list", -1));
+ "type should be non-empty list", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "THROW", "BADEXCEPTION",
NULL);
return TCL_ERROR;
@@ -4204,14 +4199,14 @@ TclNRTryObjCmd(
case TryFinally: /* finally script */
if (i < objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "finally clause must be last", -1));
+ "finally clause should be last", -1));
Tcl_DecrRefCount(handlersObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "FINALLY",
"NONTERMINAL", NULL);
return TCL_ERROR;
} else if (i == objc-1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "wrong # args to finally clause: must be"
+ "wrong # args to finally clause: should be"
" \"... finally script\"", -1));
Tcl_DecrRefCount(handlersObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "FINALLY",
@@ -4224,7 +4219,7 @@ TclNRTryObjCmd(
case TryOn: /* on code variableList script */
if (i > objc-4) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "wrong # args to on clause: must be \"... on code"
+ "wrong # args to on clause: should be \"... on code"
" variableList script\"", -1));
Tcl_DecrRefCount(handlersObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "ON",
@@ -4243,7 +4238,7 @@ TclNRTryObjCmd(
if (i > objc-4) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"wrong # args to trap clause: "
- "must be \"... trap pattern variableList script\"",
+ "should be \"... trap pattern variableList script\"",
-1));
Tcl_DecrRefCount(handlersObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "TRAP",
@@ -4253,7 +4248,7 @@ TclNRTryObjCmd(
code = 1;
if (Tcl_ListObjLength(NULL, objv[i+1], &dummy) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad prefix '%s': must be a list",
+ "bad prefix '%s': should be a list",
Tcl_GetString(objv[i+1])));
Tcl_DecrRefCount(handlersObj);
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRY", "TRAP",
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index e6ec0a6..643b533 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -2581,7 +2581,7 @@ TclCompileThrowCmd(
OP( POP);
OP( POP);
issueErrorForEmptyCode:
- PUSH( "type must be non-empty list");
+ PUSH( "type should be non-empty list");
PUSH( "-errorcode {TCL OPERATION THROW BADEXCEPTION}");
}
OP44( RETURN_IMM, TCL_ERROR, 0);
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 022dafa..92b4bab 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -259,7 +259,7 @@ TclNamespaceEnsembleCmd(
if (len < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"ensemble subcommand implementations "
- "must be non-empty lists", -1));
+ "should be non-empty lists", -1));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE",
"EMPTY_TARGET", NULL);
Tcl_DictObjDone(&search);
@@ -538,7 +538,7 @@ TclNamespaceEnsembleCmd(
if (len < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"ensemble subcommand implementations "
- "must be non-empty lists", -1));
+ "should be non-empty lists", -1));
Tcl_SetErrorCode(interp, "TCL", "ENSEMBLE",
"EMPTY_TARGET", NULL);
Tcl_DictObjDone(&search);
@@ -1945,7 +1945,7 @@ NsEnsembleImplementationCmdNR(
TclGetString(objv[1+ensemblePtr->numParameters]), NULL);
return TCL_ERROR;
}
- errorObj = Tcl_ObjPrintf("unknown%s subcommand \"%s\": must be ",
+ errorObj = Tcl_ObjPrintf("unknown%s subcommand \"%s\": should be ",
(ensemblePtr->flags & TCL_ENSEMBLE_PREFIX ? " or ambiguous" : ""),
TclGetString(objv[1+ensemblePtr->numParameters]));
if (ensemblePtr->subcommandTable.numEntries == 1) {
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 5d4702b..e155d95 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -1337,7 +1337,7 @@ Tcl_GlobObjCmd(
endOfForLoop:
if ((globFlags & TCL_GLOBMODE_TAILS) && (pathOrDir == NULL)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "\"-tails\" must be used with either "
+ "\"-tails\" should be used with either "
"\"-directory\" or \"-path\"", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "GLOB",
"BADOPTIONCOMBINATION", NULL);
diff --git a/generic/tclIO.c b/generic/tclIO.c
index d7ed3ac..d6fea64 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -7335,7 +7335,7 @@ Tcl_GetChannelBufferSize(
* An error message is generated in interp's result object to indicate
* that a command was invoked with the a bad option. The message has the
* form:
- * bad option "blah": should be one of
+ * bad/ambiguous option "blah": should be one of
* <...generic options...>+<...specific options...>
* "blah" is the optionName argument and "<specific options>" is a space
* separated list of specific option words. The function takes good care
@@ -7357,7 +7357,8 @@ Tcl_BadChannelOption(
const char *genericopt =
"blocking buffering buffersize encoding eofchar translation";
const char **argv;
- int argc, i;
+ char *problemType = "bad";
+ int argc, i, len = strlen(optionName);
Tcl_DString ds;
Tcl_Obj *errObj;
@@ -7372,8 +7373,14 @@ Tcl_BadChannelOption(
Tcl_Panic("malformed option list in channel driver");
}
Tcl_ResetResult(interp);
- errObj = Tcl_ObjPrintf("bad option \"%s\": should be one of ",
- optionName);
+ for (i = 0; i < argc; i++) {
+ if (optionName[0]=='-' && strncmp(argv[i], optionName, len)==0) {
+ problemType = "ambiguous";
+ break;
+ }
+ }
+ errObj = Tcl_ObjPrintf("%s option \"%s\": should be one of ",
+ problemType, optionName);
argc--;
for (i = 0; i < argc; i++) {
Tcl_AppendPrintfToObj(errObj, "-%s, ", argv[i]);
@@ -7709,8 +7716,9 @@ Tcl_SetChannelOption(
SetFlag(statePtr, CHANNEL_UNBUFFERED);
} else if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "bad value for -buffering: must be one of"
+ "bad value for -buffering: should be one of"
" full, line, or none", -1));
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "BUFFERING", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -7769,8 +7777,9 @@ Tcl_SetChannelOption(
if (inValue & 0x80 || outValue & 0x80) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "bad value for -eofchar: must be non-NUL ASCII"
+ "bad value for -eofchar: should be non-NUL ASCII"
" character", -1));
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "EOFCHAR", NULL);
}
ckfree(argv);
return TCL_ERROR;
@@ -7786,6 +7795,7 @@ Tcl_SetChannelOption(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -eofchar: should be a list of zero,"
" one, or two elements", -1));
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "EOFCHAR", NULL);
}
ckfree(argv);
return TCL_ERROR;
@@ -7818,8 +7828,9 @@ Tcl_SetChannelOption(
} else {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "bad value for -translation: must be a one or two"
+ "bad value for -translation: should be a one or two"
" element list", -1));
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "TRANSLATION", NULL);
}
ckfree(argv);
return TCL_ERROR;
@@ -7846,13 +7857,7 @@ Tcl_SetChannelOption(
} else if (strcmp(readMode, "platform") == 0) {
translation = TCL_PLATFORM_TRANSLATION;
} else {
- if (interp) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "bad value for -translation: must be one of "
- "auto, binary, cr, lf, crlf, or platform", -1));
- }
- ckfree(argv);
- return TCL_ERROR;
+ goto badTranslation;
}
/*
@@ -7896,17 +7901,20 @@ Tcl_SetChannelOption(
} else if (strcmp(writeMode, "platform") == 0) {
statePtr->outputTranslation = TCL_PLATFORM_TRANSLATION;
} else {
- if (interp) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "bad value for -translation: must be one of "
- "auto, binary, cr, lf, crlf, or platform", -1));
- }
- ckfree(argv);
- return TCL_ERROR;
+ goto badTranslation;
}
}
ckfree(argv);
return TCL_OK;
+ badTranslation:
+ if (interp) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "bad value for -translation: should be one of "
+ "auto, binary, cr, lf, crlf, or platform", -1));
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "TRANSLATION", NULL);
+ }
+ ckfree(argv);
+ return TCL_ERROR;
} else if (chanPtr->typePtr->setOptionProc != NULL) {
return chanPtr->typePtr->setOptionProc(chanPtr->instanceData, interp,
optionName, newValue);
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 3368a76..d7ca217 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -705,7 +705,7 @@ Tcl_CloseObjCmd(
if (!(dir & Tcl_GetChannelMode(chan))) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Half-close of %s-side not possible, side not opened"
+ "half-close of %s-side not possible, side not opened"
" or already closed", dirOptions[index]));
return TCL_ERROR;
}
@@ -1660,8 +1660,8 @@ Tcl_FcopyObjCmd(
int mode, i, index;
Tcl_WideInt toRead;
Tcl_Obj *cmdPtr;
- static const char *const switches[] = { "-size", "-command", NULL };
- enum { FcopySize, FcopyCommand };
+ static const char *const switches[] = { "-command", "-size", NULL };
+ enum { FcopyCommand, FcopySize };
if ((objc < 3) || (objc > 7) || (objc == 4) || (objc == 6)) {
Tcl_WrongNumArgs(interp, 1, objv,
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index d2919fc..cf64daa 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -1659,9 +1659,9 @@ TclGetOpenModeEx(
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "invalid access mode \"%s\": must be RDONLY, WRONLY, "
- "RDWR, APPEND, BINARY, CREAT, EXCL, NOCTTY, NONBLOCK,"
- " or TRUNC", flag));
+ "invalid access mode \"%s\": should be RDONLY, "
+ "WRONLY, RDWR, APPEND, BINARY, CREAT, EXCL, NOCTTY, "
+ "NONBLOCK, or TRUNC", flag));
}
ckfree(modeArgv);
return -1;
@@ -1673,7 +1673,7 @@ TclGetOpenModeEx(
if (!gotRW) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "access mode must include either RDONLY, WRONLY, or RDWR",
+ "access mode should include either RDONLY, WRONLY, or RDWR",
-1));
}
return -1;
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index ce8b9fb..a023866 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -91,7 +91,7 @@ typedef struct {
* proper match, then TCL_ERROR is returned and an error message is left
* in interp's result (unless interp is NULL). The msg argument is used
* in the error message; for example, if msg has the value "option" then
- * the error message will say something flag 'bad option "foo": must be
+ * the error message will say something flag 'bad option "foo": should be
* ...'
*
* Side effects:
@@ -329,7 +329,8 @@ Tcl_GetIndexFromObjStruct(
* Check if we were instructed to disallow abbreviations.
*/
- if ((flags & TCL_EXACT) || (key[0] == '\0') || (numAbbrev != 1)) {
+ if ((flags & TCL_EXACT) || (key[0] == '\0') || (numAbbrev != 1)
+ || ((flags & TCL_MULTIPLE_CHARS) && (p1 - key == 1))) {
goto error;
}
@@ -369,12 +370,12 @@ Tcl_GetIndexFromObjStruct(
entryPtr = NEXT_ENTRY(entryPtr, offset);
}
Tcl_AppendStringsToObj(resultPtr,
- (numAbbrev>1 && !(flags & TCL_EXACT) ? "ambiguous " : "bad "),
+ (numAbbrev>0 && !(flags & TCL_EXACT) ? "ambiguous " : "bad "),
msg, " \"", key, NULL);
if (*entryPtr == NULL) {
Tcl_AppendStringsToObj(resultPtr, "\": no valid options", NULL);
} else {
- Tcl_AppendStringsToObj(resultPtr, "\": must be ",
+ Tcl_AppendStringsToObj(resultPtr, "\": should be ",
*entryPtr, NULL);
entryPtr = NEXT_ENTRY(entryPtr, offset);
while (*entryPtr != NULL) {
@@ -844,7 +845,7 @@ PrefixLongestObjCmd(
* An error message is generated in interp's result object to indicate
* that a command was invoked with the wrong number of arguments. The
* message has the form
- * wrong # args: should be "foo bar additional stuff"
+ * wrong # args: must be "foo bar additional stuff"
* where "foo" and "bar" are the initial objects in objv (objc determines
* how many of these are printed) and "additional stuff" is the contents
* of the message argument.
@@ -1475,7 +1476,7 @@ TclGetCompletionCodeFromObj(
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad completion code \"%s\": must be"
+ "bad completion code \"%s\": should be"
" ok, error, return, break, continue, or an integer",
TclGetString(value)));
Tcl_SetErrorCode(interp, "TCL", "RESULT", "ILLEGAL_CODE", NULL);
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 9a2e8dd..50d30f1 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2653,6 +2653,14 @@ typedef struct ProcessGlobalValue {
#define TCL_NUMBER_NAN 5
/*
+ *----------------------------------------------------------------------
+ * Non-public flags for Tcl_GetIndexFromObj
+ *----------------------------------------------------------------------
+ */
+
+#define TCL_MULTIPLE_CHARS 2
+
+/*
*----------------------------------------------------------------
* Variables shared among Tcl modules but not used by the outside world.
*----------------------------------------------------------------
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index 0da5d47..d1abdcc 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -2309,7 +2309,7 @@ SlaveBgerror(
if (TCL_ERROR == TclListObjLength(NULL, objv[0], &length)
|| (length < 1)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "cmdPrefix must be list of length >= 1", -1));
+ "cmdPrefix should be list of length >= 1", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BGERRORFORMAT", NULL);
return TCL_ERROR;
@@ -2934,7 +2934,7 @@ SlaveRecursionLimit(
}
if (limit <= 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "recursion limit must be > 0", -1));
+ "recursion limit should be > 0", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "BADLIMIT",
NULL);
return TCL_ERROR;
@@ -4536,7 +4536,7 @@ SlaveCommandLimitCmd(
}
if (gran < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "granularity must be at least 1", -1));
+ "granularity should be at least 1", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BADVALUE", NULL);
return TCL_ERROR;
@@ -4553,7 +4553,7 @@ SlaveCommandLimitCmd(
}
if (limit < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "command limit value must be at least 0", -1));
+ "command limit value should be at least 0", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BADVALUE", NULL);
return TCL_ERROR;
@@ -4745,7 +4745,7 @@ SlaveTimeLimitCmd(
}
if (gran < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "granularity must be at least 1", -1));
+ "granularity should be at least 1", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BADVALUE", NULL);
return TCL_ERROR;
@@ -4762,7 +4762,7 @@ SlaveTimeLimitCmd(
}
if (tmp < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "milliseconds must be at least 0", -1));
+ "milliseconds should be at least 0", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BADVALUE", NULL);
return TCL_ERROR;
@@ -4780,7 +4780,7 @@ SlaveTimeLimitCmd(
}
if (tmp < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "seconds must be at least 0", -1));
+ "seconds should be at least 0", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BADVALUE", NULL);
return TCL_ERROR;
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index 0b0516b..b2f52dd 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -546,7 +546,7 @@ TclOO_Object_Unknown(
return TCL_ERROR;
}
- errorMsg = Tcl_ObjPrintf("unknown method \"%s\": must be ",
+ errorMsg = Tcl_ObjPrintf("unknown method \"%s\": should be ",
TclGetString(objv[skip]));
for (i=0 ; i<numMethodNames-1 ; i++) {
if (i) {
diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c
index 5a6c0ad..00c89f5 100644
--- a/generic/tclOODefineCmds.c
+++ b/generic/tclOODefineCmds.c
@@ -1186,7 +1186,7 @@ TclOODefineClassObjCmd(
return TCL_ERROR;
}
clsPtr = GetClassInOuterContext(interp, objv[1],
- "the class of an object must be a class");
+ "the class of an object should be a class");
if (clsPtr == NULL) {
return TCL_ERROR;
}
diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c
index 61215de..6fc84fc 100644
--- a/generic/tclOOMethod.c
+++ b/generic/tclOOMethod.c
@@ -1376,7 +1376,7 @@ TclOONewForwardInstanceMethod(
}
if (prefixLen < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "method forward prefix must be non-empty", -1));
+ "method forward prefix should be non-empty", -1));
Tcl_SetErrorCode(interp, "TCL", "OO", "BAD_FORWARD", NULL);
return NULL;
}
@@ -1417,7 +1417,7 @@ TclOONewForwardMethod(
}
if (prefixLen < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "method forward prefix must be non-empty", -1));
+ "method forward prefix should be non-empty", -1));
Tcl_SetErrorCode(interp, "TCL", "OO", "BAD_FORWARD", NULL);
return NULL;
}
diff --git a/generic/tclTest.c b/generic/tclTest.c
index a27c95a..078c26e 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -909,12 +909,12 @@ TestasyncCmd(
Tcl_MutexUnlock(&asyncTestMutex);
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be create, delete, int, mark, or marklater", NULL);
+ "\": should be create, delete, int, mark, or marklater", NULL);
return TCL_ERROR;
#else /* !TCL_THREADS */
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be create, delete, int, or mark", NULL);
+ "\": should be create, delete, int, or mark", NULL);
return TCL_ERROR;
#endif
}
@@ -1087,7 +1087,7 @@ TestcmdinfoCmd(
}
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be create, delete, get, or modify", NULL);
+ "\": should be create, delete, get, or modify", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -1192,7 +1192,7 @@ TestcmdtokenCmd(
Tcl_DecrRefCount(objPtr);
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be create or name", NULL);
+ "\": should be create or name", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -1300,7 +1300,7 @@ TestcmdtraceCmd(
Tcl_DStringFree(&buffer);
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be tracetest, deletetest, doubletest or resulttest", NULL);
+ "\": should be tracetest, deletetest, doubletest or resulttest", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -1436,7 +1436,7 @@ TestcreatecommandCmd(
Tcl_DeleteCommand(interp, "value:at:");
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be create, delete, create2, or delete2", NULL);
+ "\": should be create, delete, create2, or delete2", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -1833,7 +1833,7 @@ TestdstringCmd(
Tcl_SetResult(interp, s, SpecialFree);
} else {
Tcl_AppendResult(interp, "bad gresult option \"", argv[2],
- "\": must be staticsmall, staticlarge, free, or special",
+ "\": should be staticsmall, staticlarge, free, or special",
NULL);
return TCL_ERROR;
}
@@ -1864,7 +1864,7 @@ TestdstringCmd(
Tcl_DStringStartSublist(&dstring);
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be append, element, end, free, get, length, "
+ "\": should be append, element, end, free, get, length, "
"result, trunc, or start", NULL);
return TCL_ERROR;
}
@@ -2072,7 +2072,7 @@ TestevalexObjCmd(
const char *global = Tcl_GetStringFromObj(objv[2], &length);
if (strcmp(global, "global") != 0) {
Tcl_AppendResult(interp, "bad value \"", global,
- "\": must be global", NULL);
+ "\": should be global", NULL);
return TCL_ERROR;
}
flags = TCL_EVAL_GLOBAL;
@@ -2355,7 +2355,7 @@ TestexithandlerCmd(
(ClientData) INT2PTR(value));
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be create or delete", NULL);
+ "\": should be create or delete", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -5813,7 +5813,7 @@ TestChannelEventCmd(
mask = 0;
} else {
Tcl_AppendResult(interp, "bad event name \"", argv[3],
- "\": must be readable, writable, or none", NULL);
+ "\": should be readable, writable, or none", NULL);
return TCL_ERROR;
}
@@ -5844,7 +5844,7 @@ TestChannelEventCmd(
}
if (index < 0) {
Tcl_AppendResult(interp, "bad event index: ", argv[3],
- ": must be nonnegative", NULL);
+ ": should be nonnegative", NULL);
return TCL_ERROR;
}
for (i = 0, esPtr = statePtr->scriptRecordPtr;
@@ -5932,7 +5932,7 @@ TestChannelEventCmd(
}
if (index < 0) {
Tcl_AppendResult(interp, "bad event index: ", argv[3],
- ": must be nonnegative", NULL);
+ ": should be nonnegative", NULL);
return TCL_ERROR;
}
for (i = 0, esPtr = statePtr->scriptRecordPtr;
@@ -5954,7 +5954,7 @@ TestChannelEventCmd(
mask = 0;
} else {
Tcl_AppendResult(interp, "bad event name \"", argv[4],
- "\": must be readable, writable, or none", NULL);
+ "\": should be readable, writable, or none", NULL);
return TCL_ERROR;
}
esPtr->mask = mask;
@@ -5962,7 +5962,7 @@ TestChannelEventCmd(
TclChannelEventScriptInvoker, (ClientData) esPtr);
return TCL_OK;
}
- Tcl_AppendResult(interp, "bad command ", cmd, ", must be one of "
+ Tcl_AppendResult(interp, "bad command ", cmd, ", should be one of "
"add, delete, list, set, or removeall", NULL);
return TCL_ERROR;
}
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index f36b07f..a0425e8 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -379,7 +379,7 @@ TestbooleanobjCmd(
} else {
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"bad option \"", Tcl_GetString(objv[1]),
- "\": must be set, get, or not", NULL);
+ "\": should be set, get, or not", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -498,7 +498,7 @@ TestdoubleobjCmd(
} else {
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"bad option \"", Tcl_GetString(objv[1]),
- "\": must be set, get, mult10, or div10", NULL);
+ "\": should be set, get, mult10, or div10", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -805,7 +805,7 @@ TestintobjCmd(
} else {
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"bad option \"", Tcl_GetString(objv[1]),
- "\": must be set, get, get2, mult10, or div10", NULL);
+ "\": should be set, get, get2, mult10, or div10", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -1105,7 +1105,7 @@ TestobjCmd(
} else {
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"bad option \"", Tcl_GetString(objv[1]),
- "\": must be assign, convert, duplicate, freeallvars, "
+ "\": should be assign, convert, duplicate, freeallvars, "
"newobj, objcount, objtype, refcount, type, or types", NULL);
return TCL_ERROR;
}
diff --git a/generic/tclTimer.c b/generic/tclTimer.c
index c10986a..5be2a5f 100644
--- a/generic/tclTimer.c
+++ b/generic/tclTimer.c
@@ -830,7 +830,7 @@ Tcl_AfterObjCmd(
const char *arg = Tcl_GetString(objv[1]);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad argument \"%s\": must be"
+ "bad argument \"%s\": should be"
" cancel, idle, info, or an integer", arg));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "argument",
arg, NULL);
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index c0cde49..762b74d 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -367,7 +367,7 @@ Tcl_TraceObjCmd(
badVarOps:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad operations \"%s\": should be one or more of rwua",
+ "bad operations \"%s\": should be one or more character of rwua",
flagOps));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRACE", "BADOPS", NULL);
return TCL_ERROR;
@@ -436,7 +436,7 @@ TraceExecutionObjCmd(
}
if (listLen == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "bad operation list \"\": must be one or more of"
+ "bad operation list \"\": should be one or more of"
" enter, leave, enterstep, or leavestep", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRACE", "NOOPS",
NULL);
@@ -679,7 +679,7 @@ TraceCommandObjCmd(
}
if (listLen == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "bad operation list \"\": must be one or more of"
+ "bad operation list \"\": should be one or more of"
" delete or rename", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRACE", "NOOPS",
NULL);
@@ -878,7 +878,7 @@ TraceVariableObjCmd(
}
if (listLen == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "bad operation list \"\": must be one or more of"
+ "bad operation list \"\": should be one or more of"
" array, read, unset, or write", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "TRACE", "NOOPS",
NULL);
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index ae3adae..4c5bc51 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3612,7 +3612,7 @@ TclGetIntForIndex(
if (interp != NULL) {
bytes = Tcl_GetString(objPtr);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad index \"%s\": must be integer?[+-]integer? or"
+ "bad index \"%s\": should be integer?[+-]integer? or"
" end?[+-]integer?", bytes));
if (!strncmp(bytes, "end-", 4)) {
bytes += 4;
@@ -3705,7 +3705,7 @@ SetEndOffsetFromAny(
(size_t)((length > 3) ? 3 : length)) != 0)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad index \"%s\": must be end?[+-]integer?", bytes));
+ "bad index \"%s\": should be end?[+-]integer?", bytes));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", NULL);
}
return TCL_ERROR;
@@ -3740,7 +3740,7 @@ SetEndOffsetFromAny(
badIndexFormat:
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad index \"%s\": must be end?[+-]integer?", bytes));
+ "bad index \"%s\": should be end?[+-]integer?", bytes));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", NULL);
}
return TCL_ERROR;
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 4ccda3b..ec3b76e 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -2124,7 +2124,7 @@ ZlibCmd(
return TCL_ERROR;
badLevel:
- Tcl_SetObjResult(interp, Tcl_NewStringObj("level must be 0 to 9", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("level should be 0 to 9", -1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMPRESSIONLEVEL", NULL);
if (extraInfoStr) {
Tcl_AddErrorInfo(interp, extraInfoStr);
@@ -2132,7 +2132,7 @@ ZlibCmd(
return TCL_ERROR;
badBuffer:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "buffer size must be %d to %d",
+ "buffer size should be %d to %d",
MIN_NONSTREAM_BUFFER_SIZE, MAX_BUFFER_SIZE));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "BUFFERSIZE", NULL);
return TCL_ERROR;
@@ -2268,7 +2268,7 @@ ZlibStreamSubcmd(
} else if (Tcl_GetIntFromObj(interp, levelObj, &level) != TCL_OK) {
return TCL_ERROR;
} else if (level < 0 || level > 9) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("level must be 0 to 9",-1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("level should be 0 to 9",-1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMPRESSIONLEVEL", NULL);
Tcl_AddErrorInfo(interp, "\n (in -level option)");
return TCL_ERROR;
@@ -2420,7 +2420,7 @@ ZlibPushSubcmd(
}
if (level < 0 || level > 9) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "level must be 0 to 9", -1));
+ "level should be 0 to 9", -1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMPRESSIONLEVEL",
NULL);
goto genericOptionError;
@@ -2432,7 +2432,7 @@ ZlibPushSubcmd(
}
if (limit < 1 || limit > MAX_BUFFER_SIZE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "read ahead limit must be 1 to %d",
+ "read ahead limit should be 1 to %d",
MAX_BUFFER_SIZE));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "BUFFERSIZE", NULL);
goto genericOptionError;
@@ -2649,7 +2649,7 @@ ZlibStreamAddCmd(
case ao_buffer: /* -buffer */
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "\"-buffer\" option must be followed by integer "
+ "\"-buffer\" option should be followed by integer "
"decompression buffersize", -1));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "NOVAL", NULL);
return TCL_ERROR;
@@ -2659,7 +2659,7 @@ ZlibStreamAddCmd(
}
if (buffersize < 1 || buffersize > MAX_BUFFER_SIZE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "buffer size must be 1 to %d",
+ "buffer size should be 1 to %d",
MAX_BUFFER_SIZE));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "BUFFERSIZE", NULL);
return TCL_ERROR;
@@ -2668,7 +2668,7 @@ ZlibStreamAddCmd(
case ao_dictionary:
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "\"-dictionary\" option must be followed by"
+ "\"-dictionary\" option should be followed by"
" compression dictionary bytes", -1));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "NOVAL", NULL);
return TCL_ERROR;
@@ -2773,7 +2773,7 @@ ZlibStreamPutCmd(
case po_dictionary:
if (i == objc-2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "\"-dictionary\" option must be followed by"
+ "\"-dictionary\" option should be followed by"
" compression dictionary bytes", -1));
Tcl_SetErrorCode(interp, "TCL", "ZIP", "NOVAL", NULL);
return TCL_ERROR;
@@ -3163,7 +3163,7 @@ ZlibTransformSetOption( /* not used */
flushType = Z_SYNC_FLUSH;
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "unknown -flush type \"%s\": must be full or sync",
+ "bad -flush type \"%s\": should be full or sync",
value));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "FLUSH", NULL);
return TCL_ERROR;
@@ -3208,7 +3208,7 @@ ZlibTransformSetOption( /* not used */
return TCL_ERROR;
} else if (newLimit < 1 || newLimit > MAX_BUFFER_SIZE) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "-limit must be between 1 and 65536", -1));
+ "-limit should be between 1 and 65536", -1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "READLIMIT", NULL);
return TCL_ERROR;
}