]> git.eshelyaron.com Git - emacs.git/commitdiff
Cleanup terminal handling code.
authorDmitry Antipov <dmantipov@yandex.ru>
Tue, 14 Oct 2014 12:45:41 +0000 (16:45 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Tue, 14 Oct 2014 12:45:41 +0000 (16:45 +0400)
* dispextern.h (get_named_tty): Remove prototype but...
* termhooks.h (get_named_terminal): ...resurrect it under
more meaningful name.
(get_terminal): Likewise, but with...
(decode_live_terminal): ...this name.
(decode_tty_terminal): Add prototype.
* term.c (get_tty_terminal): Remove.
(get_named_tty): Remove.
(Ftty_display_color_p, Ftty_display_color_cells, Ftty_type)
(Fcontrolling_tty_p, Fsuspend_tty, Fresume_tty):
Use decode_tty_terminal.
(Ftty_no_underline, Ftty_top_frame): Use decode_live_terminal.
* terminal.c (get_terminal): Refactor to...
(decode_terminal, decode_live_terminal): ...new functions.
(decode_tty_terminal): Replacement for get_tty_terminal.
(get_named_terminal): Likewise for get_named_tty.
* coding.c (Fset_terminal_coding_system_internal)
(Fterminal_coding_system, Fset_keyboard_coding_system_internal):
(Fkeyboard_coding_system):
* composite.c (Fcomposition_get_gstring):
* dispnew.c (Fsend_string_to_terminal):
* frame.c (Fmake_terminal_frame):
* nsfns.m (check_ns_display_info):
* w32fns.c, xfns.c (check_x_display_info):
* xselect.c (frame_for_x_selection): Use decode_live_terminal.
* keyboard.c (handle_interrupt_signal, handle_interrupt)
(Fset_quit_char): Use get_named_terminal.
(Fset_output_flow_control, Fset_input_meta_mode):
Use decode_tty_terminal.

14 files changed:
src/ChangeLog
src/coding.c
src/composite.c
src/dispextern.h
src/dispnew.c
src/frame.c
src/keyboard.c
src/nsfns.m
src/term.c
src/termhooks.h
src/terminal.c
src/w32fns.c
src/xfns.c
src/xselect.c

index 3200a315daa0ce6fb96f9b2dff6a3e762d0d1037..c1b7c6cc8c3680669001dd0687e3aa01a5308e77 100644 (file)
@@ -1,3 +1,36 @@
+2014-10-14  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Cleanup terminal handling code.
+       * dispextern.h (get_named_tty): Remove prototype but...
+       * termhooks.h (get_named_terminal): ...resurrect it under
+       more meaningful name.
+       (get_terminal): Likewise, but with...
+       (decode_live_terminal): ...this name.
+       (decode_tty_terminal): Add prototype.
+       * term.c (get_tty_terminal): Remove.
+       (get_named_tty): Remove.
+       (Ftty_display_color_p, Ftty_display_color_cells, Ftty_type)
+       (Fcontrolling_tty_p, Fsuspend_tty, Fresume_tty):
+       Use decode_tty_terminal.
+       (Ftty_no_underline, Ftty_top_frame): Use decode_live_terminal.
+       * terminal.c (get_terminal): Refactor to...
+       (decode_terminal, decode_live_terminal): ...new functions.
+       (decode_tty_terminal): Replacement for get_tty_terminal.
+       (get_named_terminal): Likewise for get_named_tty.
+       * coding.c (Fset_terminal_coding_system_internal)
+       (Fterminal_coding_system, Fset_keyboard_coding_system_internal):
+       (Fkeyboard_coding_system):
+       * composite.c (Fcomposition_get_gstring):
+       * dispnew.c (Fsend_string_to_terminal):
+       * frame.c (Fmake_terminal_frame):
+       * nsfns.m (check_ns_display_info):
+       * w32fns.c, xfns.c (check_x_display_info):
+       * xselect.c (frame_for_x_selection): Use decode_live_terminal.
+       * keyboard.c (handle_interrupt_signal, handle_interrupt)
+       (Fset_quit_char): Use get_named_terminal.
+       (Fset_output_flow_control, Fset_input_meta_mode):
+       Use decode_tty_terminal.
+
 2014-10-13  Eli Zaretskii  <eliz@gnu.org>
 
        * w32term.h (ALIGN_STACK): Use _WIN64, not _W64, to distinguish
index f63d710ce9aae1ffc7fca04b3bda873d6b77533b..e4b52f6db484cd0db79666ec9f9413b01060d9af 100644 (file)
@@ -9759,7 +9759,7 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern
        doc: /* Internal use only.  */)
   (Lisp_Object coding_system, Lisp_Object terminal)
 {
-  struct terminal *term = get_terminal (terminal, 1);
+  struct terminal *term = decode_live_terminal (terminal);
   struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (term);
   CHECK_SYMBOL (coding_system);
   setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding);
@@ -9800,7 +9800,7 @@ frame's terminal device.  */)
   (Lisp_Object terminal)
 {
   struct coding_system *terminal_coding
-    = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1));
+    = TERMINAL_TERMINAL_CODING (decode_live_terminal (terminal));
   Lisp_Object coding_system = CODING_ID_NAME (terminal_coding->id);
 
   /* For backward compatibility, return nil if it is `undecided'.  */
@@ -9812,7 +9812,7 @@ DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_intern
        doc: /* Internal use only.  */)
   (Lisp_Object coding_system, Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_live_terminal (terminal);
   CHECK_SYMBOL (coding_system);
   if (NILP (coding_system))
     coding_system = Qno_conversion;
@@ -9831,7 +9831,7 @@ DEFUN ("keyboard-coding-system",
   (Lisp_Object terminal)
 {
   return CODING_ID_NAME (TERMINAL_KEYBOARD_CODING
-                        (get_terminal (terminal, 1))->id);
+                        (decode_live_terminal (terminal))->id);
 }
 
 \f
index 1b1960d1c4dc7cd498cb23ebfb917cec34727b6f..8982c904096ec732e6e70ef9b76d0608b122511c 100644 (file)
@@ -1719,7 +1719,7 @@ should be ignored.  */)
   if (! FONT_OBJECT_P (font_object))
     {
       struct coding_system *coding;
-      struct terminal *terminal = get_terminal (font_object, 1);
+      struct terminal *terminal = decode_live_terminal (font_object);
 
       coding = ((TERMINAL_TERMINAL_CODING (terminal)->common_flags
                 & CODING_REQUIRE_ENCODING_MASK)
index 81e36d7b3c6a29f1d17ec2065057a54d0c1c2f10..228502ca06a02e6579bc33b9d26547c93bac40bf 100644 (file)
@@ -3500,7 +3500,6 @@ extern void calculate_costs (struct frame *);
 extern void produce_glyphs (struct it *);
 extern bool tty_capable_p (struct tty_display_info *, unsigned);
 extern void set_tty_color_mode (struct tty_display_info *, struct frame *);
-extern struct terminal *get_named_tty (const char *);
 extern void create_tty_output (struct frame *);
 extern struct terminal *init_tty (const char *, const char *, bool);
 extern void tty_append_glyph (struct it *);
index fbad0edc018f625b32c2352961870091db664170..3ab8bcf3e640322d1d288423bca401b9b4d1e401 100644 (file)
@@ -5611,16 +5611,13 @@ the currently selected frame.  In batch mode, STRING is sent to stdout
 when TERMINAL is nil.  */)
   (Lisp_Object string, Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_live_terminal (terminal);
   FILE *out;
 
   /* ??? Perhaps we should do something special for multibyte strings here.  */
   CHECK_STRING (string);
   block_input ();
 
-  if (!t)
-    error ("Unknown terminal device");
-
   if (t->type == output_initial)
     out = stdout;
   else if (t->type != output_termcap && t->type != output_msdos_raw)
index a3139173655293269a885f7e4d3db183e020e6e1..8fac06e2af7d122564e3ade342b2373ae516c754 100644 (file)
@@ -964,7 +964,7 @@ affects all frames on the same terminal device.  */)
     if (CONSP (terminal))
       {
         terminal = XCDR (terminal);
-        t = get_terminal (terminal, 1);
+        t = decode_live_terminal (terminal);
       }
 #ifdef MSDOS
     if (t && t != the_only_display_info.terminal)
index 6730536dc1d76db96d685c2c88eea00cb96f21c8..e8143f26681c9b2e6b5d7f27c0bccf8d6c29e281 100644 (file)
@@ -10349,7 +10349,7 @@ static void
 handle_interrupt_signal (int sig)
 {
   /* See if we have an active terminal on our controlling tty.  */
-  struct terminal *terminal = get_named_tty ("/dev/tty");
+  struct terminal *terminal = get_named_terminal ("/dev/tty");
   if (!terminal)
     {
       /* If there are no frames there, let's pretend that we are a
@@ -10403,7 +10403,7 @@ handle_interrupt (bool in_signal_handler)
   cancel_echoing ();
 
   /* XXX This code needs to be revised for multi-tty support.  */
-  if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty"))
+  if (!NILP (Vquit_flag) && get_named_terminal ("/dev/tty"))
     {
       if (! in_signal_handler)
        {
@@ -10615,9 +10615,10 @@ Emacs reads input in CBREAK mode; see `set-input-interrupt-mode'.
 See also `current-input-mode'.  */)
   (Lisp_Object flow, Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_tty_terminal (terminal);
   struct tty_display_info *tty;
-  if (t == NULL || (t->type != output_termcap && t->type != output_msdos_raw))
+
+  if (!t)
     return Qnil;
   tty = t->display_info.tty;
 
@@ -10657,11 +10658,11 @@ the currently selected frame.
 See also `current-input-mode'.  */)
   (Lisp_Object meta, Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_tty_terminal (terminal);
   struct tty_display_info *tty;
   int new_meta;
 
-  if (t == NULL || (t->type != output_termcap && t->type != output_msdos_raw))
+  if (!t)
     return Qnil;
   tty = t->display_info.tty;
 
@@ -10698,9 +10699,10 @@ process.
 See also `current-input-mode'.  */)
   (Lisp_Object quit)
 {
-  struct terminal *t = get_named_tty ("/dev/tty");
+  struct terminal *t = get_named_terminal ("/dev/tty");
   struct tty_display_info *tty;
-  if (t == NULL || (t->type != output_termcap && t->type != output_msdos_raw))
+
+  if (!t)
     return Qnil;
   tty = t->display_info.tty;
 
index 5cf8387123e957867b6597bebc521e09e9f75bd4..a93b272440357318275cc9b6716fcc5f309aa44e 100644 (file)
@@ -133,7 +133,7 @@ check_ns_display_info (Lisp_Object object)
     }
   else if (TERMINALP (object))
     {
-      struct terminal *t = get_terminal (object, 1);
+      struct terminal *t = decode_live_terminal (object);
 
       if (t->type != output_ns)
         error ("Terminal %d is not a Nextstep display", t->id);
@@ -2541,7 +2541,7 @@ the attributes:
 Internal use only, use `display-monitor-attributes-list' instead.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *term = get_terminal (terminal, 1);
+  struct terminal *term = decode_live_terminal (terminal);
   NSArray *screens;
   NSUInteger i, n_monitors;
   struct MonitorInfo *monitors;
index 572435bdd1ac5e5846341ee67b0164e450d03934..0c36469f6554e57e100af33c7374f5799eacd277 100644 (file)
@@ -77,7 +77,6 @@ static void tty_turn_off_highlight (struct tty_display_info *);
 static void tty_show_cursor (struct tty_display_info *);
 static void tty_hide_cursor (struct tty_display_info *);
 static void tty_background_highlight (struct tty_display_info *tty);
-static struct terminal *get_tty_terminal (Lisp_Object, bool);
 static void clear_tty_hooks (struct terminal *terminal);
 static void set_tty_hooks (struct terminal *terminal);
 static void dissociate_if_controlling_tty (int fd);
@@ -2032,11 +2031,9 @@ selected frame's terminal).  This function always returns nil if
 TERMINAL does not refer to a text terminal.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_tty_terminal (terminal, 0);
-  if (!t)
-    return Qnil;
-  else
-    return t->display_info.tty->TN_max_colors > 0 ? Qt : Qnil;
+  struct terminal *t = decode_tty_terminal (terminal);
+
+  return (t && t->display_info.tty->TN_max_colors > 0) ? Qt : Qnil;
 }
 
 /* Return the number of supported colors.  */
@@ -2049,11 +2046,9 @@ selected frame's terminal).  This function always returns 0 if
 TERMINAL does not refer to a text terminal.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_tty_terminal (terminal, 0);
-  if (!t)
-    return make_number (0);
-  else
-    return make_number (t->display_info.tty->TN_max_colors);
+  struct terminal *t = decode_tty_terminal (terminal);
+
+  return make_number (t ? t->display_info.tty->TN_max_colors : 0);
 }
 
 #ifndef DOS_NT
@@ -2168,52 +2163,6 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f)
 
 #endif /* !DOS_NT */
 
-\f
-
-/* Return the tty display object specified by TERMINAL. */
-
-static struct terminal *
-get_tty_terminal (Lisp_Object terminal, bool throw)
-{
-  struct terminal *t = get_terminal (terminal, throw);
-
-  if (t && t->type != output_termcap && t->type != output_msdos_raw)
-    {
-      if (throw)
-        error ("Device %d is not a termcap terminal device", t->id);
-      else
-        return NULL;
-    }
-
-  return t;
-}
-
-/* Return an active termcap device that uses the tty device with the
-   given name.
-
-   This function ignores suspended devices.
-
-   Returns NULL if the named terminal device is not opened.  */
-
-struct terminal *
-get_named_tty (const char *name)
-{
-  struct terminal *t;
-
-  eassert (name);
-
-  for (t = terminal_list; t; t = t->next_terminal)
-    {
-      if ((t->type == output_termcap || t->type == output_msdos_raw)
-          && !strcmp (t->display_info.tty->name, name)
-          && TERMINAL_ACTIVE_P (t))
-        return t;
-    }
-
-  return 0;
-}
-
-\f
 DEFUN ("tty-type", Ftty_type, Stty_type, 0, 1, 0,
        doc: /* Return the type of the tty device that TERMINAL uses.
 Returns nil if TERMINAL is not on a tty device.
@@ -2222,15 +2171,10 @@ TERMINAL can be a terminal object, a frame, or nil (meaning the
 selected frame's terminal).  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
-
-  if (t->type != output_termcap && t->type != output_msdos_raw)
-    return Qnil;
+  struct terminal *t = decode_tty_terminal (terminal);
 
-  if (t->display_info.tty->type)
-    return build_string (t->display_info.tty->type);
-  else
-    return Qnil;
+  return (t && t->display_info.tty->type
+         ? build_string (t->display_info.tty->type) : Qnil);
 }
 
 DEFUN ("controlling-tty-p", Fcontrolling_tty_p, Scontrolling_tty_p, 0, 1, 0,
@@ -2241,13 +2185,9 @@ selected frame's terminal).  This function always returns nil if
 TERMINAL is not on a tty device.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_tty_terminal (terminal);
 
-  if ((t->type != output_termcap && t->type != output_msdos_raw)
-      || strcmp (t->display_info.tty->name, DEV_TTY) != 0)
-    return Qnil;
-  else
-    return Qt;
+  return (t && !strcmp (t->display_info.tty->name, DEV_TTY) ? Qt : Qnil);
 }
 
 DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0,
@@ -2261,7 +2201,7 @@ selected frame's terminal).  This function always returns nil if
 TERMINAL does not refer to a text terminal.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_live_terminal (terminal);
 
   if (t->type == output_termcap)
     t->display_info.tty->TS_enter_underline_mode = 0;
@@ -2276,7 +2216,7 @@ does not refer to a text terminal.  Otherwise, it returns the
 top-most frame on the text terminal.  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t = decode_live_terminal (terminal);
 
   if (t->type == output_termcap)
     return t->display_info.tty->top_frame;
@@ -2306,11 +2246,11 @@ suspended.
 A suspended tty may be resumed by calling `resume-tty' on it.  */)
   (Lisp_Object tty)
 {
-  struct terminal *t = get_tty_terminal (tty, 1);
+  struct terminal *t = decode_tty_terminal (tty);
   FILE *f;
 
   if (!t)
-    error ("Unknown tty device");
+    error ("Attempt to suspend a non-text terminal device");
 
   f = t->display_info.tty->input;
 
@@ -2366,15 +2306,15 @@ TTY may be a terminal object, a frame, or nil (meaning the selected
 frame's terminal). */)
   (Lisp_Object tty)
 {
-  struct terminal *t = get_tty_terminal (tty, 1);
+  struct terminal *t = decode_tty_terminal (tty);
   int fd;
 
   if (!t)
-    error ("Unknown tty device");
+    error ("Attempt to resume a non-text terminal device");
 
   if (!t->display_info.tty->input)
     {
-      if (get_named_tty (t->display_info.tty->name))
+      if (get_named_terminal (t->display_info.tty->name))
         error ("Cannot resume display while another display is active on the same device");
 
 #ifdef MSDOS
@@ -4007,7 +3947,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
   /* XXX Perhaps this should be made explicit by having init_tty
      always create a new terminal and separating terminal and frame
      creation on Lisp level.  */
-  terminal = get_named_tty (name);
+  terminal = get_named_terminal (name);
   if (terminal)
     return terminal;
 
index 8d85fba8af86cb2a3b8671aff57de129ca123b74..9cab853ed3d466c96f2ad231062423bb7c61140b 100644 (file)
@@ -681,7 +681,9 @@ extern struct terminal *terminal_list;
   (t->type == output_ns ? t->display_info.ns->name_list_element : Qnil)
 #endif
 
-extern struct terminal *get_terminal (Lisp_Object terminal, bool);
+extern struct terminal *decode_live_terminal (Lisp_Object);
+extern struct terminal *decode_tty_terminal (Lisp_Object);
+extern struct terminal *get_named_terminal (const char *);
 extern struct terminal *create_terminal (enum output_method,
                                         struct redisplay_interface *);
 extern void delete_terminal (struct terminal *);
index a827677a58d5b46e6f31e3ac13fe392295c5f2e2..0cd6a0bf60271d14c4379fcdea1c0c8a9fa924ea 100644 (file)
@@ -37,7 +37,9 @@ static int next_terminal_id;
 /* The initial terminal device, created by initial_term_init.  */
 struct terminal *initial_terminal;
 
+Lisp_Object Qrun_hook_with_args;
 static Lisp_Object Qterminal_live_p;
+static Lisp_Object Qdelete_terminal_functions;
 
 static void delete_initial_terminal (struct terminal *);
 
@@ -194,34 +196,66 @@ ins_del_lines (struct frame *f, int vpos, int n)
     (*FRAME_TERMINAL (f)->ins_del_lines_hook) (f, vpos, n);
 }
 
+/* Return the terminal object specified by TERMINAL.  TERMINAL may
+   be a terminal object, a frame, or nil for the terminal device of
+   the current frame.  If TERMINAL is neither from the above or the
+   resulting terminal object is deleted, return NULL.  */
 
-\f
-
-/* Return the terminal object specified by TERMINAL.  TERMINAL may be
-   a terminal object, a frame, or nil for the terminal device of the
-   current frame.  If THROW is false, return NULL for failure,
-   otherwise throw an error.  */
-
-struct terminal *
-get_terminal (Lisp_Object terminal, bool throw)
+static struct terminal *
+decode_terminal (Lisp_Object terminal)
 {
-  struct terminal *result = NULL;
+  struct terminal *t;
 
   if (NILP (terminal))
     terminal = selected_frame;
+  t = (TERMINALP (terminal)
+       ? XTERMINAL (terminal)
+       : FRAMEP (terminal) ? FRAME_TERMINAL (XFRAME (terminal)) : NULL);
+  return t && t->name ? t : NULL;
+}
 
-  if (TERMINALP (terminal))
-    result = XTERMINAL (terminal);
-  else if (FRAMEP (terminal))
-    result = FRAME_TERMINAL (XFRAME (terminal));
+/* Like above, but throw an error if TERMINAL is not valid or deleted.  */
 
-  if (result && !result->name)
-    result = NULL;
+struct terminal *
+decode_live_terminal (Lisp_Object terminal)
+{
+  struct terminal *t = decode_terminal (terminal);
 
-  if (result == NULL && throw)
+  if (!t)
     wrong_type_argument (Qterminal_live_p, terminal);
+  return t;
+}
+
+/* Like decode_terminal, but ensure that the resulting terminal object refers
+   to a text-based terminal device.  */
+
+struct terminal *
+decode_tty_terminal (Lisp_Object terminal)
+{
+  struct terminal *t = decode_live_terminal (terminal);
 
-  return result;
+  return (t->type == output_termcap || t->type == output_msdos_raw) ? t : NULL;
+}
+
+/* Return an active (not suspended) text-based terminal device that uses
+   the tty device with the given NAME, or NULL if the named terminal device
+   is not opened.  */
+
+struct terminal *
+get_named_terminal (const char *name)
+{
+  struct terminal *t;
+
+  eassert (name);
+
+  for (t = terminal_list; t; t = t->next_terminal)
+    {
+      if ((t->type == output_termcap || t->type == output_msdos_raw)
+          && !strcmp (t->display_info.tty->name, name)
+          && TERMINAL_ACTIVE_P (t))
+        return t;
+    }
+  return NULL;
 }
 
 /* Create a new terminal object of TYPE and add it to the terminal list.  RIF
@@ -308,8 +342,6 @@ delete_terminal (struct terminal *terminal)
     }
 }
 
-Lisp_Object Qrun_hook_with_args;
-static Lisp_Object Qdelete_terminal_functions;
 DEFUN ("delete-terminal", Fdelete_terminal, Sdelete_terminal, 0, 2, 0,
        doc: /* Delete TERMINAL by deleting all frames on it and closing the terminal.
 TERMINAL may be a terminal object, a frame, or nil (meaning the
@@ -319,7 +351,7 @@ Normally, you may not delete a display if all other displays are suspended,
 but if the second argument FORCE is non-nil, you may do so. */)
   (Lisp_Object terminal, Lisp_Object force)
 {
-  struct terminal *t = get_terminal (terminal, 0);
+  struct terminal *t = decode_terminal (terminal);
 
   if (!t)
     return Qnil;
@@ -380,9 +412,7 @@ sort of output terminal it uses.  See the documentation of `framep' for
 possible return values.  */)
   (Lisp_Object object)
 {
-  struct terminal *t;
-
-  t = get_terminal (object, 0);
+  struct terminal *t = decode_terminal (object);
 
   if (!t)
     return Qnil;
@@ -429,8 +459,7 @@ TERMINAL may be a terminal object, a frame, or nil (meaning the
 selected frame's terminal). */)
   (Lisp_Object terminal)
 {
-  struct terminal *t
-    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
+  struct terminal *t = decode_live_terminal (terminal);
 
   return t->name ? build_string (t->name) : Qnil;
 }
@@ -467,9 +496,7 @@ TERMINAL can be a terminal object, a frame, or nil (meaning the
 selected frame's terminal).  */)
   (Lisp_Object terminal)
 {
-  struct terminal *t
-    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
-  return Fcopy_alist (t->param_alist);
+  return Fcopy_alist (decode_live_terminal (terminal)->param_alist);
 }
 
 DEFUN ("terminal-parameter", Fterminal_parameter, Sterminal_parameter, 2, 2, 0,
@@ -478,12 +505,8 @@ TERMINAL can be a terminal object, a frame, or nil (meaning the
 selected frame's terminal).  */)
   (Lisp_Object terminal, Lisp_Object parameter)
 {
-  Lisp_Object value;
-  struct terminal *t
-    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
   CHECK_SYMBOL (parameter);
-  value = Fcdr (Fassq (parameter, t->param_alist));
-  return value;
+  return Fcdr (Fassq (parameter, decode_live_terminal (terminal)->param_alist));
 }
 
 DEFUN ("set-terminal-parameter", Fset_terminal_parameter,
@@ -495,9 +518,7 @@ TERMINAL can be a terminal object, a frame or nil (meaning the
 selected frame's terminal).  */)
   (Lisp_Object terminal, Lisp_Object parameter, Lisp_Object value)
 {
-  struct terminal *t
-    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
-  return store_terminal_param (t, parameter, value);
+  return store_terminal_param (decode_live_terminal (terminal), parameter, value);
 }
 
 /* Initial frame has no device-dependent output data, but has
index bfa69fb61cd1667cabd708314ae012924d216546..05da2a5c1d1d60c51229b78ab2202a10d13fca50 100644 (file)
@@ -276,7 +276,7 @@ check_x_display_info (Lisp_Object object)
     }
   else if (TERMINALP (object))
     {
-      struct terminal *t = get_terminal (object, 1);
+      struct terminal *t = decode_live_terminal (object);
 
       if (t->type != output_w32)
         error ("Terminal %d is not a W32 display", t->id);
index 7fd6d9070b20e102374157be1570ef4ea2ba4ef3..5edb635b1827429e2b3cb985ac766b101d73bade 100644 (file)
@@ -159,7 +159,7 @@ check_x_display_info (Lisp_Object object)
     }
   else if (TERMINALP (object))
     {
-      struct terminal *t = get_terminal (object, 1);
+      struct terminal *t = decode_live_terminal (object);
 
       if (t->type != output_x_window)
         error ("Terminal %d is not an X display", t->id);
index 9b57a95b26b1908021a7c90e6696b3a9532a4b48..92e8982229378d984b145ddba1aadf94c6808e58 100644 (file)
@@ -1901,7 +1901,7 @@ frame_for_x_selection (Lisp_Object object)
     }
   else if (TERMINALP (object))
     {
-      struct terminal *t = get_terminal (object, 1);
+      struct terminal *t = decode_live_terminal (object);
 
       if (t->type == output_x_window)
        FOR_EACH_FRAME (tail, frame)