apfl/src/format.h

32 lines
741 B
C
Raw Normal View History

#ifndef APFL_FORMAT_H
#define APFL_FORMAT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include "apfl.h"
struct apfl_format_writer {
bool (*write)(void *, const char *buf, size_t len);
void *opaque;
};
struct apfl_format_writer apfl_format_file_writer(FILE *f);
bool apfl_format_put_string_view(struct apfl_format_writer, struct apfl_string_view);
#define apfl_format_put_string(w, s) apfl_format_put_string_view((w), apfl_string_view_from(s))
bool apfl_format_put_int(struct apfl_format_writer, int);
bool apfl_format_put_char(struct apfl_format_writer, char);
bool apfl_format_put_hexbyte(struct apfl_format_writer, unsigned char);
#ifdef __cplusplus
}
#endif
#endif