/* Terminal control module for terminals described by TERMCAP
- Copyright (C) 1985-1987, 1993-1995, 1998, 2000-2012
- Free Software Foundation, Inc.
+ Copyright (C) 1985-1987, 1993-1995, 1998, 2000-2013 Free Software
+ Foundation, Inc.
This file is part of GNU Emacs.
/* New redisplay, TTY faces by Gerd Moellmann <gerd@gnu.org>. */
#include <config.h>
-#include <stdio.h>
-#include <ctype.h>
#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
#include <sys/file.h>
+#include <sys/time.h>
#include <unistd.h>
-#include <signal.h>
-#include <setjmp.h>
#include "lisp.h"
#include "termchar.h"
-#include "termopts.h"
#include "tparam.h"
-#include "buffer.h"
#include "character.h"
+#include "buffer.h"
#include "charset.h"
#include "coding.h"
#include "composite.h"
#include "xterm.h"
#endif
-#ifndef O_RDWR
-#define O_RDWR 2
-#endif
-
-#ifndef O_NOCTTY
-#define O_NOCTTY 0
-#endif
-
/* The name of the default console device. */
#ifdef WINDOWSNT
#define DEV_TTY "CONOUT$"
+#include "w32term.h"
#else
#define DEV_TTY "/dev/tty"
#endif
static void set_tty_hooks (struct terminal *terminal);
static void dissociate_if_controlling_tty (int fd);
static void delete_tty (struct terminal *);
-static void maybe_fatal (int must_succeed, struct terminal *terminal,
- const char *str1, const char *str2, ...)
- NO_RETURN ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5);
-static void vfatal (const char *str, va_list ap)
- NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0);
+static _Noreturn void maybe_fatal (int must_succeed, struct terminal *terminal,
+ const char *str1, const char *str2, ...)
+ ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5);
+static _Noreturn void vfatal (const char *str, va_list ap)
+ ATTRIBUTE_FORMAT_PRINTF (1, 0);
#define OUTPUT(tty, a) \
NC_STANDOUT = 1 << 0,
NC_UNDERLINE = 1 << 1,
NC_REVERSE = 1 << 2,
- NC_BLINK = 1 << 3,
+ NC_ITALIC = 1 << 3,
NC_DIM = 1 << 4,
NC_BOLD = 1 << 5,
NC_INVIS = 1 << 6,
- NC_PROTECT = 1 << 7,
- NC_ALT_CHARSET = 1 << 8
+ NC_PROTECT = 1 << 7
};
/* internal state */
static int max_frame_cols;
-/* Non-zero if we have dropped our controlling tty and therefore
- should not open a frame on stdout. */
-static int no_controlling_tty;
-
\f
#ifdef HAVE_GPM
conversion_buffer = encode_terminal_code (string, n, coding);
if (coding->produced > 0)
{
- BLOCK_INPUT;
+ block_input ();
fwrite (conversion_buffer, 1, coding->produced, tty->output);
if (ferror (tty->output))
clearerr (tty->output);
if (tty->termscript)
fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
- UNBLOCK_INPUT;
+ unblock_input ();
}
string += n;
conversion_buffer = encode_terminal_code (string, len, coding);
if (coding->produced > 0)
{
- BLOCK_INPUT;
+ block_input ();
fwrite (conversion_buffer, 1, coding->produced, tty->output);
if (ferror (tty->output))
clearerr (tty->output);
if (tty->termscript)
fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
- UNBLOCK_INPUT;
+ unblock_input ();
}
/* Turn appearance modes off. */
if (coding->produced > 0)
{
- BLOCK_INPUT;
+ block_input ();
fwrite (conversion_buffer, 1, coding->produced, tty->output);
if (ferror (tty->output))
clearerr (tty->output);
if (tty->termscript)
fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
- UNBLOCK_INPUT;
+ unblock_input ();
}
OUTPUT1_IF (tty, tty->TS_pad_inserted_char);
const char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
const char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll;
- register int i = n > 0 ? n : -n;
- register char *buf;
+ int i = eabs (n);
+ char *buf;
/* If the lines below the insertion are being pushed
into the end of the window, this is the same as clearing;
/* This can happen if CANNOT_DUMP or with strange options. */
if (!KEYMAPP (KVAR (kboard, Vinput_decode_map)))
- KVAR (kboard, Vinput_decode_map) = Fmake_sparse_keymap (Qnil);
+ kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil));
for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
{
struct glyph *glyph, *end;
int i;
- xassert (it->glyph_row);
+ eassert (it->glyph_row);
glyph = (it->glyph_row->glyphs[it->area]
+ it->glyph_row->used[it->area]);
end = it->glyph_row->glyphs[1 + it->area];
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
- abort ();
+ emacs_abort ();
glyph->bidi_type = it->bidi_it.type;
}
else
/* If a hook is installed, let it do the work. */
/* Nothing but characters are supported on terminal frames. */
- xassert (it->what == IT_CHARACTER
+ eassert (it->what == IT_CHARACTER
|| it->what == IT_COMPOSITION
|| it->what == IT_STRETCH
|| it->what == IT_GLYPHLESS);
{
Lisp_Object acronym = lookup_glyphless_char_display (-1, it);
- xassert (it->what == IT_GLYPHLESS);
+ eassert (it->what == IT_GLYPHLESS);
produce_glyphless_glyph (it, 1, acronym);
}
}
{
struct glyph *glyph;
- xassert (it->glyph_row);
+ eassert (it->glyph_row);
glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
if (glyph < it->glyph_row->glyphs[1 + it->area])
{
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
- abort ();
+ emacs_abort ();
glyph->bidi_type = it->bidi_it.type;
}
else
struct glyph *glyph, *end;
int i;
- xassert (it->glyph_row);
+ eassert (it->glyph_row);
glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
end = it->glyph_row->glyphs[1 + it->area];
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
- abort ();
+ emacs_abort ();
glyph->bidi_type = it->bidi_it.type;
}
else
len = 1;
else if (len > 4)
len = 4;
- sprintf (buf, "[%.*s]", len, str);
- len += 2;
+ len = sprintf (buf, "[%.*s]", len, str);
str = buf;
}
else
}
else
{
- xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE);
+ eassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE);
len = (it->c < 0x10000 ? sprintf (buf, "\\u%04X", it->c)
: it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "\\U%06X", it->c)
: sprintf (buf, "\\x%06X", it->c));
append_glyphless_glyph (it, face_id, str);
}
-
-/* Get information about special display element WHAT in an
- environment described by IT. WHAT is one of IT_TRUNCATION or
- IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a
- non-null glyph_row member. This function ensures that fields like
- face_id, c, len of IT are left untouched. */
-
-void
-produce_special_glyphs (struct it *it, enum display_element_type what)
-{
- struct it temp_it;
- Lisp_Object gc;
- GLYPH glyph;
-
- temp_it = *it;
- temp_it.dp = NULL;
- temp_it.what = IT_CHARACTER;
- temp_it.len = 1;
- temp_it.object = make_number (0);
- memset (&temp_it.current, 0, sizeof temp_it.current);
-
- if (what == IT_CONTINUATION)
- {
- /* Continuation glyph. For R2L lines, we mirror it by hand. */
- if (it->bidi_it.paragraph_dir == R2L)
- SET_GLYPH_FROM_CHAR (glyph, '/');
- else
- SET_GLYPH_FROM_CHAR (glyph, '\\');
- if (it->dp
- && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc)))
- {
- /* FIXME: Should we mirror GC for R2L lines? */
- SET_GLYPH_FROM_GLYPH_CODE (glyph, gc);
- spec_glyph_lookup_face (XWINDOW (it->window), &glyph);
- }
- }
- else if (what == IT_TRUNCATION)
- {
- /* Truncation glyph. */
- SET_GLYPH_FROM_CHAR (glyph, '$');
- if (it->dp
- && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc)))
- {
- /* FIXME: Should we mirror GC for R2L lines? */
- SET_GLYPH_FROM_GLYPH_CODE (glyph, gc);
- spec_glyph_lookup_face (XWINDOW (it->window), &glyph);
- }
- }
- else
- abort ();
-
- temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph);
- temp_it.face_id = GLYPH_FACE (glyph);
- temp_it.len = CHAR_BYTES (temp_it.c);
-
- produce_glyphs (&temp_it);
- it->pixel_width = temp_it.pixel_width;
- it->nglyphs = temp_it.pixel_width;
-}
-
-
\f
/***********************************************************************
Faces
if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD))
OUTPUT1_IF (tty, tty->TS_enter_bold_mode);
- if (face->tty_dim_p && MAY_USE_WITH_COLORS_P (tty, NC_DIM))
- OUTPUT1_IF (tty, tty->TS_enter_dim_mode);
-
- /* Alternate charset and blinking not yet used. */
- if (face->tty_alt_charset_p
- && MAY_USE_WITH_COLORS_P (tty, NC_ALT_CHARSET))
- OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode);
-
- if (face->tty_blinking_p
- && MAY_USE_WITH_COLORS_P (tty, NC_BLINK))
- OUTPUT1_IF (tty, tty->TS_enter_blink_mode);
+ if (face->tty_italic_p && MAY_USE_WITH_COLORS_P (tty, NC_ITALIC))
+ {
+ if (tty->TS_enter_italic_mode)
+ OUTPUT1 (tty, tty->TS_enter_italic_mode);
+ else
+ /* Italics mode is unavailable on many terminals. In that
+ case, map slant to dimmed text; we want italic text to
+ appear different and dimming is not otherwise used. */
+ OUTPUT1 (tty, tty->TS_enter_dim_mode);
+ }
if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
OUTPUT1_IF (tty, tty->TS_enter_underline_mode);
struct face *face = FACE_FROM_ID (f, face_id);
struct tty_display_info *tty = FRAME_TTY (f);
- xassert (face != NULL);
+ eassert (face != NULL);
if (tty->TS_exit_attribute_mode)
{
half-bright, reverse-video, standout, underline. It may or
may not turn off alt-char-mode. */
if (face->tty_bold_p
- || face->tty_dim_p
+ || face->tty_italic_p
|| face->tty_reverse_p
- || face->tty_alt_charset_p
- || face->tty_blinking_p
|| face->tty_underline_p)
{
OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
tty->standout_mode = 0;
}
-
- if (face->tty_alt_charset_p)
- OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
}
else
{
/* If we don't have "me" we can only have those appearances
that have exit sequences defined. */
- if (face->tty_alt_charset_p)
- OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
-
if (face->tty_underline_p)
OUTPUT_IF (tty, tty->TS_exit_underline_mode);
}
TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, tty->TS_enter_underline_mode, NC_UNDERLINE);
TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, tty->TS_enter_bold_mode, NC_BOLD);
TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, tty->TS_enter_dim_mode, NC_DIM);
- TTY_CAPABLE_P_TRY (tty, TTY_CAP_BLINK, tty->TS_enter_blink_mode, NC_BLINK);
- TTY_CAPABLE_P_TRY (tty, TTY_CAP_ALT_CHARSET, tty->TS_enter_alt_charset_mode, NC_ALT_CHARSET);
+ TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC, tty->TS_enter_italic_mode, NC_ITALIC);
/* We can do it! */
return 1;
TERMINAL can be a terminal object, a frame, or nil (meaning the
selected frame's terminal). This function always returns nil if
-TERMINAL does not refer to a text-only terminal. */)
+TERMINAL does not refer to a text terminal. */)
(Lisp_Object terminal)
{
struct terminal *t = get_tty_terminal (terminal, 0);
TERMINAL can be a terminal object, a frame, or nil (meaning the
selected frame's terminal). This function always returns 0 if
-TERMINAL does not refer to a text-only terminal. */)
+TERMINAL does not refer to a text terminal. */)
(Lisp_Object terminal)
{
struct terminal *t = get_tty_terminal (terminal, 0);
if (mode != tty->previous_color_mode)
{
- Lisp_Object funsym = intern ("tty-set-up-initial-frame-faces");
tty->previous_color_mode = mode;
tty_setup_colors (tty , mode);
/* This recomputes all the faces given the new color definitions. */
- safe_call (1, &funsym);
+ safe_call (1, intern ("tty-set-up-initial-frame-faces"));
}
}
struct terminal *t;
if (!name)
- abort ();
+ emacs_abort ();
for (t = terminal_list; t; t = t->next_terminal)
{
TERMINAL can be a terminal object, a frame or nil (meaning the
selected frame's terminal). This function always returns nil if
-TERMINAL does not refer to a text-only terminal. */)
+TERMINAL does not refer to a text terminal. */)
(Lisp_Object terminal)
{
struct terminal *t = get_terminal (terminal, 1);
return Qnil;
}
+DEFUN ("tty-top-frame", Ftty_top_frame, Stty_top_frame, 0, 1, 0,
+ doc: /* Return the topmost terminal frame on TERMINAL.
+TERMINAL can be a terminal object, a frame or nil (meaning the
+selected frame's terminal). This function returns nil if TERMINAL
+does not refer to a text terminal. Otherwise, it returns the
+top-most frame on the text terminal. */)
+ (Lisp_Object terminal)
+{
+ struct terminal *t = get_terminal (terminal, 1);
+
+ if (t->type == output_termcap)
+ return t->display_info.tty->top_frame;
+ return Qnil;
+}
+
\f
DEFUN ("suspend-tty", Fsuspend_tty, Ssuspend_tty, 0, 1, 0,
t->display_info.tty->output = 0;
if (FRAMEP (t->display_info.tty->top_frame))
- FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 0);
+ SET_FRAME_VISIBLE (XFRAME (t->display_info.tty->top_frame), 0);
}
if (fd == -1)
error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno));
- if (strcmp (t->display_info.tty->name, DEV_TTY))
+ if (!O_IGNORE_CTTY && strcmp (t->display_info.tty->name, DEV_TTY) != 0)
dissociate_if_controlling_tty (fd);
t->display_info.tty->output = fdopen (fd, "w+");
get_tty_size (fileno (t->display_info.tty->input), &width, &height);
if (width != old_width || height != old_height)
change_frame_size (f, height, width, 0, 0, 0);
- FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
+ SET_FRAME_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
}
set_tty_hooks (t);
return 0;
}
+/* Return the Time that corresponds to T. Wrap around on overflow. */
+static Time
+timeval_to_Time (struct timeval const *t)
+{
+ Time s_1000, ms;
+
+ s_1000 = t->tv_sec;
+ s_1000 *= 1000;
+ ms = t->tv_usec / 1000;
+ return s_1000 + ms;
+}
+
/* Return the current position of the mouse.
Set *f to the frame the mouse is in, or zero if the mouse is in no
Lisp_Object *y, Time *timeptr)
{
struct timeval now;
- Time sec, usec;
*fp = SELECTED_FRAME ();
(*fp)->mouse_moved = 0;
XSETINT (*x, last_mouse_x);
XSETINT (*y, last_mouse_y);
gettimeofday(&now, 0);
- sec = now.tv_sec;
- usec = now.tv_usec;
- *timeptr = (sec * 1000) + (usec / 1000);
+ *timeptr = timeval_to_Time (&now);
}
/* Prepare a mouse-event in *RESULT for placement in the input queue.
}
}
gettimeofday(&now, 0);
- result->timestamp = (now.tv_sec * 1000) + (now.tv_usec / 1000);
+ result->timestamp = timeval_to_Time (&now);
if (event->type & GPM_UP)
result->modifiers = up_modifier;
void
create_tty_output (struct frame *f)
{
- struct tty_output *t;
+ struct tty_output *t = xzalloc (sizeof *t);
if (! FRAME_TERMCAP_P (f))
- abort ();
-
- t = xmalloc (sizeof (struct tty_output));
- memset (t, 0, sizeof (struct tty_output));
+ emacs_abort ();
t->display_info = FRAME_TERMINAL (f)->display_info.tty;
tty_free_frame_resources (struct frame *f)
{
if (! FRAME_TERMCAP_P (f))
- abort ();
+ emacs_abort ();
if (FRAME_FACE_CACHE (f))
free_frame_faces (f);
tty_free_frame_resources (struct frame *f)
{
if (! FRAME_TERMCAP_P (f) && ! FRAME_MSDOS_P (f))
- abort ();
+ emacs_abort ();
if (FRAME_FACE_CACHE (f))
free_frame_faces (f);
terminal->delete_terminal_hook = &delete_tty;
}
-/* Drop the controlling terminal if fd is the same device. */
+/* If FD is the controlling terminal, drop it. */
static void
dissociate_if_controlling_tty (int fd)
{
-#ifndef DOS_NT
- int pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */
- if (pgid != -1)
- {
-#if defined (USG5)
- setpgrp ();
- no_controlling_tty = 1;
-#elif defined (CYGWIN)
- setsid ();
- no_controlling_tty = 1;
-#else
-#ifdef TIOCNOTTY /* Try BSD ioctls. */
- sigblock (sigmask (SIGTTOU));
- fd = emacs_open (DEV_TTY, O_RDWR, 0);
- if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1)
- {
- no_controlling_tty = 1;
- }
- if (fd != -1)
- emacs_close (fd);
- sigunblock (sigmask (SIGTTOU));
-#else
- /* Unknown system. */
- croak ();
-#endif /* ! TIOCNOTTY */
-#endif /* ! USG */
+ /* If tcgetpgrp succeeds, fd is the controlling terminal,
+ so dissociate it by invoking setsid. */
+ if (0 <= tcgetpgrp (fd) && setsid () < 0)
+ {
+#ifdef TIOCNOTTY
+ /* setsid failed, presumably because Emacs is already a process
+ group leader. Fall back on the obsolescent way to dissociate
+ a controlling tty. */
+ block_tty_out_signal ();
+ ioctl (fd, TIOCNOTTY, 0);
+ unblock_tty_out_signal ();
+#endif
}
-#endif /* !DOS_NT */
}
/* Create a termcap display on the tty device with the given name and
been_here = 1;
tty = &the_only_display_info;
#else
- tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
+ tty = xzalloc (sizeof *tty);
#endif
- memset (tty, 0, sizeof (struct tty_display_info));
+ tty->top_frame = Qnil;
tty->next = tty_list;
tty_list = tty;
terminal->display_info.tty = tty;
tty->terminal = terminal;
- tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
+ tty->Wcm = xmalloc (sizeof *tty->Wcm);
Wcm_clear (tty);
encode_terminal_src_size = 0;
set_tty_hooks (terminal);
{
- int fd;
+ /* Open the terminal device. */
FILE *file;
-#ifdef O_IGNORE_CTTY
- if (!ctty)
- /* Open the terminal device. Don't recognize it as our
- controlling terminal, and don't make it the controlling tty
- if we don't have one at the moment. */
- fd = emacs_open (name, O_RDWR | O_IGNORE_CTTY | O_NOCTTY, 0);
- else
-#endif /* O_IGNORE_CTTY */
- /* Alas, O_IGNORE_CTTY is a GNU extension that seems to be only
- defined on Hurd. On other systems, we need to explicitly
- dissociate ourselves from the controlling tty when we want to
- open a frame on the same terminal. */
- fd = emacs_open (name, O_RDWR | O_NOCTTY, 0);
+ /* If !ctty, don't recognize it as our controlling terminal, and
+ don't make it the controlling tty if we don't have one now.
+
+ Alas, O_IGNORE_CTTY is a GNU extension that seems to be only
+ defined on Hurd. On other systems, we need to explicitly
+ dissociate ourselves from the controlling tty when we want to
+ open a frame on the same terminal. */
+ int flags = O_RDWR | O_NOCTTY | (ctty ? 0 : O_IGNORE_CTTY);
+ int fd = emacs_open (name, flags, 0);
tty->name = xstrdup (name);
terminal->name = xstrdup (name);
name);
}
-#ifndef O_IGNORE_CTTY
- if (!ctty)
+ if (!O_IGNORE_CTTY && !ctty)
dissociate_if_controlling_tty (fd);
-#endif
file = fdopen (fd, "w+");
tty->input = file;
Wcm_clear (tty);
- tty->termcap_term_buffer = (char *) xmalloc (buffer_size);
+ tty->termcap_term_buffer = xmalloc (buffer_size);
/* On some systems, tgetent tries to access the controlling
terminal. */
- sigblock (sigmask (SIGTTOU));
+ block_tty_out_signal ();
status = tgetent (tty->termcap_term_buffer, terminal_type);
- sigunblock (sigmask (SIGTTOU));
+ unblock_tty_out_signal ();
if (status < 0)
{
#ifndef TERMINFO
if (strlen (tty->termcap_term_buffer) >= buffer_size)
- abort ();
+ emacs_abort ();
buffer_size = strlen (tty->termcap_term_buffer);
#endif
- tty->termcap_strings_buffer = area = (char *) xmalloc (buffer_size);
+ 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);
tty->TS_enter_underline_mode = tgetstr ("us", address);
tty->TS_exit_underline_mode = tgetstr ("ue", address);
tty->TS_enter_bold_mode = tgetstr ("md", address);
+ tty->TS_enter_italic_mode = tgetstr ("ZH", address);
tty->TS_enter_dim_mode = tgetstr ("mh", address);
- tty->TS_enter_blink_mode = tgetstr ("mb", address);
tty->TS_enter_reverse_mode = tgetstr ("mr", address);
tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);
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;
tty->mouse_highlight.mouse_face_window = Qnil;
#endif
- terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
+ terminal->kboard = xmalloc (sizeof *terminal->kboard);
init_kboard (terminal->kboard);
- KVAR (terminal->kboard, Vwindow_system) = Qnil;
+ kset_window_system (terminal->kboard, Qnil);
terminal->kboard->next_kboard = all_kboards;
all_kboards = terminal->kboard;
terminal->kboard->reference_count++;
= tty->TS_delete_mode && tty->TS_insert_mode
&& !strcmp (tty->TS_delete_mode, tty->TS_insert_mode);
- tty->se_is_so = (tty->TS_standout_mode
- && tty->TS_end_standout_mode
- && !strcmp (tty->TS_standout_mode, tty->TS_end_standout_mode));
-
UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8;
terminal->scroll_region_ok
verror (str1, ap);
va_end (ap);
- abort ();
+ emacs_abort ();
}
void
return;
if (terminal->type != output_termcap)
- abort ();
+ emacs_abort ();
tty = terminal->display_info.tty;
if (! p)
/* This should not happen. */
- abort ();
+ emacs_abort ();
p->next = tty->next;
tty->next = 0;
xfree (tty->termcap_strings_buffer);
xfree (tty->termcap_term_buffer);
- memset (tty, 0, sizeof (struct tty_display_info));
xfree (tty);
}
-\f
-
-/* Mark the pointers in the tty_display_info objects.
- Called by Fgarbage_collect. */
-
-void
-mark_ttys (void)
-{
- struct tty_display_info *tty;
-
- for (tty = tty_list; tty; tty = tty->next)
- mark_object (tty->top_frame);
-}
-
-\f
-
void
syms_of_term (void)
{
#endif
DEFVAR_LISP ("suspend-tty-functions", Vsuspend_tty_functions,
- doc: /* Functions to be run after suspending a tty.
+ doc: /* Functions run after suspending a tty.
The functions are run with one argument, the terminal object to be suspended.
See `suspend-tty'. */);
Vsuspend_tty_functions = Qnil;
DEFVAR_LISP ("resume-tty-functions", Vresume_tty_functions,
- doc: /* Functions to be run after resuming a tty.
+ doc: /* Functions run after resuming a tty.
The functions are run with one argument, the terminal object that was revived.
See `resume-tty'. */);
Vresume_tty_functions = Qnil;
defsubr (&Stty_no_underline);
defsubr (&Stty_type);
defsubr (&Scontrolling_tty_p);
+ defsubr (&Stty_top_frame);
defsubr (&Ssuspend_tty);
defsubr (&Sresume_tty);
#ifdef HAVE_GPM