To make it clearer that this can be used for writing binary data too.
30 lines
499 B
C
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
|