2 # $NetBSD: devlist2h.awk,v 1.9 2005/12/11 12:24:00 christos Exp $
4 # Copyright (c) 1995, 1996 Christopher G. Demetriou
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 # 3. All advertising materials mentioning features or use of this software
16 # must display the following acknowledgement:
17 # This product includes software developed by Christopher G. Demetriou.
18 # 4. The name of the author may not be used to endorse or promote products
19 # derived from this software without specific prior written permission
21 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 nproducts = ndevices = blanklines =
0
39 gsub("\\$", "", VERSION
)
40 gsub(/ $
/, "", VERSION
)
42 printf("/*\t$NetBSD" "$\t*/\n\n") > dfile
43 printf("/*\n") > dfile
44 printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
46 printf(" *\n") > dfile
47 printf(" * generated from:\n") > dfile
48 printf(" *\t%s\n", VERSION
) > dfile
49 printf(" */\n") > dfile
51 printf("/*\t$NetBSD" "$\t*/\n\n") > hfile
52 printf("/*\n") > hfile
53 printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
55 printf(" *\n") > hfile
56 printf(" * generated from:\n") > hfile
57 printf(" *\t%s\n", VERSION
) > hfile
58 printf(" */\n") > hfile
62 NF > 0 && $
1 ==
"device" {
65 devices
[ndevices
, 0] = $
2; # devices id
66 devices
[ndevices
, 1] = $
2; # C identifier for device
67 gsub("-", "_", devices
[ndevices
, 1]);
69 devices
[ndevices
, 2] = $
3; # driver name
72 printf("#define\tTC_DEVICE_%s\t\"%s\"\n", devices
[ndevices
, 1],
73 devices
[ndevices
, 2]) > hfile
75 printf("#define\tTC_DESCRIPTION_%s\t\"", devices
[ndevices
, 1]) > hfile
93 printf("%s", $f
) > hfile
99 devices
[ndevices
, i
] = $f
100 printf("%s", devices
[ndevices
, i
]) > hfile
122 # print out the match tables
126 printf("const struct tc_knowndev tc_knowndevs[] = {\n") > dfile
127 for (i =
1; i
<= ndevices
; i
++) {
128 printf("\t{\n") > dfile
129 printf("\t \"%-8s\",\n", devices
[i
, 0]) \
131 printf("\t TC_DEVICE_%s,\n", devices
[i
, 1]) \
133 printf("\t TC_DESCRIPTION_%s,\n", devices
[i
, 1]) \
136 printf("\t},\n") > dfile
138 printf("\t{ NULL, NULL, NULL, }\n") > dfile
139 printf("};\n") > dfile