2022-06-02 15:52:43 +03:00
|
|
|
/* This software is licensed by the MIT License, see LICENSE file */
|
|
|
|
/* Copyright © 2022 Gregory Lirent */
|
|
|
|
|
|
|
|
#include "../array.h"
|
|
|
|
|
|
|
|
#ifndef LIBCDSB_EXTRA_ARRAY_H
|
|
|
|
#define LIBCDSB_EXTRA_ARRAY_H
|
|
|
|
|
2022-06-08 09:57:41 +03:00
|
|
|
typedef int (*array_foreach_callback)(void* value, ssize_t index, vtype type, void* data);
|
|
|
|
|
|
|
|
|
2022-06-04 21:52:00 +03:00
|
|
|
#define array_get(x, s, index) libcdsb_array_get(x, s, index, 0)
|
|
|
|
#define array_pop(x, s, index) libcdsb_array_get(x, s, index, 1)
|
|
|
|
#define array_remove(s, index) libcdsb_array_get(0, s, index, 1)
|
|
|
|
|
2022-06-08 09:57:41 +03:00
|
|
|
#define array_foreach(x, data, callback) libcdsb_array_foreach(x, data, callback, 0)
|
2022-06-06 11:22:48 +03:00
|
|
|
|
2022-06-04 21:52:00 +03:00
|
|
|
extern ssize_t libcdsb_array_get(vtype_value* x, vtype_array* s, ssize_t index, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn2__;
|
|
|
|
|
2022-06-05 20:01:10 +03:00
|
|
|
extern ssize_t libcdsb_array_find(const vtype_array* x, const void* value, vtype value_type) LIBCDSB_nt__ LIBCDSB_nn1__;
|
|
|
|
extern ssize_t libcdsb_array_push( vtype_array* x, const void* value, vtype value_type) LIBCDSB_nt__ LIBCDSB_nn1__;
|
|
|
|
|
2022-06-08 09:57:41 +03:00
|
|
|
extern int libcdsb_array_foreach(vtype_array* x, void* data, array_foreach_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__;
|
2022-06-02 15:52:43 +03:00
|
|
|
|
|
|
|
#endif /* LIBCDSB_EXTRA_ARRAY_H */
|