-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a86665
commit 18c452a
Showing
11 changed files
with
364 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,35 @@ | ||
# Object files | ||
*.o | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
|
||
# Debug files | ||
*.dSYM/ | ||
# Object files | ||
*.o | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
|
||
# Debug files | ||
*.dSYM/ | ||
|
||
# Sublime Text | ||
*.sublime-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
language: c | ||
compiler: [clang, gcc] | ||
language: c | ||
compiler: [clang, gcc] | ||
script: "make tests" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
The MIT License (MIT) | ||
Copyright (c) 2015 Andrey Roenko | ||
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 MIT License (MIT) | ||
|
||
Copyright (c) 2015 Andrey Roenko | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
export CC | ||
|
||
.PHONY: tests | ||
|
||
all: tests | ||
|
||
tests: | ||
bash ./tests/run_preprocessor_tests.sh || (exit 1) | ||
mkdir -p tests/build | ||
|
||
gcc tests/containerof_test.c -Iinclude -o tests/build/containerof_test | ||
tests/build/containerof_test || (exit 1) | ||
export CC | ||
|
||
.PHONY: tests | ||
|
||
all: tests | ||
|
||
tests: | ||
bash ./tests/run_preprocessor_tests.sh || (exit 1) | ||
mkdir -p tests/build | ||
|
||
gcc tests/containerof_test.c -Iinclude -o tests/build/containerof_test | ||
tests/build/containerof_test || (exit 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
# PP_MAGE - preprocessor magic for your sources | ||
|
||
[![Build Status](https://travis-ci.org/flapenguin/pp_mage.svg)](https://travis-ci.org/flapenguin/pp_mage) | ||
|
||
## Overview | ||
This **header-only** library for C and C++ provides number of usefull macros you can use to simplify your sources. | ||
|
||
This is collection of good usefull macros you probably want to have. | ||
|
||
## Building | ||
No building is required, just add include directory to include path of your compiler. | ||
|
||
You can use `make` or `make tests` to run tests. | ||
|
||
## Documentation | ||
|
||
### Booleans | ||
`PP_TRUE`, `PP_FALSE` - constants. | ||
|
||
`PP_NOT`, `PP_AND`, `PP_OR`, `PP_XOR` - logic functions. | ||
|
||
### Conditions | ||
`PP_IF(Condition, Then)` - expands to `Then` if `Condition` is true, expands to empty otherwise. | ||
|
||
`PP_IFNOT(Condition, Then)` - expands to `Then` if `Condition` is false, expands to empty otherwise. | ||
|
||
`PP_IF_ELSE(Condition, Then, Else)` - expands to `Then` if `Condition` is true, expands to `Else` otherwise. | ||
|
||
### Functionals | ||
`PP_NARG` and `PP_MAP` are limited by 16 arguments in current version. | ||
|
||
`PP_APPLY(Macro, arg1, arg2, ...)` - expands to `Macro(arg1, arg2, ...)`. | ||
|
||
`PP_NARG(arg1, ..., argN)` - expands to number `N`. | ||
|
||
`PP_MAP(Macro, arg1, arg2 ...)` - expands to `Macro(arg1) Macro(arg2) ...`. | ||
|
||
### Utilities | ||
|
||
`PP_CONCAT(Foo, Bar)` - classical indirection concatenation macro. | ||
|
||
`PP_CONTAINER_OF(Ptr, ParentType, Member)` - gets `ParentType*` by pointer `Ptr` to its `Member`. | ||
|
||
### Blocks | ||
Next macros are usefull for reducing braces and do-whiles in huge macros. | ||
|
||
`PP_STMT_START` - expands to `do {`. | ||
|
||
`PP_STMT_END` - expands to `} while(0)`. | ||
|
||
`PP_STMT(...)` - expands to `do { ... } while(0)`. | ||
# PP_MAGE - preprocessor magic for your sources | ||
|
||
[![Build Status](https://travis-ci.org/flapenguin/pp_mage.svg)](https://travis-ci.org/flapenguin/pp_mage) | ||
|
||
## Overview | ||
This **header-only** library for C and C++ provides number of usefull macros you can use to simplify your sources. | ||
|
||
This is collection of good usefull macros you probably want to have. | ||
|
||
## Building | ||
No building is required, just add include directory to include path of your compiler. | ||
|
||
You can use `make` or `make tests` to run tests. | ||
|
||
## Documentation | ||
|
||
### Booleans | ||
`PP_TRUE`, `PP_FALSE` - constants. | ||
|
||
`PP_NOT`, `PP_AND`, `PP_OR`, `PP_XOR` - logic functions. | ||
|
||
### Conditions | ||
`PP_IF(Condition, Then)` - expands to `Then` if `Condition` is true, expands to empty otherwise. | ||
|
||
`PP_IFNOT(Condition, Then)` - expands to `Then` if `Condition` is false, expands to empty otherwise. | ||
|
||
`PP_IF_ELSE(Condition, Then, Else)` - expands to `Then` if `Condition` is true, expands to `Else` otherwise. | ||
|
||
### Functionals | ||
`PP_NARG` and `PP_MAP` are limited by 16 arguments in current version. | ||
|
||
`PP_APPLY(Macro, arg1, arg2, ...)` - expands to `Macro(arg1, arg2, ...)`. | ||
|
||
`PP_NARG(arg1, ..., argN)` - expands to number `N`. | ||
|
||
`PP_MAP(Macro, arg1, arg2 ...)` - expands to `Macro(arg1) Macro(arg2) ...`. | ||
|
||
### Utilities | ||
|
||
`PP_CONCAT(Foo, Bar)` - classical indirection concatenation macro. | ||
|
||
`PP_CONTAINER_OF(Ptr, ParentType, Member)` - gets `ParentType*` by pointer `Ptr` to its `Member`. | ||
|
||
### Blocks | ||
Next macros are usefull for reducing braces and do-whiles in huge macros. | ||
|
||
`PP_STMT_START` - expands to `do {`. | ||
|
||
`PP_STMT_END` - expands to `} while(0)`. | ||
|
||
`PP_STMT(...)` - expands to `do { ... } while(0)`. |
Oops, something went wrong.