当前位置: 首页>>代码示例>>C++>>正文


C++ Tcl_FindHashEntry函数代码示例

本文整理汇总了C++中Tcl_FindHashEntry函数的典型用法代码示例。如果您正苦于以下问题:C++ Tcl_FindHashEntry函数的具体用法?C++ Tcl_FindHashEntry怎么用?C++ Tcl_FindHashEntry使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Tcl_FindHashEntry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ItclCheckSetItclHull

/*
 * ------------------------------------------------------------------------
 *  ItclCheckSetItclHull()
 *
 *
 * ------------------------------------------------------------------------
 */
static int
ItclCheckSetItclHull(
    ClientData clientData,   /* infoPtr */
    Tcl_Interp *interp,      /* current interpreter */
    int objc,                /* number of arguments */
    Tcl_Obj *const objv[])   /* argument objects */
{
    Tcl_HashEntry *hPtr;
    Tcl_Obj *objPtr;
    ItclObject *ioPtr;
    ItclVariable *ivPtr;
    ItclObjectInfo *infoPtr;
    const char *valueStr;

    if (objc < 3) {
        Tcl_AppendResult(interp, "ItclCheckSetItclHull wrong # args should be ",
	        "<objectName> <value>", NULL);
	return TCL_ERROR;
    }
    infoPtr = (ItclObjectInfo *)clientData;
    if (strlen(Tcl_GetString(objv[1])) > 0) {
        hPtr = Tcl_FindHashEntry(&infoPtr->objectNames, (char *)objv[1]);
        if (hPtr == NULL) {
            Tcl_AppendResult(interp, "ItclCheckSetItclHull cannot find object\"",
	            Tcl_GetString(objv[1]), "\"", NULL);
	    return TCL_ERROR;
        }
        ioPtr = Tcl_GetHashValue(hPtr);
    } else {
        ioPtr = infoPtr->currIoPtr;
	if (ioPtr == NULL) {
            Tcl_AppendResult(interp, "ItclCheckSetItclHull cannot find object",
	            NULL);
	    return TCL_ERROR;
        }
    }
    objPtr = Tcl_NewStringObj("itcl_hull", -1);
    hPtr = Tcl_FindHashEntry(&ioPtr->iclsPtr->variables, (char *)objPtr);
    Tcl_DecrRefCount(objPtr);
    if (hPtr == NULL) {
        Tcl_AppendResult(interp, "ItclCheckSetItclHull cannot find itcl_hull",
	        " variable for object \"", Tcl_GetString(objv[1]), "\"", NULL);
	return TCL_ERROR;
    }
    ivPtr = Tcl_GetHashValue(hPtr);
    valueStr = Tcl_GetString(objv[2]);
    if (strcmp(valueStr, "2") == 0) {
        ivPtr->initted = 2;
    } else {
        if (strcmp(valueStr, "0") == 0) {
            ivPtr->initted = 0;
	} else {
            Tcl_AppendResult(interp, "ItclCheckSetItclHull bad value \"",
	            valueStr, "\"", NULL);
	    return TCL_ERROR;
	}
    }
    return TCL_OK;
}
开发者ID:FreddieAkeroyd,项目名称:TkTclTix,代码行数:66,代码来源:itclBase.c

示例2: XKeycodeToKeysym

KeySym 
XKeycodeToKeysym(
    Display* display,
    KeyCode keycode,
    int	index)
{
    register Tcl_HashEntry *hPtr;
    register char c;
    char virtualKey;
    int newKeycode;
    unsigned long dummy, newChar;

    if (!initialized) {
	InitKeyMaps();
    }
	
    c = keycode & charCodeMask;
    virtualKey = (keycode & keyCodeMask) >> 8;

    /*
     * When determining what keysym to produce we firt check to see if
     * the key is a function key.  We then check to see if the character
     * is another non-printing key.  Finally, we return the key syms
     * for all ASCI chars.
     */
    if (c == 0x10) {
	hPtr = Tcl_FindHashEntry(&vkeyTable, (char *) virtualKey);
	if (hPtr != NULL) {
	    return (KeySym) Tcl_GetHashValue(hPtr);
	}
    }
    
    
    hPtr = Tcl_FindHashEntry(&keycodeTable, (char *) virtualKey);
    if (hPtr != NULL) {
	return (KeySym) Tcl_GetHashValue(hPtr);
    }

    /* 
     * Recompute the character based on the Shift key only.
     * TODO: The index may also specify the NUM_LOCK.
     */
    newKeycode = virtualKey;
    if (index & 0x01) {
	newKeycode += 0x0200;
    }
    dummy = 0;
    newChar = KeyTranslate(KCHRPtr, (short) newKeycode, &dummy);
    c = newChar & charCodeMask;
    
    if (c >= XK_space && c < XK_asciitilde) {
	return c;
    }

    return NoSymbol; 
}
开发者ID:BackupTheBerlios,项目名称:bonephone,代码行数:56,代码来源:tkMacKeyboard.c

示例3: Tcl_FindHashEntry

Tcl_DBusBus *DBus_GetConnection(Tcl_Interp *interp, Tcl_Obj *const name)
{
   Tcl_HashEntry *entry;
   Tcl_DBusBus *dbus;

   entry = Tcl_FindHashEntry(&bus, (char *) name);
   if (entry == NULL) return NULL;
   dbus = (Tcl_DBusBus *) Tcl_GetHashValue(entry);
   entry = Tcl_FindHashEntry(dbus->snoop, (char *) interp);
   if (entry != NULL)
     return dbus;
   else
     return NULL;
}
开发者ID:recri,项目名称:keyer,代码行数:14,代码来源:dbusMain.c

示例4: Itcl_ParseVarResolver2

/* ARGSUSED */
int
Itcl_ParseVarResolver2(
    Tcl_Interp *interp,        /* current interpreter */
    const char* name,                /* name of the variable being accessed */
    Tcl_Namespace *contextNs,  /* namespace context */
    int flags,                 /* TCL_GLOBAL_ONLY => global variable
                                * TCL_NAMESPACE_ONLY => namespace variable */
    Tcl_Var* rPtr)             /* returns: Tcl_Var for desired variable */
{
    ItclObjectInfo *infoPtr = (ItclObjectInfo*)contextNs->clientData;
    ItclClass *iclsPtr = (ItclClass*)Itcl_PeekStack(&infoPtr->clsStack);

    Tcl_HashEntry *hPtr;
    ItclVarLookup *vlookup;

    /*
     *  See if the requested variable is a recognized "common" member.
     *  If it is, make sure that access is allowed.
     */
    hPtr = Tcl_FindHashEntry(&iclsPtr->resolveVars, name);
    if (hPtr) {
        vlookup = (ItclVarLookup*)Tcl_GetHashValue(hPtr);

        if ((vlookup->ivPtr->flags & ITCL_COMMON) != 0) {
            if (!vlookup->accessible) {
                Tcl_AppendResult(interp,
                    "can't access \"", name, "\": ",
                    Itcl_ProtectionStr(vlookup->ivPtr->protection),
                    " variable",
                    (char*)NULL);
                return TCL_ERROR;
            }
	    hPtr = Tcl_FindHashEntry(&vlookup->ivPtr->iclsPtr->classCommons,
	        (char *)vlookup->ivPtr);
	    if (hPtr != NULL) {
                *rPtr = Tcl_GetHashValue(hPtr);
                return TCL_OK;
	    }
        }
    }

    /*
     *  If the variable is not recognized, return TCL_CONTINUE and
     *  let lookup continue via the normal name resolution rules.
     *  This is important for variables like "errorInfo"
     *  that might get set while the parser namespace is active.
     */
    return TCL_CONTINUE;
}
开发者ID:TasmanS,项目名称:BusApp,代码行数:50,代码来源:itclResolve2.c

示例5: Tk_GetImageMasterData

ClientData
Tk_GetImageMasterData(
    Tcl_Interp *interp,		/* Interpreter in which the image was
				 * created. */
    const char *name,		/* Name of image. */
    const Tk_ImageType **typePtrPtr)
				/* Points to location to fill in with pointer
				 * to type information for image. */
{
    TkWindow *winPtr = (TkWindow *) Tk_MainWindow(interp);
    Tcl_HashEntry *hPtr;
    ImageMaster *masterPtr;

    hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, name);
    if (hPtr == NULL) {
	*typePtrPtr = NULL;
	return NULL;
    }
    masterPtr = Tcl_GetHashValue(hPtr);
    if (masterPtr->deleted) {
	*typePtrPtr = NULL;
	return NULL;
    }
    *typePtrPtr = masterPtr->typePtr;
    return masterPtr->masterData;
}
开发者ID:tcltk,项目名称:tk,代码行数:26,代码来源:tkImage.c

示例6: 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);
}
开发者ID:recri,项目名称:keyer,代码行数:25,代码来源:dbusMain.c

示例7: FindTag

static TkTextTag *
FindTag(
    Tcl_Interp *interp,		/* Interpreter to use for error message; if
				 * NULL, then don't record an error
				 * message. */
    TkText *textPtr,		/* Widget in which tag is being used. */
    Tcl_Obj *tagName)		/* Name of desired tag. */
{
    Tcl_HashEntry *hPtr;
    int len;
    const char *str;

    str = Tcl_GetStringFromObj(tagName, &len);
    if (len == 3 && !strcmp(str, "sel")) {
	return textPtr->selTagPtr;
    }
    hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable,
	    Tcl_GetString(tagName));
    if (hPtr != NULL) {
	return Tcl_GetHashValue(hPtr);
    }
    if (interp != NULL) {
	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		"tag \"%s\" isn't defined in text widget",
		Tcl_GetString(tagName)));
	Tcl_SetErrorCode(interp, "TK", "LOOKUP", "TEXT_TAG",
		Tcl_GetString(tagName), NULL);
    }
    return NULL;
}
开发者ID:AlexShiLucky,项目名称:bitkeeper,代码行数:30,代码来源:tkTextTag.c

示例8: AtomInit

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);
    }
}
开发者ID:lmiadowicz,项目名称:tk,代码行数:28,代码来源:tkAtom.c

示例9: IvySendDirectCmd

static int
IvySendDirectCmd(ClientData	clientData,
		 Tcl_Interp	*interp,
		 int		argc,
		 const char	**argv)
{
  Tcl_HashEntry	*entry;
  unsigned long	id;
  char		*end;

  if (argc != 4) {
    Tcl_AppendResult(interp, "wrong # of args: \"",
		     argv[0], " appName id msg\"", (char *) NULL);
    return TCL_ERROR;    
  }

  entry = Tcl_FindHashEntry(&app_table, argv[1]);
  if (!entry) {
    Tcl_AppendResult(interp, "Application \"",
		     argv[1], "\" not connected", (char *) NULL);
    return TCL_ERROR;    
  }
  
  id = strtol(argv[2], &end, 10);
  if (*end) {
    Tcl_AppendResult(interp, argv[0], " wrong id: \"", argv[2],
		     (char *) NULL);
    return TCL_ERROR;
  }

  IvySendDirectMsg((IvyClientPtr) Tcl_GetHashValue(entry), id, (char*)argv[3]);
  
  return TCL_OK;
}
开发者ID:ArchAssault-Project,项目名称:ivy-c,代码行数:34,代码来源:ivytcl.c

示例10: Tk_NameOfCursor

CONST char *
Tk_NameOfCursor(
    Display *display,		/* Display for which cursor was allocated. */
    Tk_Cursor cursor)		/* Identifier for cursor whose name is
				 * wanted. */
{
    Tcl_HashEntry *idHashPtr;
    TkCursor *cursorPtr;
    TkDisplay *dispPtr;

    dispPtr = TkGetDisplay(display);

    if (!dispPtr->cursorInit) {
    printid:
	sprintf(dispPtr->cursorString, "cursor id %p", cursor);
	return dispPtr->cursorString;
    }
    idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, (char *) cursor);
    if (idHashPtr == NULL) {
	goto printid;
    }
    cursorPtr = (TkCursor *) Tcl_GetHashValue(idHashPtr);
    if (cursorPtr->otherTable != &dispPtr->cursorNameTable) {
	goto printid;
    }
    return cursorPtr->hashPtr->key.string;
}
开发者ID:AbaqusPowerUsers,项目名称:AbaqusPythonScripts,代码行数:27,代码来源:tkCursor.c

示例11: IvyApplicationHostCmd

static int
IvyApplicationHostCmd(ClientData	clientData,
		      Tcl_Interp	*interp,
		      int		argc,
		      const char	**argv)
{
  Tcl_HashEntry	 *entry;

  if (argc != 2) {
    Tcl_AppendResult(interp, "wrong # of args: \"",
		     argv[0], " appName\"", (char *) NULL);
    return TCL_ERROR;    
  }

  entry = Tcl_FindHashEntry(&app_table, argv[1]);
  if (!entry) {
    Tcl_AppendResult(interp, "Application \"",
		     argv[1], "\" not connected", (char *) NULL);
    return TCL_ERROR;    
  }

  Tcl_SetResult(interp, (char *) IvyGetApplicationHost((IvyClientPtr) Tcl_GetHashValue(entry)),
		TCL_STATIC);
  
  return TCL_OK;
}
开发者ID:ArchAssault-Project,项目名称:ivy-c,代码行数:26,代码来源:ivytcl.c

示例12: Ns_GetMimeType

char *
Ns_GetMimeType(char *file)
{
    char          *start, *ext;
    Ns_DString     ds;
    Tcl_HashEntry *hePtr;

    start = strrchr(file, '/');
    if (start == NULL) {
	start = file;
    }

    ext = strrchr(start, '.');
    if (ext == NULL) {
	return noextType;
    }

    Ns_DStringInit(&ds);
    ext = LowerDString(&ds, ext);
    hePtr = Tcl_FindHashEntry(&types, ext);
    if (hePtr == NULL) {
	return defaultType;
    }
    return Tcl_GetHashValue(hePtr);
}
开发者ID:0xabad1dea,项目名称:aolserver,代码行数:25,代码来源:mimetypes.c

示例13: 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;
}
开发者ID:AppliedLogicSystems,项目名称:ALSProlog,代码行数:25,代码来源:tcl_interface.c

示例14: FindSigMapEntry

SignalMapEntry *
FindSigMapEntry (
    SignalMap *sigmapPtr,
    int signum)
{
    return Tcl_FindHashEntry(sigmapPtr, WORDKEY(signum));
}
开发者ID:kostix,项目名称:posix-signal,代码行数:7,代码来源:sigmap.c

示例15: StyleElementCreateCmd

/* + style element create name type ? ...args ?
 */
static int StyleElementCreateCmd(
    ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
    StylePackageData *pkgPtr = clientData;
    Ttk_Theme theme = pkgPtr->currentTheme;
    const char *elementName, *factoryName;
    Tcl_HashEntry *entryPtr;
    FactoryRec *recPtr;

    if (objc < 5) {
	Tcl_WrongNumArgs(interp, 3, objv, "name type ?-option value ...?");
	return TCL_ERROR;
    }

    elementName = Tcl_GetString(objv[3]);
    factoryName = Tcl_GetString(objv[4]);

    entryPtr = Tcl_FindHashEntry(&pkgPtr->factoryTable, factoryName);
    if (!entryPtr) {
	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		"No such element type %s", factoryName));
	Tcl_SetErrorCode(interp, "TTK", "LOOKUP", "ELEMENT_TYPE", factoryName,
		NULL);
	return TCL_ERROR;
    }

    recPtr = Tcl_GetHashValue(entryPtr);

    return recPtr->factory(interp, recPtr->clientData,
	    theme, elementName, objc - 5, objv + 5);
}
开发者ID:afmayer,项目名称:tcl-tk,代码行数:33,代码来源:ttkTheme.c


注:本文中的Tcl_FindHashEntry函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。