[comp.emacs] EMACS patches to allow v18.55 to run on Concurrent/Masscomp machines

will@nirvana.westford.ccur.com (Will Athanasiou) (08/09/90)

	Here are the pathes to allow GNU emacs v18.55 to run on the
Concurrent/Masscomp machines.  There are two things worth mentioning
about these patches:

  1) The changes in crt0.c that follow can and should be removed if
     you are not running RTU 5.0.

       + #ifdef masscomp
       + int _mp_flag = 0;
       + int _process_prof = 0;
       + extern int _sprivate;
       + int privseg = (int) &_sprivate;
       + int _magicpg= (int) &privseg;
       + #endif

  2) Some of our local X servers to not handle SIGIO correctly.  It is
     always handled correctly when going through the network.  With
     this in mind, I modified Emacs to always use the Net X server.  I
     didn't notice any speed degradation.

---- Cut here ----

*** Makefile	Tue Mar 27 16:01:10 1990
--- dist-18.55/Makefile	Mon Jun 18 12:28:50 1990
***************
*** 13,21
  
  # Where to install things
  # Note that on system V you must change MANDIR to /use/local/man/man1.
! LIBDIR= /usr/local/emacs
! BINDIR= /usr/local/bin
! MANDIR= /usr/man/man1
  
  # Flags passed down to subdirectory makefiles.
  MFLAGS=

--- 13,21 -----
  
  # Where to install things
  # Note that on system V you must change MANDIR to /use/local/man/man1.
! LIBDIR= /usr/local/gnuemacs
! BINDIR= /usr/local
! MANDIR= /usr/man/manl
  
  # Flags passed down to subdirectory makefiles.
  MFLAGS='CC=gcc -g -fwritable-strings -traditional -O -fstrength-reduce'
***************
*** 18,24
  MANDIR= /usr/man/man1
  
  # Flags passed down to subdirectory makefiles.
! MFLAGS=
  
  # Subdirectories to make recursively.  `lisp' is not included
  # because the compiled lisp files are part of the distribution

--- 18,24 -----
  MANDIR= /usr/man/manl
  
  # Flags passed down to subdirectory makefiles.
! MFLAGS='CC=gcc -g -fwritable-strings -traditional -O -fstrength-reduce'
  
  # Subdirectories to make recursively.  `lisp' is not included
  # because the compiled lisp files are part of the distribution

*** VIRGIN_GNU/crt0.c	Fri Apr 13 11:36:21 1990
--- dist-18.55/src/crt0.c	Mon Jun 18 12:32:53 1990
***************
*** 303,308
      environ--;
    exit (main (argc, argv, environ));
  }
  #else /* not CRT0_DUMMIES */
  
  /* "m68k" and "m68000" both stand for m68000 processors,

--- 303,317 -----
      environ--;
    exit (main (argc, argv, environ));
  }
+ 
+ #ifdef masscomp
+ int _mp_flag = 0;
+ int _process_prof = 0;
+ extern int _sprivate;
+ int privseg = (int) &_sprivate;
+ int _magicpg= (int) &privseg;
+ #endif
+ 
  #else /* not CRT0_DUMMIES */
  
  /* "m68k" and "m68000" both stand for m68000 processors,
*** VIRGIN_GNU/m-masscomp.h	Fri Apr 13 11:35:10 1990
--- dist-18.55/src/m-masscomp.h	Mon Jun 18 12:34:02 1990
***************
*** 128,134
  
  /* This triggers some stuff to avoid a compiler bug */
  
! #define MASSC_REGISTER_BUG
  
  /* Prevent -lg from being used for debugging.  Not implemented?  */
  

--- 128,134 -----
  
  /* This triggers some stuff to avoid a compiler bug */
  
! /* #define MASSC_REGISTER_BUG */
  
  /* Prevent -lg from being used for debugging.  Not implemented?  */
  
*** VIRGIN_GNU/process.c	Fri Apr 13 11:30:43 1990
--- dist-18.55/src/process.c	Mon Jun 18 12:36:01 1990
***************
*** 1447,1452
  	  else
  	    error("select error: %s", sys_errlist[xerrno]);
  	}
  #ifdef sun
        else if (nfds > 0 && (Available & 1) && interrupt_input)
  	/* System sometimes fails to deliver SIGIO.  */

--- 1447,1457 -----
  	  else
  	    error("select error: %s", sys_errlist[xerrno]);
  	}
+ #ifdef masscomp
+       else if (nfds > 0 && (Available & 1) && interrupt_input)
+ 	 kill( getpid(), /* SIGIO */ 32);
+          /* sigio does not work for local networks. */
+ #endif
  #ifdef sun
        else if (nfds > 0 && (Available & 1) && interrupt_input)
  	/* System sometimes fails to deliver SIGIO.  */
*** VIRGIN_GNU/s-rtu.h	Fri Apr 13 11:31:57 1990
--- dist-18.55/src/s-rtu.h	Mon Jun 18 12:38:06 1990
***************
*** 37,43
   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.

--- 37,43 -----
   does not have "job control" (the ability to stop a program,
   run some other program, then continue the first one).  */
  
! #undef NOMULTIPLEJOBS
  
  /* Emacs can read input using SIGIO and buffering characters itself,
     or using CBREAK mode and making C-g cause SIGINT.
***************
*** 57,63
     through a pipe.
  */
  
! #undef INTERRUPT_INPUT
  
  /* Letter to use in finding device name of first pty,
    if system supports pty's.  'a' means it is /dev/ptya0  */

--- 57,63 -----
     through a pipe.
  */
  
! /* #undef INTERRUPT_INPUT */
  
  /* Letter to use in finding device name of first pty,
    if system supports pty's.  'a' means it is /dev/ptya0  */
***************
*** 154,160
     This hack below isn't the best solution, but without it this
     program will cause the whole system to hang!  !@#$#%$ Masscomp!  */
  
! #define fsync(x) 0	/* "Comment out" fsync calls */
  
  /* RTU has IPC instead of Unix-domain sockets.  */
  

--- 154,160 -----
     This hack below isn't the best solution, but without it this
     program will cause the whole system to hang!  !@#$#%$ Masscomp!  */
  
! /* #define fsync(x) 0*/	/* "Comment out" fsync calls */
  
  /* RTU has IPC instead of Unix-domain sockets.  */
  
*** VIRGIN_GNU/x11term.c	Wed Aug  2 22:56:42 1989
--- dist-18.55/src/x11term.c	Mon Jun 18 13:46:09 1990
***************
*** 1525,1530
  	int  ix;
  	
  
  	vardisplay = (alternate_display ? alternate_display : "");
  	if (!vardisplay) {
  		fprintf (stderr, "DISPLAY environment variable must be set\n");

--- 1525,1534 -----
  	int  ix;
  	
  
+ #ifdef masscomp
+ 	vardisplay = (alternate_display ? alternate_display : (char *) egetenv("DISPLAY"));
+ 	if (!vardisplay || *vardisplay == '\0') {
+ #else
  	vardisplay = (alternate_display ? alternate_display : "");
  	if (!vardisplay) {
  #endif
***************
*** 1527,1532
  
  	vardisplay = (alternate_display ? alternate_display : "");
  	if (!vardisplay) {
  		fprintf (stderr, "DISPLAY environment variable must be set\n");
  		exit (-200);
  	}

--- 1531,1537 -----
  #else
  	vardisplay = (alternate_display ? alternate_display : "");
  	if (!vardisplay) {
+ #endif
  		fprintf (stderr, "DISPLAY environment variable must be set\n");
  		exit (-200);
  	}
***************
*** 1530,1535
  		fprintf (stderr, "DISPLAY environment variable must be set\n");
  		exit (-200);
  	}
  
  	XXdisplay = XOpenDisplay (vardisplay);
  	if (XXdisplay == (Display *) 0) {

--- 1535,1560 -----
  		fprintf (stderr, "DISPLAY environment variable must be set\n");
  		exit (-200);
  	}
+ #ifdef masscomp
+ {
+    char mach_name[50];
+    char *local_str = "local";
+    char *net_str   = "net";
+    char *new_disp;
+ 
+    if ( gethostname( mach_name, 50 ) != 0 ) {
+       fprintf( stderr, "Unable to determine the name of the host machine.\n" );
+       exit (-200);
+    }
+    if ( strncmp( vardisplay, mach_name, strlen(mach_name) ) == 0 ||
+         strncmp( vardisplay, local_str, strlen(local_str) ) == 0 ) {
+       new_disp = (char *) malloc(50);
+       strcpy( new_disp, net_str );
+       strcat( new_disp, index( vardisplay, ':' ));
+       vardisplay = new_disp;
+    }
+ }
+ #endif
  
  	XXdisplay = XOpenDisplay (vardisplay);
  	if (XXdisplay == (Display *) 0) {
*** VIRGIN_GNU/x11term.h	Fri Apr 13 14:19:21 1990
--- dist-18.55/src/x11term.h	Mon Jun 18 12:38:44 1990
***************
*** 20,23
  #define UNBLOCK_INPUT()
  #endif /* SIGIO */
  
! #define CLASS  "emacs"	/* class id for GNU Emacs, used in .Xdefaults, etc. */

--- 20,23 -----
  #define UNBLOCK_INPUT()
  #endif /* SIGIO */
  
! #define CLASS  "gemacs"	/* class id for GNU Emacs, used in .Xdefaults, etc. */
*** VIRGIN_GNU/xfns.c	Sun Aug 13 15:53:07 1989
--- dist-18.55/src/xfns.c	Mon Jun 18 13:09:35 1990
***************
*** 1071,1076
         fontinfo = 0;
         XXdisplay = 0;
       }
     XXdisplay = XOpenDisplay (newdisplayname);
     if (!XXdisplay)
       {

--- 1071,1097 -----
         fontinfo = 0;
         XXdisplay = 0;
       }
+ #ifdef masscomp
+ {
+    char mach_name[50];
+    char local_str = "local";
+    char net_str   = "net";
+    char *new_disp;
+ 
+    if ( gethostname( mach_name, 50 ) != 0 ) {
+       fprintf( stderr, "Unable to determine the name of the host machine.\n" );
+       exit (-200);
+    }
+    if ( strncmp( newdisplayname, mach_name, strlen(mach_name) ) == 0 ||
+         strncmp( newdisplayname, local_str, strlen(local_str) ) == 0 ) {
+       new_disp = (char *) malloc(50);
+       strcpy( new_disp, net_str );
+       strcat( new_disp, newdisplayname[ index( newdisplayname, ':' ) ] );
+       newdisplayname = new_disp;
+    }
+ }
+ #endif
+ 
     XXdisplay = XOpenDisplay (newdisplayname);
     if (!XXdisplay)
       {
*** VIRGIN_GNU/xterm.c	Wed Dec 28 23:09:23 1988
--- dist-18.55/src/xterm.c	Mon Jun 18 13:07:41 1990
***************
*** 1338,1343
        fprintf (stderr, "DISPLAY environment variable must be set\n");
        exit (-200);
      }
  
    XXdisplay = XOpenDisplay (vardisplay);
    if (XXdisplay == (Display *) 0)

--- 1338,1349 -----
        fprintf (stderr, "DISPLAY environment variable must be set\n");
        exit (-200);
      }
+ #ifdef masscomp
+ {
+    char mach_name[50];
+    char local_str = "local";
+    char net_str   = "net";
+    char *new_disp;
  
     if ( gethostname( mach_name, 50 ) != 0 ) {
        fprintf( stderr, "Unable to determine the name of the host machine.\n" );
***************
*** 1339,1344
        exit (-200);
      }
  
    XXdisplay = XOpenDisplay (vardisplay);
    if (XXdisplay == (Display *) 0)
      {

--- 1345,1363 -----
     char net_str   = "net";
     char *new_disp;
  
+    if ( gethostname( mach_name, 50 ) != 0 ) {
+       fprintf( stderr, "Unable to determine the name of the host machine.\n" );
+       exit (-200);
+    }
+    if ( strncmp( vardisplay, mach_name, strlen(mach_name) ) == 0 ||
+         strncmp( vardisplay, local_str, strlen(local_str) ) == 0 ) {
+       new_disp = (char *) malloc(50);
+       strcpy( new_disp, net_str );
+       strcat( new_disp, vardisplay[ index( vardisplay, ':' ) ] );
+       vardisplay = new_disp;
+    }
+ }
+ #endif
    XXdisplay = XOpenDisplay (vardisplay);
    if (XXdisplay == (Display *) 0)
      {
*** VIRGIN_GNU/ymakefile	Fri Apr 13 11:49:54 1990
--- dist-18.55/src/ymakefile	Mon Jun 18 12:41:00 1990
***************
*** 72,77
  #endif /* COFF, or not BSD */
  #endif
  
  /* Some m- files define this to request special switches in ld.  */
  #ifndef LD_SWITCH_MACHINE
  #define LD_SWITCH_MACHINE

--- 72,79 -----
  #endif /* COFF, or not BSD */
  #endif
  
+ CC=gcc
+ 
  /* Some m- files define this to request special switches in ld.  */
  #ifndef LD_SWITCH_MACHINE
  #define LD_SWITCH_MACHINE
***************
*** 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.

--- 104,110 -----
  
  /* If user wants to optimize, this is how.  */
  #ifndef C_OPTIMIZE_SWITCH
! #define C_OPTIMIZE_SWITCH -O -fstrength-reduce -finline-functions -fforce-mem -fforce-addr -fcombine-regs
  #endif
  
  /* cc switches needed to make `asm' keyword work.
***************
*** 142,148
  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

--- 144,150 -----
  SHORT= shortnames
  #endif /* SHORTNAMES */
  
! CFLAGS= C_DEBUG_SWITCH 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