There are several way to start undertanding
RAMS system. We have decided to make a static analysis applying reverse
engeneering methods on it. Most of the reports presented here are based
on output files generated by the Sun Fortran 77 Compiler (option Xlist*).
Perl scripts programs were developed to filter and extract code information
from the files described above, to obtain the reports. Finally, it was
developed a Shell script program to join all of these reports.
The results of this approach is presented here by this document in a
series of reports described bellow. Some reports may need a (legend).
Report 1 -List the Source Files and Modules
Here you will find all RAMS source files and related subroutine / functions
(which we will call *modules*), ordered by file name.
Report 2 - List Modules and Source Files
Some people may find useful to have a list of RAMS modules followed
by their source file names. This is another view of report 1.
Report 3 - Call Graph (relationship between modules)
Another important information is the relationship between each system
module. So, this third report shows what we call *call graph*.
Report 4 - List Shared Variables by Multiple
Modules
This next report ilustrates the shared variables. For *shared variables*
we mean common variables (referenced twice or more) and module arguments.For
instance, you may see that commom named all declare itopo as
a commom variable and model/rmisc.f radcomp makes reference
to it. By the way, model/rmisc.f radcomp means that
radcomp is a system module placed at RAMS model file system
tree.
Report 5 - Data Dictionary
Report 5 is an extension of the last report, in the sense it lists
*all* (local and global) variables defined in any source file.
Report 6 - Cyclomatic Complexity
Cyclomatic Complexity is a software qualit metric that evaluates how
*complex* is a given module. Here you will find a little discussion about
how we have calculated these values and all the cyclomatic complexity meassures
for each RAMS module.
Report 7 - List Modules which Call others
Maybe you may find interesting to have a list of modules called by
a particular module you are analysing. Here you will discover, for example,
that RAMS data preparation package main module rams_data_prep is
declared inside dprep/asgen.f and calls, respectivelly, modules
pressio, read_rawi and read_sfc this way
101: call pressio(10,locfn,p,nprx,npry,nprz,5)
120: call read_rawi(10,obslat1,obslat2,obslon1,obslon2)
139: call read_sfc(10,obslat1,obslat2,obslon1,obslon2)
Report 8 - List Modules Called by others
Did you like the last report? So you will also appreciate this one.
It is useful to have a "reverse order" of system module calls where you
can see that module A is called by modules B, C and D.
For example, here you find this sources of information:
module acctimes is declared at model/rtimh.f this
way
238: subroutine acctimes(num,string,t1,w1,a)
and is called by these modules:
source file model/rtimh.f
module timestep
17: call acctimes(0,' ',t1,w1,a)
module timestep
26: call acctimes(1,'TEND0',t1,w1,a)
module timestep
33: call acctimes(2,'THERMO',t1,w1,a)
module timestep
37: call acctimes(3,'RADIATE',t1,w1,a)
Report 9 - List Modules and their accessed
Shared Variables
There will be a time you will need to analyse all RAMS system modules
and knowing what kind of variables a particular module access. This report
shows, for each module, all shared variables it manages and what kind of
access it does.
For example, reading
this report you will be able to watch that module rams_data_prep
is declared at dprep/asgen.f and access
these shared variables:
Report 10 - List Shared Variables accessed by Modules
For example, you may see that ihour, a int*4 shared variable
defined at common /control/ offset:12 is acessed by modules rams_data_prep
and pressio declared at dprep/asgen.f source file,
as stated bellow.
ihour int*4 in common /control/ offset:12
Source File: dprep/asgen.f
File Modules:
rams_data_prep 23:N
(watch legend)
rams_data_prep 98:U
rams_data_prep 117:U
rams_data_prep 136:U
pressio 157:U
pressio 171:U
Report 11 - Commons Data Structure and Declared
Variables
Report 11 shows commons data structure as a tupple (common name, variable
name, variable type, memory offset, variable length) and list common variables
accessed by each system module file.
Report 12 - Errors and Warnings
This report contains information extracted from f77, Sun's FORTRAN
compiler, which may be useful in the case you need to know more about RAMS
source file organization such as number of warnings, errors, subroutines
and so on.
Maybe you would rather make a download
of this documentation and read it off-line. Inside staticanalysis.tar.gz
you will find information about setting up this page in order to read it
without problems.
(C) Copyright Elebra - All rights reserved
Cod.1208.001.001.1 Doc.106 Rev.0
Date 04/98