Agraph_t *g;
Agedge_t **ep, *e;
Agsym_t *a;
- mycontext_t *mycontext = (mycontext_t *)clientData;
- GVC_t *gvc = mycontext->gvc;
+ ictx_t *ictx = (ictx_t *)clientData;
+ GVC_t *gvc = ictx->gvc;
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
NULL);
return TCL_ERROR;
}
- if (!(ep = (Agedge_t **) tclhandleXlate(mycontext->edgeTblPtr, argv[0]))) {
+ if (!(ep = (Agedge_t **) tclhandleXlate(ictx->edgeTblPtr, argv[0]))) {
Tcl_AppendResult(interp, " \"", argv[0], "\"", NULL);
return TCL_ERROR;
}
if ((c == 'd') && (strncmp(argv[1], "delete", length) == 0)) {
#ifndef WITH_CGRAPH
- tclhandleFreeIndex(mycontext->edgeTblPtr, AGID(e));
+ tclhandleFreeIndex(ictx->edgeTblPtr, AGID(e));
Tcl_DeleteCommand(interp, argv[0]);
#endif
agdelete(g, e);
return TCL_OK;
} else if ((c == 'l') && (strncmp(argv[1], "listnodes", length) == 0)) {
- tclhandleString(mycontext->nodeTblPtr, buf, AGID(agtail(e)));
+ tclhandleString(ictx->nodeTblPtr, buf, AGID(agtail(e)));
Tcl_AppendElement(interp, buf);
- tclhandleString(mycontext->nodeTblPtr, buf, AGID(aghead(e)));
+ tclhandleString(ictx->nodeTblPtr, buf, AGID(aghead(e)));
Tcl_AppendElement(interp, buf);
return TCL_OK;
char c, buf[256], **argv2;
int i, j, length, argc2, rc;
unsigned long id;
- mycontext_t *mycontext = (mycontext_t *)clientData;
- GVC_t *gvc = mycontext->gvc;
+ ictx_t *ictx = (ictx_t *)clientData;
+ GVC_t *gvc = ictx->gvc;
GVJ_t *job = gvc->job;
if (argc < 2) {
NULL);
return TCL_ERROR;
}
- if (!(gp = (Agraph_t **) tclhandleXlate(mycontext->graphTblPtr, argv[0]))) {
+ if (!(gp = (Agraph_t **) tclhandleXlate(ictx->graphTblPtr, argv[0]))) {
Tcl_AppendResult(interp, " \"", argv[0], "\"", NULL);
return TCL_ERROR;
}
NULL);
return TCL_ERROR;
}
- if (!(np = (Agnode_t **) tclhandleXlate(mycontext->nodeTblPtr, argv[2]))) {
+ if (!(np = (Agnode_t **) tclhandleXlate(ictx->nodeTblPtr, argv[2]))) {
if (!(tail = agfindnode(g, argv[2]))) {
Tcl_AppendResult(interp, "Tail node \"", argv[2],
"\" not found.", NULL);
return TCL_ERROR;
}
}
- if (!(np = (Agnode_t **) tclhandleXlate(mycontext->nodeTblPtr, argv[3]))) {
+ if (!(np = (Agnode_t **) tclhandleXlate(ictx->nodeTblPtr, argv[3]))) {
if (!(head = agfindnode(g, argv[3]))) {
Tcl_AppendResult(interp, "Head node \"", argv[3],
"\" not found.", NULL);
#else
e = agedge(g, tail, head);
#endif
- if (!(ep = (Agedge_t **) tclhandleXlateIndex(mycontext->edgeTblPtr, AGID(e))) || *ep != e) {
- ep = (Agedge_t **) tclhandleAlloc(mycontext->edgeTblPtr, Tcl_GetStringResult(interp), &id);
+ if (!(ep = (Agedge_t **) tclhandleXlateIndex(ictx->edgeTblPtr, AGID(e))) || *ep != e) {
+ ep = (Agedge_t **) tclhandleAlloc(ictx->edgeTblPtr, Tcl_GetStringResult(interp), &id);
*ep = e;
AGID(e) = id;
#ifndef TCLOBJ
Tcl_CreateCommand(interp, Tcl_GetStringResult(interp), edgecmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#else /* TCLOBJ */
Tcl_CreateObjCommand(interp, Tcl_GetStringResult(interp), edgecmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#endif /* TCLOBJ */
} else {
- tclhandleString(mycontext->edgeTblPtr, Tcl_GetStringResult(interp), AGID(e));
+ tclhandleString(ictx->edgeTblPtr, Tcl_GetStringResult(interp), AGID(e));
}
setedgeattributes(agroot(g), e, &argv[4], argc - 4);
reset_layout(gvc, g);
n = agnode(g, argv[2], 1);
#else
n = agnode(g, argv[2]);
- if (!(np = (Agnode_t **) tclhandleXlateIndex(mycontext->nodeTblPtr, AGID(n))) || *np != n) {
- np = (Agnode_t **) tclhandleAlloc(mycontext->nodeTblPtr, Tcl_GetStringResult(interp), &id);
+ if (!(np = (Agnode_t **) tclhandleXlateIndex(ictx->nodeTblPtr, AGID(n))) || *np != n) {
+ np = (Agnode_t **) tclhandleAlloc(ictx->nodeTblPtr, Tcl_GetStringResult(interp), &id);
*np = n;
AGID(n) = id;
#ifndef TCLOBJ
Tcl_CreateCommand(interp, Tcl_GetStringResult(interp), nodecmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#else /* TCLOBJ */
Tcl_CreateObjCommand(interp, Tcl_GetStringResult(interp), nodecmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#endif /* TCLOBJ */
} else {
- tclhandleString(mycontext->nodeTblPtr, Tcl_GetStringResult(interp), AGID(n));
+ tclhandleString(ictx->nodeTblPtr, Tcl_GetStringResult(interp), AGID(n));
}
#endif
i = 3;
#ifdef WITH_CGRAPH
n = agnode(g, Tcl_GetStringResult(interp), 1);
#else
- np = (Agnode_t **) tclhandleAlloc(mycontext->nodeTblPtr, Tcl_GetStringResult(interp), &id);
+ np = (Agnode_t **) tclhandleAlloc(ictx->nodeTblPtr, Tcl_GetStringResult(interp), &id);
n = agnode(g, Tcl_GetStringResult(interp));
*np = n;
AGID(n) = id;
#ifndef TCLOBJ
Tcl_CreateCommand(interp, Tcl_GetStringResult(interp), nodecmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#else /* TCLOBJ */
Tcl_CreateObjCommand(interp, Tcl_GetStringResult(interp), nodecmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#endif /* TCLOBJ */
#endif
i = 2;
}
#ifdef WITH_CGRAPH
- np = (Agnode_t **)tclhandleXlateIndex(mycontext->nodeTblPtr, AGID(n));
+ np = (Agnode_t **)tclhandleXlateIndex(ictx->nodeTblPtr, AGID(n));
*np = n;
#endif
setnodeattributes(agroot(g), n, &argv[i], argc - i);
sg = agsubg(g, argv[2], 1);
#else
sg = agsubg(g, argv[2]);
- if (! (sgp = (Agraph_t **) tclhandleXlateIndex(mycontext->graphTblPtr, AGID(sg))) || *sgp != sg) {
- sgp = (Agraph_t **) tclhandleAlloc(mycontext->graphTblPtr, Tcl_GetStringResult(interp), &id);
+ if (! (sgp = (Agraph_t **) tclhandleXlateIndex(ictx->graphTblPtr, AGID(sg))) || *sgp != sg) {
+ sgp = (Agraph_t **) tclhandleAlloc(ictx->graphTblPtr, Tcl_GetStringResult(interp), &id);
*sgp = sg;
AGID(sg) = id;
#ifndef TCLOBJ
Tcl_CreateCommand(interp, Tcl_GetStringResult(interp), graphcmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#else
Tcl_CreateObjCommand(interp, Tcl_GetStringResult(interp), graphcmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#endif
} else {
- tclhandleString(mycontext->graphTblPtr, Tcl_GetStringResult(interp), AGID(sg));
+ tclhandleString(ictx->graphTblPtr, Tcl_GetStringResult(interp), AGID(sg));
}
#endif
i = 3;
#ifdef WITH_CGRAPH
sg = agsubg(g, Tcl_GetStringResult(interp), 1);
#else
- sgp = (Agraph_t **) tclhandleAlloc(mycontext->graphTblPtr, Tcl_GetStringResult(interp), &id);
+ sgp = (Agraph_t **) tclhandleAlloc(ictx->graphTblPtr, Tcl_GetStringResult(interp), &id);
sg = agsubg(g, Tcl_GetStringResult(interp));
*sgp = sg;
AGID(sg) = id;
#ifndef TCLOBJ
Tcl_CreateCommand(interp, Tcl_GetStringResult(interp), graphcmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#else
Tcl_CreateObjCommand(interp, Tcl_GetStringResult(interp), graphcmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#endif
#endif
i = 2;
}
#ifdef WITH_CGRAPH
- sgp = (Agraph_t **)tclhandleXlateIndex(mycontext->graphTblPtr, AGID(sg));
+ sgp = (Agraph_t **)tclhandleXlateIndex(ictx->graphTblPtr, AGID(sg));
*sgp = sg;
#endif
setgraphattributes(sg, &argv[i], argc - i);
} else if ((c == 'd') && (strncmp(argv[1], "delete", length) == 0)) {
reset_layout(gvc, g);
#ifndef WITH_CGRAPH
- deleteNodes(mycontext, g);
- deleteGraph(mycontext, g);
+ deleteNodes(ictx, g);
+ deleteGraph(ictx, g);
#else
deleteNodes(g);
deleteGraph(g);
Tcl_AppendResult(interp, "Edge \"", argv[2], " - ", argv[3], "\" not found.", NULL);
return TCL_ERROR;
}
- tclhandleString(mycontext->edgeTblPtr, buf, AGID(e));
+ tclhandleString(ictx->edgeTblPtr, buf, AGID(e));
Tcl_AppendElement(interp, buf);
return TCL_OK;
Tcl_AppendResult(interp, "Node not found.", NULL);
return TCL_ERROR;
}
- tclhandleString(mycontext->nodeTblPtr, buf, AGID(n));
+ tclhandleString(ictx->nodeTblPtr, buf, AGID(n));
Tcl_AppendResult(interp, buf, NULL);
return TCL_OK;
} else if ((c == 'l') && (strncmp(argv[1], "listedges", length) == 0)) {
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
- tclhandleString(mycontext->edgeTblPtr, buf, AGID(e));
+ tclhandleString(ictx->edgeTblPtr, buf, AGID(e));
Tcl_AppendElement(interp, buf);
}
}
} else if ((c == 'l') && (strncmp(argv[1], "listnodes", length) == 0)) {
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- tclhandleString(mycontext->nodeTblPtr, buf, AGID(n));
+ tclhandleString(ictx->nodeTblPtr, buf, AGID(n));
Tcl_AppendElement(interp, buf);
}
return TCL_OK;
} else if ((c == 'l')
&& (strncmp(argv[1], "listnodesrev", length) == 0)) {
for (n = aglstnode(g); n; n = agprvnode(g, n)) {
- tclhandleString(mycontext->nodeTblPtr, buf, AGID(n));
+ tclhandleString(ictx->nodeTblPtr, buf, AGID(n));
Tcl_AppendElement(interp, buf);
}
return TCL_OK;
&& (strncmp(argv[1], "listsubgraphs", length) == 0)) {
#ifdef WITH_CGRAPH
for (sg = agfstsubg(g); sg; sg = agnxtsubg(sg)) {
- tclhandleString(mycontext->graphTblPtr, buf, AGID(sg));
+ tclhandleString(ictx->graphTblPtr, buf, AGID(sg));
Tcl_AppendElement(interp, buf);
}
#else
for (e = agfstout(g->meta_node->graph, g->meta_node); e;
e = agnxtout(g->meta_node->graph, e)) {
sg = agusergraph(aghead(e));
- tclhandleString(mycontext->graphTblPtr, buf, AGID(sg));
+ tclhandleString(ictx->graphTblPtr, buf, AGID(sg));
Tcl_AppendElement(interp, buf);
}
}
Agnode_t **np, *n, *head;
Agedge_t **ep, *e;
Agsym_t *a;
- mycontext_t *mycontext = (mycontext_t *)clientData;
- GVC_t *gvc = mycontext->gvc;
+ ictx_t *ictx = (ictx_t *)clientData;
+ GVC_t *gvc = ictx->gvc;
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
NULL);
return TCL_ERROR;
}
- if (!(np = (Agnode_t **) tclhandleXlate(mycontext->nodeTblPtr, argv[0]))) {
+ if (!(np = (Agnode_t **) tclhandleXlate(ictx->nodeTblPtr, argv[0]))) {
Tcl_AppendResult(interp, " \"", argv[0], "\"", NULL);
return TCL_ERROR;
}
NULL);
return TCL_ERROR;
}
- if (!(np = (Agnode_t **) tclhandleXlate(mycontext->nodeTblPtr, argv[2]))) {
+ if (!(np = (Agnode_t **) tclhandleXlate(ictx->nodeTblPtr, argv[2]))) {
if (!(head = agfindnode(g, argv[2]))) {
Tcl_AppendResult(interp, "Head node \"", argv[2],
"\" not found.", NULL);
e = agedge(g, n, head);
#endif
if (!
- (ep = (Agedge_t **) tclhandleXlateIndex(mycontext->edgeTblPtr, AGID(e)))
+ (ep = (Agedge_t **) tclhandleXlateIndex(ictx->edgeTblPtr, AGID(e)))
|| *ep != e) {
- ep = (Agedge_t **) tclhandleAlloc(mycontext->edgeTblPtr, Tcl_GetStringResult(interp),
+ ep = (Agedge_t **) tclhandleAlloc(ictx->edgeTblPtr, Tcl_GetStringResult(interp),
&id);
*ep = e;
AGID(e) = id;
#ifndef TCLOBJ
Tcl_CreateCommand(interp, Tcl_GetStringResult(interp), edgecmd,
- (ClientData) mycontext,
+ (ClientData) ictx,
(Tcl_CmdDeleteProc *) NULL);
#else /* TCLOBJ */
Tcl_CreateObjCommand(interp, Tcl_GetStringResult(interp), edgecmd,
- (ClientData) mycontext,
+ (ClientData) ictx,
(Tcl_CmdDeleteProc *) NULL);
#endif /* TCLOBJ */
} else {
- tclhandleString(mycontext->edgeTblPtr, Tcl_GetStringResult(interp), AGID(e));
+ tclhandleString(ictx->edgeTblPtr, Tcl_GetStringResult(interp), AGID(e));
}
setedgeattributes(agroot(g), e, &argv[3], argc - 3);
reset_layout(gvc, g);
} else if ((c == 'd') && (strncmp(argv[1], "delete", length) == 0)) {
#ifndef WITH_CGRAPH
- deleteEdges(mycontext, g, n);
- tclhandleFreeIndex(mycontext->nodeTblPtr, AGID(n));
+ deleteEdges(ictx, g, n);
+ tclhandleFreeIndex(ictx->nodeTblPtr, AGID(n));
Tcl_DeleteCommand(interp, argv[0]);
#else
deleteEdges(g, n);
return TCL_ERROR;
}
if (!(e = agfindedge(g, n, head))) {
- tclhandleString(mycontext->nodeTblPtr, buf, AGID(head));
+ tclhandleString(ictx->nodeTblPtr, buf, AGID(head));
Tcl_AppendResult(interp, "Edge \"", argv[0],
" - ", buf, "\" not found.", NULL);
return TCL_ERROR;
}
- tclhandleString(mycontext->edgeTblPtr, buf, AGID(e));
+ tclhandleString(ictx->edgeTblPtr, buf, AGID(e));
Tcl_AppendElement(interp, buf);
return TCL_OK;
} else if ((c == 'l') && (strncmp(argv[1], "listedges", length) == 0)) {
for (e = agfstedge(g, n); e; e = agnxtedge(g, e, n)) {
- tclhandleString(mycontext->edgeTblPtr, buf, AGID(e));
+ tclhandleString(ictx->edgeTblPtr, buf, AGID(e));
Tcl_AppendElement(interp, buf);
}
return TCL_OK;
} else if ((c == 'l')
&& (strncmp(argv[1], "listinedges", length) == 0)) {
for (e = agfstin(g, n); e; e = agnxtin(g, e)) {
- tclhandleString(mycontext->edgeTblPtr, buf, AGID(e));
+ tclhandleString(ictx->edgeTblPtr, buf, AGID(e));
Tcl_AppendElement(interp, buf);
}
return TCL_OK;
} else if ((c == 'l')
&& (strncmp(argv[1], "listoutedges", length) == 0)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
- tclhandleString(mycontext->edgeTblPtr, buf, AGID(e));
+ tclhandleString(ictx->edgeTblPtr, buf, AGID(e));
Tcl_AppendElement(interp, buf);
}
return TCL_OK;
}
}
#else
-void deleteEdges(mycontext_t * mycontext, Agraph_t * g, Agnode_t * n)
+void deleteEdges(ictx_t * ictx, Agraph_t * g, Agnode_t * n)
{
Agedge_t **ep, *e, *e1;
char buf[16];
e = agfstedge(g, n);
while (e) {
- tclhandleString(mycontext->edgeTblPtr, buf, AGID(e));
- Tcl_DeleteCommand(mycontext->interp, buf);
- ep = (Agedge_t **) tclhandleXlateIndex(mycontext->edgeTblPtr, AGID(e));
+ tclhandleString(ictx->edgeTblPtr, buf, AGID(e));
+ Tcl_DeleteCommand(ictx->interp, buf);
+ ep = (Agedge_t **) tclhandleXlateIndex(ictx->edgeTblPtr, AGID(e));
if (!ep)
fprintf(stderr, "Bad entry in edgeTbl\n");
- tclhandleFreeIndex(mycontext->edgeTblPtr, AGID(e));
+ tclhandleFreeIndex(ictx->edgeTblPtr, AGID(e));
e1 = agnxtedge(g, e, n);
agdelete(agroot(g), e);
e = e1;
}
}
-void deleteNodes(mycontext_t * mycontext, Agraph_t * g)
+void deleteNodes(ictx_t * ictx, Agraph_t * g)
{
Agnode_t **np, *n, *n1;
char buf[16];
n = agfstnode(g);
while (n) {
- tclhandleString(mycontext->nodeTblPtr, buf, AGID(n));
- Tcl_DeleteCommand(mycontext->interp, buf);
- np = (Agnode_t **) tclhandleXlateIndex(mycontext->nodeTblPtr, AGID(n));
+ tclhandleString(ictx->nodeTblPtr, buf, AGID(n));
+ Tcl_DeleteCommand(ictx->interp, buf);
+ np = (Agnode_t **) tclhandleXlateIndex(ictx->nodeTblPtr, AGID(n));
if (!np)
fprintf(stderr, "Bad entry in nodeTbl\n");
- tclhandleFreeIndex(mycontext->nodeTblPtr, AGID(n));
- deleteEdges(mycontext, agroot(g), n);
+ tclhandleFreeIndex(ictx->nodeTblPtr, AGID(n));
+ deleteEdges(ictx, agroot(g), n);
n1 = agnxtnode(g, n);
agdelete(agroot(g), n);
n = n1;
}
}
-void deleteGraph(mycontext_t * mycontext, Agraph_t * g)
+void deleteGraph(ictx_t * ictx, Agraph_t * g)
{
Agraph_t **sgp;
Agedge_t *e;
if (g->meta_node) {
for (e = agfstout(g->meta_node->graph, g->meta_node); e;
e = agnxtout(g->meta_node->graph, e)) {
- deleteGraph(mycontext, agusergraph(aghead(e)));
+ deleteGraph(ictx, agusergraph(aghead(e)));
}
- tclhandleString(mycontext->graphTblPtr, buf, AGID(g));
- Tcl_DeleteCommand(mycontext->interp, buf);
- sgp = (Agraph_t **) tclhandleXlateIndex(mycontext->graphTblPtr, AGID(g));
+ tclhandleString(ictx->graphTblPtr, buf, AGID(g));
+ Tcl_DeleteCommand(ictx->interp, buf);
+ sgp = (Agraph_t **) tclhandleXlateIndex(ictx->graphTblPtr, AGID(g));
if (!sgp)
fprintf(stderr, "Bad entry in graphTbl\n");
- tclhandleFreeIndex(mycontext->graphTblPtr, AGID(g));
+ tclhandleFreeIndex(ictx->graphTblPtr, AGID(g));
if (g == agroot(g)) {
agclose(g);
} else {
return (void *)disc;
}
static long myiddisc_map(void *state, int objtype, char *str, unsigned long *id, int createflag) {
- mycontext_t *mycontext = (mycontext_t *)state;
- Tcl_Interp *interp = mycontext->interp;
+ ictx_t *ictx = (ictx_t *)state;
+ Tcl_Interp *interp = ictx->interp;
Tcl_CmdProc *proc = NULL;
void *tclhandleTblPtr = NULL;
int rc = 1; // init to success
switch (objtype) {
- case AGRAPH: tclhandleTblPtr = mycontext->graphTblPtr; proc = graphcmd; break;
- case AGNODE: tclhandleTblPtr = mycontext->nodeTblPtr; proc = nodecmd; break;
+ case AGRAPH: tclhandleTblPtr = ictx->graphTblPtr; proc = graphcmd; break;
+ case AGNODE: tclhandleTblPtr = ictx->nodeTblPtr; proc = nodecmd; break;
case AGINEDGE:
- case AGOUTEDGE: tclhandleTblPtr = mycontext->edgeTblPtr; proc=edgecmd; break;
+ case AGOUTEDGE: tclhandleTblPtr = ictx->edgeTblPtr; proc=edgecmd; break;
}
if (createflag) {
tclhandleAlloc(tclhandleTblPtr, Tcl_GetStringResult(interp), id);
#ifndef TCLOBJ
- Tcl_CreateCommand(interp, Tcl_GetStringResult(interp), proc, (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateCommand(interp, Tcl_GetStringResult(interp), proc, (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#else
- Tcl_CreateObjCommand(interp, Tcl_GetStringResult(interp), proc, (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, Tcl_GetStringResult(interp), proc, (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#endif
}
else {
return rc;
}
static long myiddisc_alloc(void *state, int objtype, unsigned long id) {
-// mycontext_t *mycontext = (mycontext_t *)state;
+// ictx_t *ictx = (ictx_t *)state;
switch (objtype) {
case AGRAPH: break;
return 0;
}
static void myiddisc_free(void *state, int objtype, unsigned long id) {
- mycontext_t *mycontext = (mycontext_t *)state;
- Tcl_Interp *interp = mycontext->interp;
+ ictx_t *ictx = (ictx_t *)state;
+ Tcl_Interp *interp = ictx->interp;
char buf[32];
void *tclhandleTblePtr = NULL;
switch (objtype) {
- case AGRAPH: tclhandleTblePtr = mycontext->graphTblPtr; break;
- case AGNODE: tclhandleTblePtr = mycontext->nodeTblPtr; break;
+ case AGRAPH: tclhandleTblePtr = ictx->graphTblPtr; break;
+ case AGNODE: tclhandleTblePtr = ictx->nodeTblPtr; break;
case AGINEDGE:
- case AGOUTEDGE: tclhandleTblePtr = mycontext->edgeTblPtr; break;
+ case AGOUTEDGE: tclhandleTblePtr = ictx->edgeTblPtr; break;
}
tclhandleString(tclhandleTblePtr, buf, id);
Tcl_DeleteCommand(interp, buf);
fprintf(stderr,"myiddisc_free: objtype %d, id %lu\n", objtype, id);
}
static char *myiddisc_print(void *state, int objtype, unsigned long id) {
-// mycontext_t *mycontext = (mycontext_t *)state;
+// ictx_t *ictx = (ictx_t *)state;
#if 0
static char buf[64];
switch (objtype) {
#endif
}
static void myiddisc_close(void *state) {
-// mycontext_t *mycontext = (mycontext_t *)state;
+// ictx_t *ictx = (ictx_t *)state;
fprintf(stderr,"myiddisc_close:\n");
}
static Agiddisc_t myiddisc = {
#endif /* TCLOBJ */
)
{
- mycontext_t *mycontext = (mycontext_t *)clientData;
+ ictx_t *ictx = (ictx_t *)clientData;
Agraph_t *g, **gp;
char c;
int i, length;
return TCL_ERROR;
}
#ifndef WITH_CGRAPH
- gp = (Agraph_t **) tclhandleAlloc(mycontext->graphTblPtr, Tcl_GetStringResult(interp), &id);
+ gp = (Agraph_t **) tclhandleAlloc(ictx->graphTblPtr, Tcl_GetStringResult(interp), &id);
#endif
if (argc % 2) {
/* if odd number of args then argv[2] is name */
#ifndef WITH_CGRAPH
g = agopen(argv[2], kind);
#else
- g = agopen(argv[2], kind, (Agdisc_t*)mycontext);
+ g = agopen(argv[2], kind, (Agdisc_t*)ictx);
#endif
i = 3;
} else {
#ifndef WITH_CGRAPH
g = agopen(Tcl_GetStringResult(interp), kind);
#else
- g = agopen(Tcl_GetStringResult(interp), kind, (Agdisc_t*)mycontext);
+ g = agopen(Tcl_GetStringResult(interp), kind, (Agdisc_t*)ictx);
#endif
i = 2;
}
*gp = g;
AGID(g) = id;
#else
- gp = (Agraph_t **)tclhandleXlateIndex(mycontext->graphTblPtr, AGID(g));
+ gp = (Agraph_t **)tclhandleXlateIndex(ictx->graphTblPtr, AGID(g));
*gp = g;
#endif
#ifndef WITH_CGRAPH
#ifndef TCLOBJ
Tcl_CreateCommand(interp, Tcl_GetStringResult(interp), graphcmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#else /* TCLOBJ */
Tcl_CreateObjCommand(interp, Tcl_GetStringResult(interp), graphcmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#endif /* TCLOBJ */
#endif
setgraphattributes(g, &argv[i], argc - i);
#ifdef WITH_CGRAPH
static void
-init_graphs (mycontext_t *mycontext, graph_t* g)
+init_graphs (ictx_t *ictx, graph_t* g)
{
Agraph_t *sg, **sgp;
unsigned long id;
char buf[16];
- Tcl_Interp *interp = mycontext->interp;
+ Tcl_Interp *interp = ictx->interp;
for (sg = agfstsubg (g); sg; sg = agnxtsubg (sg))
- init_graphs (mycontext, sg);
+ init_graphs (ictx, sg);
- sgp = (Agraph_t **) tclhandleAlloc(mycontext->graphTblPtr, buf, &id);
+ sgp = (Agraph_t **) tclhandleAlloc(ictx->graphTblPtr, buf, &id);
*sgp = g;
AGID(g) = id;
#ifndef TCLOBJ
- Tcl_CreateCommand(interp, buf, graphcmd, (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateCommand(interp, buf, graphcmd, (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#else /* TCLOBJ */
- Tcl_CreateObjCommand(interp, buf, graphcmd, (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, buf, graphcmd, (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#endif /* TCLOBJ */
if (agroot(g) == g)
Tcl_SetResult(interp, buf, TCL_VOLATILE);
* it to create the handles and tcl commands for each
* graph, subgraph, node, and edge.
*/
-static int tcldot_fixup(mycontext_t *mycontext, graph_t * g)
+static int tcldot_fixup(ictx_t *ictx, graph_t * g)
{
#ifndef WITH_CGRAPH
Agraph_t **gp, *sg, **sgp;
Agedge_t *e, **ep;
char buf[16];
unsigned long id;
- Tcl_Interp *interp = mycontext->interp;
+ Tcl_Interp *interp = ictx->interp;
#ifdef WITH_CGRAPH
- init_graphs (mycontext, g);
+ init_graphs (ictx, g);
#else
if (g->meta_node) {
for (n = agfstnode(g->meta_node->graph); n;
n = agnxtnode(g->meta_node->graph, n)) {
sg = agusergraph(n);
- sgp = (Agraph_t **) tclhandleAlloc(mycontext->graphTblPtr, buf, &id);
+ sgp = (Agraph_t **) tclhandleAlloc(ictx->graphTblPtr, buf, &id);
*sgp = sg;
AGID(sg) = id;
#ifndef TCLOBJ
- Tcl_CreateCommand(interp, buf, graphcmd, (ClientData) mycontext,
+ Tcl_CreateCommand(interp, buf, graphcmd, (ClientData) ictx,
(Tcl_CmdDeleteProc *) NULL);
#else /* TCLOBJ */
- Tcl_CreateObjCommand(interp, buf, graphcmd, (ClientData) mycontext,
+ Tcl_CreateObjCommand(interp, buf, graphcmd, (ClientData) ictx,
(Tcl_CmdDeleteProc *) NULL);
#endif /* TCLOBJ */
if (sg == g)
Tcl_SetResult(interp, buf, TCL_VOLATILE);
}
} else {
- gp = (Agraph_t **) tclhandleAlloc(mycontext->graphTblPtr, Tcl_GetStringResult(interp), &id);
+ gp = (Agraph_t **) tclhandleAlloc(ictx->graphTblPtr, Tcl_GetStringResult(interp), &id);
*gp = g;
AGID(g) = id;
#ifndef TCLOBJ
Tcl_CreateCommand(interp, Tcl_GetStringResult(interp), graphcmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#else /* TCLOBJ */
Tcl_CreateObjCommand(interp, Tcl_GetStringResult(interp), graphcmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#endif /* TCLOBJ */
}
#endif /* WITH_CGRAPH */
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- np = (Agnode_t **) tclhandleAlloc(mycontext->nodeTblPtr, buf, &id);
+ np = (Agnode_t **) tclhandleAlloc(ictx->nodeTblPtr, buf, &id);
*np = n;
AGID(n) = id;
#ifndef TCLOBJ
Tcl_CreateCommand(interp, buf, nodecmd,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#else /* TCLOBJ */
Tcl_CreateObjCommand(interp, buf, nodecmd,
(ClientData) gvc, (Tcl_CmdDeleteProc *) NULL);
#endif /* TCLOBJ */
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
- ep = (Agedge_t **) tclhandleAlloc(mycontext->edgeTblPtr, buf, &id);
+ ep = (Agedge_t **) tclhandleAlloc(ictx->edgeTblPtr, buf, &id);
*ep = e;
AGID(e) = id;
#ifndef TCLOBJ
- Tcl_CreateCommand(interp, buf, edgecmd, (ClientData) mycontext,
+ Tcl_CreateCommand(interp, buf, edgecmd, (ClientData) ictx,
(Tcl_CmdDeleteProc *) NULL);
#else /* TCLOBJ */
Tcl_CreateObjCommand(interp, buf, edgecmd, (ClientData) gvc,
Agraph_t *g;
Tcl_Channel channel;
int mode;
- mycontext_t *mycontext = (mycontext_t *)clientData;
+ ictx_t *ictx = (ictx_t *)clientData;
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
* so we make sure that it is initialized to "not done" */
GD_drawing(g) = NULL;
- return (tcldot_fixup(mycontext, g));
+ return (tcldot_fixup(ictx, g));
}
static int dotstring(ClientData clientData, Tcl_Interp * interp,
)
{
Agraph_t *g;
- mycontext_t *mycontext = (mycontext_t *)clientData;
+ ictx_t *ictx = (ictx_t *)clientData;
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " string\"", NULL);
* so we make sure that it is initialized to "not done" */
GD_drawing(g) = NULL;
- return (tcldot_fixup(mycontext, g));
+ return (tcldot_fixup(ictx, g));
}
#if defined(_BLD_tcldot) && defined(_DLL)
#endif
int Tcldot_Init(Tcl_Interp * interp)
{
- mycontext_t *mycontext;
+ ictx_t *ictx;
GVC_t *gvc;
- mycontext = calloc(1, sizeof(mycontext_t));
- if (!mycontext)
+ ictx = calloc(1, sizeof(ictx_t));
+ if (!ictx)
return TCL_ERROR;
- mycontext->interp = interp;
+ ictx->interp = interp;
#ifdef WITH_CGRAPH
- mycontext->mydisc.id = &myiddisc;
+ ictx->mydisc.id = &myiddisc;
#endif
#ifdef USE_TCL_STUBS
/* create a GraphViz Context and pass a pointer to it in clientdata */
gvc = gvNEWcontext(lt_preloaded_symbols, DEMAND_LOADING);
- mycontext->gvc = gvc;
+ ictx->gvc = gvc;
/* configure for available plugins */
gvconfig(gvc, FALSE);
#ifndef TCLOBJ
Tcl_CreateCommand(interp, "dotnew", dotnew,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp, "dotread", dotread,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp, "dotstring", dotstring,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#else /* TCLOBJ */
Tcl_CreateObjCommand(interp, "dotnew", dotnew,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "dotread", dotread,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "dotstring", dotstring,
- (ClientData) mycontext, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) ictx, (Tcl_CmdDeleteProc *) NULL);
#endif /* TCLOBJ */
#ifdef WITH_CGRAPH
- mycontext->graphTblPtr = (void *) tclhandleInit("tcldot", sizeof(graph_context_t *), 10);
+ ictx->graphTblPtr = (void *) tclhandleInit("tcldot", sizeof(gctx_t *), 10);
#else
- mycontext->graphTblPtr = (void *) tclhandleInit("graph", sizeof(Agraph_t *), 10);
- mycontext->nodeTblPtr = (void *) tclhandleInit("node", sizeof(Agnode_t *), 100);
- mycontext->edgeTblPtr = (void *) tclhandleInit("edge", sizeof(Agedge_t *), 100);
+ ictx->graphTblPtr = (void *) tclhandleInit("graph", sizeof(Agraph_t *), 10);
+ ictx->nodeTblPtr = (void *) tclhandleInit("node", sizeof(Agnode_t *), 100);
+ ictx->edgeTblPtr = (void *) tclhandleInit("edge", sizeof(Agedge_t *), 100);
#endif
return TCL_OK;
********* */
/*
- * mycontext - one per tcl interpreter, may support multiple graph namespaces
+ * ictx - one per tcl interpreter, may support multiple graph namespaces
*/
typedef struct {
#ifdef WITH_CGRAPH
- Agdisc_t mydisc; // must be first to allow casting mydisc to mycontext
+ Agdisc_t mydisc; // must be first to allow casting mydisc to ictx
#endif
void *graphTblPtr;
/* **FIXME** #ifndef WITH_CGRAPH */
/* #endif */
Tcl_Interp *interp;
GVC_t *gvc;
-} mycontext_t;
+} ictx_t;
#ifdef WITH_CGRAPH
/*
- * graph_context - one for each graph in a tcl interp
+ * gctx - one for each graph in a tcl interp
*/
typedef struct {
Agraph_t *g; /* the graph */
- mycontext_t *mycontext; /* refer back to top context */
-} graph_context_t;
+ ictx_t *ictx; /* refer back to top context */
+} gctx_t;
#endif
#if HAVE_LIBGD
extern void listEdgeAttrs (Tcl_Interp * interp, Agraph_t* g);
extern int mygets(void* channel, char *ubuf, int n);
#else
-extern void deleteEdges(mycontext_t * mycontext, Agraph_t * g, Agnode_t * n);
-extern void deleteNodes(mycontext_t * mycontext, Agraph_t * g);
-extern void deleteGraph(mycontext_t * mycontext, Agraph_t * g);
+extern void deleteEdges(ictx_t * ictx, Agraph_t * g, Agnode_t * n);
+extern void deleteNodes(ictx_t * ictx, Agraph_t * g);
+extern void deleteGraph(ictx_t * ictx, Agraph_t * g);
extern void listGraphAttrs (Tcl_Interp * interp, Agraph_t* g);
extern void listNodeAttrs (Tcl_Interp * interp, Agraph_t* g);
extern void listEdgeAttrs (Tcl_Interp * interp, Agraph_t* g);