Index: ChangeLog =================================================================== diff -u -rdc0040a6ddddf73e61c2a7d733ad7e15127e6bc1 -rf209c50ea8cb651d0dea25206301e45202217797 --- ChangeLog (.../ChangeLog) (revision dc0040a6ddddf73e61c2a7d733ad7e15127e6bc1) +++ ChangeLog (.../ChangeLog) (revision f209c50ea8cb651d0dea25206301e45202217797) @@ -1,6 +1,6 @@ copyhandler: we cannot use "set" method, since the object system might to provide it Method ::xotcl::Object->__exitHandler became ::xotcl::__exitHandler -configure returns now instead of the posision the list of arguments preceding dash-arguments +configure returns now instead of the position the list of arguments preceding dash-arguments todo: - new parse() command is just used for many of the "instxxx" info commands, @@ -43,10 +43,10 @@ Slot initCmd - the current (1.6.3) implementation turns initcmd into a trace to be executed the first time, the slot is read. The conversion to trace - happes in predefined.xotcl. Alternatively, we could execute the + happens in predefined.xotcl. Alternatively, we could execute the slot directly to have some alternative to defaults, where e.g commands can be executed at creation time. The current solution for - parseing, whether the default contains [] or $ is rather ugly. + parsing, whether the default contains [] or $ is rather ugly. - the old semantic of __initcmd is gone. @@ -65,10 +65,11 @@ 2009-06-27 - changed method name "instdestroy" into "dealloc" - - replaced occurances of "instdestroy" by "dealloc" in documentation + - replaced occurrences of "instdestroy" by "dealloc" in documentation - new file: tclAPI.h - added generator for tclAPI.h - - defined 8 info methods based on the new objv parseing infrastructure + - generating stub functions to reduce potential errors + - defined 8 info methods based on the new objv parsing infrastructure 2009-06-25 - new command: @@ -83,7 +84,7 @@ ::xotcl::createobjectsystem ::oo::object ::oo::class In general, it would be possible to remove an objects system at - runtime, but there is so far no tcl interface for this. + runtime, but there is so far no Tcl interface for this. - extended framework to work with multiple root classes @@ -123,10 +124,10 @@ 2009-03-02 - some small performance improvements (use CreateHashEntry instead - of FindHashEntry, remove unneded argument, improve order of long + of FindHashEntry, remove unneeded argument, improve order of long and expressions) - some code cleanup - - new methods, when compiled with tcl 8.5; + - new methods, when compiled with Tcl 8.5; + MakeProcError (producing error messages from xotcl methods) + PushProcCallFrame (compile method to byte-code) The new support allows to call code at the begin of a proc Index: generic/gentclAPI.tcl =================================================================== diff -u -rdc0040a6ddddf73e61c2a7d733ad7e15127e6bc1 -rf209c50ea8cb651d0dea25206301e45202217797 --- generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision dc0040a6ddddf73e61c2a7d733ad7e15127e6bc1) +++ generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision f209c50ea8cb651d0dea25206301e45202217797) @@ -13,39 +13,125 @@ set l [list] foreach argDefinition $argDefinitions { array set "" $argDefinition - if {$(-type) eq ""} {set type NULL} {set type "\"$(-type)\""} + switch $(-type) { + "" {set type NULL} + default {set type "\"$(-type)\""} + } lappend l "{\"$(-argName)\", $(-required), $(-nrArgs), $type}" } join $l ",\n " } -proc genc {} { +proc gencall {argDefinitions cDefsVar ifDefVar arglistVar preVar postVar} { + upvar $cDefsVar cDefs $ifDefVar ifDef $arglistVar arglist $preVar pre $postVar post + set c [list] + set a [list] + set i 0 + set pre ""; set post "" + foreach argDefinition $argDefinitions { + array set "" $argDefinition + set ifSet 0 + if {[regexp {^-(.*)$} $(-argName) _ switchName]} { + set varName with[string totitle $switchName] + set calledArg $varName + set type int + } else { + set varName $(-argName) + set calledArg $varName + switch $(-type) { + "" {set type "char *"} + "class" {set type "XOTclClass *"} + "tclobj" {set type "Tcl_Obj *"} + "objpattern" { + set type "Tcl_Obj *" + lappend c "char *${varName}String = NULL;" "XOTclObject *${varName}Obj = NULL;" + set calledArg "${varName}String, ${varName}Obj" + lappend if "char *${varName}String" "XOTclObject *${varName}Obj" + set ifSet 1 + append pre [subst -nocommands { + if (getMatchObject3(interp, ${varName}, &pc, &${varName}Obj, &${varName}String) == -1) { + return TCL_OK; + } + }] + append post [subst -nocommands { + if (${varName}Obj) { + Tcl_SetObjResult(interp, returnCode ? ${varName}Obj->cmdName : XOTclGlobalObjects[XOTE_EMPTY]); + } + }] + } + } + } + if {!$ifSet} {lappend if "$type $varName"} + lappend c [subst -nocommands {$type $varName = ($type)pc.clientData[$i];}] + lappend a $calledArg + incr i + } + set ifDef [join $if ", "] + set cDefs [join $c "\n "] + set arglist [join $a ", "] +} + + +proc genifds {} { set decls "" set enums [list] set ifds [list] foreach key [lsort [array names ::definitions]] { array set d $::definitions($key) - append decls "static int $d(implementation)$::objCmdProc\n" + append decls "static int $d(stub)$::objCmdProc\n" lappend enums $d(idx) - lappend ifds "{\"$d(methodName)\", $d(implementation), {\n [genifd $d(argDefintions)]}\n}" + lappend ifds "{\"$d(methodName)\", $d(stub), {\n [genifd $d(argDefintions)]}\n}" + + gencall $d(argDefintions) cDefs ifDef arglist pre post + append decls "static int $d(implementation)(Tcl_Interp *interp, $ifDef);\n" + if {$post ne ""} { + append cDefs "\n int returnCode;" + set call "returnCode = $d(implementation)(interp, $arglist);" + set post [string trimright $post] + append post "\n return TCL_OK;" + } else { + set call "return $d(implementation)(interp, $arglist);" + } + append fns [subst -nocommands { +static int +$d(stub)(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + parseContext pc; + if (parse2(clientData, interp, objc, objv, $d(idx), &pc) != TCL_OK) { + return TCL_ERROR; + } else { + $cDefs +$pre + $call +$post } +} + }] + } + puts { typedef struct { char *methodName; Tcl_ObjCmdProc *proc; interfaceDefinition ifd; } methodDefinition2; + +static int parse2(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], + int idx, parseContext *pc); +static int getMatchObject3(Tcl_Interp *interp, Tcl_Obj *patternObj, parseContext *pc, + XOTclObject **matchObject, char **pattern); } puts $decls set enumString [join $enums ",\n "] puts "enum {\n $enumString\n} XOTclMethods;\n" + puts $fns set definitionString [join $ifds ",\n"] puts "static methodDefinition2 methodDefinitons\[\] = \{\n$definitionString\n\};\n" } proc methodDefinition {methodName methodType implementation argDefinitions} { set d(methodName) $methodName set d(implementation) $implementation + set d(stub) ${implementation}Stub set d(methodType) $methodType set d(idx) ${implementation}Idx set completed [list] @@ -92,7 +178,7 @@ {-argName "class" -required 1 -nrargs 0 -type class} {-argName "methodName" -required 1} {-argName "arg" -required 1} - {-argName "var" -required 1} + {-argName "var" -required 1 -type tclobj} } infoClassMethod instfilter XOTclClassInfoInstfilterMethod { @@ -108,4 +194,4 @@ -genc \ No newline at end of file +genifds \ No newline at end of file Index: generic/tclAPI.h =================================================================== diff -u -rdc0040a6ddddf73e61c2a7d733ad7e15127e6bc1 -rf209c50ea8cb651d0dea25206301e45202217797 --- generic/tclAPI.h (.../tclAPI.h) (revision dc0040a6ddddf73e61c2a7d733ad7e15127e6bc1) +++ generic/tclAPI.h (.../tclAPI.h) (revision f209c50ea8cb651d0dea25206301e45202217797) @@ -4,15 +4,28 @@ Tcl_ObjCmdProc *proc; interfaceDefinition ifd; } methodDefinition2; + +static int parse2(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], + int idx, parseContext *pc); +static int getMatchObject3(Tcl_Interp *interp, Tcl_Obj *patternObj, parseContext *pc, + XOTclObject **matchObject, char **pattern); -static int XOTclClassInfoHeritageMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int XOTclClassInfoInstancesMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int XOTclClassInfoInstargsMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int XOTclClassInfoInstbodyMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int XOTclClassInfoInstcommandsMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int XOTclClassInfoInstdefaultMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int XOTclClassInfoInstfilterMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int XOTclClassInfoInstfilterguardMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int XOTclClassInfoHeritageMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int XOTclClassInfoHeritageMethod(Tcl_Interp *interp, XOTclClass * class, char * pattern); +static int XOTclClassInfoInstancesMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int XOTclClassInfoInstancesMethod(Tcl_Interp *interp, XOTclClass * class, int withClosure, char *patternString, XOTclObject *patternObj); +static int XOTclClassInfoInstargsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int XOTclClassInfoInstargsMethod(Tcl_Interp *interp, XOTclClass * class, char * methodName); +static int XOTclClassInfoInstbodyMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int XOTclClassInfoInstbodyMethod(Tcl_Interp *interp, XOTclClass * class, char * methodName); +static int XOTclClassInfoInstcommandsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int XOTclClassInfoInstcommandsMethod(Tcl_Interp *interp, XOTclClass * class, char * pattern); +static int XOTclClassInfoInstdefaultMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int XOTclClassInfoInstdefaultMethod(Tcl_Interp *interp, XOTclClass * class, char * methodName, char * arg, Tcl_Obj * var); +static int XOTclClassInfoInstfilterMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int XOTclClassInfoInstfilterMethod(Tcl_Interp *interp, XOTclClass * class, int withGuards, char * pattern); +static int XOTclClassInfoInstfilterguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int XOTclClassInfoInstfilterguardMethod(Tcl_Interp *interp, XOTclClass * class, char * filter); enum { XOTclClassInfoHeritageMethodIdx, @@ -25,40 +38,168 @@ XOTclClassInfoInstfilterguardMethodIdx } XOTclMethods; + +static int +XOTclClassInfoHeritageMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + parseContext pc; + if (parse2(clientData, interp, objc, objv, XOTclClassInfoHeritageMethodIdx, &pc) != TCL_OK) { + return TCL_ERROR; + } else { + XOTclClass * class = (XOTclClass *)pc.clientData[0]; + char * pattern = (char *)pc.clientData[1]; + + return XOTclClassInfoHeritageMethod(interp, class, pattern); + + } +} + +static int +XOTclClassInfoInstancesMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + parseContext pc; + if (parse2(clientData, interp, objc, objv, XOTclClassInfoInstancesMethodIdx, &pc) != TCL_OK) { + return TCL_ERROR; + } else { + XOTclClass * class = (XOTclClass *)pc.clientData[0]; + int withClosure = (int)pc.clientData[1]; + char *patternString = NULL; + XOTclObject *patternObj = NULL; + Tcl_Obj * pattern = (Tcl_Obj *)pc.clientData[2]; + int returnCode; + + if (getMatchObject3(interp, pattern, &pc, &patternObj, &patternString) == -1) { + return TCL_OK; + } + + returnCode = XOTclClassInfoInstancesMethod(interp, class, withClosure, patternString, patternObj); + + if (patternObj) { + Tcl_SetObjResult(interp, returnCode ? patternObj->cmdName : XOTclGlobalObjects[XOTE_EMPTY]); + } + return TCL_OK; + } +} + +static int +XOTclClassInfoInstargsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + parseContext pc; + if (parse2(clientData, interp, objc, objv, XOTclClassInfoInstargsMethodIdx, &pc) != TCL_OK) { + return TCL_ERROR; + } else { + XOTclClass * class = (XOTclClass *)pc.clientData[0]; + char * methodName = (char *)pc.clientData[1]; + + return XOTclClassInfoInstargsMethod(interp, class, methodName); + + } +} + +static int +XOTclClassInfoInstbodyMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + parseContext pc; + if (parse2(clientData, interp, objc, objv, XOTclClassInfoInstbodyMethodIdx, &pc) != TCL_OK) { + return TCL_ERROR; + } else { + XOTclClass * class = (XOTclClass *)pc.clientData[0]; + char * methodName = (char *)pc.clientData[1]; + + return XOTclClassInfoInstbodyMethod(interp, class, methodName); + + } +} + +static int +XOTclClassInfoInstcommandsMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + parseContext pc; + if (parse2(clientData, interp, objc, objv, XOTclClassInfoInstcommandsMethodIdx, &pc) != TCL_OK) { + return TCL_ERROR; + } else { + XOTclClass * class = (XOTclClass *)pc.clientData[0]; + char * pattern = (char *)pc.clientData[1]; + + return XOTclClassInfoInstcommandsMethod(interp, class, pattern); + + } +} + +static int +XOTclClassInfoInstdefaultMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + parseContext pc; + if (parse2(clientData, interp, objc, objv, XOTclClassInfoInstdefaultMethodIdx, &pc) != TCL_OK) { + return TCL_ERROR; + } else { + XOTclClass * class = (XOTclClass *)pc.clientData[0]; + char * methodName = (char *)pc.clientData[1]; + char * arg = (char *)pc.clientData[2]; + Tcl_Obj * var = (Tcl_Obj *)pc.clientData[3]; + + return XOTclClassInfoInstdefaultMethod(interp, class, methodName, arg, var); + + } +} + +static int +XOTclClassInfoInstfilterMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + parseContext pc; + if (parse2(clientData, interp, objc, objv, XOTclClassInfoInstfilterMethodIdx, &pc) != TCL_OK) { + return TCL_ERROR; + } else { + XOTclClass * class = (XOTclClass *)pc.clientData[0]; + int withGuards = (int)pc.clientData[1]; + char * pattern = (char *)pc.clientData[2]; + + return XOTclClassInfoInstfilterMethod(interp, class, withGuards, pattern); + + } +} + +static int +XOTclClassInfoInstfilterguardMethodStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + parseContext pc; + if (parse2(clientData, interp, objc, objv, XOTclClassInfoInstfilterguardMethodIdx, &pc) != TCL_OK) { + return TCL_ERROR; + } else { + XOTclClass * class = (XOTclClass *)pc.clientData[0]; + char * filter = (char *)pc.clientData[1]; + + return XOTclClassInfoInstfilterguardMethod(interp, class, filter); + + } +} + static methodDefinition2 methodDefinitons[] = { -{"instances", XOTclClassInfoHeritageMethod, { +{"instances", XOTclClassInfoHeritageMethodStub, { {"class", 1, 0, "class"}, {"pattern", 0, 0, NULL}} }, -{"instances", XOTclClassInfoInstancesMethod, { +{"instances", XOTclClassInfoInstancesMethodStub, { {"class", 1, 0, "class"}, {"-closure", 0, 0, NULL}, {"pattern", 0, 0, "objpattern"}} }, -{"instargs", XOTclClassInfoInstargsMethod, { +{"instargs", XOTclClassInfoInstargsMethodStub, { {"class", 1, 0, "class"}, {"methodName", 1, 0, NULL}} }, -{"instbody", XOTclClassInfoInstbodyMethod, { +{"instbody", XOTclClassInfoInstbodyMethodStub, { {"class", 1, 0, "class"}, {"methodName", 1, 0, NULL}} }, -{"instances", XOTclClassInfoInstcommandsMethod, { +{"instances", XOTclClassInfoInstcommandsMethodStub, { {"class", 1, 0, "class"}, {"pattern", 0, 0, NULL}} }, -{"instdefault", XOTclClassInfoInstdefaultMethod, { +{"instdefault", XOTclClassInfoInstdefaultMethodStub, { {"class", 1, 0, "class"}, {"methodName", 1, 0, NULL}, {"arg", 1, 0, NULL}, - {"var", 1, 0, NULL}} + {"var", 1, 0, "tclobj"}} }, -{"instfilter", XOTclClassInfoInstfilterMethod, { +{"instfilter", XOTclClassInfoInstfilterMethodStub, { {"class", 1, 0, "class"}, {"-guards", 0, 0, NULL}, {"pattern", 0, 0, NULL}} }, -{"instfilterguard", XOTclClassInfoInstfilterguardMethod, { +{"instfilterguard", XOTclClassInfoInstfilterguardMethodStub, { {"class", 1, 0, "class"}, {"filter", 1, 0, NULL}} } Index: generic/xotcl.c =================================================================== diff -u -rdc0040a6ddddf73e61c2a7d733ad7e15127e6bc1 -rf209c50ea8cb651d0dea25206301e45202217797 --- generic/xotcl.c (.../xotcl.c) (revision dc0040a6ddddf73e61c2a7d733ad7e15127e6bc1) +++ generic/xotcl.c (.../xotcl.c) (revision f209c50ea8cb651d0dea25206301e45202217797) @@ -3431,25 +3431,30 @@ * String key hashtable */ static int -listInstances(Tcl_Interp *interp, XOTclClass *startCl, - char *pattern, int closure, XOTclObject *matchObject) { +XOTclClassInfoInstancesMethod(Tcl_Interp *interp, XOTclClass *startCl, + int withClosure, char *pattern, XOTclObject *matchObject) { Tcl_HashTable *table = &startCl->instances; XOTclClasses *sc; Tcl_HashSearch search; Tcl_HashEntry *hPtr; int rc = 0; + /*fprintf(stderr,"XOTclClassInfoInstancesMethod: clo %d pattern %s match %p\n", + withClosure, pattern, matchObject);*/ + for (hPtr = Tcl_FirstHashEntry(table, &search); hPtr; hPtr = Tcl_NextHashEntry(&search)) { XOTclObject *inst = (XOTclObject*) Tcl_GetHashKey(table, hPtr); + /*fprintf(stderr, "match '%s' %p %p '%s'\n", + matchObject ? objectName(matchObject) : "NULL" ,matchObject, inst, objectName(inst));*/ if (matchObject && inst == matchObject) { return 1; } AppendMatchingElement(interp, inst->cmdName, pattern); } - if (closure) { + if (withClosure) { for (sc = startCl->sub; sc; sc = sc->nextPtr) { - rc = listInstances(interp, sc->cl, pattern, closure, matchObject); + rc = XOTclClassInfoInstancesMethod(interp, sc->cl, withClosure, pattern, matchObject); if (rc) break; } } @@ -6625,7 +6630,7 @@ } static int -ListHeritage(Tcl_Interp *interp, XOTclClass *cl, char *pattern) { +XOTclClassInfoHeritageMethod(Tcl_Interp *interp, XOTclClass *cl, char *pattern) { XOTclClasses *pl = ComputeOrder(cl, cl->order, Super); Tcl_ResetResult(interp); if (pl) pl=pl->nextPtr; @@ -12015,6 +12020,11 @@ break; return XOTclObjErrType(interp, objPtr, type); } + case 't': + if (strcmp(type,"tclobj") == 0) { + *clientData = (ClientData)objPtr; + break; + } case 'o': { if (strcmp(type,"objpattern") == 0) { @@ -12158,6 +12168,7 @@ return 0; } +#if 0 static int XOTclClassInfoHeritageMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) { parseContext pc; @@ -12216,7 +12227,27 @@ return ListProcArgs(interp, Tcl_Namespace_cmdTable(nsp), methodName); } } +#endif +static int +XOTclClassInfoInstargsMethod(Tcl_Interp *interp, XOTclClass *class, char *methodName) { + Tcl_Namespace *nsp = class->nsPtr; + + if (class->nonposArgsTable) { + XOTclNonposArgs *nonposArgs = NonposArgsGet(class->nonposArgsTable, methodName); + if (nonposArgs && nonposArgs->ordinaryArgs) { + return ListArgsFromOrdinaryArgs(interp, nonposArgs); + } + } + return ListProcArgs(interp, Tcl_Namespace_cmdTable(nsp), methodName); +} + +static int +XOTclClassInfoInstbodyMethod(Tcl_Interp *interp, XOTclClass *class, char * methodName) { + return ListProcBody(interp, Tcl_Namespace_cmdTable(class->nsPtr), methodName); +} + +#if 0 static int XOTclClassInfoInstbodyMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; @@ -12229,7 +12260,14 @@ return ListProcBody(interp, Tcl_Namespace_cmdTable(nsp), methodName); } } +#endif +static int +XOTclClassInfoInstcommandsMethod(Tcl_Interp *interp, XOTclClass * class, char * pattern) { + return ListKeys(interp, Tcl_Namespace_cmdTable(class->nsPtr), pattern); +} + +#if 0 static int XOTclClassInfoInstcommandsMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; @@ -12242,7 +12280,26 @@ return ListKeys(interp, Tcl_Namespace_cmdTable(nsp), pattern); } } +#endif +static int +XOTclClassInfoInstdefaultMethod(Tcl_Interp *interp, XOTclClass *class, + char *methodName, char *arg, Tcl_Obj *var) { + + Tcl_Namespace *nsp = class->nsPtr; + + if (class->nonposArgsTable) { + XOTclNonposArgs *nonposArgs = NonposArgsGet(class->nonposArgsTable, methodName); + if (nonposArgs && nonposArgs->ordinaryArgs) { + return ListDefaultFromOrdinaryArgs(interp, methodName, nonposArgs, arg, var); + } + } + return nsp ? + ListProcDefault(interp, Tcl_Namespace_cmdTable(nsp), methodName, arg, var) : + TCL_OK; +} + +#if 0 static int XOTclClassInfoInstdefaultMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; @@ -12266,7 +12323,14 @@ TCL_OK; } } +#endif +static int +XOTclClassInfoInstfilterMethod(Tcl_Interp *interp, XOTclClass * class, int withGuards, char * pattern) { + return class->opt ? FilterInfo(interp, class->opt->instfilters, pattern, withGuards, 0) : TCL_OK; +} + +#if 0 static int XOTclClassInfoInstfilterMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; @@ -12281,7 +12345,14 @@ return opt ? FilterInfo(interp, opt->instfilters, pattern, withGuards, 0) : TCL_OK; } } +#endif +static int +XOTclClassInfoInstfilterguardMethod(Tcl_Interp *interp, XOTclClass * class, char * filter) { + return class->opt ? GuardList(interp, class->opt->instfilters, filter) : TCL_OK; +} + +#if 0 static int XOTclClassInfoInstfilterguardMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { parseContext pc; @@ -12295,6 +12366,7 @@ return opt ? GuardList(interp, opt->instfilters, filter) : TCL_OK; } } +#endif static int XOTclClassInfoInstforwardMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { @@ -14516,14 +14588,14 @@ {"vars", XOTclObjInfoVarsMethod} }; methodDefinition definitions5[] = { - {"heritage", XOTclClassInfoHeritageMethod}, - {"instances", XOTclClassInfoInstancesMethod}, - {"instargs", XOTclClassInfoInstargsMethod}, - {"instbody", XOTclClassInfoInstbodyMethod}, - {"instcommands", XOTclClassInfoInstcommandsMethod}, - {"instdefault", XOTclClassInfoInstdefaultMethod}, - {"instfilter", XOTclClassInfoInstfilterMethod}, - {"instfilterguard", XOTclClassInfoInstfilterguardMethod}, + {"heritage", XOTclClassInfoHeritageMethodStub}, + {"instances", XOTclClassInfoInstancesMethodStub}, + {"instargs", XOTclClassInfoInstargsMethodStub}, + {"instbody", XOTclClassInfoInstbodyMethodStub}, + {"instcommands", XOTclClassInfoInstcommandsMethodStub}, + {"instdefault", XOTclClassInfoInstdefaultMethodStub}, + {"instfilter", XOTclClassInfoInstfilterMethodStub}, + {"instfilterguard", XOTclClassInfoInstfilterguardMethodStub}, {"instforward", XOTclClassInfoInstforwardMethod}, {"instinvar", XOTclClassInfoInstinvarMethod}, {"instmixin", XOTclClassInfoInstmixinMethod}, Index: tests/object-system.xotcl =================================================================== diff -u -r91e9b1a3b1c3e60a8538156b4aa37d5a664d5133 -rf209c50ea8cb651d0dea25206301e45202217797 --- tests/object-system.xotcl (.../object-system.xotcl) (revision 91e9b1a3b1c3e60a8538156b4aa37d5a664d5133) +++ tests/object-system.xotcl (.../object-system.xotcl) (revision f209c50ea8cb651d0dea25206301e45202217797) @@ -7,6 +7,7 @@ # since even class Test might not work at that time. # proc ? {cmd expected {msg ""}} { + #puts "??? $cmd" set r [uplevel $cmd] if {$msg eq ""} {set msg $cmd} if {$r ne $expected} {