1: #ifndef lint
   2: static char sccsid[] = "@(#)tth19.c	3.17 5/2/86";
   3: #endif
   4: 
   5: /*
   6:  * Copyright (c) 1983 Regents of the University of California,
   7:  * All rights reserved.  Redistribution permitted subject to
   8:  * the terms of the Berkeley Software License Agreement.
   9:  */
  10: 
  11: #include "ww.h"
  12: #include "tt.h"
  13: 
  14: /*
  15: kb|h19|heath|h19-b|h19b|heathkit|heath-19|z19|zenith:
  16: 	cr=^M:nl=^J:bl=^G:al=1*\EL:am:le=^H:bs:cd=\EJ:ce=\EK:
  17: 	cl=\EE:cm=\EY%+ %+ :co#80:dc=\EN:dl=1*\EM:do=\EB:
  18: 	ei=\EO:ho=\EH:im=\E@:li#24:mi:nd=\EC:as=\EF:ae=\EG:ms:
  19: 	ta=^I:pt:sr=\EI:se=\Eq:so=\Ep:up=\EA:vs=\Ex4:ve=\Ey4:
  20: 	kb=^h:ku=\EA:kd=\EB:kl=\ED:kr=\EC:kh=\EH:
  21: 	kn#8:k1=\ES:k2=\ET:k3=\EU:k4=\EV:k5=\EW:
  22: 	l6=blue:l7=red:l8=white:k6=\EP:k7=\EQ:k8=\ER:
  23: 	es:hs:ts=\Ej\Ex5\Ex1\EY8%+ \Eo:fs=\Ek\Ey5:ds=\Ey1:
  24: */
  25: 
  26: #define NCOL    80
  27: #define NROW    24
  28: 
  29: #define G (WWM_GRP << WWC_MSHIFT)
  30: short h19_frame[16] = {
  31:     ' ',    '`'|G,  'a'|G,  'e'|G,
  32:     '`'|G,  '`'|G,  'f'|G,  'v'|G,
  33:     'a'|G,  'd'|G,  'a'|G,  'u'|G,
  34:     'c'|G,  't'|G,  's'|G,  'b'|G
  35: };
  36: 
  37: extern struct tt_str *gen_VS;
  38: extern struct tt_str *gen_VE;
  39: extern struct tt_str *gen_XS;
  40: extern struct tt_str *gen_XE;
  41: 
  42: int h19_msp10c;
  43: 
  44: #define pc(c)   ttputc('c')
  45: #define esc()   pc(\033)
  46: #define PAD(ms10) { \
  47:     register i; \
  48:     for (i = ((ms10) + 5) / h19_msp10c; --i >= 0;) \
  49:         pc(\0); \
  50: }
  51: #define ICPAD() PAD((NCOL - tt.tt_col) * 1) /* 0.1 ms per char */
  52: #define ILPAD() PAD((NROW - tt.tt_row) * 10)    /* 1 ms per char */
  53: 
  54: #define H19_SETINSERT(m) (esc(), (tt.tt_insert = (m)) ? pc(@) : pc(O))
  55: 
  56: h19_setinsert(new)
  57: {
  58:     H19_SETINSERT(new);
  59: }
  60: 
  61: h19_setmodes(new)
  62: register new;
  63: {
  64:     register diff;
  65: 
  66:     diff = new ^ tt.tt_modes;
  67:     if (diff & WWM_REV) {
  68:         esc();
  69:         if (new & WWM_REV)
  70:             pc(p);
  71:         else
  72:             pc(q);
  73:     }
  74:     if (diff & WWM_GRP) {
  75:         esc();
  76:         if (new & WWM_GRP)
  77:             pc(F);
  78:         else
  79:             pc(G);
  80:     }
  81:     if (diff & WWM_USR) {
  82:         if (new & WWM_USR) {
  83:             if (gen_XS)
  84:                 ttxputs(gen_XS);
  85:         } else
  86:             if (gen_XE)
  87:                 ttxputs(gen_XE);
  88:     }
  89:     tt.tt_modes = new;
  90: }
  91: 
  92: h19_insline()
  93: {
  94:     esc();
  95:     pc(L);
  96:     ILPAD();
  97: }
  98: 
  99: h19_delline()
 100: {
 101:     esc();
 102:     pc(M);
 103:     ILPAD();
 104: }
 105: 
 106: h19_putc(c)
 107: register char c;
 108: {
 109:     if (tt.tt_nmodes != tt.tt_modes)
 110:         (*tt.tt_setmodes)(tt.tt_nmodes);
 111:     if (tt.tt_ninsert != tt.tt_insert)
 112:         H19_SETINSERT(tt.tt_ninsert);
 113:     ttputc(c);
 114:     if (tt.tt_insert)
 115:         ICPAD();
 116:     if (++tt.tt_col == NCOL)
 117:         tt.tt_col = NCOL - 1;
 118: }
 119: 
 120: h19_write(p, n)
 121: register char *p;
 122: register n;
 123: {
 124:     if (tt.tt_nmodes != tt.tt_modes)
 125:         (*tt.tt_setmodes)(tt.tt_nmodes);
 126:     if (tt.tt_ninsert != tt.tt_insert)
 127:         H19_SETINSERT(tt.tt_ninsert);
 128:     if (tt.tt_insert) {
 129:         while (--n >= 0) {
 130:             ttputc(*p++);
 131:             ICPAD();
 132:             tt.tt_col++;
 133:         }
 134:     } else {
 135:         tt.tt_col += n;
 136:         ttwrite(p, n);
 137:     }
 138:     if (tt.tt_col == NCOL)
 139:         tt.tt_col = NCOL - 1;
 140: }
 141: 
 142: h19_move(row, col)
 143: register char row, col;
 144: {
 145:     if (tt.tt_row == row) {
 146:         if (tt.tt_col == col)
 147:             return;
 148:         if (tt.tt_col == col - 1) {
 149:             esc();
 150:             pc(C);
 151:             goto out;
 152:         } else if (tt.tt_col == col + 1) {
 153:             pc(\b);
 154:             goto out;
 155:         }
 156:     }
 157:     if (tt.tt_col == col) {
 158:         if (tt.tt_row == row + 1) {
 159:             esc();
 160:             pc(A);
 161:             goto out;
 162:         } else if (tt.tt_row == row - 1) {
 163:             pc(\n);
 164:             goto out;
 165:         }
 166:     }
 167:     if (col == 0 && row == 0) {
 168:         esc();
 169:         pc(H);
 170:         goto out;
 171:     }
 172:     esc();
 173:     pc(Y);
 174:     ttputc(' ' + row);
 175:     ttputc(' ' + col);
 176: out:
 177:     tt.tt_col = col;
 178:     tt.tt_row = row;
 179: }
 180: 
 181: h19_init()
 182: {
 183:     if (gen_VS)
 184:         ttxputs(gen_VS);
 185:     esc();
 186:     pc(w);
 187:     esc();
 188:     pc(E);
 189:     tt.tt_col = tt.tt_row = 0;
 190:     tt.tt_ninsert = tt.tt_insert = 0;
 191:     tt.tt_nmodes = tt.tt_modes = 0;
 192: }
 193: 
 194: h19_end()
 195: {
 196:     if (gen_VE)
 197:         ttxputs(gen_VE);
 198:     esc();
 199:     pc(v);
 200: }
 201: 
 202: h19_clreol()
 203: {
 204:     esc();
 205:     pc(K);
 206: }
 207: 
 208: h19_clreos()
 209: {
 210:     esc();
 211:     pc(J);
 212: }
 213: 
 214: h19_clear()
 215: {
 216:     esc();
 217:     pc(E);
 218: }
 219: 
 220: h19_delchar()
 221: {
 222:     esc();
 223:     pc(N);
 224: }
 225: 
 226: tt_h19()
 227: {
 228:     float cpms = (float) wwbaud / 10000;    /* char per ms */
 229: 
 230:     h19_msp10c = 10 / cpms;         /* ms per 10 char */
 231:     gen_VS = ttxgetstr("vs");
 232:     gen_VE = ttxgetstr("ve");
 233:     gen_XS = ttxgetstr("XS");
 234:     gen_XE = ttxgetstr("XE");
 235: 
 236:     tt.tt_init = h19_init;
 237:     tt.tt_end = h19_end;
 238: 
 239:     tt.tt_insline = h19_insline;
 240:     tt.tt_delline = h19_delline;
 241:     tt.tt_delchar = h19_delchar;
 242:     tt.tt_clreol = h19_clreol;
 243:     tt.tt_clreos = h19_clreos;
 244:     tt.tt_clear = h19_clear;
 245:     tt.tt_move = h19_move;
 246:     tt.tt_write = h19_write;
 247:     tt.tt_putc = h19_putc;
 248:     tt.tt_setinsert = h19_setinsert;
 249:     tt.tt_setmodes = h19_setmodes;
 250: 
 251:     tt.tt_ncol = NCOL;
 252:     tt.tt_nrow = NROW;
 253:     tt.tt_hasinsert = 1;
 254:     tt.tt_availmodes = WWM_REV|WWM_GRP;
 255:     if (gen_XS)
 256:         tt.tt_availmodes |= WWM_USR;
 257:     tt.tt_frame = h19_frame;
 258:     return 0;
 259: }

Defined functions

h19_clear defined in line 214; used 1 times
h19_clreol defined in line 202; used 1 times
h19_clreos defined in line 208; used 1 times
h19_delchar defined in line 220; used 1 times
h19_delline defined in line 99; used 1 times
h19_end defined in line 194; used 1 times
h19_init defined in line 181; used 1 times
h19_insline defined in line 92; used 1 times
h19_move defined in line 142; used 1 times
h19_putc defined in line 106; used 1 times
h19_setinsert defined in line 56; used 1 times
h19_setmodes defined in line 61; used 1 times
h19_write defined in line 120; used 1 times
tt_h19 defined in line 226; used 3 times

Defined variables

h19_frame defined in line 30; used 1 times
h19_msp10c defined in line 42; used 2 times
sccsid defined in line 2; never used

Defined macros

G defined in line 29; used 16 times
H19_SETINSERT defined in line 54; used 3 times
ICPAD defined in line 51; used 2 times
ILPAD defined in line 52; used 2 times
NCOL defined in line 26; used 6 times
NROW defined in line 27; used 2 times
PAD defined in line 46; used 2 times
esc defined in line 45; used 16 times
pc defined in line 44; used 22 times
Last modified: 1987-02-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2722
Valid CSS Valid XHTML 1.0 Strict