diff doc/docs/dev/api/core/util.md @ 253:c4da052c0def

core: goodbye doxygen
author David Demelier <markand@malikania.fr>
date Thu, 03 Dec 2020 09:06:52 +0100
parents
children bfde372bf152
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/docs/dev/api/core/util.md	Thu Dec 03 09:06:52 2020 +0100
@@ -0,0 +1,55 @@
+# Module: util
+
+Synopsis
+
+```c
+#include <core/util.h>
+```
+
+Miscellaneous utilities.
+
+## Macros
+
+### NELEM
+
+Get the number of elements in the static C array `x`.
+
+```c
+#define NELEM(x) sizeof ((x)) / sizeof ((x)[0])
+```
+
+## functions
+
+### delay
+
+Put the thread to sleep for a given amount `ms` milliseconds.
+
+```c
+void
+delay(unsigned int ms)
+```
+
+### pprintf
+
+Construct a temporary path to a file that can fit in a `PATH_MAX` array.
+
+This function is useful when specifying paths into a function invocation such
+as `fopen(pprintf("%s.png", i), "r"))`.
+
+Format string is similar to [printf][]
+
+```c
+const char *
+pprintf(const char *fmt, ...)
+```
+
+### nrand
+
+Returns a random number between `lower` and `upper` (included).
+
+```c
+unsigned int
+nrand(unsigned int lower, unsigned int upper)
+```
+
+[printf]: https://en.cppreference.com/w/c/io/fprintf