groff
[Top][All Lists]
Advanced

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

Re: [Groff] Better locale macro file handling?


From: Colin Watson
Subject: Re: [Groff] Better locale macro file handling?
Date: Tue, 17 Feb 2009 11:49:00 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

On Tue, Feb 17, 2009 at 08:49:29AM +0100, Werner LEMBERG wrote:
> Hmm.  From an interface's point of view, this doesn't deserve a new
> request.  I suggest the following: Convert the error message of .mso
> into a new warning category which is enabled by default.  Then you can
> easily disable it with using a -W ... command line option.
> 
> You would get an `unknown warning' message on stderr for older groff
> versions, however.

Hmm. I thought warning bits were in rather scarcer supply than request
names; there are only three bits left at the moment, since it's a signed
int, and I can't think of many other plausible places where you'd want
the same category of warning as this. And, as you say, it is unfortunate
from a backward compatibility point of view: man-db would probably end
up having to detect the version of groff, since otherwise it would cause
a warning on every single manual page unless the macro file is present
(which will be the clear majority of pages). Are you sure that this is
the best approach? It seems problematic to me.

Nevertheless, here's the necessary patch if you're sure:

2009-02-17  Colin Watson  <address@hidden>

        Add a new `file' warning category.

        * src/roff/troff/troff.h (warning_type): Add WARN_FILE.
        * src/roff/troff/input.cpp (macro_source): Convert error on
        missing macro file to a warning.
        * NEWS, doc/groff.texinfo (I/O, Warnings): Document new warning
        category.

=== modified file 'NEWS'
--- NEWS        2009-02-14 17:21:35 +0000
+++ NEWS        2009-02-17 11:38:54 +0000
@@ -20,6 +20,9 @@ o The new `lsm' request specifies a macr
   registers `lsn' and `lss' hold the number of removed leading spaces and
   the corresponding horizontal space, respectively.
 
+o There is a new warning category `file'.  The `mso' request emits warnings
+  in this category when the requested macro file does not exist.
+
 
 VERSION 1.20.1
 ==============

=== modified file 'doc/groff.texinfo'
--- doc/groff.texinfo   2009-02-14 17:21:35 +0000
+++ doc/groff.texinfo   2009-02-17 11:41:35 +0000
@@ -13122,6 +13122,8 @@ for the specified @var{file} in the same
 the the @option{-m} command line option.  If the file name to be
 included has the form @address@hidden and it isn't found,
 @code{mso} tries to include @address@hidden and vice versa.
+If the file does not exist, a warning of type @samp{file} is emitted.
address@hidden, for information about warnings.
 @endDefreq
 
 @DefreqList {trf, file}
@@ -14172,6 +14174,11 @@ conditions that are errors when they do 
 @itemx 524288
 Color related warnings.
 
address@hidden file
address@hidden 1048576
+Missing files.  The @code{mso} request gives this warning when the
+requested macro file does not exist.
+
 @item all
 All warnings except @samp{di}, @samp{mac} and @samp{reg}.  It is
 intended that this covers all warnings that are useful with traditional

=== modified file 'src/roff/troff/input.cpp'
--- src/roff/troff/input.cpp    2009-02-14 17:21:35 +0000
+++ src/roff/troff/input.cpp    2009-02-17 11:37:44 +0000
@@ -7367,7 +7367,7 @@ void macro_source()
       a_delete path;
     }
     else
-      error("can't find macro file `%1'", nm.contents());
+      warning(WARN_FILE, "can't find macro file `%1'", nm.contents());
     tok.next();
   }
 }

=== modified file 'src/roff/troff/troff.h'
--- src/roff/troff/troff.h      2009-01-05 20:10:29 +0000
+++ src/roff/troff/troff.h      2009-02-17 11:37:40 +0000
@@ -75,11 +75,12 @@ enum warning_type {
   WARN_SPACE = 0200000,
   WARN_FONT = 0400000,
   WARN_IG =  01000000,
-  WARN_COLOR = 02000000
+  WARN_COLOR = 02000000,
+  WARN_FILE = 04000000
   // change WARN_TOTAL if you add more warning types
 };
 
-const int WARN_TOTAL = 03777777;
+const int WARN_TOTAL = 07777777;
 
 int warning(warning_type, const char *,
            const errarg & = empty_errarg,

Thanks,

-- 
Colin Watson                                       address@hidden




reply via email to

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