| Allegro CL version 6.2 Unrevised from 6.1 | |||||||||
Arguments: ef-name char state-loc &key put-next-octet external-format
ef-name should be a symbol. char should be a character. state-loc should be a place suitable as the first argument to setf. put-next-octet should be a form. external-format should be an external-format object or symbol naming an external-format.
The char-to-octets macro expands to the macro stored in the char-to-octets-macro slot of the external-format named by name. See the description of def-char-to-octets-macro for descriptions the return value of the of the macro's expansion as well as of the get-next-char, put-next-octet, and external-format arguments.
Users generally do not need to invoke the char-to-octets macro. In most cases, it is more convenient to use string-to-octets.
(let ((utf8-vector (make-array 10
:element-type '(unsigned-byte 8)
:initial-element 255))
(state nil)
(str "hello"))
(do ((s 0 (1+ start-s))
(start-s 0 s)
(v 0))
((>= s (length str)) utf8-vector)
(char-to-octets :utf8 (prog1 (schar str s) (incf s)) state
:put-next-octet (lambda (b)
(setf (aref utf8-vector v) b)
(incf v)))))
==> #(104 101 108 108 111 255 255 255 255 255)
See iacl.htm for more information on international character support in Allegro CL.
Copyright (c) 1998-2002, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 6.2. This page was not revised from the 6.1 page.
Created 2002.2.26.
| Allegro CL version 6.2 Unrevised from 6.1 | |||||||||