all_sources=
noinst_LIBRARIES=
-header_HEADERS=$(acgen_headers)
+header_HEADERS=$(acgen_headers)
libsxeuiTTY_a_headers = \
cm.h console-tty.h objects-tty.h systty.h gpmevent.h
-libsxeuiTTY_a_sources = \
+libsxeuiTTY_a_sources = \
cm.c console-tty.c device-tty.c event-tty.c frame-tty.c \
objects-tty.c redisplay-tty.c
-libsxeuiTTY_a_SOURCES = $(libsxeuiTTY_a_headers) $(libsxeuiTTY_a_sources)
+libsxeuiTTY_a_SOURCES = $(libsxeuiTTY_a_headers) $(libsxeuiTTY_a_sources)
EXTRA_libsxeuiTTY_a_SOURCES= \
gpmevent.c termcap.c terminfo.c tparam.c
libsxeuiTTY_a_CPPFLAGS = $(AM_CPPFLAGS) $(c_switch_general) $(X_CFLAGS)
noinst_LIBRARIES += libsxeuiTTY.a
-#
+#
# Help the SXEmacs developers get nice post-processed source files
## Create preprocessor output (debugging purposes only)
struct {
/* terminal inserts nulls, not
spaces to fill whitespace on
- screen
+ screen
*/
unsigned int must_write_spaces:1;
-
+
/* cursor movement commands
- work while in insert mode
+ work while in insert mode
*/
unsigned int insert_mode_motion:1;
unsigned int memory_above_frame:1;
/* display retained below screen */
- unsigned int memory_below_frame:1;
+ unsigned int memory_below_frame:1;
unsigned int meta_key:2; /* 0 == mask off top bit;
1 == top bit is meta;
2 == top bit is useful as
/* Some flags relating to expanding the colors */
unsigned int is_bold_brighter :1;
unsigned int is_reverse_brighter :1;
- unsigned int nearest_color :1;
+ unsigned int nearest_color :1;
};
#define CONSOLE_TTY_DATA(c) CONSOLE_TYPE_DATA (c, tty)
/* (1) Any pending events in the dispatch queue? */
if (!NILP(dispatch_event_queue))
return 1;
-
+
/* (2) Any TTY or process input available? */
if (poll_fds_for_input (non_fake_input_wait_mask))
return 1;
#if 0
event_stream_drain_queue ();
#endif
-
+
if (!user_p)
return !NILP (dispatch_event_queue);
-
+
EVENT_CHAIN_LOOP (event, dispatch_event_queue)
{
if (command_event_p (event))
static void
emacs_tty_next_event(Lisp_Event * emacs_event)
{
- int ndesc;
- int i;
- SELECT_TYPE temp_mask;
- EMACS_TIME time_to_block;
- EMACS_SELECT_TIME select_time_to_block, *pointer_to_this;
+ int ndesc;
+ int i;
+ SELECT_TYPE temp_mask;
+ EMACS_TIME time_to_block;
+ EMACS_SELECT_TIME select_time_to_block, *pointer_to_this;
- struct console *c;
- Lisp_Process *p;
+ struct console *c;
+ Lisp_Process *p;
- /* Wait for some event */
+ /* Wait for some event */
while (1) {
- temp_mask = input_wait_mask;
+ temp_mask = input_wait_mask;
if (!get_low_level_timeout_interval(tty_timer_queue, &time_to_block))
/* no timer events; block indefinitely */
}
ndesc = select(MAXDESC, &temp_mask, 0, 0, pointer_to_this);
- if (ndesc == 0) {
+ if (ndesc == 0) {
tty_timeout_to_emacs_event(emacs_event);
return;
- } else if (ndesc > 0)
- break;
- }
-
- /* Look for a TTY event */
- for (i = 0; i < MAXDESC; i++) {
- /* To avoid race conditions (among other things, an infinite
- loop when called from Fdiscard_input()), we must return
- user events ahead of process events. */
- if (!FD_ISSET(i, &temp_mask) || !FD_ISSET(i, &tty_only_mask))
- continue;
-
- c = tty_find_console_from_fd(i);
- assert(c);
- if (read_event_from_tty_or_stream_desc(emacs_event, c, i))
- return;
- }
-
- /* Look for a process event */
- for (i = 0; i < MAXDESC; i++) {
- if (!FD_ISSET(i, &temp_mask) || !FD_ISSET(i, &process_only_mask))
- continue;
-
- p = get_process_from_usid(FD_TO_USID(i));
- assert(p);
-
- XSETPROCESS(emacs_event->event.process.process, p);
- emacs_event->event_type = process_event;
- /* process events have nil as channel */
- emacs_event->timestamp = 0; /* #### */
- return;
- }
-
- /* We might get here when a fake event came through a signal. */
- /* Return a dummy event, so that a cycle of the command loop will
- occur. */
- drain_signal_event_pipe();
- emacs_event->event_type = eval_event;
- /* eval events have nil as channel */
- emacs_event->event.eval.function = Qidentity;
- emacs_event->event.eval.object = Qnil;
+ } else if (ndesc > 0)
+ break;
+ }
+
+ /* Look for a TTY event */
+ for (i = 0; i < MAXDESC; i++) {
+ /* To avoid race conditions (among other things, an infinite
+ loop when called from Fdiscard_input()), we must return
+ user events ahead of process events. */
+ if (!FD_ISSET(i, &temp_mask) || !FD_ISSET(i, &tty_only_mask))
+ continue;
+
+ c = tty_find_console_from_fd(i);
+ assert(c);
+ if (read_event_from_tty_or_stream_desc(emacs_event, c, i))
+ return;
+ }
+
+ /* Look for a process event */
+ for (i = 0; i < MAXDESC; i++) {
+ if (!FD_ISSET(i, &temp_mask) || !FD_ISSET(i, &process_only_mask))
+ continue;
+
+ p = get_process_from_usid(FD_TO_USID(i));
+ assert(p);
+
+ XSETPROCESS(emacs_event->event.process.process, p);
+ emacs_event->event_type = process_event;
+ /* process events have nil as channel */
+ emacs_event->timestamp = 0; /* #### */
+ return;
+ }
+
+ /* We might get here when a fake event came through a signal. */
+ /* Return a dummy event, so that a cycle of the command loop will
+ occur. */
+ drain_signal_event_pipe();
+ emacs_event->event_type = eval_event;
+ /* eval events have nil as channel */
+ emacs_event->event.eval.function = Qidentity;
+ emacs_event->event.eval.object = Qnil;
}
static void
/* Add the color alias */
put_skiplist( XSKIPLIST(color_slist),sym_color,idx_tuple);
- put_skiplist( XSKIPLIST(Vterm_color_alias_slist),
+ put_skiplist( XSKIPLIST(Vterm_color_alias_slist),
term, color_slist);
/* Add the index rgb */
put_skiplist( XSKIPLIST(map_slist),rgb_tuple,idx_tuple);
map2_skiplist(XSKIPLIST(slist), tty_slist_key_accum, &rgblist );
result = call2_trapping_errors( "Error_nearest_color",
- Qx_nearest_color,
+ Qx_nearest_color,
sym_color, rgblist );
return result;
}
}
if ( EQ(result,Qnil) ) {
/* If not, let's try the term */
- default_term_slist = color_slist =
+ default_term_slist = color_slist =
get_term_color_alias_slist(
CONSOLE_TTY_DATA(console)->terminal_type,0);
if ( ! EQ(color_slist,Qnil) ) {
* default color, then terminal name, then specific
* tty. This way we get actual override of color defs
* in the more specific definitions.
- */
+ */
/* NOTE: sym_term was filled above... */
default_color_alist = color_alist = get_term_color_map_slist(sym_term,0);
args[0] = color_alist;
- default_term_alist = args[1] =
+ default_term_alist = args[1] =
get_term_color_map_slist(CONSOLE_TTY_DATA(console)->terminal_type,0);
if ( ! EQ(args[1],Qnil) ) {
color_alist = Fnconc(2,args);
cached = 1;
}
}
- if ( ! cached && ! EQ(default_term_alist, Qnil) &&
+ if ( ! cached && ! EQ(default_term_alist, Qnil) &&
! EQ(default_term_slist, Qnil) ) {
result = Fget_skiplist(default_term_alist, nearest_rgb, Qnil);
if ( ! EQ(result, Qnil) ) {
put_skiplist( XSKIPLIST(default_term_slist),sym_color,result);
- put_skiplist( XSKIPLIST(Vterm_color_alias_slist),
- CONSOLE_TTY_DATA(console)->terminal_type,
+ put_skiplist( XSKIPLIST(Vterm_color_alias_slist),
+ CONSOLE_TTY_DATA(console)->terminal_type,
default_term_slist);
cached = 1;
}
}
- if ( ! cached && ! EQ(default_color_alist, Qnil) &&
+ if ( ! cached && ! EQ(default_color_alist, Qnil) &&
! EQ(default_color_slist, Qnil) ) {
result = Fget_skiplist(default_color_alist, nearest_rgb, Qnil);
if ( ! EQ(result, Qnil) ) {
put_skiplist( XSKIPLIST(default_color_slist),sym_color,result);
- put_skiplist( XSKIPLIST(Vterm_color_alias_slist),
+ put_skiplist( XSKIPLIST(Vterm_color_alias_slist),
sym_term, default_color_slist);
cached = 1;
}
}
/* Don't allocate the data until we're sure that we will succeed. */
- c->data = xnew(struct tty_color_instance_data);
+ c->data = xnew(struct tty_color_instance_data);
if ( ! c->data ) {
return 0;
}
-
+
COLOR_INSTANCE_TTY_SYMBOL(c) = sym_color;
return 1;
}
void vars_of_objects_tty(void)
{
DEFVAR_LISP("term-color-alias-slist", &Vterm_color_alias_slist /*
-Term => ( color => '(index bold) )
+Term => ( color => '(index bold) )
*/ );
DEFVAR_LISP("term-color-map-slist", &Vterm_color_map_slist /*
Term => ( [r g b] => '(index bold) )
Vterm_color_alias_slist = Qnil;
Vterm_color_map_slist = Qnil;
}
-
Lisp_Object symbol; /* so we don't have to constantly call Fintern() */
};
-#define TTY_COLOR_INSTANCE_DATA(c) \
+#define TTY_COLOR_INSTANCE_DATA(c) \
((struct tty_color_instance_data *)((c)->data))
#define COLOR_INSTANCE_TTY_SYMBOL(c) (TTY_COLOR_INSTANCE_DATA (c)->symbol)
Lisp_Object charset;
};
-#define TTY_FONT_INSTANCE_DATA(c) \
+#define TTY_FONT_INSTANCE_DATA(c) \
((struct tty_font_instance_data *) (c)->data)
#define FONT_INSTANCE_TTY_CHARSET(c) (TTY_FONT_INSTANCE_DATA (c)->charset)
if (end < 0)
end = Dynarr_length(rba);
- buf = Dynarr_new(Emchar);
+ buf = Dynarr_new(Emchar);
while (elt < end && Dynarr_atp(rba, elt)->xpos < start_pixpos) {
elt++;
{
if ( tty_stream )
Lstream_putc(tty_stream, c);
-}
+}
static void send_tty_escseq(struct console *c, char *escseq)
{
SXE_MUTEX_INIT(&tty_mutex);
tty_mutex_inited = 1;
}
- WITH_SXE_MUTEX(&tty_mutex,
+ WITH_SXE_MUTEX(&tty_mutex,
{
tty_stream = XLSTREAM(CONSOLE_TTY_DATA(c)->outstream);
tputs(escseq,1,(tputs_fun)tty_stream_putc);
if (TTY_SD(c).set_afore_ ) {
/* inevitable warning? */
- escseq = (Bufbyte*)
+ escseq = (Bufbyte*)
emacs_tparam((TTY_SD(c).set_afore_),
NULL, 0,
XINT(idx),
if (TTY_SD(c).set_aback_ ) {
/* inevitable warning */
- escseq = (Bufbyte*)
+ escseq = (Bufbyte*)
emacs_tparam((TTY_SD(c).set_aback_),
NULL, 0,
XINT(idx),
{
if (!CONSOLE_TTY_P(c))
return;
-
+
OUTPUT1_IF(c, (TTY_SD(c).init_motion_));
OUTPUT1_IF(c, (TTY_SD(c).cursor_visible_));
OUTPUT1_IF(c, (TTY_SD(c).keypad_on_));
int init_tty_for_redisplay(struct device *d, char *terminal_type)
{
- int force_colorterm = assume_colorterm ||
+ int force_colorterm = assume_colorterm ||
getenv("COLOR_TERM") != NULL ||
getenv("COLORTERM") != NULL;
/* According to the man page a terminfo/termcap cannot be
longer than 4096 so we should be golden here
*/
- char entry_buffer[4098];
+ char entry_buffer[4098];
char *bufptr;
struct console *c = XCONSOLE(DEVICE_CONSOLE(d));
char *ttype = terminal_type;
#ifdef SIGTTOU
EMACS_UNBLOCK_SIGNAL(SIGTTOU);
#endif
- /* Under Linux at least, <0 is returned for TTY_TYPE_UNDEFINED. --ben
+ /* Under Linux at least, <0 is returned for TTY_TYPE_UNDEFINED. --ben
*/
if (status <= 0) {
if ( ! strcmp( ttype, "xterm-256color" ) ) {
} else if ( ! strcmp( ttype, "xterm" ) ) {
ttype = "vt100";
continue;
- }
+ }
return TTY_TYPE_UNDEFINED;
}
} while( status <= 0 );
*/
term_get_fkeys(c->function_key_map, &bufptr);
-
+
{
/* check for ANSI set-foreground and set-background strings,
and assume color if so.
DEVICE_CLASS(d) = Qcolor;
/* These cases should be rare. Most termcap
* entries will have both colors and pairs
- * defined. However let's play it safe :)
+ * defined. However let's play it safe :)
*/
if ( colors == 0 && pairs > 0 ) {
/* try to determine colors from pairs.
* Most common cases first.
*/
- if ( pairs == 64 )
+ if ( pairs == 64 )
colors = 8;
- else if ( pairs == 256 )
+ else if ( pairs == 256 )
colors = 16;
- else
+ else
/* Naive isqrt algorithm. */
- for( colors=1;
- colors*colors < pairs;
- colors ++ );
+ for( colors=1;
+ colors*colors < pairs;
+ colors ++ );
}
if ( pairs == 0 && colors > 0 )
/* try to determine pairs from colors */
pairs = colors * colors;
CONSOLE_TTY_DATA(c)->maxcolors = colors;
CONSOLE_TTY_DATA(c)->maxpairs = pairs;
-
+
/* Most terminals that report 8 colors will
- make bold brighter */
- CONSOLE_TTY_DATA(c)->is_bold_brighter =
- (colors == 8 && TTY_SD(c).turn_on_bold_ )
- ? 1 : 0;
+ make bold brighter */
+ CONSOLE_TTY_DATA(c)->is_bold_brighter =
+ (colors == 8 && TTY_SD(c).turn_on_bold_ )
+ ? 1 : 0;
/* Most terminals do not have brighter background
colors, however the REAL X11R6 xterm and rxvt do
allow reverse to achieve this. Sadly there
is no way to autodetect. Since the Hue is very
- different on the 8 basic colors and most users
- will hopefully use xterm or rxvt.
+ different on the 8 basic colors and most users
+ will hopefully use xterm or rxvt.
*/
- CONSOLE_TTY_DATA(c)->is_reverse_brighter =
- (colors == 8 && TTY_SD(c).turn_on_reverse_)
- ? 1 : 0;
+ CONSOLE_TTY_DATA(c)->is_reverse_brighter =
+ (colors == 8 && TTY_SD(c).turn_on_reverse_)
+ ? 1 : 0;
}
else if ( force_colorterm ) {
DEVICE_CLASS(d) = Qcolor;
TTY_SD(c).set_afore_ = "\e[3%p1%dm";
CONSOLE_TTY_DATA(c)->maxcolors = 8;
CONSOLE_TTY_DATA(c)->maxpairs = 64;
- CONSOLE_TTY_DATA(c)->is_bold_brighter =
- (TTY_SD(c).turn_on_bold_ ) ? 1 : 0;
- if ( ! TTY_SD(c).orig_pair_ )
+ CONSOLE_TTY_DATA(c)->is_bold_brighter =
+ (TTY_SD(c).turn_on_bold_ ) ? 1 : 0;
+ if ( ! TTY_SD(c).orig_pair_ )
TTY_SD(c).orig_pair_ = "\e[39;49m";
} else {
DEVICE_CLASS(d) = Qmono;
CONSOLE_TTY_DATA(c)->maxcolors = 2;
CONSOLE_TTY_DATA(c)->maxpairs = 4;
- CONSOLE_TTY_DATA(c)->is_bold_brighter = 0;
- CONSOLE_TTY_DATA(c)->is_reverse_brighter = 0;
+ CONSOLE_TTY_DATA(c)->is_bold_brighter = 0;
+ CONSOLE_TTY_DATA(c)->is_reverse_brighter = 0;
}
}
strncpy(outstring, temp, slen);
return outstring;
}
-