!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ IConvert a strict ByteString to a lazy Char8 ByteString, where the format , is the same as running hexdump -C on it. KPerforms the same operation as hexDumpString, but also writes it to stdout GThis is the generic class for the set of binary parsers. This lets you J write parser functions which are agnostic about the pattern of parsing = in which they get used (incremental, strict, bitwise etc)     portable to Hugs and GHC. experimental%Adam Langley <agl@imperialviolet.org>EThis is the internal version of the above. This is the type which is E actually used by the code, as it has the extra information needed ? for backtracking. This is converted to an external friendly Result 4 type just before giving it to the outside world. The result of a partial parse 9the parse ran out of data before finishing, but produced > the given list of results before doing so. To continue the 2 parse pass more data to the given continuation 2the parse finished and produced the given list of 4 results doing so. Any unparsed data is returned. .the parse failed with the given error message The parse state BThis turns an internal Result into one safe for the outside world KThis is the final continuation that turns a passed value into an IFinished ,Start a parser and return the first Result. I';m not sure if this is a huge bodge or not. It probably is. When performing a choice (in plus$), the failure depth in the current N state is incremented. If a failure is generated inside the attempted path, H the state carried in the IFailure will have this incremented failure  depth. However, we don'1t want to backtrack after the attempted path has Q completed. Thus we insert this cut continuation, which decrements the failure C count of any failure passing though, thus it would be caught in plus and  doesn't trigger a backtrack. !FThis is the choice operator. If the first option fails, the second is K tried. The failure of the first option must happen within this function ( otherwise rollback is not attempted. # Skip ahead n bytes. Fails if fewer than n bytes are available. $2Get the total number of bytes read to this point. %,Get the number of remaining unparsed bytes. : Useful for checking whether all input has been consumed. &*Test whether all input has been consumed, - i.e. there are no remaining unparsed bytes. ' An efficient / method for strict ByteStrings. Fails if fewer  than n bytes are left in the input. ("Yield a partial and get more data Pull n/ bytes from the input, as a strict ByteString.  !"#$%&'()*+,-./01234 #$%&!"4(/'*,.)+-0123 !"#$%&'()*+,-./01234portable to Hugs and GHC. experimental%Adam Langley <agl@imperialviolet.org> The parse state 9GRun a parser on the given input and return the result (either an error  string from a call to fail., or the parsing result) and the remainder of  of the input. : Skip ahead n bytes. Fails if fewer than n bytes are available. ;Run ga*, but return without consuming its input.  Fails if ga fails. <Like ;, but consume the input if gma returns 'Just _'.  Fails if gma fails. =Like ;, but consume the input if gea returns 'Right _'.  Fails if gea fails. >2Get the total number of bytes read to this point. ?,Get the number of remaining unparsed bytes. : Useful for checking whether all input has been consumed. @*Test whether all input has been consumed, - i.e. there are no remaining unparsed bytes. A An efficient / method for strict ByteStrings. Fails if fewer  than n bytes are left in the input. Pull n/ bytes from the input, as a strict ByteString. 56789:;<=>?@ABCDEFGHIJKLMN59;<=768:>?@HACEGBDFIJKLMN56789:;<=>?@ABCDEFGHIJKLMNOEThis is used for masking the last byte of a ByteString so that extra  bits don' t leak in P*Return a Word8 with the bottom n bits set Q<Shift the whole ByteString some number of bits left where 0 <= n < 8 R=Shift the whole ByteString some number of bits right where 0 <= n < 8 SITruncate a ByteString to a given number of bits (counting from the left) . by masking out extra bits in the last byte TJTruncate a ByteString to a given number of bits (counting from the right) / by masking out extra bits in the first byte OPQRSTOPQRSTOPQRSTportable to Hugs and GHC experimental%Adam Langley <agl@imperialviolet.org>UA U# is an efficient way to build lazy  s. . There are several functions for constructing Us, but only one G to inspect them: to extract any data, you have to turn them into lazy   s using \. Internally, a U constructs a lazy  L.Bytestring by filling byte 9 arrays piece by piece. As each buffer is filled, it is 'popped' 2 off, to become a new chunk of the resulting lazy  . ) All this is hidden from the user of the U. DThis is closely based on the Builder monad, but this one deals with  single bits at a time. VO(1)." The empty BitBuilder, satisfying  \ V =  WO(1).. A BitBuilder taking a single bit, satisfying  \ (W b) =   bYJConstruct a BitBuilder by taking the bottom n bits of a Bits instance. If L the instance has less than n bits, this acts as if there was an infinite  zero filled prefix ZO(1).@ The concatenation of two BitBuilders, an associative operation  with identity V , satisfying  \ (Z x y) =   (\ x) (\ y)[O(1). A BitBuilder taking a lazy   , satisfying  \ ([ bs) = bs\O(n). Extract a lazy   from a U. D The construction work takes place if and when the relevant part of  the lazy   is demanded. ]O(1). Pop the  % we have constructed so far, if any, ) yielding a new chunk in the result lazy  . )The default size of a new chunk, in bits 'Sequence an IO operation on the buffer $Get the size of the buffer, in bits Ensure that there are at least n many bits available.  Ensure that n' many bits are available, and then use f to write some  bytes into the memory. BCreate a new buffer of, at least, the given bit size. The current > buffer is passed in. If it has a partial byte in progress, C that byte is merged in. The given buffer must be in the form as  produced by ] UVWXYZ[\] U\VWZX[Y] UVWXYZ[\] experimental%Adam Langley <agl@imperialviolet.org>BUsed as a flag argument to readN to control weather the resulting ' ByteString is left or right aligned _Run a BitGet on a ByteString `Run ga*, but return without consuming its input.  Fails if ga fails. JSame as the standard splitAt, but in this version both parts share a byte  so that splitting [1,2,3,4] at 2 results in ([1,2] , [2, 3, 4]). IFetch some number of bits from the input and return them as a ByteString % after applying the given function aSkip n' bits of the input. Fails if less then n bits remain b1Return the number of bits remaining to be parsed c/Return true if there are no more bits to parse d Get a single bit from the input e>Get a ByteString with the given number of bits, left aligned. fBGet a ByteString with the given number of bits in, right aligned. s#Read a Word16 in big endian format t#Read a Word32 in big endian format u#Read a Word64 in big endian format ^_`abcdefghijklmnopqrstu^_abc`defrstumghoijpklqn^_`abcdefghijklmnopqrstuWe don':t import the usual array indexing function from the array E modules. Instead, we implement it ourselves and remove the bounds  checking w An empty set xThe set contained all elements yA set with a single element A generic binary function HConstruct a ByteSet containing all the elements from a to b, inclusive. vwxyz{|}~ vwxyz{|}~ vwxyz{|}~  experimental4Dominic Steinitz <dominic.steinitz@blueyonder.co.uk>Append a single bit HAppend the bottom n bits of the given bits value. In the case that more I bits are requested than the value provides, this acts as if the value . has as unlimited number of leading 0 bits. KAppend a value. Note that this function is undefined for instances of Bits . which have no fixed bitsize (like Integer) Append a ByteString EAppend a left aligned ByteString where ByteString has a partial byte K with the given number of valid bits, from the MSB downwards. The number I of such bits must be 0..7. (A normal ByteString, which all bytes full  would use 0)  !"#$%&'()*+,-./01"# $!%&'()/0.234"# $!%&'(56789:;<=>?@ABCDEFG2HIJ"# $!%&'(KLMNO>P?QRSTUVWX Y Z [ \ ] ^ _`abcdefaef g > ? B ghijklmnopqrsbinary-strict-0.4.6Data.Binary.Strict.UtilData.Binary.Strict.Class!Data.Binary.Strict.IncrementalGetData.Binary.Strict.GetData.Binary.Strict.BitUtilData.Binary.BitBuilderData.Binary.Strict.BitGetData.Binary.Strict.ByteSetData.Binary.BitPutbytestring-0.9.1.4Data.ByteString.Lazy.InternalData.ByteString.LazyData.ByteString.Internal hexDumpStringhexDump BinaryParserskip bytesRead remainingisEmptyspanOfspanOf1stringword8oneOfmanymany1optionalgetWord8 getByteString getWord16be getWord32be getWord64be getWord16le getWord32le getWord64le getWordhost getWord16host getWord32host getWord64hostGetResultPartialFinishedFailedrunGetpluszerosuspend lookAhead lookAheadM lookAheadEgetFloat32hostgetFloat64hosttopNBits bottomNBits leftShift rightShiftleftTruncateBitsrightTruncateBits BitBuilderempty singletonfromByteStringfromBitsappendfromLazyByteStringtoLazyByteStringflushBitGet runBitGetgetBitgetLeftByteStringgetRightByteString getAsWord8 getAsWord16 getAsWord32 getAsWord64ByteSetfullunion intersection difference complementtoListfromListrangememberBitPutputBitputNBitsputBits putByteStringputLeftByteString runBitPutIResultStoplevelTranslateterminalContinuationcutContinuationgetgetBytes ByteString defaultSize unsafeLiftIOwithSize ensureFreewriteN newBuffer DirectionsplitAtWithDupBytereadN!binary