Request.pm 2.5 KB

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