]> git.eshelyaron.com Git - emacs.git/commitdiff
Clean up src/systty.h macros.
authorDan Nicolaescu <dann@ics.uci.edu>
Mon, 15 Nov 2010 06:10:35 +0000 (22:10 -0800)
committerDan Nicolaescu <dann@ics.uci.edu>
Mon, 15 Nov 2010 06:10:35 +0000 (22:10 -0800)
* systty.h (EMACS_GET_TTY_PGRP, EMACS_SET_TTY_PGRP, EMACS_GET_TTY)
(EMACS_SET_TTY): Remove unneeded abstraction, instead inline the
definition in all uses.
(EMACS_TTY_TABS_OK): Remove, it has a single user.
* src/sysdep.c (discard_tty_input, child_setup_tty)
(init_sys_modes, tabs_safe_p, reset_sys_modes):
* src/emacs.c (shut_down_emacs):
* src/callproc.c (child_setup):
* src/term.c (dissociate_if_controlling_tty): Inline removed macros.

src/ChangeLog
src/callproc.c
src/emacs.c
src/sysdep.c
src/systty.h
src/term.c

index 84490e6db96fd7050165ed72a9cfd4bcaeaaa9ea..7bfd266b4d82fef7a0244e6e97d26dec25109b93 100644 (file)
@@ -1,5 +1,16 @@
 2010-11-15  Dan Nicolaescu  <dann@ics.uci.edu>
 
+       Clean up systty.h macros.
+       * systty.h (EMACS_GET_TTY_PGRP, EMACS_SET_TTY_PGRP, EMACS_GET_TTY)
+       (EMACS_SET_TTY): Remove unneeded abstraction, instead inline the
+       definition in all uses.
+       (EMACS_TTY_TABS_OK): Remove, it has a single user.
+       * sysdep.c (discard_tty_input, child_setup_tty)
+       (init_sys_modes, tabs_safe_p, reset_sys_modes):
+       * emacs.c (shut_down_emacs):
+       * callproc.c (child_setup):
+       * term.c (dissociate_if_controlling_tty): Inline removed macros.
+
        * data.c (sign_extend_temp, sign_extend_lisp_int): Remove, unused.
 
 2010-11-14  Chong Yidong  <cyd@stupidchicken.com>
index ee0872b556226f3e75877a7429dd488119e6c4d8..5941f8180ffe3d586dae679fe8b0e5d20c21d228 100644 (file)
@@ -1221,7 +1221,7 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
   return cpid;
 #else /* not WINDOWSNT */
   /* setpgrp_of_tty is incorrect here; it uses input_fd.  */
-  EMACS_SET_TTY_PGRP (0, &pid);
+  tcsetpgrp (0, pid);
 
   /* execvp does not accept an environment arg so the only way
      to pass this environment is to set environ.  Our caller
@@ -1609,5 +1609,3 @@ See `setenv' and `getenv'.  */);
   defsubr (&Scall_process_region);
 }
 
-/* arch-tag: 769b8045-1df7-4d2b-8968-e3fb49017f95
-   (do not change this comment) */
index 64da350e22c5312fed87a973c451e7b7405dfa60..97ffd1a74c7154ac5f5bc035d4009c78d1c635ca 100644 (file)
@@ -2053,10 +2053,8 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
 #ifndef DOS_NT
   {
     int pgrp = EMACS_GETPGRP (0);
-
-    int tpgrp;
-    if (EMACS_GET_TTY_PGRP (0, &tpgrp) != -1
-       && tpgrp == pgrp)
+    int tpgrp = tcgetpgrp (0);
+    if ((tpgrp != -1) && tpgrp == pgrp)
       {
        reset_all_sys_modes ();
        if (sig && sig != SIGTERM)
index 84fa6d6b3b73076e4e02bd4f4522b614b5d74b5b..0c291dd80acf510cccb59ab35ca49326e8f86e24 100644 (file)
@@ -229,8 +229,8 @@ discard_tty_input (void)
       {
         if (tty->input)         /* Is the device suspended? */
           {
-            EMACS_GET_TTY (fileno (tty->input), &buf);
-            EMACS_SET_TTY (fileno (tty->input), &buf, 0);
+            emacs_get_tty (fileno (tty->input), &buf);
+            emacs_set_tty (fileno (tty->input), &buf, 0);
           }
       }
   }
@@ -366,7 +366,7 @@ child_setup_tty (int out)
 #ifndef WINDOWSNT
   struct emacs_tty s;
 
-  EMACS_GET_TTY (out, &s);
+  emacs_get_tty (out, &s);
   s.main.c_oflag |= OPOST;     /* Enable output postprocessing */
   s.main.c_oflag &= ~ONLCR;    /* Disable map of NL to CR-NL on output */
 #ifdef NLDLY
@@ -444,7 +444,7 @@ child_setup_tty (int out)
   s.main.c_cc[VTIME] = 0;
 #endif
 
-  EMACS_SET_TTY (out, &s, 0);
+  emacs_set_tty (out, &s, 0);
 #endif /* not WINDOWSNT */
 }
 #endif /* not MSDOS */
@@ -856,7 +856,7 @@ init_sys_modes (struct tty_display_info *tty_out)
   if (! tty_out->old_tty)
     tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty));
 
-  EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty);
+  emacs_get_tty (fileno (tty_out->input), tty_out->old_tty);
 
   tty = *tty_out->old_tty;
 
@@ -1002,7 +1002,7 @@ init_sys_modes (struct tty_display_info *tty_out)
   dos_ttraw (tty_out);
 #endif
 
-  EMACS_SET_TTY (fileno (tty_out->input), &tty, 0);
+  emacs_set_tty (fileno (tty_out->input), &tty, 0);
 
   /* This code added to insure that, if flow-control is not to be used,
      we have an unlocked terminal at the start. */
@@ -1094,8 +1094,16 @@ tabs_safe_p (int fd)
 {
   struct emacs_tty etty;
 
-  EMACS_GET_TTY (fd, &etty);
-  return EMACS_TTY_TABS_OK (&etty);
+  emacs_get_tty (fd, &etty);
+#ifndef DOS_NT
+#ifdef TABDLY
+  return ((etty.main.c_oflag & TABDLY) != TAB3);
+#else /* not TABDLY */
+  return 1;
+#endif /* not TABDLY */
+#else /* DOS_NT */
+  return 0;
+#endif /* DOS_NT */
 }
 \f
 /* Get terminal size from system.
@@ -1257,7 +1265,7 @@ reset_sys_modes (struct tty_display_info *tty_out)
 #endif /* F_SETFL */
 
   if (tty_out->old_tty)
-    while (EMACS_SET_TTY (fileno (tty_out->input),
+    while (emacs_set_tty (fileno (tty_out->input),
                           tty_out->old_tty, 0) < 0 && errno == EINTR)
       ;
 
index 8c46411cedb3f1ec965f87311fb6940d56ec21b2..9cecbab4f0ec4e1c259cb8a42cbc2f2830aa24f5 100644 (file)
@@ -86,17 +86,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 \f
 /* Manipulate a terminal's current process group.  */
 
-/* EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's
-   current process group.  Return -1 if there is an error.
-
-   EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's
-   current process group to *PGID.  Return -1 if there is an error.  */
-
-#ifndef DOS_NT
-#define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd)))
-#define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid)))
-#endif /* not DOS_NT */
-
 /* EMACS_GETPGRP (arg) returns the process group of the process.  */
 
 #if defined (GETPGRP_VOID)
@@ -112,21 +101,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    state, for example a struct tchars, a struct sgttyb, a struct
    tchars, a struct ltchars, and a struct pagechars, struct
    emacs_tty should contain an element for each parameter struct
-   that Emacs may change.
-
-   EMACS_GET_TTY (int FD, struct emacs_tty *P) stores the parameters
-   of the tty on FD in *P.  Return zero if all's well, or -1 if we ran
-   into an error we couldn't deal with.
-
-   EMACS_SET_TTY (int FD, struct emacs_tty *P, int flushp)
-   sets the parameters of the tty on FD according to the contents of
-   *P.  If flushp is non-zero, we discard queued input to be
-   written before making the change.
-   Return 0 if all went well, and -1 if anything failed.
-
-   EMACS_TTY_TABS_OK (struct emacs_tty *P) is false if the kernel
-   expands tabs to spaces upon output; in that case, there is no
-   advantage to using tabs over spaces.  */
+   that Emacs may change.  */
 
 
 /* For each tty parameter structure that Emacs might want to save and restore,
@@ -145,31 +120,6 @@ struct emacs_tty {
 #endif /* DOS_NT */
 };
 \f
-/* Define EMACS_GET_TTY and EMACS_SET_TTY,
-   the macros for reading and setting parts of `struct emacs_tty'.
-
-   These got pretty unmanageable (huge macros are hard to debug), and
-   finally needed some code which couldn't be done as part of an
-   expression, so we moved them out to their own functions in sysdep.c.  */
-#define EMACS_GET_TTY(fd, p)        (emacs_get_tty ((fd), (p)))
-#define EMACS_SET_TTY(fd, p, waitp) (emacs_set_tty ((fd), (p), (waitp)))
 extern int emacs_get_tty (int, struct emacs_tty *);
 extern int emacs_set_tty (int, struct emacs_tty *, int);
 
-\f
-/* Define EMACS_TTY_TABS_OK.  */
-
-#ifndef DOS_NT
-
-#ifdef TABDLY
-#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
-#else /* not TABDLY */
-#define EMACS_TTY_TABS_OK(p) 1
-#endif /* not TABDLY */
-
-#else /* DOS_NT */
-#define EMACS_TTY_TABS_OK(p) 0
-#endif /* DOS_NT */
-
-/* arch-tag: cf4b90bc-be41-401c-be98-40619178a712
-   (do not change this comment) */
index 71df92822acdf92dc909ff391ed8d920c1d394da..4d452ed3e0050afe24cc5f28c3c7d0769c55323a 100644 (file)
@@ -3087,8 +3087,7 @@ static void
 dissociate_if_controlling_tty (int fd)
 {
 #ifndef DOS_NT
-  int pgid;
-  EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */
+  int pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */
   if (pgid != -1)
     {
 #if defined (USG5)
@@ -3832,7 +3831,3 @@ bigger, or it may make it blink, or it may do nothing at all.  */);
   encode_terminal_dst = NULL;
 }
 
-
-
-/* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193
-   (do not change this comment) */