utf8-dom
This commit is contained in:
@ -61,6 +61,12 @@
|
||||
#:set-to-full-speed
|
||||
#: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
|
||||
(:use :cl :runes)
|
||||
(:export
|
||||
|
||||
44
utf8.lisp
Normal file
44
utf8.lisp
Normal 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))
|
||||
Reference in New Issue
Block a user