Purpose
Get a property
of a type.
Synopsis
int gettypeprop(XPRMcontext ctx, int type, int prop, XPRMalltypes *value);
Arguments
ctx
|
Mosel's execution context
|
type
|
Code of a type
|
prop
|
Property to retrieve. Possible values:
XPRM_TPROP_NAME
|
Name of the type
|
XPRM_TPROP_FEAT
|
Encoded features
|
XPRM_TPROP_EXP
|
Expanded type
|
XPRM_TPROP_PBID
|
Problem index (negative if the type is not a problem)
|
XPRM_TPROP_ITYPS
|
Array of field types for a constant reference containing a record
|
XPRM_TPROP_NBELT
|
Type size information (see comments below)
|
XPRM_TPROP_SIGN
|
Signature of a procedure or function type
|
|
value
|
Pointer to an area where the type property is returned
|
Return value
0 if successful, -1 if
type is not valid and 1 if
prop is not supported.
Further information
1. This function returns a property of an external type (types provided by modules or user defined). For the properties
XPRM_TPROP_NAME and
XPRM_TPROP_SIGN, the information is returned in
value->string, for
XPRM_TPROP_ITIPS the information is recorded in
value->ref and for the other properties, the result is returned in
value->integer.
2. The type features are bit encoded as follows:
XPRM_MTP_CREAT
|
Creation function available for this type
|
XPRM_MTP_DELET
|
Deletion function available for this type
|
XPRM_MTP_TOSTR
|
Type can be converted to a string
|
XPRM_MTP_FRSTR
|
Type can be initialized from a string
|
XPRM_MTP_PRTBL
|
Type can be converted to a string after execution
|
XPRM_MTP_RFCNT
|
Type implements reference count
|
XPRM_MTP_COPY
|
Type implements copy: it may be used in assignments
|
XPRM_MTP_APPND
|
The copy function of this type supports appending
|
XPRM_MTP_ORSET
|
The copy function of this type can only be used to reset an object
|
XPRM_MTP_PROB
|
|
XPRM_MTP_CMP
|
Test of equality is supported by this type
|
XPRM_MTP_SHARE
|
An entity of this type can be declared as shared
|
XPRM_MTP_TFBIN
|
Type supports export/import in binary format
|
XPRM_MTP_ORD
|
|
XPRM_MTP_CONST
|
Type supports constant definition
|
XPRM_MTP_ANDX
|
|
XPRM_MTP_NAMED
|
Type supports name association
|
3. The expanded type is available for user defined types only: it corresponds to the actual type (including structure information) associated to a user defined type code. For instance, assuming the type
myset is defined as a set of integer, getting the type expansion for the code associated to
myset will give
XPRM_STR_SET|XPRM_TYP_INT indicating that a reference to an entity of type
myset has to be handled with functions for sets.
4. Trying to get the expanded type of a module type or the features of a user defined type is an error: the function returns 1. This can be used to identify module types.
5. A user type which expanded type has structure
XPRM_STR_REC
is a record type. The public fields of a record type may be enumerated with
getnextfield.
6. A user type which expanded type has structure
XPRM_STR_UNION
is a union type. The compatible types of a union type may be enumerated with
getnextuncomptype.
7. A user type which expanded type has structure
XPRM_STR_PROB
is a problem type. The components of a problem type may be enumerated with
getnextpbcomp. Note that problem types are also implemented as native types. In this case, the flag
XPRM_MTP_PROB will be set in the type features.
8. If a type refers to a native or record constant the expanded type has structure
XPRM_STR_CSREF. The function
csrtoref might be used to retrieve the actual object associated to a constant.
9. The property
XPRM_TPROP_ITYPS is an array of integers describing the types of the fields of a constant record (it is
NULL if the referenced type is not a record). The first cell of this array is the number of fields and each following entry is the type of the corresponding field (this information is required when implementing an IO driver supporting initialisations blocks).
10. The information returned for the property
XPRM_TPROP_NBELT depends on the kind of type considered: for an array this is the number of dimensions (
getarrdim), for a subroutine this corresponds to the number of parameters it requires (
getprocinfo), for a union this is the number of compatible types of this union (
getnextuncomptype), for a record this is the number of fields it contains (
getnextfield) and for a problem this gives the number of components (
getnextpbcomp).
Related topics
© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the
property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not
convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except
solely for internal evaluation purposes to determine whether to purchase a license to the software
described in this documentation, or as otherwise set forth in a written software license agreement
between you and FICO (or a FICO affiliate). Use of this documentation and the software described in
it must conform strictly to the foregoing permitted uses, and no other use is permitted.