Notes on Code Translation to Visual Basic
This help page describes details particular to code translation using the CodeGeneration[VisualBasic] function. For general information applicable to all the functions in the CodeGeneration package, see CodeGenerationDetails.
<Text-field style="Heading 2" layout="Heading 2" bookmark="info">Description</Text-field>
The Visual Basic code generated by CodeGeneration[VisualBasic] is valid for the Visual Basic.NET language.
In addition to the functions listed on the CodeGenerationDetails help page, the following Maple functions are recognized by CodeGeneration[VisualBasic]: cat, ceil, and floor.
When translating single statements or computation sequences, it is assumed that the Imports statements necessary for using the System and System.Math libraries have already been issued, so functions from these libraries are used without qualification.
Generally, math functions recognized by CodeGeneration[VisualBasic] are translated to functions in the System.Math library. Additionally, the Maple symbol Pi is translated to the Math constant System.Math.PI.
If the parameter to CodeGeneration[VisualBasic] is a procedure, the output is embedded in a Module CodeGenerationModule so that it can be included easily in another Visual Basic program.
Note that System.Math does not have equivalents for the inverse hyperbolic functions, so CodeGeneration[VisualBasic] expresses them in terms of Log, Sqrt, and Pow functions.
Because Maple expressions involving powers greater than 2 are translated into Math.Pow function calls, the automatic type deduction system may not be able to deduce the most appropriate type in all cases.
CodeGeneration[VisualBasic] translates printf statements to System.Console.WriteLine or System.Console.Write calls, but performs only limited analysis of the printf format string. Thus some formatting instructions (for example, precision for floats) are ignored in translation.
Conversions between single-precision and double-precision floats are not performed. If the precision=single option is specified, explicit type casts must be added to the results of any Math calls generated by CodeGeneration[VisualBasic].
Ranges of Maple Arrays and rtables are adjusted so that the resulting Visual Basic arrays start with index 0.
A Maple module is translated as a Visual Basic Module. Exported module members are translated to Public functions, subroutines, or variables, while local module members are translated as Private.
See AlsoCodeGenerationCodeGeneration[VisualBasic]CodeGenerationDetailstrademark