Changeset 84
- Timestamp:
- Jun 28, 2001, 7:19:16 PM (24 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/tree.h
r55 r84 5 5 * See remarks there. 6 6 */ 7 8 /*9 * Written: 97/11/18 Jonathan Schultz <jonathan@imatix.com>10 * Revised: 98/12/08 Jonathan Schultz <jonathan@imatix.com>11 *12 * Copyright (C) 1991-99 iMatix Corporation.13 * Copyright (C) 2000 Ulrich Mller.14 * This file is part of the "XWorkplace helpers" source package.15 * This is free software; you can redistribute it and/or modify16 * it under the terms of the GNU General Public License as published17 * by the Free Software Foundation, in version 2 as it comes in the18 * "COPYING" file of the XWorkplace main distribution.19 * This program is distributed in the hope that it will be useful,20 * but WITHOUT ANY WARRANTY; without even the implied warranty of21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the22 * GNU General Public License for more details.23 */24 25 26 /* ----------------------------------------------------------------<Prolog>-27 Name: sfltree.h28 Title: Linked-list functions29 Package: Standard Function Library (SFL)30 31 Written: 97/11/18 Jonathan Schultz <jonathan@imatix.com>32 Revised: 98/01/03 Jonathan Schultz <jonathan@imatix.com>33 34 Synopsis: Provides functions to maintain 'Red-Black' balanced binary35 trees. You can use these functions to work with trees of any36 structure. To make this work, all structures must start with37 the following: "void *left, *right, *parent; TREE_COLOUR38 colour;". All trees need a pointer to the root of type TREE39 which should be initialised with treeInit - you can test40 whether a tree is empty by comparing its root with TREE_NULL.41 The order of nodes in the tree is determined by calling a42 node comparison function provided by the caller - this43 accepts two node pointers and returns zero if the two nodes44 are equal, -1 if the first is smaller and 1 if the first is45 larger.46 47 Copyright: Copyright (c) 1991-99 iMatix Corporation48 License: This is free software; you can redistribute it and/or modify49 it under the terms of the SFL License Agreement as provided50 in the file LICENSE.TXT. This software is distributed in51 the hope that it will be useful, but without any warranty.52 ------------------------------------------------------------------</Prolog>-*/53 7 54 8 #if __cplusplus … … 71 25 #endif 72 26 73 // Red-Black tree description 74 typedef enum {BLACK, RED} TREE_COLOUR; 27 typedef enum { BLACK, RED } nodeColor; 75 28 76 29 /* … … 97 50 *right, 98 51 *parent; 99 unsigned long id; 100 TREE_COLOUR colour; 52 nodeColor color; // the node's color (BLACK, RED) 53 54 unsigned long ulKey; // the node's key (data) 55 101 56 } TREE, *PTREE; 102 57 … … 105 60 #else 106 61 // EMX or whatever: doesn't know calling conventions 107 #define TREE NTRY62 #define TREEENTRY 108 63 #endif 109 64 110 // The tree algorithm needs to know how to sort the data. 111 // It does this using a functions provided by the calling program. 112 // This must return: 113 // -- 0: t1 == t2 114 // -- -1: t1 < t2 115 // -- +1: t1 > t2 116 typedef int TREEENTRY FNTREE_COMPARE_NODES(TREE *t1, TREE *t2); 117 typedef int TREEENTRY FNTREE_COMPARE_DATA(TREE *t1, void *pData); 65 #define STATUS_OK 0 66 #define STATUS_DUPLICATE_KEY -1 67 #define STATUS_INVALID_NODE -2 118 68 119 // Define a function type for use with the tree traversal function 120 typedef void TREEENTRY TREE_PROCESS(TREE *t, void *pUser); 121 122 // Global variables 123 extern TREE TREE_EMPTY; 69 typedef int TREEENTRY FNTREE_COMPARE(unsigned long ul1, unsigned long ul2); 124 70 125 71 // Function prototypes 126 72 void treeInit(TREE **root); 127 73 128 int treeInsertID(TREE **root, 129 TREE *tree, 130 BOOL fAllowDuplicates); 74 int TREEENTRY treeCompareKeys(unsigned long ul1, unsigned long ul2); 131 75 132 int treeInsertNode(TREE **root, 133 TREE *tree, 134 FNTREE_COMPARE_NODES *comp, 135 BOOL fAllowDuplicates); 76 int treeInsert(TREE **root, 77 TREE *x, 78 FNTREE_COMPARE *pfnCompare); 136 79 137 80 int treeDelete(TREE **root, 138 TREE * tree);81 TREE *z); 139 82 140 void* treeFindEQNode(TREE **root, 141 TREE *nodeFind, 142 FNTREE_COMPARE_NODES *comp); 143 void* treeFindLTNode(TREE **root, 144 TREE *nodeFind, 145 FNTREE_COMPARE_NODES *comp); 146 void* treeFindLENode(TREE **root, 147 TREE *nodeFind, 148 FNTREE_COMPARE_NODES *comp); 149 void* treeFindGTNode(TREE **root, 150 TREE *nodeFind, 151 FNTREE_COMPARE_NODES *comp); 152 void* treeFindGENode(TREE **root, 153 TREE *nodeFind, 154 FNTREE_COMPARE_NODES *comp); 83 TREE* treeFind(TREE *root, 84 unsigned long key, 85 FNTREE_COMPARE *pfnCompare); 155 86 156 void* treeFindEQID(TREE **root, 157 unsigned long idFind); 158 void* treeFindLTID(TREE **root, 159 unsigned long idFind); 160 void* treeFindLEID(TREE **root, 161 unsigned long idFind); 162 void* treeFindGTID(TREE **root, 163 unsigned long idFind); 164 void* treeFindGEID(TREE **root, 165 unsigned long idFind); 87 TREE* treeFirst(TREE *r); 166 88 167 void* treeFindEQData(TREE **root, 168 void *pData, 169 FNTREE_COMPARE_DATA *comp); 89 TREE* treeLast(TREE *r); 170 90 171 void treeTraverse (TREE *tree, 172 TREE_PROCESS *process, 173 void *pUser, 174 int method); 175 void *treeNext (TREE *tree); 176 void *treePrev (TREE *tree); 177 void *treeFirst (TREE *tree); 178 void *treeLast (TREE *tree); 91 TREE* treeNext(TREE *r); 92 93 TREE* treePrev(TREE *r); 179 94 180 95 TREE** treeBuildArray(TREE* pRoot, 181 96 unsigned long *pulCount); 182 183 // Return codes184 #define TREE_OK 0185 #define TREE_DUPLICATE 1186 #define TREE_INVALID_NODE 2187 188 // Macros189 #define TREE_NULL &TREE_EMPTY190 97 191 98 #endif -
trunk/include/helpers/winh.h
r81 r84 86 86 #define WinSendMsg(a,b,c,d) winhSendMsg((a),(b),(c),(d)) 87 87 88 MRESULT XWPENTRY winhSendDlgItemMsg(HWND hwnd, ULONG id, ULONG msg, MPARAM mp1, MPARAM mp2); 89 #define WinSendDlgItemMsg(a,b,c,d,e) winhSendDlgItemMsg((a),(b),(c),(d),(e)) 90 88 91 BOOL XWPENTRY winhPostMsg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 89 92 #define WinPostMsg(a,b,c,d) winhPostMsg((a),(b),(c),(d)) … … 122 125 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, ((PSZ)text), ((PSZ)title), 0, MB_YESNO | MB_ICONQUESTION | MB_MOVEABLE) 123 126 124 // made these functions V0.9.12 (2001-05-18) [umoeller] 125 /* #define winhSetDlgItemChecked(hwnd, id, bCheck) \ 127 #define winhSetDlgItemChecked(hwnd, id, bCheck) \ 126 128 WinSendDlgItemMsg((hwnd), (id), BM_SETCHECK, MPFROMSHORT(bCheck), MPNULL) 127 129 #define winhIsDlgItemChecked(hwnd, id) \ 128 130 (SHORT1FROMMR(WinSendDlgItemMsg((hwnd), (id), BM_QUERYCHECK, MPNULL, MPNULL))) 129 */130 131 131 132 #define winhSetMenuItemChecked(hwndMenu, usId, bCheck) \ … … 159 160 * 160 161 ********************************************************************/ 161 162 BOOL XWPENTRY winhSetDlgItemChecked(HWND hwnd, SHORT id, SHORT bCheck);163 164 SHORT XWPENTRY winhIsDlgItemChecked(HWND hwnd, SHORT id);165 162 166 163 BOOL XWPENTRY winhEnableDlgItem(HWND hwndDlg, SHORT id, BOOL fEnable); … … 295 292 ULONG ulTickCount); 296 293 297 BOOL winhSetSliderTicks(HWND hwndSlider, 298 MPARAM mpEveryOther1, 299 ULONG ulPixels1, 300 MPARAM mpEveryOther2, 301 ULONG ulPixels2); 294 BOOL XWPENTRY winhSetSliderTicks(HWND hwndSlider, 295 MPARAM mpEveryOther1, 296 ULONG ulPixels1, 297 MPARAM mpEveryOther2, 298 ULONG ulPixels2); 299 typedef BOOL XWPENTRY WINHSETSLIDERTICKS(HWND hwndSlider, 300 MPARAM mpEveryOther1, 301 ULONG ulPixels1, 302 MPARAM mpEveryOther2, 303 ULONG ulPixels2); 304 typedef WINHSETSLIDERTICKS *PWINHSETSLIDERTICKS; 302 305 303 306 /* -
trunk/include/helpers/xml.h
r71 r84 153 153 { 154 154 TREE Tree; // tree.c 155 // ulKey simply points to the strNodeName 156 // member always V0.9.13 (2001-06-27) [umoeller] 155 157 156 158 NODEBASETYPE ulNodeType; // class type; this is precious, … … 683 685 684 686 PCMELEMENTDECLNODE xmlFindElementDecl(PXMLDOM pDom, 685 const XSTRING *p strElementName);687 const XSTRING *pcszElementName); 686 688 687 689 PCMATTRIBUTEDECLBASE xmlFindAttribDeclBase(PXMLDOM pDom,
Note:
See TracChangeset
for help on using the changeset viewer.