1# autoconf -- create `configure' using m4 macros
2# Copyright (C) 2001-2003, 2009-2012 Free Software Foundation, Inc.
3
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13
14# You should have received a copy of the GNU General Public License
15# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17package Autom4te::Request;
18
19=head1 NAME
20
21Autom4te::Request - a single m4 run request
22
23=head1 SYNOPSIS
24
25  use Autom4te::Request;
26
27=head1 DESCRIPTION
28
29This perl module provides various general purpose support functions
30used in several executables of the Autoconf and Automake packages.
31
32=cut
33
34use strict;
35use Class::Struct;
36use Carp;
37use Data::Dumper;
38
39struct
40  (
41   # The key of the cache files.
42   'id' => "\$",
43   # True iff %MACRO contains all the macros we want to trace.
44   'valid' => "\$",
45   # The include path.
46   'path' => '@',
47   # The set of input files.
48   'input' => '@',
49   # The set of macros currently traced.
50   'macro' => '%',
51  );
52
53
54# Serialize a request or all the current requests.
55sub marshall($)
56{
57  my ($caller) = @_;
58  my $res = '';
59
60  # CALLER is an object: instance method.
61  my $marshall = Data::Dumper->new ([$caller]);
62  $marshall->Indent(2)->Terse(0);
63  $res = $marshall->Dump . "\n";
64
65  return $res;
66}
67
68
69# includes_p ($SELF, @MACRO)
70# --------------------------
71# Does this request covers all the @MACRO.
72sub includes_p
73{
74  my ($self, @macro) = @_;
75
76  foreach (@macro)
77    {
78      return 0
79	if ! exists ${$self->macro}{$_};
80    }
81  return 1;
82}
83
84
85=head1 SEE ALSO
86
87L<Autom4te::C4che>
88
89=head1 HISTORY
90
91Written by Akim Demaille E<lt>F<akim@freefriends.org>E<gt>.
92
93=cut
94
95
96
971; # for require
98
99### Setup "GNU" style for perl-mode and cperl-mode.
100## Local Variables:
101## perl-indent-level: 2
102## perl-continued-statement-offset: 2
103## perl-continued-brace-offset: 0
104## perl-brace-offset: 0
105## perl-brace-imaginary-offset: 0
106## perl-label-offset: -2
107## cperl-indent-level: 2
108## cperl-brace-offset: 0
109## cperl-continued-brace-offset: 0
110## cperl-label-offset: -2
111## cperl-extra-newline-before-brace: t
112## cperl-merge-trailing-else: nil
113## cperl-continued-statement-offset: 2
114## End:
115