Pennington— The Name in Software Engineering Automation

XTRAN Demonstration:  Produce Module/Function Cross-Reference of Fortran

The following analysis used an XTRAN rules file comprising just over 300 lines of "meta-code" (XTRAN's rules language) to analyze all declarations of, and calls to, Fortran SUBROUTINEs and FUNCTIONs.  The XTRAN rules file itself is not specific to Fortran; it is language-independent, and can be used to analyze any language that allows declaration of, and calls to, procedures or functions.

The input to and output from XTRAN are untouched, except for the addition of line numbers to the input files for reference.



* Input to XTRAN:

File module1.for:

 1    EXTERNAL extfnc, extsub
 2
 3    INTEGER FUNCTION intf1()
 4        intf1 = 1
 5        RETURN
 6    END
 7
 8    SUBROUTINE ints1(a, b)
 9        CALL extsub()
10        i = undfnc(j)
11        i = extfnc()
12        i = intf1()
13        RETURN
14    END
15
16    SUBROUTINE intf2
17        i = undfnc(j)
18        i = i + 1
19        i = intf1()
20        CALL ints1(i, j)
21        CALL extsub()
22        i = intf1()
23        RETURN
24    END

File module2.for:

 1    EXTERNAL extfnc, extsub
 2
 3    SUBROUTINE ints2(a, b)
 4        CALL extsub()
 5        i = undfnc(j)
 6        INCLUDE 'module3'
 7        i = extfnc()
 8        INCLUDE 'module3/NOLIST'
 9        i = intf2(a, b)
10        i = intf1()
11        RETURN
12    END

File module3.for:

 1    CALL extsub()


* Output from XTRAN:

PROCEDURE/Function Cross-Reference

Legend:
	D    => declaration
	X    => external declaration
	N    => nested declaration
	R    => recursive call
	else => call


Declarations & calls for each procedure/function, by source file:

extfnc()
    module1.for. . . . . . . . . . . . . 1E, 11
    module2.for. . . . . . . . . . . . . 1E, 7
extsub()
    module1.for. . . . . . . . . . . . . 1E, 9, 21
    module2.for. . . . . . . . . . . . . 1E, 4
    module3.for. . . . . . . . . . . . . 1
intf1()
    module1.for. . . . . . . . . . . . . 3D, 12, 19, 22
    module2.for. . . . . . . . . . . . . 10
intf2()
    module1.for. . . . . . . . . . . . . 16D
    module2.for. . . . . . . . . . . . . 9
ints1()
    module1.for. . . . . . . . . . . . . 8D, 20
ints2()
    module2.for. . . . . . . . . . . . . 3D
undfnc()
    module1.for. . . . . . . . . . . . . 10, 17
    module2.for. . . . . . . . . . . . . 5

Procedure/function declarations & calls in each source file,
  by procedure/function name:

module1.for
    extfnc(). . . 1E, 11
    extsub(). . . 1E, 9, 21
    intf1() . . . 3D, 12, 19, 22
    intf2() . . . 16D
    ints1() . . . 8D, 20
    undfnc(). . . 10, 17
module2.for
    extfnc(). . . 1E, 7
    extsub(). . . 1E, 4
    intf1() . . . 10
    intf2() . . . 9
    ints2() . . . 3D
    undfnc(). . . 5
module3.for
    extsub(). . . 1


COPYRIGHT 2012; reproduction prohibited without permission.  Revised 2009-09-11

XTRAN is a trademark of Pennington Systems Incorporated.

  Pennington Systems Incorporated
2820 N. Pinal Avenue, Suite 12
Casa Grande, Arizona 85122-7927
USA


  Phone:  +1(480)626-5503
Fax:  +1(480)626-7618
Email:  Info@Pennington.com
Web:  http://WWW.Pennington.com