25 Tcl_AppendResult(interp,
"wrong # args: should be \"", argv[0],
26 "\" option ?arg arg ...?",
NULL);
31 Tcl_AppendResult(interp,
"edge \"", argv[0],
"\" not found",
NULL);
36 if (
streq(
"delete", argv[1])) {
40 }
else if (
streq(
"listattributes", argv[1])) {
44 }
else if (
streq(
"listnodes", argv[1])) {
49 }
else if (
streq(
"queryattributes", argv[1])) {
50 for (i = 2; i < argc; i++) {
51 if (Tcl_SplitList(interp, argv[i], &argc2, (
const char ***)&argv2) !=
54 for (j = 0; j < argc2; j++) {
56 Tcl_AppendElement(interp,
agxget(e, a));
58 Tcl_AppendResult(interp,
"no attribute named \"", argv2[j],
"\"",
60 Tcl_Free((
char *)argv2);
64 Tcl_Free((
char *)argv2);
68 }
else if (
streq(
"queryattributevalues", argv[1])) {
69 for (i = 2; i < argc; i++) {
70 if (Tcl_SplitList(interp, argv[i], &argc2, (
const char ***)&argv2) !=
73 for (j = 0; j < argc2; j++) {
75 Tcl_AppendElement(interp, argv2[j]);
76 Tcl_AppendElement(interp,
agxget(e, a));
78 Tcl_AppendResult(interp,
"no attribute named \"", argv2[j],
"\"",
80 Tcl_Free((
char *)argv2);
84 Tcl_Free((
char *)argv2);
88 }
else if (
streq(
"setattributes", argv[1])) {
90 if (Tcl_SplitList(interp, argv[2], &argc2, (
const char ***)&argv2) !=
93 if ((argc2 == 0) || (argc2 % 2)) {
94 Tcl_AppendResult(interp,
"wrong # args: should be \"", argv[0],
95 "\" setattributes attributename attributevalue "
96 "?attributename attributevalue? ?...?",
98 Tcl_Free((
char *)argv2);
102 Tcl_Free((
char *)argv2);
104 if ((argc < 4) || (argc % 2)) {
105 Tcl_AppendResult(interp,
"wrong # args: should be \"", argv[0],
106 "\" setattributes attributename attributevalue "
107 "?attributename attributevalue? ?...?",
115 }
else if (
streq(
"showname", argv[1])) {
121 Tcl_AppendResult(interp,
"bad option \"", argv[1],
"\": must be one of:",
122 "\n\tdelete, listattributes, listnodes,",
123 "\n\tueryattributes, queryattributevalues,",
124 "\n\tsetattributes, showname",
NULL);
129int edgecmd(ClientData clientData, Tcl_Interp *interp,
int argc,
130 const char *argv[]) {
char * agxget(void *obj, Agsym_t *sym)
#define agfindedgeattr(g, a)
int agisdirected(Agraph_t *g)
Agraph_t * agraphof(void *obj)
char * agnameof(void *)
returns a string descriptor for the object.
Agraph_t * agroot(void *obj)
static bool streq(const char *a, const char *b)
are a and b equal?
static int edgecmd_internal(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
int edgecmd(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
void deleteEdge(gctx_t *gctx, Agraph_t *g, Agedge_t *e)
char * obj2cmd(void *obj)
void listEdgeAttrs(Tcl_Interp *interp, Agraph_t *g)
Agedge_t * cmd2e(const char *cmd)
void setedgeattributes(Agraph_t *g, Agedge_t *e, char *argv[], int argc)
void tcldot_argv_free(int argc, char *argv[])
free the strings pointed to by argv
char ** tcldot_argv_dup(int argc, const char *argv[])
duplicate the strings pointed to by argv as non-const strings