From cb44b954ddc5dbfc2ed0b89545a7ce048428bf99 Mon Sep 17 00:00:00 2001 From: wl Date: Tue, 16 Feb 2010 21:03:54 +0000 Subject: tbl: Add `nowarn' option. * src/preproc/tbl/table.h (table): Add `NOWARN' enumeration value. * src/preproc/tbl/main.cpp (process_options), src/preprox/tbl/table.cpp (table::compute_expand_width, table::compute_separation_factor): Handle `NOWARN'. * src/preproc/tbl/tbl.man, NEWS: Document it. --- src/preproc/tbl/main.cpp | 7 ++++++- src/preproc/tbl/table.cpp | 25 ++++++++++++++----------- src/preproc/tbl/table.h | 3 ++- src/preproc/tbl/tbl.man | 7 ++++++- 4 files changed, 28 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/preproc/tbl/main.cpp b/src/preproc/tbl/main.cpp index e9fec7c2..8732db9f 100644 --- a/src/preproc/tbl/main.cpp +++ b/src/preproc/tbl/main.cpp @@ -1,6 +1,6 @@ // -*- C++ -*- /* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005, - 2007, 2008, 2009 + 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -498,6 +498,11 @@ options *process_options(table_input &in) error("`nospaces' option does not take an argument"); opt->flags |= table::NOSPACES; } + else if (strieq(p, "nowarn")) { + if (arg) + error("`nowarn' option does not take an argument"); + opt->flags |= table::NOWARN; + } else if (strieq(p, "decimalpoint")) { if (!arg) error("`decimalpoint' option requires argument in parentheses"); diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp index 2d0368b0..e1b8c3fb 100644 --- a/src/preproc/tbl/table.cpp +++ b/src/preproc/tbl/table.cpp @@ -2079,10 +2079,11 @@ void table::compute_expand_width() prints("\n"); prints(".if \\n[" EXPAND_REG "]<0 \\{"); entry_list->set_location(); - prints(".tm1 \"warning: file `\\n[.F]', around line \\n[.c]:\n" - ".tm1 \" table wider than line width\n" - ".nr " EXPAND_REG " 0\n" - ".\\}\n"); + if (!(flags & NOWARN)) + prints(".tm1 \"warning: file `\\n[.F]', around line \\n[.c]:\n" + ".tm1 \" table wider than line width\n" + ".nr " EXPAND_REG " 0\n"); + prints(".\\}\n"); if (colcount > 1) printfs(".nr " EXPAND_REG " \\n[" EXPAND_REG "]/%1\n", as_string(colcount)); @@ -2118,15 +2119,17 @@ void table::compute_separation_factor() printfs("/%1\n", as_string(total_separation)); prints(".ie \\n[" SEPARATION_FACTOR_REG "]<=0 \\{"); entry_list->set_location(); - prints(".tm1 \"warning: file `\\n[.F]', around line \\n[.c]:\n" - ".tm1 \" column separation set to zero\n" - ".nr " SEPARATION_FACTOR_REG " 0\n" - ".\\}\n" + if (!(flags & NOWARN)) + prints(".tm1 \"warning: file `\\n[.F]', around line \\n[.c]:\n" + ".tm1 \" column separation set to zero\n" + ".nr " SEPARATION_FACTOR_REG " 0\n"); + prints(".\\}\n" ".el .if \\n[" SEPARATION_FACTOR_REG "]<1n \\{"); entry_list->set_location(); - prints(".tm1 \"warning: file `\\n[.F]', around line \\n[.c]:\n" - ".tm1 \" table squeezed horizontally to fit line length\n" - ".\\}\n"); + if (!(flags & NOWARN)) + prints(".tm1 \"warning: file `\\n[.F]', around line \\n[.c]:\n" + ".tm1 \" table squeezed horizontally to fit line length\n"); + prints(".\\}\n"); } void table::compute_column_positions() diff --git a/src/preproc/tbl/table.h b/src/preproc/tbl/table.h index cf5b6031..7520b10e 100644 --- a/src/preproc/tbl/table.h +++ b/src/preproc/tbl/table.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004, 2007, - 2008, 2009 + 2008, 2009, 2010 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -142,6 +142,7 @@ public: DOUBLEBOX = 0x00000010, NOKEEP = 0x00000020, NOSPACES = 0x00000040, + NOWARN = 0x00000080, EXPERIMENTAL = 0x80000000 // undocumented; use as a hook for experiments }; char *expand; diff --git a/src/preproc/tbl/tbl.man b/src/preproc/tbl/tbl.man index aef396e0..879143f2 100644 --- a/src/preproc/tbl/tbl.man +++ b/src/preproc/tbl/tbl.man @@ -1,7 +1,7 @@ '\" t .ig Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2006, 2007, 2008, - 2009 + 2009, 2010 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of @@ -167,6 +167,11 @@ diversions, when footnotes, for example, are used. Ignore leading and trailing spaces in data items (GNU tbl only). . .TP +.B nowarn +Turn off warnings related to tables +exceeding the current line width (GNU tbl only). +. +.TP .BI tab( x ) Use the character .I x -- cgit v1.2.1