ToMapleBoolean - Maple Help

Home : Support : Online Help : Programming : OpenMaple : C Application Programming Interface : Conversions to Maple Objects : OpenMaple/C/ConvertToMaple

ToMapleBoolean

convert an integer to true, false, or FAIL

ToMapleChar

convert an integer to a string of length 1

ToMapleComplex

convert a (re,im) hardware float pair to a Maple Complex object

ToMapleComplexFloat

convert a (re,im) software float pair to a Maple Complex object

ToMapleExpressionSequence

convert a series of objects to an expression sequence

NewMapleExpressionSequence

create an empty expression sequence

ToMapleInteger

convert a hardware integer to a Maple integer

ToMapleInteger64

convert a 64-bit hardware integer to a Maple integer

ToMapleFloat

convert a hardware float to a Maple software float

ToMapleHFloat

convert a hardware float to a Maple hardware float

ToMapleFunction

create a Maple function object

ToMapleName

create a named Maple variable

ToMapleNULL

create a Maple NULL

ToMapleNULLPointer

create a Maple zero integer

ToMaplePointer

create a MaplePointer object with embedded external data

ToMapleRelation

create the specified Maple relation object

ToMapleString

convert a character array to a Maple string

ToMapleUneval

delay evaluation on the given object

 Calling Sequence ToMapleBoolean(kv, i) ToMapleChar(kv, i) ToMapleComplex(kv, re, im) ToMapleComplexFloat(kv, m_re, m_im) ToMapleExpressionSequence(kv, n, arg1, arg2, ..., argN) NewMapleExpressionSequence(kv, n) ToMapleInteger(kv, i) ToMapleInteger64(kv, ll) ToMapleFloat(kv, f) ToMapleFunction(kv, fname, n, arg1, arg2, ..., argN) ToMapleName(kv, str, is_global) ToMapleNULL(kv) ToMapleNULLPointer(kv) ToMaplePointer(kv, p, i) ToMapleRelation(kv, rel, lhs, rhs) ToMapleString(kv, str) ToMapleUneval(kv, s)

Parameters

 kv - kernel handle of type MKernelVector i - hardware integer re - double-precision hardware float im - double-precision hardware float m_re - Maple float object of type ALGEB m_im - Maple float object of type ALGEB n - hardware integer arg1, ..., argN - Maple objects of type ALGEB ll - 64-bit hardware integer f - double-precision hardware float fname - Maple name object of type ALGEB str - string or character array is_global - hardware integer p - pointer to anything rel - string or character array lhs - Maple object of type ALGEB rhs - Maple object of type ALGEB s - Maple object of type ALGEB

Description

 • These functions can be used in external code with OpenMaple or define_external.
 • The ToMaple* functions create Maple objects. The parameter types and return values are defined in the supplied header files.
 • ToMapleBoolean is three valued. When b is zero, it returns the Maple false object. If b is -1, it returns the Maple FAIL object. If b is non-zero (and not -1), it returns the Maple true object.
 • ToMapleChar returns a single character Maple string object.
 • ToMapleComplex converts the pair of hardware floats, re and im to the Maple expression, $\mathrm{re}+I\mathrm{im}$, and returns this object. ToMapleComplexFloat converts a pair of Maple software float objects to the same structure.
 • ToMapleExpressionSequence creates and returns a Maple expression sequence and fills it with the n Maple objects, arg1, arg2, ..., argN.
 • NewMapleExpressionSequence creates and returns a Maple expression sequence with space for n Maple objects.  The returned object can be filled in by assigning directly to the returned object as if it were an array.  For example, $r=\mathrm{NewMapleExpressionSequence}\left(\mathrm{kv},2\right)$ creates an expression sequence with space for two objects.  It can be filled in by assigning ${r}_{1}=\mathrm{obj1}$.   Note that the first element is located at ${r}_{1}$, not ${r}_{0}$.   Once filled in, an expression sequence must not be changed.  Also, never change an expression sequence that was not created by a call to NewMapleExpressionSequence. For an explanation of why some objects are not mutable, see MapleUnique.
 • ToMapleFunction creates and returns a Maple function object of the form fname( arg1, arg2, ..., argN).
 • ToMapleName returns a Maple NAME dag with the name str. If is_global is set to TRUE (1), the name is global in the Maple name space. Otherwise, if is_global is FALSE (0), the name is a unique exported local variable.
 • ToMapleNULL returns the Maple NULL object.
 • ToMapleNULLPointer returns the Maple zero integer object. This is the WRAPPER representation of a NULL pointer passed to a procedure. This is not to be confused with the value returned by ToMapleNULL.  It is also not related to a MaplePointer object.
 • ToMaplePointer creates a MaplePointer object. The p parameter is generally a data pointer. The i parameter is a unique integer identifier for your pointer data.  It can be retrieved by calling MaplePointerType.
 • ToMapleRelation forms the relation lhs rel rhs, where rel is one of "=", "<", ">", "and", "implies", "not", "or", and, "xor".
 • ToMapleString copies the character string, str to a Maple STRING object and returns it. When using the Fortran API the length of the given string must also be passed.
 • Other functions exist for creating Maple Array objects, list objects, and table objects. For more information, see RTableCreate, MapleListAlloc, and MapleTableAlloc.

Examples

 #include #include #include "maplec.h" ALGEB M_DECL TimeString( MKernelVector kv, ALGEB args ) { time_t c; c = time(&c); return( ToMapleString(kv,asctime(localtime(&c))) ); }

Execute the external function from Maple.

 > $\mathrm{with}\left(\mathrm{ExternalCalling}\right):$
 > $\mathrm{dll}≔\mathrm{ExternalLibraryName}\left("HelpExamples"\right):$
 > $\mathrm{today}≔\mathrm{DefineExternal}\left("TimeString",\mathrm{dll}\right):$
 > $\mathrm{today}\left(\right)$
 ${"Thu Feb 11 22:13:33 2016"}$ (1)