Mercurial > molko
annotate libmlk-core/mlk/core/panic.h @ 547:c7664b679a95
misc: remove error codes for now
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 06 Mar 2023 20:03:00 +0100 |
parents | 6e8f6640e05b |
children | 75944708c55c |
rev | line source |
---|---|
88
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
1 /* |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
2 * panic.h -- unrecoverable error handling |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
3 * |
445
773a082f0b91
misc: update copyright years
David Demelier <markand@malikania.fr>
parents:
431
diff
changeset
|
4 * Copyright (c) 2020-2023 David Demelier <markand@malikania.fr> |
88
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
5 * |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
6 * Permission to use, copy, modify, and/or distribute this software for any |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
7 * purpose with or without fee is hereby granted, provided that the above |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
8 * copyright notice and this permission notice appear in all copies. |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
9 * |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
17 */ |
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
18 |
366
19782ea1cf4a
misc: start rebranding
David Demelier <markand@malikania.fr>
parents:
348
diff
changeset
|
19 #ifndef MLK_CORE_PANIC_H |
19782ea1cf4a
misc: start rebranding
David Demelier <markand@malikania.fr>
parents:
348
diff
changeset
|
20 #define MLK_CORE_PANIC_H |
88
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
21 |
253
c4da052c0def
core: goodbye doxygen
David Demelier <markand@malikania.fr>
parents:
243
diff
changeset
|
22 #include <stdarg.h> |
88
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
23 |
486 | 24 #define PANIC_LINE_MAX (256) |
25 | |
26 extern void (*mlk_panic_handler)(const char *); | |
88
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
27 |
517
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
486
diff
changeset
|
28 #if defined(__cplusplus) |
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
486
diff
changeset
|
29 extern "C" { |
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
486
diff
changeset
|
30 #endif |
292
08ab73b32832
misc: add extern "C" {} blocks for C++ friends
David Demelier <markand@malikania.fr>
parents:
253
diff
changeset
|
31 |
348
7d7991f97acf
misc: be more barebone portable
David Demelier <markand@malikania.fr>
parents:
320
diff
changeset
|
32 void |
465
01f5580e43d1
core: panic -> mlk_panic
David Demelier <markand@malikania.fr>
parents:
462
diff
changeset
|
33 mlk_panicf(const char *, ...); |
88
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
34 |
348
7d7991f97acf
misc: be more barebone portable
David Demelier <markand@malikania.fr>
parents:
320
diff
changeset
|
35 void |
465
01f5580e43d1
core: panic -> mlk_panic
David Demelier <markand@malikania.fr>
parents:
462
diff
changeset
|
36 mlk_panicva(const char *, va_list); |
95
e82eca4f8606
core: simplify error/panic routines
David Demelier <markand@malikania.fr>
parents:
88
diff
changeset
|
37 |
348
7d7991f97acf
misc: be more barebone portable
David Demelier <markand@malikania.fr>
parents:
320
diff
changeset
|
38 void |
547
c7664b679a95
misc: remove error codes for now
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
39 mlk_panic(void); |
88
44de3c528b63
core: implement basic panic mechanism, continue #2484 @1h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
40 |
517
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
486
diff
changeset
|
41 #if defined(__cplusplus) |
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
486
diff
changeset
|
42 } |
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
486
diff
changeset
|
43 #endif |
292
08ab73b32832
misc: add extern "C" {} blocks for C++ friends
David Demelier <markand@malikania.fr>
parents:
253
diff
changeset
|
44 |
366
19782ea1cf4a
misc: start rebranding
David Demelier <markand@malikania.fr>
parents:
348
diff
changeset
|
45 #endif /* !MLK_CORE_PANIC_H */ |