[BACK]Return to ci_nlist.h CVS log [TXT][DIR] Up to [Development] / failsafe / FailSafe / cluster_services / include

File: [Development] / failsafe / FailSafe / cluster_services / include / ci_nlist.h (download)

Revision 1.1, Thu Aug 31 19:16:32 2000 UTC (17 years, 1 month ago) by vasa
Branch: MAIN
CVS Tags: HEAD

Initial checkin

/*
 * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 * 
 * This program is distributed in the hope that it would be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * 
 * Further, this software is distributed without any warranty that it is
 * free of the rightful claim of any third person regarding infringement
 * or the like.  Any license provided herein, whether implied or
 * otherwise, applies only to this software file.  Patent licenses, if
 * any, provided herein do not apply to combinations of this program with
 * other software, or any other product whatsoever.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
 * USA.
 * 
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
 * Mountain View, CA 94043, or:
 * 
 * http://www.sgi.com 
 * 
 * For further information regarding this notice, see: 
 * 
 * http://oss.sgi.com/projects/GenInfo/NoticeExplan
 */
/*
 * ci_nlist.h
 *
 * what's in this file?
 */

#ifndef CI_NLIST_H
#define CI_NLIST_H
#ident "$Id: ci_nlist.h,v 1.1 2000/08/31 19:16:32 vasa Exp $"

typedef struct ci_nlist_entry_s {
    struct ci_nlist_entry_s	*next;
    void			*data;
} ci_nlist_entry_t;

typedef struct ci_nlist_s {
    struct ci_nlist_entry_s	*first;
    struct ci_nlist_entry_s	*last;
    uint32_t			count;
    void			(*printfunc)(void *, int);
    void			(*destroyfunc)(void *);
} ci_nlist_t;

typedef enum {
    CR_ISLESSTHAN	= 1,
    CR_ISEQUALTO	= 2,
    CR_ISGREATERTHAN	= 3,
    CR_ISNOTEQUAL	= 4
} ci_cmp_result_t;

typedef enum {
    SO_INCREASING	= 1,
    SO_DECREASING	= 2
} ci_sort_order_t;

ci_nlist_t *	__ci_nlist_create(void (*printfunc)(void *, int),
				  void (*destroyfunc)(void *));
void		__ci_nlist_unlink(ci_nlist_t *list);
void		__ci_nlist_unlink_elements(ci_nlist_t *list);
void		__ci_nlist_destroy(ci_nlist_t *list);
void		__ci_nlist_destroy_elements(ci_nlist_t *list);
ci_err_t	__ci_nlist_add(ci_nlist_t *list, void *data);
ci_err_t	__ci_nlist_append(ci_nlist_t *list, void *data);
ci_err_t	__ci_nlist_prepend(ci_nlist_t *list, void *data);
ci_err_t	__ci_nlist_delete(ci_nlist_t *list, void *data,
				  ci_cmp_result_t (*cfunc)(void *, void *));
ci_err_t	__ci_nlist_destroy_element(ci_nlist_t *list, void *data,
					   ci_cmp_result_t (*cfunc)(void *,
								    void *));
void *		__ci_nlist_first(ci_nlist_t *list, void **handlep);
void *		__ci_nlist_last(ci_nlist_t *list);
void *		__ci_nlist_next(ci_nlist_t *list, void **current);
void *		__ci_nlist_search(ci_nlist_t *list, void *data,
				  ci_cmp_result_t (*cfunc)(void *, void *));
ci_nlist_t *	__ci_nlist_sort(ci_nlist_t *list, ci_cmp_result_t
				(*cmpfunc)(void *, void *), 
				ci_sort_order_t order);
void *		__ci_nlist_search_extract(ci_nlist_t *list, void *data,
					  ci_cmp_result_t (*cmpfunc) (void *,
								      void *));
void *		__ci_nlist_extract_first(ci_nlist_t *list);
void *		__ci_nlist_extract_last(ci_nlist_t *list);
void *		__ci_nlist_extract(ci_nlist_t *list);
boolean_t	__ci_nlist_isempty(ci_nlist_t *list);
boolean_t	__ci_nlist_hasentries(ci_nlist_t *list);
uint32_t	__ci_nlist_count(ci_nlist_t *list);
uint32_t	__ci_nlist_position(ci_nlist_t *list, void *data);
void		__ci_nlist_print(ci_nlist_t *list, int level);
ci_nlist_t *	__ci_nlist_dup(ci_nlist_t *list);
ci_cmp_result_t __ci_nlist_string_compare(void *s1, void *s2);
ci_cmp_result_t	__ci_nlist_compare(ci_nlist_t *list1, ci_nlist_t *list2,
				   ci_cmp_result_t (*cmpfunc)(void *, void *));

#define ci_nlist_create(printfunc, destroyfunc)		\
	__ci_nlist_create(printfunc, destroyfunc)
#define ci_nlist_unlink_elements(list) 			\
	__ci_nlist_unlink_elements(list)
#define ci_nlist_unlink(list) 				\
	__ci_nlist_unlink(list)
#define ci_nlist_destroy(list) 				\
	__ci_nlist_destroy(list)
#define ci_nlist_destroy_elements(list) 		\
	__ci_nlist_destroy_elements(list)
#define ci_nlist_add(list, data)			\
	__ci_nlist_add(list, (void*)(data))
#define ci_nlist_append(list, data) 			\
	__ci_nlist_append(list, (void*)(data))
#define ci_nlist_prepend(list, data) 			\
	__ci_nlist_prepend(list, (void*)(data))
#define ci_nlist_delete(list, data, func)	 	\
	__ci_nlist_delete(list, (void*)(data), func)
#define ci_nlist_destroy_element(list, data, func)	\
	__ci_nlist_destroy_element(list, (void*)(data), func)
#define ci_nlist_first(list, handlep)			\
	__ci_nlist_first(list, handlep)
#define ci_nlist_last(list) 				\
	__ci_nlist_last(list)
#define ci_nlist_next(list, handlep) 			\
	__ci_nlist_next(list, handlep)
#define ci_nlist_search(list, data, func) 		\
	__ci_nlist_search(list, (void*)(data), func)
#define ci_nlist_sort(list, func, order)		\
	__ci_nlist_sort(list, func, order)
#define ci_nlist_search_extract(list, data, func) 	\
	__ci_nlist_search_extract(list, (void*)(data), func)
#define ci_nlist_extract_first(list) 			\
	__ci_nlist_extract_first(list)
#define ci_nlist_extract_last(list) 			\
	__ci_nlist_extract_last(list)
#define ci_nlist_extract(list) 				\
	__ci_nlist_extract(list)
#define ci_nlist_isempty(list)				\
	__ci_nlist_isempty(list)
#define ci_nlist_hasentries(list)			\
	__ci_nlist_hasentries(list)
#define ci_nlist_count(list) 				\
	__ci_nlist_count(list)
#define ci_nlist_position(list, data) 			\
	__ci_nlist_position(list, (void*)(data))
#define ci_nlist_print(list, level)			\
	__ci_nlist_print(list, level)
#define ci_nlist_dup(list)				\
	__ci_nlist_dup(list)
#define ci_nlist_string_compare 			\
	__ci_nlist_string_compare
#define ci_nlist_compare	 			\
	__ci_nlist_compare

#endif /* CI_NLIST_H */