-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdlheap_headers.h
84 lines (51 loc) · 1.74 KB
/
dlheap_headers.h
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
/**
* @file dlheap_headers.h
* @brief Heap function prototypes
* @author Dominique LaSalle <[email protected]>
* Copyright (c) 2013-2015, Dominique LaSalle
* @version 1
* @date 2013-10-04
*/
/* prefixing ugliness */
#define DLHEAP_PRE2(prefix,suffix) prefix ## _ ## suffix
#define DLHEAP_PRE1(prefix,suffix) DLHEAP_PRE2(prefix,suffix)
#define DLHEAP_PUB(name) DLHEAP_PRE1(DLHEAP_PREFIX,name)
#define DLHEAP_PRI(name) DLHEAP_PRE1(_,DLHEAP_PRE1(DLHEAP_PREFIX,name))
/******************************************************************************
* TYPES ***********************************************************************
******************************************************************************/
typedef struct DLHEAP_PUB(heap_t) {
DLHEAP_TYPE_T * elements;
size_t maxsize;
size_t size;
} DLHEAP_PUB(heap_t);
#ifndef DLHEAP_STATIC
/******************************************************************************
* FUNCTION PROTOTYPES *********************************************************
******************************************************************************/
DLHEAP_PUB(heap_t) * DLHEAP_PUB(heap_create)(
size_t n);
void DLHEAP_PUB(heap_expand)(
DLHEAP_PUB(heap_t) * heap);
void DLHEAP_PUB(heap_free)(
DLHEAP_PUB(heap_t) * heap);
void DLHEAP_PUB(heap_push)(
DLHEAP_TYPE_T val,
DLHEAP_PUB(heap_t) * heap);
DLHEAP_TYPE_T DLHEAP_PUB(heap_pop)(
DLHEAP_PUB(heap_t) * heap);
DLHEAP_TYPE_T DLHEAP_PUB(heap_peek)(
DLHEAP_PUB(heap_t) const * heap);
#undef DLHEAP_PRE2
#undef DLHEAP_PRE1
#undef DLHEAP_PUB
#undef DLHEAP_PRI
#else
#undef DLHEAP_PRE2
#undef DLHEAP_PRE1
#undef DLHEAP_PUB
#undef DLHEAP_PRI
#define DLHEAP_VISIBILITY static
#include "dlheap_funcs.h"
#undef DLHEAP_VISIBILITY
#endif