24 lines
1.2 KiB
C
24 lines
1.2 KiB
C
/* 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
|
|
|
|
typedef int (*array_access_callback)(void* value, ssize_t index, vtype type, void* data);
|
|
|
|
#define array_get(s, index, data, callback) libcdsb_array_get(s, index, data, callback, 0)
|
|
#define array_pop(s, index, data, callback) libcdsb_array_get(s, index, data, callback, 1)
|
|
#define array_remove(s, index) libcdsb_array_get(s, index, 0, 0, 1)
|
|
|
|
#define array_foreach(x, data, callback) libcdsb_array_foreach(x, data, callback, 0)
|
|
|
|
extern int libcdsb_array_get (vtype_array* x, ssize_t index, void* data, array_access_callback, vtype_bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
|
|
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__;
|
|
|
|
extern int libcdsb_array_foreach(vtype_array* x, void* data, array_access_callback, vtype_bool flush) LIBCDSB_nt__ LIBCDSB_nn13__;
|
|
|
|
#endif /* LIBCDSB_EXTRA_ARRAY_H */
|