Index: TODO =================================================================== diff -u -rabc6afbec5bf2984e6480f32f91829b54c1d8c91 -r102a1a9f4f678f98e7bcf7648ad1714147a29a47 --- TODO (.../TODO) (revision abc6afbec5bf2984e6480f32f91829b54c1d8c91) +++ TODO (.../TODO) (revision 102a1a9f4f678f98e7bcf7648ad1714147a29a47) @@ -4214,6 +4214,12 @@ - first draft of per-object parameter caching (for per-object-mixins and per-object properties). + +nsf.c: +- rename invalidateobjectparameter -> parameter:invalidate::classcache +- rename invalidateobjobjectparameter -> parameter:invalidate::objectcache +- bring cmds into alphabetical order + ======================================================================== TODO: - invalidation of per-object parameter cache for mixins and Index: generic/nsf.c =================================================================== diff -u -rabc6afbec5bf2984e6480f32f91829b54c1d8c91 -r102a1a9f4f678f98e7bcf7648ad1714147a29a47 --- generic/nsf.c (.../nsf.c) (revision abc6afbec5bf2984e6480f32f91829b54c1d8c91) +++ generic/nsf.c (.../nsf.c) (revision 102a1a9f4f678f98e7bcf7648ad1714147a29a47) @@ -285,7 +285,8 @@ NSF_INLINE static void CallStackDoDestroy(Tcl_Interp *interp, NsfObject *object); /* prototypes for parameter and argument management */ -static int NsfInvalidateObjectParameterCmd(Tcl_Interp *interp, NsfClass *cl); + +static int NsfParameterInvalidateClassCacheCmd(Tcl_Interp *interp, NsfClass *cl); static int ProcessMethodArguments(ParseContext *pcPtr, Tcl_Interp *interp, NsfObject *object, int processFlags, NsfParamDefs *paramDefs, Tcl_Obj *methodNameObj, int objc, Tcl_Obj *CONST objv[]); @@ -303,7 +304,7 @@ static int GetMatchObject(Tcl_Interp *interp, Tcl_Obj *patternObj, Tcl_Obj *origObj, NsfObject **matchObject, CONST char **pattern); static void NsfProcDeleteProc(ClientData clientData); -static int NsfInvalidateObjObjectParameterCmd(Tcl_Interp *interp, NsfObject *object); +static int NsfParameterInvalidateObjectCacheCmd(Tcl_Interp *interp, NsfObject *object); /* prototypes for alias management */ static int AliasDelete(Tcl_Interp *interp, Tcl_Obj *cmdName, CONST char *methodName, int withPer_object); @@ -7113,7 +7114,7 @@ * parameter definitions. */ /*fprintf(stderr, "MixinInvalidateObjOrders via class mixin %s calls ifd invalidate \n", ClassName(ncl));*/ - NsfInvalidateObjectParameterCmd(interp, ncl); + NsfParameterInvalidateClassCacheCmd(interp, ncl); } } Tcl_DeleteHashTable(commandTable); @@ -14395,7 +14396,7 @@ #if defined(PER_OBJECT_PARAMETER_CACHING) if (object->opt->parsedParamPtr) { - NsfInvalidateObjObjectParameterCmd(interp, object); + NsfParameterInvalidateObjectCacheCmd(interp, object); } #endif @@ -19102,6 +19103,154 @@ } /* +cmd "directdispatch" NsfDirectDispatchCmd { + {-argName "object" -required 1 -type object} + {-argName "-frame" -required 0 -nrargs 1 -type "method|object|default" -default "default"} + {-argName "command" -required 1 -type tclobj} + {-argName "args" -type args} +} +*/ +static int +NsfDirectDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withFrame, + Tcl_Obj *commandObj, int nobjc, Tcl_Obj *CONST nobjv[]) { + int result; + CONST char *methodName = ObjStr(commandObj); + Tcl_Command cmd, importedCmd; + CallFrame frame, *framePtr = &frame; + Tcl_ObjCmdProc *proc; + int flags = 0; + int useCmdDispatch = 1; + + /*fprintf(stderr, "NsfDirectDispatchCmd obj=%s, cmd m='%s'\n", ObjectName(object), methodName);*/ + + if (unlikely(*methodName != ':')) { + return NsfPrintError(interp, "method name '%s' must be fully qualified", methodName); + } + + /* + * We have a fully qualified name of a Tcl command that will be dispatched. + */ + + cmd = Tcl_GetCommandFromObj(interp, commandObj); + if (likely(cmd != NULL)) { + importedCmd = TclGetOriginalCommand(cmd); + if (unlikely(importedCmd != NULL)) { + cmd = importedCmd; + } + } + + if (unlikely(cmd == NULL)) { + return NsfPrintError(interp, "cannot lookup command '%s'", methodName); + } + + proc = Tcl_Command_objProc(cmd); + if (proc == TclObjInterpProc || + proc == NsfForwardMethod || + proc == NsfObjscopedMethod || + proc == NsfSetterMethod || + CmdIsNsfObject(cmd)) { + + if (withFrame && withFrame != FrameDefaultIdx) { + return NsfPrintError(interp, "cannot use -frame object|method in dispatch for command '%s'", + methodName); + } + useCmdDispatch = 0; + } else { + if (unlikely(withFrame == FrameMethodIdx)) { + useCmdDispatch = 0; + } else { + useCmdDispatch = 1; + } + } + + /* + * If "withFrame == FrameObjectIdx" is specified, a call-stack frame is + * pushed to make instance variables accessible for the command. + */ + if (unlikely(withFrame == FrameObjectIdx)) { + Nsf_PushFrameObj(interp, object, framePtr); + flags = NSF_CSC_IMMEDIATE; + } + /* + * Since we know, that we are always called with a full argument + * vector, we can include the cmd name in the objv by using + * nobjv-1; this way, we avoid a memcpy(). + */ + if (useCmdDispatch) { + + if (NSF_DTRACE_METHOD_ENTRY_ENABLED()) { + NSF_DTRACE_METHOD_ENTRY(ObjectName(object), + "", + (char *)methodName, + nobjc, (Tcl_Obj **)nobjv); + } + + result = CmdMethodDispatch(object, interp, nobjc+1, nobjv-1, + object, cmd, NULL); + } else { + /* + * If "withFrame == FrameMethodIdx" is specified, a call-stack frame is + * pushed to make instance variables accessible for the command. + */ + if (unlikely(withFrame == FrameMethodIdx)) { + flags = NSF_CSC_FORCE_FRAME|NSF_CSC_IMMEDIATE; + } + + result = MethodDispatch(object, interp, + nobjc+1, nobjv-1, cmd, object, + NULL /*NsfClass *cl*/, + Tcl_GetCommandName(interp, cmd), + NSF_CSC_TYPE_PLAIN, flags); + } + + if (unlikely(withFrame == FrameObjectIdx)) { + Nsf_PopFrameObj(interp, framePtr); + } + + return result; +} + + +/* +cmd "dispatch" NsfDispatchCmd { + {-argName "object" -required 1 -type object} + {-argName "-intrinsic" -required 0 -nrargs 0} + {-argName "-system" -required 0 -nrargs 0} + {-argName "command" -required 1 -type tclobj} + {-argName "args" -type args} +} +*/ +static int +NsfDispatchCmd(Tcl_Interp *interp, NsfObject *object, + int withIntrinsic, int withSystem, + Tcl_Obj *commandObj, int nobjc, Tcl_Obj *CONST nobjv[]) { + int flags = NSF_CM_NO_UNKNOWN|NSF_CSC_IMMEDIATE|NSF_CM_IGNORE_PERMISSIONS|NSF_CM_NO_SHIFT; + + /*fprintf(stderr, "NsfDispatchCmd obj=%s, cmd m='%s' nobjc %d\n", + ObjectName(object), ObjStr(commandObj), nobjc);*/ + + if (unlikely(withIntrinsic && withSystem)) { + return NsfPrintError(interp, "flags '-intrinsic' and '-system' are mutual exclusive"); + } + + /* + * Dispatch the command the method from the precedence order, with filters + * etc. -- strictly speaking unnecessary, but this function can be used to + * call protected methods and provide the flags '-intrinsics' and '-system'. + */ + + if (withIntrinsic) {flags |= NSF_CM_INTRINSIC_METHOD;} + if (withSystem) {flags |= NSF_CM_SYSTEM_METHOD;} + + /* + * Since we know, that we are always called with a full argument + * vector, we can include the cmd name in the objv by using + * nobjv-1; this way, we avoid a memcpy(). + */ + return ObjectDispatch(object, interp, nobjc+1, nobjv-1, flags); +} + +/* cmd finalize NsfFinalizeCmd { {-argName "-keepvars" -required 0 -nrargs 0} } @@ -19188,40 +19337,6 @@ } /* -cmd invalidateobjectparameter NsfInvalidateObjectParameterCmd { - {-argName "class" -type class} -} -*/ -static int -NsfInvalidateObjectParameterCmd(Tcl_Interp *interp, NsfClass *cl) { - if (cl->parsedParamPtr) { - NsfClassParamPtrEpochIncr("NsfInvalidateObjectParameterCmd"); - /* fprintf(stderr, " %s invalidate %p\n", ClassName(cl), cl->parsedParamPtr); */ - ParsedParamFree(cl->parsedParamPtr); - cl->parsedParamPtr = NULL; - } - return TCL_OK; -} - -// TODO move me, rename me -/* -cmd invalidateobjobjectparameter NsfInvalidateObjObjectParameterCmd { - {-argName "object" -type object} -} -*/ -static int -NsfInvalidateObjObjectParameterCmd(Tcl_Interp *interp, NsfObject *object) { -#if defined(PER_OBJECT_PARAMETER_CACHING) - if (object->opt && object->opt->parsedParamPtr) { - /* fprintf(stderr, " %s invalidate %p\n", ObjectName(object), obj->opt->parsedParamPtr); */ - ParsedParamFree(object->opt->parsedParamPtr); - object->opt->parsedParamPtr = NULL; - } -#endif - return TCL_OK; -} - -/* cmd is NsfIsCmd { {-argName "-complain"} {-argName "constraint" -required 1 -type tclobj} @@ -19891,156 +20006,7 @@ } -/* TODO: move me */ /* -cmd "directdispatch" NsfDirectDispatchCmd { - {-argName "object" -required 1 -type object} - {-argName "-frame" -required 0 -nrargs 1 -type "method|object|default" -default "default"} - {-argName "command" -required 1 -type tclobj} - {-argName "args" -type args} -} -*/ -static int -NsfDirectDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withFrame, - Tcl_Obj *commandObj, int nobjc, Tcl_Obj *CONST nobjv[]) { - int result; - CONST char *methodName = ObjStr(commandObj); - Tcl_Command cmd, importedCmd; - CallFrame frame, *framePtr = &frame; - Tcl_ObjCmdProc *proc; - int flags = 0; - int useCmdDispatch = 1; - - /*fprintf(stderr, "NsfDirectDispatchCmd obj=%s, cmd m='%s'\n", ObjectName(object), methodName);*/ - - if (unlikely(*methodName != ':')) { - return NsfPrintError(interp, "method name '%s' must be fully qualified", methodName); - } - - /* - * We have a fully qualified name of a Tcl command that will be dispatched. - */ - - cmd = Tcl_GetCommandFromObj(interp, commandObj); - if (likely(cmd != NULL)) { - importedCmd = TclGetOriginalCommand(cmd); - if (unlikely(importedCmd != NULL)) { - cmd = importedCmd; - } - } - - if (unlikely(cmd == NULL)) { - return NsfPrintError(interp, "cannot lookup command '%s'", methodName); - } - - proc = Tcl_Command_objProc(cmd); - if (proc == TclObjInterpProc || - proc == NsfForwardMethod || - proc == NsfObjscopedMethod || - proc == NsfSetterMethod || - CmdIsNsfObject(cmd)) { - - if (withFrame && withFrame != FrameDefaultIdx) { - return NsfPrintError(interp, "cannot use -frame object|method in dispatch for command '%s'", - methodName); - } - useCmdDispatch = 0; - } else { - if (unlikely(withFrame == FrameMethodIdx)) { - useCmdDispatch = 0; - } else { - useCmdDispatch = 1; - } - } - - /* - * If "withFrame == FrameObjectIdx" is specified, a call-stack frame is - * pushed to make instance variables accessible for the command. - */ - if (unlikely(withFrame == FrameObjectIdx)) { - Nsf_PushFrameObj(interp, object, framePtr); - flags = NSF_CSC_IMMEDIATE; - } - /* - * Since we know, that we are always called with a full argument - * vector, we can include the cmd name in the objv by using - * nobjv-1; this way, we avoid a memcpy(). - */ - if (useCmdDispatch) { - - if (NSF_DTRACE_METHOD_ENTRY_ENABLED()) { - NSF_DTRACE_METHOD_ENTRY(ObjectName(object), - "", - (char *)methodName, - nobjc, (Tcl_Obj **)nobjv); - } - - result = CmdMethodDispatch(object, interp, nobjc+1, nobjv-1, - object, cmd, NULL); - } else { - /* - * If "withFrame == FrameMethodIdx" is specified, a call-stack frame is - * pushed to make instance variables accessible for the command. - */ - if (unlikely(withFrame == FrameMethodIdx)) { - flags = NSF_CSC_FORCE_FRAME|NSF_CSC_IMMEDIATE; - } - - result = MethodDispatch(object, interp, - nobjc+1, nobjv-1, cmd, object, - NULL /*NsfClass *cl*/, - Tcl_GetCommandName(interp, cmd), - NSF_CSC_TYPE_PLAIN, flags); - } - - if (unlikely(withFrame == FrameObjectIdx)) { - Nsf_PopFrameObj(interp, framePtr); - } - - return result; -} - - -/* -cmd "dispatch" NsfDispatchCmd { - {-argName "object" -required 1 -type object} - {-argName "-intrinsic" -required 0 -nrargs 0} - {-argName "-system" -required 0 -nrargs 0} - {-argName "command" -required 1 -type tclobj} - {-argName "args" -type args} -} -*/ -static int -NsfDispatchCmd(Tcl_Interp *interp, NsfObject *object, - int withIntrinsic, int withSystem, - Tcl_Obj *commandObj, int nobjc, Tcl_Obj *CONST nobjv[]) { - int flags = NSF_CM_NO_UNKNOWN|NSF_CSC_IMMEDIATE|NSF_CM_IGNORE_PERMISSIONS|NSF_CM_NO_SHIFT; - - /*fprintf(stderr, "NsfDispatchCmd obj=%s, cmd m='%s' nobjc %d\n", - ObjectName(object), ObjStr(commandObj), nobjc);*/ - - if (unlikely(withIntrinsic && withSystem)) { - return NsfPrintError(interp, "flags '-intrinsic' and '-system' are mutual exclusive"); - } - - /* - * Dispatch the command the method from the precedence order, with filters - * etc. -- strictly speaking unnecessary, but this function can be used to - * call protected methods and provide the flags '-intrinsics' and '-system'. - */ - - if (withIntrinsic) {flags |= NSF_CM_INTRINSIC_METHOD;} - if (withSystem) {flags |= NSF_CM_SYSTEM_METHOD;} - - /* - * Since we know, that we are always called with a full argument - * vector, we can include the cmd name in the objv by using - * nobjv-1; this way, we avoid a memcpy(). - */ - return ObjectDispatch(object, interp, nobjc+1, nobjv-1, flags); -} - -/* cmd "object::exists" NsfObjectExistsCmd { {-argName "value" -required 1 -type tclobj} } @@ -20732,6 +20698,39 @@ } /* +cmd parameter:invalidate::classcache NsfParameterInvalidateClassCacheCmd { + {-argName "class" -required 1 -type class} +} +*/ +static int +NsfParameterInvalidateClassCacheCmd(Tcl_Interp *interp, NsfClass *cl) { + if (cl->parsedParamPtr) { + NsfClassParamPtrEpochIncr("NsfParameterInvalidateClassCacheCmd"); + /* fprintf(stderr, " %s invalidate %p\n", ClassName(cl), cl->parsedParamPtr); */ + ParsedParamFree(cl->parsedParamPtr); + cl->parsedParamPtr = NULL; + } + return TCL_OK; +} + +/* +cmd parameter:invalidate::objectcache NsfParameterInvalidateObjectCacheCmd { + {-argName "object" -required 1 -type object} +} +*/ +static int +NsfParameterInvalidateObjectCacheCmd(Tcl_Interp *interp, NsfObject *object) { +#if defined(PER_OBJECT_PARAMETER_CACHING) + if (object->opt && object->opt->parsedParamPtr) { + /* fprintf(stderr, " %s invalidate %p\n", ObjectName(object), obj->opt->parsedParamPtr); */ + ParsedParamFree(object->opt->parsedParamPtr); + object->opt->parsedParamPtr = NULL; + } +#endif + return TCL_OK; +} + +/* cmd parameter::specs NsfParameterSpecsCmd { {-argName "-configure" -nrargs 0 -required 0} {-argName "-nonposargs" -nrargs 0 -required 0} Index: generic/nsfAPI.decls =================================================================== diff -u -r5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2 -r102a1a9f4f678f98e7bcf7648ad1714147a29a47 --- generic/nsfAPI.decls (.../nsfAPI.decls) (revision 5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2) +++ generic/nsfAPI.decls (.../nsfAPI.decls) (revision 102a1a9f4f678f98e7bcf7648ad1714147a29a47) @@ -63,26 +63,34 @@ {-argName "name" -required 1} {-argName "args" -type allargs} } {-nxdoc 1} -cmd invalidateobjectparameter NsfInvalidateObjectParameterCmd { - {-argName "class" -required 1 -type class} -} cmd is NsfIsCmd { {-argName "-complain" -nrargs 0} {-argName "constraint" -required 1 -type tclobj} {-argName "value" -required 1 -type tclobj} } {-nxdoc 1} + +cmd parameter::get NsfParameterGetCmd { + {-argName "parametersubcmd" -type "list|name|syntax" -required 1} + {-argName "parameterspec" -required 1 -type tclobj} +} + +cmd parameter:invalidate::classcache NsfParameterInvalidateClassCacheCmd { + {-argName "class" -required 1 -type class} +} + +cmd parameter:invalidate::objectcache NsfParameterInvalidateObjectCacheCmd { + {-argName "object" -required 1 -type object} +} + cmd parameter::specs NsfParameterSpecsCmd { {-argName "-configure" -nrargs 0 -required 0} {-argName "-nonposargs" -nrargs 0 -required 0} {-argName "slotobjs" -required 1 -type tclobj} } -cmd parameter::get NsfParameterGetCmd { - {-argName "parametersubcmd" -type "list|name|syntax" -required 1} - {-argName "parameterspec" -required 1 -type tclobj} -} + # # method cmds # Index: generic/nsfAPI.h =================================================================== diff -u -r5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2 -r102a1a9f4f678f98e7bcf7648ad1714147a29a47 --- generic/nsfAPI.h (.../nsfAPI.h) (revision 5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2) +++ generic/nsfAPI.h (.../nsfAPI.h) (revision 102a1a9f4f678f98e7bcf7648ad1714147a29a47) @@ -236,7 +236,7 @@ /* just to define the symbol */ -static Nsf_methodDefinition method_definitions[104]; +static Nsf_methodDefinition method_definitions[105]; static CONST char *method_command_namespace_names[] = { "::nsf::methods::object::info", @@ -277,7 +277,6 @@ static int NsfDispatchCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfFinalizeCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfInterpObjCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); -static int NsfInvalidateObjectParameterCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfIsCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfMethodAliasCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfMethodAssertionCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); @@ -296,6 +295,8 @@ static int NsfObjectQualifyCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfObjectSystemCreateCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfParameterGetCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int NsfParameterInvalidateClassCacheCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); +static int NsfParameterInvalidateObjectCacheCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfParameterSpecsCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfProcCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); static int NsfProfileClearDataStubStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv []); @@ -381,7 +382,6 @@ static int NsfDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withIntrinsic, int withSystem, Tcl_Obj *command, int nobjc, Tcl_Obj *CONST nobjv[]); static int NsfFinalizeCmd(Tcl_Interp *interp, int withKeepvars); static int NsfInterpObjCmd(Tcl_Interp *interp, CONST char *name, int objc, Tcl_Obj *CONST objv[]); -static int NsfInvalidateObjectParameterCmd(Tcl_Interp *interp, NsfClass *class); static int NsfIsCmd(Tcl_Interp *interp, int withComplain, Tcl_Obj *constraint, Tcl_Obj *value); static int NsfMethodAliasCmd(Tcl_Interp *interp, NsfObject *object, int withPer_object, CONST char *methodName, int withFrame, Tcl_Obj *cmdName); static int NsfMethodAssertionCmd(Tcl_Interp *interp, NsfObject *object, int assertionsubcmd, Tcl_Obj *arg); @@ -400,6 +400,8 @@ static int NsfObjectQualifyCmd(Tcl_Interp *interp, Tcl_Obj *objectName); static int NsfObjectSystemCreateCmd(Tcl_Interp *interp, Tcl_Obj *rootClass, Tcl_Obj *rootMetaClass, Tcl_Obj *systemMethods); static int NsfParameterGetCmd(Tcl_Interp *interp, int parametersubcmd, Tcl_Obj *parameterspec); +static int NsfParameterInvalidateClassCacheCmd(Tcl_Interp *interp, NsfClass *class); +static int NsfParameterInvalidateObjectCacheCmd(Tcl_Interp *interp, NsfObject *object); static int NsfParameterSpecsCmd(Tcl_Interp *interp, int withConfigure, int withNonposargs, Tcl_Obj *slotobjs); static int NsfProcCmd(Tcl_Interp *interp, int withAd, Tcl_Obj *procName, Tcl_Obj *arguments, Tcl_Obj *body); static int NsfProfileClearDataStub(Tcl_Interp *interp); @@ -486,7 +488,6 @@ NsfDispatchCmdIdx, NsfFinalizeCmdIdx, NsfInterpObjCmdIdx, - NsfInvalidateObjectParameterCmdIdx, NsfIsCmdIdx, NsfMethodAliasCmdIdx, NsfMethodAssertionCmdIdx, @@ -505,6 +506,8 @@ NsfObjectQualifyCmdIdx, NsfObjectSystemCreateCmdIdx, NsfParameterGetCmdIdx, + NsfParameterInvalidateClassCacheCmdIdx, + NsfParameterInvalidateObjectCacheCmdIdx, NsfParameterSpecsCmdIdx, NsfProcCmdIdx, NsfProfileClearDataStubIdx, @@ -1252,25 +1255,6 @@ } static int -NsfInvalidateObjectParameterCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - ParseContext pc; - (void)clientData; - - if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0], - method_definitions[NsfInvalidateObjectParameterCmdIdx].paramDefs, - method_definitions[NsfInvalidateObjectParameterCmdIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN, - &pc) == TCL_OK)) { - NsfClass *class = (NsfClass *)pc.clientData[0]; - - assert(pc.status == 0); - return NsfInvalidateObjectParameterCmd(interp, class); - - } else { - return TCL_ERROR; - } -} - -static int NsfIsCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ParseContext pc; (void)clientData; @@ -1644,6 +1628,44 @@ } static int +NsfParameterInvalidateClassCacheCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; + (void)clientData; + + if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0], + method_definitions[NsfParameterInvalidateClassCacheCmdIdx].paramDefs, + method_definitions[NsfParameterInvalidateClassCacheCmdIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN, + &pc) == TCL_OK)) { + NsfClass *class = (NsfClass *)pc.clientData[0]; + + assert(pc.status == 0); + return NsfParameterInvalidateClassCacheCmd(interp, class); + + } else { + return TCL_ERROR; + } +} + +static int +NsfParameterInvalidateObjectCacheCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { + ParseContext pc; + (void)clientData; + + if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0], + method_definitions[NsfParameterInvalidateObjectCacheCmdIdx].paramDefs, + method_definitions[NsfParameterInvalidateObjectCacheCmdIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN, + &pc) == TCL_OK)) { + NsfObject *object = (NsfObject *)pc.clientData[0]; + + assert(pc.status == 0); + return NsfParameterInvalidateObjectCacheCmd(interp, object); + + } else { + return TCL_ERROR; + } +} + +static int NsfParameterSpecsCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ParseContext pc; (void)clientData; @@ -2569,7 +2591,7 @@ } } -static Nsf_methodDefinition method_definitions[104] = { +static Nsf_methodDefinition method_definitions[105] = { {"::nsf::methods::class::alloc", NsfCAllocMethodStub, 1, { {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, @@ -2711,9 +2733,6 @@ {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} }, -{"::nsf::invalidateobjectparameter", NsfInvalidateObjectParameterCmdStub, 1, { - {"class", NSF_ARG_REQUIRED, 1, Nsf_ConvertToClass, NULL,NULL,"class",NULL,NULL,NULL,NULL,NULL}} -}, {"::nsf::is", NsfIsCmdStub, 3, { {"-complain", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"constraint", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, @@ -2813,6 +2832,12 @@ {"parametersubcmd", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToParametersubcmd, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"parameterspec", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, +{"::nsf::parameter:invalidate::classcache", NsfParameterInvalidateClassCacheCmdStub, 1, { + {"class", NSF_ARG_REQUIRED, 1, Nsf_ConvertToClass, NULL,NULL,"class",NULL,NULL,NULL,NULL,NULL}} +}, +{"::nsf::parameter:invalidate::objectcache", NsfParameterInvalidateObjectCacheCmdStub, 1, { + {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}} +}, {"::nsf::parameter::specs", NsfParameterSpecsCmdStub, 3, { {"-configure", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"-nonposargs", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, Index: generic/nsfAPI.nxdocindex =================================================================== diff -u -r5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2 -r102a1a9f4f678f98e7bcf7648ad1714147a29a47 --- generic/nsfAPI.nxdocindex (.../nsfAPI.nxdocindex) (revision 5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2) +++ generic/nsfAPI.nxdocindex (.../nsfAPI.nxdocindex) (revision 102a1a9f4f678f98e7bcf7648ad1714147a29a47) @@ -12,10 +12,11 @@ set ::nxdoc::include(::nsf::dispatch) 1 set ::nxdoc::include(::nsf::finalize) 1 set ::nxdoc::include(::nsf::interp) 1 -set ::nxdoc::include(::nsf::invalidateobjectparameter) 0 set ::nxdoc::include(::nsf::is) 1 -set ::nxdoc::include(::nsf::parameter::specs) 0 set ::nxdoc::include(::nsf::parameter::get) 0 +set ::nxdoc::include(::nsf::parameter:invalidate::classcache) 0 +set ::nxdoc::include(::nsf::parameter:invalidate::objectcache) 0 +set ::nxdoc::include(::nsf::parameter::specs) 0 set ::nxdoc::include(::nsf::method::alias) 1 set ::nxdoc::include(::nsf::method::assertion) 1 set ::nxdoc::include(::nsf::method::create) 1 Index: library/nx/nx.tcl =================================================================== diff -u -r5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2 -r102a1a9f4f678f98e7bcf7648ad1714147a29a47 --- library/nx/nx.tcl (.../nx.tcl) (revision 5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2) +++ library/nx/nx.tcl (.../nx.tcl) (revision 102a1a9f4f678f98e7bcf7648ad1714147a29a47) @@ -1082,8 +1082,8 @@ ::nsf::var::set $slotObj config 1 } - #puts stderr "Bootstrap-slot for $class calls invalidateobjectparameter" - ::nsf::invalidateobjectparameter $class + #puts stderr "Bootstrap-slot for $class calls parameter:invalidate::classcache" + ::nsf::parameter:invalidate::classcache $class } ObjectParameterSlot public method namedParameterSpec {prefix name options} { @@ -1200,7 +1200,7 @@ set :methodname ${:name} } if {[::nsf::is class ${:domain}]} { - ::nsf::invalidateobjectparameter ${:domain} + ::nsf::parameter:invalidate::classcache ${:domain} } # # plain object parameter have currently no setter/forwarder @@ -1214,7 +1214,7 @@ # if {[info exists :domain] && ${:domain} ne ""} { if {[::nsf::is class ${:domain}]} { - ::nsf::invalidateobjectparameter ${:domain} + ::nsf::parameter:invalidate::classcache ${:domain} } #puts stderr "*** slot destroy of [self], domain ${:domain} per-object ${:per-object}" @@ -1339,7 +1339,7 @@ # Invalidate previously defined object parameter (built with the # empty objectparameter definition. # - ::nsf::invalidateobjectparameter MetaSlot + ::nsf::parameter:invalidate::classcache MetaSlot ###################################################################### # Define objectparameter method @@ -1520,7 +1520,7 @@ # # Make sure the invalidate all ObjectParameterSlots # - ::nsf::invalidateobjectparameter ::nx::ObjectParameterSlot + ::nsf::parameter:invalidate::classcache ::nx::ObjectParameterSlot # # Define method "guard" for mixin- and filter-slots of Object and Class @@ -1572,7 +1572,7 @@ ###################################################################### # Variable slots ###################################################################### - ::nsf::invalidateobjectparameter MetaSlot + ::nsf::parameter:invalidate::classcache MetaSlot MetaSlot create ::nx::VariableSlot -superclass ::nx::ObjectParameterSlot @@ -1722,7 +1722,7 @@ :setCheckedInstVar -nocomplain=[info exists :nocomplain] ${:domain} ${:default} } if {[::nsf::is class ${:domain}]} { - ::nsf::invalidateobjectparameter ${:domain} + ::nsf::parameter:invalidate::classcache ${:domain} } } Index: tests/disposition.test =================================================================== diff -u -r5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2 -r102a1a9f4f678f98e7bcf7648ad1714147a29a47 --- tests/disposition.test (.../disposition.test) (revision 5d1617640ad71fd52b069f81cfcadbe4cbb6f2a2) +++ tests/disposition.test (.../disposition.test) (revision 102a1a9f4f678f98e7bcf7648ad1714147a29a47) @@ -26,7 +26,7 @@ # :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [current] + ::nsf::parameter:invalidate::classcache [current] } #:class method __objectparameter {} { # return ${:objectparams} @@ -324,7 +324,7 @@ Class create S { :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [current] + ::nsf::parameter:invalidate::classcache [current] } #:class method __objectparameter {} { # return ${:objectparams} @@ -387,7 +387,7 @@ Class create R { :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [current] + ::nsf::parameter:invalidate::classcache [current] } } @@ -451,7 +451,7 @@ Class create Callee { :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [current] + ::nsf::parameter:invalidate::classcache [current] } } @@ -619,7 +619,7 @@ Class create C { :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [current] + ::nsf::parameter:invalidate::classcache [current] } :public method foo {args} { set :foo $args @@ -760,7 +760,7 @@ Class create C { :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [current] + ::nsf::parameter:invalidate::classcache [current] } } @@ -775,7 +775,7 @@ Class create C { :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [current] + ::nsf::parameter:invalidate::classcache [current] } :public method Residualargs args { puts stderr "aliased RESIDUALARGS <[llength $args]>" @@ -865,7 +865,7 @@ Class create C { :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [current] + ::nsf::parameter:invalidate::classcache [current] } :method init {} { incr :y @@ -886,7 +886,7 @@ Class create C { :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [current] + ::nsf::parameter:invalidate::classcache [current] } } @@ -1086,7 +1086,7 @@ Class create C { :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [current] + ::nsf::parameter:invalidate::classcache [current] } } @@ -1179,7 +1179,7 @@ Class create T { :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [current] + ::nsf::parameter:invalidate::classcache [current] } } Index: tests/parameters.test =================================================================== diff -u -r4c9e3b2b545a49698aa2284cc8dc5d5bb2719703 -r102a1a9f4f678f98e7bcf7648ad1714147a29a47 --- tests/parameters.test (.../parameters.test) (revision 4c9e3b2b545a49698aa2284cc8dc5d5bb2719703) +++ tests/parameters.test (.../parameters.test) (revision 102a1a9f4f678f98e7bcf7648ad1714147a29a47) @@ -1854,7 +1854,7 @@ # Invalidate the object parameter and expect that the per-class # mixin does not harm # - ::nsf::invalidateobjectparameter C + ::nsf::parameter:invalidate::classcache C # # We have now "-b1:required" in the object parameters. @@ -1911,7 +1911,7 @@ # invalidate object parameter and expect that the per-class mixin # does not harm # - ::nsf::invalidateobjectparameter C + ::nsf::parameter:invalidate::classcache C c1 __configure -a1 x @@ -2503,7 +2503,7 @@ nx::Class create C { :public class method setObjectParams {spec} { :protected method __objectparameter {} [list return $spec] - ::nsf::invalidateobjectparameter [self] + ::nsf::parameter:invalidate::classcache [self] } :setObjectParams "" }