2 # $NetBSD: devlist2h.awk,v 1.3 1998/09/05 14:42:06 christos Exp $
6 # Copyright (c) 1998 The NetBSD Foundation, Inc.
9 # This code is derived from software contributed to The NetBSD Foundation
12 # Redistribution and use in source and binary forms, with or without
13 # modification, are permitted provided that the following conditions
15 # 1. Redistributions of source code must retain the above copyright
16 # notice, this list of conditions and the following disclaimer.
17 # 2. Redistributions in binary form must reproduce the above copyright
18 # notice, this list of conditions and the following disclaimer in the
19 # documentation and/or other materials provided with the distribution.
21 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 # POSSIBILITY OF SUCH DAMAGE.
33 # Copyright (c) 1995, 1996 Christopher G. Demetriou
34 # All rights reserved.
36 # Redistribution and use in source and binary forms, with or without
37 # modification, are permitted provided that the following conditions
39 # 1. Redistributions of source code must retain the above copyright
40 # notice, this list of conditions and the following disclaimer.
41 # 2. Redistributions in binary form must reproduce the above copyright
42 # notice, this list of conditions and the following disclaimer in the
43 # documentation and/or other materials provided with the distribution.
44 # 3. All advertising materials mentioning features or use of this software
45 # must display the following acknowledgement:
46 # This product includes software developed by Christopher G. Demetriou.
47 # This product includes software developed by Christos Zoulas
48 # 4. The name of the author(s) may not be used to endorse or promote products
49 # derived from this software without specific prior written permission
51 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
52 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
53 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
54 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
55 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
60 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 function collectline(f, line) {
89 nproducts = nvendors = 0
94 gsub("\\$", "", VERSION)
96 printf("/*\t\$FreeBSD\$\t*/\n\n") > hfile
97 printf("/*\n") > hfile
98 printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
100 printf(" *\n") > hfile
101 printf(" * generated from:\n") > hfile
102 printf(" *\t%s\n", VERSION) > hfile
103 printf(" */\n") > hfile
110 vendorindex[$2] = nvendors; # record index for this name, for later.
111 vendors[nvendors, 1] = $2; # name
114 vendors[nvendors, 2] = $3; # id
115 printf("#define\tPCMCIA_VENDOR_%s\t%s\t", vendors[nvendors, 1],
116 vendors[nvendors, 2]) > hfile
117 vendors[nvendors, 3] = collectline(4, line)
118 printf("/* %s */\n", vendors[nvendors, 3]) > hfile
124 products[nproducts, 1] = $2; # vendor name
127 products[nproducts, 2] = $3; # product id
128 products[nproducts, 3] = $4; # id
133 products[nproducts, 3] = "0xffffffff";
135 for (i = 0; i < 4; i++) {
138 gsub("&tab", "\t", $f)
139 gsub("&nl", "\n", $f)
150 products[nproducts, 4] = z $f
154 products[nproducts, 4] = "{ NULL, NULL, NULL, NULL }"
156 printf("#define\tPCMCIA_CIS_%s_%s\t%s\n",
157 products[nproducts, 1], products[nproducts, 2],
158 products[nproducts, 4]) > hfile
159 printf("#define\tPCMCIA_PRODUCT_%s_%s\t%s\n", products[nproducts, 1],
160 products[nproducts, 2], products[nproducts, 3]) > hfile
162 products[nproducts, 5] = collectline(f, line)
164 printf("#define\tPCMCIA_STR_%s_%s\t\"%s\"\n",
165 products[nproducts, 1], products[nproducts, 2],
166 products[nproducts, 5]) > hfile