trsearch

20Jan2010
jec


trsearch is a csh script, based on progsearch, with a similar user interface and some additional functionality. The current version (1.0) also supports the 'traditional' progsearch modes of operation. The principal changes introduced are

Implementation

The file selection implemented in progsearch is unchanged. The argument parsing was rewritten to accomodate extra arguments, and the searchgrep script now calls a perl script sgrepf2.pl, which executes the grep command, identifies the output lines which correspond to a Fortran statement containing the search string, and then uses the perl module FtnStmt.pl to print only those lines corresponding to statements of the requested type.

The output format is now enhanced, with the search strings ( usually - work in progress..) highlighted.

Arguments & Keywords

( See also these examples ) trsearch is invoked by a command of the form

trsearch.csh <target> <str> [<str2> <str3> ] [ [ <key1> <key2> ] [-k] [ <keyn1> <keyn2> ] ]

where

<target>
is the name of a Transp executable to be searched.
<str>
is the 1st string to be searched for
<str2> <str3>
are optional additional strings to search for
<key1> <key2>
are optional traditional keywords
-k
is an optional flag denote the start of 'new' keywords
<keyn1> <keyn2>
are optional 'New' keywords. These may also be given as a single argument, delimited by commas

The traditional progsearch keywords are supported -

nolib
Libraries associated with the target code are not searched
noinc
Include files are not searched
nocomment
Comment lines are not searched
codesymbol
No comment lines, no substrings
codeassign
Looks for assignment to a symbol ( Cf Lval below )

while FtnStmt supports these additional keywords ( at the time of writing ) -

IO
String occurs in an IO list  ( = read | write )
all|any
display all occurences of String
comment
include comment lines ( Df do not.. )
def_code
String is defined ( as a procedure ) eg Subroutine, Function, module keywords
def_var
String is defined ( as a code symbol ) eg real, dimension, character keywords
lval|codeassign
String is assigned to ( occurs to left of = sign )
other
String occurs in an unclassified statement
read
String occurs in a read statement
write
String occurs in a print or write statement

If none of the 'new' keywords are present, then a traditional search ( grep & sfilter ) is performed

help ..

trread -h displays help information -

>trsearch.csh -h
Help is at hand 

?trsearch: required arguments missing -

syntax: trsearch <progname> <str1> [strs...] [keyword]"
to search program sources for specified strings."
At least one search string must be given.
trailing argument may be a keyword:
keyword = "noinc" to suppress include file searches'
"nolib" to suppress library searches'
"nocomment" to suppress comment lines'
"codesymbol" to suppress comments, substrings'
"codeassign" to look for assign statements'

'New' keywords :
IO String occurs in an IO list
all|any display all occurences of String
comment include comment lines ( Df do not.. )
def_code String is defined ( as a procedure )
def_var String is defined ( as a code symbol )
lval|codeassign String is assigned to
other String occurs in an unclassified statement
read String occurs in a read statement
write String occurs in a print or write sta

Buglist, Wishlist..

Known Bugs

Wishlist