Whitespace cleanup in src/ui/TTY
authorSteve Youngs <steve@sxemacs.org>
Sat, 28 Jan 2012 05:45:45 +0000 (15:45 +1000)
committerSteve Youngs <steve@sxemacs.org>
Sat, 28 Jan 2012 05:45:45 +0000 (15:45 +1000)
Signed-off-by: Steve Youngs <steve@sxemacs.org>
src/ui/TTY/Makefile.am
src/ui/TTY/console-tty.h
src/ui/TTY/event-tty.c
src/ui/TTY/objects-tty.c
src/ui/TTY/objects-tty.h
src/ui/TTY/redisplay-tty.c
src/ui/TTY/terminfo.c

index 9db3046..30be50f 100644 (file)
@@ -47,14 +47,14 @@ TAGS_DEPENDENCIES = $(ETAGS)
 
 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)
@@ -64,7 +64,7 @@ all_sources += $(libsxeuiTTY_a_sources) $(libsxeuiTTY_objs:.o=.c)
 
 noinst_LIBRARIES += libsxeuiTTY.a
 
-# 
+#
 # Help the SXEmacs developers get nice post-processed source files
 
 ## Create preprocessor output (debugging purposes only)
index a443037..3b3d57e 100644 (file)
@@ -73,12 +73,12 @@ struct tty_console {
        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;
 
@@ -90,7 +90,7 @@ struct tty_console {
                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
@@ -221,7 +221,7 @@ struct tty_console {
        /* 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)
index 54bb734..26897dc 100644 (file)
@@ -89,7 +89,7 @@ emacs_tty_event_pending_p(int user_p)
                /* (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;
@@ -122,10 +122,10 @@ emacs_tty_event_pending_p(int user_p)
 #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))
@@ -155,18 +155,18 @@ tty_find_console_from_fd(int fd)
 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 */
@@ -177,50 +177,50 @@ emacs_tty_next_event(Lisp_Event * emacs_event)
                }
 
                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
index 026a5d3..edd79ba 100644 (file)
@@ -154,7 +154,7 @@ RED, GREEN and BLUE is expected to be in the range 0 through 65535
 
        /* 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);
@@ -185,7 +185,7 @@ static Lisp_Object nearest_color_slist( Lisp_Object sym_color, Lisp_Object slist
 
        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;
 }
@@ -233,7 +233,7 @@ the nearest available color.
        }
        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) ) {
@@ -264,11 +264,11 @@ the nearest available color.
                 * 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);
@@ -292,23 +292,23 @@ the nearest available color.
                                        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;
                                }
@@ -382,11 +382,11 @@ tty_initialize_color_instance(Lisp_Color_Instance * c, Lisp_Object name,
        }
 
        /* 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;
 }
@@ -583,7 +583,7 @@ void console_type_create_objects_tty(void)
 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) )
@@ -595,4 +595,3 @@ Term => ( [r g b] => '(index bold) )
        Vterm_color_alias_slist = Qnil;
        Vterm_color_map_slist = Qnil;
 }
-
index 4bc7786..31beba6 100644 (file)
@@ -29,7 +29,7 @@ struct tty_color_instance_data {
        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)
@@ -38,7 +38,7 @@ struct tty_font_instance_data {
        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)
index c8c8485..a907ce0 100644 (file)
@@ -238,7 +238,7 @@ tty_output_display_block(struct window *w, struct display_line *dl, int block,
        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++;
@@ -571,7 +571,7 @@ static void tty_stream_putc( int c )
 {
        if ( tty_stream )
                Lstream_putc(tty_stream, c);
-}                      
+}
 
 static void send_tty_escseq(struct console *c, char *escseq)
 {
@@ -579,7 +579,7 @@ 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);
@@ -603,7 +603,7 @@ set_foreground_to(struct console *c, Lisp_Object sym)
 
                if (TTY_SD(c).set_afore_ ) {
                        /* inevitable warning? */
-                       escseq = (Bufbyte*) 
+                       escseq = (Bufbyte*)
                                emacs_tparam((TTY_SD(c).set_afore_),
                                             NULL, 0,
                                             XINT(idx),
@@ -633,7 +633,7 @@ set_background_to(struct console *c, Lisp_Object sym)
 
                if (TTY_SD(c).set_aback_ ) {
                        /* inevitable warning */
-                       escseq = (Bufbyte*) 
+                       escseq = (Bufbyte*)
                                emacs_tparam((TTY_SD(c).set_aback_),
                                             NULL, 0,
                                             XINT(idx),
@@ -830,7 +830,7 @@ void set_tty_modes(struct console *c)
 {
        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_));
@@ -993,7 +993,7 @@ static void tty_ring_bell(struct device *d, int volume, int pitch, int duration)
 
 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;
 
@@ -1001,7 +1001,7 @@ int init_tty_for_redisplay(struct device *d, char *terminal_type)
        /* 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;
@@ -1022,7 +1022,7 @@ int init_tty_for_redisplay(struct device *d, char *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" ) ) {
@@ -1034,7 +1034,7 @@ int init_tty_for_redisplay(struct device *d, char *terminal_type)
                        } else if ( ! strcmp( ttype, "xterm" ) ) {
                                ttype = "vt100";
                                continue;
-                       } 
+                       }
                        return TTY_TYPE_UNDEFINED;
                }
        } while( status <= 0 );
@@ -1203,7 +1203,7 @@ int init_tty_for_redisplay(struct device *d, char *terminal_type)
         */
 
        term_get_fkeys(c->function_key_map, &bufptr);
-       
+
        {
                /* check for ANSI set-foreground and set-background strings,
                   and assume color if so.
@@ -1220,43 +1220,43 @@ int init_tty_for_redisplay(struct device *d, char *terminal_type)
                        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;
@@ -1264,17 +1264,17 @@ int init_tty_for_redisplay(struct device *d, char *terminal_type)
                        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;
                }
        }
 
index db13b47..111f5d7 100644 (file)
@@ -98,4 +98,3 @@ char *emacs_tparam(const char *string, char *outstring, int len, int arg1,
        strncpy(outstring, temp, slen);
        return outstring;
 }
-