Index: TODO =================================================================== diff -u -rdd7a26337aa9aec3e0a06d2137ee7e708a8e1a9a -r9be296c7be8b0c04eaedd9f96c36d626aa7c2c97 --- TODO (.../TODO) (revision dd7a26337aa9aec3e0a06d2137ee7e708a8e1a9a) +++ TODO (.../TODO) (revision 9be296c7be8b0c04eaedd9f96c36d626aa7c2c97) @@ -2134,6 +2134,16 @@ for procs) and allows the same introspection interface (info method parameter|parametersyntax, ...) +- removed unneded functions: NsfComputePrecedence(), NsfComputeDependents(), + Nsf_SetVar2Ex(), NsfOSetInstVar(), Nsf_ObjGetVar2(), NsfOGetInstVar(), + qNsfCreateObject() +- removed unneeded external declarations: NsfClassListAdd() NsfClassListFree() +- make extern declarations explicit +- grouped most extern definitions together +- improved documentation +- moved variable declarations to inner scopes +- removed warning from cppcheck() + TODO: - nsf::proc Index: generic/nsf.c =================================================================== diff -u -rdd7a26337aa9aec3e0a06d2137ee7e708a8e1a9a -r9be296c7be8b0c04eaedd9f96c36d626aa7c2c97 --- generic/nsf.c (.../nsf.c) (revision dd7a26337aa9aec3e0a06d2137ee7e708a8e1a9a) +++ generic/nsf.c (.../nsf.c) (revision 9be296c7be8b0c04eaedd9f96c36d626aa7c2c97) @@ -223,6 +223,7 @@ NSF_INLINE static Tcl_Command NSFindCommand(Tcl_Interp *interp, CONST char *name); static Tcl_Namespace *NSGetFreshNamespace(Tcl_Interp *interp, ClientData clientData, CONST char *name); +static Tcl_Namespace *RequireObjNamespace(Tcl_Interp *interp, NsfObject *object); /* prototypes for filters and mixins */ static void FilterComputeDefined(Tcl_Interp *interp, NsfObject *object); @@ -263,8 +264,8 @@ static int AliasDeleteObjectReference(Tcl_Interp *interp, Tcl_Command cmd); /* prototypes for (class) list handling */ -extern NsfClasses ** NsfClassListAdd(NsfClasses **firstPtrPtr, NsfClass *cl, ClientData clientData); -extern void NsfClassListFree(NsfClasses *firstPtr); +static NsfClasses ** NsfClassListAdd(NsfClasses **firstPtrPtr, NsfClass *cl, ClientData clientData); +static void NsfClassListFree(NsfClasses *firstPtr); /* misc prototypes */ static int SetInstVar(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *nameObj, Tcl_Obj *valueObj); @@ -274,6 +275,8 @@ static int NextSearchAndInvoke(Tcl_Interp *interp, CONST char *methodName, int objc, Tcl_Obj *CONST objv[], NsfCallStackContent *cscPtr, int freeArgumentVector); +static void AssertionRemoveProc(NsfAssertionStore *aStore, CONST char *name); +static int NSDeleteCmd(Tcl_Interp *interp, Tcl_Namespace *nsPtr, CONST char *methodName); /* @@ -403,10 +406,26 @@ Tcl_DStringFree(dsPtr); } -/* +/*********************************************************************** * argv parsing + ***********************************************************************/ +/* + *---------------------------------------------------------------------- + * + * ParseContextInit -- + * + * Initialize a ParseContext with default values and allocate + * memory if needed. Every ParseContext has to be initialized + * before usage and has to be freed with ParseContextRelease. + * + * Results: + * None. + * + * Side effects: + * Allocate potentially memory. + * + *---------------------------------------------------------------------- */ - static void ParseContextInit(ParseContext *pcPtr, int objc, NsfObject *object, Tcl_Obj *procName) { if (objc < PARSE_CONTEXT_PREALLOC) { @@ -434,6 +453,23 @@ pcPtr->object = object; } +/* + *---------------------------------------------------------------------- + * + * ParseContextExtendObjv -- + * + * Extend Tcl_Obj array at runtime, when more elements are + * needed. This function is called to exten an already + * initialized ParseContext. + * + * Results: + * None. + * + * Side effects: + * Allocate potentially memory. + * + *---------------------------------------------------------------------- + */ static void ParseContextExtendObjv(ParseContext *pcPtr, int from, int elts, Tcl_Obj *CONST source[]) { int requiredSize = from + elts + 1; @@ -461,6 +497,23 @@ /*NsfPrintObjv("AFTER: ", pcPtr->objc, pcPtr->full_objv);*/ } +/* + *---------------------------------------------------------------------- + * + * ParseContextRelease -- + * + * Release (and potentially free) the content of a + * ParseContext. This function is the counterpart of + * ParseContextInit(), + * + * Results: + * None. + * + * Side effects: + * Free potentially memory. + * + *---------------------------------------------------------------------- + */ static void ParseContextRelease(ParseContext *pcPtr) { int status = pcPtr->status; @@ -489,27 +542,6 @@ } } - -static NSF_INLINE Var * -VarHashCreateVar(TclVarHashTable *tablePtr, Tcl_Obj *key, int *newPtr) { - Var *varPtr = NULL; - Tcl_HashEntry *hPtr; - - hPtr = Tcl_CreateHashEntry((Tcl_HashTable *) tablePtr, - (char *) key, newPtr); - if (hPtr) { - varPtr = TclVarHashGetValue(hPtr); - } - return varPtr; -} - -static TclVarHashTable * -VarHashTableCreate() { - TclVarHashTable *varTablePtr = (TclVarHashTable *) ckalloc(sizeof(TclVarHashTable)); - TclInitVarHashTable(varTablePtr, NULL); - return varTablePtr; -} - /* * call an Next Scripting method */ @@ -538,7 +570,7 @@ return result; } -int +extern int NsfCallMethodWithArgs(ClientData clientData, Tcl_Interp *interp, Tcl_Obj *methodObj, Tcl_Obj *arg, int givenobjc, Tcl_Obj *CONST objv[], int flags) { NsfObject *object = (NsfObject*) clientData; @@ -569,7 +601,7 @@ #include "nsfStack.c" /* - * 3 extern callable routines for the preliminary C interface + * 12 extern callable routines for the preliminary C interface */ extern Nsf_Object * NsfGetSelfObj(Tcl_Interp *interp) { @@ -583,8 +615,129 @@ NsfGetClass(Tcl_Interp *interp, CONST char *name) { return (Nsf_Class *)GetClassFromString(interp, name); } +extern Nsf_Class * +NsfIsClass(Tcl_Interp *interp, ClientData clientData) { + if (clientData && NsfObjectIsClass((NsfObject *)clientData)) + return (Nsf_Class *) clientData; + return NULL; +} +extern void +NsfRequireObjNamespace(Tcl_Interp *interp, Nsf_Object *object) { + RequireObjNamespace(interp, (NsfObject*) object); +} +extern Tcl_Obj * +Nsf_ObjSetVar2(Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, + Tcl_Obj *valueObj, int flgs) { + Tcl_Obj *result; + CallFrame frame, *framePtr = &frame; + Nsf_PushFrameObj(interp, (NsfObject*)object, framePtr); + if (((NsfObject*)object)->nsPtr) { + flgs |= TCL_NAMESPACE_ONLY; + } + result = Tcl_ObjSetVar2(interp, name1, name2, valueObj, flgs); + 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) { + Tcl_Obj *result; + CallFrame frame, *framePtr = &frame; + Nsf_PushFrameObj(interp, (NsfObject*)object, framePtr); + if (((NsfObject*)object)->nsPtr) { + flgs |= TCL_NAMESPACE_ONLY; + } + result = Tcl_ObjGetVar2(interp, name1, name2, flgs); + Nsf_PopFrameObj(interp, framePtr); + + return result; +} +extern int +Nsf_UnsetVar2(Nsf_Object *object1, Tcl_Interp *interp, + CONST char *name1, CONST char *name2, int flgs) { + NsfObject *object = (NsfObject *) object1; + int result; + CallFrame frame, *framePtr = &frame; + + Nsf_PushFrameObj(interp, object, framePtr); + if (object->nsPtr) { + flgs |= TCL_NAMESPACE_ONLY; + } + result = Tcl_UnsetVar2(interp, name1, name2, flgs); + Nsf_PopFrameObj(interp, framePtr); + return result; +} +extern int +NsfCreate(Tcl_Interp *interp, Nsf_Class *class, Tcl_Obj *nameObj, + int objc, Tcl_Obj *CONST objv[]) { + NsfClass *cl = (NsfClass *) class; + int result; + ALLOC_ON_STACK(Tcl_Obj *, objc+2, ov); + + INCR_REF_COUNT(nameObj); + + ov[0] = NULL; + ov[1] = nameObj; + if (objc>0) { + memcpy(ov+2, objv, sizeof(Tcl_Obj *)*objc); + } + result = NsfCCreateMethod(interp, cl, ObjStr(nameObj), objc+2, ov); + + FREE_ON_STACK(Tcl_Obj*, ov); + DECR_REF_COUNT(nameObj); + + return result; +} +extern int +NsfDeleteObject(Tcl_Interp *interp, Nsf_Object *object) { + return DispatchDestroyMethod(interp, (NsfObject *)object, 0); +} +extern int +NsfRemoveObjectMethod(Tcl_Interp *interp, Nsf_Object *object1, CONST char *methodName) { + NsfObject *object = (NsfObject*) object1; + + AliasDelete(interp, object->cmdName, methodName, 1); + +#if defined(NSF_WITH_ASSERTIONS) + if (object->opt) { + AssertionRemoveProc(object->opt->assertions, methodName); + } +#endif + + if (object->nsPtr) { + int rc = NSDeleteCmd(interp, object->nsPtr, methodName); + if (rc < 0) + return NsfPrintError(interp, "%s cannot delete method '%s' of object %s", + ObjectName(object), methodName, ObjectName(object)); + } + return TCL_OK; +} +extern int +NsfRemoveClassMethod(Tcl_Interp *interp, Nsf_Class *class, CONST char *methodName) { + NsfClass *cl = (NsfClass*) class; + int rc; +#if defined(NSF_WITH_ASSERTIONS) + NsfClassOpt *opt = cl->opt; +#endif + + AliasDelete(interp, class->object.cmdName, methodName, 0); + +#if defined(NSF_WITH_ASSERTIONS) + if (opt && opt->assertions) { + AssertionRemoveProc(opt->assertions, methodName); + } +#endif + + rc = NSDeleteCmd(interp, cl->nsPtr, methodName); + if (rc < 0) { + return NsfPrintError(interp, "%s: cannot delete method '%s'", ClassName(cl), methodName); + } + return TCL_OK; +} + + /* * NsfObject Reference Accounting */ @@ -926,7 +1079,7 @@ *---------------------------------------------------------------------- * NsfClassListFree -- * - * Frees all elements of the provided + * Frees all elements of the provided class list * * Results: * None. @@ -936,7 +1089,7 @@ * *---------------------------------------------------------------------- */ -extern void +static void NsfClassListFree(NsfClasses *sl) { NsfClasses *n; for (; sl; sl = n) { @@ -961,7 +1114,7 @@ *---------------------------------------------------------------------- */ -extern NsfClasses ** +static NsfClasses ** NsfClassListAdd(NsfClasses **firstPtrPtr, NsfClass *cl, ClientData clientData) { NsfClasses *l = *firstPtrPtr, *element = NEW(NsfClasses); element->cl = cl; @@ -1095,30 +1248,21 @@ static NsfClasses * TopoOrder(NsfClass *cl, NsfClasses *(*next)(NsfClass*)) { - if (TopoSort(cl, cl, next)) + if (TopoSort(cl, cl, next)) { return cl->order; + } NsfClassListFree(cl->order); return cl->order = NULL; } static NsfClasses * ComputeOrder(NsfClass *cl, NsfClasses *order, NsfClasses *(*direction)(NsfClass*)) { - if (order) + if (order) { return order; + } return cl->order = TopoOrder(cl, direction); } -extern NsfClasses * -NsfComputePrecedence(NsfClass *cl) { - return ComputeOrder(cl, cl->order, Super); -} - -extern NsfClasses * -NsfComputeDependents(NsfClass *cl) { - return ComputeOrder(cl, cl->order, Sub); -} - - static void FlushPrecedencesOnSubclasses(NsfClass *cl) { NsfClasses *pc; @@ -1219,21 +1363,9 @@ } /* - * internal type checking - */ - -extern Nsf_Class * -NsfIsClass(Tcl_Interp *interp, ClientData clientData) { - if (clientData && NsfObjectIsClass((NsfObject *)clientData)) - return (Nsf_Class *) clientData; - return 0; -} - -/* * methods lookup */ - /* *---------------------------------------------------------------------- * GetEnsembeObjectFromName -- @@ -1343,12 +1475,12 @@ Tcl_Namespace *parentNsPtr; NsfObject *ensembleObject; Tcl_Obj *methodHandleObj; - int oc, result, i; + int oc, i; Tcl_Obj **ov; /*fprintf(stderr, "name '%s' contains space \n", methodName);*/ - if ((result = Tcl_ListObjGetElements(interp, methodObj, &oc, &ov) != TCL_OK) + if ((Tcl_ListObjGetElements(interp, methodObj, &oc, &ov) != TCL_OK) || ((referencedObject = GetEnsembeObjectFromName(interp, nsPtr, ov[0], &cmd, fromClassNS)) == NULL) ) { @@ -2072,7 +2204,7 @@ * conditional memory allocations of optional storage */ -extern NsfObjectOpt * +static NsfObjectOpt * NsfRequireObjectOpt(NsfObject *object) { if (!object->opt) { object->opt = NEW(NsfObjectOpt); @@ -2081,7 +2213,7 @@ return object->opt; } -extern NsfClassOpt * +static NsfClassOpt * NsfRequireClassOpt(/*@notnull@*/ NsfClass *cl) { assert(cl); if (!cl->opt) { @@ -2895,11 +3027,12 @@ * with "namespace path nx". */ { Namespace *parentNsPtr = Tcl_Namespace_parentPtr(nsPtr); - int i, pathLength = Tcl_Namespace_commandPathLength(parentNsPtr); + int pathLength = Tcl_Namespace_commandPathLength(parentNsPtr); if (pathLength>0) { Namespace **pathArray = (Namespace **)ckalloc(sizeof(Namespace *) * pathLength); NamespacePathEntry *tmpPathArray = Tcl_Namespace_commandPathArray(parentNsPtr); + int i; for (i=0; insPtr; } -extern void -NsfRequireObjNamespace(Tcl_Interp *interp, Nsf_Object *object) { - RequireObjNamespace(interp, (NsfObject*) object); -} - - /* * Namespace related commands */ @@ -3671,9 +3798,9 @@ static Tcl_Obj * AutonameIncr(Tcl_Interp *interp, Tcl_Obj *nameObj, NsfObject *object, int instanceOpt, int resetOpt) { - int valueLength, mustCopy = 1, format = 0; + int valueLength; char *valueString, *c; - Tcl_Obj *valueObj, *result = NULL, *savedResult = NULL; + Tcl_Obj *valueObj, *resultObj = NULL, *savedResultObj = NULL; int flgs = TCL_LEAVE_ERR_MSG; CallFrame frame, *framePtr = &frame; @@ -3699,38 +3826,41 @@ if (valueObj) { /* we have an entry */ Tcl_UnsetVar2(interp, NsfGlobalStrings[NSF_AUTONAMES], ObjStr(nameObj), flgs); } - result = NsfGlobalObjs[NSF_EMPTY]; - INCR_REF_COUNT(result); + resultObj = NsfGlobalObjs[NSF_EMPTY]; + INCR_REF_COUNT(resultObj); } else { + int mustCopy = 1, format = 0; + if (valueObj == NULL) { valueObj = Tcl_ObjSetVar2(interp, NsfGlobalObjs[NSF_AUTONAMES], nameObj, NsfGlobalObjs[NSF_ONE], flgs); } if (instanceOpt) { char buffer[1], firstChar; CONST char *nextChars = ObjStr(nameObj); + firstChar = *(nextChars ++); if (isupper((int)firstChar)) { buffer[0] = tolower((int)firstChar); - result = Tcl_NewStringObj(buffer, 1); - INCR_REF_COUNT(result); - Tcl_AppendLimitedToObj(result, nextChars, -1, INT_MAX, NULL); + resultObj = Tcl_NewStringObj(buffer, 1); + INCR_REF_COUNT(resultObj); + Tcl_AppendLimitedToObj(resultObj, nextChars, -1, INT_MAX, NULL); mustCopy = 0; } } if (mustCopy) { - result = Tcl_DuplicateObj(nameObj); - INCR_REF_COUNT(result); + resultObj = Tcl_DuplicateObj(nameObj); + INCR_REF_COUNT(resultObj); /* - fprintf(stderr, "*** copy %p %s = %p\n", name, ObjStr(name), result); + fprintf(stderr, "*** copy %p %s = %p\n", name, ObjStr(name), resultObj); */ } /* if we find a % in the autoname -> We use Tcl_FormatObjCmd to let the autoname string be formated, like Tcl "format" command, with the value. E.g.: autoname a%06d --> a000000, a000001, a000002, ... */ - for (c = ObjStr(result); *c != '\0'; c++) { + for (c = ObjStr(resultObj); *c != '\0'; c++) { if (*c == '%') { if (*(c+1) != '%') { format = 1; @@ -3744,32 +3874,32 @@ } if (format) { ALLOC_ON_STACK(Tcl_Obj*, 3, ov); - savedResult = Tcl_GetObjResult(interp); - INCR_REF_COUNT(savedResult); - ov[1] = result; + savedResultObj = Tcl_GetObjResult(interp); + INCR_REF_COUNT(savedResultObj); + ov[1] = resultObj; ov[2] = valueObj; if (NsfCallCommand(interp, NSF_FORMAT, 3, ov) != TCL_OK) { Nsf_PopFrameObj(interp, framePtr); - DECR_REF_COUNT(savedResult); + DECR_REF_COUNT(savedResultObj); FREE_ON_STACK(Tcl_Obj*, ov); - return 0; + return NULL; } - DECR_REF_COUNT(result); - result = Tcl_DuplicateObj(Tcl_GetObjResult(interp)); - INCR_REF_COUNT(result); - Tcl_SetObjResult(interp, savedResult); - DECR_REF_COUNT(savedResult); + DECR_REF_COUNT(resultObj); + resultObj = Tcl_DuplicateObj(Tcl_GetObjResult(interp)); + INCR_REF_COUNT(resultObj); + Tcl_SetObjResult(interp, savedResultObj); + DECR_REF_COUNT(savedResultObj); FREE_ON_STACK(Tcl_Obj*, ov); } else { valueString = Tcl_GetStringFromObj(valueObj, &valueLength); - Tcl_AppendLimitedToObj(result, valueString, valueLength, INT_MAX, NULL); + Tcl_AppendLimitedToObj(resultObj, valueString, valueLength, INT_MAX, NULL); /*fprintf(stderr, "+++ append to obj done\n");*/ } } Nsf_PopFrameObj(interp, framePtr); - assert((resetOpt && result->refCount>=1) || (result->refCount == 1)); - return result; + assert((resetOpt && resultObj->refCount>=1) || (resultObj->refCount == 1)); + return resultObj; } /* @@ -3813,14 +3943,14 @@ PrimitiveDestroy((ClientData) object); if (!(object->flags & NSF_TCL_DELETE)) { - Tcl_Obj *savedObjResult = Tcl_GetObjResult(interp); - INCR_REF_COUNT(savedObjResult); + Tcl_Obj *savedResultObj = Tcl_GetObjResult(interp); + INCR_REF_COUNT(savedResultObj); /*fprintf(stderr, " before DeleteCommandFromToken %p object flags %.6x\n", oid, object->flags);*/ /*fprintf(stderr, "cmd dealloc %p refcount %d dodestroy \n", oid, Tcl_Command_refCount(oid));*/ Tcl_DeleteCommandFromToken(interp, oid); /* this can change the result */ /*fprintf(stderr, " after DeleteCommandFromToken %p %.6x\n", oid, ((Command*)oid)->flags);*/ - Tcl_SetObjResult(interp, savedObjResult); - DECR_REF_COUNT(savedObjResult); + Tcl_SetObjResult(interp, savedResultObj); + DECR_REF_COUNT(savedResultObj); } NsfCleanupObject(object, "CallStackDoDestroy"); } @@ -4268,7 +4398,7 @@ AssertionCheckList(Tcl_Interp *interp, NsfObject *object, NsfTclObjList *alist, CONST char *methodName) { NsfTclObjList *checkFailed = NULL; - Tcl_Obj *savedObjResult = Tcl_GetObjResult(interp); + Tcl_Obj *savedResultObj = Tcl_GetObjResult(interp); int savedCheckoptions, acResult = TCL_OK; /* @@ -4293,7 +4423,7 @@ } #endif - INCR_REF_COUNT(savedObjResult); + INCR_REF_COUNT(savedResultObj); Tcl_ResetResult(interp); @@ -4336,7 +4466,7 @@ } if (checkFailed) { - DECR_REF_COUNT(savedObjResult); + DECR_REF_COUNT(savedResultObj); if (acResult == TCL_ERROR) { Tcl_Obj *sr = Tcl_GetObjResult(interp); INCR_REF_COUNT(sr); @@ -4349,8 +4479,8 @@ ObjStr(checkFailed->content), methodName); } - Tcl_SetObjResult(interp, savedObjResult); - DECR_REF_COUNT(savedObjResult); + Tcl_SetObjResult(interp, savedResultObj); + DECR_REF_COUNT(savedResultObj); return TCL_OK; } @@ -4414,12 +4544,13 @@ static int AssertionSetCheckOptions(Tcl_Interp *interp, NsfObject *object, Tcl_Obj *arg) { NsfObjectOpt *opt = NsfRequireObjectOpt(object); - int ocArgs, i; + int ocArgs; Tcl_Obj **ovArgs; opt->checkoptions = CHECK_NONE; if (Tcl_ListObjGetElements(interp, arg, &ocArgs, &ovArgs) == TCL_OK && ocArgs > 0) { + int i; for (i = 0; i < ocArgs; i++) { CONST char *option = ObjStr(ovArgs[i]); if (option) { @@ -5496,7 +5627,7 @@ return cmd; } } - return 0; + return NULL; } @@ -5581,10 +5712,10 @@ /* check a filter guard, return 1 if ok */ static int GuardCheck(Tcl_Interp *interp, Tcl_Obj *guardObj) { - int result; NsfRuntimeState *rst = RUNTIME_STATE(interp); if (guardObj) { + int result; /* * if there are more than one filter guard for this filter * (i.e. they are inherited), then they are OR combined @@ -6404,86 +6535,6 @@ return TCL_OK; } -extern Tcl_Obj * -Nsf_ObjSetVar2(Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, - Tcl_Obj *valueObj, int flgs) { - Tcl_Obj *result; - CallFrame frame, *framePtr = &frame; - - Nsf_PushFrameObj(interp, (NsfObject*)object, framePtr); - if (((NsfObject*)object)->nsPtr) { - flgs |= TCL_NAMESPACE_ONLY; - } - result = Tcl_ObjSetVar2(interp, name1, name2, valueObj, flgs); - Nsf_PopFrameObj(interp, framePtr); - return result; -} - -extern Tcl_Obj * -Nsf_SetVar2Ex(Nsf_Object *object, Tcl_Interp *interp, CONST char *name1, CONST char *name2, - Tcl_Obj *valueObj, int flgs) { - Tcl_Obj *result; - CallFrame frame, *framePtr = &frame; - - Nsf_PushFrameObj(interp, (NsfObject*)object, framePtr); - if (((NsfObject*)object)->nsPtr) - flgs |= TCL_NAMESPACE_ONLY; - - result = Tcl_SetVar2Ex(interp, name1, name2, valueObj, flgs); - Nsf_PopFrameObj(interp, framePtr); - return result; -} - - -extern Tcl_Obj * -NsfOSetInstVar(Nsf_Object *object, Tcl_Interp *interp, - Tcl_Obj *nameObj, Tcl_Obj *valueObj, int flgs) { - return Nsf_ObjSetVar2(object, interp, nameObj, (Tcl_Obj *)NULL, valueObj, (flgs|TCL_PARSE_PART1)); -} - -extern Tcl_Obj * -Nsf_ObjGetVar2(Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, - int flgs) { - Tcl_Obj *result; - CallFrame frame, *framePtr = &frame; - - Nsf_PushFrameObj(interp, (NsfObject*)object, framePtr); - if (((NsfObject*)object)->nsPtr) { - flgs |= TCL_NAMESPACE_ONLY; - } - result = Tcl_ObjGetVar2(interp, name1, name2, flgs); - Nsf_PopFrameObj(interp, framePtr); - - return result; -} - -extern Tcl_Obj * -Nsf_GetVar2Ex(Nsf_Object *object, Tcl_Interp *interp, CONST char *name1, CONST char *name2, - int flgs) { - Tcl_Obj *result; - CallFrame frame, *framePtr = &frame; - - Nsf_PushFrameObj(interp, (NsfObject*)object, framePtr); - if (((NsfObject*)object)->nsPtr) - flgs |= TCL_NAMESPACE_ONLY; - - result = Tcl_GetVar2Ex(interp, name1, name2, flgs); - Nsf_PopFrameObj(interp, framePtr); - return result; -} - - -Tcl_Obj * -NsfOGetInstVar(Nsf_Object *object, Tcl_Interp *interp, Tcl_Obj *nameObj, int flgs) { - return Nsf_ObjGetVar2(object, interp, nameObj, (Tcl_Obj *)NULL, (flgs|TCL_PARSE_PART1)); -} - -int -NsfUnsetInstVar(Nsf_Object *object, Tcl_Interp *interp, CONST char *name, int flgs) { - return NsfUnsetInstVar2(object, interp, name, NULL, flgs); -} - - /* *---------------------------------------------------------------------- * CheckVarName -- @@ -6596,7 +6647,6 @@ ByteCompiled(Tcl_Interp *interp, unsigned short *cscFlagsPtr, Proc *procPtr, CONST char *body) { Tcl_Obj *bodyPtr = procPtr->bodyPtr; Namespace *nsPtr = procPtr->cmdPtr->nsPtr; - int result; if (bodyPtr->typePtr == Nsf_OT_byteCodeType) { # if defined(HAVE_TCL_COMPILE_H) @@ -6623,7 +6673,7 @@ return TCL_OK; # endif } else { - + int result; # if defined(HAVE_TCL_COMPILE_H) doCompilation: # endif @@ -7333,9 +7383,6 @@ CONST char *methodName, NsfObject *object, Tcl_Command cmdPtr, NsfCallStackContent *cscPtr) { CallFrame frame, *framePtr = &frame; -#if defined(NSF_WITH_ASSERTIONS) - CheckOptions co; -#endif int result; assert(object); @@ -7363,7 +7410,7 @@ #if defined(NSF_WITH_ASSERTIONS) if (object->opt) { - co = object->opt->checkoptions; + CheckOptions co = object->opt->checkoptions; if ((co & CHECK_INVAR)) { result = AssertionCheckInvars(interp, object, methodName, co); } @@ -8153,9 +8200,8 @@ DispatchUnknownMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], NsfObject *delegator, Tcl_Obj *methodObj, int flags) { - int result, offset; + int result; NsfObject *object = (NsfObject*)clientData; - Tcl_Obj *unknownObj = NsfMethodObj(interp, object, NSF_o_unknown_idx); /*fprintf(stderr, "compare unknownObj %p with methodObj %p '%s' %p %p %s\n", @@ -8167,6 +8213,7 @@ /* * back off and try unknown; */ + int offset; ALLOC_ON_STACK(Tcl_Obj*, objc+3, tov); /*fprintf(stderr, "calling unknown for %s %s, flgs=%02x,%02x isClass=%d %p %s objc %d\n", @@ -8216,7 +8263,7 @@ * *---------------------------------------------------------------------- */ -int +extern int NsfObjDispatch(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { int result; #ifdef STACK_TRACE @@ -8739,7 +8786,7 @@ ParamParse(Tcl_Interp *interp, Tcl_Obj *procNameObj, Tcl_Obj *arg, int disallowedFlags, NsfParam *paramPtr, int *possibleUnknowns, int *plainParams, int *nrNonposArgs) { int result, npac, isNonposArgument; - size_t nameLength, length, j; + size_t length, j; CONST char *argString, *argName; Tcl_Obj **npav; @@ -8760,12 +8807,10 @@ if (isNonposArgument) { argName = argString+1; - nameLength = length-1; paramPtr->nrArgs = 1; /* per default 1 argument, switches set their arg numbers */ (*nrNonposArgs) ++; } else { argName = argString; - nameLength = length; paramPtr->flags |= NSF_ARG_REQUIRED; /* positional arguments are required unless we have a default */ } @@ -9539,7 +9584,7 @@ tmpObject = GetObjectFromString(interp, Tcl_DStringValue(dsPtr)); if (tmpObject) { Tcl_HashSearch hSrch; - Tcl_HashEntry *hPtr, *slotEntry; + Tcl_HashEntry *hPtr; Tcl_HashTable *cmdTablePtr; Tcl_Command cmd; int new; @@ -9550,7 +9595,7 @@ hPtr = Tcl_FirstHashEntry(cmdTablePtr, &hSrch); for (; hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { char *key = Tcl_GetHashKey(cmdTablePtr, hPtr); - slotEntry = Tcl_CreateHashEntry(&slotTable, key, &new); + Tcl_CreateHashEntry(&slotTable, key, &new); if (!new) continue; cmd = (Tcl_Command) Tcl_GetHashValue(hPtr); childObject = NsfGetObjectFromCmdPtr(cmd); @@ -9901,8 +9946,7 @@ NsfCallStackContent *cscPtr, int freeArgumentVector) { Tcl_Command cmd, currentCmd = NULL; - int result, frameType = NSF_CSC_TYPE_PLAIN, - isMixinEntry = 0, isFilterEntry = 0, + int result, isMixinEntry = 0, isFilterEntry = 0, endOfFilterChain = 0; NsfRuntimeState *rst = RUNTIME_STATE(interp); NsfObject *object = cscPtr->self; @@ -9926,6 +9970,7 @@ Tcl_ResetResult(interp); /* needed for bytecode support */ #endif if (cmd) { + int frameType = NSF_CSC_TYPE_PLAIN; /* * change mixin state */ @@ -10089,7 +10134,7 @@ * *---------------------------------------------------------------------- */ -int +static int NsfNextObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { int freeArgumentVector, nobjc, result; NsfCallStackContent *cscPtr; @@ -10982,7 +11027,6 @@ NsfClass *cl = (NsfClass*)ckalloc(sizeof(NsfClass)); Tcl_Namespace *nsPtr; CONST char *nameString = ObjStr(nameObj); - size_t length; NsfObject *object = (NsfObject*)cl; /* fprintf(stderr, "PrimitiveCCreate %s parentNs %p\n",nameString, parentNsPtr); */ @@ -10997,7 +11041,6 @@ } assert(isAbsolutePath(nameString)); - length = strlen(nameString); /* fprintf(stderr, "Class alloc %p '%s'\n", cl, nameString); */ @@ -11245,70 +11288,6 @@ return 0; } -extern int -NsfCreateObject(Tcl_Interp *interp, Tcl_Obj *nameObj, Nsf_Class *class) { - NsfClass *cl = (NsfClass*) class; - Tcl_Obj *methodObj; - int result; - - INCR_REF_COUNT(nameObj); - - if (CallDirectly(interp, &cl->object, NSF_c_create_idx, &methodObj)) { - result = NsfCCreateMethod(interp, cl, ObjStr(nameObj), 1, &nameObj); - } else { - result = NsfCallMethodWithArgs((ClientData)cl, interp, methodObj, - nameObj, 1, 0, NSF_CSC_IMMEDIATE); - } - DECR_REF_COUNT(nameObj); - return result; -} - -extern int -NsfCreate(Tcl_Interp *interp, Nsf_Class *class, Tcl_Obj *nameObj, ClientData clientData, - int objc, Tcl_Obj *CONST objv[]) { - NsfClass *cl = (NsfClass *) class; - int result; - ALLOC_ON_STACK(Tcl_Obj *, objc+2, ov); - - INCR_REF_COUNT(nameObj); - - ov[0] = NULL; - ov[1] = nameObj; - if (objc>0) { - memcpy(ov+2, objv, sizeof(Tcl_Obj *)*objc); - } - result = NsfCCreateMethod(interp, cl, ObjStr(nameObj), objc+2, ov); - - FREE_ON_STACK(Tcl_Obj*, ov); - DECR_REF_COUNT(nameObj); - - return result; -} - -int -NsfDeleteObject(Tcl_Interp *interp, Nsf_Object *object1) { - NsfObject *object = (NsfObject *) object1; - - return DispatchDestroyMethod(interp, object, 0); -} - -extern int -NsfUnsetInstVar2(Nsf_Object *object1, Tcl_Interp *interp, - CONST char *name1, CONST char *name2, - int flgs) { - NsfObject *object = (NsfObject *) object1; - int result; - CallFrame frame, *framePtr = &frame; - - Nsf_PushFrameObj(interp, object, framePtr); - if (object->nsPtr) - flgs |= TCL_NAMESPACE_ONLY; - - result = Tcl_UnsetVar2(interp, name1, name2, flgs); - Nsf_PopFrameObj(interp, framePtr); - return result; -} - static int GetInstVarIntoCurrentScope(Tcl_Interp *interp, const char *cmdName, NsfObject *object, Tcl_Obj *varName, Tcl_Obj *newName) { @@ -11432,50 +11411,6 @@ return TCL_OK; } -extern int -NsfRemoveObjectMethod(Tcl_Interp *interp, Nsf_Object *object1, CONST char *methodName) { - NsfObject *object = (NsfObject*) object1; - - AliasDelete(interp, object->cmdName, methodName, 1); - -#if defined(NSF_WITH_ASSERTIONS) - if (object->opt) { - AssertionRemoveProc(object->opt->assertions, methodName); - } -#endif - - if (object->nsPtr) { - int rc = NSDeleteCmd(interp, object->nsPtr, methodName); - if (rc < 0) - return NsfPrintError(interp, "%s cannot delete method '%s' of object %s", - ObjectName(object), methodName, ObjectName(object)); - } - return TCL_OK; -} - -extern int -NsfRemoveClassMethod(Tcl_Interp *interp, Nsf_Class *class, CONST char *methodName) { - NsfClass *cl = (NsfClass*) class; - int rc; -#if defined(NSF_WITH_ASSERTIONS) - NsfClassOpt *opt = cl->opt; -#endif - - AliasDelete(interp, class->object.cmdName, methodName, 0); - -#if defined(NSF_WITH_ASSERTIONS) - if (opt && opt->assertions) { - AssertionRemoveProc(opt->assertions, methodName); - } -#endif - - rc = NSDeleteCmd(interp, cl->nsPtr, methodName); - if (rc < 0) { - return NsfPrintError(interp, "%s: cannot delete method '%s'", ClassName(cl), methodName); - } - return TCL_OK; -} - /* * obj/cl ClientData setter/getter */ @@ -11562,7 +11497,7 @@ int firstPosArg, int *outputincr) { CONST char *ForwardArgString = ObjStr(ForwardArgObj), *p; int totalargs = objc + tcd->nr_args - 1; - char c = *ForwardArgString, c1; + char c = *ForwardArgString; /* per default every ForwardArgString from the processed list corresponds to exactly one ForwardArgString in the computed final list */ @@ -11604,7 +11539,8 @@ if (c == '%') { Tcl_Obj *list = NULL, **listElements; int nrArgs = objc-1, nrPosArgs = objc-firstPosArg, nrElements = 0; - char *firstActualArgument = nrArgs>0 ? ObjStr(objv[1]) : NULL; + char c1, *firstActualArgument = nrArgs>0 ? ObjStr(objv[1]) : NULL; + c = *++ForwardArgString; c1 = *(ForwardArgString+1); @@ -11654,7 +11590,7 @@ } } else if (c == '-') { CONST char *firstElementString; - int i, insertRequired, done = 0; + int insertRequired, done = 0; /*fprintf(stderr, "process flag '%s'\n", firstActualArgument);*/ if (Tcl_ListObjGetElements(interp, ForwardArgObj, &nrElements, &listElements) != TCL_OK) { @@ -11667,6 +11603,7 @@ firstElementString++; /* we skip the dash */ if (firstActualArgument && *firstActualArgument == '-') { + int i; /*fprintf(stderr, "we have a flag in first argument '%s'\n", firstActualArgument);*/ for (i = 1; i < firstPosArg; i++) { @@ -11809,7 +11746,7 @@ NsfForwardMethod(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ForwardCmdClientData *tcd = (ForwardCmdClientData *)clientData; - int result, j, inputArg = 1, outputArg = 0; + int result, inputArg = 1; if (!tcd || !tcd->object) return NsfObjErrType(interp, "forwarder", objv[0], "object", NULL); @@ -11827,7 +11764,9 @@ return result; } else { Tcl_Obj **ov, *freeList=NULL; - int outputincr, firstPosArg=1, totalargs = objc + tcd->nr_args + 3; + int j, outputincr, outputArg = 0, firstPosArg=1, + totalargs = objc + tcd->nr_args + 3; + ALLOC_ON_STACK(Tcl_Obj*, totalargs, OV); ALLOC_ON_STACK(int, totalargs, objvmap); /*fprintf(stderr, "+++ forwardMethod standard case, allocated %d args\n", totalargs);*/ @@ -11862,6 +11801,7 @@ /* copy argument list from definition */ Tcl_Obj **listElements; int nrElements; + Tcl_ListObjGetElements(interp, tcd->args, &nrElements, &listElements); for (j=0; jnr_args - inputArg; + for (j=0; jfirstLocalPtr, i=0; ap; ap = ap->nextPtr, i++) { if (!TclIsCompiledLocalArgument(ap)) continue; varPtr = &Tcl_CallFrame_compiledLocals(varFramePtr)[i]; @@ -17938,7 +17908,6 @@ Var *varPtr; Tcl_Command cmd; register Tcl_HashEntry *entryPtr; - char *varName; for (entryPtr = Tcl_FirstHashEntry(varTablePtr, &search); entryPtr; entryPtr = Tcl_NextHashEntry(&search)) { Tcl_Obj *nameObj; @@ -17952,10 +17921,8 @@ cmd = (Tcl_Command)Tcl_GetHashValue(entryPtr); if (Tcl_Command_objProc(cmd) == RUNTIME_STATE(interp)->objInterpProc) { - char *key = Tcl_GetHashKey(cmdTablePtr, entryPtr); - /*fprintf(stderr, "cmdname = %s cmd %p proc %p objProc %p %d\n", - key, cmd, Tcl_Command_proc(cmd), Tcl_Command_objProc(cmd), + Tcl_GetHashKey(cmdTablePtr, entryPtr), cmd, Tcl_Command_proc(cmd), Tcl_Command_objProc(cmd), Tcl_Command_proc(cmd)==RUNTIME_STATE(interp)->objInterpProc);*/ Tcl_DeleteCommandFromToken(interp, cmd); @@ -18270,7 +18237,7 @@ ClientData runtimeState; int result, i; #ifdef NSF_BYTECODE - NsfCompEnv *interpstructions = NsfGetCompEnv(); + /*NsfCompEnv *interpstructions = NsfGetCompEnv();*/ #endif static NsfMutex initMutex = 0; Index: generic/nsf.decls =================================================================== diff -u -r87c6a11296ada89c007cc2ed33df6887ac53c740 -r9be296c7be8b0c04eaedd9f96c36d626aa7c2c97 --- generic/nsf.decls (.../nsf.decls) (revision 87c6a11296ada89c007cc2ed33df6887ac53c740) +++ generic/nsf.decls (.../nsf.decls) (revision 9be296c7be8b0c04eaedd9f96c36d626aa7c2c97) @@ -28,100 +28,85 @@ # int Nsf_SafeInit(Tcl_Interp *interp) #} declare 2 generic { - struct Nsf_Class *NsfIsClass(Tcl_Interp *interp, ClientData cd) + 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 NsfCreateObject(Tcl_Interp *interp, Tcl_Obj *name, struct Nsf_Class *cl) + int NsfDeleteObject(Tcl_Interp *interp, struct Nsf_Object *obj) } declare 6 generic { - int NsfDeleteObject(Tcl_Interp *interp, struct Nsf_Object *obj) + int NsfRemoveObjectMethod(Tcl_Interp *interp, struct Nsf_Object *obj, CONST char *nm) } declare 7 generic { - int NsfRemoveObjectMethod(Tcl_Interp *interp, struct Nsf_Object *obj, CONST char *nm) + int NsfRemoveClassMethod(Tcl_Interp *interp, struct Nsf_Class *cl, CONST char *nm) } declare 8 generic { - int NsfRemoveClassMethod(Tcl_Interp *interp, struct Nsf_Class *cl, CONST char *nm) + Tcl_Obj *Nsf_ObjSetVar2(struct Nsf_Object *obj, + Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, + Tcl_Obj *value, int flgs) } declare 9 generic { - Tcl_Obj *NsfOSetInstVar(struct Nsf_Object *obj, Tcl_Interp *interp, - Tcl_Obj *name, Tcl_Obj *value, int flgs) + Tcl_Obj *Nsf_ObjGetVar2(struct Nsf_Object *obj, + Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, + int flgs) } declare 10 generic { - Tcl_Obj *NsfOGetInstVar(struct Nsf_Object *obj, Tcl_Interp *interp, - Tcl_Obj *name, int flgs) + int Nsf_UnsetVar2(struct Nsf_Object *obj, Tcl_Interp *interp, + CONST char *name1, CONST char *name2, int flgs) } declare 11 generic { - Tcl_Obj *Nsf_ObjSetVar2(struct Nsf_Object *obj, - Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, - Tcl_Obj *value, int flgs) + void NsfDStringPrintf(Tcl_DString *dsPtr, CONST char *fmt, va_list apSrc) } declare 12 generic { - Tcl_Obj *Nsf_ObjGetVar2(struct Nsf_Object *obj, - Tcl_Interp *interp, Tcl_Obj *name1, Tcl_Obj *name2, - int flgs) + int NsfPrintError(Tcl_Interp *interp, CONST char *fmt, ...) } declare 13 generic { - int NsfUnsetInstVar2(struct Nsf_Object *obj, Tcl_Interp *interp, - CONST char *name1, CONST char *name2, - int flgs) + int NsfErrInProc (Tcl_Interp *interp, Tcl_Obj *objName, + Tcl_Obj *clName, CONST char *procName) } declare 14 generic { - void NsfDStringPrintf(Tcl_DString *dsPtr, CONST char *fmt, va_list apSrc) + int NsfObjErrType(Tcl_Interp *interp, CONST char *context, + Tcl_Obj *value, CONST char *type, Nsf_Param CONST *pPtr) } declare 15 generic { - int NsfPrintError(Tcl_Interp *interp, CONST char *fmt, ...) + void NsfStackDump (Tcl_Interp *interp) } declare 16 generic { - int NsfErrInProc (Tcl_Interp *interp, Tcl_Obj *objName, - Tcl_Obj *clName, CONST char *procName) + void NsfSetObjClientData(Nsf_Object *obj, ClientData data) } declare 17 generic { - int NsfObjErrType(Tcl_Interp *interp, CONST char *context, - Tcl_Obj *value, CONST char *type, Nsf_Param CONST *pPtr) + ClientData NsfGetObjClientData(Nsf_Object *obj) } declare 18 generic { - void NsfStackDump (Tcl_Interp *interp) + void NsfSetClassClientData(Nsf_Class *cl, ClientData data) } declare 19 generic { - void NsfSetObjClientData(Nsf_Object *obj, ClientData data) + ClientData NsfGetClassClientData(Nsf_Class *cl) } declare 20 generic { - ClientData NsfGetObjClientData(Nsf_Object *obj) + void NsfRequireObjNamespace(Tcl_Interp *interp, Nsf_Object *obj) } declare 21 generic { - void NsfSetClassClientData(Nsf_Class *cl, ClientData data) + int NsfCallMethodWithArgs(ClientData cd, Tcl_Interp *interp, + Tcl_Obj *method, Tcl_Obj *arg, + int objc, Tcl_Obj *CONST objv[], int flags) } declare 22 generic { - ClientData NsfGetClassClientData(Nsf_Class *cl) + int NsfAddObjectMethod(Tcl_Interp *interp, struct Nsf_Object *obj, + CONST char *nm, Tcl_ObjCmdProc *proc, + ClientData cd, Tcl_CmdDeleteProc *dp, int flags) } declare 23 generic { - void NsfRequireObjNamespace(Tcl_Interp *interp, Nsf_Object *obj) + int NsfAddClassMethod(Tcl_Interp *interp, struct Nsf_Class *cl, + CONST char *nm, Tcl_ObjCmdProc *proc, + ClientData cd, Tcl_CmdDeleteProc *dp, int flags) } declare 24 generic { - int NsfNextObjCmd(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) + int NsfCreate(Tcl_Interp *in, Nsf_Class *class, Tcl_Obj *name, + int objc, Tcl_Obj *CONST objv[]) } -declare 25 generic { - int NsfCallMethodWithArgs(ClientData cd, Tcl_Interp *interp, - Tcl_Obj *method, Tcl_Obj *arg, - int objc, Tcl_Obj *CONST objv[], int flags) -} -declare 26 generic { - int NsfAddObjectMethod(Tcl_Interp *interp, struct Nsf_Object *obj, - CONST char *nm, Tcl_ObjCmdProc *proc, - ClientData cd, Tcl_CmdDeleteProc *dp, int flags) -} -declare 27 generic { - int NsfAddClassMethod(Tcl_Interp *interp, struct Nsf_Class *cl, - CONST char *nm, Tcl_ObjCmdProc *proc, - ClientData cd, Tcl_CmdDeleteProc *dp, int flags) -} -declare 28 generic { - int NsfCreate(Tcl_Interp *in, Nsf_Class *class, Tcl_Obj *name, ClientData data, - int objc, Tcl_Obj *CONST objv[]) -} Index: generic/nsfAccessInt.h =================================================================== diff -u -r89c35cdde49d7be07d3b34a072e7c05357a9ee08 -r9be296c7be8b0c04eaedd9f96c36d626aa7c2c97 --- generic/nsfAccessInt.h (.../nsfAccessInt.h) (revision 89c35cdde49d7be07d3b34a072e7c05357a9ee08) +++ generic/nsfAccessInt.h (.../nsfAccessInt.h) (revision 9be296c7be8b0c04eaedd9f96c36d626aa7c2c97) @@ -57,6 +57,26 @@ #define TclVarHashTablePtr(varTablePtr) &(varTablePtr)->table #define TclVarValue(type, varPtr, field) (type *)(varPtr)->value.field +static NSF_INLINE Var * +VarHashCreateVar(TclVarHashTable *tablePtr, Tcl_Obj *key, int *newPtr) { + Var *varPtr = NULL; + Tcl_HashEntry *hPtr; + + hPtr = Tcl_CreateHashEntry((Tcl_HashTable *) tablePtr, + (char *) key, newPtr); + if (hPtr) { + varPtr = TclVarHashGetValue(hPtr); + } + return varPtr; +} + +static TclVarHashTable * +VarHashTableCreate() { + TclVarHashTable *varTablePtr = (TclVarHashTable *) ckalloc(sizeof(TclVarHashTable)); + TclInitVarHashTable(varTablePtr, NULL); + return varTablePtr; +} + /* * Conversion from CmdPtr to Class / Object */ Index: generic/nsfDecls.h =================================================================== diff -u -rdd7a26337aa9aec3e0a06d2137ee7e708a8e1a9a -r9be296c7be8b0c04eaedd9f96c36d626aa7c2c97 --- generic/nsfDecls.h (.../nsfDecls.h) (revision dd7a26337aa9aec3e0a06d2137ee7e708a8e1a9a) +++ generic/nsfDecls.h (.../nsfDecls.h) (revision 9be296c7be8b0c04eaedd9f96c36d626aa7c2c97) @@ -48,157 +48,131 @@ EXTERN struct Nsf_Class * NsfGetClass (Tcl_Interp * interp, CONST char * name); #endif -#ifndef NsfCreateObject_TCL_DECLARED -#define NsfCreateObject_TCL_DECLARED -/* 5 */ -EXTERN int NsfCreateObject (Tcl_Interp * interp, Tcl_Obj * name, - struct Nsf_Class * cl); -#endif #ifndef NsfDeleteObject_TCL_DECLARED #define NsfDeleteObject_TCL_DECLARED -/* 6 */ +/* 5 */ EXTERN int NsfDeleteObject (Tcl_Interp * interp, struct Nsf_Object * obj); #endif #ifndef NsfRemoveObjectMethod_TCL_DECLARED #define NsfRemoveObjectMethod_TCL_DECLARED -/* 7 */ +/* 6 */ EXTERN int NsfRemoveObjectMethod (Tcl_Interp * interp, struct Nsf_Object * obj, CONST char * nm); #endif #ifndef NsfRemoveClassMethod_TCL_DECLARED #define NsfRemoveClassMethod_TCL_DECLARED -/* 8 */ +/* 7 */ EXTERN int NsfRemoveClassMethod (Tcl_Interp * interp, struct Nsf_Class * cl, CONST char * nm); #endif -#ifndef NsfOSetInstVar_TCL_DECLARED -#define NsfOSetInstVar_TCL_DECLARED -/* 9 */ -EXTERN Tcl_Obj * NsfOSetInstVar (struct Nsf_Object * obj, - Tcl_Interp * interp, Tcl_Obj * name, - Tcl_Obj * value, int flgs); -#endif -#ifndef NsfOGetInstVar_TCL_DECLARED -#define NsfOGetInstVar_TCL_DECLARED -/* 10 */ -EXTERN Tcl_Obj * NsfOGetInstVar (struct Nsf_Object * obj, - Tcl_Interp * interp, Tcl_Obj * name, - int flgs); -#endif #ifndef Nsf_ObjSetVar2_TCL_DECLARED #define Nsf_ObjSetVar2_TCL_DECLARED -/* 11 */ +/* 8 */ EXTERN Tcl_Obj * Nsf_ObjSetVar2 (struct Nsf_Object * obj, Tcl_Interp * interp, Tcl_Obj * name1, Tcl_Obj * name2, Tcl_Obj * value, int flgs); #endif #ifndef Nsf_ObjGetVar2_TCL_DECLARED #define Nsf_ObjGetVar2_TCL_DECLARED -/* 12 */ +/* 9 */ EXTERN Tcl_Obj * Nsf_ObjGetVar2 (struct Nsf_Object * obj, Tcl_Interp * interp, Tcl_Obj * name1, Tcl_Obj * name2, int flgs); #endif -#ifndef NsfUnsetInstVar2_TCL_DECLARED -#define NsfUnsetInstVar2_TCL_DECLARED -/* 13 */ -EXTERN int NsfUnsetInstVar2 (struct Nsf_Object * obj, +#ifndef Nsf_UnsetVar2_TCL_DECLARED +#define Nsf_UnsetVar2_TCL_DECLARED +/* 10 */ +EXTERN int Nsf_UnsetVar2 (struct Nsf_Object * obj, Tcl_Interp * interp, CONST char * name1, CONST char * name2, int flgs); #endif #ifndef NsfDStringPrintf_TCL_DECLARED #define NsfDStringPrintf_TCL_DECLARED -/* 14 */ +/* 11 */ EXTERN void NsfDStringPrintf (Tcl_DString * dsPtr, CONST char * fmt, va_list apSrc); #endif #ifndef NsfPrintError_TCL_DECLARED #define NsfPrintError_TCL_DECLARED -/* 15 */ +/* 12 */ EXTERN int NsfPrintError (Tcl_Interp * interp, CONST char * fmt, ...); #endif #ifndef NsfErrInProc_TCL_DECLARED #define NsfErrInProc_TCL_DECLARED -/* 16 */ +/* 13 */ EXTERN int NsfErrInProc (Tcl_Interp * interp, Tcl_Obj * objName, Tcl_Obj * clName, CONST char * procName); #endif #ifndef NsfObjErrType_TCL_DECLARED #define NsfObjErrType_TCL_DECLARED -/* 17 */ +/* 14 */ EXTERN int NsfObjErrType (Tcl_Interp * interp, CONST char * context, Tcl_Obj * value, CONST char * type, Nsf_Param CONST * pPtr); #endif #ifndef NsfStackDump_TCL_DECLARED #define NsfStackDump_TCL_DECLARED -/* 18 */ +/* 15 */ EXTERN void NsfStackDump (Tcl_Interp * interp); #endif #ifndef NsfSetObjClientData_TCL_DECLARED #define NsfSetObjClientData_TCL_DECLARED -/* 19 */ +/* 16 */ EXTERN void NsfSetObjClientData (Nsf_Object * obj, ClientData data); #endif #ifndef NsfGetObjClientData_TCL_DECLARED #define NsfGetObjClientData_TCL_DECLARED -/* 20 */ +/* 17 */ EXTERN ClientData NsfGetObjClientData (Nsf_Object * obj); #endif #ifndef NsfSetClassClientData_TCL_DECLARED #define NsfSetClassClientData_TCL_DECLARED -/* 21 */ +/* 18 */ EXTERN void NsfSetClassClientData (Nsf_Class * cl, ClientData data); #endif #ifndef NsfGetClassClientData_TCL_DECLARED #define NsfGetClassClientData_TCL_DECLARED -/* 22 */ +/* 19 */ EXTERN ClientData NsfGetClassClientData (Nsf_Class * cl); #endif #ifndef NsfRequireObjNamespace_TCL_DECLARED #define NsfRequireObjNamespace_TCL_DECLARED -/* 23 */ +/* 20 */ EXTERN void NsfRequireObjNamespace (Tcl_Interp * interp, Nsf_Object * obj); #endif -#ifndef NsfNextObjCmd_TCL_DECLARED -#define NsfNextObjCmd_TCL_DECLARED -/* 24 */ -EXTERN int NsfNextObjCmd (ClientData cd, Tcl_Interp * interp, - int objc, Tcl_Obj *CONST objv[]); -#endif #ifndef NsfCallMethodWithArgs_TCL_DECLARED #define NsfCallMethodWithArgs_TCL_DECLARED -/* 25 */ +/* 21 */ EXTERN int NsfCallMethodWithArgs (ClientData cd, Tcl_Interp * interp, Tcl_Obj * method, Tcl_Obj * arg, int objc, Tcl_Obj *CONST objv[], int flags); #endif #ifndef NsfAddObjectMethod_TCL_DECLARED #define NsfAddObjectMethod_TCL_DECLARED -/* 26 */ +/* 22 */ EXTERN int NsfAddObjectMethod (Tcl_Interp * interp, struct Nsf_Object * obj, CONST char * nm, Tcl_ObjCmdProc * proc, ClientData cd, Tcl_CmdDeleteProc * dp, int flags); #endif #ifndef NsfAddClassMethod_TCL_DECLARED #define NsfAddClassMethod_TCL_DECLARED -/* 27 */ +/* 23 */ EXTERN int NsfAddClassMethod (Tcl_Interp * interp, struct Nsf_Class * cl, CONST char * nm, Tcl_ObjCmdProc * proc, ClientData cd, Tcl_CmdDeleteProc * dp, int flags); #endif #ifndef NsfCreate_TCL_DECLARED #define NsfCreate_TCL_DECLARED -/* 28 */ +/* 24 */ EXTERN int NsfCreate (Tcl_Interp * in, Nsf_Class * class, - Tcl_Obj * name, ClientData data, int objc, + Tcl_Obj * name, int objc, Tcl_Obj *CONST objv[]); #endif @@ -215,30 +189,26 @@ 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 */ - int (*nsfCreateObject) (Tcl_Interp * interp, Tcl_Obj * name, struct Nsf_Class * cl); /* 5 */ - int (*nsfDeleteObject) (Tcl_Interp * interp, struct Nsf_Object * obj); /* 6 */ - int (*nsfRemoveObjectMethod) (Tcl_Interp * interp, struct Nsf_Object * obj, CONST char * nm); /* 7 */ - int (*nsfRemoveClassMethod) (Tcl_Interp * interp, struct Nsf_Class * cl, CONST char * nm); /* 8 */ - Tcl_Obj * (*nsfOSetInstVar) (struct Nsf_Object * obj, Tcl_Interp * interp, Tcl_Obj * name, Tcl_Obj * value, int flgs); /* 9 */ - Tcl_Obj * (*nsfOGetInstVar) (struct Nsf_Object * obj, Tcl_Interp * interp, Tcl_Obj * name, int flgs); /* 10 */ - Tcl_Obj * (*nsf_ObjSetVar2) (struct Nsf_Object * obj, Tcl_Interp * interp, Tcl_Obj * name1, Tcl_Obj * name2, Tcl_Obj * value, int flgs); /* 11 */ - Tcl_Obj * (*nsf_ObjGetVar2) (struct Nsf_Object * obj, Tcl_Interp * interp, Tcl_Obj * name1, Tcl_Obj * name2, int flgs); /* 12 */ - int (*nsfUnsetInstVar2) (struct Nsf_Object * obj, Tcl_Interp * interp, CONST char * name1, CONST char * name2, int flgs); /* 13 */ - void (*nsfDStringPrintf) (Tcl_DString * dsPtr, CONST char * fmt, va_list apSrc); /* 14 */ - int (*nsfPrintError) (Tcl_Interp * interp, CONST char * fmt, ...); /* 15 */ - int (*nsfErrInProc) (Tcl_Interp * interp, Tcl_Obj * objName, Tcl_Obj * clName, CONST char * procName); /* 16 */ - int (*nsfObjErrType) (Tcl_Interp * interp, CONST char * context, Tcl_Obj * value, CONST char * type, Nsf_Param CONST * pPtr); /* 17 */ - void (*nsfStackDump) (Tcl_Interp * interp); /* 18 */ - void (*nsfSetObjClientData) (Nsf_Object * obj, ClientData data); /* 19 */ - ClientData (*nsfGetObjClientData) (Nsf_Object * obj); /* 20 */ - void (*nsfSetClassClientData) (Nsf_Class * cl, ClientData data); /* 21 */ - ClientData (*nsfGetClassClientData) (Nsf_Class * cl); /* 22 */ - void (*nsfRequireObjNamespace) (Tcl_Interp * interp, Nsf_Object * obj); /* 23 */ - int (*nsfNextObjCmd) (ClientData cd, Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[]); /* 24 */ - int (*nsfCallMethodWithArgs) (ClientData cd, Tcl_Interp * interp, Tcl_Obj * method, Tcl_Obj * arg, int objc, Tcl_Obj *CONST objv[], int flags); /* 25 */ - int (*nsfAddObjectMethod) (Tcl_Interp * interp, struct Nsf_Object * obj, CONST char * nm, Tcl_ObjCmdProc * proc, ClientData cd, Tcl_CmdDeleteProc * dp, int flags); /* 26 */ - int (*nsfAddClassMethod) (Tcl_Interp * interp, struct Nsf_Class * cl, CONST char * nm, Tcl_ObjCmdProc * proc, ClientData cd, Tcl_CmdDeleteProc * dp, int flags); /* 27 */ - int (*nsfCreate) (Tcl_Interp * in, Nsf_Class * class, Tcl_Obj * name, ClientData data, int objc, Tcl_Obj *CONST objv[]); /* 28 */ + int (*nsfDeleteObject) (Tcl_Interp * interp, struct Nsf_Object * obj); /* 5 */ + int (*nsfRemoveObjectMethod) (Tcl_Interp * interp, struct Nsf_Object * obj, CONST char * nm); /* 6 */ + int (*nsfRemoveClassMethod) (Tcl_Interp * interp, struct Nsf_Class * cl, CONST char * nm); /* 7 */ + Tcl_Obj * (*nsf_ObjSetVar2) (struct Nsf_Object * obj, Tcl_Interp * interp, Tcl_Obj * name1, Tcl_Obj * name2, Tcl_Obj * value, int flgs); /* 8 */ + Tcl_Obj * (*nsf_ObjGetVar2) (struct Nsf_Object * obj, Tcl_Interp * interp, Tcl_Obj * name1, Tcl_Obj * name2, int flgs); /* 9 */ + int (*nsf_UnsetVar2) (struct Nsf_Object * obj, Tcl_Interp * interp, CONST char * name1, CONST char * name2, int flgs); /* 10 */ + void (*nsfDStringPrintf) (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) (Nsf_Object * obj, ClientData data); /* 16 */ + ClientData (*nsfGetObjClientData) (Nsf_Object * obj); /* 17 */ + void (*nsfSetClassClientData) (Nsf_Class * cl, ClientData data); /* 18 */ + ClientData (*nsfGetClassClientData) (Nsf_Class * cl); /* 19 */ + void (*nsfRequireObjNamespace) (Tcl_Interp * interp, Nsf_Object * obj); /* 20 */ + int (*nsfCallMethodWithArgs) (ClientData cd, Tcl_Interp * interp, Tcl_Obj * method, Tcl_Obj * arg, int objc, Tcl_Obj *CONST objv[], int flags); /* 21 */ + int (*nsfAddObjectMethod) (Tcl_Interp * interp, struct Nsf_Object * obj, CONST char * nm, Tcl_ObjCmdProc * proc, ClientData cd, Tcl_CmdDeleteProc * dp, int flags); /* 22 */ + int (*nsfAddClassMethod) (Tcl_Interp * interp, struct Nsf_Class * cl, CONST char * nm, Tcl_ObjCmdProc * proc, ClientData cd, Tcl_CmdDeleteProc * dp, int flags); /* 23 */ + int (*nsfCreate) (Tcl_Interp * in, Nsf_Class * class, Tcl_Obj * name, int objc, Tcl_Obj *CONST objv[]); /* 24 */ } NsfStubs; #ifdef __cplusplus @@ -272,101 +242,85 @@ #define NsfGetClass \ (nsfStubsPtr->nsfGetClass) /* 4 */ #endif -#ifndef NsfCreateObject -#define NsfCreateObject \ - (nsfStubsPtr->nsfCreateObject) /* 5 */ -#endif #ifndef NsfDeleteObject #define NsfDeleteObject \ - (nsfStubsPtr->nsfDeleteObject) /* 6 */ + (nsfStubsPtr->nsfDeleteObject) /* 5 */ #endif #ifndef NsfRemoveObjectMethod #define NsfRemoveObjectMethod \ - (nsfStubsPtr->nsfRemoveObjectMethod) /* 7 */ + (nsfStubsPtr->nsfRemoveObjectMethod) /* 6 */ #endif #ifndef NsfRemoveClassMethod #define NsfRemoveClassMethod \ - (nsfStubsPtr->nsfRemoveClassMethod) /* 8 */ + (nsfStubsPtr->nsfRemoveClassMethod) /* 7 */ #endif -#ifndef NsfOSetInstVar -#define NsfOSetInstVar \ - (nsfStubsPtr->nsfOSetInstVar) /* 9 */ -#endif -#ifndef NsfOGetInstVar -#define NsfOGetInstVar \ - (nsfStubsPtr->nsfOGetInstVar) /* 10 */ -#endif #ifndef Nsf_ObjSetVar2 #define Nsf_ObjSetVar2 \ - (nsfStubsPtr->nsf_ObjSetVar2) /* 11 */ + (nsfStubsPtr->nsf_ObjSetVar2) /* 8 */ #endif #ifndef Nsf_ObjGetVar2 #define Nsf_ObjGetVar2 \ - (nsfStubsPtr->nsf_ObjGetVar2) /* 12 */ + (nsfStubsPtr->nsf_ObjGetVar2) /* 9 */ #endif -#ifndef NsfUnsetInstVar2 -#define NsfUnsetInstVar2 \ - (nsfStubsPtr->nsfUnsetInstVar2) /* 13 */ +#ifndef Nsf_UnsetVar2 +#define Nsf_UnsetVar2 \ + (nsfStubsPtr->nsf_UnsetVar2) /* 10 */ #endif #ifndef NsfDStringPrintf #define NsfDStringPrintf \ - (nsfStubsPtr->nsfDStringPrintf) /* 14 */ + (nsfStubsPtr->nsfDStringPrintf) /* 11 */ #endif #ifndef NsfPrintError #define NsfPrintError \ - (nsfStubsPtr->nsfPrintError) /* 15 */ + (nsfStubsPtr->nsfPrintError) /* 12 */ #endif #ifndef NsfErrInProc #define NsfErrInProc \ - (nsfStubsPtr->nsfErrInProc) /* 16 */ + (nsfStubsPtr->nsfErrInProc) /* 13 */ #endif #ifndef NsfObjErrType #define NsfObjErrType \ - (nsfStubsPtr->nsfObjErrType) /* 17 */ + (nsfStubsPtr->nsfObjErrType) /* 14 */ #endif #ifndef NsfStackDump #define NsfStackDump \ - (nsfStubsPtr->nsfStackDump) /* 18 */ + (nsfStubsPtr->nsfStackDump) /* 15 */ #endif #ifndef NsfSetObjClientData #define NsfSetObjClientData \ - (nsfStubsPtr->nsfSetObjClientData) /* 19 */ + (nsfStubsPtr->nsfSetObjClientData) /* 16 */ #endif #ifndef NsfGetObjClientData #define NsfGetObjClientData \ - (nsfStubsPtr->nsfGetObjClientData) /* 20 */ + (nsfStubsPtr->nsfGetObjClientData) /* 17 */ #endif #ifndef NsfSetClassClientData #define NsfSetClassClientData \ - (nsfStubsPtr->nsfSetClassClientData) /* 21 */ + (nsfStubsPtr->nsfSetClassClientData) /* 18 */ #endif #ifndef NsfGetClassClientData #define NsfGetClassClientData \ - (nsfStubsPtr->nsfGetClassClientData) /* 22 */ + (nsfStubsPtr->nsfGetClassClientData) /* 19 */ #endif #ifndef NsfRequireObjNamespace #define NsfRequireObjNamespace \ - (nsfStubsPtr->nsfRequireObjNamespace) /* 23 */ + (nsfStubsPtr->nsfRequireObjNamespace) /* 20 */ #endif -#ifndef NsfNextObjCmd -#define NsfNextObjCmd \ - (nsfStubsPtr->nsfNextObjCmd) /* 24 */ -#endif #ifndef NsfCallMethodWithArgs #define NsfCallMethodWithArgs \ - (nsfStubsPtr->nsfCallMethodWithArgs) /* 25 */ + (nsfStubsPtr->nsfCallMethodWithArgs) /* 21 */ #endif #ifndef NsfAddObjectMethod #define NsfAddObjectMethod \ - (nsfStubsPtr->nsfAddObjectMethod) /* 26 */ + (nsfStubsPtr->nsfAddObjectMethod) /* 22 */ #endif #ifndef NsfAddClassMethod #define NsfAddClassMethod \ - (nsfStubsPtr->nsfAddClassMethod) /* 27 */ + (nsfStubsPtr->nsfAddClassMethod) /* 23 */ #endif #ifndef NsfCreate #define NsfCreate \ - (nsfStubsPtr->nsfCreate) /* 28 */ + (nsfStubsPtr->nsfCreate) /* 24 */ #endif #endif /* defined(USE_NSF_STUBS) && !defined(USE_NSF_STUB_PROCS) */ Index: generic/nsfStack.c =================================================================== diff -u -rd49e60e74c36c563db5ba7095c2f898f1029169b -r9be296c7be8b0c04eaedd9f96c36d626aa7c2c97 --- generic/nsfStack.c (.../nsfStack.c) (revision d49e60e74c36c563db5ba7095c2f898f1029169b) +++ generic/nsfStack.c (.../nsfStack.c) (revision 9be296c7be8b0c04eaedd9f96c36d626aa7c2c97) @@ -1016,8 +1016,8 @@ Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp), *prevFramePtr = varFramePtr; - fprintf(stderr, "BeginOfCallChain obj %s\n", ObjectName(object)); if (object) { + fprintf(stderr, "BeginOfCallChain obj %s\n", ObjectName(object)); for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { register int flags = Tcl_CallFrame_isProcCallFrame(varFramePtr); Index: generic/nsfStubInit.c =================================================================== diff -u -r87c6a11296ada89c007cc2ed33df6887ac53c740 -r9be296c7be8b0c04eaedd9f96c36d626aa7c2c97 --- generic/nsfStubInit.c (.../nsfStubInit.c) (revision 87c6a11296ada89c007cc2ed33df6887ac53c740) +++ generic/nsfStubInit.c (.../nsfStubInit.c) (revision 9be296c7be8b0c04eaedd9f96c36d626aa7c2c97) @@ -41,30 +41,26 @@ NsfIsClass, /* 2 */ NsfGetObject, /* 3 */ NsfGetClass, /* 4 */ - NsfCreateObject, /* 5 */ - NsfDeleteObject, /* 6 */ - NsfRemoveObjectMethod, /* 7 */ - NsfRemoveClassMethod, /* 8 */ - NsfOSetInstVar, /* 9 */ - NsfOGetInstVar, /* 10 */ - Nsf_ObjSetVar2, /* 11 */ - Nsf_ObjGetVar2, /* 12 */ - NsfUnsetInstVar2, /* 13 */ - NsfDStringPrintf, /* 14 */ - NsfPrintError, /* 15 */ - NsfErrInProc, /* 16 */ - NsfObjErrType, /* 17 */ - NsfStackDump, /* 18 */ - NsfSetObjClientData, /* 19 */ - NsfGetObjClientData, /* 20 */ - NsfSetClassClientData, /* 21 */ - NsfGetClassClientData, /* 22 */ - NsfRequireObjNamespace, /* 23 */ - NsfNextObjCmd, /* 24 */ - NsfCallMethodWithArgs, /* 25 */ - NsfAddObjectMethod, /* 26 */ - NsfAddClassMethod, /* 27 */ - NsfCreate, /* 28 */ + NsfDeleteObject, /* 5 */ + NsfRemoveObjectMethod, /* 6 */ + NsfRemoveClassMethod, /* 7 */ + Nsf_ObjSetVar2, /* 8 */ + Nsf_ObjGetVar2, /* 9 */ + Nsf_UnsetVar2, /* 10 */ + NsfDStringPrintf, /* 11 */ + NsfPrintError, /* 12 */ + NsfErrInProc, /* 13 */ + NsfObjErrType, /* 14 */ + NsfStackDump, /* 15 */ + NsfSetObjClientData, /* 16 */ + NsfGetObjClientData, /* 17 */ + NsfSetClassClientData, /* 18 */ + NsfGetClassClientData, /* 19 */ + NsfRequireObjNamespace, /* 20 */ + NsfCallMethodWithArgs, /* 21 */ + NsfAddObjectMethod, /* 22 */ + NsfAddClassMethod, /* 23 */ + NsfCreate, /* 24 */ }; /* !END!: Do not edit above this line. */ Index: library/xotcl/library/store/XOTclSdbm/sdbm.c =================================================================== diff -u -rf3b7952aabc9e4f9079febd1f5b7f5fb833fd50c -r9be296c7be8b0c04eaedd9f96c36d626aa7c2c97 --- library/xotcl/library/store/XOTclSdbm/sdbm.c (.../sdbm.c) (revision f3b7952aabc9e4f9079febd1f5b7f5fb833fd50c) +++ library/xotcl/library/store/XOTclSdbm/sdbm.c (.../sdbm.c) (revision 9be296c7be8b0c04eaedd9f96c36d626aa7c2c97) @@ -114,7 +114,8 @@ /* * build the file names */ - dirname = strcat(strcpy(dirname, file), DIRFEXT); + strcpy(dirname, file); + dirname = strcat(dirname, DIRFEXT); pagname = strcpy(dirname + strlen(dirname) + 1, file); pagname = strcat(pagname, PAGFEXT); Index: library/xotcl/library/xml/TclExpat-1.1/readfilemap.c =================================================================== diff -u -rf3b7952aabc9e4f9079febd1f5b7f5fb833fd50c -r9be296c7be8b0c04eaedd9f96c36d626aa7c2c97 --- library/xotcl/library/xml/TclExpat-1.1/readfilemap.c (.../readfilemap.c) (revision f3b7952aabc9e4f9079febd1f5b7f5fb833fd50c) +++ library/xotcl/library/xml/TclExpat-1.1/readfilemap.c (.../readfilemap.c) (revision 9be296c7be8b0c04eaedd9f96c36d626aa7c2c97) @@ -59,27 +59,32 @@ } if (fstat(fd, &sb) < 0) { perror(name); + close(fd); return 0; } if (!S_ISREG(sb.st_mode)) { fprintf(stderr, "%s: not a regular file\n", name); + close(fd); return 0; } nbytes = sb.st_size; p = malloc(nbytes); if (!p) { fprintf(stderr, "%s: out of memory\n", name); + close(fd); return 0; } n = read(fd, p, nbytes); if (n < 0) { perror(name); close(fd); + free(p); return 0; } if (n != nbytes) { fprintf(stderr, "%s: read unexpected number of bytes\n", name); close(fd); + free(p); return 0; } processor(p, nbytes, name, arg); Index: library/xotcl/library/xml/TclExpat-1.1/xmlparse.c =================================================================== diff -u -rf3b7952aabc9e4f9079febd1f5b7f5fb833fd50c -r9be296c7be8b0c04eaedd9f96c36d626aa7c2c97 --- library/xotcl/library/xml/TclExpat-1.1/xmlparse.c (.../xmlparse.c) (revision f3b7952aabc9e4f9079febd1f5b7f5fb833fd50c) +++ library/xotcl/library/xml/TclExpat-1.1/xmlparse.c (.../xmlparse.c) (revision 9be296c7be8b0c04eaedd9f96c36d626aa7c2c97) @@ -799,7 +799,7 @@ const char **nextPtr) { const ENCODING *internalEnc = XmlGetInternalEncoding(); - const char *dummy; + const char *dummy = NULL; /* make cppcheck happy */ const char **eventPP; const char **eventEndPP; if (enc == encoding) { @@ -1081,6 +1081,7 @@ return XML_ERROR_BAD_CHAR_REF; if (characterDataHandler) { XML_Char buf[XML_ENCODE_MAX]; + buf[0] = '\0'; characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf)); } else if (defaultHandler) @@ -1295,7 +1296,7 @@ const char **nextPtr) { const char *s = *startPtr; - const char *dummy; + const char *dummy = NULL; /* make cppcheck happy */ const char **eventPP; const char **eventEndPP; if (enc == encoding) {