No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / hp700 / dev / devlist2h.awk
blob95b6b1abbd5b3f0de33f98d4525cd2b67d0b3a09
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
7 # All rights reserved.
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
11 # are met:
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.
31 BEGIN {
32 ncpu = busted = 0;
33 cpuh="cpudevs.h";
34 cpud="cpudevs_data.h";
35 SUBSEP = "_";
38 /^[ \t]*$/ {next}
40 /^[ \t]*\/\*/ {busted++}
42 /^[ \t]*#/ {next}
44 busted {
45 cp = match($0, /\*\//);
46 if(!cp) {
47 next;
48 } else if (cp + 1 == length($0)) {
49 busted = 0;
50 next;
51 } else {
52 sub(/.*\*\//, "");
53 busted = 0;
57 # first line is rcsid, beware
58 NR == 1 {
59 VERSION = $0;
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;
70 /^\$/ {
71 next;
74 NF > 0 && $1 == "type" {
75 printf("#define\tHPPA_TYPE_%s\t%s\n", toupper($2), $3) > cpuh;
76 types[tolower($2)] = toupper($2);
77 next;
80 NR > 1 {
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;
86 f = 4;
87 while (f <= NF) {
88 sub(/[ \t]*/, "", $f);
89 ep = match($f, /\*\//);
90 if (busted && !ep) {
91 f++;
92 continue;
94 if (match($f, /\/\*/)) {
95 if (ep) {
96 sub(/\/\*/, "", $f);
97 } else {
98 sub(/\/\*.*$/, "", $f);
99 busted++;
102 if (ep) {
103 gsub(/^.*\*\//, "", $f);
104 busted = 0;
106 if (length($f)) {
107 if (f > 4)
108 printf (" ") > cpud;
109 printf ("%s", $f) > cpud;
111 f++;
113 printf("\" },\n") > cpud;
114 } else {
115 printf("WHA at line %d\n", NR);
116 exit(1);
120 END {
121 if (busted) {
122 print("unterminated comment at the EOF\n");
123 exit(1);
125 printf("{ -1 }\n") > cpud;
126 close(cpud)
127 close(cpuh)