Ticket #302: pci-header-update.2.diff
File pci-header-update.2.diff, 2.1 KB (added by , 19 years ago) |
---|
-
pci-header.awk
8 8 # 9 9 # Use with http://pciids.sourceforge.net/pci.ids 10 10 # run as: awk -v HEADERFILE=pcihdr.h -f pci-header.awk pci.ids 11 # Updated to run with non-posix / traditional awk 11 12 12 13 BEGIN { 13 14 … … 26 27 print "#if 0" > ofile 27 28 print "#\tPCIHDR.H: PCI Vendors, Devices, and Class Type information\n#" > ofile 28 29 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() ) > ofile30 # print "#\tHeader created on " strftime( "%A, %d %b %Y %H:%M:%S %Z", systime() ) > ofile 30 31 print "#endif" > ofile 31 32 32 33 # and we start with vendors.. … … 36 37 37 38 # matches vendor - starts with an id as first thing on the line 38 39 # 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] / { 40 41 41 42 if ( vendorcount++ > 0 ) { 42 43 formatting = ",\n" … … 53 54 } 54 55 55 56 # 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] / { 57 58 58 59 device = substr($0, 8) 59 60 gsub( /\"/, "\\\"", device ) … … 65 66 } 66 67 67 68 # 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] / { 69 70 70 71 device = substr($0, 14) 71 72 gsub( /\"/, "\\\"", device ) … … 77 78 } 78 79 79 80 # match device class - store data for later 80 /^C [ [:xdigit:]][[:xdigit:]] / {81 /^C [0-9a-fA-F][0-9a-fA-F] / { 81 82 82 83 class = $2 83 84 classname = substr($0, 7) … … 85 86 } 86 87 87 88 # match subclass, use device class data captured earlier, and output 88 /^\t[ [:xdigit:]][[:xdigit:]] / {89 /^\t[0-9a-fA-F][0-9a-fA-F] / { 89 90 90 91 subclass = $1 91 92 subclassname = substr($0, 6) … … 101 102 } 102 103 103 104 # match programming interface 104 /^\t\t[ [:xdigit:]][[:xdigit:]] / {105 /^\t\t[0-9a-fA-F][0-9a-fA-F] / { 105 106 106 107 proginterface = $1 107 108 proginterfacename = substr($0, 7)