Capitalize Wuffs const names
diff --git a/internal/cgen/cgen.go b/internal/cgen/cgen.go index 319bdd3..3b9ed97 100644 --- a/internal/cgen/cgen.go +++ b/internal/cgen/cgen.go
@@ -147,6 +147,8 @@ } else { g := &gen{ + PKGPREFIX: "WUFFS_" + strings.ToUpper(pkgName) + "__", + PKGNAME: strings.ToUpper(pkgName), pkgPrefix: "wuffs_" + pkgName + "__", pkgName: pkgName, tm: tm, @@ -496,6 +498,8 @@ } type gen struct { + PKGPREFIX string // e.g. "WUFFS_JPEG__" + PKGNAME string // e.g. "JPEG" pkgPrefix string // e.g. "wuffs_jpeg__" pkgName string // e.g. "jpeg" @@ -580,7 +584,7 @@ return nil, err } - includeGuard := "WUFFS_INCLUDE_GUARD__" + strings.ToUpper(g.pkgName) + includeGuard := "WUFFS_INCLUDE_GUARD__" + g.PKGNAME b.printf("#ifndef %s\n#define %s\n\n", includeGuard, includeGuard) if err := g.genIncludes(b); err != nil { @@ -612,7 +616,7 @@ func (g *gen) genIncludes(b *buffer) error { b.writes("#if defined(WUFFS_IMPLEMENTATION) && !defined(WUFFS_CONFIG__MODULES)\n") b.writes("#define WUFFS_CONFIG__MODULES\n") - b.printf("#define WUFFS_CONFIG__MODULE__%s\n", strings.ToUpper(g.pkgName)) + b.printf("#define WUFFS_CONFIG__MODULE__%s\n", g.PKGNAME) b.writes("#endif\n\n") usesList := []string(nil) @@ -750,8 +754,7 @@ } func (g *gen) genImpl(b *buffer) error { - module := "!defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__" + - strings.ToUpper(g.pkgName) + ")" + module := "!defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__" + g.PKGNAME + ")" b.printf("#if %s\n\n", module) b.writes("// ---------------- Status Codes Implementations\n\n") @@ -940,10 +943,10 @@ func (g *gen) writeConst(b *buffer, n *a.Const) error { if cv := n.Value().ConstValue(); cv != nil { - b.printf("#define %s %v\n\n", strings.ToUpper(g.pkgPrefix+n.QID()[1].Str(g.tm)), cv) + b.printf("#define %s%s %v\n\n", g.PKGPREFIX, n.QID()[1].Str(g.tm), cv) } else { b.writes("static const ") - if err := g.writeCTypeName(b, n.XType(), "//\n"+g.pkgPrefix, n.QID()[1].Str(g.tm)); err != nil { + if err := g.writeCTypeName(b, n.XType(), "//\n"+g.PKGPREFIX, n.QID()[1].Str(g.tm)); err != nil { return err } b.writes("//\n WUFFS_BASE__POTENTIALLY_UNUSED = ")
diff --git a/internal/cgen/expr.go b/internal/cgen/expr.go index 3dd3898..7204fc2 100644 --- a/internal/cgen/expr.go +++ b/internal/cgen/expr.go
@@ -84,7 +84,7 @@ } else { if n.GlobalIdent() { - b.writes(g.pkgPrefix) + b.writes(g.PKGPREFIX) } else { b.writes(vPrefix) }
diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 14f3222..3bf3b36 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c
@@ -12690,7 +12690,7 @@ // ---------------- Private Consts static const uint32_t // - wuffs_crc32__ieee_table[16][256] // + WUFFS_CRC32__IEEE_TABLE[16][256] // WUFFS_BASE__POTENTIALLY_UNUSED = { { 0, 1996959894, 3993919788, 2567524794, 124634137, @@ -13687,42 +13687,42 @@ v_s ^= ((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) | (((uint32_t)(v_p.ptr[2])) << 16) | (((uint32_t)(v_p.ptr[3])) << 24)); - v_s = (wuffs_crc32__ieee_table[0][v_p.ptr[15]] ^ - wuffs_crc32__ieee_table[1][v_p.ptr[14]] ^ - wuffs_crc32__ieee_table[2][v_p.ptr[13]] ^ - wuffs_crc32__ieee_table[3][v_p.ptr[12]] ^ - wuffs_crc32__ieee_table[4][v_p.ptr[11]] ^ - wuffs_crc32__ieee_table[5][v_p.ptr[10]] ^ - wuffs_crc32__ieee_table[6][v_p.ptr[9]] ^ - wuffs_crc32__ieee_table[7][v_p.ptr[8]] ^ - wuffs_crc32__ieee_table[8][v_p.ptr[7]] ^ - wuffs_crc32__ieee_table[9][v_p.ptr[6]] ^ - wuffs_crc32__ieee_table[10][v_p.ptr[5]] ^ - wuffs_crc32__ieee_table[11][v_p.ptr[4]] ^ - wuffs_crc32__ieee_table[12][(255 & (v_s >> 24))] ^ - wuffs_crc32__ieee_table[13][(255 & (v_s >> 16))] ^ - wuffs_crc32__ieee_table[14][(255 & (v_s >> 8))] ^ - wuffs_crc32__ieee_table[15][(255 & (v_s >> 0))]); + v_s = (WUFFS_CRC32__IEEE_TABLE[0][v_p.ptr[15]] ^ + WUFFS_CRC32__IEEE_TABLE[1][v_p.ptr[14]] ^ + WUFFS_CRC32__IEEE_TABLE[2][v_p.ptr[13]] ^ + WUFFS_CRC32__IEEE_TABLE[3][v_p.ptr[12]] ^ + WUFFS_CRC32__IEEE_TABLE[4][v_p.ptr[11]] ^ + WUFFS_CRC32__IEEE_TABLE[5][v_p.ptr[10]] ^ + WUFFS_CRC32__IEEE_TABLE[6][v_p.ptr[9]] ^ + WUFFS_CRC32__IEEE_TABLE[7][v_p.ptr[8]] ^ + WUFFS_CRC32__IEEE_TABLE[8][v_p.ptr[7]] ^ + WUFFS_CRC32__IEEE_TABLE[9][v_p.ptr[6]] ^ + WUFFS_CRC32__IEEE_TABLE[10][v_p.ptr[5]] ^ + WUFFS_CRC32__IEEE_TABLE[11][v_p.ptr[4]] ^ + WUFFS_CRC32__IEEE_TABLE[12][(255 & (v_s >> 24))] ^ + WUFFS_CRC32__IEEE_TABLE[13][(255 & (v_s >> 16))] ^ + WUFFS_CRC32__IEEE_TABLE[14][(255 & (v_s >> 8))] ^ + WUFFS_CRC32__IEEE_TABLE[15][(255 & (v_s >> 0))]); v_p.ptr += 16; v_s ^= ((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) | (((uint32_t)(v_p.ptr[2])) << 16) | (((uint32_t)(v_p.ptr[3])) << 24)); - v_s = (wuffs_crc32__ieee_table[0][v_p.ptr[15]] ^ - wuffs_crc32__ieee_table[1][v_p.ptr[14]] ^ - wuffs_crc32__ieee_table[2][v_p.ptr[13]] ^ - wuffs_crc32__ieee_table[3][v_p.ptr[12]] ^ - wuffs_crc32__ieee_table[4][v_p.ptr[11]] ^ - wuffs_crc32__ieee_table[5][v_p.ptr[10]] ^ - wuffs_crc32__ieee_table[6][v_p.ptr[9]] ^ - wuffs_crc32__ieee_table[7][v_p.ptr[8]] ^ - wuffs_crc32__ieee_table[8][v_p.ptr[7]] ^ - wuffs_crc32__ieee_table[9][v_p.ptr[6]] ^ - wuffs_crc32__ieee_table[10][v_p.ptr[5]] ^ - wuffs_crc32__ieee_table[11][v_p.ptr[4]] ^ - wuffs_crc32__ieee_table[12][(255 & (v_s >> 24))] ^ - wuffs_crc32__ieee_table[13][(255 & (v_s >> 16))] ^ - wuffs_crc32__ieee_table[14][(255 & (v_s >> 8))] ^ - wuffs_crc32__ieee_table[15][(255 & (v_s >> 0))]); + v_s = (WUFFS_CRC32__IEEE_TABLE[0][v_p.ptr[15]] ^ + WUFFS_CRC32__IEEE_TABLE[1][v_p.ptr[14]] ^ + WUFFS_CRC32__IEEE_TABLE[2][v_p.ptr[13]] ^ + WUFFS_CRC32__IEEE_TABLE[3][v_p.ptr[12]] ^ + WUFFS_CRC32__IEEE_TABLE[4][v_p.ptr[11]] ^ + WUFFS_CRC32__IEEE_TABLE[5][v_p.ptr[10]] ^ + WUFFS_CRC32__IEEE_TABLE[6][v_p.ptr[9]] ^ + WUFFS_CRC32__IEEE_TABLE[7][v_p.ptr[8]] ^ + WUFFS_CRC32__IEEE_TABLE[8][v_p.ptr[7]] ^ + WUFFS_CRC32__IEEE_TABLE[9][v_p.ptr[6]] ^ + WUFFS_CRC32__IEEE_TABLE[10][v_p.ptr[5]] ^ + WUFFS_CRC32__IEEE_TABLE[11][v_p.ptr[4]] ^ + WUFFS_CRC32__IEEE_TABLE[12][(255 & (v_s >> 24))] ^ + WUFFS_CRC32__IEEE_TABLE[13][(255 & (v_s >> 16))] ^ + WUFFS_CRC32__IEEE_TABLE[14][(255 & (v_s >> 8))] ^ + WUFFS_CRC32__IEEE_TABLE[15][(255 & (v_s >> 0))]); v_p.ptr += 16; } v_p.len = 16; @@ -13731,29 +13731,29 @@ v_s ^= ((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) | (((uint32_t)(v_p.ptr[2])) << 16) | (((uint32_t)(v_p.ptr[3])) << 24)); - v_s = (wuffs_crc32__ieee_table[0][v_p.ptr[15]] ^ - wuffs_crc32__ieee_table[1][v_p.ptr[14]] ^ - wuffs_crc32__ieee_table[2][v_p.ptr[13]] ^ - wuffs_crc32__ieee_table[3][v_p.ptr[12]] ^ - wuffs_crc32__ieee_table[4][v_p.ptr[11]] ^ - wuffs_crc32__ieee_table[5][v_p.ptr[10]] ^ - wuffs_crc32__ieee_table[6][v_p.ptr[9]] ^ - wuffs_crc32__ieee_table[7][v_p.ptr[8]] ^ - wuffs_crc32__ieee_table[8][v_p.ptr[7]] ^ - wuffs_crc32__ieee_table[9][v_p.ptr[6]] ^ - wuffs_crc32__ieee_table[10][v_p.ptr[5]] ^ - wuffs_crc32__ieee_table[11][v_p.ptr[4]] ^ - wuffs_crc32__ieee_table[12][(255 & (v_s >> 24))] ^ - wuffs_crc32__ieee_table[13][(255 & (v_s >> 16))] ^ - wuffs_crc32__ieee_table[14][(255 & (v_s >> 8))] ^ - wuffs_crc32__ieee_table[15][(255 & (v_s >> 0))]); + v_s = (WUFFS_CRC32__IEEE_TABLE[0][v_p.ptr[15]] ^ + WUFFS_CRC32__IEEE_TABLE[1][v_p.ptr[14]] ^ + WUFFS_CRC32__IEEE_TABLE[2][v_p.ptr[13]] ^ + WUFFS_CRC32__IEEE_TABLE[3][v_p.ptr[12]] ^ + WUFFS_CRC32__IEEE_TABLE[4][v_p.ptr[11]] ^ + WUFFS_CRC32__IEEE_TABLE[5][v_p.ptr[10]] ^ + WUFFS_CRC32__IEEE_TABLE[6][v_p.ptr[9]] ^ + WUFFS_CRC32__IEEE_TABLE[7][v_p.ptr[8]] ^ + WUFFS_CRC32__IEEE_TABLE[8][v_p.ptr[7]] ^ + WUFFS_CRC32__IEEE_TABLE[9][v_p.ptr[6]] ^ + WUFFS_CRC32__IEEE_TABLE[10][v_p.ptr[5]] ^ + WUFFS_CRC32__IEEE_TABLE[11][v_p.ptr[4]] ^ + WUFFS_CRC32__IEEE_TABLE[12][(255 & (v_s >> 24))] ^ + WUFFS_CRC32__IEEE_TABLE[13][(255 & (v_s >> 16))] ^ + WUFFS_CRC32__IEEE_TABLE[14][(255 & (v_s >> 8))] ^ + WUFFS_CRC32__IEEE_TABLE[15][(255 & (v_s >> 0))]); v_p.ptr += 16; } v_p.len = 1; uint8_t* i_end2_p = i_slice_p.ptr + (i_slice_p.len / 1) * 1; while (v_p.ptr < i_end2_p) { v_s = - (wuffs_crc32__ieee_table[0][(((uint8_t)((v_s & 255))) ^ v_p.ptr[0])] ^ + (WUFFS_CRC32__IEEE_TABLE[0][(((uint8_t)((v_s & 255))) ^ v_p.ptr[0])] ^ (v_s >> 8)); v_p.ptr += 1; } @@ -13806,13 +13806,13 @@ // ---------------- Private Consts static const uint8_t // - wuffs_deflate__code_order[19] // + WUFFS_DEFLATE__CODE_ORDER[19] // WUFFS_BASE__POTENTIALLY_UNUSED = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, }; static const uint8_t // - wuffs_deflate__reverse8[256] // + WUFFS_DEFLATE__REVERSE8[256] // WUFFS_BASE__POTENTIALLY_UNUSED = { 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, @@ -13836,7 +13836,7 @@ }; static const uint32_t // - wuffs_deflate__lcode_magic_numbers[32] // + WUFFS_DEFLATE__LCODE_MAGIC_NUMBERS[32] // WUFFS_BASE__POTENTIALLY_UNUSED = { 1073741824, 1073742080, 1073742336, 1073742592, 1073742848, 1073743104, 1073743360, 1073743616, 1073743888, 1073744400, 1073744912, 1073745424, @@ -13847,7 +13847,7 @@ }; static const uint32_t // - wuffs_deflate__dcode_magic_numbers[32] // + WUFFS_DEFLATE__DCODE_MAGIC_NUMBERS[32] // WUFFS_BASE__POTENTIALLY_UNUSED = { 1073741824, 1073742080, 1073742336, 1073742592, 1073742864, 1073743376, 1073743904, 1073744928, 1073745968, 1073748016, 1073750080, 1073754176, @@ -14602,14 +14602,14 @@ v_bits |= (v_b1 << v_n_bits); v_n_bits += 8; } - self->private_data.f_code_lengths[wuffs_deflate__code_order[v_i]] = + self->private_data.f_code_lengths[WUFFS_DEFLATE__CODE_ORDER[v_i]] = ((uint8_t)((v_bits & 7))); v_bits >>= 3; v_n_bits -= 3; v_i += 1; } while (v_i < 19) { - self->private_data.f_code_lengths[wuffs_deflate__code_order[v_i]] = 0; + self->private_data.f_code_lengths[WUFFS_DEFLATE__CODE_ORDER[v_i]] = 0; v_i += 1; } v_status = wuffs_deflate__decoder__init_huff(self, 0, 0, 19, 4095); @@ -14835,9 +14835,9 @@ ((((uint32_t)(v_counts[0])) + a_n_codes0 + 1) == a_n_codes1)) { self->private_impl.f_n_huffs_bits[1] = 1; self->private_data.f_huffs[1][0] = - (wuffs_deflate__dcode_magic_numbers[0] | 1); + (WUFFS_DEFLATE__DCODE_MAGIC_NUMBERS[0] | 1); self->private_data.f_huffs[1][1] = - (wuffs_deflate__dcode_magic_numbers[31] | 1); + (WUFFS_DEFLATE__DCODE_MAGIC_NUMBERS[31] | 1); return wuffs_base__make_status(NULL); } return wuffs_base__make_status( @@ -14984,7 +14984,7 @@ } v_next_top = (v_top + (((uint32_t)(1)) << v_j)); v_redirect_key = - (((uint32_t)(wuffs_deflate__reverse8[(v_redirect_key >> 1)])) | + (((uint32_t)(WUFFS_DEFLATE__REVERSE8[(v_redirect_key >> 1)])) | ((v_redirect_key & 1) << 8)); self->private_data.f_huffs[a_which][v_redirect_key] = (268435465 | (v_top << 8) | (v_j << 4)); @@ -15002,7 +15002,7 @@ #if defined(__GNUC__) #pragma GCC diagnostic pop #endif - v_reversed_key = (((uint32_t)(wuffs_deflate__reverse8[(v_key >> 1)])) | + v_reversed_key = (((uint32_t)(WUFFS_DEFLATE__REVERSE8[(v_key >> 1)])) | ((v_key & 1) << 8)); v_reversed_key >>= (9 - v_cl); v_symbol = ((uint32_t)(v_symbols[v_i])); @@ -15013,9 +15013,9 @@ } else if (v_symbol >= a_base_symbol) { v_symbol -= a_base_symbol; if (a_which == 0) { - v_value = (wuffs_deflate__lcode_magic_numbers[(v_symbol & 31)] | v_cl); + v_value = (WUFFS_DEFLATE__LCODE_MAGIC_NUMBERS[(v_symbol & 31)] | v_cl); } else { - v_value = (wuffs_deflate__dcode_magic_numbers[(v_symbol & 31)] | v_cl); + v_value = (WUFFS_DEFLATE__DCODE_MAGIC_NUMBERS[(v_symbol & 31)] | v_cl); } } else { return wuffs_base__make_status( @@ -16339,43 +16339,43 @@ // ---------------- Private Consts static const uint32_t // - wuffs_gif__interlace_start[5] // + WUFFS_GIF__INTERLACE_START[5] // WUFFS_BASE__POTENTIALLY_UNUSED = { 4294967295, 1, 2, 4, 0, }; static const uint8_t // - wuffs_gif__interlace_delta[5] // + WUFFS_GIF__INTERLACE_DELTA[5] // WUFFS_BASE__POTENTIALLY_UNUSED = { 1, 2, 4, 8, 8, }; static const uint8_t // - wuffs_gif__interlace_count[5] // + WUFFS_GIF__INTERLACE_COUNT[5] // WUFFS_BASE__POTENTIALLY_UNUSED = { 0, 1, 2, 4, 8, }; static const uint8_t // - wuffs_gif__animexts1dot0[11] // + WUFFS_GIF__ANIMEXTS1DOT0[11] // WUFFS_BASE__POTENTIALLY_UNUSED = { 65, 78, 73, 77, 69, 88, 84, 83, 49, 46, 48, }; static const uint8_t // - wuffs_gif__netscape2dot0[11] // + WUFFS_GIF__NETSCAPE2DOT0[11] // WUFFS_BASE__POTENTIALLY_UNUSED = { 78, 69, 84, 83, 67, 65, 80, 69, 50, 46, 48, }; static const uint8_t // - wuffs_gif__iccrgbg1012[11] // + WUFFS_GIF__ICCRGBG1012[11] // WUFFS_BASE__POTENTIALLY_UNUSED = { 73, 67, 67, 82, 71, 66, 71, 49, 48, 49, 50, }; static const uint8_t // - wuffs_gif__xmpdataxmp[11] // + WUFFS_GIF__XMPDATAXMP[11] // WUFFS_BASE__POTENTIALLY_UNUSED = { 88, 77, 80, 32, 68, 97, 116, 97, 88, 77, 80, }; @@ -18079,12 +18079,12 @@ v_c = t_1; } v_is_animexts = - (v_is_animexts && (v_c == wuffs_gif__animexts1dot0[v_block_size])); + (v_is_animexts && (v_c == WUFFS_GIF__ANIMEXTS1DOT0[v_block_size])); v_is_netscape = - (v_is_netscape && (v_c == wuffs_gif__netscape2dot0[v_block_size])); + (v_is_netscape && (v_c == WUFFS_GIF__NETSCAPE2DOT0[v_block_size])); v_is_iccp = - (v_is_iccp && (v_c == wuffs_gif__iccrgbg1012[v_block_size])); - v_is_xmp = (v_is_xmp && (v_c == wuffs_gif__xmpdataxmp[v_block_size])); + (v_is_iccp && (v_c == WUFFS_GIF__ICCRGBG1012[v_block_size])); + v_is_xmp = (v_is_xmp && (v_c == WUFFS_GIF__XMPDATAXMP[v_block_size])); #if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -19975,12 +19975,12 @@ v_c = t_1; } v_is_animexts = - (v_is_animexts && (v_c == wuffs_gif__animexts1dot0[v_block_size])); + (v_is_animexts && (v_c == WUFFS_GIF__ANIMEXTS1DOT0[v_block_size])); v_is_netscape = - (v_is_netscape && (v_c == wuffs_gif__netscape2dot0[v_block_size])); + (v_is_netscape && (v_c == WUFFS_GIF__NETSCAPE2DOT0[v_block_size])); v_is_iccp = - (v_is_iccp && (v_c == wuffs_gif__iccrgbg1012[v_block_size])); - v_is_xmp = (v_is_xmp && (v_c == wuffs_gif__xmpdataxmp[v_block_size])); + (v_is_iccp && (v_c == WUFFS_GIF__ICCRGBG1012[v_block_size])); + v_is_xmp = (v_is_xmp && (v_c == WUFFS_GIF__XMPDATAXMP[v_block_size])); #if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -20985,7 +20985,7 @@ v_replicate_y1 = wuffs_base__u32__sat_add( self->private_impl.f_dst_y, ((uint32_t)( - wuffs_gif__interlace_count[self->private_impl.f_interlace]))); + WUFFS_GIF__INTERLACE_COUNT[self->private_impl.f_interlace]))); v_replicate_y1 = wuffs_base__u32__min( v_replicate_y1, self->private_impl.f_frame_rect_y1); while (v_replicate_y0 < v_replicate_y1) { @@ -21000,7 +21000,7 @@ wuffs_base__u32__sat_add_indirect( &self->private_impl.f_dst_y, ((uint32_t)( - wuffs_gif__interlace_delta[self->private_impl.f_interlace]))); + WUFFS_GIF__INTERLACE_DELTA[self->private_impl.f_interlace]))); while ( (self->private_impl.f_interlace > 0) && (self->private_impl.f_dst_y >= self->private_impl.f_frame_rect_y1)) { @@ -21014,7 +21014,7 @@ #endif self->private_impl.f_dst_y = wuffs_base__u32__sat_add( self->private_impl.f_frame_rect_y0, - wuffs_gif__interlace_start[self->private_impl.f_interlace]); + WUFFS_GIF__INTERLACE_START[self->private_impl.f_interlace]); } goto label__0__continue; } @@ -21035,7 +21035,7 @@ wuffs_base__u32__sat_add_indirect( &self->private_impl.f_dst_y, ((uint32_t)( - wuffs_gif__interlace_delta[self->private_impl.f_interlace]))); + WUFFS_GIF__INTERLACE_DELTA[self->private_impl.f_interlace]))); while ( (self->private_impl.f_interlace > 0) && (self->private_impl.f_dst_y >= self->private_impl.f_frame_rect_y1)) { @@ -21049,7 +21049,7 @@ #endif self->private_impl.f_dst_y = wuffs_base__u32__sat_add( self->private_impl.f_frame_rect_y0, - wuffs_gif__interlace_start[self->private_impl.f_interlace]); + WUFFS_GIF__INTERLACE_START[self->private_impl.f_interlace]); } goto label__0__continue; } @@ -21623,7 +21623,7 @@ #define WUFFS_JSON__DECODER_NUMBER_LENGTH_MAX_INCL 99 static const uint8_t // - wuffs_json__lut_backslashes[256] // + WUFFS_JSON__LUT_BACKSLASHES[256] // WUFFS_BASE__POTENTIALLY_UNUSED = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 162, 0, 0, 0, @@ -21642,13 +21642,13 @@ }; static const uint8_t // - wuffs_json__lut_quirky_backslashes[8] // + WUFFS_JSON__LUT_QUIRKY_BACKSLASHES[8] // WUFFS_BASE__POTENTIALLY_UNUSED = { 0, 7, 27, 10, 63, 39, 11, 0, }; static const uint8_t // - wuffs_json__lut_chars[256] // + WUFFS_JSON__LUT_CHARS[256] // WUFFS_BASE__POTENTIALLY_UNUSED = { 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, @@ -21672,7 +21672,7 @@ }; static const uint8_t // - wuffs_json__lut_classes[256] // + WUFFS_JSON__LUT_CLASSES[256] // WUFFS_BASE__POTENTIALLY_UNUSED = { 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 1, 15, @@ -21692,7 +21692,7 @@ }; static const uint8_t // - wuffs_json__lut_decimal_digits[256] // + WUFFS_JSON__LUT_DECIMAL_DIGITS[256] // WUFFS_BASE__POTENTIALLY_UNUSED = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -21713,7 +21713,7 @@ }; static const uint8_t // - wuffs_json__lut_hexadecimal_digits[256] // + WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[256] // WUFFS_BASE__POTENTIALLY_UNUSED = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -22074,7 +22074,7 @@ goto label__outer__continue; } v_c = wuffs_base__load_u8be__no_bounds_check(iop_a_src); - v_class = wuffs_json__lut_classes[v_c]; + v_class = WUFFS_JSON__LUT_CLASSES[v_c]; if (v_class != 0) { goto label__ws__break; } @@ -22143,10 +22143,10 @@ } while (((uint64_t)(io2_a_src - iop_a_src)) > 4) { v_c4 = wuffs_base__load_u32le__no_bounds_check(iop_a_src); - if (0 != (wuffs_json__lut_chars[(255 & (v_c4 >> 0))] | - wuffs_json__lut_chars[(255 & (v_c4 >> 8))] | - wuffs_json__lut_chars[(255 & (v_c4 >> 16))] | - wuffs_json__lut_chars[(255 & (v_c4 >> 24))])) { + if (0 != (WUFFS_JSON__LUT_CHARS[(255 & (v_c4 >> 0))] | + WUFFS_JSON__LUT_CHARS[(255 & (v_c4 >> 8))] | + WUFFS_JSON__LUT_CHARS[(255 & (v_c4 >> 16))] | + WUFFS_JSON__LUT_CHARS[(255 & (v_c4 >> 24))])) { goto label__0__break; } (iop_a_src += 4, wuffs_base__make_empty_struct()); @@ -22164,7 +22164,7 @@ } label__0__break:; v_c = wuffs_base__load_u8be__no_bounds_check(iop_a_src); - v_char = wuffs_json__lut_chars[v_c]; + v_char = WUFFS_JSON__LUT_CHARS[v_c]; if (v_char == 0) { (iop_a_src += 1, wuffs_base__make_empty_struct()); if (v_string_length >= 65531) { @@ -22218,7 +22218,7 @@ } v_c = ((uint8_t)( (wuffs_base__load_u16le__no_bounds_check(iop_a_src) >> 8))); - v_backslash = wuffs_json__lut_backslashes[v_c]; + v_backslash = WUFFS_JSON__LUT_BACKSLASHES[v_c]; if ((v_backslash & 128) != 0) { (iop_a_src += 2, wuffs_base__make_empty_struct()); *iop_a_dst++ = wuffs_base__make_token( @@ -22235,7 +22235,7 @@ *iop_a_dst++ = wuffs_base__make_token( (((uint64_t)( (6291456 | - ((uint32_t)(wuffs_json__lut_quirky_backslashes[( + ((uint32_t)(WUFFS_JSON__LUT_QUIRKY_BACKSLASHES[( v_backslash & 7)]))))) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) | (((uint64_t)(1)) @@ -22263,19 +22263,19 @@ 16); v_uni4_value = 0; v_uni4_ok = 128; - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni4_string >> 0))]; v_uni4_ok &= v_c; v_uni4_value |= (((uint32_t)((v_c & 15))) << 12); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni4_string >> 8))]; v_uni4_ok &= v_c; v_uni4_value |= (((uint32_t)((v_c & 15))) << 8); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni4_string >> 16))]; v_uni4_ok &= v_c; v_uni4_value |= (((uint32_t)((v_c & 15))) << 4); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni4_string >> 24))]; v_uni4_ok &= v_c; v_uni4_value |= (((uint32_t)((v_c & 15))) << 0); @@ -22331,19 +22331,19 @@ v_uni4_value = 0; v_uni4_ok = 128; v_uni4_string >>= 16; - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni4_string >> 0))]; v_uni4_ok &= v_c; v_uni4_value |= (((uint32_t)((v_c & 15))) << 12); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni4_string >> 8))]; v_uni4_ok &= v_c; v_uni4_value |= (((uint32_t)((v_c & 15))) << 8); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni4_string >> 16))]; v_uni4_ok &= v_c; v_uni4_value |= (((uint32_t)((v_c & 15))) << 4); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni4_string >> 24))]; v_uni4_ok &= v_c; v_uni4_value |= (((uint32_t)((v_c & 15))) << 0); @@ -22399,35 +22399,35 @@ wuffs_base__load_u64le__no_bounds_check(iop_a_src + 2); v_uni8_value = 0; v_uni8_ok = 128; - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni8_string >> 0))]; v_uni8_ok &= v_c; v_uni8_value |= (((uint32_t)((v_c & 15))) << 28); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni8_string >> 8))]; v_uni8_ok &= v_c; v_uni8_value |= (((uint32_t)((v_c & 15))) << 24); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni8_string >> 16))]; v_uni8_ok &= v_c; v_uni8_value |= (((uint32_t)((v_c & 15))) << 20); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni8_string >> 24))]; v_uni8_ok &= v_c; v_uni8_value |= (((uint32_t)((v_c & 15))) << 16); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni8_string >> 32))]; v_uni8_ok &= v_c; v_uni8_value |= (((uint32_t)((v_c & 15))) << 12); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni8_string >> 40))]; v_uni8_ok &= v_c; v_uni8_value |= (((uint32_t)((v_c & 15))) << 8); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni8_string >> 48))]; v_uni8_ok &= v_c; v_uni8_value |= (((uint32_t)((v_c & 15))) << 4); - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_uni8_string >> 56))]; v_uni8_ok &= v_c; v_uni8_value |= (((uint32_t)((v_c & 15))) << 0); @@ -22476,10 +22476,10 @@ v_backslash_x_string = wuffs_base__load_u32le__no_bounds_check(iop_a_src); v_backslash_x_ok = 128; - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_backslash_x_string >> 16))]; v_backslash_x_ok &= v_c; - v_c = wuffs_json__lut_hexadecimal_digits[( + v_c = WUFFS_JSON__LUT_HEXADECIMAL_DIGITS[( 255 & (v_backslash_x_string >> 24))]; v_backslash_x_ok &= v_c; if ((v_backslash_x_ok == 0) || @@ -23309,7 +23309,7 @@ goto label__0__break; } v_c = wuffs_base__load_u8be__no_bounds_check(iop_a_src); - if (0 == wuffs_json__lut_decimal_digits[v_c]) { + if (0 == WUFFS_JSON__LUT_DECIMAL_DIGITS[v_c]) { goto label__0__break; } if (v_n >= 99) { @@ -23864,7 +23864,7 @@ goto label__outer__continue; } v_c = wuffs_base__load_u8be__no_bounds_check(iop_a_src); - if (wuffs_json__lut_classes[v_c] != 0) { + if (WUFFS_JSON__LUT_CLASSES[v_c] != 0) { if (v_whitespace_length > 0) { *iop_a_dst++ = wuffs_base__make_token( (((uint64_t)(0)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
diff --git a/std/bmp/decode_bmp.wuffs b/std/bmp/decode_bmp.wuffs index e5663e4..6026655 100644 --- a/std/bmp/decode_bmp.wuffs +++ b/std/bmp/decode_bmp.wuffs
@@ -17,7 +17,7 @@ pri status "#internal error: inconsistent swizzle count" -pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 0 +pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE base.u64 = 0 pub struct decoder? implements base.image_decoder( width : base.u32[..= 0x7FFF_FFFF],
diff --git a/std/crc32/common_crc32.wuffs b/std/crc32/common_crc32.wuffs index 4d78085..ee2b5ca 100644 --- a/std/crc32/common_crc32.wuffs +++ b/std/crc32/common_crc32.wuffs
@@ -36,24 +36,24 @@ ((p[0x01] as base.u32) << 8) | ((p[0x02] as base.u32) << 16) | ((p[0x03] as base.u32) << 24) - s = ieee_table[0x00][p[0x0F]] ^ - ieee_table[0x01][p[0x0E]] ^ - ieee_table[0x02][p[0x0D]] ^ - ieee_table[0x03][p[0x0C]] ^ - ieee_table[0x04][p[0x0B]] ^ - ieee_table[0x05][p[0x0A]] ^ - ieee_table[0x06][p[0x09]] ^ - ieee_table[0x07][p[0x08]] ^ - ieee_table[0x08][p[0x07]] ^ - ieee_table[0x09][p[0x06]] ^ - ieee_table[0x0A][p[0x05]] ^ - ieee_table[0x0B][p[0x04]] ^ - ieee_table[0x0C][0xFF & (s >> 24)] ^ - ieee_table[0x0D][0xFF & (s >> 16)] ^ - ieee_table[0x0E][0xFF & (s >> 8)] ^ - ieee_table[0x0F][0xFF & (s >> 0)] + s = IEEE_TABLE[0x00][p[0x0F]] ^ + IEEE_TABLE[0x01][p[0x0E]] ^ + IEEE_TABLE[0x02][p[0x0D]] ^ + IEEE_TABLE[0x03][p[0x0C]] ^ + IEEE_TABLE[0x04][p[0x0B]] ^ + IEEE_TABLE[0x05][p[0x0A]] ^ + IEEE_TABLE[0x06][p[0x09]] ^ + IEEE_TABLE[0x07][p[0x08]] ^ + IEEE_TABLE[0x08][p[0x07]] ^ + IEEE_TABLE[0x09][p[0x06]] ^ + IEEE_TABLE[0x0A][p[0x05]] ^ + IEEE_TABLE[0x0B][p[0x04]] ^ + IEEE_TABLE[0x0C][0xFF & (s >> 24)] ^ + IEEE_TABLE[0x0D][0xFF & (s >> 16)] ^ + IEEE_TABLE[0x0E][0xFF & (s >> 8)] ^ + IEEE_TABLE[0x0F][0xFF & (s >> 0)] } else (length: 1, unroll: 1) { - s = ieee_table[0][((s & 0xFF) as base.u8) ^ p[0]] ^ (s >> 8) + s = IEEE_TABLE[0][((s & 0xFF) as base.u8) ^ p[0]] ^ (s >> 8) } this.state = 0xFFFF_FFFF ^ s @@ -62,7 +62,7 @@ // The table below was created by script/print-crc32-magic-numbers.go. -pri const ieee_table array[16] array[256] base.u32 = [[ +pri const IEEE_TABLE array[16] array[256] base.u32 = [[ 0x0000_0000, 0x7707_3096, 0xEE0E_612C, 0x9909_51BA, 0x076D_C419, 0x706A_F48F, 0xE963_A535, 0x9E64_95A3, 0x0EDB_8832, 0x79DC_B8A4, 0xE0D5_E91E, 0x97D2_D988, 0x09B6_4C2B, 0x7EB1_7CBD, 0xE7B8_2D07, 0x90BF_1D91, 0x1DB7_1064, 0x6AB0_20F2, 0xF3B9_7148, 0x84BE_41DE, 0x1ADA_D47D, 0x6DDD_E4EB, 0xF4D4_B551, 0x83D3_85C7,
diff --git a/std/deflate/common_consts.wuffs b/std/deflate/common_consts.wuffs index 86a3a81..5213414 100644 --- a/std/deflate/common_consts.wuffs +++ b/std/deflate/common_consts.wuffs
@@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// code_order is defined in the RFC section 3.2.7. -pri const code_order array[19] base.u8[..= 18] = [ +// CODE_ORDER is defined in the RFC section 3.2.7. +pri const CODE_ORDER array[19] base.u8[..= 18] = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, ] -// reverse8 reverses the bits in a byte. -pri const reverse8 array[256] base.u8 = [ +// REVERSE8 reverses the bits in a byte. +pri const REVERSE8 array[256] base.u8 = [ 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, // 0x00 - 0x07 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, // 0x08 - 0x0F 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, // 0x10 - 0x17
diff --git a/std/deflate/decode_deflate.wuffs b/std/deflate/decode_deflate.wuffs index 57f4318..e260b98 100644 --- a/std/deflate/decode_deflate.wuffs +++ b/std/deflate/decode_deflate.wuffs
@@ -33,7 +33,7 @@ // TODO: replace the placeholder 1 value with either 0 or (32768 + 512), // depending on whether we'll move decoder.history into the workbuf. -pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 1 +pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE base.u64 = 1 // The next two tables were created by script/print-deflate-magic-numbers.go. // @@ -43,27 +43,27 @@ // // Some trailing elements are 0x08000000. Bit 27 indicates an invalid value. -pri const lcode_magic_numbers array[32] base.u32 = [ +pri const LCODE_MAGIC_NUMBERS array[32] base.u32 = [ 0x4000_0000, 0x4000_0100, 0x4000_0200, 0x4000_0300, 0x4000_0400, 0x4000_0500, 0x4000_0600, 0x4000_0700, 0x4000_0810, 0x4000_0A10, 0x4000_0C10, 0x4000_0E10, 0x4000_1020, 0x4000_1420, 0x4000_1820, 0x4000_1C20, 0x4000_2030, 0x4000_2830, 0x4000_3030, 0x4000_3830, 0x4000_4040, 0x4000_5040, 0x4000_6040, 0x4000_7040, 0x4000_8050, 0x4000_A050, 0x4000_C050, 0x4000_E050, 0x4000_FF00, 0x0800_0000, 0x0800_0000, 0x0800_0000, ] -pri const dcode_magic_numbers array[32] base.u32 = [ +pri const DCODE_MAGIC_NUMBERS array[32] base.u32 = [ 0x4000_0000, 0x4000_0100, 0x4000_0200, 0x4000_0300, 0x4000_0410, 0x4000_0610, 0x4000_0820, 0x4000_0C20, 0x4000_1030, 0x4000_1830, 0x4000_2040, 0x4000_3040, 0x4000_4050, 0x4000_6050, 0x4000_8060, 0x4000_C060, 0x4001_0070, 0x4001_8070, 0x4002_0080, 0x4003_0080, 0x4004_0090, 0x4006_0090, 0x4008_00A0, 0x400C_00A0, 0x4010_00B0, 0x4018_00B0, 0x4020_00C0, 0x4030_00C0, 0x4040_00D0, 0x4060_00D0, 0x0800_0000, 0x0800_0000, ] -// huffs_table_size is the smallest power of 2 that is greater than or equal to +// HUFFS_TABLE_SIZE is the smallest power of 2 that is greater than or equal to // the worst-case size of the Huffman tables. See // script/print-deflate-huff-table-size.go which calculates that, for a 9-bit // primary table, the worst-case size is 852 for the Lit/Len table and 592 for // the Distance table. -pri const huffs_table_size base.u32 = 1024 -pri const huffs_table_mask base.u32 = 1023 +pri const HUFFS_TABLE_SIZE base.u32 = 1024 +pri const HUFFS_TABLE_MASK base.u32 = 1023 pub struct decoder? implements base.io_transformer( // These fields yield src's bits in Least Significant Bits order. @@ -115,7 +115,7 @@ // - bits 0 ..= 3 are the number of decoder.bits to consume. // // Exactly one of the eight bits [24 ..= 31] should be set. - huffs : array[2] array[huffs_table_size] base.u32, + huffs : array[2] array[HUFFS_TABLE_SIZE] base.u32, // history[.. 0x8000] holds up to the last 32KiB of decoded output, if the // decoding was incomplete (e.g. due to a short read or write). RFC 1951 @@ -195,8 +195,8 @@ pub func decoder.workbuf_len() base.range_ii_u64 { return this.util.make_range_ii_u64( - min_incl: decoder_workbuf_len_max_incl_worst_case, - max_incl: decoder_workbuf_len_max_incl_worst_case) + min_incl: DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE, + max_incl: DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE) } pub func decoder.transform_io?(dst: base.io_writer, src: base.io_reader, workbuf: slice base.u8) { @@ -399,13 +399,13 @@ n_bits += 8 } endwhile assert i < 19 via "a < b: a < c; c <= b"(c: n_clen) - this.code_lengths[code_order[i]] = (bits & 0x07) as base.u8 + this.code_lengths[CODE_ORDER[i]] = (bits & 0x07) as base.u8 bits >>= 3 n_bits -= 3 i += 1 } endwhile while i < 19 { - this.code_lengths[code_order[i]] = 0 + this.code_lengths[CODE_ORDER[i]] = 0 i += 1 } endwhile status = this.init_huff!(which: 0, n_codes0: 0, n_codes1: 19, base_symbol: 0xFFF) @@ -535,8 +535,8 @@ var initial_high_bits : base.u32 var prev_cl : base.u32[..= 15] var prev_redirect_key : base.u32 - var top : base.u32[..= huffs_table_size] - var next_top : base.u32[..= huffs_table_size] + var top : base.u32[..= HUFFS_TABLE_SIZE] + var next_top : base.u32[..= HUFFS_TABLE_SIZE] var code : base.u32 var key : base.u32 var value : base.u32 @@ -619,8 +619,8 @@ (((counts[0] as base.u32) + args.n_codes0 + 1) == args.n_codes1) { this.n_huffs_bits[1] = 1 - this.huffs[1][0] = dcode_magic_numbers[0] | 1 - this.huffs[1][1] = dcode_magic_numbers[31] | 1 + this.huffs[1][0] = DCODE_MAGIC_NUMBERS[0] | 1 + this.huffs[1][1] = DCODE_MAGIC_NUMBERS[31] | 1 return ok } @@ -817,13 +817,13 @@ initial_high_bits = (1 as base.u32) << j top = next_top - if (top + ((1 as base.u32) << j)) > huffs_table_size { + if (top + ((1 as base.u32) << j)) > HUFFS_TABLE_SIZE { return "#internal error: inconsistent Huffman decoder state" } - assert (top + ((1 as base.u32) << j)) <= 1024 via "a <= b: a <= c; c <= b"(c: huffs_table_size) + assert (top + ((1 as base.u32) << j)) <= 1024 via "a <= b: a <= c; c <= b"(c: HUFFS_TABLE_SIZE) next_top = top + ((1 as base.u32) << j) - redirect_key = (reverse8[redirect_key >> 1] as base.u32) | ((redirect_key & 1) << 8) + redirect_key = (REVERSE8[redirect_key >> 1] as base.u32) | ((redirect_key & 1) << 8) this.huffs[args.which][redirect_key] = 0x1000_0009 | (top << 8) | (j << 4) } } @@ -832,7 +832,7 @@ } counts[prev_cl] -= 1 - reversed_key = (reverse8[key >> 1] as base.u32) | ((key & 1) << 8) + reversed_key = (REVERSE8[key >> 1] as base.u32) | ((key & 1) << 8) reversed_key >>= 9 - cl symbol = symbols[i] as base.u32 @@ -846,9 +846,9 @@ // Base number + extra bits. symbol -= args.base_symbol if args.which == 0 { - value = lcode_magic_numbers[symbol & 31] | cl + value = LCODE_MAGIC_NUMBERS[symbol & 31] | cl } else { - value = dcode_magic_numbers[symbol & 31] | cl + value = DCODE_MAGIC_NUMBERS[symbol & 31] | cl } } else { return "#internal error: inconsistent Huffman decoder state" @@ -865,10 +865,10 @@ inv n_symbols <= 288, { high_bits -= delta - if (top + ((high_bits | reversed_key) & 511)) >= huffs_table_size { + if (top + ((high_bits | reversed_key) & 511)) >= HUFFS_TABLE_SIZE { return "#internal error: inconsistent Huffman decoder state" } - assert (top + ((high_bits | reversed_key) & 511)) < 1024 via "a < b: a < c; c <= b"(c: huffs_table_size) + assert (top + ((high_bits | reversed_key) & 511)) < 1024 via "a < b: a < c; c <= b"(c: HUFFS_TABLE_SIZE) this.huffs[args.which][top + ((high_bits | reversed_key) & 511)] = value } endwhile
diff --git a/std/deflate/decode_huffman_fast.wuffs b/std/deflate/decode_huffman_fast.wuffs index 54666b8..61ce260 100644 --- a/std/deflate/decode_huffman_fast.wuffs +++ b/std/deflate/decode_huffman_fast.wuffs
@@ -129,7 +129,7 @@ redir_top = (table_entry >> 8) & 0xFFFF redir_mask = ((1 as base.u32) << ((table_entry >> 4) & 0x0F)) - 1 - table_entry = this.huffs[0][(redir_top + (bits & redir_mask)) & huffs_table_mask] + table_entry = this.huffs[0][(redir_top + (bits & redir_mask)) & HUFFS_TABLE_MASK] table_entry_n_bits = table_entry & 0x0F bits >>= table_entry_n_bits n_bits -= table_entry_n_bits @@ -239,7 +239,7 @@ redir_top = (table_entry >> 8) & 0xFFFF redir_mask = ((1 as base.u32) << ((table_entry >> 4) & 0x0F)) - 1 - table_entry = this.huffs[1][(redir_top + (bits & redir_mask)) & huffs_table_mask] + table_entry = this.huffs[1][(redir_top + (bits & redir_mask)) & HUFFS_TABLE_MASK] table_entry_n_bits = table_entry & 0x0F bits >>= table_entry_n_bits n_bits -= table_entry_n_bits
diff --git a/std/deflate/decode_huffman_slow.wuffs b/std/deflate/decode_huffman_slow.wuffs index 1166fd5..474148e 100644 --- a/std/deflate/decode_huffman_slow.wuffs +++ b/std/deflate/decode_huffman_slow.wuffs
@@ -79,7 +79,7 @@ redir_top = (table_entry >> 8) & 0xFFFF redir_mask = ((1 as base.u32) << ((table_entry >> 4) & 0x0F)) - 1 while true { - table_entry = this.huffs[0][(redir_top + (bits & redir_mask)) & huffs_table_mask] + table_entry = this.huffs[0][(redir_top + (bits & redir_mask)) & HUFFS_TABLE_MASK] table_entry_n_bits = table_entry & 0x0F if n_bits >= table_entry_n_bits { bits >>= table_entry_n_bits @@ -157,7 +157,7 @@ redir_top = (table_entry >> 8) & 0xFFFF redir_mask = ((1 as base.u32) << ((table_entry >> 4) & 0x0F)) - 1 while true { - table_entry = this.huffs[1][(redir_top + (bits & redir_mask)) & huffs_table_mask] + table_entry = this.huffs[1][(redir_top + (bits & redir_mask)) & HUFFS_TABLE_MASK] table_entry_n_bits = table_entry & 0x0F if n_bits >= table_entry_n_bits { bits >>= table_entry_n_bits
diff --git a/std/gif/common_consts.wuffs b/std/gif/common_consts.wuffs index fb78d04..725840f 100644 --- a/std/gif/common_consts.wuffs +++ b/std/gif/common_consts.wuffs
@@ -24,7 +24,7 @@ pri status "#internal error: inconsistent ri/wi" -pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 0 +pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE base.u64 = 0 // See the spec appendix E "Interlaced Images" on page 29. The first element // represents either that the frame was non-interlaced, or that all interlace @@ -34,31 +34,31 @@ // For interlaced frames, the decoder.interlace field starts at 4 and is // decremented towards 0. // -// interlace_start[0] is a special case. For non-interlaced frames, that +// INTERLACE_START[0] is a special case. For non-interlaced frames, that // element is never accessed. For interlaced frames, that element is only // accessed after all interlace stages are complete. Being the maximum base.u32 // value means that, after all interlace stages are complete, dst_y will be set // to that maximum value (and therefore outside the frame rect). -pri const interlace_start array[5] base.u32 = [0xFFFF_FFFF, 1, 2, 4, 0] -pri const interlace_delta array[5] base.u8 = [1, 2, 4, 8, 8] -pri const interlace_count array[5] base.u8 = [0, 1, 2, 4, 8] +pri const INTERLACE_START array[5] base.u32 = [0xFFFF_FFFF, 1, 2, 4, 0] +pri const INTERLACE_DELTA array[5] base.u8 = [1, 2, 4, 8, 8] +pri const INTERLACE_COUNT array[5] base.u8 = [0, 1, 2, 4, 8] -// animexts1dot0 is "ANIMEXTS1.0" as bytes. -pri const animexts1dot0 array[11] base.u8 = [ +// ANIMEXTS1DOT0 is "ANIMEXTS1.0" as bytes. +pri const ANIMEXTS1DOT0 array[11] base.u8 = [ 0x41, 0x4E, 0x49, 0x4D, 0x45, 0x58, 0x54, 0x53, 0x31, 0x2E, 0x30, ] -// netscape2dot0 is "NETSCAPE2.0" as bytes. -pri const netscape2dot0 array[11] base.u8 = [ +// NETSCAPE2DOT0 is "NETSCAPE2.0" as bytes. +pri const NETSCAPE2DOT0 array[11] base.u8 = [ 0x4E, 0x45, 0x54, 0x53, 0x43, 0x41, 0x50, 0x45, 0x32, 0x2E, 0x30, ] -// iccrgbg1012 is "ICCRGBG1012" as bytes. -pri const iccrgbg1012 array[11] base.u8 = [ +// ICCRGBG1012 Is "ICCRGBG1012" as bytes. +pri const ICCRGBG1012 array[11] base.u8 = [ 0x49, 0x43, 0x43, 0x52, 0x47, 0x42, 0x47, 0x31, 0x30, 0x31, 0x32, ] -// xmpdataxmp is "XMP DataXMP" as bytes. -pri const xmpdataxmp array[11] base.u8 = [ +// XMPDATAXMP IS "XMP DataXMP" as bytes. +pri const XMPDATAXMP array[11] base.u8 = [ 0x58, 0x4D, 0x50, 0x20, 0x44, 0x61, 0x74, 0x61, 0x58, 0x4D, 0x50, ]
diff --git a/std/gif/decode_config.wuffs b/std/gif/decode_config.wuffs index d84935a..cc56b79 100644 --- a/std/gif/decode_config.wuffs +++ b/std/gif/decode_config.wuffs
@@ -83,7 +83,7 @@ has_global_palette : base.bool, - // interlace indexes the interlace_start and interlace_delta arrays. + // interlace indexes the INTERLACE_START and INTERLACE_DELTA arrays. interlace : base.u8[..= 4], // Absent an ANIMEXTS1.0 or NETSCAPE2.0 extension, the implicit number of @@ -116,19 +116,19 @@ pub func config_decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) { if this.call_sequence == 0 { - if args.quirk == quirk_delay_num_decoded_frames { + if args.quirk == QUIRK_DELAY_NUM_DECODED_FRAMES { this.quirk_enabled_delay_num_decoded_frames = args.enabled - } else if args.quirk == quirk_first_frame_local_palette_means_black_background { + } else if args.quirk == QUIRK_FIRST_FRAME_LOCAL_PALETTE_MEANS_BLACK_BACKGROUND { this.quirk_enabled_first_frame_local_palette_means_black_background = args.enabled - } else if args.quirk == quirk_honor_background_color { + } else if args.quirk == QUIRK_HONOR_BACKGROUND_COLOR { this.quirk_enabled_honor_background_color = args.enabled - } else if args.quirk == quirk_ignore_too_much_pixel_data { + } else if args.quirk == QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA { this.quirk_enabled_ignore_too_much_pixel_data = args.enabled - } else if args.quirk == quirk_image_bounds_are_strict { + } else if args.quirk == QUIRK_IMAGE_BOUNDS_ARE_STRICT { this.quirk_enabled_image_bounds_are_strict = args.enabled - } else if args.quirk == quirk_reject_empty_frame { + } else if args.quirk == QUIRK_REJECT_EMPTY_FRAME { this.quirk_enabled_reject_empty_frame = args.enabled - } else if args.quirk == quirk_reject_empty_palette { + } else if args.quirk == QUIRK_REJECT_EMPTY_PALETTE { this.quirk_enabled_reject_empty_palette = args.enabled } } @@ -567,10 +567,10 @@ block_size = 0 // Re-purpose the block_size variable as a counter. while block_size < 11 { c = args.src.read_u8?() - is_animexts = is_animexts and (c == animexts1dot0[block_size]) - is_netscape = is_netscape and (c == netscape2dot0[block_size]) - is_iccp = is_iccp and (c == iccrgbg1012[block_size]) - is_xmp = is_xmp and (c == xmpdataxmp[block_size]) + is_animexts = is_animexts and (c == ANIMEXTS1DOT0[block_size]) + is_netscape = is_netscape and (c == NETSCAPE2DOT0[block_size]) + is_iccp = is_iccp and (c == ICCRGBG1012[block_size]) + is_xmp = is_xmp and (c == XMPDATAXMP[block_size]) block_size += 1 } endwhile
diff --git a/std/gif/decode_gif.wuffs b/std/gif/decode_gif.wuffs index 232ea29..d00a196 100644 --- a/std/gif/decode_gif.wuffs +++ b/std/gif/decode_gif.wuffs
@@ -98,7 +98,7 @@ has_global_palette : base.bool, - // interlace indexes the interlace_start and interlace_delta arrays. + // interlace indexes the INTERLACE_START and INTERLACE_DELTA arrays. interlace : base.u8[..= 4], // Absent an ANIMEXTS1.0 or NETSCAPE2.0 extension, the implicit number of @@ -155,19 +155,19 @@ pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) { if this.call_sequence == 0 { - if args.quirk == quirk_delay_num_decoded_frames { + if args.quirk == QUIRK_DELAY_NUM_DECODED_FRAMES { this.quirk_enabled_delay_num_decoded_frames = args.enabled - } else if args.quirk == quirk_first_frame_local_palette_means_black_background { + } else if args.quirk == QUIRK_FIRST_FRAME_LOCAL_PALETTE_MEANS_BLACK_BACKGROUND { this.quirk_enabled_first_frame_local_palette_means_black_background = args.enabled - } else if args.quirk == quirk_honor_background_color { + } else if args.quirk == QUIRK_HONOR_BACKGROUND_COLOR { this.quirk_enabled_honor_background_color = args.enabled - } else if args.quirk == quirk_ignore_too_much_pixel_data { + } else if args.quirk == QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA { this.quirk_enabled_ignore_too_much_pixel_data = args.enabled - } else if args.quirk == quirk_image_bounds_are_strict { + } else if args.quirk == QUIRK_IMAGE_BOUNDS_ARE_STRICT { this.quirk_enabled_image_bounds_are_strict = args.enabled - } else if args.quirk == quirk_reject_empty_frame { + } else if args.quirk == QUIRK_REJECT_EMPTY_FRAME { this.quirk_enabled_reject_empty_frame = args.enabled - } else if args.quirk == quirk_reject_empty_palette { + } else if args.quirk == QUIRK_REJECT_EMPTY_PALETTE { this.quirk_enabled_reject_empty_palette = args.enabled } } @@ -306,8 +306,8 @@ pub func decoder.workbuf_len() base.range_ii_u64 { //#WHEN PREPROC201 return this.util.make_range_ii_u64( - min_incl: decoder_workbuf_len_max_incl_worst_case, - max_incl: decoder_workbuf_len_max_incl_worst_case) + min_incl: DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE, + max_incl: DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE) //#WHEN PREPROC201 decode_config.wuffs //## return this.util.empty_range_ii_u64() //#DONE PREPROC201 @@ -642,10 +642,10 @@ block_size = 0 // Re-purpose the block_size variable as a counter. while block_size < 11 { c = args.src.read_u8?() - is_animexts = is_animexts and (c == animexts1dot0[block_size]) - is_netscape = is_netscape and (c == netscape2dot0[block_size]) - is_iccp = is_iccp and (c == iccrgbg1012[block_size]) - is_xmp = is_xmp and (c == xmpdataxmp[block_size]) + is_animexts = is_animexts and (c == ANIMEXTS1DOT0[block_size]) + is_netscape = is_netscape and (c == NETSCAPE2DOT0[block_size]) + is_iccp = is_iccp and (c == ICCRGBG1012[block_size]) + is_xmp = is_xmp and (c == XMPDATAXMP[block_size]) block_size += 1 } endwhile @@ -1090,7 +1090,7 @@ replicate_src = tab.row(y: this.dst_y) replicate_y0 = this.dst_y ~sat+ 1 - replicate_y1 = this.dst_y ~sat+ (interlace_count[this.interlace] as base.u32) + replicate_y1 = this.dst_y ~sat+ (INTERLACE_COUNT[this.interlace] as base.u32) replicate_y1 = replicate_y1.min(a: this.frame_rect_y1) while replicate_y0 < replicate_y1 { assert replicate_y0 < 0xFFFF_FFFF via "a < b: a < c; c <= b"(c: replicate_y1) @@ -1101,10 +1101,10 @@ this.dirty_max_excl_y = this.dirty_max_excl_y.max(a: replicate_y1) } - this.dst_y ~sat+= interlace_delta[this.interlace] as base.u32 + this.dst_y ~sat+= INTERLACE_DELTA[this.interlace] as base.u32 while (this.interlace > 0) and (this.dst_y >= this.frame_rect_y1) { this.interlace -= 1 - this.dst_y = this.frame_rect_y0 ~sat+ interlace_start[this.interlace] + this.dst_y = this.frame_rect_y0 ~sat+ INTERLACE_START[this.interlace] } endwhile continue } @@ -1127,10 +1127,10 @@ if this.frame_rect_x1 <= this.dst_x { this.dst_x = this.frame_rect_x0 - this.dst_y ~sat+= interlace_delta[this.interlace] as base.u32 + this.dst_y ~sat+= INTERLACE_DELTA[this.interlace] as base.u32 while (this.interlace > 0) and (this.dst_y >= this.frame_rect_y1) { this.interlace -= 1 - this.dst_y = this.frame_rect_y0 ~sat+ interlace_start[this.interlace] + this.dst_y = this.frame_rect_y0 ~sat+ INTERLACE_START[this.interlace] } endwhile continue }
diff --git a/std/gif/decode_quirks.wuffs b/std/gif/decode_quirks.wuffs index 1e87418..f31b40d 100644 --- a/std/gif/decode_quirks.wuffs +++ b/std/gif/decode_quirks.wuffs
@@ -35,7 +35,7 @@ // 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 = 0x3E16_1800 | 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. @@ -43,11 +43,11 @@ // whether or not that first frame is opaque: whether that local palette // contains a transparent color. // -// This has no effect unless quirk_honor_background_color is also enabled. +// This has no effect unless QUIRK_HONOR_BACKGROUND_COLOR is also enabled. // // 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 = 0x3E16_1800 | 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 @@ -63,12 +63,12 @@ // 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 = 0x3E16_1800 | 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 = 0x3E16_1800 | 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 @@ -77,12 +77,12 @@ // // For more discussion, see // https://github.com/google/wuffs/blob/master/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 = 0x3E16_1800 | 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 = 0x3E16_1800 | 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 = 0x3E16_1800 | 0x06
diff --git a/std/gzip/decode_gzip.wuffs b/std/gzip/decode_gzip.wuffs index 816cf13..0c850d3 100644 --- a/std/gzip/decode_gzip.wuffs +++ b/std/gzip/decode_gzip.wuffs
@@ -20,8 +20,8 @@ pub status "#bad encoding flags" pub status "#bad header" -// TODO: reference deflate.decoder_workbuf_len_max_incl_worst_case. -pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 1 +// TODO: reference deflate.DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE. +pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE base.u64 = 1 pub struct decoder? implements base.io_transformer( ignore_checksum : base.bool, @@ -41,8 +41,8 @@ pub func decoder.workbuf_len() base.range_ii_u64 { return this.util.make_range_ii_u64( - min_incl: decoder_workbuf_len_max_incl_worst_case, - max_incl: decoder_workbuf_len_max_incl_worst_case) + min_incl: DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE, + max_incl: DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE) } pub func decoder.transform_io?(dst: base.io_writer, src: base.io_reader, workbuf: slice base.u8) {
diff --git a/std/json/common_consts.wuffs b/std/json/common_consts.wuffs index 18a3139..c8f8528 100644 --- a/std/json/common_consts.wuffs +++ b/std/json/common_consts.wuffs
@@ -21,20 +21,20 @@ pri status "#internal error: inconsistent I/O" -pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 0 +pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE base.u64 = 0 -// decoder_depth_max_incl is the maximum supported recursion depth: how deeply +// DECODER_DEPTH_MAX_INCL is the maximum supported recursion depth: how deeply // nested [] arrays and {} objects can be. // // The JSON spec itself does not define a limit, but allows implementations to // set their own limits. -pub const decoder_depth_max_incl base.u64 = 1024 +pub const DECODER_DEPTH_MAX_INCL base.u64 = 1024 -// decoder_dst_token_buffer_length_min_incl is the minimum length of the dst +// DECODER_DST_TOKEN_BUFFER_LENGTH_MIN_INCL is the minimum length of the dst // wuffs_base__token_buffer passed to the decoder. -pub const decoder_dst_token_buffer_length_min_incl base.u64 = 1 +pub const DECODER_DST_TOKEN_BUFFER_LENGTH_MIN_INCL base.u64 = 1 -// decoder_src_io_buffer_length_min_incl is the minimum length of the src +// DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL is the minimum length of the src // wuffs_base__io_buffer passed to the decoder. // // This constrains the src.data.len field and it is the io_buffer capacity (the @@ -42,9 +42,9 @@ // the backing array's length, not the length of the JSON-formatted input per // se. It is perfectly valid to decode "[1,2]" (of length 5) as JSON, as long // as that content is placed in an io_buffer whose data.len is at least 100. -pub const decoder_src_io_buffer_length_min_incl base.u64 = 100 +pub const DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL base.u64 = 100 -// decoder_number_length_max_incl is the longest supported byte length for a +// DECODER_NUMBER_LENGTH_MAX_INCL is the longest supported byte length for a // JSON number. Unlike JSON strings, this package's tokenizer never splits a // single JSON number into multiple tokens, as this simplifies the callers. // They can then call e.g. wuffs_base__parse_number_i64 without having to @@ -52,17 +52,17 @@ // // The JSON spec itself does not define a limit, but allows implementations to // set their own limits. -pri const decoder_number_length_max_incl base.u64 = 99 +pri const DECODER_NUMBER_LENGTH_MAX_INCL base.u64 = 99 // -------- // Look-Up Tables (LUTs). -// lut_backslashes[i] helps decode "\i", for various 'i's. +// LUT_BACKSLASHES[i] helps decode "\i", for various 'i's. // // If the element's 0x80 bit is set then "\i" is unconditionally a valid // single-output-byte backslash-escape. The low 7 bits are the unescaped value. -// For example, lut_backslashes['n'] is (0x80 | 0x0A), because "\n" is U+000A. +// For example, LUT_BACKSLASHES['n'] is (0x80 | 0x0A), because "\n" is U+000A. // // If the element is non-zero (but the 0x80 bit is not set) then "\i"'s // validity depends on the relevant quirk. The element's value is an enum: @@ -73,11 +73,11 @@ // - 5: "\'", U+0027, quirk_allow_backslash_single_quote. // - 6: "\v", U+000B, quirk_allow_backslash_v. // - 7: "\0", U+0000, quirk_allow_backslash_zero. -// The U+1234 values are held in lut_quirky_backslashes, below. +// The U+1234 values are held in LUT_QUIRKY_BACKSLASHES, below. // // If the element is zero then "\i" is invalid, or it is a special case, the // start of "\x12", "\u1234" or "\U12345678". -pri const lut_backslashes array[256] base.u8 = [ +pri const LUT_BACKSLASHES array[256] base.u8 = [ // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07. @@ -119,14 +119,14 @@ // 8 9 A B C D E F ] -// lut_quirky_backslashes is discussed in the lut_backslashes comment. The +// LUT_QUIRKY_BACKSLASHES is discussed in the LUT_BACKSLASHES comment. The // first element (index 0) is not used, but 8 is a round power of 2, so // enforcing index-in-bounds is a simple "&7" operation. -pri const lut_quirky_backslashes array[8] base.u8 = [ +pri const LUT_QUIRKY_BACKSLASHES array[8] base.u8 = [ 0x00, 0x07, 0x1B, 0x0A, 0x3F, 0x27, 0x0B, 0x00, ] -// lut_chars helps decode bytes within a string: +// LUT_CHARS helps decode bytes within a string: // - 0x00 is 1-byte UTF-8 (ASCII) but not '"', '\\' or a C0 control code. // - 0x01 is '"'. // - 0x02 is '\\'. @@ -145,7 +145,7 @@ // UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / // %xF4 %x80-8F 2( UTF8-tail ) // UTF8-tail = %x80-BF -pri const lut_chars array[256] base.u8 = [ +pri const LUT_CHARS array[256] base.u8 = [ // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, // 0x00 ..= 0x07. C0 control codes. @@ -187,7 +187,7 @@ // 8 9 A B C D E F ] -// lut_classes is: +// LUT_CLASSES is: // - 0x00 (bitmask 0x0001) is CLASS_WHITESPACE. // - 0x01 (bitmask 0x0002) is CLASS_STRING. // - 0x02 (bitmask 0x0004) is CLASS_COMMA. @@ -231,7 +231,7 @@ // // Comments are always expected. Whether the relevant quirks are enabled are // checked elsewhere. -pri const lut_classes array[256] base.u8[..= 0x0F] = [ +pri const LUT_CLASSES array[256] base.u8[..= 0x0F] = [ // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x00 ..= 0x07. @@ -273,7 +273,7 @@ // 8 9 A B C D E F ] -pri const lut_decimal_digits array[256] base.u8 = [ +pri const LUT_DECIMAL_DIGITS array[256] base.u8 = [ // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07. @@ -315,7 +315,7 @@ // 8 9 A B C D E F ] -pri const lut_hexadecimal_digits array[256] base.u8 = [ +pri const LUT_HEXADECIMAL_DIGITS array[256] base.u8 = [ // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07.
diff --git a/std/json/decode_json.wuffs b/std/json/decode_json.wuffs index 44f78e0..19b984f 100644 --- a/std/json/decode_json.wuffs +++ b/std/json/decode_json.wuffs
@@ -14,7 +14,7 @@ pub struct decoder? implements base.token_decoder( // quirk_enabled_allow_backslash_etc, an 8-element array, is indexed by the - // same enum as lut_quirky_backslashes. + // same enum as LUT_QUIRKY_BACKSLASHES. quirk_enabled_allow_backslash_etc : array[8] base.bool, quirk_enabled_allow_ascii_control_codes : base.bool, @@ -53,7 +53,7 @@ // Wuffs code does not have the capability to dynamically allocate memory, // so the maximum depth is hard-coded at compile time. In this case, the // maximum is 1024 (stack is 1024 bits or 128 bytes), also known as - // decoder_depth_max_incl. + // DECODER_DEPTH_MAX_INCL. // // The [JSON spec](https://www.ietf.org/rfc/rfc8259.txt) clearly states, // "an implementation may set limits on the maximum depth of nesting". @@ -68,41 +68,41 @@ ) pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) { - if args.quirk == quirk_allow_ascii_control_codes { + if args.quirk == QUIRK_ALLOW_ASCII_CONTROL_CODES { this.quirk_enabled_allow_ascii_control_codes = args.enabled - } else if args.quirk == quirk_allow_backslash_a { + } else if args.quirk == QUIRK_ALLOW_BACKSLASH_A { this.quirk_enabled_allow_backslash_etc[1] = args.enabled - } else if args.quirk == quirk_allow_backslash_capital_u { + } else if args.quirk == QUIRK_ALLOW_BACKSLASH_CAPITAL_U { this.quirk_enabled_allow_backslash_capital_u = args.enabled - } else if args.quirk == quirk_allow_backslash_e { + } else if args.quirk == QUIRK_ALLOW_BACKSLASH_E { this.quirk_enabled_allow_backslash_etc[2] = args.enabled - } else if args.quirk == quirk_allow_backslash_new_line { + } else if args.quirk == QUIRK_ALLOW_BACKSLASH_NEW_LINE { this.quirk_enabled_allow_backslash_etc[3] = args.enabled - } else if args.quirk == quirk_allow_backslash_question_mark { + } else if args.quirk == QUIRK_ALLOW_BACKSLASH_QUESTION_MARK { this.quirk_enabled_allow_backslash_etc[4] = args.enabled - } else if args.quirk == quirk_allow_backslash_single_quote { + } else if args.quirk == QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE { this.quirk_enabled_allow_backslash_etc[5] = args.enabled - } else if args.quirk == quirk_allow_backslash_v { + } else if args.quirk == QUIRK_ALLOW_BACKSLASH_V { this.quirk_enabled_allow_backslash_etc[6] = args.enabled - } else if args.quirk == quirk_allow_backslash_x { + } else if args.quirk == QUIRK_ALLOW_BACKSLASH_X { this.quirk_enabled_allow_backslash_x = args.enabled - } else if args.quirk == quirk_allow_backslash_zero { + } else if args.quirk == QUIRK_ALLOW_BACKSLASH_ZERO { this.quirk_enabled_allow_backslash_etc[7] = args.enabled - } else if args.quirk == quirk_allow_comment_block { + } else if args.quirk == QUIRK_ALLOW_COMMENT_BLOCK { this.quirk_enabled_allow_comment_block = args.enabled - } else if args.quirk == quirk_allow_comment_line { + } else if args.quirk == QUIRK_ALLOW_COMMENT_LINE { this.quirk_enabled_allow_comment_line = args.enabled - } else if args.quirk == quirk_allow_extra_comma { + } else if args.quirk == QUIRK_ALLOW_EXTRA_COMMA { this.quirk_enabled_allow_extra_comma = args.enabled - } else if args.quirk == quirk_allow_inf_nan_numbers { + } else if args.quirk == QUIRK_ALLOW_INF_NAN_NUMBERS { this.quirk_enabled_allow_inf_nan_numbers = args.enabled - } else if args.quirk == quirk_allow_leading_ascii_record_separator { + } else if args.quirk == QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR { this.quirk_enabled_allow_leading_ascii_record_separator = args.enabled - } else if args.quirk == quirk_allow_leading_unicode_byte_order_mark { + } else if args.quirk == QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK { this.quirk_enabled_allow_leading_unicode_byte_order_mark = args.enabled - } else if args.quirk == quirk_allow_trailing_new_line { + } else if args.quirk == QUIRK_ALLOW_TRAILING_NEW_LINE { this.quirk_enabled_allow_trailing_new_line = args.enabled - } else if args.quirk == quirk_replace_invalid_unicode { + } else if args.quirk == QUIRK_REPLACE_INVALID_UNICODE { this.quirk_enabled_replace_invalid_unicode = args.enabled } } @@ -201,7 +201,7 @@ } c = args.src.peek_u8() - class = lut_classes[c] + class = LUT_CLASSES[c] if class <> 0x00 { // 0x00 is CLASS_WHITESPACE. break.ws } @@ -288,10 +288,10 @@ inv args.src.available() > 0, { c4 = args.src.peek_u32le() - if 0x00 <> (lut_chars[0xFF & (c4 >> 0)] | - lut_chars[0xFF & (c4 >> 8)] | - lut_chars[0xFF & (c4 >> 16)] | - lut_chars[0xFF & (c4 >> 24)]) { + if 0x00 <> (LUT_CHARS[0xFF & (c4 >> 0)] | + LUT_CHARS[0xFF & (c4 >> 8)] | + LUT_CHARS[0xFF & (c4 >> 16)] | + LUT_CHARS[0xFF & (c4 >> 24)]) { break } args.src.skip32_fast!(actual: 4, worst_case: 4) @@ -308,7 +308,7 @@ } endwhile c = args.src.peek_u8() - char = lut_chars[c] + char = LUT_CHARS[c] if char == 0x00 { // Non-special ASCII. args.src.skip32_fast!(actual: 1, worst_case: 1) @@ -359,7 +359,7 @@ continue.string_loop_outer } c = (args.src.peek_u16le() >> 8) as base.u8 - backslash = lut_backslashes[c] + backslash = LUT_BACKSLASHES[c] if (backslash & 0x80) <> 0 { args.src.skip32_fast!(actual: 2, worst_case: 2) args.dst.write_simple_token_fast!( @@ -374,7 +374,7 @@ args.src.skip32_fast!(actual: 2, worst_case: 2) args.dst.write_simple_token_fast!( value_major: 0, - value_minor: 0x60_0000 | (lut_quirky_backslashes[backslash & 7] as base.u32), + value_minor: 0x60_0000 | (LUT_QUIRKY_BACKSLASHES[backslash & 7] as base.u32), continued: 1, length: 2) continue.string_loop_outer @@ -396,16 +396,16 @@ uni4_value = 0 uni4_ok = 0x80 - c = lut_hexadecimal_digits[0xFF & (uni4_string >> 0)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni4_string >> 0)] uni4_ok &= c uni4_value |= ((c & 0x0F) as base.u32) << 12 - c = lut_hexadecimal_digits[0xFF & (uni4_string >> 8)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni4_string >> 8)] uni4_ok &= c uni4_value |= ((c & 0x0F) as base.u32) << 8 - c = lut_hexadecimal_digits[0xFF & (uni4_string >> 16)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni4_string >> 16)] uni4_ok &= c uni4_value |= ((c & 0x0F) as base.u32) << 4 - c = lut_hexadecimal_digits[0xFF & (uni4_string >> 24)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni4_string >> 24)] uni4_ok &= c uni4_value |= ((c & 0x0F) as base.u32) << 0 @@ -467,16 +467,16 @@ uni4_ok = 0x80 uni4_string >>= 16 - c = lut_hexadecimal_digits[0xFF & (uni4_string >> 0)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni4_string >> 0)] uni4_ok &= c uni4_value |= ((c & 0x0F) as base.u32) << 12 - c = lut_hexadecimal_digits[0xFF & (uni4_string >> 8)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni4_string >> 8)] uni4_ok &= c uni4_value |= ((c & 0x0F) as base.u32) << 8 - c = lut_hexadecimal_digits[0xFF & (uni4_string >> 16)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni4_string >> 16)] uni4_ok &= c uni4_value |= ((c & 0x0F) as base.u32) << 4 - c = lut_hexadecimal_digits[0xFF & (uni4_string >> 24)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni4_string >> 24)] uni4_ok &= c uni4_value |= ((c & 0x0F) as base.u32) << 0 } @@ -527,28 +527,28 @@ uni8_value = 0 uni8_ok = 0x80 - c = lut_hexadecimal_digits[0xFF & (uni8_string >> 0)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni8_string >> 0)] uni8_ok &= c uni8_value |= ((c & 0x0F) as base.u32) << 28 - c = lut_hexadecimal_digits[0xFF & (uni8_string >> 8)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni8_string >> 8)] uni8_ok &= c uni8_value |= ((c & 0x0F) as base.u32) << 24 - c = lut_hexadecimal_digits[0xFF & (uni8_string >> 16)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni8_string >> 16)] uni8_ok &= c uni8_value |= ((c & 0x0F) as base.u32) << 20 - c = lut_hexadecimal_digits[0xFF & (uni8_string >> 24)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni8_string >> 24)] uni8_ok &= c uni8_value |= ((c & 0x0F) as base.u32) << 16 - c = lut_hexadecimal_digits[0xFF & (uni8_string >> 32)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni8_string >> 32)] uni8_ok &= c uni8_value |= ((c & 0x0F) as base.u32) << 12 - c = lut_hexadecimal_digits[0xFF & (uni8_string >> 40)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni8_string >> 40)] uni8_ok &= c uni8_value |= ((c & 0x0F) as base.u32) << 8 - c = lut_hexadecimal_digits[0xFF & (uni8_string >> 48)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni8_string >> 48)] uni8_ok &= c uni8_value |= ((c & 0x0F) as base.u32) << 4 - c = lut_hexadecimal_digits[0xFF & (uni8_string >> 56)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (uni8_string >> 56)] uni8_ok &= c uni8_value |= ((c & 0x0F) as base.u32) << 0 @@ -597,9 +597,9 @@ backslash_x_string = args.src.peek_u32le() backslash_x_ok = 0x80 - c = lut_hexadecimal_digits[0xFF & (backslash_x_string >> 16)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (backslash_x_string >> 16)] backslash_x_ok &= c - c = lut_hexadecimal_digits[0xFF & (backslash_x_string >> 24)] + c = LUT_HEXADECIMAL_DIGITS[0xFF & (backslash_x_string >> 24)] backslash_x_ok &= c if (backslash_x_ok == 0) or @@ -1290,12 +1290,12 @@ break } c = args.src.peek_u8() - if 0x00 == lut_decimal_digits[c] { + if 0x00 == LUT_DECIMAL_DIGITS[c] { break } - // Cap decoder_number_length_max_incl at an arbitrary value, 99. The + // Cap DECODER_NUMBER_LENGTH_MAX_INCL at an arbitrary value, 99. The // caller's src.data.len should therefore be at least 100, also known - // as decoder_src_io_buffer_length_min_incl. + // as DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL. // // An example of a JSON number that is 81 bytes long is: // https://github.com/nst/JSONTestSuite/blob/master/test_parsing/y_number_double_close_to_zero.json @@ -1630,7 +1630,7 @@ } c = args.src.peek_u8() - if lut_classes[c] <> 0x00 { // 0x00 is CLASS_WHITESPACE. + if LUT_CLASSES[c] <> 0x00 { // 0x00 is CLASS_WHITESPACE. if whitespace_length > 0 { args.dst.write_simple_token_fast!( value_major: 0, value_minor: 0, continued: 0, length: whitespace_length)
diff --git a/std/json/decode_quirks.wuffs b/std/json/decode_quirks.wuffs index 69ca90b..b0ad9a1 100644 --- a/std/json/decode_quirks.wuffs +++ b/std/json/decode_quirks.wuffs
@@ -29,50 +29,50 @@ // // This allows for multi-line strings, where a literal new line in the encoding // becomes a literal new line in the decoding. A backslash before a new line is -// still a syntax error, unless combined with quirk_allow_backslash_new_line. +// still a syntax error, unless combined with QUIRK_ALLOW_BACKSLASH_NEW_LINE. // // 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 = 0x4909_9400 | 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 = 0x4909_9400 | 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 +// This quirk can combine with QUIRK_REPLACE_INVALID_UNICODE. +pub const QUIRK_ALLOW_BACKSLASH_CAPITAL_U base.u32 = 0x4909_9400 | 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 = 0x4909_9400 | 0x03 // When this quirk is enabled, e.g. ("abc\ // z") is accepted as a JSON string, equivalent to "abc\nz". // // This allows for multi-line strings, if each new line is preceded by a -// backslash. This doesn't combine per se with quirk_allow_ascii_control_codes, +// backslash. This doesn't combine per se with QUIRK_ALLOW_ASCII_CONTROL_CODES, // but they have similar consequences. // // 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 = 0x4909_9400 | 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 = 0x4909_9400 | 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 = 0x4909_9400 | 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 = 0x4909_9400 | 0x07 // When this quirk is enabled, e.g. "abc\xeFz" is accepted as a JSON string, // There are exactly 2 encoded bytes after each "\x". @@ -91,22 +91,22 @@ // 0xAF and 0x7A. The UTF-8 encoding of U+00EF LATIN SMALL LETTER I WITH // DIAERESIS is the two byte sequence (0xC3, 0xAF). Decoded strings are still // valid UTF-8 and tokens still split on UTF-8 boundaries. -pub const quirk_allow_backslash_x base.u32 = 0x4909_9400 | 0x08 +pub const QUIRK_ALLOW_BACKSLASH_X base.u32 = 0x4909_9400 | 0x08 // 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 | 0x09 +pub const QUIRK_ALLOW_BACKSLASH_ZERO base.u32 = 0x4909_9400 | 0x09 // When this quirk is enabled, "/* C/C++ style block comments */" are accepted -// anywhere whitespace would be, although see the quirk_allow_trailing_new_line +// anywhere whitespace would be, although see the QUIRK_ALLOW_TRAILING_NEW_LINE // comment for additional interaction when combining multiple quirks. // // They produce WUFFS_BASE__TOKEN__VBD__FILLER__COMMENT_BLOCK tokens. The token // chain's source bytes includes the starting "/*" and the ending "*/". -pub const quirk_allow_comment_block base.u32 = 0x4909_9400 | 0x0A +pub const QUIRK_ALLOW_COMMENT_BLOCK base.u32 = 0x4909_9400 | 0x0A // When this quirk is enabled, "// C/C++ style line comments\n" are accepted -// anywhere whitespace would be, although see the quirk_allow_trailing_new_line +// anywhere whitespace would be, although see the QUIRK_ALLOW_TRAILING_NEW_LINE // comment for additional interaction when combining multiple quirks. // // A line comment may not omit the ending "\n", even if there is no input @@ -118,7 +118,7 @@ // Even if the line comments are on consecutive lines, each line comment is a // separate token chain. There may be whitespace tokens between one line // comment's ending "\n" and the next one's starting "//". -pub const quirk_allow_comment_line base.u32 = 0x4909_9400 | 0x0B +pub const QUIRK_ALLOW_COMMENT_LINE base.u32 = 0x4909_9400 | 0x0B // 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 @@ -127,31 +127,31 @@ // // 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 | 0x0C +pub const QUIRK_ALLOW_EXTRA_COMMA base.u32 = 0x4909_9400 | 0x0C // 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 | 0x0D +pub const QUIRK_ALLOW_INF_NAN_NUMBERS base.u32 = 0x4909_9400 | 0x0D // When this quirk is enabled, the input byte stream may optionally start with // "\x1E" (the ASCII Record Separator control character). That byte is skipped // and decoding proceeds normally. // -// When combined with quirk_allow_leading_unicode_byte_order_mark, either mark +// When combined with QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK, either mark // may come first in the byte stream. // -// When combined with quirk_allow_trailing_new_line, this format is also known +// When combined with QUIRK_ALLOW_TRAILING_NEW_LINE, 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 | 0x0E +pub const QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR base.u32 = 0x4909_9400 | 0x0E // 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). // Those 3 bytes are skipped and decoding proceeds normally. // -// When combined with quirk_allow_leading_ascii_record_separator, either mark +// 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 | 0x0F +pub const QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK base.u32 = 0x4909_9400 | 0x0F // When this quirk is enabled, following a successful decoding of a top-level // JSON value, any trailing whitespace (ASCII characters 0x09, 0x0A, 0x0D or @@ -178,16 +178,16 @@ // such bytes may confuse other line oriented Unix tools that assume exactly // one JSON value per line. // -// When combined with quirk_allow_leading_ascii_record_separator, this format +// 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". // -// When combined with quirk_allow_comment_block or quirk_allow_comment_line, it +// When combined with QUIRK_ALLOW_COMMENT_BLOCK or QUIRK_ALLOW_COMMENT_LINE, it // is an error for a comment to occur in this trailing whitespace, before an // end-of-file or '\n' is encountered. Treating this as an error avoids any // ambiguity in accounting for new lines within a block comment or ending a // line comment. -pub const quirk_allow_trailing_new_line base.u32 = 0x4909_9400 | 0x10 +pub const QUIRK_ALLOW_TRAILING_NEW_LINE base.u32 = 0x4909_9400 | 0x10 // 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 @@ -200,7 +200,7 @@ // "abc\uDC00z" and "ijk\uD800\uDBFFz" are equivalent to "abc\uFFFDz" and // "ijk\uFFFD\uFFFDz". // -// When combined with quirk_allow_backslash_capital_u, a "\U12345678" 10-byte +// 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 | 0x11 +pub const QUIRK_REPLACE_INVALID_UNICODE base.u32 = 0x4909_9400 | 0x11
diff --git a/std/lzw/decode_lzw.wuffs b/std/lzw/decode_lzw.wuffs index 7cdb1a5..3461a42 100644 --- a/std/lzw/decode_lzw.wuffs +++ b/std/lzw/decode_lzw.wuffs
@@ -24,7 +24,7 @@ // - 85be5b9 Delete the obsolete lzw.decoder.suffixes array // and the roll back has combined numbers: // - 3056a84 Roll back 3 recent lzw.decoder.suffixes commits -pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 0 +pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE base.u64 = 0 pub struct decoder? implements base.io_transformer( // set_literal_width_arg is 1 plus the saved argument passed to
diff --git a/std/wbmp/decode_wbmp.wuffs b/std/wbmp/decode_wbmp.wuffs index 6ae61a0..fad72ee 100644 --- a/std/wbmp/decode_wbmp.wuffs +++ b/std/wbmp/decode_wbmp.wuffs
@@ -14,7 +14,7 @@ pub status "#bad header" -pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 0 +pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE base.u64 = 0 pub struct decoder? implements base.image_decoder( width : base.u32,
diff --git a/std/zlib/decode_zlib.wuffs b/std/zlib/decode_zlib.wuffs index b3de981..a573fbe 100644 --- a/std/zlib/decode_zlib.wuffs +++ b/std/zlib/decode_zlib.wuffs
@@ -23,8 +23,8 @@ pub status "#bad parity check" pub status "#incorrect dictionary" -// TODO: reference deflate.decoder_workbuf_len_max_incl_worst_case. -pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 1 +// TODO: reference deflate.DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE. +pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE base.u64 = 1 pub struct decoder? implements base.io_transformer( bad_call_sequence : base.bool, @@ -68,8 +68,8 @@ pub func decoder.workbuf_len() base.range_ii_u64 { return this.util.make_range_ii_u64( - min_incl: decoder_workbuf_len_max_incl_worst_case, - max_incl: decoder_workbuf_len_max_incl_worst_case) + min_incl: DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE, + max_incl: DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE) } pub func decoder.transform_io?(dst: base.io_writer, src: base.io_reader, workbuf: slice base.u8) {