1-
21CException
32==========
43
54CException is a basic exception framework for C, suitable for use in
65embedded applications. It provides an exception framework similar in
76use to C++, but with much less overhead.
87
9-
108CException uses C standard library functions ` setjmp ` and ` longjmp ` to
119operate. As long as the target system has these two functions defined,
1210this library should be useable with very little configuration. It
1311even supports environments where multiple program flows are in use,
1412such as real-time operating systems.
1513
16-
1714There are about a gabillion exception frameworks using a similar
1815setjmp/longjmp method out there... and there will probably be more
1916in the future. Unfortunately, when we started our last embedded
2017project, all those that existed either (a) did not support multiple
2118tasks (therefore multiple stacks) or (b) were way more complex than
2219we really wanted. CException was born.
2320
24-
2521* Why use CException?*
2622
27-
28230 . It's ANSI C, and it beats passing error codes around.
29241 . You want something simple... CException throws a single id. You can
3025 define those ID's to be whatever you like. You might even choose which
@@ -37,10 +32,8 @@ we really wanted. CException was born.
3732 your only additional overhead is the time it takes you to determine
3833 a unique task id 0 - num_tasks.
3934
40-
4135For the latest version, go to [ ThrowTheSwitch.org] ( http://throwtheswitch.org )
4236
43-
4437CONTENTS OF THIS DOCUMENT
4538=========================
4639
@@ -60,20 +53,15 @@ The code directly following the Try call is "protected", meaning that
6053if any Throws occur, program control is directly transferred to the
6154start of the Catch block.
6255
63-
6456A numerical exception ID is included with Throw, and is made accessible
6557from the Catch block.
6658
67-
6859Throws can occur from within function calls (nested as deeply as you
6960like) or directly from within the function itself.
7061
71-
72-
7362Limitations
7463-----------
7564
76-
7765This library was made to be as fast as possible, and provide basic
7866exception handling. It is not a full-blown exception library. Because
7967of this, there are a few limitations that should be observed in order
@@ -154,8 +142,6 @@ to successfully utilize this library:
154142 replacing or wrapping malloc calls or something like that. This
155143 is a light framework, so these options were not desirable.
156144
157-
158-
159145API
160146---
161147
@@ -255,7 +241,6 @@ you wanted and just use the defaults provided.
255241 this the emergency fallback plan for when something has
256242 gone terribly wrong.
257243
258-
259244You may also want to include any header files which will commonly be
260245needed by the rest of your application where it uses exception handling
261246here. For example, OS header files or exception codes would be useful.
@@ -279,11 +264,9 @@ where you will need these, but they are here if you need them:
279264 * called immediately before the catch
280265
281266
282-
283267TESTING
284268-------
285269
286-
287270If you want to validate that CException works with your tools or that
288271it works with your custom configuration, you may want to run the test
289272suite.
@@ -304,29 +287,3 @@ to compile and run the test application.
304287 * The path to the Unity framework (required to run tests)
305288 (get it at [ ThrowTheSwitch.org] ( http://throwtheswitch.org ) )
306289
307-
308-
309- LICENSE
310- -------
311-
312- This software is licensed under the MIT License
313-
314- Copyright (c) 2007-2021 Mark VanderVoord
315-
316- Permission is hereby granted, free of charge, to any person obtaining a copy
317- of this software and associated documentation files (the "Software"), to deal
318- in the Software without restriction, including without limitation the rights
319- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
320- copies of the Software, and to permit persons to whom the Software is
321- furnished to do so, subject to the following conditions:
322-
323- The above copyright notice and this permission notice shall be included in
324- all copies or substantial portions of the Software.
325-
326- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
327- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
328- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
329- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
330- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
331- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
332- THE SOFTWARE.
0 commit comments