groff
[Top][All Lists]
Advanced

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

Re: device-dependent warnings


From: Alejandro Colomar
Subject: Re: device-dependent warnings
Date: Mon, 8 May 2023 16:55:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

Hi Branden,

On 5/8/23 02:29, G. Branden Robinson wrote:
> Hi Alex,
> 
> At 2023-05-07T22:42:05+0200, Alejandro Colomar wrote:
>> $ make build-pre-tbl >/dev/null
>> $ grep 'table wider' .tmp/man/man4/console_codes.4.eqn
>> .  tm1 " table wider than line length minus indentation
>> .  tm1 " table wider than line length minus indentation
>> .  tm1 " table wider than line length minus indentation
>> .  tm1 " table wider than line length minus indentation
>> .  tm1 " table wider than line length minus indentation
>> .  tm1 " table wider than line length minus indentation
>> .  tm1 " table wider than line length minus indentation
>> .  tm1 " table wider than line length minus indentation
>> .  tm1 " table wider than line length minus indentation
>>
>> BTW, tbl(1) doesn't accept any warnings flags.  Is this warning
>> unconditional?
> 
> (Un)conditional on what?  Does it have a knob permitting it to be
> disabled?  No. 

That's what I meant.

> Is it emitted if the line length (minus indentation) is
> wide enough to house the table?  No.

Of course not :)

[...]

> Yes, this is totally a formatter warning.  It's so special and breaking
> of the libgroff diagnostic scheme that GNU troff has its own bespoke
> replacement diagnostic functions to accommodate this warning format.
> (I've tried in the past to refactor out the duplicated parts--it didn't
> go well.)
> 
> Our warnings aren't obviously structured in the way you desire.  (I'm
> not sure our warnings are structured in a way _anybody_ desires.)
> 
> However, there are only a four instances of "output warnings".  They are
> all in env.cpp.  Quoting them will tell you which category they belong
> to.
> 
> https://git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/env.cpp?h=1.23.0.rc4
> 
> src/roff/troff/env.cpp:      output_warning(WARN_BREAK, "cannot break line");
> src/roff/troff/env.cpp:      output_warning(WARN_BREAK, "spreading %1m per 
> space", Ems);
> src/roff/troff/env.cpp: output_warning(WARN_BREAK, "cannot adjust line");
> src/roff/troff/env.cpp:      output_warning(WARN_BREAK, "line has 
> non-positive width %1m",
> 
> And as it happens, the WARN_BREAK category at present has no other
> users, so you can take "-Wbreak" as synonymous with your desired
> "-Woutput" if you like.

Good; I'll take that.

> 
> ...for groff 1.23.0.  I don't promise to keep this the same in the
> future.  Since nobody loves the arrangement of our warning categories, I
> can't pledge stability if someone swoops in with a brilliant redesign.

Makes sense.  Whenever you decide to rearrange that, please consider that
having an easy way to isolate output warnings can be useful.  As long as
that ability is there, I don't mind adapting to the how.

> 
> [INT_MAX]
>> Heh, next thing I'll try is a document that long.  ;-)
> 
> Once upon a time we measured that sort of thing in units of Encyclopedia
> Britannicas.

I couldn't notice the non-infiniteness.  See the following session.


$ echo -e '.TH a b c d\n.SH Name\nfoo \\- bar\n.SH Looong list\n.nf' >long.man;
$ cat long.man 
.TH a b c d
.SH Name
foo \- bar
.SH Looong list
.nf
$ grepc -k INT_MAX /usr/include/limits.h \
  | sed 's/.*INT_MAX\s*//' \
  | xargs seq >> long.man;
$ echo -e 'some\nmore\nlines\n.fi\n.PPLets see how this looks like.' >> long.man
$ time troff -man -Tutf8 ./long.man >long.cat.set
troff:./long.man:-2147483639: warning: macro 'PPLets' not defined (possibly 
missing space after 'PP')

real    60m22.147s
user    58m27.869s
sys     1m39.878s
$ time grotty <long.cat.set >long.cat

real    45m45.117s
user    44m22.965s
sys     1m12.635s


I made some small mistake with that missing space, but by the time I
noticed, I wasn't going back.  Anyway, It shouldn't matter.  I didn't
find any unexpected blank lines around the INT_MAX line.

$ head long.cat
a(b)                                                                      a(b)

Name
       foo - bar

Looong list
       1
       2
       3
       4
$ tail long.cat
       2147483643
       2147483644
       2147483645
       2147483646
       2147483647
       some
       more
       lines

d                                      c                                  a(b)


Let's see with grep(1):

$ grep -nA1 '^$' long.cat
2:
3-Name
--
5:
6-Looong list
--
2147483657:
2147483658-d                                      c                             
     a(b)


Maybe you really do have infinite pages and you didn't know.  ;)

Cheers,
Alex

P.S.: Surprisingly, the CPU didn't catch fire.

> 
> Regards,
> Branden

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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