emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101629: Code simplification in term.


From: Dan Nicolaescu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101629: Code simplification in term.c.
Date: Sun, 26 Sep 2010 18:06:21 +0300
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101629
committer: Dan Nicolaescu <address@hidden>
branch nick: trunk
timestamp: Sun 2010-09-26 18:06:21 +0300
message:
  Code simplification in term.c.
  * src/term.c: Do not include sys/ioctl.h, not needed.
  (init_tty): Reorder code to reduce the number of #ifdefs.  No code
  changes.
modified:
  src/ChangeLog
  src/term.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-09-26 06:06:28 +0000
+++ b/src/ChangeLog     2010-09-26 15:06:21 +0000
@@ -1,3 +1,9 @@
+2010-09-26  Dan Nicolaescu  <address@hidden>
+
+       * term.c: Do not include sys/ioctl.h, not needed.
+       (init_tty): Reorder code to reduce the number of #ifdefs.  No code
+       changes.
+
 2010-09-26  Teodor Zlatanov  <address@hidden>
 
        * process.h: Set up GnuTLS support.

=== modified file 'src/term.c'
--- a/src/term.c        2010-09-25 12:31:15 +0000
+++ b/src/term.c        2010-09-26 15:06:21 +0000
@@ -31,10 +31,6 @@
 #include <unistd.h>
 #endif
 
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-
 #include <signal.h>
 #include <stdarg.h>
 #include <setjmp.h>
@@ -3407,6 +3403,15 @@
   tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
   Wcm_clear (tty);
 
+  encode_terminal_src_size = 0;
+  encode_terminal_dst_size = 0;
+
+#ifdef HAVE_GPM
+  terminal->mouse_position_hook = term_mouse_position;
+  mouse_face_window = Qnil;
+#endif
+
+  
 #ifndef DOS_NT
   set_tty_hooks (terminal);
 
@@ -3460,78 +3465,6 @@
 
   add_keyboard_wait_descriptor (fileno (tty->input));
 
-#endif /* !DOS_NT */
-
-  encode_terminal_src_size = 0;
-  encode_terminal_dst_size = 0;
-
-#ifdef HAVE_GPM
-  terminal->mouse_position_hook = term_mouse_position;
-  mouse_face_window = Qnil;
-#endif
-
-#ifdef DOS_NT
-#ifdef WINDOWSNT
-  initialize_w32_display (terminal);
-#else  /* MSDOS */
-  if (strcmp (terminal_type, "internal") == 0)
-    terminal->type = output_msdos_raw;
-  initialize_msdos_display (terminal);
-#endif /* MSDOS */
-  tty->output = stdout;
-  tty->input = stdin;
-  /* The following two are inaccessible from w32console.c.  */
-  terminal->delete_frame_hook = &tty_free_frame_resources;
-  terminal->delete_terminal_hook = &delete_tty;
-
-  tty->name = xstrdup (name);
-  terminal->name = xstrdup (name);
-  tty->type = xstrdup (terminal_type);
-
-  add_keyboard_wait_descriptor (0);
-
-  Wcm_clear (tty);
-
-#ifdef WINDOWSNT
-  {
-    struct frame *f = XFRAME (selected_frame);
-
-    FrameRows (tty) = FRAME_LINES (f);
-    FrameCols (tty) = FRAME_COLS (f);
-    tty->specified_window = FRAME_LINES (f);
-
-    FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
-    FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
-  }
-#else  /* MSDOS */
-  {
-    int height, width;
-    get_tty_size (fileno (tty->input), &width, &height);
-    FrameCols (tty) = width;
-    FrameRows (tty) = height;
-  }
-#endif /* MSDOS */
-  tty->delete_in_insert_mode = 1;
-
-  UseTabs (tty) = 0;
-  terminal->scroll_region_ok = 0;
-
-  /* Seems to insert lines when it's not supposed to, messing up the
-     display.  In doing a trace, it didn't seem to be called much, so I
-     don't think we're losing anything by turning it off.  */
-  terminal->line_ins_del_ok = 0;
-#ifdef WINDOWSNT
-  terminal->char_ins_del_ok = 1;
-  baud_rate = 19200;
-#else  /* MSDOS */
-  terminal->char_ins_del_ok = 0;
-  init_baud_rate (fileno (tty->input));
-#endif /* MSDOS */
-
-  tty->TN_max_colors = 16;  /* Required to be non-zero for tty-display-color-p 
*/
-
-#else  /* not DOS_NT */
-
   Wcm_clear (tty);
 
   tty->termcap_term_buffer = (char *) xmalloc (buffer_size);
@@ -3683,7 +3616,64 @@
   tty->TF_underscore = tgetflag ("ul");
   tty->TF_teleray = tgetflag ("xt");
 
-#endif /* !DOS_NT  */
+#else /* DOS_NT */
+#ifdef WINDOWSNT
+  {
+    struct frame *f = XFRAME (selected_frame);
+
+    initialize_w32_display (terminal);
+
+    FrameRows (tty) = FRAME_LINES (f);
+    FrameCols (tty) = FRAME_COLS (f);
+    tty->specified_window = FRAME_LINES (f);
+
+    FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
+    FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
+    terminal->char_ins_del_ok = 1;
+    baud_rate = 19200;
+  }
+#else  /* MSDOS */
+  {
+    int height, width;
+    if (strcmp (terminal_type, "internal") == 0)
+      terminal->type = output_msdos_raw;
+    initialize_msdos_display (terminal);
+
+    get_tty_size (fileno (tty->input), &width, &height);
+    FrameCols (tty) = width;
+    FrameRows (tty) = height;
+    terminal->char_ins_del_ok = 0;
+    init_baud_rate (fileno (tty->input));
+  }
+#endif /* MSDOS */
+  tty->output = stdout;
+  tty->input = stdin;
+  /* The following two are inaccessible from w32console.c.  */
+  terminal->delete_frame_hook = &tty_free_frame_resources;
+  terminal->delete_terminal_hook = &delete_tty;
+
+  tty->name = xstrdup (name);
+  terminal->name = xstrdup (name);
+  tty->type = xstrdup (terminal_type);
+
+  add_keyboard_wait_descriptor (0);
+
+  /* FIXME: this should be removed,  done earlier. */
+  Wcm_clear (tty);
+
+  tty->delete_in_insert_mode = 1;
+
+  UseTabs (tty) = 0;
+  terminal->scroll_region_ok = 0;
+
+  /* Seems to insert lines when it's not supposed to, messing up the
+     display.  In doing a trace, it didn't seem to be called much, so I
+     don't think we're losing anything by turning it off.  */
+  terminal->line_ins_del_ok = 0;
+
+  tty->TN_max_colors = 16;  /* Required to be non-zero for tty-display-color-p 
*/
+#endif /* DOS_NT */
+
   terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
   init_kboard (terminal->kboard);
   terminal->kboard->Vwindow_system = Qnil;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]