File: utf8.lisp

package info (click to toggle)
cl-closure-common 20101107-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 212 kB
  • sloc: lisp: 2,671; sh: 27; makefile: 11
file content (36 lines) | stat: -rw-r--r-- 1,005 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;;; 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))

(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 closure-common-system:*utf8-runes-readtable*
      (let ((rt (copy-readtable)))
	(set-dispatch-macro-character #\# #\/ 'rune-reader rt)
	(set-dispatch-macro-character #\# #\" 'rod-reader rt)
	rt))