1dirfile_add_bit(3) GETDATA dirfile_add_bit(3)
2
3
4
6 dirfile_add_bit, dirfile_add_clincom, dirfile_add_const,
7 dirfile_add_cpolynom, dirfile_add_lincom, dirfile_add_linterp,
8 dirfile_add_multiply, dirfile_add_phase, dirfile_add_polynom,
9 dirfile_add_raw, dirfile_add_sbit, dirfile_add_string — add a field to
10 a dirfile
11
13 #include <getdata.h>
14
15 int dirfile_add_bit(DIRFILE *dirfile, const char *field_name, const
16 char *in_field, gd_bit_t bitnum, gd_bit_t numbits, int
17 fragment_index);
18
19 int dirfile_add_clincom(DIRFILE *dirfile, const char *field_name, int
20 n_fields, const char **in_fields, const double complex *cm,
21 const double complex *cb, int fragment_index);
22
23 int dirfile_add_const(DIRFILE *dirfile, const char *field_name,
24 gd_type_t const_type, gd_type_t data_type, void *value, int
25 fragment_index);
26
27 int dirfile_add_cpolynom(DIRFILE *dirfile, const char *field_name, int
28 poly_ord, const char *in_fields, const double complex *ca, int
29 fragment_index );
30
31 int dirfile_add_lincom(DIRFILE *dirfile, const char *field_name, int
32 n_fields, const char **in_fields, const double *m, const double
33 *b, int fragment_index);
34
35 int dirfile_add_linterp(DIRFILE *dirfile, const char *field_name, const
36 char *in_field, const char *table, int fragment_index);
37
38 int dirfile_add_multiply(DIRFILE *dirfile, const char *field_name,
39 const char *in_field1, const char *in_field2, int
40 fragment_index);
41
42 int dirfile_add_phase(DIRFILE *dirfile, const char *field_name, const
43 char *in_field, gd_shift_t shift, int fragment_index);
44
45 int dirfile_add_polynom(DIRFILE *dirfile, const char *field_name, int
46 poly_ord, const char *in_fields, const double *a, int
47 fragment_index );
48
49 int dirfile_add_raw(DIRFILE *dirfile, const char *field_name, gd_type_t
50 data_type, gd_spf_t spf, int fragment_index);
51
52 int dirfile_add_sbit(DIRFILE *dirfile, const char *field_name, const
53 char *in_field, gd_bit_t bitnum, gd_bit_t numbits, int
54 fragment_index);
55
56 int dirfile_add_string(DIRFILE *dirfile, const char *field_name, const
57 char *value, int fragment_index);
58
60 These functions provide alternatives to using the dirfile_add(3) func‐
61 tion to add a new field of the indicated type to the dirfile specified
62 by dirfile.
63
64 In all of these calls, field_name indicates the name of the field to be
65 added. Further, fragment_index is the index of the format file frag‐
66 ment into which the field should be added. (To convert a fragment in‐
67 dex to its file name, see get_fragmentname(3).) The meaning and valid
68 types of other arguments may be obtained from the get_entry(3) and
69 dirfile-format(5) manual pages.
70
71 The dirfile_add_clincom() and dirfile_add_cpolynom() functions are
72 identical to dirfile_add_lincom() and dirfile_add_polynom(), except
73 they take complex scalar parameters, instead of purely real values.
74
75 The dirfile_add_lincom() and dirfile_add_clincom() functions takes
76 pointers to three arrays of length n_fields containing the input field
77 names (in_fields), the gain factors (m or cm), and the offset terms (b
78 or cb). Similarly, dirfile_add_polynom() and dirfile_add_cpolynom()
79 take an array of length poly_ord + 1 containing the polynomial co-effi‐
80 cients (a or ca).
81
82 The dirfile_add_string() and dirfile_add_const() functions both add the
83 field and set the value of the field to value. For dirfile_add_con‐
84 st(), the const_type argument specifies the storage type for the const,
85 while data_type specifies the data type of the value pointed to by val‐
86 ue.
87
88 The gd_bit_t type is a signed 16-bit integer type. The gd_shift_t type
89 is a signed 64-bit integer type. The gd_spf_t type is an unsigned
90 16-bit integer type.
91
92 All fields added with this interface must contain numerical parameters.
93 Fields with CONST fields as parameters cannot be added with these func‐
94 tions. Those fields must be added with dirfile_add(3) or
95 dirfile_add_spec(3).
96
97 See NOTES below for information on using dirfile_add_clincom() and
98 dirfile_add_cpolynom() in the C89 GetData API.
99
100
102 On success, any of these functions returns zero. On error, -1 is re‐
103 turned and the dirfile error is set to a non-zero error value. Possi‐
104 ble error values are:
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_name argument contained invalid characters.
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_INDEX
122 The fragment_index argument was out of range.
123
124 GD_E_BAD_TYPE
125 The data_type or const_type argument provided to
126 dirfile_add_raw() or dirfile_add_const(), was invalid.
127
128 GD_E_DUPLICATE
129 The field_name provided duplicated that of an already existing
130 field.
131
132 GD_E_PROTECTED
133 The metadata of the fragment was protected from change. Or,
134 the creation of a RAW field was attempted and the data of the
135 fragment was protected.
136
137 GD_E_RAW_IO
138 An I/O error occurred while creating an empty binary file to be
139 associated with a newly added RAW field.
140
141 GD_E_UNKNOWN_ENCODING
142 The encoding scheme of the specified format file fragment is
143 not known to the library. As a result, the library was unable
144 to create an empty binary file to be associated with a newly
145 added RAW field.
146
147 GD_E_UNSUPPORTED
148 The encoding scheme of the specified format file fragment does
149 not support creating an empty binary file to be associated with
150 a newly added RAW field.
151
152 The dirfile error may be retrieved by calling get_error(3). A descrip‐
153 tive error string for the last error encountered can be obtained from a
154 call to get_error_string(3).
155
156
158 The C89 GetData API provides different prototypes for dirfile_add_clin‐
159 com() and dirfile_add_cpolynom():
160
161 #define GETDATA_C89_API
162 #include <getdata.h>
163
164 int dirfile_add_clincom(DIRFILE *dirfile, const char *field_name,
165 int n_fields, const char **in_fields, const double *cm,
166 const double *cb, int fragment_index);
167
168 int dirfile_add_cpolynom(DIRFILE *dirfile, const char *field_name,
169 int poly_ord, const char *in_fields, const double *ca,
170 int fragment_index );
171
172 In this case, the array pointers passed as cm, cb or ca should have
173 twice as many (purely real) elements, consisting of alternating real
174 and imaginary parts for the complex data. For example, ca[0] should be
175 the real part of the first co-efficient, ca[1] the imaginary part of
176 the first co-efficient, ca[2] the real part of the second co-efficient,
177 ca[3] the imaginary part of the second co-efficient, and so on.
178
179
181 dirfile_add(3), dirfile_add_spec(3), dirfile_madd_bit(3),
182 dirfile_madd_clincom(3), dirfile_madd_const(3), dirfile_madd_cpoly‐
183 nom(3), dirfile_madd_lincom(3), dirfile_madd_linterp(3),
184 dirfile_madd_multiply(3), dirfile_madd_phase(3), dirfile_madd_poly‐
185 nom(3), dirfile_madd_sbit(3), dirfile_madd_string(3),
186 dirfile_metaflush(3), dirfile_open(3), get_error(3), get_er‐
187 ror_string(3), dirfile-format(5)
188
189
190
191Version 0.6.0 2 November 2009 dirfile_add_bit(3)