Fjoin, Fjoin32
-join source into destination buffer
#include stdio.h>
#include "fml.h"
int
Fjoin(FBFR *dest, FBFR *src)
#include "fml32.h"
int
Fjoin32(FBFR32 *dest, FBFR32 *src)
Fjoin()
is used to join two fielded buffers based on matching fieldid/occurrence. dest and src are pointers to the destination and source fielded buffers respectively. For fields that match on fieldid/occurrence, the field value is updated in the destination buffer with the value in the source buffer. Fields in the destination buffer that have no corresponding fieldid/occurrence in the source buffer are deleted.
This function may fail due to lack of space if the new values are larger than the old; in this case, the destination buffer will have been modified. However, if this happens, the destination buffer may be re-allocated using Frealloc
(3) and the Fjoin
() function repeated. Even if the destination buffer has been partially updated, repeating the function will give the correct results.
Fjoin32
is used with 32-bit FML.
This function returns -1 on error and sets Ferror
to indicate the error condition.
Under the following conditions, Fjoin
() fails and sets Ferror
to:
[FALIGNERR]
[FNOTFLD]
Finit
().
[FNOSPACE]
In the following example:
FBFR *src, *dest; ... if(Fjoin(dest,src) 0) F_error("pgm_name");
if dest
has fields A, B, and two occurrences of C, and src
has fields A, C, and D, the resultant dest
will have source field value A and source field value C.
Fintro
(3), Fconcat
(3), Fojoin
(3), Fproj
(3), Fprojcpy
(3), Frealloc
(3)