gd_entry_list(3)

NAME
gd_entry_list, gd_field_list, gd_field_list_by_type gd_mfield_list, gd_mfield_list_by_type, gd_mvector_list, gd_vector_list — list field entries in a Dirfile

SYNOPSIS
#include <getdata.h>

const char **gd_entry_list(DIRFILE *dirfile, const char *parent, int type, unsigned int flags);

const char **gd_field_list(DIRFILE *dirfile);

const char **gd_field_list_by_type(DIRFILE *dirfile, gd_entype_t type);

const char **gd_mfield_list(DIRFILE *dirfile, const char *parent);

const char **gd_mfield_list_by_type(DIRFILE *dirfile, const char *parent, gd_entype_t type);

const char **gd_mvector_list(DIRFILE *dirfile, const char *parent);

const char **gd_vector_list(DIRFILE *dirfile);

DESCRIPTION
The function queries a dirfile(5) database specified by and finds all the fields satisfying the provided criteria. If is non-NULL, metafields under the field specified by are considered; otherwise, top-level fields are considered, and metafields ignored. The argument should be one of the following symbols indicating an explicit entry type to list:

    GD_BIT_ENTRY, GD_CARRAY_ENTRY, GD_CONST_ENTRY, GD_DIVIDE_ENTRY, GD_INDEX_ENTRY, GD_INDIR_ENTRY, GD_LINCOM_ENTRY, GD_LINTERP_ENTRY, GD_MPLEX_ENTRY, GD_MULTIPLY_ENTRY, GD_PHASE_ENTRY, GD_POLYNOM_ENTRY, GD_RAW_ENTRY, GD_RECIP_ENTRY, GD_SARRAY_ENTRY, GD_SBIT_ENTRY, GD_SINDIR_ENTRY, GD_STRING_ENTRY, GD_WINDOW_ENTRY.

(GD_INDEX_ENTRY is a special field type for the implicit INDEX field) or else one of the following special symbols: List entries of all types. List only aliases. This is the only way to get a list including aliases which do not point to valid field codes. List only scalar field types (CONST, CARRAY, SARRAY, STRING). List only numeric-valued vector field types (all field types except SINDIR and the scalar field types listed above).

The argument should be zero or more of the following flags, bitwise or'd together: Include hidden entries (see in the list: normally hidden entries are skipped; Exclude aliases from the list: normally aliases are considered the same as their target (that is: if a field satisfies the criteria, both its canonical name and all its aliases will appear in the list).

The array returned will be de-allocated by a call to and should not be de-allocated by the caller. The list returned should not be assumed to be in any particular order. The array is terminated by a NULL pointer. The number of elements in the array, excluding the terminating NULL, can be obtained from an equivalent call to The caller may not modify any strings in the array, or the array itself. Doing so may cause database corruption. The pointer returned is guaranteed to be valid at least until is called again on the same DIRFILE object, or until the array is de-allocated by a call to (Although the data may have become obsolete, if metadata have been modified in the interrim.) This function has a subset of the functionality of the function (q.v.).

  Special Cases
The call
    gd_field_list(dirfile);

is equivalent to
    gd_entry_list(dirfile, NULL, GD_ALL_ENTRIES, 0);

The call
    gd_field_list_by_type(dirfile, type);

is equivalent to
    gd_entry_list(dirfile, NULL, type, 0);

The call
    gd_mfield_list(dirfile, parent);

is equivalent to
    gd_entry_list(dirfile, parent, GD_ALL_ENTRIES, 0);

The call
    gd_mfield_list_by_type(dirfile, parent, type);

is equivalent to
    gd_entry_list(dirfile, parent, type, 0);

The call
    gd_mvector_list(dirfile, parent);

is equivalent to
    gd_entry_list(dirfile, parent, GD_VECTOR_ENTRIES, 0);

The call
    gd_vector_list(dirfile);

is equivalent to
    gd_entry_list(dirfile, NULL, GD_VECTOR_ENTRIES, 0);

RETURN VALUE
Upon successful completion, these functions returns a pointer to an array of strings containing the names of all the entries in the database satisfying the supplied criteria. The array is terminated with a NULL pointer. If there are no matching entries, an array containing only the terminating NULL pointer is returned. On error, these functions return NULL and store a negative-valued error code in the DIRFILE object which may be retrieved by a subsequent call to Possible error codes are: The supplied parent field code was not found, or referred to a metafield itself. The supplied dirfile was invalid. The parameter supplied was not one of the symbols listed above.

A descriptive error string for the error may be obtained by calling

HISTORY
The function appeared in GetData-0.3.0. The and functions appeared in GetData-0.4.0. In GetData-0.7.0, these functions were renamed to and The function appeared in GetData-0.8.0.

SEE ALSO
dirfile(5)