1dirfile_add(3)                      GETDATA                     dirfile_add(3)
2
3
4

NAME

6       dirfile_add, dirfile_madd — add a field to a dirfile
7

SYNOPSIS

9       #include <getdata.h>
10
11       int dirfile_add(DIRFILE *dirfile, const gd_entry_t *entry);
12
13       int dirfile_madd(DIRFILE *dirfile, const gd_entry_t *entry, const char
14              *parent);
15

DESCRIPTION

17       The dirfile_add() function adds the field described  by  entry  to  the
18       dirfile specified by dirfile.  The dirfile_madd() function behaves sim‐
19       ilarly, but adds the field as a metafield under the field indicated  by
20       the field code parent.
21
22       The  form of entry is described in detail on the get_entry(3) man page.
23       All relevant members of entry for the  field  type  specified  must  be
24       properly initialised.
25
26       When  adding  a  metafield, the entry->field member should contain just
27       the metafield's name, not the fully formed  <parent-field>/<meta-field>
28       field  code.   Also,  dirfile_madd()  ignores the value of entry->frag‐
29       ment_index, and instead adds the new meta field to the same format file
30       fragment in which the parent field is defined.
31
32       Fields  added  with this interface may contain either numerical parame‐
33       ters or parameters based on CONST fields.  If an  element  of  the  en‐
34       try->scalar  array  defined  for  the specified field type is non-NULL,
35       this element will be used as the CONST field code, and the  correspond‐
36       ing  numerical  member  will  be  ignored, and need not be initialised.
37       Conversely, if numerical parameters are intended, the corresponding en‐
38       try->scalar elements should be set to NULL.
39
40

RETURN VALUE

42       On  success,  dirfile_add() and dirfile_madd() return zero.   On error,
43       -1 is returned and the dirfile error is set to a non-zero error  value.
44       Possible error values are:
45
46       GD_E_ACCMODE
47               The specified dirfile was opened read-only.
48
49       GD_E_ALLOC
50               The library was unable to allocate memory.
51
52       GD_E_BAD_CODE
53               The field name provided in entry->field contained invalid char‐
54               acters. Alternately, the parent field code was  not  found,  or
55               was already a metafield.
56
57       GD_E_BAD_DIRFILE
58               The supplied dirfile was invalid.
59
60       GD_E_BAD_ENTRY
61               There  was an error in the specification of the field described
62               by entry, or the caller attempted to add a field of type RAW as
63               a metafield.
64
65       GD_E_BAD_INDEX
66               The entry->fragment_index parameter was out of range.
67
68       GD_E_BAD_TYPE
69               The  entry->data_type  parameter  provided with a RAW entry, or
70               the entry->const_type parameter provided with  a  CONST  entry,
71               was invalid.
72
73       GD_E_DUPLICATE
74               The  field  name provided in entry->field duplicated that of an
75               already existing field.
76
77       GD_E_PROTECTED
78               The metadata of the fragment was protected  from  change.   Or,
79               the  creation  of a RAW field was attempted and the data of the
80               fragment was protected.
81
82       GD_E_RAW_IO
83               An I/O error occurred while creating an empty binary file to be
84               associated with a newly added RAW field.
85
86       GD_E_UNKNOWN_ENCODING
87               The  encoding  scheme  of the specified format file fragment is
88               not known to the library.  As a result, the library was  unable
89               to  create  an  empty binary file to be associated with a newly
90               added RAW field.
91
92       GD_E_UNSUPPORTED
93               The encoding scheme of the specified format file fragment  does
94               not support creating an empty binary file to be associated with
95               a newly added RAW field.
96
97       The dirfile error may be retrieved by calling get_error(3).  A descrip‐
98       tive error string for the last error encountered can be obtained from a
99       call to get_error_string(3).
100

SEE ALSO

102       dirfile_add_bit(3),    dirfile_add_clincom(3),    dirfile_add_const(3),
103       dirfile_add_cpolynom(3), dirfile_add_lincom(3), dirfile_add_linterp(3),
104       dirfile_add_multiply(3), dirfile_add_phase(3),  dirfile_add_polynom(3),
105       dirfile_add_raw(3),      dirfile_add_sbit(3),      dirfile_add_spec(3),
106       dirfile_add_string(3),  dirfile_madd_bit(3),   dirfile_madd_clincom(3),
107       dirfile_madd_const(3),    dirfile_madd_cpolynom(3),   dirfile_madd_lin‐
108       com(3),       dirfile_madd_linterp(3),        dirfile_madd_multiply(3),
109       dirfile_madd_phase(3),  dirfile_madd_polynom(3),  dirfile_madd_sbit(3),
110       dirfile_madd_spec(3),   dirfile_madd_string(3),   dirfile_metaflush(3),
111       dirfile_open(3),   get_entry(3),   get_error(3),   get_error_string(3),
112       dirfile-format(5)
113
114
115
116Version 0.6.0                   16 October 2009                 dirfile_add(3)
Impressum