aboutsummaryrefslogtreecommitdiff
path: root/bfd/sedscript
diff options
context:
space:
mode:
authorSteve Chamberlain <steve@cygnus>1991-08-17 00:16:57 +0000
committerSteve Chamberlain <steve@cygnus>1991-08-17 00:16:57 +0000
commit90f3f3e2b046a492b08d8802fd6e2055508b795e (patch)
tree2cee2df785574d5200035c64b9a81a09036ec9e4 /bfd/sedscript
parent3a26c0cd00b712a85b63ad962ff72d125154b1bc (diff)
downloadgdb-90f3f3e2b046a492b08d8802fd6e2055508b795e.zip
gdb-90f3f3e2b046a492b08d8802fd6e2055508b795e.tar.gz
gdb-90f3f3e2b046a492b08d8802fd6e2055508b795e.tar.bz2
Initial revision
Diffstat (limited to 'bfd/sedscript')
-rwxr-xr-xbfd/sedscript85
1 files changed, 85 insertions, 0 deletions
diff --git a/bfd/sedscript b/bfd/sedscript
new file mode 100755
index 0000000..e8e225d
--- /dev/null
+++ b/bfd/sedscript
@@ -0,0 +1,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\
+/
+}