Index: TODO =================================================================== diff -u -rc5d841d4cd001b85e95e01202b4fc0afe75df6a8 -r353fe0c41d46ad9d3475bd4b8ea16aea6aae0419 --- TODO (.../TODO) (revision c5d841d4cd001b85e95e01202b4fc0afe75df6a8) +++ TODO (.../TODO) (revision 353fe0c41d46ad9d3475bd4b8ea16aea6aae0419) @@ -1745,6 +1745,13 @@ the same (always first the method, then "-frame ...") - extened regression test +- renamed some arguments of tcl interface to increase consistency +- make requiredness explicit for nsf::cmds +- introduce ::nsf::parametersyntax to provide syntax for potentially + missing definitions +- provided ::nsf::parametersyntax for 3 ::nsf commands + and 7 nx methods (from relationslots) + TODO: - "-returns" Index: generic/gentclAPI.decls =================================================================== diff -u -rc5d841d4cd001b85e95e01202b4fc0afe75df6a8 -r353fe0c41d46ad9d3475bd4b8ea16aea6aae0419 --- generic/gentclAPI.decls (.../gentclAPI.decls) (revision c5d841d4cd001b85e95e01202b4fc0afe75df6a8) +++ generic/gentclAPI.decls (.../gentclAPI.decls) (revision 353fe0c41d46ad9d3475bd4b8ea16aea6aae0419) @@ -22,14 +22,14 @@ nsfCmd __db_run_assertions NsfDebugRunAssertionsCmd { } nsfCmd alias NsfAliasCmd { - {-argName "object" -type object} + {-argName "object" -required 1 -type object} {-argName "-per-object"} {-argName "methodName"} {-argName "-frame" -required 0 -nrargs 1 -type "method|object|default" -default "default"} {-argName "cmdName" -required 1 -type tclobj} } nsfCmd assertion NsfAssertionCmd { - {-argName "object" -type object} + {-argName "object" -required 1 -type object} {-argName "assertionsubcmd" -required 1 -nrargs 1 -type "check|object-invar|class-invar"} {-argName "arg" -required 0 -type tclobj} } @@ -58,7 +58,7 @@ } nsfCmd existsvar NsfExistsVarCmd { {-argName "object" -required 1 -type object} - {-argName "var" -required 1} + {-argName "varname" -required 1} } nsfCmd finalize NsfFinalizeObjCmd { } @@ -77,15 +77,15 @@ {-argName "args" -type args} } nsfCmd importvar NsfImportvarCmd { - {-argName "object" -type object} + {-argName "object" -required 1 -type object} {-argName "args" -type args} } nsfCmd interp NsfInterpObjCmd { - {-argName "name"} + {-argName "name" -required 1} {-argName "args" -type allargs} } nsfCmd invalidateobjectparameter NsfInvalidateObjectParameterCmd { - {-argName "class" -type class} + {-argName "class" -required 1 -type class} } nsfCmd is NsfIsCmd { {-argName "-complain"} @@ -130,10 +130,10 @@ {-argName "toNs" -required 1 -type tclobj} } nsfCmd qualify NsfQualifyObjCmd { - {-argName "name" -required 1 -type tclobj} + {-argName "objectname" -required 1 -type tclobj} } nsfCmd relation NsfRelationCmd { - {-argName "object" -type object} + {-argName "object" -required 1 -type object} {-argName "relationtype" -required 1 -type "object-mixin|class-mixin|object-filter|class-filter|class|superclass|rootclass"} {-argName "value" -required 0 -type tclobj} } @@ -143,7 +143,7 @@ nsfCmd setvar NsfSetVarCmd { {-argName "object" -required 1 -type object} - {-argName "variable" -required 1 -type tclobj} + {-argName "varname" -required 1 -type tclobj} {-argName "value" -required 0 -type tclobj} } nsfCmd setter NsfSetterCmd { @@ -169,7 +169,7 @@ } objectMethod exists NsfOExistsMethod { - {-argName "var" -required 1} + {-argName "varname" -required 1} } objectMethod filterguard NsfOFilterGuardMethod { Index: generic/nsf.c =================================================================== diff -u -rc5d841d4cd001b85e95e01202b4fc0afe75df6a8 -r353fe0c41d46ad9d3475bd4b8ea16aea6aae0419 --- generic/nsf.c (.../nsf.c) (revision c5d841d4cd001b85e95e01202b4fc0afe75df6a8) +++ generic/nsf.c (.../nsf.c) (revision 353fe0c41d46ad9d3475bd4b8ea16aea6aae0419) @@ -10047,10 +10047,10 @@ } } else if (!TclIsVarUndefined(varPtr)) { - return NsfVarErrMsg(interp, "variable '", varNameString, + return NsfVarErrMsg(interp, "varname '", varNameString, "' exists already", (char *) NULL); } else if (TclIsVarTraced(varPtr)) { - return NsfVarErrMsg(interp, "variable '", varNameString, + return NsfVarErrMsg(interp, "varname '", varNameString, "' has traces: can't use for instvar", (char *) NULL); } } @@ -12734,7 +12734,7 @@ /* nsfCmd existsvar NsfExistsVarCmd { {-argName "object" -required 1 -type object} - {-argName "var" -required 1} + {-argName "varname" -required 1} } */ static int @@ -13917,18 +13917,18 @@ /* nsfCmd setvar NsfSetVarCmd { {-argName "object" -required 1 -type object} - {-argName "variable" -required 1 -type tclobj} + {-argName "varname" -required 1 -type tclobj} {-argName "value" -required 0 -type tclobj} } */ static int -NsfSetVarCmd(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *variable, Tcl_Obj *valueObj) { +NsfSetVarCmd(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *varname, Tcl_Obj *valueObj) { - if (CheckVarName(interp, ObjStr(variable)) != TCL_OK) { + if (CheckVarName(interp, ObjStr(varname)) != TCL_OK) { return TCL_ERROR; } - return SetInstVar(interp, object, variable, valueObj); + return SetInstVar(interp, object, varname, valueObj); } /* Index: generic/nsf.tcl =================================================================== diff -u -rca94e89f9a531dd4c58e22f1b87c0b941689799a -r353fe0c41d46ad9d3475bd4b8ea16aea6aae0419 --- generic/nsf.tcl (.../nsf.tcl) (revision ca94e89f9a531dd4c58e22f1b87c0b941689799a) +++ generic/nsf.tcl (.../nsf.tcl) (revision 353fe0c41d46ad9d3475bd4b8ea16aea6aae0419) @@ -38,11 +38,13 @@ } # - # ::nsf::mixin + # ::nsf::mixin # # provide a similar interface as for ::nsf::method, ::nsf::alias, ... # + set ::nsf::parametersyntax(::nsf::mixin) "object ?-per-object? classes" + proc ::nsf::mixin {object args} { if {[lindex $args 0] eq "-per-object"} { set rel "object-mixin" @@ -70,7 +72,7 @@ set {::proc ::nsf::__exithandler {} $value} get {::info body ::nsf::__exithandler} unset {proc ::nsf::__exithandler args {;}} - default {error "syntax: ::nsf::exithandler set|get|unset ?arg?"} + default {error "syntax: ::nsf::exithandler $::nsf::parametersyntax(::nsf::exithandler)"} } } # initialize exit handler @@ -103,4 +105,8 @@ # if HOME is not set, and ~ is resolved, Tcl chokes on that if {![info exists ::env(HOME)]} {set ::env(HOME) /root} + set ::nsf::parametersyntax(::nsf::xotclnext) "?--noArgs? ?arg ...?" + set ::nsf::parametersyntax(::nsf::__unset_unknown_args) "" + set ::nsf::parametersyntax(::nsf::exithandler) "?get?|?set cmds?|?unset?" + } Index: generic/predefined.h =================================================================== diff -u -rca94e89f9a531dd4c58e22f1b87c0b941689799a -r353fe0c41d46ad9d3475bd4b8ea16aea6aae0419 --- generic/predefined.h (.../predefined.h) (revision ca94e89f9a531dd4c58e22f1b87c0b941689799a) +++ generic/predefined.h (.../predefined.h) (revision 353fe0c41d46ad9d3475bd4b8ea16aea6aae0419) @@ -15,6 +15,7 @@ "eval [linsert $cmd 1 $object]} else {\n" "eval [linsert $(definition) 1 $object]}} else {\n" "error \"cannot require method $name for $object, method unknown\"}}\n" +"set ::nsf::parametersyntax(::nsf::mixin) \"object ?-per-object? classes\"\n" "proc ::nsf::mixin {object args} {\n" "if {[lindex $args 0] eq \"-per-object\"} {\n" "set rel \"object-mixin\"\n" @@ -30,7 +31,7 @@ "set {::proc ::nsf::__exithandler {} $value}\n" "get {::info body ::nsf::__exithandler}\n" "unset {proc ::nsf::__exithandler args {;}}\n" -"default {error \"syntax: ::nsf::exithandler set|get|unset ?arg?\"}}}\n" +"default {error \"syntax: ::nsf::exithandler $::nsf::parametersyntax(::nsf::exithandler)\"}}}\n" "::nsf::exithandler unset\n" "proc tmpdir {} {\n" "foreach e [list TMPDIR TEMP TMP] {\n" @@ -44,6 +45,9 @@ "return $d}}}\n" "return /tmp}\n" "namespace export tmpdir\n" -"if {![info exists ::env(HOME)]} {set ::env(HOME) /root}}\n" +"if {![info exists ::env(HOME)]} {set ::env(HOME) /root}\n" +"set ::nsf::parametersyntax(::nsf::xotclnext) \"?--noArgs? ?arg ...?\"\n" +"set ::nsf::parametersyntax(::nsf::__unset_unknown_args) \"\"\n" +"set ::nsf::parametersyntax(::nsf::exithandler) \"?get?|?set cmds?|?unset?\"}\n" ""; Index: generic/tclAPI.h =================================================================== diff -u -rc5d841d4cd001b85e95e01202b4fc0afe75df6a8 -r353fe0c41d46ad9d3475bd4b8ea16aea6aae0419 --- generic/tclAPI.h (.../tclAPI.h) (revision c5d841d4cd001b85e95e01202b4fc0afe75df6a8) +++ generic/tclAPI.h (.../tclAPI.h) (revision 353fe0c41d46ad9d3475bd4b8ea16aea6aae0419) @@ -298,7 +298,7 @@ static int NsfDebugRunAssertionsCmd(Tcl_Interp *interp); static int NsfDeprecatedCmd(Tcl_Interp *interp, CONST char *what, CONST char *oldCmd, CONST char *newCmd); static int NsfDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withFrame, Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]); -static int NsfExistsVarCmd(Tcl_Interp *interp, NsfObject *object, CONST char *var); +static int NsfExistsVarCmd(Tcl_Interp *interp, NsfObject *object, CONST char *varname); static int NsfFinalizeObjCmd(Tcl_Interp *interp); static int NsfForwardCmd(Tcl_Interp *interp, NsfObject *object, int withPer_object, Tcl_Obj *method, Tcl_Obj *withDefault, int withEarlybinding, Tcl_Obj *withMethodprefix, int withObjscope, Tcl_Obj *withOnerror, int withVerbose, Tcl_Obj *target, int nobjc, Tcl_Obj *CONST nobjv[]); static int NsfImportvarCmd(Tcl_Interp *interp, NsfObject *object, int nobjc, Tcl_Obj *CONST nobjv[]); @@ -312,16 +312,16 @@ static int NsfNSCopyCmdsCmd(Tcl_Interp *interp, Tcl_Obj *fromNs, Tcl_Obj *toNs); static int NsfNSCopyVarsCmd(Tcl_Interp *interp, Tcl_Obj *fromNs, Tcl_Obj *toNs); static int NsfNextCmd(Tcl_Interp *interp, Tcl_Obj *arguments); -static int NsfQualifyObjCmd(Tcl_Interp *interp, Tcl_Obj *name); +static int NsfQualifyObjCmd(Tcl_Interp *interp, Tcl_Obj *objectname); static int NsfRelationCmd(Tcl_Interp *interp, NsfObject *object, int relationtype, Tcl_Obj *value); -static int NsfSetVarCmd(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *variable, Tcl_Obj *value); +static int NsfSetVarCmd(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *varname, Tcl_Obj *value); static int NsfSetterCmd(Tcl_Interp *interp, NsfObject *object, int withPer_object, Tcl_Obj *parameter); static int NsfShowStackCmd(Tcl_Interp *interp); static int NsfOAutonameMethod(Tcl_Interp *interp, NsfObject *obj, int withInstance, int withReset, Tcl_Obj *name); static int NsfOCleanupMethod(Tcl_Interp *interp, NsfObject *obj); static int NsfOConfigureMethod(Tcl_Interp *interp, NsfObject *obj, int objc, Tcl_Obj *CONST objv[]); static int NsfODestroyMethod(Tcl_Interp *interp, NsfObject *obj); -static int NsfOExistsMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *var); +static int NsfOExistsMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *varname); static int NsfOFilterGuardMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *filter, Tcl_Obj *guard); static int NsfOInstVarMethod(Tcl_Interp *interp, NsfObject *obj, int objc, Tcl_Obj *CONST objv[]); static int NsfOMixinGuardMethod(Tcl_Interp *interp, NsfObject *obj, CONST char *mixin, Tcl_Obj *guard); @@ -1050,10 +1050,10 @@ return TCL_ERROR; } else { NsfObject *object = (NsfObject *)pc.clientData[0]; - CONST char *var = (CONST char *)pc.clientData[1]; + CONST char *varname = (CONST char *)pc.clientData[1]; ParseContextRelease(&pc); - return NsfExistsVarCmd(interp, object, var); + return NsfExistsVarCmd(interp, object, varname); } } @@ -1328,10 +1328,10 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - Tcl_Obj *name = (Tcl_Obj *)pc.clientData[0]; + Tcl_Obj *objectname = (Tcl_Obj *)pc.clientData[0]; ParseContextRelease(&pc); - return NsfQualifyObjCmd(interp, name); + return NsfQualifyObjCmd(interp, objectname); } } @@ -1367,11 +1367,11 @@ return TCL_ERROR; } else { NsfObject *object = (NsfObject *)pc.clientData[0]; - Tcl_Obj *variable = (Tcl_Obj *)pc.clientData[1]; + Tcl_Obj *varname = (Tcl_Obj *)pc.clientData[1]; Tcl_Obj *value = (Tcl_Obj *)pc.clientData[2]; ParseContextRelease(&pc); - return NsfSetVarCmd(interp, object, variable, value); + return NsfSetVarCmd(interp, object, varname, value); } } @@ -1494,10 +1494,10 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - CONST char *var = (CONST char *)pc.clientData[0]; + CONST char *varname = (CONST char *)pc.clientData[0]; ParseContextRelease(&pc); - return NsfOExistsMethod(interp, obj, var); + return NsfOExistsMethod(interp, obj, varname); } } @@ -2150,14 +2150,14 @@ {"pattern", 0, 0, ConvertToTclobj}} }, {"::nsf::alias", NsfAliasCmdStub, 5, { - {"object", 0, 0, ConvertToObject}, + {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, {"-per-object", 0, 0, ConvertToString}, {"methodName", 0, 0, ConvertToString}, {"-frame", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToFrame}, {"cmdName", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::assertion", NsfAssertionCmdStub, 3, { - {"object", 0, 0, ConvertToObject}, + {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, {"assertionsubcmd", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToAssertionsubcmd}, {"arg", 0, 0, ConvertToTclobj}} }, @@ -2192,7 +2192,7 @@ }, {"::nsf::existsvar", NsfExistsVarCmdStub, 2, { {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, - {"var", NSF_ARG_REQUIRED, 0, ConvertToString}} + {"varname", NSF_ARG_REQUIRED, 0, ConvertToString}} }, {"::nsf::finalize", NsfFinalizeObjCmdStub, 0, { } @@ -2211,15 +2211,15 @@ {"args", 0, 0, ConvertToNothing}} }, {"::nsf::importvar", NsfImportvarCmdStub, 2, { - {"object", 0, 0, ConvertToObject}, + {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, {"args", 0, 0, ConvertToNothing}} }, {"::nsf::interp", NsfInterpObjCmdStub, 2, { - {"name", 0, 0, ConvertToString}, + {"name", NSF_ARG_REQUIRED, 0, ConvertToString}, {"args", 0, 0, ConvertToNothing}} }, {"::nsf::invalidateobjectparameter", NsfInvalidateObjectParameterCmdStub, 1, { - {"class", 0, 0, ConvertToClass}} + {"class", NSF_ARG_REQUIRED, 0, ConvertToClass}} }, {"::nsf::is", NsfIsCmdStub, 3, { {"-complain", 0, 0, ConvertToString}, @@ -2264,16 +2264,16 @@ {"arguments", 0, 0, ConvertToTclobj}} }, {"::nsf::qualify", NsfQualifyObjCmdStub, 1, { - {"name", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} + {"objectname", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::relation", NsfRelationCmdStub, 3, { - {"object", 0, 0, ConvertToObject}, + {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, {"relationtype", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 0, ConvertToRelationtype}, {"value", 0, 0, ConvertToTclobj}} }, {"::nsf::setvar", NsfSetVarCmdStub, 3, { {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, - {"variable", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, + {"varname", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, {"value", 0, 0, ConvertToTclobj}} }, {"::nsf::setter", NsfSetterCmdStub, 3, { @@ -2299,7 +2299,7 @@ } }, {"::nsf::methods::object::exists", NsfOExistsMethodStub, 1, { - {"var", NSF_ARG_REQUIRED, 0, ConvertToString}} + {"varname", NSF_ARG_REQUIRED, 0, ConvertToString}} }, {"::nsf::methods::object::filterguard", NsfOFilterGuardMethodStub, 2, { {"filter", NSF_ARG_REQUIRED, 0, ConvertToString}, Index: library/nx/nx.tcl =================================================================== diff -u -rc5d841d4cd001b85e95e01202b4fc0afe75df6a8 -r353fe0c41d46ad9d3475bd4b8ea16aea6aae0419 --- library/nx/nx.tcl (.../nx.tcl) (revision c5d841d4cd001b85e95e01202b4fc0afe75df6a8) +++ library/nx/nx.tcl (.../nx.tcl) (revision 353fe0c41d46ad9d3475bd4b8ea16aea6aae0419) @@ -869,13 +869,13 @@ return [list oparam $objparamdefinition mparam $methodparamdefinition] } - proc ::nsf::parametersfromslots {obj} { + proc ::nsf::parametersfromslots {object} { set parameterdefinitions [list] - foreach slot [::nsf::dispatch $obj ::nsf::methods::object::info::lookupslots -type ::nx::Slot] { + foreach slot [::nsf::dispatch $object ::nsf::methods::object::info::lookupslots -type ::nx::Slot] { # Skip some slots for xotcl; # TODO: maybe different parametersfromslots for xotcl? if {[::nsf::is class ::xotcl::Object] - && [::nsf::dispatch $obj ::nsf::methods::object::info::hastype ::xotcl::Object] && + && [::nsf::dispatch $object ::nsf::methods::object::info::hastype ::xotcl::Object] && ([$slot name] eq "mixin" || [$slot name] eq "filter") } continue array set "" [$slot toParameterSyntax] @@ -1515,6 +1515,16 @@ } interp alias {} ::nx::self {} ::nsf::current object + + set value "?add class?|?assign classes?|?get?|?delete class?" + set ::nsf::parametersyntax(::nsf::classes::nx::Object::mixin) $value + set ::nsf::parametersyntax(::nsf::classes::nx::Class::mixin) $value + set ::nsf::parametersyntax(::nsf::classes::nx::Class::superclass) $value + set ::nsf::parametersyntax(::nsf::classes::nx::Object::class) "?class?" + set value "?add filter?|?assign filters?|?get?|?delete filter?" + set ::nsf::parametersyntax(::nsf::classes::nx::Object::filter) $value + set ::nsf::parametersyntax(::nsf::classes::nx::Class::filter) $value + set ::nsf::parametersyntax(::nsf::classes::nx::Object::eval) "arg ?arg ...?" } #######################################################################