F32to16, F16to32 - convert 16-bit FML to/from 32-bit FML buffer
#include <stdio.h> #include "fml.h" #include "fml32.h" int F32to16(FBFR *dest, FBFR32 *src) int F16to32(FBFR32 *dest, FBFR *src)
F32to16() converts a 32-bit FML buffer to a 16-bit FML buffer. It does this by converting the buffer on a field-by-field basis and then creating the index for the fielded buffer. A field is converted by generating a FLDID from a FLDID32, and copying the field value (and field length for string and carray fields). dest and src are pointers to the destination and source fielded buffers respectively. The source buffer is not changed.
These functions can fail for lack of space; they can be re-issued after allocating enough additional space to complete the operation.
F16to32 converts a 16-bit FML buffer to a 32-bit FML buffer. It lives in the fml32 library or shared object and sets Ferror32 on error.
F32to16 lives in the fml library or shared object and sets Ferror on error. Note that both fml.h and fml32.h must be included to use these functions; fml1632.h may not be included in the same file.
This function returns -1 on error and sets Ferror to indicate the error condition.
Under the following conditions, F32to16() fails and sets Ferror to: