diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1,7 +1,7 @@ # What is this? This is just a collection of (usually single-purpos) header files that I use refularly in my code # Common conventions -* As these are header-only libraries, there is a macro in form `HEADERNAME_IMPLEMENTATION` that has to be defined before including the header. A header can only be included once while this macro is defined, otherwise you get multiple definition errors. +* As these are header-only libraries, there is a macro in form `HEADER_NAME_IMPLEMENTATION` that has to be defined before including the header. A header can only be included once while this macro is defined, otherwise you get multiple definition errors. * 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. @@ -11,6 +11,7 @@ This is just a collection of (usually single-purpos) header files that I use ref * 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. To use some functions (`__default_int_cmp` and alikes), define `CONTAINER_EXPOSE_HELPERS`. * Examples: See [tests](tests) +* Notes: if compiled in shared object, must be compiled with -fPIC ### Additional macros * SHRINK\_RESIGING\_ARRAY: Reallocate the array to smaller capacity when it's size becomes too small. Not impelemented at the moment. ## [`rstypes.h`](include/rstypes.h) @@ -25,6 +26,7 @@ This is just a collection of (usually single-purpos) header files that I use ref ## [`jacson.h`](include/jacson.h) * Summary: Spec-compliant json serializer and parser * How to use: define `JACSON_IMPLEMENTATION` macro. `CONTAINER_IMPLEMENTATION` MUST be defined as well; either somewhere earlier in the code before including `container.h` or just before `jacson.h`. this JSON implementation uses `array` and `hash_set`. +* Macros: `JACSON_EXPORT_RSNPRINTF` will make symbols `__jacson_rsnprintf` and `__jacson_rsnputc` visible. These 2 functions allow for appending a string to a buffer obtained from malloc and resizing it (realloc) if needed. They're not visible by default because they do not have obvious friendly signature. ## `build.h` nearest TODO for now. * Summary: a build system based on C. To compile something under it, you do something like `cc -o builder builder.c && ./builder`. The idea is stolen from [Tsoding](https://example.com) |