wiki:FortranTransformations

Version 1 (modified by wuwenhao, 7 years ago) ( diff )

--

Fortran Transformations

Here are all transformations converting Fortran program behaviors to CIVL-C ones.

1 Program Unit

1.1 Program Entry

  • PROGRAM indicates the entry of the whole program.

A 'PROGRAM' chunk is transformed to be the main function in CIVL-C.

1.2 Subroutines & Call Statements

  • SUBROUTINE is a set of program instructions that process given arguments.

A 'SUBROUTINE' chunk is transformed as a CIVL-C function with void type; All parameters with scalar types will be transformed as passed-by-reference.

  • 'SUBROUTINE' chunks are triggered by CALL keyword.

A CALL-statement is transformed as a normal function call without a return-value. Argument variables with scalar types are transformed as an address-of expression.

1.3 Functions & Function Returned Values

2 Statements

2.1 Control Statements

  • IF-ELSE IF-ELSE structure keeps unchanged.
  • DO loops are transformed as for loops in CIVL-C.

(TODO: Fix the bound issue on the loop variable, which goes beyond the bound in C but stops on the bound in Fortran.)

  • Computed GOTO structures are transformed as switch-case structure in CIVL.

2.2 Common Block Statements

2.3 Inclusion

3 Expressions

4 Variables & Types

4.1 Scalar Types

4.2 Array Types & Array Sections

Note: See TracWiki for help on using the wiki.