changeset 839:b8530da02bb7

[project @ 1994-10-19 21:44:00 by jwe]
author jwe
date Wed, 19 Oct 1994 21:44:46 +0000
parents 1d012b8110c5
children ecb5bbc739c0
files src/Map.cc src/dirfns.cc src/minmax.cc src/sighandlers.cc src/sighandlers.h
diffstat 5 files changed, 462 insertions(+), 370 deletions(-) [+]
line wrap: on
line diff
--- a/src/Map.cc	Wed Oct 19 20:58:27 1994 +0000
+++ b/src/Map.cc	Wed Oct 19 21:44:46 1994 +0000
@@ -1,4 +1,4 @@
-// octave-map.cc                                   -*- C++ -*-
+// Map.cc                                               -*- C++ -*-
 /*
 
 Copyright (C) 1992, 1993, 1994 John W. Eaton
--- a/src/dirfns.cc	Wed Oct 19 20:58:27 1994 +0000
+++ b/src/dirfns.cc	Wed Oct 19 21:44:46 1994 +0000
@@ -23,12 +23,6 @@
 
 /*
 
-The functions listed below were adapted from similar functions from
-the GNU C library, copyright (C) 1991, 1992, 1993, Free Software
-Foundation, Inc.
-
-  dir_access    exists    gen_tempname    tempnam
-
 The functions listed below were adapted from a similar functions
 from GNU Bash, the Bourne Again SHell, copyright (C) 1987, 1989, 1991
 Free Software Foundation, Inc.
@@ -54,9 +48,6 @@
 #include <string.h>
 #include <strstream.h>
 #include <sys/param.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
 
 // This mess suggested by the autoconf manual.
 // unistd.h defines _POSIX_VERSION on POSIX.1 systems.
@@ -109,192 +100,6 @@
 // of symbolic link following.
 static int verbatim_pwd = 1;
 
-#ifndef HAVE_TEMPNAM
-
-#ifndef P_tmpdir
-#define P_tmpdir "/usr/tmp/"
-#endif
-
-// Return nonzero if DIR is an existent directory.
-
-static int
-diraccess (const char *dir)
-{
-  struct stat buf;
-  return stat (dir, &buf) == 0 && S_ISDIR (buf.st_mode);
-}
-
-// Return nonzero if FILE exists.
-
-static int
-exists (const char *file)
-{
-// We can stat the file even if we can't read its data.
-  struct stat st;
-  int save = errno;
-  if (stat (file, &st) == 0)
-    return 1;
-  else
-    {
-// We report that the file exists if stat failed for a reason other
-// than nonexistence.  In this case, it may or may not exist, and we
-// don't know; but reporting that it does exist will never cause any
-// trouble, while reporting that it doesn't exist when it does would
-// violate the interface of gen_tempname.
-      int exists = errno != ENOENT;
-      errno = save;
-      return exists;
-    }
-}
-
-// These are the characters used in temporary filenames.
-
-static const char letters[] =
-  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-
-// Generate a temporary filename and return it (in a static buffer).
-// If DIR_SEARCH is nonzero, DIR and PFX are used as described for
-// tempnam.  If not, a temporary filename in P_tmpdir with no special
-// prefix is generated.  This goes through a cyclic pattern of all
-// possible filenames consisting of five decimal digits of the current
-// pid and three of the characters in `letters'.  Data for tempnam and
-// tmpnam is kept separate, but when tempnam is using P_tmpdir and no
-// prefix (i.e, it is identical to tmpnam), the same data is used.
-// Each potential filename is tested for an already-existing file of
-// the same name, and no name of an existing file will be returned.
-// When the cycle reaches its end (12345ZZZ), NULL is returned.
-
-static char *
-gen_tempname (const char *dir, const char *pfx, int dir_search,
-	      size_t *lenptr)
-{
-  int saverrno = errno;
-  static const char tmpdir[] = P_tmpdir;
-  static size_t indices[2];
-  size_t *idx;
-  static char buf[MAXPATHLEN];
-  static pid_t oldpid = (pid_t) 0;
-  pid_t pid = getpid ();
-  register size_t len, plen, dlen;
-
-  if (dir_search)
-    {
-      register const char *d = getenv ("TMPDIR");
-      if (d != NULL && !diraccess (d))
-	d = NULL;
-      if (d == NULL && dir != NULL && diraccess (dir))
-	d = dir;
-      if (d == NULL && diraccess (tmpdir))
-	d = tmpdir;
-      if (d == NULL && diraccess ("/tmp"))
-	d = "/tmp";
-      if (d == NULL)
-	{
-	  errno = ENOENT;
-	  return NULL;
-	}
-      dir = d;
-    }
-  else
-    dir = tmpdir;
-
-  dlen = strlen (dir);
-
-// Remove trailing slashes from the directory name.
-  while (dlen > 1 && dir[dlen - 1] == '/')
-    --dlen;
-
-  if (pfx != NULL && *pfx != '\0')
-    {
-      plen = strlen (pfx);
-      if (plen > 5)
-	plen = 5;
-    }
-  else
-    plen = 0;
-
-  if (dir != tmpdir && !strcmp (dir, tmpdir))
-    dir = tmpdir;
-  idx = &indices[(plen == 0 && dir == tmpdir) ? 1 : 0];
-
-  if (pid != oldpid)
-    {
-      oldpid = pid;
-      indices[0] = indices[1] = 0;
-    }
-
-  len = dlen + 1 + plen + 5 + 3;
-  for (; *idx < ((sizeof (letters) - 1) * (sizeof (letters) - 1) *
-		 (sizeof (letters) - 1));
-       ++*idx)
-    {
-// Construct a file name and see if it already exists.
-//
-// We use a single counter in *IDX to cycle each of three character
-// positions through each of 62 possible letters.
-
-      if (sizeof (buf) < len)
-	return NULL;
-
-      sprintf (buf, "%.*s/%.*s%.5d%c%c%c",
-	       (int) dlen, dir, (int) plen, pfx, pid % 100000,
-	       letters[*idx % (sizeof (letters) - 1)],
-	       letters[(*idx / (sizeof (letters) - 1))
-		       % (sizeof (letters) - 1)], 
-	       letters[(*idx / ((sizeof (letters) - 1)
-				* (sizeof (letters) - 1)))
-		       % (sizeof (letters) - 1)]);
-
-      if (strlen (buf) != (int) len)
-	return NULL;
-
-      if (exists (buf))
-	continue;
-
-// If the file already existed we have continued the loop above, so we
-// only get here when we have a winning name to return.
-
-      errno = saverrno;
-
-      if (lenptr != NULL)
-	*lenptr = len + 1;
-
-      return buf;
-    }
-
-// We got out of the loop because we ran out of combinations to try.
-  errno = EEXIST;		// ???
-  return NULL;
-}
-
-// Generate a unique temporary filename using up to five characters of
-// PFX if it is not NULL.  The directory to put this file in is
-// searched for as follows: First the environment variable "TMPDIR" is
-// checked.  If it contains the name of a writable directory, that
-// directory is used.  If not and if DIR is not NULL, that value is
-// checked.  If that fails, P_tmpdir is tried and finally "/tmp".  The
-// storage for the filename is allocated by `malloc'.
-
-char *
-tempnam (const char *dir, const char *pfx)
-{
-  size_t len;
-  register char *s;
-  register char *t = gen_tempname (dir, pfx, 1, &len);
-
-  if (t == NULL)
-    return NULL;
-
-  s = (char *) malloc (len);
-  if (s == NULL)
-    return NULL;
-
-  (void) memcpy (s, t, len);
-  return s;
-}
-
-#endif
-
 // Remove the last N directories from PATH.  Do not PATH blank.
 // PATH must contain enough space for MAXPATHLEN characters.
 
--- a/src/minmax.cc	Wed Oct 19 20:58:27 1994 +0000
+++ b/src/minmax.cc	Wed Oct 19 21:44:46 1994 +0000
@@ -1,4 +1,4 @@
-// f-minmax.cc                                           -*- C++ -*-
+// f-minmax.cc						 -*- C++ -*-
 /*
 
 Copyright (C) 1994 John W. Eaton
@@ -41,6 +41,91 @@
 #define MIN(a,b) ((a) < (b) ? (a) : (b))
 #endif
 
+// This file could probably be condensed quite a bit by an appropriate
+// amount of C preprocessor abuse.
+
+static Matrix
+min (double d, const Matrix& m)
+{
+  int nr = m.rows ();
+  int nc = m.columns ();
+
+  Matrix result (nr, nc);
+
+  for (int j = 0; j < nc; j++)
+    for (int i = 0; i < nr; i++)
+      {
+	double m_elem = m.elem (i, j);
+	result.elem (i, j) = MIN (d, m_elem);
+      }
+
+  return result;
+}
+
+static Matrix
+min (const Matrix& m, double d)
+{
+  int nr = m.rows ();
+  int nc = m.columns ();
+
+  Matrix result (nr, nc);
+
+  for (int j = 0; j < nc; j++)
+    for (int i = 0; i < nr; i++)
+      {
+	double m_elem = m.elem (i, j);
+	result.elem (i, j) = MIN (m_elem, d);
+      }
+
+  return result;
+}
+
+static ComplexMatrix
+min (const Complex& c, const ComplexMatrix& m)
+{
+  int nr = m.rows ();
+  int nc = m.columns ();
+
+  ComplexMatrix result (nr, nc);
+
+  double abs_c = abs (c);
+
+  for (int j = 0; j < nc; j++)
+    for (int i = 0; i < nr; i++)
+      {
+	double abs_m_elem = abs (m.elem (i, j));
+	if (abs_c < abs_m_elem)
+	  result.elem (i, j) = c;
+	else
+	  result.elem (i, j) = m.elem (i, j);
+      }
+
+  return result;
+}
+
+static ComplexMatrix
+min (const ComplexMatrix& m, const Complex& c)
+{
+  int nr = m.rows ();
+  int nc = m.columns ();
+
+  ComplexMatrix result (nr, nc);
+
+  double abs_c = abs (c);
+
+  for (int j = 0; j < nc; j++)
+    for (int i = 0; i < nr; i++)
+      {
+	double abs_m_elem = abs (m.elem (i, j));
+	if (abs_m_elem < abs_c)
+	  result.elem (i, j) = m.elem (i, j);
+	else
+	  result.elem (i, j) = c;
+      }
+
+  return result;
+}
+
 static Matrix
 min (const Matrix& a, const Matrix& b)
 {
@@ -81,12 +166,94 @@
   for (int j = 0; j < nc; j++)
     for (int i = 0; i < nr; i++)
       {
-        double abs_a_elem = abs (a.elem (i, j));
-        double abs_b_elem = abs (b.elem (i, j));
-        if (abs_a_elem < abs_b_elem)
-          result.elem (i, j) = a.elem (i, j);
-        else
-          result.elem (i, j) = b.elem (i, j);
+	double abs_a_elem = abs (a.elem (i, j));
+	double abs_b_elem = abs (b.elem (i, j));
+	if (abs_a_elem < abs_b_elem)
+	  result.elem (i, j) = a.elem (i, j);
+	else
+	  result.elem (i, j) = b.elem (i, j);
+      }
+
+  return result;
+}
+
+static Matrix
+max (double d, const Matrix& m)
+{
+  int nr = m.rows ();
+  int nc = m.columns ();
+
+  Matrix result (nr, nc);
+
+  for (int j = 0; j < nc; j++)
+    for (int i = 0; i < nr; i++)
+      {
+	double m_elem = m.elem (i, j);
+	result.elem (i, j) = MAX (d, m_elem);
+      }
+
+  return result;
+}
+
+static Matrix
+max (const Matrix& m, double d)
+{
+  int nr = m.rows ();
+  int nc = m.columns ();
+
+  Matrix result (nr, nc);
+
+  for (int j = 0; j < nc; j++)
+    for (int i = 0; i < nr; i++)
+      {
+	double m_elem = m.elem (i, j);
+	result.elem (i, j) = MAX (m_elem, d);
+      }
+
+  return result;
+}
+
+static ComplexMatrix
+max (const Complex& c, const ComplexMatrix& m)
+{
+  int nr = m.rows ();
+  int nc = m.columns ();
+
+  ComplexMatrix result (nr, nc);
+
+  double abs_c = abs (c);
+
+  for (int j = 0; j < nc; j++)
+    for (int i = 0; i < nr; i++)
+      {
+	double abs_m_elem = abs (m.elem (i, j));
+	if (abs_c > abs_m_elem)
+	  result.elem (i, j) = c;
+	else
+	  result.elem (i, j) = m.elem (i, j);
+      }
+
+  return result;
+}
+
+static ComplexMatrix
+max (const ComplexMatrix& m, const Complex& c)
+{
+  int nr = m.rows ();
+  int nc = m.columns ();
+
+  ComplexMatrix result (nr, nc);
+
+  double abs_c = abs (c);
+
+  for (int j = 0; j < nc; j++)
+    for (int i = 0; i < nr; i++)
+      {
+	double abs_m_elem = abs (m.elem (i, j));
+	if (abs_m_elem > abs_c)
+	  result.elem (i, j) = m.elem (i, j);
+	else
+	  result.elem (i, j) = c;
       }
 
   return result;
@@ -132,18 +299,17 @@
   for (int j = 0; j < nc; j++)
     for (int i = 0; i < nr; i++)
       {
-        double abs_a_elem = abs (a.elem (i, j));
-        double abs_b_elem = abs (b.elem (i, j));
-        if (abs_a_elem > abs_b_elem)
-          result.elem (i, j) = a.elem (i, j);
-        else
-          result.elem (i, j) = b.elem (i, j);
+	double abs_a_elem = abs (a.elem (i, j));
+	double abs_b_elem = abs (b.elem (i, j));
+	if (abs_a_elem > abs_b_elem)
+	  result.elem (i, j) = a.elem (i, j);
+	else
+	  result.elem (i, j) = b.elem (i, j);
       }
 
   return result;
 }
 
-
 DEFUN_DLD_BUILTIN ("min", Fmin, Smin, 3, 2,
   "min (X): minimum value(s) of a vector (matrix)")
 {
@@ -183,7 +349,7 @@
 	}
       else if (arg1.is_complex_scalar ())
 	{
-          retval(0) = arg1.complex_value ();
+	  retval(0) = arg1.complex_value ();
 	}
       else if (arg1.is_real_type ())
 	{
@@ -218,7 +384,7 @@
   else if (nargin == 1 && nargout == 2)
     {
       if (arg1.is_real_scalar ())
-        {
+	{
 	  retval(1) = 1;
 	  retval(0) = arg1.double_value ();
 	}
@@ -267,30 +433,72 @@
 	{
 	  gripe_wrong_type_arg ("min", arg1);
 	  return retval;
-        }
+	}
     }
   else if (nargin == 2)
     {
-      if (arg1.rows () == arg2.rows ()
-	  && arg1.columns () == arg2.columns ())
+      int arg1_is_scalar = arg1.is_scalar_type ();
+      int arg2_is_scalar = arg2.is_scalar_type ();
+
+      int arg1_is_complex = arg1.is_complex_type ();
+      int arg2_is_complex = arg2.is_complex_type ();
+
+      if (arg1_is_scalar)
 	{
-	  if (arg1.is_real_type () && arg2.is_real_type ())
+	  if (arg1_is_complex || arg2_is_complex)
+	    {
+	      Complex c1 = arg1.complex_value ();
+	      ComplexMatrix m2 = arg2.complex_matrix_value ();
+	      if (! error_state)
+		{
+		  ComplexMatrix result = min (c1, m2);
+		  if (! error_state)
+		    retval(0) = result;
+		}
+	    }
+	  else
+	    {
+	      double d1 = arg1.double_value ();
+	      Matrix m2 = arg2.matrix_value ();
+
+	      if (! error_state)
+		{
+		  Matrix result = min (d1, m2);
+		  if (! error_state)
+		    retval(0) = result;
+		}
+	    }
+	}
+      else if (arg2_is_scalar)
+	{
+	  if (arg1_is_complex || arg2_is_complex)
+	    {
+	      ComplexMatrix m1 = arg1.complex_matrix_value ();
+
+	      if (! error_state)
+		{
+		  Complex c2 = arg2.complex_value ();
+		  ComplexMatrix result = min (m1, c2);
+		  if (! error_state)
+		    retval(0) = result;
+		}
+	    }
+	  else
 	    {
 	      Matrix m1 = arg1.matrix_value ();
 
 	      if (! error_state)
 		{
-		  Matrix m2 = arg2.matrix_value ();
-
+		  double d2 = arg2.double_value ();
+		  Matrix result = min (m1, d2);
 		  if (! error_state)
-		    {
-		      Matrix result = min (m1, m2);
-		      if (! error_state)
-			retval(0) = result;
-		    }
+		    retval(0) = result;
 		}
 	    }
-	  else if (arg1.is_complex_type () || arg2.is_complex_type ())
+	}
+      else
+	{
+	  if (arg1_is_complex || arg2_is_complex)
 	    {
 	      ComplexMatrix m1 = arg1.complex_matrix_value ();
 
@@ -308,12 +516,21 @@
 	    }
 	  else
 	    {
-	      gripe_wrong_type_arg ("min", arg1);
-	      return retval;
+	      Matrix m1 = arg1.matrix_value ();
+
+	      if (! error_state)
+		{
+		  Matrix m2 = arg2.matrix_value ();
+
+		  if (! error_state)
+		    {
+		      Matrix result = min (m1, m2);
+		      if (! error_state)
+			retval(0) = result;
+		    }
+		}
 	    }
 	}
-      else
-	error ("min: nonconformant matrices");
     }
   else
     panic_impossible ();
@@ -360,23 +577,31 @@
 	}
       else if (arg1.is_complex_scalar ())
 	{
-          retval(0) = arg1.complex_value ();
+	  retval(0) = arg1.complex_value ();
 	}
       else if (arg1.is_real_type ())
 	{
 	  Matrix m = arg1.matrix_value ();
-	  if (m.rows () == 1)
-	    retval(0) = m.row_max ();
-	  else
-	    retval(0) = tree_constant (m.column_max (), 0);
+
+	  if (! error_state)
+	    {
+	      if (m.rows () == 1)
+		retval(0) = m.row_max ();
+	      else
+		retval(0) = tree_constant (m.column_max (), 0);
+	    }
 	}
       else if (arg1.is_complex_type ())
 	{
 	  ComplexMatrix m = arg1.complex_matrix_value ();
-	  if (m.rows () == 1)
-	    retval(0) = m.row_max ();
-	  else
-	    retval(0) = tree_constant (m.column_max (), 0);
+
+	  if (! error_state)
+	    {
+	      if (m.rows () == 1)
+		retval(0) = m.row_max ();
+	      else
+		retval(0) = tree_constant (m.column_max (), 0);
+	    }
 	}
       else
 	{
@@ -399,29 +624,37 @@
       else if (arg1.is_real_type ())
 	{
 	  Matrix m = arg1.matrix_value ();
-	  if (m.rows () == 1)
+
+	  if (! error_state)
 	    {
-	      retval(1) = m.row_max_loc ();
-	      retval(0) = m.row_max ();
-	    }
-	  else
-	    {
-	      retval(1) = tree_constant (m.column_max_loc (), 0);
-	      retval(0) = tree_constant (m.column_max (), 0);
+	      if (m.rows () == 1)
+		{
+		  retval(1) = m.row_max_loc ();
+		  retval(0) = m.row_max ();
+		}
+	      else
+		{
+		  retval(1) = tree_constant (m.column_max_loc (), 0);
+		  retval(0) = tree_constant (m.column_max (), 0);
+		}
 	    }
 	}
       else if (arg1.is_complex_type ())
 	{
 	  ComplexMatrix m = arg1.complex_matrix_value ();
-	  if (m.rows () == 1)
+
+	  if (! error_state)
 	    {
-	      retval(1) = m.row_max_loc ();
-	      retval(0) = m.row_max ();
-	    }
-	  else
-	    {
-	      retval(1) = tree_constant (m.column_max_loc (), 0);
-	      retval(0) = tree_constant (m.column_max (), 0);
+	      if (m.rows () == 1)
+		{
+		  retval(1) = m.row_max_loc ();
+		  retval(0) = m.row_max ();
+		}
+	      else
+		{
+		  retval(1) = tree_constant (m.column_max_loc (), 0);
+		  retval(0) = tree_constant (m.column_max (), 0);
+		}
 	    }
 	}
       else
@@ -432,50 +665,100 @@
     }
   else if (nargin == 2)
     {
-      if (arg1.rows () == arg2.rows ()
-	  && arg1.columns () == arg2.columns ())
+      int arg1_is_scalar = arg1.is_scalar_type ();
+      int arg2_is_scalar = arg2.is_scalar_type ();
+
+      int arg1_is_complex = arg1.is_complex_type ();
+      int arg2_is_complex = arg2.is_complex_type ();
+
+      if (arg1_is_scalar)
 	{
-// XXX FIXME XXX -- I don't think this is quite right.
-          if (arg1.is_real_scalar ())
-            {
-	      double result;
-	      double a_elem = arg1.double_value ();
-	      double b_elem = arg2.double_value ();
-	      result = MAX (a_elem, b_elem);
-	      retval(0) = result;
+	  if (arg1_is_complex || arg2_is_complex)
+	    {
+	      Complex c1 = arg1.complex_value ();
+	      ComplexMatrix m2 = arg2.complex_matrix_value ();
+	      if (! error_state)
+		{
+		  ComplexMatrix result = max (c1, m2);
+		  if (! error_state)
+		    retval(0) = result;
+		}
 	    }
-	  else if (arg1.is_complex_scalar ())
+	  else
 	    {
-	      Complex result;
-	      Complex a_elem = arg1.complex_value ();
-	      Complex b_elem = arg2.complex_value ();
-	      if (abs (a_elem) > abs (b_elem))
-		result = a_elem;
-	      else
-		result = b_elem;
-	      retval(0) = result;
+	      double d1 = arg1.double_value ();
+	      Matrix m2 = arg2.matrix_value ();
+
+	      if (! error_state)
+		{
+		  Matrix result = max (d1, m2);
+		  if (! error_state)
+		    retval(0) = result;
+		}
 	    }
-	  else if (arg1.is_real_type ())
+	}
+      else if (arg2_is_scalar)
+	{
+	  if (arg1_is_complex || arg2_is_complex)
 	    {
-	      Matrix result;
-	      result = max (arg1.matrix_value (), arg2.matrix_value ());
-	      retval(0) = result;
+	      ComplexMatrix m1 = arg1.complex_matrix_value ();
+
+	      if (! error_state)
+		{
+		  Complex c2 = arg2.complex_value ();
+		  ComplexMatrix result = max (m1, c2);
+		  if (! error_state)
+		    retval(0) = result;
+		}
 	    }
-	  else if (arg1.is_complex_type ())
+	  else
 	    {
-	      ComplexMatrix result;
-	      result = max (arg1.complex_matrix_value (),
-			    arg2.complex_matrix_value ());
-	      retval(0) = result;
-	    }
-	  else 
-	    {
-	      gripe_wrong_type_arg ("max", arg1);
-	      return retval;
+	      Matrix m1 = arg1.matrix_value ();
+
+	      if (! error_state)
+		{
+		  double d2 = arg2.double_value ();
+		  Matrix result = max (m1, d2);
+		  if (! error_state)
+		    retval(0) = result;
+		}
 	    }
 	}
       else
-	error ("max: nonconformant matrices");
+	{
+	  if (arg1_is_complex || arg2_is_complex)
+	    {
+	      ComplexMatrix m1 = arg1.complex_matrix_value ();
+
+	      if (! error_state)
+		{
+		  ComplexMatrix m2 = arg2.complex_matrix_value ();
+
+		  if (! error_state)
+		    {
+		      ComplexMatrix result = max (m1, m2);
+		      if (! error_state)
+			retval(0) = result;
+		    }
+		}
+	    }
+	  else
+	    {
+	      Matrix m1 = arg1.matrix_value ();
+
+	      if (! error_state)
+		{
+		  Matrix m2 = arg2.matrix_value ();
+
+		  if (! error_state)
+		    {
+		      Matrix result = max (m1, m2);
+		      if (! error_state)
+			retval(0) = result;
+		    }
+		}
+	    }
+	}
     }
   else
     panic_impossible ();
--- a/src/sighandlers.cc	Wed Oct 19 20:58:27 1994 +0000
+++ b/src/sighandlers.cc	Wed Oct 19 21:44:46 1994 +0000
@@ -220,6 +220,91 @@
 #endif
 }
 
+#ifndef SYS_SIGLIST_DECLARED
+char *sys_siglist[NSIG + 1] =
+{
+#ifdef AIX
+/* AIX has changed the signals a bit */
+  "bogus signal",			/* 0 */
+  "hangup",				/* 1  SIGHUP */
+  "interrupt",				/* 2  SIGINT */
+  "quit",				/* 3  SIGQUIT */
+  "illegal instruction",		/* 4  SIGILL */
+  "trace trap",				/* 5  SIGTRAP */
+  "IOT instruction",			/* 6  SIGIOT */
+  "crash likely",			/* 7  SIGDANGER */
+  "floating point exception",		/* 8  SIGFPE */
+  "kill",				/* 9  SIGKILL */
+  "bus error",				/* 10 SIGBUS */
+  "segmentation violation",		/* 11 SIGSEGV */
+  "bad argument to system call",	/* 12 SIGSYS */
+  "write on a pipe with no one to read it", /* 13 SIGPIPE */
+  "alarm clock",			/* 14 SIGALRM */
+  "software termination signum",	/* 15 SIGTERM */
+  "user defined signal 1",		/* 16 SIGUSR1 */
+  "user defined signal 2",		/* 17 SIGUSR2 */
+  "death of a child",			/* 18 SIGCLD */
+  "power-fail restart",			/* 19 SIGPWR */
+  "bogus signal",			/* 20 */
+  "bogus signal",			/* 21 */
+  "bogus signal",			/* 22 */
+  "bogus signal",			/* 23 */
+  "bogus signal",			/* 24 */
+  "LAN I/O interrupt",			/* 25 SIGAIO */
+  "PTY I/O interrupt",			/* 26 SIGPTY */
+  "I/O intervention required",		/* 27 SIGIOINT */
+  "HFT grant",				/* 28 SIGGRANT */
+  "HFT retract",			/* 29 SIGRETRACT */
+  "HFT sound done",			/* 30 SIGSOUND */
+  "HFT input ready",			/* 31 SIGMSG */
+#else /* not AIX */
+  "bogus signal",			/* 0 */
+  "hangup",				/* 1  SIGHUP */
+  "interrupt",				/* 2  SIGINT */
+  "quit",				/* 3  SIGQUIT */
+  "illegal instruction",		/* 4  SIGILL */
+  "trace trap",				/* 5  SIGTRAP */
+  "IOT instruction",			/* 6  SIGIOT */
+  "EMT instruction",			/* 7  SIGEMT */
+  "floating point exception",		/* 8  SIGFPE */
+  "kill",				/* 9  SIGKILL */
+  "bus error",				/* 10 SIGBUS */
+  "segmentation violation",		/* 11 SIGSEGV */
+  "bad argument to system call",	/* 12 SIGSYS */
+  "write on a pipe with no one to read it", /* 13 SIGPIPE */
+  "alarm clock",			/* 14 SIGALRM */
+  "software termination signum",	/* 15 SIGTERM */
+  "user defined signal 1",		/* 16 SIGUSR1 */
+  "user defined signal 2",		/* 17 SIGUSR2 */
+  "death of a child",			/* 18 SIGCLD */
+  "power-fail restart",			/* 19 SIGPWR */
+#ifdef sun
+  "window size change",			    /* 20 SIGWINCH */
+  "urgent socket condition",		    /* 21 SIGURG */
+  "pollable event occured",		    /* 22 SIGPOLL */
+  "stop (cannot be caught or ignored)", /*  23 SIGSTOP */
+  "user stop requested from tty",	    /* 24 SIGTSTP */
+  "stopped process has been continued",	/* 25 SIGCONT */
+  "background tty read attempted",	    /* 26 SIGTTIN */
+  "background tty write attempted",    /* 27 SIGTTOU */
+  "virtual timer expired",		    /* 28 SIGVTALRM */
+  "profiling timer expired",		    /* 29 SIGPROF */
+  "exceeded cpu limit",			    /* 30 SIGXCPU */
+  "exceeded file size limit",		    /* 31 SIGXFSZ */
+  "process's lwps are blocked",	    /*  32 SIGWAITING */
+  "special signal used by thread library", /* 33 SIGLWP */
+#ifdef SIGFREEZE
+  "Special Signal Used By CPR",	    /* 34 SIGFREEZE */
+#endif
+#ifdef SIGTHAW
+  "Special Signal Used By CPR",	    /* 35 SIGTHAW */
+#endif
+#endif /* sun */
+#endif /* not AIX */
+  0
+  };
+#endif
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/src/sighandlers.h	Wed Oct 19 20:58:27 1994 +0000
+++ b/src/sighandlers.h	Wed Oct 19 21:44:46 1994 +0000
@@ -47,89 +47,8 @@
 
 // This is taken directly from Emacs 19:
 
-#ifndef HAVE_SYS_SIGLIST
-char *sys_siglist[NSIG + 1] =
-{
-#ifdef AIX
-/* AIX has changed the signals a bit */
-  "bogus signal",			/* 0 */
-  "hangup",				/* 1  SIGHUP */
-  "interrupt",				/* 2  SIGINT */
-  "quit",				/* 3  SIGQUIT */
-  "illegal instruction",		/* 4  SIGILL */
-  "trace trap",				/* 5  SIGTRAP */
-  "IOT instruction",			/* 6  SIGIOT */
-  "crash likely",			/* 7  SIGDANGER */
-  "floating point exception",		/* 8  SIGFPE */
-  "kill",				/* 9  SIGKILL */
-  "bus error",				/* 10 SIGBUS */
-  "segmentation violation",		/* 11 SIGSEGV */
-  "bad argument to system call",	/* 12 SIGSYS */
-  "write on a pipe with no one to read it", /* 13 SIGPIPE */
-  "alarm clock",			/* 14 SIGALRM */
-  "software termination signum",	/* 15 SIGTERM */
-  "user defined signal 1",		/* 16 SIGUSR1 */
-  "user defined signal 2",		/* 17 SIGUSR2 */
-  "death of a child",			/* 18 SIGCLD */
-  "power-fail restart",			/* 19 SIGPWR */
-  "bogus signal",			/* 20 */
-  "bogus signal",			/* 21 */
-  "bogus signal",			/* 22 */
-  "bogus signal",			/* 23 */
-  "bogus signal",			/* 24 */
-  "LAN I/O interrupt",			/* 25 SIGAIO */
-  "PTY I/O interrupt",			/* 26 SIGPTY */
-  "I/O intervention required",		/* 27 SIGIOINT */
-  "HFT grant",				/* 28 SIGGRANT */
-  "HFT retract",			/* 29 SIGRETRACT */
-  "HFT sound done",			/* 30 SIGSOUND */
-  "HFT input ready",			/* 31 SIGMSG */
-#else /* not AIX */
-  "bogus signal",			/* 0 */
-  "hangup",				/* 1  SIGHUP */
-  "interrupt",				/* 2  SIGINT */
-  "quit",				/* 3  SIGQUIT */
-  "illegal instruction",		/* 4  SIGILL */
-  "trace trap",				/* 5  SIGTRAP */
-  "IOT instruction",			/* 6  SIGIOT */
-  "EMT instruction",			/* 7  SIGEMT */
-  "floating point exception",		/* 8  SIGFPE */
-  "kill",				/* 9  SIGKILL */
-  "bus error",				/* 10 SIGBUS */
-  "segmentation violation",		/* 11 SIGSEGV */
-  "bad argument to system call",	/* 12 SIGSYS */
-  "write on a pipe with no one to read it", /* 13 SIGPIPE */
-  "alarm clock",			/* 14 SIGALRM */
-  "software termination signum",	/* 15 SIGTERM */
-  "user defined signal 1",		/* 16 SIGUSR1 */
-  "user defined signal 2",		/* 17 SIGUSR2 */
-  "death of a child",			/* 18 SIGCLD */
-  "power-fail restart",			/* 19 SIGPWR */
-#ifdef sun
-  "window size change",			    /* 20 SIGWINCH */
-  "urgent socket condition",		    /* 21 SIGURG */
-  "pollable event occured",		    /* 22 SIGPOLL */
-  "stop (cannot be caught or ignored)", /*  23 SIGSTOP */
-  "user stop requested from tty",	    /* 24 SIGTSTP */
-  "stopped process has been continued",	/* 25 SIGCONT */
-  "background tty read attempted",	    /* 26 SIGTTIN */
-  "background tty write attempted",    /* 27 SIGTTOU */
-  "virtual timer expired",		    /* 28 SIGVTALRM */
-  "profiling timer expired",		    /* 29 SIGPROF */
-  "exceeded cpu limit",			    /* 30 SIGXCPU */
-  "exceeded file size limit",		    /* 31 SIGXFSZ */
-  "process's lwps are blocked",	    /*  32 SIGWAITING */
-  "special signal used by thread library", /* 33 SIGLWP */
-#ifdef SIGFREEZE
-  "Special Signal Used By CPR",	    /* 34 SIGFREEZE */
-#endif
-#ifdef SIGTHAW
-  "Special Signal Used By CPR",	    /* 35 SIGTHAW */
-#endif
-#endif /* sun */
-#endif /* not AIX */
-  0
-  };
+#ifndef SYS_SIGLIST_DECLARED
+extern char *sys_siglist[];
 #endif
 
 #endif