4.3BSD beta release manual page
[unix-history] / usr / src / usr.bin / window / ttgeneric.c
index c69fe66..f82be2f 100644 (file)
@@ -1,10 +1,18 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)ttgeneric.c 3.19 83/12/21";
+static char sccsid[] = "@(#)ttgeneric.c        3.24 %G%";
 #endif
 
 #endif
 
+/*
+ * Copyright (c) 1983 Regents of the University of California,
+ * All rights reserved.  Redistribution permitted subject to
+ * the terms of the Berkeley Software License Agreement.
+ */
+
 #include "ww.h"
 #include "tt.h"
 
 #include "ww.h"
 #include "tt.h"
 
+char PC, *BC, *UP;
+short ospeed;
 char *tgoto();
 
 short gen_frame[16] = {
 char *tgoto();
 
 short gen_frame[16] = {
@@ -39,8 +47,8 @@ char *gen_BC;
 char *gen_ND;
 char *gen_HO;
 char *gen_NL;
 char *gen_ND;
 char *gen_HO;
 char *gen_NL;
-char *gen_GS;                  /* graphics */
-char *gen_GE;
+char *gen_AS;
+char *gen_AE;
 char gen_MI;
 char gen_MS;
 char gen_AM;
 char gen_MI;
 char gen_MS;
 char gen_AM;
@@ -52,8 +60,7 @@ int gen_LI;
 int gen_UG;
 int gen_SG;
 
 int gen_UG;
 int gen_SG;
 
-#define pc(c) putchar('c')
-#define ps(s) fputs((s), stdout)
+#define ps(s) ttputs(s)
 
 gen_setinsert(new)
 char new;
 
 gen_setinsert(new)
 char new;
@@ -91,11 +98,11 @@ register new;
        }
        if (diff & WWM_GRP) {
                if (new & WWM_GRP) {
        }
        if (diff & WWM_GRP) {
                if (new & WWM_GRP) {
-                       if (gen_GS)
-                               ps(gen_GS);
+                       if (gen_AS)
+                               ps(gen_AS);
                } else
                } else
-                       if (gen_GE)
-                               ps(gen_GE);
+                       if (gen_AE)
+                               ps(gen_AE);
        }
        tt.tt_modes = new;
 }
        }
        tt.tt_modes = new;
 }
@@ -105,7 +112,7 @@ gen_insline()
        if (tt.tt_modes)                        /* for concept 100 */
                gen_setmodes(0);
        if (gen_AL)
        if (tt.tt_modes)                        /* for concept 100 */
                gen_setmodes(0);
        if (gen_AL)
-               tt_tputs(gen_AL, gen_LI - tt.tt_row);
+               tttputs(gen_AL, gen_LI - tt.tt_row);
 }
 
 gen_delline()
 }
 
 gen_delline()
@@ -113,7 +120,7 @@ gen_delline()
        if (tt.tt_modes)                        /* for concept 100 */
                gen_setmodes(0);
        if (gen_DL)
        if (tt.tt_modes)                        /* for concept 100 */
                gen_setmodes(0);
        if (gen_DL)
-               tt_tputs(gen_DL, gen_LI - tt.tt_row);
+               tttputs(gen_DL, gen_LI - tt.tt_row);
 }
 
 gen_putc(c)
 }
 
 gen_putc(c)
@@ -125,12 +132,12 @@ register char c;
                gen_setmodes(tt.tt_nmodes);
        if (tt.tt_insert) {
                if (gen_IC)
                gen_setmodes(tt.tt_nmodes);
        if (tt.tt_insert) {
                if (gen_IC)
-                       tt_tputs(gen_IC, gen_CO - tt.tt_col);
-               putchar(c);
+                       tttputs(gen_IC, gen_CO - tt.tt_col);
+               ttputc(c);
                if (gen_IP)
                if (gen_IP)
-                       tt_tputs(gen_IP, gen_CO - tt.tt_col);
+                       tttputs(gen_IP, gen_CO - tt.tt_col);
        } else
        } else
-               putchar(c);
+               ttputc(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++;
@@ -149,16 +156,16 @@ register n;
        if (tt.tt_insert) {
                while (--n >= 0) {
                        if (gen_IC)
        if (tt.tt_insert) {
                while (--n >= 0) {
                        if (gen_IC)
-                               tt_tputs(gen_IC, gen_CO - tt.tt_col);
-                       putchar(*p++);
+                               tttputs(gen_IC, gen_CO - tt.tt_col);
+                       ttputc(*p++);
                        if (gen_IP)
                        if (gen_IP)
-                               tt_tputs(gen_IP, gen_CO - tt.tt_col);
+                               tttputs(gen_IP, gen_CO - tt.tt_col);
                        tt.tt_col++;
                }
        } else {
                tt.tt_col += n;
                while (--n >= 0)
                        tt.tt_col++;
                }
        } else {
                tt.tt_col += n;
                while (--n >= 0)
-                       putchar(*p++);
+                       ttputc(*p++);
        }
        if (tt.tt_col == gen_CO)
                if (gen_AM)
        }
        if (tt.tt_col == gen_CO)
                if (gen_AM)
@@ -242,7 +249,7 @@ gen_clreol()
        if (tt.tt_modes)                        /* for concept 100 */
                gen_setmodes(0);
        if (gen_CE)
        if (tt.tt_modes)                        /* for concept 100 */
                gen_setmodes(0);
        if (gen_CE)
-               tt_tputs(gen_CE, gen_CO - tt.tt_col);
+               tttputs(gen_CE, gen_CO - tt.tt_col);
 }
 
 gen_clreos()
 }
 
 gen_clreos()
@@ -250,7 +257,7 @@ gen_clreos()
        if (tt.tt_modes)                        /* for concept 100 */
                gen_setmodes(0);
        if (gen_CD)
        if (tt.tt_modes)                        /* for concept 100 */
                gen_setmodes(0);
        if (gen_CD)
-               tt_tputs(gen_CD, gen_LI - tt.tt_row);
+               tttputs(gen_CD, gen_LI - tt.tt_row);
 }
 
 gen_clear()
 }
 
 gen_clear()
@@ -264,36 +271,38 @@ gen_clear()
 gen_delchar()
 {
        if (gen_DC)
 gen_delchar()
 {
        if (gen_DC)
-               tt_tputs(gen_DC, gen_CO - tt.tt_col);
+               tttputs(gen_DC, gen_CO - tt.tt_col);
 }
 
 tt_generic()
 {
 }
 
 tt_generic()
 {
-       gen_CM = tt_xgetstr("cm");              /* may not work */
-       gen_IM = tt_xgetstr("im");
-       gen_IC = tt_tgetstr("ic");
-       gen_IP = tt_tgetstr("ip");
-       gen_EI = tt_xgetstr("ei");
-       gen_DC = tt_tgetstr("dc");
-       gen_AL = tt_tgetstr("al");
-       gen_DL = tt_tgetstr("dl");
-       gen_CE = tt_tgetstr("ce");
-       gen_CD = tt_tgetstr("cd");
-       gen_CL = tt_xgetstr("cl");
-       gen_VS = tt_xgetstr("vs");
-       gen_VE = tt_xgetstr("ve");
-       gen_TI = tt_xgetstr("ti");
-       gen_TE = tt_xgetstr("te");
-       gen_SO = tt_xgetstr("so");
-       gen_SE = tt_xgetstr("se");
-       gen_US = tt_xgetstr("us");
-       gen_UE = tt_xgetstr("ue");
-       gen_UP = tt_xgetstr("up");
-       gen_PC = tt_tgetstr("pc");
-       gen_BC = tt_xgetstr("bc");
-       gen_ND = tt_xgetstr("nd");
-       gen_HO = tt_xgetstr("ho");
-       gen_NL = tt_xgetstr("nl");
+       gen_CM = ttxgetstr("cm");               /* may not work */
+       gen_IM = ttxgetstr("im");
+       gen_IC = tttgetstr("ic");
+       gen_IP = tttgetstr("ip");
+       gen_EI = ttxgetstr("ei");
+       gen_DC = tttgetstr("dc");
+       gen_AL = tttgetstr("al");
+       gen_DL = tttgetstr("dl");
+       gen_CE = tttgetstr("ce");
+       gen_CD = tttgetstr("cd");
+       gen_CL = ttxgetstr("cl");
+       gen_VS = ttxgetstr("vs");
+       gen_VE = ttxgetstr("ve");
+       gen_TI = ttxgetstr("ti");
+       gen_TE = ttxgetstr("te");
+       gen_SO = ttxgetstr("so");
+       gen_SE = ttxgetstr("se");
+       gen_US = ttxgetstr("us");
+       gen_UE = ttxgetstr("ue");
+       gen_UP = ttxgetstr("up");
+       gen_PC = tttgetstr("pc");
+       gen_BC = ttxgetstr("bc");
+       gen_ND = ttxgetstr("nd");
+       gen_HO = ttxgetstr("ho");
+       gen_NL = ttxgetstr("nl");
+       gen_AS = ttxgetstr("as");
+       gen_AE = ttxgetstr("ae");
        gen_MI = tgetflag("mi");
        gen_MS = tgetflag("ms");
        gen_AM = tgetflag("am");
        gen_MI = tgetflag("mi");
        gen_MS = tgetflag("ms");
        gen_AM = tgetflag("am");
@@ -313,15 +322,10 @@ tt_generic()
        if (gen_BC == 0 && gen_BS)
                gen_BC = "\b";
 
        if (gen_BC == 0 && gen_BS)
                gen_BC = "\b";
 
-       {
-               extern char PC, *BC, *UP;
-               extern short ospeed;
-
-               PC = gen_PC ? *gen_PC : 0;
-               BC = gen_BC;
-               UP = gen_UP;
-               ospeed = wwoldtty.ww_sgttyb.sg_ospeed;
-       }
+       PC = gen_PC ? *gen_PC : 0;
+       BC = gen_BC;
+       UP = gen_UP;
+       ospeed = wwoldtty.ww_sgttyb.sg_ospeed;
 
        if (gen_DC)
                tt.tt_delchar = gen_delchar;
 
        if (gen_DC)
                tt.tt_delchar = gen_delchar;
@@ -343,6 +347,8 @@ tt_generic()
                tt.tt_availmodes |= WWM_REV;
        if (gen_US)
                tt.tt_availmodes |= WWM_UL;
                tt.tt_availmodes |= WWM_REV;
        if (gen_US)
                tt.tt_availmodes |= WWM_UL;
+       if (gen_AS)
+               tt.tt_availmodes |= WWM_GRP;
        tt.tt_hasinsert = gen_IM != 0;
        tt.tt_wrap = gen_AM;
        tt.tt_retain = gen_DB;
        tt.tt_hasinsert = gen_IM != 0;
        tt.tt_wrap = gen_AM;
        tt.tt_retain = gen_DB;