2 # $NetBSD: devlist2h.awk,v 1.4 2005/12/11 12:18:53 christos Exp $
4 # Copyright (c) 1998 The NetBSD Foundation, Inc.
7 # This code is derived from software contributed to The NetBSD Foundation
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions
13 # 1. Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 # 2. Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in the
17 # documentation and/or other materials provided with the distribution.
19 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
31 # Copyright (c) 1995, 1996 Christopher G. Demetriou
32 # All rights reserved.
34 # Redistribution and use in source and binary forms, with or without
35 # modification, are permitted provided that the following conditions
37 # 1. Redistributions of source code must retain the above copyright
38 # notice, this list of conditions and the following disclaimer.
39 # 2. Redistributions in binary form must reproduce the above copyright
40 # notice, this list of conditions and the following disclaimer in the
41 # documentation and/or other materials provided with the distribution.
42 # 3. All advertising materials mentioning features or use of this software
43 # must display the following acknowledgement:
44 # This product includes software developed by Christopher G. Demetriou.
45 # This product includes software developed by Christos Zoulas
46 # 4. The name of the author(s) may not be used to endorse or promote products
47 # derived from this software without specific prior written permission
49 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
50 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
51 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
52 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
53 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
54 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
55 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
56 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
57 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
58 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 function collectline
(_f
, _line
) {
87 nproducts = nvendors = blanklines =
0
88 dfile=
"giodevs_data.h"
94 gsub("\\$", "", VERSION
)
96 printf("/*\t$NetBSD" "$\t*/\n\n") > hfile
97 printf("/*\n") > hfile
98 printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
100 printf(" */\n") > hfile
102 printf("/*\t$NetBSD" "$\t*/\n\n") > dfile
103 printf("/*\n") > dfile
104 printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
106 printf(" */\n") > dfile
110 NF > 0 && $
1 ==
"product" {
113 products
[nproducts
, 1] = $
2;
114 products
[nproducts
, 2] = $
3
115 products
[nproducts
, 3] = collectline
(4, line
)
126 # print out the match tables
130 printf("struct gio_knowndev {\n") > dfile
131 printf("\tint productid;\n") > dfile
132 printf("\tconst char *product;\n") > dfile
133 printf("};\n") > dfile
134 printf("\nstruct gio_knowndev gio_knowndevs[] = {\n") > dfile
137 for (i =
1; i
<= nproducts
; i
++) {
138 printf("#define %s\t%s\t/* %s */\n", products
[i
, 1], products
[i
,2], products
[i
, 3]) > hfile
140 printf("\t{ %s, \"%s\" },\n",
141 products
[i
, 2], products
[i
, 3]) > dfile
143 printf("\t{ 0, NULL }\n") > dfile
144 printf("};\n") > dfile