2009-01-03 13:12:22 +08:00
|
|
|
#!/usr/bin/perl
|
|
|
|
my @argv = @ARGV;
|
|
|
|
$_ = join('', <>);
|
2015-08-17 17:05:20 +08:00
|
|
|
s/\s+\n/\n/sog;
|
2009-01-03 13:12:22 +08:00
|
|
|
s/\n[^\n]*!globals.h[^\n]*\n/\n/sog;
|
|
|
|
s%/\*.*?\*/%%sog;
|
|
|
|
s/(enum\s.*?{.*?})/munge($1)/soge;
|
|
|
|
s/^(\s*)([a-zA-Z_])/$1extern $2/mog;
|
|
|
|
s/extern (extern|enum)/$1/sog;
|
|
|
|
s/\n\s*extern static[^\n]*\n/\n/sog;
|
|
|
|
s/\s+=.*?;/;/sog;
|
|
|
|
s/^\n+//sog;
|
|
|
|
s/#include "winsup\.h"\n//so;
|
|
|
|
s/-NL-/\n/sog;
|
|
|
|
s/-EQ-/=/sog;
|
|
|
|
s/\n{2,}/\n/sog;
|
2012-03-20 01:49:40 +08:00
|
|
|
print <<PRELUDE,$_;
|
2009-01-03 13:12:22 +08:00
|
|
|
/* $target - Autogenerated from @argv. Look there for comments. */
|
|
|
|
|
2012-03-20 01:49:40 +08:00
|
|
|
#pragma once
|
2009-01-03 13:12:22 +08:00
|
|
|
PRELUDE
|
|
|
|
close $target_fd;
|
|
|
|
sub munge($) {
|
|
|
|
my $val = shift;
|
|
|
|
$val =~ s/\n/-NL-/sog;
|
|
|
|
$val =~ s/=/-EQ-/sog;
|
|
|
|
return $val;
|
|
|
|
}
|