https://github.com/agvxov/dictate
The Überfunktion of printing. Generics, colors, formats, margins, it has them all.
https://github.com/agvxov/dictate
c library modern-c pretty-print
Last synced: about 1 year ago
JSON representation
The Überfunktion of printing. Generics, colors, formats, margins, it has them all.
- Host: GitHub
- URL: https://github.com/agvxov/dictate
- Owner: agvxov
- Created: 2025-01-13T16:32:33.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-20T10:20:53.000Z (over 1 year ago)
- Last Synced: 2025-03-27T17:46:19.131Z (over 1 year ago)
- Topics: c, library, modern-c, pretty-print
- Language: C
- Homepage:
- Size: 280 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dictate
> The Überfunktion of printing. Generics, colors, formats, margins, it has them all.
Dictate is a family of print functions tailored,
but not limited to the cli.
**Dictate**
- is generic,
- is variadic,
- resolves irritating `` inconsistencies,
- has debug variants,
- has a convenient way to handle colors,
- and adds margin support.
## Example

## Generic and variadic?
Yes, `dictate()` is generic and variadic.
You can pass in as many arguments as you wish and with the types you wish,
without requiring a format string.
Unless of couse you *want* a format string,
in which case `dictatef()`
-behaving like `printf()`, but with the rest of the dictate features-
has you covered.
This is accomplished with a combination of C11's `_Generic` and macros.
## Irritating stdio inconsistencies
The sole reason dictate exists is this:
```C
fprintf(FILE *, char *, ...); // FILE first
fputs(char *, FILE *); // FILE last
```
## Colors
With dictate,
instead of passing in ascii escape sequences directly,
you pass in color specifies of the form: `$`.
Not only is this easier to remember,
you can also toggle their rendering (per thread),
which makes implementing something like `NO_COLOR` compliance trivial.
## Debug builds
Dictate provides `debug_*` variants for its every function.
These are only executed if `DEBUG` was defined,
otherwise they result in nops.
## Margins
Margins are characters which appear on the left of each line of an output.
They are useful for distinguishing regions of output for a reader.
Examples would include `valgrind` or `cmdtest`.
Dictate has function variants which produce such margins.
## Notes
Dictate requires C23.
For the full documentation,
please consult the [header](dictate.h),
it was made to be readable.