Finding binary data (Was: Re: Comments on binary specification)

On 13.3.2013 11:01, Michael Kay wrote:
> 6.2 bin:unpack-string. This function is largely the composition of
> binary-subsequence and decode-string, which makes it largely a
> convenience function. The exception is that it can extract a subsequence
> based on the presence of a terminator; which suggests the need for a
> primitive such as bin:terminated-subsequence($in, $offset, $terminator),
> or perhaps more primitive still bin:find($in, $offset, $search) which
> returns the (relative?) offset of the first occurrence of $search after
> the specified $offset.

I like idea of bin:find(). Do you expect $search be just single octet or
arbitrary long binary data?

> With the function as specified, you can get a zero-terminated string,
> but it's hard to tell how many bytes you have read, which makes it
> difficult to move the read position forward to get the next string after
> the terminator.

That's true.

-- 
------------------------------------------------------------------
  Jirka Kosek      e-mail: jirka@kosek.cz      http://xmlguru.cz
------------------------------------------------------------------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
------------------------------------------------------------------
    Bringing you XML Prague conference    http://xmlprague.cz
------------------------------------------------------------------

Received on Thursday, 14 March 2013 09:26:37 UTC