2006-03-02 15:10:59 +00:00
|
|
|
/*
|
2006-06-16 14:31:42 +00:00
|
|
|
* $Id: map.h,v 1.12 2006-06-16 14:31:42 bacon Exp $
|
2006-03-02 15:10:59 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _XP_AWK_MAP_H_
|
|
|
|
#define _XP_AWK_MAP_H_
|
|
|
|
|
2006-03-03 11:51:48 +00:00
|
|
|
#ifndef _XP_AWK_AWK_H_
|
|
|
|
#error Never include this file directly. Include <xp/awk/awk.h> instead
|
|
|
|
#endif
|
|
|
|
|
2006-03-02 15:10:59 +00:00
|
|
|
typedef struct xp_awk_map_t xp_awk_map_t;
|
|
|
|
typedef struct xp_awk_pair_t xp_awk_pair_t;
|
|
|
|
|
|
|
|
struct xp_awk_pair_t
|
|
|
|
{
|
|
|
|
xp_char_t* key;
|
2006-03-05 17:07:33 +00:00
|
|
|
void* val;
|
2006-03-02 15:10:59 +00:00
|
|
|
xp_awk_pair_t* next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct xp_awk_map_t
|
|
|
|
{
|
2006-04-21 17:24:31 +00:00
|
|
|
void* owner;
|
2006-03-02 15:10:59 +00:00
|
|
|
xp_size_t size;
|
|
|
|
xp_size_t capa;
|
|
|
|
xp_awk_pair_t** buck;
|
2006-04-21 17:24:31 +00:00
|
|
|
void (*freeval) (void*,void*);
|
2006-03-02 15:10:59 +00:00
|
|
|
xp_bool_t __dynamic;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2006-04-24 07:46:35 +00:00
|
|
|
xp_awk_map_t* xp_awk_map_open (xp_awk_map_t* map,
|
|
|
|
void* owner, xp_size_t capa, void(*freeval)(void*,void*));
|
2006-03-02 15:10:59 +00:00
|
|
|
void xp_awk_map_close (xp_awk_map_t* map);
|
|
|
|
|
|
|
|
void xp_awk_map_clear (xp_awk_map_t* map);
|
|
|
|
|
2006-03-06 04:04:47 +00:00
|
|
|
xp_awk_pair_t* xp_awk_map_get (xp_awk_map_t* map, xp_char_t* key);
|
2006-03-05 17:07:33 +00:00
|
|
|
xp_awk_pair_t* xp_awk_map_put (xp_awk_map_t* map, xp_char_t* key, void* val);
|
2006-04-18 14:49:42 +00:00
|
|
|
int xp_awk_map_putx (xp_awk_map_t* map, xp_char_t* key, void* val, xp_awk_pair_t** px);
|
2006-03-05 17:07:33 +00:00
|
|
|
xp_awk_pair_t* xp_awk_map_set (xp_awk_map_t* map, xp_char_t* key, void* val);
|
|
|
|
|
2006-03-06 04:04:47 +00:00
|
|
|
xp_awk_pair_t* xp_awk_map_getpair (
|
2006-03-07 15:55:14 +00:00
|
|
|
xp_awk_map_t* map, xp_char_t* key, void** val);
|
2006-03-06 04:04:47 +00:00
|
|
|
xp_awk_pair_t* xp_awk_map_setpair (
|
2006-03-07 15:55:14 +00:00
|
|
|
xp_awk_map_t* map, xp_awk_pair_t* pair, void* val);
|
2006-03-06 04:04:47 +00:00
|
|
|
|
|
|
|
int xp_awk_map_remove (xp_awk_map_t* map, xp_char_t* key);
|
2006-04-30 17:12:51 +00:00
|
|
|
int xp_awk_map_walk (xp_awk_map_t* map,
|
|
|
|
int (*walker)(xp_awk_pair_t*,void*), void* arg);
|
2006-03-02 15:10:59 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|