All Manuals > LispWorks® User Guide and Reference Manual > 36 The EXTERNAL-FORMAT Package

:bmp

:bmp-native

:bmp-reversed External Formats

Summary

Implement reading and writing of 16-bit characters only (excluding supplementary characters).

Package

keyword

Signatures

:bmp &key use-replacement little-endian

:bmp-native &key use-replacement

:bmp-reversed &key use-replacement

Arguments
use-replacement
A generalized boolean.
little-endian
A generalized boolean.
Description

The external format :bmp and its variants implement reading and writing of 16-bit characters only (excluding supplementary characters).

:bmp-native and :bmp-reversed are the actual implementation formats. They implement reading and writing 16-bit characters with the native byte order (:bmp-native) or the reversed byte order (:bmp-reversed).

:bmp implements reading and writing 16-bit characters with control over the byte order. This format maps to either :bmp-native or :bmp-reversed as appropriate.

If little-endian is supplied, it determines the byte order. Otherwise, if it is used for opening a file, LispWorks checks whether the file starts with the BOM (Byte Order Mark), and if so it uses it. Otherwise the native byte order is used. LispWorks uses the required byte order and the native byte order of the computer it executes on to decide whether to use :bmp-native or :bmp-reversed.

When writing, these :bmp external formats signal an error when trying to write supplementary characters (code greater than #xffff).

:bmp cannot read surrogate code points. When encountering a surrogate code point it either signals an error (the default), or if use-replacement is non-nil, replaces it with the replacement character. When use-replacement is non-nil, these external formats never signal an error when reading.

Compatibility note:

These formats were new in LispWorks 7.0. In LispWorks 6.1 and earlier versions :unicode is the external format to read 16-bit characters. Other than the treatment of surrogate code points, :bmp now does what :unicode used to do.

See also

26.6 External Formats to translate Lisp characters from/to external encodings
26.6.2 16-bit External formats guide


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:34