Commit | Line | Data |
4633a7c4 |
1 | # This script takes the output produced from perly.y by byacc and |
2 | # the perly.fixer shell script (i.e. the perly.c and perly.h built |
3 | # for Unix systems) and patches them to produce copies containing |
4 | # appropriate declarations for VMS handling of global symbols. |
5 | # |
6 | # If it finds that the input files are already patches for VMS, |
7 | # it just copies the input to the output. |
8 | # |
9 | # Revised 26-May-1995 by Charles Bailey bailey@genetics.upenn.edu |
10 | |
11 | ($cinfile,$hinfile,$coutfile,$houtfile) = @ARGV; |
12 | |
13 | open C,$cinfile or die "Can't read $cinfile: $!\n"; |
14 | open COUT, ">$coutfile" or die "Can't create $coutfile: $!\n"; |
15 | while (<C>) { |
16 | if (/^dEXT/) { # we've already got a fixed copy |
17 | print COUT $_,<C>; |
18 | last; |
19 | } |
20 | # add the dEXT tag to definitions of global vars, so we'll insert |
21 | # a globaldef when perly.c is compiled |
22 | s/^(short|int|YYSTYPE|char \*)\s*yy/dEXT $1 yy/; |
23 | print COUT; |
24 | } |
25 | close C; |
26 | close COUT; |
27 | |
28 | open H,$hinfile or die "Can't read $hinfile: $!\n"; |
29 | open HOUT, ">$houtfile" or die "Can't create $houtfile: $!\n"; |
30 | $hfixed = 0; # keep -w happy |
31 | while (<H>) { |
32 | $hfixed = /globalref/ unless $hfixed; # we've already got a fixed copy |
33 | next if /^extern YYSTYPE yylval/; # we've got a Unix version, and this |
34 | # is what we want to replace |
35 | print HOUT; |
36 | } |
37 | close H; |
38 | |
39 | print HOUT <<'EODECL' unless $hfixed; |
40 | #ifndef vax11c |
41 | extern YYSTYPE yylval; |
42 | #else |
43 | globalref YYSTYPE yylval; |
44 | #endif |
45 | EODECL |
46 | |
47 | close HOUT; |