dtcm: Resolve CID 87822
[oweals/cde.git] / cde / programs / dtcm / server / list.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: list.h /main/4 1995/11/09 12:45:45 rswiston $ */
24 /*
25  *  (c) Copyright 1993, 1994 Hewlett-Packard Company
26  *  (c) Copyright 1993, 1994 International Business Machines Corp.
27  *  (c) Copyright 1993, 1994 Novell, Inc.
28  *  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
29  */
30
31 #ifndef _LIST_H
32 #define _LIST_H
33
34 #include "ansi_c.h"
35 #include "data.h"
36 #include "rerule.h"
37
38 typedef struct lnode {
39         struct lnode    *llink;
40         struct lnode    *rlink;
41         caddr_t         data;
42         time_t          lasttick;
43         int             duration;
44         RepeatEvent     *re;
45 } List_node;
46
47 typedef struct {
48         List_node       *root;
49         caddr_t private;        /* for internal tool state */
50 } Hc_list;
51
52 typedef int(*Destroy_proc)P((caddr_t));
53
54 #define hc_lookup_next(p_node)          (p_node)->rlink
55 #define hc_lookup_previous(p_node)      (p_node)->llink
56
57 extern Rb_Status        hc_check_list   P((Hc_list*));
58 extern Hc_list*         hc_create       P((_DtCmsGetKeyProc, _DtCmsCompareProc));
59 extern List_node        *hc_delete      P((Hc_list*, caddr_t key));
60 extern List_node        *hc_delete_node P((Hc_list*, List_node*));
61 extern void             hc_destroy      P((Hc_list*, Destroy_proc));
62 extern void             hc_enumerate_down P((Hc_list*, _DtCmsEnumerateProc));
63 extern Rb_Status        hc_enumerate_up P((Hc_list*, _DtCmsEnumerateProc));
64 extern Rb_Status        hc_insert       P((Hc_list*, caddr_t data, caddr_t key,
65                                         RepeatEvent *re, List_node **node_r));
66 extern caddr_t          hc_lookup       P((Hc_list*, caddr_t key));
67 extern caddr_t          hc_lookup_largest       P((Hc_list*));
68 extern caddr_t          hc_lookup_next_larger   P((Hc_list*, caddr_t key));
69 extern caddr_t          hc_lookup_next_smaller  P((Hc_list*, caddr_t key));
70 extern caddr_t          hc_lookup_smallest      P((Hc_list*));
71 extern int              hc_size         P((Hc_list*));
72 extern List_node        *hc_lookup_node P((Hc_list*, caddr_t key));
73 extern Hc_list*         hc_create       P((_DtCmsGetKeyProc, _DtCmsCompareProc));
74 extern Rb_Status        hc_insert_node  P((Hc_list *, List_node *, caddr_t key));
75
76 #endif