Index: TODO =================================================================== diff -u -r7b09de6f9ec1cc5caf39751fa4f23c62365e8dfe -reac3a4e34906b1fd7a5b53c331a4368a2cc85ec6 --- TODO (.../TODO) (revision 7b09de6f9ec1cc5caf39751fa4f23c62365e8dfe) +++ TODO (.../TODO) (revision eac3a4e34906b1fd7a5b53c331a4368a2cc85ec6) @@ -3241,6 +3241,7 @@ - fixed book-keeping for TclNamespace refcounting such that now alias.test, destroy.test and test.xotcl run now clean, 2 test are still open with tcl 8.5.10 (contains.test and xotcomm.test) +- documented functions in nsfTrace.c TODO: Index: generic/nsfTrace.c =================================================================== diff -u -rffd5b8ff74134cc891b9715cf1dd949193065b61 -reac3a4e34906b1fd7a5b53c331a4368a2cc85ec6 --- generic/nsfTrace.c (.../nsfTrace.c) (revision ffd5b8ff74134cc891b9715cf1dd949193065b61) +++ generic/nsfTrace.c (.../nsfTrace.c) (revision eac3a4e34906b1fd7a5b53c331a4368a2cc85ec6) @@ -1,19 +1,36 @@ /* -*- Mode: c++ -*- * - * Extended Object Tcl (XOTcl) + * Next Scripting Framework * * Copyright (C) 1999-2010 Gustaf Neumann, Uwe Zdun * * * nsfTrace.c -- * - * Tracing facilities for XOTcl + * Tracing facilities for the Next Scripting Framework * */ #include "nsfInt.h" #include "nsfAccessInt.h" +/* + *---------------------------------------------------------------------- + * NsfStackDump -- + * + * Write the current callstack with various debugging infos to stderr. This + * function is primarily for debugging proposes of the C implmenentation of + * nsf. + * + * Results: + * None. + * + * Side effects: + * Debugging output + * + *---------------------------------------------------------------------- + */ + void NsfStackDump(Tcl_Interp *interp) { Interp *iPtr = (Interp *)interp; @@ -59,6 +76,22 @@ DECR_REF_COUNT(varCmdObj); } +/* + *---------------------------------------------------------------------- + * NsfStackDump -- + * + * Print the provided argument vector to stderr. This function is primarily + * for debugging proposes of the C implmenentation of nsf. + * + * Results: + * None. + * + * Side effects: + * Debugging output + * + *---------------------------------------------------------------------- + */ + void NsfPrintObjv(char *string, int objc, Tcl_Obj *CONST objv[]) { int j; @@ -71,15 +104,27 @@ } #ifdef NSF_MEM_COUNT -Tcl_HashTable nsfMemCount; - - +/* + *---------------------------------------------------------------------- + * NsfMemCountAlloc -- + * + * Bookkeeping function for memory und refcount debugging. This function + * records the allocation of memory resources. The accompanying function is + * NsfMemCountFree(). + * + * Results: + * None. + * + * Side effects: + * Updateing Hash table + * + *---------------------------------------------------------------------- + */ void NsfMemCountAlloc(Tcl_Interp *interp, char *id, void *p) { int new; NsfMemCounter *entry; Tcl_HashTable *tablePtr = &RUNTIME_STATE(interp)->memCountTable; - //Tcl_HashTable *tablePtr = &nsfMemCount; Tcl_HashEntry *hPtr; assert(interp); @@ -102,10 +147,26 @@ } } +/* + *---------------------------------------------------------------------- + * NsfMemCountFree -- + * + * Bookkeeping function for memory und refcount debugging. This function + * records the deallocation of memory resources. The accompanying function + * is NsfMemCountAlloc(). + * + * Results: + * None. + * + * Side effects: + * Updateing Hash table + * + *---------------------------------------------------------------------- + */ + void NsfMemCountFree(Tcl_Interp *interp, char *id, void *p) { NsfMemCounter *entry; - //Tcl_HashTable *tablePtr = &nsfMemCount; Tcl_HashTable *tablePtr = &RUNTIME_STATE(interp)->memCountTable; Tcl_HashEntry *hPtr; #ifdef NSF_MEM_TRACE @@ -123,17 +184,45 @@ entry->count--; } +/* + *---------------------------------------------------------------------- + * NsfMemCountInit -- + * + * Initialize book-keeping for memory und refcount debugging. The + * bookkeeping is realized via a per-interp hash table. + * + * Results: + * None. + * + * Side effects: + * Initializes a hash table + * + *---------------------------------------------------------------------- + */ void NsfMemCountInit(Tcl_Interp *interp) { Tcl_HashTable *tablePtr = &RUNTIME_STATE(interp)->memCountTable; Tcl_InitHashTable(tablePtr, TCL_STRING_KEYS); -#if 0 - extern Tcl_HashTable nsfMemCount; - Tcl_InitHashTable(&nsfMemCount, TCL_STRING_KEYS); -#endif } +/* + *---------------------------------------------------------------------- + * NsfMemCountRelease -- + * + * Terminate book-keeping for memory und refcount debugging. This function + * prints the resulting book-information to stderr, in case of paired + * allocs/frees and incr-ref-counts and dec-ref-counts, the Overall count + * should be 0. + * + * Results: + * None. + * + * Side effects: + * Deletes the book-keeping hash table, outputs to stderr + * + *---------------------------------------------------------------------- + */ void NsfMemCountRelease(Tcl_Interp *interp) { Tcl_HashTable *tablePtr = &RUNTIME_STATE(interp)->memCountTable;