From 72bf4c274834b91ce599ae272fb5159913b8e033 Mon Sep 17 00:00:00 2001 From: james <> Date: Wed, 20 Feb 2008 20:16:07 +0000 Subject: *** empty log message *** --- src/ansi.c | 7 +++++- src/ansi.h | 5 +++- src/html.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++----- src/prototypes.h | 6 ++--- 4 files changed, 83 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/ansi.c b/src/ansi.c index 8d4d640..905866b 100644 --- a/src/ansi.c +++ b/src/ansi.c @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.26 2008/02/20 20:16:07 james + * *** empty log message *** + * * Revision 1.25 2008/02/20 19:44:37 james * @@ * @@ -866,7 +869,7 @@ static void ansi_free(ANSI *a) } -ANSI *ansi_new_from_terminal(ANSI *a,TTY *t) +ANSI *ansi_new_from_terminal(TTY *t) { ANSI *ret; @@ -879,5 +882,7 @@ ret->update=ansi_update; ret->reset=ansi_reset; ret->terminal_reset=ansi_terminal_reset; ret->close=ansi_free; +ret->dispatch=ansi_dispatch; +return ret; } diff --git a/src/ansi.h b/src/ansi.h index b88b329..22c0bcd 100644 --- a/src/ansi.h +++ b/src/ansi.h @@ -12,6 +12,9 @@ /* * $Log$ + * Revision 1.11 2008/02/20 20:16:07 james + * *** empty log message *** + * * Revision 1.10 2008/02/20 19:44:37 james * @@ * @@ -76,8 +79,8 @@ typedef struct ANSI_struct int attr; int color; - int history_ptr; + FILE *file; int (*dispatch)(struct ANSI_struct *,struct Context_struct *); void (*update)(struct ANSI_struct *,struct Context_struct *); diff --git a/src/html.c b/src/html.c index db142a9..6aefce3 100644 --- a/src/html.c +++ b/src/html.c @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.3 2008/02/20 20:16:07 james + * *** empty log message *** + * * Revision 1.2 2008/02/04 02:05:06 james * *** empty log message *** * @@ -20,7 +23,32 @@ static char rcsid[] = "$Id$"; #include "project.h" -void + +#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 void html_entity (FILE * f, int c) { switch (c) @@ -42,17 +70,24 @@ html_entity (FILE * f, int c) } } -void +static void html_render (FILE * f, CRT_CA c) { +int fg,bg; + if (c.attr & CRT_ATTR_REVERSE) { - fprintf (f, "