This commit is contained in:
dlichteblau
2005-12-27 00:21:36 +00:00
parent bfacce53c5
commit e1a5fc652c
2 changed files with 50 additions and 0 deletions

View File

@ -61,6 +61,12 @@
#:set-to-full-speed #:set-to-full-speed
#:xstream-name)) #:xstream-name))
(defpackage :utf8-runes
(:use :cl)
(:export *utf8-runes-readtable*
#:rune #:rod #:simple-rod #:rod-string #:rod= #:make-rod
#:string-rod))
(defpackage :runes-encoding (defpackage :runes-encoding
(:use :cl :runes) (:use :cl :runes)
(:export (:export

44
utf8.lisp Normal file
View File

@ -0,0 +1,44 @@
;;; copyright (c) 2005 David Lichteblau <david@lichteblau.com>
;;; License: Lisp-LGPL (See file COPYING for details).
;;;
;;; Rune emulation for the UTF-8-compatible DOM implementation.
;;; Used only with 8 bit characters on non-unicode Lisps.
(in-package :utf8-runes)
(deftype rune () 'character)
(deftype rod () '(vector rune))
(deftype simple-rod () '(simple-array rune))
#+(or)
(definline rune (rod index)
(char rod index))
#+(or)
(defun (setf rune) (newval rod index)
(setf (char rod index) newval))
(defun rod= (r s)
(string= r s))
(defun rod-string (rod &optional default)
(declare (ignore default))
rod)
(defun string-rod (string)
string)
(defun make-rod (size)
(make-string size :element-type 'rune))
(defun rune-reader (stream subchar arg)
(runes::rune-char (runes::rune-reader stream subchar arg)))
(defun rod-reader (stream subchar arg)
(runes::rod-string (runes::rod-reader stream subchar arg)))
(setf cxml-system::*utf8-runes-readtable*
(let ((rt (copy-readtable)))
(set-dispatch-macro-character #\# #\/ 'rune-reader rt)
(set-dispatch-macro-character #\# #\" 'rod-reader rt)
rt))