From 34b377f772cca5050ac72a6f34c9630c18f2c1e7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 28 Nov 2010 15:33:57 +0000 Subject: [PATCH] layout/redactgraph: new movfeatsplitnodesall which repeatedly splits until all are done; needed because a node may need to be split into more than two new nodes, and each iteration only splits a node in two --- layout/Makefile | 8 ++++---- layout/redactgraph.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/layout/Makefile b/layout/Makefile index 3ee291a..37d2860 100644 --- a/layout/Makefile +++ b/layout/Makefile @@ -76,10 +76,10 @@ NETPBM += -lnetpbm endif endif -REDACT= consistency movfeatsplitedges \ - consistency movfeatrmstubs \ - consistency movfeatsplitnodes \ - consistency trivpairnodes \ +REDACT= consistency movfeatsplitedges \ + consistency movfeatrmstubs \ + consistency movfeatsplitnodesall \ + consistency trivpairnodes \ consistency trivnullnodes subseg2display: subseg2display.o diff --git a/layout/redactgraph.c b/layout/redactgraph.c index e47532f..32d5221 100644 --- a/layout/redactgraph.c +++ b/layout/redactgraph.c @@ -506,11 +506,11 @@ static void movfeatrmstubs(void) { } while (anychange); } -static void movfeatsplitnodes(void) { +static int movfeatsplitnodes_once(void) { Node *node, *newnode; EdgeEnd *edgeend, *mate; Edge *edge; - int side; + int side, ndone=0; FOR_ALL_NODES(node) { trace("movfeatsplitnodes "); @@ -520,6 +520,7 @@ static void movfeatsplitnodes(void) { continue; } FOR_NODE_EDGEENDS(side,edgeend, node) { + ndone++; edge= edgeend->edge; mate= movfeat_findmate(edgeend); assert(mate); @@ -528,8 +529,13 @@ static void movfeatsplitnodes(void) { edgeend_replumb(edgeend, &newnode->sides[edgeend->node->side]); } } + trace("movfeatsplitnodes_once=%d\n",ndone); + return ndone; } +static void movfeatsplitnodes(void) { movfeatsplitnodes_once(); } +static void movfeatsplitnodesall(void) { while ( movfeatsplitnodes_once() ); } + /*---------- operations - trivial graph redaction etc. ----------*/ static void trivpairnodes(void) { @@ -929,6 +935,7 @@ static const OpInfo opinfos[]= { OI(movfeatsplitedges) OI(movfeatrmstubs) OI(movfeatsplitnodes) + OI(movfeatsplitnodesall) OI(trivpairnodes) OI(trivnullnodes) { 0,0 } -- 2.30.2