Index: TODO =================================================================== diff -u -r2a2ccb5fb66078bf66fbd242592165cc43f7b87d -r1bc14766b62efc778ac40c26b1bbabac116a9f80 --- TODO (.../TODO) (revision 2a2ccb5fb66078bf66fbd242592165cc43f7b87d) +++ TODO (.../TODO) (revision 1bc14766b62efc778ac40c26b1bbabac116a9f80) @@ -1629,6 +1629,9 @@ type instead of "arg" when possible (eg ..... ?-x object? ....) - extended regression test +- factored out ParamGetType() to obtain from a paramPtr a type string +- + TODO: Index: generic/nsf.c =================================================================== diff -u -r595314aa4926c6455aa34fa4a10ca782e0e978df -r1bc14766b62efc778ac40c26b1bbabac116a9f80 --- generic/nsf.c (.../nsf.c) (revision 595314aa4926c6455aa34fa4a10ca782e0e978df) +++ generic/nsf.c (.../nsf.c) (revision 1bc14766b62efc778ac40c26b1bbabac116a9f80) @@ -6009,6 +6009,26 @@ return listObj; } +CONST char * +ParamGetType(NsfParam CONST *paramPtr) { + CONST char *result = "value"; + + assert(paramPtr); + if (paramPtr->type) { + if (paramPtr->converter == ConvertViaCmd) { + result = paramPtr->type + 5; + } else if (strcmp(paramPtr->type, "stringtype") == 0) { + if (paramPtr->converterArg) { + result = ObjStr(paramPtr->converterArg); + } + } else { + result = paramPtr->type; + } + } + + return result; +} + static Tcl_Obj * ParamDefsSyntax(Tcl_Interp *interp, NsfParam CONST *paramPtr) { Tcl_Obj *argStringObj = Tcl_NewStringObj("", 0); @@ -6024,28 +6044,11 @@ Tcl_AppendLimitedToObj(argStringObj, "?", 1, INT_MAX, NULL); Tcl_AppendLimitedToObj(argStringObj, pPtr->name, -1, INT_MAX, NULL); if (pPtr->nrArgs >0) { - if (pPtr->type) { - Tcl_AppendLimitedToObj(argStringObj, " ", 1, INT_MAX, NULL); - - if (pPtr->converter == ConvertViaCmd) { - Tcl_AppendLimitedToObj(argStringObj, pPtr->type + 5, -1, INT_MAX, NULL); - } else if (strcmp(pPtr->type, "stringtype") == 0) { - if (pPtr->converterArg) { - Tcl_AppendLimitedToObj(argStringObj, ObjStr(pPtr->converterArg), -1, INT_MAX, NULL); - } else { - Tcl_AppendLimitedToObj(argStringObj, "arg", 3, INT_MAX, NULL); - } - } else { - Tcl_AppendLimitedToObj(argStringObj, pPtr->type, -1, INT_MAX, NULL); - } - - } else { - Tcl_AppendLimitedToObj(argStringObj, " arg", 4, INT_MAX, NULL); - } + Tcl_AppendLimitedToObj(argStringObj, " ", 1, INT_MAX, NULL); + Tcl_AppendLimitedToObj(argStringObj, ParamGetType(pPtr), -1, INT_MAX, NULL); if (pPtr->flags & NSF_ARG_MULTIVALUED) { - Tcl_AppendLimitedToObj(argStringObj, " list", 5, INT_MAX, NULL); + Tcl_AppendLimitedToObj(argStringObj, " ...", 4, INT_MAX, NULL); } - //fprintf(stderr, "type of %s = %s\n",pPtr->name,pPtr->type); } Tcl_AppendLimitedToObj(argStringObj, "?", 1, INT_MAX, NULL); } @@ -8336,7 +8339,7 @@ * Otherwise: normal method dispatch * * If we are already in the precedence ordering, then advance - * past our last point; otherwise (if clPtr==0) begin from the start. + * past our last point; otherwise (if clPtr==NULL) begin from the start. * * When a mixin or filter chain reached its end, we have to search * the obj-specific methods as well. Index: library/xotcl/tests/testx.xotcl =================================================================== diff -u -r42921ea037c4334cb6ecc565978330f9d8e902ec -r1bc14766b62efc778ac40c26b1bbabac116a9f80 --- library/xotcl/tests/testx.xotcl (.../testx.xotcl) (revision 42921ea037c4334cb6ecc565978330f9d8e902ec) +++ library/xotcl/tests/testx.xotcl (.../testx.xotcl) (revision 1bc14766b62efc778ac40c26b1bbabac116a9f80) @@ -3996,11 +3996,11 @@ catch { o y 4 56 5 } m - errorCheck $m {too many arguments: should be "y ?-x arg? ?-a arg? a b"} "wrong \# check 1" + errorCheck $m {too many arguments: should be "y ?-x value? ?-a value? a b"} "wrong \# check 1" catch { o y } m - errorCheck $m {not enough arguments: should be "y ?-x arg? ?-a arg? a b"} "wrong \# check 2" + errorCheck $m {not enough arguments: should be "y ?-x value? ?-a value? a b"} "wrong \# check 2" catch { o y -x 1 } m Index: tests/parameters.tcl =================================================================== diff -u -r2a2ccb5fb66078bf66fbd242592165cc43f7b87d -r1bc14766b62efc778ac40c26b1bbabac116a9f80 --- tests/parameters.tcl (.../parameters.tcl) (revision 2a2ccb5fb66078bf66fbd242592165cc43f7b87d) +++ tests/parameters.tcl (.../parameters.tcl) (revision 1bc14766b62efc778ac40c26b1bbabac116a9f80) @@ -1311,9 +1311,9 @@ } ? {Foo info method parametersyntax noarg} "" - ? {Foo info method parametersyntax onearg} "?-x arg?" + ? {Foo info method parametersyntax onearg} "?-x value?" ? {Foo info method parametersyntax intarg} "?-x integer?" - ? {Foo info method parametersyntax intsarg} "?-x integer list?" + ? {Foo info method parametersyntax intsarg} "?-x integer ...?" ? {Foo info method parametersyntax boolarg} "?-x boolean?" ? {Foo info method parametersyntax classarg} "?-x class?" ? {Foo info method parametersyntax upperarg} "?-x upper?"