mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 09:01:35 +01:00
Add I/O positions
This commit is contained in:
1 parent
0c18c064b8
commit
7798beaa8c
14 files changed
+258
-25
No files matched your search
@@ -122,6 +122,11 @@ func (g *gen) writeBuiltinIOReader(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
b.writes("(iop_a_src > io0_a_src)")
|
||||
return nil
|
||||
|
||||
case t.IDPosition:
|
||||
b.printf("(a_src.private_impl.buf ? wuffs_base__u64__sat_add(" +
|
||||
"a_src.private_impl.buf->pos, iop_a_src - a_src.private_impl.buf->ptr) : 0)")
|
||||
return nil
|
||||
|
||||
case t.IDSetLimit:
|
||||
b.printf("wuffs_base__io_reader__set_limit(&%ssrc, iop_a_src,", aPrefix)
|
||||
// TODO: update the iop variables?
|
||||
@@ -200,6 +205,11 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
b.printf("wuffs_base__io_writer__copy_n_from_slice(&iop_a_dst, io1_a_dst,")
|
||||
return g.writeArgs(b, args, rp, depth)
|
||||
|
||||
case t.IDPosition:
|
||||
b.printf("(a_dst.private_impl.buf ? wuffs_base__u64__sat_add(" +
|
||||
"a_dst.private_impl.buf->pos, iop_a_dst - a_dst.private_impl.buf->ptr) : 0)")
|
||||
return nil
|
||||
|
||||
case t.IDSetMark:
|
||||
// TODO: is a private_impl.mark the right representation? What
|
||||
// if the function is passed a (ptr io_writer) instead of a
|
||||
|
||||
Reference in new issue
Block a user