Index: TODO =================================================================== diff -u -r763c2f93238655742da05c5bb5c8d254d704b945 -r7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6 --- TODO (.../TODO) (revision 763c2f93238655742da05c5bb5c8d254d704b945) +++ TODO (.../TODO) (revision 7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6) @@ -1692,7 +1692,12 @@ - removed NSF_CMD_NOT_FOUND - fixed aliasing warning for gcc 4.4.4 +- removed CheckAllInstances() +- added functionality to show enumerated values in + "info parametersyntax" + + TODO: - aolserver/nagiserver: @@ -1706,8 +1711,6 @@ sudo cp /usr/local/aolserver/modules/tcl/xotcl.tcl /usr/local/ns/tcl/ currently, we install into //usr/local/ns/tcl/xotcl.tcl -- show enumerated values in info parametersyntax - - "-returns" * leave syntax as is for method? * add flag to alias and forward? Index: generic/gentclAPI.tcl =================================================================== diff -u -r1e14e709ba184c6daf7a2f94605a2cff65d7706c -r7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6 --- generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision 1e14e709ba184c6daf7a2f94605a2cff65d7706c) +++ generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision 7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6) @@ -16,15 +16,17 @@ proc createconverter {type argname} { set name [convertername $type $argname] - if {[info exists ::created($name)]} { + if {[info exists ::createdConverter($name)]} { return "" } - set ::created($name) 1 set domain [split $type |] set opts "static CONST char *opts\[\] = {\"[join $domain {", "}]\", NULL};" + set ::createdConverter($name) "ConvertTo${name}, \"$type\"" set enums [list ${name}NULL] foreach d $domain {lappend enums $name[string totitle [string map [list - _] $d]]Idx} subst { +enum ${name}Idx {[join $enums {, }]}; + static int ConvertTo${name}(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -34,7 +36,6 @@ *outObjPtr = objPtr; return result; } -enum ${name}Idx {[join $enums {, }]}; } } @@ -46,6 +47,7 @@ "" {set type NULL} default {set type $(-type)} } + set flags [expr {$(-required) ? "NSF_ARG_REQUIRED" : "0"}] set argName $(-argName) switch -glob $type { "NULL" {set converter String} @@ -61,6 +63,7 @@ set converter [convertername $type $(-argName)] append ::converter [createconverter $type $(-argName)] set (-argName) $type + append flags |NSF_ARG_IS_ENUMERATION } } # this does not work, since initializer element is not constant. @@ -70,7 +73,7 @@ # } else { # set default "" # } - lappend l "{\"$argName\", $(-required), $(-nrargs), ConvertTo$converter}" + lappend l "{\"$argName\", $flags, $(-nrargs), ConvertTo$converter}" } join $l ",\n " } @@ -274,15 +277,26 @@ append stubDecls $stubDecl } - puts $::converter puts { typedef struct { CONST char *methodName; Tcl_ObjCmdProc *proc; int nrParameters; NsfParam paramDefs[12]; } methodDefinition; + } + puts $::converter + set entries [list] + foreach c [array names ::createdConverter] {lappend entries "\{$::createdConverter($c)\}"} + puts [subst { +static enumeratorConverterEntry enumeratorConverterEntries\[\] = { + [join $entries ",\n "], + {NULL, NULL} +}; + }] + + puts { static int ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], NsfObject *obj, Tcl_Obj *procName, NsfParam CONST *paramPtr, int nrParameters, int doCheck, Index: generic/nsf.c =================================================================== diff -u -re9d2589df817b1102655055cc2824b35ea58edfe -r7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6 --- generic/nsf.c (.../nsf.c) (revision e9d2589df817b1102655055cc2824b35ea58edfe) +++ generic/nsf.c (.../nsf.c) (revision 7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6) @@ -152,6 +152,11 @@ static NsfTypeConverter ConvertToNothing, ConvertViaCmd, ConvertToClass; +typedef struct { + NsfTypeConverter *converter; + char *domain; +} enumeratorConverterEntry; +static enumeratorConverterEntry enumeratorConverterEntries[]; /* * Tcl_Obj Types for Next Scripting Objects @@ -6038,6 +6043,25 @@ return result; } +static CONST char * +ParamGetDomain(NsfParam CONST *paramPtr) { + CONST char *result = "value"; + + assert(paramPtr); + if ((paramPtr->flags & NSF_ARG_IS_ENUMERATION)) { + enumeratorConverterEntry *ePtr; + for (ePtr = &enumeratorConverterEntries[0]; ePtr->converter; ePtr++) { + if (ePtr->converter == paramPtr->converter) { + result = ePtr->domain; + break; + } + } + } else { + result = ParamGetType(paramPtr); + } + return result; +} + static Tcl_Obj * ParamDefsSyntax(Tcl_Interp *interp, NsfParam CONST *paramPtr) { Tcl_Obj *argStringObj = Tcl_NewStringObj("", 0); @@ -6050,13 +6074,17 @@ if (pPtr->converter == ConvertToNothing && strcmp(pPtr->name, "args") == 0) { Tcl_AppendLimitedToObj(argStringObj, "?arg ...?", 9, INT_MAX, NULL); } else if (pPtr->flags & NSF_ARG_REQUIRED) { - Tcl_AppendLimitedToObj(argStringObj, pPtr->name, -1, INT_MAX, NULL); + if ((pPtr->flags & NSF_ARG_IS_ENUMERATION)) { + Tcl_AppendLimitedToObj(argStringObj, ParamGetDomain(pPtr), -1, INT_MAX, NULL); + } else { + Tcl_AppendLimitedToObj(argStringObj, pPtr->name, -1, INT_MAX, NULL); + } } else { Tcl_AppendLimitedToObj(argStringObj, "?", 1, INT_MAX, NULL); Tcl_AppendLimitedToObj(argStringObj, pPtr->name, -1, INT_MAX, NULL); if (pPtr->nrArgs >0) { Tcl_AppendLimitedToObj(argStringObj, " ", 1, INT_MAX, NULL); - Tcl_AppendLimitedToObj(argStringObj, ParamGetType(pPtr), -1, INT_MAX, NULL); + Tcl_AppendLimitedToObj(argStringObj, ParamGetDomain(pPtr), -1, INT_MAX, NULL); if (pPtr->flags & NSF_ARG_MULTIVALUED) { Tcl_AppendLimitedToObj(argStringObj, " ...", 4, INT_MAX, NULL); } Index: generic/nsfInt.h =================================================================== diff -u -r14965323980c2235c37b67ddbb19343ddbdaa41c -r7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6 --- generic/nsfInt.h (.../nsfInt.h) (revision 14965323980c2235c37b67ddbb19343ddbdaa41c) +++ generic/nsfInt.h (.../nsfInt.h) (revision 7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6) @@ -368,6 +368,7 @@ #define NSF_ARG_METACLASS 0x0800 #define NSF_ARG_HAS_DEFAULT 0x1000 #define NSF_ARG_IS_CONVERTER 0x2000 +#define NSF_ARG_IS_ENUMERATION 0x4000 /* disallowed options */ #define NSF_DISALLOWED_ARG_METHOD_PARAMETER (NSF_ARG_METHOD|NSF_ARG_INITCMD|NSF_ARG_RELATION) Index: generic/tclAPI.h =================================================================== diff -u -r18d4d9c1a99310c3fb9b2f2bed03e9d59fb30d30 -r7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6 --- generic/tclAPI.h (.../tclAPI.h) (revision 18d4d9c1a99310c3fb9b2f2bed03e9d59fb30d30) +++ generic/tclAPI.h (.../tclAPI.h) (revision 7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6) @@ -1,4 +1,14 @@ +typedef struct { + CONST char *methodName; + Tcl_ObjCmdProc *proc; + int nrParameters; + NsfParam paramDefs[12]; +} methodDefinition; + + +enum InfomethodsubcmdIdx {InfomethodsubcmdNULL, InfomethodsubcmdArgsIdx, InfomethodsubcmdBodyIdx, InfomethodsubcmdDefinitionIdx, InfomethodsubcmdHandleIdx, InfomethodsubcmdParameterIdx, InfomethodsubcmdParametersyntaxIdx, InfomethodsubcmdTypeIdx, InfomethodsubcmdPreconditionIdx, InfomethodsubcmdPostconditionIdx, InfomethodsubcmdSubmethodsIdx}; + static int ConvertToInfomethodsubcmd(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -8,8 +18,9 @@ *outObjPtr = objPtr; return result; } -enum InfomethodsubcmdIdx {InfomethodsubcmdNULL, InfomethodsubcmdArgsIdx, InfomethodsubcmdBodyIdx, InfomethodsubcmdDefinitionIdx, InfomethodsubcmdHandleIdx, InfomethodsubcmdParameterIdx, InfomethodsubcmdParametersyntaxIdx, InfomethodsubcmdTypeIdx, InfomethodsubcmdPreconditionIdx, InfomethodsubcmdPostconditionIdx, InfomethodsubcmdSubmethodsIdx}; +enum CallprotectionIdx {CallprotectionNULL, CallprotectionAllIdx, CallprotectionProtectedIdx, CallprotectionPublicIdx}; + static int ConvertToCallprotection(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -19,8 +30,9 @@ *outObjPtr = objPtr; return result; } -enum CallprotectionIdx {CallprotectionNULL, CallprotectionAllIdx, CallprotectionProtectedIdx, CallprotectionPublicIdx}; +enum MethodtypeIdx {MethodtypeNULL, MethodtypeAllIdx, MethodtypeScriptedIdx, MethodtypeBuiltinIdx, MethodtypeAliasIdx, MethodtypeForwarderIdx, MethodtypeObjectIdx, MethodtypeSetterIdx}; + static int ConvertToMethodtype(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -30,8 +42,9 @@ *outObjPtr = objPtr; return result; } -enum MethodtypeIdx {MethodtypeNULL, MethodtypeAllIdx, MethodtypeScriptedIdx, MethodtypeBuiltinIdx, MethodtypeAliasIdx, MethodtypeForwarderIdx, MethodtypeObjectIdx, MethodtypeSetterIdx}; +enum ScopeIdx {ScopeNULL, ScopeAllIdx, ScopeClassIdx, ScopeObjectIdx}; + static int ConvertToScope(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -41,8 +54,9 @@ *outObjPtr = objPtr; return result; } -enum ScopeIdx {ScopeNULL, ScopeAllIdx, ScopeClassIdx, ScopeObjectIdx}; +enum AssertionsubcmdIdx {AssertionsubcmdNULL, AssertionsubcmdCheckIdx, AssertionsubcmdObject_invarIdx, AssertionsubcmdClass_invarIdx}; + static int ConvertToAssertionsubcmd(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -52,8 +66,9 @@ *outObjPtr = objPtr; return result; } -enum AssertionsubcmdIdx {AssertionsubcmdNULL, AssertionsubcmdCheckIdx, AssertionsubcmdObject_invarIdx, AssertionsubcmdClass_invarIdx}; +enum ConfigureoptionIdx {ConfigureoptionNULL, ConfigureoptionFilterIdx, ConfigureoptionSoftrecreateIdx, ConfigureoptionObjectsystemsIdx, ConfigureoptionKeepinitcmdIdx, ConfigureoptionCheckresultsIdx, ConfigureoptionCheckargumentsIdx}; + static int ConvertToConfigureoption(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -63,8 +78,9 @@ *outObjPtr = objPtr; return result; } -enum ConfigureoptionIdx {ConfigureoptionNULL, ConfigureoptionFilterIdx, ConfigureoptionSoftrecreateIdx, ConfigureoptionObjectsystemsIdx, ConfigureoptionKeepinitcmdIdx, ConfigureoptionCheckresultsIdx, ConfigureoptionCheckargumentsIdx}; +enum CurrentoptionIdx {CurrentoptionNULL, CurrentoptionProcIdx, CurrentoptionMethodIdx, CurrentoptionMethodpathIdx, CurrentoptionObjectIdx, CurrentoptionClassIdx, CurrentoptionActivelevelIdx, CurrentoptionArgsIdx, CurrentoptionActivemixinIdx, CurrentoptionCalledprocIdx, CurrentoptionCalledmethodIdx, CurrentoptionCalledclassIdx, CurrentoptionCallingprocIdx, CurrentoptionCallingmethodIdx, CurrentoptionCallingclassIdx, CurrentoptionCallinglevelIdx, CurrentoptionCallingobjectIdx, CurrentoptionFilterregIdx, CurrentoptionIsnextcallIdx, CurrentoptionNextIdx}; + static int ConvertToCurrentoption(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -74,8 +90,9 @@ *outObjPtr = objPtr; return result; } -enum CurrentoptionIdx {CurrentoptionNULL, CurrentoptionProcIdx, CurrentoptionMethodIdx, CurrentoptionMethodpathIdx, CurrentoptionObjectIdx, CurrentoptionClassIdx, CurrentoptionActivelevelIdx, CurrentoptionArgsIdx, CurrentoptionActivemixinIdx, CurrentoptionCalledprocIdx, CurrentoptionCalledmethodIdx, CurrentoptionCalledclassIdx, CurrentoptionCallingprocIdx, CurrentoptionCallingmethodIdx, CurrentoptionCallingclassIdx, CurrentoptionCallinglevelIdx, CurrentoptionCallingobjectIdx, CurrentoptionFilterregIdx, CurrentoptionIsnextcallIdx, CurrentoptionNextIdx}; +enum MethodpropertyIdx {MethodpropertyNULL, MethodpropertyClass_onlyIdx, MethodpropertyCall_protectedIdx, MethodpropertyRedefine_protectedIdx, MethodpropertyReturnsIdx, MethodpropertySlotcontainerIdx, MethodpropertySlotobjIdx}; + static int ConvertToMethodproperty(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -85,8 +102,9 @@ *outObjPtr = objPtr; return result; } -enum MethodpropertyIdx {MethodpropertyNULL, MethodpropertyClass_onlyIdx, MethodpropertyCall_protectedIdx, MethodpropertyRedefine_protectedIdx, MethodpropertyReturnsIdx, MethodpropertySlotcontainerIdx, MethodpropertySlotobjIdx}; +enum RelationtypeIdx {RelationtypeNULL, RelationtypeObject_mixinIdx, RelationtypeClass_mixinIdx, RelationtypeObject_filterIdx, RelationtypeClass_filterIdx, RelationtypeClassIdx, RelationtypeSuperclassIdx, RelationtypeRootclassIdx}; + static int ConvertToRelationtype(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -96,8 +114,9 @@ *outObjPtr = objPtr; return result; } -enum RelationtypeIdx {RelationtypeNULL, RelationtypeObject_mixinIdx, RelationtypeClass_mixinIdx, RelationtypeObject_filterIdx, RelationtypeClass_filterIdx, RelationtypeClassIdx, RelationtypeSuperclassIdx, RelationtypeRootclassIdx}; +enum ObjectkindIdx {ObjectkindNULL, ObjectkindClassIdx, ObjectkindBaseclassIdx, ObjectkindMetaclassIdx}; + static int ConvertToObjectkind(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -107,8 +126,9 @@ *outObjPtr = objPtr; return result; } -enum ObjectkindIdx {ObjectkindNULL, ObjectkindClassIdx, ObjectkindBaseclassIdx, ObjectkindMetaclassIdx}; +enum SourceIdx {SourceNULL, SourceAllIdx, SourceApplicationIdx, SourceBaseclassesIdx}; + static int ConvertToSource(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int index, result; @@ -118,15 +138,23 @@ *outObjPtr = objPtr; return result; } -enum SourceIdx {SourceNULL, SourceAllIdx, SourceApplicationIdx, SourceBaseclassesIdx}; -typedef struct { - CONST char *methodName; - Tcl_ObjCmdProc *proc; - int nrParameters; - NsfParam paramDefs[12]; -} methodDefinition; +static enumeratorConverterEntry enumeratorConverterEntries[] = { + {ConvertToRelationtype, "object-mixin|class-mixin|object-filter|class-filter|class|superclass|rootclass"}, + {ConvertToCurrentoption, "proc|method|methodpath|object|class|activelevel|args|activemixin|calledproc|calledmethod|calledclass|callingproc|callingmethod|callingclass|callinglevel|callingobject|filterreg|isnextcall|next"}, + {ConvertToSource, "all|application|baseclasses"}, + {ConvertToObjectkind, "class|baseclass|metaclass"}, + {ConvertToMethodproperty, "class-only|call-protected|redefine-protected|returns|slotcontainer|slotobj"}, + {ConvertToAssertionsubcmd, "check|object-invar|class-invar"}, + {ConvertToScope, "all|class|object"}, + {ConvertToConfigureoption, "filter|softrecreate|objectsystems|keepinitcmd|checkresults|checkarguments"}, + {ConvertToMethodtype, "all|scripted|builtin|alias|forwarder|object|setter"}, + {ConvertToCallprotection, "all|protected|public"}, + {ConvertToInfomethodsubcmd, "args|body|definition|handle|parameter|parametersyntax|type|precondition|postcondition|submethods"}, + {NULL, NULL} +}; + static int ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], NsfObject *obj, Tcl_Obj *procName, @@ -2033,33 +2061,33 @@ static methodDefinition method_definitions[] = { {"::nsf::methods::class::alloc", NsfCAllocMethodStub, 1, { - {"name", 1, 0, ConvertToTclobj}} + {"name", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::methods::class::create", NsfCCreateMethodStub, 2, { - {"name", 1, 0, ConvertToString}, + {"name", NSF_ARG_REQUIRED, 0, ConvertToString}, {"args", 0, 0, ConvertToNothing}} }, {"::nsf::methods::class::dealloc", NsfCDeallocMethodStub, 1, { - {"object", 1, 0, ConvertToTclobj}} + {"object", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::methods::class::filterguard", NsfCFilterGuardMethodStub, 2, { - {"filter", 1, 0, ConvertToString}, - {"guard", 1, 0, ConvertToTclobj}} + {"filter", NSF_ARG_REQUIRED, 0, ConvertToString}, + {"guard", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::methods::class::mixinguard", NsfCMixinGuardMethodStub, 2, { - {"mixin", 1, 0, ConvertToString}, - {"guard", 1, 0, ConvertToTclobj}} + {"mixin", NSF_ARG_REQUIRED, 0, ConvertToString}, + {"guard", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::methods::class::new", NsfCNewMethodStub, 2, { {"-childof", 0, 1, ConvertToObject}, {"args", 0, 0, ConvertToNothing}} }, {"::nsf::methods::class::recreate", NsfCRecreateMethodStub, 2, { - {"name", 1, 0, ConvertToTclobj}, + {"name", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, {"args", 0, 0, ConvertToNothing}} }, {"::nsf::methods::class::info::filterguard", NsfClassInfoFilterguardMethodStub, 1, { - {"filter", 1, 0, ConvertToString}} + {"filter", NSF_ARG_REQUIRED, 0, ConvertToString}} }, {"::nsf::methods::class::info::filtermethods", NsfClassInfoFiltermethodsMethodStub, 2, { {"-guards", 0, 0, ConvertToString}, @@ -2077,20 +2105,20 @@ {"pattern", 0, 0, ConvertToObjpattern}} }, {"::nsf::methods::class::info::method", NsfClassInfoMethodMethodStub, 2, { - {"infomethodsubcmd", 0, 0, ConvertToInfomethodsubcmd}, + {"infomethodsubcmd", 0|NSF_ARG_IS_ENUMERATION, 0, ConvertToInfomethodsubcmd}, {"name", 0, 0, ConvertToTclobj}} }, {"::nsf::methods::class::info::methods", NsfClassInfoMethodsMethodStub, 6, { - {"-callprotection", 0, 1, ConvertToCallprotection}, + {"-callprotection", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCallprotection}, {"-incontext", 0, 0, ConvertToString}, - {"-methodtype", 0, 1, ConvertToMethodtype}, + {"-methodtype", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToMethodtype}, {"-nomixins", 0, 0, ConvertToString}, {"-path", 0, 0, ConvertToString}, {"pattern", 0, 0, ConvertToString}} }, {"::nsf::methods::class::info::mixinof", NsfClassInfoMixinOfMethodStub, 3, { {"-closure", 0, 0, ConvertToString}, - {"-scope", 0, 1, ConvertToScope}, + {"-scope", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToScope}, {"pattern", 0, 0, ConvertToObjpattern}} }, {"::nsf::methods::class::info::mixinclasses", NsfClassInfoMixinclassesMethodStub, 3, { @@ -2099,7 +2127,7 @@ {"pattern", 0, 0, ConvertToObjpattern}} }, {"::nsf::methods::class::info::mixinguard", NsfClassInfoMixinguardMethodStub, 1, { - {"mixin", 1, 0, ConvertToString}} + {"mixin", NSF_ARG_REQUIRED, 0, ConvertToString}} }, {"::nsf::methods::class::info::subclass", NsfClassInfoSubclassMethodStub, 2, { {"-closure", 0, 0, ConvertToString}, @@ -2115,53 +2143,53 @@ {"methodName", 0, 0, ConvertToString}, {"-nonleaf", 0, 0, ConvertToString}, {"-objscope", 0, 0, ConvertToString}, - {"cmdName", 1, 0, ConvertToTclobj}} + {"cmdName", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::assertion", NsfAssertionCmdStub, 3, { {"object", 0, 0, ConvertToObject}, - {"assertionsubcmd", 1, 0, ConvertToAssertionsubcmd}, + {"assertionsubcmd", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 0, ConvertToAssertionsubcmd}, {"arg", 0, 0, ConvertToTclobj}} }, {"::nsf::colon", NsfColonCmdStub, 1, { {"args", 0, 0, ConvertToNothing}} }, {"::nsf::configure", NsfConfigureCmdStub, 2, { - {"configureoption", 1, 0, ConvertToConfigureoption}, + {"configureoption", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 0, ConvertToConfigureoption}, {"value", 0, 0, ConvertToTclobj}} }, {"::nsf::createobjectsystem", NsfCreateObjectSystemCmdStub, 3, { - {"rootClass", 1, 0, ConvertToTclobj}, - {"rootMetaClass", 1, 0, ConvertToTclobj}, + {"rootClass", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, + {"rootMetaClass", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, {"systemMethods", 0, 0, ConvertToTclobj}} }, {"::nsf::current", NsfCurrentCmdStub, 1, { - {"currentoption", 0, 0, ConvertToCurrentoption}} + {"currentoption", 0|NSF_ARG_IS_ENUMERATION, 0, ConvertToCurrentoption}} }, {"::nsf::__db_run_assertions", NsfDebugRunAssertionsCmdStub, 0, { } }, {"::nsf::deprecated", NsfDeprecatedCmdStub, 3, { - {"what", 1, 0, ConvertToString}, - {"oldCmd", 1, 0, ConvertToString}, + {"what", NSF_ARG_REQUIRED, 0, ConvertToString}, + {"oldCmd", NSF_ARG_REQUIRED, 0, ConvertToString}, {"newCmd", 0, 0, ConvertToString}} }, {"::nsf::dispatch", NsfDispatchCmdStub, 4, { - {"object", 1, 0, ConvertToObject}, + {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, {"-objscope", 0, 0, ConvertToString}, - {"command", 1, 0, ConvertToTclobj}, + {"command", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, {"args", 0, 0, ConvertToNothing}} }, {"::nsf::existsvar", NsfExistsVarCmdStub, 2, { - {"object", 1, 0, ConvertToObject}, - {"var", 1, 0, ConvertToString}} + {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, + {"var", NSF_ARG_REQUIRED, 0, ConvertToString}} }, {"::nsf::finalize", NsfFinalizeObjCmdStub, 0, { } }, {"::nsf::forward", NsfForwardCmdStub, 11, { - {"object", 1, 0, ConvertToObject}, + {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, {"-per-object", 0, 0, ConvertToString}, - {"method", 1, 0, ConvertToTclobj}, + {"method", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, {"-default", 0, 1, ConvertToTclobj}, {"-earlybinding", 0, 0, ConvertToString}, {"-methodprefix", 0, 1, ConvertToTclobj}, @@ -2184,61 +2212,61 @@ }, {"::nsf::is", NsfIsCmdStub, 3, { {"-complain", 0, 0, ConvertToString}, - {"constraint", 1, 0, ConvertToTclobj}, - {"value", 1, 0, ConvertToTclobj}} + {"constraint", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, + {"value", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::isobject", NsfIsObjectCmdStub, 1, { - {"object", 1, 0, ConvertToTclobj}} + {"object", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::method", NsfMethodCmdStub, 9, { - {"object", 1, 0, ConvertToObject}, + {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, {"-inner-namespace", 0, 0, ConvertToString}, {"-per-object", 0, 0, ConvertToString}, {"-public", 0, 0, ConvertToString}, - {"name", 1, 0, ConvertToTclobj}, - {"args", 1, 0, ConvertToTclobj}, - {"body", 1, 0, ConvertToTclobj}, + {"name", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, + {"args", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, + {"body", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, {"-precondition", 0, 1, ConvertToTclobj}, {"-postcondition", 0, 1, ConvertToTclobj}} }, {"::nsf::methodproperty", NsfMethodPropertyCmdStub, 5, { - {"object", 1, 0, ConvertToObject}, + {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, {"-per-object", 0, 0, ConvertToString}, - {"methodName", 1, 0, ConvertToTclobj}, - {"methodproperty", 1, 0, ConvertToMethodproperty}, + {"methodName", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, + {"methodproperty", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 0, ConvertToMethodproperty}, {"value", 0, 0, ConvertToTclobj}} }, {"::nsf::my", NsfMyCmdStub, 3, { {"-local", 0, 0, ConvertToString}, - {"method", 1, 0, ConvertToTclobj}, + {"method", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, {"args", 0, 0, ConvertToNothing}} }, {"::nsf::nscopycmds", NsfNSCopyCmdsCmdStub, 2, { - {"fromNs", 1, 0, ConvertToTclobj}, - {"toNs", 1, 0, ConvertToTclobj}} + {"fromNs", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, + {"toNs", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::nscopyvars", NsfNSCopyVarsCmdStub, 2, { - {"fromNs", 1, 0, ConvertToTclobj}, - {"toNs", 1, 0, ConvertToTclobj}} + {"fromNs", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, + {"toNs", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::next", NsfNextCmdStub, 1, { {"arguments", 0, 0, ConvertToTclobj}} }, {"::nsf::qualify", NsfQualifyObjCmdStub, 1, { - {"name", 1, 0, ConvertToTclobj}} + {"name", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::relation", NsfRelationCmdStub, 3, { {"object", 0, 0, ConvertToObject}, - {"relationtype", 1, 0, ConvertToRelationtype}, + {"relationtype", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 0, ConvertToRelationtype}, {"value", 0, 0, ConvertToTclobj}} }, {"::nsf::setvar", NsfSetVarCmdStub, 3, { - {"object", 1, 0, ConvertToObject}, - {"variable", 1, 0, ConvertToTclobj}, + {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, + {"variable", NSF_ARG_REQUIRED, 0, ConvertToTclobj}, {"value", 0, 0, ConvertToTclobj}} }, {"::nsf::setter", NsfSetterCmdStub, 3, { - {"object", 1, 0, ConvertToObject}, + {"object", NSF_ARG_REQUIRED, 0, ConvertToObject}, {"-per-object", 0, 0, ConvertToString}, {"parameter", 0, 0, ConvertToTclobj}} }, @@ -2248,7 +2276,7 @@ {"::nsf::methods::object::autoname", NsfOAutonameMethodStub, 3, { {"-instance", 0, 0, ConvertToString}, {"-reset", 0, 0, ConvertToString}, - {"name", 1, 0, ConvertToTclobj}} + {"name", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::methods::object::cleanup", NsfOCleanupMethodStub, 0, { } @@ -2260,18 +2288,18 @@ } }, {"::nsf::methods::object::exists", NsfOExistsMethodStub, 1, { - {"var", 1, 0, ConvertToString}} + {"var", NSF_ARG_REQUIRED, 0, ConvertToString}} }, {"::nsf::methods::object::filterguard", NsfOFilterGuardMethodStub, 2, { - {"filter", 1, 0, ConvertToString}, - {"guard", 1, 0, ConvertToTclobj}} + {"filter", NSF_ARG_REQUIRED, 0, ConvertToString}, + {"guard", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::methods::object::instvar", NsfOInstVarMethodStub, 1, { {"args", 0, 0, ConvertToNothing}} }, {"::nsf::methods::object::mixinguard", NsfOMixinGuardMethodStub, 2, { - {"mixin", 1, 0, ConvertToString}, - {"guard", 1, 0, ConvertToTclobj}} + {"mixin", NSF_ARG_REQUIRED, 0, ConvertToString}, + {"guard", NSF_ARG_REQUIRED, 0, ConvertToTclobj}} }, {"::nsf::methods::object::noinit", NsfONoinitMethodStub, 0, { } @@ -2292,7 +2320,7 @@ } }, {"::nsf::methods::object::vwait", NsfOVwaitMethodStub, 1, { - {"varname", 1, 0, ConvertToString}} + {"varname", NSF_ARG_REQUIRED, 0, ConvertToString}} }, {"::nsf::methods::object::info::children", NsfObjInfoChildrenMethodStub, 2, { {"-type", 0, 1, ConvertToClass}, @@ -2302,7 +2330,7 @@ } }, {"::nsf::methods::object::info::filterguard", NsfObjInfoFilterguardMethodStub, 1, { - {"name", 1, 0, ConvertToString}} + {"name", NSF_ARG_REQUIRED, 0, ConvertToString}} }, {"::nsf::methods::object::info::filtermethods", NsfObjInfoFiltermethodsMethodStub, 3, { {"-guards", 0, 0, ConvertToString}, @@ -2323,7 +2351,7 @@ } }, {"::nsf::methods::object::info::is", NsfObjInfoIsMethodStub, 1, { - {"objectkind", 0, 0, ConvertToObjectkind}} + {"objectkind", 0|NSF_ARG_IS_ENUMERATION, 0, ConvertToObjectkind}} }, {"::nsf::methods::object::info::lookupfilter", NsfObjInfoLookupFilterMethodStub, 1, { {"filter", 0, 0, ConvertToString}} @@ -2332,25 +2360,25 @@ {"name", 0, 0, ConvertToTclobj}} }, {"::nsf::methods::object::info::lookupmethods", NsfObjInfoLookupMethodsMethodStub, 7, { - {"-callprotection", 0, 1, ConvertToCallprotection}, + {"-callprotection", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCallprotection}, {"-incontext", 0, 0, ConvertToString}, - {"-methodtype", 0, 1, ConvertToMethodtype}, + {"-methodtype", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToMethodtype}, {"-nomixins", 0, 0, ConvertToString}, {"-path", 0, 0, ConvertToString}, - {"-source", 0, 1, ConvertToSource}, + {"-source", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToSource}, {"pattern", 0, 0, ConvertToString}} }, {"::nsf::methods::object::info::lookupslots", NsfObjInfoLookupSlotsMethodStub, 1, { {"-type", 0, 1, ConvertToClass}} }, {"::nsf::methods::object::info::method", NsfObjInfoMethodMethodStub, 2, { - {"infomethodsubcmd", 0, 0, ConvertToInfomethodsubcmd}, + {"infomethodsubcmd", 0|NSF_ARG_IS_ENUMERATION, 0, ConvertToInfomethodsubcmd}, {"name", 0, 0, ConvertToTclobj}} }, {"::nsf::methods::object::info::methods", NsfObjInfoMethodsMethodStub, 6, { - {"-callprotection", 0, 1, ConvertToCallprotection}, + {"-callprotection", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToCallprotection}, {"-incontext", 0, 0, ConvertToString}, - {"-methodtype", 0, 1, ConvertToMethodtype}, + {"-methodtype", 0|NSF_ARG_IS_ENUMERATION, 1, ConvertToMethodtype}, {"-nomixins", 0, 0, ConvertToString}, {"-path", 0, 0, ConvertToString}, {"pattern", 0, 0, ConvertToString}} @@ -2361,7 +2389,7 @@ {"pattern", 0, 0, ConvertToObjpattern}} }, {"::nsf::methods::object::info::mixinguard", NsfObjInfoMixinguardMethodStub, 1, { - {"mixin", 1, 0, ConvertToString}} + {"mixin", NSF_ARG_REQUIRED, 0, ConvertToString}} }, {"::nsf::methods::object::info::parent", NsfObjInfoParentMethodStub, 0, { } Index: tests/parameters.tcl =================================================================== diff -u -r137f717b92ca826ee943e8c4e74d3151859c378a -r7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6 --- tests/parameters.tcl (.../parameters.tcl) (revision 137f717b92ca826ee943e8c4e74d3151859c378a) +++ tests/parameters.tcl (.../parameters.tcl) (revision 7a6e32605412db15c6b9a1d61ce0a9dfd92bfbf6) @@ -1309,5 +1309,8 @@ ? {Foo info method parametersyntax classarg} "?-x class?" ? {Foo info method parametersyntax upperarg} "?-x upper?" ? {Foo info method parametersyntax metaclassarg} "?-x metaclass?" - + + # return enumeration type + ? {nx::Class info method parametersyntax "info mixinof"} \ + "?-closure? ?-scope all|class|object? ?pattern?" } \ No newline at end of file