diff options
author | ben <ben@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-12-04 18:10:20 +0000 |
---|---|---|
committer | ben <ben@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-12-04 18:10:20 +0000 |
commit | cee668bb27e8b8322b9ccdaabab3e58cfe5c413d (patch) | |
tree | 3e9e7bb590b82cc1a854bdecf597f41460aa1584 /vidix/pci_db2c.awk | |
parent | 298578466c5e8d58444e1ed217bf10301d7ca056 (diff) | |
download | mpv-cee668bb27e8b8322b9ccdaabab3e58cfe5c413d.tar.bz2 mpv-cee668bb27e8b8322b9ccdaabab3e58cfe5c413d.tar.xz |
add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25299 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'vidix/pci_db2c.awk')
-rw-r--r-- | vidix/pci_db2c.awk | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/vidix/pci_db2c.awk b/vidix/pci_db2c.awk index 12502d06f9..8bbc19dde0 100644 --- a/vidix/pci_db2c.awk +++ b/vidix/pci_db2c.awk @@ -26,12 +26,13 @@ BEGIN { - if(ARGC != 2) { + if(ARGC != 3) { # check for arguments: print "Usage awk -f pci_db2c.awk pci.db (and make sure pci.db file exists first)"; exit(1); } in_file = ARGV[1]; + with_pci_db = ARGV[2]; vendor_file = "pci_vendors.h"; ids_file = "pci_ids.h" name_file = "pci_names.c" @@ -60,9 +61,11 @@ BEGIN { print_name_struct(name_h_file); print "#include <stddef.h>">name_file print "#include \"pci_names.h\"">name_file + if (with_pci_db) { print "#include \"pci_dev_ids.c\"">name_file print "">name_file print "static struct vendor_id_s vendor_ids[] = {">name_file + } first_pass=1; init_name_db(); while(getline <in_file) @@ -78,7 +81,7 @@ BEGIN { printf("#define VENDOR_%s\t", svend_name) >vendor_file; if(length(svend_name) < 9) printf("\t") >vendor_file; printf("0x%s /*%s*/\n",field[2], name_field) >vendor_file; - printf("{ 0x%s, \"%s\", dev_lst_%s },\n",field[2], name_field, field[2]) >name_file; + if (with_pci_db) printf("{ 0x%s, \"%s\", dev_lst_%s },\n",field[2], name_field, field[2]) >name_file; printf("/* Vendor: %s: %s */\n", field[2], name_field) > ids_file if(first_pass == 1) { first_pass=0; } else { print "{ 0xFFFF, NULL }\n};" >dev_ids_file; } @@ -118,7 +121,7 @@ BEGIN { print "#endif/*PCI_IDS_INCLUDED*/">ids_file print "">name_h_file print "#endif/*PCI_NAMES_INCLUDED*/">name_h_file - print "};">name_file + if (with_pci_db) print "};">name_file print "{ 0xFFFF, NULL }" >dev_ids_file; print "};">dev_ids_file print_func_bodies(name_file); @@ -172,16 +175,19 @@ function print_func_bodies(out_file) print "">out_file print "const char *pci_vendor_name(unsigned short id)" >out_file print "{" >out_file + if (with_pci_db) { print " unsigned i;" >out_file print " for(i=0;i<sizeof(vendor_ids)/sizeof(struct vendor_id_s);i++)">out_file print " {" >out_file print "\tif(vendor_ids[i].id == id) return vendor_ids[i].name;" >out_file print " }" >out_file + } print " return NULL;" >out_file print "}">out_file print "" >out_file print "const char *pci_device_name(unsigned short vendor_id, unsigned short device_id)" >out_file print "{" >out_file + if (with_pci_db) { print " unsigned i, j;" >out_file print " for(i=0;i<sizeof(vendor_ids)/sizeof(struct vendor_id_s);i++)">out_file print " {" >out_file @@ -196,6 +202,7 @@ function print_func_bodies(out_file) print "\t break;" >out_file print "\t}" >out_file print " }" >out_file + } print " return NULL;">out_file print "}">out_file return |