]> code.delx.au - gnu-emacs/blobdiff - src/term.c
* editfns.c (Fdelete_region): Clarify the use of the named parameters.
[gnu-emacs] / src / term.c
index 3547b9a2dddaa9efc28e7f0749d62d7e2d732589..22056451cb90ff0098d0dfc9719b581bfe4c0a09 100644 (file)
@@ -26,7 +26,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/file.h>
 #include <unistd.h>
 #include <signal.h>
-#include <stdarg.h>
 #include <setjmp.h>
 
 #include "lisp.h"
@@ -77,9 +76,11 @@ static int been_here = -1;
 static void tty_set_scroll_region (struct frame *f, int start, int stop);
 static void turn_on_face (struct frame *, int face_id);
 static void turn_off_face (struct frame *, int face_id);
+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, int);
 static void clear_tty_hooks (struct terminal *terminal);
 static void set_tty_hooks (struct terminal *terminal);
 static void dissociate_if_controlling_tty (int fd);
@@ -133,11 +134,11 @@ enum no_color_bit
 
 /* The largest frame width in any call to calculate_costs.  */
 
-int max_frame_cols;
+static int max_frame_cols;
 
 /* The largest frame height in any call to calculate_costs.  */
 
-int max_frame_lines;
+static int max_frame_lines;
 
 /* Non-zero if we have dropped our controlling tty and therefore
    should not open a frame on stdout. */
@@ -173,7 +174,7 @@ tty_ring_bell (struct frame *f)
 
 /* Set up termcap modes for Emacs. */
 
-void
+static void
 tty_set_terminal_modes (struct terminal *terminal)
 {
   struct tty_display_info *tty = terminal->display_info.tty;
@@ -201,7 +202,7 @@ tty_set_terminal_modes (struct terminal *terminal)
 
 /* Reset termcap modes before exiting Emacs. */
 
-void
+static void
 tty_reset_terminal_modes (struct terminal *terminal)
 {
   struct tty_display_info *tty = terminal->display_info.tty;
@@ -286,7 +287,7 @@ tty_turn_off_insert (struct tty_display_info *tty)
 \f
 /* Handle highlighting.  */
 
-void
+static void
 tty_turn_off_highlight (struct tty_display_info *tty)
 {
   if (tty->standout_mode)
@@ -1545,7 +1546,8 @@ produce_glyphs (struct it *it)
   /* Nothing but characters are supported on terminal frames.  */
   xassert (it->what == IT_CHARACTER
           || it->what == IT_COMPOSITION
-          || it->what == IT_STRETCH);
+          || it->what == IT_STRETCH
+          || it->what == IT_GLYPHLESS);
 
   if (it->what == IT_STRETCH)
     {
@@ -1934,6 +1936,8 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
        {
          if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display))
            acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c);
+         if (CONSP (acronym))
+           acronym = XCDR (acronym);
          buf[0] = '[';
          str = STRINGP (acronym) ? SSDATA (acronym) : "";
          for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++)
@@ -2368,7 +2372,7 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f)
 
 /* Return the tty display object specified by TERMINAL. */
 
-struct terminal *
+static struct terminal *
 get_tty_terminal (Lisp_Object terminal, int throw)
 {
   struct terminal *t = get_terminal (terminal, throw);
@@ -2411,7 +2415,7 @@ get_named_tty (const char *name)
 }
 
 \f
-DEFUE ("tty-type", Ftty_type, Stty_type, 0, 1, 0,
+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.
 
@@ -2592,6 +2596,7 @@ frame's terminal). */)
          FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
        }
 
+      set_tty_hooks (t);
       init_sys_modes (t->display_info.tty);
 
       {
@@ -2614,6 +2619,8 @@ frame's terminal). */)
  ***********************************************************************/
 
 #ifdef HAVE_GPM
+
+#ifndef HAVE_WINDOW_SYSTEM
 void
 term_mouse_moveto (int x, int y)
 {
@@ -2627,6 +2634,7 @@ term_mouse_moveto (int x, int y)
   last_mouse_x = x;
   last_mouse_y = y;  */
 }
+#endif /* HAVE_WINDOW_SYSTEM */
 
 /* Implementation of draw_row_with_mouse_face for TTY/GPM.  */
 void
@@ -2692,9 +2700,10 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event)
 static void
 term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
                     enum scroll_bar_part *part, Lisp_Object *x,
-                    Lisp_Object *y, unsigned long *timeptr)
+                    Lisp_Object *y, Time *timeptr)
 {
   struct timeval now;
+  Time sec, usec;
 
   *fp = SELECTED_FRAME ();
   (*fp)->mouse_moved = 0;
@@ -2705,7 +2714,9 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
   XSETINT (*x, last_mouse_x);
   XSETINT (*y, last_mouse_y);
   gettimeofday(&now, 0);
-  *timeptr = (now.tv_sec * 1000) + (now.tv_usec / 1000);
+  sec = now.tv_sec;
+  usec = now.tv_usec;
+  *timeptr = (sec * 1000) + (usec / 1000);
 }
 
 /* Prepare a mouse-event in *RESULT for placement in the input queue.
@@ -3086,7 +3097,6 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
   char *area = NULL;
   char **address = &area;
   int buffer_size = 4096;
-  register char *p = NULL;
   int status;
   struct tty_display_info *tty = NULL;
   struct terminal *terminal = NULL;
@@ -3114,7 +3124,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
   terminal = create_terminal ();
 #ifdef MSDOS
   if (been_here > 0)
-    maybe_fatal (1, 0, "Attempt to create another terminal %s", "",
+    maybe_fatal (0, 0, "Attempt to create another terminal %s", "",
                 name, "");
   been_here = 1;
   tty = &the_only_display_info;
@@ -3494,55 +3504,6 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
       Down (tty) = 0;
     }
 
-  /* Special handling for certain terminal types known to need it */
-
-  if (!strcmp (terminal_type, "supdup"))
-    {
-      terminal->memory_below_frame = 1;
-      tty->Wcm->cm_losewrap = 1;
-    }
-  if (!strncmp (terminal_type, "c10", 3)
-      || !strcmp (terminal_type, "perq"))
-    {
-      /* Supply a makeshift :wi string.
-        This string is not valid in general since it works only
-        for windows starting at the upper left corner;
-        but that is all Emacs uses.
-
-        This string works only if the frame is using
-        the top of the video memory, because addressing is memory-relative.
-        So first check the :ti string to see if that is true.
-
-        It would be simpler if the :wi string could go in the termcap
-        entry, but it can't because it is not fully valid.
-        If it were in the termcap entry, it would confuse other programs.  */
-      if (!tty->TS_set_window)
-       {
-         const char *m = tty->TS_termcap_modes;
-         while (*m && strcmp (m, "\033v  "))
-           m++;
-         if (*m)
-           tty->TS_set_window = "\033v%C %C %C %C ";
-       }
-      /* Termcap entry often fails to have :in: flag */
-      terminal->must_write_spaces = 1;
-      /* :ti string typically fails to have \E^G! in it */
-      /* This limits scope of insert-char to one line.  */
-      strcpy (area, tty->TS_termcap_modes);
-      strcat (area, "\033\007!");
-      tty->TS_termcap_modes = area;
-      area += strlen (area) + 1;
-      p = AbsPosition (tty);
-      /* Change all %+ parameters to %C, to handle
-         values above 96 correctly for the C100.  */
-      while (*p)
-        {
-          if (p[0] == '%' && p[1] == '+')
-            p[1] = 'C';
-          p++;
-        }
-    }
-
   tty->specified_window = FrameRows (tty);
 
   if (Wcm_init (tty) == -1)    /* can't do cursor motion */
@@ -3612,7 +3573,6 @@ vfatal (const char *str, va_list ap)
   vfprintf (stderr, str, ap);
   if (!(strlen (str) > 0 && str[strlen (str) - 1] == '\n'))
     fprintf (stderr, "\n");
-  va_end (ap);
   fflush (stderr);
   exit (1);
 }
@@ -3620,7 +3580,7 @@ vfatal (const char *str, va_list ap)
 
 /* Auxiliary error-handling function for init_tty.
    Delete TERMINAL, then call error or fatal with str1 or str2,
-   respectively, according to MUST_SUCCEED.  */
+   respectively, according to whether MUST_SUCCEED is zero or not.  */
 
 static void
 maybe_fatal (int must_succeed, struct terminal *terminal,