summaryrefslogtreecommitdiff
path: root/com32
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-29 15:10:27 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-29 15:10:27 -0700
commit9dbbd361ce735e7d647bc438849eb05fe4728894 (patch)
treea14474890240c0d096b98ca558eb9164e48b8e82 /com32
parent07b6156bbc3cc7da8bdc027a6adfbae8e4cdd3b8 (diff)
downloadsyslinux-9dbbd361ce735e7d647bc438849eb05fe4728894.tar.gz
Run Nindent on com32/menu/colors.c
Automatically reformat com32/menu/colors.c using Nindent. Do this for all files except HDT, gPXE and externally maintained libraries (zlib, tinyjpeg, libpng). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32')
-rw-r--r--com32/menu/colors.c227
1 files changed, 114 insertions, 113 deletions
diff --git a/com32/menu/colors.c b/com32/menu/colors.c
index cfd91f1d..68732bdb 100644
--- a/com32/menu/colors.c
+++ b/com32/menu/colors.c
@@ -40,144 +40,145 @@
*/
static const struct color_table default_colors[] = {
- { "screen", "37;40", 0x80ffffff, 0x00000000, SHADOW_NORMAL },
- { "border", "30;44", 0x40000000, 0x00000000, SHADOW_NORMAL },
- { "title", "1;36;44", 0xc00090f0, 0x00000000, SHADOW_NORMAL },
- { "unsel", "37;44", 0x90ffffff, 0x00000000, SHADOW_NORMAL },
- { "hotkey", "1;37;44", 0xffffffff, 0x00000000, SHADOW_NORMAL },
- { "sel", "7;37;40", 0xe0000000, 0x20ff8000, SHADOW_ALL },
- { "hotsel", "1;7;37;40", 0xe0400000, 0x20ff8000, SHADOW_ALL },
- { "scrollbar", "30;44", 0x40000000, 0x00000000, SHADOW_NORMAL },
- { "tabmsg", "31;40", 0x90ffff00, 0x00000000, SHADOW_NORMAL },
- { "cmdmark", "1;36;40", 0xc000ffff, 0x00000000, SHADOW_NORMAL },
- { "cmdline", "37;40", 0xc0ffffff, 0x00000000, SHADOW_NORMAL },
- { "pwdborder", "30;47", 0x80ffffff, 0x20ffffff, SHADOW_NORMAL },
- { "pwdheader", "31;47", 0x80ff8080, 0x20ffffff, SHADOW_NORMAL },
- { "pwdentry", "30;47", 0x80ffffff, 0x20ffffff, SHADOW_NORMAL },
- { "timeout_msg", "37;40", 0x80ffffff, 0x00000000, SHADOW_NORMAL },
- { "timeout", "1;37;40", 0xc0ffffff, 0x00000000, SHADOW_NORMAL },
- { "help", "37;40", 0xc0ffffff, 0x00000000, SHADOW_NORMAL },
- { "disabled", "1;30;44", 0x60cccccc, 0x00000000, SHADOW_NORMAL },
+ {"screen", "37;40", 0x80ffffff, 0x00000000, SHADOW_NORMAL},
+ {"border", "30;44", 0x40000000, 0x00000000, SHADOW_NORMAL},
+ {"title", "1;36;44", 0xc00090f0, 0x00000000, SHADOW_NORMAL},
+ {"unsel", "37;44", 0x90ffffff, 0x00000000, SHADOW_NORMAL},
+ {"hotkey", "1;37;44", 0xffffffff, 0x00000000, SHADOW_NORMAL},
+ {"sel", "7;37;40", 0xe0000000, 0x20ff8000, SHADOW_ALL},
+ {"hotsel", "1;7;37;40", 0xe0400000, 0x20ff8000, SHADOW_ALL},
+ {"scrollbar", "30;44", 0x40000000, 0x00000000, SHADOW_NORMAL},
+ {"tabmsg", "31;40", 0x90ffff00, 0x00000000, SHADOW_NORMAL},
+ {"cmdmark", "1;36;40", 0xc000ffff, 0x00000000, SHADOW_NORMAL},
+ {"cmdline", "37;40", 0xc0ffffff, 0x00000000, SHADOW_NORMAL},
+ {"pwdborder", "30;47", 0x80ffffff, 0x20ffffff, SHADOW_NORMAL},
+ {"pwdheader", "31;47", 0x80ff8080, 0x20ffffff, SHADOW_NORMAL},
+ {"pwdentry", "30;47", 0x80ffffff, 0x20ffffff, SHADOW_NORMAL},
+ {"timeout_msg", "37;40", 0x80ffffff, 0x00000000, SHADOW_NORMAL},
+ {"timeout", "1;37;40", 0xc0ffffff, 0x00000000, SHADOW_NORMAL},
+ {"help", "37;40", 0xc0ffffff, 0x00000000, SHADOW_NORMAL},
+ {"disabled", "1;30;44", 0x60cccccc, 0x00000000, SHADOW_NORMAL},
};
#define NCOLORS (sizeof default_colors/sizeof default_colors[0])
const int message_base_color = NCOLORS;
-const int menu_color_table_size = NCOLORS+256;
+const int menu_color_table_size = NCOLORS + 256;
/* Algorithmically generate the msgXX colors */
void set_msg_colors_global(struct color_table *tbl,
unsigned int fg, unsigned int bg,
enum color_table_shadow shadow)
{
- struct color_table *cp = tbl+message_base_color;
- unsigned int i;
- unsigned int fga, bga;
- unsigned int fgh, bgh;
- unsigned int fg_idx, bg_idx;
- unsigned int fg_rgb, bg_rgb;
-
- static const unsigned int pc2rgb[8] =
- { 0x000000, 0x0000ff, 0x00ff00, 0x00ffff, 0xff0000, 0xff00ff, 0xffff00,
- 0xffffff };
-
- /* Converting PC RGBI to sensible RGBA values is an "interesting"
- proposition. This algorithm may need plenty of tweaking. */
-
- fga = fg & 0xff000000;
- fgh = ((fg >> 1) & 0xff000000) | 0x80000000;
-
- bga = bg & 0xff000000;
- bgh = ((bg >> 1) & 0xff000000) | 0x80000000;
-
- for (i = 0; i < 256; i++) {
- fg_idx = i & 15;
- bg_idx = i >> 4;
-
- fg_rgb = pc2rgb[fg_idx & 7] & fg;
- bg_rgb = pc2rgb[bg_idx & 7] & bg;
-
- if (fg_idx & 8) {
- /* High intensity foreground */
- fg_rgb |= fgh;
- } else {
- fg_rgb |= fga;
+ struct color_table *cp = tbl + message_base_color;
+ unsigned int i;
+ unsigned int fga, bga;
+ unsigned int fgh, bgh;
+ unsigned int fg_idx, bg_idx;
+ unsigned int fg_rgb, bg_rgb;
+
+ static const unsigned int pc2rgb[8] =
+ { 0x000000, 0x0000ff, 0x00ff00, 0x00ffff, 0xff0000, 0xff00ff, 0xffff00,
+ 0xffffff
+ };
+
+ /* Converting PC RGBI to sensible RGBA values is an "interesting"
+ proposition. This algorithm may need plenty of tweaking. */
+
+ fga = fg & 0xff000000;
+ fgh = ((fg >> 1) & 0xff000000) | 0x80000000;
+
+ bga = bg & 0xff000000;
+ bgh = ((bg >> 1) & 0xff000000) | 0x80000000;
+
+ for (i = 0; i < 256; i++) {
+ fg_idx = i & 15;
+ bg_idx = i >> 4;
+
+ fg_rgb = pc2rgb[fg_idx & 7] & fg;
+ bg_rgb = pc2rgb[bg_idx & 7] & bg;
+
+ if (fg_idx & 8) {
+ /* High intensity foreground */
+ fg_rgb |= fgh;
+ } else {
+ fg_rgb |= fga;
+ }
+
+ if (bg_idx == 0) {
+ /* Default black background, assume transparent */
+ bg_rgb = 0;
+ } else if (bg_idx & 8) {
+ bg_rgb |= bgh;
+ } else {
+ bg_rgb |= bga;
+ }
+
+ cp->argb_fg = fg_rgb;
+ cp->argb_bg = bg_rgb;
+ cp->shadow = shadow;
+ cp++;
}
-
- if (bg_idx == 0) {
- /* Default black background, assume transparent */
- bg_rgb = 0;
- } else if (bg_idx & 8) {
- bg_rgb |= bgh;
- } else {
- bg_rgb |= bga;
- }
-
- cp->argb_fg = fg_rgb;
- cp->argb_bg = bg_rgb;
- cp->shadow = shadow;
- cp++;
- }
}
struct color_table *default_color_table(void)
{
- unsigned int i;
- const struct color_table *dp;
- struct color_table *cp;
- struct color_table *color_table;
- static const int pc2ansi[8] = {0, 4, 2, 6, 1, 5, 3, 7};
- static char msg_names[6*256];
- char *mp;
-
- color_table = calloc(NCOLORS+256, sizeof(struct color_table));
-
- dp = default_colors;
- cp = color_table;
-
- for (i = 0; i < NCOLORS; i++) {
- *cp = *dp;
- cp->ansi = refstrdup(dp->ansi);
- cp++;
- dp++;
- }
-
- mp = msg_names;
- for (i = 0; i < 256; i++) {
- cp->name = mp;
- mp += sprintf(mp, "msg%02x", i)+1;
-
- rsprintf(&cp->ansi, "%s3%d;4%d", (i & 8) ? "1;" : "",
- pc2ansi[i & 7], pc2ansi[(i >> 4) & 7]);
- cp++;
- }
+ unsigned int i;
+ const struct color_table *dp;
+ struct color_table *cp;
+ struct color_table *color_table;
+ static const int pc2ansi[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
+ static char msg_names[6 * 256];
+ char *mp;
+
+ color_table = calloc(NCOLORS + 256, sizeof(struct color_table));
+
+ dp = default_colors;
+ cp = color_table;
+
+ for (i = 0; i < NCOLORS; i++) {
+ *cp = *dp;
+ cp->ansi = refstrdup(dp->ansi);
+ cp++;
+ dp++;
+ }
+
+ mp = msg_names;
+ for (i = 0; i < 256; i++) {
+ cp->name = mp;
+ mp += sprintf(mp, "msg%02x", i) + 1;
+
+ rsprintf(&cp->ansi, "%s3%d;4%d", (i & 8) ? "1;" : "",
+ pc2ansi[i & 7], pc2ansi[(i >> 4) & 7]);
+ cp++;
+ }
/*** XXX: This needs to move to run_menu() ***/
- console_color_table = color_table;
- console_color_table_size = NCOLORS+256;
+ console_color_table = color_table;
+ console_color_table_size = NCOLORS + 256;
- set_msg_colors_global(color_table, MSG_COLORS_DEF_FG,
- MSG_COLORS_DEF_BG, MSG_COLORS_DEF_SHADOW);
+ set_msg_colors_global(color_table, MSG_COLORS_DEF_FG,
+ MSG_COLORS_DEF_BG, MSG_COLORS_DEF_SHADOW);
- return color_table;
+ return color_table;
}
struct color_table *copy_color_table(const struct color_table *master)
{
- const struct color_table *dp;
- struct color_table *color_table, *cp;
- unsigned int i;
+ const struct color_table *dp;
+ struct color_table *color_table, *cp;
+ unsigned int i;
- color_table = calloc(NCOLORS+256, sizeof(struct color_table));
+ color_table = calloc(NCOLORS + 256, sizeof(struct color_table));
- dp = master;
- cp = color_table;
+ dp = master;
+ cp = color_table;
- for (i = 0; i < NCOLORS+256; i++) {
- *cp = *dp;
- cp->ansi = refstr_get(dp->ansi);
- cp++;
- dp++;
- }
+ for (i = 0; i < NCOLORS + 256; i++) {
+ *cp = *dp;
+ cp->ansi = refstr_get(dp->ansi);
+ cp++;
+ dp++;
+ }
- return color_table;
+ return color_table;
}