Permalink
Browse files

Rename

git-svn-id: svn://bknr.net/svn/trunk/thirdparty/cl-interpol@3590 4281704c-cde7-0310-8518-8e2dc76b1ff0
  • Loading branch information...
1 parent c236684 commit d42102c31b5e9ea113e82e3868b9ea2499b4e148 Edi Weitz committed Jul 23, 2008
Showing with 150 additions and 27 deletions.
  1. +6 −0 CHANGELOG
  2. +4 −0 README
  3. +1 −1 cl-interpol.asd
  4. +1 −1 cl-interpol.system
  5. +27 −12 doc/index.html
  6. +1 −1 load.lisp
  7. +5 −2 packages.lisp
  8. +61 −2 read.lisp
  9. +26 −2 specials.lisp
  10. +13 −1 test.lisp
  11. +2 −2 test.pl
  12. +1 −1 test2.lisp
  13. +1 −1 unicode.lisp
  14. +1 −1 util.lisp
View
@@ -1,3 +1,9 @@
+Version 0.1.2
+2004-12-16
+Added hyperdoc support
+Added :CL-INTERPOL to *FEATURES*
+Typo fixes in doc/index.html
+
Version 0.1.1
2003-12-21
Fixed an embarrassing bug where COLLECTOR was re-used in read.lisp (reported by Hans H�bner)
View
@@ -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
View
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/cl-interpol.asd,v 1.1 2004/06/23 08:27:10 hans Exp $
+;;; $Header: /usr/local/cvsrep/cl-interpol/cl-interpol.asd,v 1.1 2003/10/16 23:05:04 edi Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
View
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/cl-interpol.system,v 1.1 2004/06/23 08:27:10 hans Exp $
+;;; $Header: /usr/local/cvsrep/cl-interpol/cl-interpol.system,v 1.1 2003/10/16 23:03:54 edi Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
View
@@ -48,6 +48,7 @@
<br>&nbsp;<br><h3><a class=none name="contents">Contents</a></h3>
<ol>
<li><a href="#install">Download and installation</a>
+ <li><a href="#mail">Support and mailing lists</a>
<li><a href="#syntax">Syntax</a>
<ol>
<li><a href="#backslash">Backslashes</a>
@@ -69,7 +70,7 @@
</ol>
<li><a href="#bugs">Bugs and problems</a>
<ol>
- <li><a href="#lispworks">CL-INTERPOL doesn't work with LispWorks 4.3</a>
+ <li><a href="#lispworks">CL-INTERPOL doesn't work with LispWorks</a>
<li><a href="#slow">Reading of large forms can be slow</a>
<li><a href="#curly"><code>{n,m}</code> modifiers in extended mode</a>
</ol>
@@ -80,8 +81,8 @@
<br>&nbsp;<br><h3><a name="install" class=none>Download and installation</a></h3>
CL-INTERPOL together with this documentation can be downloaded from <a
-href="http://weitz.de/files/cl-interpol.tgz">http://weitz.de/files/cl-interpol.tgz</a>. The
-current version is 0.1.1.
+href="http://weitz.de/files/cl-interpol.tar.gz">http://weitz.de/files/cl-interpol.tar.gz</a>. The
+current version is 0.1.2.
<p>
CL-INTERPOL comes with simple system definitions for <a
href="http://www.cliki.net/mk-defsystem">MK:DEFSYSTEM</a> and <a
@@ -128,6 +129,17 @@
syntax you have to enable it with <a
href="#enable-interpol-syntax"><code>ENABLE-INTERPOL-SYNTAX</code></a>.
+<br>&nbsp;<br><h3><a name="mail" class=none>Support and mailing lists</a></h3>
+
+For questions, bug reports, feature requests, improvements, or patches
+please use the <a
+href="http://common-lisp.net/mailman/listinfo/cl-interpol-devel">cl-interpol-devel
+mailing list</a>. If you want to be notified about future releases
+subscribe to the <a
+href="http://common-lisp.net/mailman/listinfo/cl-interpol-announce">cl-interpol-announce
+mailing list</a>. These mailing lists were made available thanks to
+the services of <a href="http://common-lisp.net/">common-lisp.net</a>.
+
<br>&nbsp;<br><h3><a name="syntax" class=none>Syntax</a></h3>
CL-INTERPOL installs <code class=yellow>?</code> (question mark) as a
@@ -334,8 +346,8 @@
and comprise the Unicode <em>name</em> of the character to be inserted into the
string. This name is interpreted as follows:
<ul>
-<li>If <a href="*long-unicode-names-p*"><code>*LONG-UNICODE-NAMES-P*</code></a> is <em>true</em> then the name is interpreted as the full <a href="http://www.unicode.org/charts/charindex.html">official Unicode name</a> of the character. Case doesn't matter.
-<li>If <a href="*short-unicode-names-p*"><code>*SHORT-UNICODE-NAMES-P*</code></a> is <em>true</em> then the name must contain a colon. The part before the colon is assumed to be the name of a Unicode scrippt and the part after the colon should be the full name except for the script name and the word &quot;letter&quot;. You can also leave the words &quot;small&quot; and &quot;capital&quot; out. CL-INTERPOL will then try to find a character with one of the Unicode names
+<li>If <a href="#*long-unicode-names-p*"><code>*LONG-UNICODE-NAMES-P*</code></a> is <em>true</em> then the name is interpreted as the full <a href="http://www.unicode.org/charts/charindex.html">official Unicode name</a> of the character. Case doesn't matter.
+<li>If <a href="#*short-unicode-names-p*"><code>*SHORT-UNICODE-NAMES-P*</code></a> is <em>true</em> then the name must contain a colon. The part before the colon is assumed to be the name of a Unicode scrippt and the part after the colon should be the full name except for the script name and the word &quot;letter&quot;. You can also leave the words &quot;small&quot; and &quot;capital&quot; out. CL-INTERPOL will then try to find a character with one of the Unicode names
<pre class=none>
&lt;<em>script</em>&gt; &lt;<em>size</em>&gt; letter &lt;<em>short-name</em>&gt;
&lt;<em>script</em>&gt; letter &lt;<em>short-name</em>&gt;
@@ -345,7 +357,7 @@
colon, and <code>&lt;<em>size</em>&gt;</code> is <code>SMALL</code> if
all letters in <code>&lt;<em>short-name</em>&gt;</code> are lowercase
and <code>CAPITAL</code> otherwise.
-<li>If none of these yields a character CL-INTERPOL will try all the strings in the list <a href="*unicode-scripts*"><code>*UNICODE-SCRIPTS*</code></a> in order and for each one it'll try to find a character with the algorithm described above where <code>&lt;<em>script</em>&gt;</code> is the corresponding element of <code>*UNICODE-SCRIPTS*</code> and <code>&lt;<em>short-name</em>&gt;</code> is the string between the curly brackets.
+<li>If none of these yields a character CL-INTERPOL will try all the strings in the list <a href="#*unicode-scripts*"><code>*UNICODE-SCRIPTS*</code></a> in order and for each one it'll try to find a character with the algorithm described above where <code>&lt;<em>script</em>&gt;</code> is the corresponding element of <code>*UNICODE-SCRIPTS*</code> and <code>&lt;<em>short-name</em>&gt;</code> is the string between the curly brackets.
</ul>
Confused? Maybe an example will help - CLISP again:
<pre>
@@ -741,11 +753,11 @@
<br>&nbsp;<br><h3><a class=none name="bugs">Bugs and problems</a></h3>
-<h4><a name="lispworks" class=none>CL-INTERPOL doesn't work with LispWorks 4.3</a></h4>
+<h4><a name="lispworks" class=none>CL-INTERPOL doesn't work with LispWorks</a></h4>
-At least on my machine <a
+<a
href="http://www.lispworks.com/">LispWorks</a>
-(4.3.6&nbsp;professional on Linux) has an error which prevents
+(4.3.6&nbsp;professional on Linux, maybe other versions too) has an error which prevents
CL-INTERPOL from working correctly. You can check for yourself by
evaluating the following form in a LispWorks listener:
@@ -759,11 +771,14 @@
</pre>
This should of course return <code>1</code> but signals an error for
-me. I have reported this as a bug to Xanalys support.
+me. If you also encounter this error you can contact Xanalys support
+for a patch.
+<p>
+Update: This was fixed in version 4.3.7.
<h4><a name="slow" class=none>Reading of large forms can be slow</a></h4>
-Some Lisps (notably LispWorks and CMUCL/SBCL) seem to have problems if very many (1000+) CL-INTERPOL strings are contained in one form. This seems to be related to GC and not necessarily something specific to CL-INTERPOL. See <a href="http://article.gmane.org/gmane.lisp.cmucl.general/1546">the CMUCL mailing list</a> and <a href="http://article.gmane.org/gmane.lisp.lispworks.general/1443">the LispWorks mailing list</a> for more information.
+Some Lisps (notably LispWorks and CMUCL/SBCL) seem to have problems if very many (1000+) CL-INTERPOL strings are contained in one form. This seems to be related to GC and not necessarily something specific to CL-INTERPOL. See <a href="http://article.gmane.org/gmane.lisp.cmucl.general/1546">the CMUCL mailing list</a> and <a href="http://article.gmane.org/gmane.lisp.lispworks.general/1443">the LispWorks mailing list</a> for more information. (Note: The behaviour of LispWorks has significantly improved with version 4.3.7.)
<h4><a name="curly" class=none><code>{n,m}</code> modifiers in extended mode</a></h4>
@@ -799,7 +814,7 @@
Thanks to Peter Seibel who had the idea to do this to make <a href="http://weitz.de/cl-ppcre/">CL-PPCRE</a> more convenient. Read <a href="http://www.apress.com/book/bookDisplay.html?bID=237">his book</a> when it is released!!!
<p>
-$Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/doc/index.html,v 1.1 2004/06/23 08:27:10 hans Exp $
+$Header: /usr/local/cvsrep/cl-interpol/doc/index.html,v 1.19 2004/12/16 19:20:43 edi Exp $
<p><a href="http://weitz.de/index.html">BACK TO MY HOMEPAGE</a>
</body>
View
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/load.lisp,v 1.1 2004/06/23 08:27:10 hans Exp $
+;;; $Header: /usr/local/cvsrep/cl-interpol/load.lisp,v 1.1 2003/10/19 15:56:51 edi Exp $
;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved.
View
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/packages.lisp,v 1.1 2004/06/23 08:27:10 hans Exp $
+;;; $Header: /usr/local/cvsrep/cl-interpol/packages.lisp,v 1.4 2004/04/24 00:19:13 edi 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*)
View
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/read.lisp,v 1.1 2004/06/23 08:27:10 hans Exp $
+;;; $Header: /usr/local/cvsrep/cl-interpol/read.lisp,v 1.25 2004/04/24 00:19:13 edi Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
@@ -202,6 +202,63 @@ backslash has already been consumed."
(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 @@ returns NIL."
(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
View
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/specials.lisp,v 1.1 2004/06/23 08:27:10 hans Exp $
+;;; $Header: /usr/local/cvsrep/cl-interpol/specials.lisp,v 1.7 2004/04/24 00:19:13 edi Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
@@ -63,6 +63,11 @@ interpolated by #\@.")
"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 @@ here by ENABLE-INTERPOL-SYNTAX.")
(defvar-unbound *readtable-copy*
"Bound to the current readtable if it has to be temporarily
-modified.")
+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))))
+
View
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/test.lisp,v 1.1 2004/06/23 08:27:10 hans Exp $
+;;; $Header: /usr/local/cvsrep/cl-interpol/test.lisp,v 1.9 2004/04/24 00:19:13 edi 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*
@@ -154,6 +158,14 @@
"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*))
View
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-### $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/test.pl,v 1.1 2004/06/23 08:27:10 hans Exp $
+### $Header: /usr/local/cvsrep/cl-interpol/test.pl,v 1.4 2003/10/19 15:55:25 edi Exp $
### Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved.
@@ -49,7 +49,7 @@ sub quote {
print <<'HEAD';
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/test.pl,v 1.1 2004/06/23 08:27:10 hans Exp $
+;;; $Header: /usr/local/cvsrep/cl-interpol/test.pl,v 1.4 2003/10/19 15:55:25 edi Exp $
;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved.
View
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/test2.lisp,v 1.1 2004/06/23 08:27:10 hans Exp $
+;;; $Header: /usr/local/cvsrep/cl-interpol/test2.lisp,v 1.3 2003/10/19 15:55:25 edi Exp $
;;; Copyright (c) 2002-2003, Dr. Edmund Weitz. All rights reserved.
View
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/unicode.lisp,v 1.1 2004/06/23 08:27:10 hans Exp $
+;;; $Header: /usr/local/cvsrep/cl-interpol/unicode.lisp,v 1.6 2003/10/22 09:22:45 edi Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.
View
@@ -1,5 +1,5 @@
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-INTERPOL; Base: 10 -*-
-;;; $Header: /home/manuel/bknr-cvs/cvs/thirdparty/cl-interpol/util.lisp,v 1.1 2004/06/23 08:27:10 hans Exp $
+;;; $Header: /usr/local/cvsrep/cl-interpol/util.lisp,v 1.7 2003/10/22 09:20:30 edi Exp $
;;; Copyright (c) 2003, Dr. Edmund Weitz. All rights reserved.

0 comments on commit d42102c

Please sign in to comment.