mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Rename while:label to while.label
This commit is contained in:
1 parent
5d29c7df61
commit
7872a8893b
8 files changed
+27
-26
No files matched your search
@@ -38,6 +38,7 @@ faster than Wuffs version 0.1 and about 2x faster than giflib (the C library).
|
||||
- Renamed `$(etc)` to `[etc]`.
|
||||
- Renamed `[i..j]` to `[i ..= j]`, consistent with Rust syntax.
|
||||
- Renamed `[N] T` and `[] T` types to `array[N] T` and `slice T`.
|
||||
- Renamed `while:label` to `while.label`.
|
||||
- Renamed `u32`, `buf1`, etc to `base.u32`, `base.io_buffer`, etc.
|
||||
- Renamed `unread_u8?` to `undo_byte!`; added `can_undo_byte`.
|
||||
- Renamed some `decode?` methods to `decode_io_writer?`.
|
||||
|
||||
+3
-3
@@ -498,7 +498,7 @@ func NewIOBind(keyword t.ID, io *Expr, arg1 *Expr, body []*Node) *IOBind {
|
||||
}
|
||||
|
||||
// Iterate is
|
||||
// "iterate:ID1 (assigns)(length:ID2, unroll:ID0), List1 { List2 } else RHS":
|
||||
// "iterate.ID1 (assigns)(length:ID2, unroll:ID0), List1 { List2 } else RHS":
|
||||
// - FlagsHasBreak is the iterate has an explicit break
|
||||
// - FlagsHasContinue is the iterate has an explicit continue
|
||||
// - ID0: unroll
|
||||
@@ -537,7 +537,7 @@ func NewIterate(label t.ID, assigns []*Node, length t.ID, unroll t.ID, asserts [
|
||||
}
|
||||
}
|
||||
|
||||
// While is "while:ID1 MHS, List1 { List2 }":
|
||||
// While is "while.ID1 MHS, List1 { List2 }":
|
||||
// - FlagsHasBreak is the while has an explicit break
|
||||
// - FlagsHasContinue is the while has an explicit continue
|
||||
// - ID1: <0|label>
|
||||
@@ -613,7 +613,7 @@ func NewRet(keyword t.ID, value *Expr) *Ret {
|
||||
}
|
||||
}
|
||||
|
||||
// Jump is "break" or "continue", with an optional label, "break:label":
|
||||
// Jump is "break" or "continue", with an optional label, "break.label":
|
||||
// - ID0: <IDBreak|IDContinue>
|
||||
// - ID1: <0|label>
|
||||
type Jump Node
|
||||
|
||||
@@ -83,13 +83,13 @@ func TestCheck(tt *testing.T) {
|
||||
|
||||
assert true
|
||||
|
||||
while:label p == q,
|
||||
while.label p == q,
|
||||
pre true,
|
||||
inv true,
|
||||
post p <> q,
|
||||
{
|
||||
// Redundant, but shows the labeled jump syntax.
|
||||
continue:label
|
||||
continue.label
|
||||
}
|
||||
}
|
||||
`) + "\n"
|
||||
|
||||
+1
-1
@@ -599,7 +599,7 @@ func (p *parser) parseStatement() (*a.Node, error) {
|
||||
}
|
||||
|
||||
func (p *parser) parseLabel() (t.ID, error) {
|
||||
if p.peek1() == t.IDColon {
|
||||
if p.peek1() == t.IDDot {
|
||||
p.src = p.src[1:]
|
||||
return p.parseIdent()
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ pri func decoder.decode_blocks?(dst base.io_writer, src base.io_reader) {
|
||||
var type base.u32
|
||||
var status base.status
|
||||
|
||||
while:outer final == 0 {
|
||||
while.outer final == 0 {
|
||||
while this.n_bits < 3,
|
||||
post this.n_bits >= 3,
|
||||
{
|
||||
@@ -247,11 +247,11 @@ pri func decoder.decode_blocks?(dst base.io_writer, src base.io_reader) {
|
||||
return status
|
||||
}
|
||||
if this.end_of_block {
|
||||
continue:outer
|
||||
continue.outer
|
||||
}
|
||||
this.decode_huffman_slow?(dst:args.dst, src:args.src)
|
||||
if this.end_of_block {
|
||||
continue:outer
|
||||
continue.outer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
|
||||
// for each. There are also up to 13 extra bits, or 2 bytes. Thus, each
|
||||
// code requires up to 2 + 2 + 2 == 6 bytes, and there are two codes (one
|
||||
// from H-L and one from H-D). Therefore, we check for at least 12 bytes.
|
||||
while:loop(args.dst.available() >= 258) and (args.src.available() >= 12) {
|
||||
while.loop(args.dst.available() >= 258) and (args.src.available() >= 12) {
|
||||
// Ensure that we have at least 15 bits of input.
|
||||
if n_bits < 15 {
|
||||
assert n_bits >= 0 // TODO: this shouldn't be necessary.
|
||||
@@ -100,14 +100,14 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
|
||||
if (table_entry >> 31) <> 0 {
|
||||
// Literal.
|
||||
args.dst.write_fast_u8!(a:((table_entry >> 8) & 0xFF) as base.u8)
|
||||
continue:loop
|
||||
continue.loop
|
||||
} else if (table_entry >> 30) <> 0 {
|
||||
// No-op; code continues past the if-else chain.
|
||||
assert args.src.available() >= 8
|
||||
} else if (table_entry >> 29) <> 0 {
|
||||
// End of block.
|
||||
this.end_of_block = true
|
||||
break:loop
|
||||
break.loop
|
||||
} else if (table_entry >> 28) <> 0 {
|
||||
// Redirect.
|
||||
|
||||
@@ -138,13 +138,13 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
|
||||
if (table_entry >> 31) <> 0 {
|
||||
// Literal.
|
||||
args.dst.write_fast_u8!(a:((table_entry >> 8) & 0xFF) as base.u8)
|
||||
continue:loop
|
||||
continue.loop
|
||||
} else if (table_entry >> 30) <> 0 {
|
||||
// No-op; code continues past the if-else chain.
|
||||
} else if (table_entry >> 29) <> 0 {
|
||||
// End of block.
|
||||
this.end_of_block = true
|
||||
break:loop
|
||||
break.loop
|
||||
} else if (table_entry >> 28) <> 0 {
|
||||
return "#internal error: inconsistent Huffman decoder state"
|
||||
} else if (table_entry >> 27) <> 0 {
|
||||
@@ -342,7 +342,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
|
||||
|
||||
if length == 0 {
|
||||
// No need to copy from args.dst.
|
||||
continue:loop
|
||||
continue.loop
|
||||
}
|
||||
|
||||
if ((dist_minus_1 + 1) as base.u64) > args.dst.history_available() {
|
||||
|
||||
@@ -48,7 +48,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
|
||||
lmask = ((1 as base.u32) << this.n_huffs_bits[0]) - 1
|
||||
dmask = ((1 as base.u32) << this.n_huffs_bits[1]) - 1
|
||||
|
||||
while:loop not coroutine_resumed {
|
||||
while.loop not coroutine_resumed {
|
||||
// Decode an lcode symbol from H-L.
|
||||
while true {
|
||||
table_entry = this.huffs[0][bits & lmask]
|
||||
@@ -67,13 +67,13 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
|
||||
if (table_entry >> 31) <> 0 {
|
||||
// Literal.
|
||||
args.dst.write_u8?(a:((table_entry >> 8) & 0xFF) as base.u8)
|
||||
continue:loop
|
||||
continue.loop
|
||||
} else if (table_entry >> 30) <> 0 {
|
||||
// No-op; code continues past the if-else chain.
|
||||
} else if (table_entry >> 29) <> 0 {
|
||||
// End of block.
|
||||
this.end_of_block = true
|
||||
break:loop
|
||||
break.loop
|
||||
} else if (table_entry >> 28) <> 0 {
|
||||
// Redirect.
|
||||
redir_top = (table_entry >> 8) & 0xFFFF
|
||||
@@ -95,13 +95,13 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
|
||||
if (table_entry >> 31) <> 0 {
|
||||
// Literal.
|
||||
args.dst.write_u8?(a:((table_entry >> 8) & 0xFF) as base.u8)
|
||||
continue:loop
|
||||
continue.loop
|
||||
} else if (table_entry >> 30) <> 0 {
|
||||
// No-op; code continues past the if-else chain.
|
||||
} else if (table_entry >> 29) <> 0 {
|
||||
// End of block.
|
||||
this.end_of_block = true
|
||||
break:loop
|
||||
break.loop
|
||||
} else if (table_entry >> 28) <> 0 {
|
||||
return "#internal error: inconsistent Huffman decoder state"
|
||||
} else if (table_entry >> 27) <> 0 {
|
||||
@@ -259,7 +259,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
|
||||
|
||||
if length == 0 {
|
||||
// No need to copy from args.dst.
|
||||
continue:loop
|
||||
continue.loop
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1004,7 +1004,7 @@ pri func decoder.decode_id_part2?(dst ptr base.pixel_buffer, src base.io_reader,
|
||||
var uncompressed slice base.u8
|
||||
|
||||
need_block_size = true
|
||||
while:outer true {
|
||||
while.outer true {
|
||||
if need_block_size {
|
||||
need_block_size = false
|
||||
block_size = args.src.read_u8_as_u64?()
|
||||
@@ -1044,7 +1044,7 @@ pri func decoder.decode_id_part2?(dst ptr base.pixel_buffer, src base.io_reader,
|
||||
return base."#bad workbuf length"
|
||||
}
|
||||
|
||||
while:inner true {
|
||||
while.inner true {
|
||||
if (this.compressed_ri > this.compressed_wi) or (this.compressed_wi > 4096) {
|
||||
return "#internal error: inconsistent ri/wi"
|
||||
}
|
||||
@@ -1072,11 +1072,11 @@ pri func decoder.decode_id_part2?(dst ptr base.pixel_buffer, src base.io_reader,
|
||||
this.skip_blocks?(src:args.src)
|
||||
}
|
||||
|
||||
break:outer
|
||||
break.outer
|
||||
} else if lzw_status == base."$short read" {
|
||||
continue:outer
|
||||
continue.outer
|
||||
} else if lzw_status == base."$short write" {
|
||||
continue:inner
|
||||
continue.inner
|
||||
}
|
||||
return lzw_status
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user