WWM_GRP added
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Sun, 18 Dec 1983 07:38:55 +0000 (23:38 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Sun, 18 Dec 1983 07:38:55 +0000 (23:38 -0800)
SCCS-vsn: usr.bin/window/ww.h 3.23
SCCS-vsn: usr.bin/window/wwframe.c 3.13
SCCS-vsn: usr.bin/window/ttinit.c 3.7
SCCS-vsn: usr.bin/window/tt.h 3.9
SCCS-vsn: usr.bin/window/tth19.c 3.11
SCCS-vsn: usr.bin/window/tttermcap.c 3.2
SCCS-vsn: usr.bin/window/ttgeneric.c 3.18
SCCS-vsn: usr.bin/window/ttf100.c 3.4

usr/src/usr.bin/window/tt.h
usr/src/usr.bin/window/ttf100.c
usr/src/usr.bin/window/ttgeneric.c
usr/src/usr.bin/window/tth19.c
usr/src/usr.bin/window/ttinit.c
usr/src/usr.bin/window/tttermcap.c
usr/src/usr.bin/window/ww.h
usr/src/usr.bin/window/wwframe.c

index 5011da9..742a432 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- *     @(#)tt.h        3.8 83/09/15
+ *     @(#)tt.h        3.9 83/12/17
  */
 
 /*
  */
 
 /*
@@ -38,7 +38,7 @@ struct tt {
        char tt_retain;                 /* can retain below (db flag) */
 
                /* the frame characters */
        char tt_retain;                 /* can retain below (db flag) */
 
                /* the frame characters */
-       char *tt_frame;
+       short *tt_frame;
 };
 struct tt tt;
 
 };
 struct tt tt;
 
index ccea275..e949f86 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)ttf100.c    3.3 3.3";
+static char *sccsid = "@(#)ttf100.c    3.4 3.4";
 #endif
 
 #include "ww.h"
 #endif
 
 #include "ww.h"
@@ -9,11 +9,12 @@ static        char *sccsid = "@(#)ttf100.c    3.3 3.3";
  * Freedom 100
  */
 
  * Freedom 100
  */
 
-char f100_frame[16] = {
-       ' ',      'J'|0x80, 'K'|0x80, 'A'|0x80,
-       'J'|0x80, 'J'|0x80, 'B'|0x80, 'M'|0x80,
-       'K'|0x80, 'D'|0x80, 'K'|0x80, 'O'|0x80,
-       'C'|0x80, 'L'|0x80, 'N'|0x80, 'I'|0x80
+#define G (WWM_GRP << WWC_MSHIFT)
+short f100_frame[16] = {
+       ' ',    'J'|G,  'K'|G,  'A'|G,
+       'J'|G,  'J'|G,  'B'|G,  'M'|G,
+       'K'|G,  'D'|G,  'K'|G,  'O'|G,
+       'C'|G,  'L'|G,  'N'|G,  'I'|G
 };
 extern char *gen_GE, *gen_GS;
 
 };
 extern char *gen_GE, *gen_GS;
 
@@ -23,6 +24,7 @@ tt_f100()
 
        ret = tt_generic();
        tt.tt_frame = f100_frame;
 
        ret = tt_generic();
        tt.tt_frame = f100_frame;
+       tt.tt_availmodes |= WWM_GRP;
        gen_GS = "\033$";
        gen_GE = "\033%";
        return ret;
        gen_GS = "\033$";
        gen_GE = "\033%";
        return ret;
index 25eb86e..29a76e3 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)ttgeneric.c 3.17 83/09/17";
+static char *sccsid = "@(#)ttgeneric.c 3.18 83/12/17";
 #endif
 
 #include "ww.h"
 #endif
 
 #include "ww.h"
@@ -7,15 +7,13 @@ static        char *sccsid = "@(#)ttgeneric.c 3.17 83/09/17";
 
 char *tgoto();
 
 
 char *tgoto();
 
-char gen_frame[16] = {
+short gen_frame[16] = {
        ' ', '|', '-', '+',
        '|', '|', '+', '+',
        '-', '+', '-', '+',
        '+', '+', '+', '+'
 };
 
        ' ', '|', '-', '+',
        '|', '|', '+', '+',
        '-', '+', '-', '+',
        '+', '+', '+', '+'
 };
 
-char gen_graphics;
-
 char *gen_CM;
 char *gen_IM;
 char *gen_IC;
 char *gen_CM;
 char *gen_IM;
 char *gen_IC;
@@ -91,6 +89,14 @@ register new;
                        if (gen_UE)
                                ps(gen_UE);
        }
                        if (gen_UE)
                                ps(gen_UE);
        }
+       if (diff & WWM_GRP) {
+               if (new & WWM_GRP) {
+                       if (gen_GS)
+                               ps(gen_GS);
+               } else
+                       if (gen_GE)
+                               ps(gen_GE);
+       }
        tt.tt_modes = new;
 }
 
        tt.tt_modes = new;
 }
 
@@ -117,25 +123,14 @@ register char c;
                gen_setinsert(tt.tt_ninsert);
        if (tt.tt_nmodes != tt.tt_modes)
                gen_setmodes(tt.tt_nmodes);
                gen_setinsert(tt.tt_ninsert);
        if (tt.tt_nmodes != tt.tt_modes)
                gen_setmodes(tt.tt_nmodes);
-       if (c & 0x80) {
-               if (gen_GS != 0 && !gen_graphics) {
-                       gen_graphics = 1;
-                       ps(gen_GS);
-               }
-       } else {
-               if (gen_GE != 0 && gen_graphics) {
-                       gen_graphics = 0;
-                       ps(gen_GE);
-               }
-       }
        if (tt.tt_insert) {
                if (gen_IC)
                        tt_tputs(gen_IC, gen_CO - tt.tt_col);
        if (tt.tt_insert) {
                if (gen_IC)
                        tt_tputs(gen_IC, gen_CO - tt.tt_col);
-               putchar(c & 0x7f);
+               putchar(c);
                if (gen_IP)
                        tt_tputs(gen_IP, gen_CO - tt.tt_col);
        } else
                if (gen_IP)
                        tt_tputs(gen_IP, gen_CO - tt.tt_col);
        } else
-               putchar(c & 0x7f);
+               putchar(c);
        if (++tt.tt_col == gen_CO)
                if (gen_AM)
                        tt.tt_col = 0, tt.tt_row++;
        if (++tt.tt_col == gen_CO)
                if (gen_AM)
                        tt.tt_col = 0, tt.tt_row++;
@@ -153,40 +148,17 @@ register n;
                gen_setmodes(tt.tt_nmodes);
        if (tt.tt_insert) {
                while (--n >= 0) {
                gen_setmodes(tt.tt_nmodes);
        if (tt.tt_insert) {
                while (--n >= 0) {
-                       if (*p & 0x80) {
-                               if (gen_GS != 0 && !gen_graphics) {
-                                       gen_graphics = 1;
-                                       ps(gen_GS);
-                               }
-                       } else {
-                               if (gen_GE != 0 && gen_graphics) {
-                                       gen_graphics = 0;
-                                       ps(gen_GE);
-                               }
-                       }
                        if (gen_IC)
                                tt_tputs(gen_IC, gen_CO - tt.tt_col);
                        if (gen_IC)
                                tt_tputs(gen_IC, gen_CO - tt.tt_col);
-                       putchar(*p++ & 0x7f);
+                       putchar(*p++);
                        if (gen_IP)
                                tt_tputs(gen_IP, gen_CO - tt.tt_col);
                        tt.tt_col++;
                }
        } else {
                tt.tt_col += n;
                        if (gen_IP)
                                tt_tputs(gen_IP, gen_CO - tt.tt_col);
                        tt.tt_col++;
                }
        } else {
                tt.tt_col += n;
-               while (--n >= 0) {
-                       if (*p & 0x80) {
-                               if (gen_GS != 0 && !gen_graphics) {
-                                       gen_graphics = 1;
-                                       ps(gen_GS);
-                               }
-                       } else {
-                               if (gen_GE != 0 && gen_graphics) {
-                                       gen_graphics = 0;
-                                       ps(gen_GE);
-                               }
-                       }
-                       putchar(*p++ & 0x7f);
-               }
+               while (--n >= 0)
+                       putchar(*p++);
        }
        if (tt.tt_col == gen_CO)
                if (gen_AM)
        }
        if (tt.tt_col == gen_CO)
                if (gen_AM)
@@ -253,7 +225,6 @@ gen_init()
        tt.tt_col = tt.tt_row = 0;
        tt.tt_ninsert = tt.tt_insert = 0;
        tt.tt_nmodes = tt.tt_modes = 0;
        tt.tt_col = tt.tt_row = 0;
        tt.tt_ninsert = tt.tt_insert = 0;
        tt.tt_nmodes = tt.tt_modes = 0;
-       gen_graphics = 0;
 }
 
 gen_end()
 }
 
 gen_end()
index 8b0bed0..9d2c703 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)tth19.c     3.10 83/12/02";
+static char *sccsid = "@(#)tth19.c     3.11 83/12/17";
 #endif
 
 #include "ww.h"
 #endif
 
 #include "ww.h"
@@ -20,18 +20,18 @@ kb|h19|heath|h19-b|h19b|heathkit|heath-19|z19|zenith:
 #define NCOL   80
 #define NROW   24
 
 #define NCOL   80
 #define NROW   24
 
-char h19_frame[16] = {
-       ' ',      '`'|0x80, 'a'|0x80, 'e'|0x80,
-       '`'|0x80, '`'|0x80, 'f'|0x80, 'v'|0x80,
-       'a'|0x80, 'd'|0x80, 'a'|0x80, 'u'|0x80,
-       'c'|0x80, 't'|0x80, 's'|0x80, 'b'|0x80
+#define G (WWM_GRP << WWC_MSHIFT)
+short h19_frame[16] = {
+       ' ',    '`'|G,  'a'|G,  'e'|G,
+       '`'|G,  '`'|G,  'f'|G,  'v'|G,
+       'a'|G,  'd'|G,  'a'|G,  'u'|G,
+       'c'|G,  't'|G,  's'|G,  'b'|G
 };
 
 extern char *gen_VS;
 extern char *gen_VE;
 
 };
 
 extern char *gen_VS;
 extern char *gen_VE;
 
-char h19_graphics;                     /* in graphics mode */
-short h19_msp10c;
+int h19_msp10c;
 
 #define pc(c)  putchar('c')
 #define esc()  pc(\033)
 
 #define pc(c)  putchar('c')
 #define esc()  pc(\033)
@@ -43,15 +43,30 @@ short h19_msp10c;
 #define ICPAD() PAD((NCOL - tt.tt_col) * 1)    /* 0.1 ms per char */
 #define ILPAD() PAD((NROW - tt.tt_row) * 10)   /* 1 ms per char */
 
 #define ICPAD() PAD((NCOL - tt.tt_col) * 1)    /* 0.1 ms per char */
 #define ILPAD() PAD((NROW - tt.tt_row) * 10)   /* 1 ms per char */
 
-#define SETINSERT(m) \
-       ((m) != tt.tt_insert \
-               ? (esc(), (tt.tt_insert = (m)) ? pc(@) : pc(O)) : 0)
-#define SETMODES(m) \
-       ((m) != tt.tt_modes \
-               ? (esc(), (tt.tt_modes = (m)) ? pc(p) : pc(q)) : 0)
-#define SETGRAPHICS(m) \
-       ((m) != h19_graphics \
-               ? (esc(), (h19_graphics = (m)) ? pc(F) : pc(G)) : 0)
+#define h19_setinsert(m) (esc(), (tt.tt_insert = (m)) ? pc(@) : pc(O))
+
+h19_setmodes(new)
+register new;
+{
+       register diff;
+
+       diff = new ^ tt.tt_modes;
+       if (diff & WWM_REV) {
+               esc();
+               if (new & WWM_REV)
+                       pc(p);
+               else
+                       pc(q);
+       }
+       if (diff & WWM_GRP) {
+               esc();
+               if (new & WWM_GRP)
+                       pc(F);
+               else
+                       pc(G);
+       }
+       tt.tt_modes = new;
+}
 
 h19_insline()
 {
 
 h19_insline()
 {
@@ -70,15 +85,11 @@ h19_delline()
 h19_putc(c)
 register char c;
 {
 h19_putc(c)
 register char c;
 {
-       SETMODES(tt.tt_nmodes);
-       SETINSERT(tt.tt_ninsert);
-       if (c & 0x80) {
-               SETGRAPHICS(1);
-               putchar(c & 0x7f);
-       } else {
-               SETGRAPHICS(0);
-               putchar(c);
-       }
+       if (tt.tt_nmodes != tt.tt_modes)
+               h19_setmodes(tt.tt_nmodes);
+       if (tt.tt_ninsert != tt.tt_insert)
+               h19_setinsert(tt.tt_ninsert);
+       putchar(c);
        if (tt.tt_insert)
                ICPAD();
        if (++tt.tt_col == NCOL)
        if (tt.tt_insert)
                ICPAD();
        if (++tt.tt_col == NCOL)
@@ -89,32 +100,20 @@ h19_write(p, n)
 register char *p;
 register n;
 {
 register char *p;
 register n;
 {
-       register char c;
-
-       SETMODES(tt.tt_nmodes);
-       SETINSERT(tt.tt_ninsert);
+       if (tt.tt_nmodes != tt.tt_modes)
+               h19_setmodes(tt.tt_nmodes);
+       if (tt.tt_ninsert != tt.tt_insert)
+               h19_setinsert(tt.tt_ninsert);
        if (tt.tt_insert) {
                while (--n >= 0) {
        if (tt.tt_insert) {
                while (--n >= 0) {
-                       if ((c = *p++) & 0x80) {
-                               SETGRAPHICS(1);
-                               putchar(c & 0x7f);
-                       } else {
-                               SETGRAPHICS(0);
-                               putchar(c);
-                       }
+                       putchar(*p++);
                        ICPAD();
                        tt.tt_col++;
                }
        } else {
                tt.tt_col += n;
                while (--n >= 0)
                        ICPAD();
                        tt.tt_col++;
                }
        } else {
                tt.tt_col += n;
                while (--n >= 0)
-                       if ((c = *p++) & 0x80) {
-                               SETGRAPHICS(1);
-                               putchar(c & 0x7f);
-                       } else {
-                               SETGRAPHICS(0);
-                               putchar(c);
-                       }
+                       putchar(*p++);
        }
        if (tt.tt_col == NCOL)
                tt.tt_col = NCOL - 1;
        }
        if (tt.tt_col == NCOL)
                tt.tt_col = NCOL - 1;
@@ -170,14 +169,12 @@ h19_init()
        tt.tt_col = tt.tt_row = 0;
        tt.tt_ninsert = tt.tt_insert = 0;
        tt.tt_nmodes = tt.tt_modes = 0;
        tt.tt_col = tt.tt_row = 0;
        tt.tt_ninsert = tt.tt_insert = 0;
        tt.tt_nmodes = tt.tt_modes = 0;
-       h19_graphics = 0;
 }
 
 h19_end()
 {
 }
 
 h19_end()
 {
-       SETMODES(0);
-       SETINSERT(0);
-       SETGRAPHICS(0);
+       h19_setmodes(0);
+       h19_setinsert(0);
        if (gen_VE)
                fputs(gen_VE, stdout);
        esc();
        if (gen_VE)
                fputs(gen_VE, stdout);
        esc();
@@ -232,7 +229,7 @@ tt_h19()
        tt.tt_ncol = NCOL;
        tt.tt_nrow = NROW;
        tt.tt_hasinsert = 1;
        tt.tt_ncol = NCOL;
        tt.tt_nrow = NROW;
        tt.tt_hasinsert = 1;
-       tt.tt_availmodes = WWM_REV;
+       tt.tt_availmodes = WWM_REV|WWM_GRP;
        tt.tt_frame = h19_frame;
        return 0;
 }
        tt.tt_frame = h19_frame;
        return 0;
 }
index 04fd663..5bc3d8a 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)ttinit.c    3.6 83/08/26";
+static char *sccsid = "@(#)ttinit.c    3.7 83/12/17";
 #endif
 
 #include "ww.h"
 #endif
 
 #include "ww.h"
index 4ebaacb..6fb6382 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)tttermcap.c 3.1 83/08/17";
+static char *sccsid = "@(#)tttermcap.c 3.2 83/12/17";
 #endif
 
 #include "ww.h"
 #endif
 
 #include "ww.h"
index ca59ab5..f8f0556 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- *     @(#)ww.h        3.22 83/12/17   
+ *     @(#)ww.h        3.23 83/12/17   
  */
 
 #include <stdio.h>
  */
 
 #include <stdio.h>
@@ -92,6 +92,7 @@ union ww_char {
 #define WWM_REV                0x01    /* reverse video */
 #define WWM_BLK                0x02    /* blinking */
 #define WWM_UL         0x04    /* underlined */
 #define WWM_REV                0x01    /* reverse video */
 #define WWM_BLK                0x02    /* blinking */
 #define WWM_UL         0x04    /* underlined */
+#define WWM_GRP                0x08    /* graphics */
 #define WWM_GLS                0x10    /* window only, glass, i.e. transparent */
 
        /* ww_state values */
 #define WWM_GLS                0x10    /* window only, glass, i.e. transparent */
 
        /* ww_state values */
index 4995897..446768d 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)wwframe.c   3.12 83/12/02";
+static char *sccsid = "@(#)wwframe.c   3.13 83/12/17";
 #endif
 
 #include "ww.h"
 #endif
 
 #include "ww.h"
@@ -203,7 +203,7 @@ char code;
        if (oldcode != code && (code & WWF_LABEL) == 0) {
                register short frame;
 
        if (oldcode != code && (code & WWF_LABEL) == 0) {
                register short frame;
 
-               frame = tt.tt_frame[code & WWF_MASK] & WWC_CMASK;
+               frame = tt.tt_frame[code & WWF_MASK];
                f->ww_buf[r][c].c_w = frame;
                if (wwsmap[r][c] == f->ww_index) {
                        wwtouched[r] |= WWU_TOUCHED;
                f->ww_buf[r][c].c_w = frame;
                if (wwsmap[r][c] == f->ww_index) {
                        wwtouched[r] |= WWU_TOUCHED;