[comp.unix.questions] Reusable troff code

abrams%community-chest.mitre.org@gateway.mitre.ORG (09/05/87)

I am contemplating rewriting some troff vugraph macros which must support a
large number of options on entry.  I think it would be user unfriendly
to require these options to be defined by position, especially since
each user might choose to accept the default on a different subset.
One alternative that I have thought of is keyword=value.  For example, the
call to start making vugraphs might be:

	.VU ID=SMPL ILLUSTRATOR=Abrams DATE=9/2/87

I would like to acquire some reusable troff coding to minimize the effort.
Do you have a troff code fragment that will parse the KEYWORD=VALUE string?
Suggestions as to alternative approaches would also be appreciated.
I'll be happy to share the "answer" with all interested parties.

Please respond directly to me; I'm not on this distribution list.
Thanks.

 
- Marshall D. Abrams, phone: (703) 883-6938
   The MITRE Corporation, 7525 Colshire Drive
   Mail Stop Z670, Mc Lean, VA   22102
   Alternate e-mail address: abrams@mitre.arpa

mjl@tropix.UUCP (Mike Lutz) (09/09/87)

In article <9190@brl-adm.ARPA> abrams%community-chest.mitre.org@gateway.mitre.ORG writes:
>
>I am contemplating rewriting some troff vugraph macros which must support a
>large number of options on entry.  I think it would be user unfriendly
>to require these options to be defined by position, especially since
>each user might choose to accept the default on a different subset.
>One alternative that I have thought of is keyword=value.  For example, the
>call to start making vugraphs might be:
>
>	.VU ID=SMPL ILLUSTRATOR=Abrams DATE=9/2/87

Why not use the tried-and-true preprocessor approach, a la tbl, eqn, pic,
etc.?  Your preprocessor can then generate positional parameters as
necessary, with the .VU macro defined in the traditional troff manner.

Mike Lutz