Update headers

This commit is contained in:
Gregory Lirent 2022-08-24 11:43:27 +03:00
parent 48bddb6db8
commit d7bd9be567
6 changed files with 31 additions and 4 deletions

View File

@ -1,6 +1,7 @@
/* This software is licensed by the MIT License, see LICENSE file */ /* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */ /* Copyright © 2022 Gregory Lirent */
#include "bits/__generics.h"
#include "vtype.h" #include "vtype.h"
#ifndef LIBCDSB_ARRAY_H #ifndef LIBCDSB_ARRAY_H

20
include/bits/__rbtree.h Normal file
View File

@ -0,0 +1,20 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#ifndef LIBCDSB_BITS_RBTREE_H
#define LIBCDSB_BITS_RBTREE_H
typedef enum {
RBFOREACH_UNSPECIFIED = 0x00,
RBFOREACH_REVERSE = 0x80,
RBFOREACH_INORDER = 0x01,
RBFOREACH_PREORDER = 0x02,
RBFOREACH_POSTORDER = 0x04,
RBFOREACH_BREADTH_FIRST = 0x08,
RBFOREACH_INORDER_REVERSE = RBFOREACH_INORDER | RBFOREACH_REVERSE,
RBFOREACH_PREORDER_REVERSE = RBFOREACH_PREORDER | RBFOREACH_REVERSE,
RBFOREACH_POSTORDER_REVERSE = RBFOREACH_POSTORDER | RBFOREACH_REVERSE,
RBFOREACH_BREADTH_FIRST_REVERSE = RBFOREACH_BREADTH_FIRST | RBFOREACH_REVERSE
} rbforeach_t;
#endif /* LIBCDSB_BITS_RBTREE_H */

View File

@ -1,6 +1,7 @@
/* This software is licensed by the MIT License, see LICENSE file */ /* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */ /* Copyright © 2022 Gregory Lirent */
#include "bits/__generics.h"
#include "vtype.h" #include "vtype.h"
#ifndef LIBCDSB_DICT_H #ifndef LIBCDSB_DICT_H

View File

@ -1,6 +1,7 @@
/* This software is licensed by the MIT License, see LICENSE file */ /* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */ /* Copyright © 2022 Gregory Lirent */
#include "bits/__generics.h"
#include "vtype.h" #include "vtype.h"
#ifndef LIBCDSB_LIST_H #ifndef LIBCDSB_LIST_H

View File

@ -1,6 +1,8 @@
/* This software is licensed by the MIT License, see LICENSE file */ /* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */ /* Copyright © 2022 Gregory Lirent */
#include "bits/__generics.h"
#include "bits/__rbtree.h"
#include "vtype.h" #include "vtype.h"
#ifndef LIBCDSB_MAP_H #ifndef LIBCDSB_MAP_H
@ -18,7 +20,7 @@ extern void map_init(vtype_map* x, vtype key_type) Nonnull__(1);
#define map_get(x, key, data, callback) libcdsb_map_find (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), data, callback, 0) #define map_get(x, key, data, callback) libcdsb_map_find (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), data, callback, 0)
#define map_update(x, key, value) libcdsb_map_update (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)) #define map_update(x, key, value) libcdsb_map_update (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define map_inject(x, key, value) libcdsb_map_inject (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)) #define map_inject(x, key, value) libcdsb_map_inject (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define map_foreach(x, data, callback) libcdsb_map_foreach (x, data, callback, 0) #define map_foreach(x, data, callback) libcdsb_map_foreach (x, data, callback, RBFOREACH_UNSPECIFIED, 0)
#define map_remove(x, key) map_pop (x, key, 0, 0) #define map_remove(x, key) map_pop (x, key, 0, 0)
#define in_map(x, key) (map_get(x, key, 0, 0) == 0) #define in_map(x, key) (map_get(x, key, 0, 0) == 0)
@ -28,6 +30,6 @@ extern void map_init(vtype_map* x, vtype key_type) Nonnull__(1);
extern bool libcdsb_map_update (vtype_map* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1); extern bool libcdsb_map_update (vtype_map* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1);
extern bool libcdsb_map_inject (vtype_map* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1); extern bool libcdsb_map_inject (vtype_map* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1);
extern int libcdsb_map_find (vtype_map* x, const void* key, vtype key_type, void* data, map_access_callback, bool cut) Nonnull__(1); extern int libcdsb_map_find (vtype_map* x, const void* key, vtype key_type, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_foreach(vtype_map* x, void* data, map_access_callback, bool flush) Nonnull__(1,3); extern int libcdsb_map_foreach(vtype_map* x, void* data, map_access_callback, rbforeach_t, bool flush) Nonnull__(1,3);
#endif /* LIBCDSB_MAP_H */ #endif /* LIBCDSB_MAP_H */

View File

@ -1,6 +1,8 @@
/* This software is licensed by the MIT License, see LICENSE file */ /* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */ /* Copyright © 2022 Gregory Lirent */
#include "bits/__generics.h"
#include "bits/__rbtree.h"
#include "vtype.h" #include "vtype.h"
#ifndef LIBCDSB_SET_H #ifndef LIBCDSB_SET_H
@ -18,7 +20,7 @@ extern void vset_init(vtype_set* x, vtype type) Nonnull__(1);
#define vset_get(x, value, data, callback) libcdsb_vset_find (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), data, callback, 0) #define vset_get(x, value, data, callback) libcdsb_vset_find (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), data, callback, 0)
#define vset_push(x, value) libcdsb_vset_insert (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)) #define vset_push(x, value) libcdsb_vset_insert (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define vset_attach(x, value) libcdsb_vset_attach (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)) #define vset_attach(x, value) libcdsb_vset_attach (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define vset_foreach(x, data, callback) libcdsb_vset_foreach(x, data, callback, 0) #define vset_foreach(x, data, callback) libcdsb_vset_foreach(x, data, callback, RBFOREACH_UNSPECIFIED, 0)
#define vset_remove(x, value) vset_pop (x, value, 0, 0) #define vset_remove(x, value) vset_pop (x, value, 0, 0)
#define in_vset(x, value) (vset_get(x, value, 0, 0) == 0) #define in_vset(x, value) (vset_get(x, value, 0, 0) == 0)
@ -28,6 +30,6 @@ extern void vset_init(vtype_set* x, vtype type) Nonnull__(1);
extern bool libcdsb_vset_insert (vtype_set* x, const void* value, vtype type) Nonnull__(1); extern bool libcdsb_vset_insert (vtype_set* x, const void* value, vtype type) Nonnull__(1);
extern bool libcdsb_vset_attach (vtype_set* x, const void* value, vtype type) Nonnull__(1); extern bool libcdsb_vset_attach (vtype_set* x, const void* value, vtype type) Nonnull__(1);
extern int libcdsb_vset_find (vtype_set* x, const void* value, vtype type, void* data, vset_access_callback, bool cut) Nonnull__(1); extern int libcdsb_vset_find (vtype_set* x, const void* value, vtype type, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_foreach(vtype_set* x, void* data, vset_access_callback, bool flush) Nonnull__(1,3); extern int libcdsb_vset_foreach(vtype_set* x, void* data, vset_access_callback, rbforeach_t, bool flush) Nonnull__(1,3);
#endif /* LIBCDSB_SET_H */ #endif /* LIBCDSB_SET_H */