chiark / gitweb /
*** empty log message ***
authorjames <james>
Thu, 7 Feb 2008 11:32:41 +0000 (11:32 +0000)
committerjames <james>
Thu, 7 Feb 2008 11:32:41 +0000 (11:32 +0000)
src/ansi.c
src/libsympathy.c

index ddce89ea09961141b4814d248b92a22baa5f2822..1b8e893906be0cb001a10f00e1b26a9a08d253bc 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
 
 /*
  * $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 ***
  *
  * Revision 1.11  2008/02/07 11:11:14  staffcvs
  * *** empty log message ***
  *
@@ -394,14 +397,14 @@ ansi_reset (ANSI * a)
 }
 
 void
 }
 
 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)
     {
 {
   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;
     }
 
   p->escape_ptr = 0;
@@ -409,26 +412,26 @@ ansi_flush_escape (ANSI * a, VT102 * v)
 }
 
 void
 }
 
 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_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'))
     {
       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'))
     {
     }
   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
     {
     }
   else
     {
-      ansi_flush_escape (a, v);
+      ansi_flush_escape (a, v,t);
       return;
     }
   p->in_escape = 0;
       return;
     }
   p->in_escape = 0;
@@ -436,22 +439,22 @@ ansi_parse_deckey (ANSI * a, VT102 * v)
 }
 
 void
 }
 
 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_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'))
     {
       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
     {
     }
   else
     {
-      ansi_flush_escape (a, v);
+      ansi_flush_escape (a, v,t);
       return;
     }
 
       return;
     }
 
@@ -462,7 +465,7 @@ ansi_parse_ansikey (ANSI * a, VT102 * v)
 
 
 void
 
 
 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)
 {
   ANSI_Parser *p = &a->parser;
   switch (p->escape_ptr)
@@ -477,41 +480,41 @@ ansi_parse_escape (ANSI * a, VT102 * v)
         case 'O':
           break;
         default:
         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':
         }
       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'))
           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:
           break;
         default:
-          ansi_flush_escape (a, v);
+          ansi_flush_escape (a, v,t);
         }
       break;
     case 4:
       switch (p->escape_buf[1])
         {
         case '[':
         }
       break;
     case 4:
       switch (p->escape_buf[1])
         {
         case '[':
-          ansi_parse_ansikey (a, v);
+          ansi_parse_ansikey (a, v,t);
           break;
         default:
           break;
         default:
-          ansi_flush_escape (a, v);
+          ansi_flush_escape (a, v,t);
         }
       break;
     case 5:
         }
       break;
     case 5:
-      ansi_flush_escape (a, v);
+      ansi_flush_escape (a, v,t);
     }
 }
 
 
 void
     }
 }
 
 
 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;
 {
   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))
 
   /*Time up? */
   if (diff.tv_sec || (diff.tv_usec > ANSI_ESCAPE_TIMEOUT))
-    ansi_flush_escape (a, v);
+    ansi_flush_escape (a, v,t);
 
 }
 
 
 void
 
 }
 
 
 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_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)
 
   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;
 
       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;
   if (p->in_escape)
     {
       p->escape_buf[p->escape_ptr++] = c;
-      ansi_parse_escape (a, v);
+      ansi_parse_escape (a, v,t);
     }
   else
     {
     }
   else
     {
-      vt102_send (v, c);
+      vt102_send (v, c,t);
     }
 
 }
 
 void
     }
 
 }
 
 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--)
 {
   while (len--)
-    ansi_parse_char (a, *(buf++), v);
+    ansi_parse_char (a, *(buf++), v,t);
 }
 
 int
 }
 
 int
-ansi_dispatch (ANSI * a, VT102 * v)
+ansi_dispatch (ANSI * a, VT102 * v,TTY *t)
 {
   char buf[1024];
   int red;
 
 {
   char buf[1024];
   int red;
 
-  ansi_check_escape (a, v);
+  ansi_check_escape (a, v,t);
 
 
   red = ansi_read (a, buf, sizeof (buf));
 
 
   red = ansi_read (a, buf, sizeof (buf));
@@ -596,7 +599,7 @@ ansi_dispatch (ANSI * a, VT102 * v)
 #endif
 
 
 #endif
 
 
-  ansi_parse (a, buf, red, v);
+  ansi_parse (a, buf, red, v,t);
 
   return 0;
 }
 
   return 0;
 }
index 6dced0d9306777f69aa6907d1781fe5b68617382..ac2f62112aaeee283722bfc6a77eaf8956c86e01 100644 (file)
@@ -11,6 +11,9 @@ static char rcsid[] =
 
 /*
  * $Log$
 
 /*
  * $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 ***
  *
  * Revision 1.9  2008/02/07 11:11:14  staffcvs
  * *** empty log message ***
  *
@@ -93,7 +96,7 @@ testy (void)
 
 
   t = tty_new_test ();
 
 
   t = tty_new_test ();
-  v = vt102_new (t);
+  v = vt102_new ();
 
   FD_ZERO (&rfd);
   for (;;)
 
   FD_ZERO (&rfd);
   for (;;)
@@ -110,7 +113,7 @@ testy (void)
         }
 #endif
        
         }
 #endif
        
-      switch (ansi_dispatch (&a, v)) {
+      switch (ansi_dispatch (&a, v,t)) {
        case -1:
         break;
        case 1:
        case -1:
         break;
        case 1:
@@ -122,7 +125,7 @@ testy (void)
 
       if (FD_ISSET (t->fd, &rfd))
         {
 
       if (FD_ISSET (t->fd, &rfd))
         {
-          if (vt102_dispatch (v))
+          if (vt102_dispatch (v,t))
             break;
         }
 
             break;
         }