57 lines
1.8 KiB
C
57 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 <stdbool.h> // bool
|
|
#include <stddef.h> // size_t
|
|
#include <stdint.h> // uintmax_t
|
|
|
|
#ifndef CORELIBS_GUARD_BASEVEN
|
|
#define CORELIBS_GUARD_BASEVEN
|
|
|
|
typedef signed short int cl_baseven_err;
|
|
typedef struct cl_baseven_t cl_baseven_t;
|
|
|
|
struct corelibs_baseven_interface {
|
|
|
|
cl_baseven_err (*const encode) (const uint8_t *src, size_t len, uint8_t *dest, size_t cap);
|
|
cl_baseven_err (*const decode) (const uint8_t *src, size_t len, uint8_t *dest, size_t cap);
|
|
|
|
// Errors - functions return them on run-time problems
|
|
const struct {
|
|
|
|
const cl_baseven_err ok, // No error
|
|
unknown; // Unknown error
|
|
|
|
const struct {
|
|
const cl_baseven_err alloc, // Memory allocation failed
|
|
overflow; // Not enough memory to run
|
|
} mem;
|
|
|
|
const struct {
|
|
const cl_baseven_err undef, // Undefined variable
|
|
inval, // Invalid variable
|
|
ncompat; // Incompatible variable
|
|
} var;
|
|
|
|
} err;
|
|
};
|
|
extern const struct corelibs_baseven_interface cl_baseven;
|
|
|
|
#endif /* CORELIBS_GUARD_BASEVEN */
|
|
|