groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff-commit] groff/src/preproc/tbl table.cpp


From: Eric S. Raymond
Subject: [Groff-commit] groff/src/preproc/tbl table.cpp
Date: Fri, 09 Feb 2007 22:03:21 +0000

CVSROOT:        /sources/groff
Module name:    groff
Changes by:     Eric S. Raymond <esr>   07/02/09 22:03:20

Modified files:
        src/preproc/tbl: table.cpp 

Log message:
        A try at the new rule for block column allocation is now enabled by
        the new "experimental" flag.  It doesn't work right as yet; there
        appears to be some error in the computation of 3avail, the available
        line length.  The purpose of this patch is (a) to make experimenting
        with other formulas easy, and (b) leave the infrastructure for flag
        'experimental' in place for future experiments.  Do not document any
        behavior associated with this flag!

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/src/preproc/tbl/table.cpp?cvsroot=groff&r1=1.9&r2=1.10

Patches:
Index: table.cpp
===================================================================
RCS file: /sources/groff/groff/src/preproc/tbl/table.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- table.cpp   9 Feb 2007 10:50:09 -0000       1.9
+++ table.cpp   9 Feb 2007 22:03:20 -0000       1.10
@@ -63,6 +63,9 @@
 // this must be one character
 #define COMPATIBLE_REG PREFIX "c"
 
+#define AVAILABLE_REG PREFIX "avail"
+#define COLCOUNT_REG PREFIX "ccount"
+
 #define LEADER_REG PREFIX LEADER
 
 #define BLOCK_WIDTH_PREFIX PREFIX "tbw"
@@ -681,6 +684,17 @@
     printfs(">?\\n[%1]u", span_width_reg(start_col, end_col));
   }
   else
+    if (parent->flags & table::EXPERIMENTAL)
+      // Each column containing a block entry gets 1/n of the remaining
+      // available line width, where n is the number of columns with block
+      // entries.
+      printfs("(u;\\n[%1]+(\\[%2]/\\[%3]))", 
+           span_width_reg(start_col, end_col), 
+           AVAILABLE_REG,
+           COLCOUNT_REG);
+    else
+      // Assign each column with a block entry 1/(n+1) of the line
+      // width, where n is the column count.
     printfs("(u;\\n[%1]>?(\\n[.l]*%2/%3))", 
            span_width_reg(start_col, end_col), 
            as_string(end_col - start_col + 1),
@@ -1928,6 +1942,8 @@
          span_left_numeric_width_reg(start_col, end_col),
          span_right_numeric_width_reg(start_col, end_col),
          span_alphabetic_width_reg(start_col, end_col));
+  printfs(".nr %1 -%2\n", 
+         AVAILABLE_REG, span_width_reg(start_col, end_col));
 }
 
 // Increase the widths of columns so that the width of any spanning entry
@@ -2122,10 +2138,13 @@
   for (q = entry_list; q; q = q->next)
     if (!q->mod->zero_width)
       q->do_width();
+  printfs(".nr %1 %2\n", COLCOUNT_REG, as_string(count_block_columns()));
+  printfs(".nr %1 \\n[.ll]-\\n[.in]\n", AVAILABLE_REG);
   for (i = 0; i < ncolumns; i++)
     compute_span_width(i, i);
   for (p = span_list; p; p = p->next)
     compute_span_width(p->start_col, p->end_col);
+  printfs(".nr %1 0>?\\n[%1]\n", AVAILABLE_REG);
   make_columns_equal();
   // Note that divide_span keeps equal width columns equal.
   for (p = span_list; p; p = p->next)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]