meta: rename to fx
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
#ifndef FX_COMPRESS_COMPRESSOR_H_
|
||||
#define FX_COMPRESS_COMPRESSOR_H_
|
||||
|
||||
#include <fx/core/macros.h>
|
||||
#include <fx/core/misc.h>
|
||||
#include <fx/core/ringbuffer.h>
|
||||
#include <fx/core/status.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
FX_DECLS_BEGIN;
|
||||
|
||||
typedef enum fx_compressor_mode {
|
||||
FX_COMPRESSOR_MODE_NONE = 0,
|
||||
FX_COMPRESSOR_MODE_COMPRESS,
|
||||
FX_COMPRESSOR_MODE_DECOMPRESS,
|
||||
} fx_compressor_mode;
|
||||
|
||||
typedef enum fx_compressor_flags {
|
||||
FX_COMPRESSOR_EOF = 0x01u,
|
||||
} fx_compressor_flags;
|
||||
|
||||
#define FX_TYPE_COMPRESSOR (fx_compressor_get_type())
|
||||
|
||||
FX_DECLARE_TYPE(fx_compressor);
|
||||
|
||||
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_compressor)
|
||||
fx_status (*c_buffer_size)(fx_compressor_mode, size_t *, size_t *);
|
||||
fx_status (*c_set_mode)(fx_compressor *, fx_compressor_mode);
|
||||
fx_status (*c_compress)(fx_compressor *);
|
||||
fx_status (*c_compress_end)(fx_compressor *);
|
||||
fx_status (*c_decompress)(fx_compressor *);
|
||||
fx_status (*c_reset)(fx_compressor *);
|
||||
FX_TYPE_CLASS_DECLARATION_END(fx_compressor)
|
||||
|
||||
typedef struct fx_compressor_data {
|
||||
fx_compressor_flags c_flags;
|
||||
fx_compressor_mode c_mode;
|
||||
fx_ringbuffer *c_in, *c_out;
|
||||
} fx_compressor_data;
|
||||
|
||||
FX_API fx_type fx_compressor_get_type(void);
|
||||
|
||||
#if 0
|
||||
FX_API fx_status fx_compressor_create(
|
||||
const struct fx_compression_function *func, enum fx_compression_mode mode,
|
||||
struct fx_ringbuffer *inbuf, struct fx_ringbuffer *outbuf,
|
||||
fx_compressor **out);
|
||||
#endif
|
||||
|
||||
FX_API fx_status fx_compressor_get_buffer_size(
|
||||
fx_type type, fx_compressor_mode mode, size_t *inbuf_size,
|
||||
size_t *outbuf_size);
|
||||
|
||||
FX_API fx_status fx_compressor_get_mode(
|
||||
const fx_compressor *compressor, fx_compressor_mode *out);
|
||||
FX_API fx_status fx_compressor_set_mode(
|
||||
fx_compressor *compressor, fx_compressor_mode mode);
|
||||
FX_API fx_status fx_compressor_set_buffer(
|
||||
fx_compressor *compressor, fx_ringbuffer *inbuf, fx_ringbuffer *outbuf);
|
||||
FX_API fx_status fx_compressor_step(fx_compressor *compressor);
|
||||
FX_API fx_status fx_compressor_end(fx_compressor *compressor);
|
||||
FX_API fx_status fx_compressor_reset(fx_compressor *compressor);
|
||||
FX_API bool fx_compressor_eof(const fx_compressor *compressor);
|
||||
|
||||
FX_DECLS_END;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
#ifndef FX_COMPRESS_CSTREAM_H_
|
||||
#define FX_COMPRESS_CSTREAM_H_
|
||||
|
||||
#include <fx/core/macros.h>
|
||||
#include <fx/core/stream.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
FX_DECLS_BEGIN;
|
||||
|
||||
enum fx_compressor_mode;
|
||||
|
||||
#define FX_TYPE_CSTREAM (fx_cstream_get_type())
|
||||
|
||||
FX_DECLARE_TYPE(fx_cstream);
|
||||
|
||||
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_cstream)
|
||||
FX_TYPE_CLASS_DECLARATION_END(fx_cstream)
|
||||
|
||||
FX_API fx_type fx_cstream_get_type(void);
|
||||
|
||||
FX_API fx_status fx_cstream_open(
|
||||
fx_stream *endpoint, fx_type compressor_type, enum fx_compressor_mode mode,
|
||||
fx_cstream **out);
|
||||
|
||||
FX_API fx_status fx_cstream_read(
|
||||
fx_cstream *stream, void *buf, size_t count, size_t *nr_read);
|
||||
FX_API fx_status fx_cstream_write(
|
||||
fx_cstream *stream, const void *buf, size_t count, size_t *nr_written);
|
||||
FX_API fx_status fx_cstream_skip(
|
||||
fx_cstream *stream, size_t count, size_t *nr_skipped);
|
||||
FX_API fx_status fx_cstream_reset(fx_cstream *stream);
|
||||
|
||||
FX_API fx_status fx_cstream_begin_compressed_section(
|
||||
fx_cstream *stream, size_t *tx_uncompressed_bytes);
|
||||
FX_API fx_status fx_cstream_end_compressed_section(
|
||||
fx_cstream *stream, size_t *tx_compressed_bytes,
|
||||
size_t *tx_uncompressed_bytes);
|
||||
FX_API bool fx_cstream_in_compressed_section(const fx_cstream *stream);
|
||||
FX_API fx_status fx_cstream_tx_bytes(const fx_cstream *stream, size_t *out);
|
||||
FX_API fx_status fx_cstream_tx_bytes_compressed(
|
||||
const fx_cstream *stream, size_t *out);
|
||||
FX_API fx_status fx_cstream_tx_bytes_uncompressed(
|
||||
const fx_cstream *stream, size_t *out);
|
||||
|
||||
FX_API fx_status fx_cstream_set_cursor_position(fx_cstream *stream, size_t pos);
|
||||
FX_API fx_status fx_cstream_restore_cursor_position(fx_cstream *stream);
|
||||
|
||||
FX_DECLS_END;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef FX_COMPRESS_ZSTD_H_
|
||||
#define FX_COMPRESS_ZSTD_H_
|
||||
|
||||
#include <fx/compress/compressor.h>
|
||||
#include <fx/core/macros.h>
|
||||
#include <fx/core/misc.h>
|
||||
#include <fx/core/status.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
FX_DECLS_BEGIN;
|
||||
|
||||
#define FX_TYPE_ZSTD_COMPRESSOR (fx_zstd_compressor_get_type())
|
||||
|
||||
FX_DECLARE_TYPE(fx_zstd_compressor);
|
||||
|
||||
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_zstd_compressor)
|
||||
FX_TYPE_CLASS_DECLARATION_END(fx_compressor)
|
||||
|
||||
FX_API fx_type fx_zstd_compressor_get_type(void);
|
||||
|
||||
FX_API fx_status fx_zstd_compressor_get_buffer_size(
|
||||
fx_compressor_mode mode, size_t *inbuf_size, size_t *outbuf_size);
|
||||
|
||||
FX_TYPE_DEFAULT_CONSTRUCTOR(fx_zstd_compressor, FX_TYPE_ZSTD_COMPRESSOR);
|
||||
|
||||
FX_DECLS_END;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user