diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-03-03 10:25:25 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-03-03 10:25:25 +0000 |
commit | 93d89c2b5e8497365be152fb53cb6cd4c5764d34 (patch) | |
tree | 0de8d05bbd0eeaeb5e4b85395f8dd576984b6a9e /cil/lib/TempFile.pm | |
parent | 891377ce1962cdb31357d6580d6546ec22df2b4f (diff) | |
download | compcert-93d89c2b5e8497365be152fb53cb6cd4c5764d34.tar.gz compcert-93d89c2b5e8497365be152fb53cb6cd4c5764d34.zip |
Getting rid of CIL
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1270 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cil/lib/TempFile.pm')
-rw-r--r-- | cil/lib/TempFile.pm | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/cil/lib/TempFile.pm b/cil/lib/TempFile.pm deleted file mode 100644 index 608713cf..00000000 --- a/cil/lib/TempFile.pm +++ /dev/null @@ -1,90 +0,0 @@ -package TempFile; -use OutputFile; -@ISA = (OutputFile); - -use strict; -use Carp; -use File::Temp qw(tempfile); - - -######################################################################## - - -sub new { - croak 'bad argument count' unless @_ == 3; - my ($proto, $basis, $suffix) = @_; - my $class = ref($proto) || $proto; - - my (undef, $filename) = tempfile('cil-XXXXXXXX', - DIR => File::Spec->tmpdir, - SUFFIX => ".$suffix", - UNLINK => 1); - - my $self = $class->SUPER::new($basis, $filename); - return $self; -} - - -######################################################################## - - -1; - -__END__ - - -=head1 Name - -TempFile - transitory compiler output files - -=head1 Synopsis - - use TempFile; - - my $cppOut = new TempFile ('code.c', 'i'); - system 'cpp', 'code.c', '-o', $cppOut->filename; - -=head2 Description - -C<TempFile> represents an intermediate output file generated by some -stage of a C<Cilly>-based compiler that should be removed after -compilation. It is a concrete subclass of L<OutputFile|OutputFile>. -Use C<TempFile> when the user has asked not for intermediate files to -be retained. - -All C<TempFile> files are removed when the script terminates. This -cleanup happens for both normal exits as well as fatal errors. -However, the standard L<Perl exec function|perlfun/exec> does not -perform cleanups, and therefore should be avoided in scripts that use -C<TempFile>. - -=head2 Public Methods - -=over - -=item new - -C<new TempFile ($basis, $suffix)> constructs a new C<TempFile> -instance. The new file name is constructed in some system-specific -temporary directory with a randomly generated file name that ends with -C<$suffix>. For example, - - new TempFile ('/foo/code.c', 'i') - -might yield a C<TempFile> with file name F</var/tmp/cil-x9GyA93R.i>. - -C<$basis> gives the basis file name for this instance. The file name -is not used directly, but is retained in case this instance is later -passed as the basis for some other C<OutputFile>. See -L<OutputFile/"basis"> for more information on basis flattening. - -C<$suffix> should not include a leading dot; this will be added -automatically. - -=back - -=head1 See Also - -L<OutputFile>, L<TempFile>. - -=cut |