libbowl [![][badge]][badge-link] ======= The last C datastructure library you will ever use. Provides a versalite API to build nested, serial and hashed structure nodes. Check out the [issue tracker][issues] I hope you enjoy ❤ [badge]: https://builds.sr.ht/~spacekookie/libbowl.svg [badge-link]: https://builds.sr.ht/~spacekookie/libbowl? [issues]: https://todo.sr.ht/~spacekookie/libbowl Exampple -------- The root structure in `libbowl` is a `bowl`. It can either be a leaf node, containing some data (`bowl_data`, which can be many types), or be a structure node, either in `ARRAY`, `LINK` or `HASH` mode. Each `libbowl` function returns a status code and uses reverse-input pointers to communicate results. A convenience `DEBUG` macro is included. ```C bowl *list; int r = bowl_malloc(&list, ARRAY); if(r) { printf("Failed to malloc!\n"); exit(2); } // `DEBUG` does the same thing as the above `if` bowl *number; DEBUG (data_malloc(&number, INTEGER, 1312)) // Finally append data into list DEBUG (bowl_append(list, number)) ``` Generally, `data` prefixed functions are convenience wrappers around allocating a `bowl`, setting it's type to `LEAF`, and inserting some data into it (performing at least 2 allocation calls). Freeing a `bowl` structure is as easy as calling free on the top node. ```C // ... DEBUG (bowl_free(list)) ``` How to build ------------ Build dependencies - gcc (`4.0+`) - cmake (`2.18+`) An out-of-source build is recommended. You can specify the linking behaviour with `-DLINK_DYNAMIC=1`. Optionally you can disable tests with `-DRUN_TESTS=0`. ``` $ mkdir build; cd build $ cmake .. -DLINK_DYNAMIC=1 -DRUN_TESTS=1 $ make ``` License ------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.