b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* x-list.h -- simple list type
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync $Id: x-list.h,v 1.4 2005/07/01 22:43:08 daniels Exp $
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Permission is hereby granted, free of charge, to any person
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync obtaining a copy of this software and associated documentation files
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (the "Software"), to deal in the Software without restriction,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync including without limitation the rights to use, copy, modify, merge,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync publish, distribute, sublicense, and/or sell copies of the Software,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync and to permit persons to whom the Software is furnished to do so,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync subject to the following conditions:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync The above copyright notice and this permission notice shall be
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync included in all copies or substantial portions of the Software.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DEALINGS IN THE SOFTWARE.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Except as contained in this notice, the name(s) of the above
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync copyright holders shall not be used in advertising or otherwise to
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync promote the sale, use or other dealings in this Software without
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync prior written authorization. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/x-list.h,v 1.1 2003/04/30 23:15:42 torrey Exp $ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifndef X_LIST_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define X_LIST_H 1
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* This is just a cons. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct x_list_struct x_list;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncstruct x_list_struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *data;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync x_list *next;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifndef X_PFX
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# define X_PFX(x) x_ ## x
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifndef X_EXTERN
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# define X_EXTERN __private_extern__
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN void X_PFX (list_free_1) (x_list *node);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN x_list *X_PFX (list_prepend) (x_list *lst, void *data);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN x_list *X_PFX (list_append) (x_list *lst, void *data);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN x_list *X_PFX (list_remove) (x_list *lst, void *data);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN void X_PFX (list_free) (x_list *lst);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN x_list *X_PFX (list_pop) (x_list *lst, void **data_ret);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN x_list *X_PFX (list_copy) (x_list *lst);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN x_list *X_PFX (list_reverse) (x_list *lst);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN x_list *X_PFX (list_find) (x_list *lst, void *data);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN x_list *X_PFX (list_nth) (x_list *lst, int n);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN x_list *X_PFX (list_filter) (x_list *src,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int (*pred) (void *item, void *data),
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *data);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN x_list *X_PFX (list_map) (x_list *src,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *(*fun) (void *item, void *data),
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *data);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN unsigned int X_PFX (list_length) (x_list *lst);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN void X_PFX (list_foreach) (x_list *lst, void (*fun)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (void *data, void *user_data),
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *user_data);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncX_EXTERN x_list *X_PFX (list_sort) (x_list *lst, int (*less) (const void *,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const void *));
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif /* X_LIST_H */