ciabatta/readme.md

138 lines
5.6 KiB
Markdown
Raw Permalink Normal View History

2022-06-20 03:51:19 +00:00
2023-06-24 15:50:53 +00:00
# Ciabatta
2022-06-26 04:39:15 +00:00
2023-07-23 09:43:38 +00:00
![Linux](https://github.com/flysand7/ciabatta/actions/workflows/build-linux.yml/badge.svg?event=push)
2023-07-28 11:47:06 +00:00
![Windows](https://github.com/flysand7/ciabatta/actions/workflows/build-windows.yml/badge.svg?event=push)
2023-06-24 15:52:53 +00:00
2022-08-06 11:53:50 +00:00
Ciabatta - An implementation of cross-platform C standard library with the
following goals:
- Providing C standard library that fully implements all C features. Some
standard libraries lack many features of C11 and C23, like threads.h or
2023-07-28 13:50:04 +00:00
aligned_alloc in case of MSVCRT.
2022-08-06 11:53:50 +00:00
- Making standard library that is easy to port to other platforms, for example
an embedded platform or a custom operating system.
- Allowing applications to debug and step into standard library functions
2023-07-28 13:50:04 +00:00
(Hello MSVCRT!)
- Reasonably fast CRT compared to MSVCRT and glibc, e.g. making malloc use
a faster allocator, avoid runtime checks where possible, heavely rely on
inlining.
2022-08-06 11:53:50 +00:00
- Extend the possibilities of C standard library with commonly used
2023-07-28 13:50:04 +00:00
functionality: implementing POSIX standard, capability for unicode
processing, API to traverse directories, hash functions, better strings API,
crash handlers.
2022-08-06 11:53:50 +00:00
Ciabatta is not binary-compatible with other CRT libraries. That means that any
libraries that your project uses have to also be compiled with Ciabatta,
2023-07-28 13:50:04 +00:00
otherwise you will run into issues.
2022-08-06 11:53:50 +00:00
Please note that as of today ciabatta is still during development and does not
implement many of the features that need to be implemented. Using it at current
time is discouraged.
2023-07-30 22:01:03 +00:00
## Current Status
### C23 standard library
| Header | Description | Status |
| --------------- | ------------------------------------ | ----------- |
| <assert.h> | Diagnostics. | none |
| <complex.h> | Complex arithmetic. | none |
| <ctype.h> | Character handling. | none |
2023-09-10 10:25:10 +00:00
| <errno.h> | Errors. | Implemented |
2023-07-30 22:01:03 +00:00
| <fenv.h> | Floating-point environment. | none |
| <float.h> | Characteristics of floating types. | none |
| <inttypes.h> | Format conversion of integer types. | none |
| <iso646.h> | Alternative spellings. | none |
2023-09-10 10:25:10 +00:00
| <limits.h> | Sizes of integer types. | Implemented |
2023-07-30 22:01:03 +00:00
| <locale.h> | Localization. | none |
| <math.h> | Mathematics. | none |
| <setjmp.h> | Nonlocal jumps. | [1] |
| <signal.h> | Signal handling. | none |
| <stdalign.h> | Alignment. | none |
| <stdarg.h> | Variable arguments. | none |
2023-08-26 11:35:18 +00:00
| <stdatomic.h> | Atomics. | [1] |
2023-07-30 22:01:03 +00:00
| <stdbit.h> | Bit and byte utilities | none |
| <stdbool.h> | Boolean type and values. | none |
| <stddef.h> | Common definitions. | none |
| <stdint.h> | Integer types. | Implemented |
2023-09-10 10:25:10 +00:00
| <stdio.h> | Input/output. | Partial |
2023-07-30 22:01:03 +00:00
| <stdlib.h> | General utilities. | none |
| <stdnoreturn.h> | `_Noreturn`. | none |
2023-09-11 16:03:57 +00:00
| <string.h> | String handling. | Partial |
2023-07-30 22:01:03 +00:00
| <tgmath.h> | Type-generic math. | none |
2023-09-10 10:25:10 +00:00
| <threads.h> | Threads. | Partial |
2023-07-30 22:01:03 +00:00
| <time.h> | Date and time. | none |
| <uchar.h> | Unicode utilities. | none |
| <wchar.h> | Wide character utilities. | none |
| <wctype.h> | Wide character utilities. | none |
[1] Implemented by compilers
2023-06-24 15:50:53 +00:00
## Support
2022-08-06 11:53:50 +00:00
2023-06-24 15:50:53 +00:00
Operating System:
- Windows
2023-07-22 14:46:04 +00:00
- Linux
2022-06-20 03:51:19 +00:00
2022-08-06 11:53:50 +00:00
Processor Architecture:
- x86-64
2023-06-24 15:50:53 +00:00
This library is supposed to be extensible to other platforms, meaning that
you can write an OS layer for another OS and use the rest of the CRT
functionality.
2023-07-22 14:30:04 +00:00
## Building ciabatta
2022-08-06 11:53:50 +00:00
2023-07-22 14:46:04 +00:00
Before proceeding please note that ciabatta can only be compiled and used
2023-07-28 13:50:04 +00:00
with `clang` and `cuik`. It may be able to work with `gcc` with some minor adjustments
2023-09-10 10:25:10 +00:00
but I never tested it.
2023-06-24 15:50:53 +00:00
2023-07-28 13:50:04 +00:00
You can get `cuik` in [the GitHub repository](https://github.com/RealNeGate/Cuik)
2023-09-10 10:25:10 +00:00
On linux you can simply run `./build.py` script. On windows can run
it with `py build.py` command.
The script accepts some command-line arguments, which you can check by running
2023-07-23 09:36:23 +00:00
```
2023-09-10 10:25:10 +00:00
$ ./build.py -h
2023-07-23 09:36:23 +00:00
```
2023-07-22 14:30:04 +00:00
## Usage
Grab the following files into your project's (or any other) directory:
- The `./include` folder
2023-08-01 01:23:25 +00:00
- The `./lib` folder
- (Windows only) The `./utf8` folder
2023-07-22 14:30:04 +00:00
2023-08-01 01:23:25 +00:00
In order to compile your project with ciabatta see the following sections,
assuming you put all files mentioned above in the `./ciabatta` folder
2023-07-22 14:30:04 +00:00
### Compiling with ciabatta on windows
1. Add the following flags to your compilation command:
2023-08-01 01:23:25 +00:00
`-nostdlib -I ./ciabatta/include utf8.obj -mfma`
2023-07-28 13:50:04 +00:00
2. Add the following sources to the compile command:
`./ciabatta/lib/cia.lib`
2023-07-22 14:30:04 +00:00
**Note:** The `include` folder refers to the folder you copied from ciabatta. Set the path to it accordingly.
### Compiling with ciabatta on linux
2023-07-28 13:50:04 +00:00
1. Add the following flags to your compilation command:
2023-08-01 01:23:25 +00:00
- `-nostdlib -I ./ciabatta/include -mfma`
2023-07-28 13:50:04 +00:00
2. Link to the following libraries
- `./ciabatta/lib/cia.a`
3. Specify the ciabatta dynamic loader in linker options
- `-Wl,-dynamic-linker,lib/ld-cia.so`
2022-06-20 03:51:19 +00:00
2023-06-24 15:50:53 +00:00
## Contributing
2022-06-20 03:51:19 +00:00
2022-08-06 11:53:50 +00:00
Pull requests welcome and accepted in any form.
2022-06-20 03:51:19 +00:00
2023-06-24 15:50:53 +00:00
## License
2022-06-20 03:51:19 +00:00
2023-07-22 14:30:04 +00:00
See [the license file](license)