16 int edgecmd(ClientData clientData, Tcl_Interp * interp,
18 int argc,
char *argv[]
20 int argc, Tcl_Obj * CONST objv[]
25 int i, j, length, argc2;
32 Tcl_AppendResult(interp,
"Wrong # args: should be \"", argv[0],
"\" option ?arg arg ...?",
NULL);
37 Tcl_AppendResult(interp,
"Edge \"", argv[0],
"\" not found",
NULL);
43 length = strlen(argv[1]);
45 if ((c ==
'd') && (strncmp(argv[1],
"delete", length) == 0)) {
50 && (strncmp(argv[1],
"listattributes", length) == 0)) {
54 }
else if ((c ==
'l') && (strncmp(argv[1],
"listnodes", length) == 0)) {
60 && (strncmp(argv[1],
"queryattributes", length) == 0)) {
61 for (i = 2; i < argc; i++) {
63 (interp, argv[i], &argc2,
64 (
CONST84 char ***) &argv2) != TCL_OK)
66 for (j = 0; j < argc2; j++) {
68 Tcl_AppendElement(interp,
agxget(e, a));
70 Tcl_AppendResult(interp,
"No attribute named \"", argv2[j],
"\"",
NULL);
74 Tcl_Free((
char *) argv2);
78 }
else if ((c ==
'q') && (strncmp(argv[1],
"queryattributevalues", length) == 0)) {
79 for (i = 2; i < argc; i++) {
81 (interp, argv[i], &argc2,
82 (
CONST84 char ***) &argv2) != TCL_OK)
84 for (j = 0; j < argc2; j++) {
86 Tcl_AppendElement(interp, argv2[j]);
87 Tcl_AppendElement(interp,
agxget(e, a));
89 Tcl_AppendResult(interp,
"No attribute named \"", argv2[j],
"\"",
NULL);
93 Tcl_Free((
char *) argv2);
97 }
else if ((c ==
's') && (strncmp(argv[1],
"setattributes", length) == 0)) {
100 (interp, argv[2], &argc2,
101 (
CONST84 char ***) &argv2) != TCL_OK)
103 if ((argc2 == 0) || (argc2 % 2)) {
104 Tcl_AppendResult(interp,
"Wrong # args: should be \"", argv[0],
105 "\" setattributes attributename attributevalue ?attributename attributevalue? ?...?",
107 Tcl_Free((
char *) argv2);
111 Tcl_Free((
char *) argv2);
113 if ((argc < 4) || (argc % 2)) {
114 Tcl_AppendResult(interp,
"Wrong # args: should be \"", argv[0],
115 "\" setattributes attributename attributevalue ?attributename attributevalue? ?...?",
123 }
else if ((c ==
's') && (strncmp(argv[1],
"showname", length) == 0)) {
132 Tcl_AppendResult(interp,
"Bad option \"", argv[1],
133 "\": must be one of:",
134 "\n\tdelete, listattributes, listnodes,",
135 "\n\tueryattributes, queryattributevalues,",
136 "\n\tsetattributes, showname",
NULL);
char * obj2cmd(void *obj)
CGRAPH_API int agisdirected(Agraph_t *g)
int edgecmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
CGRAPH_API Agraph_t * agroot(void *obj)
void listEdgeAttrs(Tcl_Interp *interp, Agraph_t *g)
CGRAPH_API Agraph_t * agraphof(void *obj)
CGRAPH_API Agnode_t * agtail(Agedge_t *e)
CGRAPH_API Agnode_t * aghead(Agedge_t *e)
CGRAPH_API char * agnameof(void *)
Agedge_t * cmd2e(char *cmd)
void deleteEdge(gctx_t *gctx, Agraph_t *g, Agedge_t *e)
#define agfindedgeattr(g, a)
void setedgeattributes(Agraph_t *g, Agedge_t *e, char *argv[], int argc)
char * agxget(void *obj, Agsym_t *sym)