Install sccs headers and copyright notices.
[unix-history] / usr / src / usr.bin / tn3270 / ctlr / screen.h
index 0e31587..00318d1 100644 (file)
@@ -1,14 +1,20 @@
 /*
 /*
- *     @(#)screen.h    3.1  10/29/86
+ * @(#)screen.h        1.6 (Berkeley) %G%
  */
 
 #define        INCLUDED_SCREEN
 
 /* defines and defines to describe how to deal with the screen */
 
  */
 
 #define        INCLUDED_SCREEN
 
 /* defines and defines to describe how to deal with the screen */
 
+#if    !defined(MSDOS)
 #define        MAXNUMBERLINES          43              /* 3278-4 */
 #define        MAXNUMBERCOLUMNS        132             /* 3278-5 */
 #define        MAXSCREENSIZE           3564            /* (27*132) 3278-5 */
 #define        MAXNUMBERLINES          43              /* 3278-4 */
 #define        MAXNUMBERCOLUMNS        132             /* 3278-5 */
 #define        MAXSCREENSIZE           3564            /* (27*132) 3278-5 */
+#else  /* !defined(MSDOS) */   /* MSDOS has memory constraints */
+#define        MAXNUMBERLINES          25              /* XXX */
+#define        MAXNUMBERCOLUMNS        80
+#define        MAXSCREENSIZE           (MAXNUMBERLINES*MAXNUMBERCOLUMNS)
+#endif /* !defined(MSDOS) */   /* MSDOS has memory constraints */
 #define LowestScreen() 0
 #define HighestScreen()        (ScreenSize-1)
 
 #define LowestScreen() 0
 #define HighestScreen()        (ScreenSize-1)
 
 \f
 /* These know how fields are implemented... */
 
 \f
 /* These know how fields are implemented... */
 
-#define        FieldInc(p)     FieldFind(FieldForward, p, LowestScreen())
-#define        FieldDec(p)     (HighestScreen() - \
-                               FieldFind(FieldReverse, \
-                                       HighestScreen()-p, HighestScreen()))
 #define WhereAttrByte(p)       (IsStartField(p)? p: FieldDec(p))
 #define        WhereHighByte(p)        ScreenDec(FieldInc(p))
 #define WhereLowByte(p)                ScreenInc(WhereAttrByte(p))
 #define WhereAttrByte(p)       (IsStartField(p)? p: FieldDec(p))
 #define        WhereHighByte(p)        ScreenDec(FieldInc(p))
 #define WhereLowByte(p)                ScreenInc(WhereAttrByte(p))
-#define FieldAttributes(x)     (IsStartField(x)? Host[x].field&0xff : \
-                                   Host[WhereAttrByte(x)].field&0xff)
-#define TurnOffMdt(x)  (Host[WhereAttrByte(x)].field &= ~ATTR_MDT)
-#define TurnOnMdt(x)   (Host[WhereAttrByte(x)].field |= ATTR_MDT)
-#define HasMdt(x)      (Host[x].field&ATTR_MDT)        /* modified tag */
+#define FieldAttributes(x)     (IsStartField(x)? GetHost(x) : \
+                                   GetHost(WhereAttrByte(x)))
+#define FieldAttributesPointer(p)      (IsStartFieldPointer(p)? \
+                                   GetHostPointer(p): \
+                                   GetHost(WhereAttrByte((p)-&Host[0])))
+#define TurnOffMdt(x)  ModifyHost(WhereAttrByte(x), &= ~ATTR_MDT)
+#define TurnOnMdt(x)   ModifyHost(WhereAttrByte(x), |= ATTR_MDT)
+#define HasMdt(x)      (GetHost(x)&ATTR_MDT)   /* modified tag */
 
        /*
         * Is the screen formatted?  Some algorithms change depending
         * on whether there are any attribute bytes lying around.
         */
 #define        FormattedScreen() \
 
        /*
         * Is the screen formatted?  Some algorithms change depending
         * on whether there are any attribute bytes lying around.
         */
 #define        FormattedScreen() \
-           ((WhereAttrByte(0) != 0) || ((Host[0].field&ATTR_MASK) != 0))
+           ((WhereAttrByte(0) != 0) || ((GetHost(0)&ATTR_MASK) == ATTR_MASK))
 
 
-#define IsStartField(x)        (Host[x].field&ATTR_MASK)       /* field starts here */
-#define NewField(p,a)  (Host[p].field = (a)|ATTR_MASK, \
-                           FieldForward[p] = FieldReverse[ScreenSize-p-1] = 1)
-#define DeleteField(p) (Host[p].field = 0, \
-                           FieldForward[p] = FieldReverse[ScreenSize-p-1] = 0)
-#define        DeleteAllFields()       (bzero(FieldForward, sizeof FieldForward), \
-                                   bzero(FieldReverse, sizeof FieldReverse))
+                                           /* field starts here */
+#define IsStartField(x)        ((GetHost(x)&ATTR_MASK) == ATTR_MASK)
+#define IsStartFieldPointer(p) ((GetHostPointer(p)&ATTR_MASK) == ATTR_MASK)
 
 
+#define NewField(p,a)  SetHost(p, (a)|ATTR_MASK)
+#define DeleteField(p) SetHost(p, 0)
+#define        DeleteAllFields()
 \f
 /* The following are independent of the implementation of fields */
 #define IsProtectedAttr(p,a)   (IsStartField(p) || ((a)&ATTR_PROT))
 \f
 /* The following are independent of the implementation of fields */
 #define IsProtectedAttr(p,a)   (IsStartField(p) || ((a)&ATTR_PROT))
 #define MAX(x,y)       ((x)<(y)? (y):(x))
 #define MIN(x,y)       ((x)<(y)? x:(y))
 
 #define MAX(x,y)       ((x)<(y)? (y):(x))
 #define MIN(x,y)       ((x)<(y)? x:(y))
 
-typedef struct {
-       unsigned char   data,   /* data at this position */
-                       field;  /* field attributes if ATTR_MASK */
-} ScreenImage;
+typedef unsigned char ScreenImage;
 
 extern int
        FieldFind();
 
 extern int
        FieldFind();
@@ -88,5 +89,12 @@ extern int
 extern char
        CIABuffer[];
 
 extern char
        CIABuffer[];
 
-#define GetHost(i)     Host[i].data
-#define SetHost(p,c)   (Host[p].data = c)
+#define        GetGeneric(i,h)         (h)[i]
+#define        GetGenericPointer(p)    (*(p))
+#define        SetGeneric(i,c,h)       ((h)[i] = (c))
+#define        ModifyGeneric(i,what,h) {(h)[i] what;}
+
+#define GetHost(i)             GetGeneric(i,Host)
+#define GetHostPointer(p)      GetGenericPointer(p)
+#define        SetHost(i,c)            SetGeneric(i,c,Host)
+#define        ModifyHost(i,what)      ModifyGeneric(i,what,Host)