migrate substitution keywords to SVN
[reactos.git] / reactos / lib / rtl / splaytree.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2003 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* $Id$
20 *
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS system libraries
23 * PURPOSE: Splay-Tree implementation
24 * FILE: lib/rtl/splaytree.c
25 */
26
27 #include <ddk/ntddk.h>
28
29 #define NDEBUG
30 #include <debug.h>
31
32
33 /* FUNCTIONS *****************************************************************/
34
35 /*
36 * @unimplemented
37 */
38 PRTL_SPLAY_LINKS
39 STDCALL
40 RtlDelete (
41 PRTL_SPLAY_LINKS Links
42 )
43 {
44 UNIMPLEMENTED;
45 return 0;
46 }
47
48 /*
49 * @unimplemented
50 */
51 VOID
52 STDCALL
53 RtlDeleteNoSplay (
54 PRTL_SPLAY_LINKS Links,
55 PRTL_SPLAY_LINKS *Root
56 )
57 {
58 UNIMPLEMENTED;
59 }
60
61
62 /*
63 * @unimplemented
64 */
65 PRTL_SPLAY_LINKS
66 STDCALL
67 RtlRealPredecessor (
68 PRTL_SPLAY_LINKS Links
69 )
70 {
71 UNIMPLEMENTED;
72 return 0;
73 }
74
75 /*
76 * @unimplemented
77 */
78 PRTL_SPLAY_LINKS
79 STDCALL
80 RtlRealSuccessor (
81 PRTL_SPLAY_LINKS Links
82 )
83 {
84 UNIMPLEMENTED;
85 return 0;
86 }
87
88 /*
89 * @unimplemented
90 */
91 PRTL_SPLAY_LINKS
92 STDCALL
93 RtlSplay (
94 PRTL_SPLAY_LINKS Links
95 )
96 {
97 UNIMPLEMENTED;
98 return 0;
99 }
100
101
102 /*
103 * @implemented
104 */
105 PRTL_SPLAY_LINKS STDCALL
106 RtlSubtreePredecessor (IN PRTL_SPLAY_LINKS Links)
107 {
108 PRTL_SPLAY_LINKS Child;
109
110 Child = Links->RightChild;
111 if (Child == NULL)
112 return NULL;
113
114 if (Child->LeftChild == NULL)
115 return Child;
116
117 /* Get left-most child */
118 while (Child->LeftChild != NULL)
119 Child = Child->LeftChild;
120
121 return Child;
122 }
123
124 /*
125 * @implemented
126 */
127 PRTL_SPLAY_LINKS STDCALL
128 RtlSubtreeSuccessor (IN PRTL_SPLAY_LINKS Links)
129 {
130 PRTL_SPLAY_LINKS Child;
131
132 Child = Links->LeftChild;
133 if (Child == NULL)
134 return NULL;
135
136 if (Child->RightChild == NULL)
137 return Child;
138
139 /* Get right-most child */
140 while (Child->RightChild != NULL)
141 Child = Child->RightChild;
142
143 return Child;
144 }
145
146 /* EOF */