1/* struct::tree - critcl - global declarations
2 */
3
4#include <global.h>
5#include <util.h>
6
7static void release (ClientData cd, Tcl_Interp* interp);
8
9#define KEY "tcllib/struct::graph/critcl"
10
11/* .................................................. */
12
13const char*
14gg_new (Tcl_Interp* interp)
15{
16  Tcl_InterpDeleteProc* proc = release;
17  GG* gg = Tcl_GetAssocData (interp, KEY, &proc);
18
19  if (gg == NULL) {
20    gg = ALLOC (GG);
21    gg->counter = 0;
22
23    Tcl_SetAssocData (interp, KEY, proc, (ClientData) gg);
24  }
25
26  gg->counter ++;
27  sprintf (gg->buf, "graph%d", gg->counter);
28  return gg->buf;
29}
30
31/* .................................................. */
32
33static void
34release (ClientData cd, Tcl_Interp* interp)
35{
36  /* ClientData cd <=> GG* gg */
37  ckfree((char*) cd);
38}
39
40/* .................................................. */
41
42
43/*
44 * Local Variables:
45 * mode: c
46 * c-basic-offset: 4
47 * fill-column: 78
48 * End:
49 */
50