[gnu.emacs.bug] patches for ibm3090 under aix370

schwartz@shire.cs.psu.edu (Scott E. Schwartz) (02/27/90)

Hi all,

	Enclosed are some patches to get emacs 18.55 up under aix370.
They are still kind of rough; no unexec stuff yet, for example, but its
a start.  If any folks at ibm have better, please speak up!  (I am
working with aix 2.something.  Things might change in version 3.)

Let me note a few general problems I had.  First, source files and
ymakefile both include config.h.  But config.h needs to include header
files that will make make barf.  The patches kludge around that, but
the whole concept is distasteful.  I hope v19 has a cleaner scheme.
Second, new concept for the 1990s:
	question: is it sysv or bsd?
	answer: yes.  
In other words, ifdef-ing on SYSV or BSD just doesn't make it anymore.
AIX is simultaneously both and neither.  Surely GnuOS will be like that
too.  By taking a deep breath and claiming to be BSD emacs was able to
build, but the general strategy it uses to conditionalize is wrong.
The right way is to conditionalize on features (ala Larry Wall's
"Config") rather than on vendors.  

=========================== m-ibm370.h =============================

/* m-ibm370.h
   For IBM 3090 type systems running AIX370.
   Concocted by Scott Schwartz <schwartz@cs.psu.edu>
   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) & 0x80) ? ((c) | 0xffffff80) : (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 */
/* high-c defines _AIX370 */

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

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

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

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

/* 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 text space precedes data space,
   numerically.  */

#define VIRT_ADDR_VARIES

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

/*  This bogosity is necessary because someone made lots of unwarranted
    assumptions */
#ifndef IN_YMAKEFILE
# include <alloca.h>
# include <setjmp.h>
#endif

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

=========================== s-aix370.h =============================

/* Definitions file for GNU Emacs running on aix370
   Concocted by Scott Schwartz <schwartz@cs.psu.edu>
   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.  */


/*
 *	Emacs is easier to build if you use the BSD compatability
 *	library.  
 */

/* These are for emacs */
#ifndef BSD4_3
#define BSD4_3
#endif /* BSD4_3 */

#ifndef BSD
#define BSD
#endif /* BSD */

/* This is the magical symbol that makes AIX do the right things */
#ifndef _BSD
#define _BSD
#endif

#define SYSTEM_TYPE "aix370"

/* Do not use interrupt_input = 1 by default, because in 4.3
   we can make noninterrupt input work properly.  */
#undef 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
 
/*
 *	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 _setjmp setjmp
#define _longjmp longjmp

/* 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). */
#define subprocesses

/* If your system uses COFF (Common Object File Format) then define the
   preprocessor symbol "COFF". */
/* AIX370 does, but unexec isn't done yet, so punt. */
/* #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 "/unix"

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

#define LDAV_SYMBOL "_avenrun"
#define LIBS_SYSTEM -lbsd

=========================== feed this to patch =====================

*** sysdep.c	Sun Jan 07 18:03:23 1990
--- sysdep.c-	Fri Feb 23 22:15:12 1990
***************
*** 150,161 ****
  /* Some USG systems with TIOCGWINSZ need this file; some don't have it.
     We don't know how to distinguish them.
     If this #include gets an error, just delete it.  */
- #ifndef _AIX370
  #include <sys/sioctl.h>
  #endif
  #endif
  #endif
- #endif
  #ifdef HAVE_TIMEVAL
  #ifdef HPUX
  #include <time.h>
--- 150,159 ----
***************
*** 834,840 ****
        if (!flow_control) ioctl (0, TIOCSTART, 0);
  #endif
  
! #if defined(AIX) && !defined(_AIX370)
        hft_init ();
  #endif
  
--- 832,838 ----
        if (!flow_control) ioctl (0, TIOCSTART, 0);
  #endif
  
! #ifdef AIX
        hft_init ();
  #endif
  
***************
*** 1039,1045 ****
    while (ioctl (0, TCSETAW, &old_gtty) < 0 && errno == EINTR);
  #endif /* not VMS */
  
! #if defined(AIX) && !defined(_AIX370)
    hft_reset ();
  #endif
  }
--- 1037,1043 ----
    while (ioctl (0, TCSETAW, &old_gtty) < 0 && errno == EINTR);
  #endif /* not VMS */
  
! #ifdef AIX
    hft_reset ();
  #endif
  }
***************
*** 3521,3527 ****
  }
  #endif /* VMS */
  
! #if defined(AIX) && !defined(_AIX370)
  
  /* Get files for keyboard remapping */
  #define HFNKEYS 2
--- 3519,3525 ----
  }
  #endif /* VMS */
  
! #ifdef AIX
  
  /* Get files for keyboard remapping */
  #define HFNKEYS 2
*** ymakefile	Sat Jan 06 23:07:15 1990
--- ymakefile-	Fri Feb 23 22:15:04 1990
***************
*** 28,34 ****
  oldXMenudir = ../oldXMenu/
  
  #define NO_SHORTNAMES
- #define IN_YMAKEFILE
  #include "config.h"
  
  /* Use HAVE_X11 as an alias for X11 in this file
--- 28,33 ----
***************
*** 51,57 ****
  
  /* Unless inhibited or changed, use -lg to link for debugging.  */
  #ifndef LIBS_DEBUG
! #define LIBS_DEBUG 
  #endif
  
  /* Some s- files define this to request special libraries.  */
--- 50,56 ----
  
  /* Unless inhibited or changed, use -lg to link for debugging.  */
  #ifndef LIBS_DEBUG
! #define LIBS_DEBUG -lg
  #endif
  
  /* Some s- files define this to request special libraries.  */
***************
*** 66,72 ****
  
  /* Some s- files define this to request special switches in ld.  */
  #ifndef LD_SWITCH_SYSTEM
! #if defined (BSD) && !defined (COFF) && !defined(_AIX370)
  #define LD_SWITCH_SYSTEM -X
  #else
  #define LD_SWITCH_SYSTEM
--- 65,71 ----
  
  /* Some s- files define this to request special switches in ld.  */
  #ifndef LD_SWITCH_SYSTEM
! #if defined (BSD) && !defined (COFF)
  #define LD_SWITCH_SYSTEM -X
  #else
  #define LD_SWITCH_SYSTEM
***************
*** 103,109 ****
  
  /* If user wants to optimize, this is how.  */
  #ifndef C_OPTIMIZE_SWITCH
! #define C_OPTIMIZE_SWITCH -g
  #endif
  
  /* cc switches needed to make `asm' keyword work.
--- 102,108 ----
  
  /* If user wants to optimize, this is how.  */
  #ifndef C_OPTIMIZE_SWITCH
! #define C_OPTIMIZE_SWITCH -O
  #endif
  
  /* cc switches needed to make `asm' keyword work.
***************
*** 116,122 ****
     if requested by configuration.  */
  
  #ifdef LD_TEXT_START_ADDR
! STARTFLAGS = -T LD_TEXT_START_ADDR 
  #endif
  
  LD=ld
--- 115,121 ----
     if requested by configuration.  */
  
  #ifdef LD_TEXT_START_ADDR
! STARTFLAGS = -T LD_TEXT_START_ADDR -e __start
  #endif
  
  LD=ld
***************
*** 143,149 ****
  SHORT= shortnames
  #endif /* SHORTNAMES */
  
! CFLAGS= C_DEBUG_SWITCH -Demacs $(MYCPPFLAG) C_SWITCH_MACHINE C_SWITCH_SYSTEM
  /* DO NOT use -R.  There is a special hack described in lastfile.c
     which is used instead.  Some initialized data areas are modified
     at initial startup, then labeled as part of the text area when
--- 142,148 ----
  SHORT= shortnames
  #endif /* SHORTNAMES */
  
! CFLAGS= C_OPTIMIZE_SWITCH -Demacs $(MYCPPFLAG) C_SWITCH_MACHINE C_SWITCH_SYSTEM
  /* DO NOT use -R.  There is a special hack described in lastfile.c
     which is used instead.  Some initialized data areas are modified
     at initial startup, then labeled as part of the text area when


--
Scott Schwartz		schwartz@cs.psu.edu
"the same idea is applied today in the use of slide rules." -- Don Knuth