Ticket #302: pci-header-update.2.diff

File pci-header-update.2.diff, 2.1 KB (added by johndrinkwater, 18 years ago)

The actual patch, ignore the previous version

  • pci-header.awk

     
    88#
    99# Use with http://pciids.sourceforge.net/pci.ids
    1010# run as: awk -v HEADERFILE=pcihdr.h -f pci-header.awk pci.ids
     11# Updated to run with non-posix / traditional awk
    1112
    1213BEGIN {
    1314
     
    2627    print "#if 0" > ofile
    2728    print "#\tPCIHDR.H: PCI Vendors, Devices, and Class Type information\n#" > ofile
    2829    print "#\tGenerated by pci-header.awk, source data from the following URI:\n#\thttp://pciids.sourceforge.net/pci.ids\n#" > ofile
    29     print "#\tHeader created on " strftime( "%A, %d %b %Y %H:%M:%S %Z", systime() ) > ofile
     30    # print "#\tHeader created on " strftime( "%A, %d %b %Y %H:%M:%S %Z", systime() ) > ofile
    3031    print "#endif" > ofile
    3132
    3233    # and we start with vendors..
     
    3637
    3738# matches vendor - starts with an id as first thing on the line
    3839# because this occurs first in the header file, we output it without worry
    39 /^[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] / {
     40/^[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F] / {
    4041
    4142    if ( vendorcount++ > 0 ) {
    4243        formatting = ",\n"
     
    5354}
    5455
    5556# matches device
    56 /^\t[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] / {
     57/^\t[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F] / {
    5758
    5859    device = substr($0, 8)
    5960    gsub( /\"/, "\\\"", device )
     
    6566}
    6667
    6768# matches subvendor device
    68 /^\t\t[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] / {
     69/^\t\t[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F] / {
    6970
    7071    device = substr($0, 14)
    7172    gsub( /\"/, "\\\"", device )
     
    7778}
    7879
    7980# match device class - store data for later
    80 /^C [[:xdigit:]][[:xdigit:]]  / {
     81/^C [0-9a-fA-F][0-9a-fA-F]  / {
    8182
    8283    class = $2
    8384    classname = substr($0, 7)
     
    8586}
    8687
    8788# match subclass, use device class data captured earlier, and output
    88 /^\t[[:xdigit:]][[:xdigit:]]  / {
     89/^\t[0-9a-fA-F][0-9a-fA-F]  / {
    8990
    9091    subclass = $1
    9192    subclassname = substr($0, 6)
     
    101102}
    102103
    103104# match programming interface
    104 /^\t\t[[:xdigit:]][[:xdigit:]]  / {
     105/^\t\t[0-9a-fA-F][0-9a-fA-F]  / {
    105106
    106107    proginterface = $1
    107108    proginterfacename = substr($0, 7)