This library provides Core Functionality built upon the C language for the C language. Inspired and taken from Modern Languages such as Python, Rust etc. Sub-divided into Five major portions.
- Memory Tracker
- Type
- Pre-Processing/Meta-Programming.
- Multi-Threading
- Standard Functions
A simple memory tracker for debug purpose. NOT GC (Garbage Collector).
- A wrapper around malloc, calloc, realloc, free. z__MALLOC, z__CALLOC, z__REALLOC, z__FREE.
- Logging memory allocation and de-allocation that can output in any file-stream including stdout.
- Evaluation of Total allocation and free, helps to combat memory leaks and such
Types to allow more stable/systamatic programming procedure, no more impletate this basic functionaity 10 different ways in 10 different programs.
- Primitive Types
- Algebraic data type
- String
- String List
- String List Array
- Arrays
- Vector Types
- Matrices
- Linked List
Meta-programming using C-preprocessor.
Multi-Threading wrapper arround both OpenMP and Pthread with C11 <threads.h> considered for the future.
The Development has started with OpenMP.
Pthreads impletation has also started with its base.
Lastly z_ Also Provides Basic day-to-day set of functions revolving around Time, File IO, System, Logging and many more.
z_ is made with modularity in mind so many parts of it are as self-isolated as they can,
it doesnt even include standard library except stddef.h, stdint.h and stdbool.h for type
declaration but they still require the bare minimum base for to be working properly such
as, z_/types/types/arr.h can be included in itself but it still require base.h of types
for z__u32 and mem.h for memory allocation definations.
Inorder to integrated z_ in your project only
git clone --depth=1 git://github.com/zakarouf/z_.git
sh make-lib.shWill result a library libzkcollection.a created in the ./build/lib and headers at ./build/include as z_ directory.
Copy the z_ folder onto your include directory. And copy the libzkcollection.a to the lib directory and link it against the executable and we are good to go.
#include <z_/z_.h>Run the install.sh script.
sh install.shThis will run the make-lib.sh script and move the headers and the library to their designated path in your system.
By Default, the path for Headers is usr/local/include/z_ and for library it is libzkcollection.a, you can change it by editing the
install.sh file itself, LIB_DIR and INCLUDE_DIR to be specfic.
Inside the source directory config_{MODULE}.h that can be modified by the user in-order to change the behaviour, include, exclude the fuctionality of that sub-library.
{MODULE} is the name of the Module i.e. config_imp.h, config_prep.h etc.
Such as inside of src/config_types.h
#define Z___TYPE_CONFIG__USE_TYPE_LINKEDLISTThis particular config tells to include the Linked List type and its functionaity at core; when
z_.h is included, and if we comment out it
//#define Z___TYPE_CONFIG__USE_TYPE_LINKEDLISTWill result in a error This forces to you to include linked list type manually.
#include "z_/types/types/llist.h"Now this will work as it should.
Additional syntax Highlighting for types and such are include in the extra/c.vim.
To add it into your project, either copy the contents of the c.vim file or put
c.vim into your after/syntax folder, such as ~/.config/vim/after/syntax/ directory.
This will load on top of your syntax highlighting for every .c file.
This library is not perfect and I know there are many others like it, but this one is mine.