chickadee » endian-blob

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.

endian-blob

Description

endian-blob is a library of endian-specific procedures for converting blobs to numeric values and vectors.

Library Procedures

Predicates and constants

endian-blob? Xprocedure

Returns #t if the given object is an endian blob, #f otherwise.

  • MSB
  • LSB

These constants specify most-significant or least-significant byte order, respectively.

Converting to and from byte blobs

byte-blob->endian-blob BYTE-BLOB BYTE-ORDERprocedure

Returns an endian blob containing the given byte-blob. Argument BYTE-ORDER is one of MSB or LSB.

Converting to and from numbers and numeric vectors

endian-blob->sint1 ENDIAN-BLOBprocedure
endian-blob->sint2 ENDIAN-BLOBprocedure
endian-blob->sint4 ENDIAN-BLOBprocedure
(sint1->endian-blob NUMBER [* MODE]) => ENDIAN-BLOBprocedure
(sint2->endian-blob NUMBER [* MODE]) => ENDIAN-BLOBprocedure
(sint4->endian-blob NUMBER [* MODE]) => ENDIAN-BLOBprocedure

These procedures convert between endian blobs and signed integers of size 1, 2, or 4 bytes, respectively. Exceptions are thrown if the given endian blobs are of incorrect size, or if the given numbers are too big to fit in the specified size. Optional argument MODE indicates the endianness of the resulting endian blob and can be one of MSBB or LSB. Default is MSB.

endian-blob->uint1 ENDIAN-BLOBprocedure
endian-blob->uint2 ENDIAN-BLOBprocedure
endian-blob->uint4 ENDIAN-BLOBprocedure
(uint1->endian-blob NUMBER [* MODE]) => ENDIAN-BLOBprocedure
(uint2->endian-blob NUMBER [* MODE]) => ENDIAN-BLOBprocedure
(uint4->endian-blob NUMBER [* MODE]) => ENDIAN-BLOBprocedure

These procedures convert between endian blobs and unsigned integers of size 1, 2, or 4 bytes, respectively. Exceptions are thrown if the given endian blobs are of incorrect size, or if the given numbers are too big to fit in the specified size. Optional argument MODE indicates the endianness of the resulting endian blob and can be one of MSBB or LSB. Default is MSB.

endian-blob->ieee_float32 ENDIAN-BLOBprocedure
endian-blob->ieee_float64 ENDIAN-BLOBprocedure
(ieee_float32->endian-blob NUMBER [* MODE]) => ENDIAN-BLOBprocedure
(ieee_float64->endian-blob NUMBER [* MODE]) => ENDIAN-BLOBprocedure

These procedures convert between endian blobs and IEEE floating point numbers of single or double precision, respectively. Exceptions are thrown if the given endian blobs are of incorrect size, or if the given numbers are too big to fit in the specified size. Optional argument MODE indicates the endianness of the resulting endian blob and can be one of MSBB or LSB. Default is MSB.

endian-blob->s8vector ENDIAN-BLOBprocedure
endian-blob->s16vector ENDIAN-BLOBprocedure
endian-blob->s32vector ENDIAN-BLOBprocedure
endian-blob->u8vector ENDIAN-BLOBprocedure
endian-blob->u16vector ENDIAN-BLOBprocedure
endian-blob->u32vector ENDIAN-BLOBprocedure
endian-blob->f32vector ENDIAN-BLOBprocedure
endian-blob->f64vector ENDIAN-BLOBprocedure
(s8vector->endian-blob S8VECTOR [* MODE]) => ENDIAN-BLOBprocedure
(s16vector->endian-blob S16VECTOR [* MODE]) => ENDIAN-BLOBprocedure
(s32vector->endian-blob S32VECTOR [* MODE]) => ENDIAN-BLOBprocedure
(u8vector->endian-blob U8VECTOR [* MODE]) => ENDIAN-BLOBprocedure
(u16vector->endian-blob U16VECTOR [* MODE]) => ENDIAN-BLOBprocedure
(u32vector->endian-blob U32VECTOR [* MODE]) => ENDIAN-BLOBprocedure
(f32vector->endian-blob F32VECTOR [* MODE]) => ENDIAN-BLOBprocedure
(f64vector->endian-blob F64VECTOR [* MODE]) => ENDIAN-BLOBprocedure

These procedures convert between endian blobs and the corresponding SRFI-4 vector type. Optional argument MODE indicates the endianness of the resulting endian blob and can be one of MSBB or LSB. Default is MSB.

Version History

License

Copyright 2009-2012 Ivan Raikov.

endian-port is based on routines from the C++ advanced I/O library and TIFF reader written by Oleg Kiselyov, as well as the floating-point I/O routines from GDB.

endian-port is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

endian-port is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

A full copy of the GPL license can be found at <http://www.gnu.org/licenses/>.

Contents »