-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathToglHash.cc
46 lines (31 loc) · 862 Bytes
/
ToglHash.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// ToglHash.cc keeps track of Togl widgets by name for PlyView
// created 5/29/98 magi
#include "ToglHash.h"
#include "togl.h"
//global exported via plvGlobals.h
ToglHash toglHash;
ToglHash::ToglHash()
{
Tcl_InitHashTable (&hashTable, TCL_STRING_KEYS);
}
ToglHash::~ToglHash()
{
Tcl_DeleteHashTable (&hashTable);
}
struct Togl* ToglHash::FindTogl (char* name)
{
//printf ("Looking for togl '%s'\n", name);
Tcl_HashEntry* hash = Tcl_FindHashEntry (&hashTable, name);
if (hash == NULL)
return NULL;
else
return (struct Togl*)Tcl_GetHashValue (hash);
}
void ToglHash::AddToHash (char* name, struct Togl* togl)
{
//printf ("Togl created, name '%s', ptr %x\n", name, togl);
int iNew;
Tcl_HashEntry* hash = Tcl_CreateHashEntry (&hashTable, name, &iNew);
if (hash != NULL)
Tcl_SetHashValue (hash, togl);
}