mirror of
https://github.com/throwtheswitch/cexception.git
synced 2026-06-05 21:24:36 +00:00
Add boilerplate to CException files
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
source "http://rubygems.org/"
|
||||
|
||||
gem "rake"
|
||||
gem "test-unit", "~> 2.4"
|
||||
@@ -1,12 +0,0 @@
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
rake (12.3.3)
|
||||
test-unit (2.5.5)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
rake
|
||||
test-unit (~> 2.4)
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
CException
|
||||
==========
|
||||
|
||||
@@ -6,14 +5,12 @@ CException is a basic exception framework for C, suitable for use in
|
||||
embedded applications. It provides an exception framework similar in
|
||||
use to C++, but with much less overhead.
|
||||
|
||||
|
||||
CException uses C standard library functions `setjmp` and `longjmp` to
|
||||
operate. As long as the target system has these two functions defined,
|
||||
this library should be useable with very little configuration. It
|
||||
even supports environments where multiple program flows are in use,
|
||||
such as real-time operating systems.
|
||||
|
||||
|
||||
There are about a gabillion exception frameworks using a similar
|
||||
setjmp/longjmp method out there... and there will probably be more
|
||||
in the future. Unfortunately, when we started our last embedded
|
||||
@@ -21,10 +18,8 @@ project, all those that existed either (a) did not support multiple
|
||||
tasks (therefore multiple stacks) or (b) were way more complex than
|
||||
we really wanted. CException was born.
|
||||
|
||||
|
||||
*Why use CException?*
|
||||
|
||||
|
||||
0. It's ANSI C, and it beats passing error codes around.
|
||||
1. You want something simple... CException throws a single id. You can
|
||||
define those ID's to be whatever you like. You might even choose which
|
||||
@@ -37,10 +32,8 @@ we really wanted. CException was born.
|
||||
your only additional overhead is the time it takes you to determine
|
||||
a unique task id 0 - num_tasks.
|
||||
|
||||
|
||||
For the latest version, go to [ThrowTheSwitch.org](http://throwtheswitch.org)
|
||||
|
||||
|
||||
CONTENTS OF THIS DOCUMENT
|
||||
=========================
|
||||
|
||||
@@ -60,20 +53,15 @@ The code directly following the Try call is "protected", meaning that
|
||||
if any Throws occur, program control is directly transferred to the
|
||||
start of the Catch block.
|
||||
|
||||
|
||||
A numerical exception ID is included with Throw, and is made accessible
|
||||
from the Catch block.
|
||||
|
||||
|
||||
Throws can occur from within function calls (nested as deeply as you
|
||||
like) or directly from within the function itself.
|
||||
|
||||
|
||||
|
||||
Limitations
|
||||
-----------
|
||||
|
||||
|
||||
This library was made to be as fast as possible, and provide basic
|
||||
exception handling. It is not a full-blown exception library. Because
|
||||
of this, there are a few limitations that should be observed in order
|
||||
@@ -154,8 +142,6 @@ to successfully utilize this library:
|
||||
replacing or wrapping malloc calls or something like that. This
|
||||
is a light framework, so these options were not desirable.
|
||||
|
||||
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
@@ -255,7 +241,6 @@ you wanted and just use the defaults provided.
|
||||
this the emergency fallback plan for when something has
|
||||
gone terribly wrong.
|
||||
|
||||
|
||||
You may also want to include any header files which will commonly be
|
||||
needed by the rest of your application where it uses exception handling
|
||||
here. 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:
|
||||
* called immediately before the catch
|
||||
|
||||
|
||||
|
||||
TESTING
|
||||
-------
|
||||
|
||||
|
||||
If you want to validate that CException works with your tools or that
|
||||
it works with your custom configuration, you may want to run the test
|
||||
suite.
|
||||
@@ -304,29 +287,3 @@ to compile and run the test application.
|
||||
* The path to the Unity framework (required to run tests)
|
||||
(get it at [ThrowTheSwitch.org](http://throwtheswitch.org))
|
||||
|
||||
|
||||
|
||||
LICENSE
|
||||
-------
|
||||
|
||||
This software is licensed under the MIT License
|
||||
|
||||
Copyright (c) 2007-2021 Mark VanderVoord
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/* =========================================================================
|
||||
CException - Simple Exception Handling in C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-24 Mark VanderVoord
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
#include "CException.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/* =========================================================================
|
||||
CException - Simple Exception Handling in C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-24 Mark VanderVoord
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
#ifndef _CEXCEPTION_H
|
||||
#define _CEXCEPTION_H
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
Copyright (c) 2007-2024 Mark VanderVoord
|
||||
|
||||
https://opensource.org/license/mit/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# =========================================================================
|
||||
# CException - Simple Exception Handling in C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-24 Mark VanderVoord
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
---
|
||||
|
||||
# This project file is for using Ceedling to run CException's self-tests. The
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/* =========================================================================
|
||||
CException - Simple Exception Handling in C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-24 Mark VanderVoord
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
#include "unity.h"
|
||||
#include "CException.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/* =========================================================================
|
||||
CException - Simple Exception Handling in C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-24 Mark VanderVoord
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
#ifndef _EXCEPTION_H
|
||||
#define _EXCEPTION_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user