comparison libmlk-core/core/panic.h @ 253:c4da052c0def

core: goodbye doxygen
author David Demelier <markand@malikania.fr>
date Thu, 03 Dec 2020 09:06:52 +0100
parents 71b3b7036de7
children 08ab73b32832
comparison
equal deleted inserted replaced
252:95c2c4a72410 253:c4da052c0def
17 */ 17 */
18 18
19 #ifndef MOLKO_CORE_PANIC_H 19 #ifndef MOLKO_CORE_PANIC_H
20 #define MOLKO_CORE_PANIC_H 20 #define MOLKO_CORE_PANIC_H
21 21
22 /** 22 #include <stdarg.h>
23 * \file panic.h 23 #include <stdnoreturn.h>
24 * \brief Unrecoverable error handling.
25 * \ingroup basics
26 *
27 * This set of functions should be used to detect runtime errors that are
28 * unexpected. They should be used only when the game cannot continue because
29 * it is in a unrecoverable state.
30 *
31 * Examples of appropriate use cases:
32 *
33 * - Game saved data is corrupt,
34 * - Assets are missing,
35 * - No more memory.
36 *
37 * In other contexts, use asserts to indicates programming error and
38 * appropriate solutions to recover the game otherwise.
39 */
40 24
41 #include <stdarg.h>
42
43 /**
44 * \brief Global panic handler.
45 *
46 * The default implementation shows the last error and exit with code 1. The
47 * function must not return so you have to implement a setjmp/longjmp or a
48 * exception to be thrown.
49 *
50 * If the user defined function returns, panic routines will finally exit with
51 * code 1.
52 */
53 extern void (*panic_handler)(void); 25 extern void (*panic_handler)(void);
54 26
55 /** 27 noreturn void
56 * Terminate the program using the \ref panic_handler routine.
57 *
58 * This function will first set the global error with the provided format
59 * string and then call the handler.
60 *
61 * \pre fmt != NULL
62 * \param fmt the printf(3) format string
63 */
64 void
65 panicf(const char *fmt, ...); 28 panicf(const char *fmt, ...);
66 29
67 /** 30 noreturn void
68 * Similar to \ref panicf but with a arguments pointer. 31 panicva(const char *fmt, va_list ap);
69 *
70 * \pre fmt != NULL
71 * \param fmt the printf(3) format string
72 * \param ap the arguments pointer
73 */
74 void
75 vpanicf(const char *fmt, va_list ap);
76 32
77 /** 33 noreturn void
78 * Similar to \ref panicf but use last error stored using \ref error.h
79 * routines.
80 */
81 void
82 panic(void); 34 panic(void);
83 35
84 #endif /* !MOLKO_CORE_PANIC_H */ 36 #endif /* !MOLKO_CORE_PANIC_H */