Atom Tk_InternAtom( Tk_Window tkwin, /* Window token; map name to atom for this * window's display. */ const char *name) /* Name to turn into atom. */ { TkDisplay *dispPtr; Tcl_HashEntry *hPtr; int isNew; dispPtr = ((TkWindow *) tkwin)->dispPtr; if (!dispPtr->atomInit) { AtomInit(dispPtr); } hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew); if (isNew) { Tcl_HashEntry *hPtr2; Atom atom; atom = XInternAtom(dispPtr->display, name, False); Tcl_SetHashValue(hPtr, atom); hPtr2 = Tcl_CreateHashEntry(&dispPtr->atomTable, (char*) atom, &isNew); Tcl_SetHashValue(hPtr2, Tcl_GetHashKey(&dispPtr->nameTable, hPtr)); } return (Atom) Tcl_GetHashValue(hPtr); }
static void InitKeyMaps() { Tcl_HashEntry *hPtr; KeyInfo *kPtr; int dummy; Tcl_InitHashTable(&keycodeTable, TCL_ONE_WORD_KEYS); for (kPtr = keyArray; kPtr->keycode != 0; kPtr++) { hPtr = Tcl_CreateHashEntry(&keycodeTable, (char *) kPtr->keycode, &dummy); Tcl_SetHashValue(hPtr, kPtr->keysym); } Tcl_InitHashTable(&vkeyTable, TCL_ONE_WORD_KEYS); for (kPtr = vituralkeyArray; kPtr->keycode != 0; kPtr++) { hPtr = Tcl_CreateHashEntry(&vkeyTable, (char *) kPtr->keycode, &dummy); Tcl_SetHashValue(hPtr, kPtr->keysym); } KCHRPtr = (Ptr) GetScriptManagerVariable(smKCHRCache); if (!KCHRPtr){ fprintf(stderr,"GetScriptManagerVariable failed\n"); } initialized = 1; }
static void AtomInit( TkDisplay *dispPtr)/* Display to initialize. */ { Tcl_HashEntry *hPtr; Atom atom; dispPtr->atomInit = 1; Tcl_InitHashTable(&dispPtr->nameTable, TCL_STRING_KEYS); Tcl_InitHashTable(&dispPtr->atomTable, TCL_ONE_WORD_KEYS); for (atom = 1; atom <= XA_LAST_PREDEFINED; atom++) { const char *name; int isNew; hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, (char *) atom); if (hPtr != NULL) { continue; } name = atomNameArray[atom - 1]; hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew); Tcl_SetHashValue(hPtr, atom); name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom, &isNew); Tcl_SetHashValue(hPtr, name); } }
static Tcl_Obj *Ttk_Use( Tcl_Interp *interp, Tcl_HashTable *table, Allocator allocate, Tk_Window tkwin, Tcl_Obj *objPtr) { int newEntry; Tcl_HashEntry *entryPtr = Tcl_CreateHashEntry(table,Tcl_GetString(objPtr),&newEntry); Tcl_Obj *cacheObj; if (!newEntry) { return Tcl_GetHashValue(entryPtr); } cacheObj = Tcl_DuplicateObj(objPtr); Tcl_IncrRefCount(cacheObj); if (allocate(interp, tkwin, cacheObj)) { Tcl_SetHashValue(entryPtr, cacheObj); return cacheObj; } else { Tcl_DecrRefCount(cacheObj); Tcl_SetHashValue(entryPtr, NULL); Tcl_BackgroundException(interp, TCL_ERROR); return NULL; } }
ClientData Itcl_RegisterClassCommand( Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *cmdName, ClientData clientData) { Tcl_HashEntry *hPtr; Tcl_HashTable *tablePtr; ItclResolvingInfo *iriPtr; int isNew; iriPtr = Tcl_GetAssocData(interp, ITCL_RESOLVE_DATA, NULL); hPtr = Tcl_CreateHashEntry(&iriPtr->resolveCmds, nsPtr->fullName, &isNew); if (isNew) { tablePtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(tablePtr, TCL_STRING_KEYS); Tcl_SetHashValue(hPtr, tablePtr); } else { tablePtr = Tcl_GetHashValue(hPtr); } hPtr = Tcl_CreateHashEntry(tablePtr, cmdName, &isNew); if (isNew) { Tcl_SetHashValue(hPtr, clientData); } return Tcl_GetHashValue(hPtr); }
static int IvyBindCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv) { filter_struct *filter; Tcl_HashEntry *entry; int dummy; char msg[INTEGER_SPACE]; if (argc != 3) { Tcl_AppendResult(interp, "wrong # of args: \"", argv[0], " filter script\"", (char *) NULL); return TCL_ERROR; } filter = (filter_struct *) ckalloc(sizeof(filter_struct)); filter->filter = ckalloc(strlen(argv[1])+1); /* regexp */ strcpy(filter->filter, argv[1]); filter->script = ckalloc(strlen(argv[2])+1); /* callback proc name */ strcpy(filter->script, argv[2]); filter->id = IvyBindMsg(IvyMsgCB, (void *) filter, filter->filter, NULL); /* MsgPtr id */ filter->interp = interp; entry = Tcl_CreateHashEntry(&filter_table, (char *) (long) filter_id, &dummy); Tcl_SetHashValue(entry, (ClientData) filter); sprintf(msg, "%d", filter_id); filter_id++; Tcl_SetResult(interp, msg, TCL_VOLATILE); return TCL_OK; }
Ttk_Theme Ttk_CreateTheme( Tcl_Interp *interp, /* Interpreter in which to create theme */ const char *name, /* Name of the theme to create. */ Ttk_Theme parent) /* Parent/fallback theme, NULL for default */ { StylePackageData *pkgPtr = GetStylePackageData(interp); Tcl_HashEntry *entryPtr; int newEntry; Theme *themePtr; entryPtr = Tcl_CreateHashEntry(&pkgPtr->themeTable, name, &newEntry); if (!newEntry) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Theme ", name, " already exists", NULL); return NULL; } /* * Initialize new theme: */ if (!parent) parent = pkgPtr->defaultTheme; themePtr = NewTheme(pkgPtr->cache, parent); Tcl_SetHashValue(entryPtr, (ClientData) themePtr); return themePtr; }
/* *---------------------------------------------------------------------- * * Nsf_PointerAdd -- * * Add an entry to our locally maintained hash table and set its * value to the provided valuePtr. The keys are generated based on * the passed type and the counter obtained from the type * registration. * * Results: * Tcl result code * * Side effects: * None. * *---------------------------------------------------------------------- */ int Nsf_PointerAdd(Tcl_Interp *interp, char *buffer, size_t size, const char *typeName, void *valuePtr) { int *counterPtr; nonnull_assert(interp != NULL); nonnull_assert(buffer != NULL); nonnull_assert(typeName != NULL); nonnull_assert(valuePtr != NULL); counterPtr = Nsf_PointerTypeLookup(typeName); if (counterPtr != NULL) { Tcl_DString ds, *dsPtr = &ds; Tcl_HashEntry *hPtr; int isNew; Tcl_DStringInit(dsPtr); Tcl_DStringAppend(dsPtr, typeName, -1); Tcl_DStringAppend(dsPtr, ":%d", 3); NsfMutexLock(&pointerMutex); snprintf(buffer, size, Tcl_DStringValue(dsPtr), (*counterPtr)++); hPtr = Tcl_CreateHashEntry(pointerHashTablePtr, buffer, &isNew); NsfMutexUnlock(&pointerMutex); Tcl_SetHashValue(hPtr, valuePtr); /*fprintf(stderr, "Nsf_PointerAdd key '%s' prefix '%s' => %p value %p\n", buffer, typeName, hPtr, valuePtr);*/ Tcl_DStringFree(dsPtr); } else { return NsfPrintError(interp, "no type converter for %s registered", typeName); } return TCL_OK; }
static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) { Theme *themePtr = (Theme*)ckalloc(sizeof(Theme)); Tcl_HashEntry *entryPtr; int unused; themePtr->parentPtr = parent; themePtr->enabledProc = ThemeEnabled; themePtr->enabledData = NULL; themePtr->cache = cache; Tcl_InitHashTable(&themePtr->elementTable, TCL_STRING_KEYS); Tcl_InitHashTable(&themePtr->styleTable, TCL_STRING_KEYS); /* * Create root style "." */ entryPtr = Tcl_CreateHashEntry(&themePtr->styleTable, ".", &unused); themePtr->rootStyle = NewStyle(); themePtr->rootStyle->styleName = Tcl_GetHashKey(&themePtr->styleTable, entryPtr); themePtr->rootStyle->cache = themePtr->cache; Tcl_SetHashValue(entryPtr, (ClientData)themePtr->rootStyle); return themePtr; }
void SetSigMapValue ( SignalMapEntry *entryPtr, ClientData clientData) { Tcl_SetHashValue(entryPtr, clientData); }
Ttk_Theme Ttk_CreateTheme( Tcl_Interp *interp, /* Interpreter in which to create theme */ const char *name, /* Name of the theme to create. */ Ttk_Theme parent) /* Parent/fallback theme, NULL for default */ { StylePackageData *pkgPtr = GetStylePackageData(interp); Tcl_HashEntry *entryPtr; int newEntry; Theme *themePtr; entryPtr = Tcl_CreateHashEntry(&pkgPtr->themeTable, name, &newEntry); if (!newEntry) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Theme %s already exists", name)); Tcl_SetErrorCode(interp, "TTK", "THEME", "EXISTS", NULL); return NULL; } /* * Initialize new theme: */ if (!parent) parent = pkgPtr->defaultTheme; themePtr = NewTheme(pkgPtr->cache, parent); Tcl_SetHashValue(entryPtr, themePtr); return themePtr; }
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); } }
/* * Initialize a Duktape intepreter. * Return value: string token of the form "::duktape::(integer)". * Side effects: creates an Duktape heap. */ static int Init_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { duk_context *ctx; Tcl_HashEntry *hashPtr; int isNew; Tcl_Obj *token; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, USAGE_INIT); return TCL_ERROR; } ctx = duk_create_heap_default(); if (ctx == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(ERROR_CREATE, -1)); return TCL_ERROR; } DUKTCL_CDATA->counter++; token = Tcl_ObjPrintf(NS "::%d", DUKTCL_CDATA->counter); hashPtr = Tcl_CreateHashEntry(&DUKTCL_CDATA->table, Tcl_GetString(token), &isNew); Tcl_SetHashValue(hashPtr, (ClientData) ctx); Tcl_SetObjResult(interp, token); return TCL_OK; }
static Slave * CreateSlave( Tk_Window tkwin, /* Token for desired slave. */ Tk_OptionTable table) { Tcl_HashEntry *hPtr; register Slave *slavePtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew); if (!isNew) { return Tcl_GetHashValue(hPtr); } /* * No preexisting slave structure for that window, so make a new one and * populate it with some default values. */ slavePtr = ckalloc(sizeof(Slave)); memset(slavePtr, 0, sizeof(Slave)); slavePtr->tkwin = tkwin; slavePtr->inTkwin = None; slavePtr->anchor = TK_ANCHOR_NW; slavePtr->borderMode = BM_INSIDE; slavePtr->optionTable = table; Tcl_SetHashValue(hPtr, slavePtr); Tk_CreateEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, slavePtr); return slavePtr; }
void TkpDefineNativeBitmaps(void) { Tcl_HashTable *tablePtr = TkGetBitmapPredefTable(); BuiltInIcon *builtInPtr; for (builtInPtr = builtInIcons; builtInPtr->name != NULL; builtInPtr++) { Tcl_HashEntry *predefHashPtr; const char * name; int isNew; name = Tk_GetUid(builtInPtr->name); predefHashPtr = Tcl_CreateHashEntry(tablePtr, name, &isNew); if (isNew) { TkPredefBitmap *predefPtr = (TkPredefBitmap *) ckalloc(sizeof(TkPredefBitmap)); NativeIcon *nativeIconPtr = (NativeIcon *) ckalloc(sizeof(NativeIcon)); nativeIconPtr->id = builtInPtr->id; nativeIconPtr->type = builtInPtr->type; predefPtr->source = (char *) nativeIconPtr; predefPtr->width = builtInPtr->size; predefPtr->height = builtInPtr->size; predefPtr->native = 1; Tcl_SetHashValue(predefHashPtr, predefPtr); } } }
static void RegisterTcpServerInterpCleanup( Tcl_Interp *interp, /* Interpreter for which we want to be * informed of deletion. */ AcceptCallback *acceptCallbackPtr) /* The accept callback record whose interp * field we want set to NULL when the * interpreter is deleted. */ { Tcl_HashTable *hTblPtr; /* Hash table for accept callback records to * smash when the interpreter will be * deleted. */ Tcl_HashEntry *hPtr; /* Entry for this record. */ int isNew; /* Is the entry new? */ hTblPtr = (Tcl_HashTable *) Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL); if (hTblPtr == NULL) { hTblPtr = (Tcl_HashTable *) ckalloc((unsigned) sizeof(Tcl_HashTable)); Tcl_InitHashTable(hTblPtr, TCL_ONE_WORD_KEYS); (void) Tcl_SetAssocData(interp, "tclTCPAcceptCallbacks", TcpAcceptCallbacksDeleteProc, hTblPtr); } hPtr = Tcl_CreateHashEntry(hTblPtr, (char *) acceptCallbackPtr, &isNew); if (!isNew) { Tcl_Panic("RegisterTcpServerCleanup: damaged accept record table"); } Tcl_SetHashValue(hPtr, acceptCallbackPtr); }
void create_name_hash( FILE *fd ) { char line[MAX_LINE_SIZE]; Tcl_HashEntry *hash_entry=NULL; int new_entry=0; Tcl_InitHashTable( &htbl, TCL_STRING_KEYS ); while ( bu_fgets( line, MAX_LINE_SIZE, fd ) ) { char *part_no, *desc, *ptr; ptr = strtok( line, " \t\n" ); if ( !ptr ) bu_exit( 1, "%s: *****Error processing part name file at line:\n\t%s\n", progname,line ); part_no = bu_strdup( ptr ); lower_case( part_no ); ptr = strtok( (char *)NULL, " \t\n" ); if ( !ptr ) bu_exit( 1, "%s: *****Error processing part name file at line:\n\t%s\n", progname,line ); desc = bu_strdup( ptr ); lower_case( desc ); hash_entry = Tcl_CreateHashEntry( &htbl, part_no, &new_entry ); if ( new_entry ) { Tcl_SetHashValue( hash_entry, desc ); } else { bu_free( (char *)part_no, "part_no" ); bu_free( (char *)desc, "desc" ); } } }
void XOTclProfileFillTable(Tcl_HashTable* table, Tcl_DString* key, double totalMicroSec) { Tcl_HashEntry* hPtr; char* keyStr = Tcl_DStringValue(key); long int* value; hPtr = Tcl_FindHashEntry(table, keyStr); if (!hPtr) { int nw; hPtr = Tcl_CreateHashEntry(table, keyStr, &nw); if (!nw) return; value = (long int*) ckalloc (sizeof(long int)); *value = 0; Tcl_SetHashValue(hPtr, (ClientData) value); } else value = (long int*) Tcl_GetHashValue (hPtr); *value += totalMicroSec; /* { long int* d = (long int*) Tcl_GetHashValue (hPtr); fprintf(stderr, "Entered %s ... %ld\n", Tcl_GetHashKey(table, hPtr), *d); }*/ }
void Tcl_CreateCommand( Tcl_Interp *interp /* Token for command interpreter (returned by a previous call to Tcl_CreateInterp). */ , unsigned char *cmdName /* Name of command. */ , Tcl_CmdProc *proc /* Command procedure to associate with cmdName. */ , void *clientData /* Arbitrary one-word value to pass to proc. */ , Tcl_CmdDeleteProc *deleteProc /* If not NULL, gives a procedure to call when * this command is deleted. */ ) { Interp *iPtr = (Interp *) interp; register Command *c; Tcl_HashEntry *he; int isnew; he = Tcl_CreateHashEntry(&iPtr->commandTable, cmdName, &isnew); if (!isnew) { /* * Command already exists: delete the old one. */ c = (Command *) Tcl_GetHashValue(he); if (c->deleteProc != 0) { (*c->deleteProc)(c->clientData); } } else { c = (Command*) mem_alloc (iPtr->pool, sizeof(Command)); Tcl_SetHashValue(he, c); } c->proc = proc; c->clientData = clientData; c->deleteProc = deleteProc; }
static void FreeBitmap( TkBitmap *bitmapPtr) /* Bitmap to be released. */ { TkBitmap *prevPtr; bitmapPtr->resourceRefCount--; if (bitmapPtr->resourceRefCount > 0) { return; } Tk_FreePixmap(bitmapPtr->display, bitmapPtr->bitmap); Tcl_DeleteHashEntry(bitmapPtr->idHashPtr); prevPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr); if (prevPtr == bitmapPtr) { if (bitmapPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(bitmapPtr->nameHashPtr); } else { Tcl_SetHashValue(bitmapPtr->nameHashPtr, bitmapPtr->nextPtr); } } else { while (prevPtr->nextPtr != bitmapPtr) { prevPtr = prevPtr->nextPtr; } prevPtr->nextPtr = bitmapPtr->nextPtr; } if (bitmapPtr->objRefCount == 0) { ckfree(bitmapPtr); } }
Tcl_DString *tcl_krb5_create_object(Tcl_Interp *interp, char *type, ClientData datum) { Tcl_HashTable *table; Tcl_DString *handle; Tcl_HashEntry *entry; int entry_created = 0; if (! (table = get_hash_table(interp, type))) { return 0; } if (! (handle = get_new_handle(interp, type))) { return 0; } if (! (entry = Tcl_CreateHashEntry(table, handle, &entry_created))) { Tcl_SetResult(interp, "error creating hash entry", TCL_STATIC); Tcl_DStringFree(handle); return TCL_ERROR; } assert(entry_created); Tcl_SetHashValue(entry, datum); return handle; }
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; }
static void FreeCursor( TkCursor *cursorPtr) /* Cursor to be released. */ { TkCursor *prevPtr; cursorPtr->resourceRefCount--; if (cursorPtr->resourceRefCount > 0) { return; } Tcl_DeleteHashEntry(cursorPtr->idHashPtr); prevPtr = (TkCursor *) Tcl_GetHashValue(cursorPtr->hashPtr); if (prevPtr == cursorPtr) { if (cursorPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(cursorPtr->hashPtr); } else { Tcl_SetHashValue(cursorPtr->hashPtr, cursorPtr->nextPtr); } } else { while (prevPtr->nextPtr != cursorPtr) { prevPtr = prevPtr->nextPtr; } prevPtr->nextPtr = cursorPtr->nextPtr; } TkpFreeCursor(cursorPtr); if (cursorPtr->objRefCount == 0) { ckfree((char *) cursorPtr); } }
/* Add a new node name to the node name hash table. node_name contains the child's name only. */ static int add_scene_node( const char *parent_name, const char *node_name, scene_node_t *node ) { Tcl_HashEntry *entry; int newEntry; char new_name[1024]; /* Add the current node to the hash table */ if (0 == strcmp(parent_name,":")) { sprintf(new_name, ":%s", node_name); } else { sprintf(new_name, "%s:%s", parent_name, node_name); } node->name = (char*)malloc( strlen(new_name) + 1 ); node->name = strcpy(node->name, new_name); entry = Tcl_CreateHashEntry(&g_hier_node_table,new_name,&newEntry); if (newEntry) { Tcl_SetHashValue(entry, node); } else { return TCL_ERROR; } return TCL_OK; }
void Tk_FreeColor( XColor *colorPtr) /* Color to be released. Must have been * allocated by Tk_GetColor or * Tk_GetColorByValue. */ { TkColor *tkColPtr = (TkColor *) colorPtr; Screen *screen = tkColPtr->screen; TkColor *prevPtr; /* * Do a quick sanity check to make sure this color was really allocated by * Tk_GetColor. */ if (tkColPtr->magic != COLOR_MAGIC) { Tcl_Panic("Tk_FreeColor called with bogus color"); } tkColPtr->resourceRefCount--; if (tkColPtr->resourceRefCount > 0) { return; } /* * This color is no longer being actively used, so free the color * resources associated with it and remove it from the hash table. No * longer any objects referencing it. */ if (tkColPtr->gc != None) { XFreeGC(DisplayOfScreen(screen), tkColPtr->gc); tkColPtr->gc = None; } TkpFreeColor(tkColPtr); prevPtr = Tcl_GetHashValue(tkColPtr->hashPtr); if (prevPtr == tkColPtr) { if (tkColPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(tkColPtr->hashPtr); } else { Tcl_SetHashValue(tkColPtr->hashPtr, tkColPtr->nextPtr); } } else { while (prevPtr->nextPtr != tkColPtr) { prevPtr = prevPtr->nextPtr; } prevPtr->nextPtr = tkColPtr->nextPtr; } /* * Free the TkColor structure if there are no objects referencing it. * However, if there are objects referencing it then keep the structure * around; it will get freed when the last reference is cleared */ if (tkColPtr->objRefCount == 0) { ckfree((char *) tkColPtr); } }
void ObjToRepMap::insert (Tcl_Obj *pObj, InternalRep *pRep) { int isNew; Tcl_HashEntry *pEntry = Tcl_CreateHashEntry( &m_objMap, reinterpret_cast<char *>(pObj), &isNew); Tcl_SetHashValue(pEntry, pRep); }
Tcl_HashEntry * HandleNameToRepMap::insert (const char *handleStr, InternalRep *pRep) { int isNew; Tcl_HashEntry *pEntry = Tcl_CreateHashEntry( &m_handleMap, const_cast<char *>(handleStr), &isNew); Tcl_SetHashValue(pEntry, static_cast<ClientData>(pRep)); return pEntry; }
static void IvyAppCB(IvyClientPtr app, void *user_data, /* script a appeler */ IvyApplicationEvent event) { static const char *app_event_str[] = { "Connected", "Disconnected" }; filter_struct *filter = (filter_struct *) user_data; int result, size, dummy; char *script_to_call; Tcl_HashEntry *entry; entry = Tcl_FindHashEntry(&app_table, IvyGetApplicationName(app)); if (event == IvyApplicationConnected) { if (!entry) { entry = Tcl_CreateHashEntry(&app_table, IvyGetApplicationName(app), &dummy); Tcl_SetHashValue(entry, (ClientData) app); } } size = strlen(filter->script) + INTEGER_SPACE; if (entry) { size += strlen(IvyGetApplicationName(app)) + 3; } else { size += 4; } script_to_call = ckalloc(size); strcpy(script_to_call, filter->script); strcat(script_to_call, " "); if (entry) { strcat(script_to_call, " \""); strcat(script_to_call, IvyGetApplicationName(app)); strcat(script_to_call, "\""); } else { strcat(script_to_call, "???"); } strcat(script_to_call, " \""); strcat(script_to_call, app_event_str[event%2]); strcat(script_to_call, "\""); Tcl_Preserve(filter->interp); result = Tcl_GlobalEval(filter->interp, script_to_call); ckfree(script_to_call); if (result != TCL_OK) { Tcl_BackgroundError(filter->interp); } Tcl_Release(filter->interp); if (event == IvyApplicationDisconnected) { if (entry) { Tcl_DeleteHashEntry(entry); } } }
void Tfp_ArraySet( Tfp_ArrayType *arr, char *key, ClientData value ) { int junk; Tcl_HashEntry *p; p = Tcl_CreateHashEntry( arr->table, key, &junk ); Tcl_SetHashValue( p, value ); }
Tcl_Command Itcl_RegisterObjectCommand( Tcl_Interp *interp, ItclObject *ioPtr, const char *cmdName, ClientData clientData, Tcl_Command cmdPtr, Tcl_Namespace *nsPtr) { Tcl_HashEntry *hPtr; ItclResolvingInfo *iriPtr; ObjectCmdTableInfo *octiPtr; ObjectCmdInfo *ociPtr; int isNew; iriPtr = Tcl_GetAssocData(interp, ITCL_RESOLVE_DATA, NULL); hPtr = Tcl_CreateHashEntry(&iriPtr->objectCmdsTables, (char *)ioPtr, &isNew); if (isNew) { octiPtr = (ObjectCmdTableInfo *)ckalloc(sizeof(ObjectCmdTableInfo)); Tcl_InitHashTable(&octiPtr->cmdInfos, TCL_ONE_WORD_KEYS); octiPtr->tablePtr = &((Namespace *)nsPtr)->cmdTable; Tcl_SetHashValue(hPtr, octiPtr); } else { octiPtr = Tcl_GetHashValue(hPtr); } hPtr = Tcl_CreateHashEntry(&octiPtr->cmdInfos, (char *)clientData, &isNew); if (isNew) { ociPtr = (ObjectCmdInfo *)ckalloc(sizeof(ObjectCmdInfo)); memset(ociPtr, 0, sizeof(ObjectCmdInfo)); Tcl_SetHashValue(hPtr, ociPtr); } else { ociPtr = Tcl_GetHashValue(hPtr); } ociPtr->clientData = clientData; ociPtr->ioPtr = ioPtr; if (cmdPtr == NULL) { /* cmdPtr = Tcl_NewNamespaceVar(interp, nsPtr, varName); */ } ociPtr->cmdPtr = cmdPtr; return cmdPtr; }