groff
[Top][All Lists]
Advanced

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

Re: [Groff] Conditional problem: "!" operator after "&"


From: Tadziu Hoffmann
Subject: Re: [Groff] Conditional problem: "!" operator after "&"
Date: Wed, 28 Jul 2010 20:09:00 +0200
User-agent: Mutt/1.5.17 (2007-11-01)

> Meanwhile, is this something that would break AT&T troff if
> groff were to do it right?

The question is, what is "right"?  I believe you're looking for
a mapping of integers to booleans, and a "not" operator for
booleans.  [ntg]roff already has both (in a way):

  * positive numbers are "true", nonpositive numbers are "false"
    (in contrast to several other languages which use "zero" and
    "nonzero").

  * if "n" is a number (integer) interpreted as a boolean, then
    "not n" is given by "(1-n)".

Thus:

  .nr NC 0
  .nr SI 0
  .if \n(NC&(1-\n(SI)     NC only.
  .if (1-\n(NC)&\n(SI     SI only.
  .if \n(NC&\n(SI         NC and SI.
  .if (1-\n(NC)&(1-\n(SI) neither.

(tested with OSF1 nroff, which only has 1- and 2-character names).





reply via email to

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