Index: TODO =================================================================== diff -u -r9e766c226c7ddb35a4aa20ca7a9e8d6678a7c9e2 -rdadc7c6c6858ff3b816ff4cc585e0d76684ec374 --- TODO (.../TODO) (revision 9e766c226c7ddb35a4aa20ca7a9e8d6678a7c9e2) +++ TODO (.../TODO) (revision dadc7c6c6858ff3b816ff4cc585e0d76684ec374) @@ -4353,6 +4353,10 @@ since ns_cache implementation needs to be objectified; newest NaviServer version works as well with older nx) +- moved "/obj/ info slot definition|..." to + "/obj/ info object slot definition|..." for consistency +- provided "parametersyntax()" for "object mixin" and "object filter" + ======================================================================== TODO: - reconsider @@ -4369,16 +4373,39 @@ - flatten out interface asymmetry between methods and properties methods: - query defined: "/obj|cls/ info methods ?pattern?" -> names - obtain definition: "/obj|cls/ info method definition /name|handle/" -> single definiton - query callable: "/obj|cls/ info lookup method /name/" -> handle (where is the method defined) - query callable: "/obj|cls/ info lookup methods ?pattern?" -> names (what methods can be called) + query defined: "/obj|cls/ info ?object? methods ?pattern?" -> names + obtain definition: "/obj|cls/ info ?object? method definition /name|handle/" -> single definiton + query callable: "/obj|cls/ info lookup method /name/" -> handle (where is the method defined) + query callable: "/obj|cls/ info lookup methods ... ?pattern?" -> names (what methods can be called) properties|variables - query defined: "/obj|cls/ info slot names ?pattern?" -> names - obtain definition: "/obj|cls/ info slot definitions ?pattern?" -> list of definitions - query callable: "/obj|cls/ info lookup slots -source .. ?pattern?" -> slot objects (where are parameters defined) + query defined: "/obj|cls/ info ?object? slot names ?pattern?" -> names + obtain definition: "/obj|cls/ info ?object? slot definitions ?pattern?" -> list definitions + obtain handles: "/obj|cls/ info ?object? slot objects ?pattern?" -> slot objects + query callable: "/obj|cls/ info lookup slots ... ?pattern?" -> slot objects (where are parameters defined) + method parameters: + query defined "/obj|cls/ info method args /name|handle/" -> list parameter names (e.g. x y) + obtain definition: "/obj|cls/ info method syntax /name|handle/" -> syntax notation of parameters (e.g. x ?y?) + obtain definition: "/obj|cls/ info method parameter /name|handle/" -> list of parameters for specified method (e.g. x:integer y) + + object parameters: + query defined: "/cls/ info parameter list ?pattern?" -> list names with potential "-" (-a -b) + "/cls/ info parameter names ?pattern?" -> list names (a b) + obtain syntax: "/cls/ info parameter syntax ?pattern?" -> syntax notation + obtain definition: "/cls/ info parameter definitions ?pattern?" -> list definitions + query available: "/obj|cls/ info lookup parameter names ?pattern?" -> list names + "/obj|cls/ info lookup parameter list ?pattern?" -> list names with potential "-" (-a -b) + "/obj|cls/ info lookup parameter syntax ?pattern?" -> syntax notation of parameters (e.g. ?-a x? ?-b b?) + "/obj|cls/ info lookup parameter definitions ?pattern?" -> list definitions + "/obj|cls/ configure" -> syntax notation of parameters (e.g. ?-a x? ?-b b?) + + + + + + + + more detail queries for "info method" and "info slot" alternative: Index: generic/nsf.c =================================================================== diff -u -rf858f142f5fab4f88996b3eb709c3afa55114be9 -rdadc7c6c6858ff3b816ff4cc585e0d76684ec374 --- generic/nsf.c (.../nsf.c) (revision f858f142f5fab4f88996b3eb709c3afa55114be9) +++ generic/nsf.c (.../nsf.c) (revision dadc7c6c6858ff3b816ff4cc585e0d76684ec374) @@ -9299,13 +9299,16 @@ } Tcl_AppendLimitedToObj(argStringObj, " ", 1, INT_MAX, NULL); } + if (pPtr->converter == ConvertToNothing && strcmp(pPtr->name, "args") == 0) { Tcl_AppendLimitedToObj(argStringObj, "?arg ...?", 9, INT_MAX, NULL); } else if (pPtr->flags & NSF_ARG_REQUIRED) { if ((pPtr->flags & NSF_ARG_IS_ENUMERATION)) { Tcl_AppendLimitedToObj(argStringObj, ParamGetDomain(pPtr), -1, INT_MAX, NULL); } else { + Tcl_AppendLimitedToObj(argStringObj, "/", 1, INT_MAX, NULL); NsfParamDefsSyntaxOne(argStringObj, pPtr); + Tcl_AppendLimitedToObj(argStringObj, "/", 1, INT_MAX, NULL); } } else { Tcl_AppendLimitedToObj(argStringObj, "?", 1, INT_MAX, NULL); @@ -17617,12 +17620,22 @@ } Tcl_AppendToObj(list, "?arg ...?", 9); } else { - Tcl_Obj *innerlist = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, innerlist, Tcl_NewStringObj(args->name, -1)); - if (printStyle == NSF_PARAMS_PARAMETER && args->defValuePtr) { - Tcl_ListObjAppendElement(interp, innerlist, args->defValuePtr); + if (printStyle == NSF_PARAMS_SYNTAX) { + /* a default means that the arg is optional xxxxxx */ + if (args->defValuePtr) { + Tcl_AppendToObj(list, "?", 1); + Tcl_AppendToObj(list, args->name, -1); + Tcl_AppendToObj(list, " ", 1); + Tcl_ListObjAppendElement(interp, list, args->defValuePtr); + Tcl_AppendToObj(list, "?", 1); + } else { + Tcl_AppendToObj(list, "/", 1); + Tcl_AppendToObj(list, args->name, -1); + Tcl_AppendToObj(list, "/", 1); + } + } else { + Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(args->name, -1)); } - Tcl_ListObjAppendElement(interp, list, innerlist); } } Index: library/lib/nx-traits.tcl =================================================================== diff -u -rf858f142f5fab4f88996b3eb709c3afa55114be9 -rdadc7c6c6858ff3b816ff4cc585e0d76684ec374 --- library/lib/nx-traits.tcl (.../nx-traits.tcl) (revision f858f142f5fab4f88996b3eb709c3afa55114be9) +++ library/lib/nx-traits.tcl (.../nx-traits.tcl) (revision dadc7c6c6858ff3b816ff4cc585e0d76684ec374) @@ -78,7 +78,7 @@ $obj public alias $newName $traitMethodHandle # We define property inheritance for the time being only for # instance properties. - foreach d [$traitName info slot definitions] { + foreach d [$traitName info object slot definitions] { $obj property $d } } Index: tests/cget.test =================================================================== diff -u -rf858f142f5fab4f88996b3eb709c3afa55114be9 -rdadc7c6c6858ff3b816ff4cc585e0d76684ec374 --- tests/cget.test (.../cget.test) (revision f858f142f5fab4f88996b3eb709c3afa55114be9) +++ tests/cget.test (.../cget.test) (revision dadc7c6c6858ff3b816ff4cc585e0d76684ec374) @@ -36,7 +36,7 @@ # - wrong parameter # - parameter without a value # - ? {p1 cget} {wrong # of arguments: should be "cget name"} + ? {p1 cget} {wrong # of arguments: should be "cget /name/"} ? {p1 cget -foo} {cannot lookup parameter value for -foo} ? {p1 cget foo} {cannot lookup parameter value for foo} ? {p1 cget -sex} {can't read "sex": no such variable} Index: tests/method-parameter.test =================================================================== diff -u -r59e100d383b22ea1407f5e5c40e303f2c6bb9027 -rdadc7c6c6858ff3b816ff4cc585e0d76684ec374 --- tests/method-parameter.test (.../method-parameter.test) (revision 59e100d383b22ea1407f5e5c40e303f2c6bb9027) +++ tests/method-parameter.test (.../method-parameter.test) (revision dadc7c6c6858ff3b816ff4cc585e0d76684ec374) @@ -58,7 +58,7 @@ ? {p3a 100 -x 1 -y 1 200} {100 1 1 200} ? {p3a 100 -xx 1 -y 1 200} {invalid non-positional argument '-xx', valid are : -x, -y; - should be "p3a a ?-x value? ?-y value? b ?-z value?"} + should be "p3a /a/ ?-x value? ?-y value? /b/ ?-z value?"} } nx::Test case unknown-handler {