From 77ccfaf556497fa5fccf0107f843b70bcc2ccd6b Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Sat, 28 Apr 2018 13:58:22 +1000 Subject: [PATCH] Add WUFFS_BASE__FLICKS_PER_MILLISECOND --- cmd/wuffs-c/internal/cgen/base-header.h | 1 + cmd/wuffs-c/internal/cgen/data.go | 2 +- gen/c/std/adler32.c | 1 + gen/c/std/crc32.c | 1 + gen/c/std/deflate.c | 1 + gen/c/std/gif.c | 1 + gen/c/std/gzip.c | 1 + gen/c/std/zlib.c | 1 + gen/h/std/adler32.h | 1 + gen/h/std/crc32.h | 1 + gen/h/std/deflate.h | 1 + gen/h/std/gif.h | 1 + gen/h/std/gzip.h | 1 + gen/h/std/zlib.h | 1 + 14 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cmd/wuffs-c/internal/cgen/base-header.h b/cmd/wuffs-c/internal/cgen/base-header.h index fe03da1a..f0926a32 100644 --- a/cmd/wuffs-c/internal/cgen/base-header.h +++ b/cmd/wuffs-c/internal/cgen/base-header.h @@ -46,6 +46,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/cmd/wuffs-c/internal/cgen/data.go b/cmd/wuffs-c/internal/cgen/data.go index 353d9caa..5a0007ef 100644 --- a/cmd/wuffs-c/internal/cgen/data.go +++ b/cmd/wuffs-c/internal/cgen/data.go @@ -20,7 +20,7 @@ const baseHeader = "" + "#ifndef WUFFS_BASE_HEADER_H\n#define WUFFS_BASE_HEADER_H\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 major.minor version number " + "as a uint32_t. The major\n// number is the high 16 bits. The minor number is the low 16 bits.\n//\n// The intention is to bump the version number at least on every API / ABI\n// backwards incompatible change.\n//\n// For now, the API and ABI are simply unstable and can change at any time.\n//\n// TODO: don't hard code this in base-header.h.\n#define WUFFS_VERSION ((uint32_t)0x00001)\n\n" + "" + - "// ---------------- Fundamentals\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 uint64_t wuffs_base__flicks;\n\n#define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000)\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__slice_u8 is a 1-dimensional buffer.\n//\n// A value with all fields NULL or zero is a valid, empty slice.\ntypedef struct {\n uint8_t* ptr;\n size_t len;\n} wuffs_base__slice_u8;\n\n// wuffs_base__table_u8 is a 2-dimensional buffer.\n//\n// A value with all fields NULL or zero is a valid, empty table.\ntypedef struct {\n uint8_t* ptr;\n size_t width;\n size_t height;\n size_t stride;\n} wuffs_base__table_u8;\n\n" + + "// ---------------- Fundamentals\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 uint64_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// 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__slice_u8 is a 1-dimensional buffer.\n//\n// A value with all fields NULL or zero is a valid, empty slice.\ntypedef struct {\n uint8_t* ptr;\n size_t len;\n} wuffs_base__slice_u8;\n\n// wuffs_base__table_u8 is a 2-dimensional buffer.\n//\n// A value with all fields NULL or zero is a valid, empty table.\ntypedef struct {\n uint8_t* ptr;\n size_t width;\n size_t height;\n size_t stride;\n} wuffs_base__table_u8;\n\n" + "" + "// --------\n\nstatic inline uint8_t wuffs_base__u8__min(uint8_t x, uint8_t y) {\n return x < y ? x : y;\n}\n\nstatic inline uint8_t wuffs_base__u8__max(uint8_t x, uint8_t y) {\n return x > y ? x : y;\n}\n\nstatic inline uint16_t wuffs_base__u16__min(uint16_t x, uint16_t y) {\n return x < y ? x : y;\n}\n\nstatic inline uint16_t wuffs_base__u16__max(uint16_t x, uint16_t y) {\n return x > y ? x : y;\n}\n\nstatic inline uint32_t wuffs_base__u32__min(uint32_t x, uint32_t y) {\n return x < y ? x : y;\n}\n\nstatic inline uint32_t wuffs_base__u32__max(uint32_t x, uint32_t y) {\n return x > y ? x : y;\n}\n\nstatic inline uint64_t wuffs_base__u64__min(uint64_t x, uint64_t y) {\n return x < y ? x : y;\n}\n\nstatic inline uint64_t wuffs_base__u64__max(uint64_t x, uint64_t y) {\n return x > y ? x : y;\n}\n\n" + "" + diff --git a/gen/c/std/adler32.c b/gen/c/std/adler32.c index 03e3ecd4..5a2220c2 100644 --- a/gen/c/std/adler32.c +++ b/gen/c/std/adler32.c @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/gen/c/std/crc32.c b/gen/c/std/crc32.c index 40a35af7..82603f76 100644 --- a/gen/c/std/crc32.c +++ b/gen/c/std/crc32.c @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/gen/c/std/deflate.c b/gen/c/std/deflate.c index 9705ef5f..d11753af 100644 --- a/gen/c/std/deflate.c +++ b/gen/c/std/deflate.c @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/gen/c/std/gif.c b/gen/c/std/gif.c index 144161dd..50acc6b3 100644 --- a/gen/c/std/gif.c +++ b/gen/c/std/gif.c @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/gen/c/std/gzip.c b/gen/c/std/gzip.c index 22ae3953..0cf5a532 100644 --- a/gen/c/std/gzip.c +++ b/gen/c/std/gzip.c @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/gen/c/std/zlib.c b/gen/c/std/zlib.c index e3362a99..5ace73c0 100644 --- a/gen/c/std/zlib.c +++ b/gen/c/std/zlib.c @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/gen/h/std/adler32.h b/gen/h/std/adler32.h index fc7b7a07..35cdf3fd 100644 --- a/gen/h/std/adler32.h +++ b/gen/h/std/adler32.h @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/gen/h/std/crc32.h b/gen/h/std/crc32.h index 3511b101..beca8b9d 100644 --- a/gen/h/std/crc32.h +++ b/gen/h/std/crc32.h @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/gen/h/std/deflate.h b/gen/h/std/deflate.h index 150e3801..10560a17 100644 --- a/gen/h/std/deflate.h +++ b/gen/h/std/deflate.h @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/gen/h/std/gif.h b/gen/h/std/gif.h index 11d90b52..af5fe7ce 100644 --- a/gen/h/std/gif.h +++ b/gen/h/std/gif.h @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/gen/h/std/gzip.h b/gen/h/std/gzip.h index 5b80aa9e..ae968e4e 100644 --- a/gen/h/std/gzip.h +++ b/gen/h/std/gzip.h @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in diff --git a/gen/h/std/zlib.h b/gen/h/std/zlib.h index 2c7cc461..4a0c922f 100644 --- a/gen/h/std/zlib.h +++ b/gen/h/std/zlib.h @@ -49,6 +49,7 @@ typedef uint64_t wuffs_base__flicks; #define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000) +#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600) // wuffs_base__empty_struct is used when a Wuffs function returns an empty // struct. In C, if a function f returns void, you can't say "x = f()", but in