Changeset 84


Ignore:
Timestamp:
Jun 28, 2001, 7:19:16 PM (24 years ago)
Author:
umoeller
Message:

Many misc updates.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/tree.h

    r55 r84  
    55 *      See remarks there.
    66 */
    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 M”ller.
    14  *      This file is part of the "XWorkplace helpers" source package.
    15  *      This is free software; you can redistribute it and/or modify
    16  *      it under the terms of the GNU General Public License as published
    17  *      by the Free Software Foundation, in version 2 as it comes in the
    18  *      "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 of
    21  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    22  *      GNU General Public License for more details.
    23  */
    24 
    25 
    26 /*  ----------------------------------------------------------------<Prolog>-
    27     Name:       sfltree.h
    28     Title:      Linked-list functions
    29     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 binary
    35                 trees.  You can use these functions to work with trees of any
    36                 structure.  To make this work, all structures must start with
    37                 the following: "void *left, *right, *parent; TREE_COLOUR
    38                 colour;".  All trees need a pointer to the root of type TREE
    39                 which should be initialised with treeInit - you can test
    40                 whether a tree is empty by comparing its root with TREE_NULL.
    41                 The order of nodes in the tree is determined by calling a
    42                 node comparison function provided by the caller - this
    43                 accepts two node pointers  and returns zero if the two nodes
    44                 are equal, -1 if the first is smaller and 1 if the first is
    45                 larger.
    46 
    47     Copyright:  Copyright (c) 1991-99 iMatix Corporation
    48     License:    This is free software; you can redistribute it and/or modify
    49                 it under the terms of the SFL License Agreement as provided
    50                 in the file LICENSE.TXT.  This software is distributed in
    51                 the hope that it will be useful, but without any warranty.
    52  ------------------------------------------------------------------</Prolog>-*/
    537
    548#if __cplusplus
     
    7125    #endif
    7226
    73     // Red-Black tree description
    74     typedef enum {BLACK, RED} TREE_COLOUR;
     27    typedef enum { BLACK, RED } nodeColor;
    7528
    7629    /*
     
    9750                        *right,
    9851                        *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
    10156    } TREE, *PTREE;
    10257
     
    10560    #else
    10661        // EMX or whatever: doesn't know calling conventions
    107         #define TREENTRY
     62        #define TREEENTRY
    10863    #endif
    10964
    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
    11868
    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);
    12470
    12571    //  Function prototypes
    12672    void treeInit(TREE **root);
    12773
    128     int treeInsertID(TREE **root,
    129                      TREE *tree,
    130                      BOOL fAllowDuplicates);
     74    int TREEENTRY treeCompareKeys(unsigned long  ul1, unsigned long ul2);
    13175
    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);
    13679
    13780    int treeDelete(TREE **root,
    138                    TREE *tree);
     81                   TREE *z);
    13982
    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);
    15586
    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);
    16688
    167     void* treeFindEQData(TREE **root,
    168                          void *pData,
    169                          FNTREE_COMPARE_DATA *comp);
     89    TREE* treeLast(TREE *r);
    17090
    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);
    17994
    18095    TREE** treeBuildArray(TREE* pRoot,
    18196                          unsigned long *pulCount);
    182 
    183     //  Return codes
    184     #define TREE_OK                 0
    185     #define TREE_DUPLICATE          1
    186     #define TREE_INVALID_NODE       2
    187 
    188     //  Macros
    189     #define TREE_NULL &TREE_EMPTY
    19097
    19198#endif
  • trunk/include/helpers/winh.h

    r81 r84  
    8686        #define WinSendMsg(a,b,c,d) winhSendMsg((a),(b),(c),(d))
    8787
     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
    8891        BOOL XWPENTRY winhPostMsg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
    8992        #define WinPostMsg(a,b,c,d) winhPostMsg((a),(b),(c),(d))
     
    122125    WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, ((PSZ)text), ((PSZ)title), 0, MB_YESNO | MB_ICONQUESTION | MB_MOVEABLE)
    123126
    124     // made these functions V0.9.12 (2001-05-18) [umoeller]
    125     /* #define winhSetDlgItemChecked(hwnd, id, bCheck) \
     127    #define winhSetDlgItemChecked(hwnd, id, bCheck) \
    126128            WinSendDlgItemMsg((hwnd), (id), BM_SETCHECK, MPFROMSHORT(bCheck), MPNULL)
    127129    #define winhIsDlgItemChecked(hwnd, id) \
    128130            (SHORT1FROMMR(WinSendDlgItemMsg((hwnd), (id), BM_QUERYCHECK, MPNULL, MPNULL)))
    129        */
    130131
    131132    #define winhSetMenuItemChecked(hwndMenu, usId, bCheck) \
     
    159160     *
    160161     ********************************************************************/
    161 
    162     BOOL XWPENTRY winhSetDlgItemChecked(HWND hwnd, SHORT id, SHORT bCheck);
    163 
    164     SHORT XWPENTRY winhIsDlgItemChecked(HWND hwnd, SHORT id);
    165162
    166163    BOOL XWPENTRY winhEnableDlgItem(HWND hwndDlg, SHORT id, BOOL fEnable);
     
    295292                                              ULONG ulTickCount);
    296293
    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;
    302305
    303306    /*
  • trunk/include/helpers/xml.h

    r71 r84  
    153153    {
    154154        TREE            Tree;           // tree.c
     155                    // ulKey simply points to the strNodeName
     156                    // member always V0.9.13 (2001-06-27) [umoeller]
    155157
    156158        NODEBASETYPE    ulNodeType;     // class type; this is precious,
     
    683685
    684686    PCMELEMENTDECLNODE xmlFindElementDecl(PXMLDOM pDom,
    685                                           const XSTRING *pstrElementName);
     687                                          const XSTRING *pcszElementName);
    686688
    687689    PCMATTRIBUTEDECLBASE xmlFindAttribDeclBase(PXMLDOM pDom,
Note: See TracChangeset for help on using the changeset viewer.