(index ("bitmatch" 0) ("bitconstruct" 494) ("bitpacket" 969) ("bitstring=?" 1132) ("bitstring-bit-set?" 1237) ("bitstring->list" 1498) ("bitstring-reverse" 2049) ("bitstring-not" 2409) ("bitstring?" 2569) ("bitstring-length" 2751) ("bitstring-append" 2874) ("bitstring-append!" 2997) ("->bitstring" 3164) ("vector->bitstring" 3274) ("u8vector->bitstring" 3430) ("string->bitstring" 3430) ("bitstring->blob" 3568) ("bitstring->u8vector" 3568))
(def (sig (syntax "(bitmatch binary-data patterns-list else-guard)" (id bitmatch))) (ul (li "Match " (tt "binary-data") " against the patterns from " (tt "patterns-list") ".") (li (tt "binary-data") " may be a bitstring object or a value of any of the following data types: u8vector, string or regular vector.") (li "If nothing matches and an " (tt "else-guard") " clause was not specified, an exception of type " (tt "bitstring-match-failure") " is raised.") (li "Else guard is optional. ")))
(def (sig (syntax "(bitconstruct pattern)" (id bitconstruct))) (ul (li "Construct bitstring based on pattern.  The pattern will construct the bitstring from identifiers taken from the current lexical scope.") (li "If nothing matches an exception of type " (tt "bitstring-match-failure") " is raised.") (li "Supports special pattern for concatenating bitstrings.")) (dl (dt "((EXPRESSION ...) bitstring)") (dd "EXPRESSION should evaluate to bitstring during constructing.")))
(def (sig (syntax "(bitpacket PACKET-NAME fields ...)" (id bitpacket))) (p "Define well-known set of fields. Fields syntax the same as bitmatch pattern syntax."))
(def (sig (procedure "(bitstring=? bitstring1 bitstring2)" (id bitstring=?))) (p "Compare bitstrings."))
(def (sig (procedure "(bitstring-bit-set? bitstring bit-index)" (id bitstring-bit-set?))) (p "Test bit value at " (tt "bit-index") " position.") (p "(bitstring-bit-set? (->bitstring '#${80 00}) 0) => #t (bitstring-bit-set? (->bitstring '#${00 01}) -1) => #t"))
(def (sig (procedure "(bitstring->list bitstring [bits [byte-order]])" (id bitstring->list))) (p "Convert bitstring to list of bits.") (p "Optional group " (tt "bits") ", default value 1, indicates how many bits each entry in the list should span.  For example, to see the contents grouped by octet, use 8 here.") (p "Optional " (tt "byte-order") " " (tt "'little") " - little-endian, " (tt "'big") " - big-endian, " (tt "'host") " host system byte-order, default value " (tt "'big") ".  This has an effect only if " (tt "bit") " is larger than 8."))
(def (sig (procedure "(bitstring-reverse bitstring [bits [byte-order]])" (id bitstring-reverse))) (p "Reverse bitstring, optional group " (tt "bits") " (default 1) with " (tt "byte-order") " (default " (tt "'big") ").") (p "(bitstring-reverse (->bitstring '#${01 02}) 1) => #${40 80}") (p "(bitstring-reverse (->bitstring '#${01 02}) 8 little) => #${02 01}"))
(def (sig (procedure "(bitstring-not bitstring)" (id bitstring-not))) (p "Invert each bit value.") (p "(bitstring-not (->bitstring '#${FE 00})) => #${01 FF}"))
(def (sig (procedure "(bitstring? obj)" (id bitstring?))) (p "Returns " (tt "#t") " or " (tt "#f") " depending on whether " (tt "obj") " is a bitstring or another type of object."))
(def (sig (procedure "(bitstring-length bitstring)" (id bitstring-length))) (p "Return length of the bitstring in bits."))
(def (sig (procedure "(bitstring-append bitstring1 bitstringN ...)" (id bitstring-append))) (p "Concatenate bitstrings."))
(def (sig (procedure "(bitstring-append! dest-bitstring bitstringN ...)" (id bitstring-append!))) (p "Concatenate bitstrings, and store result into dest-bitstring."))
(def (sig (procedure "(->bitstring obj)" (id ->bitstring))) (p "Construct bitstring from arbitrary object."))
(def (sig (procedure "(vector->bitstring vec)" (id vector->bitstring))) (p "Each element of vector " (tt "vec") " should be integer in range of 0 - 255."))
(def (sig (procedure "(u8vector->bitstring vec)" (id u8vector->bitstring)) (procedure "(string->bitstring str)" (id string->bitstring))))
(def (sig (procedure "(bitstring->blob bitstring [zero-extendind])" (id bitstring->blob)) (procedure "(bitstring->u8vector bitstring [zero-extendind])" (id bitstring->u8vector))) (p "If bitstring not aligned on 8 bit boundary rest bits extending with zeroes. " (tt "zero-extendind") " optional argument, " (tt "'left") " you get an integer value of rest bit, " (tt "'right") " give you internal bitstring repsesentation where bits follow one by one, default value " (tt "'left") ".") (p "zero-extending to left <bitstring 0 9 (1 1 1 1 1 1 1 1 1)> turn into #u8(#xff #x01)") (p "zero-extending to right, this might be usefull when you want to store your string to the disc and then load back. <bitstring 0 9 (1 1 1 1 1 1 1 1 1)> turn into #u8(#xff #x80)"))
