Update.
[glibc.git] / manual / summary.awk
blob366ee41946e6fdc1b58562d62dba064c3878f6ab
1 # awk script to create summary.texinfo from the library texinfo files.
3 # Copyright (C) 1992, 1993, 1997 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 not,
18 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, 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; }
89 sub (/,[, ]*$/, "", node);
92 $1 == "@comment" && $2 ~ /\.h$/ { header="@file{" $2 "}";
93 for (i = 3; i <= NF; ++i)
94 header=header ", @file{" $i "}"
97 $1 == "@comment" && $2 == "(none)" { header = -1; }
99 $1 == "@comment" && header != 0 { std=$2;
100 for (i=3;i<=NF;++i) std=std " " $i }
102 header != 0 && $1 ~ /@def|@item|@vindex/ \
103 { defn=""; name=""; curly=0; n=1;
104 for (i = 2; i <= NF; ++i) {
105 if ($i ~ /^{/ && $i !~ /}/) {
106 curly=1
107 word=substr ($i, 2, length ($i))
109 else {
110 if (curly) {
111 if ($i ~ /}$/) {
112 curly=0
113 word=word " " substr ($i, 1, length ($i) - 1)
114 } else
115 word=word " " $i
117 # Handle a single word in braces.
118 else if ($i ~ /^{.*}$/)
119 word=substr ($i, 2, length ($i) - 2)
120 else
121 word=$i
122 if (!curly) {
123 if (n >= firstword[$1])
124 defn=defn " " word
125 if (n == nameword[$1])
126 name=word
131 printf "@comment %s%c", name, 012 # FF
132 printf "@item%s%c%c", defn, 012, 012
133 if (header != -1) printf "%s ", header;
134 printf "(%s): @ref{%s}.%c\n", std, node, 012;
135 header = 0 }