Skip to content
Snippets Groups Projects
Commit eb2d88f7 authored by rtoy's avatar rtoy
Browse files

Update external formats to include the new required error parameter

for octets-to-code and code-to-octets.
parent 1fdc1491
No related branches found
No related tags found
No related merge requests found
Showing with 33 additions and 33 deletions
......@@ -4,7 +4,7 @@
;;; This code was written by Paul Foley and has been placed in the public
;;; domain.
;;;
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/iso8859-1.lisp,v 1.3 2009/06/11 16:04:02 rtoy Rel $")
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/iso8859-1.lisp,v 1.4 2010/06/30 04:02:53 rtoy Exp $")
(in-package "STREAM")
......@@ -14,7 +14,7 @@
(define-external-format :iso8859-1 (:size 1)
()
(octets-to-code (state input unput)
(octets-to-code (state input unput error)
(values ,input 1))
(code-to-octets (code state output)
(code-to-octets (code state output error)
(,output (if (> ,code 255) #x3F ,code))))
......@@ -4,7 +4,7 @@
;;; This code was written by Paul Foley and has been placed in the public
;;; domain.
;;;
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/iso8859-2.lisp,v 1.2 2009/06/11 16:04:02 rtoy Rel $")
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/iso8859-2.lisp,v 1.3 2010/06/30 04:02:53 rtoy Exp $")
(in-package "STREAM")
......@@ -23,10 +23,10 @@
((table +iso-8859-2+ :type (simple-array (unsigned-byte 16) (96)))
(itable (invert-table table) :type lisp::ntrie16))
(octets-to-code (state input unput code)
(octets-to-code (state input unput error code)
`(let ((,code ,input))
(values (if (< ,code 160) ,code (aref ,table (- ,code 160))) 1)))
(code-to-octets (code state output present)
(code-to-octets (code state output error present)
`(,output (if (< ,code 160)
,code
(let ((,code (get-inverse ,itable ,code)))
......
......@@ -4,7 +4,7 @@
;;; This code was written by Paul Foley and has been placed in the public
;;; domain.
;;;
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/mac-roman.lisp,v 1.3 2009/06/21 14:33:07 rtoy Rel $")
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/mac-roman.lisp,v 1.4 2010/06/30 04:02:53 rtoy Exp $")
(in-package "STREAM")
......@@ -28,10 +28,10 @@
((table +mac-roman+ :type (simple-array (unsigned-byte 16) (128)))
(itable (invert-table table) :type lisp::ntrie16))
(octets-to-code (state input unput code)
(octets-to-code (state input unput error code)
`(let ((,code ,input))
(values (if (< ,code 128) ,code (aref ,table (- ,code 128))) 1)))
(code-to-octets (code state output present)
(code-to-octets (code state output error present)
`(,output (if (< ,code 128)
,code
(let ((,code (get-inverse ,itable ,code)))
......
......@@ -4,7 +4,7 @@
;;; This code was written by Paul Foley and has been placed in the public
;;; domain.
;;;
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-16-be.lisp,v 1.4 2009/10/18 14:21:24 rtoy Exp $")
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-16-be.lisp,v 1.5 2010/06/30 04:02:53 rtoy Exp $")
(in-package "STREAM")
......@@ -13,7 +13,7 @@
(define-external-format :utf-16-be (:size 2)
()
(octets-to-code (state input unput c1 c2 code next)
(octets-to-code (state input unput error c1 c2 code next)
`(let* ((,c1 ,input)
(,c2 ,input)
(,code (+ (* 256 ,c1) ,c2)))
......@@ -48,7 +48,7 @@
(setf ,code +replacement-character-code+))
(t (setf ,state nil)))
(values ,code 2)))
(code-to-octets (code state output c c1 c2)
(code-to-octets (code state output error c c1 c2)
`(flet ((output (code)
(,output (ldb (byte 8 8) code))
(,output (ldb (byte 8 0) code))))
......
......@@ -4,7 +4,7 @@
;;; This code was written by Paul Foley and has been placed in the public
;;; domain.
;;;
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-16-le.lisp,v 1.4 2009/10/18 14:21:24 rtoy Exp $")
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-16-le.lisp,v 1.5 2010/06/30 04:02:53 rtoy Exp $")
(in-package "STREAM")
......@@ -14,7 +14,7 @@
(define-external-format :utf-16-le (:size 2)
()
(octets-to-code (state input unput c1 c2 code next)
(octets-to-code (state input unput error c1 c2 code next)
`(let* ((,c1 ,input)
(,c2 ,input)
(,code (+ (* 256 ,c2) ,c1)))
......@@ -49,7 +49,7 @@
(error "Illegal character U+FFFE in UTF-16 sequence."))
(t (setf ,state nil)))
(values ,code 2)))
(code-to-octets (code state output c c1 c2)
(code-to-octets (code state output error c c1 c2)
`(flet ((output (code)
(,output (ldb (byte 8 0) code))
(,output (ldb (byte 8 8) code))))
......
;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: STREAM -*-
;;;
;;; **********************************************************************
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-16.lisp,v 1.6 2010/01/22 23:57:29 rtoy Exp $")
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-16.lisp,v 1.7 2010/06/30 04:02:53 rtoy Exp $")
(in-package "STREAM")
......@@ -25,7 +25,7 @@
(define-external-format :utf-16 (:size 2)
()
(octets-to-code (state input unput c1 c2 code wd next st)
(octets-to-code (state input unput error c1 c2 code wd next st)
`(block nil
(when (null ,state) (setf ,state (cons 0 nil)))
(tagbody
......@@ -85,7 +85,7 @@
;; Replace with REPLACEMENT CHARACTER.
(setf ,code +replacement-character-code+)))
(return (values ,code ,wd))))))
(code-to-octets (code state output c c1 c2)
(code-to-octets (code state output error c c1 c2)
`(flet ((output (code)
(,output (ldb (byte 8 8) code))
(,output (ldb (byte 8 0) code))))
......
......@@ -4,14 +4,14 @@
;;; This code was written by Raymond Toy and has been placed in the public
;;; domain.
;;;
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-32-be.lisp,v 1.3 2009/09/28 18:12:59 rtoy Exp $")
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-32-be.lisp,v 1.4 2010/06/30 04:02:53 rtoy Exp $")
(in-package "STREAM")
(define-external-format :utf-32-be (:size 4)
()
(octets-to-code (state input unput c c1 c2 c3 c4)
(octets-to-code (state input unput error c c1 c2 c3 c4)
`(let* ((,c1 ,input)
(,c2 ,input)
(,c3 ,input)
......@@ -29,6 +29,6 @@
(t
(values ,c 4)))))
(code-to-octets (code state output i)
(code-to-octets (code state output error i)
`(dotimes (,i 4)
(,output (ldb (byte 8 (* 8 (- 3 ,i))) ,code)))))
......@@ -4,14 +4,14 @@
;;; This code was written by Raymond Toy and has been placed in the public
;;; domain.
;;;
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-32-le.lisp,v 1.3 2009/09/28 18:12:59 rtoy Exp $")
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-32-le.lisp,v 1.4 2010/06/30 04:02:53 rtoy Exp $")
(in-package "STREAM")
(define-external-format :utf-32-le (:size 4)
()
(octets-to-code (state input unput c c1 c2 c3 c4)
(octets-to-code (state input unput error c c1 c2 c3 c4)
`(let* ((,c1 ,input)
(,c2 ,input)
(,c3 ,input)
......@@ -29,6 +29,6 @@
(t
(values ,c 4)))))
(code-to-octets (code state output i)
(code-to-octets (code state output error i)
`(dotimes (,i 4)
(,output (ldb (byte 8 (* 8 ,i)) ,code)))))
......@@ -4,7 +4,7 @@
;;; This code was written by Raymond Toy and has been placed in the public
;;; domain.
;;;
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-32.lisp,v 1.5 2009/10/18 14:21:24 rtoy Exp $")
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-32.lisp,v 1.6 2010/06/30 04:02:53 rtoy Exp $")
(in-package "STREAM")
......@@ -29,7 +29,7 @@
(define-external-format :utf-32 (:size 4)
()
(octets-to-code (state input unput code c1 c2 c3 c4 st wd)
(octets-to-code (state input unput code error c1 c2 c3 c4 st wd)
`(block nil
(when (null ,state) (setf ,state 0))
(tagbody
......@@ -70,7 +70,7 @@
(go :again)))
(return (values ,code ,wd))))))
(code-to-octets (code state output i c)
(code-to-octets (code state output error i c)
`(flet ((out (,c)
;; Big-endian output
(dotimes (,i 4)
......
......@@ -4,7 +4,7 @@
;;; This code was written by Paul Foley and has been placed in the public
;;; domain.
;;;
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-8.lisp,v 1.5 2009/09/28 18:12:59 rtoy Exp $")
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-8.lisp,v 1.6 2010/06/30 04:02:53 rtoy Exp $")
(in-package "STREAM")
......@@ -15,7 +15,7 @@
(define-external-format :utf-8 (:min 1 :max 4)
()
(octets-to-code (state input unput c i j n)
(octets-to-code (state input unput error c i j n)
`(labels ((utf8 (,c ,i)
(declare (type (unsigned-byte 8) ,c)
(type (integer 1 5) ,i))
......@@ -58,7 +58,7 @@
((< ,c #b11110000) (utf8 ,c 2))
((< ,c #b11111000) (utf8 ,c 3))
(t (values +replacement-character-code+ 1))))))
(code-to-octets (code state output i j n p init)
(code-to-octets (code state output error i j n p init)
`(flet ((utf8 (,n ,i)
(let* ((,j (- 6 ,i))
(,p (* 6 ,i))
......
......@@ -4,14 +4,14 @@
;;; This code was written by Paul Foley and has been placed in the public
;;; domain.
;;;
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/void.lisp,v 1.3 2009/06/11 16:04:02 rtoy Rel $")
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/void.lisp,v 1.4 2010/06/30 04:02:53 rtoy Exp $")
;; This is actually implemented in the external-formats code
;; It appears here only for reference, and will never get loaded
(define-external-format :void (:size 0)
()
(octets-to-code (state input unput)
(octets-to-code (state input unput error)
`(error 'void-external-format))
(code-to-octets (code state output)
(code-to-octets (code state output error)
`(error 'void-external-format)))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment