Author: witekfl Date: Sun Mar 29 14:07:55 2009 GMT Module: SOURCES Tag: HEAD ---- Log message: - support for fbterm
---- Files affected: SOURCES: elinks-fbterm.patch (NONE -> 1.1) (NEW) ---- Diffs: ================================================================ Index: SOURCES/elinks-fbterm.patch diff -u /dev/null SOURCES/elinks-fbterm.patch:1.1 --- /dev/null Sun Mar 29 16:07:57 2009 +++ SOURCES/elinks-fbterm.patch Sun Mar 29 16:07:50 2009 @@ -0,0 +1,223 @@ +commit e23a8ec12164af00922751aea0dfa285d3e240b4 +Author: Witold Filipczyk <wite...@poczta.onet.pl> +Date: Fri Mar 27 19:44:46 2009 +0100 + + Support for fbterm. + + fbterm uses different 256 color sequences than xterm. + color256_seqs are part of the driver info. + +diff --git a/src/config/options.c b/src/config/options.c +index 14ab8db..00c9a25 100644 +--- a/src/config/options.c ++++ b/src/config/options.c +@@ -703,6 +703,9 @@ register_autocreated_options(void) + get_opt_int("terminal.xterm-256color.type") = 1; + get_opt_int("terminal.xterm-256color.colors") = COLOR_MODE_256; + get_opt_bool("terminal.xterm-256color.underline") = 1; ++ get_opt_int("terminal.fbterm.type") = 5; ++ get_opt_int("terminal.fbterm.colors") = COLOR_MODE_256; ++ get_opt_bool("terminal.fbterm.underline") = 1; + #endif + } + +diff --git a/src/config/options.inc b/src/config/options.inc +index b9c6a7f..c4e4a9b 100644 +--- a/src/config/options.inc ++++ b/src/config/options.inc +@@ -879,20 +879,22 @@ static struct option_info config_options_info[] = { + * 4 (TERM_FREEBSD) outputs characters in the 0x80...0x9F + * range, which FreeBSD 4.0 (but not 5.0) treated as + * graphical. ++ * 5 (TERM_FBTERM) + * + * When UTF-8 I/O is enabled, ELinks outputs (almost) the same + * characters as above but encodes them in UTF-8 and does not + * switch charsets. So, it will work in any terminal that + * understands UTF-8 and has the characters in its font. */ + INIT_OPT_INT("terminal._template_", N_("Type"), +- "type", 0, 0, 4, 0, ++ "type", 0, 0, 5, 0, + N_("Terminal type; matters mostly only when drawing frames " + "and dialog box borders:\n" + "0 is dumb terminal type, ASCII art\n" + "1 is VT100, simple but portable\n" + "2 is Linux, you get double frames and other goodies\n" + "3 is KOI-8\n" +- "4 is FreeBSD")), ++ "4 is FreeBSD\n" ++ "5 is fbterm")), + + INIT_OPT_BOOL("terminal._template_", N_("Always encode xterm title in ISO-8859-1"), + "latin1_title", 0, 1, +diff --git a/src/terminal/screen.c b/src/terminal/screen.c +index 8f838a6..bb3cbb1 100644 +--- a/src/terminal/screen.c ++++ b/src/terminal/screen.c +@@ -189,6 +189,19 @@ static const struct string underline_seqs[] = { + * + * @todo TODO: termcap/terminfo can maybe gradually be introduced via + * this structure. We'll see. --jonas */ ++ ++#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) ++static const struct string color256_seqs[] = { ++ /* foreground: */ TERM_STRING("\033[0;38;5;%dm"), ++ /* background: */ TERM_STRING("\033[48;5;%dm"), ++}; ++ ++static const struct string fbterm_color256_seqs[] = { ++ /* foreground: */ TERM_STRING("\033[m\033[1;%d}"), ++ /* background: */ TERM_STRING("\033[2;%d}"), ++}; ++#endif ++ + struct screen_driver { + LIST_HEAD(struct screen_driver); + +@@ -215,6 +228,9 @@ struct screen_driver { + /** The color mode */ + enum color_mode color_mode; + ++#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) ++ const struct string *color256_seqs; ++#endif + /** These are directly derived from the terminal options. */ + unsigned int transparent:1; + +@@ -237,6 +253,9 @@ static const struct screen_driver_opt dumb_screen_driver_opt = { + /* frame_seqs: */ NULL, + /* underline: */ underline_seqs, + /* color_mode: */ COLOR_MODE_16, ++#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) ++ /* 256 colors: */ color256_seqs, ++#endif + /* transparent: */ 1, + #ifdef CONFIG_UTF8 + /* utf8_cp: */ 0, +@@ -250,6 +269,9 @@ static const struct screen_driver_opt vt100_screen_driver_opt = { + /* frame_seqs: */ vt100_frame_seqs, + /* underline: */ underline_seqs, + /* color_mode: */ COLOR_MODE_16, ++#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) ++ /* 256 colors: */ color256_seqs, ++#endif + /* transparent: */ 1, + #ifdef CONFIG_UTF8 + /* utf8_cp: */ 0, +@@ -263,6 +285,9 @@ static const struct screen_driver_opt linux_screen_driver_opt = { + /* frame_seqs: */ NULL, /* No m11_hack */ + /* underline: */ underline_seqs, + /* color_mode: */ COLOR_MODE_16, ++#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) ++ /* 256 colors: */ color256_seqs, ++#endif + /* transparent: */ 1, + #ifdef CONFIG_UTF8 + /* utf8_cp: */ 0, +@@ -276,6 +301,9 @@ static const struct screen_driver_opt koi8_screen_driver_opt = { + /* frame_seqs: */ NULL, + /* underline: */ underline_seqs, + /* color_mode: */ COLOR_MODE_16, ++#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) ++ /* 256 colors: */ color256_seqs, ++#endif + /* transparent: */ 1, + #ifdef CONFIG_UTF8 + /* utf8_cp: */ 0, +@@ -289,12 +317,35 @@ static const struct screen_driver_opt freebsd_screen_driver_opt = { + /* frame_seqs: */ NULL, /* No m11_hack */ + /* underline: */ underline_seqs, + /* color_mode: */ COLOR_MODE_16, ++#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) ++ /* 256 colors: */ color256_seqs, ++#endif + /* transparent: */ 1, + #ifdef CONFIG_UTF8 + /* utf8_cp: */ 0, + #endif /* CONFIG_UTF8 */ ++#ifdef CONFIG_COMBINE ++ /* combine */ 0, ++#endif /* CONFIG_COMBINE */ + }; + ++/** Default options for ::TERM_LINUX. */ ++static const struct screen_driver_opt fbterm_screen_driver_opt = { ++ /* charsets: */ { -1, -1 }, /* No UTF8 I/O */ ++ /* frame: */ NULL, ++ /* frame_seqs: */ NULL, /* No m11_hack */ ++ /* underline: */ underline_seqs, ++ /* color_mode: */ COLOR_MODE_16, ++#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) ++ /* 256 colors: */ fbterm_color256_seqs, ++#endif ++ /* transparent: */ 1, ++#ifdef CONFIG_UTF8 ++ /* utf8_cp: */ 0, ++#endif /* CONFIG_UTF8 */ ++}; ++ ++ + /** Default options for all the different types of terminals. + * XXX: Keep in sync with enum term_mode_type. */ + static const struct screen_driver_opt *const screen_driver_opts[] = { +@@ -303,6 +354,7 @@ static const struct screen_driver_opt *const screen_driver_opts[] = { + /* TERM_LINUX: */ &linux_screen_driver_opt, + /* TERM_KOI8: */ &koi8_screen_driver_opt, + /* TERM_FREEBSD: */ &freebsd_screen_driver_opt, ++ /* TERM_FBTERM: */ &fbterm_screen_driver_opt, + }; + + #define use_utf8_io(driver) ((driver)->opt.charsets[0] != -1) +@@ -353,7 +405,7 @@ set_screen_driver_opt(struct screen_driver *driver, struct option *term_spec) + * characters encoded in UTF-8 are already unambiguous. */ + driver->opt.frame_seqs = NULL; + +- if (driver->type == TERM_LINUX) { ++ if (driver->type == TERM_LINUX || driver->type == TERM_FBTERM) { + if (get_opt_bool_tree(term_spec, "restrict_852")) + driver->opt.frame = frame_restrict; + driver->opt.charsets[1] = get_cp_index("cp437"); +@@ -754,11 +806,6 @@ add_char16(struct string *screen, struct screen_driver *driver, + add_char_data(screen, driver, ch->data, border); + } + +-#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) +-static const struct string color256_seqs[] = { +- /* foreground: */ TERM_STRING("\033[0;38;5;%dm"), +- /* background: */ TERM_STRING("\033[48;5;%dm"), +-}; + + static inline void + add_char_color(struct string *screen, const struct string *seq, unsigned char color) +@@ -810,6 +857,7 @@ add_char_color(struct string *screen, const struct string *seq, unsigned char co + #define add_background_color(str, seq, chr) add_char_color(str, &(seq)[1], (chr)->color[1]) + #define add_foreground_color(str, seq, chr) add_char_color(str, &(seq)[0], (chr)->color[0]) + ++#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) + /** Time critical section. */ + static inline void + add_char256(struct string *screen, struct screen_driver *driver, +@@ -853,9 +901,9 @@ add_char256(struct string *screen, struct screen_driver *driver, + ) { + copy_color_256(state->color, ch->color); + +- add_foreground_color(screen, color256_seqs, ch); ++ add_foreground_color(screen, driver->opt.color256_seqs, ch); + if (!driver->opt.transparent || ch->color[1] != 0) { +- add_background_color(screen, color256_seqs, ch); ++ add_background_color(screen, driver->opt.color256_seqs, ch); + } + + if (ch->attr & SCREEN_ATTR_BOLD) +diff --git a/src/terminal/terminal.h b/src/terminal/terminal.h +index c2c1d79..1db36d0 100644 +--- a/src/terminal/terminal.h ++++ b/src/terminal/terminal.h +@@ -18,6 +18,7 @@ enum term_mode_type { + TERM_LINUX, + TERM_KOI8, + TERM_FREEBSD, ++ TERM_FBTERM, + }; + + /** This is a bitmask describing the environment we are living in, ================================================================ _______________________________________________ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit