Hash :
d40d21bc
Author :
Thomas de Grivel
Date :
2024-08-13T13:57:51
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 47 48 49
/* kc3
* Copyright 2022,2023,2024 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 LIBKC3_MAP_H
#define LIBKC3_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 char *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 char *p);
s_map * map_new_from_lists (const s_list *keys, const s_list *values);
/* Operators. */
s_map * map_set (s_map *map, const s_tag *key, const s_tag *value);
s_map * map_sort (s_map *map);
/* Observers. */
s_tag * map_access (const s_map *map, const s_list * const *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);
const s_sym ** map_get_type (const s_map *map, const s_tag *key,
const s_sym **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 /* LIBKC3_MAP_H */