Index: TODO =================================================================== diff -u -r0d09076df0ed10a2b70c2b4e7def78ab363dbc1b -r1398015d9294ce3adec8b1d5dc6e98f7c717b243 --- TODO (.../TODO) (revision 0d09076df0ed10a2b70c2b4e7def78ab363dbc1b) +++ TODO (.../TODO) (revision 1398015d9294ce3adec8b1d5dc6e98f7c717b243) @@ -3789,7 +3789,12 @@ further deletions referencing the parent class - extended regression test +nsf.c, nsf.h, nsfStack.c, nx.tcl, tcl-cool.tcl, xotcl2.tcl +- fix spelling in comments +- strip unneeded space + + ======================================================================== TODO: Index: generic/nsf.c =================================================================== diff -u -rfb2161a532110a28aba2553b2fa1cae60ac2d475 -r1398015d9294ce3adec8b1d5dc6e98f7c717b243 --- generic/nsf.c (.../nsf.c) (revision fb2161a532110a28aba2553b2fa1cae60ac2d475) +++ generic/nsf.c (.../nsf.c) (revision 1398015d9294ce3adec8b1d5dc6e98f7c717b243) @@ -1,6 +1,6 @@ -/* +/* [a-z] * nsf.c -- - * + * * Basic Machinery of the Next Scripting Framework, a Tcl based framework * for supporting language oriented programming. For Details, see * http://next-scripting.org/ @@ -16,7 +16,7 @@ * Altendorferstrasse 97-101 * D-45143 Essen, Germany * - * (b) Vienna University of Economics and Business + * (b) Vienna University of Economics and Business * Institute of Information Systems and New Media * A-1090, Augasse 2-6 * Vienna, Austria @@ -232,7 +232,7 @@ int objc, Tcl_Obj *CONST objv[], Tcl_Command cmd, NsfObject *object, NsfClass *cl, CONST char *methodName, int frameType, int flags); -static int DispatchDefaultMethod(Tcl_Interp *interp, NsfObject *object, +static int DispatchDefaultMethod(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *obj, int flags); static int DispatchDestroyMethod(Tcl_Interp *interp, NsfObject *object, int flags); static int DispatchUnknownMethod(Tcl_Interp *interp, NsfObject *object, @@ -259,7 +259,7 @@ static NsfClass *GetClassFromString(Tcl_Interp *interp, CONST char *name); static int GetClassFromObj(Tcl_Interp *interp, register Tcl_Obj *objPtr, NsfClass **clPtr, int withUnknown); /*static NsfObject *GetHiddenObjectFromCmd(Tcl_Interp *interp, Tcl_Command cmdPtr); -static int ReverseLookupCmdFromCmdTable(Tcl_Interp *interp, Tcl_Command searchCmdPtr, +static int ReverseLookupCmdFromCmdTable(Tcl_Interp *interp, Tcl_Command searchCmdPtr, Tcl_HashTable *cmdTablePtr);*/ static void GetAllInstances(Tcl_Interp *interp, NsfCmdList **instances, NsfClass *startClass); NSF_INLINE static Tcl_Command FindMethod(Tcl_Namespace *nsPtr, CONST char *methodName); @@ -355,7 +355,7 @@ * NsfErrorContext -- * * Print the current errorCode and errorInfo to stderr. - * This should be used as the last ressor, when e.g. logging fails + * This should be used as the last ressort, when e.g. logging fails * * Results: * None. @@ -448,7 +448,7 @@ * * NsfDeprecatedCmd -- * - * Provide a warning about a depracted command or method. The + * Provide a warning about a deprecated command or method. The * message is produced via calling the external Tcl function * ::nsf::deprecated. * @@ -532,7 +532,7 @@ * ParseContextExtendObjv -- * * Extend Tcl_Obj array at runtime, when more elements are - * needed. This function is called to exten an already + * needed. This function is called to extend an already * initialized ParseContext. * * Results: @@ -606,20 +606,20 @@ #if !defined(NDEBUG) { /* - * Perform a general consistency check: although the conents of the parse - * context are at release time sometimes only partially initializized, the + * Perform a general consistency check: although the contents of the parse + * context are at release time sometimes only partially initialized, the * following holds true for ensuring correct release of Tcl_Objs: * * 1) if one of the objv-flags has NSF_PC_MUST_DECR set, - * then the status flag NSF_PC_STATUS_MUST_DECR has to + * then the status flag NSF_PC_STATUS_MUST_DECR has to * be set as well. * * 2) if objc>0 then for all objv entries having a flag * different from 0 must have a * TCL_OBJ in the vector. * - * 3) for preallocated objvs, all elements of the objv - * after the argument vector must be 0 or + * 3) for preallocated objvs, all elements of the objv + * after the argument vector must be 0 or * NSF_PC_IS_DEFAULT (sanity check) */ /* @@ -631,9 +631,9 @@ assert((pcPtr->flags[i] & NSF_PC_MUST_DECR) == 0); } } - + /* - * (2) make sure, Tcl_Objs are set when needed for reclaming memory + * (2) make sure, Tcl_Objs are set when needed for reclaiming memory */ if (pcPtr->objc > 0) { /*fprintf(stderr, "%s ", ObjStr(pcPtr->full_objv[0]));*/ @@ -644,7 +644,7 @@ } } } - /* + /* * (3) All later flags must be empty or DEFAULT */ if (pcPtr->full_objv == &pcPtr->objv_static[0] && pcPtr->objc > 0) { @@ -654,14 +654,14 @@ } } #endif - + if (unlikely(status)) { if (status & NSF_PC_STATUS_MUST_DECR) { int i; /*fprintf(stderr, "ParseContextRelease %p loop from 0 to %d\n", pcPtr, pcPtr->objc-1);*/ for (i = 0; i < pcPtr->objc; i++) { /*fprintf(stderr, "ParseContextRelease %p check [%d] obj %p flags %.6x & %p\n", - pcPtr, i, pcPtr->objv[i], + pcPtr, i, pcPtr->objv[i], pcPtr->flags[i], &(pcPtr->flags[i]));*/ if (pcPtr->flags[i] & NSF_PC_MUST_DECR) { assert(pcPtr->objv[i]); @@ -687,7 +687,7 @@ * clientData is extended. */ if (status & NSF_PC_STATUS_FREE_CD) { - /*fprintf(stderr, "free clientdata for %p\n", pcPtr);*/ + /*fprintf(stderr, "free client-data for %p\n", pcPtr);*/ MEM_COUNT_FREE("pcPtr.clientData", pcPtr->clientData); ckfree((char *)pcPtr->clientData); } @@ -712,7 +712,7 @@ memcpy(tov+2, objv, sizeof(Tcl_Obj *)*(objc-2)); } - /*fprintf(stderr, "%%%% CallMethod cmdname=%s, method=%s, objc=%d\n", + /*fprintf(stderr, "%%%% CallMethod cmdName=%s, method=%s, objc=%d\n", ObjStr(tov[0]), ObjStr(tov[1]), objc); {int i; fprintf(stderr, "\t CALL: %s ", ObjStr(methodObj));for(i=0; i2 ? ObjStr(tov[2]) : "", objc);*/ result = ObjectDispatch(object, interp, objc, tov, flags); @@ -877,45 +877,45 @@ } extern Tcl_Obj * Nsf_ObjSetVar2(Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, - Tcl_Obj *valueObj, int flgs) { + Tcl_Obj *valueObj, int flags) { Tcl_Obj *result; CallFrame frame, *framePtr = &frame; Nsf_PushFrameObj(interp, (NsfObject *)object, framePtr); if (((NsfObject *)object)->nsPtr) { - flgs |= TCL_NAMESPACE_ONLY; + flags |= TCL_NAMESPACE_ONLY; } - result = Tcl_ObjSetVar2(interp, name1, name2, valueObj, flgs); + result = Tcl_ObjSetVar2(interp, name1, name2, valueObj, flags); Nsf_PopFrameObj(interp, framePtr); return result; } extern Tcl_Obj * Nsf_ObjGetVar2(Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, - int flgs) { + int flags) { Tcl_Obj *result; CallFrame frame, *framePtr = &frame; Nsf_PushFrameObj(interp, (NsfObject *)object, framePtr); if (((NsfObject *)object)->nsPtr) { - flgs |= TCL_NAMESPACE_ONLY; + flags |= TCL_NAMESPACE_ONLY; } - result = Tcl_ObjGetVar2(interp, name1, name2, flgs); + result = Tcl_ObjGetVar2(interp, name1, name2, flags); Nsf_PopFrameObj(interp, framePtr); return result; } extern int Nsf_UnsetVar2(Nsf_Object *object1, Tcl_Interp *interp, - CONST char *name1, CONST char *name2, int flgs) { + CONST char *name1, CONST char *name2, int flags) { NsfObject *object = (NsfObject *) object1; int result; CallFrame frame, *framePtr = &frame; Nsf_PushFrameObj(interp, object, framePtr); if (object->nsPtr) { - flgs |= TCL_NAMESPACE_ONLY; + flags |= TCL_NAMESPACE_ONLY; } - result = Tcl_UnsetVar2(interp, name1, name2, flgs); + result = Tcl_UnsetVar2(interp, name1, name2, flags); Nsf_PopFrameObj(interp, framePtr); return result; } @@ -1143,7 +1143,7 @@ object, object->refCount, object->id, object->teardown, object->flags);*/ if (unlikely(object->refCount <= 0)) { - /*fprintf(stderr, "NsfCleanupObject %p refcount %d\n", object, object->refCount);*/ + /*fprintf(stderr, "NsfCleanupObject %p ref-count %d\n", object, object->refCount);*/ assert(object->refCount == 0); assert(object->flags & NSF_DELETED); @@ -1223,7 +1223,7 @@ static int GetObjectFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfObject **objectPtr) { int result; - NsfObject *nobject; + NsfObject *object; CONST char *string; Tcl_Command cmd; @@ -1253,19 +1253,19 @@ */ string = ObjStr(objPtr); if (isAbsolutePath(string)) { - nobject = NULL; + object = NULL; } else { Tcl_Obj *tmpName = NameInNamespaceObj(interp, string, CallingNameSpace(interp)); CONST char *nsString = ObjStr(tmpName); INCR_REF_COUNT(tmpName); - nobject = GetObjectFromString(interp, nsString); - /* fprintf(stderr, " RETRY, string '%s' returned %p\n", nsString, nobject);*/ + object = GetObjectFromString(interp, nsString); + /* fprintf(stderr, " RETRY, string '%s' returned %p\n", nsString, object);*/ DECR_REF_COUNT(tmpName); } - if (nobject) { - if (objectPtr) *objectPtr = nobject; + if (object) { + if (objectPtr) *objectPtr = object; result = TCL_OK; } else { result = TCL_ERROR; @@ -1308,11 +1308,11 @@ #if 0 static int -NsfCallArgumentUnknownHandler(Tcl_Interp *interp, +NsfCallArgumentUnknownHandler(Tcl_Interp *interp, Tcl_Obj *methodObj, Tcl_Obj *argumentObj, NsfObject *object) { - + Tcl_Obj *ov[4]; int result, oc = 3; @@ -1452,7 +1452,7 @@ *---------------------------------------------------------------------- * IsObjectOfType -- * - * Check, if the provided NsfObject is of a cetain type. The arguments + * Check, if the provided NsfObject is of a certain type. The arguments * "what" and "objPtr" are just used for the error messages. objPtr is the * value from which the object was converted from. * @@ -1709,8 +1709,8 @@ for (; classList; classList = classList->nextPtr) { count++; } - - fprintf(stderr, "%s class list starting with %s has %d elements\n", + + fprintf(stderr, "%s class list starting with %s has %d elements\n", title, cl ? ClassName(cl) : "none", count); } @@ -1869,7 +1869,7 @@ } /* - * If computation is successful, return cl->order. + * If computation is successful, return cl->order. * Otherwise clear cl->order. */ if (TopoSort(cl, cl, SUPER_CLASSES)) { @@ -1955,7 +1955,7 @@ * None. * * Side effects: - * Add entry to children hash table. + * Add entry to children hash-table. * *---------------------------------------------------------------------- */ @@ -1985,7 +1985,7 @@ * void * * Side effects: - * Entry deleted from instances hash table + * Entry deleted from instances hash-table * *---------------------------------------------------------------------- */ @@ -2184,11 +2184,11 @@ Tcl_Command cmd; /* - fprintf(stderr,"methodName '%s' comp %d type %s\n", + fprintf(stderr,"methodName '%s' comp %d type %s\n", methodName, strchr(methodName, ' ')>0, methodObj->typePtr ? methodObj->typePtr->name : "(none)");*/ if (methodObj->typePtr == Nsf_OT_listType) { - int length; + int length; Tcl_ListObjLength(interp, methodObj, &length); containsSpace = length > 1; } else if (methodObj->typePtr == Nsf_OT_tclCmdNameType) { @@ -2212,8 +2212,8 @@ Tcl_Obj *methodHandleObj, **ov; int oc, i; - /* - * When the methodName is required, we have to proivde a methodNameDS as + /* + * When the methodName is required, we have to provide a methodNameDS as * well. */ assert(methodName1 == NULL || methodNameDs != NULL); @@ -2318,7 +2318,7 @@ if (regObject) {*regObject = referencedObject;} if (defObject) {*defObject = referencedObject;} if (methodName1 && *methodName1 == NULL) { - /* + /* * The return value for the method name is required and was not * computed by GetRegObject() */ @@ -2359,7 +2359,7 @@ static int NSF_INLINE CmdIsProc(Tcl_Command cmd) { - /* In 8.6: TclIsProc((Command *)cmd) is not equiv to the definition below */ + /* In 8.6: TclIsProc((Command *)cmd) is not equivalent to the definition below */ assert(cmd); return (Tcl_Command_objProc(cmd) == TclObjInterpProc); } @@ -2494,7 +2494,7 @@ } static NsfClass * -SearchPLMethod(register NsfClasses *pl, CONST char *methodName, +SearchPLMethod(register NsfClasses *pl, CONST char *methodName, Tcl_Command *cmdPtr, int flags) { /* Search the precedence list (class hierarchy) */ @@ -2503,9 +2503,9 @@ Tcl_CreateHashEntry(Tcl_Namespace_cmdTablePtr(pl->cl->nsPtr), methodName, NULL); if (entryPtr != NULL) { Tcl_Command cmd = (Tcl_Command) Tcl_GetHashValue(entryPtr); - + if (Tcl_Command_flags(cmd) & flags) { - /*fprintf(stderr, "skipped cmd %p flags %.6x & %.6x => %.6x\n", + /*fprintf(stderr, "skipped cmd %p flags %.6x & %.6x => %.6x\n", cmd, flags, Tcl_Command_flags(cmd), Tcl_Command_flags(cmd) & flags);*/ continue; } @@ -2760,7 +2760,7 @@ ObjectSystemsCheckSystemMethod(Tcl_Interp *interp, CONST char *methodName, NsfObject *object) { NsfObjectSystem *osPtr, *defOsPtr = GetObjectSystem(object); char firstChar; - + assert(methodName); firstChar = *methodName; @@ -2883,8 +2883,8 @@ * different object systems. */ - /* - * Collect all instances from all object systems + /* + * Collect all instances from all object systems */ for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr; osPtr = osPtr->nextPtr) { @@ -2903,7 +2903,7 @@ ObjectName(object), object, object && !NsfObjectIsClass(object), object->flags);*/ if (object && !NsfObjectIsClass(object) - && !(object->flags & NSF_DESTROY_CALLED)) { + && !(object->flags & NSF_DESTROY_CALLED)) { DispatchDestroyMethod(interp, object, 0); } } @@ -2912,7 +2912,7 @@ for (entryPtr = instances; entryPtr; entryPtr = entryPtr->nextPtr) { NsfClass *cl = entryPtr->clorobj; - + if (cl && !(cl->object.flags & NSF_DESTROY_CALLED)) { DispatchDestroyMethod(interp, (NsfObject *)cl, 0); } @@ -3187,7 +3187,7 @@ * ensemble root. * * Results: - * Tcl_Obj, caller has to take care for refcounting + * Tcl_Obj, caller has to take care for ref-counting * * Side effects: * None. @@ -3204,7 +3204,7 @@ /* NsfShowStack(interp);*/ if ((cscPtr->flags & NSF_CSC_CALL_IS_ENSEMBLE)) { resultObj = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, resultObj, + Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewStringObj(Tcl_GetCommandName(interp, cscPtr->cmdPtr), -1)); Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewStringObj(MethodName(procObj), -1)); } else { @@ -3263,7 +3263,7 @@ /* * Case 2: The lookup happens in a proc frame (lookup in compiled - * locals and hash table vars). We are not interested to handle + * locals and hash-table vars). We are not interested to handle * these cases here, so proceed in resolver chain. */ varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); @@ -3286,7 +3286,7 @@ /* * FRAME_IS_NSF_CMETHOD has always FRAME_IS_PROC set, so it is - * handeled already above + * handled already above */ assert((frameFlags & FRAME_IS_NSF_CMETHOD) == 0); @@ -3407,7 +3407,7 @@ * This function is the actual variable resolution handler for a * colon-prefixed (":/varName/") found in a compiled script * registered by the compiling var resolver (see - * InterpCompiledColonResolver()). When initialising a call frame, + * InterpCompiledColonResolver()). When initializing a call frame, * this handler is called, crawls the object's var table (creating * a variable, if needed), and returns a Var structure. Based on * this, a link variable ":/varName/" pointing to this object @@ -3534,7 +3534,7 @@ NsfResolvedVarInfo *resVarInfo = (NsfResolvedVarInfo *)vInfoPtr; #if defined(VAR_RESOLVER_TRACE) - fprintf(stderr, "CompiledColonVarFree %p for variable '%s'\n", + fprintf(stderr, "CompiledColonVarFree %p for variable '%s'\n", resVarInfo, ObjStr(resVarInfo->nameObj)); #endif @@ -3554,15 +3554,15 @@ * tclProc.c:InitResolvedLocals()). It registers two handlers for a * given, colon-prefixed variable found in the script: the actual * variable fetcher and a variable cleanup handler. The variable - * fetcher is executed whenever a Tcl call frame is intialized and + * fetcher is executed whenever a Tcl call frame is initialized and * the array of compiled locals is constructed (see also * InitResolvedLocals()). * * The Tcl var resolver protocol dictates that per-namespace * compiling var resolvers take precedence over this per-interp * compiling var resolver. That is, per-namespace resolvers are * processed first and can effectively outrule per-interp - * resolvers by signalling TCL_OK or TCL_BREAK. + * resolvers by signaling TCL_OK or TCL_BREAK. * * Results: * TCL_OK or TCL_CONTINUE (according to Tcl's var resolver protocol) @@ -3600,7 +3600,7 @@ #if defined(VAR_RESOLVER_TRACE) fprintf(stderr, "... resVarInfo %p nameObj %p '%s' obj %p %s\n", - resVarInfo, resVarInfo->nameObj, ObjStr(resVarInfo->nameObj), + resVarInfo, resVarInfo->nameObj, ObjStr(resVarInfo->nameObj), object, ObjectName(object)); #endif @@ -3628,7 +3628,7 @@ * non-compiling var resolvers take precedence over this per-interp * non-compiling var resolver. That is, per-namespace resolvers are * processed first and can effectively outrule per-interp resolvers - * by signalling TCL_OK or TCL_BREAK. See + * by signaling TCL_OK or TCL_BREAK. See * e.g. TclLookupSimpleVar(). * * Results: @@ -3756,16 +3756,16 @@ var = (Tcl_Var)VarHashCreateVar(varTablePtr, keyObj, NULL); if (var) { #if defined(VAR_RESOLVER_TRACE) - fprintf(stderr, ".... found in hashtable %s %p flags %.6x ns %p\n", + fprintf(stderr, ".... found in hash-table %s %p flags %.6x ns %p\n", varName, var, ((Var *)var)->flags, object->nsPtr); #endif } else { /* - We failed to find the variable, therefore we create it new - */ + * We failed to find the variable, therefore we create it new + */ var = (Tcl_Var)VarHashCreateVar(varTablePtr, keyObj, &new); #if defined(VAR_RESOLVER_TRACE) - fprintf(stderr, ".... var %p %s created in hashtable %p\n", var, varName, varTablePtr); + fprintf(stderr, ".... var %p %s created in hash-table %p\n", var, varName, varTablePtr); #endif } @@ -3831,7 +3831,7 @@ /* * The resolver is called as well, when a body of a method is - * compiled. In these situations, Tcl stacks a nonproc frame, that + * compiled. In these situations, Tcl stacks a non-proc frame, that * we have to skip. In order to safely identify such situations, we * stuff into the call flags of the proc frame during the * compilation step NSF_CSC_CALL_IS_COMPILE. @@ -3876,12 +3876,12 @@ #if defined(NSF_WITH_OS_RESOLVER) /* * Experimental Object-System specific resolver: If an - * unprefixed method name is found in a body of a method, we try + * un-prefixed method name is found in a body of a method, we try * to perform a lookup for this method in the namespace of the * object system for the current object. If this lookup is not * successful the standard lookups are performed. The * object-system specific resolver allows to use the "right" - * (unprefixed) "self" or "next" calls without namespace + * (un-prefixed) "self" or "next" calls without namespace * imports. */ NsfObject *object; @@ -4217,7 +4217,7 @@ #if OBJDELETION_TRACE /* * Deletion is always tricky. Show, what elements should be deleted - * in this loop. The actually deleted elements might be acutally + * in this loop. The actually deleted elements might be actually * less, if a deletion of one item triggers the destroy of another * item. */ @@ -4233,7 +4233,7 @@ */ /* - * A destroy of one element of the hash table can trigger the + * A destroy of one element of the hash-table can trigger the * destroy of another item of the same table. Therefore we use * Nsf_NextHashEntry(), which handles this case. */ @@ -4271,7 +4271,7 @@ #endif /* * Delete all variables and initialize var table again - * (DeleteVars frees the vartable) + * (DeleteVars frees the var-table) */ TclDeleteVars((Interp *)interp, varTablePtr); TclInitVarHashTable(varTablePtr, (Namespace *)nsPtr); @@ -4285,7 +4285,7 @@ if (CmdIsNsfObject(cmd)) { /* - * Sub-objects should not be deleted here to preseve children + * Sub-objects should not be deleted here to preserve children * deletion order. Just delete aliases. */ AliasDeleteObjectReference(interp, cmd); @@ -4322,7 +4322,7 @@ assert(object); - /*fprintf(stderr, "namespacedeleteproc obj=%p ns=%p\n", + /*fprintf(stderr, "namespace delete-proc obj=%p ns=%p\n", clientData, object ? object->nsPtr : NULL);*/ MEM_COUNT_FREE("NSNamespace", object->nsPtr); @@ -4414,8 +4414,8 @@ &nsPtr, &dummy1Ptr, &dummy2Ptr, &dummy); if (nsPtr->deleteProc != NSNamespaceDeleteProc) { - /* - * Avoid hijacking a namespace with different client data + /* + * Avoid hijacking a namespace with different client data */ if (nsPtr->deleteProc || nsPtr->clientData) { Tcl_Panic("Namespace '%s' exists already with delProc %p and clientData %p; " @@ -4431,7 +4431,7 @@ nsClientData->nsPtr = (Tcl_Namespace *)nsPtr; nsPtr->clientData = nsClientData; - /*fprintf(stderr, "Adding NsfNamespaceClientData nsPtr %p cd %p name '%s'\n", + /*fprintf(stderr, "Adding NsfNamespaceClientData nsPtr %p cd %p name '%s'\n", nsPtr, nsClientData, nsPtr->fullName);*/ #else nsPtr->clientData = object; @@ -4490,7 +4490,7 @@ * If the provided parentNsPtr is not NULL, we know, that (a) the * provided name was relative and simple (contains no ":" - * characters) and that (b) this namepace was used to build a fully + * characters) and that (b) this namespace was used to build a fully * qualified name. In theses cases, the parentNsPtr points already * to the parentName, containing potentially a parent Object. In * all other cases, the parent name is either obtained from the @@ -4524,7 +4524,7 @@ TCL_GLOBAL_ONLY|TCL_FIND_ONLY_NS, &nsPtr, &dummy1Ptr, &dummy2Ptr, &dummy); /*fprintf(stderr, - "beforecreate calls TclGetNamespaceForQualName with %s => %p (%s) %p %s %p %s %p %s\n", + "before create calls TclGetNamespaceForQualName with %s => %p (%s) %p %s %p %s %p %s\n", nameString, nsPtr, nsPtr ? nsPtr->fullName : "", dummy1Ptr, dummy1Ptr ? dummy1Ptr->fullName : "", parentNsPtr, parentNsPtr ? parentNsPtr->fullName : "", @@ -4533,7 +4533,7 @@ /* * If there is a parentNs provided (or obtained from the full * namespace), we can determine the parent name from it. Otherwise, - * whe have to to perform the string operations. + * we have to to perform the string operations. */ if (parentNsPtr == NULL && nsPtr) { @@ -4645,19 +4645,19 @@ */ static int -ReverseLookupCmdFromCmdTable(Tcl_Interp *interp /* needed? */, Tcl_Command searchCmdPtr, +ReverseLookupCmdFromCmdTable(Tcl_Interp *interp /* needed? */, Tcl_Command searchCmdPtr, Tcl_HashTable *cmdTablePtr) { Tcl_HashSearch search; Tcl_HashEntry *hPtr; - + assert(searchCmdPtr); assert(cmdTablePtr); - for (hPtr = Tcl_FirstHashEntry(cmdTablePtr, &search); - hPtr != NULL; + for (hPtr = Tcl_FirstHashEntry(cmdTablePtr, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_Command needleCmdPtr = (Tcl_Command)Tcl_GetHashValue(hPtr); - + if (needleCmdPtr == searchCmdPtr) { return 1; } @@ -4672,7 +4672,7 @@ * Obtains a hidden object for a specified cmd. The function uses a reverse * lookup of *hidden* object structures based on their commands. This * helper is needed for handling hidden and re-exposed objects during the - * shutdown and the cleanup of object systems. + * shutdown and the cleanup of object systems. * * Results: * NsfObject* or NULL @@ -4683,27 +4683,27 @@ *---------------------------------------------------------------------- */ -static NsfObject * +static NsfObject * GetHiddenObjectFromCmd(Tcl_Interp *interp, Tcl_Command cmdPtr) { Interp *iPtr = (Interp *) interp; NsfObject *screenedObject; int found; assert(cmdPtr); - /* + /* * We can provide a shortcut, knowing that a) exposed cmds have an epoch * counter > 0, and b) the commands originating namespace must be the global * one. See also Tcl_HideCommand() and Tcl_ExposeCommand(). */ - if (likely(Tcl_Command_cmdEpoch(cmdPtr) == 0 || + if (likely(Tcl_Command_cmdEpoch(cmdPtr) == 0 || ((Command *)cmdPtr)->nsPtr != iPtr->globalNsPtr)) { return NULL; } - /* + /* * Reverse lookup object in the interp's hidden command table. We start * off with the hidden cmds as we suspect their number being smaller than - * the re-exposed ones, living in the global namespace + * the re-exposed ones, living in the global namespace */ found = ReverseLookupCmdFromCmdTable(interp, cmdPtr, iPtr->hiddenCmdTablePtr); if (!found) { @@ -4714,11 +4714,11 @@ found = ReverseLookupCmdFromCmdTable(interp, cmdPtr, &iPtr->globalNsPtr->cmdTable); } screenedObject = found ? NsfGetObjectFromCmdPtr(cmdPtr) : NULL; - + #if !defined(NDEBUG) if (screenedObject) { - fprintf(stderr, "SCREENED OBJECT %s found: object %p (%s) cmd %p\n", - Tcl_GetCommandName(interp, cmdPtr), screenedObject, + fprintf(stderr, "SCREENED OBJECT %s found: object %p (%s) cmd %p\n", + Tcl_GetCommandName(interp, cmdPtr), screenedObject, ObjectName(screenedObject), cmdPtr); } #endif @@ -4809,7 +4809,7 @@ /* * We could test, whether we are bootstrapping the "right" object * system, and allow only overwrites for the current bootstrap - * object system, but this seems neccessary by now. + * object system, but this seems necessary by now. */ Tcl_Obj *bootstrapObj = Tcl_GetVar2Ex(interp, "::nsf::bootstrap", NULL, TCL_GLOBAL_ONLY); if (bootstrapObj == NULL) { @@ -4921,7 +4921,7 @@ } /* - * Autonaming + * Auto-naming */ static Tcl_Obj * @@ -4930,14 +4930,14 @@ int valueLength; char *valueString, *c; Tcl_Obj *valueObj, *resultObj = NULL, *savedResultObj = NULL; - int flgs = TCL_LEAVE_ERR_MSG; + int flogs = TCL_LEAVE_ERR_MSG; CallFrame frame, *framePtr = &frame; Nsf_PushFrameObj(interp, object, framePtr); if (object->nsPtr) { - flgs |= TCL_NAMESPACE_ONLY; + flogs |= TCL_NAMESPACE_ONLY; } - valueObj = Tcl_ObjGetVar2(interp, NsfGlobalObjs[NSF_AUTONAMES], nameObj, flgs); + valueObj = Tcl_ObjGetVar2(interp, NsfGlobalObjs[NSF_AUTONAMES], nameObj, flogs); if (valueObj) { long autoname_counter; @@ -4949,12 +4949,12 @@ } Tcl_SetLongObj(valueObj, autoname_counter); Tcl_ObjSetVar2(interp, NsfGlobalObjs[NSF_AUTONAMES], nameObj, - valueObj, flgs); + valueObj, flogs); } if (resetOpt) { if (valueObj) { /* we have an entry */ - Tcl_UnsetVar2(interp, NsfGlobalStrings[NSF_AUTONAMES], ObjStr(nameObj), flgs); + Tcl_UnsetVar2(interp, NsfGlobalStrings[NSF_AUTONAMES], ObjStr(nameObj), flogs); } resultObj = NsfGlobalObjs[NSF_EMPTY]; INCR_REF_COUNT2("autoname", resultObj); @@ -4963,7 +4963,7 @@ if (valueObj == NULL) { valueObj = Tcl_ObjSetVar2(interp, NsfGlobalObjs[NSF_AUTONAMES], - nameObj, NsfGlobalObjs[NSF_ONE], flgs); + nameObj, NsfGlobalObjs[NSF_ONE], flogs); } if (instanceOpt) { char buffer[1], firstChar; @@ -5043,7 +5043,8 @@ /*fprintf(stderr, "CallStackDoDestroy %p flags %.6x\n", object, object->flags);*/ PRINTOBJ("CallStackDoDestroy", object); - /* Don't do anything, if a recursive DURING_DELETE is for some + /* + * Don't do anything, if a recursive DURING_DELETE is for some * reason active. */ if (object->flags & NSF_DURING_DELETE) { @@ -5099,23 +5100,28 @@ DispatchDestroyMethod(interp, object, 0); if (activationCount == 0) { - /* We assume, the object is now freed. if the oobjectbj is already - freed, we cannot access activation count, and we cannot call - CallStackDoDestroy */ + /* + * We assume, the object is now freed. If the object is already + * freed, we cannot access activation count, and we cannot call + * CallStackDoDestroy. + */ /*fprintf(stderr, " CallStackDestroyObject %p done\n", obj);*/ return; } } - /* If the object is not referenced on the callstack anymore - we have to destroy it directly, because CscFinish won't - find the object destroy */ + /* + * If the object is not referenced on the call-stack anymore + * we have to destroy it directly, because CscFinish won't + * find the object destroy. + */ if (object->activationCount == 0) { CallStackDoDestroy(interp, object); } else { - /* to prevail the deletion order call delete children now - -> children destructors are called before parent's - destructor */ + /* + * To prevail the deletion order call delete children now -> children + * destructors are called before parent's destructor. + */ if (object->teardown && object->nsPtr) { /*fprintf(stderr, " CallStackDestroyObject calls NSDeleteChildren\n");*/ NSDeleteChildren(interp, object->nsPtr); @@ -5197,7 +5203,7 @@ * * Add an entry to a cmdlist without duplicates. The order of the entries * is not supposed to be relevant. This function maintains a sorted list to - * reduce cost to n/2. Can be improved be using better datastructures of + * reduce cost to n/2. Can be improved be using better data structures of * needed. * * Results: @@ -5232,7 +5238,7 @@ } else { *cList = new; } - + return new; } @@ -5327,7 +5333,7 @@ CmdListRemoveDeleted(NsfCmdList **cmdList, NsfFreeCmdListClientData *freeFct) { NsfCmdList *f = *cmdList, *del; while (f) { - /* + /* * HIDDEN OBJECTS: For supporting hidden mixins, we cannot rely on the * cmdEpoch as indicator of the deletion status of a cmd because the epoch * counters of hidden and re-exposed commands are bumped. Despite of this, @@ -5424,8 +5430,8 @@ *---------------------------------------------------------------------- * CheckConditionInScope -- * - * Check a given condition in the current callframe's scope. It is - * the responsiblity of the caller to push the intended callframe. + * Check a given condition in the current call-frame's scope. It is + * the responsibility of the caller to push the intended call-frame. * * Results: * Tcl result code. @@ -5632,7 +5638,7 @@ #if 1 /* TODO: the following check operations is XOTcl1 legacy and is not - generic. it should be replaced by another methodproperty. + generic. it should be replaced by another method-property. Most of the is*String() definition are then obsolete and should be deleted from nsfInt.h as well. @@ -5670,7 +5676,7 @@ /* fprintf(stderr, "Checking Assertion %s ", assStr); */ /* - * now check the assertion in the pushed callframe's scope + * now check the assertion in the pushed call-frame's scope */ acResult = CheckConditionInScope(interp, alist->content); if (acResult != TCL_OK) { @@ -5844,7 +5850,7 @@ } /* - * pop a mixin stack information on this object + * Pop a mixin stack information on this object. */ static void MixinStackPop(NsfObject *object) { @@ -5855,8 +5861,8 @@ } /* - * Appends NsfClasses *containing the mixin classes and their - * superclasses to 'mixinClasses' list from a given mixinList + * Appends NsfClasses (containing the mixin-classes and their + * super-classes) to 'mixinClasses' list from a given mixinList. */ static void MixinComputeOrderFullList(Tcl_Interp *interp, NsfCmdList **mixinList, @@ -5882,7 +5888,7 @@ } else { if (opt && opt->classMixins) { /* - * Compute transitively the (class) mixin classes of this + * Compute transitively the (class) mixin-classes of this * added class. */ NsfClassListAdd(checkList, pl->cl, NULL); @@ -5960,8 +5966,8 @@ * MixinComputeOrder -- * * Compute a duplicate-free linearized order of per-object and per-class - * mixins and the class inheritance. The precendence rule is that the last - * occurence makes it into the final list. + * mixins and the class inheritance. The precedence rule is that the last + * occurrence makes it into the final list. * * Results: * void @@ -6028,7 +6034,7 @@ * if checker is set, it is a duplicate and ignored */ if (checker == NULL) { - /* check object->cl hierachy */ + /* check object->cl hierarchy */ checker = NsfClassListFind(TransitiveSuperClasses(object->cl), cl); /* * if checker is set, it was found in the class hierarchy and it is ignored @@ -6066,7 +6072,7 @@ *---------------------------------------------------------------------- * MixinAdd -- * - * Add a mixinreg (mixin class with a potential guard) provided as a + * Add a mixinreg (mixin-class with a potential guard) provided as a * Tcl_Obj* to 'mixinList' by appending it to the provided cmdList. * * Results: @@ -6207,13 +6213,13 @@ * GetAllInstances -- * * Get all instances of a class recursively into an initialized - * String key hashtable + * String key hash-table * * Results: * void * * Side effects: - * Passed hash table contains instances + * Passed hash-table contains instances * *---------------------------------------------------------------------- */ @@ -6230,20 +6236,20 @@ hPtr = Tcl_NextHashEntry(&search)) { NsfObject *inst = (NsfObject *)Tcl_GetHashKey(tablePtr, hPtr); Command *cmdPtr; - + if (inst->flags & NSF_TCL_DELETE) { NsfLog(interp, NSF_LOG_NOTICE, "Object %s is apparently deleted", ObjectName(inst)); continue; } - + cmdPtr = (Command *)inst->id; assert(cmdPtr); - + if (cmdPtr && (cmdPtr->nsPtr->flags & NS_DYING)) { NsfLog(interp, NSF_LOG_WARN, "Namespace of %s is apparently deleted", ObjectName(inst)); continue; } - + #if !defined(NDEBUG) { /* @@ -6264,13 +6270,13 @@ assert(object); } #endif - + /*fprintf (stderr, " -- %p flags %.6x activation %d %s id %p id->flags %.6x " "nsPtr->flags %.6x (instance of %s)\n", inst, inst->flags, inst->activationCount, ObjectName(inst), inst->id, cmdPtr->flags, cmdPtr->nsPtr ? cmdPtr->nsPtr->flags : 0, ClassName(clPtr->cl));*/ - + CmdListAdd(instances, inst->id, (NsfClass *)inst, 0, 0); } } @@ -6283,7 +6289,7 @@ * AddToResultSet -- * * Helper function to add classes to the result set (implemented as - * a hash table), flagging test for matchObject as result + * a hash-table), flagging test for matchObject as result * * Results: * 1 iff a matching object was provided and it was found; 0 otherwise @@ -6314,7 +6320,7 @@ * AddToResultSetWithGuards -- * * Helper function to add classes with guards to the result set - * (implemented as a hash table, full version as a Tcl list), flagging test + * (implemented as a hash-table, full version as a Tcl list), flagging test * for matchObject as result. * * Results: @@ -6330,7 +6336,7 @@ Tcl_Obj *resultSet, NsfClass *cl, ClientData clientData, int *new, int appendResult, CONST char *pattern, NsfObject *matchObject) { - + assert(cl); Tcl_CreateHashEntry(destTablePtr, (char *)cl, new); @@ -6362,14 +6368,14 @@ * Computes a set of classes, into which this class was mixed in * via per object mixin. The function gets recursively all per * object mixins from an class and its subclasses/isClassMixinOf - * and adds it into an initialized object ptr hashtable + * and adds it into an initialized object ptr hash-table * (TCL_ONE_WORD_KEYS) * * Results: * Tcl return code * * Side effects: - * The set of classes is returned in the provided hash table + * The set of classes is returned in the provided hash-table * *---------------------------------------------------------------------- */ @@ -6400,7 +6406,7 @@ for (m = startCl->opt->isClassMixinOf; m; m = m->nextPtr) { - /* we should have no deleted commands in the list */ + /* we should have no deleted commands in the list */ assert((Tcl_Command_flags(m->cmdPtr) & CMD_IS_DELETED) == 0); cl = NsfGetClassFromCmdPtr(m->cmdPtr); @@ -6424,7 +6430,7 @@ for (m = startCl->opt->isObjectMixinOf; m; m = m->nextPtr) { - /* we should have no deleted commands in the list */ + /* we should have no deleted commands in the list */ assert((Tcl_Command_flags(m->cmdPtr) & CMD_IS_DELETED) == 0); object = NsfGetObjectFromCmdPtr(m->cmdPtr); @@ -6447,13 +6453,13 @@ * Computes a set of classes, into which this class was mixed in * via as a class mixin. The function gets recursively all per * class mixins from an class and its subclasses and adds it - * into an initialized object ptr hashtable (TCL_ONE_WORD_KEYS) + * into an initialized object ptr hash-table (TCL_ONE_WORD_KEYS) * * Results: * Tcl return code * * Side effects: - * The set of classes is returned in the provided hash table + * The set of classes is returned in the provided hash-table * *---------------------------------------------------------------------- */ @@ -6512,8 +6518,8 @@ NsfCmdList *m; for (m = startCl->opt->isClassMixinOf; m; m = m->nextPtr) { - - /* we should have no deleted commands in the list */ + + /* we should have no deleted commands in the list */ assert((Tcl_Command_flags(m->cmdPtr) & CMD_IS_DELETED) == 0); cl = NsfGetClassFromCmdPtr(m->cmdPtr); @@ -6542,13 +6548,13 @@ * * Computes a set class-mixins of a given class and handles * transitive cases. The classes are added it into an initialized - * object ptr hashtable (TCL_ONE_WORD_KEYS) + * object ptr hash-table (TCL_ONE_WORD_KEYS) * * Results: * Tcl return code * * Side effects: - * The set of classes is returned in the provided hash table + * The set of classes is returned in the provided hash-table * *---------------------------------------------------------------------- */ @@ -6562,14 +6568,14 @@ NsfClasses *sc; /* - * check this class for classmixins + * check this class for class mixins. */ if (startCl->opt) { NsfCmdList *m; for (m = startCl->opt->classMixins; m; m = m->nextPtr) { - /* we should have no deleted commands in the list */ + /* we should have no deleted commands in the list */ assert((Tcl_Command_flags(m->cmdPtr) & CMD_IS_DELETED) == 0); cl = NsfGetClassFromCmdPtr(m->cmdPtr); @@ -6603,7 +6609,7 @@ /* - * check all superclasses of startCl for classmixins + * check all superclasses of startCl for class mixins. */ for (sc = startCl->super; sc; sc = sc->nextPtr) { /* fprintf(stderr, "Superclass GetAllClassMixins for %s (%s)\n", @@ -6687,14 +6693,14 @@ *---------------------------------------------------------------------- * RemoveFromClassmixins -- * - * Remove the class (provided as a cmd) from all classmixins lists + * Remove the class (provided as a cmd) from all class mixins lists * from the provided classes (provided as cmdlist). * * Results: * void * * Side effects: - * Deletes potentially some entries in the classmixins lists. + * Deletes potentially some entries in the class mixins lists. * *---------------------------------------------------------------------- */ @@ -6728,7 +6734,7 @@ * void * * Side effects: - * Deletes potentially some entries in the objectmixins lists. + * Deletes potentially some entries in the object mixins lists. * *---------------------------------------------------------------------- */ @@ -6827,7 +6833,7 @@ * MixinInvalidateObjOrders -- * * Reset mixin order for all instances of the class and the instances of - * its subclasses. This function is typically callled, when the the class + * its subclasses. This function is typically called, when the the class * hierarchy or the class mixins have changed and invalidate mixin entries * in all dependent instances. * @@ -6907,7 +6913,7 @@ * * DEFINED (there are mixins on the instance), * NONE (there are no mixins for the instance), - * or INVALID (a class re-strucuturing has occured, + * or INVALID (a class restructuring has occurred, * thus it is not clear whether mixins are defined or not). * * If the mixin order is INVALID, MixinComputeDefined can be used to @@ -6942,7 +6948,7 @@ * resulting list via NsfClassListFree(); * * Results: - * Precendence list inf form of a class list. + * Precedence list inf form of a class list. * * Side effects: * Allocated class list. @@ -7013,7 +7019,7 @@ } } return NULL; - } + } return cmdListPtr; } @@ -7039,15 +7045,15 @@ if ((cmdFlags & NSF_CMD_CALL_PRIVATE_METHOD) || ((cmdFlags & NSF_CMD_CLASS_ONLY_METHOD) && !NsfObjectIsClass(object))) { - /* + /* * The command is not applicable for objects (i.e. might crash, * since it expects a class record); therefore skip it */ return NSF_CHECK_FAILED; } - + if (cmdList->clientData && !RUNTIME_STATE(interp)->guardCount) { - /*fprintf(stderr, "guardcall\n");*/ + /*fprintf(stderr, "guard call\n");*/ result = GuardCall(object, interp, (Tcl_Obj *)cmdList->clientData, NULL); } return result; @@ -7075,7 +7081,7 @@ *---------------------------------------------------------------------- */ static int -MixinSearchProc(Tcl_Interp *interp, NsfObject *object, +MixinSearchProc(Tcl_Interp *interp, NsfObject *object, CONST char *methodName, Tcl_Obj *methodObj, NsfClass **clPtr, Tcl_Command *currentCmdPtr, Tcl_Command *cmdPtr) { Tcl_Command cmd = NULL; @@ -7097,22 +7103,20 @@ CmdListPrint(interp, "MixinSearch CL = \n", cmdList);*/ if (unlikely(*clPtr && *cmdPtr)) { - Tcl_Command lastCmdPtr = NULL; + Tcl_Command lastCmdPtr = NULL; /*fprintf(stderr, "... new branch\n");*/ for (; cmdList; cmdList = cmdList->nextPtr) { NsfClass *cl1; - + /* - * HIDDEN OBJECTS: For supporting hidden mixins, we cannot rely on the - * cmdEpoch as indicator of the deletion status of a cmd because the - * epoch counters of hidden and re-exposed commands are bumped. Despite - * of this, their object structures remain valid. + * Ignore deleted commands */ - if (Tcl_Command_flags(cmdList->cmdPtr) & CMD_IS_DELETED - /*Tcl_Command_cmdEpoch(cmdList->cmdPtr)*/) { continue; } - + if (Tcl_Command_flags(cmdList->cmdPtr) & CMD_IS_DELETED) { + continue; + } + cl1 = NsfGetClassFromCmdPtr(cmdList->cmdPtr); assert(cl1); lastCmdPtr = cmdList->cmdPtr; @@ -7136,15 +7140,15 @@ break; } } - + if (cl) { assert(cmdList); /* - * on success: return class and cmdList->cmdPtr; + * On success: return class and cmdList->cmdPtr; */ *currentCmdPtr = cmdList->cmdPtr; /*fprintf(stderr, "... mixinsearch success returns %p (cl %s)\n", cmd, ClassName(cl));*/ - + } else { /* * We did not find the absolute entry in the mixins. Set the @@ -7155,19 +7159,16 @@ *currentCmdPtr = lastCmdPtr; /*fprintf(stderr, "... mixinsearch success failure %p (cl %s)\n", cmd, ClassName(cl));*/ } - + return result; } else { for (; cmdList; cmdList = cmdList->nextPtr) { /* - * HIDDEN OBJECTS: For supporting hidden mixins, we cannot rely on the - * cmdEpoch as indicator of the deletion status of a cmd because the - * epoch counters of hidden and re-exposed commands are bumped. Despite - * of this, their object structures remain valid. + * Ignore deleted commands */ - if (Tcl_Command_flags(cmdList->cmdPtr) & CMD_IS_DELETED /*Tcl_Command_cmdEpoch(cmdList->cmdPtr)*/) { + if (Tcl_Command_flags(cmdList->cmdPtr) & CMD_IS_DELETED) { continue; } cl = NsfGetClassFromCmdPtr(cmdList->cmdPtr); @@ -7181,7 +7182,7 @@ if (cmd == NULL) { continue; } - + result = CanInvokeMixinMethod(interp, object, cmd, cmdList); if (unlikely(result == TCL_ERROR)) { @@ -7200,14 +7201,14 @@ /*fprintf(stderr, "mixinsearch returns %p (cl %s)\n", cmd, ClassName(cl));*/ break; } - + } *cmdPtr = cmd; return result; } /* - * info option for mixins and classmixins + * info option for mixins and class mixins */ static int MixinInfo(Tcl_Interp *interp, NsfCmdList *m, CONST char *pattern, @@ -7270,7 +7271,7 @@ /* * The search method implements filter search order for object and - * class ilter: first a given name is interpreted as fully qualified + * class filter: first a given name is interpreted as fully qualified * method name. If no method is found, a proc is searched with fully * name. Otherwise the simple name is searched on the heritage order: * object (only for per-object filters), class, meta-class @@ -7285,7 +7286,7 @@ NsfObjectOpt *opt = startingObject->opt; /* * the object-specific filter can also be defined on the object's - * class, its hierarchy, or the respective classmixins; thus use the + * class, its hierarchy, or the respective class mixins; thus use the * object's class as start point for the class-specific search then ... */ startingClass = startingObject->cl; @@ -7301,7 +7302,7 @@ } /* - * search for classfilters on classmixins + * search for class filters on class mixins */ if (startingClass) { NsfClassOpt *opt = startingClass->opt; @@ -7313,7 +7314,7 @@ } /* - * seach for object procs that are used as filters + * search for object procs that are used as filters */ if (startingObject && startingObject->nsPtr) { /*fprintf(stderr, "search filter %s as proc \n", name);*/ @@ -7427,7 +7428,7 @@ INCR_REF_COUNT(res); /* - * For the guard push a fake callframe on the Tcl stack so that + * For the guard push a fake call-frame on the Tcl stack so that * e.g. a "self calledproc" and other methods in the guard behave * like in the proc. */ @@ -7480,7 +7481,7 @@ int guardAdded = 0; NsfObjectOpt *opt; - /* search guards for classfilters registered on mixins */ + /* search guards for class filters registered on mixins */ if (!(object->flags & NSF_MIXIN_ORDER_VALID)) { MixinComputeDefined(interp, object); } @@ -7499,7 +7500,7 @@ /* search per-object filters */ opt = object->opt; if (!guardAdded && opt && opt->objFilters) { - guardAdded = GuardAddFromDefinitionList(dest, filterCmd, + guardAdded = GuardAddFromDefinitionList(dest, filterCmd, opt->objFilters); } @@ -7564,7 +7565,7 @@ * FilterAddActive -- * * Add a method name to the set of methods, which were used as filters in - * the current interp. + * the current interp. * * TODO: let the set shrink, when filters are removed. * @@ -7581,7 +7582,7 @@ NsfRuntimeState *rst = RUNTIME_STATE(interp); Tcl_HashEntry *hPtr; int newItem; - + hPtr = Tcl_CreateHashEntry(&rst->activeFilterTablePtr, methodName, &newItem); if (newItem) { Tcl_SetHashValue(hPtr, INT2PTR(1)); @@ -7610,7 +7611,7 @@ FilterIsActive(Tcl_Interp *interp, CONST char *methodName) { NsfRuntimeState *rst = RUNTIME_STATE(interp); Tcl_HashEntry *hPtr; - + hPtr = Tcl_CreateHashEntry(&rst->activeFilterTablePtr, methodName, NULL); return (hPtr != NULL); } @@ -7632,7 +7633,7 @@ static int FiltersDefined(Tcl_Interp *interp) { NsfRuntimeState *rst = RUNTIME_STATE(interp); - + return Tcl_HashSize(&rst->activeFilterTablePtr); } @@ -7821,8 +7822,8 @@ if (*methodName == ':') { /* - * if we have a methodname starting with ":" and we made it so far, - * we assume it is correct + * If we have a methodName starting with ":" and we made it so far, + * we assume it is correct. */ resultObj = Tcl_NewStringObj(methodName, -1); } else { @@ -7835,7 +7836,7 @@ } /* - * info option for filters and classfilters + * info option for filters and class filters * withGuards -> if not 0 => append guards * withMethodHandles -> if not 0 => return method handles */ @@ -7847,10 +7848,10 @@ /*fprintf(stderr, "FilterInfo %p %s %d %d\n", pattern, pattern, withGuards, withMethodHandles);*/ - - /* guard lists should only have unqualified filter lists when - withGuards is activated, withMethodHandles has no effect - */ + /* + * Guard lists should only have unqualified filter lists when + * withGuards is activated, withMethodHandles has no effect + */ if (withGuards) { withMethodHandles = 0; } @@ -7896,7 +7897,7 @@ NsfClasses *pl; /* - * ensure that no epoched command is in the filters list + * Ensure that no epoched command is in the filters list. */ CmdListRemoveDeleted(filters, GuardDel); @@ -7935,20 +7936,22 @@ /* * Computes a linearized order of object and class filter. Then * duplicates in the full list and with the class inheritance list of - * 'obj' are eliminated. The precendence rule is that the last - * occurence makes it into the final list. + * 'obj' are eliminated. The precedence rule is that the last + * occurrence makes it into the final list. */ static void FilterComputeOrder(Tcl_Interp *interp, NsfObject *object) { - NsfCmdList *filterList = NULL, *next, *checker, *newlist; + NsfCmdList *filterList = NULL, *next, *checker, *newList; NsfClasses *pl; if (object->filterOrder) FilterResetOrder(object); /* fprintf(stderr, " List: ", ObjectName(object)); */ - /* append classfilters registered for mixins */ + /* + * Append class filters registered for mixins. + */ if (!(object->flags & NSF_MIXIN_ORDER_VALID)) { MixinComputeDefined(interp, object); } @@ -7964,38 +7967,44 @@ } } - /* append per-obj filters */ + /* + * Append per-obj filters. + */ if (object->opt) { FilterComputeOrderFullList(interp, &object->opt->objFilters, &filterList); } - /* append per-class filters */ + + /* + * Append per-class filters. + */ for (pl = TransitiveSuperClasses(object->cl); pl; pl = pl->nextPtr) { NsfClassOpt *clopt = pl->cl->opt; if (clopt && clopt->classFilters) { FilterComputeOrderFullList(interp, &clopt->classFilters, &filterList); } } - /* - fprintf(stderr, "\n"); - */ - /* use no duplicates & no classes of the precedence order - on the resulting list */ + /*fprintf(stderr, "\n");*/ + + /* + * Use no duplicates & no classes of the precedence order + * on the resulting list. + */ while (filterList) { checker = next = filterList->nextPtr; while (checker) { if (checker->cmdPtr == filterList->cmdPtr) break; checker = checker->nextPtr; } if (checker == NULL) { - newlist = CmdListAdd(&object->filterOrder, filterList->cmdPtr, filterList->clorobj, + newList = CmdListAdd(&object->filterOrder, filterList->cmdPtr, filterList->clorobj, /*noDuplicates*/ 0, 1); - GuardAddInheritedGuards(interp, newlist, object, filterList->cmdPtr); + GuardAddInheritedGuards(interp, newList, object, filterList->cmdPtr); /* fprintf(stderr, " Adding %s::%s,\n", filterList->cmdPtr->nsPtr->fullName, Tcl_GetCommandName(interp, filterList->cmdPtr)); */ /* - GuardPrint(interp, newlist->clientData); + GuardPrint(interp, newList->clientData); */ } @@ -8010,13 +8019,13 @@ } /* - * the filter order is either + * The filter order is either * DEFINED (there are filter on the instance), * NONE (there are no filter for the instance), - * or INVALID (a class re-strucuturing has occured, thus it is not clear + * or INVALID (a class restructuring has occurred, thus it is not clear * whether filters are defined or not). * If it is INVALID FilterComputeDefined can be used to compute the order - * and set the instance to DEFINE or NONE + * and set the instance to DEFINE or NONE. */ static void FilterComputeDefined(Tcl_Interp *interp, NsfObject *object) { @@ -8111,7 +8120,7 @@ *currentCmd = NULL; - /* + /* * Ensure that the filter order is not invalid, otherwise compute order * FilterComputeDefined(interp, object); */ @@ -8120,7 +8129,7 @@ cmdList = SeekCurrent(object->filterStack->currentCmdPtr, object->filterOrder); while (cmdList) { - /*fprintf(stderr, "FilterSearchProc found %s\n", + /*fprintf(stderr, "FilterSearchProc found %s\n", Tcl_GetCommandName(interp, (Tcl_Command)cmdList->cmdPtr));*/ if (Tcl_Command_cmdEpoch(cmdList->cmdPtr)) { cmdList = cmdList->nextPtr; @@ -8151,7 +8160,7 @@ *---------------------------------------------------------------------- * SuperclassAdd -- * - * Add a list of superclasses (specified in the argument vector) to + * Add a list of superclasses (specified in the argument vector) to * the specified class. On the first call, the class has no previous * superclasses. * @@ -8175,10 +8184,10 @@ /* * We have to remove all dependent superclass filter referenced - * by class or one of its subclasses + * by class or one of its subclasses. * - * do not check the class "cl" itself (first entry in - * filterCheck class list) + * Do not check the class "cl" itself (first entry in + * filterCheck class list). */ if (superClasses) { superClasses = superClasses->nextPtr; @@ -8187,17 +8196,17 @@ FilterRemoveDependentFilterCmds(cl, superClasses->cl, subClasses); } - /* + /* * Invalidate all interceptors orders of instances of this and of all * depended classes. */ MixinInvalidateObjOrders(interp, cl, subClasses); - if (FiltersDefined(interp) > 0) { + if (FiltersDefined(interp) > 0) { FilterInvalidateObjOrders(interp, cl, subClasses); } - /* - * build an array of superclasses from the argument vector. + /* + * Build an array of superclasses from the argument vector. */ scl = NEW_ARRAY(NsfClass*, oc); for (i = 0; i < oc; i++) { @@ -8263,7 +8272,7 @@ if (!TransitiveSuperClasses(cl)) { NsfClasses *l; /* - * cycle in the superclass graph, backtrack + * Cycle in the superclass graph, backtrack */ while (cl->super) { (void)RemoveSuper(cl, cl->super->cl); @@ -8286,7 +8295,7 @@ *---------------------------------------------------------------------- * CheckVarName -- * - * Check, whether the provided name is free of namepace markup. + * Check, whether the provided name is free of namespace markup. * * Results: * Tcl result code. @@ -8301,7 +8310,7 @@ /* * We want to have a plain variable name, since we do not want to * get interferences with namespace resolver and such. In an first - * attempt, we disallowed occurances of "::", but we have to deal as + * attempt, we disallowed occurrences of "::", but we have to deal as * well with e.g. arrayName(::x::y) * * TODO: more general and efficient solution to disallow e.g. a::b @@ -8406,12 +8415,12 @@ (codePtr->compileEpoch != iPtr->compileEpoch), (codePtr->nsPtr != nsPtr), (codePtr->nsEpoch != nsPtr->resolverEpoch)); - + { CompiledLocal *localPtr = procPtr->firstLocalPtr; for (; localPtr != NULL; localPtr = localPtr->nextPtr) { fprintf(stderr, "... local %p '%s' resolveInfo %p deleteProc %p\n", - localPtr, localPtr->name, localPtr->resolveInfo, + localPtr, localPtr->name, localPtr->resolveInfo, localPtr->resolveInfo ? localPtr->resolveInfo->deleteProc : NULL); } } @@ -8440,7 +8449,7 @@ * PushProcCallFrame -- * * Set up and push a new call frame for the procedure invocation. - * callframe. The proc is passed via clientData. + * call-frame. The proc is passed via clientData. * * Results: * Tcl result code @@ -8649,7 +8658,7 @@ * ParamDefsFree -- * * Actually free the parameter definitions. Since the parameter definitions - * are refcounted, this function should be just called via + * are ref-counted, this function should be just called via * ParamDefsRefCountDecr. * * Results: @@ -8683,7 +8692,7 @@ * necessary, since it might be possible that during the processing of the * e.g. object parameters, these might be redefined (when an object * parameter calls a method, redefining the - * strucures). ParamDefsRefCountDecr() is responsible for actually freeing + * structures). ParamDefsRefCountDecr() is responsible for actually freeing * the structure. * * Results: @@ -8758,7 +8767,7 @@ int first, colonWritten; Tcl_Obj *listObj = Tcl_NewListObj(0, NULL), *innerListObj, *nameStringObj; Nsf_Param CONST *paramPtr; - + INCR_REF_COUNT2("paramDefsObj", listObj); for (paramPtr = paramsPtr; paramPtr->name; paramPtr++) { @@ -8991,15 +9000,15 @@ INCR_REF_COUNT2("paramDefsObj", argStringObj); for (pPtr = paramsPtr; pPtr->name; pPtr++) { - + if ((pPtr->flags & NSF_ARG_NOCONFIG)) { - /* + /* * Don't output non-configurable parameters */ continue; } if (pPtr != paramsPtr) { - /* + /* * Don't output non-consuming parameters (i.e. positional, and no args) */ if (*pPtr->name != '-' && pPtr->nrArgs == 0) { @@ -9100,7 +9109,7 @@ int rc; /* * Even, when the returned result != TCL_OK, run assertion to report - * the highest possible method from the callstack (e.g. "set" would not + * the highest possible method from the call-stack (e.g. "set" would not * be very meaningful; however, do not flush a TCL_ERROR. */ rc = AssertionCheck(interp, object, cscPtr->cl, data[2], CHECK_POST); @@ -9162,7 +9171,7 @@ # endif ParseContextRelease(pcPtr); - NsfTclStackFree(interp, pcPtr, "nsf::proc dispatch finialize release parse context"); + NsfTclStackFree(interp, pcPtr, "nsf::proc dispatch finalize release parse context"); return result; } @@ -9266,7 +9275,7 @@ * If the method to be invoked has paramDefs, we have to call the * argument parser with the argument definitions obtained from the * proc context from the cmdPtr. - */ + */ paramDefs = ParamDefsGet(cmdPtr); if (paramDefs && paramDefs->paramsPtr) { @@ -9281,8 +9290,8 @@ releasePc = 1; result = PushProcCallFrame(cp, interp, pcPtr->objc+1, pcPtr->full_objv, cscPtr); } else { - /* - * some error occured + /* + * some error occurred */ #if defined(NRE) ParseContextRelease(pcPtr); @@ -9370,8 +9379,8 @@ if (cscPtr) { /* - * We have a callstack content, but the requested dispatch will not store - * the callstack content in a corresponding callframe on its own. To get, + * We have a call-stack content, but the requested dispatch will not store + * the call-stack content in a corresponding call-frame on its own. To get, * for example, self introspection working for the requested dispatch, we * introduce a CMETHOD frame. */ @@ -9499,7 +9508,7 @@ /* * When we try to invoke a deleted object, the cmd (alias) is * automatically removed. Note that the cmd might be still referenced - * in various entries in the callstack. The reference counting on + * in various entries in the call-stack. The reference counting on * these elements takes care that the cmdPtr is deleted on a pop * operation (although we do a Tcl_DeleteCommandFromToken() below. */ @@ -9522,19 +9531,19 @@ /* * Make sure, that the current call is marked as an ensemble call, both - * for dispatching to the defaultmethod and for dispatching the method + * for dispatching to the default-method and for dispatching the method * interface of the given object. Otherwise, current introspection - * specific to submethods fails (e.g., a [current methodpath] in the - * defaultmethod). + * specific to sub-methods fails (e.g., a [current method-path] in the + * default-method). */ cscPtr->flags |= NSF_CSC_CALL_IS_ENSEMBLE; /* * The client data cp is still the obj of the called method */ - + /*fprintf(stderr, "ensemble dispatch %s objc %d\n", methodName, objc);*/ - + if (objc < 2) { CallFrame frame, *framePtr = &frame; Nsf_PushFrameCsc(interp, cscPtr, framePtr); @@ -9552,13 +9561,13 @@ if (self->nsPtr) { cmd = FindMethod(self->nsPtr, methodName); - /*fprintf(stderr, "... objv[0] %s method %p %s csc %p\n", + /*fprintf(stderr, "... objv[0] %s method %p %s csc %p\n", ObjStr(objv[0]), cmd, methodName, cscPtr); */ if (cmd) { /* * In order to allow [next] to be called in an ensemble method, - * an extra callframe is needed. This CSC frame is typed as + * an extra call-frame is needed. This CSC frame is typed as * NSF_CSC_TYPE_ENSEMBLE. Note that the associated call is flagged * additionally (NSF_CSC_CALL_IS_ENSEMBLE; see above) to be able * to identify ensemble-specific frames during [next] execution. @@ -9570,8 +9579,8 @@ */ /*fprintf(stderr, ".... ensemble dispatch on %s.%s cscPtr %p base flags %.6x cl %s\n", - ObjectName(object), methodName, cscPtr, - (0xFF & cscPtr->flags), + ObjectName(object), methodName, cscPtr, + (0xFF & cscPtr->flags), cscPtr->cl ? ObjStr(cscPtr->cl->object.cmdName) : NULL);*/ result = MethodDispatch(object, interp, objc-1, objv+1, @@ -9596,7 +9605,7 @@ /* * We are in an ensemble method. The next works here not on the * actual methodName + frame, but on the ensemble above it. We - * locate the appropriate callstack content and continue next on + * locate the appropriate call-stack content and continue next on * that. */ cscPtr1 = CallStackFindEnsembleCsc(framePtr1, &framePtr1); @@ -9612,7 +9621,7 @@ } /*fprintf(stderr, "==> next %s.%s (obj %s) csc %p returned %d unknown %d\n", - ObjectName(self), methodName, ObjectName(object), cscPtr, result, + ObjectName(self), methodName, ObjectName(object), cscPtr, result, RUNTIME_STATE(interp)->unknown); */ if (RUNTIME_STATE(interp)->unknown) { @@ -9622,7 +9631,7 @@ * object (at the class or the mixin level), or the default unknown * handler takes it from there. The application-level unknown * handler cannot determine the top-level calling object (referred - * to as the delegator). Therefore, we assemble all the neccesssary + * to as the delegator). Therefore, we assemble all the necessary * call data as the first argument passed to the unknown * handler. Call data include the calling object (delegator), the * method path, and the unknown final method. @@ -9694,7 +9703,7 @@ *---------------------------------------------------------------------- * MethodDispatch -- * - * Conveniance wrapper for MethodDispatchCsc(). It allocates a call + * Convenience wrapper for MethodDispatchCsc(). It allocates a call * stack content and invokes MethodDispatchCsc. * * Results: @@ -9799,14 +9808,14 @@ /* - * On success (no error occured) check for unknown cases. + * On success (no error occurred) check for unknown cases. */ if (likely(result == TCL_OK)) { if ((flags & NSF_CSC_METHOD_IS_UNKNOWN) || ((cscPtr->frameType == NSF_CSC_TYPE_ACTIVE_FILTER) && rst->unknown) ) { - result = DispatchUnknownMethod(interp, object, + result = DispatchUnknownMethod(interp, object, cscPtr->objc, cscPtr->objv, NULL, cscPtr->objv[0], (cscPtr->flags & NSF_CSC_CALL_NO_UNKNOWN)|NSF_CSC_IMMEDIATE); /* @@ -9919,8 +9928,8 @@ #endif /*fprintf(stderr, "ObjectDispatch obj = %s objc = %d 0=%s methodName=%s shift %d\n", - object ? ObjectName(object) : NULL, - objc, objv[0] ? ObjStr(objv[0]) : NULL, + object ? ObjectName(object) : NULL, + objc, objv[0] ? ObjStr(objv[0]) : NULL, methodName, shift);*/ objflags = object->flags; /* avoid stalling */ @@ -9945,10 +9954,11 @@ objflags = object->flags; } - /* Only start new filter chain, if - (a) filters are defined and - (b) the toplevel csc entry is not an filter on self - */ + /* + * Only start new filter chain, if + * (a) filters are defined and + * (b) the toplevel csc entry is not an filter on self + */ /*fprintf(stderr, "call %s, objflags %.6x, defined and valid %.6x doFilters %d guard count %d\n", methodName, objflags, NSF_FILTER_ORDER_DEFINED_AND_VALID, @@ -9985,7 +9995,7 @@ if (unlikely(cscPtr1 == NULL)) { return NsfPrintError(interp, "local flag only allowed when called from a method body"); - } + } if (cscPtr1->cl) { cmd = FindMethod(cscPtr1->cl->nsPtr, methodName); if (cmd) { @@ -9996,7 +10006,7 @@ } /*fprintf(stderr, "ObjectDispatch NSF_CM_LOCAL_METHOD obj %s methodName %s => cl %p %s cmd %p \n", - object ? ObjectName(object) : NULL, + object ? ObjectName(object) : NULL, methodName, cl, cl ? ClassName(cl) : "NONE", cmd);*/ } else if (*methodName == ':') { @@ -10007,7 +10017,7 @@ * We have fully qualified name provided. Determine the class and/or * object on which the method was registered. */ - + if (methodObj == NULL) { methodObj = Tcl_NewStringObj(methodName, -1); } @@ -10032,7 +10042,7 @@ * via fully qualified names. Otherwise, in line [2] below, ::State * is interpreted as an ensemble object, and the method * "unknown" won't be called (in the XOTcl tradition) and - * wierd things will happen. + * weird things will happen. * * [1] Class ::State * [2] Class ::State -parameter x @@ -10049,7 +10059,7 @@ } /*fprintf(stderr, "ObjectDispatch fully qualified obj %s methodName %s => cl %p cmd %p \n", - object ? ObjectName(object) : NULL, + object ? ObjectName(object) : NULL, methodName, cl, cmd);*/ } @@ -10059,8 +10069,8 @@ /* * Check if a mixed in method has to be called. */ - if ((objflags & NSF_MIXIN_ORDER_DEFINED_AND_VALID) == NSF_MIXIN_ORDER_DEFINED_AND_VALID - && (flags & (NSF_CM_SYSTEM_METHOD|NSF_CM_INTRINSIC_METHOD)) == 0 + if ((objflags & NSF_MIXIN_ORDER_DEFINED_AND_VALID) == NSF_MIXIN_ORDER_DEFINED_AND_VALID + && (flags & (NSF_CM_SYSTEM_METHOD|NSF_CM_INTRINSIC_METHOD)) == 0 && ((flags & NSF_CM_LOCAL_METHOD) == 0 || cl)) { /* @@ -10115,7 +10125,7 @@ cmd = mcPtr->cmd; #if defined(METHOD_OBJECT_TRACE) - fprintf(stderr, "... use internal rep method %p %s cmd %p (objProc %p) cl %p %s\n", + fprintf(stderr, "... use internal rep method %p %s cmd %p (objProc %p) cl %p %s\n", methodObj, ObjStr(methodObj), cmd, cmd ? ((Command *)cmd)->objProc : 0, cl, cl ? ClassName(cl) : ObjectName(object)); @@ -10131,11 +10141,11 @@ object, methodName, object->nsPtr, cmd, cmd ? ((Command *)cmd)->objProc : NULL);*/ if (cmd) { - if ((flags & (NSF_CM_LOCAL_METHOD|NSF_CM_IGNORE_PERMISSIONS)) == 0 + if ((flags & (NSF_CM_LOCAL_METHOD|NSF_CM_IGNORE_PERMISSIONS)) == 0 && (Tcl_Command_flags(cmd) & NSF_CMD_CALL_PRIVATE_METHOD)) { cmd = NULL; } else { - + NsfMethodObjSet(interp, methodObj, &NsfObjectMethodObjType, object, nsfObjectMethodEpoch, cmd, NULL, flags); @@ -10150,22 +10160,22 @@ cmd = NsfFindClassMethod(interp, (NsfClass *)object, methodName); } #endif - + if (likely(cmd == NULL)) { /* check for an instance method */ NsfClass *currentClass = object->cl; NsfMethodContext *mcPtr = methodObj->internalRep.twoPtrValue.ptr1; int nsfInstanceMethodEpoch = rst->instanceMethodEpoch; - + #if defined(METHOD_OBJECT_TRACE) - fprintf(stderr, "... method %p/%d '%s' type? %d context? %d nsfMethodEpoch %d => %d\n", - methodObj, methodObj->refCount, ObjStr(methodObj), + fprintf(stderr, "... method %p/%d '%s' type? %d context? %d nsfMethodEpoch %d => %d\n", + methodObj, methodObj->refCount, ObjStr(methodObj), methodObj->typePtr == &NsfInstanceMethodObjType, methodObj->typePtr == &NsfInstanceMethodObjType ? mcPtr->context == currentClass : 0, methodObj->typePtr == &NsfInstanceMethodObjType ? mcPtr->methodEpoch : 0, nsfInstanceMethodEpoch ); #endif - + if (methodObj->typePtr == &NsfInstanceMethodObjType && mcPtr->context == currentClass && mcPtr->methodEpoch == nsfInstanceMethodEpoch @@ -10174,7 +10184,7 @@ cmd = mcPtr->cmd; cl = mcPtr->cl; #if defined(METHOD_OBJECT_TRACE) - fprintf(stderr, "... use internal rep method %p %s cmd %p (objProc %p) cl %p %s\n", + fprintf(stderr, "... use internal rep method %p %s cmd %p (objProc %p) cl %p %s\n", methodObj, ObjStr(methodObj), cmd, cmd?((Command *)cmd)->objProc : NULL, cl, cl ? ClassName(cl) : ObjectName(object)); @@ -10186,7 +10196,7 @@ * We could call TransitiveSuperClasses(currentClass) to recompute * currentClass->order on demand, but by construction this is already * set here. - */ + */ assert(currentClass->order); if (unlikely(flags & NSF_CM_SYSTEM_METHOD)) { @@ -10222,7 +10232,7 @@ int cmdFlags = Tcl_Command_flags(cmd); #if !defined(NDEBUG) - if ((cmdFlags & NSF_CMD_CALL_PRIVATE_METHOD) + if ((cmdFlags & NSF_CMD_CALL_PRIVATE_METHOD) && ((flags & NSF_CM_LOCAL_METHOD) == 0) ) { /* @@ -10235,15 +10245,15 @@ assert(0); cmd = NULL; - } else + } else #endif if ((cmdFlags & NSF_CMD_CALL_PROTECTED_METHOD)) { NsfObject *lastSelf = GetSelfObj(interp); /* * Protected methods can be called, when calling object == called object. */ - + if (unlikely(object != lastSelf)) { NsfLog(interp, NSF_LOG_WARN, "'%s %s' fails since method %s.%s is protected", ObjectName(object), methodName, @@ -10340,7 +10350,7 @@ *---------------------------------------------------------------------- */ static int -DispatchDefaultMethod(Tcl_Interp *interp, NsfObject *object, +DispatchDefaultMethod(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *obj, int flags) { int result; Tcl_Obj *methodObj; @@ -10357,7 +10367,7 @@ tov[0] = obj; tov[1] = methodObj; - result = ObjectDispatch(object, interp, 2, tov, + result = ObjectDispatch(object, interp, 2, tov, flags|NSF_CM_NO_UNKNOWN|NSF_CM_IGNORE_PERMISSIONS); } @@ -10420,7 +10430,7 @@ NsfErrorContext(interp, "method destroy"); if (++rst->errorCount > 20) { - Tcl_Panic("too many destroy errors occured. Endless loop?"); + Tcl_Panic("too many destroy errors occurred. Endless loop?"); } } else if (rst->errorCount > 0) { rst->errorCount--; @@ -10448,7 +10458,7 @@ *---------------------------------------------------------------------- */ static int -DispatchInitMethod(Tcl_Interp *interp, NsfObject *object, +DispatchInitMethod(Tcl_Interp *interp, NsfObject *object, int objc, Tcl_Obj *CONST objv[], int flags) { int result; @@ -10460,7 +10470,7 @@ * check, whether init was called already */ if (!(object->flags & (NSF_INIT_CALLED|NSF_DESTROY_CALLED))) { - + /* * Flag the call to "init" before the dispatch, such that a call to * "configure" within init does not clear the already set instance @@ -10517,7 +10527,7 @@ callInfoObj?objv[1]:NULL, callInfoObj?ObjStr(objv[1]) : NULL, methodName);*/ - + if (unknownObj && methodObj != unknownObj && (flags & NSF_CSC_CALL_NO_UNKNOWN) == 0) { /* * back off and try unknown; @@ -10529,29 +10539,29 @@ callInfoObj = mustCopy ? Tcl_NewStringObj(methodName, -1) : methodObj; } INCR_REF_COUNT(callInfoObj); - - /*fprintf(stderr, "calling unknown for %s %s, flgs=%.6x,%.6x/%.6x isClass=%d %p %s objc %d\n", + + /*fprintf(stderr, "calling unknown for %s %s, flags=%.6x,%.6x/%.6x isClass=%d %p %s objc %d\n", ObjectName(object), ObjStr(methodObj), flags, NSF_CM_NO_UNKNOWN, NSF_CSC_CALL_NO_UNKNOWN, NsfObjectIsClass(object), object, ObjectName(object), objc);*/ - + tov[0] = object->cmdName; tov[1] = unknownObj; tov[2] = callInfoObj; if (objc > 1) { memcpy(tov + 3, objv + 1, sizeof(Tcl_Obj *) * (objc - 1)); } - + flags &= ~NSF_CM_NO_SHIFT; - + /*fprintf(stderr, "call unknown via dispatch mustCopy %d delegator %p method %s (%s)\n", mustCopy, delegator, ObjStr(tov[offset]), ObjStr(methodObj));*/ - - result = ObjectDispatch(object, interp, objc+2, tov, + + result = ObjectDispatch(object, interp, objc+2, tov, flags|NSF_CM_NO_UNKNOWN|NSF_CM_IGNORE_PERMISSIONS); DECR_REF_COUNT(callInfoObj); FREE_ON_STACK(Tcl_Obj*, tov); - + } else { /* no unknown called, this is the built-in unknown handler */ Tcl_Obj *tailMethodObj = NULL; @@ -10561,9 +10571,9 @@ Tcl_ListObjIndex(interp, objv[1], length - 1, &tailMethodObj); } } - + result = NsfPrintError(interp, "%s: unable to dispatch method '%s'", - ObjectName(object), + ObjectName(object), tailMethodObj ? MethodName(tailMethodObj) : methodName); } @@ -10589,7 +10599,7 @@ */ #if defined(NRE) Tcl_ObjCmdProc NsfObjDispatchNRE; -extern int +extern int NsfObjDispatch(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { return Tcl_NRCallObjProc(interp, NsfObjDispatchNRE, clientData, objc, objv); } @@ -10628,7 +10638,7 @@ * AddPrefixToBody -- * * Create a fresh TclObj* containing the body with an potential prefix. - * The caller has to decrement the refcount on this Tcl_Obj*. + * The caller has to decrement the ref-count on this Tcl_Obj*. * * Results: * Tcl_Obj @@ -10798,7 +10808,7 @@ * Nsf_ConvertToBoolean -- * * Nsf_TypeConverter setting the client data (passed to C functions) to the - * interal repesentation of a boolean. This converter checks the passed + * internal representation of a boolean. This converter checks the passed * value via Tcl_GetBooleanFromObj(). * * Results: @@ -10830,7 +10840,7 @@ * Nsf_ConvertToInt32 -- * * Nsf_TypeConverter setting the client data (passed to C functions) to the - * interal repesentation of an integer. This converter checks the passed + * internal representation of an integer. This converter checks the passed * value via Tcl_GetIntFromObj(). * * Results: @@ -10863,7 +10873,7 @@ * Nsf_ConvertToInteger -- * * Nsf_TypeConverter setting the client data (passed to C functions) to the - * TclObj containng the bignum value. This converter checks the passed + * TclObj containing the bignum value. This converter checks the passed * value via Tcl_GetBignumFromObj(). * * Results: @@ -10928,7 +10938,7 @@ * Nsf_ConvertToSwitch -- * * Nsf_TypeConverter setting the client data (passed to C functions) to the - * interal repesentation of an Boolean. This converter simply calls + * internal representation of an Boolean. This converter simply calls * Tcl_ConvertToBoolean(). The distinction between "switch" and boolean is * made on the semantics of which arguments/defaults are passed to the real * converter. @@ -10953,7 +10963,7 @@ * Nsf_ConvertToObject -- * * Nsf_TypeConverter setting the client data (passed to C functions) to the - * interal repesentation of an object. This converter checks the passed + * internal representation of an object. This converter checks the passed * value via IsObjectOfType(). * * Results: @@ -10980,7 +10990,7 @@ * Nsf_ConvertToClass -- * * Nsf_TypeConverter setting the client data (passed to C functions) to the - * interal repesentation of a class. This converter checks the passed + * internal representation of a class. This converter checks the passed * value via IsObjectOfType(). * * Results: @@ -11132,7 +11142,7 @@ * we do not want to alter the result just when the converter sets a * result. So, for non-converter, we save the old result and restore * it before the return in case of success. Strictly speaking, - * result-overwritng just harms for result-converters, but saving is + * result-overwriting just harms for result-converters, but saving is * always semantically correct. */ if ((pPtr->flags & NSF_ARG_IS_CONVERTER) == 0) { @@ -11239,9 +11249,9 @@ } else { /* * We have a pattern and meta characters, we might have - * to prefix it to ovoid abvious errors: since all object + * to prefix it to ovoid obvious errors: since all object * names are prefixed with ::, we add this prefix automatically - * to the match pattern, if it does not exist + * to the match pattern, if it does not exist. */ if (*pattern != ':' && *pattern+1 != ':') { patternObj = Tcl_NewStringObj("::", 2); @@ -11252,7 +11262,7 @@ INCR_REF_COUNT2("patternObj", patternObj); } *clientData = (ClientData)patternObj; - /* The following assert does not hold here, since we + /* The following assert does not hold here, since we have a direct call to the converter assert(*outObjPtr == objPtr); */ @@ -11342,7 +11352,7 @@ if (*option == '0') { paramPtr->flags |= NSF_ARG_ALLOW_EMPTY; } else if (*option != '1') { - return NsfPrintError(interp, "lower bound of multiplicty in %s not supported", argString); + return NsfPrintError(interp, "lower bound of multiplicity in %s not supported", argString); } /* check upper bound */ option = dotdot + 2; @@ -11353,7 +11363,7 @@ } paramPtr->flags |= NSF_ARG_MULTIVALUED; } else if (*option != '1') { - return NsfPrintError(interp, "upper bound of multiplicty in %s not supported", argString); + return NsfPrintError(interp, "upper bound of multiplicity in %s not supported", argString); } } else if (strncmp(option, "noarg", 5) == 0) { @@ -11489,9 +11499,9 @@ Tcl_DStringFree(dsPtr); for (i=0; stringTypeOpts[i]; i++) { - /* + /* * Do not allow abbreviations, so the additional strlen checks - * for a full match + * for a full match */ if (strncmp(option, stringTypeOpts[i], optionLength) == 0 && strlen(stringTypeOpts[i]) == optionLength) { @@ -11504,11 +11514,11 @@ /* converter is stringType */ result = ParamOptionSetConverter(interp, paramPtr, "stringtype", Nsf_ConvertToTclobj); if (paramPtr->converterArg) {DECR_REF_COUNT(paramPtr->converterArg);} - paramPtr->converterArg = Tcl_NewStringObj(stringTypeOpts[i], -1); + paramPtr->converterArg = Tcl_NewStringObj(stringTypeOpts[i], -1); INCR_REF_COUNT(paramPtr->converterArg); } else { - /* + /* * The parameter option is still unknown. We assume that the parameter * option identifies a user-defined argument checker, implemented as a * method. @@ -11533,7 +11543,7 @@ return NsfPrintError(interp, "Parameter types 'alias' and 'initcmd' cannot be used together"); } else if ((paramPtr->flags & (NSF_ARG_FORWARD|NSF_ARG_INITCMD)) == (NSF_ARG_FORWARD|NSF_ARG_INITCMD)) { return NsfPrintError(interp, "Parameter types 'forward' and 'initcmd' cannot be used together"); - } + } return result; } @@ -11676,8 +11686,8 @@ /* postprocessing the parameter options */ if (paramPtr->converter == NULL) { - /* - * If no converter is set, use the default converter + /* + * If no converter is set, use the default converter */ paramPtr->converter = Nsf_ConvertToTclobj; } else if (paramPtr->converter == ConvertToNothing) { @@ -11717,7 +11727,7 @@ converterNameString = ObjStr(converterNameObj); cmd = ObjectFindMethod(interp, paramObject, converterNameObj, &pcl); - /*fprintf(stderr, "locating %s on %s returns %p (%s)\n", + /*fprintf(stderr, "locating %s on %s returns %p (%s)\n", ObjStr(converterNameObj), ObjectName(paramObject), cmd, ClassName(pcl));*/ if (cmd == NULL) { if (paramPtr->converter == ConvertViaCmd) { @@ -11735,7 +11745,7 @@ NsfLog(interp, NSF_LOG_WARN, "Checker method %s defined on %s shadows built-in converter", converterNameString, ObjectName(paramObject)); - + if (paramPtr->converterName == NULL) { paramPtr->converterName = converterNameObj; paramPtr->converter = NULL; @@ -11833,9 +11843,9 @@ result = ParamParse(interp, procNameObj, argsv[i], allowedOptinons, paramPtr, &possibleUnknowns, &plainParams, &nrNonposArgs); if (result == TCL_OK && paramPtr->converter == ConvertToNothing && i < argsc-1) { - result = NsfPrintError(interp, - "parameter option \"args\" invalid for parameter \"%s\"; only allowed for last parameter", - paramPtr->name); + result = NsfPrintError(interp, + "parameter option \"args\" invalid for parameter \"%s\"; only allowed for last parameter", + paramPtr->name); } if (unlikely(result != TCL_OK)) { ParamsFree(paramsPtr); @@ -11878,7 +11888,7 @@ paramDefs->paramsPtr = paramsPtr; paramDefs->nrParams = paramPtr-paramsPtr; /*fprintf(stderr, "method %s serial %d paramDefs %p ifsize %ld, possible unknowns = %d,\n", - ObjStr(procNameObj), paramDefs->serial, + ObjStr(procNameObj), paramDefs->serial, paramDefs, paramPtr-paramsPtr, possibleUnknowns);*/ parsedParamPtr->paramDefs = paramDefs; parsedParamPtr->possibleUnknowns = possibleUnknowns; @@ -11943,7 +11953,7 @@ /* modify the cmd of the proc to set the current namespace for the body */ if (withInner_namespace) { /* - * Set the namespace of the method as inside of the class + * Set the namespace of the method as inside of the class. */ if (!regObject->nsPtr) { MakeObjNamespace(interp, regObject); @@ -12054,7 +12064,6 @@ /* could be a filter or filter inheritance ... update filter orders */ if (FilterIsActive(interp, nameStr)) { NsfClasses *subClasses = TransitiveSubClasses(cl); - fprintf(stderr, "MakeMethod calls ComputeOrderSubclasses\n"); FilterInvalidateObjOrders(interp, cl, subClasses); NsfClassListFree(subClasses); } @@ -12081,7 +12090,7 @@ * None. * * Side effects: - * Frees clientdata + * Frees client-data * *---------------------------------------------------------------------- */ @@ -12476,7 +12485,7 @@ fprintf(stderr, "after ArgumentParse %s\n", ObjStr(methodNameObj)); for (i = 0; i < pcPtr->objc-1; i++) { fprintf(stderr, "... pcPtr %p [%d] obj %p refCount %d (%s) flags %.6x & %p\n", - pcPtr, i, pcPtr->objv[i], pcPtr->objv[i]->refCount, + pcPtr, i, pcPtr->objv[i], pcPtr->objv[i]->refCount, ObjStr(pcPtr->objv[i]), pcPtr->flags[i], &(pcPtr->flags[i])); } } @@ -12717,7 +12726,7 @@ tcd = NEW(ForwardCmdClientData); memset(tcd, 0, sizeof(ForwardCmdClientData)); - + if (withDefault) { Tcl_DString ds, *dsPtr = &ds; DSTRING_INIT(dsPtr); @@ -12768,15 +12777,15 @@ ObjStr(tcd->cmdName), tcd->args?ObjStr(tcd->args):"NULL", tcd->nr_args);*/ if (tcd->objframe) { - /* when we evaluating objscope, and define ... - o forward append -objframe append - a call to - o append ... - would lead to a recursive call; so we add the appropriate namespace - */ + /* + * When we evaluating objscope, and define ... + * o forward append -objframe append + * a call to + * o append ... + * would lead to a recursive call; so we add the appropriate namespace. + */ CONST char *nameString = ObjStr(tcd->cmdName); - if (isAbsolutePath(nameString)) { - } else { + if (!isAbsolutePath(nameString)) { tcd->cmdName = NameInNamespaceObj(interp, nameString, CallingNameSpace(interp)); /*fprintf(stderr, "+++ name %s not absolute, therefore qualifying %s\n", nameString, ObjStr(tcd->cmdName));*/ @@ -12848,7 +12857,7 @@ * The function appends results to the provide listObj * * Side effects: - * Might add as well to the hash table to avoid duplicates + * Might add as well to the hash-table to avoid duplicates. * *---------------------------------------------------------------------- */ @@ -12894,8 +12903,8 @@ */ cmd = (Tcl_Command) Tcl_GetHashValue(hPtr); childObject = NsfGetObjectFromCmdPtr(cmd); - - /* + + /* * Report just the already fully initialized slot objects, not the one * being right now created. */ @@ -12929,7 +12938,7 @@ } /* - * Add finaly the entry to the returned list. + * Add finally the entry to the returned list. */ Tcl_ListObjAppendElement(interp, listObj, childObject->cmdName); } @@ -13022,7 +13031,7 @@ assert(objflags & NSF_MIXIN_ORDER_VALID); if (object->mixinStack && cscPtr->frameType) { - int result = MixinSearchProc(interp, object, *methodNamePtr, NULL, + int result = MixinSearchProc(interp, object, *methodNamePtr, NULL, clPtr, currentCmdPtr, cmdPtr); /* fprintf(stderr, "next in mixins %s frameType %.6x\n", *methodNamePtr, cscPtr->frameType); */ @@ -13057,7 +13066,7 @@ if (endOfChain) { if (**methodNamePtr == ':') { *cmdPtr = Tcl_FindCommand(interp, *methodNamePtr, NULL, TCL_GLOBAL_ONLY); - /* fprintf(stderr, "NEXT found abolute cmd %s => %p\n", *methodNamePtr, *cmdPtr); */ + /* fprintf(stderr, "NEXT found absolute cmd %s => %p\n", *methodNamePtr, *cmdPtr); */ } else if (object->nsPtr) { *cmdPtr = FindMethod(object->nsPtr, *methodNamePtr); if (*cmdPtr && (Tcl_Command_flags(*cmdPtr) & NSF_CMD_CALL_PRIVATE_METHOD)) { @@ -13094,9 +13103,9 @@ * Search for a further class method. When we are called from an active * filter and the call had the -local flag set, then allow to call private methods. */ - *clPtr = SearchPLMethod(pl, *methodNamePtr, cmdPtr, - ((cscPtr->flags & NSF_CM_LOCAL_METHOD) && - cscPtr->frameType == NSF_CSC_TYPE_ACTIVE_FILTER) + *clPtr = SearchPLMethod(pl, *methodNamePtr, cmdPtr, + ((cscPtr->flags & NSF_CM_LOCAL_METHOD) && + cscPtr->frameType == NSF_CSC_TYPE_ACTIVE_FILTER) ? 0 : NSF_CMD_CALL_PRIVATE_METHOD); } else { @@ -13150,7 +13159,7 @@ /* * We are in an ensemble method. The next works here not on the * actual methodName + frame, but on the ensemble above it. We - * locate the appropriate callstack content and continue next on + * locate the appropriate call-stack content and continue next on * that. */ cscPtr = CallStackFindEnsembleCsc(framePtr, &framePtr); @@ -13229,7 +13238,7 @@ * * This finalize function is either called via NRE callback or * directly (from NextSearchAndInvoke). It resets after a successul - * lookup and invation the continuation context (filter flags etc) + * lookup and invocation the continuation context (filter flags etc) * and cleans up optionally the argument vector (inverse operation * of NextGetArguments). * @@ -13399,33 +13408,33 @@ } else if (result == TCL_OK) { NsfCallStackContent *topCscPtr = NULL; int isLeafNext; - + /* * We could not find a cmd, yet the dispatch attempt did not result * in an error. This means that we find ourselves in either of three * situations at this point: * * 1) A next cmd (NsfNextCmd()) at the end of a filter chain: Dispatch to * unknown as there is no implementation for the requested selector - * available. 2) A next cmd from within a leaf submethod (a "leaf next"): + * available. 2) A next cmd from within a leaf sub-method (a "leaf next"): * Remain silent, do not dispatch to unknown. 3) MethodDispatchCsc() - * realises the actual "ensemble next": Dispatch to unknown, the + * realizes the actual "ensemble next": Dispatch to unknown, the * requested sub-selector is not resolvable to a cmd. * - * For the cases 1) and 3), set the interp's unknown flag signalling to + * For the cases 1) and 3), set the interp's unknown flag signaling to * higher levels (e.g., in MethodDispatchCsc(), in NsfNextCmd()) the need * for dispatching to unknown. */ - + topCscPtr = CallStackGetTopFrame(interp, NULL); assert(topCscPtr); - + /* case 2 */ - isLeafNext = (cscPtr != topCscPtr) && (topCscPtr->frameType & NSF_CSC_TYPE_ENSEMBLE) && + isLeafNext = (cscPtr != topCscPtr) && (topCscPtr->frameType & NSF_CSC_TYPE_ENSEMBLE) && (topCscPtr->flags & NSF_CSC_CALL_IS_ENSEMBLE) == 0; - rst->unknown = /* case 1 */ endOfFilterChain || - /* case 3 */ (!isLeafNext && (cscPtr->flags & NSF_CSC_CALL_IS_ENSEMBLE)); + rst->unknown = /* case 1 */ endOfFilterChain || + /* case 3 */ (!isLeafNext && (cscPtr->flags & NSF_CSC_CALL_IS_ENSEMBLE)); /*fprintf(stderr, "******** setting unknown to %d\n", rst->unknown );*/ } @@ -13540,7 +13549,7 @@ *---------------------------------------------------------------------- * ComputeLevelObj -- * - * This function comptes a fresh Tcl_Obj refering to the interp level. The + * This function comptes a fresh Tcl_Obj referring to the interp level. The * caller has to care about freeing the returned Tcl_Obj. * * Results: @@ -13639,13 +13648,12 @@ int result = TCL_OK; if (object->opt && object->opt->volatileVarName) { /* - Somebody destroys a volatile object manually while - the vartrace is still active. Destroying the object will - be a problem in case the variable is deleted later - and fires the trace. So, we unset the variable here - which will cause a destroy via var trace, which in - turn clears the volatileVarName flag. - */ + * Somebody destroys a volatile object manually while the vartrace is + * still active. Destroying the object will be a problem in case the + * variable is deleted later and fires the trace. So, we unset the + * variable here which will cause a destroy via var trace, which in turn + * clears the volatileVarName flag. + */ /*fprintf(stderr, "### FreeUnsetTraceVariable %s\n", obj->opt->volatileVarName);*/ result = Tcl_UnsetVar2(interp, object->opt->volatileVarName, NULL, 0); @@ -13725,15 +13733,18 @@ /*fprintf(stderr, "CleanupDestroyObject obj %p softrecreate %d nsPtr %p\n", object, softrecreate, object->nsPtr);*/ - /* the object pointer is guaranteed to point to the same object, so it is - * not sufficient for methodObj validation. Thereforem for objects - * containing per-object methods, we increment the objectMethodEpoch + /* + * The object pointer is guaranteed to point to the same object, so it is + * not sufficient for methodObj validation. Therefore, for objects + * containing per-object methods, we increment the objectMethodEpoch. */ if (object->nsPtr) { - NsfObjectMethodEpochIncr("CleanupDestroyObject"); + NsfObjectMethodEpochIncr("CleanupDestroyObject"); } - /* remove the instance, but not for ::Class/::Object */ + /* + * Remove the instance, but not for ::Class/::Object + */ if ((object->flags & NSF_IS_ROOT_CLASS) == 0 && (object->flags & NSF_IS_ROOT_META_CLASS) == 0 ) { @@ -13764,7 +13775,8 @@ if (!softrecreate) { /* - * Remove this object from all per object mixin lists and clear the mixin list + * Remove this object from all per object mixin lists and clear the + * mixin list. */ RemoveFromObjectMixinsOf(object->id, opt->objMixins); @@ -13859,7 +13871,7 @@ assert(object->flags & NSF_DESTROY_CALLED); /* - * check and latch against recurrent calls with object->teardown + * Check and latch against recurrent calls with object->teardown. */ PRINTOBJ("PrimitiveODestroy", object); interp = object->teardown; @@ -13888,7 +13900,7 @@ /* * Object is now mostly dead, but still allocated. However, since - * Nsf_DeleteNamespace might delegate to the parent (w.g. slots) we clear + * Nsf_DeleteNamespace might delegate to the parent (e.g. slots) we clear * teardown after the deletion of the children. */ if (object->nsPtr) { @@ -13913,7 +13925,7 @@ * DoDealloc -- * * Perform deallocation of an object/class. This function is called - * from the dealloc method and interanally to get rid of an + * from the dealloc method and internally to get rid of an * abject. It cares about volatile and frees/triggers free * operation depending on the stack references. * @@ -13939,7 +13951,7 @@ } /* - * latch, and call delete command if not already in progress + * Latch, and call delete command if not already in progress. */ if (RUNTIME_STATE(interp)->exitHandlerDestroyRound != NSF_EXITHANDLER_ON_SOFT_DESTROY) { @@ -13950,7 +13962,7 @@ } /* - * reset the object to a fresh, undestroyed state + * reset the object to a fresh, un-destroyed state */ static void MarkUndestroyed(NsfObject *object) { @@ -13973,13 +13985,13 @@ /* * There might be already a namespace with name name; if this is the - * case, use this namepsace as object namespace. The preexisting + * case, use this namespace as object namespace. The preexisting * namespace might contain Next Scripting objects. If we would not use the * namespace as child namespace, we would not recognize the objects * as child objects, deletions of the object might lead to a crash. * * We can use here the provided nsPtr, except in cases, where this - * namepaces is being destroyed (e.g. recreate a new object from a + * namespaces is being destroyed (e.g. recreate a new object from a * different object system). */ @@ -14036,8 +14048,8 @@ NSNamespacePreserve(nsPtr); } #if defined(NRE) - object->id = Tcl_NRCreateCommand(interp, nameString, - NsfObjDispatch, + object->id = Tcl_NRCreateCommand(interp, nameString, + NsfObjDispatch, NsfObjDispatchNRE, object, TclDeletesObject); #else @@ -14190,7 +14202,7 @@ * have no clopt... */ MixinInvalidateObjOrders(interp, cl, subClasses); - if (FiltersDefined(interp) > 0) { + if (FiltersDefined(interp) > 0) { FilterInvalidateObjOrders(interp, cl, subClasses); } @@ -14243,7 +14255,7 @@ * Reclass all instances of the current class the the appropriate * most general class ("baseClass"). The most general class of a * metaclass is the root meta class, the most general class of an - * object is the root class. Instances of metaclasses can be only + * object is the root class. Instances of meta-classes can be only * reset to the root meta class (and not to to the root base * class). */ @@ -14326,7 +14338,7 @@ * None. * * Side effects: - * Makes a class structure usuable. + * Makes a class structure useable. * *---------------------------------------------------------------------- */ @@ -14377,7 +14389,7 @@ } /* - * class physical destruction + * Class physical destruction */ static void PrimitiveCDestroy(ClientData clientData) { @@ -14419,7 +14431,7 @@ */ PrimitiveODestroy(clientData); - /*fprintf(stderr, "primitive cdestroy calls deletenamespace for obj %p, nsPtr %p flags %.6x\n", + /*fprintf(stderr, "primitive cdestroy calls delete namespace for obj %p, nsPtr %p flags %.6x\n", cl, saved, ((Namespace *)saved)->flags);*/ Nsf_DeleteNamespace(interp, saved); /*fprintf(stderr, "primitive cdestroy %p DONE\n", cl);*/ @@ -14483,8 +14495,8 @@ NSNamespacePreserve(nsPtr); } #if defined(NRE) - object->id = Tcl_NRCreateCommand(interp, nameString, - NsfObjDispatch, + object->id = Tcl_NRCreateCommand(interp, nameString, + NsfObjDispatch, NsfObjDispatchNRE, cl, TclDeletesObject); #else @@ -14590,7 +14602,7 @@ int result; /* - * Save the result we have so far to return it in case of success + * Save the result we have so far to return it in case of success */ savedObjResult = Tcl_GetObjResult(interp); INCR_REF_COUNT(savedObjResult); @@ -14724,7 +14736,7 @@ GetInstVarIntoCurrentScope(Tcl_Interp *interp, const char *cmdName, NsfObject *object, Tcl_Obj *varName, Tcl_Obj *newName) { Var *varPtr = NULL, *otherPtr = NULL, *arrayPtr; - int new = 0, flgs = TCL_LEAVE_ERR_MSG; + int new = 0, flogs = TCL_LEAVE_ERR_MSG; Tcl_CallFrame *varFramePtr; CallFrame frame, *framePtr = &frame; char *varNameString; @@ -14735,10 +14747,10 @@ Nsf_PushFrameObj(interp, object, framePtr); if (object->nsPtr) { - flgs = flgs|TCL_NAMESPACE_ONLY; + flogs = flogs|TCL_NAMESPACE_ONLY; } - otherPtr = TclObjLookupVar(interp, varName, NULL, flgs, "define", + otherPtr = TclObjLookupVar(interp, varName, NULL, flogs, "define", /*createPart1*/ 1, /*createPart2*/ 1, &arrayPtr); Nsf_PopFrameObj(interp, framePtr); @@ -14776,14 +14788,16 @@ varPtr = (Var *)CompiledLocalsLookup((CallFrame *)varFramePtr, varNameString); if (varPtr == NULL) { - /* look in frame's local var hashtable */ + /* + * Look in frame's local var hash-table. + */ TclVarHashTable *varTablePtr = Tcl_CallFrame_varTablePtr(varFramePtr); if (varTablePtr == NULL) { /* * The variable table does not exist. This seems to be is the * first access to a variable on this frame. We create the and - * initialize the variable hash table and update the object + * initialize the variable hash-table and update the object */ /*fprintf(stderr, "+++ create varTable in GetInstVarIntoCurrentScope\n");*/ Tcl_CallFrame_varTablePtr(varFramePtr) = varTablePtr = VarHashTableCreate(); @@ -14792,16 +14806,18 @@ } /* - * if we define an alias (newName != varName), be sure that - * the target does not exist already + * If we define an alias (newName != varName), be sure that + * the target does not exist already. */ if (!new) { - /*fprintf(stderr, "GetIntoScope createalias\n");*/ + /*fprintf(stderr, "GetIntoScope create alias\n");*/ if (varPtr == otherPtr) { return NsfPrintError(interp, "can't instvar to variable itself"); } if (TclIsVarLink(varPtr)) { - /* we try to make the same instvar again ... this is ok */ + /* + * We try to make the same instvar again ... this is ok + */ Var *linkPtr = TclVarValue(Var, varPtr, linkPtr); if (linkPtr == otherPtr) { return TCL_OK; @@ -14810,18 +14826,19 @@ /*fprintf(stderr, "linkvar flags=%x\n", linkPtr->flags); Tcl_Panic("new linkvar %s... When does this happen?", ObjStr(newName), NULL);*/ - /* We have already a variable with the same name imported - from a different object. Get rid of this old variable - */ + /* + * We have already a variable with the same name imported + * from a different object. Get rid of this old variable. + */ VarHashRefCount(linkPtr)--; if (TclIsVarUndefined(linkPtr)) { TclCleanupVar(linkPtr, (Var *) NULL); } } else if (!TclIsVarUndefined(varPtr)) { - return NsfPrintError(interp, "varname '%s' exists already", varNameString); + return NsfPrintError(interp, "varName '%s' exists already", varNameString); } else if (TclIsVarTraced(varPtr)) { - return NsfPrintError(interp, "varname '%s' has traces: can't use for instvar", varNameString); + return NsfPrintError(interp, "varName '%s' has traces: can't use for instvar", varNameString); } } @@ -14932,20 +14949,20 @@ assert(object); Nsf_PushFrameObj(interp, object, framePtr); - + ov[0] = NsfGlobalObjs[NSF_ARRAY]; ov[2] = arrayNameObj; INCR_REF_COUNT(arrayNameObj); if (valueObj == NULL) { /* - * perform an array get + * Perform an array get */ ov[1] = NsfGlobalObjs[NSF_GET]; result = Tcl_EvalObjv(interp, 3, ov, 0); } else { /* - * perform an array get + * Perform an array get */ ov[1] = NsfGlobalObjs[NSF_SET]; ov[3] = valueObj; @@ -14995,7 +15012,7 @@ * NsfSetterMethod -- * * This Tcl_ObjCmdProc is called, when a setter is invoked. A setter is a - * method that access the same-named inance variable. If the setter is + * method that access the same-named instance variable. If the setter is * called without arguments, it returns the values, if it is called with * one argument, the argument is used as new value. * @@ -15067,7 +15084,7 @@ /* * Per default every ForwardArgString from the processed list corresponds to - * exactly one ForwardArgString in the computed final list + * exactly one ForwardArgString in the computed final list. */ *outputincr = 1; p = ForwardArgString; @@ -15097,7 +15114,8 @@ ForwardArgString = ++remainder; /* - * In case we address from the end, we reduct further to distinguish from -1 (void) + * In case we address from the end, we reduct further to distinguish from + * -1 (void) */ if (pos<0) pos--; /*fprintf(stderr, "remainder = '%s' pos = %ld\n", remainder, pos);*/ @@ -15120,7 +15138,7 @@ ) { CONST char *methodName = ObjStr(objv[0]); /* - * if we dispatch a method via ".", we do not want to see the "." in the + * If we dispatch a method via ".", we do not want to see the "." in the * %proc, e.g. for the interceptor slots (such as mixin, ...) */ if (FOR_COLON_RESOLVER(methodName)) { @@ -15210,7 +15228,7 @@ && Tcl_GetIntFromObj(interp, listElements[1], &insertRequired) == TCL_OK && insertRequired) { /* - * No match, but insert of flag is required + * No match, but insert of flag is required. */ /*fprintf(stderr, "no match, but insert of %s required\n", firstElementString);*/ *out = Tcl_NewStringObj(firstElementString, -1); @@ -15219,7 +15237,7 @@ } else { /* * No match, no insert of flag required, we skip the forwarder - * option and output nothing + * option and output nothing. */ /*fprintf(stderr, "no match, nrElements %d insert req %d\n", nrElements, insertRequired);*/ *outputincr = 0; @@ -15369,7 +15387,7 @@ } /* - * First, we handle two short cuts for simple cases + * First, we handle two short cuts for simple cases. */ if (tcd->passthrough) { @@ -15381,7 +15399,7 @@ } else if (!tcd->args && *(ObjStr(tcd->cmdName)) != '%') { /* - * we have have no args, therefore we have only to replace the method name + * We have have no args, therefore we have only to replace the method name * with the given cmd name. */ ALLOC_ON_STACK(Tcl_Obj*, objc, ov); @@ -15407,7 +15425,7 @@ } /* - * The first argument is always the command, to which we forward + * The first argument is always the command, to which we forward. */ if ((result = ForwardArg(interp, objc, objv, tcd->cmdName, tcd, &ov[outputArg], &freeList, &inputArg, @@ -15418,7 +15436,7 @@ outputArg += outputincr; /* - * if we have nonpos args, determine the first pos arg position for %1 + * If we have nonpos args, determine the first pos arg position for %1 */ if (tcd->hasNonposArgs) { firstPosArg = objc; @@ -15436,7 +15454,7 @@ int nrElements; /* - * copy argument list from the definitions + * Copy argument list from the definitions. */ Tcl_ListObjGetElements(interp, tcd->args, &nrElements, &listElements); @@ -15463,7 +15481,7 @@ if (tcd->needobjmap) { /* * The objmap can shuffle the argument list. We have to set the - * adressing relative from the end; -2 means last, -3 element before + * addressing relative from the end; -2 means last, -3 element before * last, etc. */ int max = objc + tcd->nr_args - inputArg; @@ -15616,8 +15634,8 @@ cmd = Tcl_GetCommandFromObj(interp, targetObj); if (cmd) { cmd = GetOriginalCommand(cmd); - fprintf(stderr, "cmd %p epoch %d deleted %.6x\n", - cmd, + fprintf(stderr, "cmd %p epoch %d deleted %.6x\n", + cmd, Tcl_Command_cmdEpoch(cmd), Tcl_Command_flags(cmd) & CMD_IS_DELETED); if (Tcl_Command_flags(cmd) & CMD_IS_DELETED) { @@ -15745,10 +15763,10 @@ * CallConfigureMethod -- * * Call a method identified by a string selector; or provide an error - * message. This dispatcher function records as well contructor (init) + * message. This dispatcher function records as well constructor (init) * calls via this interface. The dispatcher is used in XOTcl's - * configure(), interpretating arguments with a leading dash as method dispatches. - * This behaviour is now implemented in NsfOResidualargsMethod(). + * configure(), interpreting arguments with a leading dash as method dispatches. + * This behavior is now implemented in NsfOResidualargsMethod(). * * Results: * Tcl result code. @@ -15787,7 +15805,7 @@ methodName, argc+1, obj, result, TCL_ERROR);*/ if (result != TCL_OK) { - Tcl_Obj *res = Tcl_DuplicateObj(Tcl_GetObjResult(interp)); /* save the result */ + Tcl_Obj *res = Tcl_DuplicateObj(Tcl_GetObjResult(interp)); /* save the result */ INCR_REF_COUNT(res); NsfPrintError(interp, "%s during '%s.%s'", ObjStr(res), ObjectName(object), methodName); DECR_REF_COUNT(res); @@ -15833,8 +15851,8 @@ *---------------------------------------------------------------------- * CallingNameSpace -- * - * Find the last incovation outside the Next Scripting system - * namespaces. This funciton return the namesapce of the caller but + * Find the last invocation outside the Next Scripting system + * namespaces. This function return the namespace of the caller but * skips system-specific namespaces (e.g. the namespaces of the * pre-defined slot handlers for mixin and class * registration. etc.) If we would use such namespaces, we would @@ -15923,13 +15941,13 @@ if (result == TCL_OK || result == TCL_CONTINUE) { Tcl_ListObjAppendElement(interp, *outObjPtr, elementObjPtr); - /* + /* * If the refCount of the valueObj was already incremented, we have to * decrement it here, since we want the valuObj reclaimed when the list * containing the valueObj is freed. */ - ArgumentResetRefCounts(pPtr, elementObjPtr); - } else { + ArgumentResetRefCounts(pPtr, elementObjPtr); + } else { Tcl_Obj *resultObj = Tcl_GetObjResult(interp); INCR_REF_COUNT(resultObj); @@ -15956,7 +15974,8 @@ *outObjPtr = objPtr; /* - * If argument checking is turned off, and we do not have an converter, do nothing. + * If argument checking is turned off, and we do not have an converter, do + * nothing. */ if (unlikely(doCheck == 0) && (pPtr->flags & (NSF_ARG_IS_CONVERTER|NSF_ARG_INITCMD)) == 0) { /*fprintf(stderr, "*** omit argument check for arg %s flags %.6x\n", pPtr->name, pPtr->flags);*/ @@ -15999,7 +16018,7 @@ /* * The elementObjPtr differs from the input Tcl_Obj, we switch to * the version of this handler building an output list. But first, - * we have to reset the refcounts from the first conversion. + * we have to reset the ref-counts from the first conversion. */ ArgumentResetRefCounts(pPtr, elementObjPtr); *flags |= NSF_PC_MUST_DECR; @@ -16021,17 +16040,17 @@ } else { result = (*pPtr->converter)(interp, objPtr, pPtr, clientData, outObjPtr); } - + /*fprintf(stderr, "ArgumentCheck param %s type %s is converter %d flags %.6x " - "outObj changed %d (%p %p) isok %d\n", - pPtr->name, pPtr->type, pPtr->flags & NSF_ARG_IS_CONVERTER, pPtr->flags, + "outObj changed %d (%p %p) isok %d\n", + pPtr->name, pPtr->type, pPtr->flags & NSF_ARG_IS_CONVERTER, pPtr->flags, objPtr != *outObjPtr, objPtr, *outObjPtr, result == TCL_OK);*/ if ((pPtr->flags & NSF_ARG_IS_CONVERTER) && objPtr != *outObjPtr) { *flags |= NSF_PC_MUST_DECR; } else { - /* + /* * If the output obj differs from the input obj, ensure we have - * MUST_DECR set + * MUST_DECR set. */ assert( *flags & NSF_PC_MUST_DECR || objPtr == *outObjPtr ); } @@ -16059,7 +16078,7 @@ if (pcPtr->objv[i]) { /* - * We got an actual value, which was already checked by ArgumentParse() + * We got an actual value, which was already checked by ArgumentParse(). * In case the value is a switch and NSF_PC_INVERT_DEFAULT is set, we * take the default and invert the value in place. */ @@ -16070,15 +16089,15 @@ /* * Perform bookkeeping to avoid that someone releases the new obj * before we are done. The according DECR is performed by - * ParseContextRelease() + * ParseContextRelease() */ INCR_REF_COUNT2("valueObj", pcPtr->objv[i]); pcPtr->flags[i] |= NSF_PC_MUST_DECR; pcPtr->status |= NSF_PC_STATUS_MUST_DECR; } } else { /* - * No valued was passed, check if a default is available + * No valued was passed, check if a default is available. */ if (pPtr->defaultValue) { @@ -16136,7 +16155,7 @@ if (unlikely(pcPtr->objv[i] != newValue)) { /* * The output Tcl_Obj differs from the input, so the - * Tcl_Obj was converted; in case we have set prevously + * Tcl_Obj was converted; in case we have set previously * must_decr on newValue, we decr the refCount on newValue * here and clear the flag. */ @@ -16229,7 +16248,7 @@ int o, dashdash = 0, j; Nsf_Param CONST *currentParamPtr = paramPtr; Nsf_Param CONST *lastParamPtr = paramPtr + nrParams - 1; - + ParseContextInit(pcPtr, nrParams, object, objv[0]); #if defined(PARSE_TRACE) @@ -16246,32 +16265,32 @@ fprintf(stderr, "\n"); } #endif - + for (o = 1; o < objc; o++) { Nsf_Param CONST *pPtr = currentParamPtr; Tcl_Obj *argumentObj = objv[o]; - Tcl_Obj *valueObj = NULL; - char *valueInArgument = NULL; + Tcl_Obj *valueObj = NULL; + char *valueInArgument = NULL; #if defined(PARSE_TRACE_FULL) fprintf(stderr, "arg [%d]: %s\n", o, ObjStr(argumentObj)); #endif - + if (unlikely(currentParamPtr > lastParamPtr)) { - return NsfUnexpectedArgumentError(interp, ObjStr(argumentObj), + return NsfUnexpectedArgumentError(interp, ObjStr(argumentObj), (Nsf_Object*)object, paramPtr, procNameObj); } if (*currentParamPtr->name == '-') { - /* + /* * We expect a nonpos arg. Check, if we a Tcl_Obj already converted to * NsfFlagObjType. */ NsfFlag *flagPtr = argumentObj->internalRep.twoPtrValue.ptr1; #if defined(PARSE_TRACE_FULL) - fprintf(stderr, "... arg %p %s expect nonpos arg in block %s isFlag %d sig %d serial %d (%d => %d)\n", + fprintf(stderr, "... arg %p %s expect nonpos arg in block %s isFlag %d sig %d serial %d (%d => %d)\n", argumentObj, ObjStr(argumentObj), currentParamPtr->name, argumentObj->typePtr == &NsfFlagObjType, argumentObj->typePtr == &NsfFlagObjType ? flagPtr->signature == paramPtr : 0, @@ -16280,25 +16299,24 @@ serial ); #endif - if (argumentObj->typePtr == &NsfFlagObjType + if (argumentObj->typePtr == &NsfFlagObjType && flagPtr->signature == paramPtr && flagPtr->serial == serial ) { - /* + /* * The argument was processed before and the Tcl_Obj is still valid. */ if (flagPtr->flags & NSF_FLAG_DASHDAH) { - /* - * We got a dashDash, skip nonpos param defs and continue with next - * element from objv + /* + * We got a dashDash, skip nonpos param definitions and continue with next + * element from objv. */ SkipNonposParamDefs(currentParamPtr); assert(dashdash == 0); continue; } else if (flagPtr->flags & NSF_FLAG_CONTAINS_VALUE) { - /* - * We got a flag with an embedded value (e.g -flag=1). notice the - * fact + /* + * We got a flag with an embedded value (e.g -flag=1). */ valueInArgument = "flag"; } @@ -16307,23 +16325,25 @@ } else { CONST char *argumentString = ObjStr(argumentObj); - /* + /* * We are in a state, where we expect a non-positional argument, and * the lookup from the Tcl_Obj has failed. If this non-pos args are * optional, the current argument might contain also a value for a * positional argument maybe the argument is for a posarg * later). First check, if the argument looks like a flag. */ if (argumentString[0] != '-') { - /* + /* * The actual argument is not a flag, so proceed in the parameter * vector to the next block (positional parameter) */ SkipNonposParamDefs(currentParamPtr); pPtr = currentParamPtr; - /* currentParamPtr is either NULL or points to a positional parameter */ - } else { /* + * currentParamPtr is either NULL or points to a positional parameter + */ + } else { + /* * The actual argument starts with a dash, so search for the flag in * the current block of nonpos parameter definitions */ @@ -16333,7 +16353,7 @@ /* Is there a "--" ? */ if (ch1 == '-' && *(argumentString+2) == '\0' && dashdash == 0) { dashdash = 1; - NsfFlagObjSet(interp, argumentObj, paramPtr, serial, + NsfFlagObjSet(interp, argumentObj, paramPtr, serial, NULL, NULL, NSF_FLAG_DASHDAH); SkipNonposParamDefs(currentParamPtr); continue; @@ -16357,19 +16377,19 @@ valueObj = Tcl_NewStringObj(valueInArgument+1,-1); /*fprintf(stderr, "... value from argument = %s\n", ObjStr(valueObj));*/ - NsfFlagObjSet(interp, argumentObj, paramPtr, serial, + NsfFlagObjSet(interp, argumentObj, paramPtr, serial, pPtr, valueObj, NSF_FLAG_CONTAINS_VALUE); found = 1; break; } } if (!found) { Nsf_Param CONST *nextParamPtr = NextParam(currentParamPtr, lastParamPtr); - if (nextParamPtr > lastParamPtr + if (nextParamPtr > lastParamPtr || (nextParamPtr->flags & NSF_ARG_NOLEADINGDASH)) { - return NsfUnexpectedNonposArgumentError(interp, argumentString, - (Nsf_Object *)object, - currentParamPtr, paramPtr, + return NsfUnexpectedNonposArgumentError(interp, argumentString, + (Nsf_Object *)object, + currentParamPtr, paramPtr, procNameObj); } pPtr = currentParamPtr = nextParamPtr; @@ -16383,48 +16403,48 @@ for (; pPtr <= lastParamPtr && *pPtr->name == '-'; pPtr ++) { /*fprintf(stderr, "comparing '%s' with '%s'\n", argumentString, pPtr->name);*/ - if ((pPtr->flags & NSF_ARG_NOCONFIG) == 0 + if ((pPtr->flags & NSF_ARG_NOCONFIG) == 0 && ch1 == pPtr->name[1] && strcmp(argumentString, pPtr->name) == 0) { found = 1; - NsfFlagObjSet(interp, argumentObj, paramPtr, serial, + NsfFlagObjSet(interp, argumentObj, paramPtr, serial, pPtr, NULL, 0); break; } } if (!found) { Nsf_Param CONST *nextParamPtr = NextParam(currentParamPtr, lastParamPtr); /*fprintf(stderr, "non-pos-arg '%s' not found, current %p %s last %p %s next %p %s\n", - argumentString, + argumentString, currentParamPtr, currentParamPtr->name, lastParamPtr, lastParamPtr->name, nextParamPtr, nextParamPtr->name);*/ - if (nextParamPtr > lastParamPtr + if (nextParamPtr > lastParamPtr || (nextParamPtr->flags & NSF_ARG_NOLEADINGDASH)) { #if 0 - /* + /* * Currently, we can't recover from a deletion of the * parameters in the unknown handler */ int result, refcountBefore = procNameObj->refCount; /*fprintf(stderr, "### refcount of %s before -> %d objc %d\n", ObjStr(procNameObj), procNameObj->refCount, pcPtr->objc);*/ - result = NsfCallArgumentUnknownHandler(interp, + result = NsfCallArgumentUnknownHandler(interp, procNameObj, argumentObj, - object); + object); /*fprintf(stderr, "### refcount of %s after -> %d\n", ObjStr(procNameObj), procNameObj->refCount);*/ if (procNameObj->refCount != refcountBefore) { pcPtr->objc = nrParams ; /*fprintf(stderr, "trigger error pcPtr->objc %d\n", pcPtr->objc);*/ - return NsfPrintError(interp, "Unknown handler for '%s' must not alter definition", + return NsfPrintError(interp, "Unknown handler for '%s' must not alter definition", ObjStr(argumentObj)); } #endif - return NsfUnexpectedNonposArgumentError(interp, argumentString, - (Nsf_Object *)object, - currentParamPtr, paramPtr, + return NsfUnexpectedNonposArgumentError(interp, argumentString, + (Nsf_Object *)object, + currentParamPtr, paramPtr, procNameObj); } pPtr = currentParamPtr = nextParamPtr; @@ -16436,14 +16456,14 @@ } assert(pPtr); - /* + /* * pPtr points to the actual parameter (part of the currentParamPtr block) * or might point to a place past the last parameter, in which case an * unexpected argument was provided. o is the index of the actual - * parameter, valueObj might be already provided for valueInArgument + * parameter, valueObj might be already provided for valueInArgument. */ if (unlikely(pPtr > lastParamPtr)) { - return NsfUnexpectedArgumentError(interp, ObjStr(argumentObj), + return NsfUnexpectedArgumentError(interp, ObjStr(argumentObj), (Nsf_Object *)object, paramPtr, procNameObj); } @@ -16474,9 +16494,9 @@ } } - } else if (unlikely(pPtr == lastParamPtr && + } else if (unlikely(pPtr == lastParamPtr && pPtr->converter == ConvertToNothing)) { - /* + /* * "args" was given, use the varargs interface. Store the actual * argument into pcPtr->objv. No checking is performed on "args". */ @@ -16489,20 +16509,20 @@ break; } else { - /* - * Process an ordinary positional argument + /* + * Process an ordinary positional argument. */ currentParamPtr ++; #if defined(PARSE_TRACE_FULL) - fprintf(stderr, "... positional arg o %d objc %d, nrArgs %d next paramPtr %s\n", + fprintf(stderr, "... positional arg o %d objc %d, nrArgs %d next paramPtr %s\n", o, objc, pPtr->nrArgs, currentParamPtr->name); #endif if (pPtr->nrArgs == 0) { /* * Allow positional arguments with 0 args for object parameter * aliases, which are always fired. Such parameter are non-consuming, - * therfore the processing of the current argument is not finished, we + * therefore the processing of the current argument is not finished, we * have to decrement o. We have to check here if we are already at the * end if the parameter vector. */ @@ -16515,8 +16535,8 @@ } #if defined(PARSE_TRACE_FULL) - fprintf(stderr, "... setting parameter %s pos %d valueObj '%s'\n", - pPtr->name, j, + fprintf(stderr, "... setting parameter %s pos %d valueObj '%s'\n", + pPtr->name, j, valueObj == argumentObj ? "=" : ObjStr(valueObj)); #endif @@ -16528,7 +16548,7 @@ if (unlikely(ArgumentCheck(interp, valueObj, pPtr, doCheck, &pcPtr->flags[j], - &pcPtr->clientData[j], + &pcPtr->clientData[j], &pcPtr->objv[j]) != TCL_OK)) { if (pcPtr->flags[j] & NSF_PC_MUST_DECR) {pcPtr->status |= NSF_PC_STATUS_MUST_DECR;} return TCL_ERROR; @@ -16545,9 +16565,9 @@ pcPtr->flags[j] |= NSF_PC_INVERT_DEFAULT; } - /*fprintf(stderr, "... nonpositional pcPtr %p check [%d] obj %p flags %.6x & %p\n", + /*fprintf(stderr, "... non-positional pcPtr %p check [%d] obj %p flags %.6x & %p\n", pcPtr, j, pcPtr->objv[j], pcPtr->flags[j], &(pcPtr->flags[j])); */ - + /* * Provide warnings for double-settings. */ @@ -16561,14 +16581,14 @@ DECR_REF_COUNT(cmdLineObj); } pcPtr->flags[j] |= NSF_ARG_SET; - + /* - * Embed error message of converter in current context + * Embed error message of converter in current context. */ if (pcPtr->flags[j] & NSF_ARG_WARN) { Tcl_Obj *resultObj = Tcl_GetObjResult(interp); Tcl_DString ds, *dsPtr = &ds; - + Tcl_DStringInit(dsPtr); INCR_REF_COUNT(resultObj); NsfDStringArgv(dsPtr, objc, objv); @@ -16577,7 +16597,7 @@ DECR_REF_COUNT(resultObj); Tcl_DStringFree(dsPtr); } - + if (pcPtr->flags[j] & NSF_PC_MUST_DECR) { /* fprintf(stderr, "pcPtr %p setting NSF_PC_STATUS_MUST_DECR\n", pcPtr); */ pcPtr->status |= NSF_PC_STATUS_MUST_DECR; @@ -16588,16 +16608,16 @@ } #if defined(PARSE_TRACE_FULL) - fprintf(stderr, "... iterate on o %d objc %d, currentParamPtr %s\n", + fprintf(stderr, "... iterate on o %d objc %d, currentParamPtr %s\n", o, objc, currentParamPtr->name); #endif } if (currentParamPtr <= lastParamPtr && pcPtr->varArgs == 0) { /* not all parameter processed, make sure varags is set */ - - /*fprintf(stderr, ".... not all parms processed, pPtr '%s' j %ld nrParams %d last '%s' varArgs %d\n", - currentParamPtr->name, currentParamPtr - paramPtr, nrParams, lastParamPtr->name, + + /*fprintf(stderr, ".... not all parms processed, pPtr '%s' j %ld nrParams %d last '%s' varArgs %d\n", + currentParamPtr->name, currentParamPtr - paramPtr, nrParams, lastParamPtr->name, pcPtr->varArgs);*/ if (lastParamPtr->converter == ConvertToNothing) { pcPtr->varArgs = 1; @@ -16608,9 +16628,9 @@ pcPtr->objc = nrParams; #if defined(PARSE_TRACE_FULL) - fprintf(stderr, "..... argv processed o %d lastObjc %d nrParams %d olastObjc, nrParams, ovarArgs); -#endif +#endif return ArgumentDefaults(pcPtr, interp, paramPtr, nrParams); } @@ -16629,7 +16649,7 @@ hPtr = tablePtr ? Tcl_CreateHashEntry(tablePtr, (char *)patternObj, NULL) : NULL; if (hPtr) { - Var *val = TclVarHashGetValue(hPtr); + Var *val = TclVarHashGetValue(hPtr); Tcl_SetObjResult(interp, TclVarHashGetKey(val)); } else { Tcl_SetObjResult(interp, NsfGlobalObjs[NSF_EMPTY]); @@ -16640,8 +16660,8 @@ Tcl_HashSearch hSrch; hPtr = tablePtr ? Tcl_FirstHashEntry(tablePtr, &hSrch) : NULL; for (; hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { - Var *val = TclVarHashGetValue(hPtr); - Tcl_Obj *key = TclVarHashGetKey(val); + Var *val = TclVarHashGetValue(hPtr); + Tcl_Obj *key = TclVarHashGetKey(val); if (!pattern || Tcl_StringMatch(ObjStr(key), pattern)) { Tcl_ListObjAppendElement(interp, list, key); } @@ -16653,7 +16673,8 @@ static Tcl_Command GetOriginalCommand(Tcl_Command cmd) /* The imported command for which the original - * command should be returned. */ + * command should be returned. + */ { Tcl_Command importedCmd; @@ -16683,7 +16704,7 @@ } methodObj = Tcl_NewStringObj(methodName, -1); INCR_REF_COUNT(methodObj); - NsfObjErrType(interp, "info body", methodObj, "a name of a scriped method", NULL); + NsfObjErrType(interp, "info body", methodObj, "a name of a scripted method", NULL); DECR_REF_COUNT(methodObj); return TCL_ERROR; } @@ -16708,7 +16729,7 @@ * ListCmdParams -- * * Obtains a cmd and a method name and sets as side effect the Tcl result - * to either the list. The printstyle NSF_PARAMS_NAMES, NSF_PARAMS_LIST, + * to either the list. The print-style NSF_PARAMS_NAMES, NSF_PARAMS_LIST, * NSF_PARAMS_PARAMETER, NSF_PARAMS_SYNTAX controls the elements of the * list. * @@ -16735,7 +16756,7 @@ if (paramDefs && paramDefs->paramsPtr) { /* - * Obtain parameter info from paramDefs + * Obtain parameter info from paramDefs. */ list = ListParamDefs(interp, paramDefs->paramsPtr, printStyle); Tcl_SetObjResult(interp, list); @@ -16746,7 +16767,7 @@ procPtr = GetTclProcFromCommand(cmd); if (procPtr) { /* - * Obtain parameter info from compiled locals + * Obtain parameter info from compiled locals. */ CompiledLocal *args = procPtr->firstLocalPtr; @@ -16820,7 +16841,7 @@ /* * In case, we failed so far to obtain a result, try to use the - * object-system implementors definitions in the gobal array + * object-system implementors definitions in the global array * ::nsf::parametersyntax. Note that we can only obtain the * parametersyntax this way. */ @@ -16834,7 +16855,7 @@ parameterSyntaxObj = Tcl_GetVar2Ex(interp, "::nsf::parametersyntax", Tcl_DStringValue(dsPtr), TCL_GLOBAL_ONLY); - /*fprintf(stderr, "No parametersyntax so far methodname %s cmd name %s ns %s\n", + /*fprintf(stderr, "No parametersyntax so far methodName %s cmd name %s ns %s\n", methodName, Tcl_GetCommandName(interp, cmd), Tcl_DStringValue(dsPtr));*/ Tcl_DStringFree(dsPtr); @@ -16900,7 +16921,7 @@ if (withProtection) { Tcl_ListObjAppendElement(interp, listObj, Tcl_Command_flags(cmd) & NSF_CMD_CALL_PRIVATE_METHOD - ? Tcl_NewStringObj("private", 7) + ? Tcl_NewStringObj("private", 7) : Tcl_Command_flags(cmd) & NSF_CMD_CALL_PROTECTED_METHOD ? Tcl_NewStringObj("protected", 9) : Tcl_NewStringObj("public", 6)); @@ -16956,8 +16977,8 @@ } case InfomethodsubcmdDefinitionhandleIdx: { - Tcl_SetObjResult(interp, MethodHandleObj(defObject, - NsfObjectIsClass(defObject) ? withPer_object : 1, + Tcl_SetObjResult(interp, MethodHandleObj(defObject, + NsfObjectIsClass(defObject) ? withPer_object : 1, Tcl_GetCommandName(interp, cmd))); return TCL_OK; } @@ -17018,17 +17039,17 @@ NSF_METHODTYPE_ALL, CallprotectionAllIdx, 0); } } - /* all other cases return emtpy */ + /* all other cases return empty */ Tcl_SetObjResult(interp, NsfGlobalObjs[NSF_EMPTY]); return TCL_OK; } } /* - * Subcommands different per type of method. The Converter in + * The subcommands differ per type of method. The converter in * InfoMethods defines the types: * - * "all|scripted|system|alias|forwarder|object|setter" + * all|scripted|builtin|alias|forwarder|object|setter|nsfproc */ if (GetTclProcFromCommand(cmd)) { /* a scripted method */ @@ -17120,7 +17141,7 @@ } } else if (procPtr == NsfProcStub) { /* - * special nsfproc handling + * Special nsfproc handling: */ NsfProcClientData *tcd = Tcl_Command_objClientData(cmd); if (tcd && tcd->procName) { @@ -17165,11 +17186,10 @@ * The cmd must be an alias or object. * * Note that some aliases come with procPtr == NsfObjDispatch. - * In order to dinstinguish between "object" and alias, we have + * In order to distinguish between "object" and alias, we have * to do the lookup for the entryObj to determine wether it is * really an alias. */ - Tcl_Obj *entryObj; entryObj = AliasGet(interp, defObject->cmdName, @@ -17236,7 +17256,7 @@ } } else { /* - * Should never happen + * Should never happen. * * The warning is just a guess, so we don't raise an error here. */ @@ -17276,8 +17296,9 @@ } if (cl == NULL) { - /* If the method is object specific, it can't be from a baseclass - * and must be application specfic. + /* + * If the method is object specific, it can't be from a baseclass and must + * be application specific. */ return (withSource == SourceApplicationIdx && !IsBaseClass((NsfClass *)object)); } @@ -17398,7 +17419,7 @@ * * ListMethodKeys -- * - * List the method names contained in the specified hash table + * List the method names contained in the specified hash-table * according to the filtering options (types, pattern, * protection, etc.). Optionally, a name prefix can be provided * in form of a Tcl_DString. The result is placed into the interp @@ -17430,7 +17451,7 @@ if (pattern && NoMetaChars(pattern) && strchr(pattern, ' ') == NULL) { /* * We have a pattern that can be used for direct lookup; no need - * to iterate + * to iterate. */ hPtr = Tcl_CreateHashEntry(tablePtr, pattern, NULL); if (hPtr) { @@ -17795,7 +17816,7 @@ * AliasDeleteObjectReference -- * * Delete an alias to an referenced object. Such aliases are - * created by registering an alias to an object. This funciton + * created by registering an alias to an object. This function * distinguishes between a sub-object and an alias to an object, * deletes the alias but never the referenced object. * @@ -17836,7 +17857,7 @@ /* cmd __db_compile_epoch NsfDebugCompileEpoch {} */ -static int +static int NsfDebugCompileEpoch(Tcl_Interp *interp) { Interp *iPtr = (Interp *) interp; @@ -17849,24 +17870,24 @@ {-argName "obj" -required 1 -type tclobj} } */ -static int +static int NsfDebugShowObj(Tcl_Interp *interp, Tcl_Obj *objPtr) { - + fprintf(stderr, "*** obj %p refCount %d type <%s>\n", - objPtr, objPtr->refCount, + objPtr, objPtr->refCount, objPtr->typePtr ? objPtr->typePtr->name : ""); if (objPtr->typePtr == &NsfObjectMethodObjType || objPtr->typePtr == &NsfInstanceMethodObjType ) { NsfMethodContext *mcPtr = objPtr->internalRep.twoPtrValue.ptr1; - int currentMethodEpoch = objPtr->typePtr == &NsfObjectMethodObjType ? + int currentMethodEpoch = objPtr->typePtr == &NsfObjectMethodObjType ? RUNTIME_STATE(interp)->objectMethodEpoch : RUNTIME_STATE(interp)->instanceMethodEpoch; Tcl_Command cmd = mcPtr->cmd; fprintf(stderr, " method epoch %d max %d cmd %p objProc %p flags %.6x\n", - mcPtr->methodEpoch, currentMethodEpoch, + mcPtr->methodEpoch, currentMethodEpoch, cmd, cmd ? ((Command *)cmd)->objProc : 0, mcPtr->flags); if (cmd) { @@ -17895,8 +17916,8 @@ NsfObjectSystem *osPtr; NsfCmdList *instances = NULL, *entry; - /* - * Collect all instances from all object systems + /* + * Collect all instances from all object systems. */ for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr; osPtr = osPtr->nextPtr) { GetAllInstances(interp, &instances, osPtr->rootClass); @@ -17938,7 +17959,7 @@ if (count != object->activationCount) { fprintf(stderr, "DEBUG obj %p %s activationcount %d on stack %d; " - "might be from non-stacked but active callstack content\n", + "might be from non-stacked but active call-stack content\n", object, ObjectName(object), object->activationCount, count); fprintf(stderr, "fixed count %d\n", count); /*NsfShowStack(interp);*/ @@ -18086,7 +18107,7 @@ } /* - * All other configure options are boolean + * All other configure options are boolean. */ if (valueObj) { int result = Tcl_GetBooleanFromObj(interp, valueObj, &bool); @@ -18165,28 +18186,28 @@ if (unlikely(self == NULL)) { return NsfNoCurrentObjectError(interp, methodName); } - /*fprintf(stderr, "Colon dispatch %s.%s (%d)\n", + /*fprintf(stderr, "Colon dispatch %s.%s (%d)\n", ObjectName(self), ObjStr(nobjv[0]), nobjc);*/ if (likely(!(*methodName == ':' && *(methodName + 1) == '\0'))) { return ObjectDispatch(self, interp, nobjc, nobjv, NSF_CM_NO_SHIFT); } - /* - * first arg is a single colon + /* + * First arg is a single colon. */ if (nobjc <= 1) { Tcl_SetObjResult(interp, self->cmdName); return TCL_OK; } - + /* - * multiple arguments were given + * Multiple arguments were given. */ methodName = ObjStr(nobjv[1]); if (*methodName != '-') { /* - * no need to parse arguments (local, intrinsic, ...) + * No need to parse arguments (local, intrinsic, ...). */ return ObjectDispatch(self, interp, nobjc, nobjv, 0); } else { @@ -18195,29 +18216,29 @@ Tcl_Obj *methodObj; /* - * parse arguments, use definitions from nsf::my + * Parse arguments, use definitions from nsf::my */ - if (ArgumentParse(interp, nobjc, nobjv, NULL, nobjv[0], - method_definitions[NsfMyCmdIdx].paramDefs, + if (ArgumentParse(interp, nobjc, nobjv, NULL, nobjv[0], + method_definitions[NsfMyCmdIdx].paramDefs, method_definitions[NsfMyCmdIdx].nrParameters, 0, 1, &pc) != TCL_OK) { return TCL_ERROR; } - + withIntrinsic = (int )PTR2INT(pc.clientData[0]); withLocal = (int )PTR2INT(pc.clientData[1]); withSystem = (int )PTR2INT(pc.clientData[2]); methodObj = (Tcl_Obj *)pc.clientData[3]; - + assert(pc.status == 0); - + if ((withIntrinsic && withLocal) - || (withIntrinsic && withSystem) + || (withIntrinsic && withSystem) || (withLocal && withSystem)) { return NsfPrintError(interp, "flags '-intrinsic', '-local' and '-system' are mutual exclusive"); } - + flags = NSF_CSC_IMMEDIATE; if (withIntrinsic) {flags |= NSF_CM_INTRINSIC_METHOD;} if (withLocal) {flags |= NSF_CM_LOCAL_METHOD;} @@ -18238,7 +18259,7 @@ /*fprintf(stderr, "+++ call tcl-defined exit handler\n"); */ /* - * evaluate user-defined exit handler + * Evaluate user-defined exit handler. */ result = Tcl_Eval(interp, "::nsf::__exithandler"); @@ -18291,7 +18312,7 @@ if (isCreateString(name)) { /* * The command was an interp create, so perform an Nsf_Init() on - * the new interpreter + * the new interpreter. */ slave = Tcl_GetSlave(interp, ObjStr(objv[2])); if (!slave) { @@ -18336,7 +18357,7 @@ if (paramPtr == NULL) { /* * We could not convert the arguments. Even with noComplain, we - * report the invalid converter spec as exception + * report the invalid converter spec as exception. */ return TCL_ERROR; } @@ -18388,24 +18409,24 @@ assert(objProc); /* objProc is either ... + * + * 1. NsfObjDispatch: a command representing an Next Scripting object + * + * 2. TclObjInterpProc: a cmd standing for a Tcl proc (including + * Next Scripting methods), verified through CmdIsProc() -> to be + * wrapped by NsfProcAliasMethod() + * + * 3. NsfForwardMethod: an Next Scripting forwarder + * + * 4. NsfSetterMethod: an Next Scripting setter + * + * 5. arbitrary Tcl commands (e.g. set, ..., ::nsf::relation, ...) + * + * TODO GN: i think, we should use NsfProcAliasMethod, whenever the clientData + * is not 0. These are the cases, where the clientData will be freed, + * when the original command is deleted. + */ - 1. NsfObjDispatch: a command representing an Next Scripting object - - 2. TclObjInterpProc: a cmd standing for a Tcl proc (including - Next Scripting methods), verified through CmdIsProc() -> to be - wrapped by NsfProcAliasMethod() - - 3. NsfForwardMethod: an Next Scripting forwarder - - 4. NsfSetterMethod: an Next Scripting setter - - 5. arbitrary Tcl commands (e.g. set, ..., ::nsf::relation, ...) - - TODO GN: i think, we should use NsfProcAliasMethod, whenever the clientData - is not 0. These are the cases, where the clientData will be freed, - when the original command is deleted. - */ - if (withFrame == FrameObjectIdx) { newObjProc = NsfObjscopedMethod; } @@ -18420,7 +18441,7 @@ if (oldCmd != NULL) { oldTargetObject = NsfGetObjectFromCmdPtr(oldCmd); - /*fprintf(stderr, "oldTargetObject %p flags %.6x newTargetObject %p\n", + /*fprintf(stderr, "oldTargetObject %p flags %.6x newTargetObject %p\n", oldTargetObject, oldTargetObject ? oldTargetObject->flags : 0, newTargetObject);*/ /* @@ -18430,7 +18451,7 @@ */ if (oldTargetObject != NULL && oldTargetObject != newTargetObject) { - /*fprintf(stderr, "--- releasing old target object %p refCount %d\n", + /*fprintf(stderr, "--- releasing old target object %p refCount %d\n", oldTargetObject, oldTargetObject->refCount);*/ assert(oldTargetObject->refCount > 0); AliasDeleteObjectReference(interp, oldCmd); @@ -18449,7 +18470,7 @@ if (oldTargetObject != newTargetObject) { NsfObjectRefCountIncr(newTargetObject); } - + } else if (CmdIsProc(cmd)) { /* * When we have a Tcl proc|nsf-method as alias, then use the @@ -18728,15 +18749,15 @@ Tcl_Command cmd; NsfClass *cl = withPer_object == 0 && NsfObjectIsClass(object) ? (NsfClass *)object : NULL; int flag, fromClassNS = cl != NULL; - + cmd = ResolveMethodName(interp, cl ? cl->nsPtr : object->nsPtr, methodObj, NULL, NULL, &defObject, NULL, &fromClassNS); /*fprintf(stderr, "methodProperty for method '%s' prop %d value %s => cl %p cmd %p\n", methodName, methodproperty, valueObj ? ObjStr(valueObj) : "NULL", cl, cmd);*/ if (!cmd) { - return NsfPrintError(interp, "Cannot lookup %smethod '%s' for %s", + return NsfPrintError(interp, "Cannot lookup %s method '%s' for %s", cl == 0 ? "object " : "", methodName, ObjectName(object)); } @@ -18750,19 +18771,19 @@ int impliedSetFlag = 0, impliedClearFlag = 0; switch (methodproperty) { - case MethodpropertyClass_onlyIdx: - flag = NSF_CMD_CLASS_ONLY_METHOD; + case MethodpropertyClass_onlyIdx: + flag = NSF_CMD_CLASS_ONLY_METHOD; break; case MethodpropertyCall_privateIdx: - flag = NSF_CMD_CALL_PRIVATE_METHOD; - impliedSetFlag = NSF_CMD_CALL_PROTECTED_METHOD; + flag = NSF_CMD_CALL_PRIVATE_METHOD; + impliedSetFlag = NSF_CMD_CALL_PROTECTED_METHOD; break; - case MethodpropertyCall_protectedIdx: + case MethodpropertyCall_protectedIdx: impliedClearFlag = NSF_CMD_CALL_PRIVATE_METHOD; - flag = NSF_CMD_CALL_PROTECTED_METHOD; + flag = NSF_CMD_CALL_PROTECTED_METHOD; break; - case MethodpropertyRedefine_protectedIdx: - flag = NSF_CMD_REDEFINE_PROTECTED_METHOD; + case MethodpropertyRedefine_protectedIdx: + flag = NSF_CMD_REDEFINE_PROTECTED_METHOD; break; default: flag = 0; } @@ -18852,9 +18873,9 @@ /* acquire new paramDefs */ paramDefs = ParamDefsNew(); ParamDefsStore(cmd, paramDefs); - /*fprintf(stderr, "new param defs %p for cmd %p %s\n", paramDefs, cmd, methodName);*/ + /*fprintf(stderr, "new param definitions %p for cmd %p %s\n", paramDefs, cmd, methodName);*/ } - objPtr = + objPtr = methodproperty == MethodpropertySlotobjIdx ? ¶mDefs->slotObj : ¶mDefs->returns; @@ -18894,7 +18915,7 @@ /* * In case the provided cmd is fully qualified and refers to a registered * method, the function returns the object, on which the method was - * registed. + * resisted. */ Tcl_SetObjResult(interp, (cmd && regObject) ? regObject->cmdName : NsfGlobalObjs[NSF_EMPTY]); @@ -18978,7 +18999,7 @@ } */ static int -NsfDirectDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withFrame, +NsfDirectDispatchCmd(Tcl_Interp *interp, NsfObject *object, int withFrame, Tcl_Obj *commandObj, int nobjc, Tcl_Obj *CONST nobjv[]) { int result; CONST char *methodName = ObjStr(commandObj); @@ -18995,7 +19016,7 @@ } /* - * We have a fully qualified name of a Tcl command that will be dispatched. + * We have a fully qualified name of a Tcl command that will be dispatched. */ cmd = Tcl_GetCommandFromObj(interp, commandObj); @@ -19030,9 +19051,9 @@ } } - /* - * If "withFrame == FrameObjectIdx" is specified, a callstack frame is - * pushed to make instvars accessible for the command. + /* + * 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); @@ -19041,7 +19062,7 @@ /* * 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() + * nobjv-1; this way, we avoid a memcpy(). */ if (useCmdDispatch) { @@ -19055,9 +19076,9 @@ result = CmdMethodDispatch(object, interp, nobjc+1, nobjv-1, object, cmd, NULL); } else { - /* - * If "withFrame == FrameMethodIdx" is specified, a callstack frame is - * pushed to make instvars accessible for the command. + /* + * 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; @@ -19088,12 +19109,12 @@ } */ static int -NsfDispatchCmd(Tcl_Interp *interp, NsfObject *object, +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", + /*fprintf(stderr, "NsfDispatchCmd obj=%s, cmd m='%s' nobjc %d\n", ObjectName(object), ObjStr(commandObj), nobjc);*/ if (withIntrinsic && withSystem) { @@ -19102,17 +19123,17 @@ /* * Dispatch the command the method from the precedence order, with filters - * etc. -- strictly speaking unneccessary, but this function can be used to + * 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() + * nobjv-1; this way, we avoid a memcpy(). */ return ObjectDispatch(object, interp, nobjc+1, nobjv-1, flags); } @@ -19151,9 +19172,9 @@ case ObjectpropertyRootclassIdx: flags = NSF_IS_ROOT_CLASS; break; case ObjectpropertySlotcontainerIdx: flags = NSF_IS_SLOT_CONTAINER; break; } - - Tcl_SetObjResult(interp, - NsfGlobalObjs[(object->flags & flags) ? + + Tcl_SetObjResult(interp, + NsfGlobalObjs[(object->flags & flags) ? NSF_ONE : NSF_ZERO]); return TCL_OK; } @@ -19302,8 +19323,8 @@ } */ static int -NsfMyCmd(Tcl_Interp *interp, - int withIntrinsic, int withLocal, int withSystem, +NsfMyCmd(Tcl_Interp *interp, + int withIntrinsic, int withLocal, int withSystem, Tcl_Obj *methodObj, int nobjc, Tcl_Obj *CONST nobjv[]) { NsfObject *self = GetSelfObj(interp); int flags, result; @@ -19313,7 +19334,7 @@ } if ((withIntrinsic && withLocal) - || (withIntrinsic && withSystem) + || (withIntrinsic && withSystem) || (withLocal && withSystem)) { return NsfPrintError(interp, "flags '-intrinsic', '-local' and '-system' are mutual exclusive"); } @@ -19430,7 +19451,7 @@ ObjStr(toNs)); } /* - * copy all procs & commands in the ns + * Copy all procs & commands in the namespace. */ cmdTablePtr = Tcl_Namespace_cmdTablePtr(fromNsPtr); hPtr = Tcl_FirstHashEntry(cmdTablePtr, &hSrch); @@ -19439,7 +19460,7 @@ name = Tcl_GetHashKey(cmdTablePtr, hPtr); /* - * construct full cmd names + * Construct full cmd names. */ newFullCmdName = Tcl_NewStringObj(toNsPtr->fullName, -1); oldFullCmdName = Tcl_NewStringObj(fromNsPtr->fullName, -1); @@ -19453,7 +19474,7 @@ /*fprintf(stderr, "try to copy command from '%s' to '%s'\n", oldName, newName);*/ /* * Make sure that the destination command does not already exist. - * Otherwise: do not copy + * Otherwise: do not copy. */ cmd = Tcl_FindCommand(interp, newName, NULL, TCL_GLOBAL_ONLY); if (cmd) { @@ -19472,7 +19493,7 @@ /* * Find the existing command. An error is returned if simpleName can't - * be found + * be found. */ cmd = Tcl_FindCommand(interp, oldName, NULL, TCL_GLOBAL_ONLY); if (cmd == NULL) { @@ -19482,7 +19503,7 @@ return TCL_ERROR; } /* - * Do not copy Objects or Classes + * Do not copy Objects or Classes. */ if (!GetObjectFromString(interp, oldName)) { @@ -19492,7 +19513,7 @@ int result; /* - * Build a list containing the arguments of the proc + * Build a list containing the arguments of the proc. */ result = ListCmdParams(interp, cmd, oldName, NSF_PARAMS_PARAMETER); if (result != TCL_OK) { @@ -19569,7 +19590,7 @@ } } else { /* - * Otherwise copy command + * Otherwise copy command. */ Tcl_ObjCmdProc *objProc = Tcl_Command_objProc(cmd); Tcl_CmdDeleteProc *deleteProc = Tcl_Command_deleteProc(cmd); @@ -19875,7 +19896,7 @@ /* todo: need to remove these properties? - allow to delete a classystem at runtime? + allow to delete a class system at runtime? */ } } @@ -19913,12 +19934,12 @@ object->flags &= ~NSF_MIXIN_ORDER_VALID; /* - * since mixin procs may be used as filters -> we have to invalidate + * Since mixin procs may be used as filters -> we have to invalidate. */ object->flags &= ~NSF_FILTER_ORDER_VALID; /* - * now add the specified mixins + * Now add the specified mixins. */ objopt->objMixins = newMixinCmdList; for (i = 0; i < oc; i++) { @@ -19979,15 +20000,15 @@ * Since methods of mixed in classes may be used as filters, we have to * invalidate the filters as well. */ - if (FiltersDefined(interp) > 0) { + if (FiltersDefined(interp) > 0) { FilterInvalidateObjOrders(interp, cl, subClasses); } NsfClassListFree(subClasses); clopt->classMixins = newMixinCmdList; for (i = 0; i < oc; i++) { Tcl_Obj *ocl = NULL; - /* fprintf(stderr, "Added to classmixins of %s: %s\n", + /* fprintf(stderr, "Added to class-mixins of %s: %s\n", ClassName(cl), ObjStr(ov[i])); */ Tcl_ListObjIndex(interp, ov[i], 0, &ocl); @@ -20008,7 +20029,7 @@ if (clopt->classFilters) { CmdListFree(&clopt->classFilters, GuardDel); } - if (FiltersDefined(interp) > 0) { + if (FiltersDefined(interp) > 0) { NsfClasses *subClasses = TransitiveSubClasses(cl); FilterInvalidateObjOrders(interp, cl, subClasses); NsfClassListFree(subClasses); @@ -20032,7 +20053,7 @@ */ static int NsfCurrentCmd(Tcl_Interp *interp, int selfoption) { - NsfObject *object = GetSelfObj(interp); + NsfObject *object = GetSelfObj(interp); NsfCallStackContent *cscPtr; Tcl_CallFrame *framePtr; int result = TCL_OK; @@ -20124,13 +20145,13 @@ cscPtr = NsfCallStackFindLastInvocation(interp, 1, &framePtr); if (cscPtr && cscPtr->cmdPtr) { Tcl_Obj *methodNameObj = Tcl_NewStringObj(Tcl_GetCommandName(interp, cscPtr->cmdPtr), -1); - /* + /* * By checking the characteristic frame and call type pattern for "leaf" * ensemble dispatches, we make sure that the method path is only * reported for these cases. Otherwise, we constrain the result to the * method name. */ - if ((cscPtr->frameType & NSF_CSC_TYPE_ENSEMBLE) && + if ((cscPtr->frameType & NSF_CSC_TYPE_ENSEMBLE) && (cscPtr->flags & NSF_CSC_CALL_IS_COMPILE) == 0) { resultObj = CallStackMethodPath(interp, framePtr); result = Tcl_ListObjAppendElement(interp, resultObj, methodNameObj); @@ -20215,12 +20236,12 @@ cmd var::exists NsfVarExistsCmd { {-argName "-array" -required 0 -nrargs 0} {-argName "object" -required 1 -type object} - {-argName "varname" -required 1} + {-argName "varName" -required 1} } */ static int NsfVarExistsCmd(Tcl_Interp *interp, int withArray, NsfObject *object, CONST char *varName) { - int flags = + int flags = NSF_VAR_TRIGGER_TRACE|NSF_VAR_REQUIRE_DEFINED| (withArray ? NSF_VAR_ISARRAY : 0); @@ -20243,19 +20264,19 @@ int i, result = TCL_OK; for (i = 0; i < objc && result == TCL_OK; i++) { - Tcl_Obj **ov; + Tcl_Obj **ov; int oc; /*fprintf(stderr, "ListGetElements %p %s\n", objv[i], ObjStr(objv[i]));*/ if ((result = Tcl_ListObjGetElements(interp, objv[i], &oc, &ov)) == TCL_OK) { - Tcl_Obj *varname = NULL, *alias = NULL; + Tcl_Obj *varName = NULL, *alias = NULL; switch (oc) { - case 0: {varname = objv[i]; break;} - case 1: {varname = ov[0]; break;} - case 2: {varname = ov[0]; alias = ov[1]; break;} + case 0: {varName = objv[i]; break;} + case 1: {varName = ov[0]; break;} + case 2: {varName = ov[0]; alias = ov[1]; break;} } - if (varname) { - result = GetInstVarIntoCurrentScope(interp, cmdName, object, varname, alias); + if (varName) { + result = GetInstVarIntoCurrentScope(interp, cmdName, object, varName, alias); } else { assert(objv[i]); result = NsfPrintError(interp, "invalid variable specification '%s'", ObjStr(objv[i])); @@ -20275,29 +20296,29 @@ cmd var::set NsfVarSetCmd { {-argName "-array" -required 0 -nrargs 0} {-argName "object" -required 1 -type object} - {-argName "varname" -required 1 -type tclobj} + {-argName "varName" -required 1 -type tclobj} {-argName "value" -required 0 -type tclobj} } */ static int NsfVarSetCmd(Tcl_Interp *interp, int withArray, - NsfObject *object, Tcl_Obj *varname, Tcl_Obj *valueObj) { + NsfObject *object, Tcl_Obj *varName, Tcl_Obj *valueObj) { - if (CheckVarName(interp, ObjStr(varname)) != TCL_OK) { + if (CheckVarName(interp, ObjStr(varName)) != TCL_OK) { return TCL_ERROR; } if (withArray) { - return SetInstArray(interp, object, varname, valueObj); + return SetInstArray(interp, object, varName, valueObj); } else { - return SetInstVar(interp, object, varname, valueObj); + return SetInstVar(interp, object, varName, valueObj); } } /* cmd var::unset NsfVarUnsetCmd { {-argName "-nocomplain" -required 0 -nrargs 0} {-argName "object" -required 1 -type object} - {-argName "varname" -required 1 -type tclobj} + {-argName "varName" -required 1 -type tclobj} } */ static int @@ -20374,7 +20395,7 @@ *---------------------------------------------------------------------- * ParamSetFromAny2 -- * - * Convert the second argment argument (e.g. "x:integer") into the + * Convert the second argument argument (e.g. "x:integer") into the * internal representation of a Tcl_Obj of the type parameter. The * conversion is performed by the usual ParamParse() function, used * e.g. for the parameter passing for arguments. @@ -20391,7 +20412,7 @@ static int ParamSetFromAny2( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ - const char *varNamePrefix, /* shows up as varname in error message */ + const char *varNamePrefix, /* shows up as varName in error message */ register Tcl_Obj *objPtr) /* The object to convert. */ { Tcl_Obj *fullParamObj = Tcl_NewStringObj(varNamePrefix, -1); @@ -20480,12 +20501,12 @@ * * a) on class cleanup: ParsedParamFree(cl->parsedParamPtr) * b) on class structure changes, - * c) when classmixins are added, + * c) when class-mixins are added, * d) when new slots are defined, * e) when slots are removed * * When slot defaults or types are changed, the slots have to - * perform a manual "::nsf::invalidateobjectparameter $domain" + * perform a manual "::nsf::invalidateobjectparameter $domain". */ /* @@ -20654,9 +20675,9 @@ */ static int NsfOCleanupMethod(Tcl_Interp *interp, NsfObject *object) { - NsfClass *cl = NsfObjectToClass(object); - int softrecreate; + NsfClass *cl = NsfObjectToClass(object); Tcl_Obj *savedNameObj; + int softrecreate; #if defined(OBJDELETION_TRACE) fprintf(stderr, "+++ NsfOCleanupMethod\n"); @@ -20720,33 +20741,33 @@ } else { initString = ObjStr(initMethodObj); } - - /* + + /* * The effective call site of the configure() method (e.g., a proc or a - * method) can result from upleveling the object creation procedure; + * method) can result from up-leveling the object creation procedure; * therefore, the *effective* call site can deviate from the *declaring* * call site (e.g. as in XOTcl2's unknown method). In such a scenario, the - * configure() dispatch finds itself in a particular callstack + * configure() dispatch finds itself in a particular call-stack * configuration: The top-most frame reflects the declaring call site * (interp->framePtr), while the effective call site (interp->varFramePtr) - * is identified by a lower callstack level. + * is identified by a lower call-stack level. * * Since configure pushes an object frame (for accessing the instance * variables) and sometimes a CMETHOD frame (for method invocations) we * record a) whether there was a preceding uplevel (identifiable through * deviating interp->framePtr and interp->varFramePtr) and, in case, b) the - * ruling variable frame context. The preserved callframe reference can + * ruling variable frame context. The preserved call-frame reference can * later be used to restore the uplevel'ed call frame context. - */ + */ - uplevelVarFramePtr = - (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp) != Tcl_Interp_framePtr(interp) - ? Tcl_Interp_varFramePtr(interp) - : NULL; - - /* - * Push frame to allow for [self] and make instvars of obj accessible as - * locals + uplevelVarFramePtr = + (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp) != Tcl_Interp_framePtr(interp) + ? Tcl_Interp_varFramePtr(interp) + : NULL; + + /* + * Push frame to allow for [self] and make instance variables of obj accessible as + * locals. */ Nsf_PushFrameObj(interp, object, framePtr); @@ -20772,11 +20793,11 @@ for (i = 1, paramPtr = paramDefs->paramsPtr; paramPtr->name; paramPtr++, i++) { /* - * Set the new value always when the object is not yet initialized - * and the new value was specified (was not taken from the default - * value definition). The second part of the test is needed to - * avoid overwriting with default values when e.g. "o configure" - * is called lated without arguments. + * Set the new value always when the object is not yet initialized and the + * new value was specified (was not taken from the default value + * definition). The second part of the test is needed to avoid + * overwriting with default values when e.g. "o configure" is called lated + * without arguments. */ /*fprintf(stderr, "[%d] param %s, object init called %d is default %d value = '%s' nrArgs %d\n", i, paramPtr->name, (object->flags & NSF_INIT_CALLED), @@ -20832,15 +20853,15 @@ } /* - * The current callframe of configure uses an objframe, such + * The current call-frame of configure uses an obj-frame, such * that setvar etc. are able to access variables like "a" as a * local variable. However, in the init block, we do not like * that behavior, since this should look like like a proc body. - * So we push yet another callframe without providing the - * varframe. + * So we push yet another call-frame without providing the + * var-frame. * * The new frame will have the namespace of the caller to avoid - * the current objframe. Nsf_PushFrameCsc() will establish a + * the current obj-frame. Nsf_PushFrameCsc() will establish a * CMETHOD frame. */ @@ -20863,15 +20884,15 @@ * Restore the variable frame context as found at the original call * site of configure(). Note that we do not have to revert this * context change when leaving this configure() context because a - * surrounding [uplevel] will correct the callstack context for us ... + * surrounding [uplevel] will correct the call-stack context for us ... */ if (uplevelVarFramePtr) { Tcl_Interp_varFramePtr(interp) = uplevelVarFramePtr; } /* * Mark the intermittent CSC frame as INACTIVE, so that, e.g., - * callstack traversals seeking active frames ignore it. + * call-stack traversals seeking active frames ignore it. */ cscPtr->frameType = NSF_CSC_TYPE_INACTIVE; @@ -20893,7 +20914,7 @@ */ if (newValue == paramPtr->defaultValue) { /* - * use the default + * Use the default. */ if (Tcl_ListObjGetElements(interp, paramPtr->defaultValue, &oc, &ovPtr) != TCL_OK) { goto method_arg_done; @@ -20902,7 +20923,7 @@ ovPtr ++; } else { /* - * use actual args + * Use actual args. */ ov0 = objv[pc.lastObjc]; ovPtr = (Tcl_Obj **)&objv[pc.lastObjc + 1]; @@ -20936,7 +20957,7 @@ /*fprintf(stderr, "call alias %s with methodObj %s.%s oc %d, nrArgs %d '%s'\n", paramPtr->name, ObjectName(object), ObjStr(methodObj), oc, paramPtr->nrArgs, ObjStr(newValue));*/ - + result = NsfCallMethodWithArgs(interp, (Nsf_Object*)object, methodObj, ov0, oc, ovPtr, NSF_CSC_IMMEDIATE); } @@ -20995,7 +21016,7 @@ /* * Mark the intermittent CSC frame as INACTIVE, so that, e.g., - * callstack traversals seeking active frames ignore it. + * call-stack traversals seeking active frames ignore it. */ cscPtr->frameType = NSF_CSC_TYPE_INACTIVE; @@ -21043,11 +21064,12 @@ */ if (i < paramDefs->nrParams || !pc.varArgs) { #if defined(CONFIGURE_ARGS_TRACE) - fprintf(stderr, "*** %s SET %s '%s'\n", + fprintf(stderr, "*** %s SET %s '%s'\n", ObjectName(object), ObjStr(paramPtr->nameObj), ObjStr(newValue)); #endif /* - * Actually set instance variable with the provided value or default value. + * Actually set instance variable with the provided value or default + * value. */ Tcl_ObjSetVar2(interp, paramPtr->nameObj, NULL, newValue, TCL_LEAVE_ERR_MSG|TCL_PARSE_PART1); } @@ -21121,13 +21143,13 @@ /* objectMethod exists NsfOExistsMethod { - {-argName "varname" -required 1} + {-argName "varName" -required 1} } */ static int NsfOExistsMethod(Tcl_Interp *interp, NsfObject *object, CONST char *var) { - Tcl_SetIntObj(Tcl_GetObjResult(interp), - VarExists(interp, object, var, NULL, + Tcl_SetIntObj(Tcl_GetObjResult(interp), + VarExists(interp, object, var, NULL, NSF_VAR_TRIGGER_TRACE|NSF_VAR_REQUIRE_DEFINED)); return TCL_OK; } @@ -21176,7 +21198,7 @@ if (!Tcl_Interp_varFramePtr(interp)) { CallStackRestoreSavedFrames(interp, &ctx); - return NsfPrintError(interp, "instvar used on %s, but callstack is not in procedure scope", + return NsfPrintError(interp, "instvar used on %s, but call-stack is not in procedure scope", ObjectName(object)); } @@ -21320,12 +21342,12 @@ } /* - * Call init with residual args in case it was not called yet + * Call init with residual args in case it was not called yet. */ result = DispatchInitMethod(interp, object, normalArgs, objv+1, 0); /* - * Return the non-processed leading arguments (XOTcl convention) + * Return the non-processed leading arguments (XOTcl convention). */ Tcl_SetObjResult(interp, Tcl_NewListObj(normalArgs, objv+1)); @@ -21500,7 +21522,7 @@ NsfObject *newObj; /* - * create a new object from scratch + * Create a new object from scratch. */ assert(isAbsolutePath(nameString)); @@ -21552,7 +21574,7 @@ int result; /* - * create a new object from scratch + * Create a new object from scratch. */ /*fprintf(stderr, " **** class '%s' wants to alloc '%s'\n", ClassName(cl), nameString);*/ @@ -21561,7 +21583,7 @@ } /* - * If the path is not absolute, we add the appropriate namespace + * If the path is not absolute, we add the appropriate namespace. */ if (isAbsolutePath(nameString)) { tmpName = NULL; @@ -21609,14 +21631,14 @@ /*fprintf(stderr, "NsfCCreateMethod specifiedName %s\n", specifiedName);*/ /* - * complete the name if it is not absolute + * Complete the name if it is not absolute. */ if (!isAbsolutePath(nameString)) { parentNsPtr = CallingNameSpace(interp); tmpObj = NameInNamespaceObj(interp, nameString, parentNsPtr); /* * If the name contains colons, the parentNsPtr is not appropriate - * for determining the parent + * for determining the parent. */ if (strchr(nameString, ':')) { parentNsPtr = NULL; @@ -21636,7 +21658,7 @@ /* * Check whether we have to call recreate (i.e. when the - * object exists already) + * object exists already). */ newObject = GetObjectFromString(interp, nameString); @@ -21647,14 +21669,15 @@ newObject ? IsMetaClass(interp, newObject->cl, 1) : 0 );*/ - /* don't allow to - - recreate an object as a class, - - recreate a class as an object, and to - - recreate an object in a different object system + /* + * Don't allow to + * - recreate an object as a class, + * - recreate a class as an object, and to + * - recreate an object in a different object system + * + * In these clases, we use destroy followed by create instead of recreate. + */ - In these clases, we use destroy + create instead of recrate. - */ - if (newObject && (IsMetaClass(interp, cl, 1) == IsMetaClass(interp, newObject->cl, 1)) && GetObjectSystem(newObject) == cl->osPtr) { @@ -21684,7 +21707,7 @@ } else { /* * newObject might exist here, but will be automatically destroyed by - * alloc + * alloc. */ /*fprintf(stderr, "alloc ... %s newObject %p \n", ObjStr(nameObj), newObject);*/ @@ -21759,7 +21782,6 @@ if (h) { NsfClasses *subClasses = TransitiveSubClasses(cl); - fprintf(stderr, "NsfCFilterGuardMethod calls ComputeOrderSubclasses\n"); if (h->clientData) { GuardDel(h); } @@ -21800,7 +21822,6 @@ GuardDel((NsfCmdList *) h); } GuardAdd(h, guardObj); - fprintf(stderr, "NsfCMixinGuardMethod calls ComputeOrderSubclasses\n"); subClasses = TransitiveSubClasses(cl); MixinInvalidateObjOrders(interp, cl, subClasses); NsfClassListFree(subClasses); @@ -21870,7 +21891,7 @@ } /* * In case the symbol existed already, reset prefix to the - * original length + * original length. */ Tcl_DStringSetLength(dsPtr, prefixLength); } @@ -21925,19 +21946,19 @@ * * Check whether we have a pending destroy on the object; if yes, * clear it, such that the recreated object and won't be destroyed - * on a POP + * on a POP. */ MarkUndestroyed(object); /* - * ensure correct class for object + * Ensure correct class for object. */ result = ChangeClass(interp, object, class); if (result == TCL_OK) { Tcl_Obj *methodObj; /* - * dispatch "cleanup" method + * Dispatch "cleanup" method. */ if (CallDirectly(interp, object, NSF_o_cleanup_idx, &methodObj)) { /*fprintf(stderr, "RECREATE calls cleanup directly for object %s\n", ObjectName(object));*/ @@ -21952,7 +21973,7 @@ } /* - * Second: if cleanup was successful, initialize the object as usual + * Second: if cleanup was successful, initialize the object as usual. */ if (result == TCL_OK) { result = DoObjInitialization(interp, object, objc, objv); @@ -22168,8 +22189,8 @@ NsfClass *fcl; /* - * Searches for filter on [self] and returns fully qualified name - * if it is not found it returns an empty string + * Searches for filter on [self] and returns fully qualified name if it is + * not found it returns an empty string. */ Tcl_ResetResult(interp); @@ -22226,13 +22247,13 @@ } */ static int -ListMethodKeysClassList(Tcl_Interp *interp, NsfClasses *classList, - int withSource, CONST char *pattern, - int methodType, int withCallprotection, - int withPath, Tcl_HashTable *dups, +ListMethodKeysClassList(Tcl_Interp *interp, NsfClasses *classList, + int withSource, CONST char *pattern, + int methodType, int withCallprotection, + int withPath, Tcl_HashTable *dups, NsfObject *object, int withPer_object) { NsfClasses *pl; - + /* append method keys from inheritance order */ for (pl = classList; pl; pl = pl->nextPtr) { Tcl_HashTable *cmdTablePtr = Tcl_Namespace_cmdTablePtr(pl->cl->nsPtr); @@ -22259,7 +22280,7 @@ int result, methodType = AggregatedMethodType(withMethodtype); /* - * TODO: we could make this faster for patterns without metachars + * TODO: we could make this faster for patterns without meta-chars * by letting ListMethodKeys() to signal us when an entry was found. * we wait, until the we decided about "info methods defined" * vs. "info method search" vs. "info defined" etc. @@ -22308,9 +22329,9 @@ } } - result = ListMethodKeysClassList(interp, TransitiveSuperClasses(object->cl), - withSource, pattern, - methodType, withCallprotection, + result = ListMethodKeysClassList(interp, TransitiveSuperClasses(object->cl), + withSource, pattern, + methodType, withCallprotection, withPath, dups, object, withPer_object); Tcl_DeleteHashTable(dups); @@ -22339,15 +22360,15 @@ MEM_COUNT_ALLOC("Tcl_InitHashTable", &slotTable); /* - * First add the per-object slot objects + * First add the per-object slot objects. */ if (MethodSourceMatches(withSource, NULL, object)) { AddSlotObjects(interp, object, "::per-object-slot", &slotTable, withSource, type, pattern, listObj); } /* - * Then add the class provided slot objects + * Then add the class provided slot objects. */ for (clPtr = precendenceList; clPtr; clPtr = clPtr->nextPtr) { if (MethodSourceMatches(withSource, clPtr->cl, NULL)) { @@ -22512,24 +22533,24 @@ */ static int NsfObjInfoVarsMethod(Tcl_Interp *interp, NsfObject *object, CONST char *pattern) { - Tcl_Obj *varlist, *okList, *element; + Tcl_Obj *varList, *okList, *element; int i, length; TclVarHashTable *varTablePtr = object->nsPtr ? Tcl_Namespace_varTablePtr(object->nsPtr) : object->varTablePtr; ListVarKeys(interp, TclVarHashTablePtr(varTablePtr), pattern); - varlist = Tcl_GetObjResult(interp); + varList = Tcl_GetObjResult(interp); - Tcl_ListObjLength(interp, varlist, &length); + Tcl_ListObjLength(interp, varList, &length); okList = Tcl_NewListObj(0, NULL); for (i=0; icl->instances; Tcl_HashEntry *hPtr; Tcl_HashSearch search; - + for (hPtr = Tcl_FirstHashEntry(tablePtr, &search); hPtr; hPtr = Tcl_NextHashEntry(&search)) { NsfObject *inst = (NsfObject *) Tcl_GetHashKey(tablePtr, hPtr); - + if (matchObject && inst == matchObject) { Tcl_SetStringObj(resultObj, ObjStr(matchObject->cmdName), -1); return resultObj; @@ -22751,18 +22772,18 @@ Tcl_InitHashTable(dups, TCL_STRING_KEYS); /* guards are ignored */ NsfClassListAddPerClassMixins(interp, class, &mixinClasses, &checkList); - (void) ListMethodKeysClassList(interp, mixinClasses, - withSource, pattern, - AggregatedMethodType(withMethodtype), withCallprotection, + (void) ListMethodKeysClassList(interp, mixinClasses, + withSource, pattern, + AggregatedMethodType(withMethodtype), withCallprotection, withPath, dups, &class->object, 0); NsfClassListFree(checkList); NsfClassListFree(mixinClasses); - result = ListMethodKeysClassList(interp, TransitiveSuperClasses(class), - withSource, pattern, - AggregatedMethodType(withMethodtype), withCallprotection, + result = ListMethodKeysClassList(interp, TransitiveSuperClasses(class), + withSource, pattern, + AggregatedMethodType(withMethodtype), withCallprotection, withPath, dups, &class->object, 0); - + Tcl_DeleteHashTable(dups); return result; } else { @@ -22933,7 +22954,7 @@ paramsPtr = parsedParam.paramDefs->paramsPtr; /* - * If a single paramter name is given, we construct a filtered parameter + * If a single parameter name is given, we construct a filtered parameter * list on the fly and provide it to the output functions. Note, that the * first matching parameter is queried. */ @@ -22949,7 +22970,7 @@ } } if (paramsPtr == parsedParam.paramDefs->paramsPtr) { - /* + /* * The named parameter was NOT found, so return "". */ Tcl_SetObjResult(interp, NsfGlobalObjs[NSF_EMPTY]); @@ -22990,7 +23011,7 @@ NsfClassInfoSlotobjectsMethod(Tcl_Interp *interp, NsfClass *class, int withClosure, int withSource, NsfClass *type, CONST char *pattern) { - NsfClasses *clPtr, *intrinsicClasses, *precedenceList = NULL; + NsfClasses *clPtr, *intrinsicClasses, *precedenceList = NULL; Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); Tcl_HashTable slotTable; @@ -23000,7 +23021,7 @@ if (withClosure) { NsfClasses *checkList = NULL, *mixinClasses = NULL; /* - * Compute the closure: first the transitive mixin classes... + * Compute the closure: first the transitive mixin-classes... */ NsfClassListAddPerClassMixins(interp, class, &mixinClasses, &checkList); for (clPtr = mixinClasses; clPtr; clPtr = clPtr->nextPtr) { @@ -23010,7 +23031,7 @@ } } /* - * ... followed by the intrinsic classes + * ... followed by the intrinsic classes. */ NsfClassListAdd(&precedenceList, class, NULL); for (clPtr = intrinsicClasses->nextPtr; clPtr; clPtr = clPtr->nextPtr) { @@ -23026,7 +23047,7 @@ if (withSource == 0) {withSource = 1;} /* - * Use a hash table to eliminate potential duplicates. + * Use a hash-table to eliminate potential duplicates. */ Tcl_InitHashTable(&slotTable, TCL_STRING_KEYS); MEM_COUNT_ALLOC("Tcl_InitHashTable", &slotTable); @@ -23111,9 +23132,9 @@ cmdTablePtr = Tcl_Namespace_cmdTablePtr(nsPtr); childTablePtr = Tcl_Namespace_childTablePtr(nsPtr); - /* + /* * Deleting the procs and vars in the child namespaces does not seem to be - * necessary, but we do it anyway + * necessary, but we do it anyway. */ for (entryPtr = Tcl_FirstHashEntry(childTablePtr, &search); entryPtr; entryPtr = Tcl_NextHashEntry(&search)) { @@ -23158,7 +23179,7 @@ * Delete all nsfprocs in the namespaces rooted by the second * argument. If it is NULL, the globale namespace is used a root of the * namespace tree. The function is necessary to trigger the freeing of - * the parameter defs. + * the parameter definitions. * * Results: * None. @@ -23174,13 +23195,13 @@ register Tcl_HashEntry *entryPtr; Tcl_HashSearch search; Tcl_Command cmd; - + if (nsPtr == NULL) { nsPtr = Tcl_GetGlobalNamespace(interp); } assert(nsPtr); - /*fprintf(stderr, "### DeleteNsfProcs current namespace '%s'\n", + /*fprintf(stderr, "### DeleteNsfProcs current namespace '%s'\n", nsPtr ? nsPtr->fullName : "NULL");*/ cmdTablePtr = Tcl_Namespace_cmdTablePtr(nsPtr); @@ -23199,7 +23220,7 @@ entryPtr = Tcl_NextHashEntry(&search)) { Tcl_Namespace *childNsPtr = (Tcl_Namespace *) Tcl_GetHashValue(entryPtr); DeleteNsfProcs(interp, childNsPtr); - } + } } /* @@ -23343,7 +23364,7 @@ if (object && object->nsPtr) { Tcl_HashEntry *hPtr; Tcl_HashSearch hSrch; - + for (hPtr = Tcl_FirstHashEntry(Tcl_Namespace_cmdTablePtr(object->nsPtr), &hSrch); hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { Tcl_Command cmd = Tcl_GetHashValue(hPtr); @@ -23384,18 +23405,18 @@ /* * Finally delete the object/class tree in a bottom up manner, - * deleteing all objects without dependencies first. Finally, only + * deleting all objects without dependencies first. Finally, only * the root classes of the object system will remain, which are * deleted separately. */ while (1) { /* - * Delete all plain objects without dependencies + * Delete all plain objects without dependencies. */ deleted = 0; - for (entry = *instances, lastEntry = NULL; - entry; + for (entry = *instances, lastEntry = NULL; + entry; lastEntry = entry, entry = entry->nextPtr) { NsfObject *object = (NsfObject *)entry->clorobj; @@ -23408,11 +23429,11 @@ assert((Tcl_Command_flags(entry->cmdPtr) & CMD_IS_DELETED) == 0); if (object && !NsfObjectIsClass(object) && !ObjectHasChildren(object)) { - /*fprintf(stderr, "check %p obj->flags %.6x cmd %p deleted %d\n", - object, object->flags, entry->cmdPtr, + /*fprintf(stderr, "check %p obj->flags %.6x cmd %p deleted %d\n", + object, object->flags, entry->cmdPtr, Tcl_Command_flags(entry->cmdPtr) & CMD_IS_DELETED); */ assert(object->id); - /*fprintf(stderr, " ... delete object %s %p, class=%s id %p ns %p\n", + /*fprintf(stderr, " ... delete object %s %p, class=%s id %p ns %p\n", ObjectName(object), object, ClassName(object->cl), object->id, object->nsPtr);*/ @@ -23439,10 +23460,10 @@ } /* - * Delete all classes without dependencies + * Delete all classes without dependencies. */ - for (entry = *instances, lastEntry = NULL; - entry; + for (entry = *instances, lastEntry = NULL; + entry; lastEntry = entry, entry = entry->nextPtr) { NsfClass *cl = entry->clorobj; @@ -23501,9 +23522,9 @@ /*fprintf(stderr, "ExitHandler\n");*/ /* - * Don't use exit handler, if the interpreter is alread destroyed. + * Don't use exit handler, if the interpreter is already destroyed. * Call to exit handler comes after freeing namespaces, commands, etc. - * e.g. TK calls Tcl_DeleteInterp directly, if Window is killed + * e.g. TK calls Tcl_DeleteInterp directly, if Window is killed. */ /* @@ -23545,7 +23566,7 @@ NsfStringIncrFree(&rst->iss); /* - * Free all data in the pointer converter + * Free all data in the pointer converter. */ Nsf_PointerExit(interp); @@ -23561,9 +23582,9 @@ /* Tcl_GlobalEval(interp, "puts {checkmem to checkmemFile}; checkmem checkmemFile"); */ #endif - + /* - * Free runtime state + * Free runtime state. */ ckfree((char *) RUNTIME_STATE(interp)); #if USE_ASSOC_DATA @@ -23575,7 +23596,7 @@ #if defined(NSF_MEM_COUNT) && !defined(PRE86) /* * When raising an error, the Tcl_Objs on the error stack and in the - * innerCountext are refCount-incremented. When Tcl exits, it does normally + * inner context are refCount-incremented. When Tcl exits, it does normally * not perform the according decrementing. We perform here a manual * decrementing and reset these lists. */ @@ -23628,7 +23649,7 @@ /* - * Registers thread/appl exit handlers. + * Registers thread/application exit handlers. */ static void RegisterExitHandlers(ClientData clientData) { @@ -23652,7 +23673,7 @@ ClientData runtimeState; int result, i; NsfRuntimeState *rst; - + #ifdef NSF_BYTECODE /*NsfCompEnv *interpstructions = NsfGetCompEnv();*/ #endif @@ -23695,7 +23716,7 @@ MEM_COUNT_INIT(); /* - * Init global variables for Tcl_Obj types + * Init global variables for Tcl_Obj types. */ NsfMutexLock(&initMutex); Nsf_OT_byteCodeType = Tcl_GetObjType("bytecode"); @@ -23716,7 +23737,7 @@ /* - * Initialize the pointer converter + * Initialize the pointer converter. */ Nsf_PointerInit(interp); /* @@ -23735,40 +23756,46 @@ rst->doCheckArguments = 1; /* - * check, if the namespace exists, otherwise create it. + * Check, if the namespace exists, otherwise create it. */ - rst->NsfNS = Tcl_FindNamespace(interp, "::nsf", NULL, TCL_GLOBAL_ONLY); + rst->NsfNS = Tcl_FindNamespace(interp, "::nsf", NULL, TCL_GLOBAL_ONLY); if (rst->NsfNS == NULL) { - rst->NsfNS = Tcl_CreateNamespace(interp, "::nsf", NULL, + rst->NsfNS = Tcl_CreateNamespace(interp, "::nsf", NULL, (Tcl_NamespaceDeleteProc *)NULL); } MEM_COUNT_ALLOC("TclNamespace", rst->NsfNS); /* - * init an empty, faked proc structure in the RUNTIME state + * Init an empty, faked proc structure in the RUNTIME state. */ rst->fakeProc.iPtr = (Interp *)interp; rst->fakeProc.refCount = 1; rst->fakeProc.cmdPtr = NULL; rst->fakeProc.bodyPtr = NULL; - rst->fakeProc.numArgs = 0; + rst->fakeProc.numArgs = 0; rst->fakeProc.numCompiledLocals = 0; rst->fakeProc.firstLocalPtr = NULL; rst->fakeProc.lastLocalPtr = NULL; - /* NsfClasses in separate Namespace / Objects */ + /* + * NsfClasses in separate Namespace / Objects + */ rst->NsfClassesNS = Tcl_CreateNamespace(interp, "::nsf::classes", NULL, (Tcl_NamespaceDeleteProc *)NULL); MEM_COUNT_ALLOC("TclNamespace", rst->NsfClassesNS); - /* cache interpreters proc interpretation functions */ + /* + * Cache interpreters proc interpretation functions + */ rst->objInterpProc = TclGetObjInterpProc(); rst->exitHandlerDestroyRound = NSF_EXITHANDLER_OFF; RegisterExitHandlers(interp); NsfStringIncrInit(&RUNTIME_STATE(interp)->iss); - /* initialize global Tcl_Obj */ + /* + * initialize global Tcl_Obj + */ NsfGlobalObjs = NEW_ARRAY(Tcl_Obj*, nr_elements(NsfGlobalStrings)); for (i = 0; i < nr_elements(NsfGlobalStrings); i++) { @@ -23779,26 +23806,30 @@ Tcl_InitHashTable(&rst->activeFilterTablePtr, TCL_STRING_KEYS); MEM_COUNT_ALLOC("Tcl_InitHashTable", &rst->activeFilterTablePtr); - /* create namespaces for the different command types */ + /* + * Create namespaces for the different command types. + */ Tcl_CreateNamespace(interp, "::nsf::cmd", 0, (Tcl_NamespaceDeleteProc *)NULL); for (i=0; i < nr_elements(method_command_namespace_names); i++) { Tcl_CreateNamespace(interp, method_command_namespace_names[i], 0, (Tcl_NamespaceDeleteProc *)NULL); } - /* create all method commands (will use the namespaces above) */ + /* + * Create all method commands (will use the namespaces above). + */ for (i=0; i < nr_elements(method_definitions)-1; i++) { Tcl_CreateObjCommand(interp, method_definitions[i].methodName, method_definitions[i].proc, 0, 0); } /* - * shadowed Tcl cmds + * Create Shadowed Tcl cmds: */ result = NsfShadowTclCommands(interp, SHADOW_LOAD); if (result != TCL_OK) { return result; } /* - * new Tcl cmds + * Create new Tcl cmds: */ #ifdef NSF_BYTECODE instructions[INST_NEXT].cmdPtr = (Command *) @@ -23822,11 +23853,11 @@ rst->colonCmd = Tcl_FindCommand(interp, "::nsf::colon", NULL, TCL_GLOBAL_ONLY); /* - * SS: Tcl occassionally resolves a proc's cmd structure (e.g., in + * SS: Tcl occasionally resolves a proc's cmd structure (e.g., in * [info frame /number/] or TclInfoFrame()) without * verification. However, NSF non-proc frames, in particular * initcmd blocks, point to the fakeProc structure which does not - * come with an initialised Command pointer. For now, we default to + * come with an initialized Command pointer. For now, we default to * an internal command. However, we need to revisit this decision * as non-proc frames (e.g., initcmds) report a "proc" entry * indicating "::nsf::colon" (which is sufficiently misleading and @@ -23836,7 +23867,7 @@ { /* - * the file "predefined.h. contains some methods and library procs + * The file "predefined.h" contains some methods and library procs * implemented in Tcl - they could go in a nsf.tcl file, but * they're embedded here with Tcl_GlobalEval to avoid the need to * carry around a separate file at runtime. @@ -23868,7 +23899,7 @@ #endif /* - * obtain type for parsed var name + * Obtain type for parsed var name. */ if (Nsf_OT_parsedVarNameType == NULL) { Tcl_Obj *varNameObj = Tcl_NewStringObj("::nsf::version",-1); Index: generic/nsf.h =================================================================== diff -u -r259dfade51ab7751d37295acf97399337c0d9ebd -r1398015d9294ce3adec8b1d5dc6e98f7c717b243 --- generic/nsf.h (.../nsf.h) (revision 259dfade51ab7751d37295acf97399337c0d9ebd) +++ generic/nsf.h (.../nsf.h) (revision 1398015d9294ce3adec8b1d5dc6e98f7c717b243) @@ -11,7 +11,7 @@ * Altendorferstrasse 97-101 * D-45143 Essen, Germany * - * (b) Vienna University of Economics and Business + * (b) Vienna University of Economics and Business * Institute of Information Systems and New Media * A-1090, Augasse 2-6 * Vienna, Austria @@ -78,11 +78,11 @@ * Feature activation/deactivation */ -/* activate bytecode support +/* activate bytecode support #define NSF_BYTECODE */ -/* activate/deacticate profiling information at the end +/* activate/deactivate profiling information at the end of running the program #define NSF_PROFILE 1 #define NSF_DTRACE 1 @@ -92,7 +92,7 @@ #define NSF_DEVELOPMENT 1 */ -/* activate/deactivate assert +/* activate/deactivate assert #define NDEBUG 1 */ @@ -104,7 +104,7 @@ #define NSF_WITH_OS_RESOLVER 1 #define NSF_WITH_VALUE_WARNINGS 1 -/* activate/deacticate memory tracing +/* activate/deactivate memory tracing #define NSF_MEM_TRACE 1 #define NSF_MEM_COUNT 1 */ @@ -212,8 +212,8 @@ # define NsfMutexUnlock(a) (*(a))-- #endif -/* - * A special definition used to allow this header file to be included +/* + * A special definition used to allow this header file to be included * in resource files so that they can get obtain version information from * this file. Resource compilers don't like all the C stuff, like typedefs * and procedure declarations, that occur below. @@ -222,14 +222,14 @@ #ifndef RC_INVOKED /* - * The structures Nsf_Object and Nsf_Class define mostly opaque - * data structures for the internal use strucures NsfObject and - * NsfClass (both defined in NsfInt.h). Modification of elements + * The structures Nsf_Object and Nsf_Class define mostly opaque + * data structures for the internal use structures NsfObject and + * NsfClass (both defined in NsfInt.h). Modification of elements * visible elements must be mirrored in both incarnations. * * Warning: These structures are just containing a few public * fields. These structures must not be used for querying the size or - * allocating the datastructures. + * allocating the data structures. */ typedef struct Nsf_Object { @@ -246,15 +246,15 @@ } Nsf_ParseContext; struct Nsf_Param; -typedef int (Nsf_TypeConverter)(Tcl_Interp *interp, +typedef int (Nsf_TypeConverter)(Tcl_Interp *interp, Tcl_Obj *obj, - struct Nsf_Param CONST *pPtr, - ClientData *clientData, + struct Nsf_Param CONST *pPtr, + ClientData *clientData, Tcl_Obj **outObjPtr); -Nsf_TypeConverter Nsf_ConvertToBoolean, Nsf_ConvertToClass, +Nsf_TypeConverter Nsf_ConvertToBoolean, Nsf_ConvertToClass, Nsf_ConvertToInteger, Nsf_ConvertToInt32, - Nsf_ConvertToObject, Nsf_ConvertToParameter, - Nsf_ConvertToString, Nsf_ConvertToSwitch, + Nsf_ConvertToObject, Nsf_ConvertToParameter, + Nsf_ConvertToString, Nsf_ConvertToSwitch, Nsf_ConvertToTclobj, Nsf_ConvertToPointer; typedef struct Nsf_Param { @@ -272,7 +272,7 @@ Tcl_Obj *method; } Nsf_Param; -extern int +extern int Nsf_ArgumentParse(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], Nsf_Object *object, Tcl_Obj *procNameObj, Nsf_Param CONST *paramPtr, int nrParams, int serial, @@ -282,19 +282,19 @@ Tcl_Obj *cmdNameObj, Tcl_Obj *methodObj); extern int -NsfDispatchClientDataError(Tcl_Interp *interp, ClientData clientData, +NsfDispatchClientDataError(Tcl_Interp *interp, ClientData clientData, CONST char *what, CONST char *methodName); extern int NsfNoCurrentObjectError(Tcl_Interp *interp, CONST char *what); extern int -NsfUnexpectedArgumentError(Tcl_Interp *interp, CONST char *argumentString, - Nsf_Object *object, Nsf_Param CONST *paramPtr, +NsfUnexpectedArgumentError(Tcl_Interp *interp, CONST char *argumentString, + Nsf_Object *object, Nsf_Param CONST *paramPtr, Tcl_Obj *procNameObj); extern int -NsfUnexpectedNonposArgumentError(Tcl_Interp *interp, - CONST char *argumentString, - Nsf_Object *object, +NsfUnexpectedNonposArgumentError(Tcl_Interp *interp, + CONST char *argumentString, + Nsf_Object *object, Nsf_Param CONST *currentParamPtr, Nsf_Param CONST *paramPtr, Tcl_Obj *procNameObj); Index: generic/nsfStack.c =================================================================== diff -u -ra09faeafaaacd8dcd4c52cdb86653993e8dc499a -r1398015d9294ce3adec8b1d5dc6e98f7c717b243 --- generic/nsfStack.c (.../nsfStack.c) (revision a09faeafaaacd8dcd4c52cdb86653993e8dc499a) +++ generic/nsfStack.c (.../nsfStack.c) (revision 1398015d9294ce3adec8b1d5dc6e98f7c717b243) @@ -1,8 +1,8 @@ -/* +/* * nsfStack.c -- - * + * * Stack handling functions of the Next Scripting Framework. - * + * * Copyright (C) 2010-2011 Gustaf Neumann * Copyright (C) 2011 Stefan Sobernig * @@ -55,8 +55,8 @@ * Results: * true on success or 0 * - * Side effects: - * + * Side effects: + * * List element potentially removed and freed. If a list turns * empty, the interp's state is updated. * @@ -80,7 +80,7 @@ *---------------------------------------------------------------------- * NsfShowStack -- * - * Print the contents of the callstack to stderr. This function is + * Print the contents of the call-stack to stderr. This function is * for debugging purposes only. * * Results: @@ -149,7 +149,7 @@ *---------------------------------------------------------------------- * Nsf_PushFrameObj, Nsf_PopFrameObj -- * - * Push or pop a frame with a callstack content as an OBJECT + * Push or pop a frame with a call-stack content as an OBJECT * frame. * * Results: @@ -167,7 +167,7 @@ Tcl_PushCallFrame(interp, (Tcl_CallFrame *)framePtr, object->nsPtr, 0|FRAME_IS_NSF_OBJECT); } else { - /* The object has no nsPtr, so we diguise as a proc, using fakeProc */ + /* The object has no nsPtr, so we disguise as a proc, using fakeProc */ Tcl_PushCallFrame(interp, (Tcl_CallFrame *)framePtr, Tcl_CallFrame_nsPtr(Tcl_Interp_varFramePtr(interp)), FRAME_IS_PROC|FRAME_IS_NSF_OBJECT); @@ -182,18 +182,18 @@ static void Nsf_PopFrameObj(Tcl_Interp *interp, CallFrame *framePtr) { - /*fprintf(stderr,"POP OBJECT_FRAME (Nsf_PopFrameObj) frame %p, vartable %p set to NULL, already %d\n", + /*fprintf(stderr,"POP OBJECT_FRAME (Nsf_PopFrameObj) frame %p, varTable %p set to NULL, already %d\n", framePtr, Tcl_CallFrame_varTablePtr(framePtr), Tcl_CallFrame_varTablePtr(framePtr) == NULL);*/ - Tcl_CallFrame_varTablePtr(framePtr) = NULL; + Tcl_CallFrame_varTablePtr(framePtr) = NULL; Tcl_PopCallFrame(interp); } /* *---------------------------------------------------------------------- * Nsf_PushFrameCsc, Nsf_PopFrameCsc -- * - * Push or pop a frame with a callstack content as a CMETHOD + * Push or pop a frame with a call-stack content as a CMETHOD * frame. * * Results: @@ -205,7 +205,7 @@ *---------------------------------------------------------------------- */ -NSF_INLINE static void +NSF_INLINE static void Nsf_PushFrameCsc(Tcl_Interp *interp, NsfCallStackContent *cscPtr, CallFrame *framePtr) { CallFrame *varFramePtr = Tcl_Interp_varFramePtr(interp); /*fprintf(stderr,"PUSH CMETHOD_FRAME (Nsf_PushFrameCsc) frame %p cscPtr %p methodName %s\n", @@ -217,7 +217,7 @@ Tcl_CallFrame_procPtr(framePtr) = &RUNTIME_STATE(interp)->fakeProc; } -NSF_INLINE static void +NSF_INLINE static void Nsf_PopFrameCsc(Tcl_Interp *interp, CallFrame *UNUSED(framePtr)) { /*fprintf(stderr,"POP CMETHOD_FRAME (Nsf_PopFrameCsc) frame %p, varTablePtr = %p\n", framePtr, Tcl_CallFrame_varTablePtr(framePtr));*/ @@ -314,11 +314,11 @@ GetSelfObj(Tcl_Interp *interp) { register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); - /*fprintf(stderr, "GetSelfObj interp has frame %p and varframe %p\n", + /*fprintf(stderr, "GetSelfObj interp has frame %p and var-frame %p\n", Tcl_Interp_framePtr(interp), Tcl_Interp_varFramePtr(interp));*/ for (; varFramePtr; varFramePtr = - + #if defined(SKIP_LEVELS) Tcl_CallFrame_callerPtr(varFramePtr) #else @@ -438,7 +438,7 @@ *---------------------------------------------------------------------- * NsfCallStackFindActiveFrame -- * - * Search for the first active frame on the callstack. + * Search for the first active frame on the call-stack. * * Results: * Call stack content or NULL. @@ -516,7 +516,7 @@ *---------------------------------------------------------------------- * CallStackRestoreSavedFrames -- * - * Restore the previously saved frames from the speficied call + * Restore the previously saved frames from the specified call * frame context. These frames are typically saved by * CallStackUseActiveFrame(). * @@ -542,10 +542,10 @@ *---------------------------------------------------------------------- * CallStackFindActiveFilter -- * - * Return the callstack content of the currently active filter + * Return the call-stack content of the currently active filter * * Results: - * Callstack content or NULL, if no filter is active + * Call-stack content or NULL, if no filter is active * * Side effects: * None. @@ -573,11 +573,11 @@ *---------------------------------------------------------------------- * CallStackFindEnsembleCsc -- * - * Return the callstack content and the optionally the stack frame + * Return the call-stack content and the optionally the stack frame * of the last ensemble invocation. * * Results: - * callstack content + * call-stack content * * Side effects: * None. @@ -590,13 +590,13 @@ NsfCallStackContent *cscPtr = NULL; assert(framePtr); - for (/* Skipping the starting frame, assumingly a "leaf" frame in an ensemle dispatch */ + for (/* Skipping the starting frame, assuming a "leaf" frame in an ensemble dispatch */ varFramePtr = Tcl_CallFrame_callerPtr(framePtr); - Tcl_CallFrame_isProcCallFrame(varFramePtr) & FRAME_IS_NSF_CMETHOD; + Tcl_CallFrame_isProcCallFrame(varFramePtr) & FRAME_IS_NSF_CMETHOD; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); assert(cscPtr); - + /*fprintf(stderr," --- frame %p cmdPtr %p NSF_CSC_TYPE_ENSEMBLE %d NSF_CSC_CALL_IS_ENSEMBLE %d \ NSF_CSC_TYPE_INACTIVE %d\n", varFramePtr, @@ -605,11 +605,11 @@ (cscPtr->flags & NSF_CSC_CALL_IS_ENSEMBLE) != 0, (cscPtr->frameType & NSF_CSC_TYPE_INACTIVE) != 0);*/ /* - * The "root" frame in a callstack branch resulting from an ensemble + * The "root" frame in a call-stack branch resulting from an ensemble * dispatch is not typed as an NSF_CSC_TYPE_ENSEMBLE frame, the call type * /is/ NSF_CSC_CALL_IS_ENSEMBLE. */ - if ((cscPtr->frameType & NSF_CSC_TYPE_ENSEMBLE) == 0 && + if ((cscPtr->frameType & NSF_CSC_TYPE_ENSEMBLE) == 0 && (cscPtr->flags & NSF_CSC_CALL_IS_ENSEMBLE)) break; } if (framePtrPtr) { @@ -640,18 +640,18 @@ Tcl_Obj *methodPathObj = Tcl_NewListObj(0, NULL); assert(framePtr); - /* - * Append all ensemble names to the specified list obj + /* + * Append all ensemble names to the specified list obj */ - for (/* Skipping the starting frame, assumingly a "leaf" frame in an ensemle dispatch */ + for (/* Skipping the starting frame, assuming a "leaf" frame in an ensemble dispatch */ framePtr = Tcl_CallFrame_callerPtr(framePtr), elements = 0; Tcl_CallFrame_isProcCallFrame(framePtr) & (FRAME_IS_NSF_CMETHOD|FRAME_IS_NSF_METHOD); framePtr = Tcl_CallFrame_callerPtr(framePtr)) { - + NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(framePtr); assert(cscPtr); - + /*fprintf(stderr, "--- frame %p cmdPtr %p cmd %s NSF_CSC_TYPE_ENSEMBLE %d \ NSF_CSC_CALL_IS_ENSEMBLE %d NSF_CSC_TYPE_INACTIVE %d\n", framePtr, @@ -661,7 +661,7 @@ (cscPtr->flags & NSF_CSC_CALL_IS_ENSEMBLE) != 0, (cscPtr->frameType & NSF_CSC_TYPE_INACTIVE) != 0);*/ - /* + /* * The "ensemble" call type, we find applied to all intermediate and leaf * ensemble frames. By filtering according to the ensemble call type, we * effectively omit leaf ensemble and non-ensemble frames from being @@ -672,27 +672,27 @@ /* Do not record any INACTIVE frames in the method path */ if ((cscPtr->frameType & NSF_CSC_TYPE_INACTIVE)) continue; - Tcl_ListObjAppendElement(interp, methodPathObj, + Tcl_ListObjAppendElement(interp, methodPathObj, Tcl_NewStringObj(Tcl_GetCommandName(interp, cscPtr->cmdPtr), -1)); elements++; - + /* - * The "root" frame in a callstack branch resulting from an ensemble + * The "root" frame in a call-stack branch resulting from an ensemble * dispatch is not typed as an NSF_CSC_TYPE_ENSEMBLE frame, the call type * /is/ NSF_CSC_CALL_IS_ENSEMBLE (as checked above). */ - + if ((cscPtr->frameType & NSF_CSC_TYPE_ENSEMBLE) == 0) break; - + } - /* - * The resulting list has reveresed order. If there are multiple + /* + * The resulting list has reversed order. If there are multiple * arguments, reverse the list to obtain the right order. */ if (elements > 1) { int oc, i; Tcl_Obj **ov; - + INCR_REF_COUNT(methodPathObj); Tcl_ListObjGetElements(interp, methodPathObj, &oc, &ov); resultObj = Tcl_NewListObj(0, NULL); @@ -745,7 +745,7 @@ * CallStackReplaceVarTableReferences -- * * Replace all references to the old var table (arg 1) by - * references to a new var table (arg 2) on the callstack. + * references to a new var table (arg 2) on the call-stack. * This function is e.g. used by require namespace. * * Results: @@ -767,7 +767,7 @@ if (!(frameFlags & FRAME_IS_NSF_OBJECT)) continue; if (!(Tcl_CallFrame_varTablePtr(framePtr) == oldVarTablePtr)) continue; - /*fprintf(stderr, "+++ makeObjNamespace replacing vartable %p with %p in frame %p\n", + /*fprintf(stderr, "+++ makeObjNamespace replacing varTable %p with %p in frame %p\n", oldVarTablePtr, newVarTablePtr, framePtr);*/ Tcl_CallFrame_varTablePtr(framePtr) = newVarTablePtr; } @@ -777,9 +777,9 @@ *---------------------------------------------------------------------- * CallStackPopAll -- * - * Unwind the stack and pop all callstack entries that are still + * Unwind the stack and pop all call-stack entries that are still * alive (e.g. if "exit" is called and we were jumping out of the - * callframe). + * call-frame). * * Results: * None. @@ -804,7 +804,7 @@ if (Tcl_CallFrame_level(framePtr) == 0) break; frameFlags = Tcl_CallFrame_isProcCallFrame(framePtr); - /*fprintf(stderr, "--- popping %p frameflags %.6x\n", framePtr, frameFlags);*/ + /*fprintf(stderr, "--- popping %p frame-flags %.6x\n", framePtr, frameFlags);*/ if (frameFlags & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { /* free the call stack content; we need this just for decr activation count */ @@ -831,11 +831,11 @@ NsfCallStackContent *cscPtr = (NsfCallStackContent *)nextCscPtr->cl; CscListRemove(interp, cscPtr, &unstackedEntries); CscFinish(interp, cscPtr, TCL_OK, "unwind"); - + count ++; - nextCscPtr = unstackedEntries ? unstackedEntries->nextPtr : NULL; + nextCscPtr = unstackedEntries ? unstackedEntries->nextPtr : NULL; } - + if (count>0 && RUNTIME_STATE(interp)->debugLevel > 0) { fprintf(stderr, "+++ unwind removed %d unstacked csc entries\n", count); } @@ -853,7 +853,7 @@ * operation requires a CscFinish operation later. * * Results: - * A valid, semiinitialized cscPtr. + * A valid, semi-initialized cscPtr. * * Side effects: * Memory allocation @@ -904,18 +904,18 @@ #endif assert(cscPtr); - + #if defined(NSF_PROFILE) gettimeofday(&trt, NULL); - + cscPtr->startUsec = trt.tv_usec; cscPtr->startSec = trt.tv_sec; #endif /* * When cmd is provided, the call is not unknown, the method * will be executed and the object will be stacked. In these - * cases, we maintain an activation count. + * cases, we maintain an activation count. */ if (likely(cmd != NULL)) { /* @@ -924,7 +924,7 @@ object->activationCount ++; MEM_COUNT_ALLOC("object.activationCount",object); /*fprintf(stderr, "CscInit %p method %s activationCount ++ (%s) --> %d (cl %p)\n", - cscPtr, cmd ? Tcl_GetCommandName(object->teardown, cmd) : "UNK", + cscPtr, cmd ? Tcl_GetCommandName(object->teardown, cmd) : "UNK", ObjectName(object), object->activationCount, cl);*/ /* * Track class activations @@ -935,8 +935,8 @@ */ cl->object.activationCount ++; MEM_COUNT_ALLOC("class.activationCount", cl); - /* - * Incremement the namespace ptr in case Tcl tries to delete + /* + * Increment the namespace ptr in case Tcl tries to delete * this namespace during the invocation */ NSNamespacePreserve(Tcl_Command_nsPtr(cmd)); @@ -1025,7 +1025,7 @@ NsfObject *clObject = &cscPtr->cl->object; clObject->activationCount --; MEM_COUNT_FREE("class.activationCount", clObject); - + /*fprintf(stderr, "CscFinish class %p %s check ac %d flags destroy %.6x success %.6x\n", clObject, ObjectName(clObject), clObject->activationCount, @@ -1063,7 +1063,7 @@ * Currently not used. * * Results: - * Callframe ptr + * Call-frame ptr * * Side effects: * None. @@ -1073,14 +1073,14 @@ #if 0 static Tcl_CallFrame * BeginOfCallChain(Tcl_Interp *interp, NsfObject *object) { - Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp), + Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp), *prevFramePtr = varFramePtr; if (object) { fprintf(stderr, "BeginOfCallChain obj %s\n", ObjectName(object)); for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { register int flags = Tcl_CallFrame_isProcCallFrame(varFramePtr); - + if (flags & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); if (cscPtr->self == object) { Index: library/nx/nx.tcl =================================================================== diff -u -rb4c1e40335b8210a65b8a7a560d7d69a38febbbd -r1398015d9294ce3adec8b1d5dc6e98f7c717b243 --- library/nx/nx.tcl (.../nx.tcl) (revision b4c1e40335b8210a65b8a7a560d7d69a38febbbd) +++ library/nx/nx.tcl (.../nx.tcl) (revision 1398015d9294ce3adec8b1d5dc6e98f7c717b243) @@ -1,5 +1,5 @@ ############################################################ -# nx.tcl - +# nx.tcl - # # Implementation of the NX object system, based # on the Next Scripting Framework @@ -14,10 +14,10 @@ # publish, distribute, sublicense, and/or sell copies of the Software, # and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -31,10 +31,10 @@ package provide nx 2.0b3 namespace eval ::nx { - namespace eval ::nsf {}; # make pkg indexer happy - namespace eval ::nsf::object {}; # make pkg indexer happy - namespace eval ::nx::internal {}; # make pkg indexer happy - namespace eval ::nx::traits {}; # make pkg indexer happy + namespace eval ::nsf {} ;# make pkg-indexer happy + namespace eval ::nsf::object {} ;# make pkg-indexer happy + namespace eval ::nx::internal {} ;# make pkg-indexer happy + namespace eval ::nx::traits {} ;# make pkg-indexer happy # # By setting the variable bootstrap, we can check later, whether we @@ -43,39 +43,39 @@ set ::nsf::bootstrap ::nx # - # First create the ::nx object system. The interally called methods, + # 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 # aliases). # ::nsf::objectsystem::create ::nx::Object ::nx::Class { - -class.alloc {alloc ::nsf::methods::class::alloc} + -class.alloc {alloc ::nsf::methods::class::alloc} -class.create create -class.dealloc {dealloc ::nsf::methods::class::dealloc} - -class.objectparameter objectparameter + -class.objectparameter objectparameter -class.recreate {recreate ::nsf::methods::class::recreate} -object.configure configure -object.defaultmethod {defaultmethod ::nsf::methods::object::defaultmethod} -object.destroy destroy -object.init {init ::nsf::methods::object::init} - -object.move move + -object.move move -object.unknown unknown } # - # get frequenly used primitiva from the next scripting framework + # get frequently used primitiva from the next scripting framework # namespace export next current self configure finalize interp is relation namespace import ::nsf::next ::nsf::current ::nsf::self ::nsf::dispatch # # provide the standard command set for ::nx::Object # - ::nsf::method::alias Object volatile ::nsf::methods::object::volatile - ::nsf::method::alias Object configure ::nsf::methods::object::configure - ::nsf::method::alias Object upvar ::nsf::methods::object::upvar - ::nsf::method::alias Object destroy ::nsf::methods::object::destroy + ::nsf::method::alias Object volatile ::nsf::methods::object::volatile + ::nsf::method::alias Object configure ::nsf::methods::object::configure + ::nsf::method::alias Object upvar ::nsf::methods::object::upvar + ::nsf::method::alias Object destroy ::nsf::methods::object::destroy ::nsf::method::alias Object uplevel ::nsf::methods::object::uplevel # @@ -86,29 +86,29 @@ ###################################################################### # Default Methods (referenced via createobjectsystem) ###################################################################### - - namespace eval ::nsf::methods {}; # make pkg indexer happy - namespace eval ::nsf::methods::object {}; # make pkg indexer happy + namespace eval ::nsf::methods {} ;# make pkg-indexer happy + namespace eval ::nsf::methods::object {} ;# make pkg-indexer happy + # Actually, we do not need an unknown handler, but if someone # defines his own unknown handler we define it automatically proc ::nsf::methods::object::unknown {m args} { error "[::nsf::self]: unable to dispatch method '$m'" } - + # The default constructor proc ::nsf::methods::object::init args {} # This method can be called on invocations of the object without a # specified method. proc ::nsf::methods::object::defaultmethod {} {::nsf::self} - + ###################################################################### # Class methods ###################################################################### - + # provide the standard command set for Class - ::nsf::method::alias Class create ::nsf::methods::class::create + ::nsf::method::alias Class create ::nsf::methods::class::create ::nsf::method::alias Class new ::nsf::methods::class::new # set a few aliases as protected @@ -137,8 +137,8 @@ # objects when needed. # ::nsf::method::create Object __resolve_method_path { - -per-object:switch - -verbose:switch + -per-object:switch + -verbose:switch path } { set object [::nsf::self] @@ -149,7 +149,7 @@ set regObject $object foreach w [lrange $path 0 end-1] { #puts stderr "check $object info methods $path @ <$w>" - set scope [expr {[::nsf::is class $object] && !${per-object} ? "class" : "object"}] + set scope [expr {[::nsf::is class $object] && !${per-object} ? "class" : "object"}] if {[::nsf::directdispatch $object ::nsf::methods::${scope}::info::methods $w] eq ""} { # # Create dispatch/ensemble object and accessor method (if wanted) @@ -322,7 +322,7 @@ # Object public method forward { - method + method -default -methodprefix -objframe:switch -onerror -returns -verbose:switch target:optional args } { @@ -341,8 +341,8 @@ return $r } - Class public method forward { - method + Class public method forward { + method -default -methodprefix -objframe:switch -onerror -returns -verbose:switch target:optional args } { @@ -362,7 +362,7 @@ } ###################################################################### - # Provide method "alias" + # Provide method "alias" # # -frame object|method make only sense for c-defined cmds, ###################################################################### @@ -400,7 +400,7 @@ set container [namespace tail $object] if {[::nsf::object::exists $object] && $container in {slot per-object-slot}} { set parent [$object ::nsf::methods::object::info::parent] - return [expr {[::nsf::object::exists $parent] + return [expr {[::nsf::object::exists $parent] && [::nsf::method::property $parent -per-object $container slotcontainer]}] } return 0 @@ -437,7 +437,7 @@ } return ${slotContainer} } - + ###################################################################### # Allocate system slot containers ###################################################################### @@ -482,7 +482,7 @@ set ref "\"$m\" of $obj $path" error "Unable to dispatch sub-method $ref; valid are: [join [lsort $valid] {, }]" } - + :protected method defaultmethod {} { if {[catch {set obj [uplevel ::nsf::current]}]} { error "Ensemble dispatch called outside of method context" @@ -511,7 +511,7 @@ nsf::var::unset -nocomplain [self] $name } Object public method "delete variable" {name} { - # First remove the instanstance variable and complain, if it does + # First remove the instance variable and complain, if it does # not exist. if {[nsf::var::exists [self] $name]} { nsf::var::unset [self] $name @@ -569,7 +569,7 @@ return [:info lookup method $methodName] } # - # method require, public explicitly + # method require, public explicitly # :method "require public method" {methodName} { set result [:require method $methodName] @@ -609,13 +609,13 @@ return $result } } - + ###################################################################### # Info definition ###################################################################### # we have to use "eval", since objectParameters are not defined yet - + Object eval { :alias "info lookup filter" ::nsf::methods::object::info::lookupfilter :alias "info lookup method" ::nsf::methods::object::info::lookupmethod @@ -668,7 +668,7 @@ # that the automatically created name of the ensemble object has to # be the same as defined above. ###################################################################### - + EnsembleObject create ::nx::Class::slot::__info Class alias info ::nx::Class::slot::__info @@ -682,7 +682,7 @@ } # - # Copy all info methods except the subobjects to + # Copy all info methods except the sub-objects to # ::nx::Class::slot::__info # foreach m [::nsf::directdispatch ::nx::Object::slot::__info ::nsf::methods::object::info::methods] { @@ -754,7 +754,7 @@ ###################################################################### # Define "info info" and "info unknown" ###################################################################### - + proc ::nx::internal::infoOptions {obj} { #puts stderr "INFO INFO $obj -> '[::nsf::directdispatch $obj ::nsf::methods::object::info::methods -methodtype all]'" set methods [list] @@ -771,7 +771,7 @@ Object method "info info" {} {::nx::internal::infoOptions ::nx::Object::slot::__info} Class method "info info" {} {::nx::internal::infoOptions ::nx::Class::slot::__info} - + # finally register method "method" (otherwise, we cannot use "method" above) Object alias "info method" ::nsf::methods::object::info::method Class alias "info method" ::nsf::methods::class::info::method @@ -782,19 +782,19 @@ # Deactivated for now. If we like to revive this method, it should # be integrated with the method modifiers and the method "class" # - # Object method abstract {methtype -per-object:switch methname arglist} { + # Object method abstract {methtype -per-object:switch methName arglist} { # if {$methtype ne "method"} { # error "invalid method type '$methtype', must be 'method'" # } # set body " # if {!\[::nsf::current isnextcall\]} { - # error \"Abstract method $methname $arglist called\" + # error \"Abstract method $methName $arglist called\" # } else {::nsf::next} # " # if {${per-object}} { - # :method -per-object $methname $arglist $body + # :method -per-object $methName $arglist $body # } else { - # :method $methname $arglist $body + # :method $methName $arglist $body # } # } @@ -843,13 +843,13 @@ ###################################################################### # # We are in bootstrap code; we cannot use slots/parameter to define - # slots, so the code is a little low level. After the defintion of + # slots, so the code is a little low level. After the definition of # the slots, we can use slot-based code such as "-parameter" or # "objectparameter". # Class create ::nx::MetaSlot ::nsf::relation MetaSlot superclass Class - + MetaSlot class method requireClass {required:class old:class,0..1} { # # Combine two classes and return the more specialized one @@ -925,18 +925,18 @@ } MetaSlot public class method createFromParameterSpec { - target - -per-object:switch + target + -per-object:switch {-class ""} - {-initblock ""} + {-initblock ""} {-defaultopts ""} spec default:optional } { lassign [:parseParameterSpec -class $class -defaultopts $defaultopts $spec] \ name parameterOptions class opts - + if {[info exists default]} { lappend opts -default $default } @@ -970,22 +970,22 @@ MetaSlot create ::nx::ObjectParameterSlot ::nsf::relation ObjectParameterSlot superclass Slot - + MetaSlot create ::nx::MethodParameterSlot ::nsf::relation MethodParameterSlot superclass Slot # Create a slot instance for dispatching method parameter specific # value checkers MethodParameterSlot create ::nx::methodParameterSlot - + # Define a temporary, low level interface for defining slot # values. Normally, this is done via slot objects, which are defined # later. The proc is removed later in this script. proc createBootstrapVariableSlots {class definitions} { foreach att $definitions { if {[llength $att]>1} {foreach {att default} $att break} - set slotObj [::nx::slotObj $class $att] + set slotObj [::nx::slotObj $class $att] #puts stderr "::nx::BootStrapVariableSlot create $slotObj" ::nx::BootStrapVariableSlot create $slotObj if {[info exists default]} { @@ -1003,8 +1003,8 @@ ::nsf::var::set $slotObj position 0 ::nsf::var::set $slotObj config 1 } - - #puts stderr "Bootstrapslot for $class calls invalidateobjectparameter" + + #puts stderr "Bootstrap-slot for $class calls invalidateobjectparameter" ::nsf::invalidateobjectparameter $class } @@ -1032,7 +1032,7 @@ ::nsf::relation BootStrapVariableSlot superclass ObjectParameterSlot BootStrapVariableSlot public method getParameterSpec {} { - # + # # Bootstrap version of getParameter spec. Just bare essentials. # set name [namespace tail [self]] @@ -1164,7 +1164,7 @@ } ObjectParameterSlot protected method getParameterOptions { - {-withMultiplicity 0} + {-withMultiplicity 0} {-forObjectParameter 0} } { # @@ -1195,7 +1195,7 @@ } return $options } - + ObjectParameterSlot public method getParameterSpec {} { # # Get a full object parmeter specification from slot object @@ -1239,7 +1239,7 @@ # slots. The above definitions should be sufficient as a basis for # object parameters. We provide the definition here before we refine # the slot definitions. - # + # # Invalidate previously defined object parameter (built with the # empty objectparameter definition. # @@ -1250,7 +1250,7 @@ ###################################################################### Class protected method objectparameter {} { - # + # # Collect the object parameter slots in per-position lists to # ensure partial ordering and avoid sorting. # @@ -1305,7 +1305,7 @@ # # Value contains globbing meta characters. # - if {[info exists :elementtype] && ${:elementtype} eq "mixinreg" + if {[info exists :elementtype] && ${:elementtype} eq "mixinreg" && ![string match ::* $value]} { # # Prefix glob pattern with ::, since all object names have @@ -1363,12 +1363,12 @@ # uplevel [list ::nsf::relation $obj $prop [linsert $oldSetting $pos $value]] } - + RelationSlot public method delete {-nocomplain:switch obj prop value} { uplevel [list ::nsf::relation $obj $prop \ [:delete_value $obj $prop [::nsf::relation $obj $prop] $value]] } - + ###################################################################### # Register system slots ###################################################################### @@ -1380,12 +1380,12 @@ -forwardername object-mixin -elementtype mixinreg ::nx::RelationSlot create ::nx::Object::slot::filter \ -forwardername object-filter -elementtype filterreg - + ::nx::RelationSlot create ::nx::Class::slot::mixin \ -forwardername class-mixin -elementtype mixinreg ::nx::RelationSlot create ::nx::Class::slot::filter \ -forwardername class-filter -elementtype filterreg - + # # Create two convenience object parameters to allow configuration # of per-object mixins and filters for classes. @@ -1394,20 +1394,20 @@ -methodname "::nsf::classes::nx::Object::mixin" -elementtype mixinreg ::nx::ObjectParameterSlot create ::nx::Class::slot::object-filter \ -methodname "::nsf::classes::nx::Object::filter" -elementtype filterreg - + # # Create object parameter slots for "noninit" and "volatile" # ::nx::ObjectParameterSlot create ::nx::Object::slot::noinit \ -methodname ::nsf::methods::object::noinit -noarg true ::nx::ObjectParameterSlot create ::nx::Object::slot::volatile -noarg true - + # # Define "class" as a ObjectParameterSlot defined as alias # ::nx::ObjectParameterSlot create ::nx::Object::slot::class \ -methodname "::nsf::methods::object::class" -elementtype class - + # # Define "superclass" as a ObjectParameterSlot defined as alias # @@ -1416,7 +1416,7 @@ -elementtype class \ -multiplicity 1..n \ -default ::nx::Object - + # # Define the initcmd as a positional ObjectParameterSlot # @@ -1426,7 +1426,7 @@ # -noarg true \ # -positional true \ # -position 1 - + # # Define the initcmd as a positional ObjectParameterSlot # @@ -1435,27 +1435,27 @@ -noleadingdash true \ -positional true \ -position 2 - + # # Make sure the invalidate all ObjectParameterSlots # ::nsf::invalidateobjectparameter ::nx::ObjectParameterSlot - + # # Define method "guard" for mixin- and filter-slots of Object and Class # ::nx::Object::slot::filter method guard {obj prop filter guard:optional} { if {[info exists guard]} { ::nsf::directdispatch $obj ::nsf::methods::object::filterguard $filter $guard } else { - $obj info filter guard $filter + $obj info filter guard $filter } } ::nx::Class::slot::filter method guard {obj prop filter guard:optional} { if {[info exists guard]} { ::nsf::directdispatch $obj ::nsf::methods::class::filterguard $filter $guard } else { - $obj info filter guard $filter + $obj info filter guard $filter } } ::nx::Object::slot::mixin method guard {obj prop mixin guard:optional} { @@ -1469,11 +1469,11 @@ if {[info exists guard]} { ::nsf::directdispatch $obj ::nsf::methods::class::mixinguard $filter $guard } else { - $obj info mixin guard $filter + $obj info mixin guard $filter } } #::nsf::method::alias ::nx::Class::slot::object-filter guard ::nx::Object::slot::filter::guard - + # # With a special purpose eval, we could avoid the need for # reconfigure for slot changes via eval (two cases in the regression @@ -1486,13 +1486,13 @@ # :reconfigure # return $r #} - + ###################################################################### # Variable slots ###################################################################### ::nsf::invalidateobjectparameter MetaSlot - + MetaSlot create ::nx::VariableSlot -superclass ::nx::ObjectParameterSlot createBootstrapVariableSlots ::nx::VariableSlot { @@ -1520,7 +1520,7 @@ } ::nx::VariableSlot protected method getParameterOptions { - {-withMultiplicity 0} + {-withMultiplicity 0} {-forObjectParameter 0} } { set options "" @@ -1571,10 +1571,10 @@ ::nx::VariableSlot protected method needsForwarder {} { # - # We just forward, when + # We just forward, when # * "assign" and "add" are still untouched, or # * or incremental is specified - # + # if {[:info lookup method assign] ne "::nsf::classes::nx::VariableSlot::assign"} {return 1} if {[:info lookup method add] ne "::nsf::classes::nx::VariableSlot::add"} {return 1} if {[:info lookup method get] ne "::nsf::classes::nx::VariableSlot::get"} {return 1} @@ -1587,9 +1587,9 @@ ::nx::VariableSlot public method makeAccessor {} { if {!${:accessor}} { - #puts stderr "Do not register forwarder ${:domain} ${:name}" + #puts stderr "Do not register forwarder ${:domain} ${:name}" return 0 - } + } if {[:needsForwarder]} { set handle [:makeForwarder] :makeIncrementalOperations @@ -1638,7 +1638,7 @@ set options [:getParameterOptions -withMultiplicity true] lappend options slot=[::nsf::self] set body {::nsf::var::set $obj $var $value} - + if {[:info lookup method assign] eq "::nsf::classes::nx::VariableSlot::assign"} { #puts stderr ":public method assign [list obj var [:namedParameterSpec {} value $options]] $body" :public method assign [list obj var [:namedParameterSpec {} value $options]] $body @@ -1686,7 +1686,7 @@ } # - # Implementation of methods called by the traces + # Implementation of methods called by the traces # ::nx::VariableSlot method __default_from_cmd {obj cmd var sub op} { #puts "GETVAR [::nsf::current method] obj=$obj cmd=$cmd, var=$var, op=$op" @@ -1705,14 +1705,14 @@ } ###################################################################### - # Implementation of (incremental) forwarder operations for - # VariableSlots: - # - assign - # - get - # - add + # Implementation of (incremental) forwarder operations for + # VariableSlots: + # - assign + # - get + # - add # - delete ###################################################################### - + ::nsf::method::alias ::nx::VariableSlot get ::nsf::var::set ::nsf::method::alias ::nx::VariableSlot assign ::nsf::var::set @@ -1743,8 +1743,8 @@ nx::Object method variable { {-accessor:switch} - {-class ""} - {-initblock ""} + {-class ""} + {-initblock ""} {-nocomplain:switch} spec:parameter defaultValue:optional @@ -1753,7 +1753,7 @@ # This method creates sometimes a slot, sometimes not # (optimization). We need a slot currently in the following # situations: - # - when accessors are needed + # - when accessors are needed # (serializer uses slot object to create accessors) # - when initblock is non empty # @@ -1816,8 +1816,8 @@ } Object method property { - {-class ""} - -nocomplain:switch + {-class ""} + -nocomplain:switch spec:parameter {initblock ""} } { @@ -1834,7 +1834,7 @@ {-accessor:switch} {-class ""} {-config:switch} - {-initblock ""} + {-initblock ""} spec:parameter defaultValue:optional } { @@ -1846,7 +1846,7 @@ {*}[expr {[info exists defaultValue] ? [list $defaultValue] : ""}]] return [::nsf::directdispatch [self] ::nsf::methods::class::info::method registrationhandle [$slot name]] } - + nx::Class method property { {-class ""} spec:parameter @@ -1892,7 +1892,7 @@ } ###################################################################### - # Now the slots are defined; now we can defines the Objects or + # Now the slots are defined; now we can defines the Objects or # classes with parameters more easily than above. ###################################################################### @@ -1939,7 +1939,7 @@ if {![::nsf::object::exists $object]} {$class create $object} # This method is reused in XOTcl which has e.g. no "require"; # therefore use nsf primitiva. - ::nsf::directdispatch $object ::nsf::methods::object::requirenamespace + ::nsf::directdispatch $object ::nsf::methods::object::requirenamespace if {$withnew} { # @@ -1955,10 +1955,10 @@ set infoMethod "::nsf::methods::class::info::method" set plainNew "::nsf::methods::class::new" set mappedNew [::nx::NsScopedNew $infoMethod definitionhandle new] - + set nxMapNew [expr {[::nx::Class $infoMethod origin new] eq $plainNew}] if {$nxMapNew} {::nsf::method::alias ::nx::Class new $mappedNew} - + if {[::nsf::is class ::xotcl::Class]} { set xotclMapNew [expr {[::xotcl::Class $infoMethod origin new] eq $plainNew}] if {$xotclMapNew} {::nsf::method::alias ::xotcl::Class new $mappedNew } @@ -1976,7 +1976,7 @@ if {$xotclMapNew} {::nsf::method::alias ::xotcl::Class new $plainNew} } if {$errorOccured} {error $errorMsg} - + } else { ::apply [list {} $cmds $object] } @@ -2012,7 +2012,7 @@ lappend children [namespace children $t] } } - + # a namespace or an obj with namespace may have children # itself foreach c $children { @@ -2034,7 +2034,7 @@ return ::[string trimleft [set :dest]$tail :] } } - + :method copyTargets {} { #puts stderr "COPY will copy targetList = [set :targetList]" set objs {} @@ -2088,7 +2088,7 @@ # set base [$origin ::nsf::methods::object::info::parent] set container [namespace tail $origin] - if {[::nsf::object::exists $base] + if {[::nsf::object::exists $base] && [::nsf::method::property $base -per-object $container slotcontainer] } { ::nx::internal::setSlotContainerProperties [$dest ::nsf::methods::object::info::parent] $container @@ -2147,7 +2147,7 @@ } return [lindex $objs 0] } - + :public method copy {obj {dest ""}} { #puts stderr "[::nsf::self] copy <$obj> <$dest>" set :objLength [string length $obj] @@ -2185,7 +2185,7 @@ ###################################################################### - # Methods of metaclasses are methods intended for classes. Make + # Methods of meta-classes are methods intended for classes. Make # sure, these methods are only applied on classes. ###################################################################### @@ -2197,7 +2197,7 @@ ###################################################################### # some utilities ###################################################################### - # + # # Provide mechanisms to configure nx # ::nx::Object create ::nx::configure { @@ -2240,7 +2240,7 @@ # framework is faster than namespace-ensembles. # Object create ::nx::var { - :public alias exists ::nsf::var::exists + :public alias exists ::nsf::var::exists :public alias import ::nsf::var::import :public alias set ::nsf::var::set } @@ -2273,7 +2273,7 @@ set ::nx::confdir ~/.nx set ::nx::logdir $::nx::confdir/log - + unset ::nsf::bootstrap } Index: library/tcl-cool/tcl-cool.tcl =================================================================== diff -u -r8046b1da6bc0689f73d4dbdc3f8d1e03fd23acaf -r1398015d9294ce3adec8b1d5dc6e98f7c717b243 --- library/tcl-cool/tcl-cool.tcl (.../tcl-cool.tcl) (revision 8046b1da6bc0689f73d4dbdc3f8d1e03fd23acaf) +++ library/tcl-cool/tcl-cool.tcl (.../tcl-cool.tcl) (revision 1398015d9294ce3adec8b1d5dc6e98f7c717b243) @@ -9,11 +9,11 @@ # # This script consists of three major parts: # -# 1. The definition of TclCOOL (Tcl Core Object Oriented Languge) +# 1. The definition of TclCOOL (Tcl Core Object Oriented Language) # based on the Next Scripting Framework (::nsf). TclCOOL is # simple but powerful object language. # -# 2. Sample TclCOOL program +# 2. Sample TclCOOL program # # In a first step, we load nsf @@ -23,7 +23,7 @@ # Now we have the following commands and methods defined in the ::nsf # namespace (among more functionality not needed here): # -# Two unexported commands for OO-language designer +# Two un-exported commands for OO-language designer # ::nsf::alias # ::nsf::objectsystem::create # ::nsf::forward @@ -33,7 +33,7 @@ # Three exported commands to be used by in the languages # ::nsf::my # ::nsf::current -# ::nsf::next +# ::nsf::next # # An unregistered (unattached) set of methods that can be used for # objects. We use here just: @@ -54,11 +54,11 @@ # # 1. TclCOOL language definition based on the Next Scripting Framework # -###################################################################### +###################################################################### namespace eval tcl-cool { - # In a first step, we create two base classes of TclCOOL, + # In a first step, we create two base classes of TclCOOL, # namely "object" and "class" in the current namespace: ::nsf::objectsystem::create object class @@ -70,11 +70,11 @@ # We define as well [self] as a synonym of "nsf::current object" # interp alias {} ::tcl-cool::self {} ::nsf::current object - - # We define 2 methods for "class" (actually "::tcl-cool::class) - # based on the methodset for classes + + # We define 2 methods for "class" (actually "::tcl-cool::class) + # based on the method set for classes # - # - "method" is a means to define the methods, which are provided + # - "method" is a means to define the methods, which are provided # by the class to the instances of the class # - "forward" is a forwarder for instances of the class # @@ -96,8 +96,8 @@ # Sometimes using method is better to be selective on the arguments # and the provided switches. - # Next, we define 3 methods for "object" (actually "::tcl-cool::object) - # based on the methodset for objects + # Next, we define 3 methods for "object" (actually "::tcl-cool::object) + # based on the method set for objects # # - "variable" is a means to import instance variables into # the current scope ("instvar" in XOTcl) @@ -109,7 +109,7 @@ ::nsf::method::alias object methods ::nsf::methods::object::info::lookupmethods # - # The method "create" defines, what happens, when a class or object + # The method "create" defines, what happens, when a class or object # is created. First the object is allocated, then the constructor is called. # class method create {name args} { @@ -135,12 +135,12 @@ # The following method is the constructor for classes. It sets the # default superclass and provides easy means for specifying methods # and superclasses during initialization - + class method init {spec} { my variable __default_superclass set __default_superclass [namespace current]::object while {[llength $spec]} { - set m [pop spec] + set m [pop spec] switch $m { method {my method [pop spec] [pop spec] [pop spec]} superclass {my superclass [pop spec]} @@ -158,17 +158,17 @@ } } - # Finally, we provide a few methods for all objects in TclCOOL: + # Finally, we provide a few methods for all objects in TclCOOL: # - "unknown": provide an error message, when unknown methods are called - # - "filter": convenience routine to set filters though + # - "filter": convenience routine to set filters though object method unknown {m args} {error "[self]: unknown method '$m' called"} - + # Provide users a convenient way to register/deregister per-object # filters and mixins - object forward filter ::nsf::relation %self object-filter + object forward filter ::nsf::relation %self object-filter object forward mixin ::nsf::relation %self object-mixin - + # finally, export a few commands namespace export object class my self next } @@ -238,7 +238,7 @@ # fido filter tracer -# +# # invoke the methods again # puts "wag means [fido wag]" @@ -247,7 +247,7 @@ # The output is: # > ============ filter ================ -# > * call ::fido wag +# > * call ::fido wag # > * exit ::fido wag, returns 'Joy' # > wag means Joy # > * call ::fido chase tweedy! @@ -282,7 +282,7 @@ # fido mixin lazydog -# +# # invoke the methods again # puts "wag means [fido wag]" Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -r21336c95f6123ebf608e5ab45b9674cffba35303 -r1398015d9294ce3adec8b1d5dc6e98f7c717b243 --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 21336c95f6123ebf608e5ab45b9674cffba35303) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 1398015d9294ce3adec8b1d5dc6e98f7c717b243) @@ -1,5 +1,5 @@ ############################################################ -# xotcl2.tcl - +# xotcl2.tcl - # # Implementation of the XOTcl 2 object systen, based # on the Next Scripting Framework @@ -14,10 +14,10 @@ # publish, distribute, sublicense, and/or sell copies of the Software, # and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -51,17 +51,17 @@ # of the object system and as root meta class. # ::nsf::objectsystem::create ::xotcl::Object ::xotcl::Class { - -class.alloc alloc + -class.alloc alloc -class.create create -class.dealloc dealloc - -class.objectparameter objectparameter - -class.recreate recreate - -object.configure configure + -class.objectparameter objectparameter + -class.recreate recreate + -object.configure configure -object.cleanup cleanup - -object.defaultmethod defaultmethod - -object.destroy destroy - -object.init init - -object.move move + -object.defaultmethod defaultmethod + -object.destroy destroy + -object.init init + -object.move move -object.unknown unknown } @@ -73,7 +73,7 @@ namespace eval ::nsf::method::create {} # - # get frequenly used primitiva into the ::xotcl namespace + # get frequently used primitiva into the ::xotcl namespace # namespace import ::nsf::configure ::nsf::my ::nsf::finalize ::nsf::interp namespace import ::nsf::method::alias ::nsf::is ::nsf::relation @@ -112,7 +112,7 @@ # @object ::xotcl::Object # # XOTcl programs are constructed out of objects. This class - # describes common structural and behavioural features for all XOTcl + # describes common structural and behavioral features for all XOTcl # objects. It is the root object-class in the XOTcl 2 object system. # provide the standard command set for ::xotcl::Object @@ -153,11 +153,11 @@ # @param -reset Reset the object-internal counter for a given seed string # @param name The seeding string which is used as a base for name generation # @return The generated name string - + # @method ::xotcl::Object#cleanup # # TODO: this is a method not used in the Next Scripting Langauge. This - # mehtod is just called via recreate, so everything necessary can be + # method is just called via recreate, so everything necessary can be # performed there as well. However, it is available for backward # compatibility available in XOTcl 2.0 # @@ -167,16 +167,16 @@ # recreation process by {{@method ::xotcl::Class class recreate}}. # Depending on the recreation scheme applied (see {{@command # ::nsf::configure}}, object variables are deleted, per-object - # namespaces are cleared, and the object's relationsships (e.g., mixin + # namespaces are cleared, and the object's relationships (e.g., mixin # relations) are reset. - # + # # @properties interally-called - + # @method ::xotcl::Object#destroy # # @use ::xotcl::Object#destroy - # @method ::xotcl::Object#exists + # @method ::xotcl::Object#exists # # A helper method for checking whether the variable {{{var}}} is # defined on the object and assigned a value. You may use a variable @@ -252,7 +252,7 @@ # have the {{{interp}}} enter an event loop until the specified # variable {{{varname}}} is set on the object. # - # @param varName The name of the signalling object variable. + # @param varName The name of the signaling object variable. ::nsf::method::create Object vwait {varName} { if {[regexp {:[^:]*} $varName]} { @@ -315,13 +315,13 @@ # define a minimal implementation of "method" Object instproc method {name arguments:parameter,0..* body} { - :proc $name $arguments $body + :proc $name $arguments $body } Class instproc method {-per-object:switch name arguments:parameter,0..* body} { if {${per-object}} { - :proc $name $arguments $body + :proc $name $arguments $body } else { - :instproc $name $arguments $body + :instproc $name $arguments $body } } @@ -334,9 +334,9 @@ # # but since we changed the name of -objscope in nsf to -objframe, we # have to provide the definition the hard way via methods. - + Object instproc forward { - method + method -default -earlybinding:switch -methodprefix -objscope:switch -onerror -verbose:switch target:optional args } { @@ -353,8 +353,8 @@ return $r } - Class instproc instforward { - method + Class instproc instforward { + method -default -earlybinding:switch -methodprefix -objscope:switch -onerror -verbose:switch target:optional args } { @@ -371,7 +371,7 @@ return $r } - + Class instproc unknown {args} { #puts stderr "use '[self] create $args', not '[self] $args'" uplevel [list [self] create {*}$args] @@ -413,7 +413,7 @@ # - # Use parameter definition from nx + # Use parameter definition from nx # (same with classInfo parameter, see below) #::nsf::method::alias ::xotcl::Class parameter ::nsf::classes::nx::Class::attributes @@ -427,7 +427,7 @@ } # We provide a default value for superclass (when no superclass is - # specified explicitely) and metaclass, in case they should differ + # specified explicitly) and metaclass, in case they should differ # from the root classes of the object system. ::xotcl::Class parameter { @@ -520,7 +520,7 @@ # info nonposargs # info default # - # TODO mark all absolete calls at least as deprecated in library + # TODO mark all obsolete calls at least as deprecated in library # proc ::xotcl::info_args {scope o method} { @@ -759,7 +759,7 @@ } return "" } - + :alias slots ::nsf::methods::class::info::slotobjects :alias subclass ::nsf::methods::class::info::subclass :alias superclass ::nsf::methods::class::info::superclass @@ -789,11 +789,11 @@ Object instproc isclass {{class:substdefault "[self]"}} {::nsf::is class $class} Object instproc ismetaclass {{class:substdefault "[self]"}} {::nsf::is metaclass $class} Object instproc ismixin {class} { - return [expr {[::nsf::is class $class] && + return [expr {[::nsf::is class $class] && [my ::nsf::methods::object::info::hasmixin $class]}] } Object instproc istype {class} { - return [expr {[::nsf::is class $class] && + return [expr {[::nsf::is class $class] && [::nsf::directdispatch [self] ::nsf::methods::object::info::hastype $class]}] } @@ -866,8 +866,8 @@ #puts "method_handle_to_xotcl gets handle '$methodHandle' // $definition" return $definition } - + Object instproc check {checkoptions} { ::nsf::method::assertion [self] check [::xotcl::checkoption_xotcl1_to_internal $checkoptions] } @@ -912,7 +912,7 @@ Object proc setExitHandler {newbody} {::nsf::exithandler set $newbody} Object proc getExitHandler {} {::nsf::exithandler get} - # resue some definitions from next scripting + # reuse some definitions from next scripting ::nsf::method::alias ::xotcl::Object copy ::nsf::classes::nx::Object::copy ::nsf::method::alias ::xotcl::Object move ::nsf::classes::nx::Object::move #::nsf::method::alias ::xotcl::Object defaultmethod ::nsf::classes::nx::Object::defaultmethod @@ -928,10 +928,10 @@ # Provide a backward compatible version of ::xotcl::alias # ::nsf::proc ::xotcl::alias { - obj:object - methodName - -per-object:switch - -objscope:switch + obj:object + methodName + -per-object:switch + -objscope:switch target } { ::nsf::method::alias \ @@ -953,7 +953,7 @@ } } } - + config proc mkindex {meta dir args} { set sp {[ ]+} set st {^[ ]*} @@ -1068,7 +1068,7 @@ :property {version 1.0} :property {autoexport {}} :property {export {}} - + :public class method create {name args} { set nq [namespace qualifiers $name] if {$nq ne "" && ![namespace exists $nq]} {Object create $nq} @@ -1079,7 +1079,7 @@ :require $name $name configure {*}$args } - + :public class method contains script { if {[info exists :provide]} { package provide [set :provide] [set :version] @@ -1103,16 +1103,16 @@ namespace eval :: [list namespace import [::xotcl::self]::$e] } } - + :public class method unknown args { #puts stderr "unknown: package $args" [set :packagecmd] {*}$args } - + :public class method verbose value { set :verbose $value } - + :public class method present args { if {$::tcl_version<8.3} { switch -exact -- [lindex $args 0] { @@ -1128,7 +1128,7 @@ [set :packagecmd] present {*}$args } } - + :public class method import {{-into ::} pkg} { :require $pkg namespace eval $into [subst -nocommands { @@ -1143,7 +1143,7 @@ } } } - + :public class method require args { #puts "XOTCL package require $args, current=[namespace current]" set prevComponent ${:component} @@ -1165,38 +1165,38 @@ set :component $prevComponent return $v } - + set :component . set :verbose 0 set :packagecmd ::package } - + unset -nocomplain cmd unset ::nsf::bootstrap # Documentation stub object -> just ignore per default. # if xoDoc is loaded, documentation will be activated ::xotcl::Object create ::xotcl::@ ::xotcl::@ proc unknown args {} - + set ::xotcl::confdir ~/.xotcl set ::xotcl::logdir $::xotcl::confdir/log namespace import ::nsf::tmpdir # finally, export contents defined for XOTcl namespace export Object Class Attribute myproc myvar my self next @ - + # # Provide parametersyntax for methods, which do not have a spec # # Tcl commands set ::nsf::parametersyntax(::append) "varName ?value value value ...?" set ::nsf::parametersyntax(::array) "option arrayName ?arg arg ...?" - set ::nsf::parametersyntax(::eval) "arg ?arg ...?" - set ::nsf::parametersyntax(::incr) "varName ?increment?" - set ::nsf::parametersyntax(::lappend) "varName ?value value value ...?" - set ::nsf::parametersyntax(::set) "varName ?value?" - set ::nsf::parametersyntax(::set) "varName ?value?" + set ::nsf::parametersyntax(::eval) "arg ?arg ...?" + set ::nsf::parametersyntax(::incr) "varName ?increment?" + set ::nsf::parametersyntax(::lappend) "varName ?value value value ...?" + set ::nsf::parametersyntax(::set) "varName ?value?" + set ::nsf::parametersyntax(::set) "varName ?value?" set ::nsf::parametersyntax(::subst) "?-nobackslashes? ?-nocommands? ?-novariables? string" set ::nsf::parametersyntax(::trace) "option ?arg arg ...?" set ::nsf::parametersyntax(::unset) "?-nocomplain? ?--? ?name name name ...?"