chiark / gitweb /
@@
authorjames <james>
Wed, 20 Feb 2008 19:44:37 +0000 (19:44 +0000)
committerjames <james>
Wed, 20 Feb 2008 19:44:37 +0000 (19:44 +0000)
apps/mainloop.c
apps/sympathy.c
src/ansi.c
src/ansi.h

index fd2947f8af97729d5fa382f988cb4eba0e69d43c..3c7d01da7d8088372f8d5014355447a323d77c59 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.6  2008/02/20 19:44:37  james
+ * @@
+ *
  * Revision 1.5  2008/02/20 18:31:44  james
  * *** empty log message ***
  *
@@ -301,8 +304,8 @@ check_status (Context * c, Clients * cs)
 }
 
 
-static void
-msg_from_server (IPC_Msg * m, Context * c)
+static int
+msg_from_server (ANSI *a,IPC_Msg * m, Context * c)
 {
   switch (m->hdr.type)
     {
@@ -320,6 +323,11 @@ msg_from_server (IPC_Msg * m, Context * c)
         abort ();
 
       *(c->v) = m->vt102.vt102;
+
+      if (a->one_shot) {
+               a->one_shot(a,&c->v->crt);
+               return 1;
+       }
       //FIXME HTML hook
       break;
     case IPC_MSG_TYPE_TERM:
@@ -331,6 +339,7 @@ msg_from_server (IPC_Msg * m, Context * c)
     default:
       fprintf (stderr, "Unhandeled message type %d\n", m->hdr.type);
     }
+return 0;
 }
 
 
@@ -466,7 +475,8 @@ mainloop (TTY * tty, Socket * server_socket, Socket * client_socket,
 
           while (client_socket->msg)
             {
-              msg_from_server (client_socket->msg, &c);
+              if (msg_from_server (ansi,client_socket->msg, &c))
+               break;
               socket_consume_msg (client_socket);
             }
         }
@@ -475,10 +485,11 @@ mainloop (TTY * tty, Socket * server_socket, Socket * client_socket,
       /*update our local screen */
       if (ansi)
         {
-          if (ansi_dispatch (ansi, &c))
-            break;
+          if (ansi->dispatch)
+               ansi->dispatch (ansi, &c);
 
-          ansi_update (ansi, &c);
+         if (ansi->update)
+          ansi->update (ansi, &c);
         }
     }
 
index 94105a3437bd9ffc0c5a75e449e63d508f18e3a8..df351f3e9111f56c40082daeeeb5655cfd2e6937 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.10  2008/02/20 19:44:37  james
+ * @@
+ *
  * Revision 1.9  2008/02/20 18:49:11  staffcvs
  * *** empty log message ***
  *
@@ -474,7 +477,7 @@ main (int argc, char *argv[])
 
           terminal_register_handlers ();
           ansi->terminal = terminal_open (0, 1);
-          ansi_reset (ansi, NULL);
+          ansi->reset(ansi, NULL);
         }
     }
 
@@ -482,7 +485,7 @@ main (int argc, char *argv[])
 
   if (ansi)
     {
-      ansi_terminal_reset (ansi);
+       ansi->close(ansi);
       terminal_atexit ();
     }
 
index 019422821bf5e5fe49c9c8128b2b2a0cfe680651..8d4d640e9b07460d4c76da33f62c70001b96cec2 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.25  2008/02/20 19:44:37  james
+ * @@
+ *
  * Revision 1.24  2008/02/20 19:36:06  james
  * @@
  *
@@ -817,7 +820,7 @@ ansi_dispatch (ANSI * a, Context * c)
 
 
   if (!a->terminal)
-    return;
+    return 0;
 
   red = a->terminal->recv (a->terminal, buf, sizeof (buf));
   if (red <= 0)
index 28089875cd0db8648e06324e138375a1c53bba6f..b88b329848352b26cd9c252d066202d0d9b30c9b 100644 (file)
@@ -12,6 +12,9 @@
 
 /*
  * $Log$
+ * Revision 1.10  2008/02/20 19:44:37  james
+ * @@
+ *
  * Revision 1.9  2008/02/20 19:36:06  james
  * @@
  *
@@ -76,9 +79,9 @@ typedef struct ANSI_struct
 
   int history_ptr;
 
-  void (*dispatch)(struct ANSI_struct *,struct Context_struct *);
+  int (*dispatch)(struct ANSI_struct *,struct Context_struct *);
   void (*update)(struct ANSI_struct *,struct Context_struct *);
-  void (*oneshot)(struct ANSI_struct *,struct CRT_struct *);
+  void (*one_shot)(struct ANSI_struct *,struct CRT_struct *);
   void (*reset)(struct ANSI_struct *,struct CRT_struct *);
   void (*terminal_reset)(struct ANSI_struct *);
   void (*close)(struct ANSI_struct *);