mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-25 14:04:33 +00:00
chore: Update markdown files
Added CODE_OF_CONDUCT.md Added CONTRIBUTING.md Moved CREDITS.md Moved LICENSES.md Added SECURITY.md Added STYLE_GUIDE.md Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
parent
6dae34debd
commit
edd13c30c5
128
CODE_OF_CONDUCT.md
Normal file
128
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,128 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
enderice2@protonmail.com.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
70
CONTRIBUTING.md
Normal file
70
CONTRIBUTING.md
Normal file
@ -0,0 +1,70 @@
|
||||
# Contributing to Fennix
|
||||
|
||||
We welcome contributions to Fennix! Whether you are reporting a bug, suggesting a feature, or submitting a pull request, we’re excited to collaborate with you.
|
||||
|
||||
## Table of Contents
|
||||
- [How to Contribute](#how-to-contribute)
|
||||
- [Code of Conduct](#code-of-conduct)
|
||||
- [Getting Started](#getting-started)
|
||||
- [Pull Request Guidelines](#pull-request-guidelines)
|
||||
- [Reporting Issues](#reporting-issues)
|
||||
- [Style Guide](#style-guide)
|
||||
|
||||
---
|
||||
|
||||
## How to Contribute
|
||||
|
||||
1. **Check existing issues or discussions** to see if your idea has already been mentioned or if someone is already working on it.
|
||||
2. If you’re new to the project, consider contributing to [good first issues](https://github.com/EnderIce2/Fennix/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22).
|
||||
3. Fork the repository and create a new branch for your changes.
|
||||
|
||||
---
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
By participating in this project, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md). Be respectful and inclusive while interacting with the community.
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Fork this repository and clone your fork.
|
||||
2. Set up your development environment according to the [README.md](README.md) or any other setup guide provided.
|
||||
3. Ensure all tests pass before submitting changes. Add tests for new features where applicable.
|
||||
|
||||
---
|
||||
|
||||
## Pull Request Guidelines
|
||||
|
||||
1. Keep pull requests focused on a single issue or feature.
|
||||
2. Write clear, descriptive commit messages.
|
||||
3. Ensure all tests pass before submitting your PR.
|
||||
4. Include a detailed description of your changes and reference any relevant issue numbers.
|
||||
5. Be open to feedback and revise your pull request if requested.
|
||||
6. Mark your pull request as a draft if it’s still a work in progress.
|
||||
|
||||
---
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
1. Check if the issue has already been reported.
|
||||
2. Include a clear and descriptive title.
|
||||
3. Provide detailed steps to reproduce the problem (if applicable).
|
||||
4. Mention your environment details (e.g., OS, version, etc.).
|
||||
5. Attach screenshots or logs if they help explain the issue.
|
||||
|
||||
---
|
||||
|
||||
## Style Guide
|
||||
|
||||
Follow the coding style used in the repository to ensure consistency. Adhere to:
|
||||
- Use CamelCase for all names.
|
||||
- Start function and global declaration names with an uppercase letter.
|
||||
- Start local variable names with a lowercase letter.
|
||||
- Maintain consistent formatting and commenting guidelines.
|
||||
|
||||
Refer to the [style guide document](STYLE_GUIDE.md) if available.
|
||||
|
||||
---
|
||||
|
||||
Thank you for contributing! Your effort makes Fennix better for everyone. If you have any questions, feel free to reach out by opening an issue or joining our discussions.
|
@ -1,54 +0,0 @@
|
||||
# Licenses in the project
|
||||
|
||||
This project uses code from other projects, each with its own licenses.
|
||||
Below are the licenses associated with these components.
|
||||
Make sure to read and comply with these licenses before using or redistributing this software.
|
||||
|
||||
## printf
|
||||
|
||||
- **License:** The MIT License (MIT)
|
||||
- **Location:** [library/printf.c](library/printf.c) [include/printf.h](include/printf.h)
|
||||
|
||||
## stb_image
|
||||
|
||||
- **License:** The MIT License (MIT) and Public Domain
|
||||
- **Location:** [include/stb/image.h](include/stb/image.h)
|
||||
|
||||
## stb_image_resize
|
||||
|
||||
- **License:** The MIT License (MIT) and Public Domain
|
||||
- **Location:** [include/stb/image_resize.h](include/stb/image_resize.h)
|
||||
|
||||
## cargs
|
||||
|
||||
- **License:** The MIT License (MIT)
|
||||
- **Location:** [library/cargs.c](library/cargs.c) [include/cargs.h](include/cargs.h)
|
||||
|
||||
## cwalk
|
||||
|
||||
- **License:** The MIT License (MIT)
|
||||
- **Location:** [library/cwalk.c](library/cwalk.c) [include/cwalk.h](include/cwalk.h)
|
||||
|
||||
## Tamsyn Font (v1.11)
|
||||
|
||||
- **License:** Unknown
|
||||
- **Location:** [files/tamsyn-font-1.11/LICENSE](files/tamsyn-font-1.11/LICENSE)
|
||||
|
||||
## liballoc
|
||||
|
||||
- **License:** Public Domain
|
||||
- **Location:** [https://raw.githubusercontent.com/blanham/liballoc/master/LICENSE](https://raw.githubusercontent.com/blanham/liballoc/master/LICENSE)
|
||||
|
||||
## rpmalloc
|
||||
|
||||
- **License:** The MIT License (MIT) and Public Domain
|
||||
- **Location:** [https://raw.githubusercontent.com/mjansson/rpmalloc/develop/LICENSE](https://raw.githubusercontent.com/mjansson/rpmalloc/develop/LICENSE)
|
||||
|
||||
## ini.h
|
||||
|
||||
- **License:** The MIT License (MIT) and Public Domain
|
||||
- **Location:** [include/ini.h](include/ini.h)
|
||||
|
||||
---
|
||||
|
||||
Please refer to the respective license files for the full text of each license.
|
10
Kernel/core/memory/heap_allocators/liballoc_1_1/LICENSE
Normal file
10
Kernel/core/memory/heap_allocators/liballoc_1_1/LICENSE
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
This code is released into the public domain. Use this code at your own
|
||||
risk. Feel free to use it for whatever purpose you want. I take no responsibilty or
|
||||
whatever if anything goes wrong. Use it at your own risk.
|
||||
|
||||
If you have any fixes or patches, please email me.
|
||||
|
||||
Durand Miller <clutter@djm.co.za>
|
||||
|
||||
|
59
LICENSES.md
Normal file
59
LICENSES.md
Normal file
@ -0,0 +1,59 @@
|
||||
# Licenses in the project
|
||||
|
||||
This project uses code from other projects, each with its own licenses.
|
||||
Below are the licenses associated with these components.
|
||||
Make sure to read and comply with these licenses before using or redistributing this software.
|
||||
|
||||
## printf
|
||||
|
||||
- **License:** The MIT License (MIT)
|
||||
- **Location(s):** [Kernel/library/printf.c](Kernel/library/printf.c) [Kernel/include/printf.h](Kernel/include/printf.h) [Userspace/libc/src/print/LICENSE](Userspace/libc/src/print/LICENSE)
|
||||
|
||||
## stb_image
|
||||
|
||||
- **License:** The MIT License (MIT) and Public Domain
|
||||
- **Location(s):** [Kernel/include/stb/image.h](Kernel/include/stb/image.h)
|
||||
|
||||
## stb_image_resize
|
||||
|
||||
- **License:** The MIT License (MIT) and Public Domain
|
||||
- **Location(s):** [Kernel/include/stb/image_resize.h](Kernel/include/stb/image_resize.h)
|
||||
|
||||
## cargs
|
||||
|
||||
- **License:** The MIT License (MIT)
|
||||
- **Location(s):** [Kernel/library/cargs.c](Kernel/library/cargs.c) [Kernel/include/cargs.h](Kernel/include/cargs.h)
|
||||
|
||||
## cwalk
|
||||
|
||||
- **License:** The MIT License (MIT)
|
||||
- **Location(s):** [Kernel/library/cwalk.c](Kernel/library/cwalk.c) [Kernel/include/cwalk.h](Kernel/include/cwalk.h)
|
||||
|
||||
## Tamsyn Font (v1.11)
|
||||
|
||||
- **License:** Unknown
|
||||
- **Location(s):** [Kernel/files/tamsyn-font-1.11/LICENSE](Kernel/files/tamsyn-font-1.11/LICENSE)
|
||||
|
||||
## liballoc
|
||||
|
||||
- **License:** Public Domain
|
||||
- **Location(s):** [Kernel/core/memory/heap_allocators/liballoc_1_1/LICENSE](Kernel/core/memory/heap_allocators/liballoc_1_1/LICENSE) [Userspace/libc/src/mem/LICENSE](Userspace/libc/src/mem/LICENSE)
|
||||
|
||||
## rpmalloc
|
||||
|
||||
- **License:** The MIT License (MIT) and Public Domain
|
||||
- **Location(s):** [https://raw.githubusercontent.com/mjansson/rpmalloc/develop/LICENSE](https://raw.githubusercontent.com/mjansson/rpmalloc/develop/LICENSE)
|
||||
|
||||
## ini.h
|
||||
|
||||
- **License:** The MIT License (MIT) and Public Domain
|
||||
- **Location(s):** [Kernel/include/ini.h](Kernel/include/ini.h)
|
||||
|
||||
## nanoprintf.h
|
||||
|
||||
- **License:** Unlicense and 0BSD
|
||||
- **Location(s):** [Userspace/libc/interpreter/nanoprintf.h](Userspace/libc/interpreter/nanoprintf.h)
|
||||
|
||||
---
|
||||
|
||||
Please refer to the respective license files for the full text of each license.
|
5
Makefile
5
Makefile
@ -92,9 +92,12 @@ endif
|
||||
# Install necessary packages, build cross-compiler etc...
|
||||
tools:
|
||||
make --quiet -C tools all
|
||||
|
||||
setup:
|
||||
make --quiet -C Kernel prepare
|
||||
make --quiet -C Userspace prepare
|
||||
make --quiet -C Drivers prepare
|
||||
make --quiet -C Userspace prepare
|
||||
$(MAKE) tools
|
||||
|
||||
build: build_kernel build_userspace build_drivers build_image
|
||||
|
||||
|
138
README.md
138
README.md
@ -1,32 +1,138 @@
|
||||
# Fennix
|
||||
<div align="center">
|
||||
<img src="tools/website/assets/logo.png" width="150"/>
|
||||
<h2>Fennix Operating System</h2>
|
||||
</div>
|
||||
|
||||
Opeating System from scratch made in C and C++
|
||||
<p align="center">
|
||||
<p align="center">
|
||||
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/EnderIce2/Fennix">
|
||||
<img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/EnderIce2/Fennix/makefile.yml">
|
||||
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/EnderIce2/Fennix">
|
||||
<img alt="GitHub License" src="https://img.shields.io/github/license/EnderIce2/Fennix">
|
||||
</p>
|
||||
</p>
|
||||
|
||||
<p align='center'>Fennix is an operating system built from scratch using C and C++.</p>
|
||||
|
||||
---
|
||||
|
||||
#### How to compile & run
|
||||
> [!CAUTION]
|
||||
> The project is still in development and is not yet ready for production use.
|
||||
> Please use a virtual machine to run the OS.
|
||||
|
||||
- Clone repo using:
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/EnderIce2/Fennix.git
|
||||
## Features
|
||||
|
||||
- 🧩 Flexible and modular
|
||||
- You can easily choose the components you want to include in the kernel
|
||||
- 🎛️ Compatible with multiple platforms
|
||||
- Supports i386, AMD64 and AArch64 platforms
|
||||
- 📦 Support for different operating system binaries
|
||||
- You can run Linux and Windows binaries
|
||||
- 🖨️ Driver support
|
||||
- Supports a variety of drivers for different hardware components
|
||||
- 📖 Detailed documentation
|
||||
- The project is well-documented using Doxygen
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Some features are still in development and may not be fully functional.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### 💾 Download ISO Image
|
||||
|
||||
You can download the development ISO image from the [Actions](https://github.com/EnderIce2/Fennix/actions/workflows/makefile.yml) tab on the GitHub repository.
|
||||
|
||||
|
||||
### 🛠️ Prerequisites
|
||||
|
||||
To build the project, you need to have the following tools installed:
|
||||
|
||||
- `make`
|
||||
- `gcc`
|
||||
- `ld`
|
||||
- ... and other standard Unix tools
|
||||
- These can be installed using `build-essential` on Ubuntu or `base-devel` on Arch Linux
|
||||
- `doxygen` (optional)
|
||||
- To generate the documentation
|
||||
|
||||
### 🚀 Installation
|
||||
|
||||
You can install the project by building it from source.
|
||||
|
||||
#### Cloning the Repository
|
||||
|
||||
First, clone the repository using Git:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/EnderIce2/fennix.git
|
||||
cd fennix
|
||||
```
|
||||
|
||||
- Build the cross-compiler and other tools:
|
||||
```bash
|
||||
make tools
|
||||
#### Preparing the Environment
|
||||
|
||||
Before building the project, you need to build the cross-compiler toolchain and QEMU. You can do this by running the following command:
|
||||
|
||||
```sh
|
||||
make setup
|
||||
```
|
||||
|
||||
- Compile using:
|
||||
```bash
|
||||
This will clone, patch, and build the required tools for you.
|
||||
|
||||
#### Building the Project
|
||||
|
||||
To build the project, run:
|
||||
|
||||
```sh
|
||||
make build
|
||||
```
|
||||
|
||||
- Run using:
|
||||
```bash
|
||||
This will build the kernel, userspace, and drivers. The iso image will be `Fennix.iso`.
|
||||
|
||||
#### Running the OS
|
||||
|
||||
You can run the OS using QEMU. First, build the project, then run:
|
||||
|
||||
```sh
|
||||
make run
|
||||
```
|
||||
|
||||
- Clean using:
|
||||
```bash
|
||||
make clean
|
||||
#### Additional Configuration
|
||||
|
||||
You can configure the project by editing the `config.mk` file.
|
||||
|
||||
## 🧪 Debugging
|
||||
|
||||
If you use Visual Studio Code, you can press `F5` to start debugging the OS.
|
||||
The configuration is already set up for you.
|
||||
|
||||
> [!TIP]
|
||||
> Make sure you built the project at least once before debugging.
|
||||
|
||||
## 📚 Documentation
|
||||
|
||||
The project documentation is generated using Doxygen.
|
||||
To generate the documentation, run:
|
||||
|
||||
```sh
|
||||
make docs
|
||||
```
|
||||
|
||||
The documentation will be available in the `doxygen-doc/docs` directory.
|
||||
|
||||
## 👨💻 Contributing
|
||||
|
||||
Contributions are welcome!
|
||||
Please read the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on how to contribute to this project.
|
||||
|
||||
### Contributors
|
||||
|
||||
<a href="https://github.com/EnderIce2/Fennix/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=EnderIce2/Fennix" />
|
||||
</a>
|
||||
|
||||
## 📃 License
|
||||
|
||||
Fennix is licensed under the GNU General Public License v3.0.
|
||||
See the [LICENSE.md](LICENSE.md) file for more details.
|
||||
|
||||
Other licenses used in the project can be found in the [LICENSES.md](LICENSES.md) file.
|
||||
|
39
SECURITY.md
Normal file
39
SECURITY.md
Normal file
@ -0,0 +1,39 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Fennix is a comprehensive operating system comprising:
|
||||
- **Kernel**: Core OS functionality.
|
||||
- **Drivers**: Hardware interaction layers.
|
||||
- **Userspace**: Libraries and utilities, including `libc` and essential services like `init`.
|
||||
|
||||
We actively support the latest version of Fennix. Older versions may receive security updates at our discretion.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
To report a security vulnerability, please follow these steps:
|
||||
|
||||
1. **Do not disclose the vulnerability publicly** until it has been addressed.
|
||||
2. Use [GitHub Issues](https://github.com/EnderIce2/Fennix/issues/new/choose) to report the vulnerability. If you prefer to report it privately, e-mail me at **[enderice2@protonmail.com](mailto:enderice2@protonmail.com)** with the following details:
|
||||
- A clear and detailed description of the vulnerability.
|
||||
- Steps to reproduce the issue.
|
||||
- Any potential impact of the vulnerability.
|
||||
- Relevant logs, screenshots, or proof-of-concept code (if applicable).
|
||||
3. We will acknowledge your report within 5 business days.
|
||||
|
||||
## Our Process
|
||||
|
||||
1. **Triage**: We will validate the vulnerability and determine its severity.
|
||||
2. **Resolution**: If confirmed, we will develop and test a fix.
|
||||
3. **Notification**: You will be notified once the issue is resolved. If applicable, credit will be given to you in the release notes.
|
||||
4. **Update**: The fix will be included in a public release. Ensure you update your system to the latest version.
|
||||
|
||||
## General Guidelines
|
||||
|
||||
- Keep your Fennix installation updated to benefit from the latest security patches.
|
||||
- Regularly review and apply updates to third-party packages and dependencies used in your userspace applications.
|
||||
|
||||
---
|
||||
|
||||
Thank you for helping to make Fennix a secure and reliable operating system for everyone!
|
||||
|
91
STYLE_GUIDE.md
Normal file
91
STYLE_GUIDE.md
Normal file
@ -0,0 +1,91 @@
|
||||
# Fennix Style Guide
|
||||
|
||||
This document outlines the coding standards and style guidelines for contributing to the Fennix project. Consistent code helps improve readability, maintainability, and collaboration.
|
||||
|
||||
## General Naming Conventions
|
||||
|
||||
- **CamelCase** is used for all identifiers:
|
||||
- Function and global declaration names must start with an uppercase letter.
|
||||
- Example: `InitializeKernel`, `LoadModule`
|
||||
- Local variable names must start with a lowercase letter.
|
||||
- Example: `bufferSize`, `inputString`
|
||||
|
||||
## Code Formatting
|
||||
|
||||
- **File formatting** should follow the "Visual Studio" style:
|
||||
- Use `Tab` for indentation. Each `Tab` should represent one level of indentation.
|
||||
- Consistently format files by using "Format Document" (available in editors like Visual Studio or VS Code).
|
||||
- Code blocks must align correctly with their containing structure (e.g., functions, loops).
|
||||
|
||||
### Example
|
||||
|
||||
```c
|
||||
void InitializeKernel()
|
||||
{
|
||||
int bufferSize = 1024;
|
||||
char *inputString = AllocateMemory(bufferSize);
|
||||
if (inputString == NULL)
|
||||
{
|
||||
HandleError("Memory allocation failed");
|
||||
return;
|
||||
}
|
||||
|
||||
int status = LoadModules(inputString);
|
||||
if (status == 0)
|
||||
return 0;
|
||||
|
||||
// Continue with the initialization
|
||||
}
|
||||
```
|
||||
|
||||
## Commenting Guidelines
|
||||
|
||||
- Write clear and concise comments to describe the purpose and functionality of the code if necessary. (**Avoid unnecessary comments.**)
|
||||
- A good explanation of this is [here](https://youtu.be/Bf7vDBBOBUA).
|
||||
- Use inline comments sparingly to clarify complex logic.
|
||||
- Document public APIs using Doxygen-style comments.
|
||||
|
||||
### Example
|
||||
|
||||
```c
|
||||
/**
|
||||
* @brief Initializes the kernel.
|
||||
*
|
||||
* This function initializes the kernel by loading modules and setting up the environment.
|
||||
*/
|
||||
void InitializeKernel();
|
||||
|
||||
|
||||
void ProcessData()
|
||||
{
|
||||
/* Read data from the buffer */
|
||||
size_t bytesRead = ReadData(buffer, MAX_BUFFER_SIZE);
|
||||
if (bytesRead == 0) /* No data read */
|
||||
{
|
||||
HandleError("No data read");
|
||||
return;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Guidelines for File Structure
|
||||
|
||||
- Group related functions together.
|
||||
- Use a consistent order for declarations: global variables, private functions, public functions.
|
||||
- Separate sections of code with blank lines for better readability.
|
||||
- Avoid having too many functions in a single file.
|
||||
- End each file with a newline character.
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Ensure code is clean and free of unnecessary or redundant elements.
|
||||
- Follow the DRY principle (Don’t Repeat Yourself) by reusing existing functions and utilities.
|
||||
|
||||
## Automated Tools
|
||||
|
||||
- Use linters or formatters integrated into your editor to ensure consistent style.
|
||||
- Run tests and validate changes before submitting.
|
||||
|
||||
---
|
||||
|
||||
Adhering to these guidelines ensures that the Fennix codebase remains robust, readable, and easy to maintain. Thank you for your effort and commitment to quality!
|
Loading…
x
Reference in New Issue
Block a user