chiark / gitweb /
layout/redactgraph: new movfeatsplitnodesall which repeatedly splits until all are...
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 28 Nov 2010 15:33:57 +0000 (15:33 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 28 Nov 2010 15:33:57 +0000 (15:33 +0000)
layout/Makefile
layout/redactgraph.c

index 3ee291ac2beb579a62b804a4f3b8d6fb06f74a1b..37d2860130ea1296faf79365b7025dc4c7099d38 100644 (file)
@@ -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
index e47532f280510c4aa27679cc8b697a7020800d33..32d5221fb46f663590c833b5f7e275f360b272ce 100644 (file)
@@ -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 }