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 810e02695699e9a81ce6df69bc88f6cbaa938329
parent 3eb25b2a059cebc006d357aaa2bd6b671f9be987
Author: Commit-Bot <unknown>
Date:   Sun, 28 Nov 2010 09:30:54 +0000

Automatic commit from picoLisp.tgz, From: Sun, 28 Nov 2010 09:30:54 GMT
Diffstat:
Mdoc/refP.html | 6+++---
Mersatz/fun.src | 6+++---
Mersatz/picolisp.jar | 0
Mersatz/sys.src | 32+++++++++++++++++++++++++++++++-
Msrc64/version.l | 4++--
5 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/doc/refP.html b/doc/refP.html @@ -578,9 +578,9 @@ href="refP.html#println">println</a></code>. <dt><a name="prior"><code>(prior 'lst1 'lst2) -> lst | NIL</code></a> <dd>Returns the cell in <code>lst2</code> which immediately precedes the cell <code>lst1</code>, or <code>NIL</code> if <code>lst1</code> is not found in -<code>lst2</code>. <code><a href="ref_.html#==">==</a></code> is used for -comparison (pointer equality). See also <code><a -href="refO.html#offset">offset</a></code> and <code><a +<code>lst2</code> or is the very first cell. <code><a +href="ref_.html#==">==</a></code> is used for comparison (pointer equality). See +also <code><a href="refO.html#offset">offset</a></code> and <code><a href="refM.html#memq">memq</a></code>. <pre><code> diff --git a/ersatz/fun.src b/ersatz/fun.src @@ -1,4 +1,4 @@ -# 25nov10abu +# 28nov10abu # (c) Software Lab. Alexander Burger # Ersatz PicoLisp Functions @@ -206,8 +206,8 @@ java (num i j k x y z s v o) } try { if (z == T) - return new Symbol(java.lang.Class.forName(y.name()).getConstructor(par).newInstance(arg)); - Method m = (s = (Symbol)y).Obj == null? java.lang.Class.forName(s.Name).getMethod(z.name(),par) : s.Obj.getClass().getMethod(z.name(),par); + return new Symbol(javaConstructor(ex, java.lang.Class.forName(y.name()), par).newInstance(arg)); + Method m = javaMethod(ex, (s = (Symbol)y).Obj == null? java.lang.Class.forName(s.Name) : s.Obj.getClass(), z.name(), par); o = m.invoke(s.Obj, arg); if (m.getReturnType() == Void.TYPE) return Nil; diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar Binary files differ. diff --git a/ersatz/sys.src b/ersatz/sys.src @@ -1,4 +1,4 @@ -// 17nov10abu +// 28nov10abu // (c) Software Lab. Alexander Burger import java.util.*; @@ -131,6 +131,36 @@ public class PicoLisp { return null; /* Brain-dead Java */ } + final static Constructor javaConstructor(Any ex, Class cls, Class[] par) throws NoSuchMethodException { + looking: + for (Constructor m : cls.getConstructors()) { + Class<?>[] types = m.getParameterTypes(); + if (types.length == par.length) { + for (int i = 0; i < types.length; ++i) + if (!(types[i].isAssignableFrom(par[i]))) + continue looking; + return m; + } + } + throw new NoSuchMethodException(); + } + + final static Method javaMethod(Any ex, Class cls, String nm, Class[] par) throws NoSuchMethodException { + looking: + for (Method m : cls.getMethods()) { + if (m.getName().equals(nm)) { + Class<?>[] types = m.getParameterTypes(); + if (types.length == par.length) { + for (int i = 0; i < types.length; ++i) + if (!(types[i].isAssignableFrom(par[i]))) + continue looking; + return m; + } + } + } + throw new NoSuchMethodException(nm); + } + final static int waitFd(Any ex, int fd, int ms) { int i; Selector sel; diff --git a/src64/version.l b/src64/version.l @@ -1,6 +1,6 @@ -# 25nov10abu +# 28nov10abu # (c) Software Lab. Alexander Burger -(de *Version 3 0 4 13) +(de *Version 3 0 4 14) # vi:et:ts=3:sw=3