qse/ase/awk/map.h

75 lines
1.7 KiB
C
Raw Normal View History

2006-03-02 15:10:59 +00:00
/*
2006-10-22 11:34:53 +00:00
* $Id: map.h,v 1.16 2006-10-22 11:34:53 bacon Exp $
2006-03-02 15:10:59 +00:00
*/
2006-10-22 11:34:53 +00:00
#ifndef _SSE_AWK_MAP_H_
#define _SSE_AWK_MAP_H_
2006-03-02 15:10:59 +00:00
2006-10-22 11:34:53 +00:00
#ifndef _SSE_AWK_AWK_H_
#error Never include this file directly. Include <sse/awk/awk.h> instead
2006-03-03 11:51:48 +00:00
#endif
2006-10-22 11:34:53 +00:00
typedef struct sse_awk_map_t sse_awk_map_t;
typedef struct sse_awk_pair_t sse_awk_pair_t;
2006-03-02 15:10:59 +00:00
2006-10-22 11:34:53 +00:00
struct sse_awk_pair_t
2006-03-02 15:10:59 +00:00
{
2006-10-22 11:34:53 +00:00
sse_char_t* key;
sse_size_t key_len;
2006-03-05 17:07:33 +00:00
void* val;
2006-10-22 11:34:53 +00:00
sse_awk_pair_t* next;
2006-03-02 15:10:59 +00:00
};
2006-10-22 11:34:53 +00:00
struct sse_awk_map_t
2006-03-02 15:10:59 +00:00
{
2006-04-21 17:24:31 +00:00
void* owner;
2006-10-22 11:34:53 +00:00
sse_size_t size;
sse_size_t capa;
sse_awk_pair_t** buck;
2006-04-21 17:24:31 +00:00
void (*freeval) (void*,void*);
2006-10-22 11:34:53 +00:00
sse_awk_t* awk;
sse_bool_t __dynamic;
2006-03-02 15:10:59 +00:00
};
#ifdef __cplusplus
extern "C" {
#endif
2006-10-22 11:34:53 +00:00
sse_awk_map_t* sse_awk_map_open (
sse_awk_map_t* map, void* owner, sse_size_t capa,
void(*freeval)(void*,void*), sse_awk_t* awk);
2006-08-03 05:05:48 +00:00
2006-10-22 11:34:53 +00:00
void sse_awk_map_close (sse_awk_map_t* map);
2006-03-02 15:10:59 +00:00
2006-10-22 11:34:53 +00:00
void sse_awk_map_clear (sse_awk_map_t* map);
2006-03-02 15:10:59 +00:00
2006-10-22 11:34:53 +00:00
sse_awk_pair_t* sse_awk_map_get (
sse_awk_map_t* map, const sse_char_t* key, sse_size_t key_len);
2006-08-03 05:05:48 +00:00
2006-10-22 11:34:53 +00:00
sse_awk_pair_t* sse_awk_map_put (
sse_awk_map_t* map, sse_char_t* key, sse_size_t key_len, void* val);
2006-08-03 05:05:48 +00:00
2006-10-22 11:34:53 +00:00
int sse_awk_map_putx (
sse_awk_map_t* map, sse_char_t* key, sse_size_t key_len,
void* val, sse_awk_pair_t** px);
2006-08-03 05:05:48 +00:00
2006-10-22 11:34:53 +00:00
sse_awk_pair_t* sse_awk_map_set (
sse_awk_map_t* map, sse_char_t* key, sse_size_t key_len, void* val);
2006-03-05 17:07:33 +00:00
2006-10-22 11:34:53 +00:00
sse_awk_pair_t* sse_awk_map_getpair (
sse_awk_map_t* map, const sse_char_t* key, sse_size_t key_len, void** val);
2006-08-03 05:05:48 +00:00
2006-10-22 11:34:53 +00:00
sse_awk_pair_t* sse_awk_map_setpair (
sse_awk_map_t* map, sse_awk_pair_t* pair, void* val);
2006-03-06 04:04:47 +00:00
2006-10-22 11:34:53 +00:00
int sse_awk_map_remove (sse_awk_map_t* map, sse_char_t* key, sse_size_t key_len);
2006-08-03 05:05:48 +00:00
2006-10-22 11:34:53 +00:00
int sse_awk_map_walk (sse_awk_map_t* map,
int (*walker)(sse_awk_pair_t*,void*), void* arg);
2006-03-02 15:10:59 +00:00
#ifdef __cplusplus
}
#endif
#endif