1dirfile_add_spec(3) GETDATA dirfile_add_spec(3)
2
3
4
6 dirfile_add_spec, dirfile_madd_spec — add a field to a dirfile
7
9 #include <getdata.h>
10
11 int dirfile_add_spec(DIRFILE *dirfile, const char *line, int
12 fragment_index);
13
14 int dirfile_madd_spec(DIRFILE *dirfile, const char *line, const char
15 *parent);
16
18 The dirfile_add_spec() function adds the field described by the field
19 specification line in line to the dirfile specified by dirfile. The
20 dirfile_madd_spec() function behaves similarly, but adds the field as a
21 metafield under the field indicated by the field parent. Field speci‐
22 fication lines are described in detail in dirfile-format(5). Since
23 Standards Version 7 (see dirfile(5)) permits specifying metafield with‐
24 out the use of the /META directive, dirfile_add_spec() may also be used
25 to add metafields, by specifying the metafield's full field code. See
26 dirfile-format(5) for full details.
27
28 When using dirfile_madd_spec(), line should only contain a field speci‐
29 fication, and not a /META directive.
30
31 Passing these functions a directive line instead of a field specifica‐
32 tion line will result in a syntax error. These functions never call
33 the registered parser callback function, even if line contains a syntax
34 error.
35
36
38 On success, dirfile_add_spec() and dirfile_madd_spec() return zero.
39 On error, -1 is returned and the dirfile error is set to a non-zero er‐
40 ror value. Possible error values are:
41
42 GD_E_ACCMODE
43 The specified dirfile was opened read-only.
44
45 GD_E_ALLOC
46 The library was unable to allocate memory.
47
48 GD_E_BAD_CODE
49 The parent field code was not found, or was already a
50 metafield.
51
52 GD_E_BAD_DIRFILE
53 The supplied dirfile was invalid.
54
55 GD_E_BAD_INDEX
56 The fragment_index argument was out of range.
57
58 GD_E_FORMAT
59 A syntax error was encountered in line.
60
61 GD_E_PROTECTED
62 The metadata of the fragment was protected from change. Or,
63 the creation of a RAW field was attempted and the data of the
64 fragment was protected.
65
66 GD_E_RAW_IO
67 An I/O error occurred while creating an empty binary file to be
68 associated with a newly added RAW field.
69
70 GD_E_UNKNOWN_ENCODING
71 The encoding scheme of the specified format file fragment is
72 not known to the library. As a result, the library was unable
73 to create an empty binary file to be associated with a newly
74 added RAW field.
75
76 GD_E_UNSUPPORTED
77 The encoding scheme of the specified format file fragment does
78 not support creating an empty binary file to be associated with
79 a newly added RAW field.
80
81 The dirfile error may be retrieved by calling get_error(3). A descrip‐
82 tive error string for the last error encountered can be obtained from a
83 call to get_error_string(3).
84
86 dirfile_add(3), dirfile_add_bit(3), dirfile_add_const(3),
87 dirfile_add_lincom(3), dirfile_add_linterp(3), dirfile_add_multiply(3),
88 dirfile_add_phase(3), dirfile_add_raw(3), dirfile_madd(3),
89 dirfile_madd_bit(3), dirfile_madd_const(3), dirfile_madd_lincom(3),
90 dirfile_madd_linterp(3), dirfile_madd_multiply(3),
91 dirfile_madd_phase(3), dirfile_madd_string(3), dirfile_metaflush(3),
92 dirfile_open(3), get_error(3), get_error_string(3), dirfile-format(5)
93
94
95
96Version 0.6.0 4 October 2009 dirfile_add_spec(3)