[MPlayer-cvslog] r30214 - in trunk: Makefile vidix vidix/pci_db2c.awk vidix/pci_names.c

diego subversion at mplayerhq.hu
Mon Jan 4 21:53:57 CET 2010


Author: diego
Date: Mon Jan  4 21:53:57 2010
New Revision: 30214

Log:
Remove previous failed attempt at disabling that auto-generation of some C code.
This reverts the previous buggy commit, r30094.

Deleted:
   trunk/vidix/pci_names.c
Modified:
   trunk/Makefile
   trunk/vidix/   (props changed)
   trunk/vidix/pci_db2c.awk

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	Mon Jan  4 21:36:27 2010	(r30213)
+++ trunk/Makefile	Mon Jan  4 21:53:57 2010	(r30214)
@@ -897,7 +897,7 @@ tremor/%: CFLAGS += $(CFLAGS_TREMOR_LOW)
 
 vidix/%: CFLAGS += $(CFLAGS_DHAHELPER) $(CFLAGS_SVGALIB_HELPER)
 
-VIDIX_PCI_FILES = vidix/pci_dev_ids.c vidix/pci_ids.h vidix/pci_vendor_ids.h \
+VIDIX_PCI_FILES = vidix/pci_dev_ids.c vidix/pci_ids.h vidix/pci_names.c \
                   vidix/pci_vendors.h
 
 $(VIDIX_PCI_FILES): vidix/pci_db2c.awk vidix/pci.db

Modified: trunk/vidix/pci_db2c.awk
==============================================================================
--- trunk/vidix/pci_db2c.awk	Mon Jan  4 21:36:27 2010	(r30213)
+++ trunk/vidix/pci_db2c.awk	Mon Jan  4 21:53:57 2010	(r30214)
@@ -34,12 +34,12 @@ BEGIN {
     with_pci_db = ARGV[2];
     dev_ids_c_file = "vidix/pci_dev_ids.c"
     ids_h_file     = "vidix/pci_ids.h"
-    vendor_ids_h_file = "vidix/pci_vendor_ids.h"
+    names_c_file   = "vidix/pci_names.c"
     vendors_h_file = "vidix/pci_vendors.h";
     # print out head lines
     print_head(vendors_h_file);
     print_head(ids_h_file);
-    print_head(vendor_ids_h_file);
+    print_head(names_c_file);
     print_head(dev_ids_c_file);
     print "#include <stdlib.h>" > dev_ids_c_file;
     print "#include \"pci_names.h\"" > dev_ids_c_file;
@@ -49,12 +49,12 @@ BEGIN {
     print "#include \"pci_vendors.h\"" > ids_h_file
     print "" > ids_h_file
 
-    print "#include <stddef.h>" > vendor_ids_h_file
-    print "#include \"pci_names.h\"" > vendor_ids_h_file
+    print "#include <stddef.h>" > names_c_file
+    print "#include \"pci_names.h\"" > names_c_file
     if (with_pci_db) {
-        print "#include \"pci_dev_ids.c\"" > vendor_ids_h_file
-        print "" > vendor_ids_h_file
-        print "static struct vendor_id_s vendor_ids[] = {" > vendor_ids_h_file
+        print "#include \"pci_dev_ids.c\"" > names_c_file
+        print "" > names_c_file
+        print "static struct vendor_id_s vendor_ids[] = {" > names_c_file
     }
     first_pass = 1;
     init_name_db();
@@ -67,7 +67,7 @@ BEGIN {
             printf("#define VENDOR_%s\t", svend_name) > vendors_h_file;
             if (length(svend_name) < 9) printf("\t") > vendors_h_file;
             printf("0x%s /*%s*/\n", field[2], name_field) > vendors_h_file;
-            if (with_pci_db) printf("{ 0x%s, \"%s\", dev_lst_%s },\n", field[2], name_field, field[2]) > vendor_ids_h_file;
+            if (with_pci_db) printf("{ 0x%s, \"%s\", dev_lst_%s },\n", field[2], name_field, field[2]) > names_c_file;
             printf("/* Vendor: %s: %s */\n", field[2], name_field) > ids_h_file
             if (first_pass == 1) first_pass = 0;
             else print "{ 0xFFFF, NULL }\n};" > dev_ids_c_file;
@@ -100,9 +100,10 @@ BEGIN {
     }
     print_guards_end(vendors_h_file);
     print_guards_end(ids_h_file);
-    if (with_pci_db) print "};" > vendor_ids_h_file
+    if (with_pci_db) print "};" > names_c_file
     print "{ 0xFFFF, NULL }" > dev_ids_c_file;
     print "};" > dev_ids_c_file
+    print_func_bodies(names_c_file);
 }
 
 function construct_guard_name(out_file)
@@ -134,6 +135,41 @@ function print_head(out_file)
     print "" > out_file
 }
 
+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 "        if (vendor_ids[i].id == id)" > out_file
+        print "            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 "        if (vendor_ids[i].id == vendor_id) {" > out_file
+        print "            j = 0;" > out_file
+        print "            while (vendor_ids[i].dev_list[j].id != 0xFFFF) {" > out_file
+        print "                if (vendor_ids[i].dev_list[j].id == device_id)" > out_file
+        print "                    return vendor_ids[i].dev_list[j].name;" > out_file
+        print "                j++;" > out_file
+        print "            };" > out_file
+        print "            break;" > out_file
+        print "        }" > out_file
+        print "    }" > out_file
+    }
+    print "    return NULL;" > out_file
+    print "}" > out_file
+}
+
 function kill_double_quoting(fld)
 {
     n = split(fld, phrases, "[\"]");


More information about the MPlayer-cvslog mailing list