blob-utils
TOC »
Documentation
Blob Utils
- BV
- (or string blob srfi-4-vector)
- IDX
- fixnum ; {(<= 0 ...)}
The inclusion of string in BV is deprecated.
Usage
(import blob-utils)
bytes->hexstring
- bytes->hexstring BV #!optional START ENDprocedure
Returns a hexadecimal represenation of BV.
- START
- fixnum ; {(<= 0 ...)}
- END
- fixnum ; {(<= START ...)}
bytes-set-u8
bytes-set-s8
- bytes-set-u8! BV IDX UINTprocedure
- bytes-set-s8! BV IDX INTprocedure
- UINT
- fixnum ; 0..(2^8)-1
- INT
- fixnum ; -(2^7)..(2^7)-1
bytes-set-u16
bytes-set-s16
- bytes-set-u16! BV IDX UINTprocedure
- bytes-set-s16! BV IDX INTprocedure
- UINT
- fixnum ; 0..(2^16)-1
- INT
- fixnum ; -(2^15)..(2^15)-1
bytes-set-u32
bytes-set-s32
- bytes-set-u32! BV IDX UINTprocedure
- bytes-set-s32! BV IDX INTprocedure
- UINT
- number ; 0..(2^32)-1
- INT
- number ; -(2^31)..(2^31)-1
bytes-set-u64
bytes-set-s64
- bytes-set-u64! BV IDX UINTprocedure
- bytes-set-s64! BV IDX INTprocedure
- UINT
- number ; 0..(2^64)-1
- INT
- number ; -(2^63)..(2^63)-1
Blob Hexadecimal
Blob representation as a hexadecimal string.
Usage
(import blob-hexadecimal)
blob->hex
- blob->hex BLOB #!optional START ENDprocedure
Returns a hexadecimal represenation of the BLOB bytes.
- BLOB
- blob
- START
- fixnum ; {(<= 0 ...)}
- END
- fixnum ; {(<= 0 ...)}
Blob Set Int
Stuff integers into a blob.
Usage
(import blob-set-int)
blob-set-u8!
- (blob-set-u8! BLOB N [(OFFSET 0)])procedure
Sets the byte at OFFSET to N in BLOB.
blob-set-u16-le!
- (blob-set-u16-le! BLOB N [(OFFSET 0)])procedure
Sets the 2 bytes at OFFSET to N in BLOB using little-endian byte order.
blob-set-u16-be!
- (blob-set-u16-be! BLOB N [(OFFSET 0)])procedure
Sets the 2 bytes at OFFSET to N in BLOB using big-endian byte order.
blob-set-u32-le!
- (blob-set-u32-le! BLOB N [(OFFSET 0)])procedure
Sets the 4 bytes at OFFSET to N in BLOB using little-endian byte order.
blob-set-u32-be!
- (blob-set-u32-be! BLOB N [(OFFSET 0)])procedure
Sets the 4 bytes at OFFSET to N in BLOB using big-endian byte order.
blob-set-u64-le!
- (blob-set-u64-le! BLOB N [(OFFSET 0)])procedure
Sets the 8 bytes at OFFSET to N in BLOB using little-endian byte order.
blob-set-u64-be!
- (blob-set-u64-be! BLOB N [(OFFSET 0)])procedure
Sets the 8 bytes at OFFSET to N in BLOB using big-endian byte order.
*blob-set-u8!
- *blob-set-u8! BLOB N OFFSETprocedure
Sets the byte at OFFSET to N in BLOB.
Performs no argument checking.
*blob-set-u16-le!
- *blob-set-u16-le! BLOB N OFFSETprocedure
Sets the 2 bytes at OFFSET to N in BLOB using little-endian byte order.
Performs no argument checking.
*blob-set-u16-be!
- *blob-set-u16-be! BLOB N OFFSETprocedure
Sets the 2 bytes at OFFSET to N in BLOB using big-endian byte order.
Performs no argument checking.
*blob-set-u32-le!
- *blob-set-u32-le! BLOB N OFFSETprocedure
Sets the 4 bytes at OFFSET to N in BLOB using little-endian byte order.
Performs no argument checking.
*blob-set-u32-be!
- *blob-set-u32-be! BLOB N OFFSETprocedure
Sets the 4 bytes at OFFSET to N in BLOB using big-endian byte order.
Performs no argument checking.
*blob-set-u64-le!
- *blob-set-u64-le! BLOB N OFFSETprocedure
Sets the 8 bytes at OFFSET to N in BLOB using little-endian byte order.
Performs no argument checking.
*blob-set-u64-be!
- *blob-set-u64-be! BLOB N OFFSETprocedure
Sets the 8 bytes at OFFSET to N in BLOB using big-endian byte order.
Performs no argument checking.
Pack Integer
Set integer in blob.
- PACK
- (or string blob u8vector)
- KIND
- (or symbol PACK) ; symbol from (string blob u8vector)
- START
- fixnum ; (<= 0 ...)
- ORDER
- symbol ; big-endian be big little-endian le little
The pack functions are pure or mutating depending on the KIND.
The inclusion of string in KIND & PACK is deprecated.
Usage
(import pack-integer)
pack-u8
- (pack-u8 N [kind: KIND] [start: START]) -> PACKprocedure
Returns the number N packed into an object of KIND, at position START.
pack-u16
- (pack-u16 N [kind: KIND] [start: START] [order: ORDER]) -> PACKprocedure
Returns the number N packed into an object of KIND, at position START.
pack-u32
- (pack-u32 N [kind: KIND] [start: START] [order: ORDER]) -> PACKprocedure
Returns the number N packed into an object of KIND, at position START.
pack-u64
- (pack-u64 N [kind: KIND] [start: START] [order: ORDER]) -> PACKprocedure
Returns the number N packed into an object of KIND, at position START.
pack-integer
- (pack-integer N [kind: KIND] [start: START] [order: ORDER]) -> PACKprocedure
Returns the number N packed into an object of KIND, at position START.
Notes
- The pack-int & blob-utils APIs overlap.
- The pack-int API should be bit-indexed.
Requirements
Author
Repository
This egg is hosted on the CHICKEN Subversion repository:
https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/blob-utils
If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.
Version history
- 2.0.1
- Fix pack-integer single-byte case.
- 2.0.0
- CHICKEN 5 release.
- 1.2.0
- Added blob-utils module.
- 1.1.0
- Added pack-integer module.
- 1.0.4
- 1.0.3
- Reverted 64 bit support.
- 1.0.2
- Removed 64 bit support.
- 1.0.1
- 1.0.0
- Hello (Some from string-utils)
License
Copyright (C) 2012-2020 Kon Lovett. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.