swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

glp - perl script to find classes/protocols


From: Rick Riolo
Subject: glp - perl script to find classes/protocols
Date: Mon, 2 Feb 1998 12:20:21 -0500 (EST)

Attached is a perl script to do what marcus suggests,
with a little pretty-ing up.   One problem with this whole
approach is that for beginning users when they run a script
like this for, say, ProbeMap, they will get a lot of hits,
and lots of lines go by, all fine to someone who knows the
structure of swarm classes, but all a bloomin-buzzing confusion
to the newbie.  To alleviate this a bit
the script tries to extract the names that appear in the
core lib documentation list and print them at the end.
  - r

Rick Riolo                           address@hidden
Program for Study of Complex Systems (PSCS)
4068 Randall Lab                
University of Michigan         Ann Arbor MI 48109-1120
Phone: 313 763 3323                  Fax: 313 763 9267
http://www.pscs.umich.edu/PEOPLE/rlr-home.html

On 1 Feb 1998, Marcus G. Daniels wrote:

> Date: 01 Feb 1998 18:04:41 -0800
> From: Marcus G. Daniels <address@hidden>
> To: address@hidden
> Cc: address@hidden
> Subject: Re: index into documentation? oobr?
> 
> >>>>> "RLR" == Rick Riolo <address@hidden> writes:
> 
> RLR> if a new user comes across something in a demo program 
> RLR> (eg Raster, ActiveGraph, etc), what is the best way for them to figure
> RLR> out where to find more documentation on that class?
> 
> Here's a possible procedure:
> 
> 1. Grep through the Swarm headers for a class or protocol name, something 
> like:
> 
> $ grep Raster include/*.h include/*/*.h
> or
> $ grep '@interface.*Raster' include/*.h include/*/*.h
> or
> $ grep '@protocol.*ProbeLibrary' include/*.h include/*/*.h
> 
> 2. With the knowledge of library membership for the class or protocol,
> go to http://www.santafe.edu/projects/swarm/swarmdocs/#core
> and select that library of interest, then select the "Interface Reference"
> for the nitty gritty.
> 
===============================================================================
#!/usr/local/bin/perl

require "getopts.pl";
&Getopts('h');

$SwarmHome = '/s/Swarm/swarm';
if ( $ENV{'SWARMHOME'} ) {
        $SwarmHome = $ENV{'SWARMHOME'};
}
$IPat = "address@hidden";
$PPat = "address@hidden";

&Usage() if $opt_h;
sub Usage {
    print <<"EOF";
Usage: $0 [-h] SymbolName

  Looks through files in include/*.h and include/*/*.h
  under the directory $SwarmHome for lines that match
    $IPat\SymbolName
  or
    $PPat\SynbolName
  and prints the lines matched.

EOF
    exit;
}

@files = <$SwarmHome/include/*.h>;
@files1 = <$SwarmHome/include/*/*.h>;
@files = (@files,@files1);

%Libs = ();

print "\nLooking for '$IPat' or '$PPat'\n";
print "in files under $SwarmHome/:\n";

foreach $file (@files) {
        open(FILE,$file);
        while ( <FILE> ) {
                if ( /$IPat/ || /$PPat/ ) {
                        $file =~ /^$SwarmHome\/(.*)/;
                        $path1 = $1;
                        printf "   %40s     $_", $path1;
                        if ( $path1 =~ /^include\/(.*)\// ) {
                                $Libs{"$1"} = "$1";
                        }
                        else {
                                $path1 =~ /^include\/(.*)\.h/;
                                $Libs{"$1"} = "$1";
                        }
                }
        }
        close FILE;
} 

print "Swarm libs to try:\n";
foreach (keys %Libs) {
        print " $_";
}
print "\n\n";





                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]