Alexander Burger wrote:
Hi Cle,
Hi Alexander,
unfortunately, we see problems on Mac OS since quite some time.
You'll see that if you search in the archive of this mailing list
(http://www.mail-archive.com/picolisp@software-lab.de).
I had already seen this, but those problems dealt with being not able to
build picoLisp though. Therefore I had the hope, that my problem perhaps
is already solved! :-}
I don't have a Mac myself. So I'm still hoping that some of the Mac
users fires up a debugger and helps, but no results so far :-(
Ok! Today I had give it a try and finally I was able to patch and build
picoLisp to being runable under Snow Leopard passing all unit tests in
lib/test.l and running doc/hello.l and doc/family.l too :-)
I have attached the patch necessary to fix all glitches for Snow
Leopard. I have tested the changes against Snow Leopard and NetBSD and
they work fine! I intend to have a look, if they run under Leopard
(MacOS/X 10.5) tomorrow if I can manage to install Xcode on my PPC machine.
BTW: If you duplicate the OpenBSD section in the src/Makefile and
replace OpenBSD by NetBSD, you can add another platform picoLisp is
running onto :-D
The attached patch was made against the development version downloaded
as picoLisp.tgz from your homepage. The patch was applied as:
tar xzf picoLisp.tgz
cd picoLisp
patch -p0 < ../picoLisp.patch
(cd src; make clean picolisp)
./p lib/test.l -bye
I hope, I did not break your coding style too much via the patch ...
Best regards and thanks for picoLisp ... :-)
Ciao,
Cle.
(...)
Index: src/Makefile
===
--- src/Makefile
+++ src/Makefile
@@ -33,11 +33,11 @@
STRIP = strip
else
ifeq ($(shell uname), Darwin)
OS = Darwin
PICOLISP-FLAGS = -m32 -lc -lm -ldl
- DYNAMIC-LIB-FLAGS = -dynamiclib -undefined dynamic_lookup
+ DYNAMIC-LIB-FLAGS = -dynamiclib -undefined dynamic_lookup -m32
STRIP = :
else
ifeq ($(shell uname -o), Cygwin)
OS = Cygwin
DYNAMIC-LIB-FLAGS = -shared
Index: src/main.c
===
--- src/main.c
+++ src/main.c
@@ -2,10 +2,31 @@
* (c) Software Lab. Alexander Burger
*/
#include "pico.h"
+/* Globals declared in pico.h */
+int Signal, Chr, Slot, Spkr, Mic, Hear, Tell, Children, ExtN;
+char **AV, *AV0, *Home;
+child *Child;
+heap *Heaps;
+cell *Avail;
+stkEnv Env;
+catchFrame *CatchPtr;
+struct termios OrgTermio, *Termio;
+int InFDs, OutFDs;
+inFile *InFile, **InFiles;
+outFile *OutFile, **OutFiles;
+int (*getBin)(void);
+void (*putBin)(int);
+any TheKey, TheCls, Thrown;
+any Alarm, Line, Zero, One, Intern[IHASH], Transient[IHASH], Extern[EHASH];
+any ApplyArgs, ApplyBody, DbVal, DbTail;
+any Nil, DB, Meth, Quote, T;
+any Solo, PPid, Pid, At, At2, At3, This, Dbg, Zap, Ext, Scl, Class;
+any Run, Hup, Sig1, Sig2, Up, Err, Msg, Uni, Led, Tsm, Adr, Fork, Bye;
+
/* Globals */
static int TtyPid;
static word2 USec;
static struct timeval Tv;
static bool Tio, Jam;
@@ -633,11 +654,11 @@
else {
if (n)
memcpy(buf, Home, n);
strcpy(buf + n, "lib/"), strcpy(buf + n + 4, nm);
}
- if (!(h = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL)) || !(h = dlsym(h,p)))
+ if (!(h = dlopen(buf, RTLD_NOW | RTLD_GLOBAL)) || !(h = dlsym(h,p)))
return NO;
val(x) = box(num(h));
}
return YES;
}
@@ -1061,10 +1082,17 @@
if (*av[i] != '-') {
if ((p = strrchr(av[i], '/')) && !(p == av[i]+1 && *av[i] == '.')) {
Home = malloc(p - av[i] + 2);
memcpy(Home, av[i], p - av[i] + 1);
Home[p - av[i] + 1] = '\0';
+ }
+ else if ((p = getcwd(NULL,0)) != NULL) {
+int len = strlen(p);
+Home = malloc(len + 2);
+memcpy(Home, p, len);
+Home[len] = '/';
+Home[len + 1] = '\0';
}
break;
}
AV0 = *av++;
AV = av;
Index: src/pico.h
===
--- src/pico.h
+++ src/pico.h
@@ -234,512 +234,512 @@
/* External symbol access */
#define Fetch(ex,x) if (isExt(x)) db(ex,x,1)
#define Touch(ex,x) if (isExt(x)) db(ex,x,2)
/* Globals */
-int Signal, Chr, Slot, Spkr, Mic, Hear, Tell, Children, ExtN;
-char **AV, *AV0, *Home;
-child *Child;
-heap *Heaps;
-cell *Avail;
-stkEnv Env;
-catchFrame *CatchPtr;
-struct termios OrgTermio, *Termio;
-int InFDs, OutFDs;
-inFile *InFile, **InFiles;
-outFile *OutFile, **OutFiles;
-int (*getBin)(void);
-void (*putBin)(int);
-any TheKey, TheCls, Thrown;
-any Alarm, Line, Zero, One, Intern[IHASH], Transient[IHASH], Extern[EHASH];
-any ApplyArgs, ApplyBody, DbVal, DbTail;
-any Nil, DB, Meth, Quote, T;
-any Solo, PPid, Pid, At, At2, At3, This, Dbg, Zap, Ext, Scl, Class;
-any Run, Hup, Sig1, Sig2, Up, Err, Msg, Uni, Led, Tsm, Adr, Fork, Bye;
+extern in