| | 1 | = Fortran Transformations = |
| | 2 | |
| | 3 | Here are all transformations converting Fortran program behaviors to CIVL-C ones. |
| | 4 | |
| | 5 | == 1 Program Unit == |
| | 6 | |
| | 7 | === 1.1 Program Entry === |
| | 8 | |
| | 9 | * `PROGRAM` indicates the entry of the whole program. |
| | 10 | A 'PROGRAM' chunk is transformed to be the main function in CIVL-C. |
| | 11 | |
| | 12 | === 1.2 Subroutines & Call Statements === |
| | 13 | |
| | 14 | * `SUBROUTINE` is a set of program instructions that process given arguments. |
| | 15 | A 'SUBROUTINE' chunk is transformed as a CIVL-C function with `void` type; |
| | 16 | All parameters with scalar types will be transformed as passed-by-reference. |
| | 17 | |
| | 18 | * 'SUBROUTINE' chunks are triggered by `CALL` keyword. |
| | 19 | A CALL-statement is transformed as a normal function call without a return-value. |
| | 20 | Argument variables with scalar types are transformed as an address-of expression. |
| | 21 | |
| | 22 | === 1.3 Functions & Function Returned Values=== |
| | 23 | |
| | 24 | == 2 Statements == |
| | 25 | |
| | 26 | === 2.1 Control Statements === |
| | 27 | |
| | 28 | * `IF`-`ELSE` `IF`-`ELSE` structure keeps unchanged. |
| | 29 | |
| | 30 | * `DO` loops are transformed as `for` loops in CIVL-C. |
| | 31 | |
| | 32 | |
| | 33 | (TODO: Fix the bound issue on the loop variable, which goes beyond the bound in C but stops on the bound in Fortran.) |
| | 34 | |
| | 35 | * Computed `GOTO` structures are transformed as `switch`-`case` structure in CIVL. |
| | 36 | |
| | 37 | === 2.2 Common Block Statements=== |
| | 38 | |
| | 39 | === 2.3 Inclusion === |
| | 40 | |
| | 41 | == 3 Expressions == |
| | 42 | |
| | 43 | == 4 Variables & Types == |
| | 44 | |
| | 45 | === 4.1 Scalar Types === |
| | 46 | |
| | 47 | === 4.2 Array Types & Array Sections === |