Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

blob-utils

  1. Outdated egg!
  2. blob-utils
  3. Documentation
    1. Usage
    2. bytes->hexstring
    3. bytes-set-u8
    4. bytes-set-s8
    5. bytes-set-u16
    6. bytes-set-s16
    7. bytes-set-u32
    8. bytes-set-s32
    9. bytes-set-u64
    10. bytes-set-s64
    11. Blob Hexadecimal
      1. Usage
      2. blob->hex
    12. Blob Set Int
      1. Usage
      2. blob-set-u8!
      3. blob-set-u16-le!
      4. blob-set-u16-be!
      5. blob-set-u32-le!
      6. blob-set-u32-be!
      7. blob-set-u64-le!
      8. blob-set-u64-be!
      9. *blob-set-u8!
      10. *blob-set-u16-le!
      11. *blob-set-u16-be!
      12. *blob-set-u32-le!
      13. *blob-set-u32-be!
      14. *blob-set-u64-le!
      15. *blob-set-u64-be!
    13. Pack Integer
      1. Usage
      2. pack-u8
      3. pack-u16
      4. pack-u32
      5. pack-u64
      6. pack-integer
  4. Notes
  5. Requirements
  6. Author
  7. Version history
  8. License

Documentation

Usage

(require-extension blob-utils)

bytes->hexstring

[procedure] (bytes->hexstring BV [START [END]]) -> string

Returns a hexadecimal represenation of BV.

BV
(or string blob srfi-4-vector)
START
fixnum ; 0..<last>
END
fixnum ; 0..<end>

bytes-set-u8

bytes-set-s8

[procedure] (bytes-set-u8! BV IDX UINT)
[procedure] (bytes-set-s8! BV IDX INT)
BV
(or string blob srfi-4-vector)
IDX
fixnum ; 0..<last>
UINT
fixnum ; 0..(2^8)-1
INT
fixnum ; -(2^7)..(2^7)-1

bytes-set-u16

bytes-set-s16

[procedure] (bytes-set-u16! BV IDX UINT)
[procedure] (bytes-set-s16! BV IDX INT)
BV
(or string blob srfi-4-vector)
IDX
fixnum ; 0..<last>
UINT
fixnum ; 0..(2^16)-1
INT
fixnum ; -(2^15)..(2^15)-1

bytes-set-u32

bytes-set-s32

[procedure] (bytes-set-u32! BV IDX UINT)
[procedure] (bytes-set-s32! BV IDX INT)
BV
(or string blob srfi-4-vector)
IDX
fixnum ; 0..<last>
UINT
number ; 0..(2^32)-1
INT
number ; -(2^31)..(2^31)-1

bytes-set-u64

bytes-set-s64

[procedure] (bytes-set-u64! BV IDX UINT)
[procedure] (bytes-set-s64! BV IDX INT)
BV
(or string blob srfi-4-vector)
IDX
fixnum ; 0..<last>
UINT
number ; 0..(2^64)-1
INT
number ; -(2^63)..(2^63)-1

Blob Hexadecimal

Blob representation as a hexadecimal string.

Usage

(require-extension blob-hexadecimal)

blob->hex

[procedure] (blob->hex BLOB [START [END]]) -> string

Returns a hexadecimal represenation of the BLOB bytes.

BLOB
blob
START
fixnum ; 0..<last>
END
fixnum ; 0..<end>

Blob Set Int

Stuff integers into a blob.

Usage

(require-extension blob-set-int)

blob-set-u8!

[procedure] (blob-set-u8! BLOB N [(OFFSET 0)])

Sets the byte at OFFSET to N in BLOB.

blob-set-u16-le!

[procedure] (blob-set-u16-le! BLOB N [(OFFSET 0)])

Sets the 2 bytes at OFFSET to N in BLOB using little-endian byte order.

blob-set-u16-be!

[procedure] (blob-set-u16-be! BLOB N [(OFFSET 0)])

Sets the 2 bytes at OFFSET to N in BLOB using big-endian byte order.

blob-set-u32-le!

[procedure] (blob-set-u32-le! BLOB N [(OFFSET 0)])

Sets the 4 bytes at OFFSET to N in BLOB using little-endian byte order.

blob-set-u32-be!

[procedure] (blob-set-u32-be! BLOB N [(OFFSET 0)])

Sets the 4 bytes at OFFSET to N in BLOB using big-endian byte order.

blob-set-u64-le!

[procedure] (blob-set-u64-le! BLOB N [(OFFSET 0)])

Sets the 8 bytes at OFFSET to N in BLOB using little-endian byte order.

blob-set-u64-be!

[procedure] (blob-set-u64-be! BLOB N [(OFFSET 0)])

Sets the 8 bytes at OFFSET to N in BLOB using big-endian byte order.

*blob-set-u8!

[procedure] (*blob-set-u8! BLOB N OFFSET)

Sets the byte at OFFSET to N in BLOB.

Performs no argument checking.

*blob-set-u16-le!

[procedure] (*blob-set-u16-le! BLOB N OFFSET)

Sets the 2 bytes at OFFSET to N in BLOB using little-endian byte order.

Performs no argument checking.

*blob-set-u16-be!

[procedure] (*blob-set-u16-be! BLOB N OFFSET)

Sets the 2 bytes at OFFSET to N in BLOB using big-endian byte order.

Performs no argument checking.

*blob-set-u32-le!

[procedure] (*blob-set-u32-le! BLOB N OFFSET)

Sets the 4 bytes at OFFSET to N in BLOB using little-endian byte order.

Performs no argument checking.

*blob-set-u32-be!

[procedure] (*blob-set-u32-be! BLOB N OFFSET)

Sets the 4 bytes at OFFSET to N in BLOB using big-endian byte order.

Performs no argument checking.

*blob-set-u64-le!

[procedure] (*blob-set-u64-le! BLOB N OFFSET)

Sets the 8 bytes at OFFSET to N in BLOB using little-endian byte order.

Performs no argument checking.

*blob-set-u64-be!

[procedure] (*blob-set-u64-be! BLOB N OFFSET)

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.

Usage

(require-extension pack-integer)

pack-u8

[procedure] (pack-u8 N [kind: KIND] [start: START]) -> (or string blob u8vector)

Returns the number N packed into an object of KIND, at position START.

KIND
(or symbol (or string blob u8vector))
START
fixnum ; 0..<last>

pack-u16

[procedure] (pack-u16 N [kind: KIND] [start: START] [order: ORDER]) -> (or string blob u8vector)

Returns the number N packed into an object of KIND, at position START.

KIND
(or symbol (or string blob u8vector))
START
fixnum ; (<= 0 ...)
ORDER
symbol ; big-endian be big little-endian le little

pack-u32

[procedure] (pack-u32 N [kind: KIND] [start: START] [order: ORDER]) -> (or string blob u8vector)

Returns the number N packed into an object of KIND, at position START.

KIND
(or symbol (or string blob u8vector))
START
fixnum ; (<= 0 ...)
ORDER
symbol ; big-endian be big little-endian le little

pack-u64

[procedure] (pack-u64 N [kind: KIND] [start: START] [order: ORDER]) -> (or string blob u8vector)

Returns the number N packed into an object of KIND, at position START.

KIND
(or symbol (or string blob u8vector))
START
fixnum ; (<= 0 ...)
ORDER
symbol ; big-endian be big little-endian le little

pack-integer

[procedure] (pack-integer N [kind: KIND] [start: START] [order: ORDER]) -> (or string blob u8vector)

Returns the number N packed into an object of KIND, at position START.

KIND
(or symbol (or string blob u8vector))
START
fixnum ; (<= 0 ...)
ORDER
symbol ; big-endian be big little-endian le little

Notes

Requirements

string-utils check-errors

setup-helper test

Author

Kon Lovett

Version history

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-2018 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.