]>
Commit | Line | Data |
---|---|---|
90f3f3e2 SC |
1 | # SED script for preprocessing embedded doc from source (S. Chamberlain markup) |
2 | # middle pass; most of the work is done here. | |
3 | # | |
4 | # First, get rid of /*doc* markers; they've done their job in the first pass. | |
5 | /^\/\*doc\*/d | |
6 | # | |
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}/ | |
12 | # | |
13 | # /*proto-internal* is just like /*proto* from doc point of view. | |
14 | /^\/\*proto-internal\*/s/^\/\*proto-internal\* *\(.*\)$/@findex \1\ | |
15 | @subsubsection @code{\1}/ | |
16 | # | |
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}/ | |
21 | # | |
22 | # Two alternative docn block ends, '*/' and '*-*/' on lines by themselves; | |
23 | # replace by blank lines (for texinfo source readability). | |
24 | /^\*\/$/c\ | |
25 | ||
26 | /^\*-\*\/$/c\ | |
27 | ||
28 | # {* and *} are standins for comment markers (originally embedded in .c | |
29 | # comments)---turn into real comment markers: | |
30 | s/{\*/\/\*/ | |
31 | s/\*}/\*\// | |
32 | # | |
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}/ | |
37 | # | |
38 | # We don't need *+++ and *--- markers any more; kill them (trailing marker | |
39 | # becomes blank line for readability) | |
40 | /\*\+\+\+/d | |
41 | /\*---/c\ | |
42 | ||
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. | |
46 | /^\$/i\ | |
47 | @example | |
48 | /^\$/a\ | |
49 | @end example | |
50 | # | |
51 | # In any example line, turn '{' and '}' into '@{' and '@}' | |
52 | ###/^\$/s/{/@{/g | |
53 | ###/^\$/s/}/@}/g | |
54 | # | |
55 | # Now delete the '$' markers themselves: | |
56 | /^\$/s/\$// | |
57 | # | |
58 | # *+ and *- delimit large examples to be enclosed in cartouches. | |
59 | /^\*\+$/c\ | |
60 | @lisp\ | |
61 | @cartouche | |
62 | /^\*-$/c\ | |
63 | @end cartouche\ | |
64 | @end lisp\ | |
65 | ||
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 | |
70 | # a semicolon) | |
71 | /^\*;.*;$/{ | |
72 | s/^\*;/@example\ | |
73 | / | |
74 | s/;$/;\ | |
75 | @end example\ | |
76 | / | |
77 | } | |
78 | # Multi-line case: | |
79 | /^\*;/,/.*;$/{ | |
80 | s/^\*;/@example\ | |
81 | / | |
82 | s/;$/;\ | |
83 | @end example\ | |
84 | / | |
85 | } |