Notes on Code Translation to C - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Code Generation Package : C : CodeGeneration/General/CDetails

Notes on Code Translation to C

• 

The C code generated by CodeGeneration[C] follows the ANSI C standard.

  

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

Description

• 

In addition to the functions listed on the CodeGeneration/Details help page, the following Maple functions are recognized by CodeGeneration[C]: ceil, floor, if (operator form), length, sprintf, system.

• 

Generally, math functions recognized by CodeGeneration[C] are translated to functions in the ANSI C standard math library, math.h.

• 

Since there are no equivalents for max, min, round, sign, and signum in ANSI C, CodeGeneration[C] translates them to expressions involving the conditional operator.

• 

The functions mod, modp, and mods are all translated to ANSI C expressions using the modulus operator %.

  

Note: The behavior of these functions is inconsistent with the behavior of % for some values of the arguments.

• 

Because Maple expressions involving powers greater than 2 are translated into pow function calls, the automatic type deduction system may not be able to deduce the most appropriate type in all cases.

• 

Identifiers present in the input code that do not meet the ANSI C standard for identifiers (a string of up to 31 alphanumeric characters or underscores, beginning with a letter or underscore) are replaced with valid identifiers in the generated output.

• 

Ranges of Maple Arrays and rtables are adjusted so that the resulting C arrays start with index 0.

• 

A module is printed as follows.

  

The exports of the module are printed as a sequence of variable declarations and function prototypes, suitable for inclusion in a C header file, followed by initializations and function definitions for every module member, which are intended to be put into a source file associated with this header file.

See Also

CodeGeneration

CodeGeneration/Details

CodeGeneration[C]

 


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