Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / onewire / devlist2h.awk
blob5211b5a8632c6089ffc7e864ee8dc06f26e7643d
1 # $NetBSD$
2 # $OpenBSD: devlist2h.awk,v 1.3 2006/03/10 14:36:32 grange Exp $
5 # Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
7 # Permission to use, copy, modify, and distribute this software for any
8 # purpose with or without fee is hereby granted, provided that the above
9 # copyright notice and this permission notice appear in all copies.
11 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 BEGIN {
21 hfile = "onewiredevs.h"
22 dfile = "onewiredevs_data.h"
25 NR == 1 {
26 VERSION = $0
27 gsub("\\$", "", VERSION)
29 printf("/*\t\$NetBSD\$\t*/\n\n" \
30 "/*\n * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n" \
31 " *\n * Generated from:\n *\t%s\n */\n\n", VERSION) > hfile
32 printf("/*\t\$NetBSD\$\t*/\n\n" \
33 "/*\n * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n" \
34 " *\n * Generated from:\n *\t%s\n */\n\n", VERSION) > dfile
35 printf("static const struct onewire_family " \
36 "onewire_famtab[] = {\n") > dfile
39 $1 == "family" {
40 printf("#define ONEWIRE_FAMILY_%s\t%s\n", toupper($2), $3) > hfile
41 printf("\t{ ONEWIRE_FAMILY_%s, \"", toupper($2)) > dfile
43 f = 4
44 while (f <= NF) {
45 if (f > 4)
46 printf(" ") > dfile
47 printf("%s", $f) > dfile
48 f++
50 printf("\" },\n") > dfile
51 next
54 END {
55 printf("\t{ 0, NULL }\n};\n") > dfile