本文整理汇总了C++中Tcl_DeleteHashEntry函数的典型用法代码示例。如果您正苦于以下问题:C++ Tcl_DeleteHashEntry函数的具体用法?C++ Tcl_DeleteHashEntry怎么用?C++ Tcl_DeleteHashEntry使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Tcl_DeleteHashEntry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FreeCursor
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);
}
}
示例2: TkGCCleanup
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;
}
示例3: DBus_SignalCleanup
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);
}
示例4: FreeBitmap
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);
}
}
示例5: DeleteImage
static void
DeleteImage(
ImageMaster *masterPtr) /* Pointer to main data structure for image. */
{
Image *imagePtr;
Tk_ImageType *typePtr;
typePtr = masterPtr->typePtr;
masterPtr->typePtr = NULL;
if (typePtr != NULL) {
for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
typePtr->freeProc(imagePtr->instanceData, imagePtr->display);
imagePtr->changeProc(imagePtr->widgetClientData, 0, 0,
masterPtr->width, masterPtr->height, masterPtr->width,
masterPtr->height);
}
typePtr->deleteProc(masterPtr->masterData);
}
if (masterPtr->instancePtr == NULL) {
if (masterPtr->hPtr != NULL) {
Tcl_DeleteHashEntry(masterPtr->hPtr);
}
Tcl_Release(masterPtr->winPtr);
ckfree(masterPtr);
} else {
masterPtr->deleted = 1;
}
}
示例6: XOTclProfilePrintTable
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);
}
示例7: bonjour_register_cleanup
////////////////////////////////////////////////////
// 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);
}
示例8: tcl_delete
static AP_Result tcl_delete(AP_World *w, AP_Obj interp_name)
{
Tcl_HashEntry *entry;
Tcl_Interp *interp;
if (AP_ObjType(w, interp_name) != AP_ATOM) {
return AP_SetStandardError(w, AP_TYPE_ERROR,
AP_NewSymbolFromStr(w, "atom"), interp_name);
}
entry = Tcl_FindHashEntry(&tcl_interp_name_table, AP_GetAtomStr(w, interp_name));
if (!entry) {
return AP_SetStandardError(w, AP_DOMAIN_ERROR,
AP_NewSymbolFromStr(w, "tcl_interpreter"), interp_name);
}
interp = Tcl_GetHashValue(entry);
Tcl_DeleteInterp(interp);
Tcl_DeleteHashEntry(entry);
return AP_SUCCESS;
}
示例9: EmbWinStructureProc
static void
EmbWinStructureProc(
ClientData clientData, /* Pointer to record describing window item. */
XEvent *eventPtr) /* Describes what just happened. */
{
TkTextEmbWindowClient *client = clientData;
TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
Tcl_HashEntry *hPtr;
if (eventPtr->type != DestroyNotify) {
return;
}
hPtr = Tcl_FindHashEntry(&ewPtr->body.ew.sharedTextPtr->windowTable,
Tk_PathName(client->tkwin));
if (hPtr != NULL) {
/*
* This may not exist if the entire widget is being deleted.
*/
Tcl_DeleteHashEntry(hPtr);
}
ewPtr->body.ew.tkwin = NULL;
client->tkwin = NULL;
index.tree = ewPtr->body.ew.sharedTextPtr->tree;
index.linePtr = ewPtr->body.ew.linePtr;
index.byteIndex = TkTextSegToOffset(ewPtr, ewPtr->body.ew.linePtr);
TkTextChanged(ewPtr->body.ew.sharedTextPtr, NULL, &index, &index);
TkTextInvalidateLineMetrics(ewPtr->body.ew.sharedTextPtr, NULL,
index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
}
示例10: Tk_FreeColor
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);
}
}
示例11: IvyAppCB
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);
}
}
}
示例12: Tcl_FindHashEntry
void
ObjToRepMap::erase (Tcl_Obj *pObj)
{
Tcl_HashEntry *pEntry = Tcl_FindHashEntry(
&m_objMap, reinterpret_cast<char *>(pObj));
if (pEntry != 0) {
Tcl_DeleteHashEntry(pEntry);
}
}
示例13: SWIG_Tcl_Disown
SWIG_Tcl_Disown(void *ptr) {
Tcl_HashEntry *entryPtr;
if (!swigobjectTableinit) return 0;
entryPtr = Tcl_FindHashEntry(&swigobjectTable, (char *) ptr);
if (entryPtr) {
Tcl_DeleteHashEntry(entryPtr);
return 1;
}
return 0;
}
示例14: Tfp_ArrayDelete
void
Tfp_ArrayDelete( Tfp_ArrayType *arr, char *key )
{
Tcl_HashEntry *p;
p = Tcl_FindHashEntry( arr->table, key );
if (p == (Tcl_HashEntry *) NULL) {
return;
}
(*arr->cleanProc) ( Tcl_GetHashValue( p ) );
Tcl_DeleteHashEntry( p );
}
示例15: PkguaDeleteTokens
static void
PkguaDeleteTokens(
Tcl_Interp *interp)
{
Tcl_HashEntry *entryPtr =
Tcl_FindHashEntry(&interpTokenMap, (char *) interp);
if (entryPtr) {
Tcl_Free((char *) Tcl_GetHashValue(entryPtr));
Tcl_DeleteHashEntry(entryPtr);
}
}