blob: f43def9ed854c22c7e7b9fdd84924529a97561e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#ifndef _LIBHX_DEQUE_H
#define _LIBHX_DEQUE_H 1
#ifdef __cplusplus
# include <cstdlib>
#else
# include <stdlib.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct HXdeque_node {
struct HXdeque_node *next;
union {
void *ptr;
char *sptr;
};
struct HXdeque *parent;
struct HXdeque_node *prev;
};
struct HXdeque {
struct HXdeque_node *first;
void *ptr;
struct HXdeque_node *last;
unsigned int items;
};
extern struct HXdeque *HXdeque_init(void);
extern struct HXdeque_node *HXdeque_push(struct HXdeque *, const void *);
extern struct HXdeque_node *HXdeque_unshift(struct HXdeque *, const void *);
extern void *HXdeque_pop(struct HXdeque *);
extern void *HXdeque_shift(struct HXdeque *);
extern void HXdeque_move(struct HXdeque_node *, struct HXdeque_node *);
extern struct HXdeque_node *HXdeque_find(struct HXdeque *, const void *);
extern void *HXdeque_get(struct HXdeque *, const void *);
extern void *HXdeque_del(struct HXdeque_node *);
extern void HXdeque_free(struct HXdeque *);
extern void HXdeque_genocide2(struct HXdeque *, void (*)(void *));
extern void **HXdeque_to_vec(const struct HXdeque *, unsigned int *);
static __inline__ void HXdeque_genocide(struct HXdeque *dq)
{
HXdeque_genocide2(dq, free);
}
#ifdef __cplusplus
} /* extern "C" */
extern "C++" {
template<typename type> static __inline__ type HXdeque_pop(struct HXdeque *dq)
{
return reinterpret_cast<type>(HXdeque_pop(dq));
}
template<typename type> static __inline__ type
HXdeque_shift(struct HXdeque *dq)
{
return reinterpret_cast<type>(HXdeque_shift(dq));
}
template<typename type> static __inline__ type
HXdeque_get(struct HXdeque *dq, const void *ptr)
{
return reinterpret_cast<type>(HXdeque_get(dq, ptr));
}
template<typename type> static __inline__ type
HXdeque_del(struct HXdeque_node *nd)
{
return reinterpret_cast<type>(HXdeque_del(nd));
}
template<typename type> static __inline__ type *
HXdeque_to_vec(struct HXdeque *dq, unsigned int *n)
{
return reinterpret_cast<type *>(HXdeque_to_vec(dq, n));
}
} /* extern "C++" */
#endif
#endif /* _LIBHX_DEQUE_H */
|