word FloatFloatToAscii( /* returns # of chars in ASCII string */
FFA_stackFrame *stackFrame,
char *resultString,
FloatNum *number);
This routine converts a floating point number to an ASCII string. It uses a complicated data structure,
FFA_stackFrame
. To convert floating point numbers to ASCII without filling in this structure, use the
FloatFloatToAscii_StdFormat()
routine instead. Unless a special flag is passed, this routine will convert the top number of the floating point stack and pop it.
FloatFloatToAscii()
takes the following arguments:
FFA_stackFrame
structure. This structure contains a structure of parameters to
FloatFloatToAscii()
; also, the routine will return some information in this structure. The structure is discussed in detail below.If you pass the FFAF_FROM_ADDR flag, then instead of converting the number at the head of the floating-point stack, the routine will convert this number.
The routine explicitly returns the number of characters in the generated string, not counting the null terminator. It will return zero if an error occurred.
Structures:
typedef union {
FloatFloatToAsciiData FFA_float;
FloatFloatToDateTimeData FFA_dateTime;
} FFA_stackFrame;
typedef struct {
FloatFloatToAsciiParams FFA_params;
word FFA_startNumber;
word FFA_decimalPoint;
word FFA_endNumber;
word FFA_numChars;
word FFA_startExponent;
word FFA_bufSize;
word FFA_saveDI;
word FFA_numSign;
byte FFA_startSigCount;
byte FFA_sigCount;
byte FFA_noMoreSigInfo;
byte FFA_startDecCount;
byte FFA_decCount;
word FFA_decExponent;
word FFA_curExponent;
byte FFA_useCommas;
byte FFA_charsToComma;
char FFA_commaChar;
char FFA_decimalChar;
} FloatFloatToAsciiData;
If you're passing a
FloatFloatToAsciiData
structure, you must fill in the
FFA_params
field. When
FloatFloatToAscii()
returns, some of the other fields will have been filled in with potentially useful information:
FloatFloatToAsciiData
fields are internal. typedef struct {
FloatFloatToAsciiFormatFlags formatFlags;
byte decimalOffset;
byte totalDigits;
byte decimalLimit;
char preNegative[SIGN_STR_LEN+1];
char postNegative[SIGN_STR_LEN+1];
char prePositive[SIGN_STR_LEN+1];
char postPositive[SIGN_STR_LEN+1];
char header[PAD_STR_LEN+1];
char trailer[PAD_STR_LEN+1];
byte FFTAP_unused;
} FloatFloatToAsciiParams;
The
FloatFloatToAsciiParams
structure determines how
FloatFloatToAscii()
should format its generated string. It contains the following fields:
FloatFloatToAsciiFormatFlags
structure containing flags used to fine-tune the formatting. typedef WordFlags FloatFloatToAsciiFormatFlags;
#define FFAF_FLOAT_RESERVED 0x8000
#define FFAF_FROM_ADDR 0x4000
#define FFAF_DONT_USE_SCIENTIFIC 0x0200
#define FFAF_SCIENTIFIC 0x0100
#define FFAF_PERCENT 0x0080
#define FFAF_USE_COMMAS 0x0040
#define FFAF_NO_TRAIL_ZEROS 0x0020
#define FFAF_NO_LEAD_ZERO 0x0010
#define FFAF_HEADER_PRESENT 0x0008
#define FFAF_TRAILER_PRESENT 0x0004
#define FFAF_SIGN_CHAR_TO_FOLLOW_HEADER 0x0002
#define FFAF_SIGN_CHAR_TO_PRECEDE_TRAILER 0x0001
The
FloatFloatToAsciiFormatFlags
field contains the following flags:
FloatFloatToAscii()
will convert the number at the top of the floating point stack. By passing this flag, you ask that the routine instead convert the number pointed to by its
number
argument. typedef struct {
FloatFloatToDateTimeParams FFA_dateTimeParams;
} FloatFloatToDateTimeData;
typedef struct {
FloatFloatToDateTimeFlags FFA_dateTimeFlags;
word FFA_year;
byte FFA_month;
byte FFA_day;
byte FFA_weekday;
byte FFA_hours;
byte FFA_minutes;
byte FFA_seconds;
} FloatFloatToDateTimeParams;
The
FloatFloatToDateTime
structure is used to pass and return information for the formatting of date and time strings.
FloatFloatToDateTimeFlags
field fine-tunes the way in which to format the date string. typedef WordFlags FloatFloatToDateTimeFlags;
#define FFDT_DATE_TIME_OP 0x8000
#define FFDT_FROM_ADDR 0x4000
#define FFDT_FORMAT 0x3fff
The
FloatFloatToDateTimeFlags
field determines how the date/time should be formated.
DateTimeFormat
value.
See Also: FloatFloatToAscii_StdFormat().
word FloatFloatToAscii_StdFormat(
char *string,
FloatNum *number,
FloatFloatToAsciiFormatFlags format,
word numDigits,
word numFractionalDigits)
This routine formats a floating point number as an ASCII string. It is similar in purpose to
FloatFloatToAscii()
. However, this routine does not require the use of the daunting
FFA_stackFrame
data structure. It has the following arguments:
FloatFloatToAsciiFormatFlags
. This data type is discussed under
FloatFloatToAscii()
. The following flags are permitted: FFAF_FROM_ADDR, FFAF_SCIENTIFIC, FFAFF_PERCENT, FFAF_USE_COMMAS, FFAF_NO_TRAIL_ZEROS.The routine returns the number of characters in the resulting string, or zero if there was an error.
See Also: FloatFloatToAscii().
GEOS SDK TechDocs
|
|
FileTruncate() ...
|
FoamDBAddFieldToRecord() ...