1dirfile_alter_bit(3) GETDATA dirfile_alter_bit(3)
2
3
4
6 dirfile_alter_bit, dirfile_alter_clincom, dirfile_alter_const,
7 dirfile_alter_cpolynom, dirfile_alter_lincom, dirfile_alter_linterp,
8 dirfile_alter_multiply, dirfile_alter_phase, dirfile_alter_polynom,
9 dirfile_alter_raw, dirfile_alter_sbit — modify a field in a dirfile
10
12 #include <getdata.h>
13
14 int dirfile_alter_bit(DIRFILE *dirfile, const char *field_code, const
15 char *in_field, gd_bit_t bitnum, gd_bit_t numbits);
16
17 int dirfile_alter_clincom(DIRFILE *dirfile, const char *field_code, int
18 n_fields, const char **in_fields, const double complex *cm,
19 const double complex *cb);
20
21 int dirfile_alter_const(DIRFILE *dirfile, const char *field_code,
22 gd_type_t const_type);
23
24 int dirfile_alter_cpolynom(DIRFILE *dirfile, const char *field_code,
25 int poly_ord, const char *in_field, const double complex *ca);
26
27 int dirfile_alter_lincom(DIRFILE *dirfile, const char *field_code, int
28 n_fields, const char **in_fields, const double *m, const double
29 *b);
30
31 int dirfile_alter_linterp(DIRFILE *dirfile, const char *field_code,
32 const char *in_field, const char *table, int rename_table);
33
34 int dirfile_alter_multiply(DIRFILE *dirfile, const char *field_code,
35 const char *in_field1, const char *in_field2);
36
37 int dirfile_alter_phase(DIRFILE *dirfile, const char *field_code, const
38 char *in_field, gd_shift_t shift);
39
40 int dirfile_alter_polynom(DIRFILE *dirfile, const char *field_code, int
41 poly_ord, const char *in_field, const double *ca);
42
43 int dirfile_alter_raw(DIRFILE *dirfile, const char *field_code,
44 gd_type_t data_type, gd_spf_t spf, int recode);
45
46 int dirfile_alter_sbit(DIRFILE *dirfile, const char *field_code, const
47 char *in_field, gd_bit_t bitnum, gd_bit_t numbits);
48
50 These functions provide alternatives to using the dirfile_alter_en‐
51 try(3) function to modify a field of the indicated type in the dirfile
52 specified by dirfile.
53
54 In all of these calls, field_code indicates the the field to be modi‐
55 fied, which may be a regular field, or a metafield specified by its
56 full (slashed) field code, but should not contain a representtion suf‐
57 fix. The meaning and valid types of other arguments may be obtained
58 from the get_entry(3) and dirfile-format(5) manual pages.
59
60 The dirfile_alter_clincom() and dirfile_alter_cpolynom() functions are
61 identical to dirfile_alter_lincom() and dirfile_alter_polynom(), except
62 they take complex scalar parameters, instead of purely real values.
63 This only matters for the input of new parameters; if the scalar param‐
64 eters are not changed (by passing NULL instead of a list of scalars),
65 the functions can be used interchangeably, regardless of whether the
66 altered field has complex scalar parameters or not.
67
68 If the corresponding parameters are to be changed, the dirfile_al‐
69 ter_lincom() and dirfile_alter_clincom() functions take pointers to
70 three arrays of length n_fields containing the input field names
71 (in_fields), the gain factors (m or cm), and the offset terms (b or
72 cb). Similarly, dirfile_alter_polynom() and dirfile_alter_cpolynom()
73 take an array of length poly_ord + 1 containing the polynomial co-effi‐
74 cients (a or ca).
75
76 Some field parameters have special values which indicate no change
77 should be made to the parameter. Specifically, if any of the string
78 parameters or m, b, or a (cm, cb, or ca) are NULL, the old values will
79 be retained. Similarly, if spf, n_fields, or numbits is zero, or if
80 bitnum is -1, or if data_type, or const_type are equal to GD_NULL,
81 these parameters will not be modified.
82
83 All field parameters introduced with this interface must contain numer‐
84 ical parameters. Field parameters which are CONST cannot be introduced
85 with these functions. To do that, use dirfile_alter_entry(3),
86 dirfile_alter_spec(3) or dirfile_malter_spec(3), as appropriate.
87
88 If rename_table is non-zero, the look-up table referenced by the LIN‐
89 TERP field will be renamed to the path given by table. If recode is
90 non-zero, the binary file associated with the RAW field will be re-en‐
91 coded to reflect the new field parameters.
92
93 See NOTES below for information on using dirfile_alter_clincom() and
94 dirfile_alter_cpolynom() in the C89 GetData API.
95
96
98 On success, any of these functions returns zero. On error, -1 is re‐
99 turned and the dirfile error is set to a non-zero error value. Possi‐
100 ble error values are:
101
102 The gd_bit_t type is a signed 16-bit integer type. The gd_shift_t type
103 is a signed 64-bit integer type. The gd_spf_t type is an unsigned
104 16-bit integer type.
105
106 GD_E_ACCMODE
107 The specified dirfile was opened read-only.
108
109 GD_E_ALLOC
110 The library was unable to allocate memory.
111
112 GD_E_BAD_CODE
113 The field specified by field_code was not found.
114
115 GD_E_BAD_DIRFILE
116 The supplied dirfile was invalid.
117
118 GD_E_BAD_ENTRY
119 One or more of the field parameters specified was invalid.
120
121 GD_E_BAD_FIELD_TYPE
122 The field specified by field_code was of the wrong type for the
123 function called.
124
125 GD_E_BAD_TYPE
126 The data_type or const_type argument was invalid.
127
128 GD_E_PROTECTED
129 The metadata of the fragment was protected from change. Or, a
130 request to translate the binary file associated with a RAW
131 field was attempted, but the data of the fragment was protect‐
132 ed.
133
134 GD_E_RAW_IO
135 An I/O error occurred while translating the binary file associ‐
136 ated with a modified RAW field, or an I/O error occurred while
137 attempting to rename a LINTERP table file.
138
139 GD_E_UNKNOWN_ENCODING
140 The encoding scheme of the specified format file fragment is
141 not known to the library. As a result, the library was unable
142 to translate the binary file be associated with a modified RAW
143 field.
144
145 GD_E_UNSUPPORTED
146 The encoding scheme of the specified format file fragment does
147 not support translating the empty binary file associated with a
148 modified RAW field.
149
150 The dirfile error may be retrieved by calling get_error(3). A descrip‐
151 tive error string for the last error encountered can be obtained from a
152 call to get_error_string(3).
153
154
156 The C89 GetData API provides different prototypes for dirfile_al‐
157 ter_clincom() and dirfile_alter_cpolynom():
158
159 #define GETDATA_C89_API
160 #include <getdata.h>
161
162 int dirfile_alter_clincom(DIRFILE *dirfile, const char *field_code,
163 int n_fields, const char **in_fields, const double *cm,
164 const double *cb);
165
166 int dirfile_alter_cpolynom(DIRFILE *dirfile, const char *field_code,
167 int poly_ord, const char *in_fields, const double *ca);
168
169 In this case, the array pointers passed as cm, cb or ca should have
170 twice as many (purely real) elements, consisting of alternating real
171 and imaginary parts for the complex data. For example, ca[0] should be
172 the real part of the first co-efficient, ca[1] the imaginary part of
173 the first co-efficient, ca[2] the real part of the second co-efficient,
174 ca[3] the imaginary part of the second co-efficient, and so on.
175
176
178 dirfile_alter_entry(3), dirfile_alter_spec(3), dirfile_malter_spec(3),
179 dirfile_metaflush(3), dirfile_open(3), get_error(3), get_er‐
180 ror_string(3), dirfile-format(5)
181
182
183
184Version 0.6.0 2 November 2009 dirfile_alter_bit(3)