summaryrefslogtreecommitdiffstats
path: root/generic/tclEnsemble.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-03-09 14:06:53 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-03-09 14:06:53 (GMT)
commit1111254200cc2b8bc8aa2d899f43d56884f1f1cb (patch)
tree321682fffd0f114d52e16ad5231ed933e40ad10e /generic/tclEnsemble.c
parent47412dd55bfb480602e28ca7d73b0aef74b622cb (diff)
downloadtcl-1111254200cc2b8bc8aa2d899f43d56884f1f1cb.zip
tcl-1111254200cc2b8bc8aa2d899f43d56884f1f1cb.tar.gz
tcl-1111254200cc2b8bc8aa2d899f43d56884f1f1cb.tar.bz2
Turn namespace into an ensemble. Not yet on trunk because of some mysterious failures that need resolving...
Diffstat (limited to 'generic/tclEnsemble.c')
-rw-r--r--generic/tclEnsemble.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index bc9ff16..bbc1e55 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -123,11 +123,11 @@ TclNamespaceEnsembleCmd(
return TCL_ERROR;
}
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "subcommand ?arg ...?");
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?arg ...?");
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[2], ensembleSubcommands,
+ if (Tcl_GetIndexFromObj(interp, objv[1], ensembleSubcommands,
"subcommand", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -149,12 +149,12 @@ TclNamespaceEnsembleCmd(
* Check that we've got option-value pairs... [Bug 1558654]
*/
- if ((objc & 1) == 0) {
- Tcl_WrongNumArgs(interp, 3, objv, "?option value ...?");
+ if (objc & 1) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?option value ...?");
return TCL_ERROR;
}
- objv += 3;
- objc -= 3;
+ objv += 2;
+ objc -= 2;
/*
* Work out what name to use for the command to create. If supplied,
@@ -322,29 +322,29 @@ TclNamespaceEnsembleCmd(
}
case ENS_EXISTS:
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "cmdname");
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "cmdname");
return TCL_ERROR;
}
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- Tcl_FindEnsemble(interp, objv[3], 0) != NULL));
+ Tcl_FindEnsemble(interp, objv[2], 0) != NULL));
return TCL_OK;
case ENS_CONFIG:
- if (objc < 4 || (objc != 5 && objc & 1)) {
- Tcl_WrongNumArgs(interp, 3, objv,
+ if (objc < 3 || (objc != 4 && !(objc & 1))) {
+ Tcl_WrongNumArgs(interp, 2, objv,
"cmdname ?-option value ...? ?arg ...?");
return TCL_ERROR;
}
- token = Tcl_FindEnsemble(interp, objv[3], TCL_LEAVE_ERR_MSG);
+ token = Tcl_FindEnsemble(interp, objv[2], TCL_LEAVE_ERR_MSG);
if (token == NULL) {
return TCL_ERROR;
}
- if (objc == 5) {
+ if (objc == 4) {
Tcl_Obj *resultObj = NULL; /* silence gcc 4 warning */
- if (Tcl_GetIndexFromObj(interp, objv[4], ensembleConfigOptions,
+ if (Tcl_GetIndexFromObj(interp, objv[3], ensembleConfigOptions,
"option", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -388,7 +388,7 @@ TclNamespaceEnsembleCmd(
}
break;
}
- } else if (objc == 4) {
+ } else if (objc == 3) {
/*
* Produce list of all information.
*/
@@ -457,8 +457,8 @@ TclNamespaceEnsembleCmd(
Tcl_GetEnsembleFlags(NULL, token, &flags);
permitPrefix = (flags & TCL_ENSEMBLE_PREFIX) != 0;
- objv += 4;
- objc -= 4;
+ objv += 3;
+ objc -= 3;
/*
* Parse the option list, applying type checks as we go. Note that