1 # $NetBSD: devlist2h.awk,v 1.4.86.1 2008/10/27 08:02:40 skrll Exp $
3 # $OpenBSD: devlist2h.awk,v 1.6 2004/04/07 18:24:19 mickey Exp $
6 # Copyright (c) 1998-2003 Michael Shalayeff
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
18 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 # IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
22 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 # SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 # THE POSSIBILITY OF SUCH DAMAGE.
34 cpud=
"cpudevs_data.h";
40 /^
[ \t]*\
/\
*/ {busted
++}
45 cp =
match($
0, /\
*\
//);
48 } else if (cp
+ 1 ==
length($
0)) {
57 # first line is rcsid, beware
60 gsub("\\$", "", VERSION
);
62 printf("/*\t$NetBSD" "$\t*/\n\n") > cpud
;
63 printf("/*\n * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n" \
64 " * generated from:\n *\t%s\n */\n\n", VERSION
) > cpud
;
65 printf("/*\t$NetBSD" "$\t*/\n\n") > cpuh
;
66 printf("/*\n * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n" \
67 " * generated from:\n *\t%s\n */\n\n", VERSION
) > cpuh
;
74 NF > 0 && $
1 ==
"type" {
75 printf("#define\tHPPA_TYPE_%s\t%s\n", toupper($
2), $
3) > cpuh
;
76 types
[tolower($
2)] =
toupper($
2);
81 if (tolower($
1) in types
) {
82 printf("#define\tHPPA_%s_%s\t%s\n", toupper($
1),
83 toupper($
2), $
3) > cpuh
;
84 printf("{HPPA_TYPE_%s,\tHPPA_%s_%s,\t\"", toupper($
1),
85 toupper($
1), toupper($
2), $
3) > cpud
;
88 sub(/[ \t]*/, "", $f
);
89 ep =
match($f
, /\
*\
//);
94 if (match($f
, /\
/\
*/)) {
98 sub(/\
/\
*.
*$
/, "", $f
);
103 gsub(/^.
*\
*\
//, "", $f
);
109 printf ("%s", $f
) > cpud
;
113 printf("\" },\n") > cpud
;
115 printf("WHA at line %d\n", NR);
122 print("unterminated comment at the EOF\n");
125 printf("{ -1 }\n") > cpud
;