本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例14: FindSigMapEntry
SignalMapEntry *
FindSigMapEntry (
SignalMap *sigmapPtr,
int signum)
{
return Tcl_FindHashEntry(sigmapPtr, WORDKEY(signum));
}
示例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);
}