Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 83 lines (66 sloc) 2.975 kB
87dfa5d @derickr - Implemented FR #131: XDebug needs to implement paged child object r…
derickr authored
1 /* $Id: xdebug_hash.h,v 1.2 2006-01-22 23:30:59 derick Exp $ */
fcc0a12 @derickr - Updated error handling from debug commands
derickr authored
2
3 /* The contents of this file are subject to the Vulcan Logic Public
4 * License Version 1.1 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of
6 * the License at http://www.vl-srm.net/vlpl/
7 *
8 * Software distributed under the License is distributed on an "AS
9 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 * implied. See the License for the specific language governing
11 * rights and limitations under the License.
12 *
13 * The Original Code is vl-srm.net code.
14 *
15 * The Initial Developer of the Original Code is the Vulcan Logic
16 * Group. Portions created by Vulcan Logic Group are Copyright (C)
17 * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
18 *
19 * Contributor(s):
20 */
21
22 #ifndef __XDEBUG_HASH_H__
23 #define __XDEBUG_HASH_H__
24
25 #include <stddef.h>
26
27 #include "xdebug_llist.h"
28
29 #define XDEBUG_HASH_KEY_IS_STRING 0
30 #define XDEBUG_HASH_KEY_IS_NUM 1
31
32 #define xdebug_ui32 unsigned long
33
34 typedef void (*xdebug_hash_dtor)(void *);
35
36 typedef struct _xdebug_hash {
37 xdebug_llist **table;
38 xdebug_hash_dtor dtor;
39 int slots;
40 size_t size;
41 } xdebug_hash;
42
43 typedef struct _xdebug_hash_key {
44 union {
45 struct {
46 char *val;
47 unsigned int len;
48 } str;
49
50 unsigned long num;
51 } value;
52
53 int type;
54 } xdebug_hash_key;
55
56 typedef struct _xdebug_hash_element {
57 void *ptr;
58 xdebug_hash_key key;
59 } xdebug_hash_element;
60
61 /* Helper functions */
62 char* xdebug_hash_key_to_str(xdebug_hash_key* key, int* new_len);
63
64 /* Standard functions */
65 xdebug_hash *xdebug_hash_alloc(int slots, xdebug_hash_dtor dtor);
66 int xdebug_hash_add_or_update(xdebug_hash *h, char *str_key, unsigned int str_key_len, unsigned long num_key, const void *p);
67 int xdebug_hash_extended_delete(xdebug_hash *h, char *str_key, unsigned int str_key_len, unsigned long num_key);
68 int xdebug_hash_extended_find(xdebug_hash *h, char *str_key, unsigned int str_key_len, unsigned long num_key, void **p);
69 void xdebug_hash_apply(xdebug_hash *h, void *user, void (*cb)(void *, xdebug_hash_element *));
87dfa5d @derickr - Implemented FR #131: XDebug needs to implement paged child object r…
derickr authored
70 void xdebug_hash_apply_with_argument(xdebug_hash *h, void *user, void (*cb)(void *, xdebug_hash_element *, void *), void *argument);
fcc0a12 @derickr - Updated error handling from debug commands
derickr authored
71 void xdebug_hash_destroy(xdebug_hash *h);
72
73 #define xdebug_hash_find(h, key, key_len, p) xdebug_hash_extended_find(h, key, key_len, 0, p)
74 #define xdebug_hash_delete(h, key, key_len) xdebug_hash_extended_delete(h, key, key_len, 0)
75 #define xdebug_hash_add(h, key, key_len, p) xdebug_hash_add_or_update(h, key, key_len, 0, p)
76 #define xdebug_hash_update xdebug_hash_add
77 #define xdebug_hash_index_find(h, key, p) xdebug_hash_extended_find(h, NULL, 0, key, p)
78 #define xdebug_hash_index_delete(h, key) xdebug_hash_extended_delete(h, NULL, 0, key)
79 #define xdebug_hash_index_add(h, key, p) xdebug_hash_add_or_update(h, NULL, 0, key, p)
80 #define xdebug_hash_index_update xdebug_hash_index_add
81
82 #endif /* __XDEBUG_HASH_H__ */
Something went wrong with that request. Please try again.