Index: generic/xotcl.c =================================================================== diff -u -r8cd07ec2847e5ccff9f486950459d72a4d497e8b -r6ca97641fdc0a1a85b5ec603e44ed84f6b15bf1c --- generic/xotcl.c (.../xotcl.c) (revision 8cd07ec2847e5ccff9f486950459d72a4d497e8b) +++ generic/xotcl.c (.../xotcl.c) (revision 6ca97641fdc0a1a85b5ec603e44ed84f6b15bf1c) @@ -6737,9 +6737,13 @@ static int ListPrecedence(Tcl_Interp *interp, XOTclObject *obj, char *pattern, int intrinsicOnly) { XOTclClasses *pl, *precedenceList; + + /*fprintf(stderr, "ListPrecedence %s pattern %s, intrinsic %d\n", + ObjStr(obj->cmdName), pattern, intrinsicOnly);*/ + Tcl_ResetResult(interp); precedenceList = ComputePrecedenceList(interp, obj, pattern, !intrinsicOnly); - for (pl = precedenceList; pl != 0; pl = pl->nextPtr) { + for (pl = precedenceList; pl; pl = pl->nextPtr) { char *name = className(pl->cl); Tcl_AppendElement(interp, name); } @@ -9396,14 +9400,50 @@ } static int +getModifiers(int objc, int offset, Tcl_Obj *CONST objv[], CONST char *options[], int *set) { + int i, j, found, count = 0; + char *to; + + *set = 0; + for (i = offset; i < objc; i++) { + to = ObjStr(objv[i]); + if (to[0] == '-') { + found = 0; + for (j=0; options[j]; j++) { + if (strcmp(to,options[j]) == 0) { + count++; + *set |= 1 << j; + found = 1; + } + } + /* if we find a modifier that was not given, stop processing */ + if (!found) break; + /* '--' stops modifiers */ + if (to[1] == '-') break; + } + } + return count; +} + +static int XOTclObjInfoPrecedenceMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { XOTclObject *obj; + static CONST char *options[] = {"-intrinsic", NULL}; + int modifiers, withPrecedence, set, args; + char *pattern; - if (objc < 2 || objc > 3) return XOTclObjErrArgCnt(interp, objv[0], NULL, " ?pattern?"); + modifiers = getModifiers(objc, 2, objv, options, &set); + args = objc-modifiers; + + if (args < 2 || args > 3) + return XOTclObjErrArgCnt(interp, objv[0], NULL, " ?-intrinsic? ?pattern?"); + pattern = args == 3 ? ObjStr(objv[objc-1]) : NULL; + if (XOTclObjConvertObject(interp, objv[1], &obj) != TCL_OK) return XOTclObjErrType(interp, objv[1], "Object"); - return ListPrecedence(interp, obj, objc == 3 ? ObjStr(objv[2]) : NULL, 0); + withPrecedence = (modifiers>0); + return ListPrecedence(interp, obj, pattern, withPrecedence); } static int @@ -12153,31 +12193,7 @@ return ListHeritage(interp, cl, objc == 3 ? ObjStr(objv[2]) : NULL); } -static int -getModifiers(int objc, int offset, Tcl_Obj *CONST objv[], CONST char *options[], int *set) { - int i, j, found, count = 0; - char *to; - *set = 0; - for (i = offset; i < objc; i++) { - to = ObjStr(objv[i]); - if (to[0] == '-') { - found = 0; - for (j=0; options[j]; j++) { - if (strcmp(to,options[j]) == 0) { - count++; - *set |= 1 << j; - found = 1; - } - } - /* if we find a modifier that was not given, stop processing */ - if (!found) break; - /* '--' stops modifiers */ - if (to[1] == '-') break; - } - } - return count; -} static int XOTclClassInfoInstancesMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Index: tests/testx.xotcl =================================================================== diff -u -r8cd07ec2847e5ccff9f486950459d72a4d497e8b -r6ca97641fdc0a1a85b5ec603e44ed84f6b15bf1c --- tests/testx.xotcl (.../testx.xotcl) (revision 8cd07ec2847e5ccff9f486950459d72a4d497e8b) +++ tests/testx.xotcl (.../testx.xotcl) (revision 6ca97641fdc0a1a85b5ec603e44ed84f6b15bf1c) @@ -2771,7 +2771,7 @@ Recreated recreateObj recreateObj destroy errorCheck [set ::recreateFilterResult] \ - " ::recreateObj+::xotcl::Object->configure ::recreateObj+::xotcl::Object->init ::recreateObj+::xotcl::Object->cleanup ::recreateObj+::xotcl::Object->configure ::recreateObj+::xotcl::Object->init ::recreateObj+::xotcl::Object->destroy" \ + " ::recreateObj+::xotcl::Object->configure ::recreateObj+::xotcl::Object->setvalues ::recreateObj+::xotcl::Object->init ::recreateObj+::xotcl::Object->cleanup ::recreateObj+::xotcl::Object->configure ::recreateObj+::xotcl::Object->setvalues ::recreateObj+::xotcl::Object->init ::recreateObj+::xotcl::Object->destroy" \ "recreateObj - recreateFilterResult" if {$i == 0} { errorCheck [set ::recreateMixinResult] \ @@ -3350,9 +3350,8 @@ ::errorCheck [d1 info precedence] "::D1 ::D ::C ::xotcl::Object ::oo::object" "d1 info precedence" ::errorCheck [d1 info precedence *] "::D1 ::D ::C ::xotcl::Object ::oo::object" "d1 info precedence *" ::errorCheck [d1 info precedence ::D*] "::D1 ::D" "d1 info precedence pattern" -puts stderr 1 - ::errorCheck [d1 info precedence -intrinsic] "::D ::C ::xotcl::Object" "d1 info precedence -intrinsic" - ::errorCheck [d1 info precedence -intrinsic *] "::D ::C ::xotcl::Object" "d1 info precedence -intrinsic *" + ::errorCheck [d1 info precedence -intrinsic] "::D ::C ::xotcl::Object ::oo::object" "d1 info precedence -intrinsic" + ::errorCheck [d1 info precedence -intrinsic *] "::D ::C ::xotcl::Object ::oo::object" "d1 info precedence -intrinsic *" ::errorCheck [d1 info precedence -intrinsic ::D*] "::D" "d1 info precedence -intrinsic pattern" d1 destroy