aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames <>2008-02-07 11:32:41 +0000
committerjames <>2008-02-07 11:32:41 +0000
commitb7dab6019f661c3ef5d19f8faeacfec3a927f727 (patch)
tree043258e2d2e7796b5e828e798bc97cff151da0e2
parent23aa36778606858a01c4662aaad683d4ea93ac0f (diff)
downloadsympathy-b7dab6019f661c3ef5d19f8faeacfec3a927f727.tar.gz
sympathy-b7dab6019f661c3ef5d19f8faeacfec3a927f727.tar.bz2
sympathy-b7dab6019f661c3ef5d19f8faeacfec3a927f727.zip
*** empty log message ***
-rw-r--r--src/ansi.c65
-rw-r--r--src/libsympathy.c9
2 files changed, 40 insertions, 34 deletions
diff --git a/src/ansi.c b/src/ansi.c
index ddce89e..1b8e893 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.12 2008/02/07 11:32:41 james
+ * *** empty log message ***
+ *
* Revision 1.11 2008/02/07 11:11:14 staffcvs
* *** empty log message ***
*
@@ -394,14 +397,14 @@ ansi_reset (ANSI * a)
}
void
-ansi_flush_escape (ANSI * a, VT102 * v)
+ansi_flush_escape (ANSI * a, VT102 * v,TTY *t)
{
ANSI_Parser *p = &a->parser;
int i;
for (i = 0; i < p->escape_ptr; ++i)
{
- vt102_send (v, p->escape_buf[i]);
+ vt102_send (v, p->escape_buf[i],t);
}
p->escape_ptr = 0;
@@ -409,26 +412,26 @@ ansi_flush_escape (ANSI * a, VT102 * v)
}
void
-ansi_parse_deckey (ANSI * a, VT102 * v)
+ansi_parse_deckey (ANSI * a, VT102 * v,TTY *t)
{
ANSI_Parser *p = &a->parser;
if ((p->escape_buf[1] != '[') && (p->escape_buf[1] != 'O'))
{
- ansi_flush_escape (a, v);
+ ansi_flush_escape (a, v,t);
return;
}
if ((p->escape_buf[2] >= 'A') || (p->escape_buf[2] <= 'Z'))
{
- vt102_send (v, KEY_UP + (p->escape_buf[2] - 'A'));
+ vt102_send (v, KEY_UP + (p->escape_buf[2] - 'A'),t);
}
else if ((p->escape_buf[2] >= 'a') || (p->escape_buf[2] <= 'z'))
{
- vt102_send (v, KEY_154 + (p->escape_buf[2] - 'a'));
+ vt102_send (v, KEY_154 + (p->escape_buf[2] - 'a'),t);
}
else
{
- ansi_flush_escape (a, v);
+ ansi_flush_escape (a, v,t);
return;
}
p->in_escape = 0;
@@ -436,22 +439,22 @@ ansi_parse_deckey (ANSI * a, VT102 * v)
}
void
-ansi_parse_ansikey (ANSI * a, VT102 * v)
+ansi_parse_ansikey (ANSI * a, VT102 * v,TTY *t)
{
ANSI_Parser *p = &a->parser;
if ((p->escape_buf[1] != '[') || (p->escape_buf[3] != '~'))
{
- ansi_flush_escape (a, v);
+ ansi_flush_escape (a, v,t);
return;
}
if ((p->escape_buf[2] >= '0') || (p->escape_buf[2] <= '9'))
{
- vt102_send (v, KEY_180 + (p->escape_buf[2] - '0'));
+ vt102_send (v, KEY_180 + (p->escape_buf[2] - '0'),t);
}
else
{
- ansi_flush_escape (a, v);
+ ansi_flush_escape (a, v,t);
return;
}
@@ -462,7 +465,7 @@ ansi_parse_ansikey (ANSI * a, VT102 * v)
void
-ansi_parse_escape (ANSI * a, VT102 * v)
+ansi_parse_escape (ANSI * a, VT102 * v,TTY *t)
{
ANSI_Parser *p = &a->parser;
switch (p->escape_ptr)
@@ -477,41 +480,41 @@ ansi_parse_escape (ANSI * a, VT102 * v)
case 'O':
break;
default:
- ansi_flush_escape (a, v);
+ ansi_flush_escape (a, v,t);
}
break;
case 3:
switch (p->escape_buf[1])
{
case 'O':
- ansi_parse_deckey (a, v);
+ ansi_parse_deckey (a, v,t);
break;
case '[':
if ((p->escape_buf[2] >= 'A') && (p->escape_buf[2] <= 'Z'))
- ansi_parse_deckey (a, v);
+ ansi_parse_deckey (a, v,t);
break;
default:
- ansi_flush_escape (a, v);
+ ansi_flush_escape (a, v,t);
}
break;
case 4:
switch (p->escape_buf[1])
{
case '[':
- ansi_parse_ansikey (a, v);
+ ansi_parse_ansikey (a, v,t);
break;
default:
- ansi_flush_escape (a, v);
+ ansi_flush_escape (a, v,t);
}
break;
case 5:
- ansi_flush_escape (a, v);
+ ansi_flush_escape (a, v,t);
}
}
void
-ansi_check_escape (ANSI * a, VT102 * v)
+ansi_check_escape (ANSI * a, VT102 * v,TTY *t)
{
ANSI_Parser *p = &a->parser;
struct timeval now, diff;
@@ -529,24 +532,24 @@ ansi_check_escape (ANSI * a, VT102 * v)
/*Time up? */
if (diff.tv_sec || (diff.tv_usec > ANSI_ESCAPE_TIMEOUT))
- ansi_flush_escape (a, v);
+ ansi_flush_escape (a, v,t);
}
void
-ansi_parse_char (ANSI * a, int c, VT102 * v)
+ansi_parse_char (ANSI * a, int c, VT102 * v,TTY *t)
{
ANSI_Parser *p = &a->parser;
/*See if it's time to flush the escape*/
- ansi_check_escape (a, v);
+ ansi_check_escape (a, v,t);
if (c == 033)
{
if (p->in_escape)
- ansi_flush_escape (a, v);
+ ansi_flush_escape (a, v,t);
p->in_escape++;
p->escape_ptr = 0;
@@ -556,29 +559,29 @@ ansi_parse_char (ANSI * a, int c, VT102 * v)
if (p->in_escape)
{
p->escape_buf[p->escape_ptr++] = c;
- ansi_parse_escape (a, v);
+ ansi_parse_escape (a, v,t);
}
else
{
- vt102_send (v, c);
+ vt102_send (v, c,t);
}
}
void
-ansi_parse (ANSI * a, char *buf, int len, VT102 * v)
+ansi_parse (ANSI * a, char *buf, int len, VT102 * v,TTY *t)
{
while (len--)
- ansi_parse_char (a, *(buf++), v);
+ ansi_parse_char (a, *(buf++), v,t);
}
int
-ansi_dispatch (ANSI * a, VT102 * v)
+ansi_dispatch (ANSI * a, VT102 * v,TTY *t)
{
char buf[1024];
int red;
- ansi_check_escape (a, v);
+ ansi_check_escape (a, v,t);
red = ansi_read (a, buf, sizeof (buf));
@@ -596,7 +599,7 @@ ansi_dispatch (ANSI * a, VT102 * v)
#endif
- ansi_parse (a, buf, red, v);
+ ansi_parse (a, buf, red, v,t);
return 0;
}
diff --git a/src/libsympathy.c b/src/libsympathy.c
index 6dced0d..ac2f621 100644
--- a/src/libsympathy.c
+++ b/src/libsympathy.c
@@ -11,6 +11,9 @@ static char rcsid[] =
/*
* $Log$
+ * Revision 1.10 2008/02/07 11:32:41 james
+ * *** empty log message ***
+ *
* Revision 1.9 2008/02/07 11:11:14 staffcvs
* *** empty log message ***
*
@@ -93,7 +96,7 @@ testy (void)
t = tty_new_test ();
- v = vt102_new (t);
+ v = vt102_new ();
FD_ZERO (&rfd);
for (;;)
@@ -110,7 +113,7 @@ testy (void)
}
#endif
- switch (ansi_dispatch (&a, v)) {
+ switch (ansi_dispatch (&a, v,t)) {
case -1:
break;
case 1:
@@ -122,7 +125,7 @@ testy (void)
if (FD_ISSET (t->fd, &rfd))
{
- if (vt102_dispatch (v))
+ if (vt102_dispatch (v,t))
break;
}