chiark / gitweb /
*** empty log message ***
authorjames <james>
Wed, 6 Feb 2008 11:30:37 +0000 (11:30 +0000)
committerjames <james>
Wed, 6 Feb 2008 11:30:37 +0000 (11:30 +0000)
apps/Makefile.am
src/ansi.h
src/crt.c
src/crt.h
src/prototypes.h
src/vt102.c
src/vt102.h

index 0ef4af70a42c0694c7827792a287fd0fb75e5f4e..f2b82b4be5758156c4a3685b00cd4a9069e62bb9 100644 (file)
@@ -7,6 +7,9 @@
 # $Id$
 #
 # $Log$
 # $Id$
 #
 # $Log$
+# Revision 1.2  2008/02/06 11:30:45  james
+# *** empty log message ***
+#
 # Revision 1.1  2008/02/03 16:20:24  james
 # *** empty log message ***
 #
 # Revision 1.1  2008/02/03 16:20:24  james
 # *** empty log message ***
 #
@@ -18,10 +21,10 @@ INCLUDES = -I$(srcdir)/../src
 noinst_PROGRAMS = sympathyd sympathy
 
 sympathy_SOURCES = sympathy.c
 noinst_PROGRAMS = sympathyd sympathy
 
 sympathy_SOURCES = sympathy.c
-sympathy_LDADD = ../src/libsympathy.la  
+sympathy_LDADD = ../src/libsympathy.la  -lutil
 
 sympathyd_SOURCES = sympathyd.c
 
 sympathyd_SOURCES = sympathyd.c
-sympathyd_LDADD = ../src/libsympathy.la  
+sympathyd_LDADD = ../src/libsympathy.la  -lutil
 
 AM_CFLAGS=-g
 
 
 AM_CFLAGS=-g
 
index b687ac6991c847792b4855de3c9f360fcce7a101..2a5977b973ad7def2834821a7bc6bc41abd11c6d 100644 (file)
@@ -12,6 +12,9 @@
 
 /*
  * $Log$
 
 /*
  * $Log$
+ * Revision 1.2  2008/02/06 11:30:37  james
+ * *** empty log message ***
+ *
  * Revision 1.1  2008/02/03 23:31:25  james
  * *** empty log message ***
  *
  * Revision 1.1  2008/02/03 23:31:25  james
  * *** empty log message ***
  *
 
 #define ANSI_INVAL -1
 
 
 #define ANSI_INVAL -1
 
-typedef struct {
-int fd;
+typedef struct
+{
+  int fd;
 
 
-CRT crt;
-CRT_Pos pos;
-CRT_Pos size;
-int hide_cursor;
+  CRT crt;
+  CRT_Pos pos;
+  CRT_Pos size;
+  int hide_cursor;
 
 
-int attr;
+  int attr;
 
 } ANSI;
 
 
 } ANSI;
 
index 7b8e7ddfbad2dcc7fa18cc685e6513ce696b3bf2..b8391506796b569da77acbb52a3959b2ca9354e2 100644 (file)
--- a/src/crt.c
+++ b/src/crt.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
 
 /*
  * $Log$
+ * Revision 1.5  2008/02/06 11:30:37  james
+ * *** empty log message ***
+ *
  * Revision 1.4  2008/02/05 01:11:46  james
  * *** empty log message ***
  *
  * Revision 1.4  2008/02/05 01:11:46  james
  * *** empty log message ***
  *
@@ -27,7 +30,7 @@ static char rcsid[] = "$Id$";
 #include "project.h"
 
 void
 #include "project.h"
 
 void
-crt_erase (CRT * c, CRT_Pos s, CRT_Pos e,int ea)
+crt_erase (CRT * c, CRT_Pos s, CRT_Pos e, int ea)
 {
   CRT_CA *ps = &c->screen[CRT_ADDR_POS (&s)];
   CRT_CA *pe = &c->screen[CRT_ADDR_POS (&e)];
 {
   CRT_CA *ps = &c->screen[CRT_ADDR_POS (&s)];
   CRT_CA *pe = &c->screen[CRT_ADDR_POS (&e)];
@@ -36,7 +39,7 @@ crt_erase (CRT * c, CRT_Pos s, CRT_Pos e,int ea)
     {
       ps->chr = ' ';
       if (ea)
     {
       ps->chr = ' ';
       if (ea)
-      ps->attr = CRT_ATTR_NORMAL;
+        ps->attr = CRT_ATTR_NORMAL;
       ps++;
     }
 
       ps++;
     }
 
@@ -49,7 +52,7 @@ crt_cls (CRT * c)
   CRT_Pos e = { CRT_COLS - 1, CRT_ROWS - 1 };
   int i;
 
   CRT_Pos e = { CRT_COLS - 1, CRT_ROWS - 1 };
   int i;
 
-  crt_erase (c, s, e,1);
+  crt_erase (c, s, e, 1);
 
 #if 0
   for (i = 0; i < CRT_ROWS; ++i)
 
 #if 0
   for (i = 0; i < CRT_ROWS; ++i)
@@ -62,13 +65,13 @@ crt_cls (CRT * c)
 }
 
 void
 }
 
 void
-crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e,int ea)
+crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e, int ea)
 {
   int l, n;
   int p;
 
 {
   int l, n;
   int p;
 
-  s.x=0;
-  e.x=CRT_COLS-1;
+  s.x = 0;
+  e.x = CRT_COLS - 1;
 
   l = e.x - s.x;
   l++;
 
   l = e.x - s.x;
   l++;
@@ -85,18 +88,18 @@ crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e,int ea)
     }
 
   s.y = e.y;
     }
 
   s.y = e.y;
-  crt_erase (c, s, e,ea);
+  crt_erase (c, s, e, ea);
 
 }
 
 void
 
 }
 
 void
-crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e,int ea)
+crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e, int ea)
 {
   int l, n;
   int p;
 
 {
   int l, n;
   int p;
 
-  s.x=0;
-  e.x=CRT_COLS-1;
+  s.x = 0;
+  e.x = CRT_COLS - 1;
 
   l = e.x - s.x;
   l++;
 
   l = e.x - s.x;
   l++;
@@ -109,12 +112,12 @@ crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e,int ea)
 
   while (n--)
     {
 
   while (n--)
     {
-      memcpy (&c->screen[p],&c->screen[p-CRT_COLS], l);
+      memcpy (&c->screen[p], &c->screen[p - CRT_COLS], l);
       p -= CRT_COLS;
     }
 
   e.y = s.y;
       p -= CRT_COLS;
     }
 
   e.y = s.y;
-  crt_erase (c, s, e,ea);
+  crt_erase (c, s, e, ea);
 
 }
 
 
 }
 
index ca3fc00fc9d53797c31ea89811a73e7a2734cb02..002f67fe4d8e650d0deb65997a895cb140b8837e 100644 (file)
--- a/src/crt.h
+++ b/src/crt.h
@@ -12,6 +12,9 @@
 
 /*
  * $Log$
 
 /*
  * $Log$
+ * Revision 1.3  2008/02/06 11:30:37  james
+ * *** empty log message ***
+ *
  * Revision 1.2  2008/02/04 20:23:55  james
  * *** empty log message ***
  *
  * Revision 1.2  2008/02/04 20:23:55  james
  * *** empty log message ***
  *
 #define CRT_ATTR_BLINK    0x4
 #define CRT_ATTR_BOLD     0x8
 
 #define CRT_ATTR_BLINK    0x4
 #define CRT_ATTR_BOLD     0x8
 
-typedef struct {
-       uint8_t chr;
-       uint8_t attr;
+typedef struct
+{
+  uint8_t chr;
+  uint8_t attr;
 } CRT_CA;
 
 } CRT_CA;
 
-typedef struct {
-       int x;
-       int y;
+typedef struct
+{
+  int x;
+  int y;
 } CRT_Pos;
 
 
 } CRT_Pos;
 
 
-typedef struct {
-       CRT_CA screen[CRT_CELS];
-       CRT_Pos pos;
-       int hide_cursor;
+typedef struct
+{
+  CRT_CA screen[CRT_CELS];
+  CRT_Pos pos;
+  int hide_cursor;
 } CRT;
 
 
 } CRT;
 
 
-static inline crt_ca_cmp(CRT_CA a,CRT_CA b) {
-       return memcmp(&a,&b,sizeof(a));
+static inline
+crt_ca_cmp (CRT_CA a, CRT_CA b)
+{
+  return memcmp (&a, &b, sizeof (a));
 }
 
 #endif /* __CRT_H__ */
 }
 
 #endif /* __CRT_H__ */
index 67e3aaff5c544114fe374e0192c3f4a2cd577706..56af551b2010ddb1acf4fc03f3ef5636648d0496 100644 (file)
@@ -1,39 +1,39 @@
 /* ansi.c */
 /* ansi.c */
-void ansi_write(ANSI *a, char *buf, int n);
-void ansi_getsize(ANSI *a);
-void ansi_move(ANSI *a, CRT_Pos p);
-void ansi_showhide_cursor(ANSI *a, int hide);
-void ansi_force_attr_normal(ANSI *a);
-void ansi_set_attr(ANSI *a, int attr);
-void ansi_render(ANSI *a, CRT_CA ca);
-void ansi_cls(ANSI *a);
-void ansi_draw(ANSI *a, CRT *c);
-void ansi_reset(ANSI *a);
+void ansi_write (ANSI * a, char *buf, int n);
+void ansi_getsize (ANSI * a);
+void ansi_move (ANSI * a, CRT_Pos p);
+void ansi_showhide_cursor (ANSI * a, int hide);
+void ansi_force_attr_normal (ANSI * a);
+void ansi_set_attr (ANSI * a, int attr);
+void ansi_render (ANSI * a, CRT_CA ca);
+void ansi_cls (ANSI * a);
+void ansi_draw (ANSI * a, CRT * c);
+void ansi_reset (ANSI * a);
 /* crt.c */
 /* crt.c */
-void crt_erase(CRT *c, CRT_Pos s, CRT_Pos e, int ea);
-void crt_cls(CRT *c);
-void crt_scroll_up(CRT *c, CRT_Pos s, CRT_Pos e, int ea);
-void crt_scroll_down(CRT *c, CRT_Pos s, CRT_Pos e, int ea);
-void crt_reset(CRT *c);
-void crt_insert(CRT *c, CRT_CA ca);
+void crt_erase (CRT * c, CRT_Pos s, CRT_Pos e, int ea);
+void crt_cls (CRT * c);
+void crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e, int ea);
+void crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e, int ea);
+void crt_reset (CRT * c);
+void crt_insert (CRT * c, CRT_CA ca);
 /* html.c */
 /* html.c */
-void html_entity(FILE *f, int c);
-void html_render(FILE *f, CRT_CA c);
-void html_draw(FILE *f, CRT *c);
+void html_entity (FILE * f, int c);
+void html_render (FILE * f, CRT_CA c);
+void html_draw (FILE * f, CRT * c);
 /* libsympathy.c */
 struct termios old;
 /* libsympathy.c */
 struct termios old;
-void testy(void);
+void testy (void);
 /* render.c */
 /* testtty.c */
 /* render.c */
 /* testtty.c */
-int open_fd_to_bash(void);
+int open_fd_to_bash (void);
 /* version.c */
 /* vt102.c */
 /* version.c */
 /* vt102.c */
-void vt102_cursor_normalize(VT102 *v, int do_wrapscroll, int use_margins);
-void vt102_cursor_motion(VT102 *v, int x, int y, int wrapscroll);
-void vt102_delete_from_line(VT102 *v, CRT_Pos p);
-void vt102_parse_esc(VT102 *v, int c);
-void vt102_parse_csi(VT102 *v, char *buf, int len);
-void vt102_status_line(VT102 *v, char *str);
-void vt102_parse_char(VT102 *v, int c);
-void vt102_parser_reset(VT102_parser *p);
-void vt102_reset(VT102 *v);
+void vt102_cursor_normalize (VT102 * v, int do_wrapscroll, int use_margins);
+void vt102_cursor_motion (VT102 * v, int x, int y, int wrapscroll);
+void vt102_delete_from_line (VT102 * v, CRT_Pos p);
+void vt102_parse_esc (VT102 * v, int c);
+void vt102_parse_csi (VT102 * v, char *buf, int len);
+void vt102_status_line (VT102 * v, char *str);
+void vt102_parse_char (VT102 * v, int c);
+void vt102_parser_reset (VT102_parser * p);
+void vt102_reset (VT102 * v);
index da3a58797923b526fd29f69991ec699644d503a9..8b6192971f645704c7bc4d6faf98324701e46c02 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
 
 /*
  * $Log$
+ * Revision 1.7  2008/02/06 11:30:37  james
+ * *** empty log message ***
+ *
  * Revision 1.6  2008/02/05 01:11:46  james
  * *** empty log message ***
  *
  * Revision 1.6  2008/02/05 01:11:46  james
  * *** empty log message ***
  *
@@ -236,10 +239,85 @@ vt102_delete_from_line (VT102 * v, CRT_Pos p)
                &v->crt.screen[CRT_ADDR_POS (&p) + 1], sizeof (CRT_CA) * n);
     }
 
                &v->crt.screen[CRT_ADDR_POS (&p) + 1], sizeof (CRT_CA) * n);
     }
 
-  v->crt.screen[CRT_ADDR (v->bottom_margin.x, p.y)].chr = ' ';
+  v->crt.screen[CRT_ADDR (p.y, v->bottom_margin.x)].chr = ' ';
 /*But not attr due to vt102 bug*/
 }
 
 /*But not attr due to vt102 bug*/
 }
 
+void
+vt102_change_mode (VT102 * v, int private, char *ns, int set)
+{
+  int m;
+
+
+  if (*ns)
+    {
+      m = atoi (ns);
+    }
+  else
+    {
+      m = 1;
+    }
+
+  if (m < 0)
+    return;
+  if (m >= VT102_NMODES)
+    return;
+
+  if (private)
+    v->private_modes[m] = set;
+  else
+    v->modes[m] = set;
+
+  fprintf (stderr, "mode set=%d private=%d num=%d\n", set, private, m);
+}
+
+void
+vt102_parse_mode_string (VT102 * v, char *buf, int len)
+{
+  int private = 0;
+  char last = buf[len - 1];
+  char num[4];
+  int o;
+
+  memset (num, 0, sizeof (num));
+  o = sizeof (num) - 1;
+
+  len--;
+
+  if (*buf == '?')
+    {
+      private++;
+      buf++;
+      len--;
+    }
+
+  if (len < 0)
+    return;
+
+  while (len--)
+    {
+      if (*buf == ';')
+        {
+          vt102_change_mode (v, private, &num[o], last == 'h');
+          memset (num, 0, sizeof (num));
+          o = sizeof (num) - 1;
+          buf++;
+          continue;
+        }
+
+      num[0] = num[1];
+      num[1] = num[2];
+      num[2] = *buf;
+
+      if (o)
+        o--;
+
+      buf++;
+    }
+
+  vt102_change_mode (v, private, &num[o], last == 'h');
+
+}
 
 void
 vt102_parse_esc (VT102 * v, int c)
 
 void
 vt102_parse_esc (VT102 * v, int c)
@@ -262,7 +340,7 @@ vt102_parse_csi (VT102 * v, char *buf, int len)
   buf[len - 1] = 0;
 #endif
 
   buf[len - 1] = 0;
 #endif
 
-  if (len>2)
+  if (len > 2)
     {
       narg = atoi (arg);
     }
     {
       narg = atoi (arg);
     }
@@ -300,7 +378,7 @@ vt102_parse_csi (VT102 * v, char *buf, int len)
           vt102_cursor_normalize (v, 0, 0);
           break;
         case 'J':
           vt102_cursor_normalize (v, 0, 0);
           break;
         case 'J':
-               fprintf(stderr,"OCTOPUS %d\n",narg);
+          fprintf (stderr, "OCTOPUS %d\n", narg);
           switch (narg)
             {
             case 1:
           switch (narg)
             {
             case 1:
@@ -315,27 +393,24 @@ vt102_parse_csi (VT102 * v, char *buf, int len)
           {
             CRT_Pos ls = { 0, v->pos.y };
             CRT_Pos le = { VT102_COLS - 1, v->pos.y };
           {
             CRT_Pos ls = { 0, v->pos.y };
             CRT_Pos le = { VT102_COLS - 1, v->pos.y };
-            if (len==2)
+            if (len == 2)
               narg = 0;         /*Different default */
 
             switch (narg)
               {
               case 0:
               narg = 0;         /*Different default */
 
             switch (narg)
               {
               case 0:
-               fprintf(stderr,"FISH %d %d -> %d %d\n",
-                       v->pos.x,v->pos.y,
-                       le.x,le.y);
+                fprintf (stderr, "FISH %d %d -> %d %d\n",
+                         v->pos.x, v->pos.y, le.x, le.y);
                 crt_erase (&v->crt, v->pos, le, 1);
                 break;
               case 1:
                 crt_erase (&v->crt, v->pos, le, 1);
                 break;
               case 1:
-               fprintf(stderr,"SOUP %d %d -> %d %d\n",
-                       ls.x,ls.y,
-                       v->pos.x,v->pos.y);
+                fprintf (stderr, "SOUP %d %d -> %d %d\n",
+                         ls.x, ls.y, v->pos.x, v->pos.y);
                 crt_erase (&v->crt, ls, v->pos, 1);
                 break;
               case 2:
                 crt_erase (&v->crt, ls, v->pos, 1);
                 break;
               case 2:
-               fprintf(stderr,"TREE %d %d -> %d %d\n",
-                       ls.x,ls.y,
-                       le.x,le.y);
+                fprintf (stderr, "TREE %d %d -> %d %d\n",
+                         ls.x, ls.y, le.x, le.y);
                 crt_erase (&v->crt, ls, le, 1);
                 break;
               }
                 crt_erase (&v->crt, ls, le, 1);
                 break;
               }
@@ -364,41 +439,50 @@ vt102_parse_csi (VT102 * v, char *buf, int len)
             }
           break;
 
             }
           break;
 
-         case 'g':
-         case 'h':
-       case 'l':
-          fprintf (stderr, "C: CSI %s buf[0]=%c\n", buf,buf[0]);
-               break;
-
-       case 'm':
-       //horror of horrors parsing the ;
-       break;
-       case 'r':
-               v->top_margin=v->screen_start;
-               v->bottom_margin=v->screen_end;
-
-         if ((len>2) && (ptr=index(arg,';'))) {
-               ptr++;
-               v->top_margin.y=narg-1;
-               v->bottom_margin.y=atoi(ptr)-1;
-         } 
-
-       if (v->top_margin.y<v->screen_start.y) v->top_margin.y=v->screen_start.y;
-       if (v->top_margin.y>v->screen_end.y) v->top_margin.y=v->screen_end.y;
-       if (v->bottom_margin.y<v->screen_start.y) v->bottom_margin.y=v->screen_start.y;
-       if (v->bottom_margin.y>v->screen_end.y) v->bottom_margin.y=v->screen_end.y;
-
-       fprintf(stderr,"D: %d %d\n",v->top_margin.y,v->bottom_margin.y);
-        v->pos=v->top_margin;
-       break;
+        case 'g':
+          fprintf (stderr, "C: CSI %s buf[0]=%c\n", buf, buf[0]);
+          break;
+
+        case 'h':
+        case 'l':
+          fprintf (stderr, "D: CSI %s buf[0]=%c\n", buf, buf[0]);
+          vt102_parse_mode_string (v, &buf[1], len - 1);
+          break;
+
+        case 'm':
+          //horror of horrors parsing the ;
+          break;
+        case 'r':
+          v->top_margin = v->screen_start;
+          v->bottom_margin = v->screen_end;
+
+          if ((len > 2) && (ptr = index (arg, ';')))
+            {
+              ptr++;
+              v->top_margin.y = narg - 1;
+              v->bottom_margin.y = atoi (ptr) - 1;
+            }
+
+          if (v->top_margin.y < v->screen_start.y)
+            v->top_margin.y = v->screen_start.y;
+          if (v->top_margin.y > v->screen_end.y)
+            v->top_margin.y = v->screen_end.y;
+          if (v->bottom_margin.y < v->screen_start.y)
+            v->bottom_margin.y = v->screen_start.y;
+          if (v->bottom_margin.y > v->screen_end.y)
+            v->bottom_margin.y = v->screen_end.y;
+
+          fprintf (stderr, "D: %d %d\n", v->top_margin.y, v->bottom_margin.y);
+
+          v->pos = v->top_margin;
+          break;
 
         default:
 
         default:
-          fprintf (stderr, "A: CSI %s buf[0]=%c\n", buf,buf[0]);
+          fprintf (stderr, "A: CSI %s buf[0]=%c\n", buf, buf[0]);
         }
       break;
     default:
         }
       break;
     default:
-      fprintf (stderr, "B: CSI %s buf[0]=%c\n", buf,buf[0]);
+      fprintf (stderr, "B: CSI %s buf[0]=%c\n", buf, buf[0]);
     }
 
 
     }
 
 
@@ -429,8 +513,8 @@ vt102_parse_char (VT102 * v, int c)
   VT102_parser *p = &v->parser;
 
 #if 0
   VT102_parser *p = &v->parser;
 
 #if 0
-  fprintf (stderr, "%c pc %d %d %d   %d %d\n", c, c, p->in_csi, p->in_escape,
-           v->pos.x, v->pos.y);
+  fprintf (stderr, "%c pc %d %d %d   %d %d\n", (c > 31) ? 32 : c, c,
+           p->in_csi, p->in_escape, v->pos.x, v->pos.y);
 #endif
   if (p->in_csi)
     {
 #endif
   if (p->in_csi)
     {
@@ -469,13 +553,14 @@ vt102_parse_char (VT102 * v, int c)
          /*ENQ*/ case 5:
          /*ACK*/ case 6:
          /*BEL*/ case 7:
          /*ENQ*/ case 5:
          /*ACK*/ case 6:
          /*BEL*/ case 7:
+          break;
          /*BS*/ case 8:
           vt102_cursor_motion (v, -1, 0, 1);
           break;
          /*HT*/ case 9:
          /*BS*/ case 8:
           vt102_cursor_motion (v, -1, 0, 1);
           break;
          /*HT*/ case 9:
-            v->pos.x+=8;
-            v->pos.x&=~7;
-               vt102_cursor_normalize(v,1,1);
+          v->pos.x += 8;
+          v->pos.x &= ~7;
+          vt102_cursor_normalize (v, 1, 1);
           break;
          /*LF*/ case 10:
          /*VT*/ case 11:
           break;
          /*LF*/ case 10:
          /*VT*/ case 11:
index 6942175a589b7f09f56dbfb90fa81182759c3737..1007353b502a7eae453d7f5bbe4da4c32f0defa9 100644 (file)
@@ -12,6 +12,9 @@
 
 /*
  * $Log$
 
 /*
  * $Log$
+ * Revision 1.4  2008/02/06 11:30:37  james
+ * *** empty log message ***
+ *
  * Revision 1.3  2008/02/04 20:23:55  james
  * *** empty log message ***
  *
  * Revision 1.3  2008/02/04 20:23:55  james
  * *** empty log message ***
  *
 
 #define VT102_CSI_LEN 128
 
 
 #define VT102_CSI_LEN 128
 
-#define VT102_ROWS     24
-#define VT102_COLS     80
+#define VT102_ROWS             24
+#define VT102_COLS             80
 #define VT102_STATUS_ROW       24
 
 #define VT102_STATUS_ROW       24
 
+#define VT102_NMODES           32
+
 typedef struct
 {
   int in_escape;
 typedef struct
 {
   int in_escape;
@@ -42,13 +47,29 @@ typedef struct
 
 typedef struct
 {
 
 typedef struct
 {
-  CRT_Pos top_margin,bottom_margin;
-  CRT_Pos screen_start,screen_end;
+  CRT_Pos top_margin, bottom_margin;
+  CRT_Pos screen_start, screen_end;
   VT102_parser parser;
   int attr;
   CRT crt;
   CRT_Pos pos;
   VT102_parser parser;
   int attr;
   CRT crt;
   CRT_Pos pos;
+
+  uint8_t modes[VT102_NMODES];
+  uint8_t private_modes[VT102_NMODES];
 } VT102;
 
 } VT102;
 
+#define VT102_PRIVATE_MODE_CURSOR_MODE         1
+#define VT102_PRIVATE_MODE_VT52                        2
+#define VT102_PRIVATE_MODE_132COLS             3
+#define VT102_PRIVATE_MODE_SMOOTH_SCROLL       4
+#define VT102_PRIVATE_MODE_REVERSE_SCREEN      5
+#define VT102_PRIVATE_MODE_ORIGIN_MODE         6
+#define VT102_PRIVATE_MODE_AUTO_WRAP           7
+#define VT102_PRIVATE_MODE_AUTO_REPEAT         8
+
+#define VT102_MODE_KEYBOARD_DISABLE            2
+#define VT102_MODE_INSERT                      4
+#define VT102_PRIVATE_MODE_LOCAL_ECHO_OFF      12
+#define VT102_MODE_NEWLINE_MODE                        20
 
 #endif /* __VT102_H__ */
 
 #endif /* __VT102_H__ */