- Timestamp:
- 06/19/05 18:16:50 (4 years ago)
- svk:copy_cache_prev:
- 6641
- Files:
-
- 1 modified
-
script/pugscc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
script/pugscc
r3102 r4851 8 8 use File::Basename; 9 9 use File::Glob 'bsd_glob'; 10 use IPC::Open2; 10 11 11 12 if (!@ARGV || grep /^--help$/, @ARGV) { … … 63 64 64 65 unlink "dump.ast"; 65 system("pugs", "-C$backend" => @ARGV); 66 exit 1 unless -e "dump.ast"; 66 67 my ($rh, $wh); 68 my $pid = open2($rh, $wh, 'pugs', -C => $backend, @ARGV); 69 my $program = do { local $/; <$rh> }; 70 waitpid($pid, 0); 71 72 exit 1 unless length $program; 73 74 sub writeFile { 75 my ($file, $str) = @_; 76 open my $fh, '>', $file or die $!; 77 print $fh $str; 78 close $fh; 79 } 67 80 68 81 if ($backend eq 'Parrot') { 69 rename "dump.ast" => $out;82 writeFile($out, $program); 70 83 chmod 0755, $out; 71 84 } 72 85 else { 73 rename "dump.ast" => "$base/MainCC.hs";86 writeFile("$base/MainCC.hs", $program); 74 87 75 88 my $archlib = `pugs -V:archlib`;
