fdds_put - put one field into a DDS type buffer


SYNOPSIS

#include <fdds.h> (fixed-format sources)
#include <f90dds.h> (free-format sources)

integer function fdds_putxx(bin_tag, field_tag, out_buf, offset, in_array[, count])

integer bin_tag
integer field_tag
HostBufType out_buf(*)
integer offset
HostArrayType in_array(*)
integer count

DESCRIPTION

These functions put data from in_array into a field of out_buf. The data are converted from the host-dependent type defined by the trailing characters in the function name (see below) to the type of the field known to bin_tag.

ARGUMENTS

"bin_tag" is a binary tag previously obtained from fddx_out.

"field_tag" identifies a specific field within a structure of bin_tag. It is obtained with function fdds_member. If field_tag is zero, the default target (a trace) is used.

"out_buf" is the output buffer into which the converted information is placed.

"offset" is a byte offset into out_buf from where the field_tag is referenced (typically 0).

"in_array" is the input array from which the data is transferred. The host-dependent type of in_array is implied by the function name suffix ("xx").

"count" is the number of elements to convert.
count must NOT be used for fdds_putcb, but is require by each of the other routines.

OUTPUT

The put functions copy (or convert) data from an input array into the output field. Vectors are truncated or padded, depending upon the source and destination count.

The function return value is count, or zero if an error occurred.

A simple byte copy is performed, if the binary formats are the same. The put functions convert between most numeric representations. The allowed combinations are implementation dependent. The functions also convert between ascii and ebcdic character formats. Byte fields can be copied, without conversion, from any array. Conversion is not allowed between numeric and character types. If conversion is not possible, an error is reported and the output field is not changed.

Function     Host Type    in_array Pad
fdds_put     byte         zero
fdds_putcb   character    blank
fdds_puti    integer      zero
fdds_puti2   integer*2    zero
fdds_putr    real         zero
fdds_putff   real         zero (USP fake float)
fdds_putd    real*8       zero
fdds_putc    complex      zero
    
C assignment rules are used to convert float arrays to integer and unsigned fields. Character arrays passed by fdds_putcb are assumed to be padded with blanks. Trailing pad characters are ignored during put processing; they effectively shorten input character arrays. A null character, within a fdds_putcb character array, effectively reduces its count. fdds_putff stuffs floats into consecutive 1-, 2- or 4-byte integer values (fake floats).

EXAMPLES

c put (convert) integer in_array into type field
      integer bin_tag, field_tag
      integer out_buf(*)
      integer in_array(*)
      ...
      j = fdds_puti(bin_tag, field_tag, out_buf, 0, in_array, 100)

c Stuff REAL srcx into output header SrcX
      character Title*(80)
      integer in_bin_tag, out_bin_tag, srcx_tag
      integer ier, itrc, ntrc
      real    srcx
      real    out_buf(*)
      ...
      out_bin_tag = fddx_out('out','stdout:',Title,in_bin_tag)
      ier = fddx_dict(in_bin_tag,'scan')
      ntrc = fdds_axis_prod(1)
      srcx_tag = fdds_member(out_bin_tag,0,'SrcX')
      do itrc = 1,ntrc
         ...
         ier = fdds_putr(out_bin_tag,srcx_tag,out_buf,0,srcx,1)
         ier = fddx_write(out_bin_tag,out_buf,1)
      enddo
    

SEE ALSO

fdds_member
fdds_get
fddx_out
fddx_write
fddx_dict
fdds_axis_prod
    

AUTHOR

R. L. Selzler, EPTG (May, 1994) Jerry Ehlers, BP America (May 2003)