CMUCL commit: src/pcl/simple-streams/external-formats (ascii.lisp)

Raymond Toy rtoy at common-lisp.net
Tue Nov 10 16:31:44 CET 2009


    Date: Tuesday, November 10, 2009 @ 10:31:44
  Author: rtoy
    Path: /project/cmucl/cvsroot/src/pcl/simple-streams/external-formats

   Added: ascii.lisp

Initial version for ASCII external format.


------------+
 ascii.lisp |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)


Index: src/pcl/simple-streams/external-formats/ascii.lisp
diff -u /dev/null src/pcl/simple-streams/external-formats/ascii.lisp:1.1
--- /dev/null	Tue Nov 10 10:31:44 2009
+++ src/pcl/simple-streams/external-formats/ascii.lisp	Tue Nov 10 10:31:43 2009
@@ -0,0 +1,19 @@
+;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: STREAM -*-
+;;;
+;;; **********************************************************************
+;;; This code was written by Raymond Toy and has been placed in the public
+;;; domain.
+;;;
+(ext:file-comment "$Header: /project/cmucl/cvsroot/src/pcl/simple-streams/external-formats/ascii.lisp,v 1.1 2009-11-10 15:31:43 rtoy Exp $")
+
+(in-package "STREAM")
+
+(define-external-format :ascii (:size 1)
+  ()
+  (octets-to-code (state input unput c)
+    `(let ((,c ,input))		  
+       (values (if (< ,c #x80) ,c +replacement-character-code+)
+	       1))
+  (code-to-octets (code state output)
+    `(,output (if (> ,code #x7F) #x3F ,code))))
+



More information about the cmucl-commit mailing list