| << Prev | - Up - | Next >> |
To check whether a given OZ_Term is a certain Oz value several functions are provided:
OZ_isAtomOZ_isBoolOZ_isCellOZ_isThreadOZ_isPortOZ_isChunkOZ_isDictionaryOZ_isConsOZ_isFalseOZ_isFeatureOZ_isFloatOZ_isIntOZ_isBigIntOZ_isSmallIntOZ_isNumberOZ_isLiteralOZ_isNameOZ_isNilOZ_isObjectOZ_isPairOZ_isPair2OZ_isProcedureOZ_isRecordOZ_isTrueOZ_isTupleOZ_isUnitOZ_isValueOZ_isVariableOZ_isBitStringOZ_isByteStringOZ_isFSetValue All these functions have the same signature. For example
OZ_isAtomis declared asint OZ_isAtom(OZ_Term t)
All type tests return nonzero iff their argument is of the respective type.
A few of these need some more explanation:
int OZ_isBigInt(OZ_Term t)
int OZ_isSmallInt(OZ_Term t)
The emulator has two representations for integers: small integers and big integers. Small integers are implemented very efficiently.
Returns zero iff t is a tuple with label #.
Returns nonzero iff t is a tuple with label # and arity of 2.
Returns nonzero iff t is not a variable.
Returns nonzero iff t is a variable.
OZ_isList
int OZ_isList(OZ_Term term, OZ_Term *var)
Returns nonzero iff term is a list. If term is no list, but the tail is a variable, then *var is set to the tail of the list, else it is set to null. var may be null. If term is cyclic then OZ_isList never terminates!
OZ_isString
int OZ_isString(OZ_Term term, OZ_Term *var)
Returns nonzero iff term is an Oz string. If term is no string, but the tail or an element of the list is a variable, then *var is set to this variable, else it is set to null. var may be null. If term is cyclic then OZ_isString never terminates!
OZ_isVirtualString
int OZ_isVirtualString(OZ_Term term, OZ_Term *var)
Returns nonzero iff term is a virtual string. If term is no virtual string, but contains a variable, then *var is set to this variable, else it is set to null. var may be null. If term is cyclic then OZ_isVirtualString never terminates!
OZ_termType
OZ_Term OZ_termType(OZ_Term t)
Returns an atom describing the type of t. The following types are returned:
variable, int, float, atom, name, tuple, record, fset,
foreignPointer, procedure, cell, space, object, port,
chunk, array, dictionary, lock class, resource (see also Value.type in Section 3.2 of ``The Oz Base Environment'').
| << Prev | - Up - | Next >> |