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