diff --git a/cmd/wuffs-c/internal/cgen/base/base-public.h b/cmd/wuffs-c/internal/cgen/base/base-public.h index 31d7b668..68d6518b 100644 --- a/cmd/wuffs-c/internal/cgen/base/base-public.h +++ b/cmd/wuffs-c/internal/cgen/base/base-public.h @@ -651,23 +651,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -679,7 +669,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -687,6 +677,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -715,6 +724,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue diff --git a/cmd/wuffs-c/internal/cgen/cgen.go b/cmd/wuffs-c/internal/cgen/cgen.go index c4648995..db35477f 100644 --- a/cmd/wuffs-c/internal/cgen/cgen.go +++ b/cmd/wuffs-c/internal/cgen/cgen.go @@ -366,6 +366,11 @@ func (g *gen) genHeader(b *buffer) error { return err } + b.writes("// ---------------- C++ Convenience Methods \n\n") + if err := g.writeCppImpls(b); err != nil { + return err + } + b.writes("\n#ifdef __cplusplus\n} // extern \"C\"\n#endif\n\n") b.printf("#endif // %s\n\n", includeGuard) return nil @@ -676,8 +681,95 @@ func (g *gen) writeStruct(b *buffer, n *a.Struct) error { } } } + b.writes("} private_impl;\n\n") - b.printf("} private_impl;\n } %s%s;\n\n", g.pkgPrefix, structName) + if n.Node().Raw().Flags()&a.FlagsPublic != 0 { + if err := g.writeCppPrototypes(b, n); err != nil { + return err + } + } + + b.printf("} %s%s;\n\n", g.pkgPrefix, structName) + return nil +} + +func (g *gen) writeCppPrototypes(b *buffer, n *a.Struct) error { + b.writes("#ifdef __cplusplus\n") + b.writes("inline void check_wuffs_version(size_t sizeof_star_self, uint64_t wuffs_version);\n") + + structID := n.QID()[1] + for _, file := range g.files { + for _, tld := range file.TopLevelDecls() { + if (tld.Kind() != a.KFunc) || (tld.Raw().Flags()&a.FlagsPublic == 0) { + continue + } + f := tld.Func() + qqid := f.QQID() + if qqid[1] != structID { + continue + } + + if err := g.writeFuncSignature(b, f, cppInsideStruct); err != nil { + return err + } + b.writes(";\n") + } + } + + b.writes("#endif // __cplusplus\n\n") + return nil +} + +func (g *gen) writeCppImpls(b *buffer) error { + b.writes("\n#ifdef __cplusplus\n\n") + + publicStructs := map[t.ID]bool{} + + for _, file := range g.files { + for _, tld := range file.TopLevelDecls() { + if (tld.Kind() != a.KStruct) || (tld.Raw().Flags()&a.FlagsPublic == 0) { + continue + } + n := tld.Struct() + + structID := n.QID()[1] + structName := structID.Str(g.tm) + b.printf("inline void %s%s::check_wuffs_version(size_t sizeof_star_self, uint64_t wuffs_version) {\n", + g.pkgPrefix, structName) + b.printf("%s%s__check_wuffs_version(this, sizeof_star_self, wuffs_version);\n", + g.pkgPrefix, structName) + b.printf("}\n\n") + + publicStructs[structID] = true + } + } + + for _, file := range g.files { + for _, tld := range file.TopLevelDecls() { + if (tld.Kind() != a.KFunc) || (tld.Raw().Flags()&a.FlagsPublic == 0) { + continue + } + n := tld.Func() + if !publicStructs[n.QQID()[1]] { + continue + } + + if err := g.writeFuncSignature(b, n, cppOutsideStruct); err != nil { + return err + } + b.writes("{ return ") + b.writes(g.funcCName(n)) + b.writes("(this") + for _, o := range n.In().Fields() { + b.writeb(',') + b.writes(aPrefix) + b.writes(o.Field().Name().Str(g.tm)) + } + b.writes(");}\n\n") + } + } + + b.writes("#endif // __cplusplus\n\n") return nil } diff --git a/cmd/wuffs-c/internal/cgen/data.go b/cmd/wuffs-c/internal/cgen/data.go index c110c60f..55269220 100644 --- a/cmd/wuffs-c/internal/cgen/data.go +++ b/cmd/wuffs-c/internal/cgen/data.go @@ -58,9 +58,9 @@ const basePublicH = "" + "& r.min_incl_y == s.min_incl_y &&\n r.max_excl_x == s.max_excl_x && r.max_excl_y == s.max_excl_y) ||\n (wuffs_base__rect_ie_u32__is_empty(r) &&\n wuffs_base__rect_ie_u32__is_empty(s));\n}\n\nstatic inline bool wuffs_base__rect_ie_u32__contains(wuffs_base__rect_ie_u32 r,\n uint32_t x,\n uint32_t y) {\n return (r.min_incl_x <= x) && (x < r.max_excl_x) && (r.min_incl_y <= y) &&\n (y < r.max_excl_y);\n}\n\nstatic inline wuffs_base__rect_ie_u32 wuffs_base__rect_ie_u32__intersection(\n wuffs_base__rect_ie_u32 r,\n wuffs_base__rect_ie_u32 s) {\n r.min_incl_x = wuffs_base__u32__max(r.min_incl_x, s.min_incl_x);\n r.min_incl_y = wuffs_base__u32__max(r.min_incl_y, s.min_incl_y);\n r.max_excl_x = wuffs_base__u32__min(r.max_excl_x, s.max_excl_x);\n r.max_excl_y = wuffs_base__u32__min(r.max_excl_y, s.max_excl_y);\n return r;\n}\n\nstatic inline wuffs_base__rect_ie_u32 wuffs_base__rect_ie_u32__union" + "(\n wuffs_base__rect_ie_u32 r,\n wuffs_base__rect_ie_u32 s) {\n if (wuffs_base__rect_ie_u32__is_empty(r)) {\n return s;\n }\n if (wuffs_base__rect_ie_u32__is_empty(s)) {\n return r;\n }\n r.min_incl_x = wuffs_base__u32__min(r.min_incl_x, s.min_incl_x);\n r.min_incl_y = wuffs_base__u32__min(r.min_incl_y, s.min_incl_y);\n r.max_excl_x = wuffs_base__u32__max(r.max_excl_x, s.max_excl_x);\n r.max_excl_y = wuffs_base__u32__max(r.max_excl_y, s.max_excl_y);\n return r;\n}\n\nstatic inline uint32_t wuffs_base__rect_ie_u32__width(\n wuffs_base__rect_ie_u32 r) {\n return wuffs_base__u32__sat_sub(r.max_excl_x, r.min_incl_x);\n}\n\nstatic inline uint32_t wuffs_base__rect_ie_u32__height(\n wuffs_base__rect_ie_u32 r) {\n return wuffs_base__u32__sat_sub(r.max_excl_y, r.min_incl_y);\n}\n\n" + "" + - "// ---------------- I/O\n\n// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus\n// additional indexes into that buffer, plus an opened / closed flag.\n//\n// A value with all fields NULL or zero is a valid, empty buffer.\ntypedef struct {\n uint8_t* ptr; // Pointer.\n size_t len; // Length.\n size_t wi; // Write index. Invariant: wi <= len.\n size_t ri; // Read index. Invariant: ri <= wi.\n bool closed; // No further writes are expected.\n} wuffs_base__io_buffer;\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__io_buffer* buf;\n // The bounds values are typically NULL, when created by the Wuffs public\n // API. NULL means that the callee substitutes the implicit bounds derived\n // from buf.\n uint8_t* bounds[2];\n } private_impl;\n} wuffs_base__io_reader;\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/A" + - "BI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__io_buffer* buf;\n // The bounds values are typically NULL, when created by the Wuffs public\n // API. NULL means that the callee substitutes the implicit bounds derived\n // from buf.\n uint8_t* bounds[2];\n } private_impl;\n} wuffs_base__io_writer;\n\n// wuffs_base__io_buffer__compact moves any written but unread bytes to the\n// start of the buffer.\nstatic inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) {\n if (!buf || (buf->ri == 0)) {\n return;\n }\n size_t n = buf->wi - buf->ri;\n if (n != 0) {\n memmove(buf->ptr, buf->ptr + buf->ri, n);\n }\n buf->wi = n;\n buf->ri = 0;\n}\n\nstatic inline wuffs_base__io_reader wuffs_base__io_buffer__reader(\n wuffs_base__io_buffer* buf) {\n wuffs_base__io_reader ret = ((wuffs_base__io_reader){});\n ret.private_impl.buf = buf;\n return ret;\n}\n\nstatic inline wuffs_base__io_writer wuffs_base__io_buffer__writer(\n wuffs_base__io_buffer* buf) {\n wuffs_base__io" + - "_writer ret = ((wuffs_base__io_writer){});\n ret.private_impl.buf = buf;\n return ret;\n}\n\n" + + "// ---------------- I/O\n\nstruct wuffs_base__io_buffer__struct;\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n struct wuffs_base__io_buffer__struct* buf;\n // The bounds values are typically NULL, when created by the Wuffs public\n // API. NULL means that the callee substitutes the implicit bounds derived\n // from buf.\n uint8_t* bounds[2];\n } private_impl;\n} wuffs_base__io_reader;\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n struct wuffs_base__io_buffer__struct* buf;\n // The bounds values are typically NULL, when created by the Wuffs public\n // API. NULL means that the callee substitutes the implicit bounds derived\n // from buf.\n uint8_t* bounds[2];\n } private_impl;\n} wuffs_base__io_writer;\n\n// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and leng" + + "th), plus\n// additional indexes into that buffer, plus an opened / closed flag.\n//\n// A value with all fields NULL or zero is a valid, empty buffer.\ntypedef struct wuffs_base__io_buffer__struct {\n uint8_t* ptr; // Pointer.\n size_t len; // Length.\n size_t wi; // Write index. Invariant: wi <= len.\n size_t ri; // Read index. Invariant: ri <= wi.\n bool closed; // No further writes are expected.\n\n#ifdef __cplusplus\n inline void compact();\n inline wuffs_base__io_reader reader();\n inline wuffs_base__io_writer writer();\n#endif // __cplusplus\n\n} wuffs_base__io_buffer;\n\n// wuffs_base__io_buffer__compact moves any written but unread bytes to the\n// start of the buffer.\nstatic inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) {\n if (!buf || (buf->ri == 0)) {\n return;\n }\n size_t n = buf->wi - buf->ri;\n if (n != 0) {\n memmove(buf->ptr, buf->ptr + buf->ri, n);\n }\n buf->wi = n;\n buf->ri = 0;\n}\n\nstatic inline wuffs_base__io_reader wuffs_base__io_buffer__reader(\n wuf" + + "fs_base__io_buffer* buf) {\n wuffs_base__io_reader ret = ((wuffs_base__io_reader){});\n ret.private_impl.buf = buf;\n return ret;\n}\n\nstatic inline wuffs_base__io_writer wuffs_base__io_buffer__writer(\n wuffs_base__io_buffer* buf) {\n wuffs_base__io_writer ret = ((wuffs_base__io_writer){});\n ret.private_impl.buf = buf;\n return ret;\n}\n\n#ifdef __cplusplus\n\ninline void wuffs_base__io_buffer__struct::compact() {\n wuffs_base__io_buffer__compact(this);\n}\n\ninline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() {\n return wuffs_base__io_buffer__reader(this);\n}\n\ninline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() {\n return wuffs_base__io_buffer__writer(this);\n}\n\n#endif // __cplusplus\n\n" + "" + "// ---------------- Images\n\n// wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue\n// color, as a uint32_t value. It is in word order, not byte order: its value\n// is always 0xAARRGGBB, regardless of endianness. It uses premultiplied alpha.\ntypedef uint32_t wuffs_base__color_u32argb;\n\n" + "" + diff --git a/cmd/wuffs-c/internal/cgen/func.go b/cmd/wuffs-c/internal/cgen/func.go index 33d6d3ea..3213a30a 100644 --- a/cmd/wuffs-c/internal/cgen/func.go +++ b/cmd/wuffs-c/internal/cgen/func.go @@ -69,8 +69,17 @@ func (g *gen) funcCName(n *a.Func) string { return g.pkgPrefix + n.FuncName().Str(g.tm) } -func (g *gen) writeFuncSignature(b *buffer, n *a.Func) error { - if !n.Public() { +// C++ related function signature constants. +const ( + cppNone = 0 // Not C++, just plain C. + cppInsideStruct = 1 + cppOutsideStruct = 2 +) + +func (g *gen) writeFuncSignature(b *buffer, n *a.Func, cpp uint32) error { + if cpp != cppNone { + b.writes("inline ") + } else if !n.Public() { b.writes("static ") } @@ -88,14 +97,27 @@ func (g *gen) writeFuncSignature(b *buffer, n *a.Func) error { return fmt.Errorf("TODO: multiple return values") } - b.writes(g.funcCName(n)) - b.writeb('(') - - comma := false - if r := n.Receiver(); !r.IsZero() { - b.printf("%s%s *self", g.pkgPrefix, r.Str(g.tm)) - comma = true + switch cpp { + case cppNone: + b.writes(g.funcCName(n)) + case cppInsideStruct: + b.writes(n.FuncName().Str(g.tm)) + case cppOutsideStruct: + b.writes(g.pkgPrefix) + b.writes(n.Receiver().Str(g.tm)) + b.writes("::") + b.writes(n.FuncName().Str(g.tm)) } + + b.writeb('(') + comma := false + if cpp == cppNone { + if r := n.Receiver(); !r.IsZero() { + b.printf("%s%s *self", g.pkgPrefix, r.Str(g.tm)) + comma = true + } + } + for _, o := range n.In().Fields() { if comma { b.writeb(',') @@ -112,7 +134,7 @@ func (g *gen) writeFuncSignature(b *buffer, n *a.Func) error { } func (g *gen) writeFuncPrototype(b *buffer, n *a.Func) error { - if err := g.writeFuncSignature(b, n); err != nil { + if err := g.writeFuncSignature(b, n, cppNone); err != nil { return err } b.writes(";\n\n") @@ -123,7 +145,7 @@ func (g *gen) writeFuncImpl(b *buffer, n *a.Func) error { k := g.funks[n.QQID()] b.printf("// -------- func %s.%s\n\n", g.pkgName, n.QQID().Str(g.tm)) - if err := g.writeFuncSignature(b, n); err != nil { + if err := g.writeFuncSignature(b, n, cppNone); err != nil { return err } b.writes("{\n") diff --git a/example/crc32/crc32.cc b/example/crc32/crc32.cc index 4ad8b0db..7cb963ec 100644 --- a/example/crc32/crc32.cc +++ b/example/crc32/crc32.cc @@ -44,7 +44,7 @@ uint8_t src_buffer[SRC_BUFFER_SIZE]; int main(int argc, char** argv) { wuffs_crc32__ieee_hasher h = ((wuffs_crc32__ieee_hasher){}); - wuffs_crc32__ieee_hasher__check_wuffs_version(&h, sizeof h, WUFFS_VERSION); + h.check_wuffs_version(sizeof h, WUFFS_VERSION); while (true) { const int stdin_fd = 0; @@ -57,11 +57,10 @@ int main(int argc, char** argv) { continue; } - uint32_t checksum = - wuffs_crc32__ieee_hasher__update(&h, ((wuffs_base__slice_u8){ - .ptr = src_buffer, - .len = static_cast(n), - })); + uint32_t checksum = h.update((wuffs_base__slice_u8){ + .ptr = src_buffer, + .len = static_cast(n), + }); if (n == 0) { printf("%08" PRIx32 "\n", checksum); diff --git a/gen/c/base.c b/gen/c/base.c index 0c8162c2..e313fc27 100644 --- a/gen/c/base.c +++ b/gen/c/base.c @@ -682,23 +682,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -710,7 +700,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -718,6 +708,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -746,6 +755,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue diff --git a/gen/c/std/adler32.c b/gen/c/std/adler32.c index 554b0db0..b194e38b 100644 --- a/gen/c/std/adler32.c +++ b/gen/c/std/adler32.c @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1342,6 +1367,13 @@ typedef struct { bool f_started; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline uint32_t update(wuffs_base__slice_u8 a_x); +#endif // __cplusplus + } wuffs_adler32__hasher; // ---------------- Public Initializer Prototypes @@ -1360,6 +1392,22 @@ void wuffs_adler32__hasher__check_wuffs_version(wuffs_adler32__hasher* self, uint32_t wuffs_adler32__hasher__update(wuffs_adler32__hasher* self, wuffs_base__slice_u8 a_x); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_adler32__hasher::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_adler32__hasher__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline uint32_t wuffs_adler32__hasher::update(wuffs_base__slice_u8 a_x) { + return wuffs_adler32__hasher__update(this, a_x); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/c/std/crc32.c b/gen/c/std/crc32.c index 840f17bd..f4c900dd 100644 --- a/gen/c/std/crc32.c +++ b/gen/c/std/crc32.c @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1341,6 +1366,13 @@ typedef struct { uint32_t f_state; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline uint32_t update(wuffs_base__slice_u8 a_x); +#endif // __cplusplus + } wuffs_crc32__ieee_hasher; // ---------------- Public Initializer Prototypes @@ -1360,6 +1392,23 @@ void wuffs_crc32__ieee_hasher__check_wuffs_version( uint32_t wuffs_crc32__ieee_hasher__update(wuffs_crc32__ieee_hasher* self, wuffs_base__slice_u8 a_x); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_crc32__ieee_hasher::check_wuffs_version( + size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_crc32__ieee_hasher__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline uint32_t wuffs_crc32__ieee_hasher::update(wuffs_base__slice_u8 a_x) { + return wuffs_crc32__ieee_hasher__update(this, a_x); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/c/std/deflate.c b/gen/c/std/deflate.c index 7e6b8272..776c3cea 100644 --- a/gen/c/std/deflate.c +++ b/gen/c/std/deflate.c @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1429,6 +1454,14 @@ typedef struct { uint32_t v_hdist; } c_decode_huffman_slow[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_deflate__decoder; // ---------------- Public Initializer Prototypes @@ -1448,6 +1481,25 @@ wuffs_base__status wuffs_deflate__decoder__decode(wuffs_deflate__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_deflate__decoder::check_wuffs_version( + size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_deflate__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline wuffs_base__status wuffs_deflate__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_deflate__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/c/std/gif.c b/gen/c/std/gif.c index b830cae3..18228fe4 100644 --- a/gen/c/std/gif.c +++ b/gen/c/std/gif.c @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1371,6 +1396,15 @@ typedef struct { uint64_t v_n_copied; } c_decode[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline void set_literal_width(uint32_t a_lw); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_lzw__decoder; // ---------------- Public Initializer Prototypes @@ -1393,6 +1427,28 @@ wuffs_base__status wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_lzw__decoder::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_lzw__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline void wuffs_lzw__decoder::set_literal_width(uint32_t a_lw) { + return wuffs_lzw__decoder__set_literal_width(this, a_lw); +} + +inline wuffs_base__status wuffs_lzw__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_lzw__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif @@ -1530,6 +1586,20 @@ typedef struct { wuffs_base__status v_z; } c_decode_id_part1[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline wuffs_base__status decode_config(wuffs_base__image_config* a_dst, + wuffs_base__io_reader a_src); + inline uint64_t frame_count(); + inline wuffs_base__range_ii_u64 work_buffer_size(); + inline wuffs_base__status decode_frame(wuffs_base__image_buffer* a_dst, + wuffs_base__io_reader a_src, + wuffs_base__slice_u8 a_work_buffer); + inline wuffs_base__status decode_up_to_id_part1(wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_gif__decoder; // ---------------- Public Initializer Prototypes @@ -1565,6 +1635,44 @@ wuffs_base__status wuffs_gif__decoder__decode_up_to_id_part1( wuffs_gif__decoder* self, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_gif__decoder::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_gif__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline wuffs_base__status wuffs_gif__decoder::decode_config( + wuffs_base__image_config* a_dst, + wuffs_base__io_reader a_src) { + return wuffs_gif__decoder__decode_config(this, a_dst, a_src); +} + +inline uint64_t wuffs_gif__decoder::frame_count() { + return wuffs_gif__decoder__frame_count(this); +} + +inline wuffs_base__range_ii_u64 wuffs_gif__decoder::work_buffer_size() { + return wuffs_gif__decoder__work_buffer_size(this); +} + +inline wuffs_base__status wuffs_gif__decoder::decode_frame( + wuffs_base__image_buffer* a_dst, + wuffs_base__io_reader a_src, + wuffs_base__slice_u8 a_work_buffer) { + return wuffs_gif__decoder__decode_frame(this, a_dst, a_src, a_work_buffer); +} + +inline wuffs_base__status wuffs_gif__decoder::decode_up_to_id_part1( + wuffs_base__io_reader a_src) { + return wuffs_gif__decoder__decode_up_to_id_part1(this, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/c/std/gzip.c b/gen/c/std/gzip.c index e8050e98..8b96454b 100644 --- a/gen/c/std/gzip.c +++ b/gen/c/std/gzip.c @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1350,6 +1375,13 @@ typedef struct { uint32_t f_state; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline uint32_t update(wuffs_base__slice_u8 a_x); +#endif // __cplusplus + } wuffs_crc32__ieee_hasher; // ---------------- Public Initializer Prototypes @@ -1369,6 +1401,23 @@ void wuffs_crc32__ieee_hasher__check_wuffs_version( uint32_t wuffs_crc32__ieee_hasher__update(wuffs_crc32__ieee_hasher* self, wuffs_base__slice_u8 a_x); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_crc32__ieee_hasher::check_wuffs_version( + size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_crc32__ieee_hasher__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline uint32_t wuffs_crc32__ieee_hasher::update(wuffs_base__slice_u8 a_x) { + return wuffs_crc32__ieee_hasher__update(this, a_x); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif @@ -1503,6 +1552,14 @@ typedef struct { uint32_t v_hdist; } c_decode_huffman_slow[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_deflate__decoder; // ---------------- Public Initializer Prototypes @@ -1522,6 +1579,25 @@ wuffs_base__status wuffs_deflate__decoder__decode(wuffs_deflate__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_deflate__decoder::check_wuffs_version( + size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_deflate__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline wuffs_base__status wuffs_deflate__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_deflate__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif @@ -1578,6 +1654,15 @@ typedef struct { uint64_t scratch; } c_decode[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline void set_ignore_checksum(bool a_ic); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_gzip__decoder; // ---------------- Public Initializer Prototypes @@ -1600,6 +1685,28 @@ wuffs_base__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_gzip__decoder::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_gzip__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline void wuffs_gzip__decoder::set_ignore_checksum(bool a_ic) { + return wuffs_gzip__decoder__set_ignore_checksum(this, a_ic); +} + +inline wuffs_base__status wuffs_gzip__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_gzip__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/c/std/lzw.c b/gen/c/std/lzw.c index 36ac7008..9cac40ab 100644 --- a/gen/c/std/lzw.c +++ b/gen/c/std/lzw.c @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1362,6 +1387,15 @@ typedef struct { uint64_t v_n_copied; } c_decode[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline void set_literal_width(uint32_t a_lw); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_lzw__decoder; // ---------------- Public Initializer Prototypes @@ -1384,6 +1418,28 @@ wuffs_base__status wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_lzw__decoder::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_lzw__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline void wuffs_lzw__decoder::set_literal_width(uint32_t a_lw) { + return wuffs_lzw__decoder__set_literal_width(this, a_lw); +} + +inline wuffs_base__status wuffs_lzw__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_lzw__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/c/std/zlib.c b/gen/c/std/zlib.c index 5bce5e4d..6622cf49 100644 --- a/gen/c/std/zlib.c +++ b/gen/c/std/zlib.c @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1351,6 +1376,13 @@ typedef struct { bool f_started; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline uint32_t update(wuffs_base__slice_u8 a_x); +#endif // __cplusplus + } wuffs_adler32__hasher; // ---------------- Public Initializer Prototypes @@ -1369,6 +1401,22 @@ void wuffs_adler32__hasher__check_wuffs_version(wuffs_adler32__hasher* self, uint32_t wuffs_adler32__hasher__update(wuffs_adler32__hasher* self, wuffs_base__slice_u8 a_x); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_adler32__hasher::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_adler32__hasher__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline uint32_t wuffs_adler32__hasher::update(wuffs_base__slice_u8 a_x) { + return wuffs_adler32__hasher__update(this, a_x); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif @@ -1503,6 +1551,14 @@ typedef struct { uint32_t v_hdist; } c_decode_huffman_slow[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_deflate__decoder; // ---------------- Public Initializer Prototypes @@ -1522,6 +1578,25 @@ wuffs_base__status wuffs_deflate__decoder__decode(wuffs_deflate__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_deflate__decoder::check_wuffs_version( + size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_deflate__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline wuffs_base__status wuffs_deflate__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_deflate__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif @@ -1576,6 +1651,15 @@ typedef struct { uint64_t scratch; } c_decode[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline void set_ignore_checksum(bool a_ic); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_zlib__decoder; // ---------------- Public Initializer Prototypes @@ -1598,6 +1682,28 @@ wuffs_base__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_zlib__decoder::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_zlib__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline void wuffs_zlib__decoder::set_ignore_checksum(bool a_ic) { + return wuffs_zlib__decoder__set_ignore_checksum(this, a_ic); +} + +inline wuffs_base__status wuffs_zlib__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_zlib__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/h/std/adler32.h b/gen/h/std/adler32.h index 109a4aed..4f4f0a7a 100644 --- a/gen/h/std/adler32.h +++ b/gen/h/std/adler32.h @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1342,6 +1367,13 @@ typedef struct { bool f_started; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline uint32_t update(wuffs_base__slice_u8 a_x); +#endif // __cplusplus + } wuffs_adler32__hasher; // ---------------- Public Initializer Prototypes @@ -1360,6 +1392,22 @@ void wuffs_adler32__hasher__check_wuffs_version(wuffs_adler32__hasher* self, uint32_t wuffs_adler32__hasher__update(wuffs_adler32__hasher* self, wuffs_base__slice_u8 a_x); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_adler32__hasher::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_adler32__hasher__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline uint32_t wuffs_adler32__hasher::update(wuffs_base__slice_u8 a_x) { + return wuffs_adler32__hasher__update(this, a_x); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/h/std/crc32.h b/gen/h/std/crc32.h index efaada9c..0b6b9613 100644 --- a/gen/h/std/crc32.h +++ b/gen/h/std/crc32.h @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1341,6 +1366,13 @@ typedef struct { uint32_t f_state; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline uint32_t update(wuffs_base__slice_u8 a_x); +#endif // __cplusplus + } wuffs_crc32__ieee_hasher; // ---------------- Public Initializer Prototypes @@ -1360,6 +1392,23 @@ void wuffs_crc32__ieee_hasher__check_wuffs_version( uint32_t wuffs_crc32__ieee_hasher__update(wuffs_crc32__ieee_hasher* self, wuffs_base__slice_u8 a_x); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_crc32__ieee_hasher::check_wuffs_version( + size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_crc32__ieee_hasher__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline uint32_t wuffs_crc32__ieee_hasher::update(wuffs_base__slice_u8 a_x) { + return wuffs_crc32__ieee_hasher__update(this, a_x); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/h/std/deflate.h b/gen/h/std/deflate.h index 8e037953..6c3b1559 100644 --- a/gen/h/std/deflate.h +++ b/gen/h/std/deflate.h @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1429,6 +1454,14 @@ typedef struct { uint32_t v_hdist; } c_decode_huffman_slow[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_deflate__decoder; // ---------------- Public Initializer Prototypes @@ -1448,6 +1481,25 @@ wuffs_base__status wuffs_deflate__decoder__decode(wuffs_deflate__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_deflate__decoder::check_wuffs_version( + size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_deflate__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline wuffs_base__status wuffs_deflate__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_deflate__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/h/std/gif.h b/gen/h/std/gif.h index 877a62e7..39b9c505 100644 --- a/gen/h/std/gif.h +++ b/gen/h/std/gif.h @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1371,6 +1396,15 @@ typedef struct { uint64_t v_n_copied; } c_decode[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline void set_literal_width(uint32_t a_lw); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_lzw__decoder; // ---------------- Public Initializer Prototypes @@ -1393,6 +1427,28 @@ wuffs_base__status wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_lzw__decoder::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_lzw__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline void wuffs_lzw__decoder::set_literal_width(uint32_t a_lw) { + return wuffs_lzw__decoder__set_literal_width(this, a_lw); +} + +inline wuffs_base__status wuffs_lzw__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_lzw__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif @@ -1530,6 +1586,20 @@ typedef struct { wuffs_base__status v_z; } c_decode_id_part1[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline wuffs_base__status decode_config(wuffs_base__image_config* a_dst, + wuffs_base__io_reader a_src); + inline uint64_t frame_count(); + inline wuffs_base__range_ii_u64 work_buffer_size(); + inline wuffs_base__status decode_frame(wuffs_base__image_buffer* a_dst, + wuffs_base__io_reader a_src, + wuffs_base__slice_u8 a_work_buffer); + inline wuffs_base__status decode_up_to_id_part1(wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_gif__decoder; // ---------------- Public Initializer Prototypes @@ -1565,6 +1635,44 @@ wuffs_base__status wuffs_gif__decoder__decode_up_to_id_part1( wuffs_gif__decoder* self, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_gif__decoder::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_gif__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline wuffs_base__status wuffs_gif__decoder::decode_config( + wuffs_base__image_config* a_dst, + wuffs_base__io_reader a_src) { + return wuffs_gif__decoder__decode_config(this, a_dst, a_src); +} + +inline uint64_t wuffs_gif__decoder::frame_count() { + return wuffs_gif__decoder__frame_count(this); +} + +inline wuffs_base__range_ii_u64 wuffs_gif__decoder::work_buffer_size() { + return wuffs_gif__decoder__work_buffer_size(this); +} + +inline wuffs_base__status wuffs_gif__decoder::decode_frame( + wuffs_base__image_buffer* a_dst, + wuffs_base__io_reader a_src, + wuffs_base__slice_u8 a_work_buffer) { + return wuffs_gif__decoder__decode_frame(this, a_dst, a_src, a_work_buffer); +} + +inline wuffs_base__status wuffs_gif__decoder::decode_up_to_id_part1( + wuffs_base__io_reader a_src) { + return wuffs_gif__decoder__decode_up_to_id_part1(this, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/h/std/gzip.h b/gen/h/std/gzip.h index d5cfcfac..087bb5a3 100644 --- a/gen/h/std/gzip.h +++ b/gen/h/std/gzip.h @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1350,6 +1375,13 @@ typedef struct { uint32_t f_state; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline uint32_t update(wuffs_base__slice_u8 a_x); +#endif // __cplusplus + } wuffs_crc32__ieee_hasher; // ---------------- Public Initializer Prototypes @@ -1369,6 +1401,23 @@ void wuffs_crc32__ieee_hasher__check_wuffs_version( uint32_t wuffs_crc32__ieee_hasher__update(wuffs_crc32__ieee_hasher* self, wuffs_base__slice_u8 a_x); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_crc32__ieee_hasher::check_wuffs_version( + size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_crc32__ieee_hasher__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline uint32_t wuffs_crc32__ieee_hasher::update(wuffs_base__slice_u8 a_x) { + return wuffs_crc32__ieee_hasher__update(this, a_x); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif @@ -1503,6 +1552,14 @@ typedef struct { uint32_t v_hdist; } c_decode_huffman_slow[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_deflate__decoder; // ---------------- Public Initializer Prototypes @@ -1522,6 +1579,25 @@ wuffs_base__status wuffs_deflate__decoder__decode(wuffs_deflate__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_deflate__decoder::check_wuffs_version( + size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_deflate__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline wuffs_base__status wuffs_deflate__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_deflate__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif @@ -1578,6 +1654,15 @@ typedef struct { uint64_t scratch; } c_decode[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline void set_ignore_checksum(bool a_ic); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_gzip__decoder; // ---------------- Public Initializer Prototypes @@ -1600,6 +1685,28 @@ wuffs_base__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_gzip__decoder::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_gzip__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline void wuffs_gzip__decoder::set_ignore_checksum(bool a_ic) { + return wuffs_gzip__decoder__set_ignore_checksum(this, a_ic); +} + +inline wuffs_base__status wuffs_gzip__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_gzip__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/h/std/lzw.h b/gen/h/std/lzw.h index 4bd7b3a8..70763220 100644 --- a/gen/h/std/lzw.h +++ b/gen/h/std/lzw.h @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1362,6 +1387,15 @@ typedef struct { uint64_t v_n_copied; } c_decode[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline void set_literal_width(uint32_t a_lw); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_lzw__decoder; // ---------------- Public Initializer Prototypes @@ -1384,6 +1418,28 @@ wuffs_base__status wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_lzw__decoder::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_lzw__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline void wuffs_lzw__decoder::set_literal_width(uint32_t a_lw) { + return wuffs_lzw__decoder__set_literal_width(this, a_lw); +} + +inline wuffs_base__status wuffs_lzw__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_lzw__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif diff --git a/gen/h/std/zlib.h b/gen/h/std/zlib.h index 9b098b33..3927f63d 100644 --- a/gen/h/std/zlib.h +++ b/gen/h/std/zlib.h @@ -671,23 +671,13 @@ static inline uint32_t wuffs_base__rect_ie_u32__height( // ---------------- I/O -// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus -// additional indexes into that buffer, plus an opened / closed flag. -// -// A value with all fields NULL or zero is a valid, empty buffer. -typedef struct { - uint8_t* ptr; // Pointer. - size_t len; // Length. - size_t wi; // Write index. Invariant: wi <= len. - size_t ri; // Read index. Invariant: ri <= wi. - bool closed; // No further writes are expected. -} wuffs_base__io_buffer; +struct wuffs_base__io_buffer__struct; typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -699,7 +689,7 @@ typedef struct { // Do not access the private_impl's fields directly. There is no API/ABI // compatibility or safety guarantee if you do so. struct { - wuffs_base__io_buffer* buf; + struct wuffs_base__io_buffer__struct* buf; // The bounds values are typically NULL, when created by the Wuffs public // API. NULL means that the callee substitutes the implicit bounds derived // from buf. @@ -707,6 +697,25 @@ typedef struct { } private_impl; } wuffs_base__io_writer; +// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus +// additional indexes into that buffer, plus an opened / closed flag. +// +// A value with all fields NULL or zero is a valid, empty buffer. +typedef struct wuffs_base__io_buffer__struct { + uint8_t* ptr; // Pointer. + size_t len; // Length. + size_t wi; // Write index. Invariant: wi <= len. + size_t ri; // Read index. Invariant: ri <= wi. + bool closed; // No further writes are expected. + +#ifdef __cplusplus + inline void compact(); + inline wuffs_base__io_reader reader(); + inline wuffs_base__io_writer writer(); +#endif // __cplusplus + +} wuffs_base__io_buffer; + // wuffs_base__io_buffer__compact moves any written but unread bytes to the // start of the buffer. static inline void wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) { @@ -735,6 +744,22 @@ static inline wuffs_base__io_writer wuffs_base__io_buffer__writer( return ret; } +#ifdef __cplusplus + +inline void wuffs_base__io_buffer__struct::compact() { + wuffs_base__io_buffer__compact(this); +} + +inline wuffs_base__io_reader wuffs_base__io_buffer__struct::reader() { + return wuffs_base__io_buffer__reader(this); +} + +inline wuffs_base__io_writer wuffs_base__io_buffer__struct::writer() { + return wuffs_base__io_buffer__writer(this); +} + +#endif // __cplusplus + // ---------------- Images // wuffs_base__color_u32argb is an 8 bit per channel Alpha, Red, Green, Blue @@ -1351,6 +1376,13 @@ typedef struct { bool f_started; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline uint32_t update(wuffs_base__slice_u8 a_x); +#endif // __cplusplus + } wuffs_adler32__hasher; // ---------------- Public Initializer Prototypes @@ -1369,6 +1401,22 @@ void wuffs_adler32__hasher__check_wuffs_version(wuffs_adler32__hasher* self, uint32_t wuffs_adler32__hasher__update(wuffs_adler32__hasher* self, wuffs_base__slice_u8 a_x); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_adler32__hasher::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_adler32__hasher__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline uint32_t wuffs_adler32__hasher::update(wuffs_base__slice_u8 a_x) { + return wuffs_adler32__hasher__update(this, a_x); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif @@ -1503,6 +1551,14 @@ typedef struct { uint32_t v_hdist; } c_decode_huffman_slow[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_deflate__decoder; // ---------------- Public Initializer Prototypes @@ -1522,6 +1578,25 @@ wuffs_base__status wuffs_deflate__decoder__decode(wuffs_deflate__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_deflate__decoder::check_wuffs_version( + size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_deflate__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline wuffs_base__status wuffs_deflate__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_deflate__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif @@ -1576,6 +1651,15 @@ typedef struct { uint64_t scratch; } c_decode[1]; } private_impl; + +#ifdef __cplusplus + inline void check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version); + inline void set_ignore_checksum(bool a_ic); + inline wuffs_base__status decode(wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src); +#endif // __cplusplus + } wuffs_zlib__decoder; // ---------------- Public Initializer Prototypes @@ -1598,6 +1682,28 @@ wuffs_base__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self, wuffs_base__io_writer a_dst, wuffs_base__io_reader a_src); +// ---------------- C++ Convenience Methods + +#ifdef __cplusplus + +inline void wuffs_zlib__decoder::check_wuffs_version(size_t sizeof_star_self, + uint64_t wuffs_version) { + wuffs_zlib__decoder__check_wuffs_version(this, sizeof_star_self, + wuffs_version); +} + +inline void wuffs_zlib__decoder::set_ignore_checksum(bool a_ic) { + return wuffs_zlib__decoder__set_ignore_checksum(this, a_ic); +} + +inline wuffs_base__status wuffs_zlib__decoder::decode( + wuffs_base__io_writer a_dst, + wuffs_base__io_reader a_src) { + return wuffs_zlib__decoder__decode(this, a_dst, a_src); +} + +#endif // __cplusplus + #ifdef __cplusplus } // extern "C" #endif