libyang  3.6.1
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tree.h
Go to the documentation of this file.
1 
15 #ifndef LY_TREE_H_
16 #define LY_TREE_H_
17 
18 #include <inttypes.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
104 #define LY_ARRAY_COUNT_TYPE uint64_t
105 
109 #define LY_PRI_ARRAY_COUNT_TYPE PRIu64
110 
114 #define LY_ARRAY_SELECT(_1, _2, NAME, ...) NAME
115 
125 #define LY_ARRAY_FOR_ITER(ARRAY, TYPE, ITER) \
126  for (ITER = ARRAY; \
127  (ARRAY) && ((char *)ITER - (char *)ARRAY)/(sizeof(TYPE)) < (*((LY_ARRAY_COUNT_TYPE*)(ARRAY) - 1)); \
128  ITER = (TYPE*)ITER + 1)
129 
140 #define LY_ARRAY_FOR_INDEX(ARRAY, INDEX) \
141  for (INDEX = 0; \
142  INDEX < LY_ARRAY_COUNT(ARRAY); \
143  ++INDEX)
144 
148 #define LY_ARRAY_COUNT(ARRAY) (ARRAY ? (*((LY_ARRAY_COUNT_TYPE*)(ARRAY) - 1)) : 0)
149 
167 #define LY_ARRAY_FOR(ARRAY, ...) LY_ARRAY_SELECT(__VA_ARGS__, LY_ARRAY_FOR_ITER, LY_ARRAY_FOR_INDEX, LY_UNDEF)(ARRAY, __VA_ARGS__)
168 
180 #define LY_LIST_FOR(START, ELEM) \
181  for ((ELEM) = (START); \
182  (ELEM); \
183  (ELEM) = (ELEM)->next)
184 
194 #define LY_LIST_FOR_SAFE(START, NEXT, ELEM) \
195  for ((ELEM) = (START); \
196  (ELEM) ? (NEXT = (ELEM)->next, 1) : 0; \
197  (ELEM) = (NEXT))
198 
202 typedef enum {
223 } LY_DATA_TYPE;
224 #define LY_DATA_TYPE_COUNT 20
229 extern const char *ly_data_type2str[LY_DATA_TYPE_COUNT];
230 
234 typedef enum {
243 
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif /* LY_TREE_H_ */
LY_DATA_TYPE
YANG built-in types.
Definition: tree.h:202
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
Definition: tree.h:234