[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RE: [Groff] Newbie help for documenting code snippets
From: |
mahesh |
Subject: |
Re: RE: [Groff] Newbie help for documenting code snippets |
Date: |
12 Jan 2005 11:31:05 -0000 |
On Wed, 12 Jan 2005 Ted Harding wrote :
>On 12-Jan-05 mahesh wrote:
> > Hi all,
> >
> > I would like to generate documentation for some C code, along the lines
> > of Richard Steven's books.
...
> >
>
>Hi Mahesh,
...
>
>Within troff, you can use the ".nm" request to initiate numbering
>of formatted lines. Since it can be a bit tricky to get the details
>right, here is an example (based on "ms" macros since I've used
>".LP" but it will work if ".LP" is changed for a different macro
>set):
>
That was very useful. Thanks. I spent sometime understanding it. (I wish there were more examples like this to guide newbies. )
'nl' too is quite OK with me.
The given macros more-or-less [see next para] takes care of the code block/snippet. Now, what do i need to do for the Steven's style descriptions. For each range of line numbers in a code snippet, the range a-b is left indented in italics, followed by the description with what looks like .PP. How is it done ?
My failed attempt was this:
.po -0.5i
.I
34-58
.R
This is the description for lines 34-58 ...
Now, in the Preface to his books, Richard Stevens mentions using 'loom' and some awk scripts written by Gary Wright. I have got loom with me now, but can't get it to work. Could someone help me on this, if its not off-topic.
Moreover, i feel much of it would have been automated, i/e, Stevens must have had a 'C' file, in which he places markers (?) and loom slurps them into the troff doc. Perhaps the italicized a-b lines were also somehow automated. Thus the documentation refers to the *actual* code.
There is no info. on this at kohala.com.
I hope it isn't a lost art.
- mahesh