1 # SED script for preprocessing embedded doc from source (S. Chamberlain markup)
2 # middle pass; most of the work is done here.
4 # First, get rid of /*doc* markers; they've done their job in the first pass.
7 # /*proto* markers may be optionally followed by a *i-style subsubsec, findex
8 # entry. This will generate empty @findex and @subsubsection entries if
9 # the *proto* is on a line by itself; third pass removes them.
10 /^\/\*proto\*/s/^\/\*proto\* *\(.*\)$/@findex \1\
11 @subsubsection @code{\1}/
13 # /*proto-internal* is just like /*proto* from doc point of view.
14 /^\/\*proto-internal\*/s/^\/\*proto-internal\* *\(.*\)$/@findex \1\
15 @subsubsection @code{\1}/
17 # *i at beginning of line: rest of line is both a subsubsection heading
18 # and an entry in function index.
19 /^\*i/s/^\*i *\(.*\)$/@findex \1\
20 @subsubsection @code{\1}/
22 # Two alternative docn block ends, '*/' and '*-*/' on lines by themselves;
23 # replace by blank lines (for texinfo source readability).
28 # {* and *} are standins for comment markers (originally embedded in .c
29 # comments)---turn into real comment markers:
33 # '*+++' and '*---' span a block of text that includes both example lines
34 # (marked by leading '$') and explanatory text (to be italicized).
35 # Italicize lines lacking '$':
36 /\*\+\+\+/,/\*---/s/^\([^$].*\)$/@i{\1}/
38 # We don't need *+++ and *--- markers any more; kill them (trailing marker
39 # becomes blank line for readability)
43 # Any line beginning with '$' is made an example line; third pass later
44 # coalesces adjacent example blocks. *DO NOT* introduce extra space after
45 # @end example, so we can spot adjacent ones in third pass.
51 # In any example line, turn '{' and '}' into '@{' and '@}'
55 # Now delete the '$' markers themselves:
58 # *+ and *- delimit large examples to be enclosed in cartouches.
66 # '*;' introduces an example which may have a single line or multiple lines;
67 # it extends until the next semicolon (which is also printed).
68 # One-line case: (do this first; else second line address for multi-line case
69 # will include random text til we happen to end a line in a doc comment with