perl.cvs.parrot
[Top] [All Lists]

[svn:parrot] r25689 - in trunk: config/gen/makefiles tools/build

Subject: [svn:parrot] r25689 - in trunk: config/gen/makefiles tools/build
From:
Date: Tue, 12 Feb 2008 22:22:27 -0800 PST
Newsgroups: perl.cvs.parrot

Author: petdance
Date: Tue Feb 12 22:22:26 2008
New Revision: 25689

Modified:
   trunk/config/gen/makefiles/root.in
   trunk/tools/build/headerizer.pl

Log:
added malloclist target to show all the PARROT_MALLOC functions

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in  (original)
+++ trunk/config/gen/makefiles/root.in  Tue Feb 12 22:22:26 2008
@@ -745,6 +745,7 @@
        @echo "  splint:            Code checking with splint."
        @echo "  headerizer:        Recreate header files for C-source files"
        @echo "  apilist:           Show list of PARROT_API functions"
+       @echo "  malloclist:        Show list of PARROT_MALLOC functions"
        @echo "  cover:             Run test suite coverage analysis."
        @echo ""
        @echo "Release:"
@@ -2205,7 +2206,10 @@
        $(PERL) $(BUILD_TOOLS_DIR)/headerizer.pl $(HEADERIZER_O_FILES)
 
 apilist: $(SRC_DIR)/core_pmcs.c
-       $(PERL) $(BUILD_TOOLS_DIR)/headerizer.pl --apilist $(HEADERIZER_O_FILES)
+       $(PERL) $(BUILD_TOOLS_DIR)/headerizer.pl --macro=PARROT_API 
$(HEADERIZER_O_FILES)
+
+malloclist: $(SRC_DIR)/core_pmcs.c
+       $(PERL) $(BUILD_TOOLS_DIR)/headerizer.pl --macro=PARROT_MALLOC 
$(HEADERIZER_O_FILES)
 
 ###############################################################################
 #

Modified: trunk/tools/build/headerizer.pl
==============================================================================
--- trunk/tools/build/headerizer.pl     (original)
+++ trunk/tools/build/headerizer.pl     Tue Feb 12 22:22:26 2008
@@ -44,9 +44,9 @@
 
 =over 4
 
-=item C<--apilist>
+=item C<--macro=X>
 
-Print a list of PARROT_API functions instead of updating source.
+Print a list of all functions that have macro X.  For example, 
--macro=PARROT_API.
 
 =back
 
@@ -406,11 +406,12 @@
 }
 
 sub main {
-    my $apilist;
+    my $macro_match;
     GetOptions(
-        apilist => \$apilist,
+        'macro=s' => \$macro_match,
     ) or exit(1);
 
+    die "No files specified.\n" unless @ARGV;
     my %ofiles;
     ++$ofiles{$_} for @ARGV;
     my @ofiles = sort keys %ofiles;
@@ -442,7 +443,7 @@
         }
 
         my @decls;
-        if ( $apilist || -f $pmcfile ) {
+        if ( $macro_match || -f $pmcfile ) {
             @decls = extract_function_declarations( $csource );
         }
         else {
@@ -453,11 +454,15 @@
             my $components = function_components_from_declaration( $cfile, 
$decl );
             push( @{ $cfiles{$hfile}->{$cfile} }, $components ) unless $hfile 
eq 'none';
             push( @{ $cfiles_with_statics{$cfile} }, $components ) if 
$components->{is_static};
-            push( @{ $api{$cfile} }, $components ) if $components->{is_api};
+            if ( $macro_match ) {
+                if ( grep { $_ eq $macro_match } @{$components->{macros}} ) {
+                    push( @{ $api{$cfile} }, $components );
+                }
+            }
         }
     }    # for @cfiles
 
-    if ( $apilist ) {
+    if ( $macro_match ) {
         my $nfuncs = 0;
         for my $cfile ( sort keys %api ) {
             my @funcs = sort { $a->{name} cmp $b->{name} } @{$api{$cfile}};
@@ -467,7 +472,8 @@
                 ++$nfuncs;
             }
         }
-        print "$nfuncs PARROT_API functions\n";
+        my $s = $nfuncs == 1 ? '' : 's';
+        print "$nfuncs $macro_match function$s\n";
     }
     else { # Normal headerization and updating
         # Update all the .h files

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:parrot] r25689 - in trunk: config/gen/makefiles tools/build, petdance <=