51 lines
1.8 KiB
C
51 lines
1.8 KiB
C
/*
|
|
* This file is part of corelibs. (https://git.redxen.eu/corelibs)
|
|
* Copyright (c) 2021 Alex-David Denes
|
|
*
|
|
* corelibs is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* any later version.
|
|
*
|
|
* corelibs is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with corelibs. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "types/error/error.h"
|
|
|
|
#include <stdint.h> // uintmax_t
|
|
|
|
#ifndef CORELIBS_GUARD_LLIST
|
|
#define CORELIBS_GUARD_LLIST
|
|
|
|
typedef struct cl_llist_t cl_llist_t;
|
|
|
|
struct corelibs_llist_interface {
|
|
cl_error_t (*const create) (void *content, void (*const free_function) (void *), cl_llist_t **save);
|
|
cl_error_t (*const link) (uintmax_t elements, ...);
|
|
cl_error_t (*const rep) (cl_llist_t *dest, cl_llist_t *src);
|
|
const struct {
|
|
cl_error_t (*const list) (cl_llist_t *element);
|
|
cl_error_t (*const elem) (cl_llist_t *element);
|
|
cl_error_t (*const cont) (cl_llist_t *element);
|
|
} free;
|
|
const struct {
|
|
cl_error_t (*const cont) (cl_llist_t *element, void *content);
|
|
cl_error_t (*const free) (cl_llist_t *element, void (*const free_function) (void *));
|
|
} set;
|
|
const struct {
|
|
cl_error_t (*const prev) (const cl_llist_t *element, cl_llist_t **save);
|
|
cl_error_t (*const next) (const cl_llist_t *element, cl_llist_t **save);
|
|
cl_error_t (*const cont) (const cl_llist_t *element, void **save);
|
|
} get;
|
|
};
|
|
extern const struct corelibs_llist_interface cl_llist;
|
|
|
|
#endif /* CORELIBS_GUARD_LLIST */
|
|
|