[comp.sys.next] Lisp in 2.0

jonas@cs.rochester.edu (Jonas Karlsson) (10/04/90)

Someone told me that 2.0 will not support LISP's 'foreign functions'.
Is this true? Does this mean we won't be able to load Objective C
into LISP or call the Appkit from within lisp?

hard facts appreciated (anyone from Franz reading this who can help me?)

thanks,
-j

verket@venice.SEDD.TRW.COM (Paul Verket) (10/04/90)

From article <1990Oct3.202510.3463@cs.rochester.edu>, by jonas@cs.rochester.edu (Jonas Karlsson):
> 
> Someone told me that 2.0 will not support LISP's 'foreign functions'.
> Is this true? ...

1.0 lisp running under 2.0 NextOS won't. 1.0 owners will get a free upgrade 
to 2.0 lisp. 
			Paul Verket

telfeyan@zip.eecs.umich.edu (Roland Telfeyan) (02/21/91)

Just got my 2.0 software and hardware upgrade.  But I'm afraid to
perform the upgrade because I want to be able to continue my LISP
development.

Questions:
    (1) Has anyone gotten their Allegro CL upgrade yet, and if so
how long did it take to arrive after sending the card in.
    (2) [Important] What is the workaround for getting the 1.0
version to work in 2.0?  In the upgrade manual it says that there
is an alteration that can be done, but it says nothing more (p. 5).

I tried running config in 2.0, and the problems seem to be with
the Mach headers in static.o.  I changed the 3 to a 6 (cputype)
and got another error, so I'm not goin to waste any more time
until I find out more.

Thanks, anybody!

Roland

--
Roland Telfeyan                             roland@cpat.umich.edu
Music Theory, School of Music                telf@ub.cc.umich.edu
University of Michigan      1100 Baits, Ann Arbor, MI  48109-2085

anderson@sapir.cog.jhu.edu (Stephen R. Anderson) (02/21/91)

Just before doing my software upgrade, I remember reading that the 1.0
version of CL would work under 2.0 except for the foreign function
interface.  Alas, I can't find that reference anymore. And I didn't
actually try running lisp under 2.0 on the '030 cube, because (rather
unexpectedly) all the pieces were in place for me to do the '040
upgrade almost immediately after I upgraded the OS. But I can tell you
that the 1.0 version of CL doesn't run, and can't be rebuilt, once
you've done both upgrades. I understand from NeXT that the
'040-compatible version of CL will be shipping "within the NeXT week
or so", but I haven't actually seen it. Franz has also assured me that
new versions are just around the corner. But for the moment, if you
have a substantial investment in lisp, don't upgrade your system!

Steve Anderson

sksircar@shade.Princeton.EDU (Subrata Sircar) (02/21/91)

telfeyan@zip.eecs.umich.edu (Roland Telfeyan) writes:
>Just got my 2.0 software and hardware upgrade.  But I'm afraid to
>perform the upgrade because I want to be able to continue my LISP
>development.

Us too.  So far, all we've gotten out of our purchase was a pair of keyboard
feet for $1000 :<)

>Questions:
>    (1) Has anyone gotten their Allegro CL upgrade yet, and if so
>how long did it take to arrive after sending the card in.

NeXTStep 2.0 breaks the Allegro CL foreign-function abilities.  The release
date (obtained by calling NeXT when we registered our purchases) was given
as April.  I'd bet May, just because...

>    (2) [Important] What is the workaround for getting the 1.0
>version to work in 2.0?  In the upgrade manual it says that there
>is an alteration that can be done, but it says nothing more (p. 5).

As far as I am aware, there is no workaround for the foreign-function stuff.
If you have a 1.0 binary which is pure Lisp, then you should be able to run
it straight-out-of-the-box, but any calling of, say, C-code is right out.
Anybody know different?



Subrata Sircar | sksircar@phoenix.princeton.edu |Prophet& SPAMIT Charter Member
	I don't speak for Princeton, and they don't speak for me.
"May their souls rot in easy-listening hell!" - Johnny Melnibone, GRIMJACK #76
"I seem to suffer from irrelevant flashbacks." - Paul, PAUL THE SAMURAI #1

tenny@ootool.dec.com (Dave Tenny) (02/21/91)

There IS a reference that says that the ACL 1.0 will work on a 2.0
(software at any rate, I don't have the 68040 board) system.

However, the advertising is either inaccurate or false.  ACL ceased
to function entirely when I upgraded OS to 2.0. (Forget foreign functions,
ACL won't fire up at all).

I have a question about it logged to ask_next@NeXT.COM, we'll see what they
say.

Dave

eps@toaster.SFSU.EDU (Eric P. Scott) (02/22/91)

In article <1991Feb21.001055.5896@zip.eecs.umich.edu>
	telfeyan@zip.eecs.umich.edu (Roland Telfeyan) writes:
>    (2) [Important] What is the workaround for getting the 1.0
>version to work in 2.0?  In the upgrade manual it says that there
>is an alteration that can be done, but it says nothing more (p. 5).

Attached.
					-=EPS=-
-------
Franz Allegro Common Lisp 2.0 1.0

Q:  Why can't I use my 1.0 version of Franz Allegro Common Lisp
under 2.0?  Is there something I can do to make it work until an
update becomes available?

A:  The 1.0 release of Common Lisp does not work with Release 2.0
for several reasons:
	1. the Mach header of the .o files have some uninitialized
		fields
	2. the libNeXT and libdsp have some incompatibilities and
		cannot be used
	3. foreign loading doesn't quite work

(and perhaps other unknown things). The 1.0 version may be modified
to more or less work (i.e. no NeXTstep, no dsp, limited foreign
code interface) as follows.  THIS WILL ONLY WORK FOR 030 MACHINES!!!
There is no known fix for the 040 machines.

Make sure that the /usr/cl directory from 1.0 is backed up. Also
save the /usr/lib/emacs/lisp/fi directory if you like that sort of
thing.

After building a 2.0 system, re-install the /usr/cl directory.

Save the following program as fixlispheader.c:
=========================================================
#include <mach.h>
#include <sys/loader.h>
#include <sys/file.h>
#include <nlist.h>

/*
 * This fixes the mach header of /usr/cl/build/static.o for
 * release 2.0
 */

main(int argc, char *argv[])
{
	int fd;
	struct mach_header mh;
	struct nlist nl;

	fd = open("static.o", O_RDWR);
	read(fd, &mh, sizeof(mh));
	mh.cputype = CPU_TYPE_MC680x0;
	mh.cpusubtype = CPU_SUBTYPE_MC68030;
	lseek(fd, 0, L_SET);
	write(fd, &mh, sizeof(mh));

	lseek(fd, 1400832, L_SET);
	read(fd, &nl, sizeof(nl));
	nl.n_type = N_SECT | N_EXT;
	nl.n_sect = 1;
	lseek(fd, 1400832, L_SET);
	write(fd, &nl, sizeof(nl));
}
====================================================================

Compile this program: (i.e., "cc -o fixlispheader fixlispheader.c"),
then in a shell as root:

	# cd /usr/cl/build
	# fixlispheader

This will destructively modify the static.o file so that it works
with the 2.0 release.

Before doing a normal "config" operation to build the lisp image,
the config file must be modified to not link in libNeXT and libdsp.
Open /usr/cl/build/config and change line 679 from

	LDFLAGS = -lcrt0.o -u _NXEditorFilter -u _DSPAwaitData
to
	LDFLAGS = -lcrt0.o

Also change line 680 from

	LIBRARIES = -lNeXT_s -ldsp_s -lsys_s

to
	LIBRARIES = -lsys_s


After these modifications, run the configuration script as normal.

Dynamic foreign code loading is also broken: (load "foo.o") will
not work. The workaround is to build a custom image (using the
configuration script) with your code linked in. To do this, add
your .o files to the LIBRARIES macro mentioned above. For example:

	LIBRARIES = /me/foo.o -lsys_s


When running this image, use the lisp defforeign function as usual.