-----BEGIN PGP SIGNED MESSAGE-----
I did a small bit of hacking to get the more-threads
package working, and to define and get working a dbm
package on SunOS4.1.3_U1 and NetBSD 1.1.
Forgive me for not providing diffs or anything more
useful than an overall description.
For more-threads, in env/more-thread.scm, in the
start-threads function, there's the lines:
the env must be commented out, as start-command-processor
as shipped in 0.4 does not take an environment as an
For dbm, the first thing to do for SunOS4.1.3 is to
acquire, build and install the Berkeley db library,
which can be found at ftp.cs.berkeley.edu:ucb/4bsd/db.tar.gz.
The current version is 1.85, which is what I used,
compiling it with the same gcc I used to build scsh.
(This is probably important, since gcc does interesting
things with struct returns that is incompatible with
SunOS's cc. I used gcc version 2.6.0)
Next, adjust scsh's Makefile.in; turn the commented-out
DBOPEN line to "DBOPEN = bdbmo.o", then adjust the
makefile to ensure that the scsh/$(DBOPEN) line
the scsh/dbm.o scsh/dbm1.o line, and the scsh/dbm.scm
db.scm ndbm.scm lines aren't commented out. db.scm
and ndbm.scm both need to have scsh/ stapled in front.
If running SunOS, you want to update the configure
script a bit, to have:
if [ -f /usr/lib/libdb.a ]; then
by adding the if ... fi part. If you put the Berkeley
db into your libc, you don't need to do this. :)
I just put the Berkeley ndbm.h and db.h into /usr/include
so I didn't have to adjust configure or Makefile.in to
look for the Berkeley header files. I figure that I want
to rebuild with the Berkeley db stuff anything I have
source for that is still using the old SunOS ndbm
Next, adjust scsh/scsh-package.scm, by adding this:
(define-structure dbm scsh-dbm-interface
(open scsh-utilities scheme externals error-package
just before (define-structure scsh
(The open list is probably overly-broad).
The 1.85 version of the Berkeley db library's dbm_close
returns void and not int. I ended up fighting with
cig a bit and changed the original to this:
(define-foreign %dbm-close (dbm_close ((C DBM*) dbm))
[the original had integer instead of (C void)]
One needs a working cig first, naturally, and once
then does /usr/local/lib/cig/cig < dbm.scm > dbm.c
in the scsh subdirectory.
This generates gcc-unfriendly braindamage in the .c file,
so that has to be changed:
scheme_value df_dbm_close(long nargs, scheme_value *args)
extern void dbm_close(DBM* );
cig_check_nargs(2, nargs, "dbm_close");
ret1 = VECTOR_REF(*args,0);
AlienVal(ret1) = (long) r1;
the changes here involved changing "void r1;" and
getting rid of "r1=" from in front of the call to
dbm_close function, and adding in "r1=0" afterwards.
A check for errno or something to adjust the return
value might be wise, but this was quicker.
After a make and a make install, one should be able to
test the functionality of the threads/more-threads
package with the example in doc/threads.txt; here
is what you should see:
> ,open dbm
> (define d (dbm-open "/tmp/zaza" (bitwise-ior open/create
> (dbm-insert d "foo" "bar")
> (dbm-insert d "f" "a")
> (dbm-firstkey d)
> (dbm-nextkey d)
> (dbm-close d)
> (run (ls -l /tmp/zaza))
- -rw-r--r-- 1 smd 32768 Jan 7 16:29 /tmp/zaza
The combination of scsh+dbm is a pretty powerful one.
The threads package is mostly candy for me for now.
- - --
Sean Doran <email@example.com>
-----BEGIN PGP SIGNATURE-----
Comment: PGP Public Key in ftp://ftp.sprintlink.net/engineer/smd/pgpkey
-----END PGP SIGNATURE-----