Example #1
0
static void FreeStyle(Style *stylePtr)
{
    Tcl_HashSearch search;
    Tcl_HashEntry *entryPtr;

    entryPtr = Tcl_FirstHashEntry(&stylePtr->settingsTable, &search);
    while (entryPtr != NULL) {
	Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr);
	Tcl_DecrRefCount(stateMap);
	entryPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&stylePtr->settingsTable);

    entryPtr = Tcl_FirstHashEntry(&stylePtr->defaultsTable, &search);
    while (entryPtr != NULL) {
	Tcl_Obj *defaultValue = (Ttk_StateMap)Tcl_GetHashValue(entryPtr);
	Tcl_DecrRefCount(defaultValue);
	entryPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&stylePtr->defaultsTable);

    Ttk_FreeLayoutTemplate(stylePtr->layoutTemplate);

    ckfree((char*)stylePtr);
}
Example #2
0
static void FreeTheme(Theme *themePtr)
{
    Tcl_HashSearch search;
    Tcl_HashEntry *entryPtr;

    /*
     * Free associated ElementImpl's
     */
    entryPtr = Tcl_FirstHashEntry(&themePtr->elementTable, &search);
    while (entryPtr != NULL) {
	ElementImpl *elementImpl = (ElementImpl *)Tcl_GetHashValue(entryPtr);
	FreeElementImpl(elementImpl);
	entryPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&themePtr->elementTable);

    /*
     * Free style table:
     */
    entryPtr = Tcl_FirstHashEntry(&themePtr->styleTable, &search);
    while (entryPtr != NULL) {
	Style *stylePtr = (Style*)Tcl_GetHashValue(entryPtr);
	FreeStyle(stylePtr);
	entryPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&themePtr->styleTable);

    /*
     * Free theme record:
     */
    ckfree((char *)themePtr);

    return;
}
Example #3
0
static void
BumpCmdRefEpochs(
    Namespace *nsPtr)		/* Namespace being modified. */
{
    Tcl_HashEntry *entry;
    Tcl_HashSearch search;

    nsPtr->cmdRefEpoch++;

#ifndef BREAK_NAMESPACE_COMPAT
    for (entry = Tcl_FirstHashEntry(&nsPtr->childTable, &search);
	    entry != NULL; entry = Tcl_NextHashEntry(&search)) {
	Namespace *childNsPtr = Tcl_GetHashValue(entry);

	BumpCmdRefEpochs(childNsPtr);
    }
#else
    if (nsPtr->childTablePtr != NULL) {
	for (entry = Tcl_FirstHashEntry(nsPtr->childTablePtr, &search);
		entry != NULL; entry = Tcl_NextHashEntry(&search)) {
	    Namespace *childNsPtr = Tcl_GetHashValue(entry);

	    BumpCmdRefEpochs(childNsPtr);
	}
    }
#endif
    TclInvalidateNsPath(nsPtr);
}
Example #4
0
static void FreeTheme(Theme *themePtr)
{
    Tcl_HashSearch search;
    Tcl_HashEntry *entryPtr;

    /*
     * Free element table:
     */
    entryPtr = Tcl_FirstHashEntry(&themePtr->elementTable, &search);
    while (entryPtr != NULL) {
	Ttk_ElementClass *elementClass = Tcl_GetHashValue(entryPtr);
	FreeElementClass(elementClass);
	entryPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&themePtr->elementTable);

    /*
     * Free style table:
     */
    entryPtr = Tcl_FirstHashEntry(&themePtr->styleTable, &search);
    while (entryPtr != NULL) {
	Style *stylePtr = Tcl_GetHashValue(entryPtr);
	FreeStyle(stylePtr);
	entryPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&themePtr->styleTable);

    /*
     * Free theme record:
     */
    ckfree(themePtr);

    return;
}
Example #5
0
/**
 * Detaches a registry database from the registry object. This does some cleanup
 * for an attached registry, then detaches it. Allocated `reg_entry` objects are
 * deleted here.
 *
 * @param [in] reg     registry to detach from
 * @param [out] errPtr on error, a description of the error that occurred
 * @return             true if success; false if failure
 */
int reg_detach(reg_registry* reg, reg_error* errPtr) {
    sqlite3_stmt* stmt = NULL;
    int result = 0;
    char* query = "DETACH DATABASE registry";
    if (!(reg->status & reg_attached)) {
        reg_throw(errPtr,REG_MISUSE,"no database is attached to this registry");
        return 0;
    }
    if (sqlite3_prepare_v2(reg->db, query, -1, &stmt, NULL) == SQLITE_OK) {
        int r;
        reg_entry* entry;
        Tcl_HashEntry* curr;
        Tcl_HashSearch search;
        /* XXX: Busy waiting, consider using sqlite3_busy_handler/timeout */
        do {
            sqlite3_step(stmt);
            r = sqlite3_reset(stmt);
            switch (r) {
                case SQLITE_OK:
                    for (curr = Tcl_FirstHashEntry(&reg->open_entries, &search);
                            curr != NULL; curr = Tcl_NextHashEntry(&search)) {
                        entry = Tcl_GetHashValue(curr);
                        if (entry->proc) {
                            free(entry->proc);
                        }
                        free(entry);
                    }
                    Tcl_DeleteHashTable(&reg->open_entries);
                    for (curr = Tcl_FirstHashEntry(&reg->open_files, &search);
                            curr != NULL; curr = Tcl_NextHashEntry(&search)) {
                        reg_file* file = Tcl_GetHashValue(curr);

                        free(file->proc);
                        free(file->key.path);
                        free(file);
                    }
                    Tcl_DeleteHashTable(&reg->open_files);
                    reg->status &= ~reg_attached;
                    result = 1;
                    break;
                case SQLITE_BUSY:
                    break;
                default:
                    reg_sqlite_error(reg->db, errPtr, query);
                    break;
            }
        } while (r == SQLITE_BUSY);
    } else {
        reg_sqlite_error(reg->db, errPtr, query);
    }
    if (stmt) {
        sqlite3_finalize(stmt);
    }
    return result;
}
Example #6
0
/* Ttk_StylePkgFree --
 *	Cleanup procedure for StylePackageData.
 */
static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp)
{
    StylePackageData *pkgPtr = (StylePackageData *)clientData;
    Tcl_HashSearch search;
    Tcl_HashEntry *entryPtr;
    Theme *themePtr;
    Cleanup *cleanup;

    /*
     * Cancel any pending ThemeChanged calls:
     */
    if (pkgPtr->themeChangePending) {
	Tcl_CancelIdleCall(ThemeChangedProc, pkgPtr);
    }

    /*
     * Free themes.
     */
    entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search);
    while (entryPtr != NULL) {
	themePtr = (Theme *) Tcl_GetHashValue(entryPtr);
	FreeTheme(themePtr);
	entryPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&pkgPtr->themeTable);

    /*
     * Free element constructor table:
     */
    entryPtr = Tcl_FirstHashEntry(&pkgPtr->factoryTable, &search);
    while (entryPtr != NULL) {
	ckfree(Tcl_GetHashValue(entryPtr));
	entryPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&pkgPtr->factoryTable);

    /*
     * Release cache:
     */
    Ttk_FreeResourceCache(pkgPtr->cache);

    /*
     * Call all registered cleanup procedures:
     */
    cleanup = pkgPtr->cleanupList;
    while (cleanup) {
	Cleanup *next = cleanup->next;
	cleanup->cleanupProc(cleanup->clientData);
	ckfree((ClientData)cleanup);
	cleanup = next;
    }

    ckfree((char*)pkgPtr);
}
Example #7
0
void
TkStylePkgFree(
    TkMainInfo *mainPtr)	/* The application being deleted. */
{
    ThreadSpecificData *tsdPtr =
	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
    Tcl_HashSearch search;
    Tcl_HashEntry *entryPtr;
    StyleEngine *enginePtr;
    int i;

    tsdPtr->nbInit--;
    if (tsdPtr->nbInit != 0) {
	return;
    }

    /*
     * Free styles.
     */

    entryPtr = Tcl_FirstHashEntry(&tsdPtr->styleTable, &search);
    while (entryPtr != NULL) {
	ckfree(Tcl_GetHashValue(entryPtr));
	entryPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&tsdPtr->styleTable);

    /*
     * Free engines.
     */

    entryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search);
    while (entryPtr != NULL) {
	enginePtr = Tcl_GetHashValue(entryPtr);
	FreeStyleEngine(enginePtr);
	ckfree(enginePtr);
	entryPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&tsdPtr->engineTable);

    /*
     * Free elements.
     */

    for (i = 0; i < tsdPtr->nbElements; i++) {
	FreeElement(tsdPtr->elements+i);
    }
    Tcl_DeleteHashTable(&tsdPtr->elementTable);
    ckfree(tsdPtr->elements);
}
Example #8
0
void
TkGCCleanup(
    TkDisplay *dispPtr)		/* display to clean up resources in */
{
    Tcl_HashEntry *entryPtr;
    Tcl_HashSearch search;
    TkGC *gcPtr;

    for (entryPtr = Tcl_FirstHashEntry(&dispPtr->gcIdTable, &search);
	    entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) {
	gcPtr = Tcl_GetHashValue(entryPtr);

	/*
	 * This call is not needed, as it is only used on Unix to restore the
	 * Id to the stack pool, and we don't want to use them anymore.
	 *   Tk_FreeXId(gcPtr->display, (XID) XGContextFromGC(gcPtr->gc));
	 */

	XFreeGC(gcPtr->display, gcPtr->gc);
	Tcl_DeleteHashEntry(gcPtr->valueHashPtr);
	Tcl_DeleteHashEntry(entryPtr);
	ckfree(gcPtr);
    }
    Tcl_DeleteHashTable(&dispPtr->gcValueTable);
    Tcl_DeleteHashTable(&dispPtr->gcIdTable);
    dispPtr->gcInit = -1;
}
Example #9
0
/*
 * FreeElementImpl --
 * 	Release resources associated with an element implementation record.
 */
static void FreeElementImpl(ElementImpl *elementImpl)
{
    Tcl_HashSearch search;
    Tcl_HashEntry *entryPtr;
    int i;

    /*
     * Free default values:
     */
    for (i = 0; i < elementImpl->nResources; ++i) {
	if (elementImpl->defaultValues[i]) {
	    Tcl_DecrRefCount(elementImpl->defaultValues[i]);
	}
    }
    ckfree((ClientData)elementImpl->defaultValues);

    /*
     * Free option map cache:
     */
    entryPtr = Tcl_FirstHashEntry(&elementImpl->optMapCache, &search);
    while (entryPtr != NULL) {
	ckfree(Tcl_GetHashValue(entryPtr));
	entryPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&elementImpl->optMapCache);

    ckfree(elementImpl->elementRecord);
    ckfree((ClientData)elementImpl);
}
Example #10
0
////////////////////////////////////////////////////
// cleanup any leftover registration
////////////////////////////////////////////////////
static int bonjour_register_cleanup(
   ClientData clientData
) {
   Tcl_HashTable *registerRegistrations = 
      (Tcl_HashTable *)clientData;
   Tcl_HashEntry *hashEntry = NULL;
   Tcl_HashSearch searchToken;
   active_registration *activeRegister = NULL;

   // run through the remaining entries in the hash table
   for(hashEntry = Tcl_FirstHashEntry(registerRegistrations,
                                      &searchToken);
       hashEntry != NULL;
       hashEntry = Tcl_NextHashEntry(&searchToken)) {

      activeRegister = (active_registration *)Tcl_GetHashValue(hashEntry);

      // deallocate the service reference
      DNSServiceRefDeallocate(activeRegister->sdRef);

      // clean up the memory used by activeRegister
      ckfree(activeRegister->regtype);
      ckfree((void *)activeRegister);

      // deallocate the hash entry
      Tcl_DeleteHashEntry(hashEntry);
   }

   Tcl_DeleteHashTable(registerRegistrations);

   return(TCL_OK);
}
Example #11
0
static int StyleThemeCurrentCmd(
    ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[])
{
    StylePackageData *pkgPtr = clientData;
    Tcl_HashSearch search;
    Tcl_HashEntry *entryPtr = NULL;
    const char *name = NULL;

    if (objc != 3) {
	Tcl_WrongNumArgs(interp, 3, objv, "");
	return TCL_ERROR;
    }

    entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search);
    while (entryPtr != NULL) {
	Theme *ptr = Tcl_GetHashValue(entryPtr);
	if (ptr == pkgPtr->currentTheme) {
	    name = Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr);
	    break;
	}
	entryPtr = Tcl_NextHashEntry(&search);
    }

    if (name == NULL) {
	Tcl_SetObjResult(interp, Tcl_NewStringObj(
		"error: failed to get theme name", -1));
	Tcl_SetErrorCode(interp, "TTK", "THEME", "NAMELESS", NULL);
	return TCL_ERROR;
    }

    Tcl_SetObjResult(interp, Tcl_NewStringObj(name, -1));
    return TCL_OK;
}
Example #12
0
void
Nsf_PointerExit(Tcl_Interp *interp) {

  nonnull_assert(interp != NULL);

  NsfMutexLock(&pointerMutex);
  if (--pointerTableRefCount == 0) {

    if (RUNTIME_STATE(interp)->logSeverity == NSF_LOG_DEBUG) {
      Tcl_HashSearch hSrch;
      const Tcl_HashEntry *hPtr;

      for (hPtr = Tcl_FirstHashEntry(pointerHashTablePtr, &hSrch);
           hPtr != NULL;
	   hPtr = Tcl_NextHashEntry(&hSrch)) {
	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
	 * already deleted.
	 */

	fprintf(stderr, "Nsf_PointerExit: we have still an entry %s with value %p\n", key, valuePtr);
      }
    }

    Tcl_DeleteHashTable(pointerHashTablePtr);
  }
  /*fprintf(stderr, "Nsf_PointerExit pointerTableRefCount == %d\n", pointerTableRefCount);*/

  NsfMutexUnlock(&pointerMutex);
}
Example #13
0
int DBus_SignalCleanup(Tcl_Interp *interp, Tcl_HashTable *members)
{
   Tcl_HashTable *interps;
   Tcl_HashEntry *memberPtr, *interpPtr;
   Tcl_HashSearch search;
   Tcl_DBusSignalData *signal;

   for (memberPtr = Tcl_FirstHashEntry(members, &search);
	memberPtr != NULL; memberPtr = Tcl_NextHashEntry(&search)) {
      interps = Tcl_GetHashValue(memberPtr);
      interpPtr = Tcl_FindHashEntry(interps, (char *) interp);
      if (interpPtr != NULL) {
	 signal = Tcl_GetHashValue(interpPtr);
	 Tcl_DecrRefCount(signal->script);
	 ckfree((char *) signal);
	 Tcl_DeleteHashEntry(interpPtr);
	 if (Tcl_CheckHashEmpty(interps)) {
	    Tcl_DeleteHashTable(interps);
	    ckfree((char *) interps);
	    Tcl_DeleteHashEntry(memberPtr);
	 }
      }
   }
   return Tcl_CheckHashEmpty(members);
}
Example #14
0
void
XOTclProfilePrintTable(Tcl_HashTable* table) {
  Tcl_HashEntry* topValueHPtr;
  long int* topValue;

  do {
    Tcl_HashSearch hSrch;
    Tcl_HashEntry* hPtr = table ?
      Tcl_FirstHashEntry(table, &hSrch) : 0;
    char* topKey = 0;

    topValueHPtr = 0;
    topValue = 0;

    for (; hPtr != 0; hPtr = Tcl_NextHashEntry(&hSrch)) {
      long int *val = (long int*) Tcl_GetHashValue(hPtr);
      if (val && (!topValue || (topValue && *val >= *topValue))) {
	topValue = val;
	topValueHPtr = hPtr;
	topKey =  Tcl_GetHashKey(table, hPtr);
      }
    }

    if (topValueHPtr) {
      fprintf(stderr, "  %15ld   %s\n", *topValue, topKey);
      ckfree((char*) topValue);
      Tcl_DeleteHashEntry(topValueHPtr);
    }
  } while (topValueHPtr);
}
Example #15
0
TNPtr
tn_dup (TPtr dst, TNPtr src)
{
    TNPtr dstn;

    dstn = tn_new (dst, Tcl_GetString (src->name));

    if (src->attr) {
	int i, new;
	Tcl_HashSearch hs;
	Tcl_HashEntry* he;
	Tcl_HashEntry* dhe;
	CONST char*    key;
	Tcl_Obj*       val;

	dstn->attr = ALLOC (Tcl_HashTable);
	Tcl_InitHashTable(dstn->attr, TCL_STRING_KEYS);

	for(i = 0, he = Tcl_FirstHashEntry(src->attr, &hs);
	    he != NULL;
	    he = Tcl_NextHashEntry(&hs), i++) {

	    key = Tcl_GetHashKey (src->attr, he);
	    val = (Tcl_Obj*) Tcl_GetHashValue(he);

	    dhe = Tcl_CreateHashEntry(dstn->attr, key, &new);

	    Tcl_IncrRefCount (val);
	    Tcl_SetHashValue (dhe, (ClientData) val);
	}
    }
void Merge_RR_Hashes(member* prev_member, member *new_member)
{
  Tcl_HashTable *prev_table = &prev_member->RR_Hash;
  Tcl_HashTable *new_table = &new_member->RR_Hash;
  Tcl_HashEntry *prev_entry, *new_entry;
  Tcl_HashSearch the_search;
  receiver_report *prev_info, *new_info;
  int created;

  new_entry = Tcl_FirstHashEntry(new_table, &the_search);
  while (new_entry != NULL) {
    prev_entry = Tcl_CreateHashEntry(prev_table,
				     Tcl_GetHashKey(new_table, new_entry),
				     &created);
    if (created) {
      prev_info = (receiver_report *) malloc(sizeof(receiver_report));
      Tcl_SetHashValue(prev_entry, (ClientData) prev_info);
      new_info = (receiver_report *) Tcl_GetHashValue(new_entry);
      memcpy(prev_info, new_info, sizeof(receiver_report));
    } else {
      prev_info = (receiver_report *) Tcl_GetHashValue(prev_entry);
      new_info = (receiver_report *) Tcl_GetHashValue(new_entry);
      Merge_RRs(prev_info, new_info);
    }

    new_entry = Tcl_NextHashEntry(&the_search);
  }

  return;
}
Example #17
0
void 
HtmlImageServerDoGC (HtmlTree *pTree)
{
    if (pTree->pImageServer->isSuspendGC) {
        int nDelete;
        pTree->pImageServer->isSuspendGC = 0;
        do {
            int ii;
            HtmlImage2 *apDelete[32];
            Tcl_HashSearch srch;
            Tcl_HashEntry *pEntry;

            nDelete = 0;
            pEntry = Tcl_FirstHashEntry(&pTree->pImageServer->aImage, &srch);
            for ( ; nDelete < 32 && pEntry; pEntry = Tcl_NextHashEntry(&srch)) {
                HtmlImage2 *p = Tcl_GetHashValue(pEntry);
                if (p->nRef == 0) {
                    apDelete[nDelete++] = p;
                }
            }

            for (ii = 0; ii < nDelete; ii++) {
                HtmlImage2 *p = apDelete[ii];
                p->nRef = 1;
                HtmlImageFree(p);
            }
        } while (nDelete == 32);
    }
}
Example #18
0
Tcl_HashEntry *
Tcl_FirstHashEntry(
    Tcl_HashTable *tablePtr,	/* Table to search. */
    Tcl_HashSearch *searchPtr)	/* Place to store information about progress
				 * through the table. */
{
    searchPtr->tablePtr = tablePtr;
    searchPtr->nextIndex = 0;
    searchPtr->nextEntryPtr = NULL;
    return Tcl_NextHashEntry(searchPtr);
}
Example #19
0
void
TclFinalizeThreadStorage(void)
{
    Tcl_HashSearch search;	/* We need to hit every thread with this
				 * search. */
    Tcl_HashEntry *hPtr;	/* Hash entry for current thread in master
				 * table. */
    Tcl_MutexLock(&threadStorageLock);

    /*
     * We are going to delete the hash table for every thread now. This hash
     * table should be empty at this point, except for one entry for the
     * current thread.
     */

    for (hPtr = Tcl_FirstHashEntry(&threadStorageHashTable, &search);
	    hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
	Tcl_HashTable *hashTablePtr = Tcl_GetHashValue(hPtr);

	if (hashTablePtr != NULL) {
	    /*
	     * Delete thread specific hash table for the thread in question
	     * and free the struct.
	     */

	    Tcl_DeleteHashTable(hashTablePtr);
	    TclpSysFree((char *)hashTablePtr);
	}

	/*
	 * Delete thread specific entry from master hash table.
	 */

	Tcl_SetHashValue(hPtr, NULL);
    }

    Tcl_DeleteHashTable(&threadStorageHashTable);

    /*
     * Clear out the thread storage cache as well.
     */

    memset((void*) &threadStorageCache, 0,
	    sizeof(ThreadStorage) * STORAGE_CACHE_SLOTS);

    /*
     * Reset this to zero, it will be set to STORAGE_FIRST_KEY if the thread
     * storage subsystem gets reinitialized
     */

    nextThreadStorageKey = STORAGE_INVALID_KEY;

    Tcl_MutexUnlock(&threadStorageLock);
}
Example #20
0
static void MarkAllCartsInactive(void)
{
    Tcl_HashSearch search;
    Tcl_HashEntry *cartEntry;
    CartObj *cart;
    cartEntry = Tcl_FirstHashEntry(cartTablePtr, &search);
    for(cartEntry = Tcl_FirstHashEntry(cartTablePtr, &search);
            cartEntry != NULL; cartEntry = Tcl_NextHashEntry(&search)) {
        cart = Tcl_GetHashValue(cartEntry);
        cart->inactive = TRUE;
    }
}
Example #21
0
void
TnmAttrClear(Tcl_HashTable *tablePtr)
{
    Tcl_HashEntry *entryPtr;
    Tcl_HashSearch search;

    entryPtr = Tcl_FirstHashEntry(tablePtr, &search);
    while (entryPtr != NULL) {
        ckfree((char *) Tcl_GetHashValue(entryPtr));
        entryPtr = Tcl_NextHashEntry(&search);
    }
}
Example #22
0
static void
PkguaFreeTokensHashTable(void)
{
    Tcl_HashSearch search;
    Tcl_HashEntry *entryPtr;

    for (entryPtr = Tcl_FirstHashEntry(&interpTokenMap, &search);
	    entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) {
	Tcl_Free((char *) Tcl_GetHashValue(entryPtr));
    }
    interpTokenMapInitialised = 0;
}
Example #23
0
HandleNameToRepMap::~HandleNameToRepMap ()
{
    // Clean up any left over objects.
    Tcl_HashSearch search;
    Tcl_HashEntry *pEntry = Tcl_FirstHashEntry(&m_handleMap, &search);
    while (pEntry != 0) {
        Tcl_HashEntry *pNext = Tcl_NextHashEntry(&search);
        delete static_cast<InternalRep *>(Tcl_GetHashValue(pEntry));
        pEntry = pNext;
    }

    Tcl_DeleteHashTable(&m_handleMap);
}
Example #24
0
ClientData
NextSigMapEntry (
    SignalMapSearch *searchPtr)
{
    Tcl_HashEntry *entryPtr;

    entryPtr = Tcl_NextHashEntry(searchPtr);
    if (entryPtr != NULL) {
        return Tcl_GetHashValue(entryPtr);
    } else {
        return NULL;
    }
}
Example #25
0
/*
 *---------------------------------------------------------------------------
 *
 * HtmlImageServerCount --
 *
 *     Return the number of images currently stored in the image-server.
 *     Only images returned by the -imagecmd script are counted, not 
 *     scaled or tiled copies thereof.
 *
 * Results:
 *     Number of images.
 *
 * Side effects:
 *     None.
 *
 *---------------------------------------------------------------------------
 */
int 
HtmlImageServerCount (HtmlTree *pTree)
{
    int nImage = 0;
    Tcl_HashSearch srch;
    Tcl_HashEntry *pEntry;

    pEntry = Tcl_FirstHashEntry(&pTree->pImageServer->aImage, &srch);
    for ( ; pEntry; pEntry = Tcl_NextHashEntry(&srch)) {
        nImage++;
    }
   
    return nImage;
}
Example #26
0
static Tcl_HashEntry * 
ts_lua_hash_table_iterator_next(Tcl_HashTable *ht_ptr, Tcl_HashSearch * state_ptr)
{
    Tcl_HashSearch *tcl_search_state_ptr;
    Tcl_HashEntry *tcl_he_ptr;
    Tcl_HashEntry *he_ptr;

    tcl_search_state_ptr = (Tcl_HashSearch *) state_ptr;

    tcl_he_ptr = Tcl_NextHashEntry(tcl_search_state_ptr);
    he_ptr = (Tcl_HashEntry*) tcl_he_ptr;

    return he_ptr;
}
Example #27
0
void
tn_delete (TNPtr n)
{
    T* t = n->tree;

    /* We assume that the node either has no parent or siblings anymore,
     * or that their presence does not matter. The node may still have
     * children. They are deleted recursively. That is the situation
     * where the parent/sibling information does not matter anymore, and
     * can be ignored.
     */

    tn_notleaf (n);
    tn_notnode (n);

    Tcl_DecrRefCount	(n->name); n->name = NULL;
    Tcl_DeleteHashEntry (n->he);   n->he   = NULL;

    if (n->child) {
	int i;

	for (i = 0; i < n->nchildren; i++) {
	    ASSERT_BOUNDS (i, n->nchildren);

	    tn_delete (n->child [i]);
	    n->child [i] = NULL;
	}
	ckfree ((char*) n->child);

	n->child       = NULL;
	n->nchildren   = 0;
	n->maxchildren = 0;
    }

    if (n->attr) {
	Tcl_HashSearch	hs;
	Tcl_HashEntry*	he;

	for(he = Tcl_FirstHashEntry(n->attr, &hs);
	    he != NULL;
	    he = Tcl_NextHashEntry(&hs)) {
	    Tcl_DecrRefCount ((Tcl_Obj*) Tcl_GetHashValue(he));
	}
	Tcl_DeleteHashTable(n->attr);
	ckfree ((char*) n->attr);
	n->attr = NULL;
    }

    ckfree ((char*) n);
}
/* Destroy the RR hash for a sender, and all its associated values. */
void Delete_RR_Hash(member *the_member)
{
  Tcl_HashTable *the_table = &the_member->RR_Hash;
  Tcl_HashEntry *the_entry;
  Tcl_HashSearch the_search;
  
  the_entry = Tcl_FirstHashEntry(the_table, &the_search);
  while (the_entry != NULL) {
    free(Tcl_GetHashValue(the_entry));
    the_entry = Tcl_NextHashEntry(&the_search);
  }

  Tcl_DeleteHashTable(the_table);
}
Example #29
0
/*
 * Syslog_ListHash - appends to interp result all the values of given
 * hash table
 */
static void Syslog_ListHash(Tcl_Interp *interp,Tcl_HashTable *table) 
{
    Tcl_HashSearch *searchPtr=(Tcl_HashSearch *)
          Tcl_Alloc(sizeof(Tcl_HashSearch));
    Tcl_HashEntry *entry;
    char separator[3]={' ',' ',0};   
    entry=Tcl_FirstHashEntry(table,searchPtr);
    while (entry) {
        Tcl_AppendResult(interp,separator,Tcl_GetHashKey(table,entry),NULL);
        separator[0]=',';
        entry=Tcl_NextHashEntry(searchPtr);
    }   
    Tcl_Free((char *)searchPtr);
} 
Example #30
0
File: tkImage.c Project: tcltk/tk
void
TkDeleteAllImages(
    TkMainInfo *mainPtr)	/* Structure describing application that is
				 * going away. */
{
    Tcl_HashSearch search;
    Tcl_HashEntry *hPtr;

    for (hPtr = Tcl_FirstHashEntry(&mainPtr->imageTable, &search);
	    hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
	EventuallyDeleteImage(Tcl_GetHashValue(hPtr), 1);
    }
    Tcl_DeleteHashTable(&mainPtr->imageTable);
}