Notes on Code Translation to Fortran - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Code Generation Package : Fortran : CodeGeneration/General/FortranDetails

Notes on Code Translation to Fortran

  

This help page describes details particular to code translation using the CodeGeneration[Fortran] function. For general information applicable to all the functions in the CodeGeneration package, see CodeGeneration/Details.

Description

• 

The Fortran code generated by CodeGeneration[Fortran] follows the Fortran 77 standard.

• 

Output from CodeGeneration[Fortran] follows Fortran 77 formatting rules: statements begin in column 7, and generated lines that exceed 72 characters in length are broken and continued according to accepted convention for Fortran 77.

• 

Identifiers present in the input code that do not meet the Fortran 77 standard for identifiers (a string of up to 6 alphanumeric characters, beginning with a letter) are replaced with valid identifiers in the generated output. Additionally, an identifier which differs from some other identifier only in case (for example, XYz vs. xYz) cannot be translated as is, since Fortran 77 is case-insensitive. Therefore, such conflicting identifiers are replaced with allowable identifiers one by one until the conflict is resolved. Note that this can produce confusing results if the code to be translated contains alternate-case equivalents of certain Maple names (for example, pi), as the Maple names may then be replaced.

  

Note: The {limitvariablelength=value} option specifies whether variable names longer than 6 characters will be replaced. Permissible values are true and false.  The default value is true.  This option is available for the CodeGeneration[Fortran] command only. Use the limitvariablelength=false option to prevent the automatic replacement of long names.

• 

If the code to be translated is a procedure with no return value, then it is translated to a Fortran subroutine; otherwise, it is translated to a Fortran function.

• 

The functions mod, modp, and mods are all translated as calls to the Fortran mod function (or its variants, depending on the setting of functionprecision). Note that the behavior of these functions is inconsistent with the behavior of mod for some values of the arguments.

• 

CodeGeneration[Fortran] translates printf statements to print statements, but performs only limited analysis of the printf format string. Thus some formatting instructions (for example, precision for floats) are ignored in translation.

• 

A Maple module is mapped to a Fortran program.  No distinction is made between public and private module members.  Procedure module members are declared, then in the main block, other module members are declared and/or initialized.

See Also

CodeGeneration, CodeGeneration/Details, CodeGeneration[Fortran]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam