* Re: [TUHS] macro returning a value?
@ 2021-11-13 18:45 Douglas McIlroy
0 siblings, 0 replies; only message in thread
From: Douglas McIlroy @ 2021-11-13 18:45 UTC (permalink / raw)
To: TUHS main list
> Is there a trick to make a macro or string return a value?
I know what you mean. Though a string does return a value, it
can't compute an arithmetic result. Alternatively, a macro,
which can use arithmetic, can only return the result as a distinct
input line. (That might be overcome by a trick with \c, but I don't
see one right off.)
Though I have no useful advice about this dilemma, it does spur
memories. I wrote the pre-Unix roff that was reimplemented on
Unix and then superseded by Joe Ossanna's nroff. Joe introduced
macros. Curiously, I had implemented macros in an assembler so
early on (1959) that I have (incorrectly) been cited as the father of
macros, yet it never occurred to me to put them in roff.
Joe's work inspired me to add macros to pre-Unix roff. I did
one thing differently. A macro could be called the usual way or
it could be called inline like an nroff string. The only difference
was that a macro's final newline was omitted when it was
expanded inline. That implementation might have helped with
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-13 18:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-13 18:45 [TUHS] macro returning a value? Douglas McIlroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).