1dirfile_alter_spec(3) GETDATA dirfile_alter_spec(3)
2
3
4
6 dirfile_alter_spec, dirfile_malter_spec — modify a field in a dirfile
7
9 #include <getdata.h>
10
11 int dirfile_alter_spec(DIRFILE *dirfile, const char *line, int recode);
12
13 int dirfile_malter_spec(DIRFILE *dirfile, const char *line, const char
14 *parent, int recode);
15
17 The dirfile_alter_spec() function modifies the field described by the
18 field specification line in line to the dirfile specified by dirfile.
19 The dirfile_malter_spec() function behaves similarly, but modifies the
20 metafield under the field indicated by the field code parent. Field
21 specification lines are described in detail in dirfile-format(5).
22
23 The name of the field to be modified, which must already exist, will be
24 obtained from the field specification line. When adding a metafield,
25 line should only contain a field specification, and not a /META direc‐
26 tive.
27
28 If the modified field is of type RAW and the recode argument is non-ze‐
29 ro, the binary file associated with the field will be converted for
30 changes in data type and samples-per-frame. If recode is zero, no bi‐
31 nary file conversion will take place.
32
33 If the modified field is of type LINTERP and the recode argument is
34 non-zero, the look-up table file will be moved if entry->table speci‐
35 fies a different path, overwriting an existing file with the new path‐
36 name, if present. If the field specified by field_code is of type oth‐
37 er than RAW or LINTERP, the recode argument is ignored.
38
39 Passing these functions a directive line instead of a field specifica‐
40 tion line will result in a syntax error. These functions never call
41 the registered parser callback function, even if line contains a syntax
42 error.
43
44
46 On success, dirfile_alter_spec() and dirfile_malter_spec() return zero.
47 On error, -1 is returned and the dirfile error is set to a non-zero er‐
48 ror value. Possible error values are:
49
50 GD_E_ACCMODE
51 The specified dirfile was opened read-only.
52
53 GD_E_ALLOC
54 The library was unable to allocate memory.
55
56 GD_E_BAD_CODE
57 The field specified in line was not found, or the parent field
58 code was not found.
59
60 GD_E_BAD_DIRFILE
61 The supplied dirfile was invalid.
62
63 GD_E_FORMAT
64 A syntax error was encountered in line.
65
66 GD_E_PROTECTED
67 The metadata of the fragment was protected from change. Or, a
68 request to translate the binary file associated with a RAW
69 field was attempted, but the data of the fragment was protect‐
70 ed.
71
72 GD_E_RAW_IO
73 An I/O error occurred while translating the binary file associ‐
74 ated with a modified RAW field, or an I/O error occurred while
75 attempting to rename a LINTERP table file.
76
77 GD_E_UNKNOWN_ENCODING
78 The encoding scheme of the specified format file fragment is
79 not known to the library. As a result, the library was unable
80 to translate the binary file be associated with a modified RAW
81 field.
82
83 GD_E_UNSUPPORTED
84 The encoding scheme of the specified format file fragment does
85 not support translating the empty binary file associated with a
86 modified RAW field.
87
88 The dirfile error may be retrieved by calling get_error(3). A descrip‐
89 tive error string for the last error encountered can be obtained from a
90 call to get_error_string(3).
91
93 dirfile_alter_bit(3), dirfile_alter_const(3), dirfile_alter_entry(3),
94 dirfile_alter_lincom(3), dirfile_alter_linterp(3), dirfile_alter_multi‐
95 ply(3), dirfile_alter_phase(3), dirfile_alter_raw(3), dirfile_al‐
96 ter_spec(3), dirfile_metaflush(3), dirfile_open(3), get_error(3),
97 get_error_string(3), dirfile-format(5)
98
99
100
101Version 0.5.0 7 December 2008 dirfile_alter_spec(3)