Next: Module dependencies
Up: Mofia 2.0 Implementation Notes
Previous: Mofia 2.0 Implementation Notes
All new code is to be placed in Fortran 90 modules to enforce strong
type-checking and to facilitate encapsulation. A module is
built around its data, but it also contains the procedures accessing
this data, particularly the procedures creating, destroying, or
modifying this data. Of course procedures will often access data in
several modules, so there is sometimes ambiguity as to where they
belong. In this case it is often useful to place them in steering
modules.
Module names will look like (root_mod, and routines in it will
often contain (root in their names.
When a module is compiled, two files are produced, with extensions .o
and .mod. The .mod file contains the variable and procedure type
definitions, and is used in the compilation stage of other use
associated modules to enforce type cosistency. These files are all placed
in a separate /module subdirectory, much like include files. Contents
of a typical module are (in order):
- USE statements
- List module names containing data or procedures accessed in
this module.
- PRIVATE
- Make variables inaccessible by default.
- PUBLIC names
- List of variables and procedures to be made
accessible through use association. If the module contains only
public names and has no USE statements then PRIVATE and PUBLIC can be
omitted.
- IMPLICIT NONE
-
- TYPE, INTEGER, REAL, INTERFACE
- Data type definitions, definitions of variables global to the module, interface blocks.
For consistency between modules the interface block code will be put in a .ifb file
and included by the cpp preprocesser.
- CONTAINS
- Followed by code for procedures.
Next: Module dependencies
Up: Mofia 2.0 Implementation Notes
Previous: Mofia 2.0 Implementation Notes
Art Olin
2001-04-20