diff --git a/cmd/wuffs-c/internal/cgen/base/base-private.h b/cmd/wuffs-c/internal/cgen/base/base-private.h index b9942e99..8668c929 100644 --- a/cmd/wuffs-c/internal/cgen/base/base-private.h +++ b/cmd/wuffs-c/internal/cgen/base/base-private.h @@ -17,6 +17,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +#ifdef __cplusplus +extern "C" { +#endif + #define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) // WUFFS_BASE__MAGIC is a magic number to check that initializers are called. @@ -558,4 +562,8 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark( return ((wuffs_base__empty_struct){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE diff --git a/cmd/wuffs-c/internal/cgen/base/base-public.h b/cmd/wuffs-c/internal/cgen/base/base-public.h index 646723ef..c3424582 100644 --- a/cmd/wuffs-c/internal/cgen/base/base-public.h +++ b/cmd/wuffs-c/internal/cgen/base/base-public.h @@ -21,6 +21,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1228,4 +1232,8 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC diff --git a/cmd/wuffs-c/internal/cgen/data.go b/cmd/wuffs-c/internal/cgen/data.go index e4f36cfc..1133f25d 100644 --- a/cmd/wuffs-c/internal/cgen/data.go +++ b/cmd/wuffs-c/internal/cgen/data.go @@ -17,9 +17,9 @@ package cgen const basePublicH = "" + - "#ifndef WUFFS_INCLUDE_GUARD__BASE_PUBLIC\n#define WUFFS_INCLUDE_GUARD__BASE_PUBLIC\n\n// Copyright 2017 The Wuffs Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \n#include \n#include \n\n// Wuffs assumes that:\n// - converting a uint32_t to a size_t will never overflow.\n// - converting a size_t to a uint64_t will never overflow.\n#if (__WORDSIZE != 32) && (__WORDSIZE != 64)\n#error \"Wuffs requires a word size of either 32 or 64 bits\"\n#endif\n\n// WUFFS_VERSION is the m" + - "ajor.minor.patch version, as per https://semver.org/,\n// as a uint64_t. The major number is the high 32 bits. The minor number is the\n// middle 16 bits. The patch number is the low 16 bits. The version extension\n// (such as \"\", \"beta\" or \"rc.1\") is part of the string representation (such as\n// \"1.2.3-beta\") but not the uint64_t representation.\n//\n// All three of major, minor and patch being zero means that this is a\n// work-in-progress version, not a release version, and has no backwards or\n// forwards compatibility guarantees.\n//\n// !! Some code generation programs can override WUFFS_VERSION.\n#define WUFFS_VERSION ((uint64_t)0)\n#define WUFFS_VERSION_MAJOR ((uint64_t)0)\n#define WUFFS_VERSION_MINOR ((uint64_t)0)\n#define WUFFS_VERSION_PATCH ((uint64_t)0)\n#define WUFFS_VERSION_EXTENSION \"\"\n#define WUFFS_VERSION_STRING \"0.0.0\"\n\n// wuffs_base__empty_struct is used when a Wuffs function returns an empty\n// struct. In C, if a function f returns void, you can't say \"x = f()\", but in\n// Wuffs, if a function g returns " + - "empty, you can say \"y = g()\".\ntypedef struct {\n} wuffs_base__empty_struct;\n\n// wuffs_base__utility is a placeholder receiver type. It enables what Java\n// calls static methods, as opposed to regular methods.\ntypedef struct {\n} wuffs_base__utility;\n\n" + + "#ifndef WUFFS_INCLUDE_GUARD__BASE_PUBLIC\n#define WUFFS_INCLUDE_GUARD__BASE_PUBLIC\n\n// Copyright 2017 The Wuffs Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \n#include \n#include \n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// Wuffs assumes that:\n// - converting a uint32_t to a size_t will never overflow.\n// - converting a size_t to a uint64_t will never overflow.\n#if (__WORDSIZE != 32) && (__WORDSIZE != 64)\n#error \"Wuffs requires a word size of either 32 or 64" + + " bits\"\n#endif\n\n// WUFFS_VERSION is the major.minor.patch version, as per https://semver.org/,\n// as a uint64_t. The major number is the high 32 bits. The minor number is the\n// middle 16 bits. The patch number is the low 16 bits. The version extension\n// (such as \"\", \"beta\" or \"rc.1\") is part of the string representation (such as\n// \"1.2.3-beta\") but not the uint64_t representation.\n//\n// All three of major, minor and patch being zero means that this is a\n// work-in-progress version, not a release version, and has no backwards or\n// forwards compatibility guarantees.\n//\n// !! Some code generation programs can override WUFFS_VERSION.\n#define WUFFS_VERSION ((uint64_t)0)\n#define WUFFS_VERSION_MAJOR ((uint64_t)0)\n#define WUFFS_VERSION_MINOR ((uint64_t)0)\n#define WUFFS_VERSION_PATCH ((uint64_t)0)\n#define WUFFS_VERSION_EXTENSION \"\"\n#define WUFFS_VERSION_STRING \"0.0.0\"\n\n// wuffs_base__empty_struct is used when a Wuffs function returns an empty\n// struct. In C, if a function f returns void, you can't say \"x = f()\", b" + + "ut in\n// Wuffs, if a function g returns empty, you can say \"y = g()\".\ntypedef struct {\n} wuffs_base__empty_struct;\n\n// wuffs_base__utility is a placeholder receiver type. It enables what Java\n// calls static methods, as opposed to regular methods.\ntypedef struct {\n} wuffs_base__utility;\n\n" + "" + "// --------\n\n// A status code is either zero (OK), positive (a recoverable suspension or\n// pause in processing) or negative (a non-recoverable error). Its bits:\n// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.\n// - bits 30 .. 24 are a package-namespaced numeric code\n// - bits 23 .. 21 are reserved.\n// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.\n//\n// Do not manipulate these bits directly; they are private implementation\n// details. Use methods such as wuffs_base__status__is_error instead.\ntypedef int32_t wuffs_base__status;\n\n// !! INSERT wuffs_base__status names.\n\nstatic inline bool wuffs_base__status__is_error(wuffs_base__status s) {\n return s < 0;\n}\n\nstatic inline bool wuffs_base__status__is_ok(wuffs_base__status s) {\n return s == 0;\n}\n\nstatic inline bool wuffs_base__status__is_suspension(wuffs_base__status s) {\n return s > 0;\n}\n\nconst char* wuffs_base__status__string(wuffs_base__status s);\n\n" + "" + @@ -89,14 +89,14 @@ const basePublicH = "" + "end,\n wuffs_base__animation_disposal disposal,\n wuffs_base__slice_u8 palette) {\n if (!b) {\n return;\n }\n\n // Clip the dirty_rect to the image bounds.\n dirty_rect.max_excl_x = wuffs_base__u32__min(\n dirty_rect.max_excl_x, b->private_impl.config.private_impl.width);\n dirty_rect.max_excl_y = wuffs_base__u32__min(\n dirty_rect.max_excl_y, b->private_impl.config.private_impl.height);\n b->private_impl.dirty_rect = dirty_rect;\n\n b->private_impl.duration = duration;\n b->private_impl.blend = blend;\n b->private_impl.disposal = disposal;\n b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);\n if (b->private_impl.palette_changed) {\n memmove(b->private_impl.palette, palette.ptr, 1024);\n }\n}\n\n// wuffs_base__image_buffer__loop returns whether the image decoder should loop\n// back to the beginning of the animation, assuming that we've reached the end\n// of the encoded stream. If so, it increments b's count of the animation loops\n// played so far.\nstatic inline bool wuffs_base" + "__image_buffer__loop(wuffs_base__image_buffer* b) {\n if (!b) {\n return false;\n }\n uint32_t n = b->private_impl.config.private_impl.num_loops;\n if (n == 0) {\n return true;\n }\n if (b->private_impl.loop_count < n - 1) {\n b->private_impl.loop_count++;\n return true;\n }\n return false;\n}\n\n// wuffs_base__image_config returns the overall configuration for this frame.\nstatic inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(\n wuffs_base__image_buffer* b) {\n return b ? &b->private_impl.config : NULL;\n}\n\n// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of\n// this frame's pixels differs from the previous frame.\nstatic inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(\n wuffs_base__image_buffer* b) {\n return b ? b->private_impl.dirty_rect : ((wuffs_base__rect_ie_u32){0});\n}\n\n// wuffs_base__image_buffer__duration returns the amount of time to display\n// this frame. Zero means to display forever - a still (non-animated) image.\nsta" + "tic inline wuffs_base__flicks wuffs_base__image_buffer__duration(\n wuffs_base__image_buffer* b) {\n return b ? b->private_impl.duration : 0;\n}\n\n// wuffs_base__image_buffer__blend returns, for a transparent image, whether to\n// blend this frame with the existing canvas.\n//\n// In Porter-Duff compositing operator terminology, false means \"src\" and true\n// means \"src over dst\".\nstatic inline bool wuffs_base__image_buffer__blend(\n wuffs_base__image_buffer* b) {\n return b && b->private_impl.blend;\n}\n\n// wuffs_base__image_buffer__disposal returns, for an animated image, how to\n// dispose of this frame after displaying it.\nstatic inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(\n wuffs_base__image_buffer* b) {\n return b ? b->private_impl.disposal : 0;\n}\n\n// wuffs_base__image_buffer__palette_changed returns whether this frame's\n// palette differs from the previous frame. It is conservative and may return\n// false positives (but never false negatives).\nstatic inline bool wuffs_base__i" + - "mage_buffer__palette_changed(\n wuffs_base__image_buffer* b) {\n return b && b->private_impl.palette_changed;\n}\n\n// wuffs_base__image_buffer__palette returns the palette that the pixel data\n// can index. The backing array is inside b and has length 1024.\nstatic inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(\n wuffs_base__image_buffer* b) {\n return b ? ((wuffs_base__slice_u8){.ptr = b->private_impl.palette,\n .len = 1024})\n : ((wuffs_base__slice_u8){});\n}\n\nstatic inline wuffs_base__table_u8 wuffs_base__image_buffer__plane(\n wuffs_base__image_buffer* b,\n uint32_t p) {\n return (b && (p < WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX))\n ? b->private_impl.pixbuf.planes[p]\n : ((wuffs_base__table_u8){});\n}\n\n#endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC\n" + + "mage_buffer__palette_changed(\n wuffs_base__image_buffer* b) {\n return b && b->private_impl.palette_changed;\n}\n\n// wuffs_base__image_buffer__palette returns the palette that the pixel data\n// can index. The backing array is inside b and has length 1024.\nstatic inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(\n wuffs_base__image_buffer* b) {\n return b ? ((wuffs_base__slice_u8){.ptr = b->private_impl.palette,\n .len = 1024})\n : ((wuffs_base__slice_u8){});\n}\n\nstatic inline wuffs_base__table_u8 wuffs_base__image_buffer__plane(\n wuffs_base__image_buffer* b,\n uint32_t p) {\n return (b && (p < WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX))\n ? b->private_impl.pixbuf.planes[p]\n : ((wuffs_base__table_u8){});\n}\n\n#ifdef __cplusplus\n} // extern \"C\"\n#endif\n\n#endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC\n" + "" const basePrivateH = "" + - "#ifndef WUFFS_INCLUDE_GUARD__BASE_PRIVATE\n#define WUFFS_INCLUDE_GUARD__BASE_PRIVATE\n\n// Copyright 2017 The Wuffs Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x)\n\n// WUFFS_BASE__MAGIC is a magic number to check that initializers are called.\n// It's not foolproof, given C doesn't automatically zero memory before use,\n// but it should catch 99.99% of cases.\n//\n// Its (non-zero) value is arbitrary, based on md5sum(\"wuffs\").\n#define WUFF" + - "S_BASE__MAGIC ((uint32_t)0x3CCB6C71)\n\n// Denote intentional fallthroughs for -Wimplicit-fallthrough.\n//\n// The order matters here. Clang also defines \"__GNUC__\".\n#if defined(__clang__) && __cplusplus >= 201103L\n#define WUFFS_BASE__FALLTHROUGH [[clang::fallthrough]]\n#elif !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 7)\n#define WUFFS_BASE__FALLTHROUGH __attribute__((fallthrough))\n#else\n#define WUFFS_BASE__FALLTHROUGH\n#endif\n\n// Use switch cases for coroutine suspension points, similar to the technique\n// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\n//\n// We use trivial macros instead of an explicit assignment and case statement\n// so that clang-format doesn't get confused by the unusual \"case\"s.\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0 case 0:;\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT(n) \\\n coro_susp_point = n; \\\n WUFFS_BASE__FALLTHROUGH; \\\n case n:;\n\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) " + - "\\\n if (status < 0) { \\\n goto exit; \\\n } else if (status == 0) { \\\n goto ok; \\\n } \\\n coro_susp_point = n; \\\n goto suspend; \\\n case n:;\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define WUFFS_BASE__LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define WUFFS_BASE__UNLIKELY(expr) (__builtin_expect(!!(expr), 0))\n#else\n#define WUFFS_BASE__LIKELY(expr) (expr)\n#define WUFFS_BASE__UNLIKELY(expr) (expr)\n#endif\n\n// The helpers below are functions, instead of macros, because their arguments\n// can be an expression that we shouldn't evaluate more than once.\n//\n// They are static, so that linking multiple wuffs .o files won't complain about\n// duplicate function definitions." + - "\n//\n// They are explicitly marked inline, even if modern compilers don't use the\n// inline attribute to guide optimizations such as inlining, to avoid the\n// -Wunused-function warning, and we like to compile with -Wall -Werror.\n\nstatic inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {\n return ((wuffs_base__empty_struct){});\n}\n\n" + + "#ifndef WUFFS_INCLUDE_GUARD__BASE_PRIVATE\n#define WUFFS_INCLUDE_GUARD__BASE_PRIVATE\n\n// Copyright 2017 The Wuffs Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x)\n\n// WUFFS_BASE__MAGIC is a magic number to check that initializers are called.\n// It's not foolproof, given C doesn't automatically zero memory before use,\n// but it should catch 99.99% of cases.\n//\n// Its (non-zero) value is arbitrary" + + ", based on md5sum(\"wuffs\").\n#define WUFFS_BASE__MAGIC ((uint32_t)0x3CCB6C71)\n\n// Denote intentional fallthroughs for -Wimplicit-fallthrough.\n//\n// The order matters here. Clang also defines \"__GNUC__\".\n#if defined(__clang__) && __cplusplus >= 201103L\n#define WUFFS_BASE__FALLTHROUGH [[clang::fallthrough]]\n#elif !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 7)\n#define WUFFS_BASE__FALLTHROUGH __attribute__((fallthrough))\n#else\n#define WUFFS_BASE__FALLTHROUGH\n#endif\n\n// Use switch cases for coroutine suspension points, similar to the technique\n// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\n//\n// We use trivial macros instead of an explicit assignment and case statement\n// so that clang-format doesn't get confused by the unusual \"case\"s.\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0 case 0:;\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT(n) \\\n coro_susp_point = n; \\\n WUFFS_BASE__FALLTHROUGH; \\\n case n:;\n\n#define WUFFS_BASE__CORO" + + "UTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) \\\n if (status < 0) { \\\n goto exit; \\\n } else if (status == 0) { \\\n goto ok; \\\n } \\\n coro_susp_point = n; \\\n goto suspend; \\\n case n:;\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define WUFFS_BASE__LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define WUFFS_BASE__UNLIKELY(expr) (__builtin_expect(!!(expr), 0))\n#else\n#define WUFFS_BASE__LIKELY(expr) (expr)\n#define WUFFS_BASE__UNLIKELY(expr) (expr)\n#endif\n\n// The helpers below are functions, instead of macros, because their arguments\n// can be an expression that we shouldn't evaluate more than once.\n//\n// They are static, so that linking multiple wuffs .o files won't complain " + + "about\n// duplicate function definitions.\n//\n// They are explicitly marked inline, even if modern compilers don't use the\n// inline attribute to guide optimizations such as inlining, to avoid the\n// -Wunused-function warning, and we like to compile with -Wall -Werror.\n\nstatic inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {\n return ((wuffs_base__empty_struct){});\n}\n\n" + "" + "// ---------------- Numeric Types\n\nstatic inline uint16_t wuffs_base__load_u16be(uint8_t* p) {\n return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);\n}\n\nstatic inline uint16_t wuffs_base__load_u16le(uint8_t* p) {\n return ((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8);\n}\n\nstatic inline uint32_t wuffs_base__load_u24be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 16) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 0);\n}\n\nstatic inline uint32_t wuffs_base__load_u24le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 16);\n}\n\nstatic inline uint32_t wuffs_base__load_u32be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) |\n ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0);\n}\n\nstatic inline uint32_t wuffs_base__load_u32le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24);\n}\n\nstatic inline uint64_t wuffs_base__load_u40be(uint8_t" + "* p) {\n return ((uint64_t)(p[0]) << 32) | ((uint64_t)(p[1]) << 24) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 8) |\n ((uint64_t)(p[4]) << 0);\n}\n\nstatic inline uint64_t wuffs_base__load_u40le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 32);\n}\n\nstatic inline uint64_t wuffs_base__load_u48be(uint8_t* p) {\n return ((uint64_t)(p[0]) << 40) | ((uint64_t)(p[1]) << 32) |\n ((uint64_t)(p[2]) << 24) | ((uint64_t)(p[3]) << 16) |\n ((uint64_t)(p[4]) << 8) | ((uint64_t)(p[5]) << 0);\n}\n\nstatic inline uint64_t wuffs_base__load_u48le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40);\n}\n\nstatic inline uint64_t wuffs_base__load_u56be(uint8_t* p) {\n return ((uint64_t)(p[0]) << 48) | ((uint64_t)(p[1]) << 40) |\n ((u" + @@ -118,8 +118,8 @@ const basePrivateH = "" + " by 3 seems best for the std/deflate benchmarks, but that\n // is mostly because 3 is the minimum length for the deflate format. This\n // function implementation shouldn't overfit to that one format. Perhaps the\n // copy_from_history32 Wuffs method should also take an unroll hint argument,\n // and the cgen can look if that argument is the constant expression '3'.\n //\n // See also wuffs_base__io_writer__copy_from_history32__bco below.\n //\n // Alternatively, or additionally, have a sloppy_copy_from_history32 method\n // that copies 8 bytes at a time, possibly writing more than length bytes?\n for (; n >= 3; n -= 3) {\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n }\n for (; n; n--) {\n *ptr++ = *start++;\n }\n *ptr_ptr = ptr;\n return length;\n}\n\n// wuffs_base__io_writer__copy_from_history32__bco is a Bounds Check Optimized\n// version of the wuffs_base__io_writer__copy_from_history32 function above.\n// The caller needs to prove that:\n// - distance > 0\n// - distance <= (*ptr_pt" + "r - start)\n// - length <= (end - *ptr_ptr)\nstatic inline uint32_t wuffs_base__io_writer__copy_from_history32__bco(\n uint8_t** ptr_ptr,\n uint8_t* start,\n uint8_t* end,\n uint32_t distance,\n uint32_t length) {\n uint8_t* ptr = *ptr_ptr;\n start = ptr - distance;\n uint32_t n = length;\n for (; n >= 3; n -= 3) {\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n }\n for (; n; n--) {\n *ptr++ = *start++;\n }\n *ptr_ptr = ptr;\n return length;\n}\n\nstatic inline uint32_t wuffs_base__io_writer__copy_from_reader32(\n uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n uint8_t** ptr_ioptr_r,\n uint8_t* iobounds1_r,\n uint32_t length) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = length;\n if (n > iobounds1_w - ioptr_w) {\n n = iobounds1_w - ioptr_w;\n }\n uint8_t* ioptr_r = *ptr_ioptr_r;\n if (n > iobounds1_r - ioptr_r) {\n n = iobounds1_r - ioptr_r;\n }\n if (n > 0) {\n memmove(ioptr_w, ioptr_r, n);\n *ptr_ioptr_w += n;\n *ptr_ioptr_r += n;\n }\n return " + "n;\n}\n\nstatic inline uint64_t wuffs_base__io_writer__copy_from_slice(\n uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n wuffs_base__slice_u8 src) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = src.len;\n if (n > iobounds1_w - ioptr_w) {\n n = iobounds1_w - ioptr_w;\n }\n if (n > 0) {\n memmove(ioptr_w, src.ptr, n);\n *ptr_ioptr_w += n;\n }\n return n;\n}\n\nstatic inline uint32_t wuffs_base__io_writer__copy_from_slice32(\n uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n wuffs_base__slice_u8 src,\n uint32_t length) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = src.len;\n if (n > length) {\n n = length;\n }\n if (n > iobounds1_w - ioptr_w) {\n n = iobounds1_w - ioptr_w;\n }\n if (n > 0) {\n memmove(ioptr_w, src.ptr, n);\n *ptr_ioptr_w += n;\n }\n return n;\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(\n wuffs_base__io_reader* o,\n uint8_t* ioptr_r,\n uint64_t limit) {\n if (o && ((o->private_impl.bounds[1] - ioptr_r) > limit)) {\n o->private" + - "_impl.bounds[1] = ioptr_r + limit;\n }\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_reader__set_mark(\n wuffs_base__io_reader* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__set(\n wuffs_base__io_writer* o,\n wuffs_base__io_buffer* b,\n uint8_t** ioptr1_ptr,\n uint8_t** ioptr2_ptr,\n wuffs_base__slice_u8 s) {\n b->ptr = s.ptr;\n b->len = s.len;\n b->wi = 0;\n b->ri = 0;\n b->closed = false;\n o->private_impl.buf = b;\n o->private_impl.bounds[0] = s.ptr;\n o->private_impl.bounds[1] = s.ptr + s.len;\n *ioptr1_ptr = s.ptr;\n *ioptr2_ptr = s.ptr + s.len;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark(\n wuffs_base__io_writer* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n\n#endif // WUFFS_INCLUDE_GUARD__BASE" + - "_PRIVATE\n" + + "_impl.bounds[1] = ioptr_r + limit;\n }\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_reader__set_mark(\n wuffs_base__io_reader* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__set(\n wuffs_base__io_writer* o,\n wuffs_base__io_buffer* b,\n uint8_t** ioptr1_ptr,\n uint8_t** ioptr2_ptr,\n wuffs_base__slice_u8 s) {\n b->ptr = s.ptr;\n b->len = s.len;\n b->wi = 0;\n b->ri = 0;\n b->closed = false;\n o->private_impl.buf = b;\n o->private_impl.bounds[0] = s.ptr;\n o->private_impl.bounds[1] = s.ptr + s.len;\n *ioptr1_ptr = s.ptr;\n *ioptr2_ptr = s.ptr + s.len;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark(\n wuffs_base__io_writer* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n\n#ifdef __cplusplus\n} // extern \"C\"\n" + + "#endif\n\n#endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE\n" + "" const baseImplC = "" + diff --git a/gen/c/base.c b/gen/c/base.c index 4d89f201..d7ee683c 100644 --- a/gen/c/base.c +++ b/gen/c/base.c @@ -35,6 +35,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1259,26 +1263,34 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // C HEADER ENDS HERE. +// C HEADER ENDS HERE. #ifndef WUFFS_INCLUDE_GUARD__BASE_PRIVATE #define WUFFS_INCLUDE_GUARD__BASE_PRIVATE - // Copyright 2017 The Wuffs Authors. - // - // Licensed under the Apache License, Version 2.0 (the "License"); - // you may not use this file except in compliance with the License. - // You may obtain a copy of the License at - // - // https://www.apache.org/licenses/LICENSE-2.0 - // - // Unless required by applicable law or agreed to in writing, software - // distributed under the License is distributed on an "AS IS" BASIS, - // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - // See the License for the specific language governing permissions and - // limitations under the License. +// Copyright 2017 The Wuffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifdef __cplusplus +extern "C" { +#endif #define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) @@ -1821,6 +1833,10 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark( return ((wuffs_base__empty_struct){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE static const char wuffs_base__status__string_data[] = { diff --git a/gen/c/std/adler32.c b/gen/c/std/adler32.c index 60dc2967..fe936dd2 100644 --- a/gen/c/std/adler32.c +++ b/gen/c/std/adler32.c @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,9 +1252,13 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { @@ -1325,6 +1333,10 @@ uint32_t wuffs_adler32__hasher__update(wuffs_adler32__hasher* self, // See the License for the specific language governing permissions and // limitations under the License. +#ifdef __cplusplus +extern "C" { +#endif + #define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) // WUFFS_BASE__MAGIC is a magic number to check that initializers are called. @@ -1866,6 +1878,10 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark( return ((wuffs_base__empty_struct){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ADLER32) diff --git a/gen/c/std/crc32.c b/gen/c/std/crc32.c index 976a8f0e..d8a44d43 100644 --- a/gen/c/std/crc32.c +++ b/gen/c/std/crc32.c @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,9 +1252,13 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { @@ -1325,6 +1333,10 @@ uint32_t wuffs_crc32__ieee_hasher__update(wuffs_crc32__ieee_hasher* self, // See the License for the specific language governing permissions and // limitations under the License. +#ifdef __cplusplus +extern "C" { +#endif + #define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) // WUFFS_BASE__MAGIC is a magic number to check that initializers are called. @@ -1866,6 +1878,10 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark( return ((wuffs_base__empty_struct){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CRC32) diff --git a/gen/c/std/deflate.c b/gen/c/std/deflate.c index 17c369d7..4420aff8 100644 --- a/gen/c/std/deflate.c +++ b/gen/c/std/deflate.c @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,9 +1252,13 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { @@ -1413,6 +1421,10 @@ wuffs_base__status wuffs_deflate__decoder__decode(wuffs_deflate__decoder* self, // See the License for the specific language governing permissions and // limitations under the License. +#ifdef __cplusplus +extern "C" { +#endif + #define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) // WUFFS_BASE__MAGIC is a magic number to check that initializers are called. @@ -1954,6 +1966,10 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark( return ((wuffs_base__empty_struct){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__DEFLATE) diff --git a/gen/c/std/gif.c b/gen/c/std/gif.c index fe476b5d..166406dd 100644 --- a/gen/c/std/gif.c +++ b/gen/c/std/gif.c @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,18 +1252,22 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations - // ---------------- BEGIN USE "std/lzw" +// ---------------- BEGIN USE "std/lzw" #ifndef WUFFS_INCLUDE_GUARD__LZW #define WUFFS_INCLUDE_GUARD__LZW - // Code generated by wuffs-c. DO NOT EDIT. +// Code generated by wuffs-c. DO NOT EDIT. - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { @@ -1530,6 +1538,10 @@ wuffs_base__status wuffs_gif__decoder__decode_up_to_id_part1( // See the License for the specific language governing permissions and // limitations under the License. +#ifdef __cplusplus +extern "C" { +#endif + #define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) // WUFFS_BASE__MAGIC is a magic number to check that initializers are called. @@ -2071,6 +2083,10 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark( return ((wuffs_base__empty_struct){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GIF) diff --git a/gen/c/std/gzip.c b/gen/c/std/gzip.c index 107d2816..16040a2a 100644 --- a/gen/c/std/gzip.c +++ b/gen/c/std/gzip.c @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,18 +1252,22 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations - // ---------------- BEGIN USE "std/crc32" +// ---------------- BEGIN USE "std/crc32" #ifndef WUFFS_INCLUDE_GUARD__CRC32 #define WUFFS_INCLUDE_GUARD__CRC32 - // Code generated by wuffs-c. DO NOT EDIT. +// Code generated by wuffs-c. DO NOT EDIT. - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { @@ -1565,6 +1573,10 @@ wuffs_base__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self, // See the License for the specific language governing permissions and // limitations under the License. +#ifdef __cplusplus +extern "C" { +#endif + #define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) // WUFFS_BASE__MAGIC is a magic number to check that initializers are called. @@ -2106,6 +2118,10 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark( return ((wuffs_base__empty_struct){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__GZIP) diff --git a/gen/c/std/lzw.c b/gen/c/std/lzw.c index a83e114e..6d622377 100644 --- a/gen/c/std/lzw.c +++ b/gen/c/std/lzw.c @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,9 +1252,13 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { @@ -1349,6 +1357,10 @@ wuffs_base__status wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self, // See the License for the specific language governing permissions and // limitations under the License. +#ifdef __cplusplus +extern "C" { +#endif + #define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) // WUFFS_BASE__MAGIC is a magic number to check that initializers are called. @@ -1890,6 +1902,10 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark( return ((wuffs_base__empty_struct){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__LZW) diff --git a/gen/c/std/zlib.c b/gen/c/std/zlib.c index b5efc9d1..0dd929e0 100644 --- a/gen/c/std/zlib.c +++ b/gen/c/std/zlib.c @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,18 +1252,22 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations - // ---------------- BEGIN USE "std/adler32" +// ---------------- BEGIN USE "std/adler32" #ifndef WUFFS_INCLUDE_GUARD__ADLER32 #define WUFFS_INCLUDE_GUARD__ADLER32 - // Code generated by wuffs-c. DO NOT EDIT. +// Code generated by wuffs-c. DO NOT EDIT. - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { @@ -1563,6 +1571,10 @@ wuffs_base__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self, // See the License for the specific language governing permissions and // limitations under the License. +#ifdef __cplusplus +extern "C" { +#endif + #define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) // WUFFS_BASE__MAGIC is a magic number to check that initializers are called. @@ -2104,6 +2116,10 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark( return ((wuffs_base__empty_struct){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE #if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__ZLIB) diff --git a/gen/h/std/adler32.h b/gen/h/std/adler32.h index b6509e00..beb2db88 100644 --- a/gen/h/std/adler32.h +++ b/gen/h/std/adler32.h @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,9 +1252,13 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { diff --git a/gen/h/std/crc32.h b/gen/h/std/crc32.h index 7f36f2ac..a7699c2c 100644 --- a/gen/h/std/crc32.h +++ b/gen/h/std/crc32.h @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,9 +1252,13 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { diff --git a/gen/h/std/deflate.h b/gen/h/std/deflate.h index dfad38c3..15e74507 100644 --- a/gen/h/std/deflate.h +++ b/gen/h/std/deflate.h @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,9 +1252,13 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { diff --git a/gen/h/std/gif.h b/gen/h/std/gif.h index e4c6946a..0b0f7bee 100644 --- a/gen/h/std/gif.h +++ b/gen/h/std/gif.h @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,18 +1252,22 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations - // ---------------- BEGIN USE "std/lzw" +// ---------------- BEGIN USE "std/lzw" #ifndef WUFFS_INCLUDE_GUARD__LZW #define WUFFS_INCLUDE_GUARD__LZW - // Code generated by wuffs-c. DO NOT EDIT. +// Code generated by wuffs-c. DO NOT EDIT. - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { diff --git a/gen/h/std/gzip.h b/gen/h/std/gzip.h index 9902dc7b..3dd88119 100644 --- a/gen/h/std/gzip.h +++ b/gen/h/std/gzip.h @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,18 +1252,22 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations - // ---------------- BEGIN USE "std/crc32" +// ---------------- BEGIN USE "std/crc32" #ifndef WUFFS_INCLUDE_GUARD__CRC32 #define WUFFS_INCLUDE_GUARD__CRC32 - // Code generated by wuffs-c. DO NOT EDIT. +// Code generated by wuffs-c. DO NOT EDIT. - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { diff --git a/gen/h/std/lzw.h b/gen/h/std/lzw.h index 45f1d867..32b0fb73 100644 --- a/gen/h/std/lzw.h +++ b/gen/h/std/lzw.h @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,9 +1252,13 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" { diff --git a/gen/h/std/zlib.h b/gen/h/std/zlib.h index 73d9fea0..4921848b 100644 --- a/gen/h/std/zlib.h +++ b/gen/h/std/zlib.h @@ -24,6 +24,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + // Wuffs assumes that: // - converting a uint32_t to a size_t will never overflow. // - converting a size_t to a uint64_t will never overflow. @@ -1248,18 +1252,22 @@ static inline wuffs_base__table_u8 wuffs_base__image_buffer__plane( : ((wuffs_base__table_u8){}); } +#ifdef __cplusplus +} // extern "C" +#endif + #endif // WUFFS_INCLUDE_GUARD__BASE_PUBLIC - // ---------------- Use Declarations +// ---------------- Use Declarations - // ---------------- BEGIN USE "std/adler32" +// ---------------- BEGIN USE "std/adler32" #ifndef WUFFS_INCLUDE_GUARD__ADLER32 #define WUFFS_INCLUDE_GUARD__ADLER32 - // Code generated by wuffs-c. DO NOT EDIT. +// Code generated by wuffs-c. DO NOT EDIT. - // ---------------- Use Declarations +// ---------------- Use Declarations #ifdef __cplusplus extern "C" {