On this page:
2.1 Endianness Controls
packing-big-endian?
big-endian/ p
little-endian/ p
native-endian/ p
2.2 Integers
integer/ p
int8/ p
sint8/ p
uint8/ p
int16/ p
sint16/ p
uint16/ p
int32/ p
sint32/ p
uint32/ p
int64/ p
sint64/ p
uint64/ p
byte/ p
sbyte/ p
ubyte/ p
short/ p
sshort/ p
ushort/ p
int/ p
sint/ p
uint/ p
long/ p
slong/ p
ulong/ p
2.3 Reals
real/ p
float/ p
double/ p
2.4 Derived Types
character/ p
char/ p
wchar/ p
bool/ p

2 Numeric Packings

    2.1 Endianness Controls

    2.2 Integers

    2.3 Reals

    2.4 Derived Types

 (require (planet "number.ss" ("murphy" "packed-io.plt" 1 0)))
This module provides packings of data represented as numeric values of a fixed size.

2.1 Endianness Controls

(packing-big-endian?)  any/c
(packing-big-endian? v)  void?
  v : any/c
Parameter that determines whether data is stored in big-endian format during packing or unpacking.

Defaults to the system’s native endianness (system-big-endian?).

(big-endian/p packing)  packing?
  packing : packing?
Produces a wrapped version of packing that sets (packing-big-endian? #t) while packing or unpacking.

(little-endian/p packing)  packing?
  packing : packing?
Produces a wrapped version of packing that sets (packing-big-endian? #f) while packing or unpacking.

(native-endian/p packing)  packing?
  packing : packing?
Produces a wrapped version of packing that sets (packing-big-endian? (system-big-endian?)) while packing or unpacking.

2.2 Integers

(integer/p size signed?)  packing?
  size : (or/c 1 2 4 8)
  signed? : any/c
Produces a packing for integral numbers into size bytes. signed? determines whether the packed values are signed or unsigned.

int8/p : packing?
sint8/p : packing?
uint8/p : packing?
int16/p : packing?
sint16/p : packing?
uint16/p : packing?
int32/p : packing?
sint32/p : packing?
uint32/p : packing?
int64/p : packing?
sint64/p : packing?
uint64/p : packing?
Standard integer packings with 8, 16, 32 and 64 bits representation size. The packings whose names start with u are unsigned, the others are signed.

byte/p : packing?
sbyte/p : packing?
ubyte/p : packing?
short/p : packing?
sshort/p : packing?
ushort/p : packing?
int/p : packing?
sint/p : packing?
uint/p : packing?
long/p : packing?
slong/p : packing?
ulong/p : packing?
Aliases for the standard integer packings with friendly names: byte is 8 bits, short is 16 bits, int is 32 bits and long is 64 bits.

2.3 Reals

(real/p size)  packing?
  size : (or/c 4 8)
Produces a packing for IEEE floating point numbers into size bytes.

float/p : packing?
double/p : packing?
Standard floating point packings: float/p has 32 bits, double/p has 64 bits representation size.

2.4 Derived Types

(character/p size)  packing?
  size : (or/c 1 2 4 8)
Produces a packing of characters as size bytes long unsigned integers.

char/p : packing?
wchar/p : packing?
Standard character packings: char/p has 8 bits, wchar/p has 16 bits representation size.

bool/p : packing?
Single byte packing of boolean values. #f is represented by 0, any other value maps to 1 while packing and any other packed number maps to #t when unpacking.