- Finished implementing RtlInsertUnicodePrefix: handle greater and less than insertions.
[reactos.git] / reactos / include / ndk / rtlfuncs.h
index 3dca19a..0a5ddd4 100644 (file)
 #include "extypes.h"
 #include "rtltypes.h"
 
+/* MACROS ********************************************************************/
+
+/* FIXME: Eventually move the ones in rtltypes.h here... */
+
+/*
+ * Splay Tree Macros
+ */
+#define RtlIsLeftChild(Links) \
+    (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
+
+#define RtlRightChild(Links) \
+    (PRTL_SPLAY_LINKS)(Links)->RightChild
+
+#define RtlIsRoot(Links) \
+    (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
+
+#define RtlLeftChild(Links) \
+    (PRTL_SPLAY_LINKS)(Links)->LeftChild
+
+#define RtlParent(Links) \
+    (PRTL_SPLAY_LINKS)(Links)->Parent
+
+#define RtlInitializeSplayLinks(Links)                  \
+    PRTL_SPLAY_LINKS _SplayLinks;                       \
+    _SplayLinks = (PRTL_SPLAY_LINKS)(Links);            \
+    _SplayLinks->Parent = _SplayLinks;                  \
+    _SplayLinks->LeftChild = NULL;                      \
+    _SplayLinks->RightChild = NULL;
+
+#define RtlInsertAsLeftChild(ParentLinks,ChildLinks)    \
+    PRTL_SPLAY_LINKS _SplayParent;                      \
+    PRTL_SPLAY_LINKS _SplayChild;                       \
+    _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks);     \
+    _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks);       \
+    _SplayParent->LeftChild = _SplayChild;              \
+    _SplayChild->Parent = _SplayParent;
+
+#define RtlInsertAsRightChild(ParentLinks,ChildLinks)   \
+    PRTL_SPLAY_LINKS _SplayParent;                      \
+    PRTL_SPLAY_LINKS _SplayChild;                       \
+    _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks);     \
+    _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks);       \
+    _SplayParent->RightChild = _SplayChild;             \
+    _SplayChild->Parent = _SplayParent;
+
 /* PROTOTYPES ****************************************************************/
 
+/*
+ * Splay Tree Functions
+ */
+NTSYSAPI
+PRTL_SPLAY_LINKS
+NTAPI
+RtlSplay(PRTL_SPLAY_LINKS Links);
+
+NTSYSAPI
+PRTL_SPLAY_LINKS
+NTAPI
+RtlDelete(PRTL_SPLAY_LINKS Links);
+
+NTSYSAPI
+VOID
+NTAPI
+RtlDeleteNoSplay(
+    PRTL_SPLAY_LINKS Links,
+    PRTL_SPLAY_LINKS *Root
+);
+
+NTSYSAPI
+PRTL_SPLAY_LINKS
+NTAPI
+RtlSubtreeSuccessor(PRTL_SPLAY_LINKS Links);
+
+NTSYSAPI
+PRTL_SPLAY_LINKS
+NTAPI
+RtlSubtreePredecessor(PRTL_SPLAY_LINKS Links);
+
+NTSYSAPI
+PRTL_SPLAY_LINKS
+NTAPI
+RtlRealSuccessor(PRTL_SPLAY_LINKS Links);
+
+NTSYSAPI
+PRTL_SPLAY_LINKS
+NTAPI
+RtlRealPredecessor(PRTL_SPLAY_LINKS Links);
+
 /*
  * Error and Exception Functions
  */