Blame lib/Autom4te/Request.pm

Packit 47b4ca
# autoconf -- create `configure' using m4 macros
Packit 47b4ca
# Copyright (C) 2001-2003, 2009-2012 Free Software Foundation, Inc.
Packit 47b4ca
Packit 47b4ca
# This program is free software: you can redistribute it and/or modify
Packit 47b4ca
# it under the terms of the GNU General Public License as published by
Packit 47b4ca
# the Free Software Foundation, either version 3 of the License, or
Packit 47b4ca
# (at your option) any later version.
Packit 47b4ca
Packit 47b4ca
# This program is distributed in the hope that it will be useful,
Packit 47b4ca
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 47b4ca
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 47b4ca
# GNU General Public License for more details.
Packit 47b4ca
Packit 47b4ca
# You should have received a copy of the GNU General Public License
Packit 47b4ca
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 47b4ca
Packit 47b4ca
package Autom4te::Request;
Packit 47b4ca
Packit 47b4ca
=head1 NAME
Packit 47b4ca
Packit 47b4ca
Autom4te::Request - a single m4 run request
Packit 47b4ca
Packit 47b4ca
=head1 SYNOPSIS
Packit 47b4ca
Packit 47b4ca
  use Autom4te::Request;
Packit 47b4ca
Packit 47b4ca
=head1 DESCRIPTION
Packit 47b4ca
Packit 47b4ca
This perl module provides various general purpose support functions
Packit 47b4ca
used in several executables of the Autoconf and Automake packages.
Packit 47b4ca
Packit 47b4ca
=cut
Packit 47b4ca
Packit 47b4ca
use strict;
Packit 47b4ca
use Class::Struct;
Packit 47b4ca
use Carp;
Packit 47b4ca
use Data::Dumper;
Packit 47b4ca
Packit 47b4ca
struct
Packit 47b4ca
  (
Packit 47b4ca
   # The key of the cache files.
Packit 47b4ca
   'id' => "\$",
Packit 47b4ca
   # True iff %MACRO contains all the macros we want to trace.
Packit 47b4ca
   'valid' => "\$",
Packit 47b4ca
   # The include path.
Packit 47b4ca
   'path' => '@',
Packit 47b4ca
   # The set of input files.
Packit 47b4ca
   'input' => '@',
Packit 47b4ca
   # The set of macros currently traced.
Packit 47b4ca
   'macro' => '%',
Packit 47b4ca
  );
Packit 47b4ca
Packit 47b4ca
Packit 47b4ca
# Serialize a request or all the current requests.
Packit 47b4ca
sub marshall($)
Packit 47b4ca
{
Packit 47b4ca
  my ($caller) = @_;
Packit 47b4ca
  my $res = '';
Packit 47b4ca
Packit 47b4ca
  # CALLER is an object: instance method.
Packit 47b4ca
  my $marshall = Data::Dumper->new ([$caller]);
Packit 47b4ca
  $marshall->Indent(2)->Terse(0);
Packit 47b4ca
  $res = $marshall->Dump . "\n";
Packit 47b4ca
Packit 47b4ca
  return $res;
Packit 47b4ca
}
Packit 47b4ca
Packit 47b4ca
Packit 47b4ca
# includes_p ($SELF, @MACRO)
Packit 47b4ca
# --------------------------
Packit 47b4ca
# Does this request covers all the @MACRO.
Packit 47b4ca
sub includes_p
Packit 47b4ca
{
Packit 47b4ca
  my ($self, @macro) = @_;
Packit 47b4ca
Packit 47b4ca
  foreach (@macro)
Packit 47b4ca
    {
Packit 47b4ca
      return 0
Packit 47b4ca
	if ! exists ${$self->macro}{$_};
Packit 47b4ca
    }
Packit 47b4ca
  return 1;
Packit 47b4ca
}
Packit 47b4ca
Packit 47b4ca
Packit 47b4ca
=head1 SEE ALSO
Packit 47b4ca
Packit 47b4ca
L<Autom4te::C4che>
Packit 47b4ca
Packit 47b4ca
=head1 HISTORY
Packit 47b4ca
Packit 47b4ca
Written by Akim Demaille E<lt>F<akim@freefriends.org>E<gt>.
Packit 47b4ca
Packit 47b4ca
=cut
Packit 47b4ca
Packit 47b4ca
Packit 47b4ca
Packit 47b4ca
1; # for require
Packit 47b4ca
Packit 47b4ca
### Setup "GNU" style for perl-mode and cperl-mode.
Packit 47b4ca
## Local Variables:
Packit 47b4ca
## perl-indent-level: 2
Packit 47b4ca
## perl-continued-statement-offset: 2
Packit 47b4ca
## perl-continued-brace-offset: 0
Packit 47b4ca
## perl-brace-offset: 0
Packit 47b4ca
## perl-brace-imaginary-offset: 0
Packit 47b4ca
## perl-label-offset: -2
Packit 47b4ca
## cperl-indent-level: 2
Packit 47b4ca
## cperl-brace-offset: 0
Packit 47b4ca
## cperl-continued-brace-offset: 0
Packit 47b4ca
## cperl-label-offset: -2
Packit 47b4ca
## cperl-extra-newline-before-brace: t
Packit 47b4ca
## cperl-merge-trailing-else: nil
Packit 47b4ca
## cperl-continued-statement-offset: 2
Packit 47b4ca
## End: