IsMapleAssignedName - Maple Help

MapleNumArgs

return the number of arguments in an EXPSEQ object

IsMapleAssignedName

test if an object is an assigned name

IsMapleComplexNumeric

test if an object is complex numeric

IsMapleEquation

test if an object is an equation

IsMapleNumeric

test if an object is numeric

IsMapleFraction

test if an object is a fraction

IsMapleInteger

test if an object is an integer

IsMapleInteger8

test if an object is an 8-bit integer

IsMapleInteger16

test if an object is a 16-bit integer

IsMapleInteger32

test if an object is a 32-bit integer

IsMapleInteger64

test if an object is a 64-bit integer

IsMapleList

test if an object is a list

IsMapleName

test if an object is a name

IsMapleLogical

test if an object is a logical operation

IsMapleNULL

test if an object is NULL

IsMaplePointer

test if an object is a generated pointer

IsMaplePointerNULL

test if an object is the string "NULL"

IsMapleRelation

test if an object is a relation

IsMapleProcedure

test if an object is a Maple procedure

IsMapleRTable

test if an object is an rtable

IsMapleSet

test if an object is a set

IsMapleStop

test for an "end of session" object

IsMapleString

test if an object is a string

IsMapleTable

test if an object is a table

IsMapleUnassignedName

test if an object is an unassigned name

IsMapleUnnamedZero

test if an object is 0

 Calling Sequence MapleNumArgs(kv, s) IsMapleAssignedName(kv, s) IsMapleComplexNumeric(kv, s) IsMapleEquation(kv, s) IsMapleNumeric(kv, s) IsMapleFraction(kv, s) IsMapleInteger(kv, s) IsMapleInteger8(kv, s) IsMapleInteger16(kv, s) IsMapleInteger32(kv, s) IsMapleInteger64(kv, s) IsMapleList(kv, s) IsMapleLogical(kv, s) IsMapleName(kv, s) IsMapleNULL(kv, s) IsMaplePointer(kv, s) IsMaplePointerNULL(kv, s) IsMapleProcedure(kv, s) IsMapleRelation(kv, s) IsMapleRTable(kv, s) IsMapleSet(kv, s) IsMapleStop(kv, s) IsMapleString(kv, s) IsMapleTable(kv, s) IsMapleUnassignedName(kv, s) IsMapleUnnamedZero(kv, s)

Parameters

 kv - kernel handle of type MKernelVector s - Maple object of type ALGEB

Description

 • These functions can be used in external code with OpenMaple or define_external.
 • The IsMaple* functions test the specified type of the given Maple object. These functions all return TRUE (1) when the Maple DAG, s, fits the description given by the function name. If s is not of the correct type, FALSE (0) is returned.
 • MapleNumArgs returns the length of any Maple object.  It is most useful for computing the length of the argument expression sequence passed out to the call_external dll entry point.  An expression sequence object can be treated as a simple array with indexing starting at 1 (not 0).  For example, if args is an expression sequence and MapleNumArgs(kv,args) returns 3, then args[1], args[2], and args[3] are all Maple objects.  In the case of an external entry point, these are the arguments given during the function call.
 • There are several functions for determining what kind of NULL an object is. These are primarily used by automatic wrapper generation, and are not commonly be seen in hand-written code.  IsMapleUnnamedZero looks for a Maple zero object, but not a name assigned the value zero. IsMapleNULL tests for the empty expression sequence denoted by NULL in the Maple language.  IsPointerNULL tests for the C version of NULL (hardware zero), or the Maple string, "NULL".
 • IsMapleStop can be used with OpenMaple to detect the evaluation of the quit command.
 • The IsMaple...Numeric routines use the Maple type numeric definition. All other tests use the object type definition as defined by the type command. The only significant exception is IsMapleName, which returns TRUE only for NAME objects, while type(t[1], name) returns true even if it is testing a TABLEREF object.
 • Integer query routines, with the bit size specified in the name, test to ensure that the given Maple object, s, is a Maple integer and also that it can fit into the specified number of bits if converted to a hardware integer.

Examples

 #include #include "maplec.h" ALGEB M_DECL MyRand( MKernelVector kv, ALGEB *args ) { M_INT argc, val; argc = MapleNumArgs(kv,(ALGEB)args); if( argc != 1 ) { MapleRaiseError(kv,"one argument expected"); return( NULL ); } if( !IsMapleInteger32(kv,args[1]) ) { MapleRaiseError2(kv, "integer expected for %-1 argument, instead got %2", ToMapleInteger(kv,1),args[1]); return( NULL ); } val = MapleToInteger32(kv,args[1]); return( ToMapleInteger(kv,(rand() % val)) ); }

Execute the external function from Maple.

 > $\mathrm{with}\left(\mathrm{ExternalCalling}\right):$
 > $\mathrm{dll}≔\mathrm{ExternalLibraryName}\left("HelpExamples"\right):$
 > $\mathrm{myrand}≔\mathrm{DefineExternal}\left(\mathrm{MyRand},\mathrm{dll}\right):$
 > $\mathrm{myrand}\left(100\right)$
 ${27}$ (1)
 > $\mathrm{myrand}\left(\mathrm{xx}\right)$

Compatibility

 • The IsMapleEquation, IsMapleFraction, IsMapleLogical and IsMapleRelation commands were introduced in Maple 2018.