source: trunk/include/zAVLTree.h@ 567

Last change on this file since 567 was 458, checked in by katerina, 10 years ago

Fix for ticket #358 (repetitive lstat warning) and #359 (reporting of added/deleted top level directories).

File size: 2.6 KB
Line 
1/*
2 * zAVLTree.h: Header file for zAVLTrees.
3 * Copyright (C) 1998,2001 Michael H. Buselli
4 * This is version 0.1.3 (alpha).
5 * Generated from $Id: xAVLTree.h.sh,v 1.5 2001/06/07 06:58:28 cosine Exp $
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * The author of this library can be reached at the following address:
22 * Michael H. Buselli
23 * 30051 N. Waukegan Rd. Apt. 103
24 * Lake Bluff, IL 60044-5412
25 *
26 * Or you can send email to <cosine@cosine.org>.
27 * The official web page for this product is:
28 * http://www.cosine.org/project/AVLTree/
29 */
30
31#ifndef _ZAVLTREE_H_
32#define _ZAVLTREE_H_
33
34/* typedef the keytype */
35typedef const void * zAVLKey;
36
37/* Comparison function for strings is strcmp(). */
38/* #define zAVLKey_cmp(tree, a, b) (strcmp((a), (b))) */
39
40#define zAVL_KEY_STRING 0
41#define zAVL_KEY_INT 1
42
43
44typedef struct _zAVLNode {
45 zAVLKey key;
46 long depth;
47 void *item;
48 struct _zAVLNode *parent;
49 struct _zAVLNode *left;
50 struct _zAVLNode *right;
51} zAVLNode;
52
53
54typedef struct {
55 zAVLNode *top;
56 long count;
57 zAVLKey (*getkey)(const void *item);
58 int keytype;
59} zAVLTree;
60
61
62typedef struct {
63 const zAVLTree *avltree;
64 const zAVLNode *curnode;
65} zAVLCursor;
66
67
68extern zAVLTree *zAVLAllocTree (zAVLKey (*getkey)(void const *item), int keytype);
69extern void zAVLFreeTree (zAVLTree *avltree, void (freeitem)(void *item));
70extern int zAVLInsert (zAVLTree *avltree, void *item);
71extern void *zAVLSearch (zAVLTree const *avltree, zAVLKey key);
72extern int zAVLDelete (zAVLTree *avltree, zAVLKey key);
73extern void *zAVLFirst (zAVLCursor *avlcursor, zAVLTree const *avltree);
74extern void *zAVLNext (zAVLCursor *avlcursor);
75
76extern char * zAVL_string_get (zAVLTree * tree, const char * key);
77/* uses strdup to insert a copy */
78extern int zAVL_string_set (zAVLTree ** tree, const char * key);
79extern void zAVL_string_reset (zAVLTree * tree);
80extern void zAVL_string_del (zAVLTree * tree, const char * key);
81
82#endif
Note: See TracBrowser for help on using the repository browser.