picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit b69efc23ddf621748115a361e311d24402204af7
parent c419e490c79ecfe3a2bb31d2571074aa1f46574c
Author: Alexander Burger <abu@software-lab.de>
Date:   Tue, 20 Sep 2011 10:51:25 +0200

Docs for namespace extensions
Diffstat:
Mdoc/ref.html | 2++
Mdoc/refP.html | 16++++++++++++++++
Mdoc/refS.html | 37+++++++++++++++++++++++++++++++++++++
Msrc64/sym.l | 8++++----
Mtest/src/sym.l | 14+++++++++++++-
5 files changed, 72 insertions(+), 5 deletions(-)

diff --git a/doc/ref.html b/doc/ref.html @@ -1834,6 +1834,7 @@ abbreviations: <a href="refP.html#pat?">pat?</a> <a href="refF.html#fun?">fun?</a> <a href="refA.html#all">all</a> + <a href="refS.html#symbols">symbols</a> <a href="refI.html#intern">intern</a> <a href="refE.html#extern">extern</a> <a href="ref_.html#====">====</a> @@ -2525,6 +2526,7 @@ abbreviations: <dt>Globals <dd><code> <a href="#nilSym">NIL</a> + <a href="refP.html#pico">pico</a> <a href="refO.html#*OS">*OS</a> <a href="refD.html#*DB">*DB</a> <a href="refT.html#T">T</a> diff --git a/doc/refP.html b/doc/refP.html @@ -240,6 +240,22 @@ href="refE.html#extract">extract</a></code>. -> 1 </code></pre> +<dt><a name="pico"><code>pico</code></a> +<dd>(64-bit version only) A global constant holding the initial (default) +namespace of internal symbols. Its value is a cons pair of two '<code><a +href="refI.html#idx">idx</a></code>' trees, one for symbols with short names and +one for symbols with long names (more than 7 bytes in the name). +See also +<code><a href="refS.html#symbols">symbols</a></code> and +<code><a href="refI.html#intern">intern</a></code>. + +<pre><code> +: (symbols) +-> pico +: (cdr pico) +-> (rollback (*NoTrace (ledSearch (expandTab (********)) *CtryCode ... +</code></pre> + <dt><a name="pil"><code>(pil ['any ..]) -> sym</code></a> <dd>Returns the path name to the <code><a href="refP.html#pack">pack</a></code>ed <code>any</code> arguments in diff --git a/doc/refS.html b/doc/refS.html @@ -896,6 +896,43 @@ href="refE.html#ext?">ext?</a></code>. -> NIL </code></pre> +<dt><a name="symbols"><code>(symbols) -> sym</code></a> +<dt><code>(symbols 'sym1) -> sym2</code> +<dt><code>(symbols 'sym1 'sym2) -> sym3</code> +<dd>(64-bit version only) Creates and manages namespaces of internal symbols: In +the first form, the current namespace is returned. In the second form, the +current namespace is set to <code>sym1</code>, and the previous namespace +<code>sym2</code> is returned. In the third form, <code>sym1</code> is assigned +a copy of an existing namespace <code>sym2</code> and becomes the new current +namespace, returning the previous namespace <code>sym3</code>. See also <code><a +href="refP.html#pico">pico</a></code> and <code><a +href="refI.html#intern">intern</a></code>. + +<pre><code> +: (symbols 'myLib 'pico) +-> pico +: (de foo (X) + (bar (inx X)) ) +-> foo + +: (symbols 'pico) +-> myLib +: (pp 'foo) +(de foo . NIL) +-> foo +: (pp 'myLib~foo) +(de "foo" (X) + ("bar" ("inx" X)) ) +-> "foo" + +: (symbols 'myLib) +-> pico +: (pp 'foo) +(de foo (X) + (bar (inx X)) ) +-> foo +</code></pre> + <dt><a name="sync"><code>(sync) -> flg</code></a> <dd>Waits for pending data from all family processes. While other processes are still sending data (via the <code><a href="refT.html#tell">tell</a></code> diff --git a/src64/sym.l b/src64/sym.l @@ -1,4 +1,4 @@ -# 16sep11abu +# 20sep11abu # (c) Software Lab. Alexander Burger ### Compare long names ### @@ -880,8 +880,8 @@ ret # (symbols) -> sym -# (symbols 'sym) -> sym -# (symbols 'sym1 'sym2) -> sym +# (symbols 'sym1) -> sym2 +# (symbols 'sym1 'sym2) -> sym3 (code 'doSymbols 2) push X push Y @@ -920,7 +920,7 @@ call copyC_E # Copy source ld A (L II) # Get new symbol namespace ld (A) E # Store source copy - ld E (Intern) # Return current symbol namespace + ld E (Intern) # Return old symbol namespace ld (Intern) A # Store new drop end diff --git a/test/src/sym.l b/test/src/sym.l @@ -1,4 +1,4 @@ -# 13jul11abu +# 20sep11abu # (c) Software Lab. Alexander Burger ### name ### @@ -37,6 +37,18 @@ (filter '((S) (= S "test")) (all)) ) +### symbols ### +(when (== 64 64) + (test T (bool (pair pico))) + (test 'pico (symbols 'myLib 'pico)) ) + +(when (== 64 64) + (one Foo) + (test 'myLib (symbols 'pico)) ) + +(when (== 64 64) + (test 1 myLib~Foo) ) + ### intern ### (test car (val (intern (pack "c" "a" "r"))))