BadVPN – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /** |
2 | * @file SAvl_header.h |
||
3 | * @author Ambroz Bizjak <ambrop7@gmail.com> |
||
4 | * |
||
5 | * @section LICENSE |
||
6 | * |
||
7 | * Redistribution and use in source and binary forms, with or without |
||
8 | * modification, are permitted provided that the following conditions are met: |
||
9 | * 1. Redistributions of source code must retain the above copyright |
||
10 | * notice, this list of conditions and the following disclaimer. |
||
11 | * 2. Redistributions in binary form must reproduce the above copyright |
||
12 | * notice, this list of conditions and the following disclaimer in the |
||
13 | * documentation and/or other materials provided with the distribution. |
||
14 | * 3. Neither the name of the author nor the |
||
15 | * names of its contributors may be used to endorse or promote products |
||
16 | * derived from this software without specific prior written permission. |
||
17 | * |
||
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
28 | */ |
||
29 | |||
30 | // Preprocessor inputs. All types must be typedef names unless stated otherwise. |
||
31 | // SAVL_PARAM_NAME - name of this data structure |
||
32 | // SAVL_PARAM_FEATURE_COUNTS - whether to keep count information (0 or 1) |
||
33 | // SAVL_PARAM_FEATURE_NOKEYS - define to 1 if there is no need for a lookup operation |
||
34 | // SAVL_PARAM_TYPE_ENTRY - type of entry. This can also be a struct (e.g.: struct Foo). |
||
35 | // SAVL_PARAM_TYPE_KEY - type of key (ignored if SAVL_PARAM_FEATURE_NOKEYS) |
||
36 | // SAVL_PARAM_TYPE_ARG - type of argument pass through to callbacks |
||
37 | // SAVL_PARAM_TYPE_COUNT - type of count (only if SAVL_PARAM_FEATURE_COUNTS) |
||
38 | // SAVL_PARAM_VALUE_COUNT_MAX - maximum value of count (of type SAVL_PARAM_TYPE_COUNT) (only if SAVL_PARAM_FEATURE_COUNTS) |
||
39 | // SAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) - compare two entries; returns -1/0/1 |
||
40 | // SAVL_PARAM_FUN_COMPARE_KEY_ENTRY(arg, key1, entry2) - compare key and entry; returns -1/0/1 (ignored if SAVL_PARAM_FEATURE_NOKEYS) |
||
41 | // SAVL_PARAM_MEMBER_NODE - node member in entry |
||
42 | |||
43 | // types |
||
44 | #define SAvl SAVL_PARAM_NAME |
||
45 | #define SAvlEntry SAVL_PARAM_TYPE_ENTRY |
||
46 | #define SAvlArg SAVL_PARAM_TYPE_ARG |
||
47 | #define SAvlKey SAVL_PARAM_TYPE_KEY |
||
48 | #define SAvlCount SAVL_PARAM_TYPE_COUNT |
||
49 | #define SAvlNode MERGE(SAvl, Node) |
||
50 | |||
51 | // public functions |
||
52 | #define SAvl_Init MERGE(SAvl, _Init) |
||
53 | #define SAvl_Insert MERGE(SAvl, _Insert) |
||
54 | #define SAvl_Remove MERGE(SAvl, _Remove) |
||
55 | #define SAvl_Lookup MERGE(SAvl, _Lookup) |
||
56 | #define SAvl_LookupExact MERGE(SAvl, _LookupExact) |
||
57 | #define SAvl_GetFirstGreater MERGE(SAvl, _GetFirstGreater) |
||
58 | #define SAvl_GetLastLesser MERGE(SAvl, _GetLastLesser) |
||
59 | #define SAvl_GetFirstGreaterEqual MERGE(SAvl, _GetFirstGreaterEqual) |
||
60 | #define SAvl_GetLastLesserEqual MERGE(SAvl, _GetLastLesserEqual) |
||
61 | #define SAvl_GetFirst MERGE(SAvl, _GetFirst) |
||
62 | #define SAvl_GetLast MERGE(SAvl, _GetLast) |
||
63 | #define SAvl_GetNext MERGE(SAvl, _GetNext) |
||
64 | #define SAvl_GetPrev MERGE(SAvl, _GetPrev) |
||
65 | #define SAvl_IsEmpty MERGE(SAvl, _IsEmpty) |
||
66 | #define SAvl_Verify MERGE(SAvl, _Verify) |
||
67 | #define SAvl_Count MERGE(SAvl, _Count) |
||
68 | #define SAvl_IndexOf MERGE(SAvl, _IndexOf) |
||
69 | #define SAvl_GetAt MERGE(SAvl, _GetAt) |
||
70 | |||
71 | // internal stuff |
||
72 | #define SAvl__Tree MERGE(SAvl, __Tree) |
||
73 | #define SAvl__TreeRef MERGE(SAvl, __TreeRef) |
||
74 | #define SAvl__TreeLink MERGE(SAvl, __TreeLink) |
||
75 | #define SAvl__TreeDeref MERGE(SAvl, __TreeDeref) |
||
76 | #define SAvl__Tree_Init MERGE(SAvl, __Tree_Init) |
||
77 | #define SAvl__Tree_Insert MERGE(SAvl, __Tree_Insert) |
||
78 | #define SAvl__Tree_Remove MERGE(SAvl, __Tree_Remove) |
||
79 | #define SAvl__Tree_Lookup MERGE(SAvl, __Tree_Lookup) |
||
80 | #define SAvl__Tree_LookupExact MERGE(SAvl, __Tree_LookupExact) |
||
81 | #define SAvl__Tree_GetFirstGreater MERGE(SAvl, __Tree_GetFirstGreater) |
||
82 | #define SAvl__Tree_GetLastLesser MERGE(SAvl, __Tree_GetLastLesser) |
||
83 | #define SAvl__Tree_GetFirstGreaterEqual MERGE(SAvl, __Tree_GetFirstGreaterEqual) |
||
84 | #define SAvl__Tree_GetLastLesserEqual MERGE(SAvl, __Tree_GetLastLesserEqual) |
||
85 | #define SAvl__Tree_GetFirst MERGE(SAvl, __Tree_GetFirst) |
||
86 | #define SAvl__Tree_GetLast MERGE(SAvl, __Tree_GetLast) |
||
87 | #define SAvl__Tree_GetNext MERGE(SAvl, __Tree_GetNext) |
||
88 | #define SAvl__Tree_GetPrev MERGE(SAvl, __Tree_GetPrev) |
||
89 | #define SAvl__Tree_IsEmpty MERGE(SAvl, __Tree_IsEmpty) |
||
90 | #define SAvl__Tree_Verify MERGE(SAvl, __Tree_Verify) |
||
91 | #define SAvl__Tree_Count MERGE(SAvl, __Tree_Count) |
||
92 | #define SAvl__Tree_IndexOf MERGE(SAvl, __Tree_IndexOf) |
||
93 | #define SAvl__Tree_GetAt MERGE(SAvl, __Tree_GetAt) |