Debian Codegraph @

vendor/c_exception/test/support/CExceptionConfig.h

raw
1 #ifndef _EXCEPTION_H
2 #define _EXCEPTION_H
3
4 #include "unity.h"
5
6 extern volatile int TestingTheFallback;
7 extern volatile int TestingTheFallbackId;
8
9 //Optionally define the exception type (something like an int which can be directly assigned)
10 #define CEXCEPTION_T int
11
12 // Optionally define the reserved value representing NO EXCEPTION
13 #define CEXCEPTION_NONE (1234)
14
15 // Optionally define a special handler for unhandled exceptions
16 #define CEXCEPTION_NO_CATCH_HANDLER(id) \
17 { \
18 if (!TestingTheFallback) \
19 { \
20 TEST_FAIL_MESSAGE("Unexpected Exception!"); \
21 } \
22 else \
23 { \
24 TestingTheFallbackId = id; \
25 TestingTheFallback--; \
26 } \
27 }
28
29 // Multi-Tasking environments will need a couple of macros defined to make this library
30 // properly handle multiple exception stacks. You will need to include and required
31 // definitions, then define the following macros:
32 // EXCEPTION_GET_ID - returns the id of the current task indexed 0 to (numtasks - 1)
33 // EXCEPTION_NUM_ID - returns the number of tasks that might be returned
34 //
35 // For example, Quadros might include the following implementation:
36 #ifndef TEST
37 #include "OSAPI.h"
38 #define CEXCEPTION_GET_ID (KS_GetTaskID())
39 #define CEXCEPTION_NUM_ID (NTASKS + 1)
40 #endif
41
42 //This could be a good place to define/include some error ID's:
43 #define ERROR_ID_EVERYTHING_IS_BROKEN (0x88)
44 #define ERROR_ID_ONLY_THIS_IS_BROKEN (0x77)
45
46 #endif // _EXCEPTION_H