34 #define TAILQ_HEAD(name, type) \ 36 struct type *tqh_first; \ 37 struct type **tqh_last; \ 40 #define TAILQ_ENTRY(type) \ 42 struct type *tqe_next; \ 43 struct type **tqe_prev; \ 49 #define TAILQ_CONCAT(head1, head2) do { \ 50 if (!TAILQ_EMPTY(head2)) { \ 51 *(head1)->tqh_last = (head2)->tqh_first; \ 52 (head2)->tqh_first->next.tqe_prev = (head1)->tqh_last; \ 53 (head1)->tqh_last = (head2)->tqh_last; \ 54 TAILQ_INIT((head2)); \ 58 #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) 60 #define TAILQ_FIRST(head) ((head)->tqh_first) 62 #define TAILQ_FOREACH(var, head) \ 63 for ((var) = TAILQ_FIRST((head)); \ 65 (var) = TAILQ_NEXT((var))) 67 #define TAILQ_FOREACH_SAFE(var, head, tvar) \ 68 for ((var) = TAILQ_FIRST((head)); \ 69 (var) && ((tvar) = TAILQ_NEXT((var)), 1); \ 72 #define TAILQ_INIT(head) do { \ 73 TAILQ_FIRST((head)) = NULL; \ 74 (head)->tqh_last = &TAILQ_FIRST((head)); \ 77 #define TAILQ_INSERT_AFTER(head, listelm, elm) do { \ 78 if ((TAILQ_NEXT((elm)) = TAILQ_NEXT((listelm))) != NULL) \ 79 TAILQ_NEXT((elm))->next.tqe_prev = \ 82 (head)->tqh_last = &TAILQ_NEXT((elm)); \ 84 TAILQ_NEXT((listelm)) = (elm); \ 85 (elm)->next.tqe_prev = &TAILQ_NEXT((listelm)); \ 88 #define TAILQ_INSERT_BEFORE(listelm, elm) do { \ 89 (elm)->next.tqe_prev = (listelm)->next.tqe_prev; \ 90 TAILQ_NEXT((elm)) = (listelm); \ 91 *(listelm)->next.tqe_prev = (elm); \ 92 (listelm)->next.tqe_prev = &TAILQ_NEXT((elm)); \ 95 #define TAILQ_INSERT_HEAD(head, elm) do { \ 96 if ((TAILQ_NEXT((elm)) = TAILQ_FIRST((head))) != NULL) \ 97 TAILQ_FIRST((head))->next.tqe_prev = \ 100 (head)->tqh_last = &TAILQ_NEXT((elm)); \ 101 TAILQ_FIRST((head)) = (elm); \ 102 (elm)->next.tqe_prev = &TAILQ_FIRST((head)); \ 105 #define TAILQ_INSERT_TAIL(head, elm) do { \ 106 TAILQ_NEXT((elm)) = NULL; \ 107 (elm)->next.tqe_prev = (head)->tqh_last; \ 108 *(head)->tqh_last = (elm); \ 109 (head)->tqh_last = &TAILQ_NEXT((elm)); \ 112 #define TAILQ_LAST(head, headname) \ 113 (*(((struct headname *)((head)->tqh_last))->tqh_last)) 115 #define TAILQ_NEXT(elm) ((elm)->next.tqe_next) 117 #define TAILQ_PREV(elm, headname) \ 118 (*(((struct headname *)((elm)->next.tqe_prev))->tqh_last)) 120 #define TAILQ_REMOVE(head, elm) do { \ 121 if ((TAILQ_NEXT((elm))) != NULL) \ 122 TAILQ_NEXT((elm))->next.tqe_prev = \ 123 (elm)->next.tqe_prev; \ 125 (head)->tqh_last = (elm)->next.tqe_prev; \ 126 *(elm)->next.tqe_prev = TAILQ_NEXT((elm)); \ 127 (elm)->next.tqe_next = (void *)-1; \ 128 (elm)->next.tqe_prev = (void *)-1; \ 131 #define TAILQ_SWAP(head1, head2, type) do { \ 132 struct type *swap_first = (head1)->tqh_first; \ 133 struct type **swap_last = (head1)->tqh_last; \ 134 (head1)->tqh_first = (head2)->tqh_first; \ 135 (head1)->tqh_last = (head2)->tqh_last; \ 136 (head2)->tqh_first = swap_first; \ 137 (head2)->tqh_last = swap_last; \ 138 if ((swap_first = (head1)->tqh_first) != NULL) \ 139 swap_first->next.tqe_prev = &(head1)->tqh_first; \ 141 (head1)->tqh_last = &(head1)->tqh_first; \ 142 if ((swap_first = (head2)->tqh_first) != NULL) \ 143 swap_first->next.tqe_prev = &(head2)->tqh_first; \ 145 (head2)->tqh_last = &(head2)->tqh_first; \ 152 #define ISC_FALSE isc_boolean_false 153 #define ISC_TRUE isc_boolean_true 154 #define ISC_TF(x) ((x) ? ISC_TRUE : ISC_FALSE) 161 #define ELEMENT_NONE 0 162 #define ELEMENT_INTEGER 1 163 #define ELEMENT_REAL 2 164 #define ELEMENT_BOOLEAN 3 165 #define ELEMENT_NULL 4 166 #define ELEMENT_STRING 5 167 #define ELEMENT_LIST 6 168 #define ELEMENT_MAP 7 184 void concatString(
struct string *s,
const struct string *a);
275 void printList(FILE *fp,
const struct list *l,
277 void printMap(FILE *fp,
const struct map *m,
279 void printString(FILE *fp,
const struct string *s);
void concatString(struct string *s, const struct string *a)
size_t mapSize(const struct element *m)
struct element * listGet(struct element *l, int i)
void resetDouble(struct element *e, double d)
isc_boolean_t boolValue(const struct element *e)
isc_boolean_t skip_to_end(const struct element *e)
const char * type2name(int t)
struct element * createList(void)
struct string * hexaValue(struct element *)
struct comment * createComment(const char *line)
struct element * copyMap(struct element *m)
struct element * createInt(int64_t i)
void mapSet(struct element *m, struct element *e, const char *k)
TAILQ_ENTRY(element) next
int64_t intValue(const struct element *e)
struct element * createDouble(double d)
struct string * makeStringExt(int l, const char *s, char fmt)
struct map * mapValue(struct element *e)
struct element * createString(const struct string *s)
void resetBool(struct element *e, isc_boolean_t b)
void concat(struct element *l, struct element *o)
void listRemove(struct element *l, int i)
void resetNull(struct element *e)
struct element * createNull(void)
void printList(FILE *fp, const struct list *l, isc_boolean_t skip, unsigned indent)
struct element * mapGet(struct element *m, const char *k)
struct element * createMap(void)
isc_boolean_t mapContains(const struct element *m, const char *k)
void merge(struct element *m, struct element *o)
struct string string_value
void resetList(struct element *e)
void appendString(struct string *s, const char *a)
void listPush(struct element *l, struct element *e)
struct element * create(void)
struct handle * mapPop(struct element *)
struct element * createBool(isc_boolean_t b)
void derive(struct handle *, struct handle *)
size_t listSize(const struct element *l)
isc_boolean_t eqString(const struct string *s, const struct string *o)
void resetString(struct element *e, const struct string *s)
struct element * createHexa(struct string *)
void listSet(struct element *l, struct element *e, int i)
struct string * makeString(int l, const char *s)
void print(FILE *fp, const struct element *e, isc_boolean_t skip, unsigned indent)
void mapRemove(struct element *m, const char *k)
double doubleValue(const struct element *e)
void resetInt(struct element *e, int64_t i)
struct string * allocString(void)
struct element * copy(struct element *e)
struct string * makeStringArray(int l, const char *s, char fmt)
void printMap(FILE *fp, const struct map *m, isc_boolean_t skip, unsigned indent)
int name2type(const char *n)
struct string * quote(struct string *)
void resetMap(struct element *e)
struct list * listValue(struct element *e)
void resetBy(struct element *e, struct element *o)
#define TAILQ_HEAD(name, type)
struct string * stringValue(struct element *e)
struct element * copyList(struct element *l)
void printString(FILE *fp, const struct string *s)