base: add WUFFS_BASE__MIME_TYPE__ETC
diff --git a/doc/note/enumerated-media-types.txt b/doc/note/enumerated-media-types.txt index 470aa49..36d4eb0 100644 --- a/doc/note/enumerated-media-types.txt +++ b/doc/note/enumerated-media-types.txt
@@ -47,6 +47,8 @@ # directory of the github.com/google/wuffs repository. That same directory also # holds a base38-and-fourcc.md file that elaborates on base38 encoding. +0x09CC62_556F2000 2757997502603264 appl/brot/.. application/brotli +0x09CC62_607F1000 2757997688197120 appl/defl/.. application/deflate 0x09CC62_6933B000 2757997834252288 appl/epub/.. application/epub+zip 0x09CC62_784EA000 2757998087675904 appl/gzip/.. application/gzip 0x09CC62_880DB9BE 2757998351858110 appl/java/ar application/java-archive @@ -130,6 +132,7 @@ 0x09CC62_E70E1800 2757999945717760 appl/xhtm/.. application/xhtml+xml 0x09CC62_E73A1800 2757999948601344 appl/xiso/.. application/x-iso9660-image 0x09CC62_E7AC4000 2757999956082688 appl/xlat/.. application/x-latex +0x09CC62_E7C9B800 2757999958013952 appl/xlzm/.. application/x-lzma 0x09CC62_E7E58000 2757999959834624 appl/xml./.. application/xml 0x09CC62_E7E5F000 2757999959863296 appl/xmld/.. application/xml-dtd 0x09CC62_E7EDD1BC 2757999960379836 appl/xms./ap application/x-ms-application @@ -144,6 +147,8 @@ 0x09CC62_E91A22EA 2757999980061418 appl/xtex/in application/x-texinfo 0x09CC62_E9E68000 2757999993454592 appl/xxz./.. application/x-xz 0x09CC62_F49B4000 2758000173072384 appl/zip./.. application/zip +0x09CC62_F51AB000 2758000181424128 appl/zlib/.. application/zlib +0x09CC62_F663B000 2758000202985472 appl/zstd/.. application/zstd 0x09CC62_FAA35800 2758000274266112 appl/~exa/.. application/pua.example 0x09CC62_FE887DA3 2758000339615139 appl/~~~~/~~ application/*
diff --git a/internal/cgen/base/fundamental-public.h b/internal/cgen/base/fundamental-public.h index 68ca4ec..001c7c9 100644 --- a/internal/cgen/base/fundamental-public.h +++ b/internal/cgen/base/fundamental-public.h
@@ -682,6 +682,13 @@ // -------- +// Various MIME types in 4/4/2 base-38 encoding, per +// doc/note/enumerated-media-types.txt + +// ¡ INSERT MimeTypes. + +// -------- + // Quirks. // ¡ INSERT Quirks.
diff --git a/internal/cgen/cgen.go b/internal/cgen/cgen.go index 8c9134c..c354538 100644 --- a/internal/cgen/cgen.go +++ b/internal/cgen/cgen.go
@@ -316,6 +316,32 @@ } return nil }, + "// ¡ INSERT MimeTypes.\n": func(b *buffer) error { + for i, z := range builtin.MimeTypes { + if i != 0 { + b.writeb('\n') + } + strBuf := make([]byte, len(z.Name)) + for i := range strBuf { + c := z.Name[i] + if ('a' <= c) && (c <= 'z') { + strBuf[i] = c &^ 0x20 + } else if (('A' <= c) && (c <= 'Z')) || (('0' <= c) && (c <= '9')) { + strBuf[i] = c + } else { + strBuf[i] = '_' + } + } + b.printf("// base38(%q) = 0x%X_%08X\n#define WUFFS_BASE__MIME_TYPE__%s %d\n", + z.Base38String, + z.Base38Number>>32, + z.Base38Number&0xFFFFFFFF, + string(strBuf), + z.Base38Number, + ) + } + return nil + }, "// ¡ INSERT Quirks.\n": func(b *buffer) error { first := true for _, z := range builtin.Consts {
diff --git a/lang/builtin/builtin.go b/lang/builtin/builtin.go index 144bb65..30d61e5 100644 --- a/lang/builtin/builtin.go +++ b/lang/builtin/builtin.go
@@ -94,6 +94,15 @@ {"ZSTD", "Zstandard"}, } +var MimeTypes = [...]struct { + Base38Number uint64 + Base38String string + Name string +}{ + {0x09CC62_607F1000, "appl/defl/..", "application/deflate"}, + {0x09CC62_A9E37800, "appl/octe/..", "application/octet-stream"}, +} + var Consts = [...]struct { Type t.ID Value string
diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 8c3a7df..1b28825 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c
@@ -964,6 +964,17 @@ // -------- +// Various MIME types in 4/4/2 base-38 encoding, per +// doc/note/enumerated-media-types.txt + +// base38("appl/defl/..") = 0x9CC62_607F1000 +#define WUFFS_BASE__MIME_TYPE__APPLICATION_DEFLATE 2757997688197120 + +// base38("appl/octe/..") = 0x9CC62_A9E37800 +#define WUFFS_BASE__MIME_TYPE__APPLICATION_OCTET_STREAM 2757998919514112 + +// -------- + // Quirks. #define WUFFS_BASE__QUIRK_IGNORE_CHECKSUM 1