Go to the documentation of this file.
69 #define NIL ((List *) NULL)
83 #if defined(PG_USE_INLINE) || defined(PG_LIST_INCLUDE_DEFINITIONS)
114 #define lnext(lc) ((lc)->next)
115 #define lfirst(lc) ((lc)->data.ptr_value)
116 #define lfirst_int(lc) ((lc)->data.int_value)
117 #define lfirst_oid(lc) ((lc)->data.oid_value)
119 #define linitial(l) lfirst(list_head(l))
120 #define linitial_int(l) lfirst_int(list_head(l))
121 #define linitial_oid(l) lfirst_oid(list_head(l))
123 #define lsecond(l) lfirst(lnext(list_head(l)))
124 #define lsecond_int(l) lfirst_int(lnext(list_head(l)))
125 #define lsecond_oid(l) lfirst_oid(lnext(list_head(l)))
127 #define lthird(l) lfirst(lnext(lnext(list_head(l))))
128 #define lthird_int(l) lfirst_int(lnext(lnext(list_head(l))))
129 #define lthird_oid(l) lfirst_oid(lnext(lnext(list_head(l))))
131 #define lfourth(l) lfirst(lnext(lnext(lnext(list_head(l)))))
132 #define lfourth_int(l) lfirst_int(lnext(lnext(lnext(list_head(l)))))
133 #define lfourth_oid(l) lfirst_oid(lnext(lnext(lnext(list_head(l)))))
135 #define llast(l) lfirst(list_tail(l))
136 #define llast_int(l) lfirst_int(list_tail(l))
137 #define llast_oid(l) lfirst_oid(list_tail(l))
142 #define list_make1(x1) lcons(x1, NIL)
143 #define list_make2(x1,x2) lcons(x1, list_make1(x2))
144 #define list_make3(x1,x2,x3) lcons(x1, list_make2(x2, x3))
145 #define list_make4(x1,x2,x3,x4) lcons(x1, list_make3(x2, x3, x4))
147 #define list_make1_int(x1) lcons_int(x1, NIL)
148 #define list_make2_int(x1,x2) lcons_int(x1, list_make1_int(x2))
149 #define list_make3_int(x1,x2,x3) lcons_int(x1, list_make2_int(x2, x3))
150 #define list_make4_int(x1,x2,x3,x4) lcons_int(x1, list_make3_int(x2, x3, x4))
152 #define list_make1_oid(x1) lcons_oid(x1, NIL)
153 #define list_make2_oid(x1,x2) lcons_oid(x1, list_make1_oid(x2))
154 #define list_make3_oid(x1,x2,x3) lcons_oid(x1, list_make2_oid(x2, x3))
155 #define list_make4_oid(x1,x2,x3,x4) lcons_oid(x1, list_make3_oid(x2, x3, x4))
161 #define foreach(cell, l) \
162 for ((cell) = list_head(l); (cell) != NULL; (cell) = lnext(cell))
169 #define for_each_cell(cell, initcell) \
170 for ((cell) = (initcell); (cell) != NULL; (cell) = lnext(cell))
180 #define forboth(cell1, list1, cell2, list2) \
181 for ((cell1) = list_head(list1), (cell2) = list_head(list2); \
182 (cell1) != NULL && (cell2) != NULL; \
183 (cell1) = lnext(cell1), (cell2) = lnext(cell2))
189 #define forthree(cell1, list1, cell2, list2, cell3, list3) \
190 for ((cell1) = list_head(list1), (cell2) = list_head(list2), (cell3) = list_head(list3); \
191 (cell1) != NULL && (cell2) != NULL && (cell3) != NULL; \
192 (cell1) = lnext(cell1), (cell2) = lnext(cell2), (cell3) = lnext(cell3))
262 #ifdef ENABLE_LIST_COMPAT
264 #define lfirsti(lc) lfirst_int(lc)
265 #define lfirsto(lc) lfirst_oid(lc)
267 #define makeList1(x1) list_make1(x1)
268 #define makeList2(x1, x2) list_make2(x1, x2)
269 #define makeList3(x1, x2, x3) list_make3(x1, x2, x3)
270 #define makeList4(x1, x2, x3, x4) list_make4(x1, x2, x3, x4)
272 #define makeListi1(x1) list_make1_int(x1)
273 #define makeListi2(x1, x2) list_make2_int(x1, x2)
275 #define makeListo1(x1) list_make1_oid(x1)
276 #define makeListo2(x1, x2) list_make2_oid(x1, x2)
278 #define lconsi(datum, list) lcons_int(datum, list)
279 #define lconso(datum, list) lcons_oid(datum, list)
281 #define lappendi(list, datum) lappend_int(list, datum)
282 #define lappendo(list, datum) lappend_oid(list, datum)
284 #define nconc(l1, l2) list_concat(l1, l2)
286 #define nth(n, list) list_nth(list, n)
288 #define member(datum, list) list_member(list, datum)
289 #define ptrMember(datum, list) list_member_ptr(list, datum)
290 #define intMember(datum, list) list_member_int(list, datum)
291 #define oidMember(datum, list) list_member_oid(list, datum)
299 #define lremove(elem, list) list_delete_ptr(list, elem)
300 #define LispRemove(elem, list) list_delete(list, elem)
301 #define lremovei(elem, list) list_delete_int(list, elem)
302 #define lremoveo(elem, list) list_delete_oid(list, elem)
304 #define ltruncate(n, list) list_truncate(list, n)
306 #define set_union(l1, l2) list_union(l1, l2)
307 #define set_uniono(l1, l2) list_union_oid(l1, l2)
308 #define set_ptrUnion(l1, l2) list_union_ptr(l1, l2)
310 #define set_difference(l1, l2) list_difference(l1, l2)
311 #define set_differenceo(l1, l2) list_difference_oid(l1, l2)
312 #define set_ptrDifference(l1, l2) list_difference_ptr(l1, l2)
314 #define equali(l1, l2) equal(l1, l2)
315 #define equalo(l1, l2) equal(l1, l2)
317 #define freeList(list) list_free(list)
319 #define listCopy(list) list_copy(list)