[comp.lang.lisp.x] Problem apparently solved

maverick@cork.Berkeley.EDU (Vance Maverick) (05/25/91)

I took the version of XLISP 2.1 available under the WINTERP distribution from export.lcs.mit.edu, and after some twiddling, that seems to work fine.

	Vance

mayer@hplabs.hpl.hp.com (Niels Mayer) (05/25/91)

In article <1991May24.215346.7480@agate.berkeley.edu> maverick@cork.Berkeley.EDU (Vance Maverick) writes:
>I took the version of XLISP 2.1 available under the WINTERP distribution from export.lcs.mit.edu, and after some twiddling, that seems to work fine.

Note that the version of XLISP 2.1 in WINTERP does not have all the Tom
Almy bugfixes and patches applied to it. Despite not being the latest and
greates, it works ok for us currently. Some release in the near future will
be a merge of the Almy XLISP with WINTERP's.

Until then, you may be interested in what I had to do to get the version of
XLISP 2.1 on bikini.cis.ufl.edu (containing the Tom Almy patches as well as
the Ken Whedbee patches) to run on HPUX 7.0 on an HP 9000 series 370.

			--------------------
To: kcw@cis.ufl.edu (Ken Whedbee)
Subject: problems compiling XLISP/src/unixstuf.c on HPUX 7.0
Organization: Hewlett-Packard Labs, Software & Systems Lab, Palo Alto, CA.
X-Mailer: mh6.7
Date: Tue, 14 May 91 16:53:55 PDT
Message-ID: <8617.674265235@hplnpm.hpl.hp.com>
From: Niels P. Mayer <mayer@hplnpm.hpl.hp.com>


> the improved version of xlisp2.1 can be found at:
> anonymous/ftp bikini.cis.ufl.edu (or 128.227.224.1)
> 	       and: pub/xlisp.tar.Z           "unix version"

I grabbed this version and compiled it on my HP9000s370 running HPUX 7.0 --
I got the following compiler errors:

| hplnpm-301-.../xlisp-2.1.almy+whedbee/src> make -f makeunix
|         cc -O -DUNIX -c xlisp.c
|   ...
|         cc -O -DUNIX -c unixstuf.c
| "unixstuf.c", line 41: redeclaration of times
| "unixstuf.c", line 152: warning: incorrect combination of pointer and integer, op =
| *** Error code 1

I fixed it with the following patch:
==============================================================================
*** unixstuf.c.~1~	Fri Apr 12 04:00:00 1991
--- unixstuf.c	Tue May 14 15:56:33 1991
***************
*** 13,18
  ********************************************************************************
  */
  
  #include <signal.h>
  #include <sys/types.h>
  #include <sys/times.h>

--- 13,19 -----
  ********************************************************************************
  */
  
+ #include <stdlib.h>
  #include <signal.h>
  #include <sys/types.h>
  #include <sys/times.h>
***************
*** 38,44
  
  /* -- external variables */
  extern	FILE	*tfp;
! extern long times();
  extern LVAL xlenv, xlfenv, xldenv;
  
  /* -- local variables */

--- 39,45 -----
  
  /* -- external variables */
  extern	FILE	*tfp;
! /* extern long times(); NPM */
  extern LVAL xlenv, xlfenv, xldenv;
  
  /* -- local variables */
==============================================================================

However, now when I run xlisp,

(1) I cannot evaluate expressions by hitting <return>.
(2) ^T generates a core dump:
        [ Tue May 14 16:11:13 Free: 251, GC calls: 1, Total: 39441 ]
	Segmentation fault (core dumped)

Because of (1), I can't test whether the time functions you added (e.g.
time) actually work on HPUX.

I'll have to figure out what is going wrong here at some later time.  I
just wanted to tell you that there seem to be problems with this version of
XLISP.

=========================== take 2 ===============================================

Just to check on things, I peephole-commented out the offending tty-control
lines in unixstuf.c and ran a few cursory tests -- things seem to work ok,
including the time functions). Note that I didn't actually look closely at
the stuff I commented out, so there may be unknown problems lurking....
more later.

You may want to make the tty-control stuff a compilation option. I don't
know if I'd qualify as normal unix xlisp user, but I tend to use xlisp
under an emacs process. The current lisp subprocess facilities under emacs
seem to work well w/ buffered I/O; furthermore, the desired ^T, ^C, ^P etc
functionality can all be done inside emacs (upon appropriate keypress have
emacs send the appropriate function call to xlisp). Of course, it is nice
to be able to break out of an infinite loop (etc) using a signal handler.

Here's the patch for the final version of unixstuf.c with which I got a
working version of xlisp:
==============================================================================
*** unixstuf.c.~1~	Fri Apr 12 04:00:00 1991
--- unixstuf.c	Tue May 14 16:22:55 1991
***************
*** 13,18
  ********************************************************************************
  */
  
  #include <signal.h>
  #include <sys/types.h>
  #include <sys/times.h>

--- 13,19 -----
  ********************************************************************************
  */
  
+ #include <stdlib.h> /* NPM */
  #include <signal.h>
  #include <sys/types.h>
  #include <sys/times.h>
***************
*** 17,22
  #include <sys/types.h>
  #include <sys/times.h>
  
  #ifdef BSD
  #include <sys/ioctl.h>
  struct sgttyb savetty;

--- 18,24 -----
  #include <sys/types.h>
  #include <sys/times.h>
  
+ #ifdef COMMENTED_OUT_BY_NPM
  #ifdef BSD
  #include <sys/ioctl.h>
  struct sgttyb savetty;
***************
*** 27,33
  #include <termio.h>
  struct termio savetty;
  struct termio newtty;
! #define stty(fd,arg)	(ioctl(fd, TCGETA, arg))
  #define gtty(fd,arg)	(ioctl(fd, TCSETAF, arg))
  #endif
  

--- 29,35 -----
  #include <termio.h>
  struct termio savetty;
  struct termio newtty;
! #define tty(fd,arg)	(ioctl(fd, TCGETA, arg))
  #define gtty(fd,arg)	(ioctl(fd, TCSETAF, arg))
  #endif
  #endif
***************
*** 30,35
  #define stty(fd,arg)	(ioctl(fd, TCGETA, arg))
  #define gtty(fd,arg)	(ioctl(fd, TCSETAF, arg))
  #endif
  
  #include "xlisp.h"
  

--- 32,38 -----
  #define tty(fd,arg)	(ioctl(fd, TCGETA, arg))
  #define gtty(fd,arg)	(ioctl(fd, TCSETAF, arg))
  #endif
+ #endif
  
  #include "xlisp.h"
  
***************
*** 38,44
  
  /* -- external variables */
  extern	FILE	*tfp;
! extern long times();
  extern LVAL xlenv, xlfenv, xldenv;
  
  /* -- local variables */

--- 41,49 -----
  
  /* -- external variables */
  extern	FILE	*tfp;
! #ifdef COMMENTED_OUT_BY_NPM
! extern long times(); 
! #endif
  extern LVAL xlenv, xlfenv, xldenv;
  
  /* -- local variables */
***************
*** 48,53
  static	int	lindex;
  static	int	lcount;
  
  char *xfgets();
  char read_keybd();
  

--- 53,59 -----
  static	int	lindex;
  static	int	lcount;
  
+ #ifdef COMMENTED_OUT_BY_NPM
  char *xfgets();
  char read_keybd();
  #endif
***************
*** 50,55
  
  char *xfgets();
  char read_keybd();
  
  
  /******************************************************************************

--- 56,62 -----
  #ifdef COMMENTED_OUT_BY_NPM
  char *xfgets();
  char read_keybd();
+ #endif
  
  /******************************************************************************
   * xsystem - run a process, sending output (if any) to stdout/stderr
***************
*** 51,57
  char *xfgets();
  char read_keybd();
  
- 
  /******************************************************************************
   * xsystem - run a process, sending output (if any) to stdout/stderr
   *

--- 58,63 -----
  char read_keybd();
  #endif
  
  /******************************************************************************
   * xsystem - run a process, sending output (if any) to stdout/stderr
   *
***************
*** 102,107
  char	*banner;
  {
  	fprintf(stderr,"%s\nUNIX version\n", banner );
  	init_tty();
  	lindex	= 0;
  	lcount	= 0;

--- 108,114 -----
  char	*banner;
  {
  	fprintf(stderr,"%s\nUNIX version\n", banner );
+ #ifdef COMMENTED_OUT_BY_NPM
  	init_tty();
  #endif
  	lindex	= 0;
***************
*** 103,108
  {
  	fprintf(stderr,"%s\nUNIX version\n", banner );
  	init_tty();
  	lindex	= 0;
  	lcount	= 0;
  }

--- 110,116 -----
  	fprintf(stderr,"%s\nUNIX version\n", banner );
  #ifdef COMMENTED_OUT_BY_NPM
  	init_tty();
+ #endif
  	lindex	= 0;
  	lcount	= 0;
  }
***************
*** 110,115
  /* -- osfinish - clean up before returning to the operating system */
  osfinish()
  {
  	stty(0, &savetty);
  }
  

--- 118,124 -----
  /* -- osfinish - clean up before returning to the operating system */
  osfinish()
  {
+ #ifdef COMMENTED_OUT_BY_NPM
  	stty(0, &savetty);
  #endif
  }
***************
*** 111,116
  osfinish()
  {
  	stty(0, &savetty);
  }
  
  

--- 120,126 -----
  {
  #ifdef COMMENTED_OUT_BY_NPM
  	stty(0, &savetty);
+ #endif
  }
  
  
***************
*** 210,215
  int	ostgetc()
  {
  
  	while(--lcount < 0 )
  		{
  		if ( xfgets(lbuf,LBSIZE,stdin) == NULL )

--- 220,226 -----
  int	ostgetc()
  {
  
+ #ifdef COMMENTED_OUT_BY_NPM
  	while(--lcount < 0 )
  		{
  		if ( xfgets(lbuf,LBSIZE,stdin) == NULL )
***************
*** 223,228
  		}
  
  	return( lbuf[lindex++] );
  }
  
  

--- 234,252 -----
  		}
  
  	return( lbuf[lindex++] );
+ #else
+ 	while(--lcount < 0 )
+ 		{
+ 		if ( fgets(lbuf,LBSIZE,stdin) == NULL )
+ 			return( EOF );
+ 		if ( tfp )
+ 			fputs( lbuf, tfp );
+ 		lcount = strlen( lbuf );
+ 		lindex = 0;
+ 		}
+ 
+ 	return( lbuf[lindex++] );
+ #endif
  }
  
  
***************
*** 259,264
  {
  }
  
  osx_check(ch)
  char ch;
  {

--- 283,289 -----
  {
  }
  
+ #ifdef COMMENTED_OUT_BY_NPM
  osx_check(ch)
  char ch;
  {
***************
*** 274,279
  	  printf("\n ");
       }
  }
  
  
  /* -- ossymbols - enter os-specific symbols */

--- 299,305 -----
  	  printf("\n ");
       }
  }
+ #endif
  
  /* -- ossymbols - enter os-specific symbols */
  ossymbols()
***************
*** 275,281
       }
  }
  
- 
  /* -- ossymbols - enter os-specific symbols */
  ossymbols()
  {

--- 301,306 -----
  }
  #endif
  
  /* -- ossymbols - enter os-specific symbols */
  ossymbols()
  {
***************
*** 305,311
    ostputc('\n');
  }
  
! 
  char read_keybd()
  {
     int nrd;

--- 330,336 -----
    ostputc('\n');
  }
  
! #ifdef COMMENTED_OUT_BY_NPM
  char read_keybd()
  {
     int nrd;
***************
*** 324,329
  
     return(buf[0]);
  }
  
  
  init_tty()

--- 349,355 -----
  
     return(buf[0]);
  }
+ #endif
  
  #ifdef COMMENTED_OUT_BY_NPM
  init_tty()
***************
*** 325,331
     return(buf[0]);
  }
  
! 
  init_tty()
  {
  	/* extern sigcatch(); */

--- 351,357 -----
  }
  #endif
  
! #ifdef COMMENTED_OUT_BY_NPM
  init_tty()
  {
  	/* extern sigcatch(); */
***************
*** 364,369
  		exit();
  	}
  }
  
  onsusp()
  {

--- 390,396 -----
  		exit();
  	}
  }
+ #endif
  
  #ifdef COMMENTED_OUT_BY_NPM
  onsusp()
***************
*** 365,370
  	}
  }
  
  onsusp()
  {
      /* ignore SIGTTOU so we dont get stopped if csh grabs the tty */

--- 392,398 -----
  }
  #endif
  
+ #ifdef COMMENTED_OUT_BY_NPM
  onsusp()
  {
      /* ignore SIGTTOU so we dont get stopped if csh grabs the tty */
***************
*** 383,388
      signal(SIGTSTP, onsusp);
      stty(0, &newtty);
  }
  
  
  

--- 411,417 -----
      signal(SIGTSTP, onsusp);
      stty(0, &newtty);
  }
+ #endif
  
  #ifdef COMMENTED_OUT_BY_NPM
  char *xfgets(s, n, iop)
***************
*** 384,391
      stty(0, &newtty);
  }
  
! 
! 
  char *xfgets(s, n, iop)
  char *s;
  register FILE *iop;

--- 413,419 -----
  }
  #endif
  
! #ifdef COMMENTED_OUT_BY_NPM
  char *xfgets(s, n, iop)
  char *s;
  register FILE *iop;
***************
*** 418,423
  	*cs++ = '\0';
  	return(s);
  }
  
  #ifdef TIMES
  /***********************************************************************/

--- 446,452 -----
  	*cs++ = '\0';
  	return(s);
  }
+ #endif
  
  #ifdef TIMES
  /***********************************************************************/


-------------------------------------------------------------------------------
            Niels Mayer -- hplabs!mayer -- mayer@hplabs.hp.com
                  Human-Computer Interaction Department
                       Hewlett-Packard Laboratories
                              Palo Alto, CA.
                                   *