X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fexternal-formats%2Fucs-2.lisp;h=1d15d10ef912d0aa482b458998a15584b543df99;hb=927856d3c6db92a0fff279a15eae303bdf4a7820;hp=fc1d4bd4546be63e5fcc79e71416935d58b6c4bf;hpb=7effaab5d43dd5423938b00854848e01eb3a67c8;p=sbcl.git diff --git a/src/code/external-formats/ucs-2.lisp b/src/code/external-formats/ucs-2.lisp index fc1d4bd..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 #!+win32 :ucs2 #!+win32 :ucs-2) nil - 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))) - -(define-external-format/variable-width (:ucs-2be :ucs2be) nil - 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))) - - -;;; ;;; octets ;;; @@ -209,8 +189,24 @@ (instantiate-octets-definition define-ucs-2->string) -(add-external-format-funs '(:ucs-2le :ucs2le #!+win32 :ucs2 #!+win32 :ucs-2) - '(ucs-2le->string-aref string->ucs-2le)) +(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) -(add-external-format-funs '(:ucs-2be :ucs2be) - '(ucs-2be->string-aref string->ucs-2be)) +(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)