1get_mfield_list_by_type(3) GETDATA get_mfield_list_by_type(3)
2
3
4
6 get_mfield_list_by_type — retrieve a list of fields in a dirfile
7
9 #include <getdata.h>
10
11 const char **get_mfield_list_by_type(DIRFILE *dirfile, const char
12 *parent, gd_entype_t type);
13
15 The get_mfield_list_by_type() function queries a dirfile(5) database
16 specified by dirfile and returns a read-only list of names of the all
17 metafields of the indicated type for the supplied parent field.
18
19 The dirfile argument must point to a valid DIRFILE object previously
20 created by a call to dirfile_open(3). The type argument should be one
21 of the following symbols indicating the desired field type:
22
23 GD_BIT_ENTRY, GD_CONST_ENTRY, GD_INDEX_ENTRY,
24 GD_LINCOM_ENTRY, GD_LINTERP_ENTRY, GD_MULTIPLY_ENTRY,
25 GD_PHASE_ENTRY, GD_POLYNOM_ENTRY, GD_RAW_ENTRY, GD_SBIT_ENTRY,
26 GD_STRING_ENTRY.
27
28 The array returned will be de-allocated by a call to dirfile_close(3)
29 and should not be de-allocated by the caller. The list returned should
30 not be assumed to be in any particular order. The array is terminated
31 by a NULL pointer. The number of fields in the array can be obtained
32 from a call to get_nmfields_by_type(3).
33
34 The caller may not modify any strings in the array, or the array it‐
35 self. Doing so may cause database corruption. The pointer returned is
36 guaranteed to be valid until get_mfield_list_by_type() is called again
37 with the same arguments, or until the array is deallocated by a call to
38 dirfile_close(3).
39
40 For CONST and STRING field types, corresponding lists of values for may
41 be obtained by calling get_mconstants(3) or get_mstrings(3).
42
43
45 Upon successful completion, get_mfield_list_by_type() returns a pointer
46 to an array of strings containing the names of all the metafields of
47 the specific type for the given parent. On error it returns NULL and
48 sets the dirfile error to a non-zero error value. Possible error val‐
49 ues are:
50
51 GD_E_ALLOC
52 The library was unable to allocate memory.
53
54 GD_E_BAD_CODE
55 The supplied parent field code was not found, or referred to a
56 metafield itself.
57
58 GD_E_BAD_DIRFILE
59 The supplied dirfile was invalid.
60
61 The dirfile error may be retrieved by calling get_error(3). A descrip‐
62 tive error string for the last error encountered can be obtained from a
63 call to get_error_string(3).
64
66 dirfile(5), dirfile_open(3), get_mconstants(3), get_error(3), get_er‐
67 ror_string(3), get_field_list_by_type(3), get_mfield_list(3), get_nm‐
68 fields_by_type(3), get_mstrings(3)
69
70
71
72Version 0.6.0 16 October 2009 get_mfield_list_by_type(3)