-----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:
(start-command-processor
#f context
env
(lambda ()
the env must be commented out, as start-command-processor
as shipped in 0.4 does not take an environment as an
argument.
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:
## SunOS
sparc*-sun-sunos* )
dir=sunos
if [ -f /usr/lib/libdb.a ]; then
LIBS=-ldb
fi
;;
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
eventually.
Next, adjust scsh/scsh-package.scm, by adding this:
(define-structure dbm scsh-dbm-interface
(open scsh-utilities scheme externals error-package
scsh-level-0 define-foreign-syntax
defrec-package record)
(files dbm))
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))
(C void));
[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* );
scheme_value ret1;
long r1;
cig_check_nargs(2, nargs, "dbm_close");
dbm_close((DBM* )AlienVal(args[1]));
r1=0;
ret1 = VECTOR_REF(*args,0);
AlienVal(ret1) = (long) r1;
return ret1;
}
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:
Scsh 0.4
> ,open dbm
> (define d (dbm-open "/tmp/zaza" (bitwise-ior open/create
open/read+write)
#o666 hash/method))
> (dbm-insert d "foo" "bar")
0
> (dbm-insert d "f" "a")
0
> (dbm-firstkey d)
"foo"
> (dbm-nextkey d)
"f"
> (dbm-close d)
> (run (ls -l /tmp/zaza))
- -rw-r--r-- 1 smd 32768 Jan 7 16:29 /tmp/zaza
0
>
The combination of scsh+dbm is a pretty powerful one.
The threads package is mostly candy for me for now.
Sean.
- - --
Sean Doran <smd@sprint.net>
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
Comment: PGP Public Key in ftp://ftp.sprintlink.net/engineer/smd/pgpkey
iQCVAwUBMPA9cUSWYarrFs6xAQEcMgP/deAsJzlfzzw3zRGpdrX+DDsyW2SD5pAq
YgH5L5u7A5QTdoU65je270Vk3SCA4Ox9bKDjYnrCHkcqGMKSg4yxXa9X5Qp0WDpr
yJFfK6Dmz+UsvRIXoIaXN2i55mXHapNL/P63bZxLv9oEHUFOA1fXBAL6MluiI6Lp
Qm1MBFpi84k=
=9z9Y
-----END PGP SIGNATURE-----
|