source: trunk/src/win32k/include/avl.h@ 2912

Last change on this file since 2912 was 2501, checked in by bird, 26 years ago

Temporary backup checkin.

File size: 2.0 KB
Line 
1/* $Id: avl.h,v 1.2 2000-01-22 18:20:59 bird Exp $
2 *
3 * AVL-Tree (lookalike) declaration.
4 *
5 * Copyright (c) 1999 knut st. osmundsen
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10#ifndef _AVL_H_
11#define _AVL_H_
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/*
18 * AVL configuration. PRIVATE!
19 */
20#define AVL_MAX_HEIGHT 19 /* Up to 2^16 nodes. */
21
22/**
23 * AVL key type
24 */
25typedef unsigned long AVLKEY;
26
27/**
28 * AVL Core node.
29 */
30typedef struct _AVLNodeCore
31{
32 AVLKEY Key; /* Key value. */
33 struct _AVLNodeCore * pLeft; /* Pointer to left leaf node. */
34 struct _AVLNodeCore * pRight; /* Pointer to right leaf node. */
35 unsigned char uchHeight; /* Height of this tree: max(heigth(left), heigth(right)) + 1 */
36} AVLNODECORE, *PAVLNODECORE, **PPAVLNODECORE;
37
38/**
39 * AVL Enum data - All members are PRIVATE! Don't touch!
40 */
41typedef struct _AVLEnumData
42{
43 char fFromLeft;
44 char cEntries;
45 char achFlags[AVL_MAX_HEIGHT];
46 PAVLNODECORE aEntries[AVL_MAX_HEIGHT];
47} AVLENUMDATA, *PAVLENUMDATA;
48
49
50/*
51 * callback type
52 */
53typedef unsigned ( _PAVLCALLBACK)(PAVLNODECORE, void*);
54typedef _PAVLCALLBACK *PAVLCALLBACK;
55
56
57void AVLInsert(PPAVLNODECORE ppTree, PAVLNODECORE pNode);
58PAVLNODECORE AVLRemove(PPAVLNODECORE ppTree, AVLKEY Key);
59PAVLNODECORE AVLGet(PPAVLNODECORE ppTree, AVLKEY Key);
60PAVLNODECORE AVLGetWithParent(PPAVLNODECORE ppTree, PPAVLNODECORE ppParent, AVLKEY Key);
61PAVLNODECORE AVLGetWithAdjecentNodes(PPAVLNODECORE ppTree, AVLKEY Key, PPAVLNODECORE ppLeft, PPAVLNODECORE ppRight);
62unsigned AVLDoWithAll(PPAVLNODECORE ppTree, int fFromLeft, PAVLCALLBACK pfnCallBack, void *pvParam);
63PAVLNODECORE AVLBeginEnumTree(PPAVLNODECORE ppTree, PAVLENUMDATA pEnumData, int fFromLeft);
64PAVLNODECORE AVLGetNextNode(PAVLENUMDATA pEnumData);
65PAVLNODECORE AVLGetBestFit(PPAVLNODECORE ppTree, AVLKEY Key, int fAbove);
66
67
68
69/*
70 * Just in case NULL is undefined.
71 */
72#ifndef NULL
73 #define NULL ((void*)0)
74#endif
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif
Note: See TracBrowser for help on using the repository browser.