Add an EXFUN for `Ffind_char'.
[chise/xemacs-chise.git-] / src / redisplay-tty.c
index 83301dd..80bdcc4 100644 (file)
@@ -53,17 +53,12 @@ Boston, MA 02111-1307, USA.  */
    invoking them correctly. */
 /* # include <curses.h> */
 /* # include <term.h> */
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern int tgetent (const char *, const char *);
-extern int tgetflag (const char *);
-extern int tgetnum (const char *);
-extern char *tgetstr (const char *, char **);
-extern void tputs (const char *, int, void (*)(int));
-#ifdef __cplusplus
-}
-#endif
+EXTERN_C int tgetent (const char *, const char *);
+EXTERN_C int tgetflag (const char *);
+EXTERN_C int tgetnum (const char *);
+EXTERN_C char *tgetstr (const char *, char **);
+EXTERN_C void tputs (const char *, int, void (*)(int));
+
 #define FORCE_CURSOR_UPDATE(c) send_string_to_tty_console (c, 0, 0)
 #define OUTPUTN(c, a, n)                       \
   do {                                         \
@@ -171,8 +166,7 @@ static void
 #endif
 tty_frame_output_end (struct frame *f)
 {
-  struct device *d = XDEVICE (FRAME_DEVICE (f));
-  struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
+  struct console *c = XCONSOLE (FRAME_CONSOLE (f));
 
   CONSOLE_TTY_CURSOR_X (c) = CONSOLE_TTY_FINAL_CURSOR_X (c);
   CONSOLE_TTY_CURSOR_Y (c) = CONSOLE_TTY_FINAL_CURSOR_Y (c);
@@ -242,8 +236,7 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block,
       rb = Dynarr_atp (rba, elt);
 
       if (rb->findex == findex && rb->type == RUNE_CHAR
-         && (!EQ (rb->object.cglyph.charset, Vcharset_ascii)
-             || (rb->object.cglyph.code_point != '\n'))
+         && (!CHARC_ASCII_EQ (rb->object.cglyph, '\n'))
          && (rb->cursor_type != CURSOR_ON
              || NILP (w->text_cursor_visible_p)))
        {
@@ -264,15 +257,10 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block,
              findex = rb->findex;
              xpos = rb->xpos;
 
-             if (EQ (rb->object.cglyph.charset, Vcharset_ascii)
-                 && (rb->object.cglyph.code_point == '\n'))
+             if (CHARC_ASCII_EQ (rb->object.cglyph, '\n'))
                {
                  /* Clear in case a cursor was formerly here. */
-                 Charc ec_space;
-
-                 ec_space.charset = Vcharset_ascii;
-                 ec_space.code_point = ' ';
-                 Dynarr_add (buf, ec_space);
+                 Dynarr_add (buf, ASCII_TO_CHARC (' '));
                  tty_output_charc_dynarr (w, dl, buf, rb->xpos,
                                           DEFAULT_INDEX, 0);
                  Dynarr_reset (buf);
@@ -303,11 +291,10 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block,
              Charc ec_to_add;
              int size = rb->width;
 
-             ec_to_add.charset = Vcharset_ascii;
              if (rb->type == RUNE_BLANK)
-               ec_to_add.code_point = ' ';
+               ec_to_add = ASCII_TO_CHARC (' ');
              else
-               ec_to_add.code_point = '-';
+               ec_to_add = ASCII_TO_CHARC ('-');
 
              while (size--)
                Dynarr_add (buf, ec_to_add);
@@ -893,7 +880,13 @@ reset_tty_modes (struct console *c)
   OUTPUT1_IF (c, TTY_SD (c).keypad_off);
   OUTPUT1_IF (c, TTY_SD (c).cursor_normal);
   OUTPUT1_IF (c, TTY_SD (c).end_motion);
-  tty_frame_output_end (XFRAME (CONSOLE_SELECTED_FRAME (c)));
+
+  {
+    Lisp_Object frm = CONSOLE_SELECTED_FRAME (c);
+
+    if (!NILP (frm))
+      tty_frame_output_end (XFRAME (frm));
+  }
 }
 
 /*****************************************************************************
@@ -930,6 +923,7 @@ tty_redisplay_shutdown (struct console *c)
    up or removed. */
 
 
+#ifdef NOT_YET
 /* FLAGS - these don't need to be console local since only one console
           can be being updated at a time. */
 static int insert_mode_on;             /* nonzero if in insert mode */
@@ -938,7 +932,6 @@ static int underline_mode_on;               /* nonzero if in underline mode */
 static int alternate_mode_on;          /* nonzero if in alternate char set */
 static int attributes_on;              /* nonzero if any attributes on */
 
-#ifdef NOT_YET
 static void
 turn_on_insert (struct frame *f)
 {
@@ -1065,12 +1058,12 @@ init_tty_for_redisplay (struct device *d, char *terminal_type)
   CONSOLE_TTY_DATA (c)->term_entry_buffer = (char *) xmalloc (2044);
   bufptr = CONSOLE_TTY_DATA (c)->term_entry_buffer;
 
-#if !defined(WIN32)
+#ifdef SIGTTOU
   /* SIGTT* don't exist under win32 */
   EMACS_BLOCK_SIGNAL (SIGTTOU);
 #endif
   status = tgetent (entry_buffer, terminal_type);
-#if !defined(WIN32)
+#ifdef SIGTTOU
   EMACS_UNBLOCK_SIGNAL (SIGTTOU);
 #endif
 #if 0
@@ -1224,6 +1217,7 @@ init_tty_for_redisplay (struct device *d, char *terminal_type)
    */
   cm_cost_init (c);
 
+#ifdef NOT_YET
   /*
    * Initialize local flags.
    */
@@ -1232,6 +1226,7 @@ init_tty_for_redisplay (struct device *d, char *terminal_type)
   underline_mode_on = 0;
   alternate_mode_on = 0;
   attributes_on = 0;
+#endif
 
   /*
    * Attempt to initialize the function_key_map to