changeset 84697:efbb243fc83d

(get_terminal): Don't accept integers to represent terminals. (Fterminal_name, Fterminal_parameters, Fterminal_parameter) (Fset_terminal_parameter): Work with dead terminals as well. (Fmodify_terminal_parameters): Remove.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 20 Sep 2007 21:44:06 +0000
parents 2c04a398aea9
children e6e2af0f00c5
files src/ChangeLog src/terminal.c
diffstat 2 files changed, 14 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Sep 20 21:40:42 2007 +0000
+++ b/src/ChangeLog	Thu Sep 20 21:44:06 2007 +0000
@@ -1,5 +1,10 @@
 2007-09-20  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* terminal.c (get_terminal): Don't accept integers to represent terminals.
+	(Fterminal_name, Fterminal_parameters, Fterminal_parameter)
+	(Fset_terminal_parameter): Work with dead terminals as well.
+	(Fmodify_terminal_parameters): Remove.
+
 	* terminal.c (get_terminal): Handle terminals.
 	Make sure the terminal returned is live.
 	(create_terminal): Use allocate_terminal.
--- a/src/terminal.c	Thu Sep 20 21:40:42 2007 +0000
+++ b/src/terminal.c	Thu Sep 20 21:44:06 2007 +0000
@@ -208,21 +208,6 @@
   if (TERMINALP (terminal))
     result = XTERMINAL (terminal);
 
-  else if (INTEGERP (terminal))
-    {
-      /* FIXME: Get rid of the use of integers to represent terminals.  */
-      struct terminal *t;
-
-      for (t = terminal_list; t; t = t->next_terminal)
-        {
-          if (t->id == XINT (terminal))
-            {
-              result = t;
-  	      eassert (t->name != NULL);
-              break;
-            }
-        }
-    }
   else if (FRAMEP (terminal))
     {
       result = FRAME_TERMINAL (XFRAME (terminal));
@@ -428,12 +413,10 @@
   (terminal)
      Lisp_Object terminal;
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t
+    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
 
-  if (t->name)
-    return build_string (t->name);
-  else
-    return Qnil;
+  return t->name ? build_string (t->name) : Qnil;
 }
 
 
@@ -484,7 +467,8 @@
      (terminal)
      Lisp_Object terminal;
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t
+    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
   return Fcopy_alist (t->param_alist);
 }
 
@@ -497,54 +481,13 @@
      Lisp_Object parameter;
 {
   Lisp_Object value;
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t
+    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
   CHECK_SYMBOL (parameter);
   value = Fcdr (Fassq (parameter, t->param_alist));
   return value;
 }
 
-DEFUN ("modify-terminal-parameters", Fmodify_terminal_parameters,
-       Smodify_terminal_parameters, 2, 2, 0,
-       doc: /* Modify the parameters of terminal TERMINAL according to ALIST.
-ALIST is an alist of parameters to change and their new values.
-Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.
-
-TERMINAL can be a terminal id, a frame or nil (meaning the selected
-frame's terminal).  */)
-     (terminal, alist)
-     Lisp_Object terminal;
-     Lisp_Object alist;
-{
-  Lisp_Object tail, prop, val;
-  struct terminal *t = get_terminal (terminal, 1);
-  int length = XINT (Fsafe_length (alist));
-  int i;
-  Lisp_Object *parms = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
-  Lisp_Object *values = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
-
-  /* Extract parm names and values into those vectors.  */
-  
-  i = 0;
-  for (tail = alist; CONSP (tail); tail = Fcdr (tail))
-    {
-      Lisp_Object elt;
-      
-      elt = Fcar (tail);
-      parms[i] = Fcar (elt);
-      values[i] = Fcdr (elt);
-      i++;
-    }
-  
-  /* Now process them in reverse of specified order.  */
-  for (i--; i >= 0; i--)
-    {
-      prop = parms[i];
-      val = values[i];
-      store_terminal_param (t, prop, val);
-    }
-  return Qnil;
-}
-
 DEFUN ("set-terminal-parameter", Fset_terminal_parameter,
        Sset_terminal_parameter, 3, 3, 0,
        doc: /* Set TERMINAL's value for parameter PARAMETER to VALUE.
@@ -557,7 +500,8 @@
      Lisp_Object parameter;
      Lisp_Object value;
 {
-  struct terminal *t = get_terminal (terminal, 1);
+  struct terminal *t
+    = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1);
   return store_terminal_param (t, parameter, value);
 }
 
@@ -613,7 +557,6 @@
   defsubr (&Sterminal_name);
   defsubr (&Sterminal_parameters);
   defsubr (&Sterminal_parameter);
-  defsubr (&Smodify_terminal_parameters);
   defsubr (&Sset_terminal_parameter);
 
   Fprovide (intern ("multi-tty"), Qnil);