<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>features/wrapper.feature</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,61 @@
 package Egypt::Extractor::GCC;
 
+=head1 NAME
+
+Egypt::Extractor::GCC - egypt's extractor for GCC-generated intermediate files.
+
+=head1 DESCRIPTION
+
+The GCC extractor reads information from the intermediate files generated by
+GCC after it compiles the source code. When using the GCC extractor, egypt
+tools will traverse your directories for files matching F&lt;*.rtl&gt; and
+F&lt;*.expand&gt;, and will parse them in order to obtain information.
+
+The original egypt implementation by Andreas Gustafsson only supported
+extracting information using GCC information. After major refactoring of the
+code, that logic ended up in this module as a pluggable component for use
+with egypt's current implementation.
+
+=head1 GENERATING THE INPUT FILES
+
+Compile the program or source file you want to create a call graph for
+with gcc, adding the option &quot;-dr&quot; to CFLAGS.  This option causes gcc
+to dump its intermediate code representation of each file it compiles
+into a a file.
+
+For example, the following works for many programs:
+
+   make clean
+   make CFLAGS=-dr
+
+Depending on the GCC version, the RTL file for a source file F&lt;foo.c&gt;
+may be called something like F&lt;foo.c.rtl&gt;, F&lt;foo.c.00.rtl&gt;, or
+F&lt;foo.c.00.expand&gt;.
+
+=head1 LIMITATIONS
+
+Relying on GCC-suplied information brings two major drawbracks:
+
+=over
+
+=item
+The dependencies are processed after compiling the code, so some
+information is lost. For example functions or variables that are actually
+implemented as macros (#define's) are not considered in the results.
+
+=item
+You have to compile the sources before extracting information. Depending on the
+size of the project and how many times you need to extract the information, this
+limitation will probably make this extractor not viable for you.
+
+=back
+
+=head1 SEE ALSO
+
+L&lt;gcc&gt;, L&lt;egypt&gt;
+
+=cut
+
 use strict;
 use warnings;
 </diff>
      <filename>Egypt/Extractor/GCC.pm</filename>
    </modified>
    <modified>
      <diff>@@ -1,16 +1,10 @@
 use ExtUtils::MakeMaker;
 
-my $version = `perl -ne 'if (/applies to egypt version/) { s/.*version //; s/[^0-9]*\$//; print  }' egypt`;
-chomp $version;
-unless ($version =~ /^\d+.\d+$/) {
-  die &quot;Invalid version read from documentation: [$version]. There is something wrong with this package.\n&quot;;
-}
-
 my @exe_files = glob('egypt*');
 
 WriteMakefile(
   NAME =&gt; 'egypt',
-  VERSION =&gt; $version,
+  VERSION_FROM =&gt; 'egypt',
   EXE_FILES =&gt; \@exe_files,
   PMLIBDIRS =&gt; [ 'Egypt' ],
   AUTHOR =&gt; 'Antonio Terceiro &lt;terceiro@softwarelivre.org&gt;',</diff>
      <filename>Makefile.PL</filename>
    </modified>
    <modified>
      <diff>@@ -1,16 +1,16 @@
 #!/usr/bin/perl -w
 
 use Pod::Usage;
-
-#use Getopt::Euclid;
+our $VERSION = '1.8.0';
 
 =head1 NAME
 
-egypt - a source code analysis suite.
+egypt - a source code analysis suite
 
 =head1 SYNOPSIS
 
-  egypt &lt;tool&gt; [options] &lt;args&gt;
+  egypt &lt;tool&gt; [tool-options] &lt;toolargs&gt; [&lt;tool-args&gt; ...]
+  egypt &lt;option&gt;
 
 =head1 DESCRIPTION
 
@@ -26,7 +26,7 @@ egypt has several individual tools that share a core infrastructure, but do
 different analysis and produce different output. They are normally invoked like
 this:
 
-  egypt &lt;tool&gt; [OPTIONS] &lt;directory&gt; [&lt;directory&gt; ...]
+  egypt &lt;tool&gt; [tool-options] &lt;tool-args&gt; [&lt;tool-args&gt; ...]
 
 Although you can invoke egypt tools against one or few files inside a project,
 normally it only makes sense to run it against the entire source tree (e.g.
@@ -37,6 +37,9 @@ corresponding manual for the tool(s) you want.
 
 =head1 OPTIONS
 
+The following are the options for the wrapper egypt script. The options for
+each tools are documented in the respective tool's manual page.
+
 =over
 
 =item --version
@@ -47,52 +50,89 @@ Displays version information and exits.
 
 Displays help for the 'egypt' command.
 
-=item --usage
+=back
+
+=head1 COPYRIGHT
 
-Displays usage for the 'egypt' command.
+=over
+
+=item Copyright (c) 1994-2006 Andreas Gustafsson
+
+=item Copyright (c) 2008-2009 Antonio Terceiro
 
 =back
 
-=head1 VERSION
+This program is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 AUTHORS
 
-This documentation applies to egypt version 1.8.
+Andreas Gustafsson wrote the original version of egypt. Since them several
+people contributed to egypt's development. See the AUTHORS file for a complete
+list.
 
 =cut
 
 use strict;
 use File::Basename;
 
-sub usage {
-  pod2usage(-verbose =&gt; 1);
-  exit(1);
-}
-
-if (scalar(@ARGV) == 0) {
-  usage();
-}
-
 my $base = dirname(__FILE__);
-my $command = shift(@ARGV);
 
-if ($command !~ /^[a-z]+$/) {
-  usage();
+sub usage {
+  my $status = shift;
+  pod2usage(-verbose =&gt; 1, -exitval =&gt; &quot;NOEXIT&quot;);
+  list_egypt_tools();
+  exit($status);
 }
 
-my $program = &quot;$base/egypt-$command&quot;;
-if (! -x $program) {
-  printf(&quot;\&quot;%s\&quot; is not an egypt command.\n&quot;, $command);
-  print(&quot;\n&quot;);
+sub list_egypt_tools {
   print(&quot;Available commands:\n&quot;);
   print(&quot;\n&quot;);
   for my $cmd_program (sort(glob(&quot;$base/egypt-*&quot;))) {
     $cmd_program =~ /^.*egypt-(.*)$/;
     my $cmd = $1;
-    printf(&quot;  %s\n&quot;, $cmd);
+    printf(&quot;    %s\n&quot;, $cmd);
   }
   print(&quot;\n&quot;);
+}
+
+sub show_version {
+  printf(&quot;egypt version %s\n&quot;, $VERSION);
+  exit(0);
+}
+
+if (scalar(@ARGV) == 0) {
+  usage(1);
+}
+
+my $tool = shift(@ARGV);
+if ($tool !~ /^[a-z]+$/) {
+  if ($tool eq '--version') {
+    show_version();
+  } elsif($tool eq '--help') {
+    usage(0);
+  } else {
+    printf(&quot;Invalid option: %s\n&quot;, $tool);
+    usage(1);
+  }
+}
+
+my $program = &quot;$base/egypt-$tool&quot;;
+if (! -x $program) {
+  printf(&quot;\&quot;%s\&quot; is not an egypt command.\n\n&quot;, $tool);
+  list_egypt_tools();
+  exit(1);
+}
 
+# do not pass --version option ahead, since the tools don't have a version on
+# their own.
+my @args;
+if (grep { $_ eq '--version' } @ARGV) {
+  print(&quot;Invalid option: --version\n&quot;);
+  system($program, '--help');
   exit(1);
+} else {
+  system($program, @ARGV);
+  exit($? &gt;&gt; 8);
 }
 
-system($program, @ARGV);
-exit($? &gt;&gt; 8);</diff>
      <filename>egypt</filename>
    </modified>
    <modified>
      <diff>@@ -4,32 +4,32 @@ use Getopt::Euclid;
 
 =head1 NAME
 
-egypt - create call graph from gcc RTL dump
-
-=head1 VERSION
-
-This documentation applies to egypt version 1.8.
+egypt graph - dependency graph generator
 
 =head1 USAGE
 
-  egypt [options] &lt;file&gt;...
+  egypt graph [options] &lt;input&gt;...
 
 =head1 DESCRIPTION
 
-Egypt is a simple tool for creating call graphs of C programs.
+egypt graph reads the dependency information from one or more source code
+directories passed as arguments, and produces as output the graph of
+dependencies between the modules of the software in the graphviz(1) format.
+
+egypt graph is part of the egypt suite.
 
 =head1 REQUIRED ARGUMENTS
 
 =over
 
-=item &lt;file&gt;...
+=item &lt;input&gt;...
 
-egypt can process any number of RTL files passed to it on the command line. If
-you pass directories in the command line, egypt will find those directories for
-files that match *.rtl and *.expand, and process them.
+The input directories (or files) with source code to be processed.
 
-If no input files are given in the command line, egypt will expect the RTL data
-in the standard input.
+Although you can pass individual files as input, this tool is more useful if
+you pass entire source directories. If you pass just a couple of files, their
+dependencies on modules that are not declared and/or implemented in those
+files will not be calculated.
 
 =back
 
@@ -55,6 +55,8 @@ default, such calls are not shown.  Even with this option, only direct
 calls will be shown; there is no way to show indirect calls to
 external functions.
 
+This options only works with the GCC extractor.
+
 =item --cluster
 
 Cluster the functions into files, so you can see in which files are the calling
@@ -73,16 +75,14 @@ It doesn't make much sense to use --modules together with --cluster.
 
 =item --extractor &lt;extractor&gt;
 
-Define wich extractor method use to analise source code. Default is Doxyparse.
+Define wich extractor method use to analise source code. Options are &quot;Doxyparse&quot; and
+&quot;GCC&quot;. Default is Doxyparse. See Egypt::Extractor::GCC(3) for information on how to
+setup your source tree in order to use the GCC extractor.
 
 =for Euclid:
   extractor.type: string, extractor =~ /\A\w+\Z/
   extractor.default: 'Doxyparse'
 
-=item --version
-
-Displays egypt version information and exits.
-
 =item --help
 
 Displays help on command line syntax and options.
@@ -105,85 +105,61 @@ file&gt;); this file is much easier to extract information from than a C
 source file.  Egypt extracts information about function calls from the
 RTL file and massages it into the format used by Graphviz.
 
-=head1 GENERATING THE RTL FILE
-
-Compile the program or source file you want to create a call graph for
-with gcc, adding the option &quot;-dr&quot; to CFLAGS.  This option causes gcc
-to dump its intermediate code representation of each file it compiles
-into a a file.
+=head1 VIEWING THE GRAPH
 
-For example, the following works for many programs:
+To view the generated graph, pipe egypt's output to one of the 
+Graphiz tools. You can use B&lt;dotty(1)&gt; to display the graph in a
+X11 window:
 
-   make clean
-   make CFLAGS=-dr
+    $ egypt graph src/ | dotty -
 
-Depending on the GCC version, the RTL file for a source file F&lt;foo.c&gt;
-may be called something like F&lt;foo.c.rtl&gt;, F&lt;foo.c.00.rtl&gt;, or
-F&lt;foo.c.00.expand&gt;.
+You can also generate a file to print or include in a document
+by using the B&lt;dot(1)&gt;.
 
-=head1 VIEWING THE CALL GRAPH
+To generate a PNG image called F&lt;graph.png&gt;:
 
-To view the call graph in an X11 window, run egypt with one or
-more .rtl files as command line arguments and pipe its output to the
-B&lt;dotty&gt; program from the Graphviz package.  For example, if you
-compiled F&lt;foo.c&gt; with C&lt;gcc -dr&gt; to generate F&lt;foo.c.00.rtl&gt;, use
+  $ egypt graph src/ | dot -Tpng -ograph.png -
 
-    egypt foo.c.00.rtl | dotty -
+To generate a PostScript version of the dependency graph for printing, you can
+also use the B&lt;dot&gt;. For example, to generate a dependency graph in the file
+F&lt;graph.ps&gt; fitting everything on a US letter size page in landscape mode, try
 
-=head1 PRINTING THE CALL GRAPH
+  $ egypt graph src/ | dot -Grotate=90 -Gsize=11,8.5 -Tps -o graph.ps
 
-To generate a PostScript version of the call graph for printing, use
-the B&lt;dot&gt; program from the Graphviz package.  For example, to generate
-a callgraph in the file F&lt;callgraph.ps&gt; fitting everything on a US
-letter size page in landscape mode, try
+Sometimes, the graph will fit better if the dependencies arrows go from left to
+right instead of top to bottom.  The B&lt;dot&gt; option B&lt;-Grankdir=LR&gt; will do
+that:
 
-   egypt foo.c.00.rtl | dot -Grotate=90 -Gsize=11,8.5 -Tps -o callgraph.ps
+  $ egypt graph src/ | dot -Gsize=8.5,11 -Grankdir=LR -Tps -o graph.ps
 
-Sometimes, the graph will fit better if function calls go from left to
-right instead of top to bottom.  The B&lt;dot&gt; option B&lt;-Grankdir=LR&gt;
-will do that:
-
-   egypt foo.c.00.rtl | dot -Gsize=8.5,11 -Grankdir=LR -Tps -o callgraph.ps
-
-For nontrivial programs, the graph may end up too small
+For large software, the graph may end up too small
 to comfortably read.  If that happens, try N-up printing:
 
-   egypt foo.c.00.rtl | dot -Gpage=8.5,11 -Tps -o callgraph.ps
+  $ egypt graph src/ | dot -Gpage=8.5,11 -Tps -o graph.ps
 
 You can also try playing with other B&lt;dot&gt; options such as B&lt;-Gratio&gt;,
 or for a different style of graph, try using B&lt;neato&gt; instead of
 B&lt;dot&gt;.  See the Graphwiz documentation for more information about the
 various options available for customizing the style of the graph.
 
-=head1 READING THE CALL GRAPH
-
-Function calls are displayed as solid arrows.  A dotted arrow means
-that the function the arrow points from takes the address of the
-function the arrow points to; this typically indicates that the latter
-function is being used as a callback.
+=head1 READING THE GRAPH
 
-=head1 WHY IS IT CALLED EGYPT?
+When generating a graph in the function level (i.g. without the I&lt;--modules&gt;
+option), function calls are displayed as solid arrows.  A dotted arrow means
+that the function the arrow points from takes the address of the function the
+arrow points to; this typically indicates that the latter function is being
+used as a callback.
 
-Egypt was going to be called B&lt;rtlcg&gt;, short for I&lt;RTL Call Graph&gt;,
-but it turned out to be one of those rare cases where ROT13'ing the
-name made it easier to remember and pronounce.
+When the I&lt;--modules&gt; option is on, then there are only solid arrows. An arrow
+from I&lt;A&gt; to I&lt;B&gt; means that I&lt;A&gt; depends on I&lt;B&gt;.
 
 =head1 SEE ALSO
 
-L&lt;gcc&gt;, L&lt;dotty&gt;, L&lt;dot&gt;, L&lt;neato&gt;
-
-=head1 COPYRIGHT
-
-Copyright (c) 1994-2006 Andreas Gustafsson
-Copyright (c) 2008-2009 Antonio Terceiro
-
-This program is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
+B&lt;dotty(1)&gt;, B&lt;dot(1)&gt;, B&lt;neato(1)&gt;, B&lt;egypt(1)&gt;
 
-=head1 AUTHORS
+=head1 COPYRIGHT AND AUTHORS
 
-Andreas Gustafsson wrote the original version of egypt. Antonio Terceiro built
-on his work and did a major refactoring while adding several features.
+See B&lt;egypt(1)&gt;
 
 =cut
 
@@ -210,7 +186,7 @@ $output-&gt;cluster($ARGV{'--cluster'});
 # wheter to group by module or not
 $output-&gt;group_by_module($ARGV{'--modules'});
 
-$extractor-&gt;process(@{$ARGV{'&lt;file&gt;'}});
+$extractor-&gt;process(@{$ARGV{'&lt;input&gt;'}});
 print $output-&gt;string;
 
 exit(0);</diff>
      <filename>egypt-graph</filename>
    </modified>
    <modified>
      <diff>@@ -4,17 +4,25 @@ use Getopt::Euclid;
 
 =head1 NAME
 
-egypt-metrics - egypt's metric reporting tool
+egypt metrics - egypt's metric reporting tool
 
-=head1 USAGE
+=head1 SYNOPSIS
 
-  egypt-metrics [options] &lt;directory&gt; [&lt;directory&gt; ...]
+  egypt metrics [options] &lt;input&gt; [&lt;input&gt; ...]
+
+=head1 DESCRIPTION
+
+egypt metrics analyzes source code in the directories passed as arguments and
+procudes a matrics report. Such report is written to the standard output in the
+YAML format (see I&lt;http://www.yaml.org/&gt;)
+
+egypt metrics is part of the egypt suite.
 
 =head1 REQUIRED ARGUMENTS
 
 =over
 
-=item &lt;directory&gt;...
+=item &lt;input&gt;...
 
 Tells egypt which source code directory(ies) you want to parse.
 
@@ -39,14 +47,21 @@ see Egypt::Extractor::GCC(3).
 When using the Doxyparse extractor (default), all files matching the languages
 supported by doxyparse are processed.
 
+=item --help
+
+Displays a help message on how to use this tool.
+
 =back
 
-=head1 COPYRIGHT
+=head1 OUTPUT FORMAT
+
+The output is a stream of YAML documents. The first one presents metrics for
+the project as a whole. The subsequent ones present per-module metrics, and thus
+there will be as many of them as there are modules in your project.
 
-Copyright (c) 2009 Antonio Terceiro
+=head1 COPYRIGHT AND AUTHORS
 
-This program is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
+See egypt(1)
 
 =cut
 
@@ -58,7 +73,7 @@ use Egypt::Metrics;
 my $extractor = Egypt::Extractor-&gt;load($ARGV{'--extractor'});
 my $metrics = Egypt::Metrics-&gt;new(model =&gt; $extractor-&gt;model);
 
-$extractor-&gt;process(@{$ARGV{'&lt;directory&gt;'}});
+$extractor-&gt;process(@{$ARGV{'&lt;input&gt;'}});
 print $metrics-&gt;report;
 
 exit(0);</diff>
      <filename>egypt-metrics</filename>
    </modified>
    <modified>
      <diff>@@ -23,7 +23,11 @@ end
 
 When /^I run &quot;([^\&quot;]*)&quot;$/ do |command|
   system(&quot;#{command} &gt;tmp.out 2&gt;tmp.err&quot;)
-  @exit_status = $?
+  if $?.is_a?(Fixnum)
+    @exit_status = $?
+  else
+    @exit_status = $?.exitstatus
+  end
   @stdout = File.readlines('tmp.out')
   @stderr = File.readlines('tmp.err')
 end
@@ -51,8 +55,26 @@ Then /^egypt must report that &quot;([^\&quot;]*)&quot; is part of &quot;([^\&quot;]*)&quot;$/ do |func,mod|
   found.should == true
 end
 
+class OutputDoesNotMatch &lt; Exception
+end
 Then /^the output must match &quot;([^\&quot;]*)&quot;$/ do |pattern|
-  @stdout.select {|item| item.match(pattern)}.should have_at_least(1).items
+  if @stdout.select {|item| item.match(pattern)}.size == 0
+    delimiter_line = &quot;-------------------------------------------------\n&quot;
+    report = []
+    report.push &quot;Standard output:\n&quot;
+    report.push delimiter_line
+    report.push @stdout
+    report.push delimiter_line
+    if !@stderr.empty?
+      report.push &quot;\n&quot;
+      report.push &quot;Standard error:\n&quot;
+      report.push delimiter_line
+      report.push @stderr
+      report.push delimiter_line
+    end
+    report.push &quot;\n&quot;
+    raise OutputDoesNotMatch.new(report)
+  end
 end
 
 Then /^the output must not match &quot;([^\&quot;]*)&quot;$/ do |pattern|</diff>
      <filename>features/step_definitions/egypt_steps.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>features/graph/version.feature</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>a49f09bafd5484f728f5d616aa015d674fb37485</id>
    </parent>
  </parents>
  <author>
    <name>Antonio Terceiro</name>
    <email>terceiro@softwarelivre.org</email>
  </author>
  <url>http://github.com/terceiro/egypt/commit/459b7a02ada64d7914bada83bf7b12ed40a861b8</url>
  <id>459b7a02ada64d7914bada83bf7b12ed40a861b8</id>
  <committed-date>2009-08-27T09:17:38-07:00</committed-date>
  <authored-date>2009-08-27T09:17:38-07:00</authored-date>
  <message>Documentation and UI work</message>
  <tree>7efb15a80bea650587a8cdcdc6aed7f276327f1e</tree>
  <committer>
    <name>Antonio Terceiro</name>
    <email>terceiro@softwarelivre.org</email>
  </committer>
</commit>
