Hash :
39820f94
Author :
Thomas de Grivel
Date :
2023-12-15T21:24:43
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
/* c3
* Copyright 2022,2023 kmx.io <contact@kmx.io>
*
* Permission is hereby granted to use this software granted the above
* copyright notice and this permission paragraph are included in all
* copies and substantial portions of this software.
*
* THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
* PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
#ifndef LIBC3_MAP_H
#define LIBC3_MAP_H
#include "types.h"
/* Stack allocation compatible functions, call map_clean after use. */
void map_clean (s_map *map);
s_map * map_init (s_map *map, uw size);
s_map * map_init_1 (s_map *map, const s8 *p);
s_map * map_init_cast (s_map *map, const s_tag *tag);
s_map * map_init_copy (s_map *map, const s_map *src);
s_map * map_init_from_lists (s_map *map, const s_list *keys,
const s_list *values);
/* Heap allocation functions, call map_delete after use. */
void map_delete (s_map *map);
s_map * map_new (uw size);
s_map * map_new_1 (const s8 *p);
s_map * map_new_from_lists (const s_list *keys, const s_list *values);
/* Modifiers */
s_map * map_set (s_map *map, const s_tag *key, const s_tag *value);
s_map * map_sort (s_map *map);
/* Operators */
s_tag * map_access (const s_map *map, const s_tag *key, s_tag *value);
s_map * map_cast (const s_tag *tag, s_map *map);
s_tag * map_get (const s_map *map, const s_tag *key, s_tag *dest);
s_map * map_update (const s_map *map, const s_tag *key,
const s_tag *value, s_map *dest);
s_map * map_update_list (const s_map *map, const s_list *alist,
s_map *dest);
#endif /* LIBC3_MAP_H */