*** empty log message ***
authorJim Blandy <jimb@redhat.com>
Fri, 1 May 1992 06:20:46 +0000 (06:20 +0000)
committerJim Blandy <jimb@redhat.com>
Fri, 1 May 1992 06:20:46 +0000 (06:20 +0000)
13 files changed:
Makefile.in
src/alloc.c
src/callproc.c
src/data.c
src/emacs.c
src/filelock.c
src/floatfns.c
src/keyboard.c
src/process.c
src/s/aix3-1.h
src/syntax.c
src/sysdep.c
src/syssignal.h

index ceb8f0e..13c3ed3 100644 (file)
@@ -127,8 +127,7 @@ src/paths.h: Makefile src/paths.h.in
        -e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "'$${buildlisppath}'";' \
        -e 's;\(#.*PATH_EXEC\).*$$;\1 "${libdir}";'                     \
        -e 's;\(#.*PATH_DATA\).*$$;\1 "${datadir}";'                    \
-       -e 's;\(#.*PATH_LOCK\).*$$;\1 "${lockdir}/";'                   \
-       -e 's;\(#.*PATH_SUPERLOCK\).*$$;\1 "${lockdir}/!!!SuperLock!!!";'
+       -e 's;\(#.*PATH_LOCK\).*$$;\1 "${lockdir}/";'
 
 src:   lib-src
 
index 3f40ea4..b463797 100644 (file)
@@ -551,8 +551,9 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0,
   register struct Lisp_Marker *p;
   /* Detact the bug that seems to have caused this to be called from
      a signal handler.  */
-  int mask = sigsetmask (-1);
-  sigsetmask (mask);
+  int mask, dummy;
+  EMACS_SIGSETMASK (-1, mask);
+  EMACS_SIGSETMASK (mask, dummy);
   if (mask != 0)
     abort ();
 
index 68b447d..1a564ad 100644 (file)
@@ -224,7 +224,11 @@ If you quit, the process is killed with SIGKILL.")
     /* Tell SIGCHLD handler to look for this pid.  */
     synch_process_pid = pid;
     /* Now let SIGCHLD come through.  */
-    sigsetmask (mask);
+    {
+      int dummy;
+
+      EMACS_SIGSETMASK (mask, dummy);
+    }
 #endif
 
     environ = save_environ;
@@ -530,11 +534,17 @@ init_callproc ()
   register char **envp;
   Lisp_Object tempdir;
 
-  Vdata_directory = Ffile_name_as_directory (build_string (PATH_DATA));
+  {
+    char *data_dir = egetenv ("EMACSDATA");
+    
+    Vdata_directory =
+      Ffile_name_as_directory
+       (build_string (data_dir ? data_dir : PATH_DATA));
+  }
 
-  /* Turn PATH_EXEC into a path.  `==' is just a string which we know
-     will not be the name of an environment variable.  */
-  Vexec_path = decode_env_path ("==", PATH_EXEC);
+  /* Check the EMACSPATH environment variable, defaulting to the
+     PATH_EXEC path from paths.h.  */
+  Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC);
   Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path));
   Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
 
index 4e95494..48af4ec 100644 (file)
@@ -1959,7 +1959,11 @@ arith_error (signo)
 #ifdef BSD4_1
   sigrelse (SIGFPE);
 #else /* not BSD4_1 */
-  sigsetmask (SIGEMPTYMASK);
+  {
+    int dummy;
+
+    EMACS_SIGSETMASK (SIGEMPTYMASK, dummy);
+  }
 #endif /* not BSD4_1 */
 
   Fsignal (Qarith_error, Qnil);
index c530eca..90a86b2 100644 (file)
@@ -442,6 +442,9 @@ main (argc, argv, envp)
   init_vmsfns ();
 #endif /* VMS */
   init_process ();
+#ifdef CLASH_DETECTION
+  init_filelock ();
+#endif /* CLASH_DETECTION */
 
 /* Intern the names of all standard functions and variables; define standard keys */
 
index a2c7941..7a47375 100644 (file)
@@ -1,10 +1,10 @@
-/* Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
+/* Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
+the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -39,6 +39,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 extern int errno;
 
+extern char *egetenv ();
+
 #ifdef CLASH_DETECTION
   
 /* If system does not have symbolic links, it does not have lstat.
@@ -48,6 +50,44 @@ extern int errno;
 #define lstat stat
 #endif
 
+
+/* The name of the directory in which we keep lock files, with a '/'
+   appended.  */  
+char *lock_path;
+
+/* The name of the file in the lock directory which is used to
+   arbitrate access to the entire directory.  */
+#define SUPERLOCK_NAME "!!!SuperLock!!!"
+
+/* The path to the superlock file.  This is SUPERLOCK_NAME appended to
+   lock_path.  */
+char *superlock_path;
+
+/* Set LOCK to the name of the lock file for the filename FILE.
+   char *LOCK; Lisp_Object FILE;  */
+#define MAKE_LOCK_PATH (lock, file) \
+  (lock = (char *) alloca (XSTRING (file)->size + strlen (lock_path) + 1), \
+   fill_in_lock_file_name (lock, (file)))
+
+fill_in_lock_file_name (lockfile, fn)
+     register char *lockfile;
+     register Lisp_Object fn;
+{
+  register char *p;
+
+  strcpy (lockfile, lock_path);
+
+  p = lockfile + strlen (lockfile);
+
+  strcpy (p, XSTRING (fn)->data);
+
+  for (; *p; p++)
+    {
+      if (*p == '/')
+       *p = '!';
+    }
+}
+
 static Lisp_Object
 lock_file_owner_name (lfname)
      char *lfname;
@@ -90,11 +130,10 @@ lock_file (fn)
   register Lisp_Object attack;
   register char *lfname;
 
-  /* Create the name of the lock-file for file fn */
-  lfname = (char *) alloca (XSTRING (fn)->size + strlen (PATH_LOCK) + 1);
-  fill_in_lock_file_name (lfname, fn);
+  MAKE_LOCK_PATH (lfname, fn);
 
-  /* See if this file is visited and has changed on disk since it was visited.  */
+  /* See if this file is visited and has changed on disk since it was
+     visited.  */
   {
     register Lisp_Object subject_buf = Fget_file_buffer (fn);
     if (!NILP (subject_buf)
@@ -116,31 +155,12 @@ lock_file (fn)
     {
       lock_superlock (lfname);
       lock_file_1 (lfname, O_WRONLY) ;
-      unlink (PATH_SUPERLOCK);
+      unlink (superlock_path);
       return;
     }
   /* User says ignore the lock */
 }
 
-fill_in_lock_file_name (lockfile, fn)
-     register char *lockfile;
-     register Lisp_Object fn;
-{
-  register char *p;
-
-  strcpy (lockfile, PATH_LOCK);
-
-  p = lockfile + strlen (lockfile);
-
-  strcpy (p, XSTRING (fn)->data);
-
-  for (; *p; p++)
-    {
-      if (*p == '/')
-       *p = '!';
-    }
-}
-
 /* Lock the lock file named LFNAME.
    If MODE is O_WRONLY, we do so even if it is already locked.
    If MODE is O_WRONLY | O_EXCL | O_CREAT, we do so only if it is free.
@@ -236,15 +256,14 @@ unlock_file (fn)
 {
   register char *lfname;
 
-  lfname = (char *) alloca (XSTRING (fn)->size + strlen (PATH_LOCK) + 1);
-  fill_in_lock_file_name (lfname, fn);
+  MAKE_LOCK_PATH (lfname, fn);
 
   lock_superlock (lfname);
 
   if (current_lock_owner_1 (lfname) == getpid ())
     unlink (lfname);
 
-  unlink (PATH_SUPERLOCK);
+  unlink (superlock_path);
 }
 
 lock_superlock (lfname)
@@ -252,7 +271,7 @@ lock_superlock (lfname)
 {
   register int i, fd;
 
-  for (i = -20; i < 0 && (fd = open (PATH_SUPERLOCK,
+  for (i = -20; i < 0 && (fd = open (superlock_path,
                                     O_WRONLY | O_EXCL | O_CREAT, 0666)) < 0;
        i++)
     {
@@ -263,7 +282,7 @@ lock_superlock (lfname)
   if (fd >= 0)
     {
 #ifdef USG
-      chmod (PATH_SUPERLOCK, 0666);
+      chmod (superlock_path, 0666);
 #else
       fchmod (fd, 0666);
 #endif
@@ -341,9 +360,7 @@ t if it is locked by you, else a string of the name of the locker.")
 
   fn = Fexpand_file_name (fn, Qnil);
 
-  /* Create the name of the lock-file for file filename */
-  lfname = (char *) alloca (XSTRING (fn)->size + strlen (PATH_LOCK) + 1);
-  fill_in_lock_file_name (lfname, fn);
+  MAKE_LOCK_PATH (lfname, fn);
 
   owner = current_lock_owner (lfname);
   if (owner <= 0)
@@ -354,6 +371,29 @@ t if it is locked by you, else a string of the name of the locker.")
   return (lock_file_owner_name (lfname));
 }
 
+\f
+/* Initialization functions.  */
+
+init_filelock ()
+{
+  lock_path = egetenv ("EMACSLOCKDIR");
+  if (! lock_path)
+    lock_path = PATH_LOCK;
+
+  /* Make sure it ends with a slash.  */
+  if (lock_path[strlen (lock_path) - 1] != '/')
+    {
+      lock_path = strcpy ((char *) xmalloc (strlen (lock_path) + 2),
+                         lock_path);
+      strcat (lock_path, "/");
+    }
+
+  superlock_path = (char *) xmalloc ((strlen (lock_path)
+                                     + sizeof (SUPERLOCK_NAME)));
+  strcpy (superlock_path, lock_path);
+  strcat (superlock_path, SUPERLOCK_NAME);
+}
+
 syms_of_filelock ()
 {
   defsubr (&Sunlock_buffer);
index ed94c9e..c99ba48 100644 (file)
@@ -509,7 +509,11 @@ float_error (signo)
 #ifdef BSD4_1
   sigrelse (SIGILL);
 #else /* not BSD4_1 */
-  sigsetmask (0);
+  {
+    int dummy;
+
+    EMACS_SIGSETMASK (0, dummy);
+  }
 #endif /* not BSD4_1 */
 #else
   /* Must reestablish handler each time it is called.  */
index c0f9ae4..122fa24 100644 (file)
@@ -2104,9 +2104,10 @@ gobble_input (expected)
 #ifdef SIGIO
   if (interrupt_input)
     {
-      SIGMASKTYPE mask = sigblockx (SIGIO);
+      SIGMASKTYPE mask;
+      EMACS_SIGBLOCKX (SIGIO, mask);
       read_avail_input (expected);
-      sigsetmask (mask);
+      EMACS_SIGSETMASK (mask, mask);
     }
   else
 #endif
index 442cae6..d9e2734 100644 (file)
@@ -108,8 +108,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "termhooks.h"
 #include "termopts.h"
 #include "commands.h"
-
-extern int screen_garbaged;
+#include "dispextern.h"
 
 Lisp_Object Qrun, Qstop, Qsignal, Qopen, Qclosed;
 /* Qexit is declared and initialized in eval.c.  */
@@ -419,6 +418,13 @@ allocate_pty ()
   register c, i;
   int fd;
 
+  /* Some systems name their pseudoterminals so that there are gaps in
+     the usual sequence - for example, on HP9000/S700 systems, there
+     are no pseudoterminals with names ending in 'f'.  So we wait for
+     three failures in a row before deciding that we've reached the
+     end of the ptys.  */
+  int failed_count = 0;
+
 #ifdef PTY_ITERATION
   PTY_ITERATION
 #else
@@ -440,20 +446,27 @@ allocate_pty ()
 #endif /* not HPUX */
 #endif /* no PTY_NAME_SPRINTF */
 
-#ifndef IRIS
-       if (stat (pty_name, &stb) < 0)
+#ifdef IRIS
+       /* Unusual IRIS code */
+       *ptyv = open ("/dev/ptc", O_RDWR | O_NDELAY, 0);
+       if (fd < 0)
+         return -1;
+       if (fstat (fd, &stb) < 0)
          return -1;
+#else
+       if (stat (pty_name, &stb) < 0)
+         {
+           failed_count++;
+           if (failed_count >= 3)
+             return -1;
+         }
+       else
+         failed_count = 0;
 #ifdef O_NONBLOCK
        fd = open (pty_name, O_RDWR | O_NONBLOCK, 0);
 #else
        fd = open (pty_name, O_RDWR | O_NDELAY, 0);
 #endif
-#else /* Unusual IRIS code */
-       *ptyv = open ("/dev/ptc", O_RDWR | O_NDELAY, 0);
-       if (fd < 0)
-         return -1;
-       if (fstat (fd, &stb) < 0)
-         return -1;
 #endif /* IRIS */
 
        if (fd >= 0)
@@ -1742,11 +1755,6 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
       if (!read_kbd)
        FD_CLR (0, &Available);
 
-      /* If a screen has been newly mapped and needs updating,
-        reprocess its display stuff.  */
-      if (screen_garbaged)
-       redisplay_preserve_echo_area ();
-
       if (read_kbd && detect_input_pending ())
        nfds = 0;
       else
@@ -1829,6 +1837,16 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
       if (! wait_proc)
        got_some_input |= nfds > 0;
 
+      /* If checking input just got us a size-change event from X,
+        obey it now if we should.  */
+      if (read_kbd)
+       do_pending_window_change ();
+
+      /* If screen size has changed, redisplay now
+        for either sit-for or keyboard input.  */
+      if (read_kbd && screen_garbaged)
+       redisplay_preserve_echo_area ();
+
       /* Check for data from a process or a command channel */
       for (channel = FIRST_PROC_DESC; channel < MAXDESC; channel++)
        {
index 366ef83..5b15772 100644 (file)
@@ -208,7 +208,7 @@ and this notice must be preserved on all copies.  */
 
 /* #define ADDR_CORRECT(x) (x) */
 
-#define LD_CMD cc
+#define LINKER cc
 
 /* Prevent -lg from being used for debugging.  Not needed.  */
 
index 4f203ca..483526e 100644 (file)
@@ -158,12 +158,13 @@ DEFUN ("modify-syntax-entry", foo, bar, 0, 0, 0,
 The syntax is changed only for table TABLE, which defaults to\n\
  the current buffer's syntax table.\n\
 The first character of S should be one of the following:\n\
-  Space    whitespace syntax.    w   word constituent.\n\
-  _        symbol constituent.   .   punctuation.\n\
-  (        open-parenthesis.     )   close-parenthesis.\n\
-  \"        string quote.         \\   character-quote.\n\
-  $        paired delimiter.     '   expression quote or prefix operator.\n\
-  <       comment starter.      >   comment ender.\n\
+  Space or -  whitespace syntax.    w   word constituent.\n\
+  _           symbol constituent.   .   punctuation.\n\
+  (           open-parenthesis.     )   close-parenthesis.\n\
+  \"           string quote.         \\   escape.\n\
+  $           paired delimiter.     '   expression quote or prefix operator.\n\
+  <           comment starter.      >   comment ender.\n\                  
+  /           character-quote.\n\
 Only single-character comment start and end sequences are represented thus.\n\
 Two-character sequences are represented as described below.\n\
 The second character of S is the matching parenthesis,\n\
index 03614f9..6298038 100644 (file)
@@ -638,7 +638,11 @@ reset_sigio ()
 request_sigio ()
 {
 #ifdef SIGWINCH
-  sigunblock (sigmask (SIGWINCH));
+  {
+    int dummy;
+
+    EMACS_SIGUNBLOCKX (SIGWINCH, dummy);
+  }
 #endif
   fcntl (0, F_SETFL, old_fcntl_flags | FASYNC);
 
@@ -648,7 +652,11 @@ request_sigio ()
 unrequest_sigio ()
 {
 #ifdef SIGWINCH
-  sigblock (sigmask (SIGWINCH));
+  {
+    int dummy;
+    
+    EMACS_SIGBLOCK (SIGWINCH, dummy);
+  }
 #endif
   fcntl (0, F_SETFL, old_fcntl_flags);
   interrupts_deferred = 1;
index 81d52c8..cf59144 100644 (file)
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
+
 #ifdef POSIX_SIGNALS
 #define SIGMASKTYPE sigset_t
 
@@ -27,14 +28,19 @@ extern sigset_t empty_mask, full_mask, temp_mask;
 #define sigmask(SIG) \
 (sigemptyset (&temp_mask), sigaddset (&temp_mask, SIG), temp_mask)
 
-/* May need a local mask.  There could be problems if code using any
-   of the 3 macros below could be reentered due to a signal occurring.
-   This can't happen in Emacs 18.57, so we don't worry. - DJB
-   These macros also require GCC. */
-#define sigpause(SIG)    ({ sigset_t _mask; sys_sigpause(SIG); })
-#define sigblock(SIG)    ({ sigset_t _mask; sys_sigblock(SIG); })
-#define sigunblock(SIG)  ({ sigset_t _mask; sys_sigunblock(SIG); })
-#define sigsetmask(SIG)  ({ sigset_t _mask; sys_sigsetmask(SIG); })
+/* The below routines may need a local mask.  There could be problems
+   if code using any of the 3 macros below could be reentered due to a
+   signal occurring.  This can't happen in Emacs 18.57, so we don't
+   worry. - DJB */
+
+#define EMACS_SIGPAUSE(sigset) \
+  do { sigset_t _mask; sys_sigpause (sigset); } while (0)
+#define EMACS_SIGBLOCK(new_sig, old_sig) \
+  do { sigset_t _mask; (old_sig) = sys_sigblock (new_sig); } while (0)
+#define EMACS_SIGUNBLOCK(new_sig, old_sig) \
+  do { sigset_t _mask; (old_sig) = sys_sigunblock (new_sig); } while (0)
+#define EMACS_SIGSETMASK(new_sig, old_sig) \
+  do { sigset_t _mask; (old_sig) = sys_sigsetmask (new_sig); } while (0)
 #define sighold(SIG)     ONLY_USED_IN_BSD_4_1
 #define sigrelse(SIG)    ONLY_USED_IN_BSD_4_1
 
@@ -46,12 +52,12 @@ sigset_t sys_sigsetmask (sigset_t new_mask);
 
 #define sys_sigdel(MASK,SIG) sigdelset(&MASK,SIG)
 
-#else /* not POSIX_SIGNALS */
+#else /* ! defined (POSIX_SIGNALS) */
 
 #define sigunblock(SIG) \
 { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
 
-#endif /* not POSIX_SIGNALS */
+#endif /* ! defined (POSIX_SIGNALS) */
 
 #ifndef SIGMASKTYPE
 #define SIGMASKTYPE int
@@ -65,21 +71,38 @@ sigset_t sys_sigsetmask (sigset_t new_mask);
 #define sigmask(no) (1L << ((no) - 1))
 #endif
 
-#ifndef BSD4_1
-#define sigfree() sigsetmask (SIGEMPTYMASK)
-#define sigholdx(sig) sigsetmask (sigmask (sig))
-#define sigblockx(sig) sigblock (sigmask (sig))
-#define sigunblockx(sig) sigblock (SIGEMPTYMASK)
-#define sigpausex(sig) sigpause (0)
-#endif /* not BSD4_1 */
-
 #ifdef BSD4_1
 #define SIGIO SIGTINT
 /* sigfree and sigholdx are in sysdep.c */
-#define sigblockx(sig) sighold (sig)
-#define sigunblockx(sig) sigrelse (sig)
-#define sigpausex(sig) sigpause (sig)
-#endif /* BSD4_1 */
+#define EMACS_SIGFREE () sigfree ()
+
+/* We define the following macros to expand into statements rather
+   than expressions, because the POSIX macros above do the same, and
+   we don't want people on BSD4_1 systems accidentally using the
+   macros in a way that will break the other systems.  */
+#define EMACS_SIGHOLDX(new_sig, old_sig) \
+  do { (old_sig) = sigholdx (new_sig); } while (0)
+#define EMACS_SIGBLOCKX(new_sig, old_sig) \
+  do { (old_sig) = sighold (new_sig); } while (0)
+#define EMACS_SIGUNBLOCKX(new_sig, old_sig) \
+  do { (old_sig) = sigrelse (new_sig); } while (0)
+#define EMACS_SIGPAUSEX(sig) \
+  EMACS_SIGPAUSE (new_sig);
+
+#else /* ! defined (BSD4_1) */
+
+#define EMACS_SIGFREE() \
+  do { SIGMASKTYPE _dummy; EMACS_SIGSETMASK (SIGEMPTYMASK, _dummy); } while (0)
+#define EMACS_SIGHOLDX(new_sig, old_sig) \
+  EMACS_SIGSETMASK (sigmask (new_sig), old_sig)
+#define EMACS_SIGBLOCKX(new_sig, old_sig) \
+  EMACS_SIGBLOCK (sigmask (new_sig), old_sig)
+#define EMACS_SIGUNBLOCKX(new_sig, old_sig) \
+  EMACS_SIGUNBLOCK (sigmask (new_sig), old_sig)
+#define EMACS_SIGPAUSEX(sig) \
+  EMACS_SIGPAUSE (0)
+
+#endif /* ! defined (BSD4_1) */
 
 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
    Must do that using the killpg call.  */
@@ -96,6 +119,6 @@ sigset_t sys_sigsetmask (sigset_t new_mask);
 #ifdef SIGCLD
 #ifndef SIGCHLD
 #define SIGCHLD SIGCLD
-#endif /* not SIGCHLD */
-#endif /* SIGCLD */
-#endif /* not VMS */
+#endif /* SIGCHLD */
+#endif /* ! defined (SIGCLD) */
+#endif /* VMS */