diff --git a/internal/cgen/base/fundamental-public.h b/internal/cgen/base/fundamental-public.h index a36cf709..4655d231 100644 --- a/internal/cgen/base/fundamental-public.h +++ b/internal/cgen/base/fundamental-public.h @@ -347,6 +347,12 @@ typedef struct wuffs_base__transform__output__struct { // -------- +// Quirks. + +// !! INSERT Quirks. + +// -------- + // Flicks are a unit of time. One flick (frame-tick) is 1 / 705_600_000 of a // second. See https://github.com/OculusVR/Flicks typedef int64_t wuffs_base__flicks; diff --git a/internal/cgen/cgen.go b/internal/cgen/cgen.go index f0002bda..8973e58d 100644 --- a/internal/cgen/cgen.go +++ b/internal/cgen/cgen.go @@ -302,6 +302,21 @@ func insertBaseAllPublicH(buf *buffer) error { } return nil }, + "// !! INSERT Quirks.\n": func(b *buffer) error { + first := true + for _, z := range builtin.Consts { + if (z.Name == "") || (z.Name[0] != 'Q') || !strings.HasPrefix(z.Name, "QUIRK_") { + continue + } + if first { + first = false + } else { + b.writeb('\n') + } + b.printf("#define WUFFS_BASE__%s %s\n", z.Name, z.Value) + } + return nil + }, "// !! INSERT wuffs_base__status names.\n": func(b *buffer) error { for _, z := range builtin.Statuses { msg, _ := t.Unescape(z) diff --git a/internal/cgen/data/data.go b/internal/cgen/data/data.go index 5ba84ef8..13d09f01 100644 --- a/internal/cgen/data/data.go +++ b/internal/cgen/data/data.go @@ -78,6 +78,8 @@ const BaseFundamentalPublicH = "" + "" + "// --------\n\n// FourCC constants.\n\n// !! INSERT FourCCs.\n\n" + "" + + "// --------\n\n// Quirks.\n\n// !! INSERT Quirks.\n\n" + + "" + "// --------\n\n// Flicks are a unit of time. One flick (frame-tick) is 1 / 705_600_000 of a\n// second. See https://github.com/OculusVR/Flicks\ntypedef int64_t wuffs_base__flicks;\n\n#define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000)\n#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600)\n\n" + "" + "// ---------------- Numeric Types\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 int8_t //\nwuffs_base__i8__min(int8_t x, int8_t y) {\n return x < y ? x : y;\n}\n\nstatic inline int8_t //\nwuffs_base__i8__max(int8_t x, int8_t y) {\n return x > y ? x : y;\n}\n\nstatic inline int16_t //\nwuffs_base__i16__min(int16_t x, int16_t y) {\n return x < y ? x : y;\n}\n\nstatic inline int16_t //\nwuffs_base__i16__max(int16_t x, int16_t y) {\n return x > y ? x : y;\n}\n\nstatic inline int32_t //\nwuffs_base__i32__min(int32_t x, int32_t y) {\n return x < y ? x : y;\n}\n\nstatic inline " + diff --git a/lang/builtin/builtin.go b/lang/builtin/builtin.go index 66ba7721..a21803f2 100644 --- a/lang/builtin/builtin.go +++ b/lang/builtin/builtin.go @@ -79,6 +79,10 @@ var Consts = [...]struct { // ---- + {t.IDU32, "1", "QUIRK_IGNORE_CHECKSUM"}, + + // ---- + {t.IDU32, "46", "TOKEN__VALUE_EXTENSION__NUM_BITS"}, // ---- diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index e9ed7988..0f4edbae 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -421,6 +421,12 @@ typedef struct wuffs_base__transform__output__struct { // -------- +// Quirks. + +#define WUFFS_BASE__QUIRK_IGNORE_CHECKSUM 1 + +// -------- + // Flicks are a unit of time. One flick (frame-tick) is 1 / 705_600_000 of a // second. See https://github.com/OculusVR/Flicks typedef int64_t wuffs_base__flicks;