Skip to content

Commit

Permalink
Chore: Project license maintainance
Browse files Browse the repository at this point in the history
- Added LICENSE files to array.h and logger.h libraries
- Added license notices to all src files;
  • Loading branch information
OleksiiBulba committed May 1, 2024
1 parent 45f4999 commit c5bde64
Show file tree
Hide file tree
Showing 11 changed files with 319 additions and 0 deletions.
22 changes: 22 additions & 0 deletions libs/array/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2024 Alexey Kutepov <reximkut@gmail.com>
Copyright (c) 2024 Oleksii Bulba <oleksii.bulba@gmail.com>

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.
77 changes: 77 additions & 0 deletions libs/array/README.md
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>

#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.
25 changes: 25 additions & 0 deletions libs/array/array.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
* MIT License
*
* Copyright (c) 2024 Alexey Kutepov <reximkut@gmail.com>
* Copyright (c) 2024 Oleksii Bulba <oleksii.bulba@gmail.com>
*
* 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_

Expand Down
21 changes: 21 additions & 0 deletions libs/logger/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Oleksii Bulba <oleksii.bulba@gmail.com>

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.
24 changes: 24 additions & 0 deletions libs/logger/logger.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* MIT License
*
* Copyright (c) 2024 Oleksii Bulba <oleksii.bulba@gmail.com>
*
* 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

Expand Down
25 changes: 25 additions & 0 deletions src/rule.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
* MIT License
*
* Copyright (c) 2024 Alexey Kutepov <reximkut@gmail.com>
* Copyright (c) 2024 Oleksii Bulba <oleksii.bulba@gmail.com>
*
* 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 <stdlib.h>
#include <string.h>

Expand Down
25 changes: 25 additions & 0 deletions src/rule.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
* MIT License
*
* Copyright (c) 2024 Alexey Kutepov <reximkut@gmail.com>
* Copyright (c) 2024 Oleksii Bulba <oleksii.bulba@gmail.com>
*
* 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_

Expand Down
25 changes: 25 additions & 0 deletions src/tula.l
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
* MIT License
*
* Copyright (c) 2024 Alexey Kutepov <reximkut@gmail.com>
* Copyright (c) 2024 Oleksii Bulba <oleksii.bulba@gmail.com>
*
* 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"
%}
Expand Down
25 changes: 25 additions & 0 deletions src/tula.y
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
* MIT License
*
* Copyright (c) 2024 Alexey Kutepov <reximkut@gmail.com>
* Copyright (c) 2024 Oleksii Bulba <oleksii.bulba@gmail.com>
*
* 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 <stdio.h>
#include <stdlib.h>
Expand Down
25 changes: 25 additions & 0 deletions src/tula_state_machine.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
#include <stdio.h>
#include <stdlib.h>
/*
* MIT License
*
* Copyright (c) 2024 Alexey Kutepov <reximkut@gmail.com>
* Copyright (c) 2024 Oleksii Bulba <oleksii.bulba@gmail.com>
*
* 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 <string.h>
#include <stdbool.h>

Expand Down
25 changes: 25 additions & 0 deletions src/tula_state_machine.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
* MIT License
*
* Copyright (c) 2024 Alexey Kutepov <reximkut@gmail.com>
* Copyright (c) 2024 Oleksii Bulba <oleksii.bulba@gmail.com>
*
* 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_

Expand Down

0 comments on commit c5bde64

Please sign in to comment.