[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff-commit] groff ChangeLog src/preproc/tbl/table.cpp src/p...
From: |
Werner LEMBERG |
Subject: |
[Groff-commit] groff ChangeLog src/preproc/tbl/table.cpp src/p... |
Date: |
Sat, 18 Oct 2008 04:43:34 +0000 |
CVSROOT: /cvsroot/groff
Module name: groff
Changes by: Werner LEMBERG <wl> 08/10/18 04:43:34
Modified files:
. : ChangeLog
src/preproc/tbl: table.cpp table.h
Log message:
* src/preproc/tbl/table.cpp (table::compute_available_block_width):
New function.
(table::compute_widths): Replace some code with new function
(shifted to a more appropriate place).
* src/preproc/tbl/table.h: Updated.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/ChangeLog?cvsroot=groff&r1=1.1156&r2=1.1157
http://cvs.savannah.gnu.org/viewcvs/groff/src/preproc/tbl/table.cpp?cvsroot=groff&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/groff/src/preproc/tbl/table.h?cvsroot=groff&r1=1.12&r2=1.13
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/groff/groff/ChangeLog,v
retrieving revision 1.1156
retrieving revision 1.1157
diff -u -b -r1.1156 -r1.1157
--- ChangeLog 16 Oct 2008 13:42:08 -0000 1.1156
+++ ChangeLog 18 Oct 2008 04:43:34 -0000 1.1157
@@ -1,3 +1,11 @@
+2008-10-17 Werner LEMBERG <address@hidden>
+
+ * src/preproc/tbl/table.cpp (table::compute_available_block_width):
+ New function.
+ (table::compute_widths): Replace some code with new function
+ (shifted to a more appropriate place).
+ * src/preproc/tbl/table.h: Updated.
+
2008-10-16 Werner LEMBERG <address@hidden>
* tmac/doc-common (doc-operating-system-*), tmac/groff_mdoc.man: Add
Index: src/preproc/tbl/table.cpp
===================================================================
RCS file: /cvsroot/groff/groff/src/preproc/tbl/table.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/preproc/tbl/table.cpp 18 Jul 2008 07:37:16 -0000 1.15
+++ src/preproc/tbl/table.cpp 18 Oct 2008 04:43:34 -0000 1.16
@@ -737,7 +737,7 @@
void block_entry::do_width()
{
- for (int i=start_col; i <= end_col; i++)
+ for (int i = start_col; i <= end_col; i++)
parent->blockflag[i] = (char)1;
}
@@ -1962,8 +1962,6 @@
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 " AVAILABLE_REG " -\\n[%1]\n",
- span_width_reg(start_col, end_col));
}
// Increase the widths of columns so that the width of any spanning entry
@@ -2056,9 +2054,24 @@
}
}
+// Compute remaining length for block columns.
+
+void table::compute_available_block_width()
+{
+ printfs(".nr " COLCOUNT_REG " %1\n", as_string(count_block_columns()));
+ prints(".nr " AVAILABLE_REG " \\n[.l]-\\n[.i]");
+ for (int i = 0; i < ncolumns; i++)
+ printfs("-\\n[%1]", span_width_reg(i, i));
+ prints("\n");
+ prints(".if \\n[" AVAILABLE_REG "]<0 \\{"
+ ".tm warning: page \\n%: table wider than line width\n"
+ ".nr " AVAILABLE_REG " 0\n"
+ ".\\}\n");
+}
+
void table::compute_separation_factor()
{
- if (flags & (ALLBOX|BOX|DOUBLEBOX))
+ if (flags & (ALLBOX | BOX | DOUBLEBOX))
left_separation = right_separation = 1;
else {
for (int i = 0; i < nrows; i++) {
@@ -2152,6 +2165,7 @@
build_span_list();
int i;
horizontal_span *p;
+ // These values get refined later.
prints(".nr " SEPARATION_FACTOR_REG " 1n\n");
for (i = 0; i < ncolumns; i++) {
init_span_reg(i, i);
@@ -2160,29 +2174,26 @@
}
for (p = span_list; p; p = p->next)
init_span_reg(p->start_col, p->end_col);
+ // Compute all field widths except for blocks.
table_entry *q;
for (q = entry_list; q; q = q->next)
if (!q->mod->zero_width)
q->do_width();
+ // Compute all span widths, not handling blocks yet.
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 " COLCOUNT_REG " %1\n", as_string(count_block_columns()));
- prints(".nr " AVAILABLE_REG " \\n[.l]-\\n[.i]");
- for (i = 0; i < ncolumns; i++)
- printfs("-\\n[%1]", span_width_reg(i, i));
- prints("\n");
- prints(".if \\n[" AVAILABLE_REG "]<0 \\{"
- ".tm warning: page \\n%: table wider than line width\n"
- ".nr " AVAILABLE_REG " 0\n"
- ".\\}\n");
+ // Making columns equal normally increases the width of some columns.
make_columns_equal();
// Note that divide_span keeps equal width columns equal.
+ // This function might increase the width of some columns, too.
for (p = span_list; p; p = p->next)
divide_span(p->start_col, p->end_col);
for (p = span_list; p; p = p->next)
sum_columns(p->start_col, p->end_col);
+ // Now handle blocks.
+ compute_available_block_width();
int had_spanning_block = 0;
int had_equal_block = 0;
for (q = entry_list; q; q = q->next)
@@ -2194,6 +2205,7 @@
if (equal[i])
had_equal_block = 1;
}
+ // Second pass.
if (had_equal_block)
make_columns_equal();
if (had_spanning_block)
@@ -2463,7 +2475,7 @@
}
}
}
- if (flags & (BOX|ALLBOX|DOUBLEBOX)) {
+ if (flags & (BOX | ALLBOX | DOUBLEBOX)) {
add_vertical_rule(0, nrows - 1, 0, 0);
add_vertical_rule(0, nrows - 1, ncolumns, 0);
}
@@ -2507,7 +2519,7 @@
".if !\\n[" SUPPRESS_BOTTOM_REG "] \\{"
"." REPEATED_VPT_MACRO " 0\n"
".mk " SAVED_VERTICAL_POS_REG "\n");
- if (flags & (BOX|ALLBOX|DOUBLEBOX)) {
+ if (flags & (BOX | ALLBOX | DOUBLEBOX)) {
prints(".if \\n[T.]&\\n[" NEED_BOTTOM_RULE_REG "] \\{");
print_single_hline(0);
prints(".\\}\n");
@@ -2737,7 +2749,7 @@
void table::do_top()
{
prints(".fc \002\003\n");
- if (!(flags & NOKEEP) && (flags & (BOX|DOUBLEBOX|ALLBOX)))
+ if (!(flags & NOKEEP) && (flags & (BOX | DOUBLEBOX | ALLBOX)))
prints("." TABLE_KEEP_MACRO_NAME "\n");
if (flags & DOUBLEBOX) {
prints(".ls 1\n"
@@ -2757,7 +2769,7 @@
prints(".ls\n"
".vs\n");
}
- else if (flags & (ALLBOX|BOX)) {
+ else if (flags & (ALLBOX | BOX)) {
print_single_hline(0);
}
//printfs(".mk %1\n", row_top_reg(0));
@@ -2775,7 +2787,7 @@
prints(".nr " NEED_BOTTOM_RULE_REG " 1\n"
".nr T. 1\n"
".T#\n");
- if (!(flags & NOKEEP) && (flags & (BOX|DOUBLEBOX|ALLBOX)))
+ if (!(flags & NOKEEP) && (flags & (BOX | DOUBLEBOX | ALLBOX)))
prints("." TABLE_RELEASE_MACRO_NAME "\n");
if (flags & DOUBLEBOX)
prints(".sp " DOUBLE_LINE_SEP "\n");
Index: src/preproc/tbl/table.h
===================================================================
RCS file: /cvsroot/groff/groff/src/preproc/tbl/table.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/preproc/tbl/table.h 12 Feb 2007 00:25:24 -0000 1.12
+++ src/preproc/tbl/table.h 18 Oct 2008 04:43:34 -0000 1.13
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004, 2007
+/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004, 2007, 2008
Free Software Foundation, Inc.
Written by James Clark (address@hidden)
@@ -104,6 +104,7 @@
int right_separation;
int allocated_rows;
void build_span_list();
+ void compute_available_block_width();
void do_hspan(int r, int c);
void do_vspan(int r, int c);
void allocate(int r);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Groff-commit] groff ChangeLog src/preproc/tbl/table.cpp src/p...,
Werner LEMBERG <=