mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 01:01:35 +01:00
Spin out a std/lzw package
This commit is contained in:
1 parent
3e1cdd1a83
commit
6d510bcfcb
13 files changed
+3973
-565
No files matched your search
+120
-38
@@ -1150,6 +1150,125 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane(
|
||||
|
||||
// ---------------- Use Declarations
|
||||
|
||||
// ---------------- BEGIN USE "std/lzw"
|
||||
|
||||
#ifndef WUFFS_LZW_H
|
||||
#define WUFFS_LZW_H
|
||||
|
||||
// Code generated by wuffs-c. DO NOT EDIT.
|
||||
|
||||
// ---------------- Use Declarations
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// ---------------- Status Codes
|
||||
|
||||
// Status codes are int32_t values. Its bits:
|
||||
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
|
||||
// - bits 30 .. 10 are the packageid: a namespace.
|
||||
// - bits 9 .. 8 are reserved.
|
||||
// - bits 7 .. 0 are a package-namespaced numeric code.
|
||||
//
|
||||
// Do not manipulate these bits directly; they are private implementation
|
||||
// details. Use methods such as wuffs_lzw__status__is_error instead.
|
||||
typedef int32_t wuffs_lzw__status;
|
||||
|
||||
#define wuffs_lzw__packageid 1316776 // 0x001417A8
|
||||
|
||||
#define WUFFS_LZW__STATUS_OK 0 // 0x00000000
|
||||
#define WUFFS_LZW__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001
|
||||
#define WUFFS_LZW__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002
|
||||
#define WUFFS_LZW__ERROR_BAD_RECEIVER -2147483645 // 0x80000003
|
||||
#define WUFFS_LZW__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004
|
||||
#define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
|
||||
-2147483643 // 0x80000005
|
||||
#define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
|
||||
-2147483642 // 0x80000006
|
||||
#define WUFFS_LZW__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007
|
||||
#define WUFFS_LZW__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008
|
||||
#define WUFFS_LZW__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009
|
||||
#define WUFFS_LZW__SUSPENSION_SHORT_READ 10 // 0x0000000A
|
||||
#define WUFFS_LZW__SUSPENSION_SHORT_WRITE 11 // 0x0000000B
|
||||
#define WUFFS_LZW__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C
|
||||
#define WUFFS_LZW__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D
|
||||
#define WUFFS_LZW__SUSPENSION_END_OF_DATA 14 // 0x0000000E
|
||||
|
||||
#define WUFFS_LZW__ERROR_CODE_IS_OUT_OF_RANGE -799105024 // 0xD05EA000
|
||||
#define WUFFS_LZW__ERROR_PREFIX_CHAIN_IS_CYCLICAL -799105023 // 0xD05EA001
|
||||
|
||||
bool wuffs_lzw__status__is_error(wuffs_lzw__status s);
|
||||
|
||||
const char* wuffs_lzw__status__string(wuffs_lzw__status s);
|
||||
|
||||
// ---------------- Public Consts
|
||||
|
||||
// ---------------- Structs
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so. Instead, use the
|
||||
// wuffs_lzw__decoder__etc functions.
|
||||
//
|
||||
// In C++, these fields would be "private", but C does not support that.
|
||||
//
|
||||
// It is a struct, not a struct*, so that it can be stack allocated.
|
||||
struct {
|
||||
wuffs_lzw__status status;
|
||||
uint32_t magic;
|
||||
|
||||
uint32_t f_literal_width;
|
||||
uint8_t f_stack[4096];
|
||||
uint8_t f_suffixes[4096];
|
||||
uint16_t f_prefixes[4096];
|
||||
|
||||
struct {
|
||||
uint32_t coro_susp_point;
|
||||
uint32_t v_literal_width;
|
||||
uint32_t v_clear_code;
|
||||
uint32_t v_end_code;
|
||||
uint32_t v_save_code;
|
||||
uint32_t v_prev_code;
|
||||
uint32_t v_width;
|
||||
uint32_t v_bits;
|
||||
uint32_t v_n_bits;
|
||||
uint32_t v_code;
|
||||
uint32_t v_s;
|
||||
uint32_t v_c;
|
||||
uint64_t v_n_copied;
|
||||
} c_decode[1];
|
||||
} private_impl;
|
||||
} wuffs_lzw__decoder;
|
||||
|
||||
// ---------------- Public Initializer Prototypes
|
||||
|
||||
// wuffs_lzw__decoder__check_wuffs_version is an initializer function.
|
||||
//
|
||||
// It should be called before any other wuffs_lzw__decoder__* function.
|
||||
//
|
||||
// Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
|
||||
void wuffs_lzw__decoder__check_wuffs_version(wuffs_lzw__decoder* self,
|
||||
size_t sizeof_star_self,
|
||||
uint32_t wuffs_version);
|
||||
|
||||
// ---------------- Public Function Prototypes
|
||||
|
||||
void wuffs_lzw__decoder__set_literal_width(wuffs_lzw__decoder* self,
|
||||
uint32_t a_lw);
|
||||
|
||||
wuffs_lzw__status wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
||||
wuffs_base__io_writer a_dst,
|
||||
wuffs_base__io_reader a_src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // WUFFS_LZW_H
|
||||
|
||||
// ---------------- END USE "std/lzw"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -1196,8 +1315,6 @@ typedef int32_t wuffs_gif__status;
|
||||
#define WUFFS_GIF__ERROR_INTERNAL_ERROR_INCONSISTENT_RI_WI \
|
||||
-1105848313 // 0xBE161807
|
||||
#define WUFFS_GIF__ERROR_TODO_UNSUPPORTED_INTERLACING -1105848312 // 0xBE161808
|
||||
#define WUFFS_GIF__ERROR_LZW_CODE_IS_OUT_OF_RANGE -1105848311 // 0xBE161809
|
||||
#define WUFFS_GIF__ERROR_LZW_PREFIX_CHAIN_IS_CYCLICAL -1105848310 // 0xBE16180A
|
||||
|
||||
bool wuffs_gif__status__is_error(wuffs_gif__status s);
|
||||
|
||||
@@ -1207,41 +1324,6 @@ const char* wuffs_gif__status__string(wuffs_gif__status s);
|
||||
|
||||
// ---------------- Structs
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so. Instead, use the
|
||||
// wuffs_gif__lzw_decoder__etc functions.
|
||||
//
|
||||
// In C++, these fields would be "private", but C does not support that.
|
||||
//
|
||||
// It is a struct, not a struct*, so that it can be stack allocated.
|
||||
struct {
|
||||
wuffs_gif__status status;
|
||||
uint32_t magic;
|
||||
|
||||
uint32_t f_literal_width;
|
||||
uint8_t f_stack[4096];
|
||||
uint8_t f_suffixes[4096];
|
||||
uint16_t f_prefixes[4096];
|
||||
|
||||
struct {
|
||||
uint32_t coro_susp_point;
|
||||
uint32_t v_literal_width;
|
||||
uint32_t v_clear_code;
|
||||
uint32_t v_end_code;
|
||||
uint32_t v_save_code;
|
||||
uint32_t v_prev_code;
|
||||
uint32_t v_width;
|
||||
uint32_t v_bits;
|
||||
uint32_t v_n_bits;
|
||||
uint32_t v_code;
|
||||
uint32_t v_s;
|
||||
uint32_t v_c;
|
||||
uint64_t v_n_copied;
|
||||
} c_decode[1];
|
||||
} private_impl;
|
||||
} wuffs_gif__lzw_decoder;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so. Instead, use the
|
||||
@@ -1279,7 +1361,7 @@ typedef struct {
|
||||
uint32_t f_uncompressed_wi;
|
||||
uint8_t f_uncompressed[4096];
|
||||
uint8_t f_palettes[2][1024];
|
||||
wuffs_gif__lzw_decoder f_lzw;
|
||||
wuffs_lzw__decoder f_lzw;
|
||||
|
||||
struct {
|
||||
uint32_t coro_susp_point;
|
||||
|
||||
Reference in new issue
Block a user