OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * $Id$ 00003 * 00004 * This is the header file for a general list linked package. 00005 * 00006 * Copyright 1990,1991 by the Massachusetts Institute of Technology 00007 * For distribution and copying rights, see the file "mit-copyright.h" 00008 */ 00009 00010 #ifndef __LINKED_LIST_H__ 00011 #define __LINKED_LIST_H__ 00012 00013 #define LL_SUCCESS 0 00014 #define LL_FAILURE -1 00015 00016 typedef struct _ll_node { 00017 struct _ll_node *prev; 00018 struct _ll_node *next; 00019 char *data; 00020 } ll_node; 00021 00022 typedef struct { 00023 ll_node *first; 00024 ll_node *last; 00025 int nelements; 00026 } linked_list; 00027 00028 typedef enum {ll_head, ll_tail} ll_end; 00029 typedef enum {ll_s_add, ll_s_check} ll_s_action; 00030 00031 00032 /* 00033 * ll_add_data just assigns the data field of node to be d. 00034 * If this were c++, this would be an inline function and d 00035 * would be a void *, but we'll take what we can get... 00036 */ 00037 #define ll_add_data(n,d) (((n)->data)=(char*)(d)) 00038 00039 #ifdef __STDC__ 00040 00041 void ll_init(linked_list *list); 00042 ll_node *ll_add_node(linked_list *list, ll_end which_end); 00043 int ll_delete_node(linked_list *list, ll_node *node); 00044 int ll_string(linked_list *, ll_s_action, char *); 00045 00046 #else /* __STDC__ */ 00047 00048 void ll_init(); 00049 ll_node *ll_add_node(); 00050 int ll_delete_node(); 00051 int ll_string(); 00052 00053 #endif /* __STDC__ */ 00054 00055 #endif /* __LINKED_LIST_H__ */