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>
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
defsubr (&Scall_process_region);
}
-/* arch-tag: 769b8045-1df7-4d2b-8968-e3fb49017f95
- (do not change this comment) */
#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)
{
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);
}
}
}
#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
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 */
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;
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. */
{
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.
#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)
;
\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)
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,
#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) */
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)
encode_terminal_dst = NULL;
}
-
-
-/* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193
- (do not change this comment) */