From moeller@gwdvms.dnet.gwdg.de Thu Apr 24 10:20:31 1997
Return-Path: <moeller@gwdvms.dnet.gwdg.de>
Delivery-Date: Thu, 24 Apr 1997 10:20:31 +0200
Received: from dnet.gwdg.de (actually gwdgi.gwdg.de) by gwdu42.gwdg.de 
          with SMTP (PP); Thu, 24 Apr 1997 10:20:10 +0200
Date: Thu, 24 Apr 1997 10:20:10 +0200
From: "GWDVMS::MOELLER" <moeller@gwdvms.dnet.gwdg.de>
To: EMOENKE@gwdg.de
Subject: EMACS 19.34 on CRAY(T3E) - a first attempt
Status: RO

The "red tape" alluded to below is too much for me.
So here's my contribution to the EMACS porting community,
use it for whatever purpose you like.

Note that an EMACS created with this configuration doesn't
work flawlessly (often needs ^G^G to re-awaken), but it won't
crash on the old (1.2) unicos-mk, and I'm currently using it
lacking a better tool ...

Wolfgang J. Moeller, Tel. +49 551 2011516 or -510, moeller@gwdvms.dnet.gwdg.de
GWDG, D-37077 Goettingen, F.R.Germany   |       Disclaimer: No claim intended!
<moeller@decus.decus.de>  ----- <moeller@gwdg.de>  -----  <w.moeller@ieee.org>
================================================================================
From:	GWDVMS::MOELLER      14-FEB-1997 12:54:27.93
To:	GWDGI::"rms@gnu.ai.mit.edu"
Subj:	EMACS on CRAY T3E (was Re: How to proceed ...)

> The first thing to do is send me the diffs to port Emacs.
> Then I will read them and maybe ask for some changes.

No diffs, as the src/s and src/m entries are all new

----- emacs-19.34/src/m/t3e.h --------------------------------------------------
/* t3e.h (UNICOS/mk) - distinction between OS and MACHINE unclear yet */

/* The following line tells the configuration script what sort of 
   operating system this machine is likely to run.
   USUAL-OPSYS="unicosmk"  */

#define LIBS_DEBUG		/* no -lg available */
#define ORDINARY_LINK
#define TEXT_START -1

#define BROKEN_FIONREAD		/* ??? it seems */

#define SYS_MALLOC		/* just conservative */
#define C_ALLOCA		/* alloca() not provided */

#define CANNOT_DUMP
#define VIRT_ADDR_VARIES	/* just conservative */
#define NO_REMAP		/* just conservative */

#define WORDS_BIG_ENDIAN

#define NO_ARG_ARRAY

/* following lines adapted from m/alpha.h
 * NOTE: T3E is BIG_ENDIAN, and uses 43 bit "physical" addresses
 */

#define PNTR_COMPARISON_TYPE unsigned long

#define EMACS_INT long
#define EMACS_UINT unsigned long
#define SPECIAL_EMACS_INT		/* ??? */

#define EXPLICIT_SIGN_EXTEND

#define NO_UNION_TYPE
#define VALBITS         60

/* ??? can't find any reference to this in 19.34 */
/* ??? #define MARKBIT         0x8000000000000000L */

/* With CRAY cc, long == int (both are 64 bits, but short is 32 bits) */
/* Define XINT and XUINT so that they can take arguments of type int  */
/* #define XINT(a)  (((long) (a) << (BITS_PER_LONG - VALBITS)) >> (BITS_PER_LONG - VALBITS)) */
/* #define XUINT(a) ((long) (a) & VALMASK) */

/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
#define XPNTR(a) XUINT(a)

/* end of t3e.h (UNICOS/mk V1) */
--------------------------------------------------------------------------------
----- emacs-19.34/src/s/unicosmk.h ---------------------------------------------
/* unicosmk.h - UNICOS/mk V1 on CRAY T3E
 * cf. "../m/t3e.h" - distinction between OS and MACHINE isn't clear yet
 */

#define USG
#define USG5
/* ??? #define USG5_3 */
/* ??? #define USG5_4 */

#define SYSTEM_TYPE "UNICOS/mk"

/* have "ksh":		#define NOMULTIPLEJOBS */

/* doesn't work:	#define INTERRUPT_INPUT */

#define HAVE_PTYS
/* don't #define SYSV_PTYS */
#define PTY_ITERATION	c = sysconf(_SC_CRAY_NPTY); if(c < 0) c = 128; for (i = 0; i < c; i++)
#define PTY_NAME_SPRINTF	sprintf(pty_name,"/dev/pty/%03d",i);
#define PTY_TTY_NAME_SPRINTF	sprintf(pty_name,"/dev/ttyp%03d",i);
#define EMACS_C_MODE_DUMMY ""
/* CRAY-specific ioctl() for directing /dev/tty to a terminal */
#define SETUP_SLAVE_PTY		ioctl(xforkin,TCSETCTTY,0);
/* not referenced: #define FIRST_PTY_LETTER 'a' */

/* inhibits inclusion of <termios.h>:	#define HAVE_TERMIO */
#define NO_TERMIO	/* don't include <termio.h> */
#define HAVE_TERMIOS

#define subprocesses

#define SIGTYPE void
#define POSIX_SIGNALS	/* seem to work, anyway */

/* definition of `wait3()' taken from usg5-4.h */
#define wait3(status,options,rusage) waitpid((pid_t) -1, (status), (options))
#define WCOREDUMP(w) ((w&0200) != 0)	/* fake */
#define WAIT_USE_INT			/* have "syswait.h" define the rest */

#define SIGNALS_VIA_CHARACTERS	/* otherwise, ^C in "shell" wouldn't work */

#define HAVE_SOCKETS
#define NO_SOCK_SIGIO	/* doesn't seem to work without */
#define NO_SIOCTL_H	/* no such header, anyway */

#define HAVE_VFORK
#define VFORK_RETURN_TYPE int

/* #define NONSYSTEM_DIR_LIBRARY */
#define SYSV_SYSTEM_DIR

#define BSTRING

/* ??? #define COFF */

/* #define MAIL_USE_FLOCK */
/* #define CLASH_DETECTION */

/* #define SEPCHAR ':' */
/* #define static */

#define TERMINFO

#define _setjmp setjmp
#define _longjmp longjmp

#define INTERRUPTIBLE_OPEN
#define open sys_open
#define INTERRUPTIBLE_CLOSE
#define close sys_close
#define INTERRUPTIBLE_IO
#define write sys_write
#define read sys_read

/* end of unicosmk.h ( UNICOS/mk V1 on CRAY T3E) */
--------------------------------------------------------------------------------

My tentative change to config.guess (so I need no argument to ./configure) goes

--------------------------------------------------------------------------------
*** config.guess.ORIG   Tue Aug 13 03:10:24 1996
--- config.guess.WJM    Fri Jan 31 10:27:11 1997
***************
*** 51,56 ****
--- 51,61 ----
  # Note: order is significant - the case branches are not exclusive.

  case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ ##+wjm, as of UNICOS-MK V1.2
+     CRAY\ T3E:*:*:unicosmk)
+       echo t3e-cray-unicosmk
+       exit 0;;
+ ##.wjm
      alpha:OSF1:*:*)
        # A Vn.n version is a released version.
        # A Tn.n version is a released field test version.
--------------------------------------------------------------------------------

Naturally (???), I had to change all of the 3 other config* to pass 
the "t3e-cray-unicosmk" triple, but I really don't understand this stuff.

I reported two bugs related to having a CANNOT_DUMP emacs-19.34
to gnu.emacs.bugs some days ago (`make install' fails to create "DOC",
and "default.el" drops the first two file name arguments).

> When it is all settled, then I will ask you for legal papers
> to give us permission to use your changes.

I hope that not too much red tape will be involved here, although
it was a lot of work to start fresh on a machine that has no tools
whatsoever for inspecting a "core" file my config files, but now
it seems to work just fine (no fault with all of basic editing, 
"dired", "shell", "mail", "gnus" and the X windows funtionality).

You'll notice that my config files are just a start, that might lead 
someone else to refine things and/or investigate another CRAY machine. 
>From what I infer from ports of other software, UNICOS/mk ("mk" for
"microkernel" - the T3E is a parallel computer) is more 'standard' 
than other UNICOSes (which I haven't ever seen), but as of the first
production release, it has some very rough edges (and even a slightly 
buggy compiler, which gave me trouble at one place with porting "gmp" -
already informed the "gmp" maintainer). For this reason, I didn't even
attempt to clean up compiler warnings, of which there's a lot (mostly
about pointers to signed vs. unsigned chars, to be sure).

Regards,
Wolfgang J. Moeller, Tel. +49 551 2011516 or -510, moeller@gwdvms.dnet.gwdg.de
GWDG, D-37077 Goettingen, F.R.Germany   |       Disclaimer: No claim intended!
<moeller@decus.decus.de>  ----- <moeller@gwdg.de>  -----  <w.moeller@ieee.org>

