From c5bde640c76806270f5d957a610fadbd16055af8 Mon Sep 17 00:00:00 2001 From: Oleksii Bulba Date: Wed, 1 May 2024 16:00:05 +0400 Subject: [PATCH] Chore: Project license maintainance - Added LICENSE files to array.h and logger.h libraries - Added license notices to all src files; --- libs/array/LICENSE | 22 ++++++++++++ libs/array/README.md | 77 ++++++++++++++++++++++++++++++++++++++++ libs/array/array.h | 25 +++++++++++++ libs/logger/LICENSE | 21 +++++++++++ libs/logger/logger.h | 24 +++++++++++++ src/rule.c | 25 +++++++++++++ src/rule.h | 25 +++++++++++++ src/tula.l | 25 +++++++++++++ src/tula.y | 25 +++++++++++++ src/tula_state_machine.c | 25 +++++++++++++ src/tula_state_machine.h | 25 +++++++++++++ 11 files changed, 319 insertions(+) create mode 100644 libs/array/LICENSE create mode 100644 libs/array/README.md create mode 100644 libs/logger/LICENSE diff --git a/libs/array/LICENSE b/libs/array/LICENSE new file mode 100644 index 0000000..7988051 --- /dev/null +++ b/libs/array/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2024 Alexey Kutepov +Copyright (c) 2024 Oleksii Bulba + +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/libs/array/README.md b/libs/array/README.md new file mode 100644 index 0000000..f895b43 --- /dev/null +++ b/libs/array/README.md @@ -0,0 +1,77 @@ +# C Dynamic array.h Library + +This C library provides a simple and efficient mechanism for creating and managing dynamic arrays, inspired by the stb libraries and [nob library](https://github.com/tsoding/musializer/blob/master/src/nob.h) by . The library is designed as a header-only library to ease integration into other projects. + +## Features + +- **Header-only**: No need for separate compilation, just include it in your project. +- **Type Safety**: Generic implementation using macros ensures type safety. +- **Easy to Use**: Simple API for array operations like append and get. +- **Customizable Memory Management**: Defaults to standard memory functions but allows for overriding. + +## Installation + +Since the library is header-only, the installation process is straightforward. Simply copy the `array.h` file into your project's include directory or anywhere in your include path. + +## Usage + +First, include the header file in your source file: +```c +#include "array.h" +``` + +To use the library, follow these steps: + +- Define the array type for your specific item type using `ARRAY_DEFINE(item_type)`. +- Create an array instance and initialize it. +- Append items to the array. +- Access items using the `ARRAY_GET` macro. +- Free the array when it's no longer needed. + +### Example + +Here's an example of using the dynamic array library with an int type: + +```c +#include + +#include "array.h" + +ARRAY_DEFINE(int); // Define the array type for integers + +int main() { + ARRAY(int) my_array = {NULL, 0, 0}; // Initialize the array + + // Append items + array_append(&my_array, 10); + array_append(&my_array, 20); + + // Access and print items + printf("Item at index 0: %d\n", *ARRAY_GET(&my_array, 0)); + printf("Item at index 1: %d\n", *ARRAY_GET(&my_array, 1)); + + // Free the array + array_free_array(my_array); + + return 0; +} +``` + +## Customizing Memory Management + +By default, the library uses the standard realloc and free functions for memory management. You can customize these by defining `ARRAY_REALLOC` and `ARRAY_FREE` before including _array.h_. + +## License + +This project is licensed under the MIT License. You can use it freely in both personal and commercial projects. + +For complete license details, refer to the LICENSE file in the array.h project repository. + +## Contributing + +Contributions to the library are welcome! To contribute, please fork the repository, make your changes, and submit a pull request. + +## Contact + +For questions and support, please open an issue in the project's GitHub repository. + diff --git a/libs/array/array.h b/libs/array/array.h index 5fdc8b1..12c3dd1 100644 --- a/libs/array/array.h +++ b/libs/array/array.h @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024 Alexey Kutepov + * Copyright (c) 2024 Oleksii Bulba + * + * 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. + */ + #ifndef ARRAY_H_ #define ARRAY_H_ diff --git a/libs/logger/LICENSE b/libs/logger/LICENSE new file mode 100644 index 0000000..f472b12 --- /dev/null +++ b/libs/logger/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Oleksii Bulba + +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/libs/logger/logger.h b/libs/logger/logger.h index ce2aad7..7caefe5 100644 --- a/libs/logger/logger.h +++ b/libs/logger/logger.h @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2024 Oleksii Bulba + * + * 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. + */ + #ifndef LOGGER_H #define LOGGER_H diff --git a/src/rule.c b/src/rule.c index 72785cb..f614bf4 100644 --- a/src/rule.c +++ b/src/rule.c @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024 Alexey Kutepov + * Copyright (c) 2024 Oleksii Bulba + * + * 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. + */ + #include #include diff --git a/src/rule.h b/src/rule.h index 137c29d..2bdbc35 100644 --- a/src/rule.h +++ b/src/rule.h @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024 Alexey Kutepov + * Copyright (c) 2024 Oleksii Bulba + * + * 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. + */ + #ifndef RULE_H_ #define RULE_H_ diff --git a/src/tula.l b/src/tula.l index dc78e41..1d82dae 100644 --- a/src/tula.l +++ b/src/tula.l @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024 Alexey Kutepov + * Copyright (c) 2024 Oleksii Bulba + * + * 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. + */ + %{ #include "tula.tab.h" %} diff --git a/src/tula.y b/src/tula.y index 1d751f9..2ecd2cf 100644 --- a/src/tula.y +++ b/src/tula.y @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024 Alexey Kutepov + * Copyright (c) 2024 Oleksii Bulba + * + * 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. + */ + %{ #include #include diff --git a/src/tula_state_machine.c b/src/tula_state_machine.c index fa4d679..996925e 100644 --- a/src/tula_state_machine.c +++ b/src/tula_state_machine.c @@ -1,5 +1,30 @@ #include #include +/* + * MIT License + * + * Copyright (c) 2024 Alexey Kutepov + * Copyright (c) 2024 Oleksii Bulba + * + * 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. + */ + #include #include diff --git a/src/tula_state_machine.h b/src/tula_state_machine.h index 2047971..848f94a 100644 --- a/src/tula_state_machine.h +++ b/src/tula_state_machine.h @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024 Alexey Kutepov + * Copyright (c) 2024 Oleksii Bulba + * + * 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. + */ + #ifndef STATE_MACHINE_H_ #define STATE_MACHINE_H_