DMI_NAMES

Synopsis

#include <opendmi/utils/name.h>

DMI_NAMES({ name, ..., {} })
DMI_NAME_RANGES({ range, ..., {} })

DMI_NAME_UNSPEC(id)
DMI_NAME_UNKNOWN(id)
DMI_NAME_OTHER(id)
DMI_NAME_NONE(id)
DMI_NAME_UNSUPPORTED(id)
DMI_NAME_RESERVED(id)

DMI_NAME_FUNCTION(prefix)

Description

A name set, dmi_name_set_t, names the values of an enumeration or the bits of a set, see dmi_name_lookup, and is what the .values of an attribute refers to, see DMI_ATTRIBUTE.

DMI_NAMES

List of the names of single values, a compound literal of dmi_name_t, each of an .id, a .code and a .name, terminated by an empty entry, {}, which the list itself ends with.

DMI_NAME_RANGES

List of the names of ranges of values, a compound literal of dmi_name_range_t, each of a .start_id and an .end_id, inclusive, a .code and a .name, terminated the same way. A value named on its own is named so rather than by its range.

DMI_NAME_UNSPEC, DMI_NAME_UNKNOWN, DMI_NAME_OTHER, DMI_NAME_NONE, DMI_NAME_UNSUPPORTED, DMI_NAME_RESERVED

Entries of DMI_NAMES for the values the specification names the same way everywhere, e.g. unspecified and Unspecified.

DMI_NAME_FUNCTION

Definition of the function naming the values of an enumeration, which returns the name of a value of <prefix>_t in the name set <prefix>_names, see dmi_name_lookup. The function, <prefix>_name, is declared on its own, and the macro is not followed by a semicolon.

The code of the name set, .code, names the table its names are translated in, by the codes of the entries, see dmi_name_lookup.

Parameters

id

Value the entry names.

prefix

Prefix of the names of the function, the enumeration type and the name set, e.g. dmi_chassis_type.

Example

const dmi_name_set_t dmi_chassis_type_names =
{
    .code  = "chassis-type",
    .names = DMI_NAMES({
        DMI_NAME_UNSPEC(DMI_CHASSIS_TYPE_UNSPEC),
        DMI_NAME_OTHER(DMI_CHASSIS_TYPE_OTHER),
        DMI_NAME_UNKNOWN(DMI_CHASSIS_TYPE_UNKNOWN),
        {
            .id   = DMI_CHASSIS_TYPE_DESKTOP,
            .code = "desktop",
            .name = "Desktop"
        },
        ...
        {}
    })
};

DMI_NAME_FUNCTION(dmi_chassis_type)