gd_madd_bit(3)

NAME
gd_madd_bit, gd_madd_carray, gd_madd_clincom, gd_madd_const, gd_madd_cpolynom, gd_madd_crecip, gd_madd_divide, gd_madd_indir, gd_madd_lincom, gd_madd_linterp, gd_madd_multiply, gd_madd_phase, gd_madd_polynom, gd_madd_recip, gd_madd_sarray, gd_madd_sbit, gd_madd_sindir, gd_madd_string — add a field to a Dirfile

SYNOPSIS
#include <getdata.h>

int gd_madd_bit(DIRFILE *dirfile, const char *parent, const char *field_name, const char *in_field, int bitnum, int numbits);

int gd_madd_carray(DIRFILE *dirfile, const char *parent, const char *field_name, gd_type_t const_type, size_t array_len, gd_type_t data_type, void *value);

int gd_madd_clincom(DIRFILE *dirfile, const char *parent, const char *field_name, int n_fields, const char **in_fields, const double complex *cm, const double complex *cb);

int gd_madd_const(DIRFILE *dirfile, const char *parent, const char *field_name, gd_type_t const_type, gd_type_t data_type, void *value);

int gd_madd_cpolynom(DIRFILE *dirfile, const char *parent, const char *field_name, int poly_ord, const char *in_field, const double complex *ca);

int gd_madd_crecip(DIRFILE *dirfile, const char *parent, const char *field_name, const char *in_field, double complex cdividend, int fragment_index);

int gd_madd_divide(DIRFILE *dirfile, const char *parent, const char *field_name, const char *in_field1, const char *in_field2);

int gd_madd_indir(DIRFILE *dirfile, const char *parent, const char *field_name, const char *index_field, const char *carray_field);

int gd_madd_lincom(DIRFILE *dirfile, const char *parent, const char *field_name, int n_fields, const char **in_fields, const double *m, const double *b);

int gd_madd_linterp(DIRFILE *dirfile, const char *parent, const char *field_name, const char *in_field, const char *table);

int gd_madd_mplex(DIRFILE *dirfile, const char *parent, const char *field_name, const char *in_field, const char *count_field, int count_val, int period);

int gd_madd_multiply(DIRFILE *dirfile, const char *parent, const char *field_name, const char *in_field1, const char *in_field2);

int gd_madd_polynom(DIRFILE *dirfile, const char *parent, const char *field_name, int poly_ord, const char *in_field, const double *a);

int gd_madd_phase(DIRFILE *dirfile, const char *parent, const char *field_name, const char *in_field, gd_int64_t shift);

int gd_madd_recip(DIRFILE *dirfile, const char *parent, const char *field_name, const char *in_field, double dividend, int fragment_index);

int gd_madd_sarray(DIRFILE *dirfile, const char *parent, const char *field_name, size_t array_len ,constchar**"value);

int gd_madd_sbit(DIRFILE *dirfile, const char *parent, const char *field_name, const char *in_field, int bitnum, int numbits);

int gd_madd_sindir(DIRFILE *dirfile, const char *parent, const char *field_name, const char *index_field, const char *sarray_field);

int gd_madd_string(DIRFILE *dirfile, const char *parent, const char *field_name, const char *value);

int gd_madd_window(DIRFILE *dirfile, const char *parent, const char *field_name, const char *in_field, const char *check_field, gd_windop_t windop, gd_triplet_t threshold);

DESCRIPTION
These functions add a new metafield of the indicated type under the parent field given by to the dirfile specified by

In all of these calls, indicates the name of the field to be added. It should not be the full <parent-field>/<meta-field> field code. The meaning and valid types of other arguments may be obtained from the and dirfile-format(5) manual pages. The and functions are identical to and except they take complex scalar parameters, instead of purely real values. The and functions take pointers to three arrays of length containing the input field names (in_fields), the gain factors (m or cm), and the offset terms (b or cb). Similarly, and take an array of length + 1 containing the polynomial co-efficients (a or ca). The and functions both add the field and set the value of the field to For and the argument specifies the storage type for the const, while specifies the data type of the value pointed to by For should contain string pointers. The gd_int64_t type is a signed 64-bit integer type. The gd_triplet_t type is defined as:

typedef union {
  gd_int64_t i;
  gd_uint64_t u;
  double r;
} gd_triplet_t;

Which element of this gd_triplet_t union to set depends on the operator selected for the WINDOW field. See for details.

All fields added with this interface must contain numerical parameters. Fields with scalar fields as parameters cannot be added with these functions. Those fields must be added with or See &c. for an alternate way of adding metafields with explicit parameters. See NOTES below for information on using gd_madd_clincom(), gd_madd_cpolynom(), and in the C89 GetData API.

RETURN VALUE
On success, any of these functions returns zero. On error, a negative-valued error code is returned. Possible error codes are: The specified dirfile was opened read-only. The library was unable to allocate memory. The argument contained invalid characters. Alternately, the field code was not found, or was already a metafield. The supplied dirfile was invalid. One or more of the field parameters specified was invalid. The or argument provided to or was invalid. The provided duplicated that of an already existing field. The metadata of the fragment was protected from change.

The dirfile error may also be retrieved by calling A descriptive error string for the last error encountered can be obtained from a call to

NOTES
The C89 GetData API provides different prototypes for and

#define GD_C89_API
#include <getdata.h>

int gd_madd_clincom(DIRFILE *dirfile, const char *parent, const char *field_name, int n_fields, const char **in_fields, const double *cm, const double *cb);

int gd_madd_cpolynom(DIRFILE *dirfile, const char *parent, const char *field_name, int poly_ord, const char *in_field, const double *ca);

int gd_madd_crecip(DIRFILE *dirfile, const char *parent, const char *field_name, const char *in_field, double cdividend[2], int fragment_index);

In this case, the array pointers passed as or should have twice as many (purely real) elements, consisting of alternating real and imaginary parts for the complex data. That is, for example, should be the real part of the first co-efficient, the imaginary part of the first co-efficient, the real part of the second co-efficient, the imaginary part of the second co-efficient, and so on. Similarly, the parameter becomes a double precision array of length two.

For and these are simply different (but equivalent) declarations of the C99 function entry point. For however, a different entry point is needed (since the parameter is passed by reference instead of by value). In the interests of portability, the C89 version of is always available, and may be accessed as with the C89 prototype, in both the C99 and C89 APIs.

HISTORY
The functions and appeared in GetData-0.4.0. The functions and appeared in GetData-0.6.0. In GetData-0.7.0, the functions were renamed to and The functions and also appeared in this version. In GetData-0.8.0, these functions first allowed adding metafields by providing the full (slashed) field name. The functions and also appeared in this version. In GetData-0.10.0, the error return from these functions changed from -1 to a negative-valued error code. The functions and also appeared in this version.

SEE ALSO
the corresponding gd_add_<entry-type> functions (e.g. dirfile-format(5)