static void
produce_glyphless_glyph (struct it *it, Lisp_Object acronym)
{
- int face_id;
- int len;
+ int len, face_id = merge_glyphless_glyph_face (it);
char buf[sizeof "\\x" + max (6, (sizeof it->c * CHAR_BIT + 3) / 4)];
char const *str = " ";
- /* Get a face ID for the glyph by utilizing a cache (the same way as
- done for `escape-glyph' in get_next_display_element). */
- if (it->f == last_glyphless_glyph_frame
- && it->face_id == last_glyphless_glyph_face_id)
- {
- face_id = last_glyphless_glyph_merged_face_id;
- }
- else
- {
- /* Merge the `glyphless-char' face into the current face. */
- face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id);
- last_glyphless_glyph_frame = it->f;
- last_glyphless_glyph_face_id = it->face_id;
- last_glyphless_glyph_merged_face_id = face_id;
- }
-
if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE)
{
/* As there's no way to produce a thin space, we produce a space
{
struct terminal *t;
- if (!name)
- emacs_abort ();
+ eassert (name);
for (t = terminal_list; t; t = t->next_terminal)
{
}
static bool
-term_mouse_movement (FRAME_PTR frame, Gpm_Event *event)
+term_mouse_movement (struct frame *frame, Gpm_Event *event)
{
/* Has the mouse moved off the glyph it was on at the last sighting? */
if (event->x != last_mouse_x || event->y != last_mouse_y)
This clears mouse_moved until the next motion
event arrives. */
static void
-term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
+term_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
enum scroll_bar_part *part, Lisp_Object *x,
Lisp_Object *y, Time *timeptr)
{
{
struct tty_output *t = xzalloc (sizeof *t);
- if (! FRAME_TERMCAP_P (f))
- emacs_abort ();
+ eassert (FRAME_TERMCAP_P (f));
t->display_info = FRAME_TERMINAL (f)->display_info.tty;
static void
tty_free_frame_resources (struct frame *f)
{
- if (! FRAME_TERMCAP_P (f))
- emacs_abort ();
+ eassert (FRAME_TERMCAP_P (f));
if (FRAME_FACE_CACHE (f))
free_frame_faces (f);
static void
tty_free_frame_resources (struct frame *f)
{
- if (! FRAME_TERMCAP_P (f) && ! FRAME_MSDOS_P (f))
- emacs_abort ();
+ eassert (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f));
if (FRAME_FACE_CACHE (f))
free_frame_faces (f);
TERMINAL_TYPE is the termcap type of the device, e.g. "vt100".
- If MUST_SUCCEED is true, then all errors are fatal. */
+ If MUST_SUCCEED is true, then all errors are fatal. */
struct terminal *
init_tty (const char *name, const char *terminal_type, bool must_succeed)
{
- char *area = NULL;
+#ifdef TERMINFO
+ char **address = 0;
+#else
+ char *area;
char **address = &area;
- int buffer_size = 4096;
+#endif
int status;
struct tty_display_info *tty = NULL;
struct terminal *terminal = NULL;
- bool ctty = 0; /* True if asked to open controlling tty. */
+ bool ctty = false; /* True if asked to open controlling tty. */
if (!terminal_type)
maybe_fatal (must_succeed, 0,
Wcm_clear (tty);
- tty->termcap_term_buffer = xmalloc (buffer_size);
-
/* On some systems, tgetent tries to access the controlling
- terminal. */
+ terminal. */
block_tty_out_signal ();
+#ifdef TERMINFO
+ status = tgetent (0, terminal_type);
+#else
status = tgetent (tty->termcap_term_buffer, terminal_type);
+ if (tty->termcap_term_buffer[TERMCAP_BUFFER_SIZE - 1])
+ emacs_abort ();
+#endif
unblock_tty_out_signal ();
if (status < 0)
}
#ifndef TERMINFO
- if (strlen (tty->termcap_term_buffer) >= buffer_size)
- emacs_abort ();
- buffer_size = strlen (tty->termcap_term_buffer);
+ area = tty->termcap_strings_buffer;
#endif
- tty->termcap_strings_buffer = area = xmalloc (buffer_size);
tty->TS_ins_line = tgetstr ("al", address);
tty->TS_ins_multi_lines = tgetstr ("AL", address);
tty->TS_bell = tgetstr ("bl", address);
Right (tty) = tgetstr ("nd", address);
Down (tty) = tgetstr ("do", address);
if (!Down (tty))
- Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */
+ Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do". */
if (tgetflag ("bs"))
- Left (tty) = "\b"; /* can't possibly be longer! */
- else /* (Actually, "bs" is obsolete...) */
+ Left (tty) = "\b"; /* Can't possibly be longer! */
+ else /* (Actually, "bs" is obsolete...) */
Left (tty) = tgetstr ("le", address);
if (!Left (tty))
- Left (tty) = tgetstr ("bc", address); /* Obsolete name for "le" */
+ Left (tty) = tgetstr ("bc", address); /* Obsolete name for "le". */
tty->TS_pad_char = tgetstr ("pc", address);
tty->TS_repeat = tgetstr ("rp", address);
tty->TS_end_standout_mode = tgetstr ("se", address);
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 */
+ tty->TN_max_colors = 16; /* Must be non-zero for tty-display-color-p. */
#endif /* DOS_NT */
#ifdef HAVE_GPM
tty->Wcm->cm_tab = 0;
/* We can't support standout mode, because it uses magic cookies. */
tty->TS_standout_mode = 0;
- /* But that means we cannot rely on ^M to go to column zero! */
+ /* But that means we cannot rely on ^M to go to column zero! */
CR (tty) = 0;
- /* LF can't be trusted either -- can alter hpos */
- /* if move at column 0 thru a line with TS_standout_mode */
+ /* LF can't be trusted either -- can alter hpos. */
+ /* If move at column 0 thru a line with TS_standout_mode. */
Down (tty) = 0;
}
tty->specified_window = FrameRows (tty);
- if (Wcm_init (tty) == -1) /* can't do cursor motion */
+ if (Wcm_init (tty) == -1) /* Can't do cursor motion. */
{
maybe_fatal (must_succeed, terminal,
"Terminal type \"%s\" is not powerful enough to run Emacs",
if (!terminal->name)
return;
- if (terminal->type != output_termcap)
- emacs_abort ();
+ eassert (terminal->type == output_termcap);
tty = terminal->display_info.tty;
xfree (tty->old_tty);
xfree (tty->Wcm);
- xfree (tty->termcap_strings_buffer);
- xfree (tty->termcap_term_buffer);
-
xfree (tty);
}