version 1.1.1.1, 2012/02/21 17:26:11
|
version 1.1.1.2, 2012/10/09 09:22:28
|
Line 22
|
Line 22
|
#define DICT_H |
#define DICT_H |
|
|
#include <limits.h> |
#include <limits.h> |
#ifdef KAZLIB_SIDEEFFECT_DEBUG |
|
#include "sfx.h" |
|
#endif |
|
|
|
/* |
/* |
* Blurb for inclusion into C++ translation units |
* Blurb for inclusion into C++ translation units |
Line 44 typedef unsigned long dictcount_t;
|
Line 41 typedef unsigned long dictcount_t;
|
typedef enum { dnode_red, dnode_black } dnode_color_t; |
typedef enum { dnode_red, dnode_black } dnode_color_t; |
|
|
typedef struct dnode_t { |
typedef struct dnode_t { |
#if defined(DICT_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) |
|
struct dnode_t *dict_left; |
struct dnode_t *dict_left; |
struct dnode_t *dict_right; |
struct dnode_t *dict_right; |
struct dnode_t *dict_parent; |
struct dnode_t *dict_parent; |
dnode_color_t dict_color; |
dnode_color_t dict_color; |
const void *dict_key; |
const void *dict_key; |
void *dict_data; |
void *dict_data; |
#else |
|
int dict_dummy; |
|
#endif |
|
} dnode_t; |
} dnode_t; |
|
|
typedef int (*dict_comp_t)(const void *, const void *); |
typedef int (*dict_comp_t)(const void *, const void *); |
Line 61 typedef dnode_t *(*dnode_alloc_t)(void *);
|
Line 54 typedef dnode_t *(*dnode_alloc_t)(void *);
|
typedef void (*dnode_free_t)(dnode_t *, void *); |
typedef void (*dnode_free_t)(dnode_t *, void *); |
|
|
typedef struct dict_t { |
typedef struct dict_t { |
#if defined(DICT_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) |
|
dnode_t dict_nilnode; |
dnode_t dict_nilnode; |
dictcount_t dict_nodecount; |
dictcount_t dict_nodecount; |
dictcount_t dict_maxcount; |
dictcount_t dict_maxcount; |
Line 70 typedef struct dict_t {
|
Line 62 typedef struct dict_t {
|
dnode_free_t dict_freenode; |
dnode_free_t dict_freenode; |
void *dict_context; |
void *dict_context; |
int dict_dupes; |
int dict_dupes; |
#else |
|
int dict_dummmy; |
|
#endif |
|
} dict_t; |
} dict_t; |
|
|
typedef void (*dnode_process_t)(dict_t *, dnode_t *, void *); |
typedef void (*dnode_process_t)(dict_t *, dnode_t *, void *); |
|
|
typedef struct dict_load_t { |
typedef struct dict_load_t { |
#if defined(DICT_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) |
|
dict_t *dict_dictptr; |
dict_t *dict_dictptr; |
dnode_t dict_nilnode; |
dnode_t dict_nilnode; |
#else |
|
int dict_dummmy; |
|
#endif |
|
} dict_load_t; |
} dict_load_t; |
|
|
extern dict_t *dict_create(dictcount_t, dict_comp_t); |
extern dict_t *dict_create(dictcount_t, dict_comp_t); |
Line 124 extern void dict_load_next(dict_load_t *, dnode_t *, c
|
Line 109 extern void dict_load_next(dict_load_t *, dnode_t *, c
|
extern void dict_load_end(dict_load_t *); |
extern void dict_load_end(dict_load_t *); |
extern void dict_merge(dict_t *, dict_t *); |
extern void dict_merge(dict_t *, dict_t *); |
|
|
#if defined(DICT_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) |
|
#ifdef KAZLIB_SIDEEFFECT_DEBUG |
|
#define dict_isfull(D) (SFX_CHECK(D)->dict_nodecount == (D)->dict_maxcount) |
|
#else |
|
#define dict_isfull(D) ((D)->dict_nodecount == (D)->dict_maxcount) |
#define dict_isfull(D) ((D)->dict_nodecount == (D)->dict_maxcount) |
#endif |
|
#define dict_count(D) ((D)->dict_nodecount) |
#define dict_count(D) ((D)->dict_nodecount) |
#define dict_isempty(D) ((D)->dict_nodecount == 0) |
#define dict_isempty(D) ((D)->dict_nodecount == 0) |
#define dnode_get(N) ((N)->dict_data) |
#define dnode_get(N) ((N)->dict_data) |
#define dnode_getkey(N) ((N)->dict_key) |
#define dnode_getkey(N) ((N)->dict_key) |
#define dnode_put(N, X) ((N)->dict_data = (X)) |
#define dnode_put(N, X) ((N)->dict_data = (X)) |
#endif |
|
|
|
#ifdef __cplusplus |
#ifdef __cplusplus |
} |
} |