[comp.lang.fortran] fortran source code translation utility

johnd@Stardent.COM (John R. Dennis @stardent) (02/13/90)

Can anyone point us at a utility that would perform a modest amount of
automated text editing on fortran source. The intended application is changing
from an old API (Application Program Interface, e.g. library calling
semantics) to a new API. At a minimum we want to be able to replace one name
with another, optionally we would also like to be able to add or delete a
parameter or change its position in a parameter list, or translate a
hard-coded constant to a symbolic constant (parameter in fortran), etc.

Note that because of the difficulty of doing lexical analysis of fortran
source and identifing tokens this is not a simple string replacement operation
such as might be offered by awk or sed in UNIX. Such a utility must have
considerable smarts about the fortran language.

It seems to me that given fortran's long history this must be a common problem
that has had multiple solutions. Can you point us at some of those solutions,
hopefully in the public domain?


-- 
John Dennis
E     Mail: johnd@Stardent.COM | {uunet,convex,decvax}!stardent!johnd
Snail Mail: Stardent Computer, 85 Wells Avenue Newton, MA 02159
Voice Mail: <Work>(617) 964-6228 x243 <Home>(508)366-7976

lamson@sierra.crd.ge.com (scott h lamson) (02/13/90)

In article <1990Feb12.234210.5541@Stardent.COM> johnd@Stardent.COM (John R. Dennis @stardent) writes:

>   From: johnd@Stardent.COM (John R. Dennis @stardent)

>   At a minimum we want to be able to replace one name
>   with another, optionally we would also like to be able to add or delete a
>   parameter or change its position in a parameter list, or translate a
>   hard-coded constant to a symbolic constant (parameter in fortran), etc.

One thing you can use is arithmetic statement functions
c
c   local definitions ** host specific **
c
c        convex version
c                   [ sh lamson GE CRD 1/90 ]
c     arithmetic statement functions to switch cray shift routines 
c       to convex
c
      integer shift,shiftr,shiftl
c
      and(i,j) = iand(i,j)
      or(i,j) = ior(i,j)
      shift(i,j) = ishft(i,j)
      shiftl(i,j) = ishft(i,j)
      shiftr(i,j) = ishft(i,-j)
c
c

this replaces cray references shiftr(i,j) with ishft(i,-j) which is
provided on the convex.   this minimizes the differences between cray
and convex versions, where both are being maintained.  I put this in
an include file for use by many routines.

another option is toolpack, a set of fortran source code
transformation tools.
For distribution, contact Integrated Systems Technologies at (312)869-
7820 or the Numerical Algorithms Group (usa 312-971-2337 or uk oxford
(0865)511245 international +44865 511245).

also see references IEEE Transactions on Software Engineering SE-9
                       #6 Nov 83 P 673.  L.J. Osterweil
TOOLPACK Funding was provided by the NSF, DOE, and 
                      UK Research & Engineering Council.


Lastly, Dennis Gannon et others is working on FAUST, a fortran (C?)
software development environment with source transformation
facilities.  This may be available this coming summer.

--
        Scott|  ARPA:      lamson@crd.ge.com
       Lamson|  UUCP:      uunet!crd.ge.com!lamson
(518)387-5795|  UUCP:      uunet!sierra.crd.ge.com!lamson

flatau@handel.CS.ColoState.Edu (flatau) (02/21/90)

I have used for some time "Toolpack" on VAX/VMS. It is a very useful utility.
However, I am  slowly moving towards UNIX.
I got fairly old 1986 Public Domain tape distributed by NAG.
It is version 2.1 but it seems that the installation on UNIX box is
not trivial (no make file, requires Pascal (?) compiler).
I wonder what is the current status of  machine
specific Toolpack public domain releases (except NAG's commercial version).
Would anybody have hacks for a) Titan --- UNIX V b) Sun's ?
and experience of installing Toolpack on UNIX ?
Is there a newer version than 2.1 and if yes is it available through
anonymous login ? Is the installation improved in the new version ?

Just out of curiosity, what is the status
of Toolpack project, is there anybody still working on it ?

Peter

flatau@handel.cs.colostate.edu