X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fhtml.c;h=cc10a58ffa061ed16fcb5a8f4f649d7d6fa27e6d;hb=cd3c335082e66f9a790a5bbb0f24a7ec49c9d3d5;hp=6aefce3f300dea2b9213a210e067299e3528aa30;hpb=6f9cbdaa434b4ff90158de4ae24cebfb8300b36a;p=sympathy.git diff --git a/src/html.c b/src/html.c index 6aefce3..cc10a58 100644 --- a/src/html.c +++ b/src/html.c @@ -10,6 +10,15 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.6 2008/02/20 23:42:05 staffcvs + * *** empty log message *** + * + * Revision 1.5 2008/02/20 23:31:48 staffcvs + * *** empty log message *** + * + * Revision 1.4 2008/02/20 22:54:22 staffcvs + * *** empty log message *** + * * Revision 1.3 2008/02/20 20:16:07 james * *** empty log message *** * @@ -27,24 +36,23 @@ static char rcsid[] = "$Id$"; #define V(i) (((i)==0)?0x80:(((i)==1)?0xc0:0xff)) #define COLOR(r,g,b,i) ((((r)?(V(i)):0) << 0)| (((g)?(V(i)):0) << 8)| (((b)?(V(i)):0) << 16)) -static int colormap[]= -{ -[CRT_COLOR_BLACK]=COLOR(0,0,0,0), -[CRT_COLOR_RED]=COLOR(0,0,1,0), -[CRT_COLOR_GREEN]=COLOR(0,1,0,0), -[CRT_COLOR_YELLOW]=COLOR(0,1,1,0), -[CRT_COLOR_BLUE]=COLOR(1,0,0,0), -[CRT_COLOR_MAGENTA]=COLOR(1,0,1,0), -[CRT_COLOR_CYAN]=COLOR(1,1,0,0), -[CRT_COLOR_WHITE]=COLOR(1,1,1,1), -[CRT_COLOR_BLACK|CRT_COLOR_INTENSITY]=COLOR(1,1,1,0), -[CRT_COLOR_RED|CRT_COLOR_INTENSITY]=COLOR(0,0,1,2), -[CRT_COLOR_GREEN|CRT_COLOR_INTENSITY]=COLOR(0,1,0,2), -[CRT_COLOR_YELLOW|CRT_COLOR_INTENSITY]=COLOR(0,1,1,2), -[CRT_COLOR_BLUE|CRT_COLOR_INTENSITY]=COLOR(1,0,0,2), -[CRT_COLOR_MAGENTA|CRT_COLOR_INTENSITY]=COLOR(1,0,1,2), -[CRT_COLOR_CYAN|CRT_COLOR_INTENSITY]=COLOR(1,1,0,2), -[CRT_COLOR_WHITE|CRT_COLOR_INTENSITY]=COLOR(1,1,1,2), +static int colormap[] = { + [CRT_COLOR_BLACK] = COLOR (0, 0, 0, 0), + [CRT_COLOR_RED] = COLOR (0, 0, 1, 0), + [CRT_COLOR_GREEN] = COLOR (0, 1, 0, 0), + [CRT_COLOR_YELLOW] = COLOR (0, 1, 1, 0), + [CRT_COLOR_BLUE] = COLOR (1, 0, 0, 0), + [CRT_COLOR_MAGENTA] = COLOR (1, 0, 1, 0), + [CRT_COLOR_CYAN] = COLOR (1, 1, 0, 0), + [CRT_COLOR_WHITE] = COLOR (1, 1, 1, 1), + [CRT_COLOR_BLACK | CRT_COLOR_INTENSITY] = COLOR (1, 1, 1, 0), + [CRT_COLOR_RED | CRT_COLOR_INTENSITY] = COLOR (0, 0, 1, 2), + [CRT_COLOR_GREEN | CRT_COLOR_INTENSITY] = COLOR (0, 1, 0, 2), + [CRT_COLOR_YELLOW | CRT_COLOR_INTENSITY] = COLOR (0, 1, 1, 2), + [CRT_COLOR_BLUE | CRT_COLOR_INTENSITY] = COLOR (1, 0, 0, 2), + [CRT_COLOR_MAGENTA | CRT_COLOR_INTENSITY] = COLOR (1, 0, 1, 2), + [CRT_COLOR_CYAN | CRT_COLOR_INTENSITY] = COLOR (1, 1, 0, 2), + [CRT_COLOR_WHITE | CRT_COLOR_INTENSITY] = COLOR (1, 1, 1, 2), }; @@ -73,21 +81,28 @@ html_entity (FILE * f, int c) static void html_render (FILE * f, CRT_CA c) { -int fg,bg; - + int fg, bg; + if (c.attr & CRT_ATTR_REVERSE) { - fg=CRT_COLOR_BG(c.color); - bg=CRT_COLOR_FG(c.color); + fg = CRT_COLOR_BG (c.color); + bg = CRT_COLOR_FG (c.color); } else { - fg=CRT_COLOR_FG(c.color); - bg=CRT_COLOR_BG(c.color); - if (c.attr & CRT_ATTR_BOLD) - fg|=CRT_COLOR_INTENSITY; + fg = CRT_COLOR_FG (c.color); + bg = CRT_COLOR_BG (c.color); + if (c.attr & CRT_ATTR_BOLD) + fg |= CRT_COLOR_INTENSITY; } - fprintf (f, "",colormap[bg],colormap[fg]); +#ifdef CSS + fprintf (f, "", + colormap[fg], colormap[bg]); +#else + fprintf (f, "", colormap[bg], + colormap[fg]); + fprintf (f, ""); +#endif if (c.attr & CRT_ATTR_UNDERLINE) fprintf (f, "