E Installation  -  Dave Yost, March 10, 1982
- ------------

Here are the topics which you will have to address
to install E.  If you don't have Unix Version 7 or
at least the phototypesetter V7 compiler and
stdio, you are in big trouble.

There are two versions of the editor here. 'e15'
is the new substantial rewrite which uses the Line
Acces I/O Package.  It has been running reliably
for some time, and only some minor bugs remain.
It is larger than e14, using more than 64K of
instruction space.  So far, it is only known to
run on the VAX, Perkin Elmer, and 11 with Berkeley
overlays.  See e15/Changes and e15/Bugs for the
current state.  You should run this version if you
are on a machine with a big address space.  E14 is
the older version, which has somewhat less
capability, but is pretty solid.

Both versions use a lot of instruction address
space, and the editor's data space starts at
several K and grows as your editing session
continues.  E15's data space grows faster than
E14's, because it keeps pointers to the previous
version of all lines after they are changed, not
just closed and picked lines.  E14 will fit on
split I&D 11's; e15 will not.  If you have the
Berkeley overlays, you should be able to run
either on any 11, but I have personally only
gotten this to work on a 70, not a 34, and this
only recently, so there may still be some bugs.

Documentation has to be pieced together from
doc/*, e15/Changes, and term/Keyboard.

This distribution came from a VAX.  There should
not be any binaries or libraries on the tape, so
you'll have to make everything from scratch.

On UNIXV7 systems, use the Makefile in this
directory, which invokes make in various
subdirectories.  Machine, compiler, and operating
system defines are in "../include/".  See
../README for more details.  Look for '-D'
options in */Makefile for other stuff like
Termcap, too.

You will find a program called 'ranlib' is called
in the Makefiles.  That is something that may not
be in your system, but is available from Western
Electric as an update to V7, and I think, 32V.  It
is included in the current Berkeley releases.  If
you don't have ranlib, either remove it from the
Makefiles or create a null shell file called
ranlib or something.

If you are on UNIXV6, and you don't have
Phototypesetter Version 7, get it or give up.
I like to use the modern language features.

LAST BUT NOT LEAST, you have to get E to run
nicely on the terminals you are using.  For the
editor to be really nice to use, it has to make
good use of your terminal's function keys.  Yes,
this means that if it doesn't have function keys,
or has only a few of them, you will be hitting the
control key a lot.  The way we have handled this
problem in the past has been to compile in
terminal-handling code for all terminals we want
to support.  Recently, with the help of Mark
Horton, I have got it working with termcap.  The
problem with termcap is that you get the default
E keyboard, and you really want to use the
terminal's function keys.  N.B.  I laid out the
new 'standard' keyboard on 7/16/81.  If you are
used to the old one, SURPRISE!  See term/Keyboard.
If you want to customize the editor for your
favorite terminal, see e.tt.c in the editor
subdirectory, and term/Doc and term/*.c as
examples.  Currently supported are:
	annarbor.c   Ann Arbor 4080
	ambas.c      Ann Arbor Ambassador
      * adm3a.c      Lear Siegler ADM3a
      * adm31.c      Lear Siegler ADM31
      * dm4000.c     Datamedia DM4000
	h19.c        Heathkit H19 & H89
	intext.c     INTERACTIVE Systems Intext
	adm42.c      Lear Siegler ADM42
	c100.c       Concept 100
	intext2.c    INTERACTIVE Systems Intext2
      * po.c         Perkin Elmer terminals
Those with asterisks use the 'standard' keyboard.
A list of environment variable abberviations for
these terminals is found in e.tt.c.  The
ambassador is rather special.  You need to do a
make in the ambas directory and install the
'ambas' program somewhere.

The editor version number changes when the format
of the state file changes or when the keystroke
sequences change.  Thus, I was using the name e10
for quite a while, even though I kept fixing it.
Nowadays there is a subrevision number that gets
incuremented every time you do a new make.

Do the stuff below, then run the Makefile in this
directory.

========

On the PDP-11:
Increase "Phototypesetter Version 7" and V7 C
compiler symbol table sizes:

c0.h:
14c14
< #define HSHSIZ  300     /* # entries in hash table for names */
---
> #define HSHSIZ  700     /* # entries in hash table for names */

c2: change make file to do a ld -i (Split I&D)

========

Compiler bug on the VAX:

If you are on 4bsd or later, you are OK.
Otherwise, on 32V, 3.0 or 4.0, you have to
deal with a compiler bug.  The bug is that
'register char' and 'register short' generate
incorrect code.  The only place where there is
code that steps on this bug is in the LA Package
directory, la1.  You can get around this by
putting the following lines in la1/la.local.h:

#undef Reg1
#undef Reg2
#undef Reg3
#undef Reg4
#undef Reg5
#undef Reg6
#define Reg1
#define Reg2
#define Reg3
#define Reg4
#define Reg5
#define Reg6

or on 32V you can fix /usr/src/cmd/pcc/local.c
so that the compiler will never put shorts
or chars into registers.  There is a very
simple routine called cisreg() in local.c.
Take out the code that allows CHAR, UCHAR,
SHORT, USHORT.

On 3.0 and 4.0 local.c may be in a different
place.

========

cpp.c: Increase cpp symbol table size
(not required on Berkeley VAX systems.)

# define SBSIZE 19000

 and

# define symsiz 1000  /* instead of 500 */

On the vax, now that cpp will be bigger, you must
change makefile so that "-d2" is no
longer one of the CFLAGS.

========

E source files you may want to mess with:

e.h
e.x.c

And, especially to taylor E for your terminals:
e.tt.c
e.tt.h
e.t.h

========


I am told that some of the Makefiles cause 'make'
to exceed some of its limits on at least one other
system (IS/1).  Here's what is different in the
'defs' file in the source directory for the
version of 'make' we run (4bsd):

#define HASHSIZE 1021         /* v7 = 509 */
#define NLEFTS 512            /* v7 = 40 */
#define INMAX 2500            /* v7 = 1500 */
#define OUTMAX 3500           /* v7 = 2500 */
#define QBUFMAX 2500          /* v7 = 1500 */
#define MAXDIR 10             /* v7 = ? */

========

One of the routines in ./lib is the "empty" call.
On V6 and V7 systems, you will have to install a
kernel mod to get this function.  On 4bsd+ you are
OK.  On 2.8bsd, the FIONREAD mod seems to be
installed, but it really isn't.

If you don't implement this function one way or
another, the editor will not perform as well
because it won't be able to look ahead to see if
there are more keys waiting from the terminal, and
therefore can't be intelligent about interrupting
functions and aborting unnecessary screen redraws.
You will also not be able to interrupt editor
functions.

NOTE: If you don't implement 'empty', you CAN NOT abort a replay.

Here's what to do to V7 and 32V so that 'empty()' will work.

---/usr/sys/dev/tty.c   (/usr/src/sys/sys/tty.c on 32V)
>>>in ioctl()
	if (fmt != IFCHR && fmt != IFMPC) {
#ifndef NOFIONREAD
		if (uap->cmd==FIONREAD && (fmt == IFREG || fmt == IFDIR)) {
			off_t nread;

			if (!(fp->f_flag&FREAD)) {
				u.u_error = EBADF;
				return;
			}
			nread = ip->i_size - fp->f_un.f_offset;
			if (copyout((caddr_t)&nread, uap->cmarg, sizeof(off_t)))
				u.u_error = EFAULT;
		} else
#endif NOFIONREAD
>>>in ttioccomm() after the TIOCGETC case
#ifndef NOFIONREAD
	/*
	 * Return number of characters immediately available.
	 */
	case FIONREAD: {
		off_t nread = 0;

		switch (tp->t_line) {
		case 0:
			if (   tp->t_canq.c_cc == 0
			    && tp->t_rawq.c_cc != 0
			    && (   (tp->t_flags&(RAW|CBREAK))
				|| (   tp->t_delct > 0
				    && *tp->t_rawq.c_cf != CEOT
				   )
			      )
			  )
				canon(tp);
			nread = tp->t_canq.c_cc;
			break;
		}
		if (copyout((caddr_t)&nread, addr, sizeof (off_t)))
			u.u_error = EFAULT;
		break;
		}
#endif
---/usr/sys/h/tty.h
---/usr/include/sys/h/tty.h
---/usr/include/sgtty.h

>>>after #define FIONCLEX        (('f'<<8)|2)
#ifndef NOFIONREAD
/* another local */
#define	FIONREAD	(('f'<<8)|127)	/* get # bytes to read */
/* FIONREAD is not implemented on mpx channels yet */
#endif  NOFIONREAD
========
