source: trunk/athena/bin/aklog/linked_list.h @ 10763

Revision 10763, 1.1 KB checked in by ghudson, 27 years ago (diff)
ANSIfy a bit.
Line 
1/*
2 * $Id: linked_list.h,v 1.4 1997-11-17 16:23:50 ghudson Exp $
3 *
4 * This is the header file for a general list linked package.
5 *
6 * Copyright 1990,1991 by the Massachusetts Institute of Technology
7 * For distribution and copying rights, see the file "mit-copyright.h"
8 */
9
10#ifndef AKLOG__LINKED_LIST_H
11#define AKLOG__LINKED_LIST_H
12
13#define LL_SUCCESS 0
14#define LL_FAILURE -1
15
16typedef struct _ll_node {
17    struct _ll_node *prev;
18    struct _ll_node *next;
19    char *data;
20} ll_node;
21
22typedef struct {
23    ll_node *first;
24    ll_node *last;
25    int nelements;
26} linked_list;
27
28typedef enum {ll_head, ll_tail} ll_end;
29typedef enum {ll_s_add, ll_s_check} ll_s_action;
30
31
32/*
33 * ll_add_data just assigns the data field of node to be d.
34 * If this were c++, this would be an inline function and d
35 * would be a void *, but we'll take what we can get...
36 */
37#define ll_add_data(n,d) (((n)->data)=(char*)(d))
38
39void ll_init(linked_list *list);
40ll_node *ll_add_node(linked_list *list, ll_end which_end);
41int ll_delete_node(linked_list *list, ll_node *node);
42int ll_string(linked_list *, ll_s_action, char *);
43
44#endif /* AKLOG__LINKED_LIST_H */
Note: See TracBrowser for help on using the repository browser.