[cl-interpol-cvs] CVS update: cl-interpol/CHANGELOG cl-interpol/README cl-interpol/cl-interpol.asd cl-interpol/cl-interpol.system cl-interpol/load.lisp cl-interpol/packages.lisp cl-interpol/read.lisp cl-interpol/specials.lisp cl-interpol/test.lisp cl-interpol/test.pl cl-interpol/test2.lisp cl-interpol/unicode.lisp cl-interpol/util.lisp
Edi Weitz
eweitz at common-lisp.net
Sat Apr 24 00:26:54 UTC 2004
Update of /project/cl-interpol/cvsroot/cl-interpol
In directory common-lisp.net:/tmp/cvs-serv31054
Modified Files:
CHANGELOG README cl-interpol.asd cl-interpol.system load.lisp
packages.lisp read.lisp specials.lisp test.lisp test.pl
test2.lisp unicode.lisp util.lisp
Log Message:
pre-0.1.2 including hyperdoc support
Date: Fri Apr 23 20:26:53 2004
Author: eweitz
Index: cl-interpol/CHANGELOG
diff -u cl-interpol/CHANGELOG:1.1.1.1 cl-interpol/CHANGELOG:1.2
--- cl-interpol/CHANGELOG:1.1.1.1 Tue Jan 6 20:05:17 2004
+++ cl-interpol/CHANGELOG Fri Apr 23 20:26:52 2004
@@ -1,3 +1,8 @@
+Version 0.1.2
+????-??-??
+Added hyperdoc support
+Added :CL-INTERPOL to *FEATURES*
+
Version 0.1.1
2003-12-21
Fixed an embarrassing bug where COLLECTOR was re-used in read.lisp (reported by Hans Hübner)
Index: cl-interpol/README
diff -u cl-interpol/README:1.1.1.1 cl-interpol/README:1.2
--- cl-interpol/README:1.1.1.1 Tue Jan 6 20:05:01 2004
+++ cl-interpol/README Fri Apr 23 20:26:52 2004
@@ -1,6 +1,10 @@
Complete documentation for CL-INTERPOL can be found in the 'doc'
directory.
+CL-INTERPOL also supports Nikodemus Siivola's HYPERDOC, see
+<http://common-lisp.net/project/hyperdoc/> and
+<http://www.cliki.net/hyperdoc>.
+
1. Installation
1.1. Probably the easiest way is
Index: cl-interpol/cl-interpol.asd
diff -u cl-interpol/cl-interpol.asd:1.1.1.1 cl-interpol/cl-interpol.asd:1.2
--- cl-interpol/cl-interpol.asd:1.1.1.1 Tue Jan 6 20:05:01 2004
+++ cl-interpol/cl-interpol.asd Fri Apr 23 20:26:52 2004
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/cl-interpol.asd,v 1.1.1.1 2004/01/07 01:05:01 eweitz Exp $
+;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/cl-interpol.asd,v 1.2 2004/04/24 00:26:52 eweitz Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
Index: cl-interpol/cl-interpol.system
diff -u cl-interpol/cl-interpol.system:1.1.1.1 cl-interpol/cl-interpol.system:1.2
--- cl-interpol/cl-interpol.system:1.1.1.1 Tue Jan 6 20:05:17 2004
+++ cl-interpol/cl-interpol.system Fri Apr 23 20:26:52 2004
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/cl-interpol.system,v 1.1.1.1 2004/01/07 01:05:17 eweitz Exp $
+;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/cl-interpol.system,v 1.2 2004/04/24 00:26:52 eweitz Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
Index: cl-interpol/load.lisp
diff -u cl-interpol/load.lisp:1.1.1.1 cl-interpol/load.lisp:1.2
--- cl-interpol/load.lisp:1.1.1.1 Tue Jan 6 20:05:01 2004
+++ cl-interpol/load.lisp Fri Apr 23 20:26:52 2004
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/load.lisp,v 1.1.1.1 2004/01/07 01:05:01 eweitz Exp $
+;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/load.lisp,v 1.2 2004/04/24 00:26:52 eweitz Exp $
;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved.
Index: cl-interpol/packages.lisp
diff -u cl-interpol/packages.lisp:1.1.1.1 cl-interpol/packages.lisp:1.2
--- cl-interpol/packages.lisp:1.1.1.1 Tue Jan 6 20:05:01 2004
+++ cl-interpol/packages.lisp Fri Apr 23 20:26:52 2004
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/packages.lisp,v 1.1.1.1 2004/01/07 01:05:01 eweitz Exp $
+;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/packages.lisp,v 1.2 2004/04/24 00:26:52 eweitz Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
@@ -41,7 +41,8 @@
#:*short-unicode-names-p*
#:*unicode-scripts*
#:*outer-delimiters*
- #:*inner-delimiters*))
+ #:*inner-delimiters*
+ #:*optional-delimiters-p*))
#+:cormanlisp
(defpackage "CL-INTERPOL"
@@ -56,3 +57,5 @@
"*UNICODE-SCRIPTS*"
"*OUTER-DELIMITERS*"
"*INNER-DELIMITERS*"))
+
+(pushnew :cl-interpol *features*)
\ No newline at end of file
Index: cl-interpol/read.lisp
diff -u cl-interpol/read.lisp:1.1.1.1 cl-interpol/read.lisp:1.2
--- cl-interpol/read.lisp:1.1.1.1 Tue Jan 6 20:05:20 2004
+++ cl-interpol/read.lisp Fri Apr 23 20:26:52 2004
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/read.lisp,v 1.1.1.1 2004/01/07 01:05:20 eweitz Exp $
+;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/read.lisp,v 1.2 2004/04/24 00:26:52 eweitz Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
@@ -202,6 +202,63 @@
(concatenate 'string "\\" (string result)))
(t result)))))
+(declaim (inline normal-name-char-p)
+ (inline never-name-char-p))
+
+(defun normal-name-char-p (c)
+ (and c (or (alphanumericp c)
+ (member c '(#\_ #\- #\+ #\*)))))
+
+(defun never-name-char-p (c)
+ (or (not c)
+ (get-macro-character c)
+ (member c '(#\$ #\@))))
+
+(defvar quell-warnings-form
+ #+sbcl '(declare (optimize (sb-ext:inhibit-warnings 3)))
+ #-sbcl nil
+ "A declaration form to quiet warnings about unbound variables
+ within a lexical environment.")
+
+(defun read-longest-name ()
+ (coerce
+ (loop until (never-name-char-p (peek-char nil *stream* nil nil t))
+ collect (read-char*))
+ 'string))
+
+(defun read-optional-delimited ()
+ "Read the stuff following an optional delimiter, returning a form
+that tries to deal correctly with lexical variables."
+ (flet ((try-pos (name i form)
+ (let ((ostr (gensym)))
+ `(handler-case
+ (with-output-to-string (,ostr)
+ (princ ,(read-from-string (subseq name 0 i)) ,ostr)
+ (princ ,(subseq name i) ,ostr)
+ ,ostr)
+ (unbound-variable () ,form)))))
+
+ (loop
+ with name = (read-longest-name)
+ with form = `(error ,(format nil "Interpolation error in ~s~%" name))
+ with ostr = (gensym)
+ for i = (position-if-not #'normal-name-char-p name)
+ then (position-if-not #'normal-name-char-p name :start (1+ i))
+
+ unless i
+ return `(let () ,quell-warnings-form
+ (handler-case
+ (with-output-to-string (,ostr)
+ (princ ,(read-from-string name) ,ostr)
+ ,ostr)
+ (unbound-variable () ,form)))
+
+ if (> i 0)
+ do (setq form (try-pos name i form))
+
+ if (< i (length name))
+ do (setq form (try-pos name (1+ i) form)))))
+
(declaim (inline read-form))
(defun read-form ()
"Reads and returns one or more Lisp forms from *STREAM* if the
@@ -210,7 +267,9 @@
(let* ((start-delimiter (peek-char*))
(end-delimiter (get-end-delimiter start-delimiter *inner-delimiters*)))
(cond ((null end-delimiter)
- nil)
+ (if *optional-delimiters-p*
+ (read-optional-delimited)
+ nil))
(t
`(progn
,@(progn
Index: cl-interpol/specials.lisp
diff -u cl-interpol/specials.lisp:1.1.1.1 cl-interpol/specials.lisp:1.2
--- cl-interpol/specials.lisp:1.1.1.1 Tue Jan 6 20:05:17 2004
+++ cl-interpol/specials.lisp Fri Apr 23 20:26:52 2004
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/specials.lisp,v 1.1.1.1 2004/01/07 01:05:17 eweitz Exp $
+;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/specials.lisp,v 1.2 2004/04/24 00:26:52 eweitz Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
@@ -63,6 +63,11 @@
"The Unicode scripts which are to be tried if a name couldn't be
resolved otherwise.")
+(defvar *optional-delimiters-p* nil
+ "Whether text following $ or @ should interpolate even without a
+following delimiter. Lexical variables are handled correctly,
+but the rules are somewhat complex -- see the docs for details.")
+
(defmacro defvar-unbound (variable-name documentation)
"Like DEFVAR, but the variable will be unbound rather than getting
an initial value. This is useful for variables which should have no
@@ -96,4 +101,23 @@
(defvar-unbound *readtable-copy*
"Bound to the current readtable if it has to be temporarily
-modified.")
\ No newline at end of file
+modified.")
+
+;; stuff for Nikodemus Siivola's HYPERDOC
+;; see <http://common-lisp.net/project/hyperdoc/>
+;; and <http://www.cliki.net/hyperdoc>
+
+(defvar *hyperdoc-base-uri* "http://weitz.de/cl-interpol/")
+
+(let ((exported-symbols-alist
+ (loop for symbol being the external-symbols of :cl-interpol
+ collect (cons symbol
+ (concatenate 'string
+ "#"
+ (string-downcase symbol))))))
+ (defun hyperdoc-lookup (symbol type)
+ (declare (ignore type))
+ (cdr (assoc symbol
+ exported-symbols-alist
+ :test #'eq))))
+
\ No newline at end of file
Index: cl-interpol/test.lisp
diff -u cl-interpol/test.lisp:1.1.1.1 cl-interpol/test.lisp:1.2
--- cl-interpol/test.lisp:1.1.1.1 Tue Jan 6 20:05:17 2004
+++ cl-interpol/test.lisp Fri Apr 23 20:26:52 2004
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/test.lisp,v 1.1.1.1 2004/01/07 01:05:17 eweitz Exp $
+;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/test.lisp,v 1.2 2004/04/24 00:26:52 eweitz Exp $
;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved.
@@ -29,6 +29,10 @@
(in-package #:cl-interpol)
+;; Otherwise it's impossible to see which tests are failing for all
+;; the "helpful" warnings.
+#+sbcl (declaim (optimize (sb-ext:inhibit-warnings 3)))
+
(defvar *temp*)
(defparameter *cl-interpol-base-directory*
@@ -153,6 +157,14 @@
(test #?"The result is ${(let ((y 2)) (+ x y))}"
"The result is 42")
(test #?"${#?'${a} ${c}'} ${x}" "foo bar 40"))
+
+(setq cl-interpol:*optional-delimiters-p* t)
+(test (let ((% 23)) #?"$%a%b%") "23a%b%")
+(test (let ((%a 23)) #?"$%a%b%") "23%b%")
+(test (let ((%a% 23)) #?"$%a%b%") "23b%")
+(test (let ((%a%b 23)) #?"$%a%b%") "23%")
+(test (let ((%a%b% 23)) #?"$%a%b%") "23")
+(setq cl-interpol:*optional-delimiters-p* nil)
(load (merge-pathnames "test2.lisp"
*cl-interpol-base-directory*))
Index: cl-interpol/test.pl
diff -u cl-interpol/test.pl:1.1.1.1 cl-interpol/test.pl:1.2
--- cl-interpol/test.pl:1.1.1.1 Tue Jan 6 20:05:17 2004
+++ cl-interpol/test.pl Fri Apr 23 20:26:52 2004
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-### $Header: /project/cl-interpol/cvsroot/cl-interpol/test.pl,v 1.1.1.1 2004/01/07 01:05:17 eweitz Exp $
+### $Header: /project/cl-interpol/cvsroot/cl-interpol/test.pl,v 1.2 2004/04/24 00:26:52 eweitz Exp $
### Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved.
@@ -49,7 +49,7 @@
print <<'HEAD';
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/test.pl,v 1.1.1.1 2004/01/07 01:05:17 eweitz Exp $
+;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/test.pl,v 1.2 2004/04/24 00:26:52 eweitz Exp $
;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved.
Index: cl-interpol/test2.lisp
diff -u cl-interpol/test2.lisp:1.1.1.1 cl-interpol/test2.lisp:1.2
--- cl-interpol/test2.lisp:1.1.1.1 Tue Jan 6 20:05:17 2004
+++ cl-interpol/test2.lisp Fri Apr 23 20:26:52 2004
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/test2.lisp,v 1.1.1.1 2004/01/07 01:05:17 eweitz Exp $
+;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/test2.lisp,v 1.2 2004/04/24 00:26:52 eweitz Exp $
;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved.
Index: cl-interpol/unicode.lisp
diff -u cl-interpol/unicode.lisp:1.1.1.1 cl-interpol/unicode.lisp:1.2
--- cl-interpol/unicode.lisp:1.1.1.1 Tue Jan 6 20:06:26 2004
+++ cl-interpol/unicode.lisp Fri Apr 23 20:26:52 2004
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/unicode.lisp,v 1.1.1.1 2004/01/07 01:06:26 eweitz Exp $
+;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/unicode.lisp,v 1.2 2004/04/24 00:26:52 eweitz Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
Index: cl-interpol/util.lisp
diff -u cl-interpol/util.lisp:1.1.1.1 cl-interpol/util.lisp:1.2
--- cl-interpol/util.lisp:1.1.1.1 Tue Jan 6 20:05:20 2004
+++ cl-interpol/util.lisp Fri Apr 23 20:26:52 2004
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/util.lisp,v 1.1.1.1 2004/01/07 01:05:20 eweitz Exp $
+;;; $Header: /project/cl-interpol/cvsroot/cl-interpol/util.lisp,v 1.2 2004/04/24 00:26:52 eweitz Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
More information about the Cl-interpol-cvs
mailing list