gd_alter_bit(3)

NAME
gd_alter_bit, gd_alter_carray, gd_alter_clincom, gd_alter_const, gd_alter_cpolynom, gd_alter_crecip, gd_alter_divide, gd_alter_indir, gd_alter_lincom, gd_alter_linterp, gd_alter_multiply, gd_alter_phase, gd_alter_polynom, gd_alter_raw, gd_alter_recip, gd_alter_sarray, gd_alter_sbit, gd_alter_sindir — modify a field in a Dirfile

SYNOPSIS
#include <getdata.h>

int gd_alter_bit(DIRFILE *dirfile, const char *field_code, const char *in_field, int bitnum, int numbits);

int gd_alter_carray(DIRFILE *dirfile, const char *field_code, gd_type_t const_type, size_t array_len);

int gd_alter_clincom(DIRFILE *dirfile, const char *field_code, int n_fields, const char **in_fields, const double complex *cm, const double complex *cb);

int gd_alter_const(DIRFILE *dirfile, const char *field_code, gd_type_t const_type);

int gd_alter_cpolynom(DIRFILE *dirfile, const char *field_code, int poly_ord, const char *in_field, const double complex *ca);

int gd_alter_crecip(DIRFILE *dirfile, const char *field_code, const char *in_field, complex double cdividend);

int gd_alter_divide(DIRFILE *dirfile, const char *field_code, const char *in_field1, const char *in_field2);

int gd_alter_indir(DIRFILE *dirfile, const char *field_code, const char *index_field, const char *carray_field);

int gd_alter_lincom(DIRFILE *dirfile, const char *field_code, int n_fields, const char **in_fields, const double *m, const double *b);

int gd_alter_linterp(DIRFILE *dirfile, const char *field_code, const char *in_field, const char *table, int rename_table);

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

int gd_alter_multiply(DIRFILE *dirfile, const char *field_code, const char *in_field1, const char *in_field2);

int gd_alter_phase(DIRFILE *dirfile, const char *field_code, const char *in_field, gd_int64_t shift);

int gd_alter_polynom(DIRFILE *dirfile, const char *field_code, int poly_ord, const char *in_field, const double *ca);

int gd_alter_raw(DIRFILE *dirfile, const char *field_code, gd_type_t data_type, unsigned int spf, int recode);

int gd_alter_recip(DIRFILE *dirfile, const char *field_code, const char *in_field, double dividend);

int gd_alter_sarray(DIRFILE *dirfile, const char *field_code, size_t array_len);

int gd_alter_sbit(DIRFILE *dirfile, const char *field_code, const char *in_field, int bitnum, int numbits);

int gd_alter_sindir(DIRFILE *dirfile, const char *field_code, const char *index_field, const char *sarray_field);

int gd_alter_window(DIRFILE *dirfile, const char *field_code, const char *in_field, const char *check_field, gd_windop_t windop, gd_triplet_t threshold);

DESCRIPTION
These functions provide alternatives to using the function to modify a field of the indicated type in the dirfile specified by

In all of these calls, indicates the the field to be modified, which may be a regular field, or a metafield specified by its full (slashed) field code, but should not contain a representation suffix. The meaning and valid types of other arguments may be obtained from the and dirfile-format(5) manual pages. 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. The and functions are identical to and except they take complex scalar parameters, instead of purely real values. This only matters for the input of new parameters; if the scalar parameters are not changed (by passing NULL instead of a list of scalars), the functions can be used interchangeably, regardless of whether the altered field has complex scalar parameters or not. If the corresponding parameters are to be changed, 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). Some field parameters have special values which indicate no change should be made to the parameter. These special values are: any of the string parameters, also m, b, a, cm, cb, or ca; spf, n_fields, numbits, cdividend, dividend, or array_len; bitnum or period; data_type or const_type;

All field parameters introduced with this interface must contain literal parameters. Field parameters which are scalar fields cannot be introduced with these functions. To do that, use or as appropriate. If is non-zero, the look-up table referenced by the LINTERP field will be renamed to the path given by If is non-zero, the binary file associated with the RAW field will be re-encoded to reflect the new field parameters. In this case, the field's I/O pointer will be reset to the beginning-of-frame. If is used to increase the length of a CARRAY field, the added elements will be uninitialised. Use or equivalent to initialise them. Similarly, increasing the length of a SARRAY with will set the added elements to the empty string (""). Use or equivalent to modify them. See NOTES below for information on using gd_alter_clincom(), gd_alter_crecip(), and in the C89 GetData API.

RETURN VALUE
On success, these functions return 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 field specified by was not found, or a supplied field code did not contain the appropriate prefix or suffix. The supplied dirfile was invalid. One or more of the field parameters specified was invalid. The field specified by was of the wrong type for the function called. The argument was invalid. An I/O error occurred while translating the binary file associated with a modified RAW field, or an I/O error occurred while attempting to rename a LINTERP table file. The metadata of the fragment was protected from change. Or, a request to translate the binary file associated with a RAW field was attempted, but the data of the fragment was protected. The encoding scheme of the indicated format specification fragment is not known to the library. As a result, the library was unable to translate the binary file be associated with a modified RAW field. The encoding scheme of the indicated format specification fragment does not support translating the binary file associated with a modified RAW field.

The error code is also stored in the DIRFILE object and may be retrieved after these functions return by calling A descriptive error string for the error may be obtained by calling

NOTES
The C89 GetData API provides different prototypes for gd_alter_clincom(), gd_alter_cpolynom(), and

#define GD_C89_API
#include <getdata.h>

int gd_alter_clincom(DIRFILE *dirfile, const char *field_code, int n_fields, const char **in_fields, const double *cm, const double *cb);

int gd_alter_cpolynom(DIRFILE *dirfile, const char *field_code, int poly_ord, const char *in_fields, const double *ca);

int gd_alter_crecip(DIRFILE *dirfile, const char *field_code, const char *in_field, const double cdividend[2]);

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. Passing NULL as is equivalent to specifying a dividend of zero: it indicates no change to the dividend parameter.

HISTORY
The functions and appeared in GetData-0.5.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. The functions and appeared in GetData-0.8.0. 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
dirfile-format(5)