chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / vt102.c
index a22fe691a4adb6edac6be91058f6359ce0c108e7..88210873f2d1e1e31b9dadcbd6e36b38e7f32f36 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.43  2008/02/27 00:27:22  james
+ * *** empty log message ***
+ *
  * Revision 1.42  2008/02/26 23:56:12  james
  * *** empty log message ***
  *
@@ -297,9 +300,9 @@ ESC+B
 #include "project.h"
 #include "syslog.h"
 
-//static char terminal_reply[]={033,0133,077,066,0143};
-
 #define TABLE_LENGTH 128
+#undef DEBUG
+
 
 static char terminal_id[] = "vt102";
 
@@ -678,9 +681,9 @@ vt102_insert_into_line (VT102 * v, CRT_Pos p)
                &v->crt.screen[CRT_ADDR_POS (&p)], sizeof (CRT_CA) * n);
     }
 
-  v->crt.screen[CRT_ADDR (p.y, v->bottom_margin.x)].chr = ' ';
-  v->crt.screen[CRT_ADDR (p.y, v->bottom_margin.x)].attr = CRT_ATTR_NORMAL;
-  v->crt.screen[CRT_ADDR (p.y, v->bottom_margin.x)].color = CRT_COLOR_NORMAL;
+  v->crt.screen[CRT_ADDR_POS (&p)].chr = ' ';
+  v->crt.screen[CRT_ADDR_POS (&p)].attr = CRT_ATTR_NORMAL;
+  v->crt.screen[CRT_ADDR_POS (&p)].color = CRT_COLOR_NORMAL;
 }
 
 
@@ -1262,23 +1265,26 @@ vt102_parse_csi (Context * c, char *buf, int len)
           vt102_parse_attr_string (v, &buf[1], len - 1);
           break;
         case 'n':              //Device status report
-         switch (buf[1]) {
-       case '5':
-          vt102_send_id (c, "\033[0n");
-         break;
-        case '6':
-        if (c->t) {
-        char buf[16];
-       int i;
-        i=sprintf(buf,"\033[%d;%dR",v->pos.y+1,v->pos.x+1);
-       c->t->xmit (c->t, buf, i);
-         }
-       break;
-       default:
-          //?15n printer status
-          log_f (c->l, "<%s:%d unhandled DSR: \\033%s>", __FILE__, __LINE__,
-                 buf);
-       }
+          switch (buf[1])
+            {
+            case '5':
+              vt102_send_id (c, "\033[0n");
+              break;
+            case '6':
+              if (c->t)
+                {
+                  char buf[16];
+                  int i;
+                  i =
+                    sprintf (buf, "\033[%d;%dR", v->pos.y + 1, v->pos.x + 1);
+                  c->t->xmit (c->t, buf, i);
+                }
+              break;
+            default:
+              //?15n printer status
+              log_f (c->l, "<%s:%d unhandled DSR: \\033%s>", __FILE__,
+                     __LINE__, buf);
+            }
           break;
         case 'q':              //Load LED on off 
           break;
@@ -1314,8 +1320,8 @@ vt102_parse_csi (Context * c, char *buf, int len)
           break;
         case 'y':              //Invoke confidence test
           break;
-       case 'z':       //request terminal parameters
-         break;
+        case 'z':              //request terminal parameters
+          break;
 
         default:
           log_f (c->l, "<%s:%d unhandled CSI: \\033%s>", __FILE__, __LINE__,
@@ -1340,10 +1346,11 @@ vt102_parse_esc (Context * c)
   VT102 *v = c->v;
   VT102_parser *p = &v->parser;
 
-#if 1
+#ifdef DEBUG
   p->cmd_buf[p->cmd_ptr] = 0;
-  log_f (c->l, "<cmd in  x=%3d y=%2d aw=%d vt=%d <ESC>%s >", v->pos.x, v->pos.y,
-         v->pending_wrap, !v->private_modes[VT102_PRIVATE_MODE_VT52],p->cmd_buf);
+  log_f (c->l, "<cmd in  x=%3d y=%2d aw=%d vt=%d <ESC>%s >", v->pos.x,
+         v->pos.y, v->pending_wrap,
+         !v->private_modes[VT102_PRIVATE_MODE_VT52], p->cmd_buf);
 #endif
 
   if (!v->private_modes[VT102_PRIVATE_MODE_VT52])
@@ -1514,8 +1521,10 @@ vt102_parse_esc (Context * c)
     }
 
   p->cmd_buf[p->cmd_ptr] = 0;
+#ifdef DEBUG
   log_f (c->l, "<cmd out x=%3d y=%2d aw=%d>", v->pos.x, v->pos.y,
          v->pending_wrap);
+#endif
 }
 
 void
@@ -1700,7 +1709,7 @@ vt102_parse_char (Context * c, int ch)
     }
   else
     {
-#if 1
+#ifdef DEBUG
       if (ch != 27)
         log_f (c->l,
                "<chr in  x=%3d y=%2d aw=%d  \\%03o %3d %c",
@@ -1770,7 +1779,7 @@ vt102_parse_char (Context * c, int ch)
           vt102_regular_char (c, v, ch);
         }
 
-#if 1
+#ifdef DEBUG
       if (ch != 27)
         log_f (c->l, "<chr out x=%3d y=%2d aw=%d>", v->pos.x, v->pos.y,
                v->pending_wrap);