... |
... |
@@ -133,7 +133,8 @@ |
133
|
133
|
(setf (gethash (ef-name ef) *external-formats*) ef))
|
134
|
134
|
|
135
|
135
|
(declaim (inline ef-octets-to-code ef-code-to-octets ef-flush-state ef-copy-state
|
136
|
|
- ef-cache ef-min-octets ef-max-octets))
|
|
136
|
+ ef-cache ef-min-octets ef-max-octets
|
|
137
|
+ ef-octet-count))
|
137
|
138
|
|
138
|
139
|
(defun ef-octets-to-code (ef)
|
139
|
140
|
(efx-octets-to-code (ef-efx ef)))
|
... |
... |
@@ -176,7 +177,7 @@ |
176
|
177
|
;;; DEFINE-EXTERNAL-FORMAT -- Public
|
177
|
178
|
;;;
|
178
|
179
|
;;; name (&key base min max size documentation) (&rest slots) octets-to-code
|
179
|
|
-;;; code-to-octets flush-state copy-state
|
|
180
|
+;;; code-to-octets flush-state copy-state octet-count
|
180
|
181
|
;;;
|
181
|
182
|
;;; Define a new external format. If base is specified, then an
|
182
|
183
|
;;; external format is defined that is based on a previously defined
|
... |
... |
@@ -238,6 +239,15 @@ |
238
|
239
|
;;; This should probably be a deep copy so that if the original
|
239
|
240
|
;;; state is modified, the copy is not.
|
240
|
241
|
;;;
|
|
242
|
+;;; octet-count (code state error &rest vars)
|
|
243
|
+;;; Defines a form to determine the number of octets needed to
|
|
244
|
+;;; encode the given CODE using the external format. This is
|
|
245
|
+;;; essentially the same as CODE-TO-OCTETS, except the encoding is
|
|
246
|
+;;; not saved anywhere. ERROR is the same as in CODE-TO-OCTETS.
|
|
247
|
+;;;
|
|
248
|
+;;; This should return one value: the number of octets needed to
|
|
249
|
+;;; encode the given code.
|
|
250
|
+;;;
|
241
|
251
|
;;; Note: external-formats work on code-points, not
|
242
|
252
|
;;; characters, so that the entire 31 bit ISO-10646 range can be
|
243
|
253
|
;;; used internally regardless of the size of a character recognized
|