[comp.emacs] gnu emacs 18.41 on iris 3.5 turbos

raible@ORVILLE.ARPA (05/01/87)

So the following s-, m-, and diffs should be sufficient to get
a reasonable gnu emacs on a silicon graphics 3.5 machine.

Features: dumps, asynchronous subprocesses with ptys, uses the iris
          directory routines and alloca, sockets, select, etc.

Known bugs: - PURESIZE is too big.  Anyone know how to read out of the
              running emacs how much of PURESIZE was actually used?
            - Starting new processes sometimes losses due to (random?)
              SIGIOT's.  A work-around is included.
	    - etc/loadst only gets the time - nothing else
            - No mouse support (has anyone done this yet?)

Have fun...

Eric (raible@ames-nas.arpa)

====================================================================

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# /tmp/README /tmp/xemacs-diffs m-irist.h s-iris3-5.h

echo x - /tmp/README
cat > "/tmp/README" << '//E*O*F /tmp/README//'
This file contains all of the files and changes (relative to v18.41) needed
to bring up gnu emacs on a SGI iris.

In brief, the changes are:
	additional header files:
		m-irist.h s-iris3-5.h
	config.h changed to use the above files
	small changes (in context diff form) to:
		keyboard.c process.c sysdep.c unexec.c
//E*O*F /tmp/README//

echo x - /tmp/xemacs-diffs
cat > "/tmp/xemacs-diffs" << '//E*O*F /tmp/xemacs-diffs//'
*** keyboard.c-dst	Tue Mar 17 08:23:05 1987
--- keyboard.c	Fri May  1 10:32:43 1987
***************
*** 42,49 ****
  #include <sys/ioctl.h>
  #endif /* not USG */
  
! #ifdef HPUX /* ioctl (0, FIONREAD, addr) always seems to return -1
! 	       with errno 22 EINVAL.  I don't know what's wrong */
  #undef FIONREAD
  #endif HPUX
  
--- 42,52 ----
  #include <sys/ioctl.h>
  #endif /* not USG */
  
! #if defined(HPUX) || defined(IRIS35)
!  /* For HPUX: ioctl (0, FIONREAD, addr) always seems to return -1
! 	      with errno 22 EINVAL.  I don't know what's wrong */
!  /* For IRIS release 3.5, the effect having this defined is that
!               all keystrokes are delayed one keystroke. "Don't know why" */
  #undef FIONREAD
  #endif HPUX
  
*** process.c-dst	Fri Mar 20 03:54:51 1987
--- process.c	Wed Apr 29 16:23:17 1987
***************
*** 47,52 ****
--- 47,56 ----
  #include <fcntl.h>
  #endif /* USG */
  
+ #ifdef IRIS
+ #include <sysmacros.h>	/* for "minor" */
+ #include <sys/time.h>
+ #else
  #ifdef HAVE_TIMEVAL
  #if defined (USG) && !defined (UNIPLUS)
  #include <time.h>
***************
*** 54,59 ****
--- 58,64 ----
  #include <sys/time.h>
  #endif
  #endif /* HAVE_TIMEVAL */
+ #endif /* IRIS */
  
  #if defined (HPUX) && defined (HAVE_PTYS)
  #include <sys/ptyio.h>
***************
*** 220,233 ****
--- 225,248 ----
  	sprintf (ptyname, "/dev/pty%c%x", c, i);
  #endif /* not MASSCOMP */
  #endif /* not HPUX */
+ 
+ #ifdef IRIS
+ 	*ptyv = open ("/dev/ptc", O_RDWR | O_NDELAY, 0);
+ 	if (*ptyv < 0 || fstat (*ptyv, &stb) < 0)
+ 	  return 0;
+ #else
  	if (stat (ptyname, &stb) < 0)
  	  return 0;
  
  	*ptyv = open (ptyname, O_RDWR | O_NDELAY, 0);
+ #endif /* IRIS */
  	if (*ptyv >= 0)
  	  {
  	    /* check to make certain that both sides are available
  	       this avoids a nasty yet stupid bug in rlogins */
+ #ifdef IRIS
+ 	    sprintf (ptyname, "/dev/ttyq%d", minor(stb.st_rdev));
+ #else
  #ifdef HPUX
              sprintf (ptyname, "/dev/pty/tty%c%x", c, i);
  #else
***************
*** 237,247 ****
--- 252,267 ----
              sprintf (ptyname, "/dev/tty%c%x", c, i);
  #endif /* not RTU */
  #endif /* not HPUX */
+ #endif /* not IRIS */
  #ifndef UNIPLUS
  	    if (access (ptyname, 6) != 0)
  	      {
  		close (*ptyv);
+ #ifdef IRIS
+ 		return (0);
+ #else
  		continue;
+ #endif /* IRIS */
  	      }
  #endif /* not UNIPLUS */
  	    /*
***************
*** 1996,2001 ****
--- 2019,2037 ----
    p->sentinel = sentinel;
  }
  
+ 
+ #ifdef IRIS
+ ignore_signal_IRIS (sig)
+      int sig;
+ {
+   /* Don't know why the IRIS gets random SIGIOT's sometimes when
+      starting new processes, but this allows us to limp along. */
+ 
+   signal (SIGIOT, ignore_signal_IRIS);
+   message1 ("Got a mysterious SIGIOT - kill the last process started.");
+ }
+ #endif
+ 
  init_process ()
  {
    register int i;
***************
*** 2009,2014 ****
--- 2045,2054 ----
  #endif
        )
      signal (SIGCHLD, child_sig);
+ #endif
+ 
+ #ifdef IRIS
+   signal (SIGIOT, ignore_signal_IRIS);
  #endif
  
    input_wait_mask = ChannelMask(0);
*** sysdep.c-dst	Fri Mar 20 07:12:58 1987
--- sysdep.c	Wed Apr 29 16:27:34 1987
***************
*** 1886,1891 ****
--- 1886,1912 ----
  
  #endif /* not HAVE_VFORK */
  
+ #ifdef IRIS
+ 
+ /* The IRIS (3.5) has timevals, but uses sys V utime, and doesn't have the
+    utimbuf structure defined anywhere but in the man page. */
+ 
+ struct utimbuf {
+ 	long actime;
+ 	long modtime;
+ };
+ 
+ utimes (name, tvp)
+ char *name;
+ struct timeval tvp[];
+ {
+   struct utimbuf utb;
+   utb.actime  = tvp[0].tv_sec;
+   utb.modtime = tvp[1].tv_sec;
+   utime (name, &utb);
+ }
+ #endif /* IRIS */
+ 
  #ifdef HPUX
  
  /* HPUX sets HAVE_TIMEVAL but does not implement utimes.  */
*** unexec.c-dst	Fri Mar 20 08:57:05 1987
--- unexec.c	Wed Apr 29 16:23:17 1987
***************
*** 297,303 ****
  
  #else /* not HPUX */
  
! #ifdef USG
  static struct bhdr hdr, ohdr;
  #define a_magic fmagic
  #define a_text tsize
--- 297,303 ----
  
  #else /* not HPUX */
  
! #if defined (USG) && ! defined (IRIS)
  static struct bhdr hdr, ohdr;
  #define a_magic fmagic
  #define a_text tsize
//E*O*F /tmp/xemacs-diffs//

echo x - m-irist.h
cat > "m-irist.h" << '//E*O*F m-irist.h//'
/* m- file for Silicon Graphics Iris 2500 Turbos
   Copyright (C) 1985, 1986 Free Software Foundation, Inc.

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.  */


/* The following three symbols give information on
 the size of various data types.  */

#define SHORTBITS 16		/* Number of bits in a short */

#define INTBITS 32		/* Number of bits in an int */

#define LONGBITS 32		/* Number of bits in a long */

/* Define BIG_ENDIAN iff lowest-numbered byte in a word
   is the most significant byte.  */

/* #define BIG_ENDIAN */

/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
 * group of arguments and treat it as an array of the arguments.  */

#define NO_ARG_ARRAY

/* Define WORD_MACHINE if addresses and such have
 * to be corrected before they can be used as byte counts.  */

#define WORD_MACHINE

/* Define how to take a char and sign-extend into an int.
   On machines where char is signed, this is a no-op.  */

#define SIGN_EXTEND_CHAR(c) (c)

/* Now define a symbol for the cpu type, if your compiler
   does not define it automatically:
   Ones defined so far include vax, m68000, ns16000, pyramid,
   orion, tahoe, APOLLO and many others */

#ifndef m68000
#define m68000
#endif

/* Use type int rather than a union, to represent Lisp_Object */
/* This is desirable for most machines.  */

#define NO_UNION_TYPE

/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
   the 24-bit bit field into an int.  In other words, if bit fields
   are always unsigned.

   If you use NO_UNION_TYPE, this flag does not matter.  */

#define EXPLICIT_SIGN_EXTEND

/* Data type of load average, as read out of kmem.  */

#define LOAD_AVE_TYPE long

/* Convert that into an integer that is 100 for a load average of 1.0  */

#define FSCALE 1.0
#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)

/* Define CANNOT_DUMP on machines where unexec does not work.
   Then the function dump-emacs will not be defined
   and temacs will do (load "loadup") automatically unless told otherwise.  */

/* #define CANNOT_DUMP */

/* Define VIRT_ADDR_VARIES if the virtual addresses of
   pure and impure space as loaded can vary, and even their
   relative order cannot be relied on.

   Otherwise Emacs assumes that data space precedes text space,
   numerically.  */

/* #define VIRT_ADDR_VARIES */

/* LIBS_TERMCAP is used only in ymakefile */

#define LIBS_TERMCAP -ltermcap

/* Define C_ALLOCA if this machine does not support a true alloca
   and the one written in C should be used instead.
   Define HAVE_ALLOCA to say that the system provides a properly
   working alloca function and it should be used.
   Define neither one if an assembler-language alloca
   in the file alloca.s should be used.  */

/* #define C_ALLOCA */
#define HAVE_ALLOCA

/* Define NO_REMAP if memory segmentation makes it not work well
   to change the boundary between the text section and data section
   when Emacs is dumped.  If you define this, the preloaded Lisp
   code will not be sharable; but that's better than failing completely.  */

/* #define NO_REMAP */
//E*O*F m-irist.h//

echo x - s-iris3-5.h
cat > "s-iris3-5.h" << '//E*O*F s-iris3-5.h//'
/* Definitions file for GNU Emacs running on Silicon Graphics 3.5
   Copyright (C) 1985, 1986 Free Software Foundation, Inc.

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 USG
#define USG5
#define IRIS
#define IRIS35

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

#define SYSTEM_TYPE "silicon-graphics-unix"

/* 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

/* Emacs can read input using SIGIO and buffering characters itself,
   or using CBREAK mode and making C-g cause SIGINT.
   The choice is controlled by the variable interrupt_input.
   Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)

   SIGIO can be used only on systems that implement it (4.2 and 4.3).
   CBREAK mode has two disadvatages
     1) At least in 4.2, it is impossible to handle the Meta key properly.
        I hear that in system V this problem does not exist.
     2) Control-G causes output to be discarded.
        I do not know whether this can be fixed in system V.

   Another method of doing input is planned but not implemented.
   It would have Emacs fork off a separate process
   to read the input and send it to the true Emacs process
   through a pipe.
*/

/* #define INTERRUPT_INPUT */

/* Letter to use in finding device name of first pty,
  if system supports pty's.  'a' means it is /dev/ptya0  */

#define FIRST_PTY_LETTER 'a'

/*
 *	Define HAVE_TERMIO if the system provides sysV-style ioctls
 *	for terminal control.
 */

#define HAVE_TERMIO

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

#define HAVE_TIMEVAL
 
/*
 *	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 HAVE_SOCKETS if system supports 4.2-compatible sockets.  */

#define HAVE_SOCKETS

/*
 *	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 */

/* We use the Berkeley (and usg5.2.2) interface to nlist.  */

#define NLIST_STRUCT

/* The file containing the kernel's symbol table is called /vmunix.  */

#define KERNEL_FILE "/vmunix"

/* The symbol in the kernel where the load average is found
   is named _avenrun.  */

#define LDAV_SYMBOL "_avenrun"

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

/*
 *	Make the sigsetmask function go away.  Don't know what the
 *	ramifications of this are, but doesn't seem possible to
 *	emulate it properly anyway at this point.
 */

#define sigsetmask(mask)	/* Null expansion */

/* The IRIS defines SIGIO in signal.h, but doesn't implement it. */
#undef SIGIO

#define LIBS_MACHINE -lbsd -ldbm -lPW
#define C_SWITCH_MACHINE -I/usr/include/bsd

#define PURESIZE 150000

/* There is an inconsistency between the sgi assembler, linker which barfs
   on these. */

#define internal_with_output_to_temp_buffer	stupid_long_name1
#define Finsert_abbrev_table_description	stupid_long_name2

/* setjmp and longjmp can safely replace _setjmp and _longjmp,
   but they will run slower.  */

#define _setjmp setjmp
#define _longjmp longjmp

/* On USG systems the system calls are interruptable by signals
 that the user program has elected to catch.  Thus the system call
 must be retried in these cases.  To handle this without massive
 changes in the source code, we remap the standard system call names
 to names for our own functions in sysdep.c that do the system call
 with retries. */

#define read sys_read
#define open sys_open
#define write sys_write

#define INTERRUPTABLE_OPEN
#define INTERRUPTABLE_IO

/* On USG systems these have different names */

#define index strchr
#define rindex strrchr

/* USG systems tend to put everything declared static
   into the initialized data area, which becomes pure after dumping Emacs.
   Foil this.  Emacs carefully avoids static vars inside functions.  */

/* #define static */

/* Compiler bug bites on many systems when default ADDR_CORRECT is used.  */

#define ADDR_CORRECT(x) (int)((char *)(x) - (char*)0)

/* some errno.h's don't actually allocate the variable itself */

#define NEED_ERRNO

//E*O*F s-iris3-5.h//

exit s