do {
while (isspace(*pos))
pos++; /* skip white space */
- cnt++;
- while ((c = *pos) && !isspace(c) && (c != ';'))
- pos++; /* skip token */
+ if (c = *pos) { /* skip token */
+ cnt++;
+ while ((c = *pos) && !isspace(c) && (c != ';'))
+ pos++;
+ }
} while (isspace(c));
return cnt;
}
pp++;
n--;
}
+ while (isspace(*pos)) pos++;
if (*pos == '\0')
more = 0;
else
* is missing, init_nop will use a standard neato technique to
* supply it.
*/
-int init_nop(Agraph_t * g)
+int init_nop(Agraph_t * g, int adjust)
{
int i;
node_t *np;
nop_init_graphs(g, G_lp, G_bb);
posEdges = nop_init_edges(g);
- if (Nop == 1)
+ if (adjust && Nop == 1)
adjustNodes(g);
/* If G_bb not defined, define it */
/* At this point, all bounding boxes should be correctly defined.
* If necessary, we translate the graph to the origin.
*/
- if (GD_bb(g).LL.x || GD_bb(g).LL.y)
+ if (adjust && (GD_bb(g).LL.x || GD_bb(g).LL.y))
translate(g, posEdges);
- if (posEdges != AllEdges)
- spline_edges0(g);
- else {
+ if (!adjust) {
node_t *n;
- neato_set_aspect(g);
State = GVSPLINES;
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
ND_coord_i(n).x = POINTS(ND_pos(n)[0]);
ND_coord_i(n).y = POINTS(ND_pos(n)[1]);
}
}
+ else if (posEdges != AllEdges)
+ spline_edges0(g);
+ else {
+ State = GVSPLINES;
+ neato_set_aspect(g);
+ }
return 0;
}
neato_init_graph(g);
if (Nop) {
addZ (g);
- if (init_nop(g)) {
+ if (init_nop(g, 1)) {
agerr(AGPREV, "as required by the -n flag\n");
exit(1);
}
extern void makeSpline(edge_t *, Ppoly_t **, int, bool);
extern void make_spring(graph_t *, Agnode_t *, Agnode_t *, double);
extern void move_node(graph_t *, int, Agnode_t *);
- extern int init_nop(graph_t * g);
+ extern int init_nop(graph_t * g, int);
extern void neato_nodesize(node_t * n, bool flip);
extern void neato_cleanup(graph_t * g);
extern void neato_cleanup_edge(edge_t * e);
* allocate it in the root graph and the connected components.
*/
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- /* for (i = 0; (n = GD_neato_nlist(g)[i]); i++) { */
ND_pos(n)[0] = ND_pos(n)[0] * xf;
ND_pos(n)[1] = ND_pos(n)[1] * yf;
}
}
/* neato_set_aspect:
- * Sets aspect ration if necessary; real work done in _neato_set_aspect;
+ * Sets aspect ratio if necessary; real work done in _neato_set_aspect;
* This also copies the internal layout coordinates (ND_pos) to the
* external ones (ND_coord_i).
*/