blob: e8e225daec9656090f802c053461708a38be217f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# SED script for preprocessing embedded doc from source (S. Chamberlain markup)
# middle pass; most of the work is done here.
#
# First, get rid of /*doc* markers; they've done their job in the first pass.
/^\/\*doc\*/d
#
# /*proto* markers may be optionally followed by a *i-style subsubsec, findex
# entry. This will generate empty @findex and @subsubsection entries if
# the *proto* is on a line by itself; third pass removes them.
/^\/\*proto\*/s/^\/\*proto\* *\(.*\)$/@findex \1\
@subsubsection @code{\1}/
#
# /*proto-internal* is just like /*proto* from doc point of view.
/^\/\*proto-internal\*/s/^\/\*proto-internal\* *\(.*\)$/@findex \1\
@subsubsection @code{\1}/
#
# *i at beginning of line: rest of line is both a subsubsection heading
# and an entry in function index.
/^\*i/s/^\*i *\(.*\)$/@findex \1\
@subsubsection @code{\1}/
#
# Two alternative docn block ends, '*/' and '*-*/' on lines by themselves;
# replace by blank lines (for texinfo source readability).
/^\*\/$/c\
/^\*-\*\/$/c\
# {* and *} are standins for comment markers (originally embedded in .c
# comments)---turn into real comment markers:
s/{\*/\/\*/
s/\*}/\*\//
#
# '*+++' and '*---' span a block of text that includes both example lines
# (marked by leading '$') and explanatory text (to be italicized).
# Italicize lines lacking '$':
/\*\+\+\+/,/\*---/s/^\([^$].*\)$/@i{\1}/
#
# We don't need *+++ and *--- markers any more; kill them (trailing marker
# becomes blank line for readability)
/\*\+\+\+/d
/\*---/c\
# Any line beginning with '$' is made an example line; third pass later
# coalesces adjacent example blocks. *DO NOT* introduce extra space after
# @end example, so we can spot adjacent ones in third pass.
/^\$/i\
@example
/^\$/a\
@end example
#
# In any example line, turn '{' and '}' into '@{' and '@}'
###/^\$/s/{/@{/g
###/^\$/s/}/@}/g
#
# Now delete the '$' markers themselves:
/^\$/s/\$//
#
# *+ and *- delimit large examples to be enclosed in cartouches.
/^\*\+$/c\
@lisp\
@cartouche
/^\*-$/c\
@end cartouche\
@end lisp\
# '*;' introduces an example which may have a single line or multiple lines;
# it extends until the next semicolon (which is also printed).
# One-line case: (do this first; else second line address for multi-line case
# will include random text til we happen to end a line in a doc comment with
# a semicolon)
/^\*;.*;$/{
s/^\*;/@example\
/
s/;$/;\
@end example\
/
}
# Multi-line case:
/^\*;/,/.*;$/{
s/^\*;/@example\
/
s/;$/;\
@end example\
/
}
|