Mercurial > molko
comparison libcore/core/error.h @ 121:789b23e01f52
misc: reorganize hierarchy, closes #2490
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 05 Oct 2020 13:25:06 +0200 |
parents | src/core/error.h@e82eca4f8606 |
children | aab824406d3d |
comparison
equal
deleted
inserted
replaced
120:b3429b26d60d | 121:789b23e01f52 |
---|---|
1 /* | |
2 * error.h -- error routines | |
3 * | |
4 * Copyright (c) 2020 David Demelier <markand@malikania.fr> | |
5 * | |
6 * Permission to use, copy, modify, and/or distribute this software for any | |
7 * purpose with or without fee is hereby granted, provided that the above | |
8 * copyright notice and this permission notice appear in all copies. | |
9 * | |
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
17 */ | |
18 | |
19 #ifndef MOLKO_ERROR_H | |
20 #define MOLKO_ERROR_H | |
21 | |
22 /** | |
23 * \file error.h | |
24 * \brief Error routines. | |
25 * \ingroup basics | |
26 */ | |
27 | |
28 #include <stdarg.h> | |
29 #include <stdbool.h> | |
30 | |
31 #include "plat.h" | |
32 | |
33 /** | |
34 * Get the last error returned. | |
35 * | |
36 * \return The error string. | |
37 */ | |
38 const char * | |
39 error(void); | |
40 | |
41 /** | |
42 * Convenient helper that sets last error from global C errno and then return | |
43 * false. | |
44 * | |
45 * \return Always false. | |
46 */ | |
47 bool | |
48 error_errno(void); | |
49 | |
50 /** | |
51 * Set the game error with a printf-like format. | |
52 * | |
53 * \pre fmt != NULL | |
54 * \param fmt the format string | |
55 * \return Always false. | |
56 */ | |
57 bool | |
58 error_printf(const char *fmt, ...) PLAT_PRINTF(1, 2); | |
59 | |
60 /** | |
61 * Similar to \ref error_printf. | |
62 * | |
63 * \pre fmt != NULL | |
64 * \param fmt the format stinrg | |
65 * \param ap the variadic arguments pointer | |
66 * \return Always false. | |
67 */ | |
68 bool | |
69 error_vprintf(const char *fmt, va_list ap) PLAT_PRINTF(1, 0); | |
70 | |
71 #endif /* !MOLKO_ERROR_H */ |