#!/usr/local/bin/perl # # Script to process the output of purify in terms of memory use. # # Abelardo Pardo # # Revision [$Id: createfunctionmap,v 1.4 1996/12/18 23:43:46 hsv Exp $] require 5.001; use Getopt::Long; # Define default variables # $version = 1.3; # Initialize the different options # $opt_h = 0; $opt_v = 0; # Read the options # $optionResult = GetOptions("h","v"); # Print the version if required # if ($opt_v) { print < ENDOFMESSAGE exit; } # Print the help message if required # if ($opt_h || !$optionResult) { print < Options: -h Print this message -v Print the version Author: Abelardo Pardo ENDOFMESSAGE exit; } # Open the input files # foreach $filename (@ARGV) { if (open(INPUT, $filename)) { $indefinition = 0; while() { chop; if (/FileName\s+\[\s*(.+)\s*\]/) { $cfilename = $1; } if (/PackageName\s+\[\s*(.+)\s*\]/) { $pkgname = $1; } if (/^\/\*\*AutomaticStart\*+\/$/) { $indefinition = 1; } if (/^\/\*\*AutomaticEnd\*+\/$/) { $indefinition = 0; } if ($indefinition == 1) { if (/static\s*.*\s+([a-zA-Z0-9_]+\(.*\))/) { $function = $1; $function =~ /([a-zA-Z0-9_]+)\(.*\)/; print "$pkgname $cfilename $1\n"; } } } close(INPUT); } else { print "Unable to open $filename. Ignoring it.\n"; } } exit;