X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fexternal-formats%2Fucs-2.lisp;h=1d15d10ef912d0aa482b458998a15584b543df99;hb=927856d3c6db92a0fff279a15eae303bdf4a7820;hp=4375114f03b9188d166afb16443a946a4b400bd0;hpb=01e9e8c568777d6480699e6cb3947f38c3bed350;p=sbcl.git diff --git a/src/code/external-formats/ucs-2.lisp b/src/code/external-formats/ucs-2.lisp index 4375114..1d15d10 100644 --- a/src/code/external-formats/ucs-2.lisp +++ b/src/code/external-formats/ucs-2.lisp @@ -34,26 +34,6 @@ (sap-ref-8 sap offset) (ldb (byte 8 8) value))) ;;; -;;; Define external format: fd-stream -;;; -(define-external-format/variable-width (:ucs-2le :ucs2le) nil - 2 - (if (< bits #x10000) - (setf (sap-ref-16le sap tail) bits) - (stream-encoding-error-and-handle stream bits)) - 2 - (code-char (sap-ref-16le sap head))) - -(define-external-format/variable-width (:ucs-2be :ucs2be) nil - 2 - (if (< bits #x10000) - (setf (sap-ref-16be sap tail) bits) - (stream-encoding-error-and-handle stream bits)) - 2 - (code-char (sap-ref-16be sap head))) - - -;;; ;;; octets ;;; @@ -209,10 +189,24 @@ (instantiate-octets-definition define-ucs-2->string) -(pushnew '((:ucs-2le :ucs2le) - ucs-2le->string-aref string->ucs-2le) - *external-format-functions*) +(define-external-format/variable-width (:ucs-2le :ucs2le #!+win32 :ucs2 #!+win32 :ucs-2) t + (code-char #xfffd) + 2 + (if (< bits #x10000) + (setf (sap-ref-16le sap tail) bits) + (external-format-encoding-error stream bits)) + 2 + (code-char (sap-ref-16le sap head)) + ucs-2le->string-aref + string->ucs-2le) -(pushnew '((:ucs-2be :ucs2be) - ucs-2be->string-aref string->ucs-2be) - *external-format-functions*) +(define-external-format/variable-width (:ucs-2be :ucs2be) t + (code-char #xfffd) + 2 + (if (< bits #x10000) + (setf (sap-ref-16be sap tail) bits) + (external-format-encoding-error stream bits)) + 2 + (code-char (sap-ref-16be sap head)) + ucs-2be->string-aref + string->ucs-2be)