diff options
| author | james <> | 2008-02-06 20:26:58 +0000 | 
|---|---|---|
| committer | james <> | 2008-02-06 20:26:58 +0000 | 
| commit | b4c47719823e9907f6040e1e899b927cbeb8282e (patch) | |
| tree | cdf78ad3063886c1b6c4e609fea211d06a49793a /src/ansi.c | |
| parent | e28e963a332cf073fcb511e9b85ee7e6648df1f6 (diff) | |
| download | sympathy-b4c47719823e9907f6040e1e899b927cbeb8282e.tar.gz sympathy-b4c47719823e9907f6040e1e899b927cbeb8282e.tar.bz2 sympathy-b4c47719823e9907f6040e1e899b927cbeb8282e.zip | |
*** empty log message ***
Diffstat (limited to 'src/ansi.c')
| -rw-r--r-- | src/ansi.c | 71 | 
1 files changed, 49 insertions, 22 deletions
| @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";  /*   * $Log$ + * Revision 1.7  2008/02/06 20:26:57  james + * *** empty log message *** + *   * Revision 1.6  2008/02/06 17:53:28  james   * *** empty log message ***   * @@ -271,10 +274,7 @@ ansi_draw (ANSI * a, CRT * c)  {    CRT_Pos p;    int o; -  int hidden_cursor=0; - -   - +  int hidden_cursor = 0;    for (p.y = 0; p.y < CRT_ROWS; ++p.y)      { @@ -287,7 +287,7 @@ ansi_draw (ANSI * a, CRT * c)              continue;            if (crt_ca_cmp (a->crt.screen[o], c->screen[o]))              { -  	      ansi_showhide_cursor (a, 1); +              ansi_showhide_cursor (a, 1);                a->crt.screen[o] = c->screen[o];                ansi_move (a, p); @@ -297,25 +297,26 @@ ansi_draw (ANSI * a, CRT * c)      } -  if ((CRT_COLS>a->size.x) || (CRT_ROWS>a->size.y)) { -	char msg[]="Window is too small"; -	p.x=0; -	p.y=0; +  if ((CRT_COLS > a->size.x) || (CRT_ROWS > a->size.y)) +    { +      char msg[] = "Window is too small"; +      p.x = 0; +      p.y = 0; + +      ansi_showhide_cursor (a, 1); +      ansi_set_attr (a, CRT_ATTR_REVERSE); +      ansi_move (a, p); + +      ansi_write (a, msg, sizeof (msg)); +      a->pos.x = ANSI_INVAL; +    } -  	ansi_showhide_cursor (a, 1); -  	ansi_set_attr (a, CRT_ATTR_REVERSE); -	ansi_move(a,p); -	 -  	ansi_write (a, msg, sizeof(msg)); -    	a->pos.x = ANSI_INVAL; -   } -	 -  if ((c->pos.x>=a->size.x) -  || (c->pos.y>=a->size.y)) { -  	ansi_showhide_cursor (a, 1); -	return; -  } +  if ((c->pos.x >= a->size.x) || (c->pos.y >= a->size.y)) +    { +      ansi_showhide_cursor (a, 1); +      return; +    }    a->crt.pos = c->pos;    ansi_move (a, a->crt.pos); @@ -339,3 +340,29 @@ ansi_reset (ANSI * a)    ansi_cls (a);    ansi_draw (a, &a->crt);  } + +void ansi_parse_char(ANSI *a,int c,VT102 *v) +{ +vt102_send(v,c); +} + +void ansi_parse(ANSI *a,char *buf,int len,VT102 *v) +{ +while (len--)  +ansi_parse_char(a,*(buf++),v); +} + +int ansi_dispatch(ANSI *a,VT102 *v) +{ +char buf[1024]; +int red; + +red=read(a.fd,buf,sizeof(buf)); +if (red<0) return -1; +if (!red) return -1; + +ansi_parse(a,buf,red,v); + +return 0; +} +int  | 
