qse/ase/awk/map.h

79 lines
1.7 KiB
C
Raw Normal View History

2006-03-02 15:10:59 +00:00
/*
2007-02-03 10:47:41 +00:00
* $Id: map.h,v 1.19 2007-02-03 10:47:41 bacon Exp $
*
* {License}
2006-03-02 15:10:59 +00:00
*/
2006-10-24 04:10:12 +00:00
#ifndef _ASE_AWK_MAP_H_
#define _ASE_AWK_MAP_H_
2006-03-02 15:10:59 +00:00
2006-10-24 04:10:12 +00:00
#ifndef _ASE_AWK_AWK_H_
#error Never include this file directly. Include <ase/awk/awk.h> instead
2006-03-03 11:51:48 +00:00
#endif
2006-10-24 04:10:12 +00:00
typedef struct ase_awk_map_t ase_awk_map_t;
typedef struct ase_awk_pair_t ase_awk_pair_t;
2006-03-02 15:10:59 +00:00
2006-10-24 04:10:12 +00:00
struct ase_awk_pair_t
2006-03-02 15:10:59 +00:00
{
2006-10-24 04:10:12 +00:00
ase_char_t* key;
ase_size_t key_len;
2006-03-05 17:07:33 +00:00
void* val;
2006-10-24 04:10:12 +00:00
ase_awk_pair_t* next;
2006-03-02 15:10:59 +00:00
};
2006-10-24 04:10:12 +00:00
struct ase_awk_map_t
2006-03-02 15:10:59 +00:00
{
2006-04-21 17:24:31 +00:00
void* owner;
2006-10-24 04:10:12 +00:00
ase_size_t size;
ase_size_t capa;
ase_awk_pair_t** buck;
2006-04-21 17:24:31 +00:00
void (*freeval) (void*,void*);
2006-10-24 04:10:12 +00:00
ase_awk_t* awk;
ase_bool_t __dynamic;
2006-03-02 15:10:59 +00:00
};
#ifdef __cplusplus
extern "C" {
#endif
2006-10-24 04:10:12 +00:00
ase_awk_map_t* ase_awk_map_open (
ase_awk_map_t* map, void* owner, ase_size_t capa,
void(*freeval)(void*,void*), ase_awk_t* awk);
2006-08-03 05:05:48 +00:00
2006-10-24 04:10:12 +00:00
void ase_awk_map_close (ase_awk_map_t* map);
2006-03-02 15:10:59 +00:00
2006-10-24 04:10:12 +00:00
void ase_awk_map_clear (ase_awk_map_t* map);
2006-03-02 15:10:59 +00:00
2006-12-11 08:44:52 +00:00
ase_size_t ase_awk_map_getsize (ase_awk_map_t* map);
2006-10-24 04:10:12 +00:00
ase_awk_pair_t* ase_awk_map_get (
ase_awk_map_t* map, const ase_char_t* key, ase_size_t key_len);
2006-08-03 05:05:48 +00:00
2006-10-24 04:10:12 +00:00
ase_awk_pair_t* ase_awk_map_put (
ase_awk_map_t* map, ase_char_t* key, ase_size_t key_len, void* val);
2006-08-03 05:05:48 +00:00
2006-10-24 04:10:12 +00:00
int ase_awk_map_putx (
ase_awk_map_t* map, ase_char_t* key, ase_size_t key_len,
void* val, ase_awk_pair_t** px);
2006-08-03 05:05:48 +00:00
2006-10-24 04:10:12 +00:00
ase_awk_pair_t* ase_awk_map_set (
ase_awk_map_t* map, ase_char_t* key, ase_size_t key_len, void* val);
2006-03-05 17:07:33 +00:00
2006-10-24 04:10:12 +00:00
ase_awk_pair_t* ase_awk_map_getpair (
ase_awk_map_t* map, const ase_char_t* key, ase_size_t key_len, void** val);
2006-08-03 05:05:48 +00:00
2006-10-24 04:10:12 +00:00
ase_awk_pair_t* ase_awk_map_setpair (
ase_awk_map_t* map, ase_awk_pair_t* pair, void* val);
2006-03-06 04:04:47 +00:00
2006-10-24 04:10:12 +00:00
int ase_awk_map_remove (ase_awk_map_t* map, ase_char_t* key, ase_size_t key_len);
2006-08-03 05:05:48 +00:00
2006-10-24 04:10:12 +00:00
int ase_awk_map_walk (ase_awk_map_t* map,
int (*walker)(ase_awk_pair_t*,void*), void* arg);
2006-03-02 15:10:59 +00:00
#ifdef __cplusplus
}
#endif
#endif