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 10:50:09 +0000

CVSROOT:        /sources/groff
Module name:    groff
Changes by:     Eric S. Raymond <esr>   07/02/09 10:50:09

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

Log message:
        New table::count_block_colums() method counts columns in the table
        that have T{ T} entries. Requires the new parent field in the 
        table_entry class.  Not yet used for anything.

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

Patches:
Index: table.cpp
===================================================================
RCS file: /sources/groff/groff/src/preproc/tbl/table.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- table.cpp   9 Feb 2007 10:20:08 -0000       1.8
+++ table.cpp   9 Feb 2007 10:50:09 -0000       1.9
@@ -714,7 +714,8 @@
 
 void block_entry::do_width()
 {
-  // do nothing; the action happens in divert
+  for (int i=start_col; i <= end_col; i++)
+    parent->blockflag[i] = true;
 }
 
 void block_entry::do_depth()
@@ -1202,7 +1203,7 @@
   vrule_list(0), stuff_list(0), span_list(0),
   entry_list(0), entry_list_tailp(&entry_list), entry(0),
   vline(0), row_is_all_lines(0), left_separation(0), right_separation(0),
-  allocated_rows(0)
+  allocated_rows(0), blockflag(0)
 {
   minimum_width = new string[ncolumns];
   column_separation = ncolumns > 1 ? new int[ncolumns - 1] : 0;
@@ -1307,6 +1308,7 @@
          allocated_rows = r + 1;
        entry = new PPtable_entry[allocated_rows];
        vline = new char*[allocated_rows];
+       blockflag = new bool[allocated_rows];
       }
       else {
        table_entry ***old_entry = entry;
@@ -1321,6 +1323,10 @@
        vline = new char*[allocated_rows];
        memcpy(vline, old_vline, sizeof(char*)*old_allocated_rows);
        a_delete old_vline;
+       bool *old_blockflag = blockflag;
+       blockflag = new bool[allocated_rows];
+       memcpy(blockflag, old_blockflag, sizeof(bool)*old_allocated_rows);
+       a_delete old_blockflag;
       }
     }
     assert(allocated_rows > r);
@@ -1687,6 +1693,15 @@
   }
 }
 
+int table::count_block_columns()
+{
+  int count = 0;
+  for (int i = 0; i < ncolumns; i++)
+    if (blockflag[i])
+      count++;
+  return count;
+}
+
 void table::init_output()
 {
   prints(".nr " COMPATIBLE_REG " \\n(.C\n"




reply via email to

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