~burner/xsb/debianized-xsb

« back to all changes in this revision

Viewing changes to packages/xpath/cc/libxml/hash.h

  • Committer: Michael R. Head
  • Date: 2006-09-06 22:11:55 UTC
  • Revision ID: burner@n23-20060906221155-7e398d23438a7ee4
Add the files from the 3.0.1 release package

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Summary: Chained hash tables
 
3
 * Description: This module implements the hash table support used in 
 
4
 *              various places in the library.
 
5
 *
 
6
 * Copy: See Copyright for the status of this software.
 
7
 *
 
8
 * Author: Bjorn Reese <bjorn.reese@systematic.dk>
 
9
 */
 
10
 
 
11
#ifndef __XML_HASH_H__
 
12
#define __XML_HASH_H__
 
13
 
 
14
#ifdef __cplusplus
 
15
extern "C" {
 
16
#endif
 
17
 
 
18
/*
 
19
 * The hash table.
 
20
 */
 
21
typedef struct _xmlHashTable xmlHashTable;
 
22
typedef xmlHashTable *xmlHashTablePtr;
 
23
 
 
24
#ifdef __cplusplus
 
25
}
 
26
#endif
 
27
 
 
28
#include <libxml/xmlversion.h>
 
29
#include <libxml/parser.h>
 
30
 
 
31
#ifdef __cplusplus
 
32
extern "C" {
 
33
#endif
 
34
 
 
35
/*
 
36
 * Recent version of gcc produce a warning when a function pointer is assigned
 
37
 * to an object pointer, or vice versa.  The following macro is a dirty hack
 
38
 * to allow suppression of the warning.  If your architecture has function
 
39
 * pointers which are a different size than a void pointer, there may be some
 
40
 * serious trouble within the library.
 
41
 */
 
42
/**
 
43
 * XML_CAST_FPTR:
 
44
 * @fptr:  pointer to a function
 
45
 *
 
46
 * Macro to do a casting from an object pointer to a
 
47
 * function pointer without encountering a warning from
 
48
 * gcc
 
49
 *
 
50
 */
 
51
#define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
 
52
 
 
53
/*
 
54
 * function types:
 
55
 */
 
56
/**
 
57
 * xmlHashDeallocator:
 
58
 * @payload:  the data in the hash
 
59
 * @name:  the name associated
 
60
 *
 
61
 * Callback to free data from a hash.
 
62
 */
 
63
typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
 
64
/**
 
65
 * xmlHashCopier:
 
66
 * @payload:  the data in the hash
 
67
 * @name:  the name associated
 
68
 *
 
69
 * Callback to copy data from a hash.
 
70
 *
 
71
 * Returns a copy of the data or NULL in case of error.
 
72
 */
 
73
typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
 
74
/**
 
75
 * xmlHashScanner:
 
76
 * @payload:  the data in the hash
 
77
 * @data:  extra scannner data
 
78
 * @name:  the name associated
 
79
 *
 
80
 * Callback when scanning data in a hash with the simple scanner.
 
81
 */
 
82
typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);
 
83
/**
 
84
 * xmlHashScannerFull:
 
85
 * @payload:  the data in the hash
 
86
 * @data:  extra scannner data
 
87
 * @name:  the name associated
 
88
 * @name2:  the second name associated
 
89
 * @name3:  the third name associated
 
90
 *
 
91
 * Callback when scanning data in a hash with the full scanner.
 
92
 */
 
93
typedef void (*xmlHashScannerFull)(void *payload, void *data,
 
94
                                   const xmlChar *name, const xmlChar *name2,
 
95
                                   const xmlChar *name3);
 
96
 
 
97
/*
 
98
 * Constructor and destructor.
 
99
 */
 
100
XMLPUBFUN xmlHashTablePtr XMLCALL
 
101
                        xmlHashCreate   (int size);
 
102
XMLPUBFUN void XMLCALL                  
 
103
                        xmlHashFree     (xmlHashTablePtr table,
 
104
                                         xmlHashDeallocator f);
 
105
 
 
106
/*
 
107
 * Add a new entry to the hash table.
 
108
 */
 
109
XMLPUBFUN int XMLCALL                   
 
110
                        xmlHashAddEntry (xmlHashTablePtr table,
 
111
                                         const xmlChar *name,
 
112
                                         void *userdata);
 
113
XMLPUBFUN int XMLCALL                   
 
114
                        xmlHashUpdateEntry(xmlHashTablePtr table,
 
115
                                         const xmlChar *name,
 
116
                                         void *userdata,
 
117
                                         xmlHashDeallocator f);
 
118
XMLPUBFUN int XMLCALL               
 
119
                        xmlHashAddEntry2(xmlHashTablePtr table,
 
120
                                         const xmlChar *name,
 
121
                                         const xmlChar *name2,
 
122
                                         void *userdata);
 
123
XMLPUBFUN int XMLCALL                   
 
124
                        xmlHashUpdateEntry2(xmlHashTablePtr table,
 
125
                                         const xmlChar *name,
 
126
                                         const xmlChar *name2,
 
127
                                         void *userdata,
 
128
                                         xmlHashDeallocator f);
 
129
XMLPUBFUN int XMLCALL                   
 
130
                        xmlHashAddEntry3(xmlHashTablePtr table,
 
131
                                         const xmlChar *name,
 
132
                                         const xmlChar *name2,
 
133
                                         const xmlChar *name3,
 
134
                                         void *userdata);
 
135
XMLPUBFUN int XMLCALL                   
 
136
                        xmlHashUpdateEntry3(xmlHashTablePtr table,
 
137
                                         const xmlChar *name,
 
138
                                         const xmlChar *name2,
 
139
                                         const xmlChar *name3,
 
140
                                         void *userdata,
 
141
                                         xmlHashDeallocator f);
 
142
 
 
143
/*
 
144
 * Remove an entry from the hash table.
 
145
 */
 
146
XMLPUBFUN int XMLCALL     
 
147
                        xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
 
148
                           xmlHashDeallocator f);
 
149
XMLPUBFUN int XMLCALL     
 
150
                        xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
 
151
                            const xmlChar *name2, xmlHashDeallocator f);
 
152
XMLPUBFUN int  XMLCALL    
 
153
                        xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
 
154
                            const xmlChar *name2, const xmlChar *name3,
 
155
                            xmlHashDeallocator f);
 
156
 
 
157
/*
 
158
 * Retrieve the userdata.
 
159
 */
 
160
XMLPUBFUN void * XMLCALL                        
 
161
                        xmlHashLookup   (xmlHashTablePtr table,
 
162
                                         const xmlChar *name);
 
163
XMLPUBFUN void * XMLCALL                        
 
164
                        xmlHashLookup2  (xmlHashTablePtr table,
 
165
                                         const xmlChar *name,
 
166
                                         const xmlChar *name2);
 
167
XMLPUBFUN void * XMLCALL                        
 
168
                        xmlHashLookup3  (xmlHashTablePtr table,
 
169
                                         const xmlChar *name,
 
170
                                         const xmlChar *name2,
 
171
                                         const xmlChar *name3);
 
172
XMLPUBFUN void * XMLCALL                        
 
173
                        xmlHashQLookup  (xmlHashTablePtr table,
 
174
                                         const xmlChar *name,
 
175
                                         const xmlChar *prefix);
 
176
XMLPUBFUN void * XMLCALL                        
 
177
                        xmlHashQLookup2 (xmlHashTablePtr table,
 
178
                                         const xmlChar *name,
 
179
                                         const xmlChar *prefix,
 
180
                                         const xmlChar *name2,
 
181
                                         const xmlChar *prefix2);
 
182
XMLPUBFUN void * XMLCALL                        
 
183
                        xmlHashQLookup3 (xmlHashTablePtr table,
 
184
                                         const xmlChar *name,
 
185
                                         const xmlChar *prefix,
 
186
                                         const xmlChar *name2,
 
187
                                         const xmlChar *prefix2,
 
188
                                         const xmlChar *name3,
 
189
                                         const xmlChar *prefix3);
 
190
 
 
191
/*
 
192
 * Helpers.
 
193
 */
 
194
XMLPUBFUN xmlHashTablePtr XMLCALL               
 
195
                        xmlHashCopy     (xmlHashTablePtr table,
 
196
                                         xmlHashCopier f);
 
197
XMLPUBFUN int XMLCALL                   
 
198
                        xmlHashSize     (xmlHashTablePtr table);
 
199
XMLPUBFUN void XMLCALL                  
 
200
                        xmlHashScan     (xmlHashTablePtr table,
 
201
                                         xmlHashScanner f,
 
202
                                         void *data);
 
203
XMLPUBFUN void XMLCALL                  
 
204
                        xmlHashScan3    (xmlHashTablePtr table,
 
205
                                         const xmlChar *name,
 
206
                                         const xmlChar *name2,
 
207
                                         const xmlChar *name3,
 
208
                                         xmlHashScanner f,
 
209
                                         void *data);
 
210
XMLPUBFUN void XMLCALL                  
 
211
                        xmlHashScanFull (xmlHashTablePtr table,
 
212
                                         xmlHashScannerFull f,
 
213
                                         void *data);
 
214
XMLPUBFUN void XMLCALL                  
 
215
                        xmlHashScanFull3(xmlHashTablePtr table,
 
216
                                         const xmlChar *name,
 
217
                                         const xmlChar *name2,
 
218
                                         const xmlChar *name3,
 
219
                                         xmlHashScannerFull f,
 
220
                                         void *data);
 
221
#ifdef __cplusplus
 
222
}
 
223
#endif
 
224
#endif /* ! __XML_HASH_H__ */