Update of /project/cl-prevalence/cvsroot/cl-prevalence/src
In directory common-lisp.net:/tmp/cvs-serv5673/src
Modified Files:
serialization.lisp
Log Message:
added serialization support for characters (suggested by ian eslick)
Date: Sat Jan 22 11:23:55 2005
Author: scaekenberghe
Index: cl-prevalence/src/serialization.lisp
diff -u cl-prevalence/src/serialization.lisp:1.7 cl-prevalence/src/serialization.lisp:1.8
--- cl-prevalence/src/serialization.lisp:1.7 Fri Jan 21 01:05:01 2005
+++ cl-prevalence/src/serialization.lisp Sat Jan 22 11:23:54 2005
@@ -1,6 +1,6 @@
;;;; -*- mode: Lisp -*-
;;;;
-;;;; $Id: serialization.lisp,v 1.7 2005/01/21 09:05:01 scaekenberghe Exp $
+;;;; $Id: serialization.lisp,v 1.8 2005/01/22 19:23:54 scaekenberghe Exp $
;;;;
;;;; XML and S-Expression based Serialization for Common Lisp and CLOS
;;;;
@@ -204,6 +204,12 @@
(s-xml:print-string-xml object stream)
(write-string "</STRING>" stream))
+(defmethod serialize-xml-internal ((object character) stream serialization-state)
+ (declare (ignore serialization-state))
+ (write-string "<CHARACTER>" stream)
+ (s-xml:print-string-xml (princ-to-string object) stream)
+ (write-string "</CHARACTER>" stream))
+
(defmethod serialize-xml-internal ((object symbol) stream serialization-state)
(declare (ignore serialization-state))
(write-string "<SYMBOL>" stream)
@@ -222,6 +228,10 @@
(declare (ignore serialization-state))
(prin1 object stream))
+(defmethod serialize-sexp-internal ((object character) stream serialization-state)
+ (declare (ignore serialization-state))
+ (prin1 object stream))
+
(defmethod serialize-sexp-internal ((object symbol) stream serialization-state)
(declare (ignore serialization-state))
(print-symbol object stream))
@@ -457,6 +467,7 @@
(:null nil)
(:true t)
(:string (or seed ""))
+ (:character (char seed 0))
(:key (car seed))
(:value (car seed))
(:entry (nreverse seed))