ToMapleBoolean - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : VB Application Programming Interface : Conversions to Maple Objects : OpenMaple/VB/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

ToMapleInteger

convert a hardware integer to a Maple integer

ToMapleFloat

convert a hardware float to a Maple float

ToMapleFunction

create a Maple function object

ToMapleName

create a named Maple variable

ToMapleNULL

create a Maple NULL

ToMapleNULLPointer

create a Maple zero integer

ToMapleRelation

create the specified Maple relation object

ToMapleString

convert a character array to a Maple string

ToMapleUneval

delay evaluation on the given object

NewMapleExpressionSequence

create an empty expression sequence

MapleExpseqAssign

fill in an expression sequence

MapleExpseqSelect

select from an expression sequence

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

ToMapleBoolean(kv, i)

ToMapleChar(kv, str)

ToMapleComplex(kv, re, im)

ToMapleComplexFloat(kv, m_re, m_im)

ToMapleInteger(kv, i)

ToMapleFloat(kv, f)

ToMapleFunction(kv, fname, expseq

ToMapleName(kv, str, is_global)

ToMapleNULL(kv)

ToMapleNULLPointer(kv)

ToMapleRelation(kv, rel, lhs, rhs)

ToMapleString(kv, str)

ToMapleUneval(kv, s)

NewMapleExpressionSequence(kv, n)

MapleExpseqAssign(kv, expseq, i, s)

MapleExpseqSelect(kv, expseq, i)

Parameters

kv

-

kernel handle returned by StartMaple

i

-

hardware integer

re

-

double-precision hardware float

im

-

double-precision hardware float

m_re

-

Maple float object

m_im

-

Maple float object

n

-

hardware integer

f

-

double-precision hardware float

fname

-

Maple name object

str

-

string

is_global

-

True or False

rel

-

string

lhs

-

Maple object

rhs

-

Maple object

s

-

Maple object

expseq

-

Maple expression sequence object

Description

• 

These functions are part of the OpenMaple interface to Microsoft Visual Basic.

• 

The ToMaple* functions create Maple objects. The parameter types and return values are defined in maple.bas.

  

Note: The maple.bas file is in the extern/include directory of your Maple installation.

• 

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. If the str parameter is a string with more than one character, the Maple string object returned has only the first character of the input string.

• 

ToMapleComplex converts the pair of hardware floats, re and im to the Maple expression, re+Iim, and returns this object. ToMapleComplexFloat converts a pair of Maple software float objects to the same structure.

• 

NewMapleExpressionSequence creates and returns a Maple expression sequence with space for n Maple objects.  The returned object can be filled using MapleExpseqAssign. For example, r=NewMapleExpressionSequencekv,2 creates an expression sequence with space for two objects.  It can be filled with object1 s1 and object2 s2 by calling MapleExpseqAssign(kv,r,1,s1) and MapleExpseqAssign(kv,r,2,s2). Note that the first element is specified by index 1, not 0. Once filled, 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. MapleExpseqSelect(kv,r,1) returns the first object in an expression sequence.

• 

ToMapleFunction creates and returns a Maple function object of the form fname(expseq), where expseq is an expression sequence possibly created by NewMapleExpressionSequence.

• 

ToMapleName returns a Maple NAME dag with the name str. If is_global is set to True, the name is global in the Maple name space. Otherwise, if is_global is False, the name is a unique exported local variable.

• 

ToMapleNULL returns the Maple NULL object.

• 

ToMapleNULLPointer returns the Maple zero integer object. This is the C WRAPPER representation of a NULL pointer passed to a procedure. This is not to be confused with the value returned by ToMapleNULL.

• 

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.

• 

Other functions exist for creating Maple Array objects, list objects, and table objects. For more information, see RTableCreate, MapleListAlloc, and MapleTableAlloc.

Examples

Sub TestConvertToMaple(ByVal kv As Long)

    Dim list, args As Long

    list = MapleListAlloc(kv, 15)

    MapleListAssign kv, list, 1, ToMapleBoolean(kv, 1)

    MapleListAssign kv, list, 2, ToMapleBoolean(kv, 0)

    MapleListAssign kv, list, 3, ToMapleBoolean(kv, -1)

    MapleListAssign kv, list, 4, ToMapleBoolean(kv, 2)

    MapleListAssign kv, list, 5, ToMapleChar(kv, "M")

    MapleListAssign kv, list, 6, ToMapleComplex(kv, 1.1, 2.2)

    MapleListAssign kv, list, 7, ToMapleComplexFloat(kv, _

       ToMapleFloat(kv, 3.3), ToMapleFloat(kv, 4.4))

    MapleListAssign kv, list, 8, ToMapleInteger(kv, 98765)

    MapleListAssign kv, list, 9, ToMapleFloat(kv, 3.1415)

    args = NewMapleExpressionSequence(kv, 2)

    MapleExpseqAssign kv, args, 1, ToMapleName(kv, "x", True)

    MapleExpseqAssign kv, args, 2, ToMapleName(kv, "x", True)

    MapleListAssign kv, list, 10, ToMapleFunction(kv, _

       ToMapleName(kv, "int", True), args)

    MapleListAssign kv, list, 11, ToMapleNULLPointer(kv)

    MapleListAssign kv, list, 12, ToMapleRelation(kv, ">", _

       ToMapleName(kv, "X", True), ToMapleInteger(kv, 1))

    MapleListAssign kv, list, 13, ToMapleString(kv, "A string")

    MapleListAssign kv, list, 14, ToMapleUneval(kv, ToMapleName(kv, "Z", True))

    'note NULL will get removed when the list is flattened

    MapleListAssign kv, list, 15, ToMapleNULL(kv)

    MapleALGEB_Printf1 kv, "%a", list

End Sub

See Also

OpenMaple

OpenMaple/VB/API

 


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