Added entry for DirectSoundFullDuplexCreate.
[wine] / tools / make_debug
1 #!/usr/bin/perl
2 #
3 # Update the list of debug channels of a given spec file
4 #
5 # Copyright 2000 Alexandre Julliard
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 #
21 # Usage: make_debug spec_file [source_files...]
22 #
23
24 die "Usage: make_debug spec_file [source]\n" unless @ARGV;
25
26 $SPEC = shift @ARGV;
27
28 # read in all the source files
29 if (@ARGV)
30 {
31     while (<>)
32     {
33         if (/DECLARE_DEBUG_CHANNEL\s*\(\s*([A-Za-z0-9_]+)\s*\)/) { $channels{$1} = 1; }
34         if (/DEFAULT_DEBUG_CHANNEL\s*\(\s*([A-Za-z0-9_]+)\s*\)/) { $channels{$1} = 1; }
35     }
36 }
37 @dbg_channels = sort keys %channels;
38
39 # read the whole spec file
40 undef $/;
41 open SPEC or die "Cannot open $SPEC\n";
42 $spec = <SPEC>;
43 close SPEC;
44
45 # build the new channel list
46 $channel_str = "debug_channels (";
47 $pos = length($channel_str);
48 for ($i = 0; $i <= $#dbg_channels; $i++)
49 {
50    $channel_str .= $dbg_channels[$i];
51    $pos += length($dbg_channels[$i]);
52    if ($i < $#dbg_channels)
53    {
54        if ($pos >= 75) { $pos = 16; $channel_str .= "\n" . (" " x $pos); }
55        else { $channel_str .= " "; $pos++; }
56    }
57 }
58 $channel_str .= ")";
59
60 # replace the list in the spec file
61 if (!($spec =~ s/debug_channels\s*\(([^)]*)\)/$channel_str/))
62 {
63     die "Could not replace debug_channels\n" if @dbg_channels;
64     exit 0;
65 }
66
67 # output the modified spec file
68 open OUTPUT, ">$SPEC" or die "Cannot modify $SPEC\n";
69 print OUTPUT $spec;
70 close OUTPUT;