]>
Commit | Line | Data |
---|---|---|
90f3f3e2 SC |
1 | # SED script for preprocessing embedded headers from source |
2 | # (S. Chamberlain markup) | |
3 | # middle pass; most of the work is done here. | |
4 | # | |
5 | # First, get rid of /*proto* markers; they've done their job in the first pass. | |
6 | # (They remain comment-introducers) | |
7 | /^\/\*proto\*/s/^\/\*proto\*/\/*/ | |
8 | /^\/\*proto-internal\*/s/^\/\*proto-internal\*/\/*/ | |
9 | # | |
10 | # *-*/ is an alternative (older) comment-block end. Remap for uniformity: | |
11 | s/^\*-\*\//\*\// | |
12 | # | |
13 | # {* and *} are standins for comment markers (originally embedded in .c | |
14 | # comments)---turn into real comment markers: | |
15 | s/{\*/\/\*/ | |
16 | s/\*}/\*\// | |
17 | # | |
18 | # '*+++' and '*---' span a block of text that includes both header lines | |
19 | # (marked by leading '$') and explanatory text (to be comments). | |
20 | # No need to start comment at "*+++", or end it at "*---", since we're | |
21 | # already in a *proto* comment block. Just delete. | |
22 | /\*\+\+\+/d | |
23 | /\*---/d | |
24 | # | |
25 | # Any line beginning with '$' is made a line of code in the header; | |
26 | # stuff in between is comments, so *precede* each '$' line with | |
27 | # END-comment, *follow* each '$' line with START-comment; third pass later | |
28 | # eliminates empty comment blocks. | |
29 | /^\$/i\ | |
30 | */ | |
31 | /^\$/a\ | |
32 | /* | |
33 | # | |
34 | # Now delete the '$' markers themselves: | |
35 | /^\$/s/\$// | |
36 | # | |
37 | # *+ and *- delimit larger blocks of code, treated the same as '$' lines | |
38 | /^\*\+$/c\ | |
39 | */ | |
40 | /^\*-$/c\ | |
41 | /* | |
42 | # | |
43 | # '*;' introduces code which may have a single line or multiple lines; | |
44 | # it extends until the next semicolon (which is also printed). | |
45 | # | |
46 | # One-line case: (do this first; else second line address for multi-line case | |
47 | # will include random text til we happen to end a line in a proto comment with | |
48 | # a semicolon) | |
49 | /^\*;.*;$/{ | |
50 | s/^\*;/*\/\ | |
51 | / | |
52 | s/;$/;\ | |
53 | \/*\ | |
54 | / | |
55 | } | |
56 | # Multi-line case: | |
57 | /^\*;/,/.*;$/{ | |
58 | s/^\*;/*\/\ | |
59 | / | |
60 | s/;$/;\ | |
61 | \/*\ | |
62 | / | |
63 | } |