Fortran Declare and Define

Indicates an entity is defined or declared in a scope. The same reference kind is used for top level program units defined in files, nested program units contained in other program units, and also for objects/types defined in program units.

For subprograms, a “define” relation is generated for the actual subroutine or function statement. Other declarations (for example, function type declarations, external statements, and declarations in interface blocks), result in “declare” relations.

For objects, the first declaring statement for the object results in a “define” relation. Subsequent declaring statements result in “declare” relations.

For private entities in modules, the reference kinds Define Private and Definein Private are used in place of Define and Definein.

For implicit definitions, Define Implicit and Definein Implicit are used in place of Define and Definein.

Example 1: In the sample.f file:

SUBROUTINE A 
... 
CONTAINS 
   SUBROUTINE B 
      INTEGER X 
      ... 
   END SUBROUTINE B 
END SUBROUTINE A 

Example 2: In the sample.f file:

SUBROUTINE SUB1 
   EXTERNAL FUNC 
   ... 
END SUBROUTINE 
FUNCTION FUNC 
   INTEGER FUNC 
END FUNCTION 

Example3:

SUBROUTINE SUB1 
   INTEGER :: A(:) 
   POINTER A 
   ... 
END SUBROUTINE 

Example4:

MODULE M  
   PRIVATE 
   INTEGER A   ! private object 
   ... 
END MODULE 

Example5:

SUBROUTINE SUB 
   M = 1 
   ... 
END 
Reference Kind
Entity Performing Reference
Entity Being Referenced
Fortran Declare
Ex. 2: SUB1Ex. 3, line 3: SUB1
Ex. 2: FUNCEx. 3, line 3: A
Fortran Declarein
Ex. 2: FUNCEx. 3, line 3: A
Ex. 2: SUB1Ex. 3, line 3: SUB1
Fortran Define
Ex. 1: sample.fEx. 1: AEx. 1: BEx. 2: sample.fEx. 3, line 2: SUB1
Ex. 1: AEx. 1: BEx. 1: XEx. 2: FUNCEx. 3, line 2: A
Fortran Definein
Ex. 1: AEx. 1: BEx. 1: XEx. 2: FUNCEx. 3, line 2: A
Ex. 1: sample.fEx. 1: AEx. 1: BEx. 2: sample.fEx. 3, line 2: SUB1
Fortran Define Private
Ex. 4: M
Ex. 4: A
Fortran Definein Private
Ex. 4: A
Ex. 4: M
Fortran Define Implicit
Ex. 5: SUB
Ex. 5: M
Fortran Definein Implicit
Ex. 5: M
Ex. 5: SUB
 

Scientific Toolworks, Inc.
http://www.scitools.com