Cygwin: cygtls: rename sig to current_sig
[newlib-cygwin.git] / winsup / cygwin / scripts / mkglobals_h
blob7521a03bfbd313930ad696c93d9ac3c8d355520f
1 #!/usr/bin/perl
2 my @argv = @ARGV;
3 $_ = join('', <>);
4 s/\s+\n/\n/sog;
5 s/\n[^\n]*!globals.h[^\n]*\n/\n/sog;
6 s%/\*.*?\*/%%sog;
7 s/EXPORT_ALIAS.*\n//so;
8 s/(enum\s.*?{.*?})/munge($1)/soge;
9 s/^(\s*)([a-zA-Z_])/$1extern $2/mog;
10 s/extern (extern|enum)/$1/sog;
11 s/\n\s*extern static[^\n]*\n/\n/sog;
12 s/\s+=.*?;/;/sog;
13 s/^\n+//sog;
14 s/#include "winsup\.h"\n//so;
15 s/-NL-/\n/sog;
16 s/-EQ-/=/sog;
17 s/\n{2,}/\n/sog;
18 print <<PRELUDE,$_;
19 /* $target - Autogenerated from @argv. Look there for comments. */
21 #pragma once
22 PRELUDE
23 close $target_fd;
24 sub munge($) {
25 my $val = shift;
26 $val =~ s/\n/-NL-/sog;
27 $val =~ s/=/-EQ-/sog;
28 return $val;