1
2
3
4
5
6
7
8
9gd_alter_bit(3)                     GETDATA                    gd_alter_bit(3)
10
11
12

NAME

14       gd_alter_bit,    gd_alter_carray,   gd_alter_clincom,   gd_alter_const,
15       gd_alter_cpolynom,  gd_alter_crecip,  gd_alter_divide,  gd_alter_indir,
16       gd_alter_lincom,  gd_alter_linterp,  gd_alter_multiply, gd_alter_phase,
17       gd_alter_polynom,   gd_alter_raw,   gd_alter_recip,    gd_alter_sarray,
18       gd_alter_sbit, gd_alter_sindir — modify a field in a Dirfile
19
20

SYNOPSIS

22       #include <getdata.h>
23
24       int gd_alter_bit(DIRFILE *dirfile, const char *field_code, const char
25              *in_field, int bitnum, int numbits);
26
27       int gd_alter_carray(DIRFILE *dirfile, const char *field_code, gd_type_t
28              const_type, size_t array_len);
29
30       int gd_alter_clincom(DIRFILE *dirfile, const char *field_code, int
31              n_fields, const char **in_fields, const double complex *cm,
32              const double complex *cb);
33
34       int gd_alter_const(DIRFILE *dirfile, const char *field_code, gd_type_t
35              const_type);
36
37       int gd_alter_cpolynom(DIRFILE *dirfile, const char *field_code, int
38              poly_ord, const char *in_field, const double complex *ca);
39
40       int gd_alter_crecip(DIRFILE *dirfile, const char *field_code, const
41              char *in_field, complex double cdividend);
42
43       int gd_alter_divide(DIRFILE *dirfile, const char *field_code, const
44              char *in_field1, const char *in_field2);
45
46       int gd_alter_indir(DIRFILE *dirfile, const char *field_code, const char
47              *index_field, const char *carray_field);
48
49       int gd_alter_lincom(DIRFILE *dirfile, const char *field_code, int
50              n_fields, const char **in_fields, const double *m, const double
51              *b);
52
53       int gd_alter_linterp(DIRFILE *dirfile, const char *field_code, const
54              char *in_field, const char *table, int rename_table);
55
56       int gd_alter_mplex(DIRFILE *dirfile, const char *field_name, const char
57              *in_field, const char *count_field, int count_val, int period);
58
59       int gd_alter_multiply(DIRFILE *dirfile, const char *field_code, const
60              char *in_field1, const char *in_field2);
61
62       int gd_alter_phase(DIRFILE *dirfile, const char *field_code, const char
63              *in_field, gd_int64_t shift);
64
65       int gd_alter_polynom(DIRFILE *dirfile, const char *field_code, int
66              poly_ord, const char *in_field, const double *ca);
67
68       int gd_alter_raw(DIRFILE *dirfile, const char *field_code, gd_type_t
69              data_type, unsigned int spf, int recode);
70
71       int gd_alter_recip(DIRFILE *dirfile, const char *field_code, const char
72              *in_field, double dividend);
73
74       int gd_alter_sarray(DIRFILE *dirfile, const char *field_code, size_t
75              array_len);
76
77       int gd_alter_sbit(DIRFILE *dirfile, const char *field_code, const char
78              *in_field, int bitnum, int numbits);
79
80       int gd_alter_sindir(DIRFILE *dirfile, const char *field_code, const
81              char *index_field, const char *sarray_field);
82
83       int gd_alter_window(DIRFILE *dirfile, const char *field_code, const
84              char *in_field, const char *check_field, gd_windop_t windop,
85              gd_triplet_t threshold);
86
87

DESCRIPTION

89       These functions provide alternatives  to  using  the  gd_alter_entry(3)
90       function  to modify a field of the indicated type in the dirfile speci‐
91       fied by dirfile.
92
93       In all of these calls, field_code indicates the the field to  be  modi‐
94       fied,  which  may  be  a regular field, or a metafield specified by its
95       full (slashed) field code, but should not contain a representation suf‐
96       fix.   The  meaning  and valid types of other arguments may be obtained
97       from  the  get_entry(3)  and  dirfile-format(5)  manual   pages.    The
98       gd_int64_t type is a signed 64-bit integer type.  The gd_triplet_t type
99       is defined as:
100
101           typedef union {
102             gd_int64_t i;
103             gd_uint64_t u;
104             double r;
105           } gd_triplet_t;
106
107       Which element of this gd_triplet_t union to set depends on the operator
108       selected for the WINDOW field.  See gd_entry(3) for details.
109
110       The  gd_alter_clincom() and gd_alter_cpolynom() functions are identical
111       to gd_alter_lincom() and gd_alter_polynom(), except they  take  complex
112       scalar  parameters,  instead  of purely real values.  This only matters
113       for the input of new parameters;  if  the  scalar  parameters  are  not
114       changed  (by  passing NULL instead of a list of scalars), the functions
115       can be used interchangeably, regardless of whether  the  altered  field
116       has complex scalar parameters or not.
117
118       If    the   corresponding   parameters   are   to   be   changed,   the
119       gd_alter_lincom() and gd_alter_clincom()  functions  take  pointers  to
120       three  arrays  of  length  n_fields  containing  the  input field names
121       (in_fields), the gain factors (m or cm), and the  offset  terms  (b  or
122       cb).  Similarly, gd_alter_polynom() and gd_alter_cpolynom() take an ar‐
123       ray of length poly_ord + 1 containing the polynomial  co-efficients  (a
124       or ca).
125
126       Some  field  parameters  have  special  values which indicate no change
127       should be made to the parameter.  These special values are:
128
129       NULL:   any of the string parameters, also m, b, a, cm, cb, or ca;
130
131       0:      spf, n_fields, numbits, cdividend, dividend, or array_len;
132
133       -1:     bitnum or period;
134
135       GD_NULL:
136               data_type or const_type;
137
138       GD_WINDOP_UNK:
139               windop.
140
141       All field parameters introduced with this interface must contain liter‐
142       al  parameters.  Field parameters which are scalar fields cannot be in‐
143       troduced with these functions.   To  do  that,  use  gd_alter_entry(3),
144       gd_alter_spec(3) or gd_malter_spec(3), as appropriate.
145
146       If  rename_table  is  non-zero,  the  look-up  table  referenced by the
147       LINTERP field will be renamed to the path given by table.  If recode is
148       non-zero,  the binary file associated with the RAW field will be re-en‐
149       coded to reflect the new field parameters.  In this case,  the  field's
150       I/O pointer will be reset to the beginning-of-frame.
151
152       If  gd_alter_carray() is used to increase the length of a CARRAY field,
153       the added elements will be uninitialised.   Use  gd_put_carray_slice(3)
154       or  equivalent to initialise them.  Similarly, increasing the length of
155       a SARRAY with gd_alter_sarray() will set the added elements to the emp‐
156       ty  string  ("").   Use  gd_put_sarray_slice(3) or equivalent to modify
157       them.
158
159       See NOTES below for information  on  using  gd_alter_clincom(),  gd_al‐
160       ter_crecip(), and gd_alter_cpolynom() in the C89 GetData API.
161
162

RETURN VALUE

164       On  success,  these functions return zero.  On error, a negative-valued
165       error code is returned.  Possible error codes are:
166
167       GD_E_ACCMODE
168               The specified dirfile was opened read-only.
169
170       GD_E_ALLOC
171               The library was unable to allocate memory.
172
173       GD_E_BAD_CODE
174               The field specified by field_code was not found, or a  supplied
175               field code did not contain the appropriate prefix or suffix.
176
177       GD_E_BAD_DIRFILE
178               The supplied dirfile was invalid.
179
180       GD_E_BAD_ENTRY
181               One or more of the field parameters specified was invalid.
182
183       GD_E_BAD_FIELD_TYPE
184               The field specified by field_code was of the wrong type for the
185               function called.
186
187       GD_E_BAD_TYPE
188               The data_type const_type argument was invalid.
189
190       GD_E_IO An I/O error occurred while translating the binary file associ‐
191               ated  with a modified RAW field, or an I/O error occurred while
192               attempting to rename a LINTERP table file.
193
194       GD_E_PROTECTED
195               The metadata of the fragment was protected from change.  Or,  a
196               request  to  translate  the  binary  file associated with a RAW
197               field was attempted, but the data of the fragment was  protect‐
198               ed.
199
200       GD_E_UNKNOWN_ENCODING
201               The encoding scheme of the indicated format specification frag‐
202               ment is not known to the library.  As a result, the library was
203               unable  to translate the binary file be associated with a modi‐
204               fied RAW field.
205
206       GD_E_UNSUPPORTED
207               The encoding scheme of the indicated format specification frag‐
208               ment  does  not  support translating the binary file associated
209               with a modified RAW field.
210
211       The error code is also stored in the DIRFILE  object  and  may  be  re‐
212       trieved  after  these  functions  return by calling gd_error(3).  A de‐
213       scriptive error string  for  the  error  may  be  obtained  by  calling
214       gd_error_string(3).
215
216

NOTES

218       The  C89  GetData  API provides different prototypes for gd_alter_clin‐
219       com(), gd_alter_cpolynom(), and gd_alter_crecip():
220
221       #define GD_C89_API
222       #include <getdata.h>
223
224       int gd_alter_clincom(DIRFILE *dirfile, const char *field_code, int
225              n_fields, const char **in_fields, const double *cm, const double
226              *cb);
227
228       int gd_alter_cpolynom(DIRFILE *dirfile, const char *field_code, int
229              poly_ord, const char *in_fields, const double *ca);
230
231       int gd_alter_crecip(DIRFILE *dirfile, const char *field_code, const
232              char *in_field, const double cdividend[2]);
233
234       In this case, the array pointers passed as cm, cb  or  ca  should  have
235       twice  as  many  (purely real) elements, consisting of alternating real
236       and imaginary parts for the complex data.  That is, for example,  ca[0]
237       should  be the real part of the first co-efficient, ca[1] the imaginary
238       part of the first co-efficient, ca[2] the real part of the  second  co-
239       efficient,  ca[3] the imaginary part of the second co-efficient, and so
240       on.  Similarly, the cdividend parameter becomes a double precision  ar‐
241       ray of length two.
242
243       For  gd_alter_clincom()  and gd_alter_cpolynom(), these are simply dif‐
244       ferent (but equivalent) declarations of the C99 function  entry  point.
245       For  gd_alter_crecip(),  however,  a  different  entry  point is needed
246       (since the cdividend parameter is passed by  reference  instead  of  by
247       value).    In   the  interests  of  portability,  the  C89  version  of
248       gd_alter_crecip()  is  always  available,  and  may  be   accessed   as
249       gd_alter_crecip89(),  with  the  C89 prototype, in both the C99 and C89
250       APIs.  Passing NULL as cdividend is equivalent to specifying a dividend
251       of zero: it indicates no change to the dividend parameter.
252
253

HISTORY

255       The      functions      dirfile_alter_bit(),     dirfile_alter_const(),
256       dirfile_alter_lincom(),                        dirfile_alter_linterp(),
257       dirfile_alter_multiply(),           dirfile_alter_phase(),          and
258       dirfile_alter_raw() appeared in GetData-0.5.0.
259
260       The   functions   dirfile_alter_clincom(),    dirfile_alter_cpolynom(),
261       dirfile_alter_polynom(),  and  dirfile_alter_sbit()  appeared in GetDa‐
262       ta-0.6.0.
263
264       In  GetData-0.7.0,  the  functions  were  renamed  to   gd_alter_bit(),
265       gd_alter_clincom(),        gd_alter_const(),       gd_alter_cpolynom(),
266       gd_alter_lincom(),       gd_alter_linterp(),       gd_alter_multiply(),
267       gd_alter_phase(),      gd_alter_polynom(),      gd_alter_raw(),     and
268       gd_alter_sbit().  The functions  gd_alter_carray(),  gd_alter_crecip(),
269       gd_alter_crecip89(),  gd_alter_divide(),  and gd_alter_recip() also ap‐
270       peared in this version.
271
272       The functions gd_alter_mplex() and gd_alter_window() appeared in GetDa‐
273       ta-0.8.0.
274
275       In  GetData-0.10.0,  the error return from these functions changed from
276       -1 to a negative-valued error code.   The  functions  gd_alter_indir(),
277       gd_alter_sarray(), and gd_alter_sindir() also appeared in this version.
278
279

SEE ALSO

281       gd_alter_entry(3),  gd_alter_spec(3),  gd_error(3), gd_error_string(3),
282       gd_malter_spec(3), gd_metaflush(3), gd_open(3), gd_put_carray_slice(3),
283       gd_put_sarray_slice(3), dirfile-format(5)
284
285
286
287Version 0.10.0                 25 December 2016                gd_alter_bit(3)
Impressum