apfl/src/format.h
Laria Carolin Chabowski 55c95f99ad Rename format => io_writer
To make it clearer that this can be used for writing binary data too.
2023-02-10 21:48:31 +01:00

30 lines
499 B
C

#ifndef APFL_FORMAT_H
#define APFL_FORMAT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include "apfl.h"
#define FMT_TRY(x) do { if (!(x)) return false; } while (0)
struct format_spec {
const char *name;
bool (*callback)(void *, struct apfl_io_writer, struct apfl_string_view arg);
};
bool apfl_abstract_format(
void *opaque,
const struct format_spec *specs,
struct apfl_io_writer w,
struct apfl_string_view fmt
);
#ifdef __cplusplus
}
#endif
#endif