Update.
[glibc.git] / manual / summary.awk
blob2eade0c20d211da399cd90ba72a97c230de0d05b
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["@defmac"]=1
29 nameword["@defspec"]=1
30 nameword["@defvar"]=1
31 nameword["@defopt"]=1
32 nameword["@deffn"]=2
33 nameword["@defvr"]=2
34 nameword["@deftp"]=2
35 nameword["@deftypefun"]=2
36 nameword["@deftypevar"]=2
37 nameword["@deftypefn"]=3
38 nameword["@deftypevr"]=3
39 firstword["@defun"]=1
40 firstword["@defmac"]=1
41 firstword["@defspec"]=1
42 firstword["@defvar"]=1
43 firstword["@defopt"]=1
44 firstword["@deffn"]=2
45 firstword["@defvr"]=2
46 firstword["@deftp"]=2
47 firstword["@deftypefun"]=1
48 firstword["@deftypevar"]=1
49 firstword["@deftypefn"]=2
50 firstword["@deftypevr"]=2
51 nameword["@item"]=1
52 firstword["@item"]=1
53 nameword["@itemx"]=1
54 firstword["@itemx"]=1
55 nameword["@vindex"]=1
56 firstword["@vindex"]=1
58 print "@c DO NOT EDIT THIS FILE!"
59 print "@c This file is generated by summary.awk from the Texinfo sources."
62 $1 == "@node" { node=$2;
63 for (i = 3; i <= NF; ++i)
64 { node=node " " $i; if ( $i ~ /,/ ) break; }
67 $1 == "@comment" && $2 ~ /\.h$/ { header="@file{" $2 "}";
68 for (i = 3; i <= NF; ++i)
69 header=header ", @file{" $i "}"
72 $1 == "@comment" && $2 == "(none)" { header = -1; }
74 $1 == "@comment" && header != 0 { std=$2;
75 for (i=3;i<=NF;++i) std=std " " $i }
77 header != 0 && $1 ~ /@def|@item|@vindex/ \
78 { defn=""; name=""; curly=0; n=1;
79 for (i = 2; i <= NF; ++i) {
80 if ($i ~ /^{/ && $i !~ /}/) {
81 curly=1
82 word=substr ($i, 2, length ($i))
84 else {
85 if (curly) {
86 if ($i ~ /}$/) {
87 curly=0
88 word=word " " substr ($i, 1, length ($i) - 1)
89 } else
90 word=word " " $i
92 # Handle a single word in braces.
93 else if ($i ~ /^{.*}$/)
94 word=substr ($i, 2, length ($i) - 2)
95 else
96 word=$i
97 if (!curly) {
98 if (n >= firstword[$1])
99 defn=defn " " word
100 if (n == nameword[$1])
101 name=word
106 printf "@comment %s%c", name, 012 # FF
107 printf "@item%s%c%c", defn, 012, 012
108 if (header != -1) printf "%s ", header;
109 printf "(%s): @ref{%s}.%c\n", std, node, 012;
110 header = 0 }