diff options
authorKatharina Fey <kookie@spacekookie.de>2019-07-23 12:42:43 +0200
committerKatharina Fey <kookie@spacekookie.de>2019-07-23 12:42:43 +0200
commite234a2baa210df4c4376e0b378f0b2cbbf79d84b (patch)
parent27814bbae0854adb916d39f82c29590e903c3584 (diff)
Adding some examples to the READMEHEADmaster
1 files changed, 33 insertions, 0 deletions
diff --git a/README.md b/README.md
index 4644332..bd9ac7b 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,39 @@ I hope you enjoy ❤
[badge-link]: https://builds.sr.ht/~spacekookie/libbowl?
[issues]: https://todo.sr.ht/~spacekookie/libbowl
+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.
+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.
+// ...
+DEBUG (bowl_free(list))
How to build