base38: reassign alphabet and numbers

It changes from " 0-9?a-z" to ".0-9a-z~". The default or placeholder
changes from " " to "." so it's now always visible. The wildcard changes
from "?" to "~" so it's now sorted last.
This commit is contained in:
Nigel Tao committed 2024-08-26 12:30:20 +10:00
1 parent e12f10eef0
commit bd42fa7af2
18 files changed
+235 -212

No files matched your search

+2 -2
View File
@@ -37,8 +37,8 @@ pub const DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL : base.u64 = 9
// --------
// TOKEN_VALUE_MAJOR is the base-38 encoding of "cbor".
pub const TOKEN_VALUE_MAJOR : base.u32 = 0x0C_061D
// TOKEN_VALUE_MAJOR is the base38 encoding of "cbor".
pub const TOKEN_VALUE_MAJOR : base.u32 = 0x0B_29FA
// TOKEN_VALUE_MINOR__DETAIL_MASK is a mask for the low 18 bits of a token's
// value_minor. 18 is 64 - base.TOKEN__VALUE_EXTENSION__NUM_BITS.
+10 -10
View File
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
// The base38 encoding of "gif " is 0x0F_8586. Left shifting by 10 gives
// 0x3E16_1800.
pri const QUIRKS_BASE : base.u32 = 0x3E16_1800
// The base38 encoding of "gif." is 0x0E_A964. Left shifting by 10 gives
// 0x3AA5_9000.
pri const QUIRKS_BASE : base.u32 = 0x3AA5_9000
// --------
@@ -32,7 +32,7 @@ pri const QUIRKS_BASE : base.u32 = 0x3E16_1800
// see the N+1'th frame's header (or the end-of-animation terminator), so that
// e.g. the API for visiting the N'th frame can also return whether it's the
// final frame. Enabling this quirk allows for matching that behavior.
pub const QUIRK_DELAY_NUM_DECODED_FRAMES : base.u32 = 0x3E16_1800 | 0x00
pub const QUIRK_DELAY_NUM_DECODED_FRAMES : base.u32 = 0x3AA5_9000 | 0x00
// When this quirk is enabled, the background color of the first frame is set
// to black whenever that first frame has a local (frame-specific) palette.
@@ -44,7 +44,7 @@ pub const QUIRK_DELAY_NUM_DECODED_FRAMES : base.u32 = 0x3E16_1800 | 0x00
//
// There isn't really much of a rationale for this, other than it matches the
// behavior of another GIF implementation.
pub const QUIRK_FIRST_FRAME_LOCAL_PALETTE_MEANS_BLACK_BACKGROUND : base.u32 = 0x3E16_1800 | 0x01
pub const QUIRK_FIRST_FRAME_LOCAL_PALETTE_MEANS_BLACK_BACKGROUND : base.u32 = 0x3AA5_9000 | 0x01
// When this quirk is enabled, the background color is taken from the GIF
// instead of always being transparent black. If the background color index in
@@ -60,12 +60,12 @@ pub const QUIRK_FIRST_FRAME_LOCAL_PALETTE_MEANS_BLACK_BACKGROUND : base.u32 = 0x
// processing WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND. In both
// cases, the caller of Wuffs, not Wuffs itself, is responsible for filling the
// pixel buffer with that color.
pub const QUIRK_HONOR_BACKGROUND_COLOR : base.u32 = 0x3E16_1800 | 0x02
pub const QUIRK_HONOR_BACKGROUND_COLOR : base.u32 = 0x3AA5_9000 | 0x02
// When this quirk is enabled, silently ignore e.g. a frame that reports a
// width and height of 6 pixels each, followed by 50 pixel values. In that
// case, we process the first 36 pixel values and discard the excess 14.
pub const QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA : base.u32 = 0x3E16_1800 | 0x03
pub const QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA : base.u32 = 0x3AA5_9000 | 0x03
// When this quirk is enabled, if the initial frame bounds extends beyond the
// image bounds, then the image bounds stay unchanged. By default (with this
@@ -74,14 +74,14 @@ pub const QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA : base.u32 = 0x3E16_1800 | 0x03
//
// For more discussion, see
// https://github.com/google/wuffs/blob/main/test/data/artificial/gif-frame-out-of-bounds.gif.make-artificial.txt
pub const QUIRK_IMAGE_BOUNDS_ARE_STRICT : base.u32 = 0x3E16_1800 | 0x04
pub const QUIRK_IMAGE_BOUNDS_ARE_STRICT : base.u32 = 0x3AA5_9000 | 0x04
// When this quirk is enabled, a frame with zero width or height is rejected
// during decode_frame (but accepted during decode_frame_config).
pub const QUIRK_REJECT_EMPTY_FRAME : base.u32 = 0x3E16_1800 | 0x05
pub const QUIRK_REJECT_EMPTY_FRAME : base.u32 = 0x3AA5_9000 | 0x05
// When this quirk is enabled, a frame with no explicit palette is rejected,
// instead of implicitly having a palette with every entry being opaque black.
pub const QUIRK_REJECT_EMPTY_PALETTE : base.u32 = 0x3E16_1800 | 0x06
pub const QUIRK_REJECT_EMPTY_PALETTE : base.u32 = 0x3AA5_9000 | 0x06
pri const QUIRKS_COUNT : base.u32 = 0x07
+4 -4
View File
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
// The base38 encoding of "jpeg" is 0x122FF6. Left shifting by 10 gives
// 0x48BF_D800.
pri const QUIRKS_BASE : base.u32 = 0x48BF_D800
// The base38 encoding of "jpeg" is 0x11_53D3. Left shifting by 10 gives
// 0x454F_4C00.
pri const QUIRKS_BASE : base.u32 = 0x454F_4C00
// --------
@@ -35,7 +35,7 @@ pri const QUIRKS_BASE : base.u32 = 0x48BF_D800
// encountering a progressive JPEG. This results in more readable calling code,
// instead of commenting about "positive work buffer minimum length implies a
// progressive JPEG".
pub const QUIRK_REJECT_PROGRESSIVE_JPEGS : base.u32 = 0x48BF_D800 | 0x00
pub const QUIRK_REJECT_PROGRESSIVE_JPEGS : base.u32 = 0x454F_4C00 | 0x00
// --------
+24 -24
View File
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
// The base38 encoding of "json" is 0x12_4265. Left shifting by 10 gives
// 0x4909_9400.
pri const QUIRKS_BASE : base.u32 = 0x4909_9400
// The base38 encoding of "json" is 0x11_6642. Left shifting by 10 gives
// 0x4599_0800.
pri const QUIRKS_BASE : base.u32 = 0x4599_0800
// --------
@@ -30,22 +30,22 @@ pri const QUIRKS_BASE : base.u32 = 0x4909_9400
//
// Any indentation following a new line is not stripped, but remains part of
// the decoded string.
pub const QUIRK_ALLOW_ASCII_CONTROL_CODES : base.u32 = 0x4909_9400 | 0x00
pub const QUIRK_ALLOW_ASCII_CONTROL_CODES : base.u32 = 0x4599_0800 | 0x00
// When this quirk is enabled, e.g. "abc\az" is accepted as a JSON string,
// equivalent to "abc\u0007z", containing an ASCII Bell control character.
pub const QUIRK_ALLOW_BACKSLASH_A : base.u32 = 0x4909_9400 | 0x01
pub const QUIRK_ALLOW_BACKSLASH_A : base.u32 = 0x4599_0800 | 0x01
// When this quirk is enabled, e.g. "abc\U0001F4A9z" is accepted as a JSON
// string, equivalent to "abc\uD83D\uDCA9z", containing the U+0001F4A9 PILE OF
// POO Unicode code point. There are exactly 8 encoded bytes after each "\U".
//
// This quirk can combine with QUIRK_REPLACE_INVALID_UNICODE.
pub const QUIRK_ALLOW_BACKSLASH_CAPITAL_U : base.u32 = 0x4909_9400 | 0x02
pub const QUIRK_ALLOW_BACKSLASH_CAPITAL_U : base.u32 = 0x4599_0800 | 0x02
// When this quirk is enabled, e.g. "abc\ez" is accepted as a JSON string,
// equivalent to "abc\u001Bz", containing an ASCII Escape control character.
pub const QUIRK_ALLOW_BACKSLASH_E : base.u32 = 0x4909_9400 | 0x03
pub const QUIRK_ALLOW_BACKSLASH_E : base.u32 = 0x4599_0800 | 0x03
// When this quirk is enabled, e.g. ("abc\
// z") is accepted as a JSON string, equivalent to "abc\nz".
@@ -56,22 +56,22 @@ pub const QUIRK_ALLOW_BACKSLASH_E : base.u32 = 0x4909_9400 | 0x03
//
// Any indentation following a new line is not stripped, but remains part of
// the decoded string.
pub const QUIRK_ALLOW_BACKSLASH_NEW_LINE : base.u32 = 0x4909_9400 | 0x04
pub const QUIRK_ALLOW_BACKSLASH_NEW_LINE : base.u32 = 0x4599_0800 | 0x04
// When this quirk is enabled, e.g. "abc\?z" is accepted as a JSON string,
// equivalent to "abc?z".
pub const QUIRK_ALLOW_BACKSLASH_QUESTION_MARK : base.u32 = 0x4909_9400 | 0x05
pub const QUIRK_ALLOW_BACKSLASH_QUESTION_MARK : base.u32 = 0x4599_0800 | 0x05
// When this quirk is enabled, e.g. "abc\'z" is accepted as a JSON string,
// equivalent to "abc'z".
pub const QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE : base.u32 = 0x4909_9400 | 0x06
pub const QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE : base.u32 = 0x4599_0800 | 0x06
// When this quirk is enabled, e.g. "abc\vz" is accepted as a JSON string,
// equivalent to "abc\u000Bz", containing an ASCII Vertical Tab control
// character.
pub const QUIRK_ALLOW_BACKSLASH_V : base.u32 = 0x4909_9400 | 0x07
pub const QUIRK_ALLOW_BACKSLASH_V : base.u32 = 0x4599_0800 | 0x07
// (0x4909_9400 | 0x08) is reserved for QUIRK_ALLOW_BACKSLASH_X_AS_BYTES. This
// (0x4599_0800 | 0x08) is reserved for QUIRK_ALLOW_BACKSLASH_X_AS_BYTES. This
// quirk used to be implemented, but it was removed due to its complexity.
// Enabling it (as a run-time option) meant that decoded JSON strings are no
// longer guaranteed to be valid UTF-8. We could re-implement it (i.e. undo
@@ -86,11 +86,11 @@ pub const QUIRK_ALLOW_BACKSLASH_V : base.u32 = 0x4909_9400 | 0x07
//
// There are exactly 2 encoded bytes after each "\x". "\x", "\x9", "\x9$" and
// "\X99" are all still rejected.
pub const QUIRK_ALLOW_BACKSLASH_X_AS_CODE_POINTS : base.u32 = 0x4909_9400 | 0x09
pub const QUIRK_ALLOW_BACKSLASH_X_AS_CODE_POINTS : base.u32 = 0x4599_0800 | 0x09
// When this quirk is enabled, e.g. "abc\0z" is accepted as a JSON string,
// equivalent to "abc\u0000z", containing an ASCII NUL control character.
pub const QUIRK_ALLOW_BACKSLASH_ZERO : base.u32 = 0x4909_9400 | 0x0A
pub const QUIRK_ALLOW_BACKSLASH_ZERO : base.u32 = 0x4599_0800 | 0x0A
// When this quirk is enabled, "/* C/C++ style block comments */" are accepted
// anywhere whitespace would be. See also QUIRK_ALLOW_TRAILING_FILLER.
@@ -100,7 +100,7 @@ pub const QUIRK_ALLOW_BACKSLASH_ZERO : base.u32 = 0x4909_9400 | 0x0A
//
// To avoid ambiguity (as comments can contain new lines), this quirk cannot be
// combined with QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF.
pub const QUIRK_ALLOW_COMMENT_BLOCK : base.u32 = 0x4909_9400 | 0x0B
pub const QUIRK_ALLOW_COMMENT_BLOCK : base.u32 = 0x4599_0800 | 0x0B
// When this quirk is enabled, "// C/C++ style line comments\n" are accepted
// anywhere whitespace would be. See also QUIRK_ALLOW_TRAILING_FILLER.
@@ -119,7 +119,7 @@ pub const QUIRK_ALLOW_COMMENT_BLOCK : base.u32 = 0x4909_9400 | 0x0B
//
// To avoid ambiguity (as comments can contain new lines), this quirk cannot be
// combined with QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF.
pub const QUIRK_ALLOW_COMMENT_LINE : base.u32 = 0x4909_9400 | 0x0C
pub const QUIRK_ALLOW_COMMENT_LINE : base.u32 = 0x4599_0800 | 0x0C
// When this quirk is enabled, there may be a comma after the final array
// element or object key-value pair and before the closing "]" or "}". A comma
@@ -128,12 +128,12 @@ pub const QUIRK_ALLOW_COMMENT_LINE : base.u32 = 0x4909_9400 | 0x0C
//
// For example, `[1,]`, `[1,2,3,]` and `{"k":"v",}` all become acceptable, but
// `[,]`, `{,}` and `{"k",:"v"}` are still rejected.
pub const QUIRK_ALLOW_EXTRA_COMMA : base.u32 = 0x4909_9400 | 0x0D
pub const QUIRK_ALLOW_EXTRA_COMMA : base.u32 = 0x4599_0800 | 0x0D
// When this quirk is enabled, "inf", "Infinity", "NAN" and their
// case-insensitive variants, optionally preceded immediately by "-" or "+",
// are accepted anywhere a JSON number would be.
pub const QUIRK_ALLOW_INF_NAN_NUMBERS : base.u32 = 0x4909_9400 | 0x0E
pub const QUIRK_ALLOW_INF_NAN_NUMBERS : base.u32 = 0x4599_0800 | 0x0E
// When this quirk is enabled, the input byte stream may optionally start with
// "\x1E" (the ASCII Record Separator control character). That byte is skipped
@@ -145,7 +145,7 @@ pub const QUIRK_ALLOW_INF_NAN_NUMBERS : base.u32 = 0x4909_9400 | 0x0E
// When combined with QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF, this format is
// also known as RFC 7464, Json Text Sequences and MIME type
// "application/json-seq".
pub const QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR : base.u32 = 0x4909_9400 | 0x0F
pub const QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR : base.u32 = 0x4599_0800 | 0x0F
// When this quirk is enabled, the input byte stream may optionally start with
// "\xEF\xBB\xBF", the UTF-8 encoding of the Unicode BOM (Byte Order Mark).
@@ -153,7 +153,7 @@ pub const QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR : base.u32 = 0x4909_9400 |
//
// When combined with QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR, either mark
// may come first in the byte stream.
pub const QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK : base.u32 = 0x4909_9400 | 0x10
pub const QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK : base.u32 = 0x4599_0800 | 0x10
// When this quirk is enabled, following a successful decoding of a top-level
// JSON value, any trailing whitespace (ASCII characters 0x09, 0x0A, 0x0D or
@@ -166,7 +166,7 @@ pub const QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK : base.u32 = 0x4909_9400 |
// To avoid ambiguity, this quirk cannot be combined with
// QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF. Unlike that quirk, enabling this
// quirk will consume multiple trailing '\n' bytes.
pub const QUIRK_ALLOW_TRAILING_FILLER : base.u32 = 0x4909_9400 | 0x11
pub const QUIRK_ALLOW_TRAILING_FILLER : base.u32 = 0x4599_0800 | 0x11
// When this quirk is enabled, following a successful decoding of a top-level
// JSON value, any trailing whitespace (ASCII characters 0x09, 0x0A, 0x0D or
@@ -202,14 +202,14 @@ pub const QUIRK_ALLOW_TRAILING_FILLER : base.u32 = 0x4909_9400 | 0x11
// When combined with QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR, this format
// is also known as RFC 7464, Json Text Sequences and MIME type
// "application/json-seq".
pub const QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF : base.u32 = 0x4909_9400 | 0x12
pub const QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF : base.u32 = 0x4599_0800 | 0x12
// When this quirk is enabled, JSON Pointer strings containing "~n", "~r" or
// "~t", which would otherwise be invalid, are unescaped as "\n", "\r" or "\t".
//
// This quirk isn't used by Wuffs' std/json package per se, but it is used by
// the wuffs_aux::DecodeJson function.
pub const QUIRK_JSON_POINTER_ALLOW_TILDE_N_TILDE_R_TILDE_T : base.u32 = 0x4909_9400 | 0x13
pub const QUIRK_JSON_POINTER_ALLOW_TILDE_N_TILDE_R_TILDE_T : base.u32 = 0x4599_0800 | 0x13
// When this quirk is enabled, invalid UTF-8 inside a JSON string is accepted.
// Each byte of invalid UTF-8 is equivalent to "\uFFFD", the Unicode
@@ -225,6 +225,6 @@ pub const QUIRK_JSON_POINTER_ALLOW_TILDE_N_TILDE_R_TILDE_T : base.u32 = 0x4909_9
// When combined with QUIRK_ALLOW_BACKSLASH_CAPITAL_U, a "\U12345678" 10-byte
// unit that is an invalid Unicode code point (i.e. in the range U+D800 ..=
// U+DFFF or above U+10FFFF) is similarly replaced with U+FFFD.
pub const QUIRK_REPLACE_INVALID_UNICODE : base.u32 = 0x4909_9400 | 0x14
pub const QUIRK_REPLACE_INVALID_UNICODE : base.u32 = 0x4599_0800 | 0x14
pri const QUIRKS_COUNT : base.u32 = 0x15
+5 -5
View File
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
// The base38 encoding of "lzma" is 0x141638. Left shifting by 10 gives
// 0x5058_E000.
pri const QUIRKS_BASE : base.u32 = 0x5058_E000
// The base38 encoding of "lzma" is 0x13_3A15. Left shifting by 10 gives
// 0x4CE8_5400.
pri const QUIRKS_BASE : base.u32 = 0x4CE8_5400
// --------
@@ -22,7 +22,7 @@ pri const QUIRKS_BASE : base.u32 = 0x5058_E000
// initial byte [after properties or other headers] is not equal to ZERO, the
// LZMA Decoder must stop decoding and report error" from the spec
// https://raw.githubusercontent.com/jljusten/LZMA-SDK/781863cdf592da3e97420f50de5dac056ad352a5/DOC/lzma-specification.txt
pub const QUIRK_ALLOW_NON_ZERO_INITIAL_BYTE : base.u32 = 0x5058_E000 | 0x00
pub const QUIRK_ALLOW_NON_ZERO_INITIAL_BYTE : base.u32 = 0x4CE8_5400 | 0x00
// When this quirk is set, a positive value indicates an extension to the LZMA
// format. Zero means to use the default LZMA format.
@@ -39,4 +39,4 @@ pub const QUIRK_ALLOW_NON_ZERO_INITIAL_BYTE : base.u32 = 0x5058_E000 | 0x00
// For LZMA2, the high 7 bytes (shifted right by 8) must be less than or equal
// to 40 and indicates the dictionary size. See section "5.3.1. LZMA2" of
// https://tukaani.org/xz/xz-file-format.txt
pub const QUIRK_FORMAT_EXTENSION : base.u32 = 0x5058_E000 | 0x01
pub const QUIRK_FORMAT_EXTENSION : base.u32 = 0x4CE8_5400 | 0x01
+4 -4
View File
@@ -12,13 +12,13 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
// The base38 encoding of "lzw " is 0x1417A8. Left shifting by 10 gives
// 0x505E_A000.
pri const QUIRKS_BASE : base.u32 = 0x505E_A000
// The base38 encoding of "lzw." is 0x13_3B86. Left shifting by 10 gives
// 0x4CEE_1800.
pri const QUIRKS_BASE : base.u32 = 0x4CEE_1800
// --------
// When this quirk is set (to a value in the range 0 ..= 9), a positive value
// is one more than the initial number of bits of a literal code. Zero means to
// use the default literal width, 8.
pub const QUIRK_LITERAL_WIDTH_PLUS_ONE : base.u32 = 0x505E_A000 | 0x00
pub const QUIRK_LITERAL_WIDTH_PLUS_ONE : base.u32 = 0x4CEE_1800 | 0x00
+4 -4
View File
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
// The base38 encoding of "xz " is 0x1E1EBC. Left shifting by 10 gives
// 0x787A_F000.
pri const QUIRKS_BASE : base.u32 = 0x787A_F000
// The base38 encoding of "xz.." is 0x1D_42C0. Left shifting by 10 gives
// 0x750B_0000.
pri const QUIRKS_BASE : base.u32 = 0x750B_0000
// --------
@@ -37,4 +37,4 @@ pri const QUIRKS_BASE : base.u32 = 0x787A_F000
// XZ-as-part-of-something-else format, not the XZ-standalone format. Like most
// of Wuffs' other std/foobar quirks, decoding a more lenient variant of the
// foobar format is opt-in, not opt-out.
pub const QUIRK_DECODE_STANDALONE_CONCATENATED_STREAMS : base.u32 = 0x787A_F000 | 0x00
pub const QUIRK_DECODE_STANDALONE_CONCATENATED_STREAMS : base.u32 = 0x750B_0000 | 0x00
+4 -4
View File
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
// The base38 encoding of "zlib" is 0x1F_7F79. Left shifting by 10 gives
// 0x7DFD_E400.
pri const QUIRKS_BASE : base.u32 = 0x7DFD_E400
// The base38 encoding of "zlib" is 0x1E_A356. Left shifting by 10 gives
// 0x7A8D_5800.
pri const QUIRKS_BASE : base.u32 = 0x7A8D_5800
// --------
@@ -24,6 +24,6 @@ pri const QUIRKS_BASE : base.u32 = 0x7DFD_E400
// A zlib.decoder basically becomes a deflate.decoder. This is useful when the
// caller might want to choose between the two related-but-slightly-different
// formats at run time but would rather not allocate two separate decoders.
pub const QUIRK_JUST_RAW_DEFLATE : base.u32 = 0x7DFD_E400 | 0x00
pub const QUIRK_JUST_RAW_DEFLATE : base.u32 = 0x7A8D_5800 | 0x00
pri const QUIRKS_COUNT : base.u32 = 0x01