[comp.emacs] JOVE and/or GNU-MACS for 386/IX

jordan@titn.TITN (Jordan Bortz) (07/31/87)

Has anyone done a port of jove or gnu-macs for the 386 running Ineractive
Systems 386/IX (V.3)??  I'm really looking for gnumacs, and would like to
bench it (and use LISP funcs!), but am using jove now, which I compiled 
on the 386.

It seems to work okay, except that running processes in windows doesn't
work, and a make-to-buffer gives a Read Error 4.  Does anyone have
the patches for jove?? 

Also of course looking for gnu-macs people with 386 ports.  Thanks!

	Jordan

-- 
=============================================================================
Jordan Bortz	Higher Level Software 1085 Warfield Ave  Piedmont, CA   94611
(415) 268-8948	UUCP:	(decvax|ucbvax|ihnp4)!decwrl!sun!plx!titn!jordan
=============================================================================

gabell@phoenix.PRINCETON.EDU (Gavin Alexander Bell) (08/03/87)

In article <184@titn.TITN> jordan@titn.TITN (Jordan Bortz) writes:
>Has anyone done a port of jove ...
>It seems to work okay, except that running processes in windows doesn't
>work, and a make-to-buffer gives a Read Error 4.  Does anyone have
>the patches for jove?? 

The mailer bounced this, so I'm posting it...

I had the same problem with JOVE giving me a READ ERROR 4 when I
tried to get it running on a Silicon Graphics Iris.  It's caused
by a stray signal being caught before the read of the pipe is done.
A fellow Jove user (Jim Mattson) came up with this patch to the file
fb.c  (This just follows the "if at first you don't succeed..."
philosophy)::

filbuf(fp)
File	*fp;
{
	char redo = 1;	/* Kludge for errno 4 on S5000/80 and IRISES-- jsm */
	if (fp->f_flags & (F_EOF|F_ERR))
		return EOF;
	fp->f_ptr = fp->f_base;
	while (redo) {
		fp->f_cnt = read(fp->f_fd, fp->f_base, fp->f_bufsize);
		redo= 0 ;
		if (fp->f_cnt == -1) {
			if (errno == 4) redo = 1;
			else {
				printf("[Read error %d]", errno);
				fp->f_flags |= F_ERR;
			}
		}
	}
	if (fp->f_cnt == 0) {
		fp->f_flags |= F_EOF;
		return EOF;
	}
	io_chars += fp->f_cnt;
	return getc(fp);
}

Hope this helps.

Oh-- Jove seems to work fine on the Irises, except that filename
completion doesn't work (it always claims there is 'no match').
Has anybody else had this problem?  Anybody else figured out a
fix?

-- Gavin Bell

mb@ttidca.TTI.COM (Michael Bloom) (08/04/87)

>
>Oh-- Jove seems to work fine on the Irises, except that filename
>completion doesn't work (it always claims there is 'no match').
>Has anybody else had this problem?  Anybody else figured out a
>fix?

Well, having seen similar behavior with other programs ported to
System V, I think I can make an educated guess.  In jove/scandir.c,
just *before* the in line that goes "if ((dp->d_fd = open(dir, 0)) == -1)"
see if adding these two lines does the trick:

	if (dir && *dir == NULL) 
		dir = ".";

The reason for this is that unlike in BSD, USG unices do not treat the
null string and "." as having the same meaning.r

allbery@ncoast.UUCP (Brandon Allbery) (08/08/87)

As quoted from <184@titn.TITN> by jordan@titn.TITN (Jordan Bortz):
+---------------
| Has anyone done a port of jove or gnu-macs for the 386 running Ineractive
| Systems 386/IX (V.3)??  I'm really looking for gnumacs, and would like to
| bench it (and use LISP funcs!), but am using jove now, which I compiled 
| on the 386.
| 
| It seems to work okay, except that running processes in windows doesn't
| work, and a make-to-buffer gives a Read Error 4.  Does anyone have
| the patches for jove?? 
+---------------


This bug in JOVE happens on any non-BSD system.  BSD has the property of
automatically restarting interrupted read()s on slow devices; others don't,
and the read() function returns -1 with errno == EINTR (4).

I don't have the fixes online.  Basically, however, I changed the call to
read() in _filbuf (? -- the function called by getc(); it's in fp.c) to
xread(), and added the following function (approximate; I don't know if this
one will work, but you get the idea):

#ifndef BSD

xread(fd, buf, nbytes)
int fd, nbytes;
char *buf; {
	long here;
	int cnt, rcnt, acnt;
	extern int errno;
	
	if ((here = lseek(fd, 0L, 1)) == -1)
		rcnt = 1;
	else
		rcnt = nbytes;
	for (cnt = 0; cnt < nbytes; cnt += acnt) {
		if ((acnt = read(fd, buf + cnt, rcnt)) == -1)
			if (errno != EINTR)
				return -1;
			else {
				acnt = 0;
				if (here != -1L)
					(void) lseek(fd, here, 0);
			}
		else if (acnt < rcnt)
			return cnt + acnt;
	}
	return cnt;
}

#endif BSD

The idea was to (1) force restarts on interrupted reads, and (2) do so in
an efficient way where possible (i.e. seekable files).  No checks for non-
pipes are done, since I have contempt for anyone who would C-X C-I /dev/tty.
Those who disagree can stick an isatty(fd) in the seekable check.

I suspect that the same has to be done for writes; I've had truncated writes,
and truncated file reads from before I did this.

One "bug" I've noticed, which I don't think is from my code:  we have an
early LSRHS version of Jove on ncoast, and it displays each line from a
C-X C-E as make outputs it.  The new version of Jove on tdi2 waits for
1024 bytes before displaying it; I consider this unfriendly, as I prefer
the proof that it's actually doing something.  (There may be another bug
in the fact that Jove works fine on tdi2 (a System V site) with my change
as posted above, but on ncoast the new Jove always gives me:

JOVE CRASH!!! (code 1)
Your buffers have been saved...

I traced this to random read(0, ...) calls in random places returning EOF
when it wasn't expected.  I don't know if this is a bug in Jove (unlikely,
or it'd happen on tdi2 as well; they use the same configuration, modulo
user-written memcpy()) or in System III (or Plexus Sys3; likely, given
the nonsense in both Plexus Sys3 and Plexus Sys5...).

I'll see about posting my actual changes.  BTW, the total set of changes
I made includes code to attach to /etc/avenrun's shm segment (see article
X-Archive: comp.sources.misc/8708/1) to support the mode line %l parameter.
-- 
 Brandon S. Allbery, moderator of comp.sources.misc and comp.binaries.ibm.pc
  {{harvard,mit-eddie}!necntc,well!hoptoad,sun!cwruecmp!hal}!ncoast!allbery
ARPA: necntc!ncoast!allbery@harvard.harvard.edu  Fido: 157/502  MCI: BALLBERY
   <<ncoast Public Access UNIX: +1 216 781 6201 24hrs. 300/1200/2400 baud>>