From: james Date: Wed, 20 Feb 2008 19:25:09 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=48b2a7fa2c0dc01a99a1a2e5bd7c7533d0c7f974;p=sympathy.git *** empty log message *** --- diff --git a/src/ansi.c b/src/ansi.c index 3504750..0fa9a96 100644 --- a/src/ansi.c +++ b/src/ansi.c @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.23 2008/02/20 19:25:09 james + * *** empty log message *** + * * Revision 1.22 2008/02/15 03:32:07 james * *** empty log message *** * @@ -80,7 +83,7 @@ static char rcsid[] = "$Id$"; #include "project.h" -void +static void ansi_move (ANSI * a, CRT_Pos p) { char buf[16]; @@ -170,7 +173,7 @@ ansi_move (ANSI * a, CRT_Pos p) } -void +static void ansi_showhide_cursor (ANSI * a, int hide) { if (a->hide_cursor == hide) @@ -189,7 +192,7 @@ ansi_showhide_cursor (ANSI * a, int hide) } -void +static void ansi_force_attr_normal (ANSI * a) { a->terminal->xmit (a->terminal, "\033[0m", 4); @@ -197,7 +200,7 @@ ansi_force_attr_normal (ANSI * a) a->color = ANSI_INVAL; } -void +static void ansi_set_color (ANSI * a, int color) { int dif; @@ -238,7 +241,7 @@ ansi_set_color (ANSI * a, int color) } } -void +static void ansi_set_attr (ANSI * a, int attr) { int dif; @@ -296,7 +299,7 @@ ansi_set_attr (ANSI * a, int attr) } -void +static void ansi_render (ANSI * a, CRT_CA ca) { int dif; @@ -321,7 +324,7 @@ ansi_render (ANSI * a, CRT_CA ca) } -void +static void ansi_cls (ANSI * a) { CRT_Pos p = { 0 }; @@ -368,7 +371,7 @@ ansi_scroll_up (ANSI * a, CRT_Pos s, CRT_Pos e) } -void +static void ansi_spot_scroll_up (ANSI * a, CRT * c) { int l, n, p; @@ -403,7 +406,7 @@ ansi_spot_scroll_up (ANSI * a, CRT * c) } -void +static void ansi_spot_scroll (ANSI * a, CRT * c) { @@ -421,7 +424,7 @@ ansi_spot_scroll (ANSI * a, CRT * c) #endif -void +static void ansi_draw_line (ANSI * a, CRT_CA * cap, int y) { CRT_Pos p = { 0, y }; @@ -446,7 +449,7 @@ ansi_draw_line (ANSI * a, CRT_CA * cap, int y) } } -void +static void ansi_resize_check (ANSI * a) { @@ -475,7 +478,7 @@ ansi_resize_check (ANSI * a) #define HISTORY_GUESS_SCROLL 24 /*guess all 24 lines usually scroll */ /*if they haven't then ansi_draw will patch it up*/ -void +static void ansi_history (ANSI * a, History * h) { char buf[32]; @@ -551,7 +554,7 @@ ansi_history (ANSI * a, History * h) -void +static void ansi_draw (ANSI * a, CRT * c) { CRT_Pos p; @@ -606,14 +609,14 @@ ansi_draw (ANSI * a, CRT * c) ansi_showhide_cursor (a, a->crt.hide_cursor); } -void +static void ansi_reset (ANSI * a, CRT * c) { a->size.x = -1; ansi_draw (a, c ? c : &a->crt); } -void +static void ansi_terminal_reset (ANSI * a) { CRT_Pos p = { 0, CRT_ROWS }; @@ -622,7 +625,7 @@ ansi_terminal_reset (ANSI * a) ansi_move (a, p); } -void +static void ansi_flush_escape (ANSI * a, Context * c) { ANSI_Parser *p = &a->parser; @@ -637,7 +640,7 @@ ansi_flush_escape (ANSI * a, Context * c) p->in_escape = 0; } -void +static void ansi_parse_deckey (ANSI * a, Context * c) { ANSI_Parser *p = &a->parser; @@ -664,7 +667,7 @@ ansi_parse_deckey (ANSI * a, Context * c) p->escape_ptr = 0; } -void +static void ansi_parse_ansikey (ANSI * a, Context * c) { ANSI_Parser *p = &a->parser; @@ -690,7 +693,7 @@ ansi_parse_ansikey (ANSI * a, Context * c) -void +static void ansi_parse_escape (ANSI * a, Context * c) { ANSI_Parser *p = &a->parser; @@ -739,7 +742,7 @@ ansi_parse_escape (ANSI * a, Context * c) } -void +static void ansi_check_escape (ANSI * a, Context * c) { ANSI_Parser *p = &a->parser; @@ -763,7 +766,7 @@ ansi_check_escape (ANSI * a, Context * c) } -void +static void ansi_parse_char (ANSI * a, Context * c, int ch) { ANSI_Parser *p = &a->parser; @@ -794,7 +797,7 @@ ansi_parse_char (ANSI * a, Context * c, int ch) } -void +static void ansi_parse (ANSI * a, Context * c, char *buf, int len) { while (len--) @@ -840,9 +843,30 @@ ansi_dispatch (ANSI * a, Context * c) } -void +static void ansi_update (ANSI * a, Context * c) { ansi_history (a, c->h); ansi_draw (a, &c->v->crt); } + +static void ansi_free(ANSI *a) +{ + +} + +ANSI *ansi_new_from_terminal(ANSI *a,TTY *t) +{ +ANSI *ret; + +ret=malloc(sizeof(ANSI)); +memset(ret,0,sizeof(ANSI)); + +ret->terminal=t; + +ret->update=ansi_update; +ret->reset=ansi_reset; +ret->terminal_reset=ansi_terminal_reset; +ret->close=ansi_free; + +} diff --git a/src/ansi.h b/src/ansi.h index 7aa5935..44fd61a 100644 --- a/src/ansi.h +++ b/src/ansi.h @@ -12,6 +12,9 @@ /* * $Log$ + * Revision 1.8 2008/02/20 19:25:09 james + * *** empty log message *** + * * Revision 1.7 2008/02/13 16:57:29 james * *** empty log message *** * @@ -51,7 +54,10 @@ typedef struct int escape_ptr; } ANSI_Parser; -typedef struct +struct CRT_struct; +struct Context_struct; + +typedef struct ANSI_struct { ANSI_Parser parser; @@ -66,6 +72,11 @@ typedef struct int history_ptr; + + void (*dispatch)(struct ANSI_struct *,struct Context_struct *); + void (*update)(struct ANSI_struct *,struct CRT_struct *); + void (*reset)(struct ANSI_struct *,struct CRT_struct *); + void (*terminal_reset)(struct ANSI_struct *); } ANSI; diff --git a/src/crt.h b/src/crt.h index 410b390..933dc7b 100644 --- a/src/crt.h +++ b/src/crt.h @@ -12,6 +12,9 @@ /* * $Log$ + * Revision 1.9 2008/02/20 19:25:09 james + * *** empty log message *** + * * Revision 1.8 2008/02/13 09:12:21 james * *** empty log message *** * @@ -102,7 +105,7 @@ typedef struct int dir; } CRT_ScrollHint; -typedef struct +typedef struct CRT_struct { CRT_CA screen[CRT_CELS]; CRT_Pos pos;