[net.eunice] GNU Emacs under Eunice - partial efforts and questions

manheime@nbs-amrf.UUCP (Ken Manheimer) (05/13/86)

[I wrote this up yesterday, and discovered in the meantime that our
Eunice upgrade is on the way; i gather that this version of Eunice
will emulate bsd 4.2 fairly closely; if that is truly the case then
the issues below may be moot as far as i'm concerned.  I'm posting
this anyway since other people may be sticking with the 4.1 bsd
version of Eunice may be able to benefit from my experiences (who
knows, if it's full of problems we may be also...), and in any case
my curiousity is generally not deterred by practical considerations.]

I just spent part of the weekend and part of [yesterday] attempting
to get Gnu Emacs (version 17.43) operational under Eunice (eunice
version 4.2, which is essentially bsd 4.1 (moreorless).  I gather
there's a new version of eunice out or impending, but we haven't
received any notice of it...).  I've made substantial progress, to
the point where i can start up temacs and actually insert
carriage-returns to my hearts content.  Can't do anything else with
it though (particularly not load lisp).  (More details about the
fixes i discovered up to this point and the problems i'm having can
be found below.)

I'm writing this in the hope that someone out there has either
surmounted my current problem and knows a quick fix, or even
better, has already accomplished the whole port and can clue me in.

At the bottom you'll find a ChangeLog, an s-eun4.1.h eunice-specific
header file, and diffs of the fixes i have implemented to this point.
Some of the changes are clear fixes, others are more tentative
guesses that worked.

In the meanwhile, here's what i can garner of the current problem.

As i mentioned, i can get temacs to start up and in, though it comes
up with the message:

'Bare impure Emacs (standard Lisp code not loaded)'

even when the '-l' load flag option is correctly specified (in which
case the 'function definition void' message mentioned below also
appears).

The only keys correctly processed are carriage-returns (as near as i
can test them, of course; the buffer-modification indicator on the
mode line is changed on the first <cr>, the cursor moves down line by
line, and half-screen scrolling happens just right when the end of
screen is reached).  No other functions seem to be defined, though the
symbols for all the basic keys (as defined in cmds.c:  keys_of_cmds)
are established - the error message:

'Symbol's function definition is void: <some-or-other-command>'

is evoked for all these keys except <cr>.  (Both \C-X and \E prefixes
also elicit the error message.  Only way to exit is to kill the
session from another process.)

I took a superficial look to see what distinguishes the newline
command from the other primitive ones, and the only thing i could find
was the fact that its key definition comes first in keys_of_cmds, so
of course it tried putting it later on.  Made no difference at all.

When this GNU temacs is run in '-batch' mode you wind up in a weird
state where you can enter input, but inevitably get the 'function def
void' message for each character on any line that you enter.  However,
<esc> gets you out cleanly, and ^C/^Y(Eunice/Dec correlate of ^Z) will
perform their respective interrupts, getting you out uncleanly.  As i
mentioned earlier, the '-l' load the Makefile tries to do (for
producing a dumpable emacs) fails with one of the 'void function
definition' messages for 'load'.

The source changes are below my signature.

Ken Manheimer  Integrated Systems Group, Factory Automation Systems Division,
	       National Bureau of Standards
 
UUCP:   ...!seismo!nbs-amrf!manheime 

USmail: National Bureau of Standards            BELL: (301)921-2171
        Metrology A127
        Gaithersburg, MD  20899

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Contents below this point:

1. ChangeLog additions, src/ChangLog:
2. src/s-eun4.1.h:
3. diff ../old/ymakefile src/ymakefile
4. diff ../old/malloc.c src/malloc.c
5. diff ../old/process.c src/process.c
6. diff ../old/filelock.c src/filelock.c
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1. ChangeLog additions, src/ChangLog:
------------------------------------------------------------------------

Sat May 10 19:30    1986  Ken Manheimer (...!seismo!nbs-amrf!manheime)

	* generated s-eun4.1.h
	Eunice doesn't have gettimeofday, and even though it does have 
	<sys/time.h> have to #undef HAVE_TIMEVAL.
	Eunice doesn't have links, lstat: '#undef S_IFLNK','#define lstat stat'

	* malloc.c
	Problems with assumption of use of getrlimit in all of BSD, had
	to alter #ifdefs to take account of Eunice.
	Not only doesn't Eunice have bstring routines, it also doesn't
	have memcopy, memcmp, etc.  Created our own versions of the
	bstring routines.

	* process.c
	Made neglected #ifdef enclosures to references to stuff from
	sys/time.h using #ifdef HAVE_TIMEVAL/#endif pairs.

	* filelock.c
	Had to provide alternate chmod for fchmod calls, which aren't
	present in Eunice.
	
	* ymakefile
	Mustn't include -ljobs; they're inherent in -lc.
	Added -noshare to load options, to circumvent redundancies between
	-lc and (intrinsic) shared C libraries.
	Also, changed some of the /usr/local/lib/... configuration
	specs to /usr/local/src/... i'm taking the lazy approach to
	configuration, especially due to the lack of file links in
	eunice to make a configuration conducive to both recompilation
	and sensible organization.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
2. src/s-eun4.1.h:
------------------------------------------------------------------------
/* Definitions file for GNU Emacs running on Eunice bsd 4.1, 
   derived by Ken Manheimer, National Bureau of Standards, 10-May-86
   from rms' s-bsd4.1.h (Copyright (C) 1985 Richard M. Stallman)

This file is part of GNU Emacs.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.  No author or distributor
accepts responsibility to anyone for the consequences of using it
or for whether it serves any particular purpose or works at all,
unless he says so in writing.  Refer to the GNU Emacs General Public
License for full details.

Everyone is granted permission to copy, modify and redistribute
GNU Emacs, but only under the conditions described in the
GNU Emacs General Public License.   A copy of this license is
supposed to have been given to you along with GNU Emacs so you
can know your rights and responsibilities.  It should be in a
file named COPYING.  Among other things, the copyright notice
and this notice must be preserved on all copies.  */


/*
 *	Define symbols to identify the version of Unix this is.
 *	Define all the symbols that apply correctly.
 */

#define EUNICE

#define BSD4_1		/* Eunice is most like bsd 4.1 */

#define BSD

#undef S_IFLNK		/* Eunice 4.1 doesn't have symbolic links. */
#define lstat stat

/* SYSTEM_TYPE should indicate the kind of system you are using.
 It sets the Lisp variable system-type.  */

#define SYSTEM_TYPE "Eunice"

/* nomultiplejobs should be defined if your system's shell
 does not have "job control" (the ability to stop a program,
 run some other program, then continue the first one).  */

/* #define NOMULTIPLEJOBS */

/* Default is to set interrupt_input to 1: do input buffering within Emacs */

#define INTERRUPT_INPUT

/* First pty name is /dev/ptyp0.  */

#define FIRST_PTY_LETTER 'p'
 
/*
 *	Define HAVE_TIMEVAL if the system supports the BSD style clock values.
 *	Look in <sys/time.h> for a timeval structure.
 */

/* #define HAVE_TIMEVAL */
 
/* or HAVE_TIMEVAL and: #define gettimeofday(stuff,garbage) time(stuff.tv_sec)
*/

/*
 *	Define HAVE_SELECT if the system supports the `select' system call.
 */

/* #define HAVE_SELECT */

/*
 *	Define HAVE_PTYS if the system supports pty devices.
 */

/* #define HAVE_PTYS */

/*
 *	Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate
 *      The 4.2 opendir, etc., library functions.
 */

#define NONSYSTEM_DIR_LIBRARY

/* Define this symbol if your system has the functions bcopy, etc. */

/* #define BSTRING */

/* subprocesses should be defined if you want to
   have code for asynchronous subprocesses
   (as used in M-x compile and M-x shell).
   This is generally OS dependent, and not supported
   under most USG systems. */

#define subprocesses

/* If your system uses COFF (Common Object File Format) then define the
   preprocessor symbol "COFF". */

/* #define COFF */

/* define MAIL_USE_FLOCK if the mailer uses flock
   to interlock access to /usr/spool/mail/$USER.
   The alternative is that a lock file named
   /usr/spool/mail/$USER.lock.  */

/* #define MAIL_USE_FLOCK */

/* Define CLASH_DETECTION if you want lock files to be written
   so that Emacs can tell instantly when you try to modify
   a file that someone else has modified in his Emacs.  */

#define CLASH_DETECTION

/* Special hacks needed to make Emacs run on this system.  */

/* Make the function `signal' act as in 4.2.  */

#define signal sigset

#define _longjmp longjmp
#define _setjmp setjmp

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
3. diff ../old/ymakefile src/ymakefile
------------------------------------------------------------------------
34c34,35
< LIBJOBS= -ljobs
---
> /*klm LIBJOBS= -ljobs */
> LIBJOBS=
63a65,70
> /* using the -lc library will cause plurality conflicts with the shared
>    c library, making Eunice cc & make bomb.  So, special Eunice ld flag
>    '-noshare' Ken Manheimer */
> #ifdef EUNICE
> LDFLAGS= -X -noshare
> #else
69a77
> #endif
173c181
< temacs: $(LOCALCPP) $(SHORTNAME) crt0.o ${obj} ${otherobj}
---
> /* temacs: $(LOCALCPP) $(SHORTNAME) crt0.o ${obj} ${otherobj}
174a183,185
> */
> temacs: $(LOCALCPP) $(SHORTNAME) crt0.o /lib/crt0.o ${obj} ${otherobj}
> 	ld ${STARTFLAGS} ${LDFLAGS} -o temacs crt0.o /lib/crt0.o ${obj} ${otherobj} ${LIBES} 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4. diff ../old/malloc.c src/malloc.c
------------------------------------------------------------------------
98c98
< #ifdef SIGIO
---
> #ifdef SIGIO && !defined(EUNICE)
103,104c103
< #ifndef BSD42
< #ifndef USG
---
> #ifndef USG || defined(EUNICE)
107c106
< #else /* if BSD42 */
---
> #ifdef BSD42
535c534
< #ifndef BSD42
---
> #ifdef EUNICE
542c541,542
< #else /* BSD42 */
---
> #else
> #ifdef BSD42
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5. diff ../old/process.c src/process.c
------------------------------------------------------------------------
947a948
> /*klm 10-May-86 Adding following #ifdef/#else instead of these two lines.
949a951,957
> */
> #ifdef HAVE_TIMEVAL
> 	  timeout.tv_sec = 0;
> 	  timeout.tv_usec = 0;
> #else /* not HAVE_TIMEVAL */
>           timeout = 0;
> #endif /* not HAVE_TIMEVAL */
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6. diff ../old/filelock.c src/filelock.c
------------------------------------------------------------------------
122a123
> #if defined (BSD) && !defined (BSD4_1)
123a125,127
> #else
>       chmod (lfname, 0666);
> #endif
211a216
> #if defined (BSD) && !defined (BSD4_1)
212a218,220
> #else
>       chmod (PATH_SUPERLOCK, 0666);
> #endif