\fBdegree\fR : \fBint\fR
the degree of a node.
.TP
+\fBX\fR : \fBdouible\fR
+the X coordinate of a node. (Assumes the node has a \fIpos\fP attribute.)
+.TP
+\fBY\fR : \fBdouible\fR
+the Y coordinate of a node. (Assumes the node has a \fIpos\fP attribute.)
+.TP
\fBroot\fR : \fBgraph_t\fR
the root graph of an object. The root of a root graph
is itself.
return v;
}
+/* posOf:
+ * Get pos data from node; store x or y into v if successful and return 0;
+ * else return -1
+ */
+static int posOf(Agnode_t* np, int idx, double* v)
+{
+ static Agraph_t* root;
+ static Agsym_t* pos;
+ Agraph_t* nroot = agroot(np);
+ char* ps;
+ double p[2];
+
+ if (root != nroot) {
+ root = nroot;
+ pos = agattr(root, AGNODE, "pos", 0);
+ }
+ if (!pos) return -1;
+ ps = agxget(np, pos);
+ if (sscanf(ps, "%lf,%lf", &p[0], &p[1]) == 2) {
+ *v = p[idx];
+ return 0;
+ }
+ else return -1;
+
+}
+
#ifdef DEBUG
static char *symName(Expr_t * ex, int op)
{
return -1;
}
break;
+ case M_X:
+ if (AGTYPE(objp) == AGNODE) {
+ if (posOf ((Agnode_t *) objp, 0, &(v->floating)))
+ exerror("no x coordinate for node \"%s\"", agnameof(objp));
+ } else {
+ exerror("x coordinate of non-node");
+ return -1;
+ }
+ break;
+ case M_Y:
+ if (AGTYPE(objp) == AGNODE) {
+ if (posOf ((Agnode_t *) objp, 1, &(v->floating)))
+ exerror("no y coordinate for node \"%s\"", agnameof(objp));
+ } else {
+ exerror("x coordinate of non-node");
+ return -1;
+ }
+ break;
case M_parent:
if (AGTYPE(objp) == AGRAPH)
v->integer = PTR2INT(agparent((Agraph_t *) objp));
V_travtype "$tvtype" ID T_tvtyp 0 Y(TV)
V_ARGC "ARGC" ID INTEGER 0 Y(I)
M_degree "degree" ID INTEGER Y(V) Y(I)
+M_X "X" ID FLOATING Y(V) Y(F)
+M_Y "Y" ID FLOATING Y(V) Y(F)
M_head "head" ID T_node Y(E) Y(V)
M_tail "tail" ID T_node Y(E) Y(V)
M_name "name" ID STRING YALL Y(S)