/* Terminal control module for terminals described by TERMCAP
- Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1998, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 1985-1987, 1993-1995, 1998, 2000-2011
Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <ctype.h>
#include <errno.h>
#include <sys/file.h>
-
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif
-
#include <signal.h>
#include <stdarg.h>
#include <setjmp.h>
extern int tgetflag (char *id);
extern int tgetnum (char *id);
+char *tparam (char *, char *, int, int, ...);
+
+extern char *tgetstr (char *, char **);
+
#include "cm.h"
#ifdef HAVE_X_WINDOWS
#include "xterm.h"
#define OUTPUT_IF(tty, a) \
do { \
if (a) \
- emacs_tputs ((tty), a, \
- (int) (FRAME_LINES (XFRAME (selected_frame)) \
- - curY (tty) ), \
- cmputc); \
+ OUTPUT (tty, a); \
} while (0)
#define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0)
-/* If true, use "vs", otherwise use "ve" to make the cursor visible. */
-
-static int visible_cursor;
-
/* Display space properties */
-/* Functions to call after suspending a tty. */
-Lisp_Object Vsuspend_tty_functions;
-
-/* Functions to call after resuming a tty. */
-Lisp_Object Vresume_tty_functions;
-
/* Chain of all tty device parameters. */
struct tty_display_info *tty_list;
-/* Nonzero means no need to redraw the entire frame on resuming a
- suspended Emacs. This is useful on terminals with multiple
- pages, where one page is used for Emacs and another for all
- else. */
-int no_redraw_on_reenter;
-
/* Meaning of bits in no_color_video. Each bit set means that the
corresponding attribute cannot be combined with colors. */
should not open a frame on stdout. */
static int no_controlling_tty;
-/* Provided for lisp packages. */
-
-static int system_uses_terminfo;
-
-char *tparam (char *, char *, int, int, ...);
-
-extern char *tgetstr (char *, char **);
\f
#ifdef HAVE_GPM
KBOARD *kboard = term_get_fkeys_kboard;
/* This can happen if CANNOT_DUMP or with strange options. */
- if (!KEYMAPP (kboard->Vinput_decode_map))
- kboard->Vinput_decode_map = Fmake_sparse_keymap (Qnil);
+ if (!KEYMAPP (KVAR (kboard, Vinput_decode_map)))
+ KVAR (kboard, Vinput_decode_map) = Fmake_sparse_keymap (Qnil);
for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
{
char *sequence = tgetstr (keys[i].cap, address);
if (sequence)
- Fdefine_key (kboard->Vinput_decode_map, build_string (sequence),
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence),
Fmake_vector (make_number (1),
intern (keys[i].name)));
}
if (k0)
/* Define f0 first, so that f10 takes precedence in case the
key sequences happens to be the same. */
- Fdefine_key (kboard->Vinput_decode_map, build_string (k0),
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
Fmake_vector (make_number (1), intern ("f0")));
- Fdefine_key (kboard->Vinput_decode_map, build_string (k_semi),
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k_semi),
Fmake_vector (make_number (1), intern ("f10")));
}
else if (k0)
- Fdefine_key (kboard->Vinput_decode_map, build_string (k0),
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
Fmake_vector (make_number (1), intern (k0_name)));
}
if (sequence)
{
sprintf (fkey, "f%d", i);
- Fdefine_key (kboard->Vinput_decode_map, build_string (sequence),
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence),
Fmake_vector (make_number (1),
intern (fkey)));
}
{ \
char *sequence = tgetstr (cap2, address); \
if (sequence) \
- Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), \
+ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), \
Fmake_vector (make_number (1), \
intern (sym))); \
}
/* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID
- is a face ID to be used for the glyph. What actually appended are
- glyphs of type CHAR_GLYPH of which characters are in STR
- (it->nglyphs bytes). */
+ is a face ID to be used for the glyph. What is actually appended
+ are glyphs of type CHAR_GLYPH whose characters are in STR (which
+ comes from it->nglyphs bytes). */
static void
append_glyphless_glyph (struct it *it, int face_id, char *str)
}
}
-/* Declared in xdisp.c */
-extern struct frame *last_glyphless_glyph_frame;
-extern unsigned last_glyphless_glyph_face_id;
-extern int last_glyphless_glyph_merged_face_id;
-extern Lisp_Object Qglyphless_char;
-
/* Produce glyphs for a glyphless character for iterator IT.
IT->glyphless_method specifies which method to use for displaying
the character. See the description of enum
- glyphless_display_method in dispextern.h for the detail.
+ glyphless_display_method in dispextern.h for the details.
FOR_NO_FONT is nonzero if and only if this is for a character that
is not supproted by the coding system of the terminal. ACRONYM, if
produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
{
int face_id;
- int width, len;
+ int len;
char buf[9], *str = " ";
/* Get a face ID for the glyph by utilizing a cache (the same way as
- doen for `escape-glyph' in get_next_display_element). */
+ done for `escape-glyph' in get_next_display_element). */
if (it->f == last_glyphless_glyph_frame
&& it->face_id == last_glyphless_glyph_face_id)
{
if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE)
{
- /* As there's no way to produce a thin space, we produce
- a space of canonical width.. */
+ /* As there's no way to produce a thin space, we produce a space
+ of canonical width. */
len = 1;
}
else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX)
len = CHAR_WIDTH (it->c);
if (len == 0)
len = 1;
- else if (width > 4)
+ else if (len > 4)
len = 4;
+ sprintf (buf, "[%.*s]", len, str);
+ len += 2;
+ str = buf;
}
else
{
if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display))
acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c);
buf[0] = '[';
- str = STRINGP (acronym) ? (char *) SDATA (acronym) : "";
+ str = STRINGP (acronym) ? SSDATA (acronym) : "";
for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++)
buf[1 + len] = str[len];
buf[1 + len] = ']';
}
else
{
- xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEXA_CODE);
- len = (it->c < 0x100 ? sprintf (buf, "U+%02X", it->c)
- : it->c < 0x10000 ? sprintf (buf, "U+%04X", it->c)
- : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "U+%06X", it->c)
- : sprintf (buf, "E+%06X", it->c));
+ xassert (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));
}
str = buf;
}
dissociate_if_controlling_tty (int fd)
{
#ifndef DOS_NT
- int pgid;
- EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */
+ int pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */
if (pgid != -1)
{
#if defined (USG5)
tty->mouse_highlight.mouse_face_window = Qnil;
#endif
-
+
#ifndef DOS_NT
set_tty_hooks (terminal);
terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
init_kboard (terminal->kboard);
- terminal->kboard->Vwindow_system = Qnil;
+ KVAR (terminal->kboard, Vwindow_system) = Qnil;
terminal->kboard->next_kboard = all_kboards;
all_kboards = terminal->kboard;
terminal->kboard->reference_count++;
void
syms_of_term (void)
{
- DEFVAR_BOOL ("system-uses-terminfo", &system_uses_terminfo,
+ DEFVAR_BOOL ("system-uses-terminfo", system_uses_terminfo,
doc: /* Non-nil means the system uses terminfo rather than termcap.
This variable can be used by terminal emulator packages. */);
#ifdef TERMINFO
system_uses_terminfo = 0;
#endif
- DEFVAR_LISP ("suspend-tty-functions", &Vsuspend_tty_functions,
+ DEFVAR_LISP ("suspend-tty-functions", Vsuspend_tty_functions,
doc: /* Functions to be 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,
+ DEFVAR_LISP ("resume-tty-functions", Vresume_tty_functions,
doc: /* Functions to be 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;
- DEFVAR_BOOL ("visible-cursor", &visible_cursor,
+ DEFVAR_BOOL ("visible-cursor", visible_cursor,
doc: /* Non-nil means to make the cursor very visible.
This only has an effect when running in a text terminal.
What means \"very visible\" is up to your terminal. It may make the cursor
encode_terminal_src = NULL;
encode_terminal_dst = NULL;
}
-
-
-
-/* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193
- (do not change this comment) */