[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] nop request
From: |
Ralph Corderoy |
Subject: |
Re: [Groff] nop request |
Date: |
Mon, 04 Sep 2000 17:28:06 +0100 |
Hi Werner and Ted,
Werner wrote:
> The .nop is meant as syntactical sugar only. I believe that code
> like
>
> .if a \{\
> . if b \{\
> . nop Hallo!
> . \}
> .\}
>
> is easier to read than
>
> .if a \{\
> . if b \{\
> Hallo!
> . \}
> .\}
>
> and better to understand than
>
> .if a \{\
> . if b \{\
> . if 1 Hallo!
> . \}
> .\}
Wow, that's a strange belief to hold :-) I look at troff input as
plain text interspersed with commands so I want Hallo! to be at the
start of a line so it stands out as plain text and not a command. Same
with the C preprocessor.
#if FEATURE_FOO #if FEATURE_FOO
# if DEBUG # if DEBUG
int debug; # nop int debug;
# endif # endif
#endif #endif
> Do you have a better name?
I've thought hard about this and I don't think so. Perhaps it is hard
to name because its purpose doesn't fit well? .nop definitely suggests
no-op which would suggest .\"'s behaviour. There's .then but that's a
bit strange too.
.if a \{\
. if b \{\
. then Hallo!
. \}
.\}
Really, no command is mandatory here and it is hard to name something
that doesn't need to exist.
Ted wrote:
> Also, from time to time I use a definition
>
> .de nop
> ..
>
> as in
>
> .blm nop
That's why I though Wener's .nop was needed (when I didn't understand
its purpose), because .\" wouldn't work there. I could be wrong.
> So, while I can see the point of Werner's proposal, I think it would
> be a very good idea to call it something else. Maybe ".pad"? I don't
> have a clearly good suggestion for the name.
.pad would suggest some form of padding in the output, like .ce or .tl.
> Finally, I think the interpretation as 'equivalent to ".if 1"' is not
> obvious: does it mean you can use
>
> .nop \{Some input
> and some more input
> .\}
Yes, I believe that works. The implementation of .nop simple consumes
whitespace before normal parsing resumes at \{.
% head x.tr
.nop \{Some input
and some more input
.\}
end
% ./test-groff -Tascii < x.tr | cat -s
Some input and some more input end
It gives the same output if the dot before \} is removed too.
Ralph.
RE: [Groff] nop request, Ted Harding, 2000/09/04