only executable by group dialer
[unix-history] / usr / src / usr.bin / window / ww.h
index 906d043..11825ab 100644 (file)
@@ -3,17 +3,23 @@
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of California at Berkeley. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  *
- *     @(#)ww.h        3.44 (Berkeley) %G%
+ *     @(#)ww.h        3.52 (Berkeley) %G%
  */
 
 #include <sgtty.h>
 #include <setjmp.h>
  */
 
 #include <sgtty.h>
 #include <setjmp.h>
+#include <machine/endian.h>
 
 #define NWW    30              /* maximum number of windows */
 
 
 #define NWW    30              /* maximum number of windows */
 
@@ -99,10 +105,11 @@ struct ww_tty {
 union ww_char {
        short c_w;              /* as a word */
        struct {
 union ww_char {
        short c_w;              /* as a word */
        struct {
-#if defined(vax)
+#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
                char C_c;       /* the character part */
                char C_m;       /* the mode part */
                char C_c;       /* the character part */
                char C_m;       /* the mode part */
-#else
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
                char C_m;       /* the mode part */
                char C_c;       /* the character part */
 #endif
                char C_m;       /* the mode part */
                char C_c;       /* the character part */
 #endif
@@ -111,6 +118,13 @@ union ww_char {
 #define c_c c_un.C_c
 #define c_m c_un.C_m
 
 #define c_c c_un.C_c
 #define c_m c_un.C_m
 
+       /* for display update */
+struct ww_update {
+       int best_gain;
+       int best_col;
+       int gain;
+};
+
        /* parts of ww_char */
 #define WWC_CMASK      0x00ff
 #define WWC_MMASK      0xff00
        /* parts of ww_char */
 #define WWC_CMASK      0x00ff
 #define WWC_MMASK      0xff00
@@ -159,9 +173,8 @@ union ww_char {
 #define WWE_BADTERM    6               /* bad terminal type */
 #define WWE_CANTDO     7               /* dumb terminal */
 
 #define WWE_BADTERM    6               /* bad terminal type */
 #define WWE_CANTDO     7               /* dumb terminal */
 
-       /* wwtouched[] bits */
+       /* wwtouched[] bits, there used to be more than one */
 #define WWU_TOUCHED    0x01            /* touched */
 #define WWU_TOUCHED    0x01            /* touched */
-#define WWU_MAJOR      0x02            /* major change */
 
        /* the window structures */
 struct ww wwhead;
 
        /* the window structures */
 struct ww wwhead;
@@ -174,7 +187,6 @@ struct ww_tty wwnewtty;             /* the new (current) terminal settings */
 struct ww_tty wwwintty;                /* the terminal settings for windows */
 char *wwterm;                  /* the terminal name */
 char wwtermcap[1024];          /* place for the termcap */
 struct ww_tty wwwintty;                /* the terminal settings for windows */
 char *wwterm;                  /* the terminal name */
 char wwtermcap[1024];          /* place for the termcap */
-char wwkeys[512];              /* termcap fields for the function keys */
 
        /* generally useful variables */
 int wwnrow, wwncol;            /* the screen size */
 
        /* generally useful variables */
 int wwnrow, wwncol;            /* the screen size */
@@ -186,6 +198,7 @@ char **wwsmap;                      /* the screen map */
 union ww_char **wwos;          /* the old (current) screen */
 union ww_char **wwns;          /* the new (desired) screen */
 char *wwtouched;               /* wwns changed flags */
 union ww_char **wwos;          /* the old (current) screen */
 union ww_char **wwns;          /* the new (desired) screen */
 char *wwtouched;               /* wwns changed flags */
+struct ww_update *wwupd;       /* for display update */
 extern int wwbaudmap[];                /* maps stty() baud rate code into number */
 int wwbaud;                    /* wwbaudmap[wwoldtty.ww_sgttyb.sg_ospeed] */
 int wwcursorrow, wwcursorcol;  /* where we want the cursor to be */
 extern int wwbaudmap[];                /* maps stty() baud rate code into number */
 int wwbaud;                    /* wwbaudmap[wwoldtty.ww_sgttyb.sg_ospeed] */
 int wwcursorrow, wwcursorcol;  /* where we want the cursor to be */
@@ -194,7 +207,8 @@ int wwerrno;                        /* error number */
        /* statistics */
 int wwnflush, wwnwr, wwnwre, wwnwrz, wwnwrc;
 int wwnwwr, wwnwwra, wwnwwrc;
        /* statistics */
 int wwnflush, wwnwr, wwnwre, wwnwrz, wwnwrc;
 int wwnwwr, wwnwwra, wwnwwrc;
-int wwnupdate, wwnupdline, wwnupdmiss, wwnmajline, wwnmajmiss;
+int wwnupdate, wwnupdline, wwnupdmiss;
+int wwnupdscan, wwnupdclreol, wwnupdclreos, wwnupdclreosmiss, wwnupdclreosline;
 int wwnread, wwnreade, wwnreadz, wwnreadc;
 int wwnwread, wwnwreade, wwnwreadz, wwnwreadd, wwnwreadc, wwnwreadp;
 int wwnselect, wwnselecte, wwnselectz;
 int wwnread, wwnreade, wwnreadz, wwnreadc;
 int wwnwread, wwnwreade, wwnwreadz, wwnwreadd, wwnwreadc, wwnwreadp;
 int wwnselect, wwnselecte, wwnselectz;
@@ -223,22 +237,27 @@ char wwintr;              /* interrupting */
 char wwsetjmp;         /* want a longjmp() from wwrint() and wwchild() */
 jmp_buf wwjmpbuf;      /* jmpbuf for above */
 #define wwinterrupt()  wwintr
 char wwsetjmp;         /* want a longjmp() from wwrint() and wwchild() */
 jmp_buf wwjmpbuf;      /* jmpbuf for above */
 #define wwinterrupt()  wwintr
-#define wwsetintr()    (wwintr = 1, wwsetjmp ? longjmp(wwjmpbuf, 1) : 0)
+#define wwsetintr()    do { wwintr = 1; if (wwsetjmp) longjmp(wwjmpbuf, 1); } \
+                       while (0)
 #define wwclrintr()    (wwintr = 0)
 
        /* the window virtual terminal */
 #define wwclrintr()    (wwintr = 0)
 
        /* the window virtual terminal */
-#define WWT_TERM       "TERM=window"
-#define WWT_TERMCAP    "WW|window|window program:\
-       :cr=^M:nl=^J:bl=^G:\
-       :al=\\EL:am:le=^H:bs:cd=\\EJ:ce=\\EK:cl=\\EE:cm=\\EY%+ %+ :\
-       :da:db:dc=\\EN:dl=\\EM:do=\\EB:ei=\\EO:ho=\\EH:im=\\E@:mi:\
-       :nd=\\EC:ta=^I:pt:up=\\EA:me=\\Er^?:"
+#define WWT_TERM       "window-v2"
+#define WWT_TERMCAP    "WW|window-v2|window program version 2:\
+       :am:bs:da:db:ms:pt:cr=^M:nl=^J:bl=^G:ta=^I:\
+       :cm=\\EY%+ %+ :le=^H:nd=\\EC:up=\\EA:do=\\EB:ho=\\EH:\
+       :cd=\\EJ:ce=\\EK:cl=\\EE:me=\\Er^?:"
 #define WWT_REV                "se=\\ErA:so=\\EsA:mr=\\EsA:"
 #define WWT_BLK                "BE=\\ErB:BS=\\EsB:mb=\\EsB:"
 #define WWT_UL         "ue=\\ErD:us=\\EsD:"
 #define WWT_GRP                "ae=\\ErH:as=\\EsH:"
 #define WWT_DIM                "HE=\\ErP:HS=\\EsP:mh=\\EsP:"
 #define WWT_USR                "XE=\\Er`:XS=\\Es`:"
 #define WWT_REV                "se=\\ErA:so=\\EsA:mr=\\EsA:"
 #define WWT_BLK                "BE=\\ErB:BS=\\EsB:mb=\\EsB:"
 #define WWT_UL         "ue=\\ErD:us=\\EsD:"
 #define WWT_GRP                "ae=\\ErH:as=\\EsH:"
 #define WWT_DIM                "HE=\\ErP:HS=\\EsP:mh=\\EsP:"
 #define WWT_USR                "XE=\\Er`:XS=\\Es`:"
+#define WWT_ALDL       "al=\\EL:dl=\\EM:"
+#define WWT_IMEI       "im=\\E@:ei=\\EO:mi:"
+#define WWT_DC         "dc=\\EN:"
+char wwwintermcap[1024];       /* terminal-specific but window-independent
+                                  part of the window termcap */
 
        /* our functions */
 struct ww *wwopen();
 
        /* our functions */
 struct ww *wwopen();