Index: TODO =================================================================== diff -u -r3b5f62d43eeca24c06993127a7637e7b9ec17216 -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba --- TODO (.../TODO) (revision 3b5f62d43eeca24c06993127a7637e7b9ec17216) +++ TODO (.../TODO) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) @@ -5807,6 +5807,15 @@ - extend regression test - make effects of namespace-imported classes more local + +remove various code smells: +- add const declarations +- prefer boolean tests +- don't write "for" loops without a block +- don't pass non-initialized value in an array on index [0] +- reduce variable scope +- prefer single returns statements in functions +- dont't use CONST unless defined by Tcl-API ======================================================================== TODO: Index: generic/nsf.c =================================================================== diff -u -r3b5f62d43eeca24c06993127a7637e7b9ec17216 -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba --- generic/nsf.c (.../nsf.c) (revision 3b5f62d43eeca24c06993127a7637e7b9ec17216) +++ generic/nsf.c (.../nsf.c) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) @@ -1013,12 +1013,12 @@ /* * Support for variable hash tables */ -static NSF_INLINE Var *VarHashCreateVar(TclVarHashTable *tablePtr, Tcl_Obj *key, int *newPtr) nonnull(1) nonnull(2); +static NSF_INLINE Var *VarHashCreateVar(TclVarHashTable *tablePtr, const Tcl_Obj *key, int *newPtr) nonnull(1) nonnull(2); static NSF_INLINE Var * -VarHashCreateVar(TclVarHashTable *tablePtr, Tcl_Obj *key, int *newPtr) { - Var *varPtr = NULL; - Tcl_HashEntry *hPtr; +VarHashCreateVar(TclVarHashTable *tablePtr, const Tcl_Obj *key, int *newPtr) { + Var *varPtr = NULL; + const Tcl_HashEntry *hPtr; nonnull_assert(tablePtr != NULL); nonnull_assert(key != NULL); @@ -1136,7 +1136,7 @@ /*********************************************************************** * EXTERN callable routines for the preliminary C interface ***********************************************************************/ -Nsf_Object * NsfGetSelfObj(Tcl_Interp *interp) nonnull(1); +Nsf_Object * NsfGetSelfObj(const Tcl_Interp *interp) nonnull(1); Nsf_Object * NsfGetObject(Tcl_Interp *interp, const char *name) nonnull(1) nonnull(2); Nsf_Class * NsfGetClass(Tcl_Interp *interp, const char *name) nonnull(1) nonnull(2); Nsf_Class * NsfIsClass(Tcl_Interp *interp, ClientData clientData) nonnull(1) nonnull(2); @@ -1163,7 +1163,7 @@ ClientData NsfGetClassClientData(Tcl_Interp *interp, Nsf_Class *cl) nonnull(1) nonnull(2); Nsf_Object * -NsfGetSelfObj(Tcl_Interp *interp) { +NsfGetSelfObj(const Tcl_Interp *interp) { nonnull_assert(interp != NULL); return (Nsf_Object *) GetSelfObj(interp); } @@ -2241,14 +2241,14 @@ * *---------------------------------------------------------------------- */ -static NsfClasses *NsfClassListFind(NsfClasses *clPtr, NsfClass *cl) nonnull(2); +static NsfClasses *NsfClassListFind(NsfClasses *clPtr, const NsfClass *cl) nonnull(2); static NsfClasses * -NsfClassListFind(NsfClasses *clPtr, NsfClass *cl) { +NsfClassListFind(NsfClasses *clPtr, const NsfClass *cl) { nonnull_assert(cl != NULL); - for (; clPtr; clPtr = clPtr->nextPtr) { + for (; clPtr != NULL; clPtr = clPtr->nextPtr) { if (clPtr->cl == cl) { break; } @@ -2284,7 +2284,7 @@ nonnull_assert(title != NULL); cl = (classListPtr != NULL) ? classListPtr->cl : NULL; - for (; classListPtr; classListPtr = classListPtr->nextPtr) { + for (; classListPtr != NULL; classListPtr = classListPtr->nextPtr) { count++; } @@ -2328,10 +2328,10 @@ * *---------------------------------------------------------------------- */ -static NsfClasses *NsfClassListUnlink(NsfClasses **firstPtrPtr, void *key) nonnull(1) nonnull(2); +static NsfClasses *NsfClassListUnlink(NsfClasses **firstPtrPtr, const void *key) nonnull(1) nonnull(2); static NsfClasses * -NsfClassListUnlink(NsfClasses **firstPtrPtr, void *key) { +NsfClassListUnlink(NsfClasses **firstPtrPtr, const void *key) { NsfClasses *entryPtr = NULL; nonnull_assert(firstPtrPtr != NULL); @@ -2341,7 +2341,10 @@ NsfClasses *prevPtr = NULL; /* list is non-empty */ - for (entryPtr = *firstPtrPtr; entryPtr; prevPtr = entryPtr, entryPtr = entryPtr->nextPtr) { + for (entryPtr = *firstPtrPtr; + entryPtr != NULL; + prevPtr = entryPtr, entryPtr = entryPtr->nextPtr + ) { if ((void *)entryPtr->cl == key) { /* found entry */ if (prevPtr != NULL) { @@ -2412,20 +2415,21 @@ cl->color = GRAY; for (; sl != NULL; sl = sl->nextPtr) { NsfClass *sc = sl->cl; + if (sc->color == GRAY) { cl->color = WHITE; return 0; } if (unlikely(sc->color == WHITE && !TopoSort(sc, baseClass, direction, withMixinOfs))) { cl->color = WHITE; if (cl == baseClass) { - register NsfClasses *pc; - for (pc = cl->order; pc; pc = pc->nextPtr) { pc->cl->color = WHITE; } + const register NsfClasses *pc; + for (pc = cl->order; pc != NULL; pc = pc->nextPtr) { pc->cl->color = WHITE; } } return 0; } } if (withMixinOfs != 0) { NsfCmdList *classMixins = ((cl->opt != NULL) && cl->opt->isClassMixinOf) ? cl->opt->isClassMixinOf : NULL; - for (; classMixins; classMixins = classMixins->nextPtr) { + for (; classMixins != NULL; classMixins = classMixins->nextPtr) { NsfClass *sc = NsfGetClassFromCmdPtr(classMixins->cmdPtr); if (likely(sc != NULL) @@ -2906,7 +2910,7 @@ #endif } - for (pl = sl->cl->order; pl; pl = pl->nextPtr) { + for (pl = sl->cl->order; pl != NULL; pl = pl->nextPtr) { #if defined(NSF_LINEARIZER_TRACE) fprintf(stderr, "====== PO order: %s %p\n", ClassName(pl->cl), pl->cl->order); #endif @@ -3407,8 +3411,8 @@ if (tailContainsSpace != 0) { const char *firstElementString; - Tcl_Namespace *parentNsPtr; - NsfObject *ensembleObject; + const Tcl_Namespace *parentNsPtr; + const NsfObject *ensembleObject; Tcl_Obj *methodHandleObj, **ov; int oc, i; @@ -3636,15 +3640,18 @@ NSF_INLINE static Tcl_Command FindMethod(Tcl_Namespace *nsPtr, const char *methodName) { - register Tcl_HashEntry *entryPtr; + register const Tcl_HashEntry *entryPtr; + Tcl_Command result; nonnull_assert(nsPtr != NULL); nonnull_assert(methodName != NULL); if ((entryPtr = Tcl_CreateHashEntry(Tcl_Namespace_cmdTablePtr(nsPtr), methodName, NULL))) { - return (Tcl_Command) Tcl_GetHashValue(entryPtr); + result = (Tcl_Command) Tcl_GetHashValue(entryPtr); + } else { + result = NULL; } - return NULL; + return result; } /* @@ -3837,7 +3844,7 @@ nonnull_assert(methodObj != NULL); nonnull_assert(cmdPtr != NULL); - for (pl = PrecedenceOrder(cl); pl; pl = pl->nextPtr) { + for (pl = PrecedenceOrder(cl); pl != NULL; pl = pl->nextPtr) { Tcl_Command cmd = ResolveMethodName(interp, pl->cl->nsPtr, methodObj, NULL, NULL, NULL, NULL, &fromClassNS); if (cmd != NULL) { @@ -4058,7 +4065,7 @@ * Collect all instances from all object systems */ - for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr; osPtr = osPtr->nextPtr) { + for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr != NULL; osPtr = osPtr->nextPtr) { GetAllInstances(interp, &instances, osPtr->rootClass); } @@ -4067,7 +4074,7 @@ /*fprintf(stderr, "===CALL destroy on OBJECTS\n");*/ - for (entryPtr = instances; entryPtr; entryPtr = entryPtr->nextPtr) { + for (entryPtr = instances; entryPtr != NULL; entryPtr = entryPtr->nextPtr) { NsfObject *object = (NsfObject *)entryPtr->clorobj; /*fprintf(stderr, "key = %s %p %d flags %.6x\n", @@ -4081,7 +4088,7 @@ /*fprintf(stderr, "===CALL destroy on CLASSES\n");*/ - for (entryPtr = instances; entryPtr; entryPtr = entryPtr->nextPtr) { + for (entryPtr = instances; entryPtr != NULL; entryPtr = entryPtr->nextPtr) { NsfClass *cl = entryPtr->clorobj; if (cl != NULL && ((cl->object.flags & NSF_DESTROY_CALLED) == 0u)) { @@ -4100,7 +4107,7 @@ #endif /* now free all objects systems with their root classes */ - for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr; osPtr = nPtr) { + for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr != NULL; osPtr = nPtr) { nPtr = osPtr->nextPtr; ObjectSystemFree(interp, osPtr); } @@ -4358,11 +4365,11 @@ * *---------------------------------------------------------------------- */ -static void GetVarAndNameFromHash(Tcl_HashEntry *hPtr, Var **val, Tcl_Obj **varNameObj) +static void GetVarAndNameFromHash(const Tcl_HashEntry *hPtr, Var **val, Tcl_Obj **varNameObj) nonnull(1) nonnull(2) nonnull(3); static void -GetVarAndNameFromHash(Tcl_HashEntry *hPtr, Var **val, Tcl_Obj **varNameObj) { +GetVarAndNameFromHash(const Tcl_HashEntry *hPtr, Var **val, Tcl_Obj **varNameObj) { nonnull_assert(hPtr != NULL); nonnull_assert(val != NULL); @@ -4595,7 +4602,7 @@ * TCL_CONTINUE takes care for variable creation. */ - Var *newVar = VarHashCreateVar(varTablePtr, key, &new); + const Var *newVar = VarHashCreateVar(varTablePtr, key, &new); *varPtr = (Tcl_Var)newVar; } DECR_REF_COUNT(key); @@ -4755,7 +4762,7 @@ VarHashRefCount(var)++; #if defined(VAR_RESOLVER_TRACE) { - Var *v = (Var *)(resVarInfo->var); + const Var *v = (Var *)(resVarInfo->var); fprintf(stderr, ".... looked up existing var %s var %p flags = %.6x undefined %d\n", ObjStr(resVarInfo->nameObj), v, v->flags, @@ -5198,7 +5205,7 @@ NsfObjectSystem *osPtr; if ((frameFlags & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) != 0u) { - NsfCallStackContent *cscPtr = (NsfCallStackContent *)varFramePtr->clientData; + const NsfCallStackContent *cscPtr = (NsfCallStackContent *)varFramePtr->clientData; assert(cscPtr != NULL); object = cscPtr->self; } else if ((frameFlags & (FRAME_IS_NSF_OBJECT)) != 0u) { @@ -5627,7 +5634,7 @@ NSDeleteChildren(Tcl_Interp *interp, Tcl_Namespace *nsPtr) { Tcl_HashTable *cmdTablePtr = Tcl_Namespace_cmdTablePtr(nsPtr); Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; int expected; nonnull_assert(interp != NULL); @@ -5699,7 +5706,7 @@ TclVarHashTable *varTablePtr = Tcl_Namespace_varTablePtr(nsPtr); Tcl_HashTable *cmdTablePtr = Tcl_Namespace_cmdTablePtr(nsPtr); Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; nonnull_assert(interp != NULL); nonnull_assert(nsPtr != NULL); @@ -6123,7 +6130,7 @@ ReverseLookupCmdFromCmdTable(Tcl_Interp *interp /* needed? */, Tcl_Command searchCmdPtr, Tcl_HashTable *cmdTablePtr) { Tcl_HashSearch search; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; nonnull_assert(searchCmdPtr != NULL); nonnull_assert(cmdTablePtr != NULL); @@ -6230,7 +6237,7 @@ /*fprintf(stderr, "GetObjectFromString name = '%s'\n", name);*/ cmd = NSFindCommand(interp, name); - if (likely(cmd && CmdIsNsfObject(cmd))) { + if (likely(cmd != NULL && CmdIsNsfObject(cmd))) { /*fprintf(stderr, "GetObjectFromString %s => %p\n", name, Tcl_Command_objClientData(cmd));*/ return (NsfObject *)Tcl_Command_objClientData(cmd); } @@ -6546,6 +6553,7 @@ ALLOC_ON_STACK(Tcl_Obj*, 3, ov); savedResultObj = Tcl_GetObjResult(interp); INCR_REF_COUNT(savedResultObj); + ov[0] = NULL; ov[1] = resultObj; ov[2] = valueObj; if (NsfCallCommand(interp, NSF_FORMAT, 3, ov) != TCL_OK) { @@ -7210,7 +7218,7 @@ nonnull_assert(value != NULL); keyString = ObjStr(key); - for (elt = *list, prevPtr = list; elt; prevPtr = &elt->nextPtr, elt = elt->nextPtr) { + for (elt = *list, prevPtr = list; elt != NULL; prevPtr = &elt->nextPtr, elt = elt->nextPtr) { const char *eltString = ObjStr(elt->content); if (key == elt->content || strcmp(keyString, eltString) == 0) { @@ -7274,7 +7282,7 @@ nonnull_assert(interp != NULL); - for (; alist; alist = alist->nextPtr) { + for (; alist != NULL; alist = alist->nextPtr) { Tcl_ListObjAppendElement(interp, listObj, alist->content); } return listObj; @@ -7318,7 +7326,7 @@ static NsfProcAssertion * AssertionFindProcs(NsfAssertionStore *aStore, const char *name) { - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; nonnull_assert(aStore != NULL); nonnull_assert(name != NULL); @@ -7394,7 +7402,7 @@ static void AssertionRemoveStore(NsfAssertionStore *aStore) { Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; nonnull_assert(aStore != NULL); @@ -7731,11 +7739,11 @@ CmdListRemoveDeleted(mixinList, GuardDel); - for (m = *mixinList; m; m = m->nextPtr) { + for (m = *mixinList; m != NULL; m = m->nextPtr) { NsfClass *mCl = NsfGetClassFromCmdPtr(m->cmdPtr); if (mCl != NULL) { - for (pl = PrecedenceOrder(mCl); pl; pl = pl->nextPtr) { + for (pl = PrecedenceOrder(mCl); pl != NULL; pl = pl->nextPtr) { if (IsRootClass(pl->cl) == 0) { NsfClassOpt *opt = pl->cl->opt; @@ -7823,7 +7831,7 @@ nonnull_assert(classListPtr != NULL); nonnull_assert(checkList != NULL); - for (pl = PrecedenceOrder(cl); pl; pl = pl->nextPtr) { + for (pl = PrecedenceOrder(cl); pl != NULL; pl = pl->nextPtr) { NsfClassOpt *clopt = pl->cl->opt; if (clopt != NULL && clopt->classMixins) { MixinComputeOrderFullList(interp, &clopt->classMixins, @@ -7874,7 +7882,7 @@ * TODO: we could add this already in MixinComputeOrderFullList() if we * provide an additional flag. */ - for (m = object->opt->objMixins; m; m = m->nextPtr) { + for (m = object->opt->objMixins; m != NULL; m = m->nextPtr) { NsfClass *mCl = NsfGetClassFromCmdPtr(m->cmdPtr); if (mCl != NULL) { NsfClassListAddNoDup(&checkList, mCl, NULL, NULL); @@ -7902,7 +7910,7 @@ * Don't add duplicates or classes of the precedence order to the resulting * list. */ - for (clPtr = mixinClasses; clPtr; clPtr = clPtr->nextPtr) { + for (clPtr = mixinClasses; clPtr != NULL; clPtr = clPtr->nextPtr) { NsfClass *cl = clPtr->cl; NsfClasses *checker; @@ -8152,10 +8160,10 @@ nonnull_assert(startCl != NULL); subClasses = TransitiveSubClasses(startCl); - for (clPtr = subClasses; clPtr; clPtr = clPtr->nextPtr) { + for (clPtr = subClasses; clPtr != NULL; clPtr = clPtr->nextPtr) { Tcl_HashTable *tablePtr = &clPtr->cl->instances; Tcl_HashSearch search; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; for (hPtr = Tcl_FirstHashEntry(tablePtr, &search); hPtr != NULL; @@ -8366,7 +8374,7 @@ if (startCl->opt != NULL) { NsfCmdList *m; - for (m = startCl->opt->isClassMixinOf; m; m = m->nextPtr) { + for (m = startCl->opt->isClassMixinOf; m != NULL; m = m->nextPtr) { NsfClass *cl; /* we should have no deleted commands in the list */ @@ -8390,7 +8398,7 @@ if (startCl->opt != NULL) { NsfCmdList *m; - for (m = startCl->opt->isObjectMixinOf; m; m = m->nextPtr) { + for (m = startCl->opt->isObjectMixinOf; m != NULL; m = m->nextPtr) { NsfObject *object; /* we should have no deleted commands in the list */ @@ -8447,7 +8455,7 @@ nonnull_assert(resultSet != NULL); nonnull_assert(mixinOfs != NULL); - for (m = mixinOfs; m; m = m->nextPtr) { + for (m = mixinOfs; m != NULL; m = m->nextPtr) { NsfClass *cl; int rc, new; @@ -8623,7 +8631,7 @@ if (startCl->opt != NULL) { NsfCmdList *m; - for (m = startCl->opt->classMixins; m; m = m->nextPtr) { + for (m = startCl->opt->classMixins; m != NULL; m = m->nextPtr) { /* we should have no deleted commands in the list */ assert((Tcl_Command_flags(m->cmdPtr) & CMD_IS_DELETED) == 0); @@ -8916,7 +8924,7 @@ */ do { Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; Tcl_HashTable *instanceTablePtr; /* @@ -9192,7 +9200,7 @@ /*fprintf(stderr, "... new branch\n");*/ - for (; cmdList; cmdList = cmdList->nextPtr) { + for (; cmdList != NULL; cmdList = cmdList->nextPtr) { NsfClass *cl1; /* @@ -9674,7 +9682,7 @@ if (guardAdded == 0) { /* search per-class filters */ - for (pl = PrecedenceOrder(object->cl); !guardAdded && pl; pl = pl->nextPtr) { + for (pl = PrecedenceOrder(object->cl); !guardAdded && pl != NULL; pl = pl->nextPtr) { NsfClassOpt *clopt = pl->cl->opt; if (clopt != NULL && clopt->classFilters != NULL) { guardAdded = GuardAddFromDefinitionList(dest, filterCmd, clopt->classFilters); @@ -9804,7 +9812,7 @@ static int FilterIsActive(Tcl_Interp *interp, const char *methodName) { NsfRuntimeState *rst = RUNTIME_STATE(interp); - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; nonnull_assert(interp != NULL); nonnull_assert(methodName != NULL); @@ -9958,16 +9966,17 @@ static void FilterSearchAgain(Tcl_Interp *interp, NsfCmdList **filters, NsfObject *startingObject, NsfClass *startingClass) { - NsfCmdList *cmdList = NULL, *del = NULL; + NsfCmdList *cmdList; nonnull_assert(interp != NULL); nonnull_assert(filters != NULL); CmdListRemoveDeleted(filters, GuardDel); cmdList = *filters; - + while (cmdList != NULL) { - NsfClass *cl = NULL; + NsfCmdList *del = NULL; + NsfClass *cl = NULL; const char *simpleName = Tcl_GetCommandName(interp, cmdList->cmdPtr); Tcl_Command cmd = FilterSearch(simpleName, startingObject, startingClass, &cl); @@ -9985,7 +9994,6 @@ if (del != NULL) { CmdListDeleteCmdListEntry(del, GuardDel); - del = NULL; } } } @@ -10017,7 +10025,7 @@ do { Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; assert(subClasses->cl); @@ -10076,7 +10084,7 @@ do { Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; NsfClassOpt *opt; assert(subClasses->cl); @@ -10247,7 +10255,7 @@ /* don't search on the start class again */ pl = pl->nextPtr; /* now go up the hierarchy */ - for(; pl; pl = pl->nextPtr) { + for(; pl != NULL; pl = pl->nextPtr) { Tcl_Command pi = FindMethod(pl->cl->nsPtr, simpleName); if (pi != NULL) { CmdListAdd(filterList, pi, pl->cl, /*noDuplicates*/ 0, 1); @@ -10324,7 +10332,7 @@ /* * Append per-class filters. */ - for (pl = PrecedenceOrder(object->cl); pl; pl = pl->nextPtr) { + for (pl = PrecedenceOrder(object->cl); pl != NULL; pl = pl->nextPtr) { NsfClassOpt *clopt = pl->cl->opt; if (clopt != NULL && clopt->classFilters != NULL) { FilterComputeOrderFullList(interp, &clopt->classFilters, &filterList); @@ -10339,7 +10347,7 @@ /* * Search for filterList->cmdPtr */ - for (checker = next = filterList->nextPtr; checker; checker = checker->nextPtr) { + for (checker = next = filterList->nextPtr; checker != NULL; checker = checker->nextPtr) { if (checker->cmdPtr == filterList->cmdPtr) { break; } @@ -10502,7 +10510,7 @@ } /* search per-class filters */ - for (pl = PrecedenceOrder(object->cl); pl; pl = pl->nextPtr) { + for (pl = PrecedenceOrder(object->cl); pl != NULL; pl = pl->nextPtr) { NsfClassOpt *opt = pl->cl->opt; if (opt != NULL && opt->classFilters != NULL) { if (CmdListFindCmdInList(cmd, opt->classFilters)) { @@ -10800,7 +10808,8 @@ VarExists(Tcl_Interp *interp, NsfObject *object, const char *name1, const char *name2, unsigned int flags) { CallFrame frame, *framePtr = &frame; - Var *varPtr, *arrayPtr; + const Var *varPtr; + Var *arrayPtr; int result; nonnull_assert(interp != NULL); @@ -11056,7 +11065,7 @@ firstChar = *methodName; defOsPtr = GetObjectSystem(object); - for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr; osPtr = osPtr->nextPtr) { + for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr != NULL; osPtr = osPtr->nextPtr) { int i, isRootClassMethod; unsigned int flag = 0u; NsfObject *defObject; @@ -11248,7 +11257,7 @@ nonnull_assert(paramsPtr != NULL); /*fprintf(stderr, "ParamsFree %p\n", paramsPtr);*/ - for (paramPtr = paramsPtr; paramPtr->name; paramPtr++) { + for (paramPtr = paramsPtr; paramPtr->name != NULL; paramPtr++) { ParamFree(paramPtr); } @@ -11320,14 +11329,16 @@ /* * Count the parameters */ - for (pPtr = paramsPtr, maxParams = 0; pPtr->name; pPtr++, maxParams++); + for (pPtr = paramsPtr, maxParams = 0; pPtr->name != NULL; pPtr++, maxParams++) { + ; + } /* * Allocate the number of potentional matches */ paramList = ParamsNew(maxParams); - for (pPtr = paramsPtr, nrMatchingParams = 0; pPtr->name; pPtr++) { + for (pPtr = paramsPtr, nrMatchingParams = 0; pPtr->name != NULL; pPtr++) { if (Tcl_StringMatch( ObjStr(pPtr->nameObj), pattern)) { paramList[nrMatchingParams] = *pPtr; nrMatchingParams++; @@ -12137,7 +12148,7 @@ INCR_REF_COUNT2("paramDefsObj", argStringObj); - for (pPtr = paramsPtr; pPtr->name; pPtr++) { + for (pPtr = paramsPtr; pPtr->name != NULL; pPtr++) { if ((pPtr->flags & NSF_ARG_NOCONFIG) != 0u) { /* @@ -12419,7 +12430,11 @@ assert((object->flags & NSF_FILTER_ORDER_VALID) != 0u); /* otherwise: FilterComputeDefined(interp, object);*/ - for (cmdList = object->filterOrder; cmdList && cmdList->cmdPtr != cmdPtr; cmdList = cmdList->nextPtr); + for (cmdList = object->filterOrder; + (cmdList != NULL) && (cmdList->cmdPtr != cmdPtr); + cmdList = cmdList->nextPtr) { + ; + } if (cmdList != NULL) { /* @@ -12908,7 +12923,7 @@ for (varFramePtr = (Tcl_CallFrame *)framePtr; likely(varFramePtr != NULL); varFramePtr = Tcl_CallFrame_callerVarPtr(varFramePtr)) { - NsfCallStackContent *cscPtr; + const NsfCallStackContent *cscPtr; /* * If we reach a non-nsf frame, or it is not an ensemble, we are done. @@ -13318,7 +13333,7 @@ NSF_INLINE static int ObjectDispatchFinalize(Tcl_Interp *interp, NsfCallStackContent *cscPtr, int result /*, char *msg, const char *methodName*/) { - NsfRuntimeState *rst = RUNTIME_STATE(interp); + const NsfRuntimeState *rst = RUNTIME_STATE(interp); NsfObject *object; unsigned int flags; @@ -13341,9 +13356,9 @@ if (likely(result == TCL_OK && (cscPtr->cmdPtr != NULL) && (Tcl_Command_cmdEpoch(cscPtr->cmdPtr) == 0))) { - NsfParamDefs *paramDefs = ParamDefsGet(cscPtr->cmdPtr, NULL); + const NsfParamDefs *paramDefs = ParamDefsGet(cscPtr->cmdPtr, NULL); - if ((paramDefs != NULL) && paramDefs->returns) { + if ((paramDefs != NULL) && (paramDefs->returns != NULL)) { Tcl_Obj *valueObj = Tcl_GetObjResult(interp); result = ParameterCheck(interp, paramDefs->returns, valueObj, "return-value:", @@ -13456,7 +13471,7 @@ Tcl_Obj *cmdName, *methodObj; NsfCallStackContent csc, *cscPtr = NULL; int isValidCsc = 1; - NsfRuntimeState *rst; + const NsfRuntimeState *rst; nonnull_assert(clientData != NULL); nonnull_assert(interp != NULL); @@ -14434,6 +14449,7 @@ Tcl_Obj *objv[4]; /*fprintf(stderr, "ConvertToTclobj %s (must be %s)\n", ObjStr(objPtr), ObjStr(pPtr->converterArg));*/ + objv[0] = NULL; objv[1] = pPtr->converterArg; objv[2] = NsfGlobalObjs[NSF_OPTION_STRICT]; objv[3] = objPtr; @@ -14500,14 +14516,14 @@ Nsf_ConvertToBoolean(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { int result, boolVal; - result = Tcl_GetBooleanFromObj(interp, objPtr, &boolVal); nonnull_assert(interp != NULL); nonnull_assert(objPtr != NULL); nonnull_assert(pPtr != NULL); nonnull_assert(clientData != NULL); nonnull_assert(outObjPtr != NULL); + result = Tcl_GetBooleanFromObj(interp, objPtr, &boolVal); if (likely(result == TCL_OK)) { *clientData = (ClientData)INT2PTR(boolVal); } else { @@ -14540,8 +14556,7 @@ int Nsf_ConvertToInt32(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { - int result; - int i; + int result, i; nonnull_assert(interp != NULL); nonnull_assert(objPtr != NULL); @@ -14696,6 +14711,7 @@ int Nsf_ConvertToObject(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { + int result; nonnull_assert(interp != NULL); nonnull_assert(objPtr != NULL); @@ -14705,9 +14721,11 @@ assert(*outObjPtr == objPtr); if (likely(GetObjectFromObj(interp, objPtr, (NsfObject **)clientData) == TCL_OK)) { - return IsObjectOfType(interp, (NsfObject *)*clientData, "object", objPtr, pPtr); + result = IsObjectOfType(interp, (NsfObject *)*clientData, "object", objPtr, pPtr); + } else { + result = NsfObjErrType(interp, NULL, objPtr, "object", (Nsf_Param *)pPtr); } - return NsfObjErrType(interp, NULL, objPtr, "object", (Nsf_Param *)pPtr); + return result; } /* @@ -14734,7 +14752,7 @@ int Nsf_ConvertToClass(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { - int withUnkown; + int withUnkown, result; nonnull_assert(interp != NULL); nonnull_assert(objPtr != NULL); @@ -14746,9 +14764,11 @@ withUnkown = (RUNTIME_STATE(interp)->doClassConverterOmitUnkown == 0); if (likely(GetClassFromObj(interp, objPtr, (NsfClass **)clientData, withUnkown) == TCL_OK)) { - return IsObjectOfType(interp, (NsfObject *)*clientData, "class", objPtr, pPtr); + result = IsObjectOfType(interp, (NsfObject *)*clientData, "class", objPtr, pPtr); + } else { + result = NsfObjErrType(interp, NULL, objPtr, "class", (Nsf_Param *)pPtr); } - return NsfObjErrType(interp, NULL, objPtr, "class", (Nsf_Param *)pPtr); + return result; } @@ -14790,9 +14810,10 @@ result = Tcl_ConvertToType(interp, objPtr, &NsfFilterregObjType); if (likely(result == TCL_OK)) { *clientData = objPtr; - return result; + } else { + result = NsfObjErrType(interp, NULL, objPtr, "filterreg", (Nsf_Param *)pPtr); } - return NsfObjErrType(interp, NULL, objPtr, "filterreg", (Nsf_Param *)pPtr); + return result; } /* @@ -14832,9 +14853,10 @@ result = Tcl_ConvertToType(interp, objPtr, &NsfMixinregObjType); if (likely(result == TCL_OK)) { *clientData = objPtr; - return result; + } else { + result = NsfObjErrType(interp, NULL, objPtr, "mixinreg", (Nsf_Param *)pPtr); } - return NsfObjErrType(interp, NULL, objPtr, "mixinreg", (Nsf_Param *)pPtr); + return result; } /* @@ -14863,6 +14885,7 @@ Nsf_ConvertToParameter(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { const char *value; + int result; nonnull_assert(interp != NULL); nonnull_assert(objPtr != NULL); @@ -14875,13 +14898,14 @@ value = ObjStr(objPtr); /*fprintf(stderr, "convert to parameter '%s' t '%s'\n", value, pPtr->type);*/ if (*value == ':' || (*value == '-' && *(value + 1) == ':')) { - return NsfPrintError(interp, "leading colon in '%s' not allowed in parameter specification '%s'", - ObjStr(objPtr), pPtr->name); + result = NsfPrintError(interp, "leading colon in '%s' not allowed in parameter specification '%s'", + ObjStr(objPtr), pPtr->name); + } else { + *clientData = (char *)ObjStr(objPtr); + result = TCL_OK; } - *clientData = (char *)ObjStr(objPtr); - - return TCL_OK; + return result; } /* @@ -16276,7 +16300,7 @@ Nsf_Param *pPtr; Tcl_Obj *argList = Tcl_NewListObj(0, NULL); - for (pPtr = parsedParam.paramDefs->paramsPtr; pPtr->name; pPtr++) { + for (pPtr = parsedParam.paramDefs->paramsPtr; pPtr->name != NULL; pPtr++) { if (*pPtr->name == '-') { Tcl_ListObjAppendElement(interp, argList, Tcl_NewStringObj(pPtr->name+1, -1)); } else { @@ -16865,7 +16889,7 @@ if (paramDefs != NULL) { Nsf_Param *paramPtr; - for (paramPtr = paramDefs->paramsPtr; paramPtr->name; paramPtr++) { + for (paramPtr = paramDefs->paramsPtr; paramPtr->name != NULL; paramPtr++) { if (*paramPtr->name == '-') { Tcl_Obj *varNameObj = Tcl_NewStringObj(paramPtr->name+1, -1); @@ -17180,7 +17204,7 @@ * provide for ImportedCmdData client data etc., we cannot * directly use it. */ - for (refPtr = aliasedCmd->importRefPtr; refPtr; refPtr = refPtr->nextPtr) { + for (refPtr = aliasedCmd->importRefPtr; refPtr != NULL; refPtr = refPtr->nextPtr) { if (refPtr->importedCmdPtr == (Command *) tcd->aliasCmd) { if (prevPtr == NULL) { aliasedCmd->importRefPtr = refPtr->nextPtr; @@ -17448,7 +17472,7 @@ if (slotContainerObject != NULL && slotContainerObject->nsPtr && ((slotContainerObject->flags & NSF_IS_SLOT_CONTAINER) != 0u)) { Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; Tcl_HashTable *cmdTablePtr = Tcl_Namespace_cmdTablePtr(slotContainerObject->nsPtr); Tcl_Command cmd; @@ -17729,7 +17753,7 @@ /* * Skip until actual class */ - for ( ; pl; pl = pl->nextPtr) { + for ( ; pl != NULL; pl = pl->nextPtr) { if (pl->cl == cl) { pl = pl->nextPtr; break; @@ -18359,7 +18383,7 @@ int rc = 0; Tcl_HashSearch search; Tcl_HashEntry *entryPtr; - Tcl_Var *varPtr; + const Tcl_Var *varPtr; nonnull_assert(interp != NULL); nonnull_assert(nsPtr != NULL); @@ -18415,10 +18439,10 @@ *---------------------------------------------------------------------- */ -static int FreeUnsetTraceVariable(Tcl_Interp *interp, NsfObject *object) nonnull(1) nonnull(2); +static int FreeUnsetTraceVariable(Tcl_Interp *interp, const NsfObject *object) nonnull(1) nonnull(2); static int -FreeUnsetTraceVariable(Tcl_Interp *interp, NsfObject *object) { +FreeUnsetTraceVariable(Tcl_Interp *interp, const NsfObject *object) { nonnull_assert(interp != NULL); nonnull_assert(object != NULL); @@ -19257,7 +19281,7 @@ if (IsRootClass(cl) == 0) { Tcl_HashTable *instanceTablePtr = &cl->instances; Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; for (hPtr = Tcl_FirstHashEntry(instanceTablePtr, &hSrch); hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSrch)) { @@ -19854,7 +19878,7 @@ } /* is the class a subclass of a meta-class? */ - for (pl = PrecedenceOrder(cl); pl; pl = pl->nextPtr) { + for (pl = PrecedenceOrder(cl); pl != NULL; pl = pl->nextPtr) { if (IsRootMetaClass(pl->cl)) { return 1; } @@ -21243,7 +21267,7 @@ nonnull_assert(interp != NULL); nonnull_assert(nsPtr != NULL); - for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr; osPtr = osPtr->nextPtr) { + for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr != NULL; osPtr = osPtr->nextPtr) { Tcl_Command cmd = osPtr->rootClass->object.id; if ((Tcl_Namespace *)((Command *)cmd)->nsPtr == nsPtr) { return 1; @@ -21805,7 +21829,7 @@ #if defined(PARSE_TRACE) { Nsf_Param const *pPtr; fprintf(stderr, "PARAMETER "); - for (o = 0, pPtr = paramPtr; pPtr->name; o++, pPtr++) { + for (o = 0, pPtr = paramPtr; pPtr->name != NULL; o++, pPtr++) { fprintf(stderr, "[%d]%s (nrargs %d %s) ", o, pPtr->name, pPtr->nrArgs, (pPtr->flags & NSF_ARG_REQUIRED) != 0u ? "req" : "opt"); @@ -22249,7 +22273,7 @@ static int ListVarKeys(Tcl_Interp *interp, Tcl_HashTable *tablePtr, const char *pattern) { - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; nonnull_assert(interp != NULL); @@ -22259,21 +22283,23 @@ INCR_REF_COUNT(patternObj); hPtr = (tablePtr != NULL) ? Tcl_CreateHashEntry(tablePtr, (char *)patternObj, NULL) : NULL; if (hPtr != NULL) { - Var *val = TclVarHashGetValue(hPtr); + const Var *val = TclVarHashGetValue(hPtr); + Tcl_SetObjResult(interp, TclVarHashGetKey(val)); } else { Tcl_SetObjResult(interp, NsfGlobalObjs[NSF_EMPTY]); } DECR_REF_COUNT(patternObj); } else { - Tcl_Obj *list = Tcl_NewListObj(0, NULL); + Tcl_Obj *list = Tcl_NewListObj(0, NULL); Tcl_HashSearch hSrch; hPtr = (tablePtr != NULL) ? Tcl_FirstHashEntry(tablePtr, &hSrch) : NULL; for (; hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSrch)) { - Var *val = TclVarHashGetValue(hPtr); - Tcl_Obj *key = TclVarHashGetKey(val); + const Var *val = TclVarHashGetValue(hPtr); + Tcl_Obj *key = TclVarHashGetKey(val); + if (pattern == NULL || Tcl_StringMatch(ObjStr(key), pattern)) { Tcl_ListObjAppendElement(interp, list, key); } @@ -23457,7 +23483,7 @@ int methodType, int withCallprotection, int withPath, Tcl_HashTable *dups, NsfObject *object, int withPer_object) { Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; Tcl_Command cmd; const char *key; int isObject, methodTypeMatch; @@ -23693,7 +23719,7 @@ Tcl_Obj *list = Tcl_NewListObj(0, NULL); Tcl_HashSearch hSrch; Tcl_HashTable *cmdTablePtr = Tcl_Namespace_cmdTablePtr(object->nsPtr); - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; for (hPtr = Tcl_FirstHashEntry(cmdTablePtr, &hSrch); hPtr != NULL; @@ -23750,7 +23776,7 @@ nonnull_assert(tablePtr != NULL); if (withDefinition != 0) { - Tcl_HashEntry *hPtr = (pattern != NULL) ? Tcl_CreateHashEntry(tablePtr, pattern, NULL) : NULL; + const Tcl_HashEntry *hPtr = (pattern != NULL) ? Tcl_CreateHashEntry(tablePtr, pattern, NULL) : NULL; /* * Notice: we don't use pattern for wildcard matching here; pattern can * only contain wildcards when used without "-definition". @@ -24378,7 +24404,7 @@ return TCL_OK; } - + /* cmd __db_get_obj NsfDebugGetDict { {-argName "obj" -required 1 -type tclobj} @@ -24433,7 +24459,7 @@ /* * Collect all instances from all object systems. */ - for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr; osPtr = osPtr->nextPtr) { + for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr != NULL; osPtr = osPtr->nextPtr) { GetAllInstances(interp, &instances, osPtr->rootClass); } @@ -24457,7 +24483,7 @@ object, ObjectName(object), object->activationCount);*/ framePtr = (Tcl_CallFrame *)Tcl_Interp_framePtr(interp); - for (; framePtr; framePtr = Tcl_CallFrame_callerPtr(framePtr)) { + for (; framePtr != NULL; framePtr = Tcl_CallFrame_callerPtr(framePtr)) { int frameFlags = Tcl_CallFrame_isProcCallFrame(framePtr); NsfCallStackContent *cscPtr = ((frameFlags & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) != 0u) ? @@ -24573,9 +24599,9 @@ nonnull_assert(interp != NULL); if (likely(proc != NULL)) { - CompiledLocal *ap; - Var *varPtr; - int i; + const CompiledLocal *ap; + const Var *varPtr; + int i; for (ap = proc->firstLocalPtr, i = 0; ap; ap = ap->nextPtr, i++) { if (!TclIsCompiledLocalArgument(ap)) { @@ -24698,7 +24724,7 @@ NsfObjectSystem *osPtr; Tcl_Obj *list = Tcl_NewListObj(0, NULL); - for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr; osPtr = osPtr->nextPtr) { + for (osPtr = RUNTIME_STATE(interp)->objectSystems; osPtr != NULL; osPtr = osPtr->nextPtr) { Tcl_Obj *osObj = Tcl_NewListObj(0, NULL); Tcl_Obj *systemMethods = Tcl_NewListObj(0, NULL); int idx; @@ -25288,7 +25314,7 @@ Tcl_Obj *resultObj; int i; - for (i = 0, paramPtr = paramDefs->paramsPtr; paramPtr->name; paramPtr++, i++) { + for (i = 0, paramPtr = paramDefs->paramsPtr; paramPtr->name != NULL; paramPtr++, i++) { Tcl_Obj *valueObj = pc.objv[i]; if (valueObj != NsfGlobalObjs[NSF___UNKNOWN__]) { @@ -26509,7 +26535,7 @@ Tcl_Namespace *fromNsPtr = NULL, *toNsPtr; Var *varPtr = NULL; Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; TclVarHashTable *varTablePtr; NsfObject *object, *destObject; const char *destFullName; @@ -26790,7 +26816,7 @@ if (dependentSubClasses != NULL) { - for (clPtr = dependentSubClasses; clPtr; clPtr = clPtr->nextPtr) { + for (clPtr = dependentSubClasses; clPtr != NULL; clPtr = clPtr->nextPtr) { NsfClass *subClass = clPtr->cl; if (subClass->parsedParamPtr != NULL) { @@ -26920,7 +26946,7 @@ * Fold the per-position lists into a flat result list */ resultObj = Tcl_NewListObj(0, NULL); - for (elt = objList; elt; elt = elt->nextPtr) { + for (elt = objList; elt != NULL; elt = elt->nextPtr) { Tcl_ListObjGetElements(interp, elt->payload, &objc, &objv); for (i = 0; i < objc; i++) { Tcl_ListObjAppendElement(interp, resultObj, objv[i]); @@ -27237,7 +27263,7 @@ /* * Delete from old isObjectMixinOf lists */ - for (cmdlist = objopt->objMixins; cmdlist; cmdlist = cmdlist->nextPtr) { + for (cmdlist = objopt->objMixins; cmdlist != NULL; cmdlist = cmdlist->nextPtr) { cl = NsfGetClassFromCmdPtr(cmdlist->cmdPtr); clopt = (cl != NULL) ? cl->opt : NULL; if (clopt != NULL) { @@ -28280,7 +28306,9 @@ #if defined(CONFIGURE_ARGS_TRACE) fprintf(stderr, "*** POPULATE OBJ '%s': nr of parsed args %d\n", ObjectName(object), pc.objc); #endif - for (i = 1, paramPtr = paramDefs->paramsPtr; paramPtr->name; paramPtr++, i++) { + for (i = 1, paramPtr = paramDefs->paramsPtr; + paramPtr->name != NULL; + paramPtr++, i++) { /* * Set the new value always when the new value was specified (was not @@ -28610,7 +28638,7 @@ * (very unlikely). */ for (paramPtr = paramDefs->paramsPtr; - paramPtr->name && *paramPtr->name != '-'; + (paramPtr->name != NULL) && (*paramPtr->name != '-'); paramPtr++); /* @@ -30475,7 +30503,7 @@ nonnull_assert(object != NULL); precedenceList = ComputePrecedenceList(interp, object, pattern, !withIntrinsicOnly, 1); - for (pl = precedenceList; pl; pl = pl->nextPtr) { + for (pl = precedenceList; pl != NULL; pl = pl->nextPtr) { assert(pl->cl != NULL); Tcl_ListObjAppendElement(interp, resultObj, pl->cl->object.cmdName); } @@ -30616,15 +30644,15 @@ intrinsic = PrecedenceOrder(cl); NsfClassListAddPerClassMixins(interp, cl, &mixinClasses, &checkList); - for (pl = mixinClasses; pl; pl = pl->nextPtr) { + for (pl = mixinClasses; pl != NULL; pl = pl->nextPtr) { if (NsfClassListFind(pl->nextPtr, pl->cl) == NULL && NsfClassListFind(intrinsic, pl->cl) == NULL) { AppendMatchingElement(interp, resultObj, pl->cl->object.cmdName, pattern); } } if (intrinsic != NULL) { - for (pl = intrinsic->nextPtr; pl; pl = pl->nextPtr) { + for (pl = intrinsic->nextPtr; pl != NULL; pl = pl->nextPtr) { AppendMatchingElement(interp, resultObj, pl->cl->object.cmdName, pattern); } } @@ -30672,7 +30700,7 @@ do { Tcl_HashTable *tablePtr = &subClasses->cl->instances; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; Tcl_HashSearch search; for (hPtr = Tcl_FirstHashEntry(tablePtr, &search); @@ -30834,7 +30862,7 @@ } NsfClassListAddPerClassMixins(interp, class, &mixinClasses, &checkList); - for (clPtr = mixinClasses; clPtr; clPtr = clPtr->nextPtr) { + for (clPtr = mixinClasses; clPtr != NULL; clPtr = clPtr->nextPtr) { if (NsfClassListFind(clPtr->nextPtr, clPtr->cl)) { continue; } @@ -30982,7 +31010,7 @@ * Compute the closure: first the transitive mixin-classes... */ NsfClassListAddPerClassMixins(interp, class, &mixinClasses, &checkList); - for (clPtr = mixinClasses; clPtr; clPtr = clPtr->nextPtr) { + for (clPtr = mixinClasses; clPtr != NULL; clPtr = clPtr->nextPtr) { if (NsfClassListFind(clPtr->nextPtr, clPtr->cl) == NULL && NsfClassListFind(intrinsicClasses, clPtr->cl) == NULL) { NsfClassListAdd(&precedenceList, clPtr->cl, NULL); @@ -30992,7 +31020,7 @@ * ... followed by the intrinsic classes. */ NsfClassListAdd(&precedenceList, class, NULL); - for (clPtr = intrinsicClasses->nextPtr; clPtr; clPtr = clPtr->nextPtr) { + for (clPtr = intrinsicClasses->nextPtr; clPtr != NULL; clPtr = clPtr->nextPtr) { NsfClassListAdd(&precedenceList, clPtr->cl, NULL); } if (checkList != NULL) { @@ -31014,7 +31042,7 @@ Tcl_InitHashTable(&slotTable, TCL_STRING_KEYS); MEM_COUNT_ALLOC("Tcl_InitHashTable", &slotTable); - for (clPtr = precedenceList; clPtr; clPtr = clPtr->nextPtr) { + for (clPtr = precedenceList; clPtr != NULL; clPtr = clPtr->nextPtr) { if (MethodSourceMatches(withSource, clPtr->cl, NULL)) { AddSlotObjects(interp, &clPtr->cl->object, "::slot", &slotTable, withSource, type, pattern, listObj); @@ -31104,7 +31132,7 @@ Tcl_HashTable *varTablePtr, *cmdTablePtr, *childTablePtr; Tcl_HashSearch search; Tcl_Command cmd; - Var *varPtr; + const Var *varPtr; register Tcl_HashEntry *entryPtr; nonnull_assert(interp != NULL); @@ -31120,14 +31148,16 @@ * Deleting the procs and vars in the child namespaces does not seem to be * necessary, but we do it anyway. */ - for (entryPtr = Tcl_FirstHashEntry(childTablePtr, &search); entryPtr; + for (entryPtr = Tcl_FirstHashEntry(childTablePtr, &search); + entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { Tcl_Namespace *childNsPtr = (Tcl_Namespace *) Tcl_GetHashValue(entryPtr); DeleteProcsAndVars(interp, childNsPtr, withKeepvars); } if (withKeepvars == 0) { - for (entryPtr = Tcl_FirstHashEntry(varTablePtr, &search); entryPtr; + for (entryPtr = Tcl_FirstHashEntry(varTablePtr, &search); + entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { Tcl_Obj *nameObj; GetVarAndNameFromHash(entryPtr, &varPtr, &nameObj); @@ -31138,7 +31168,8 @@ } } - for (entryPtr = Tcl_FirstHashEntry(cmdTablePtr, &search); entryPtr; + for (entryPtr = Tcl_FirstHashEntry(cmdTablePtr, &search); + entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { cmd = (Tcl_Command)Tcl_GetHashValue(entryPtr); @@ -31254,7 +31285,8 @@ cmdTablePtr = Tcl_Namespace_cmdTablePtr(nsPtr); childTablePtr = Tcl_Namespace_childTablePtr(nsPtr); - for (entryPtr = Tcl_FirstHashEntry(cmdTablePtr, &search); entryPtr; + for (entryPtr = Tcl_FirstHashEntry(cmdTablePtr, &search); + entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { Tcl_Command cmd = (Tcl_Command)Tcl_GetHashValue(entryPtr); @@ -31264,7 +31296,8 @@ Tcl_DeleteCommandFromToken(interp, cmd); } } - for (entryPtr = Tcl_FirstHashEntry(childTablePtr, &search); entryPtr; + for (entryPtr = Tcl_FirstHashEntry(childTablePtr, &search); + entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { Tcl_Namespace *childNsPtr = (Tcl_Namespace *) Tcl_GetHashValue(entryPtr); @@ -31338,26 +31371,26 @@ * *---------------------------------------------------------------------- */ -static int ObjectHasChildren(NsfObject *object) nonnull(1); +static int ObjectHasChildren(const NsfObject *object) nonnull(1); static int -ObjectHasChildren(NsfObject *object) { - Tcl_Namespace *ns; +ObjectHasChildren(const NsfObject *object) { + const Tcl_Namespace *ns; int result = 0; nonnull_assert(object != NULL); ns = object->nsPtr; if (ns != NULL) { - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; Tcl_HashSearch hSrch; Tcl_HashTable *cmdTablePtr = Tcl_Namespace_cmdTablePtr(ns); for (hPtr = Tcl_FirstHashEntry(cmdTablePtr, &hSrch); hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSrch)) { Tcl_Command cmd = Tcl_GetHashValue(hPtr); - NsfObject *childObject = NsfGetObjectFromCmdPtr(cmd); + const NsfObject *childObject = NsfGetObjectFromCmdPtr(cmd); if (childObject != NULL) { result = 1; @@ -31410,7 +31443,7 @@ /* delete per-object methods */ if (object != NULL && object->nsPtr != NULL) { - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; Tcl_HashSearch hSrch; for (hPtr = Tcl_FirstHashEntry(Tcl_Namespace_cmdTablePtr(object->nsPtr), &hSrch); @@ -31434,7 +31467,7 @@ * objects, which will resolved this way. */ if (object != NULL && NsfObjectIsClass(object)) { - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; Tcl_HashSearch hSrch; for (hPtr = Tcl_FirstHashEntry(Tcl_Namespace_cmdTablePtr(((NsfClass *)object)->nsPtr), @@ -31564,7 +31597,7 @@ * to the most general superclass. */ for (entry = *instances; - entry; + entry != NULL; entry = entry->nextPtr) { NsfObject *object = (NsfObject *)entry->clorobj; NsfClass *baseClass; Index: generic/nsf.decls =================================================================== diff -u -r453ad27418d60f0ab744ae4ac911bcd5e2505140 -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba --- generic/nsf.decls (.../nsf.decls) (revision 453ad27418d60f0ab744ae4ac911bcd5e2505140) +++ generic/nsf.decls (.../nsf.decls) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) @@ -63,19 +63,19 @@ struct Nsf_Class *NsfIsClass(Tcl_Interp *interp, ClientData cd) } declare 3 generic { - struct Nsf_Object *NsfGetObject(Tcl_Interp *interp, CONST char *name) + struct Nsf_Object *NsfGetObject(Tcl_Interp *interp, const char *name) } declare 4 generic { - struct Nsf_Class *NsfGetClass(Tcl_Interp *interp, CONST char *name) + struct Nsf_Class *NsfGetClass(Tcl_Interp *interp, const char *name) } declare 5 generic { int NsfDeleteObject(Tcl_Interp *interp, struct Nsf_Object *object) } declare 6 generic { - int NsfRemoveObjectMethod(Tcl_Interp *interp, struct Nsf_Object *object, CONST char *nm) + int NsfRemoveObjectMethod(Tcl_Interp *interp, struct Nsf_Object *object, const char *nm) } declare 7 generic { - int NsfRemoveClassMethod(Tcl_Interp *interp, struct Nsf_Class *cl, CONST char *nm) + int NsfRemoveClassMethod(Tcl_Interp *interp, struct Nsf_Class *cl, const char *nm) } declare 8 generic { Tcl_Obj *Nsf_ObjSetVar2(struct Nsf_Object *object, @@ -89,21 +89,21 @@ } declare 10 generic { int Nsf_UnsetVar2(struct Nsf_Object *object, Tcl_Interp *interp, - CONST char *name1, CONST char *name2, unsigned int flags) + const char *name1, const char *name2, unsigned int flags) } declare 11 generic { - void NsfDStringVPrintf(Tcl_DString *dsPtr, CONST char *fmt, va_list apSrc) + void NsfDStringVPrintf(Tcl_DString *dsPtr, const char *fmt, va_list apSrc) } declare 12 generic { - int NsfPrintError(Tcl_Interp *interp, CONST char *fmt, ...) + int NsfPrintError(Tcl_Interp *interp, const char *fmt, ...) } declare 13 generic { int NsfErrInProc (Tcl_Interp *interp, Tcl_Obj *objName, - Tcl_Obj *clName, CONST char *procName) + Tcl_Obj *clName, const char *procName) } declare 14 generic { - int NsfObjErrType(Tcl_Interp *interp, CONST char *context, - Tcl_Obj *value, CONST char *type, Nsf_Param CONST *pPtr) + int NsfObjErrType(Tcl_Interp *interp, const char *context, + Tcl_Obj *value, const char *type, Nsf_Param const *pPtr) } declare 15 generic { void NsfStackDump (Tcl_Interp *interp) @@ -149,50 +149,50 @@ unsigned int processFlags, Nsf_ParseContext *pcPtr) } declare 26 generic { - void NsfLog(Tcl_Interp *interp, int requiredLevel, CONST char *fmt, ...) + void NsfLog(Tcl_Interp *interp, int requiredLevel, const char *fmt, ...) } declare 27 generic { - int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, CONST char *typeName, void *valuePtr) + int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, const char *typeName, void *valuePtr) } declare 28 generic { int Nsf_PointerDelete(CONST char *key, void *valuePtr, int free) } declare 29 generic { - int Nsf_PointerTypeRegister(Tcl_Interp *interp, CONST char* typeName, int *counterPtr) + int Nsf_PointerTypeRegister(Tcl_Interp *interp, const char* typeName, int *counterPtr) } declare 30 generic { - int Nsf_ConvertToBoolean(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + int Nsf_ConvertToBoolean(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) } declare 31 generic { - int Nsf_ConvertToClass(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + int Nsf_ConvertToClass(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) } declare 32 generic { - int Nsf_ConvertToInt32(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + int Nsf_ConvertToInt32(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) } declare 33 generic { - int Nsf_ConvertToInteger(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + int Nsf_ConvertToInteger(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) } declare 34 generic { - int Nsf_ConvertToObject(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + int Nsf_ConvertToObject(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) } declare 35 generic { - int Nsf_ConvertToPointer(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + int Nsf_ConvertToPointer(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) } declare 36 generic { - int Nsf_ConvertToString(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + int Nsf_ConvertToString(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) } declare 37 generic { - int Nsf_ConvertToTclobj(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + int Nsf_ConvertToTclobj(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) } declare 38 generic { @@ -202,7 +202,7 @@ int Nsf_CmdDefinitionRegister(Tcl_Interp *interp, Nsf_methodDefinition *definitionRecords) } declare 40 generic { - int NsfArgumentError(Tcl_Interp *interp, CONST char *errorMsg, Nsf_Param CONST *paramPtr, + int NsfArgumentError(Tcl_Interp *interp, const char *errorMsg, Nsf_Param const *paramPtr, Tcl_Obj *cmdNameObj, Tcl_Obj *methodPathObj) } declare 41 generic { Index: generic/nsfError.c =================================================================== diff -u -rc7b7511d348de756b5d3fff6b34795383cb0b458 -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba --- generic/nsfError.c (.../nsfError.c) (revision c7b7511d348de756b5d3fff6b34795383cb0b458) +++ generic/nsfError.c (.../nsfError.c) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) @@ -452,7 +452,7 @@ Tcl_DStringAppend(dsPtr, "invalid non-positional argument '", -1); Tcl_DStringAppend(dsPtr, argumentString, -1); Tcl_DStringAppend(dsPtr, "', valid are : ", -1); - for (pPtr = currentParamPtr; pPtr->name && *pPtr->name == '-'; pPtr ++) { + for (pPtr = currentParamPtr; (pPtr->name != NULL) && (*pPtr->name == '-'); pPtr ++) { if (pPtr->flags & NSF_ARG_NOCONFIG) { continue; } Index: generic/nsfInt.h =================================================================== diff -u -rc39e939183732462f9b41cf988c01b69b9faace5 -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba --- generic/nsfInt.h (.../nsfInt.h) (revision c39e939183732462f9b41cf988c01b69b9faace5) +++ generic/nsfInt.h (.../nsfInt.h) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) @@ -421,7 +421,7 @@ struct NsfCmdList *nextPtr; } NsfCmdList; -typedef void (NsfFreeCmdListClientData) _ANSI_ARGS_((NsfCmdList*)); +typedef void (NsfFreeCmdListClientData) (NsfCmdList*); /* for incr string */ typedef struct NsfStringIncrStruct { @@ -1056,7 +1056,7 @@ EXTERN void NsfProfileTraceExitAppend(Tcl_Interp *interp, const char *label, double duration) nonnull(1) nonnull(2); -EXTERN NsfCallStackContent *NsfCallStackGetTopFrame(Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr) +EXTERN NsfCallStackContent *NsfCallStackGetTopFrame(const Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr) nonnull(1); #endif Index: generic/nsfPointer.c =================================================================== diff -u -r16a02881bff0a0d626d0045dfd96660338d0c314 -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba --- generic/nsfPointer.c (.../nsfPointer.c) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) +++ generic/nsfPointer.c (.../nsfPointer.c) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) @@ -162,7 +162,8 @@ nonnull_assert(valuePtr != NULL); - for (hPtr = Tcl_FirstHashEntry(pointerHashTablePtr, &hSrch); hPtr; + for (hPtr = Tcl_FirstHashEntry(pointerHashTablePtr, &hSrch); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSrch)) { void *ptr = Tcl_GetHashValue(hPtr); if (ptr == valuePtr) { @@ -198,7 +199,8 @@ nonnull_assert(valuePtr != NULL); NsfMutexLock(&pointerMutex); - hPtr = (key != NULL) ? Tcl_CreateHashEntry(pointerHashTablePtr, key, NULL) + hPtr = (key != NULL) + ? Tcl_CreateHashEntry(pointerHashTablePtr, key, NULL) : Nsf_PointerGetHptr(valuePtr); if (hPtr != NULL) { if (free != 0) { @@ -313,7 +315,7 @@ void * Nsf_PointerTypeLookup(Tcl_Interp *interp, const char* typeName) { - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; nonnull_assert(interp != NULL); nonnull_assert(typeName != NULL); @@ -386,12 +388,13 @@ if (RUNTIME_STATE(interp)->debugLevel >= 2) { Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr; + const Tcl_HashEntry *hPtr; - for (hPtr = Tcl_FirstHashEntry(pointerHashTablePtr, &hSrch); hPtr; + for (hPtr = Tcl_FirstHashEntry(pointerHashTablePtr, &hSrch); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSrch)) { - char *key = Tcl_GetHashKey(pointerHashTablePtr, hPtr); - void *valuePtr = Tcl_GetHashValue(hPtr); + const char *key = Tcl_GetHashKey(pointerHashTablePtr, hPtr); + const void *valuePtr = Tcl_GetHashValue(hPtr); /* * We can't use NsfLog here any more, since the Tcl procs are Index: generic/nsfStack.c =================================================================== diff -u -rdc4e227d31df104be7df072ee78f2779ff387b9e -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba --- generic/nsfStack.c (.../nsfStack.c) (revision dc4e227d31df104be7df072ee78f2779ff387b9e) +++ generic/nsfStack.c (.../nsfStack.c) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) @@ -34,7 +34,7 @@ * DEALINGS IN THE SOFTWARE. */ #ifdef CHECK_ACTIVATION_COUNTS -static NsfClasses * NsfClassListUnlink(NsfClasses **firstPtrPtr, void *key); +static NsfClasses * NsfClassListUnlink(NsfClasses **firstPtrPtr, const void *key); /* *---------------------------------------------------------------------- @@ -50,12 +50,12 @@ * *---------------------------------------------------------------------- */ -static int CscListRemove(Tcl_Interp *interp, NsfCallStackContent *cscPtr, NsfClasses **cscListPtr) - nonnull(1) nonnull(2) nonnull(3); -static void CscListAdd(Tcl_Interp *interp, NsfCallStackContent *cscPtr) nonnull(1) nonnull(2); +static int CscListRemove(const Tcl_Interp *interp, const NsfCallStackContent *cscPtr, NsfClasses **cscListPtr) + nonnull(1) nonnull(2); +static void CscListAdd(const Tcl_Interp *interp, const NsfCallStackContent *cscPtr) nonnull(1) nonnull(2); static void -CscListAdd(Tcl_Interp *interp, NsfCallStackContent *cscPtr) { +CscListAdd(const Tcl_Interp *interp, const NsfCallStackContent *cscPtr) { nonnull_assert(interp != NULL); nonnull_assert(cscPtr != NULL); @@ -80,12 +80,11 @@ *---------------------------------------------------------------------- */ static int -CscListRemove(Tcl_Interp *interp, NsfCallStackContent *cscPtr, NsfClasses **cscListPtr) { +CscListRemove(const Tcl_Interp *interp, const NsfCallStackContent *cscPtr, NsfClasses **cscListPtr) { NsfClasses *entryPtr, **cscList = &RUNTIME_STATE(interp)->cscList; nonnull_assert(interp != NULL); nonnull_assert(cscPtr != NULL); - nonnull_assert(cscListPtr != NULL); entryPtr = NsfClassListUnlink(cscList, cscPtr); if (entryPtr != NULL) { @@ -119,15 +118,15 @@ fprintf(stderr, "NsfShowStack framePtr %p varFramePtr %p\n", (void *)Tcl_Interp_framePtr(interp), (void *)Tcl_Interp_varFramePtr(interp)); /* framePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); - for (; framePtr; framePtr = Tcl_CallFrame_callerPtr(framePtr)) { + for (; framePtr != NULL; framePtr = Tcl_CallFrame_callerPtr(framePtr)) { fprintf(stderr, "... frame %p flags %.6x cd %p objv[0] %s\n", framePtr, Tcl_CallFrame_isProcCallFrame(framePtr), Tcl_CallFrame_clientData(framePtr), Tcl_CallFrame_objc(framePtr) ? ObjStr(Tcl_CallFrame_objv(framePtr)[0]) : "(null)"); }*/ framePtr = (Tcl_CallFrame *)Tcl_Interp_framePtr(interp); fprintf(stderr, "... varFrame flags clientData lvl ns\n"); - for (; framePtr; framePtr = Tcl_CallFrame_callerPtr(framePtr)) { + for (; framePtr != NULL; framePtr = Tcl_CallFrame_callerPtr(framePtr)) { int frameFlags = Tcl_CallFrame_isProcCallFrame(framePtr); NsfCallStackContent *cscPtr = (frameFlags & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) ? @@ -181,10 +180,10 @@ * *---------------------------------------------------------------------- */ -static void Nsf_PushFrameObj(Tcl_Interp *interp, NsfObject *object, CallFrame *framePtr) nonnull(1) nonnull(2) nonnull(3); +static void Nsf_PushFrameObj(Tcl_Interp *interp, NsfObject *object, const CallFrame *framePtr) nonnull(1) nonnull(2) nonnull(3); static void Nsf_PopFrameObj(Tcl_Interp *interp, CallFrame *framePtr) nonnull(1) nonnull(2); -static void Nsf_PushFrameObj(Tcl_Interp *interp, NsfObject *object, CallFrame *framePtr) { +static void Nsf_PushFrameObj(Tcl_Interp *interp, NsfObject *object, const CallFrame *framePtr) { nonnull_assert(interp != NULL); nonnull_assert(object != NULL); @@ -236,12 +235,12 @@ * *---------------------------------------------------------------------- */ -NSF_INLINE static void Nsf_PushFrameCsc(Tcl_Interp *interp, NsfCallStackContent *cscPtr, CallFrame *framePtr) +NSF_INLINE static void Nsf_PushFrameCsc(Tcl_Interp *interp, const NsfCallStackContent *cscPtr, CallFrame *framePtr) nonnull(1) nonnull(2) nonnull(3); static void Nsf_PopFrameCsc(Tcl_Interp *interp, CallFrame *UNUSED(framePtr)) nonnull(1); NSF_INLINE static void -Nsf_PushFrameCsc(Tcl_Interp *interp, NsfCallStackContent *cscPtr, CallFrame *framePtr) { +Nsf_PushFrameCsc(Tcl_Interp *interp, const NsfCallStackContent *cscPtr, CallFrame *framePtr) { CallFrame *varFramePtr = Tcl_Interp_varFramePtr(interp); nonnull_assert(interp != NULL); @@ -368,18 +367,18 @@ # endif #endif -NSF_INLINE static NsfObject* GetSelfObj(Tcl_Interp *interp) nonnull(1); +NSF_INLINE static NsfObject* GetSelfObj(const Tcl_Interp *interp) nonnull(1); NSF_INLINE static NsfObject* -GetSelfObj(Tcl_Interp *interp) { +GetSelfObj(const Tcl_Interp *interp) { register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); nonnull_assert(interp != NULL); /*fprintf(stderr, "GetSelfObj interp has frame %p and var-frame %p\n", Tcl_Interp_framePtr(interp), Tcl_Interp_varFramePtr(interp));*/ - for (; varFramePtr; varFramePtr = + for (; varFramePtr != NULL; varFramePtr = #if defined(SKIP_LEVELS) Tcl_CallFrame_callerPtr(varFramePtr) @@ -390,7 +389,7 @@ register int flags = Tcl_CallFrame_isProcCallFrame(varFramePtr); if (likely(flags & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD))) { - NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); + const NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); return cscPtr->self; } else if (flags & FRAME_IS_NSF_OBJECT) { @@ -423,11 +422,11 @@ * *---------------------------------------------------------------------- */ -static Tcl_CallFrame* CallStackGetTclFrame(Tcl_Interp *interp, +static Tcl_CallFrame* CallStackGetTclFrame(const Tcl_Interp *interp, Tcl_CallFrame *startFramePtr, int skip) nonnull(1); -static Tcl_CallFrame* CallStackGetTclFrame(Tcl_Interp *interp, +static Tcl_CallFrame* CallStackGetTclFrame(const Tcl_Interp *interp, Tcl_CallFrame *varFramePtr, int skip) { nonnull_assert(interp != NULL); @@ -443,7 +442,7 @@ varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr); } - for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { + for (; varFramePtr != NULL; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { return varFramePtr; } @@ -468,16 +467,17 @@ * *---------------------------------------------------------------------- */ -NSF_INLINE static NsfCallStackContent *CallStackGetTopFrame0(Tcl_Interp *interp) nonnull(1); +static NsfCallStackContent* +CallStackGetTopFrame(const Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr) nonnull(1); static NsfCallStackContent* -CallStackGetTopFrame(Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr) { +CallStackGetTopFrame(const Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr) { register Tcl_CallFrame *varFramePtr; nonnull_assert(interp != NULL); for (varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); - varFramePtr; + varFramePtr != NULL; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { @@ -493,16 +493,16 @@ return NULL; } -NSF_INLINE static NsfCallStackContent* CallStackGetTopFrame0(Tcl_Interp *interp) nonnull(1); +NSF_INLINE static NsfCallStackContent* CallStackGetTopFrame0(const Tcl_Interp *interp) nonnull(1); NSF_INLINE static NsfCallStackContent* -CallStackGetTopFrame0(Tcl_Interp *interp) { +CallStackGetTopFrame0(const Tcl_Interp *interp) { register Tcl_CallFrame *varFramePtr; nonnull_assert(interp != NULL); for (varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); - varFramePtr; + varFramePtr != NULL; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { if (likely(Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD))) { return (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); @@ -512,10 +512,10 @@ } #if defined(NSF_PROFILE) -NsfCallStackContent* NsfCallStackGetTopFrame(Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr) nonnull(1); +NsfCallStackContent* NsfCallStackGetTopFrame(const Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr) nonnull(1); NsfCallStackContent* -NsfCallStackGetTopFrame(Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr) { +NsfCallStackGetTopFrame(const Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr) { return CallStackGetTopFrame(interp, framePtrPtr); } #endif @@ -535,11 +535,11 @@ * *---------------------------------------------------------------------- */ -static NsfCallStackContent *NsfCallStackFindLastInvocation(Tcl_Interp *interp, int offset, Tcl_CallFrame **framePtrPtr) +static NsfCallStackContent *NsfCallStackFindLastInvocation(const Tcl_Interp *interp, int offset, Tcl_CallFrame **framePtrPtr) nonnull(1); static NsfCallStackContent * -NsfCallStackFindLastInvocation(Tcl_Interp *interp, int offset, Tcl_CallFrame **framePtrPtr) { +NsfCallStackFindLastInvocation(const Tcl_Interp *interp, int offset, Tcl_CallFrame **framePtrPtr) { register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); int lvl = Tcl_CallFrame_level(varFramePtr); @@ -602,21 +602,21 @@ * *---------------------------------------------------------------------- */ -static NsfCallStackContent *NsfCallStackFindActiveFrame(Tcl_Interp *interp, int offset, Tcl_CallFrame **framePtrPtr) nonnull(1); +static NsfCallStackContent *NsfCallStackFindActiveFrame(const Tcl_Interp *interp, int offset, Tcl_CallFrame **framePtrPtr) nonnull(1); static NsfCallStackContent * -NsfCallStackFindActiveFrame(Tcl_Interp *interp, int offset, Tcl_CallFrame **framePtrPtr) { +NsfCallStackFindActiveFrame(const Tcl_Interp *interp, int offset, Tcl_CallFrame **framePtrPtr) { register Tcl_CallFrame *varFramePtr; nonnull_assert(interp != NULL); /* skip #offset frames */ for (varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); - offset>0 && varFramePtr; + (offset > 0) && (varFramePtr != NULL); varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr), offset--); /* search for first active frame and set tcl frame pointers */ - for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { + for (; varFramePtr != NULL; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); if (!(cscPtr->frameType & NSF_CSC_TYPE_INACTIVE)) { @@ -652,10 +652,10 @@ * *---------------------------------------------------------------------- */ -static void CallStackUseActiveFrame(Tcl_Interp *interp, callFrameContext *ctx) nonnull(1) nonnull(2); +static void CallStackUseActiveFrame(const Tcl_Interp *interp, callFrameContext *ctx) nonnull(1) nonnull(2); static void -CallStackUseActiveFrame(Tcl_Interp *interp, callFrameContext *ctx) { +CallStackUseActiveFrame(const Tcl_Interp *interp, callFrameContext *ctx) { Tcl_CallFrame *framePtr, *inFramePtr; nonnull_assert(interp != NULL); @@ -724,15 +724,15 @@ * *---------------------------------------------------------------------- */ -static NsfCallStackContent * CallStackFindActiveFilter(Tcl_Interp *interp) nonnull(1); +static NsfCallStackContent * CallStackFindActiveFilter(const Tcl_Interp *interp) nonnull(1); static NsfCallStackContent * -CallStackFindActiveFilter(Tcl_Interp *interp) { +CallStackFindActiveFilter(const Tcl_Interp *interp) { register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); nonnull_assert(interp != NULL); - for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { + for (; varFramePtr != NULL; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); if (cscPtr->frameType == NSF_CSC_TYPE_ACTIVE_FILTER) { @@ -760,10 +760,10 @@ * *---------------------------------------------------------------------- */ -static NsfCallStackContent * CallStackFindEnsembleCsc(Tcl_CallFrame *framePtr, Tcl_CallFrame **framePtrPtr) nonnull(1) nonnull(2); +static NsfCallStackContent * CallStackFindEnsembleCsc(const Tcl_CallFrame *framePtr, Tcl_CallFrame **framePtrPtr) nonnull(1) nonnull(2); static NsfCallStackContent * -CallStackFindEnsembleCsc(Tcl_CallFrame *framePtr, Tcl_CallFrame **framePtrPtr) { +CallStackFindEnsembleCsc(const Tcl_CallFrame *framePtr, Tcl_CallFrame **framePtrPtr) { register Tcl_CallFrame *varFramePtr; NsfCallStackContent *cscPtr = NULL; @@ -834,7 +834,7 @@ Tcl_CallFrame_isProcCallFrame(framePtr) & (FRAME_IS_NSF_CMETHOD|FRAME_IS_NSF_METHOD); framePtr = Tcl_CallFrame_callerPtr(framePtr)) { - NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(framePtr); + const NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(framePtr); assert(cscPtr != NULL); /*fprintf(stderr, "--- frame %p cmdPtr %p cmd %s NSF_CSC_TYPE_ENSEMBLE %d \ @@ -920,16 +920,16 @@ * *---------------------------------------------------------------------- */ -NSF_INLINE static int FilterActiveOnObj(Tcl_Interp *interp, NsfObject *object, Tcl_Command cmd) nonnull(1) nonnull(2); +NSF_INLINE static int FilterActiveOnObj(const Tcl_Interp *interp, const NsfObject *object, Tcl_Command cmd) nonnull(1) nonnull(2); NSF_INLINE static int -FilterActiveOnObj(Tcl_Interp *interp, NsfObject *object, Tcl_Command cmd) { - register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); +FilterActiveOnObj(const Tcl_Interp *interp, const NsfObject *object, Tcl_Command cmd) { + register const Tcl_CallFrame *varFramePtr = (const Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); nonnull_assert(interp != NULL); nonnull_assert(object != NULL); - for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { + for (; varFramePtr != NULL; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); if (cmd == cscPtr->cmdPtr && object == cscPtr->self && @@ -957,17 +957,18 @@ * *---------------------------------------------------------------------- */ -static void CallStackReplaceVarTableReferences(Tcl_Interp *interp, TclVarHashTable *oldVarTablePtr, TclVarHashTable *newVarTablePtr) nonnull(1) nonnull(2) nonnull(3); +static void CallStackReplaceVarTableReferences(const Tcl_Interp *interp, TclVarHashTable *oldVarTablePtr, TclVarHashTable *newVarTablePtr) nonnull(1) nonnull(2) nonnull(3); static void -CallStackReplaceVarTableReferences(Tcl_Interp *interp, TclVarHashTable *oldVarTablePtr, TclVarHashTable *newVarTablePtr) { +CallStackReplaceVarTableReferences(const Tcl_Interp *interp, TclVarHashTable *oldVarTablePtr, TclVarHashTable *newVarTablePtr) { Tcl_CallFrame *framePtr; nonnull_assert(interp != NULL); nonnull_assert(oldVarTablePtr != NULL); nonnull_assert(newVarTablePtr != NULL); - for (framePtr = (Tcl_CallFrame *)Tcl_Interp_framePtr(interp); framePtr; + for (framePtr = (Tcl_CallFrame *)Tcl_Interp_framePtr(interp); + framePtr != NULL; framePtr = Tcl_CallFrame_callerPtr(framePtr)) { int frameFlags = Tcl_CallFrame_isProcCallFrame(framePtr); @@ -1010,7 +1011,7 @@ } while (1) { - Tcl_CallFrame *framePtr = Tcl_Interp_framePtr(interp); + const Tcl_CallFrame *framePtr = Tcl_Interp_framePtr(interp); int frameFlags; if (framePtr == NULL || (Tcl_CallFrame_level(framePtr) == 0)) { @@ -1313,27 +1314,27 @@ *---------------------------------------------------------------------- */ #if 0 -static Tcl_CallFrame * BeginOfCallChain(Tcl_Interp *interp, NsfObject *object) nonnull(1); +static Tcl_CallFrame * BeginOfCallChain(const Tcl_Interp *interp, NsfObject *object) nonnull(1); static Tcl_CallFrame * -BeginOfCallChain(Tcl_Interp *interp, NsfObject *object) { +BeginOfCallChain(const Tcl_Interp *interp, NsfObject *object) { Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp), *prevFramePtr = varFramePtr; nonnull_assert(interp != NULL); if (object != NULL) { fprintf(stderr, "BeginOfCallChain obj %s\n", ObjectName(object)); - for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { + for (; varFramePtr != NULL; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { register unsigned int flags = Tcl_CallFrame_isProcCallFrame(varFramePtr); if (flags & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { - NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); + const NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); if (cscPtr->self == object) { prevFramePtr = varFramePtr; continue; } - } else if (flags & (FRAME_IS_NSF_OBJECT|FRAME_IS_LAMBDA)) { + } else if ((flags & (FRAME_IS_NSF_OBJECT|FRAME_IS_LAMBDA)) != 0u) { continue; } break; Index: generic/nsfUtil.c =================================================================== diff -u -r4fa580aed7f0c54c8e09ec6bb1fc1b46789334ed -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba --- generic/nsfUtil.c (.../nsfUtil.c) (revision 4fa580aed7f0c54c8e09ec6bb1fc1b46789334ed) +++ generic/nsfUtil.c (.../nsfUtil.c) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) @@ -223,7 +223,7 @@ nonnull_assert(iss != NULL); - for (p=alphabet; *p; p++) { + for (p=alphabet; *p != '\0'; p++) { chartable[(int)*p] = ++i; } Index: generic/stubs8.6/nsfDecls.h =================================================================== diff -u -r453ad27418d60f0ab744ae4ac911bcd5e2505140 -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba --- generic/stubs8.6/nsfDecls.h (.../nsfDecls.h) (revision 453ad27418d60f0ab744ae4ac911bcd5e2505140) +++ generic/stubs8.6/nsfDecls.h (.../nsfDecls.h) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) @@ -67,18 +67,18 @@ /* 2 */ EXTERN struct Nsf_Class * NsfIsClass(Tcl_Interp *interp, ClientData cd); /* 3 */ -EXTERN struct Nsf_Object * NsfGetObject(Tcl_Interp *interp, CONST char *name); +EXTERN struct Nsf_Object * NsfGetObject(Tcl_Interp *interp, const char *name); /* 4 */ -EXTERN struct Nsf_Class * NsfGetClass(Tcl_Interp *interp, CONST char *name); +EXTERN struct Nsf_Class * NsfGetClass(Tcl_Interp *interp, const char *name); /* 5 */ EXTERN int NsfDeleteObject(Tcl_Interp *interp, struct Nsf_Object *object); /* 6 */ EXTERN int NsfRemoveObjectMethod(Tcl_Interp *interp, - struct Nsf_Object *object, CONST char *nm); + struct Nsf_Object *object, const char *nm); /* 7 */ EXTERN int NsfRemoveClassMethod(Tcl_Interp *interp, - struct Nsf_Class *cl, CONST char *nm); + struct Nsf_Class *cl, const char *nm); /* 8 */ EXTERN Tcl_Obj * Nsf_ObjSetVar2(struct Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, @@ -90,20 +90,20 @@ Tcl_Obj *name2, unsigned int flags); /* 10 */ EXTERN int Nsf_UnsetVar2(struct Nsf_Object *object, - Tcl_Interp *interp, CONST char *name1, - CONST char *name2, unsigned int flags); + Tcl_Interp *interp, const char *name1, + const char *name2, unsigned int flags); /* 11 */ EXTERN void NsfDStringVPrintf(Tcl_DString *dsPtr, - CONST char *fmt, va_list apSrc); + const char *fmt, va_list apSrc); /* 12 */ -EXTERN int NsfPrintError(Tcl_Interp *interp, CONST char *fmt, ...); +EXTERN int NsfPrintError(Tcl_Interp *interp, const char *fmt, ...); /* 13 */ EXTERN int NsfErrInProc(Tcl_Interp *interp, Tcl_Obj *objName, - Tcl_Obj *clName, CONST char *procName); + Tcl_Obj *clName, const char *procName); /* 14 */ EXTERN int NsfObjErrType(Tcl_Interp *interp, - CONST char *context, Tcl_Obj *value, - CONST char *type, Nsf_Param CONST *pPtr); + const char *context, Tcl_Obj *value, + const char *type, Nsf_Param const *pPtr); /* 15 */ EXTERN void NsfStackDump(Tcl_Interp *interp); /* 16 */ @@ -149,47 +149,47 @@ Nsf_ParseContext *pcPtr); /* 26 */ EXTERN void NsfLog(Tcl_Interp *interp, int requiredLevel, - CONST char *fmt, ...); + const char *fmt, ...); /* 27 */ EXTERN int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, - CONST char *typeName, void *valuePtr); + const char *typeName, void *valuePtr); /* 28 */ EXTERN int Nsf_PointerDelete(CONST char *key, void *valuePtr, int free); /* 29 */ EXTERN int Nsf_PointerTypeRegister(Tcl_Interp *interp, - CONST char*typeName, int *counterPtr); + const char*typeName, int *counterPtr); /* 30 */ EXTERN int Nsf_ConvertToBoolean(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 31 */ EXTERN int Nsf_ConvertToClass(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 32 */ EXTERN int Nsf_ConvertToInt32(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 33 */ EXTERN int Nsf_ConvertToInteger(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 34 */ EXTERN int Nsf_ConvertToObject(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 35 */ EXTERN int Nsf_ConvertToPointer(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 36 */ EXTERN int Nsf_ConvertToString(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 37 */ EXTERN int Nsf_ConvertToTclobj(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 38 */ EXTERN int Nsf_EnumerationTypeRegister(Tcl_Interp *interp, @@ -199,8 +199,8 @@ Nsf_methodDefinition *definitionRecords); /* 40 */ EXTERN int NsfArgumentError(Tcl_Interp *interp, - CONST char *errorMsg, - Nsf_Param CONST *paramPtr, + const char *errorMsg, + Nsf_Param const *paramPtr, Tcl_Obj *cmdNameObj, Tcl_Obj *methodPathObj); /* 41 */ EXTERN void Nsf_DStringPrintf(Tcl_DString *dsPtr, @@ -217,18 +217,18 @@ int (*nsf_Init) (Tcl_Interp *interp); /* 0 */ void (*reserved1)(void); struct Nsf_Class * (*nsfIsClass) (Tcl_Interp *interp, ClientData cd); /* 2 */ - struct Nsf_Object * (*nsfGetObject) (Tcl_Interp *interp, CONST char *name); /* 3 */ - struct Nsf_Class * (*nsfGetClass) (Tcl_Interp *interp, CONST char *name); /* 4 */ + struct Nsf_Object * (*nsfGetObject) (Tcl_Interp *interp, const char *name); /* 3 */ + struct Nsf_Class * (*nsfGetClass) (Tcl_Interp *interp, const char *name); /* 4 */ int (*nsfDeleteObject) (Tcl_Interp *interp, struct Nsf_Object *object); /* 5 */ - int (*nsfRemoveObjectMethod) (Tcl_Interp *interp, struct Nsf_Object *object, CONST char *nm); /* 6 */ - int (*nsfRemoveClassMethod) (Tcl_Interp *interp, struct Nsf_Class *cl, CONST char *nm); /* 7 */ + int (*nsfRemoveObjectMethod) (Tcl_Interp *interp, struct Nsf_Object *object, const char *nm); /* 6 */ + int (*nsfRemoveClassMethod) (Tcl_Interp *interp, struct Nsf_Class *cl, const char *nm); /* 7 */ Tcl_Obj * (*nsf_ObjSetVar2) (struct Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, Tcl_Obj *value, unsigned int flags); /* 8 */ Tcl_Obj * (*nsf_ObjGetVar2) (struct Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, unsigned int flags); /* 9 */ - int (*nsf_UnsetVar2) (struct Nsf_Object *object, Tcl_Interp *interp, CONST char *name1, CONST char *name2, unsigned int flags); /* 10 */ - void (*nsfDStringVPrintf) (Tcl_DString *dsPtr, CONST char *fmt, va_list apSrc); /* 11 */ - int (*nsfPrintError) (Tcl_Interp *interp, CONST char *fmt, ...); /* 12 */ - int (*nsfErrInProc) (Tcl_Interp *interp, Tcl_Obj *objName, Tcl_Obj *clName, CONST char *procName); /* 13 */ - int (*nsfObjErrType) (Tcl_Interp *interp, CONST char *context, Tcl_Obj *value, CONST char *type, Nsf_Param CONST *pPtr); /* 14 */ + int (*nsf_UnsetVar2) (struct Nsf_Object *object, Tcl_Interp *interp, const char *name1, const char *name2, unsigned int flags); /* 10 */ + void (*nsfDStringVPrintf) (Tcl_DString *dsPtr, const char *fmt, va_list apSrc); /* 11 */ + int (*nsfPrintError) (Tcl_Interp *interp, const char *fmt, ...); /* 12 */ + int (*nsfErrInProc) (Tcl_Interp *interp, Tcl_Obj *objName, Tcl_Obj *clName, const char *procName); /* 13 */ + int (*nsfObjErrType) (Tcl_Interp *interp, const char *context, Tcl_Obj *value, const char *type, Nsf_Param const *pPtr); /* 14 */ void (*nsfStackDump) (Tcl_Interp *interp); /* 15 */ void (*nsfSetObjClientData) (Tcl_Interp *interp, Nsf_Object *object, ClientData data); /* 16 */ ClientData (*nsfGetObjClientData) (Tcl_Interp *interp, Nsf_Object *object); /* 17 */ @@ -240,21 +240,21 @@ int (*nsfAddClassMethod) (Tcl_Interp *interp, struct Nsf_Class *cl, CONST char *nm, Tcl_ObjCmdProc *proc, ClientData cd, Tcl_CmdDeleteProc *dp, unsigned int flags); /* 23 */ int (*nsfCreate) (Tcl_Interp *in, Nsf_Class *class, Tcl_Obj *name, int objc, Tcl_Obj *CONST objv[]); /* 24 */ 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, unsigned int processFlags, Nsf_ParseContext *pcPtr); /* 25 */ - void (*nsfLog) (Tcl_Interp *interp, int requiredLevel, CONST char *fmt, ...); /* 26 */ - int (*nsf_PointerAdd) (Tcl_Interp *interp, char *buffer, CONST char *typeName, void *valuePtr); /* 27 */ + void (*nsfLog) (Tcl_Interp *interp, int requiredLevel, const char *fmt, ...); /* 26 */ + int (*nsf_PointerAdd) (Tcl_Interp *interp, char *buffer, const char *typeName, void *valuePtr); /* 27 */ int (*nsf_PointerDelete) (CONST char *key, void *valuePtr, int free); /* 28 */ - int (*nsf_PointerTypeRegister) (Tcl_Interp *interp, CONST char*typeName, int *counterPtr); /* 29 */ - int (*nsf_ConvertToBoolean) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 30 */ - int (*nsf_ConvertToClass) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 31 */ - int (*nsf_ConvertToInt32) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 32 */ - int (*nsf_ConvertToInteger) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 33 */ - int (*nsf_ConvertToObject) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 34 */ - int (*nsf_ConvertToPointer) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 35 */ - int (*nsf_ConvertToString) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 36 */ - int (*nsf_ConvertToTclobj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 37 */ + int (*nsf_PointerTypeRegister) (Tcl_Interp *interp, const char*typeName, int *counterPtr); /* 29 */ + int (*nsf_ConvertToBoolean) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 30 */ + int (*nsf_ConvertToClass) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 31 */ + int (*nsf_ConvertToInt32) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 32 */ + int (*nsf_ConvertToInteger) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 33 */ + int (*nsf_ConvertToObject) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 34 */ + int (*nsf_ConvertToPointer) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 35 */ + int (*nsf_ConvertToString) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 36 */ + int (*nsf_ConvertToTclobj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 37 */ int (*nsf_EnumerationTypeRegister) (Tcl_Interp *interp, Nsf_EnumeratorConverterEntry *typeRecords); /* 38 */ int (*nsf_CmdDefinitionRegister) (Tcl_Interp *interp, Nsf_methodDefinition *definitionRecords); /* 39 */ - int (*nsfArgumentError) (Tcl_Interp *interp, CONST char *errorMsg, Nsf_Param CONST *paramPtr, Tcl_Obj *cmdNameObj, Tcl_Obj *methodPathObj); /* 40 */ + int (*nsfArgumentError) (Tcl_Interp *interp, const char *errorMsg, Nsf_Param const *paramPtr, Tcl_Obj *cmdNameObj, Tcl_Obj *methodPathObj); /* 40 */ void (*nsf_DStringPrintf) (Tcl_DString *dsPtr, const char *fmt, ...); /* 41 */ } NsfStubs; Index: generic/stubs8.7/nsfDecls.h =================================================================== diff -u -r56d1814f9bc01434184bd033b95d3e394a0609b3 -r8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba --- generic/stubs8.7/nsfDecls.h (.../nsfDecls.h) (revision 56d1814f9bc01434184bd033b95d3e394a0609b3) +++ generic/stubs8.7/nsfDecls.h (.../nsfDecls.h) (revision 8eecbe5b3a2640ba1d3e1dc6dc5e9cec0c2a26ba) @@ -67,18 +67,18 @@ /* 2 */ EXTERN struct Nsf_Class * NsfIsClass(Tcl_Interp *interp, ClientData cd); /* 3 */ -EXTERN struct Nsf_Object * NsfGetObject(Tcl_Interp *interp, CONST char *name); +EXTERN struct Nsf_Object * NsfGetObject(Tcl_Interp *interp, const char *name); /* 4 */ -EXTERN struct Nsf_Class * NsfGetClass(Tcl_Interp *interp, CONST char *name); +EXTERN struct Nsf_Class * NsfGetClass(Tcl_Interp *interp, const char *name); /* 5 */ EXTERN int NsfDeleteObject(Tcl_Interp *interp, struct Nsf_Object *object); /* 6 */ EXTERN int NsfRemoveObjectMethod(Tcl_Interp *interp, - struct Nsf_Object *object, CONST char *nm); + struct Nsf_Object *object, const char *nm); /* 7 */ EXTERN int NsfRemoveClassMethod(Tcl_Interp *interp, - struct Nsf_Class *cl, CONST char *nm); + struct Nsf_Class *cl, const char *nm); /* 8 */ EXTERN Tcl_Obj * Nsf_ObjSetVar2(struct Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, @@ -90,20 +90,20 @@ Tcl_Obj *name2, unsigned int flags); /* 10 */ EXTERN int Nsf_UnsetVar2(struct Nsf_Object *object, - Tcl_Interp *interp, CONST char *name1, - CONST char *name2, unsigned int flags); + Tcl_Interp *interp, const char *name1, + const char *name2, unsigned int flags); /* 11 */ EXTERN void NsfDStringVPrintf(Tcl_DString *dsPtr, - CONST char *fmt, va_list apSrc); + const char *fmt, va_list apSrc); /* 12 */ -EXTERN int NsfPrintError(Tcl_Interp *interp, CONST char *fmt, ...); +EXTERN int NsfPrintError(Tcl_Interp *interp, const char *fmt, ...); /* 13 */ EXTERN int NsfErrInProc(Tcl_Interp *interp, Tcl_Obj *objName, - Tcl_Obj *clName, CONST char *procName); + Tcl_Obj *clName, const char *procName); /* 14 */ EXTERN int NsfObjErrType(Tcl_Interp *interp, - CONST char *context, Tcl_Obj *value, - CONST char *type, Nsf_Param CONST *pPtr); + const char *context, Tcl_Obj *value, + const char *type, Nsf_Param const *pPtr); /* 15 */ EXTERN void NsfStackDump(Tcl_Interp *interp); /* 16 */ @@ -149,47 +149,47 @@ Nsf_ParseContext *pcPtr); /* 26 */ EXTERN void NsfLog(Tcl_Interp *interp, int requiredLevel, - CONST char *fmt, ...); + const char *fmt, ...); /* 27 */ EXTERN int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, - CONST char *typeName, void *valuePtr); + const char *typeName, void *valuePtr); /* 28 */ EXTERN int Nsf_PointerDelete(CONST char *key, void *valuePtr, int free); /* 29 */ EXTERN int Nsf_PointerTypeRegister(Tcl_Interp *interp, - CONST char*typeName, int *counterPtr); + const char*typeName, int *counterPtr); /* 30 */ EXTERN int Nsf_ConvertToBoolean(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 31 */ EXTERN int Nsf_ConvertToClass(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 32 */ EXTERN int Nsf_ConvertToInt32(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 33 */ EXTERN int Nsf_ConvertToInteger(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 34 */ EXTERN int Nsf_ConvertToObject(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 35 */ EXTERN int Nsf_ConvertToPointer(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 36 */ EXTERN int Nsf_ConvertToString(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 37 */ EXTERN int Nsf_ConvertToTclobj(Tcl_Interp *interp, - Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, + Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 38 */ EXTERN int Nsf_EnumerationTypeRegister(Tcl_Interp *interp, @@ -199,8 +199,8 @@ Nsf_methodDefinition *definitionRecords); /* 40 */ EXTERN int NsfArgumentError(Tcl_Interp *interp, - CONST char *errorMsg, - Nsf_Param CONST *paramPtr, + const char *errorMsg, + Nsf_Param const *paramPtr, Tcl_Obj *cmdNameObj, Tcl_Obj *methodPathObj); /* 41 */ EXTERN void Nsf_DStringPrintf(Tcl_DString *dsPtr, @@ -217,18 +217,18 @@ int (*nsf_Init) (Tcl_Interp *interp); /* 0 */ void (*reserved1)(void); struct Nsf_Class * (*nsfIsClass) (Tcl_Interp *interp, ClientData cd); /* 2 */ - struct Nsf_Object * (*nsfGetObject) (Tcl_Interp *interp, CONST char *name); /* 3 */ - struct Nsf_Class * (*nsfGetClass) (Tcl_Interp *interp, CONST char *name); /* 4 */ + struct Nsf_Object * (*nsfGetObject) (Tcl_Interp *interp, const char *name); /* 3 */ + struct Nsf_Class * (*nsfGetClass) (Tcl_Interp *interp, const char *name); /* 4 */ int (*nsfDeleteObject) (Tcl_Interp *interp, struct Nsf_Object *object); /* 5 */ - int (*nsfRemoveObjectMethod) (Tcl_Interp *interp, struct Nsf_Object *object, CONST char *nm); /* 6 */ - int (*nsfRemoveClassMethod) (Tcl_Interp *interp, struct Nsf_Class *cl, CONST char *nm); /* 7 */ + int (*nsfRemoveObjectMethod) (Tcl_Interp *interp, struct Nsf_Object *object, const char *nm); /* 6 */ + int (*nsfRemoveClassMethod) (Tcl_Interp *interp, struct Nsf_Class *cl, const char *nm); /* 7 */ Tcl_Obj * (*nsf_ObjSetVar2) (struct Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, Tcl_Obj *value, unsigned int flags); /* 8 */ Tcl_Obj * (*nsf_ObjGetVar2) (struct Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, unsigned int flags); /* 9 */ - int (*nsf_UnsetVar2) (struct Nsf_Object *object, Tcl_Interp *interp, CONST char *name1, CONST char *name2, unsigned int flags); /* 10 */ - void (*nsfDStringVPrintf) (Tcl_DString *dsPtr, CONST char *fmt, va_list apSrc); /* 11 */ - int (*nsfPrintError) (Tcl_Interp *interp, CONST char *fmt, ...); /* 12 */ - int (*nsfErrInProc) (Tcl_Interp *interp, Tcl_Obj *objName, Tcl_Obj *clName, CONST char *procName); /* 13 */ - int (*nsfObjErrType) (Tcl_Interp *interp, CONST char *context, Tcl_Obj *value, CONST char *type, Nsf_Param CONST *pPtr); /* 14 */ + int (*nsf_UnsetVar2) (struct Nsf_Object *object, Tcl_Interp *interp, const char *name1, const char *name2, unsigned int flags); /* 10 */ + void (*nsfDStringVPrintf) (Tcl_DString *dsPtr, const char *fmt, va_list apSrc); /* 11 */ + int (*nsfPrintError) (Tcl_Interp *interp, const char *fmt, ...); /* 12 */ + int (*nsfErrInProc) (Tcl_Interp *interp, Tcl_Obj *objName, Tcl_Obj *clName, const char *procName); /* 13 */ + int (*nsfObjErrType) (Tcl_Interp *interp, const char *context, Tcl_Obj *value, const char *type, Nsf_Param const *pPtr); /* 14 */ void (*nsfStackDump) (Tcl_Interp *interp); /* 15 */ void (*nsfSetObjClientData) (Tcl_Interp *interp, Nsf_Object *object, ClientData data); /* 16 */ ClientData (*nsfGetObjClientData) (Tcl_Interp *interp, Nsf_Object *object); /* 17 */ @@ -240,21 +240,21 @@ int (*nsfAddClassMethod) (Tcl_Interp *interp, struct Nsf_Class *cl, CONST char *nm, Tcl_ObjCmdProc *proc, ClientData cd, Tcl_CmdDeleteProc *dp, unsigned int flags); /* 23 */ int (*nsfCreate) (Tcl_Interp *in, Nsf_Class *class, Tcl_Obj *name, int objc, Tcl_Obj *CONST objv[]); /* 24 */ 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, unsigned int processFlags, Nsf_ParseContext *pcPtr); /* 25 */ - void (*nsfLog) (Tcl_Interp *interp, int requiredLevel, CONST char *fmt, ...); /* 26 */ - int (*nsf_PointerAdd) (Tcl_Interp *interp, char *buffer, CONST char *typeName, void *valuePtr); /* 27 */ + void (*nsfLog) (Tcl_Interp *interp, int requiredLevel, const char *fmt, ...); /* 26 */ + int (*nsf_PointerAdd) (Tcl_Interp *interp, char *buffer, const char *typeName, void *valuePtr); /* 27 */ int (*nsf_PointerDelete) (CONST char *key, void *valuePtr, int free); /* 28 */ - int (*nsf_PointerTypeRegister) (Tcl_Interp *interp, CONST char*typeName, int *counterPtr); /* 29 */ - int (*nsf_ConvertToBoolean) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 30 */ - int (*nsf_ConvertToClass) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 31 */ - int (*nsf_ConvertToInt32) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 32 */ - int (*nsf_ConvertToInteger) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 33 */ - int (*nsf_ConvertToObject) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 34 */ - int (*nsf_ConvertToPointer) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 35 */ - int (*nsf_ConvertToString) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 36 */ - int (*nsf_ConvertToTclobj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 37 */ + int (*nsf_PointerTypeRegister) (Tcl_Interp *interp, const char*typeName, int *counterPtr); /* 29 */ + int (*nsf_ConvertToBoolean) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 30 */ + int (*nsf_ConvertToClass) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 31 */ + int (*nsf_ConvertToInt32) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 32 */ + int (*nsf_ConvertToInteger) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 33 */ + int (*nsf_ConvertToObject) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 34 */ + int (*nsf_ConvertToPointer) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 35 */ + int (*nsf_ConvertToString) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 36 */ + int (*nsf_ConvertToTclobj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr); /* 37 */ int (*nsf_EnumerationTypeRegister) (Tcl_Interp *interp, Nsf_EnumeratorConverterEntry *typeRecords); /* 38 */ int (*nsf_CmdDefinitionRegister) (Tcl_Interp *interp, Nsf_methodDefinition *definitionRecords); /* 39 */ - int (*nsfArgumentError) (Tcl_Interp *interp, CONST char *errorMsg, Nsf_Param CONST *paramPtr, Tcl_Obj *cmdNameObj, Tcl_Obj *methodPathObj); /* 40 */ + int (*nsfArgumentError) (Tcl_Interp *interp, const char *errorMsg, Nsf_Param const *paramPtr, Tcl_Obj *cmdNameObj, Tcl_Obj *methodPathObj); /* 40 */ void (*nsf_DStringPrintf) (Tcl_DString *dsPtr, const char *fmt, ...); /* 41 */ } NsfStubs;