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