File: | /usr/local/share/autoconf/Autom4te/Request.pm |
Coverage: | 69.7% |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | # autoconf -- create `configure' using m4 macros | ||||||
2 | # Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, | ||||||
3 | # 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 <http://www.gnu.org/licenses/>. | ||||||
17 | |||||||
18 | package Autom4te::Request; | ||||||
19 | |||||||
20 - 33 | =head1 NAME Autom4te::Request - a single m4 run request =head1 SYNOPSIS use Autom4te::Request; =head1 DESCRIPTION This perl module provides various general purpose support functions used in several executables of the Autoconf and Automake packages. =cut | ||||||
34 | |||||||
35 | 2758 2758 2758 | 8013 6111 13374 | use strict; | ||||
36 | 2758 2758 2758 | 18360 2870 17094 | use Autom4te::Struct; | ||||
37 | 2758 2758 2758 | 10050 2460 6088 | use Carp; | ||||
38 | 2758 2758 2758 | 10335 3409 7693 | use Data::Dumper; | ||||
39 | |||||||
40 | struct | ||||||
41 | ( | ||||||
42 | # The key of the cache files. | ||||||
43 | 'id' => "\$", | ||||||
44 | # True iff %MACRO contains all the macros we want to trace. | ||||||
45 | 'valid' => "\$", | ||||||
46 | # The include path. | ||||||
47 | 'path' => '@', | ||||||
48 | # The set of input files. | ||||||
49 | 'input' => '@', | ||||||
50 | # The set of macros currently traced. | ||||||
51 | 'macro' => '%', | ||||||
52 | ); | ||||||
53 | |||||||
54 | |||||||
55 | # Serialize a request or all the current requests. | ||||||
56 | sub marshall($) | ||||||
57 | { | ||||||
58 | 2758 | 0 | 6397 | my ($caller) = @_; | |||
59 | 2758 | 5206 | my $res = ''; | ||||
60 | |||||||
61 | # CALLER is an object: instance method. | ||||||
62 | 2758 | 38058 | my $marshall = Data::Dumper->new ([$caller]); | ||||
63 | 2758 | 220528 | $marshall->Indent(2)->Terse(0); | ||||
64 | 2758 | 14409 | $res = $marshall->Dump . "\n"; | ||||
65 | |||||||
66 | 2758 | 873124 | return $res; | ||||
67 | } | ||||||
68 | |||||||
69 | |||||||
70 | # includes_p ($SELF, @MACRO) | ||||||
71 | # -------------------------- | ||||||
72 | # Does this request covers all the @MACRO. | ||||||
73 | sub includes_p | ||||||
74 | { | ||||||
75 | 0 | 0 | my ($self, @macro) = @_; | ||||
76 | |||||||
77 | 0 | foreach (@macro) | |||||
78 | { | ||||||
79 | 0 | return 0 | |||||
80 | 0 | if ! exists ${$self->macro}{$_}; | |||||
81 | } | ||||||
82 | 0 | return 1; | |||||
83 | } | ||||||
84 | |||||||
85 | |||||||
86 - 94 | =head1 SEE ALSO L<Autom4te::C4che> =head1 HISTORY Written by Akim Demaille E<lt>F<akim@freefriends.org>E<gt>. =cut | ||||||
95 | |||||||
96 | |||||||
97 | |||||||
98 | 1; # for require | ||||||
99 | |||||||
100 | ### Setup "GNU" style for perl-mode and cperl-mode. | ||||||
101 | ## Local Variables: | ||||||
102 | ## perl-indent-level: 2 | ||||||
103 | ## perl-continued-statement-offset: 2 | ||||||
104 | ## perl-continued-brace-offset: 0 | ||||||
105 | ## perl-brace-offset: 0 | ||||||
106 | ## perl-brace-imaginary-offset: 0 | ||||||
107 | ## perl-label-offset: -2 | ||||||
108 | ## cperl-indent-level: 2 | ||||||
109 | ## cperl-brace-offset: 0 | ||||||
110 | ## cperl-continued-brace-offset: 0 | ||||||
111 | ## cperl-label-offset: -2 | ||||||
112 | ## cperl-extra-newline-before-brace: t | ||||||
113 | ## cperl-merge-trailing-else: nil | ||||||
114 | ## cperl-continued-statement-offset: 2 | ||||||
115 | ## End: |