Понадобился хороший прогрессбар для Си, делюсь.
https://github.com/charlesnicholson/improg:
Immediate-mode terminal progress bars in C
Zero memory allocations, no state.
Improg is dual-licensed under both the «Unlicense» and the «Zero-Clause BSD» (0BSD) licenses. The intent of this dual-licensing structure is to make improg as consumable as possible in as many environments / countries / companies as possible without encumbering users.
This license applies to all of the improg source code, build code, and tests, with the explicit exception of doctest.h, which exists under its own license and is included in this repository.
Кусочек improg-demo.c (gif-анимация):
#define VERIFY_IMP(CALLABLE) \
do { if ((CALLABLE) != IMP_RET_SUCCESS) { printf("error\n"); exit(1); } } while (0)
static void test_label(imp_ctx_t *ctx) {
imp_widget_def_t const w = IMP_WIDGET_COMPOSITE(-1, 3, IMP_ARRAY(
IMP_WIDGET_LABEL("Label : "),
IMP_WIDGET_LABEL("[simple] "),
IMP_WIDGET_LABEL("[complex 🐛🐛🐛🐛🐛 ∅🍺🍻🍷🍹💯]")));
imp_value_t const v =
IMP_VALUE_COMPOSITE(3, IMP_ARRAY(IMP_VALUE_NULL(), IMP_VALUE_NULL(), IMP_VALUE_NULL()));
VERIFY_IMP(imp_draw_line(ctx, NULL, NULL, &w, &v));
}
static void test_scalar(imp_ctx_t *ctx) {
imp_widget_def_t const w = IMP_WIDGET_COMPOSITE(-1, 9, IMP_ARRAY(
IMP_WIDGET_LABEL("Scalar : int=["),
IMP_WIDGET_SCALAR(-1, -1),
IMP_WIDGET_LABEL("] imax=["),
IMP_WIDGET_SCALAR(-1, -1),
IMP_WIDGET_LABEL("] fpos=["),
IMP_WIDGET_SCALAR(-1, 9),
IMP_WIDGET_LABEL("] fneg=["),
IMP_WIDGET_SCALAR(-1, -1),
IMP_WIDGET_LABEL("]")));
imp_value_t const v = IMP_VALUE_COMPOSITE(9, IMP_ARRAY(
IMP_VALUE_NULL(),
IMP_VALUE_INT(12345678),
IMP_VALUE_NULL(),
IMP_VALUE_INT(9223372036854775807LL),
IMP_VALUE_NULL(),
IMP_VALUE_DOUBLE(1234.567891011),
IMP_VALUE_NULL(),
IMP_VALUE_DOUBLE(-1234.567891),
IMP_VALUE_NULL()));
VERIFY_IMP(imp_draw_line(ctx, NULL, NULL, &w, &v));
}



