3 # $OpenBSD: devlist2h.awk,v 1.2 2006/06/02 21:16:44 uwe Exp $
4 # NetBSD: devlist2h.awk,v 1.2 1998/07/22 11:47:13 christos Exp
6 # Copyright (c) 1998, Christos Zoulas
7 # Copyright (c) 1995, 1996 Christopher G. Demetriou
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.
18 # 3. All advertising materials mentioning features or use of this software
19 # must display the following acknowledgement:
20 # This product includes software developed by Christopher G. Demetriou.
21 # This product includes software developed by Christos Zoulas
22 # 4. The name of the author(s) may not be used to endorse or promote products
23 # derived from this software without specific prior written permission
25 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 function collectline
(f
, line
) {
63 nproducts = nvendors =
0
68 gsub("\\$", "", VERSION
)
70 printf("/*\t$NetBSD$\t*/\n\n") > hfile
71 printf("/*\n") > hfile
72 printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
74 printf(" *\n") > hfile
75 printf(" * generated from:\n") > hfile
76 printf(" *\t%s\n", VERSION
) > hfile
77 printf(" */\n") > hfile
84 vendorindex
[$
2] = nvendors
; # record index for this name, for later.
85 vendors
[nvendors
, 1] = $
2; # name
86 vendors
[nvendors
, 2] = $
3; # id
87 printf("#define\tSDMMC_VENDOR_%s\t%s\t", vendors
[nvendors
, 1],
88 vendors
[nvendors
, 2]) > hfile
89 vendors
[nvendors
, 3] = collectline
(4, line
)
90 printf("/* %s */\n", vendors
[nvendors
, 3]) > hfile
96 products
[nproducts
, 1] = $
2; # vendor name
97 products
[nproducts
, 2] = $
3; # product id
98 products
[nproducts
, 3] = $
4; # id
103 products
[nproducts
, 3] =
"SDMMC_PRODUCT_INVALID"
105 for (i =
0; i
< 4; i
++) {
108 gsub("&tab", "\t", $f
)
109 gsub("&nl", "\n", $f
)
120 products
[nproducts
, 4] = z $f
124 products
[nproducts
, 4] =
"{ NULL, NULL, NULL, NULL }"
126 printf("#define\tSDMMC_CIS_%s_%s\t%s\n",
127 products
[nproducts
, 1], products
[nproducts
, 2],
128 products
[nproducts
, 4]) > hfile
129 printf("#define\tSDMMC_PRODUCT_%s_%s\t%s\n", products
[nproducts
, 1],
130 products
[nproducts
, 2], products
[nproducts
, 3]) > hfile
132 # products[nproducts, 5] = collectline(f, line)
134 # printf("#define\tSDMMC_STR_%s_%s\t\"%s\"\n",
135 # products[nproducts, 1], products[nproducts, 2],
136 # products[nproducts, 5]) > hfile