This routine does a three part conversion-
The source/destination for a conversion can be the address of a value of the appropiate type or it may be an Sds item.
When specifing the address of the value, you must specify the type. (SDS_CHAR, SDS_INT, SDS_UINT etc. (Not SDS_STRUCT)). Additional type codes - ARG_STRING/ARG_STRING2 - can be speicifed indicating the source or destination is a null terminated string while should/will contain a representation of the number. (If both source and destination are strings, then a simple string copy is done.) A ARG_STRING2 type differs in only when the source is a FLOAT or DOUBLE value. When ARG_STRING is used, the maximum number of decimal digits is retrieved whilst when ARG_STRING2 is used, 6 is used for FLOAT and 10 for double. (Note that a type of SDS_CHAR represents a single character, not a string of characters)
To specify an Sds item as the source/destination, supply the address of the Sds id of the item in the appropiate address argument. Suppy ARG_SDS as the corresponding type code. The Sds id must describe a Scaler item, expect if it is a one dimensional character array. In this case, it is considered a character string. Source strings must be null terminated.
Invalid conversions result in status being set to ARG__CNVERR and an error being reported using ErsRep.
The ranges of integer types are determined by the range acceptable to SDS. The ranges of real types are determined by the archecture on which the machine is running.
Types of SDS_INT and SDS_UINT indicate the relevant item is a long int (which may be 32 or 64 bits, depending upon the machine and compiler being used). Note that if the machine does not support 64 bits integers then 64bit values with the high 32bits set to non-zero values cannot be handled - an error is returned.
> | SrcAddr | void * | Address of the source data or of an Sds item id. |
---|---|---|---|
> | SrcType | SdsCodeType | Type of the source data. |
> | DstType | SdsCodeType | Type of the destination data. |
> | DstAddr | void * | Address of the destination or of an Sds item id. |
> | DstLen | int | Length of the destination in bytes. If DstType is ARG_SDS, then this is ignored. |
! | status | StatusType * | Modified status.
|
ErsRep | Ers | Report an error. |
---|---|---|
ErsSPrintf | Ers | Format a string into a buffer. |
strtol | CRTL | Convert a decimal string to a long. |
strtoul | CRTL | Convert a decimal string to an unsigned long. |
strtod | CRTL | Convert a decimal string to a double. |
strncpy | CRTL | Copy one string to another |
strlen | CRTL | Get the length of a string. |
Click here for the DRAMA home page and here for the AAO home page.
For more information, contact tony.farrell@mq.edu.au