Annotation of 43BSDTahoe/ucb/window/tth19.c, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.