From df9af17159b3807b81ee7b0387af8075a535391c Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Sat, 16 Mar 2024 22:41:16 -0400 Subject: [PATCH] Add boilerplate to CException files --- Gemfile | 4 --- Gemfile.lock | 12 --------- docs/CException.md | 43 --------------------------------- lib/CException.c | 7 ++++++ lib/CException.h | 7 ++++++ license.txt | 2 -- project.yml | 7 ++++++ test/TestException.c | 7 ++++++ test/support/CExceptionConfig.h | 7 ++++++ 9 files changed, 35 insertions(+), 61 deletions(-) delete mode 100644 Gemfile delete mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 0ab41bb..0000000 --- a/Gemfile +++ /dev/null @@ -1,4 +0,0 @@ -source "http://rubygems.org/" - -gem "rake" -gem "test-unit", "~> 2.4" diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 8622142..0000000 --- a/Gemfile.lock +++ /dev/null @@ -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) diff --git a/docs/CException.md b/docs/CException.md index 8792d20..82b7946 100644 --- a/docs/CException.md +++ b/docs/CException.md @@ -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. diff --git a/lib/CException.c b/lib/CException.c index 33ed0c2..825e545 100644 --- a/lib/CException.c +++ b/lib/CException.c @@ -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__ diff --git a/lib/CException.h b/lib/CException.h index 55399ca..6b6cf10 100644 --- a/lib/CException.h +++ b/lib/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 _CEXCEPTION_H #define _CEXCEPTION_H diff --git a/license.txt b/license.txt index 5e1af5e..6a7911c 100644 --- a/license.txt +++ b/license.txt @@ -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 diff --git a/project.yml b/project.yml index ab4a290..8c29572 100644 --- a/project.yml +++ b/project.yml @@ -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 diff --git a/test/TestException.c b/test/TestException.c index 3d03d52..d339a78 100644 --- a/test/TestException.c +++ b/test/TestException.c @@ -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" diff --git a/test/support/CExceptionConfig.h b/test/support/CExceptionConfig.h index 66cb87e..d4aee17 100644 --- a/test/support/CExceptionConfig.h +++ b/test/support/CExceptionConfig.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