Return-Path: Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Delivered-To: mailing list dev@apr.apache.org Received: (qmail 83483 invoked from network); 2 Feb 2001 19:00:42 -0000 Received: from sfo-gw.covalent.net (HELO mako.covalent.net) (207.44.198.62) by h31.sny.collab.net with SMTP; 2 Feb 2001 19:00:42 -0000 Received: from localhost (dougm@localhost) by mako.covalent.net (8.11.0/8.11.0) with ESMTP id f12IxxT01077; Fri, 2 Feb 2001 10:59:59 -0800 X-Authentication-Warning: mako.covalent.net: dougm owned process doing -bs Date: Fri, 2 Feb 2001 10:59:59 -0800 (PST) From: Doug MacEachern To: Ben Laurie cc: dev@apr.apache.org Subject: Re: cvs commit: apr-util/include apr_hooks.h In-Reply-To: <3A7AEA65.93213E60@algroup.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N On Fri, 2 Feb 2001, Ben Laurie wrote: > What's C::Scan?? http://www.cpan.org/modules/by-module/C/ i'm using a wrapper around it (Apache::ParseSource), that spits out two other modules which are Perl structures containing the parsed header files. Apache::FunctionTable entries look like so: { 'return_type' => 'int', 'name' => 'ap_set_keepalive', 'args' => [ { 'type' => 'request_rec *', 'name' => 'r' } ], } and Apache::StructureTable entries like so: { 'type' => 'server_addr_rec', 'elts' => [ { 'type' => 'server_addr_rec *', 'name' => 'next' }, { 'type' => 'apr_sockaddr_t *', 'name' => 'host_addr' }, { 'type' => 'apr_port_t', 'name' => 'host_port' }, { 'type' => 'char *', 'name' => 'virthost' } ], }, i'm planning to use these tables for generating most of the modperl-2.0 glue code. but it can be used for whatever, here's some sorta neato stats (probably not 100% accurate): % perl util/source_stats.pl 80 typedefs apr: 55 ap: 25 71 typedef_structs apr: 32 ap: 39 609 functions apr: 319 ap: 290 431 struct_members apr: 147 ap: 284 % cat util/source_stats.pl use strict; use Apache::FunctionTable (); use Apache::StructureTable (); my %stats; for my $entry (@$Apache::FunctionTable) { unless ($entry->{name} =~ /^(ap|apr)_/) { print "found alien function $entry->{name}\n"; } $stats{functions}->{$1}++; } for my $entry (@$Apache::StructureTable) { my $elts = $entry->{elts}; my $type = $entry->{type}; my $c = $type =~ /^apr_/ ? "apr" : "ap"; if (@$elts) { $stats{typedef_structs}->{$c}++; $stats{struct_members}->{$c} += @$elts; } else { $stats{typedefs}->{$c}++; } } while (my($name, $tab) = each %stats) { printf "%d %s\n", $tab->{ap} + $tab->{apr}, $name; for (qw(apr ap)) { printf "%6s: %d\n", $_, $tab->{$_}; } }