[closure-cvs] CVS update: closure/src/renderer/hyphenation.lisp
Eric Marsden
emarsden at common-lisp.net
Sun Jul 17 09:30:55 UTC 2005
Update of /project/closure/cvsroot/closure/src/renderer
In directory common-lisp.net:/tmp/cvs-serv15903/renderer
Modified Files:
hyphenation.lisp
Log Message:
The hyphenation table can be referenced using an URL, rather than by
an absolute filename.
Date: Sun Jul 17 11:30:51 2005
Author: emarsden
Index: closure/src/renderer/hyphenation.lisp
diff -u closure/src/renderer/hyphenation.lisp:1.3 closure/src/renderer/hyphenation.lisp:1.4
--- closure/src/renderer/hyphenation.lisp:1.3 Sun Mar 13 19:03:24 2005
+++ closure/src/renderer/hyphenation.lisp Sun Jul 17 11:30:51 2005
@@ -4,7 +4,7 @@
;;; Created: 2003-03-07
;;; Author: Gilbert Baumann <gilbert at base-engineering.com>
;;; License: MIT style (see below)
-;;; $Id: hyphenation.lisp,v 1.3 2005/03/13 18:03:24 gbaumann Exp $
+;;; $Id: hyphenation.lisp,v 1.4 2005/07/17 09:30:51 emarsden Exp $
;;; ---------------------------------------------------------------------------
;;; (c) copyright 1999-2003 by Gilbert Baumann
@@ -174,18 +174,18 @@
;;;; Reading Tables
-(defun read-hyphen-table-file (filename &key (class 'tree-hyphenation-table))
- (with-open-file (input filename)
- (let ((res (make-instance class
- :filename filename)))
- (read-line input nil nil)
- (do ((line (read-line input nil nil) (read-line input nil nil)))
- ((null line))
- (let* ((j (position #\space line))
- (pattern (map 'vector #'digit-char-p (subseq line (+ j 1)))))
- (insert-hyphenation-pattern res (subseq line 0 j) pattern)))
- res)))
-
+(defun read-hyphen-table (url &key (class 'tree-hyphenation-table))
+ (let ((url (if (url:url-p url) url (url:parse-url url))))
+ (netlib:with-open-document ((input mime-type) url)
+ (declare (ignore mime-type))
+ (let ((res (make-instance class :filename url)))
+ (g/read-line input nil nil)
+ (do ((line (g/read-line input nil nil) (g/read-line input nil nil)))
+ ((null line))
+ (let* ((j (position #\space line))
+ (pattern (map 'vector #'digit-char-p (subseq line (+ j 1)))))
+ (insert-hyphenation-pattern res (subseq line 0 j) pattern)))
+ res))))
;; 100,000x hyphenation of "argument":
@@ -193,6 +193,10 @@
;; new: .57s 2.400,000 bytes [technically zero]
;; $Log: hyphenation.lisp,v $
+;; Revision 1.4 2005/07/17 09:30:51 emarsden
+;; The hyphenation table can be referenced using an URL, rather than by
+;; an absolute filename.
+;;
;; Revision 1.3 2005/03/13 18:03:24 gbaumann
;; Gross license change
;;
More information about the Closure-cvs
mailing list