Mercurial > mplayer.hg
annotate vidix/pci_db2c.awk @ 27118:5798fb7fceb6
Simplify some imaadpcm macros
author | reimar |
---|---|
date | Sun, 29 Jun 2008 08:42:53 +0000 |
parents | caa5f90c7cb0 |
children | 9e739bdb049c |
rev | line source |
---|---|
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
1 # This file converts given pci.db to "C" source and header files |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
2 # For latest version of pci ids see: http://pciids.sf.net |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
3 # Copyright 2002 Nick Kurshev |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
4 # |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
5 # Usage: awk -f pci_db2c.awk pci.db |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
6 # |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
7 # Tested with Gawk v 3.0.x and Mawk 1.3.3 |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
8 # But it should work with standard Awk implementations (hopefully). |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
9 # (Nobody tested it with Nawk, but it should work, too). |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
10 # |
23292
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
11 # This file is part of MPlayer. |
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
12 # |
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
13 # MPlayer is free software; you can redistribute it and/or modify |
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
14 # it under the terms of the GNU General Public License as published by |
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
15 # the Free Software Foundation; either version 2 of the License, or |
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
16 # (at your option) any later version. |
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
17 # |
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
18 # MPlayer is distributed in the hope that it will be useful, |
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
21 # GNU General Public License for more details. |
99c7b632130d
Add standard license header, confirmed by Nick in private mail.
diego
parents:
22912
diff
changeset
|
22 # |
26719 | 23 # You should have received a copy of the GNU General Public License along |
24 # with MPlayer; if not, write to the Free Software Foundation, Inc., | |
25 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
26 |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
27 BEGIN { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
28 |
25271
4ba5a1593296
add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
ben
parents:
23292
diff
changeset
|
29 if(ARGC != 3) { |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
30 # check for arguments: |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
31 print "Usage awk -f pci_db2c.awk pci.db (and make sure pci.db file exists first)"; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
32 exit(1); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
33 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
34 in_file = ARGV[1]; |
25271
4ba5a1593296
add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
ben
parents:
23292
diff
changeset
|
35 with_pci_db = ARGV[2]; |
26516 | 36 vendor_file = "vidix/pci_vendors.h"; |
37 ids_file = "vidix/pci_ids.h" | |
38 name_file = "vidix/pci_names.c" | |
39 name_h_file = "vidix/pci_names.h" | |
40 dev_ids_file = "vidix/pci_dev_ids.c" | |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
41 line=0; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
42 # print out head lines |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
43 print_head(vendor_file); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
44 print_head(ids_file); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
45 print_head(name_file); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
46 print_head(name_h_file); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
47 print_head(dev_ids_file); |
22912 | 48 print_includes(dev_ids_file); |
26031
559a244d5679
Add MPLAYER_ prefix to the multiple inclusion guards of generated header files.
diego
parents:
26026
diff
changeset
|
49 print "#ifndef MPLAYER_PCI_VENDORS_H" >vendor_file |
559a244d5679
Add MPLAYER_ prefix to the multiple inclusion guards of generated header files.
diego
parents:
26026
diff
changeset
|
50 print "#define MPLAYER_PCI_VENDORS_H">vendor_file |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
51 print "" >vendor_file |
26031
559a244d5679
Add MPLAYER_ prefix to the multiple inclusion guards of generated header files.
diego
parents:
26026
diff
changeset
|
52 print "#ifndef MPLAYER_PCI_IDS_H" >ids_file |
559a244d5679
Add MPLAYER_ prefix to the multiple inclusion guards of generated header files.
diego
parents:
26026
diff
changeset
|
53 print "#define MPLAYER_PCI_IDS_H">ids_file |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
54 print "" >ids_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
55 print "#include \"pci_vendors.h\"">ids_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
56 print "" >ids_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
57 |
26031
559a244d5679
Add MPLAYER_ prefix to the multiple inclusion guards of generated header files.
diego
parents:
26026
diff
changeset
|
58 print "#ifndef MPLAYER_PCI_NAMES_H" >name_h_file |
559a244d5679
Add MPLAYER_ prefix to the multiple inclusion guards of generated header files.
diego
parents:
26026
diff
changeset
|
59 print "#define MPLAYER_PCI_NAMES_H">name_h_file |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
60 print "" >name_h_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
61 print_name_struct(name_h_file); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
62 print "#include <stddef.h>">name_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
63 print "#include \"pci_names.h\"">name_file |
25271
4ba5a1593296
add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
ben
parents:
23292
diff
changeset
|
64 if (with_pci_db) { |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
65 print "#include \"pci_dev_ids.c\"">name_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
66 print "">name_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
67 print "static struct vendor_id_s vendor_ids[] = {">name_file |
25271
4ba5a1593296
add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
ben
parents:
23292
diff
changeset
|
68 } |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
69 first_pass=1; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
70 init_name_db(); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
71 while(getline <in_file) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
72 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
73 # count up lines |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
74 line++; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
75 n=split($0, field, "[\t]"); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
76 name_field = kill_double_quoting(field[3]) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
77 if(field[1] == "v" && length(field[3])>0 && field[4] == "0") |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
78 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
79 init_device_db() |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
80 svend_name = get_short_vendor_name(field[3]) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
81 printf("#define VENDOR_%s\t", svend_name) >vendor_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
82 if(length(svend_name) < 9) printf("\t") >vendor_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
83 printf("0x%s /*%s*/\n",field[2], name_field) >vendor_file; |
25271
4ba5a1593296
add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
ben
parents:
23292
diff
changeset
|
84 if (with_pci_db) printf("{ 0x%s, \"%s\", dev_lst_%s },\n",field[2], name_field, field[2]) >name_file; |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
85 printf("/* Vendor: %s: %s */\n", field[2], name_field) > ids_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
86 if(first_pass == 1) { first_pass=0; } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
87 else { print "{ 0xFFFF, NULL }\n};" >dev_ids_file; } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
88 printf("static const struct device_id_s dev_lst_%s[]={\n", field[2])>dev_ids_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
89 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
90 if(field[1] == "d" && length(field[3])>0 && field[4] == "0") |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
91 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
92 sdev_name = get_short_device_name(field[3]) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
93 full_name = sprintf("#define DEVICE_%s_%s", svend_name, sdev_name); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
94 printf("%s\t", full_name) >ids_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
95 if(length(full_name) < 9) printf("\t") >ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
96 if(length(full_name) < 17) printf("\t") >ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
97 if(length(full_name) < 25) printf("\t") >ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
98 if(length(full_name) < 32) printf("\t") >ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
99 if(length(full_name) < 40) printf("\t") >ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
100 if(length(full_name) < 48) printf("\t") >ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
101 printf("0x%s /*%s*/\n", substr(field[2], 5), name_field) >ids_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
102 printf("{ 0x%s, \"%s\" },\n", substr(field[2], 5), name_field) >dev_ids_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
103 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
104 if(field[1] == "s" && length(field[3])>0 && field[4] == "0") |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
105 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
106 subdev_name = get_short_subdevice_name(field[3]) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
107 full_name = sprintf("#define SUBDEVICE_%s_%s", svend_name, subdev_name) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
108 printf("\t%s\t", full_name) >ids_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
109 if(length(full_name) < 9) printf("\t") >ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
110 if(length(full_name) < 17) printf("\t") >ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
111 if(length(full_name) < 25) printf("\t") >ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
112 if(length(full_name) < 32) printf("\t") >ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
113 if(length(full_name) < 40) printf("\t") >ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
114 printf("0x%s /*%s*/\n", substr(field[2], 9), name_field) >ids_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
115 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
116 } |
25491
0680997b8af0
Skip unnecessary (debug) output; obey the rule of silence.
diego
parents:
25271
diff
changeset
|
117 #print "Total lines parsed:", line; |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
118 print "">vendor_file |
26031
559a244d5679
Add MPLAYER_ prefix to the multiple inclusion guards of generated header files.
diego
parents:
26026
diff
changeset
|
119 print "#endif /* MPLAYER_PCI_VENDORS_H */">vendor_file |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
120 print "">ids_file |
26031
559a244d5679
Add MPLAYER_ prefix to the multiple inclusion guards of generated header files.
diego
parents:
26026
diff
changeset
|
121 print "#endif /* MPLAYER_PCI_IDS_H */">ids_file |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
122 print "">name_h_file |
26031
559a244d5679
Add MPLAYER_ prefix to the multiple inclusion guards of generated header files.
diego
parents:
26026
diff
changeset
|
123 print "#endif /* MPLAYER_PCI_NAMES_H */">name_h_file |
25271
4ba5a1593296
add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
ben
parents:
23292
diff
changeset
|
124 if (with_pci_db) print "};">name_file |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
125 print "{ 0xFFFF, NULL }" >dev_ids_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
126 print "};">dev_ids_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
127 print_func_bodies(name_file); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
128 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
129 |
22912 | 130 function print_includes(out_file) |
131 { | |
132 print "#include <stdlib.h>" >out_file; | |
133 print "#include \"pci_names.h\"" >out_file; | |
134 return; | |
135 } | |
136 | |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
137 function print_head( out_file) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
138 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
139 print "/*" >out_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
140 printf(" * File: %s\n", out_file) >out_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
141 printf(" * This file was generated automatically. Don't modify it.\n") >out_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
142 print "*/" >out_file; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
143 return; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
144 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
145 |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
146 function print_name_struct(out_file) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
147 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
148 print "">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
149 print "struct device_id_s" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
150 print "{" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
151 print "\tunsigned short\tid;" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
152 print "\tconst char *\tname;" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
153 print "};" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
154 print "">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
155 print "struct vendor_id_s" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
156 print "{" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
157 print "\tunsigned short\tid;" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
158 print "\tconst char *\tname;" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
159 print "\tconst struct device_id_s *\tdev_list;" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
160 print "};" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
161 print "extern const char *pci_vendor_name(unsigned short id);">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
162 print "extern const char *pci_device_name(unsigned short vendor_id, unsigned short device_id);">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
163 print "">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
164 return |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
165 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
166 |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
167 function print_func_bodies(out_file) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
168 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
169 print "">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
170 print "const char *pci_vendor_name(unsigned short id)" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
171 print "{" >out_file |
25271
4ba5a1593296
add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
ben
parents:
23292
diff
changeset
|
172 if (with_pci_db) { |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
173 print " unsigned i;" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
174 print " for(i=0;i<sizeof(vendor_ids)/sizeof(struct vendor_id_s);i++)">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
175 print " {" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
176 print "\tif(vendor_ids[i].id == id) return vendor_ids[i].name;" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
177 print " }" >out_file |
25271
4ba5a1593296
add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
ben
parents:
23292
diff
changeset
|
178 } |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
179 print " return NULL;" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
180 print "}">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
181 print "" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
182 print "const char *pci_device_name(unsigned short vendor_id, unsigned short device_id)" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
183 print "{" >out_file |
25271
4ba5a1593296
add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
ben
parents:
23292
diff
changeset
|
184 if (with_pci_db) { |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
185 print " unsigned i, j;" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
186 print " for(i=0;i<sizeof(vendor_ids)/sizeof(struct vendor_id_s);i++)">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
187 print " {" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
188 print "\tif(vendor_ids[i].id == vendor_id)" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
189 print "\t{" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
190 print "\t j=0;" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
191 print "\t while(vendor_ids[i].dev_list[j].id != 0xFFFF)" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
192 print "\t {">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
193 print "\t\tif(vendor_ids[i].dev_list[j].id == device_id) return vendor_ids[i].dev_list[j].name;">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
194 print "\t\tj++;">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
195 print "\t };">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
196 print "\t break;" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
197 print "\t}" >out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
198 print " }" >out_file |
25271
4ba5a1593296
add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
ben
parents:
23292
diff
changeset
|
199 } |
22900
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
200 print " return NULL;">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
201 print "}">out_file |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
202 return |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
203 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
204 |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
205 function kill_double_quoting(fld) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
206 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
207 n=split(fld,phrases, "[\"]"); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
208 new_fld = phrases[1] |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
209 for(i=2;i<=n;i++) new_fld = sprintf("%s\\\"%s", new_fld, phrases[i]) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
210 return new_fld |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
211 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
212 |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
213 function init_name_db() |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
214 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
215 vendor_names[1]="" |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
216 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
217 |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
218 function init_device_db() |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
219 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
220 # delete device_names |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
221 for( i in device_names ) delete device_names[i]; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
222 device_names[1]="" |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
223 # delete subdevice_names |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
224 for( i in subdevice_names ) delete subdevice_names[i]; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
225 subdevice_names[1] = "" |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
226 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
227 |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
228 function get_short_vendor_name(from) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
229 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
230 n=split(from, name, "[ ]"); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
231 new_name = toupper(name[1]); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
232 if(length(new_name)<3) new_name = sprintf("%s_%s", new_name, toupper(name[2])); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
233 n=split(new_name, name, "[^0-9A-Za-z]"); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
234 svendor = name[1]; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
235 for(i=2;i<=n;i++) svendor=sprintf("%s%s%s", svendor, length(name[i])?"_":"", name[i]); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
236 new_name = svendor; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
237 vend_suffix = 2; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
238 # check for unique |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
239 while(new_name in vendor_names) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
240 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
241 new_name = sprintf("%s%u", svendor, vend_suffix) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
242 vend_suffix = vend_suffix + 1; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
243 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
244 # Add new name in array of vendor's names |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
245 vendor_names[new_name] = new_name |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
246 return new_name; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
247 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
248 |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
249 function get_short_device_name(from_name) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
250 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
251 n=split(from_name, name, "[ ]"); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
252 new_name = toupper(name[1]); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
253 if(length(name[2])) new_name = sprintf("%s_%s", new_name, toupper(name[2])); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
254 if(length(name[3])) new_name = sprintf("%s_%s", new_name, toupper(name[3])); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
255 n=split(new_name, name, "[^0-9A-Za-z]"); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
256 sdevice = name[1]; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
257 for(i=2;i<=n;i++) sdevice=sprintf("%s%s%s", sdevice, length(name[i])?"_":"", name[i]); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
258 new_name = sdevice; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
259 dev_suffix = 2; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
260 # check for unique |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
261 while(new_name in device_names) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
262 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
263 new_name = sprintf("%s%u", sdevice, dev_suffix) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
264 dev_suffix = dev_suffix + 1; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
265 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
266 # Add new name in array of device names |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
267 device_names[new_name] = new_name |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
268 return new_name; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
269 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
270 |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
271 function get_short_subdevice_name(from_name) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
272 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
273 n=split(from_name, name, "[ ]"); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
274 new_name = toupper(name[1]); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
275 if(length(name[2])) new_name = sprintf("%s_%s", new_name, toupper(name[2])); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
276 if(length(name[3])) new_name = sprintf("%s_%s", new_name, toupper(name[3])); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
277 n=split(new_name, name, "[^0-9A-Za-z]"); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
278 ssdevice = name[1]; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
279 for(i=2;i<=n;i++) ssdevice=sprintf("%s%s%s", ssdevice, length(name[i])?"_":"", name[i]); |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
280 new_name = ssdevice; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
281 sdev_suffix = 2; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
282 # check for unique |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
283 while(new_name in subdevice_names) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
284 { |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
285 new_name = sprintf("%s%u", ssdevice, sdev_suffix) |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
286 sdev_suffix = sdev_suffix + 1; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
287 } |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
288 # Add new name in array of subdevice names |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
289 subdevice_names[new_name] = new_name |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
290 return new_name; |
a9e111b88c4a
merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents:
diff
changeset
|
291 } |