Replace LPDDSURFACEDESC by LPDDSURFACEDESC2 in IDirectDrawSurface4
[wine/multimedia.git] / tools / make_debug
blobcc83b29846db2d25ca19fab44037c8d20f590ad5
1 #!/usr/bin/perl
3 # Update the list of debug channels of a given spec file
5 # Copyright 2000 Alexandre Julliard
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.
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.
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
21 # Usage: make_debug spec_file [source_files...]
24 die "Usage: make_debug spec_file [source]\n" unless @ARGV;
26 $SPEC = shift @ARGV;
28 # read in all the source files
29 if (@ARGV)
31 while (<>)
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; }
37 @dbg_channels = sort keys %channels;
39 # read the whole spec file
40 undef $/;
41 open SPEC or die "Cannot open $SPEC\n";
42 $spec = <SPEC>;
43 close SPEC;
45 # build the new channel list
46 $channel_str = "debug_channels (";
47 $pos = length($channel_str);
48 for ($i = 0; $i <= $#dbg_channels; $i++)
50 $channel_str .= $dbg_channels[$i];
51 $pos += length($dbg_channels[$i]);
52 if ($i < $#dbg_channels)
54 if ($pos >= 75) { $pos = 16; $channel_str .= "\n" . (" " x $pos); }
55 else { $channel_str .= " "; $pos++; }
58 $channel_str .= ")";
60 # replace the list in the spec file
61 if (!($spec =~ s/debug_channels\s*\(([^)]*)\)/$channel_str/))
63 die "Could not replace debug_channels\n" if @dbg_channels;
64 exit 0;
67 # output the modified spec file
68 open OUTPUT, ">$SPEC" or die "Cannot modify $SPEC\n";
69 print OUTPUT $spec;
70 close OUTPUT;