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;
28 # read in all the source files
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
41 open SPEC
or die "Cannot open $SPEC\n";
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++; }
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;
67 # output the modified spec file
68 open OUTPUT
, ">$SPEC" or die "Cannot modify $SPEC\n";