Loading...
Searching...
No Matches
tree.h
Go to the documentation of this file.
#ifndef LY_TREE_H_
#define LY_TREE_H_
#include <inttypes.h>
#ifdef __cplusplus
extern "C" {
#endif
#define LY_ARRAY_COUNT_TYPE uint64_t
#define LY_PRI_ARRAY_COUNT_TYPE PRIu64
#define LY_ARRAY_SELECT(_1, _2, NAME, ...) NAME
#define LY_ARRAY_FOR_ITER(ARRAY, TYPE, ITER) \
for (ITER = ARRAY; \
(ARRAY) && ((char *)ITER - (char *)ARRAY)/(sizeof(TYPE)) < (*((LY_ARRAY_COUNT_TYPE*)(ARRAY) - 1)); \
ITER = (TYPE*)ITER + 1)
#define LY_ARRAY_FOR_INDEX(ARRAY, INDEX) \
for (INDEX = 0; \
INDEX < LY_ARRAY_COUNT(ARRAY); \
++INDEX)
#define LY_ARRAY_COUNT(ARRAY) (ARRAY ? (*((LY_ARRAY_COUNT_TYPE*)(ARRAY) - 1)) : 0)
#define LY_ARRAY_FOR(ARRAY, ...) LY_ARRAY_SELECT(__VA_ARGS__, LY_ARRAY_FOR_ITER, LY_ARRAY_FOR_INDEX, LY_UNDEF)(ARRAY, __VA_ARGS__)
#define LY_LIST_FOR(START, ELEM) \
for ((ELEM) = (START); \
(ELEM); \
(ELEM) = (ELEM)->next)
#define LY_LIST_FOR_SAFE(START, NEXT, ELEM) \
for ((ELEM) = (START); \
(ELEM) ? (NEXT = (ELEM)->next, 1) : 0; \
(ELEM) = (NEXT))
typedef enum {
LY_TYPE_UNKNOWN = 0,
LY_TYPE_BINARY,
LY_TYPE_UINT8,
LY_TYPE_UINT16,
LY_TYPE_UINT32,
LY_TYPE_UINT64,
LY_TYPE_STRING,
LY_TYPE_BITS,
LY_TYPE_BOOL,
LY_TYPE_DEC64,
LY_TYPE_EMPTY,
LY_TYPE_ENUM,
LY_TYPE_IDENT,
LY_TYPE_INST,
LY_TYPE_LEAFREF,
LY_TYPE_UNION,
LY_TYPE_INT8,
LY_TYPE_INT16,
LY_TYPE_INT32,
LY_TYPE_INT64
} LY_DATA_TYPE;
#define LY_DATA_TYPE_COUNT 20
extern const char *ly_data_type2str[LY_DATA_TYPE_COUNT];
typedef enum {
LY_VALUE_CANON,
LY_VALUE_SCHEMA,
LY_VALUE_SCHEMA_RESOLVED,
LY_VALUE_XML,
LY_VALUE_JSON,
LY_VALUE_LYB,
LY_VALUE_STR_NS
} LY_VALUE_FORMAT;
#ifdef __cplusplus
}
#endif
#endif /* LY_TREE_H_ */
LY_DATA_TYPE
LY_DATA_TYPE
YANG built-in types.
Definition tree.h:202
ly_data_type2str
const char * ly_data_type2str[20]
Stringfield YANG built-in data types.
LY_DATA_TYPE_COUNT
#define LY_DATA_TYPE_COUNT
Definition tree.h:224
LY_VALUE_FORMAT
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
Definition tree.h:234
LY_TYPE_STRING
@ LY_TYPE_STRING
Definition tree.h:209
LY_TYPE_BITS
@ LY_TYPE_BITS
Definition tree.h:210
LY_TYPE_UNKNOWN
@ LY_TYPE_UNKNOWN
Definition tree.h:203
LY_TYPE_IDENT
@ LY_TYPE_IDENT
Definition tree.h:215
LY_TYPE_UINT16
@ LY_TYPE_UINT16
Definition tree.h:206
LY_TYPE_LEAFREF
@ LY_TYPE_LEAFREF
Definition tree.h:217
LY_TYPE_INT16
@ LY_TYPE_INT16
Definition tree.h:220
LY_TYPE_UNION
@ LY_TYPE_UNION
Definition tree.h:218
LY_TYPE_BOOL
@ LY_TYPE_BOOL
Definition tree.h:211
LY_TYPE_INT32
@ LY_TYPE_INT32
Definition tree.h:221
LY_TYPE_ENUM
@ LY_TYPE_ENUM
Definition tree.h:214
LY_TYPE_INST
@ LY_TYPE_INST
Definition tree.h:216
LY_TYPE_UINT8
@ LY_TYPE_UINT8
Definition tree.h:205
LY_TYPE_BINARY
@ LY_TYPE_BINARY
Definition tree.h:204
LY_TYPE_INT64
@ LY_TYPE_INT64
Definition tree.h:222
LY_TYPE_INT8
@ LY_TYPE_INT8
Definition tree.h:219
LY_TYPE_UINT64
@ LY_TYPE_UINT64
Definition tree.h:208
LY_TYPE_DEC64
@ LY_TYPE_DEC64
Definition tree.h:212
LY_TYPE_UINT32
@ LY_TYPE_UINT32
Definition tree.h:207
LY_TYPE_EMPTY
@ LY_TYPE_EMPTY
Definition tree.h:213
LY_VALUE_JSON
@ LY_VALUE_JSON
Definition tree.h:239
LY_VALUE_SCHEMA
@ LY_VALUE_SCHEMA
Definition tree.h:236
LY_VALUE_CANON
@ LY_VALUE_CANON
Definition tree.h:235
LY_VALUE_XML
@ LY_VALUE_XML
Definition tree.h:238
LY_VALUE_STR_NS
@ LY_VALUE_STR_NS
Definition tree.h:241
LY_VALUE_SCHEMA_RESOLVED
@ LY_VALUE_SCHEMA_RESOLVED
Definition tree.h:237
LY_VALUE_LYB
@ LY_VALUE_LYB
Definition tree.h:240