Update.
[glibc.git] / manual / summary.awk
blobd997a2080f8ac1bf4b7360a35aabbd4c442b2b1f
1 # awk script to create summary.texinfo from the library texinfo files.
3 # Copyright (C) 1992, 1993 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Library General Public License
8 # as published by the Free Software Foundation; either version 2 of
9 # the License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Library General Public License for more details.
16 # You should have received a copy of the GNU Library General Public
17 # License along with the GNU C Library; see the file COPYING.LIB. If
18 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19 # Cambridge, MA 02139, USA.
21 # This script recognizes sequences that look like:
22 # @comment HEADER.h
23 # @comment STANDARD
24 # @def... ITEM | @item ITEM | @vindex ITEM
26 BEGIN { header = 0;
27 nameword["@defun"]=1
28 nameword["@defunx"]=1
29 nameword["@defmac"]=1
30 nameword["@defmacx"]=1
31 nameword["@defspec"]=1
32 nameword["@defspecx"]=1
33 nameword["@defvar"]=1
34 nameword["@defvarx"]=1
35 nameword["@defopt"]=1
36 nameword["@defoptx"]=1
37 nameword["@deffn"]=2
38 nameword["@deffnx"]=2
39 nameword["@defvr"]=2
40 nameword["@defvrx"]=2
41 nameword["@deftp"]=2
42 nameword["@deftpx"]=2
43 nameword["@deftypefun"]=2
44 nameword["@deftypefunx"]=2
45 nameword["@deftypevar"]=2
46 nameword["@deftypevarx"]=2
47 nameword["@deftypefn"]=3
48 nameword["@deftypefnx"]=3
49 nameword["@deftypevr"]=3
50 nameword["@deftypevrx"]=3
51 firstword["@defun"]=1
52 firstword["@defunx"]=1
53 firstword["@defmac"]=1
54 firstword["@defmacx"]=1
55 firstword["@defspec"]=1
56 firstword["@defspecx"]=1
57 firstword["@defvar"]=1
58 firstword["@defvarx"]=1
59 firstword["@defopt"]=1
60 firstword["@defoptx"]=1
61 firstword["@deffn"]=2
62 firstword["@deffnx"]=2
63 firstword["@defvr"]=2
64 firstword["@defvrx"]=2
65 firstword["@deftp"]=2
66 firstword["@deftpx"]=2
67 firstword["@deftypefun"]=1
68 firstword["@deftypefunx"]=1
69 firstword["@deftypevar"]=1
70 firstword["@deftypevarx"]=1
71 firstword["@deftypefn"]=2
72 firstword["@deftypefnx"]=2
73 firstword["@deftypevr"]=2
74 firstword["@deftypevrx"]=2
75 nameword["@item"]=1
76 firstword["@item"]=1
77 nameword["@itemx"]=1
78 firstword["@itemx"]=1
79 nameword["@vindex"]=1
80 firstword["@vindex"]=1
82 print "@c DO NOT EDIT THIS FILE!"
83 print "@c This file is generated by summary.awk from the Texinfo sources."
86 $1 == "@node" { node=$2;
87 for (i = 3; i <= NF; ++i)
88 { node=node " " $i; if ( $i ~ /,/ ) break; }
91 $1 == "@comment" && $2 ~ /\.h$/ { header="@file{" $2 "}";
92 for (i = 3; i <= NF; ++i)
93 header=header ", @file{" $i "}"
96 $1 == "@comment" && $2 == "(none)" { header = -1; }
98 $1 == "@comment" && header != 0 { std=$2;
99 for (i=3;i<=NF;++i) std=std " " $i }
101 header != 0 && $1 ~ /@def|@item|@vindex/ \
102 { defn=""; name=""; curly=0; n=1;
103 for (i = 2; i <= NF; ++i) {
104 if ($i ~ /^{/ && $i !~ /}/) {
105 curly=1
106 word=substr ($i, 2, length ($i))
108 else {
109 if (curly) {
110 if ($i ~ /}$/) {
111 curly=0
112 word=word " " substr ($i, 1, length ($i) - 1)
113 } else
114 word=word " " $i
116 # Handle a single word in braces.
117 else if ($i ~ /^{.*}$/)
118 word=substr ($i, 2, length ($i) - 2)
119 else
120 word=$i
121 if (!curly) {
122 if (n >= firstword[$1])
123 defn=defn " " word
124 if (n == nameword[$1])
125 name=word
130 printf "@comment %s%c", name, 012 # FF
131 printf "@item%s%c%c", defn, 012, 012
132 if (header != -1) printf "%s ", header;
133 printf "(%s): @ref{%s}.%c\n", std, node, 012;
134 header = 0 }