dirfile_alter_bit (3) Linux Manual Page
NAME
dirfile_alter_bit, dirfile_alter_clincom, dirfile_alter_const, dirfile_alter_cpolynom, dirfile_alter_lincom, dirfile_alter_linterp, dirfile_alter_multiply, dirfile_alter_phase, dirfile_alter_polynom, dirfile_alter_raw, dirfile_alter_sbit — modify a field in a dirfile
SYNOPSIS
#include <getdata.h>
-
int dirfile_alter_bit(DIRFILE *dirfile, const char *field_code,const char *in_field, gd_bit_tbitnum, gd_bit_tnumbits);int dirfile_alter_clincom(DIRFILE *dirfile, const char *field_code,intn_fields, const char **in_fields, const double complex *cm,const double complex *cb);int dirfile_alter_const(DIRFILE *dirfile, const char *field_code,gd_type_tconst_type);int dirfile_alter_cpolynom(DIRFILE *dirfile, const char *field_code,intpoly_ord, const char *in_field, const double complex *ca);int dirfile_alter_lincom(DIRFILE *dirfile, const char *field_code,intn_fields, const char **in_fields, const double *m,const double *b);int dirfile_alter_linterp(DIRFILE *dirfile, const char *field_code,const char *in_field, const char *table, intrename_table);int dirfile_alter_multiply(DIRFILE *dirfile, const char *field_code,const char *in_field1, const char *in_field2);int dirfile_alter_phase(DIRFILE *dirfile, const char *field_code,const char *in_field, gd_shift_tshift);int dirfile_alter_polynom(DIRFILE *dirfile, const char *field_code,intpoly_ord, const char *in_field, const double *ca);int dirfile_alter_raw(DIRFILE *dirfile, const char *field_code,gd_type_tdata_type, gd_spf_tspf, intrecode);int dirfile_alter_sbit(DIRFILE *dirfile, const char *field_code,const char *in_field, gd_bit_tbitnum, gd_bit_tnumbits);
DESCRIPTION
dirfile_alter_entry(3) function to modify a field of the indicated type in the dirfile specified by dirfile. In all of these calls, field_code 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 representtion suffix. The meaning and valid types of other arguments may be obtained from the get_entry(3) and dirfile-format(5) manual pages.
The dirfile_alter_clincom() and dirfile_alter_cpolynom() functions are identical to dirfile_alter_lincom() and dirfile_alter_polynom(), 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 dirfile_alter_lincom() and dirfile_alter_clincom() functions take pointers to three arrays of length n_fields containing the input field names (in_fields), the gain factors (m or cm), and the offset terms (b or cb). Similarly, dirfile_alter_polynom() and dirfile_alter_cpolynom() take an array of length poly_ord + 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. Specifically, if any of the string parameters or m,~b, or a (cm,~cb, or ca) are NULL, the old values will be retained. Similarly, if spf, n_fields, or numbits is zero, or if bitnum is -1, or if data_type, or const_type are equal to GD_NULL, these parameters will not be modified.
All field parameters introduced with this interface must contain numerical parameters. Field parameters which are CONST cannot be introduced with these functions. To do that, use dirfile_alter_entry(3), dirfile_alter_spec(3) or dirfile_malter_spec(3), as appropriate.
If rename_table is non-zero, the look-up table referenced by the LINTERP field will be renamed to the path given by table. If recode is non-zero, the binary file associated with the RAW field will be re-encoded to reflect the new field parameters.
See NOTES below for information on using dirfile_alter_clincom() and dirfile_alter_cpolynom() in the C89 GetData API.
RETURN VALUE
On success, any of these functions returns zero. On error, -1 is returned and the dirfile error is set to a non-zero error value. Possible error values are:
The gd_bit_t type is a signed 16-bit integer type. The gd_shift_t type is a signed 64-bit integer type. The gd_spf_t type is an unsigned 16-bit integer type.
GD_E_ACCMODE- The specified dirfile was opened read-only.
GD_E_ALLOC- The library was unable to allocate memory.
GD_E_BAD_CODE- The field specified by field_code was not found.
GD_E_BAD_DIRFILE- The supplied dirfile was invalid.
GD_E_BAD_ENTRY- One or more of the field parameters specified was invalid.
GD_E_BAD_FIELD_TYPE- The field specified by field_code was of the wrong type for the function called.
GD_E_BAD_TYPE- The data_type or const_type argument was invalid.
GD_E_PROTECTED- The metadata of the fragment was protected from change. Or, a request to translate the binary file associated with a
RAWfield was attempted, but the data of the fragment was protected. GD_E_RAW_IO- An I/O error occurred while translating the binary file associated with a modified
RAWfield, or an I/O error occurred while attempting to rename aLINTERPtable file. GD_E_UNKNOWN_ENCODING- The encoding scheme of the specified format file fragment is not known to the library. As a result, the library was unable to translate the binary file be associated with a modified
RAWfield. GD_E_UNSUPPORTED- The encoding scheme of the specified format file fragment does not support translating the empty binary file associated with a modified
RAWfield. The dirfile error may be retrieved by callingget_error(3). A descriptive error string for the last error encountered can be obtained from a call toget_error_string(3).
NOTES
The C89 GetData API provides different prototypes for dirfile_alter_clincom() and dirfile_alter_cpolynom():
#define GETDATA_C89_API
#include <getdata.h>
int dirfile_alter_clincom(DIRFILE *dirfile, const char *field_code,
int n_fields, const char **in_fields, const double *cm,
const double *cb);
int dirfile_alter_cpolynom(DIRFILE *dirfile, const char *field_code,
int poly_ord, const char *in_fields, const double *ca);
SEE ALSO
dirfile_alter_entry(3), dirfile_alter_spec(3), dirfile_malter_spec(3), dirfile_metaflush(3), dirfile_open(3), get_error(3), get_error_string(3), dirfile-format(5)
