1# autoconf -- create `configure' using m4 macros
2# Copyright (C) 2001, 2002, 2003  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 2, or (at your option)
7# 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, write to the Free Software
16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17# 02110-1301, USA.
18
19package Autom4te::Request;
20
21=head1 NAME
22
23Autom4te::Request - a single m4 run request
24
25=head1 SYNOPSIS
26
27  use Autom4te::Request;
28
29=head1 DESCRIPTION
30
31This perl module provides various general purpose support functions
32used in several executables of the Autoconf and Automake packages.
33
34=cut
35
36use strict;
37use Autom4te::Struct;
38use Carp;
39use Data::Dumper;
40
41struct
42  (
43   # The key of the cache files.
44   'id' => "\$",
45   # True iff %MACRO contains all the macros we want to trace.
46   'valid' => "\$",
47   # The include path.
48   'path' => '@',
49   # The set of input files.
50   'input' => '@',
51   # The set of macros currently traced.
52   'macro' => '%',
53  );
54
55
56# Serialize a request or all the current requests.
57sub marshall($)
58{
59  my ($caller) = @_;
60  my $res = '';
61
62  # CALLER is an object: instance method.
63  my $marshall = Data::Dumper->new ([$caller]);
64  $marshall->Indent(2)->Terse(0);
65  $res = $marshall->Dump . "\n";
66
67  return $res;
68}
69
70
71# includes_p ($SELF, @MACRO)
72# --------------------------
73# Does this request covers all the @MACRO.
74sub includes_p
75{
76  my ($self, @macro) = @_;
77
78  foreach (@macro)
79    {
80      return 0
81	if ! exists ${$self->macro}{$_};
82    }
83  return 1;
84}
85
86
87=head1 SEE ALSO
88
89L<Autom4te::C4che>
90
91=head1 HISTORY
92
93Written by Akim Demaille E<lt>F<akim@freefriends.org>E<gt>.
94
95=cut
96
97
98
991; # for require
100
101### Setup "GNU" style for perl-mode and cperl-mode.
102## Local Variables:
103## perl-indent-level: 2
104## perl-continued-statement-offset: 2
105## perl-continued-brace-offset: 0
106## perl-brace-offset: 0
107## perl-brace-imaginary-offset: 0
108## perl-label-offset: -2
109## cperl-indent-level: 2
110## cperl-brace-offset: 0
111## cperl-continued-brace-offset: 0
112## cperl-label-offset: -2
113## cperl-extra-newline-before-brace: t
114## cperl-merge-trailing-else: nil
115## cperl-continued-statement-offset: 2
116## End:
117