char-to-octets

Macro

Package: excl

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.

Examples:

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

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.