[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] strings with arguments
From: |
Werner LEMBERG |
Subject: |
Re: [Groff] strings with arguments |
Date: |
Sun, 07 Jul 2002 06:50:47 +0200 (CEST) |
> > PS: It is *not* possible to make macros with arguments be called
> > inline. The complications caused by newlines are too hairy.
>
> Now I can see the difficulties. I had in mind some kind of Pascal
> `function', while a groff macro is like a Pascal `procedure'.
> This seems to be impossible at the moment. Consequently, OOP is out
> of reach. So I won't bother you with this before the next release.
After some experimenting I'm now convinced that inline expansion of
macros can't suppress the final newline in general.
At home I've added some lines of code (less than 20 lines) which
successfully suppresses the last newline of a macro so that e.g. the
following works:
.de xxx
foo\\$1
..
aaa\*[xxx bar]aaa
=> aaafoobaraaa
Now consider this:
.de xxx
. ie n \
. nop n\\$1
. el \
. nop t\\$1
aaa\*[xxx bar]aaa
If in troff mode, the result is
aaatbaraaa
but in nroff mode we get
aaanbar aaa
since only the final newline is suppressed. I could manage to always
suppress newlines, e.g.
.de xxx
Hallo
\\$1
..
aaa\*[xxx John]aaa
=> aaaHalloJohnaaa
but I think this is a bad idea. The only clean solution to this
problem would be to introduce a new variant of the `de' request to
define inline macros.
Werner