Index: TODO =================================================================== diff -u -r729b49eb1dcb08183a0ed41588416a923271811a -rd9344280c05990c0254aa652a08a09da3e5822b1 --- TODO (.../TODO) (revision 729b49eb1dcb08183a0ed41588416a923271811a) +++ TODO (.../TODO) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -5191,8 +5191,35 @@ - renamed parameter::get -> parameter::info - renamed method::get -> cmd::info +nsf.c, gentclAPI.tcl: +- new argument types "virtualobjectargs" and "virtualclassargs" for + context-specific argument resolutions: when a context object + is provided, arguments of type "virtualobjectargs" are determined + based on the slots applicable for the object (like "... lookup ..."), + arguments of type "virtualclassargs" are resolved against a class. + These types are used as follows: + /obj/ configure /virtualobjectargs/ + /cls/ create /name/ /virtualclassargs/ + /cls/ recreate /name/ /virtualclassargs/ + /cls/ new ?-childof /obj/? /virtualclassargs/ + This new feature allows us to provide better error messages and + to make much of the "... info ... configure parameter ..." + infrastructure much less important. +- For "virtualclassargs" we need the functionality to obtain + from the C-Code based on a class the configure parameters + applicable to objects of this class. +- add argument "-context ..." to "cmd::info" to pass the context object + (so far the only place where the context-object is used) +- object system configuration parameters changes: + new: -class.configureparameter + new: -object.configureparameter + removed: -class.objectparameter + ======================================================================== TODO: +- use "cmd::info" to implement "info lookup parameter configure" etc. +- use context-object for error messages of configure/new/create/recreate +- remove // comments - what should happen with: "/class/ info mixin classes -heritage" - asymmetry between "/obj/ info lookup mixins" vs. "/obj/ info ?object? mixin classes" Index: generic/gentclAPI.tcl =================================================================== diff -u -r403f26de1f34f39943b605903b47ec31c974cf9a -rd9344280c05990c0254aa652a08a09da3e5822b1 --- generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision 403f26de1f34f39943b605903b47ec31c974cf9a) +++ generic/gentclAPI.tcl (.../gentclAPI.tcl) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -90,7 +90,9 @@ "object" {set converter Object} "tclobj" {set converter Tclobj} "args" {set converter Nothing} - "allargs" {set converter Nothing} + "allargs" - + "virtualobjectargs" - + "virtualclassargs" {set converter Nothing} "objpattern" {set converter Objpattern} *|* { if {![info exists (-typeName)]} {set (-typeName) $(-argName)} @@ -206,7 +208,9 @@ set ifSet 1 set cVar 0 } - "allargs" { + "virtualobjectargs" - + "virtualclassargs" - + "allargs" { set type "int " set calledArg "objc, objv" lappend if "int objc" "Tcl_Obj *CONST objv\[\]" Index: generic/nsf.c =================================================================== diff -u -r729b49eb1dcb08183a0ed41588416a923271811a -rd9344280c05990c0254aa652a08a09da3e5822b1 --- generic/nsf.c (.../nsf.c) (revision 729b49eb1dcb08183a0ed41588416a923271811a) +++ generic/nsf.c (.../nsf.c) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -357,6 +357,24 @@ static int NsfParameterInvalidateObjectCacheCmd(Tcl_Interp *interp, NsfObject *object) nonnull(1) nonnull(2); +static int GetObjectParameterDefinition(Tcl_Interp *interp, Tcl_Obj *procNameObj, + NsfObject *object, NsfClass *class, + NsfParsedParam *parsedParamPtr) + nonnull(1) nonnull(2) nonnull(5); + +typedef Tcl_Obj *(NsfFormatFunction) _ANSI_ARGS_((Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, + NsfObject *contextObject)); + +static Tcl_Obj *NsfParamDefsVirtualFormat(Tcl_Interp *interp, Nsf_Param CONST *pPtr, + NsfObject *contextObject, + NsfFormatFunction formatFunction) + nonnull(1) nonnull(2) nonnull(3) nonnull(4); + +static int NsfParamDefsAppendVirtual(Tcl_Interp *interp, Tcl_Obj *listObj, + Nsf_Param CONST *paramsPtr, NsfObject *contextObject, + NsfFormatFunction formatFunction) + nonnull(1) nonnull(2) nonnull(3) nonnull(5); + /* prototypes for alias management */ static int AliasDelete(Tcl_Interp *interp, Tcl_Obj *cmdName, CONST char *methodName, int withPer_object) nonnull(1) nonnull(2) nonnull(3); @@ -7429,7 +7447,7 @@ if (strcmp(option, "all") == 0) { opt->checkoptions |= CHECK_ALL; } - break; + break; } } } @@ -10933,21 +10951,24 @@ * *---------------------------------------------------------------------- */ -static int ParamDefsStore(Tcl_Command cmd, NsfParamDefs *paramDefs, int checkAlwaysFlag) nonnull(1); +static int ParamDefsStore(Tcl_Interp *interp, Tcl_Command cmd, NsfParamDefs *paramDefs, int checkAlwaysFlag) + nonnull(1) nonnull(2); static int -ParamDefsStore(Tcl_Command cmd, NsfParamDefs *paramDefs, int checkAlwaysFlag) { +ParamDefsStore(Tcl_Interp *interp, Tcl_Command cmd, NsfParamDefs *paramDefs, int checkAlwaysFlag) { Command *cmdPtr = (Command *)cmd; + assert(interp); assert(cmd); // TODO This function might store empty paramDefs. needed? if (cmdPtr->deleteProc != NsfProcDeleteProc) { NsfProcContext *ctxPtr = NEW(NsfProcContext); - /*fprintf(stderr, "ParamDefsStore %p replace deleteProc %p by %p\n", - paramDefs, cmdPtr->deleteProc, NsfProcDeleteProc);*/ + /*fprintf(stderr, "ParamDefsStore %p (%s) replace deleteProc %p by %p\n", + paramDefs, Tcl_GetCommandName(interp, cmd), + cmdPtr->deleteProc, NsfProcDeleteProc);*/ ctxPtr->oldDeleteData = (Proc *)cmdPtr->deleteData; ctxPtr->oldDeleteProc = cmdPtr->deleteProc; @@ -11096,7 +11117,8 @@ *---------------------------------------------------------------------- */ static void ParamDefsFormatOption(Tcl_Obj *nameStringObj, CONST char *option, - int *colonWritten, int *firstOption) nonnull(1) nonnull(2) nonnull(3) nonnull(4); + int *colonWritten, int *firstOption) + nonnull(1) nonnull(2) nonnull(3) nonnull(4); static void ParamDefsFormatOption(Tcl_Obj *nameStringObj, CONST char *option, @@ -11134,11 +11156,11 @@ * *---------------------------------------------------------------------- */ -static Tcl_Obj *ParamDefsFormat(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr) +static Tcl_Obj *ParamDefsFormat(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfObject *contextObject) nonnull(1) nonnull(2) returns_nonnull; static Tcl_Obj * -ParamDefsFormat(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr) { +ParamDefsFormat(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfObject *contextObject) { int first, colonWritten; Tcl_Obj *listObj = Tcl_NewListObj(0, NULL), *innerListObj, *nameStringObj; @@ -11169,7 +11191,12 @@ first = 1; colonWritten = 0; + if (NsfParamDefsAppendVirtual(interp, listObj, paramsPtr, contextObject, ParamDefsFormat)) { + continue; + } + nameStringObj = Tcl_NewStringObj(paramsPtr->name, -1); + if (paramsPtr->type) { ParamDefsFormatOption(nameStringObj, paramsPtr->type, &colonWritten, &first); } else if (isNonpos && paramsPtr->nrArgs == 0) { @@ -11234,22 +11261,25 @@ * *---------------------------------------------------------------------- */ -static Tcl_Obj * ParamDefsList(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr) +static Tcl_Obj *ParamDefsList(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfObject *contextObject) nonnull(1) nonnull(2) returns_nonnull; static Tcl_Obj * -ParamDefsList(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr) { +ParamDefsList(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfObject *contextObject) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); assert(interp); assert(paramsPtr); INCR_REF_COUNT2("paramDefsObj", listObj); + for (; likely(paramsPtr->name != NULL); paramsPtr++) { - if ((paramsPtr->flags & NSF_ARG_NOCONFIG) == 0) { - Tcl_ListObjAppendElement(interp, listObj, Tcl_NewStringObj(paramsPtr->name, -1)); - } + if ((paramsPtr->flags & NSF_ARG_NOCONFIG) != 0) continue; + if (NsfParamDefsAppendVirtual(interp, listObj, paramsPtr, contextObject, ParamDefsList)) continue; + + Tcl_ListObjAppendElement(interp, listObj, Tcl_NewStringObj(paramsPtr->name, -1)); } + return listObj; } @@ -11269,24 +11299,27 @@ * *---------------------------------------------------------------------- */ -static Tcl_Obj * ParamDefsNames(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr) +static Tcl_Obj * ParamDefsNames(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfObject *contextObject) nonnull(1) nonnull(2) returns_nonnull; static Tcl_Obj * -ParamDefsNames(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr) { +ParamDefsNames(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfObject *contextObject) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); assert(interp); assert(paramsPtr); INCR_REF_COUNT2("paramDefsObj", listObj); + for (; likely(paramsPtr->name != NULL); paramsPtr++) { - if ((paramsPtr->flags & NSF_ARG_NOCONFIG) == 0) { - Tcl_ListObjAppendElement(interp, listObj, - paramsPtr->nameObj ? paramsPtr->nameObj : - Tcl_NewStringObj(paramsPtr->name,-1)); - } + if ((paramsPtr->flags & NSF_ARG_NOCONFIG) != 0) continue; + if (NsfParamDefsAppendVirtual(interp, listObj, paramsPtr, contextObject, ParamDefsNames)) continue; + + Tcl_ListObjAppendElement(interp, listObj, + paramsPtr->nameObj ? paramsPtr->nameObj : + Tcl_NewStringObj(paramsPtr->name,-1)); } + return listObj; } @@ -11382,7 +11415,8 @@ *---------------------------------------------------------------------- */ -static void NsfParamDefsSyntaxOne(Tcl_Obj *argStringObj, Nsf_Param CONST *pPtr) nonnull(1) nonnull(2); +static void NsfParamDefsSyntaxOne(Tcl_Obj *argStringObj, Nsf_Param CONST *pPtr) + nonnull(1) nonnull(2); static void NsfParamDefsSyntaxOne(Tcl_Obj *argStringObj, Nsf_Param CONST *pPtr) { @@ -11417,6 +11451,84 @@ /* *---------------------------------------------------------------------- + * NsfParamDefsVirtualFormat -- + * + * This function is called, when we know we can resolve a virtual argument + * against the context object. In such cases, obtain the resolved parsed + * params and call the formatter. + * + * Results: + * Standard Tcl result code. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static Tcl_Obj * +NsfParamDefsVirtualFormat(Tcl_Interp *interp, Nsf_Param CONST *pPtr, NsfObject *contextObject, NsfFormatFunction formatFunction) { + NsfParsedParam parsedParam; + int result; + + assert(interp); + assert(pPtr); + assert(pPtr->type); + assert(formatFunction); + assert(contextObject); + + if (strcmp(pPtr->type, "virtualobjectargs") == 0) { + result = GetObjectParameterDefinition(interp, NsfGlobalObjs[NSF_EMPTY], contextObject, NULL, &parsedParam); + } else if (NsfObjectIsClass(contextObject)) { + result = GetObjectParameterDefinition(interp, NsfGlobalObjs[NSF_EMPTY], NULL, (NsfClass *)contextObject, &parsedParam); + } else { + NsfLog(interp, NSF_LOG_WARN, "... CANNOT append, context is no class <%s>\n", ObjectName(contextObject)); + result = TCL_ERROR; + } + if (result == TCL_OK && parsedParam.paramDefs != NULL) { + return (*formatFunction)(interp, parsedParam.paramDefs->paramsPtr, contextObject); + } + return NULL; +} + + +/* + *---------------------------------------------------------------------- + * NsfParamDefsAppendVirtual -- + * + * Check for the given paramsPtr wether this is a virtual parameter and if + * possible, resolve it and append the formatted content to the Tcl_Obj. + * + * Results: + * Boolean value for success + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +static int +NsfParamDefsAppendVirtual(Tcl_Interp *interp, Tcl_Obj *listObj, Nsf_Param CONST *paramsPtr, NsfObject *contextObject, + NsfFormatFunction formatFunction) { + assert(interp); + assert(listObj); + assert(paramsPtr); + assert(formatFunction); + + if (paramsPtr->converter == ConvertToNothing && strcmp(paramsPtr->name, "args") == 0) { + if (contextObject != NULL && strncmp(paramsPtr->type, "virtual", 7) == 0) { + Tcl_Obj *formattedObj = NsfParamDefsVirtualFormat(interp, paramsPtr, contextObject, formatFunction); + if (formattedObj != NULL) { + Tcl_ListObjAppendList(interp, listObj, formattedObj); + return 1; + } + } + } + return 0; +} + +/* + *---------------------------------------------------------------------- * NsfParamDefsSyntax -- * * Return the parameter definitions of a sequence of parameters in @@ -11432,13 +11544,15 @@ *---------------------------------------------------------------------- */ -Tcl_Obj *NsfParamDefsSyntax(Nsf_Param CONST *paramsPtr) nonnull(1) returns_nonnull; +Tcl_Obj *NsfParamDefsSyntax(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfObject *contextObject) + nonnull(1) nonnull(2) returns_nonnull; Tcl_Obj * -NsfParamDefsSyntax(Nsf_Param CONST *paramsPtr) { +NsfParamDefsSyntax(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfObject *contextObject) { Tcl_Obj *argStringObj = Tcl_NewObj(); Nsf_Param CONST *pPtr; + assert(interp); assert(paramsPtr); INCR_REF_COUNT2("paramDefsObj", argStringObj); @@ -11462,7 +11576,41 @@ } if (pPtr->converter == ConvertToNothing && strcmp(pPtr->name, "args") == 0) { - Tcl_AppendLimitedToObj(argStringObj, "?/arg .../?", 11, INT_MAX, NULL); + int argsResolved = 0; + + if (contextObject != NULL && strncmp(pPtr->type, "virtual", 7) == 0) { + Tcl_Obj *formattedObj = NsfParamDefsVirtualFormat(interp, pPtr, contextObject, NsfParamDefsSyntax); + if (formattedObj != NULL) { + argsResolved = 1; + Tcl_AppendObjToObj(argStringObj, formattedObj); + } + } + if (argsResolved == 0) { + Tcl_AppendLimitedToObj(argStringObj, "?/arg .../?", 11, INT_MAX, NULL); + } +#if 0 + NsfParsedParam parsedParam; + int result; + + if (strcmp(pPtr->type, "virtualobjectargs") == 0) { + fprintf(stderr, "append virtual object args\n"); + result = GetObjectParameterDefinition(interp, NsfGlobalObjs[NSF_EMPTY], contextObject, NULL, &parsedParam); + } else if (NsfObjectIsClass(contextObject)) { + fprintf(stderr, "append virtual class args\n"); + result = GetObjectParameterDefinition(interp, NsfGlobalObjs[NSF_EMPTY], NULL, (NsfClass *)contextObject, &parsedParam); + } else { + result = TCL_ERROR; + } + if (result == TCL_OK && parsedParam.paramDefs != NULL) { + argsResolved = 1; + Tcl_AppendObjToObj(argStringObj, NsfParamDefsSyntax(interp, parsedParam.paramDefs->paramsPtr, contextObject)); + } + } + if (argsResolved == 0) { + Tcl_AppendLimitedToObj(argStringObj, "?/arg .../?", 11, INT_MAX, NULL); + } +#endif + } else if (pPtr->flags & NSF_ARG_REQUIRED) { if ((pPtr->flags & NSF_ARG_IS_ENUMERATION)) { @@ -15459,7 +15607,7 @@ procPtr->cmdPtr->nsPtr = ((Command *)regObject->id)->nsPtr; } - ParamDefsStore((Tcl_Command)procPtr->cmdPtr, parsedParam.paramDefs, checkAlwaysFlag); + ParamDefsStore(interp, (Tcl_Command)procPtr->cmdPtr, parsedParam.paramDefs, checkAlwaysFlag); Tcl_SetObjResult(interp, MethodHandleObj(defObject, withPer_object, methodName)); result = TCL_OK; } @@ -15906,7 +16054,7 @@ * receives paramters + flag via client data... but it is needed for * introspection. */ - ParamDefsStore(cmd, paramDefs, checkAlwaysFlag); + ParamDefsStore(interp, cmd, paramDefs, checkAlwaysFlag); /*fprintf(stderr, "NsfProcAdd procName '%s' define cmd '%s' %p in namespace %s\n", procName, Tcl_GetCommandName(interp, cmd), cmd, cmdNsPtr->fullName);*/ @@ -20530,7 +20678,7 @@ } } else if (unlikely(pPtr->flags & NSF_ARG_REQUIRED) && (processFlags & NSF_ARGPARSE_FORCE_REQUIRED)) { - Tcl_Obj *paramDefsObj = NsfParamDefsSyntax(ifd); + Tcl_Obj *paramDefsObj = NsfParamDefsSyntax(interp, ifd, NULL); // TODO NsfObject *contextObject Tcl_Obj *methodPathObj = NsfMethodNamePath(interp, NULL /* use topmost frame */, MethodName(pcPtr->full_objv[0])); @@ -21185,21 +21333,23 @@ * *---------------------------------------------------------------------- */ -static Tcl_Obj * ListParamDefs(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfParamsPrintStyle style) +static Tcl_Obj *ListParamDefs(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, + NsfObject *contextObject, NsfParamsPrintStyle style) nonnull(1) nonnull(2) returns_nonnull; static Tcl_Obj * -ListParamDefs(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfParamsPrintStyle style) { +ListParamDefs(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfObject *contextObject, + NsfParamsPrintStyle style) { Tcl_Obj *listObj; assert(interp); assert(paramsPtr); switch (style) { - case NSF_PARAMS_PARAMETER: listObj = ParamDefsFormat(interp, paramsPtr); break; - case NSF_PARAMS_LIST: listObj = ParamDefsList(interp, paramsPtr); break; - case NSF_PARAMS_NAMES: listObj = ParamDefsNames(interp, paramsPtr); break; - default: /* NSF_PARAMS_SYNTAX:*/ listObj = NsfParamDefsSyntax(paramsPtr); break; + case NSF_PARAMS_PARAMETER: listObj = ParamDefsFormat(interp, paramsPtr, contextObject); break; + case NSF_PARAMS_LIST: listObj = ParamDefsList(interp, paramsPtr, contextObject); break; + case NSF_PARAMS_NAMES: listObj = ParamDefsNames(interp, paramsPtr, contextObject); break; + default: /* NSF_PARAMS_SYNTAX:*/ listObj = NsfParamDefsSyntax(interp, paramsPtr, contextObject); break; } return listObj; @@ -21223,13 +21373,13 @@ *---------------------------------------------------------------------- */ -static int ListCmdParams(Tcl_Interp *interp, Tcl_Command cmd, CONST char *methodName, - NsfParamsPrintStyle printStyle) - nonnull(1) nonnull(3) nonnull(2); +static int ListCmdParams(Tcl_Interp *interp, Tcl_Command cmd, NsfObject *contextObject, + CONST char *methodName, NsfParamsPrintStyle printStyle) + nonnull(1) nonnull(2) nonnull(4) ; static int -ListCmdParams(Tcl_Interp *interp, Tcl_Command cmd, CONST char *methodName, - NsfParamsPrintStyle printStyle) { +ListCmdParams(Tcl_Interp *interp, Tcl_Command cmd, NsfObject *contextObject, + CONST char *methodName, NsfParamsPrintStyle printStyle) { NsfParamDefs *paramDefs; Tcl_Obj *listObj; Proc *procPtr; @@ -21244,7 +21394,7 @@ /* * Obtain parameter info from paramDefs. */ - listObj = ListParamDefs(interp, paramDefs->paramsPtr, printStyle); + listObj = ListParamDefs(interp, paramDefs->paramsPtr, contextObject, printStyle); Tcl_SetObjResult(interp, listObj); DECR_REF_COUNT2("paramDefsObj", listObj); return TCL_OK; @@ -21313,8 +21463,8 @@ Nsf_methodDefinition *mdPtr = Nsf_CmdDefinitionGet(((Command *)cmd)->objProc); if (mdPtr != NULL) { NsfParamDefs paramDefs = {mdPtr->paramDefs, mdPtr->nrParameters, 1, 0, NULL, NULL}; - Tcl_Obj *list = ListParamDefs(interp, paramDefs.paramsPtr, printStyle); - + Tcl_Obj *list = ListParamDefs(interp, paramDefs.paramsPtr, contextObject, printStyle); + Tcl_SetObjResult(interp, list); DECR_REF_COUNT2("paramDefsObj", list); return TCL_OK; @@ -21330,7 +21480,7 @@ paramDefs.paramsPtr = cd->paramsPtr; paramDefs.nrParams = 1; paramDefs.slotObj = NULL; - list = ListParamDefs(interp, paramDefs.paramsPtr, printStyle); + list = ListParamDefs(interp, paramDefs.paramsPtr, contextObject, printStyle); Tcl_SetObjResult(interp, list); DECR_REF_COUNT2("paramDefsObj", list); return TCL_OK; @@ -21553,16 +21703,22 @@ static int ListMethod(Tcl_Interp *interp, NsfObject *regObject, NsfObject *defObject, - CONST char *methodName, Tcl_Command cmd, - int subcmd, int withPer_object) + CONST char *methodName, + Tcl_Command cmd, + int subcmd, + NsfObject *contextObject, + int withPer_object) nonnull(1) nonnull(4) nonnull(5); static int ListMethod(Tcl_Interp *interp, NsfObject *regObject, NsfObject *defObject, - CONST char *methodName, Tcl_Command cmd, - int subcmd, int withPer_object) { + CONST char *methodName, + Tcl_Command cmd, + int subcmd, + NsfObject *contextObject, + int withPer_object) { Tcl_ObjCmdProc *procPtr; int outputPerObject; @@ -21610,12 +21766,12 @@ case InfomethodsubcmdArgsIdx: { Tcl_Command importedCmd = GetOriginalCommand(cmd); - return ListCmdParams(interp, importedCmd, methodName, NSF_PARAMS_NAMES); + return ListCmdParams(interp, importedCmd, contextObject, methodName, NSF_PARAMS_NAMES); } case InfomethodsubcmdParameterIdx: { Tcl_Command importedCmd = GetOriginalCommand(cmd); - return ListCmdParams(interp, importedCmd, methodName, NSF_PARAMS_PARAMETER); + return ListCmdParams(interp, importedCmd, contextObject, methodName, NSF_PARAMS_PARAMETER); } case InfomethodsubcmdReturnsIdx: { @@ -21632,7 +21788,7 @@ case InfomethodsubcmdSyntaxIdx: { Tcl_Command importedCmd = GetOriginalCommand(cmd); - return ListCmdParams(interp, importedCmd, methodName, NSF_PARAMS_SYNTAX); + return ListCmdParams(interp, importedCmd, contextObject, methodName, NSF_PARAMS_SYNTAX); } case InfomethodsubcmdPreconditionIdx: { @@ -21726,7 +21882,7 @@ Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewStringObj("::proc", -1)); Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewStringObj(methodName,-1)); } - ListCmdParams(interp, cmd, methodName, NSF_PARAMS_PARAMETER); + ListCmdParams(interp, cmd, contextObject, methodName, NSF_PARAMS_PARAMETER); Tcl_ListObjAppendElement(interp, resultObj, Tcl_GetObjResult(interp)); AppendReturnsClause(interp, resultObj, cmd); @@ -21838,7 +21994,7 @@ Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewStringObj(Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr))); - ListCmdParams(interp, cmd, Tcl_DStringValue(dsPtr), NSF_PARAMS_PARAMETER); + ListCmdParams(interp, cmd, NULL, Tcl_DStringValue(dsPtr), NSF_PARAMS_PARAMETER); Tcl_ListObjAppendElement(interp, resultObj, Tcl_GetObjResult(interp)); ListProcBody(interp, GetTclProcFromCommand(procCmd), methodName); Tcl_ListObjAppendElement(interp, resultObj, Tcl_GetObjResult(interp)); @@ -21970,13 +22126,15 @@ *---------------------------------------------------------------------- */ static int -ListMethodResolve(Tcl_Interp *interp, int subcmd, Tcl_Namespace *nsPtr, - NsfObject *object, Tcl_Obj *methodNameObj, int fromClassNS) - nonnull(1) nonnull(5); + ListMethodResolve(Tcl_Interp *interp, int subcmd, NsfObject *contextObject, + Tcl_Namespace *nsPtr, NsfObject *object, + Tcl_Obj *methodNameObj, int fromClassNS) + nonnull(1) nonnull(6); static int -ListMethodResolve(Tcl_Interp *interp, int subcmd, Tcl_Namespace *nsPtr, - NsfObject *object, Tcl_Obj *methodNameObj, int fromClassNS) { +ListMethodResolve(Tcl_Interp *interp, int subcmd, NsfObject *contextObject, + Tcl_Namespace *nsPtr, NsfObject *object, + Tcl_Obj *methodNameObj, int fromClassNS) { NsfObject *regObject, *defObject; CONST char *methodName1 = NULL; int result = TCL_OK; @@ -21995,10 +22153,13 @@ * empty. */ if (likely(cmd != NULL)) { + result = ListMethod(interp, regObject ? regObject : object, defObject ? defObject : object, - methodName1, cmd, subcmd, fromClassNS ? 0 : 1); + methodName1, cmd, subcmd, contextObject, + fromClassNS ? 0 : 1); + } else if (subcmd == InfomethodsubcmdExistsIdx) { Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); } @@ -23312,13 +23473,17 @@ /* cmd "cmd::info" NsfCmdInfoCmd { {-argName "subcmd" -required 1 -typeName "methodgetcmd" -type "args|body|definition|exists|registrationhandle|definitionhandle|origin|parameter|syntax|type|precondition|postcondition|submethods|returns"} + {-argName "-context" -required 0 -type object} {-argName "methodName" -required 1 -type tclobj} } {-nxdoc 1} */ static int -NsfCmdInfoCmd(Tcl_Interp *interp, int subcmd, Tcl_Obj *methodNameObj) { +NsfCmdInfoCmd(Tcl_Interp *interp, int subcmd, NsfObject *context, Tcl_Obj *methodNameObj) { - return ListMethodResolve(interp, subcmd, NULL, NULL, methodNameObj, 0); + assert(interp); + assert(methodNameObj); + + return ListMethodResolve(interp, subcmd, context, NULL, NULL, methodNameObj, 0); } /* @@ -24392,7 +24557,7 @@ if (paramDefs == NULL) { /* acquire new paramDefs */ paramDefs = ParamDefsNew(); - ParamDefsStore(cmd, paramDefs, 0); + ParamDefsStore(interp, cmd, paramDefs, 0); /*fprintf(stderr, "new param definitions %p for cmd %p %s\n", paramDefs, cmd, methodName);*/ } objPtr = @@ -25089,19 +25254,19 @@ break; case ParametersubcmdListIdx: - listObj = ParamDefsList(interp, paramsPtr); + listObj = ParamDefsList(interp, paramsPtr, NULL); // TODO contextObject Tcl_SetObjResult(interp, listObj); DECR_REF_COUNT2("paramDefsObj", listObj); break; case ParametersubcmdNameIdx: - listObj = ParamDefsNames(interp, paramsPtr); + listObj = ParamDefsNames(interp, paramsPtr, NULL); // TODO contextObject Tcl_SetObjResult(interp, listObj); DECR_REF_COUNT2("paramDefsObj", listObj); break; case ParametersubcmdSyntaxIdx: - listObj = NsfParamDefsSyntax(paramsPtr); + listObj = NsfParamDefsSyntax(interp, paramsPtr, NULL); // TODO contextObject Tcl_SetObjResult(interp, listObj); DECR_REF_COUNT2("paramDefsObj", listObj); break; @@ -26217,34 +26382,99 @@ * *---------------------------------------------------------------------- */ +static int +ComputeParameterDefinition(Tcl_Interp *interp, Tcl_Obj *procNameObj, + NsfObject *object, NsfClass *class, + NsfParsedParam *parsedParamPtr) { + int result = TCL_OK; + Tcl_Obj *methodObj; + NsfObject *self; + + if (object) { + methodObj = NsfMethodObj(object, NSF_o_configureparameter_idx); + self = object; + } else { + assert(class); + self = &class->object; + methodObj = NsfMethodObj(self, NSF_c_configureparameter_idx); + } -static int GetObjectParameterDefinition(Tcl_Interp *interp, Tcl_Obj *procNameObj, - NsfObject *object, NsfParsedParam *parsedParamPtr) - nonnull(1) nonnull(2) nonnull(3) nonnull(4); + if (methodObj) { + /*fprintf(stderr, "calling %s %s\n", ObjectName(self), ObjStr(methodObj));*/ + result = CallMethod(self, interp, methodObj, 2, NULL, + NSF_CM_IGNORE_PERMISSIONS|NSF_CSC_IMMEDIATE); + + if (likely(result == TCL_OK)) { + Tcl_Obj *rawConfArgs = Tcl_GetObjResult(interp); + /*fprintf(stderr, ".... rawConfArgs for %s => '%s'\n", + ObjectName(self), ObjStr(rawConfArgs));*/ + INCR_REF_COUNT(rawConfArgs); + + /* + * Parse the string representation to obtain the internal + * representation. + */ + result = ParamDefsParse(interp, procNameObj, rawConfArgs, + NSF_DISALLOWED_ARG_OBJECT_PARAMETER, 1, + parsedParamPtr); + if (likely(result == TCL_OK)) { + NsfParsedParam *ppDefPtr = NEW(NsfParsedParam); + + ppDefPtr->paramDefs = parsedParamPtr->paramDefs; + ppDefPtr->possibleUnknowns = parsedParamPtr->possibleUnknowns; + if (class) { + assert(class->parsedParamPtr == NULL); + class->parsedParamPtr = ppDefPtr; +#if defined(PER_OBJECT_PARAMETER_CACHING) + } else if (object) { + NsfObjectOpt *opt = NsfRequireObjectOpt(object); + if (object->opt->parsedParamPtr) { + NsfParameterInvalidateObjectCacheCmd(interp, object); + } + opt->parsedParamPtr = ppDefPtr; + opt->classParamPtrEpoch = RUNTIME_STATE(interp)->classParamPtrEpoch; + /*fprintf(stderr, "set obj param for obj %p %s epoch %d ppDefPtr %p\n", + object, ObjectName(object), opt->classParamPtrEpoch, ppDefPtr);*/ +#endif + } + if (ppDefPtr->paramDefs) { + ParamDefsRefCountIncr(ppDefPtr->paramDefs); + } + } + DECR_REF_COUNT(rawConfArgs); + } + } + return result; +} + + static int GetObjectParameterDefinition(Tcl_Interp *interp, Tcl_Obj *procNameObj, - NsfObject *object, NsfParsedParam *parsedParamPtr) { - int result; - NsfClass *class; + NsfObject *object, NsfClass *class, + NsfParsedParam *parsedParamPtr) { + int result = TCL_OK; assert(interp); assert(procNameObj); - assert(object); assert(parsedParamPtr); - if ((object->flags & NSF_HAS_PER_OBJECT_SLOTS) - || (object->opt && object->opt->objMixins) - ) { - /* - * We have object-specific parameters. Do not use the per-class cache, - * and do not save the results in the per-class cache - */ - /*fprintf(stderr, "per-object configure obj %s flags %.6x\n", - ObjectName(object), object->flags);*/ - class = NULL; - } else { - class = object->cl; + parsedParamPtr->paramDefs = NULL; + parsedParamPtr->possibleUnknowns = 0; + + if (class == NULL) { + if ((object && object->flags & NSF_HAS_PER_OBJECT_SLOTS) + || (object && object->opt && object->opt->objMixins) + ) { + /* + * We have object-specific parameters. Do not use the per-class cache, + * and do not save the results in the per-class cache + */ + /*fprintf(stderr, "per-object configure obj %s flags %.6x\n", + ObjectName(object), object->flags);*/ + } else { + class = object->cl; + } } /* @@ -26275,7 +26505,7 @@ result = TCL_OK; #if defined(PER_OBJECT_PARAMETER_CACHING) - } else if (object->opt && object->opt->parsedParamPtr && + } else if (object && object->opt && object->opt->parsedParamPtr && object->opt->classParamPtrEpoch == RUNTIME_STATE(interp)->classParamPtrEpoch) { NsfParsedParam *objParsedParamPtr = object->opt->parsedParamPtr; @@ -26291,57 +26521,9 @@ * There is no parameter definition available, get a new one in * the the string representation. */ - Tcl_Obj *methodObj = NsfMethodObj(object, NSF_c_objectparameter_idx); - - if (methodObj) { - /*fprintf(stderr, "calling %s objectparameter\n", ObjectName(object));*/ - result = CallMethod(object, interp, methodObj, 2, NULL, - NSF_CM_IGNORE_PERMISSIONS|NSF_CSC_IMMEDIATE); - - if (likely(result == TCL_OK)) { - Tcl_Obj *rawConfArgs = Tcl_GetObjResult(interp); - - /*fprintf(stderr, ".... rawConfArgs for %s => '%s'\n", - ObjectName(object), ObjStr(rawConfArgs));*/ - INCR_REF_COUNT(rawConfArgs); - - /* - * Parse the string representation to obtain the internal - * representation. - */ - result = ParamDefsParse(interp, procNameObj, rawConfArgs, - NSF_DISALLOWED_ARG_OBJECT_PARAMETER, 1, - parsedParamPtr); - if (likely(result == TCL_OK)) { - NsfParsedParam *ppDefPtr = NEW(NsfParsedParam); - ppDefPtr->paramDefs = parsedParamPtr->paramDefs; - ppDefPtr->possibleUnknowns = parsedParamPtr->possibleUnknowns; - if (class) { - assert(class->parsedParamPtr == NULL); - class->parsedParamPtr = ppDefPtr; -#if defined(PER_OBJECT_PARAMETER_CACHING) - } else { - NsfObjectOpt *opt = NsfRequireObjectOpt(object); - if (object->opt->parsedParamPtr) { - NsfParameterInvalidateObjectCacheCmd(interp, object); - } - opt->parsedParamPtr = ppDefPtr; - opt->classParamPtrEpoch = RUNTIME_STATE(interp)->classParamPtrEpoch; - /*fprintf(stderr, "set obj param for obj %p %s epoch %d ppDefPtr %p\n", - object, ObjectName(object), opt->classParamPtrEpoch, ppDefPtr);*/ -#endif - } - if (ppDefPtr->paramDefs) { - ParamDefsRefCountIncr(ppDefPtr->paramDefs); - } - } - DECR_REF_COUNT(rawConfArgs); - } - } else { - parsedParamPtr->paramDefs = NULL; - parsedParamPtr->possibleUnknowns = 0; - result = TCL_OK; - } + result = ComputeParameterDefinition(interp, procNameObj, + object, class, + parsedParamPtr); } return result; @@ -26549,7 +26731,7 @@ #endif /* Get the object parameter definition */ - result = GetObjectParameterDefinition(interp, objv[0], object, &parsedParam); + result = GetObjectParameterDefinition(interp, objv[0], object, NULL, &parsedParam); if (result != TCL_OK || parsedParam.paramDefs == NULL) { /*fprintf(stderr, "... nothing to do for method %s\n", ObjStr(objv[0]));*/ @@ -26674,7 +26856,7 @@ Tcl_Obj *varObj = Tcl_ObjGetVar2(interp, paramPtr->nameObj, NULL, TCL_PARSE_PART1); if (varObj == NULL) { - Tcl_Obj *paramDefsObj = NsfParamDefsSyntax(paramDefs->paramsPtr); + Tcl_Obj *paramDefsObj = NsfParamDefsSyntax(interp, paramDefs->paramsPtr, object); // TODO contextObject? NsfPrintError(interp, "required argument '%s' is missing, should be:\n\t%s%s%s %s", paramPtr->nameObj ? ObjStr(paramPtr->nameObj) : paramPtr->name, @@ -26881,7 +27063,7 @@ * Get the object parameter definition */ result = GetObjectParameterDefinition(interp, NsfGlobalObjs[NSF_EMPTY], - object, &parsedParam); + object, NULL, &parsedParam); if (unlikely(result != TCL_OK)) { return result; } @@ -27839,7 +28021,8 @@ if (likely(class->parsedParamPtr && class->parsedParamPtr->paramDefs)) { Tcl_Obj *listObj; - listObj = ListParamDefs(interp, class->parsedParamPtr->paramDefs->paramsPtr, NSF_PARAMS_PARAMETER); + listObj = ListParamDefs(interp, class->parsedParamPtr->paramDefs->paramsPtr, + NULL, NSF_PARAMS_PARAMETER); Tcl_SetObjResult(interp, listObj); DECR_REF_COUNT2("paramDefsObj", listObj); } @@ -27907,8 +28090,6 @@ assert(interp); assert(cl); - /*fprintf(stderr, "NsfCNewMethod objc %d\n", objc);*/ - Tcl_DStringInit(dsPtr); if (withChildof) { CONST char *parentName = ObjStr(withChildof); @@ -27945,16 +28126,29 @@ fullnameObj = Tcl_NewStringObj(Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr)); INCR_REF_COUNT(fullnameObj); + /* + * Since we are using "virtualclassargs" for the last argument, we have to + * adjust the agument list manually. + */ + if (withChildof) { + objc -= 3 ; + objv += 3 ; + } else { + objc --; + objv++; + } + { Tcl_Obj *methodObj; int callDirectly; ALLOC_ON_STACK(Tcl_Obj*, objc+3, ov); callDirectly = CallDirectly(interp, &cl->object, NSF_c_create_idx, &methodObj); - ov[0] = objv[0]; + ov[0] = NULL; /* just a placeholder for passing conventions in ObjectDispatch() */ ov[1] = methodObj; ov[2] = fullnameObj; + if (objc >= 1) { memcpy(ov+3, objv, sizeof(Tcl_Obj *)*objc); } @@ -28343,7 +28537,9 @@ NsfObject *pobj = pcl ? &pcl->object : object; int perObject = (pcl == NULL); - ListMethod(interp, pobj, pobj, ObjStr(methodObj), cmd, InfomethodsubcmdRegistrationhandleIdx, perObject); + ListMethod(interp, pobj, pobj, ObjStr(methodObj), cmd, + InfomethodsubcmdRegistrationhandleIdx, NULL, + perObject); } return TCL_OK; } @@ -28560,7 +28756,7 @@ static int NsfObjInfoMethodMethod(Tcl_Interp *interp, NsfObject *object, int subcmd, Tcl_Obj *methodNameObj) { - return ListMethodResolve(interp, subcmd, object->nsPtr, object, methodNameObj, 0); + return ListMethodResolve(interp, subcmd, NULL, object->nsPtr, object, methodNameObj, 0); } /* @@ -28650,7 +28846,7 @@ assert(object); result = GetObjectParameterDefinition(interp, NsfGlobalObjs[NSF_EMPTY], - object, &parsedParam); + object, NULL, &parsedParam); if (result != TCL_OK || parsedParam.paramDefs == NULL) { return result; @@ -28696,16 +28892,16 @@ switch (subcmd) { case InfoobjectparametersubcmdDefinitionsIdx: - listObj = ParamDefsFormat(interp, paramsPtr); + listObj = ParamDefsFormat(interp, paramsPtr, NULL); // TODO contextObject break; case InfoobjectparametersubcmdListIdx: - listObj = ParamDefsList(interp, paramsPtr); + listObj = ParamDefsList(interp, paramsPtr, NULL); // TODO contextObject break; case InfoobjectparametersubcmdNamesIdx: - listObj = ParamDefsNames(interp, paramsPtr); + listObj = ParamDefsNames(interp, paramsPtr, NULL); // TODO contextObject break; case InfoobjectparametersubcmdSyntaxIdx: - listObj = NsfParamDefsSyntax(paramsPtr); + listObj = NsfParamDefsSyntax(interp, paramsPtr, NULL); // TODO contextObject break; } assert(listObj); @@ -28999,7 +29195,7 @@ NsfClassInfoMethodMethod(Tcl_Interp *interp, NsfClass *class, int subcmd, Tcl_Obj *methodNameObj) { - return ListMethodResolve(interp, subcmd, class->nsPtr, &class->object, methodNameObj, 1); + return ListMethodResolve(interp, subcmd, NULL, class->nsPtr, &class->object, methodNameObj, 1); } /* Index: generic/nsfAPI.decls =================================================================== diff -u -r729b49eb1dcb08183a0ed41588416a923271811a -rd9344280c05990c0254aa652a08a09da3e5822b1 --- generic/nsfAPI.decls (.../nsfAPI.decls) (revision 729b49eb1dcb08183a0ed41588416a923271811a) +++ generic/nsfAPI.decls (.../nsfAPI.decls) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -100,6 +100,7 @@ cmd "cmd::info" NsfCmdInfoCmd { {-argName "subcmd" -required 1 -typeName "methodgetcmd" -type "args|body|definition|exists|registrationhandle|definitionhandle|origin|parameter|syntax|type|precondition|postcondition|submethods|returns"} + {-argName "-context" -required 0 -type object} {-argName "methodName" -required 1 -type tclobj} } {-nxdoc 1} @@ -301,7 +302,7 @@ } objectMethod configure NsfOConfigureMethod { - {-argName "args" -type allargs} + {-argName "args" -type virtualobjectargs} } objectMethod destroy NsfODestroyMethod { @@ -356,7 +357,7 @@ classMethod create NsfCCreateMethod { {-argName "objectName" -required 1} - {-argName "args" -type allargs} + {-argName "args" -type virtualclassargs} } classMethod dealloc NsfCDeallocMethod { @@ -378,12 +379,12 @@ classMethod new NsfCNewMethod { {-argName "-childof" -required 0 -type tclobj} - {-argName "args" -required 0 -type args} + {-argName "args" -required 0 -type virtualclassargs} } classMethod recreate NsfCRecreateMethod { {-argName "objectName" -required 1 -type tclobj} - {-argName "args" -type allargs} + {-argName "args" -type virtualclassargs} } classMethod superclass NsfCSuperclassMethod { Index: generic/nsfAPI.h =================================================================== diff -u -r729b49eb1dcb08183a0ed41588416a923271811a -rd9344280c05990c0254aa652a08a09da3e5822b1 --- generic/nsfAPI.h (.../nsfAPI.h) (revision 729b49eb1dcb08183a0ed41588416a923271811a) +++ generic/nsfAPI.h (.../nsfAPI.h) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -522,7 +522,7 @@ NSF_nonnull(1) NSF_nonnull(2); static int NsfCMixinGuardMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *mixin, Tcl_Obj *guard) NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3) NSF_nonnull(4); -static int NsfCNewMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *withChildof, int nobjc, Tcl_Obj *CONST nobjv[]) +static int NsfCNewMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *withChildof, int objc, Tcl_Obj *CONST objv[]) NSF_nonnull(1) NSF_nonnull(2); static int NsfCRecreateMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *objectName, int objc, Tcl_Obj *CONST objv[]) NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3); @@ -558,8 +558,8 @@ NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(7) NSF_nonnull(8) NSF_nonnull(9); static int NsfAsmProcCmd(Tcl_Interp *interp, int withAd, int withCheckalways, Tcl_Obj *procName, Tcl_Obj *arguments, Tcl_Obj *body) NSF_nonnull(1) NSF_nonnull(4) NSF_nonnull(5) NSF_nonnull(6); -static int NsfCmdInfoCmd(Tcl_Interp *interp, int subcmd, Tcl_Obj *methodName) - NSF_nonnull(1) NSF_nonnull(3); +static int NsfCmdInfoCmd(Tcl_Interp *interp, int subcmd, NsfObject *withContext, Tcl_Obj *methodName) + NSF_nonnull(1) NSF_nonnull(4); static int NsfColonCmd(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) NSF_nonnull(1); static int NsfConfigureCmd(Tcl_Interp *interp, int option, Tcl_Obj *value) @@ -985,7 +985,7 @@ Tcl_Obj *withChildof = (Tcl_Obj *)pc.clientData[0]; assert(pc.status == 0); - return NsfCNewMethod(interp, cl, withChildof, objc-pc.lastObjc, objv+pc.lastObjc); + return NsfCNewMethod(interp, cl, withChildof, objc, objv); } else { return TCL_ERROR; @@ -1453,10 +1453,11 @@ method_definitions[NsfCmdInfoCmdIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN, &pc) == TCL_OK)) { int subcmd = (int )PTR2INT(pc.clientData[0]); - Tcl_Obj *methodName = (Tcl_Obj *)pc.clientData[1]; + NsfObject *withContext = (NsfObject *)pc.clientData[1]; + Tcl_Obj *methodName = (Tcl_Obj *)pc.clientData[2]; assert(pc.status == 0); - return NsfCmdInfoCmd(interp, subcmd, methodName); + return NsfCmdInfoCmd(interp, subcmd, withContext, methodName); } else { return TCL_ERROR; @@ -3206,7 +3207,7 @@ }, {"::nsf::methods::class::create", NsfCCreateMethodStub, 2, { {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} + {"args", 0, 1, ConvertToNothing, NULL,NULL,"virtualclassargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::dealloc", NsfCDeallocMethodStub, 1, { {"object", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} @@ -3224,11 +3225,11 @@ }, {"::nsf::methods::class::new", NsfCNewMethodStub, 2, { {"-childof", 0, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} + {"args", 0, 1, ConvertToNothing, NULL,NULL,"virtualclassargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::recreate", NsfCRecreateMethodStub, 2, { {"objectName", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, - {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} + {"args", 0, 1, ConvertToNothing, NULL,NULL,"virtualclassargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::superclass", NsfCSuperclassMethodStub, 1, { {"superclasses", 0, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} @@ -3308,8 +3309,9 @@ {"arguments", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"body", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, -{"::nsf::cmd::info", NsfCmdInfoCmdStub, 2, { +{"::nsf::cmd::info", NsfCmdInfoCmdStub, 3, { {"subcmd", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToInfomethodsubcmd, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, + {"-context", 0, 1, Nsf_ConvertTo_Object, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, {"methodName", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::colon", NsfColonCmdStub, 1, { @@ -3537,7 +3539,7 @@ {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::configure", NsfOConfigureMethodStub, 1, { - {"args", 0, 1, ConvertToNothing, NULL,NULL,"allargs",NULL,NULL,NULL,NULL,NULL}} + {"args", 0, 1, ConvertToNothing, NULL,NULL,"virtualobjectargs",NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::object::destroy", NsfODestroyMethodStub, 0, { {NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} Index: generic/nsfError.c =================================================================== diff -u -r8a6eddd18d929736bd1d3fefe985c2b1f2963fc0 -rd9344280c05990c0254aa652a08a09da3e5822b1 --- generic/nsfError.c (.../nsfError.c) (revision 8a6eddd18d929736bd1d3fefe985c2b1f2963fc0) +++ generic/nsfError.c (.../nsfError.c) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -29,7 +29,8 @@ #include "nsfInt.h" /* function prototypes */ -Tcl_Obj *NsfParamDefsSyntax(Nsf_Param CONST *paramPtr); +Tcl_Obj *NsfParamDefsSyntax(Tcl_Interp *interp, Nsf_Param CONST *paramsPtr, NsfObject *contextObject) + nonnull(1) nonnull(2) returns_nonnull; /* *---------------------------------------------------------------------- @@ -287,7 +288,7 @@ int NsfArgumentError(Tcl_Interp *interp, CONST char *errorMsg, Nsf_Param CONST *paramPtr, Tcl_Obj *cmdNameObj, Tcl_Obj *methodObj) { - Tcl_Obj *argStringObj = NsfParamDefsSyntax(paramPtr); + Tcl_Obj *argStringObj = NsfParamDefsSyntax(interp, paramPtr, NULL); assert(interp); assert(errorMsg); @@ -341,7 +342,7 @@ * * NsfUnexpectedNonposArgumentError -- * - * Produce a unexpecte argument number (most likely, too many arguments) + * Produce an error message about an invalid nonposistional argument. * * Results: * TCL_ERROR Index: generic/nsfInt.h =================================================================== diff -u -reea18b07ddfc917545d48ab6a272c0bfb9656f07 -rd9344280c05990c0254aa652a08a09da3e5822b1 --- generic/nsfInt.h (.../nsfInt.h) (revision eea18b07ddfc917545d48ab6a272c0bfb9656f07) +++ generic/nsfInt.h (.../nsfInt.h) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -572,10 +572,11 @@ NSF_c_alloc_idx, NSF_c_create_idx, NSF_c_dealloc_idx, - NSF_c_objectparameter_idx, + NSF_c_configureparameter_idx, NSF_c_recreate_idx, NSF_o_cleanup_idx, - NSF_o_configure_idx, + NSF_o_configure_idx, + NSF_o_configureparameter_idx, NSF_o_defaultmethod_idx, NSF_o_destroy_idx, NSF_o_init_idx, @@ -592,10 +593,11 @@ "-class.alloc", "-class.create", "-class.dealloc", - "-class.objectparameter", + "-class.configureparameter", "-class.recreate", "-object.cleanup", "-object.configure", + "-object.configureparameter", "-object.defaultmethod", "-object.destroy", "-object.init", Index: library/nx/nx.tcl =================================================================== diff -u -r729b49eb1dcb08183a0ed41588416a923271811a -rd9344280c05990c0254aa652a08a09da3e5822b1 --- library/nx/nx.tcl (.../nx.tcl) (revision 729b49eb1dcb08183a0ed41588416a923271811a) +++ library/nx/nx.tcl (.../nx.tcl) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -50,16 +50,17 @@ # First create the ::nx object system. The internally called methods, # which are not defined by in this script, must have method handles # included. The methods "create", "configure", "destroy", "move" and - # "__objectparameter" are defined in this script (either scripted, or + # "__objectcoonfigureparameter" are defined in this script (either scripted, or # via alias). # ::nsf::objectsystem::create ::nx::Object ::nx::Class { -class.alloc {__alloc ::nsf::methods::class::alloc} -class.create create -class.dealloc {__dealloc ::nsf::methods::class::dealloc} - -class.objectparameter __objectparameter + -class.configureparameter __class_configureparameter -class.recreate {__recreate ::nsf::methods::class::recreate} -object.configure __configure + -object.configureparameter __object_configureparameter -object.defaultmethod {defaultmethod ::nsf::methods::object::defaultmethod} -object.destroy destroy -object.init {init ::nsf::methods::object::init} @@ -323,7 +324,7 @@ # process. The real definition is based on slots, which are not # available at this point. - Object protected method __objectparameter {} {;} + Object protected method __object_configureparameter {} {;} ###################################################################### # Define forward methods @@ -1495,10 +1496,14 @@ # Define objectparameter method ###################################################################### - Object protected method __objectparameter {} { + Object protected method __object_configureparameter {} { set slotObjects [nsf::directdispatch [self] ::nsf::methods::object::info::lookupslots -type ::nx::Slot] return [::nsf::parameter::specs $slotObjects] } + Class protected method __class_configureparameter {} { + set slotObjects [nsf::directdispatch [self] ::nsf::methods::class::info::slotobjects -closure -type ::nx::Slot] + return [::nsf::parameter::specs $slotObjects] + } } namespace eval ::nx { Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -rcafecba5f922de5329a5db109b697cbf88ae5f1a -rd9344280c05990c0254aa652a08a09da3e5822b1 --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision cafecba5f922de5329a5db109b697cbf88ae5f1a) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -56,9 +56,10 @@ -class.alloc alloc -class.create create -class.dealloc dealloc - -class.objectparameter objectparameter + -class.configureparameter __class_configureparameter -class.recreate recreate -object.configure configure + -object.configureparameter __object_configureparameter -object.cleanup cleanup -object.defaultmethod defaultmethod -object.destroy destroy @@ -405,15 +406,16 @@ # Method objectparameter, backwards upward compatible. We use # here the definition of parametersfromslots from nx.tcl # - ::xotcl::Object instproc objectparameter {} { - set parameterDefinitions [list] - set class [nsf::directdispatch [self] ::nsf::methods::object::info::class] - foreach slot [nsf::directdispatch $class ::nsf::methods::class::info::slotobjects -closure -type ::nx::Slot] { - lappend parameterDefinitions [$slot getParameterSpec] - } + ::xotcl::Object instproc __object_configureparameter {} { + set slotObjects [nsf::directdispatch [self] ::nsf::methods::object::info::lookupslots -type ::nx::Slot] + set parameterDefinitions [::nsf::parameter::specs $slotObjects] lappend parameterDefinitions args:alias,method=residualargs,args - return $parameterDefinitions } + ::xotcl::Class instproc __class_configureparameter {} { + set slotObjects [nsf::directdispatch [self] ::nsf::methods::class::info::slotobjects -closure -type ::nx::Slot] + set parameterDefinitions [::nsf::parameter::specs $slotObjects] + lappend parameterDefinitions args:alias,method=residualargs,args + } ###################################################################### # Define default accessors for all parameters @@ -1125,7 +1127,7 @@ ${:forwardername} } - :public method __objectparameter {} { + :public method __object_configureparameter {} { set slotObjects [nsf::directdispatch [self] ::nsf::methods::object::info::lookupslots -type ::nx::Slot] set parameterDefinitions [::nsf::parameter::specs -nonposargs $slotObjects] lappend parameterDefinitions args:alias,method=residualargs,args Index: library/xotcl/tests/slottest.xotcl =================================================================== diff -u -r5d3bc04b5ec0a4422236a65220d94ceee17a8796 -rd9344280c05990c0254aa652a08a09da3e5822b1 --- library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision 5d3bc04b5ec0a4422236a65220d94ceee17a8796) +++ library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -113,8 +113,8 @@ ? {o1 class} "::O" o1 class Object ? {o1 class} "::xotcl::Object" -? {o1 objectparameter} "-mixin:mixinreg,alias,0..n -filter:filterreg,alias,0..n -class:class,alias args:alias,method=residualargs,args" -? {Object objectparameter} "-instfilter:filterreg,alias,0..n -superclass:alias,0..n -instmixin:mixinreg,alias,0..n {-__default_metaclass ::xotcl::Class} {-__default_superclass ::xotcl::Object} -mixin:mixinreg,alias,0..n -filter:filterreg,alias,0..n -class:class,alias args:alias,method=residualargs,args" +? {o1 __object_configureparameter} "-mixin:mixinreg,alias,0..n -filter:filterreg,alias,0..n -class:class,alias args:alias,method=residualargs,args" +? {Object __object_configureparameter} "-instfilter:filterreg,alias,0..n -superclass:alias,0..n -instmixin:mixinreg,alias,0..n {-__default_metaclass ::xotcl::Class} {-__default_superclass ::xotcl::Object} -mixin:mixinreg,alias,0..n -filter:filterreg,alias,0..n -class:class,alias args:alias,method=residualargs,args" ? {o1 class add M} {class: expected a class but got "M ::xotcl::Object"} Index: library/xotcl/tests/testx.xotcl =================================================================== diff -u -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 -rd9344280c05990c0254aa652a08a09da3e5822b1 --- library/xotcl/tests/testx.xotcl (.../testx.xotcl) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) +++ library/xotcl/tests/testx.xotcl (.../testx.xotcl) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -2951,7 +2951,7 @@ Recreated recreateObj recreateObj destroy errorCheck [set ::recreateFilterResult] \ - " ::recreateObj+::xotcl::Object->configure ::recreateObj+::xotcl::Object->objectparameter ::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->__object_configureparameter ::recreateObj+::xotcl::Object->init ::recreateObj+::xotcl::Object->cleanup ::recreateObj+::xotcl::Object->configure ::recreateObj+::xotcl::Object->init ::recreateObj+::xotcl::Object->destroy" \ "recreateObj - recreateFilterResult" if {$i == 0} { errorCheck [set ::recreateMixinResult] \ @@ -3182,15 +3182,15 @@ ::errorCheck [b info procs] objproc "info procs" ::errorCheck [B info instprocs] myProc2 "info instprocs" - ::errorCheck [lsort [b info methods]] "abstract append array autoname check class cleanup configure contains copy defaultmethod destroy eval exists extractConfigureArg f filter filterguard filtersearch forward hasclass incr info init instvar invar isclass ismetaclass ismixin isobject istype lappend method mixin mixinguard move myProc myProc2 myProcMix1 myProcMix2 noinit objectparameter objproc parametercmd proc procsearch requireNamespace residualargs self set setFilter signature subst trace unknown unset uplevel upvar volatile vwait" "b info methods" + ::errorCheck [lsort [b info methods]] "__object_configureparameter abstract append array autoname check class cleanup configure contains copy defaultmethod destroy eval exists extractConfigureArg f filter filterguard filtersearch forward hasclass incr info init instvar invar isclass ismetaclass ismixin isobject istype lappend method mixin mixinguard move myProc myProc2 myProcMix1 myProcMix2 noinit objproc parametercmd proc procsearch requireNamespace residualargs self set setFilter signature subst trace unknown unset uplevel upvar volatile vwait" "b info methods" - ::errorCheck [lsort [b info methods -nocmds]] "abstract check extractConfigureArg f filtersearch forward hasclass init isclass ismetaclass ismixin isobject istype method myProc myProc2 myProcMix1 myProcMix2 objectparameter objproc proc procsearch self setFilter signature unknown vwait" "b info methods -nocmds" + ::errorCheck [lsort [b info methods -nocmds]] "__object_configureparameter abstract check extractConfigureArg f filtersearch forward hasclass init isclass ismetaclass ismixin isobject istype method myProc myProc2 myProcMix1 myProcMix2 objproc proc procsearch self setFilter signature unknown vwait" "b info methods -nocmds" ::errorCheck [lsort [b info methods -noprocs]] "append array autoname class cleanup configure destroy eval exists filter filterguard incr info instvar invar lappend mixin mixinguard noinit parametercmd requireNamespace residualargs set subst trace unset uplevel upvar volatile" "b info methods -noprocs" - ::errorCheck [lsort [b info methods -nocmds -nomixins]] "abstract check extractConfigureArg f filtersearch forward hasclass init isclass ismetaclass ismixin isobject istype method myProc myProc2 objectparameter objproc proc procsearch self setFilter signature unknown vwait" "b info methods -nocmds -nomixins" + ::errorCheck [lsort [b info methods -nocmds -nomixins]] "__object_configureparameter abstract check extractConfigureArg f filtersearch forward hasclass init isclass ismetaclass ismixin isobject istype method myProc myProc2 objproc proc procsearch self setFilter signature unknown vwait" "b info methods -nocmds -nomixins" ::errorCheck [b info methods -nocmds -noprocs] "" "b info methods -nocmds -noprocs" - ::errorCheck [lsort [B info methods -nocmds]] "abstract allinstances check extractConfigureArg f filtersearch forward hasclass init instforward instproc isclass ismetaclass ismixin isobject istype method objectparameter parameter proc procsearch self setFilter signature slots unknown uses vwait" "B info methods -nocmds" + ::errorCheck [lsort [B info methods -nocmds]] "__class_configureparameter __object_configureparameter abstract allinstances check extractConfigureArg f filtersearch forward hasclass init instforward instproc isclass ismetaclass ismixin isobject istype method parameter proc procsearch self setFilter signature slots unknown uses vwait" "B info methods -nocmds" namespace eval a { proc o args {return o} @@ -3584,9 +3584,9 @@ set ::context payrollApp - ::errorCheck [lsort [jim info methods]] "abstract age append array autoname check class cleanup configure contains copy defaultmethod destroy driving-license eval exists extractConfigureArg filter filterguard filtersearch forward hasclass id incr info init instvar invar isclass ismetaclass ismixin isobject istype lappend method mixin mixinguard move name noinit objectparameter parametercmd print proc procsearch requireNamespace residualargs salary self set signature subst trace unknown unset uplevel upvar volatile vwait" "condmixin all methods" + ::errorCheck [lsort [jim info methods]] "__object_configureparameter abstract age append array autoname check class cleanup configure contains copy defaultmethod destroy driving-license eval exists extractConfigureArg filter filterguard filtersearch forward hasclass id incr info init instvar invar isclass ismetaclass ismixin isobject istype lappend method mixin mixinguard move name noinit parametercmd print proc procsearch requireNamespace residualargs salary self set signature subst trace unknown unset uplevel upvar volatile vwait" "condmixin all methods" - ::errorCheck "[lsort [jim info methods -incontext]]" "abstract age append array autoname check class cleanup configure contains copy defaultmethod destroy eval exists extractConfigureArg filter filterguard filtersearch forward hasclass id incr info init instvar invar isclass ismetaclass ismixin isobject istype lappend method mixin mixinguard move name noinit objectparameter parametercmd print proc procsearch requireNamespace residualargs salary self set signature subst trace unknown unset uplevel upvar volatile vwait" "all methods in context" + ::errorCheck "[lsort [jim info methods -incontext]]" "__object_configureparameter abstract age append array autoname check class cleanup configure contains copy defaultmethod destroy eval exists extractConfigureArg filter filterguard filtersearch forward hasclass id incr info init instvar invar isclass ismetaclass ismixin isobject istype lappend method mixin mixinguard move name noinit parametercmd print proc procsearch requireNamespace residualargs salary self set signature subst trace unknown unset uplevel upvar volatile vwait" "all methods in context" ::errorCheck [my show payrollApp jim] "{payrollApp: jim info methods salary => salary} {payrollApp: jim info methods -incontext salary => salary} {payrollApp: jim info methods driv* => driving-license} {payrollApp: jim info methods -incontext driv* => }" "payrollApp jim" ::errorCheck [my show shipmentApp jim] "{shipmentApp: jim info methods salary => salary} {shipmentApp: jim info methods -incontext salary => } {shipmentApp: jim info methods driv* => driving-license} {shipmentApp: jim info methods -incontext driv* => driving-license}" "shipmentApp jim" Index: tests/disposition.test =================================================================== diff -u -rf671281a240219965d436e2bfa762baf85274ca6 -rd9344280c05990c0254aa652a08a09da3e5822b1 --- tests/disposition.test (.../disposition.test) (revision f671281a240219965d436e2bfa762baf85274ca6) +++ tests/disposition.test (.../disposition.test) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -26,7 +26,7 @@ # some testing helpers # :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } :setObjectParams "" @@ -321,10 +321,10 @@ nx::test case dispo-multiplicities { Class create S { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } - #:object method __objectparameter {} { + #:object method __object_configureparameter {} { # return ${:objectparams} #} :public method foo {args} { @@ -384,7 +384,7 @@ nx::test case dispo-returns { Class create R { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -448,7 +448,7 @@ nx::test case dispo-callstack { Class create Callee { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -509,7 +509,7 @@ Callee public object method run {} { set self [self] - set objparams [:__objectparameter] + set objparams [:__object_configureparameter] # # The ? helper by default performs a [namespace eval] in the :: # namespace, so the uplevel|upvar would happen in a different, @@ -616,7 +616,7 @@ nx::test case alias-noarg { Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } :public method foo {args} { @@ -757,7 +757,7 @@ nx::test case alias-noarg { Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -772,7 +772,7 @@ nx::test case alias-args { Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } :public method Residualargs args { @@ -862,7 +862,7 @@ nx::test case alias-init { Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } :method init {} { @@ -883,7 +883,7 @@ # Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -1083,7 +1083,7 @@ nx::test case dispo-configure-transparency { Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -1174,7 +1174,7 @@ Class create C Class create T { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -1335,7 +1335,7 @@ ? {::xotcl::Class create XD -set x 1} "::XD" #? {c1 eval {info exists :args}} 0 - ? {XD objectparameter} "-instfilter:filterreg,alias,0..n -superclass:alias,0..n -instmixin:mixinreg,alias,0..n {-__default_metaclass ::xotcl::Class} {-__default_superclass ::xotcl::Object} -mixin:mixinreg,alias,0..n -filter:filterreg,alias,0..n -class:class,alias args:alias,method=residualargs,args" + ? {XD __object_configureparameter} "-instfilter:filterreg,alias,0..n -superclass:alias,0..n -instmixin:mixinreg,alias,0..n {-__default_metaclass ::xotcl::Class} {-__default_superclass ::xotcl::Object} -mixin:mixinreg,alias,0..n -filter:filterreg,alias,0..n -class:class,alias args:alias,method=residualargs,args" # # test passing arguments to init Index: tests/interceptor-slot.test =================================================================== diff -u -reea18b07ddfc917545d48ab6a272c0bfb9656f07 -rd9344280c05990c0254aa652a08a09da3e5822b1 --- tests/interceptor-slot.test (.../interceptor-slot.test) (revision eea18b07ddfc917545d48ab6a272c0bfb9656f07) +++ tests/interceptor-slot.test (.../interceptor-slot.test) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -475,7 +475,7 @@ r enter Uwe r leave Uwe r configure -name "Office" - ? {set ::_} "__objectparameter init enter leave configure" + ? {set ::_} "__object_configureparameter init enter leave configure" # # Hmm, we not so much interested on all these calls. Just the Index: tests/method-parameter.test =================================================================== diff -u -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 -rd9344280c05990c0254aa652a08a09da3e5822b1 --- tests/method-parameter.test (.../method-parameter.test) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) +++ tests/method-parameter.test (.../method-parameter.test) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -61,6 +61,10 @@ should be "p3a /a/ ?-x /value/? ?-y /value/? /b/ ?-z /value/?"} } +# +# Testing the unknown handler +# + nx::test case unknown-handler { Class create C { Index: tests/object-system.test =================================================================== diff -u -r3cbf24ff95e38976cdc905ec0e8014d9d754ad6f -rd9344280c05990c0254aa652a08a09da3e5822b1 --- tests/object-system.test (.../object-system.test) (revision 3cbf24ff95e38976cdc905ec0e8014d9d754ad6f) +++ tests/object-system.test (.../object-system.test) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -19,7 +19,7 @@ } } -? {::nsf::configure objectsystem} "{::nx::Object ::nx::Class {-class.alloc __alloc -class.create create -class.dealloc __dealloc -class.objectparameter __objectparameter -class.recreate __recreate -object.configure __configure -object.defaultmethod defaultmethod -object.destroy destroy -object.init init -object.move move -object.unknown unknown}}" +? {::nsf::configure objectsystem} "{::nx::Object ::nx::Class {-class.alloc __alloc -class.create create -class.dealloc __dealloc -class.configureparameter __class_configureparameter -class.recreate __recreate -object.configure __configure -object.configureparameter __object_configureparameter -object.defaultmethod defaultmethod -object.destroy destroy -object.init init -object.move move -object.unknown unknown}}" ? {::nsf::object::exists nx::Object} 1 ? {::nsf::object::property nx::Object initialized} 1 Index: tests/parameters.test =================================================================== diff -u -r729b49eb1dcb08183a0ed41588416a923271811a -rd9344280c05990c0254aa652a08a09da3e5822b1 --- tests/parameters.test (.../parameters.test) (revision 729b49eb1dcb08183a0ed41588416a923271811a) +++ tests/parameters.test (.../parameters.test) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -282,11 +282,11 @@ } C create c1 - ? {C eval :__objectparameter} \ + ? {C eval :__object_configureparameter} \ "{-superclass:class,alias,method=::nsf::methods::class::superclass,1..n ::nx::Object} -mixin:mixinreg,slot=::nx::Class::slot::mixin,slotset,method=class-mixin,0..n $::filter $::objectMixin -class:class,alias,method=::nsf::methods::object::class $::objectFilter $::initBlock" #### TOOD: remove or add - #? {c1 eval :__objectparameter} \ + #? {c1 eval :__object_configureparameter} \ # "::c1: unable to dispatch method '__objectparameter'" } @@ -314,7 +314,7 @@ ? {d1 info lookup slots -source application} \ "::D::slot::d ::C::slot::a ::C::slot::b ::C::slot::c" - ? {d1 eval :__objectparameter} \ + ? {d1 eval :__object_configureparameter} \ "-d:required -a -b:boolean {-c 1} $::trailer" } @@ -343,29 +343,29 @@ } D mixin set M - ? {d1 eval :__objectparameter} \ + ? {d1 eval :__object_configureparameter} \ "-b -m1 -m2 -d:required -a {-c 1} $::trailer" \ "mixin added" M mixin set M2 - ? {d1 eval :__objectparameter} \ + ? {d1 eval :__object_configureparameter} \ "-b2 -b -m1 -m2 -d:required -a {-c 1} $::trailer" \ "transitive mixin added" D mixin set "" #we should have again the old interface - ? {d1 eval :__objectparameter} \ + ? {d1 eval :__object_configureparameter} \ "-d:required -a -b:boolean {-c 1} $::trailer" C mixin set M - ? {d1 eval :__objectparameter} \ + ? {d1 eval :__object_configureparameter} \ "-b2 -b -m1 -m2 -d:required -a {-c 1} $::trailer" \ "mixin added" C mixin set "" #we should have again the old interface - ? {d1 eval :__objectparameter} \ + ? {d1 eval :__object_configureparameter} \ "-d:required -a -b:boolean {-c 1} $::trailer" } @@ -1923,13 +1923,13 @@ nx::Class create M1 {:property b1:required} nx::Class create M2 {:property b2:required} - ? {c1 eval :__objectparameter} "-a1 $::trailer" + ? {c1 eval :__object_configureparameter} "-a1 $::trailer" c1 object mixin set M1 ? {c1 info precedence} "::M1 ::C ::nx::Object" - ? {c1 eval :__objectparameter} "-b1:required -a1 $::trailer" + ? {c1 eval :__object_configureparameter} "-b1:required -a1 $::trailer" # # Invalidate the object parameter and expect that the per-class @@ -2030,7 +2030,7 @@ ? {C info slots -closure} \ "::C::slot::a1 ::nx::Object::slot::__initblock ::nx::Object::slot::object-mixin ::nx::Object::slot::class ::nx::Object::slot::object-filter" - ? {c1 eval :__objectparameter} \ + ? {c1 eval :__object_configureparameter} \ "-a2 -b1:required -a1 $::trailer" # @@ -2047,7 +2047,7 @@ ? {C info slots -closure} \ "::C::slot::a1 ::nx::Object::slot::__initblock ::nx::Object::slot::object-mixin ::nx::Object::slot::class ::nx::Object::slot::object-filter" - ? {c1 eval :__objectparameter} "-a2 -b1:required -a1 $::trailer" + ? {c1 eval :__object_configureparameter} "-a2 -b1:required -a1 $::trailer" # should not require b1 ? {C create c2} ::c2 @@ -2641,7 +2641,7 @@ nx::Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [self] } :setObjectParams "" Index: tests/properties.test =================================================================== diff -u -r23b10a2c736cf33731b0d7b0381314ddec44f2d6 -rd9344280c05990c0254aa652a08a09da3e5822b1 --- tests/properties.test (.../properties.test) (revision 23b10a2c736cf33731b0d7b0381314ddec44f2d6) +++ tests/properties.test (.../properties.test) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -821,8 +821,8 @@ ? {c1 info lookup configure syntax} { ?-e /value/? ?-a /value/? ?-b /value/? ?-volatile? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?} - set e [C eval :__objectparameter] - ? {C eval :__objectparameter} $e + set e [C eval :__object_configureparameter] + ? {C eval :__object_configureparameter} $e ? {c1 cget -a} a1 ? {c1 configure -a a2} "" @@ -840,8 +840,8 @@ # ? {d1 info lookup configure syntax} { ?-e /value/? ?-a /value/? ?-b /value/? ?-volatile? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?} - set e [D eval :__objectparameter] - ? {D eval :__objectparameter} $e + set e [D eval :__object_configureparameter] + ? {D eval :__object_configureparameter} $e ? {d1 cget -a} a1 ? {d1 configure -a a2} "" @@ -880,9 +880,9 @@ ? {o1 info lookup configure syntax} { ?-e /value/? ?-a /value/? ?-b /value/? ?-object-mixin /mixinreg .../? ?-class /class/? ?-object-filter /filterreg .../? ?/__initblock/?} - set e [o1 eval :__objectparameter] + set e [o1 eval :__object_configureparameter] - ? {o1 eval :__objectparameter} $e + ? {o1 eval :__object_configureparameter} $e ? {o1 cget -a} a1 ? {o1 configure -a a2} ""