Bump date stamp to 20130605
[official-gcc.git] / libgupc / dox-filter-config-h
blob61d7fb69b782039c38878579fc66db21b53ca95c
1 #!/bin/env perl
2 use strict;
3 use warnings;
4 use File::Slurp qw(slurp);
6 die "usage: $0 <input_file>" unless @ARGV;
7 my $file = $ARGV[0];
8 die "file not found: $file\n" unless -f $file;
9 die "open failed: $file\n" unless open IN, "<$file";
11 my $input = slurp(\*IN);
13 my ($before, $gupcr_cfg, $after) = 
14   ($input =~ m{(.*//begin\ gupcr_config_h\n)(.*)
15                (//end\ gupcr_config_h.*)}xs);
17 die "could not match the gupcr_config_h file markers\n"
18   unless defined($before)
19          && defined($gupcr_cfg)
20          && defined($after);
22 $gupcr_cfg =~ s{^/\*\s*((?:(?!/\*).)*?)\s*?\*/\n
23                 \#(?:define|undef)\s+(\w+)(.*?)$}
24                {/**\ \@brief\ ${1}\ */\n\#define\ ${2}${3}}xgms;
26 my $result = $before . $gupcr_cfg . $after;
27 print $result;
29 exit 0;