[BACK]Return to devlist2h.awk CVS log [TXT][DIR] Up to [local] / sys / dev / isa

Annotation of sys/dev/isa/devlist2h.awk, Revision 1.1.1.1

1.1       nbrk        1: #! /usr/bin/awk -f
                      2: #      $OpenBSD: devlist2h.awk,v 1.6 2001/01/29 06:16:14 mickey Exp $
                      3: #      $NetBSD: devlist2h.awk,v 1.2 1996/01/22 21:08:09 cgd Exp $
                      4: #
                      5: # Copyright (c) 1995, 1996 Christopher G. Demetriou
                      6: # All rights reserved.
                      7: #
                      8: # Redistribution and use in source and binary forms, with or without
                      9: # modification, are permitted provided that the following conditions
                     10: # are met:
                     11: # 1. Redistributions of source code must retain the above copyright
                     12: #    notice, this list of conditions and the following disclaimer.
                     13: # 2. Redistributions in binary form must reproduce the above copyright
                     14: #    notice, this list of conditions and the following disclaimer in the
                     15: #    documentation and/or other materials provided with the distribution.
                     16: # 3. All advertising materials mentioning features or use of this software
                     17: #    must display the following acknowledgement:
                     18: #      This product includes software developed by Christopher G. Demetriou.
                     19: # 4. The name of the author may not be used to endorse or promote products
                     20: #    derived from this software without specific prior written permission
                     21: #
                     22: # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     23: # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     24: # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     25: # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     26: # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     27: # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     28: # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     29: # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     30: # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     31: # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     32: #
                     33: BEGIN {
                     34:        nproducts = 0
                     35:        dfile="pnpdevs.h"
                     36: }
                     37: NR == 1 {
                     38:        VERSION = $0
                     39:        gsub("\\$", "", VERSION)
                     40:
                     41:        printf("/*\n") > dfile
                     42:        printf(" * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.\n") \
                     43:            > dfile
                     44:        printf(" *\n") > dfile
                     45:        printf(" * generated from:\n") > dfile
                     46:        printf(" *\t%s\n", VERSION) > dfile
                     47:        printf(" */\n") > dfile
                     48:
                     49:        next
                     50: }
                     51: {
                     52:        if ($1 == "")
                     53:                next
                     54:        if (substr($1,0,1) == "#")
                     55:                next
                     56:        if (substr($2,0,1) == "#")
                     57:                next
                     58:        do {
                     59:                nproducts++
                     60:                if ((x = index($1, "/")))
                     61:                        products[nproducts, 1] = substr($1, 1, x - 1);
                     62:                else
                     63:                        products[nproducts, 1] = $1;            # driver name
                     64:                products[nproducts, 2] = $2;            # pnp id
                     65: #              if ($3 && substr($3,0,1) == "#")
                     66: #                      products[nproducts, 3] = substr($3, 1);
                     67: #              printf("%s %s %s\n", $1, $2, products[nproducts, 3]);
                     68:        } while (x && ($1 = substr($1, x + 1, length($1) - x)));
                     69:
                     70:        next
                     71: }
                     72: END {
                     73:        # print out the match tables
                     74:
                     75:        printf("\n") > dfile
                     76:
                     77:        printf("const struct isapnp_knowndev isapnp_knowndevs[] = {\n") > dfile
                     78:        for (i = 1; i <= nproducts; i++) {
                     79:                printf("\t{ {\"%s\"}, {\"%s\"} },",
                     80:                    products[i, 2], products[i, 1]) \
                     81:                    > dfile
                     82:                if (products[i, 3])
                     83:                        printf("\t/* %s */", products[i, 3]) > dfile
                     84:                printf("\n") > dfile
                     85:        }
                     86:        printf("};\n") > dfile
                     87: }

CVSweb