From 57033d0ef1810abf4edd9d8e57a95a5795e5a5a9 Mon Sep 17 00:00:00 2001 From: justanothercatgirl Date: Sat, 22 Jun 2024 18:16:54 +0300 Subject: added `rstypes` header. --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 137e97b..54aa525 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,17 @@ This is just a collection of (usually single-purpos) header files that I use ref * Names starting with underscores are kind of private-use for this libraries, but they may be declared not `static` because they are used in macros that expose API. * `snake_case` * Function-like macros are not all-caps. -* For now i only support GCC-based compilers. I will consider removing this dependency in future (e.g. getting rid of that [`__qsort_cmps` declaration](include/utility.h)). +* For now i only support GCC-based compilers. I will consider removing this dependency in future (e.g. getting rid of all `typeof` uses) # Descriptions for heders: -## [`dynarray.h`](include/dynarray.h) -* Summary: A flexible and easy-to-use dynamically-sized array implementation based on the idea of storing metadata about array to the left of actual data. this allows it to be used interchangabely as a regular C array and as dynamic array. -* How to use: Define `DYNARRAY_IMPLEMENTATION` macro before including `dynarray.h`. If you are using functions to sort the array (`array_qsort_integral`), you also have to define `UTILITY_IMPLEMENTATION` (as it uses integer comparison functions from there) -* Examples: See [tests](tests/dynarray.c) -## [`utility.h`](include/utility.h) -* Summary: Some commonly-used macros and functions in this library, could as well be called `miscellaneous`. -* How to use: Define `UTILITY_IMPLEMENTATION` macro before including `utility.h`. If you want it to expose helper functions/variables (which you may want, check the source), define macro `UTILITY_EXPOSE_HELPERS`. -* Examples: there are kind of no examples for this, i guess you could search for the usages in [`dynarray.h`](include/dynarray.h) +## [`container.h`](include/container.h) +* Summary: originally was several headers, but since `hash_map.h` used `dynarray.h`, which itself used `utility.h`, it was too complex to work with. So i combined everything in a single header. +* How to use: Define `CONTAINER_IMPLEMENTATION` macro before including `container.h`. It's probably better to `#undef` it after inclusion as well +* Examples: See [tests](tests) +## [`rstypes.h`](include/rstypes.h) +* Summary: rust type aliases (like `u32`, `f128` e.t.c.) +* How to use: if you don't need `i128` or `u128`, then just include the header. If you do need them, define macro `RS_TYPES_USE_128`. +* Examples: See [tests](tests/types.c). +* Notes: Not many compilers support 128-bit wide integers, and ones which DO support them tend to warn you that these are non ISO-C. That's why I've put them behind a macro. If they are not supported, their usage will fail with compilation error. ## [`embed.h`](include/embed.h) * Summary: Code generator for embedding resources directly into an executable. * How to use: It exposes C interface, so in order to use it, you will need to have a C program that builds resources for you. It has it's own repo, but i will be adding CLI to there soon. @@ -25,5 +26,5 @@ nearest TODO for now. # Warning! Everything here is written by a relatively inexperienced student (me), so I guarantee basically nothing. Memory leaks? I am sorry for them, but also not responsible. Security? Haven't heard of that either. That's just how it is. But I try to make everything as good as possible, so you can use the code after a careful review. # License -I did not decide on it yet, but I am inclined towards MIT or even public domain. Don't want to restrict the usage with LGPL, because it's not like this code is a big deal, anyone could write it. Also, I don't want to deal with license issues that I created for myself in future, so yeah, that's how it is. For now, public domain. +I did not decide on it yet, but I am inclined towards MIT or even public domain. Don't want to restrict the usage with LGPL, because it's not like this code is a big deal, anyone could write it. Also, I don't want to deal with license issues that I can create for my future self, so yeah, that's how it is. For now, public domain. -- cgit v1.2.3-70-g09d2