3 # Update the list of debug channels of a given spec file
5 # Copyright 2000 Alexandre Julliard
7 # Usage: make_debug spec_file [source_files...]
10 die "Usage: make_debug spec_file [source]\n" unless @ARGV;
14 # read in all the source files
19 if (/DECLARE_DEBUG_CHANNEL\s*\(\s*([A-Za-z0-9_]+)\s*\)/) { $channels{$1} = 1; }
20 if (/DEFAULT_DEBUG_CHANNEL\s*\(\s*([A-Za-z0-9_]+)\s*\)/) { $channels{$1} = 1; }
23 @dbg_channels = sort keys %channels;
25 # read the whole spec file
27 open SPEC
or die "Cannot open $SPEC\n";
31 # build the new channel list
32 $channel_str = "debug_channels (";
33 $pos = length($channel_str);
34 for ($i = 0; $i <= $#dbg_channels; $i++)
36 $channel_str .= $dbg_channels[$i];
37 $pos += length($dbg_channels[$i]);
38 if ($i < $#dbg_channels)
40 if ($pos >= 75) { $pos = 16; $channel_str .= "\n" . (" " x
$pos); }
41 else { $channel_str .= " "; $pos++; }
46 # replace the list in the spec file
47 if (!($spec =~ s/debug_channels\s*\(([^)]*)\)/$channel_str/))
49 die "Could not replace debug_channels\n" if @dbg_channels;
53 # output the modified spec file
54 open OUTPUT
, ">$SPEC" or die "Cannot modify $SPEC\n";