2 # $NetBSD: devlist2h.awk,v 1.3 1998/09/05 14:42:06 christos Exp $
3 # $FreeBSD: src/sys/dev/pccard/devlist2h.awk,v 1.3 2003/03/28 06:43:50 imp Exp $
4 # $DragonFly: src/sys/bus/pccard/devlist2h.awk,v 1.1 2004/02/10 07:55:45 joerg 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.
20 # 3. All advertising materials mentioning features or use of this software
21 # must display the following acknowledgement:
22 # This product includes software developed by the NetBSD
23 # Foundation, Inc. and its contributors.
24 # 4. Neither the name of The NetBSD Foundation nor the names of its
25 # contributors may be used to endorse or promote products derived
26 # from this software without specific prior written permission.
28 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
29 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
32 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 # POSSIBILITY OF SUCH DAMAGE.
40 # Copyright (c) 1995, 1996 Christopher G. Demetriou
41 # All rights reserved.
43 # Redistribution and use in source and binary forms, with or without
44 # modification, are permitted provided that the following conditions
46 # 1. Redistributions of source code must retain the above copyright
47 # notice, this list of conditions and the following disclaimer.
48 # 2. Redistributions in binary form must reproduce the above copyright
49 # notice, this list of conditions and the following disclaimer in the
50 # documentation and/or other materials provided with the distribution.
51 # 3. All advertising materials mentioning features or use of this software
52 # must display the following acknowledgement:
53 # This product includes software developed by Christopher G. Demetriou.
54 # This product includes software developed by Christos Zoulas
55 # 4. The name of the author(s) may not be used to endorse or promote products
56 # derived from this software without specific prior written permission
58 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
59 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
60 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
61 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
62 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
63 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
64 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
65 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
66 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
67 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
69 function collectline
(f
, line
) {
96 nproducts = nvendors =
0
100 printf("/*\n") > hfile
101 printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
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