pink26 0.1.1
Image processing and digital topology for teaching
Loading...
Searching...
No Matches
status.h
Go to the documentation of this file.
1/*
2Copyright Alain Lebret (2026)
3
4This software is an image processing library whose purpose is to be
5used primarily for research and teaching.
6
7This software is governed by the CeCILL license under French law and
8abiding by the rules of distribution of free software. You can use,
9modify and/ or redistribute the software under the terms of the CeCILL
10license as circulated by CEA, CNRS and INRIA at the following URL
11"http://www.cecill.info".
12
13As a counterpart to the access to the source code and rights to copy,
14modify and redistribute granted by the license, users are provided only
15with a limited warranty and the software's author, the holder of the
16economic rights, and the successive licensors have only limited
17liability.
18
19In this respect, the user's attention is drawn to the risks associated
20with loading, using, modifying and/or developing or reproducing the
21software by the user in light of its specific status of free software,
22that may mean that it is complicated to manipulate, and that also
23therefore means that it is reserved for developers and experienced
24professionals having in-depth computer knowledge. Users are therefore
25encouraged to load and test the software's suitability as regards their
26requirements in conditions enabling the security of their systems and/or
27data to be ensured and, more generally, to use and operate it in the
28same conditions as regards security.
29
30The fact that you are presently reading this means that you have had
31knowledge of the CeCILL license. You don't have to accept the License,
32but note that nothing other than this License grants you permission
33to use, propagate or modify any covered work.
34*/
35
45
46#ifndef PINK26_STATUS_H
47#define PINK26_STATUS_H
48
49#include <stdint.h>
50
52#if defined(_MSC_VER)
53#define P26_THREAD_LOCAL __declspec(thread)
54#else
55#define P26_THREAD_LOCAL _Thread_local
56#endif
57
64#if defined(__GNUC__) || defined(__clang__)
65#define P26_PRINTF_LIKE(fmt_index, args_index) \
66 __attribute__((format(printf, fmt_index, args_index)))
67#else
68#define P26_PRINTF_LIKE(fmt_index, args_index)
69#endif
70
72typedef int64_t p26_index;
73
86
99p26_status p26_fail(p26_status status, const char *format, ...) P26_PRINTF_LIKE(2, 3);
100
108const char *p26_last_error(void);
109
112
119const char *p26_status_name(p26_status status);
120
121#endif /* PINK26_STATUS_H */
p26_status
Result of a pink26 function.
Definition status.h:75
@ P26_E_FORMAT
Malformed or truncated file content.
Definition status.h:80
@ P26_E_UNSUPPORTED
Valid input that pink26 does not handle (e.g.
Definition status.h:81
@ P26_E_IO
A file could not be opened, read, written or closed.
Definition status.h:82
@ P26_E_TYPE
Unknown or unsupported pixel type.
Definition status.h:78
@ P26_E_NOMEM
Memory allocation failed.
Definition status.h:79
@ P26_E_OVERFLOW
A size does not fit in memory or in the integer types.
Definition status.h:83
@ P26_OK
Success.
Definition status.h:76
@ P26_E_INTERNAL
Admitted legacy Pink code aborted (a former exit() call).
Definition status.h:84
@ P26_E_INVALID_ARG
NULL pointer, bad dimension, bad connectivity...
Definition status.h:77
p26_status const char * p26_last_error(void)
Returns the last message recorded by p26_fail() in the calling thread.
int64_t p26_index
Pixel index or size in pixels (64-bit, so large 3D images fit).
Definition status.h:72
void p26_clear_error(void)
Empties the error message of the calling thread.
p26_status p26_fail(p26_status status, const char *format,...) P26_PRINTF_LIKE(2
Records an error message for the calling thread and returns status.
const char * p26_status_name(p26_status status)
Returns the name of a status code, e.g.
#define P26_PRINTF_LIKE(fmt_index, args_index)
Portability switch: marks a printf-like function so that GCC and Clang check its format string agains...
Definition status.h:68