home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / uccs / root.14 / udk / usr / add-on / include / tamwin.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-19  |  4.2 KB  |  155 lines

  1. /*
  2.  * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  3.  *                                                                         
  4.  *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  5.  *                   SANTA CRUZ OPERATION INC.                             
  6.  *                                                                         
  7.  *   The copyright notice above does not evidence any actual or intended   
  8.  *   publication of such source code.                                      
  9.  */
  10.  
  11. #ident    "@(#)libetitam:tamwin.h    1.1"
  12. # ifndef WINDOW
  13.  
  14. #include    "tam.h"
  15. #include    <stdio.h>
  16.  
  17. #define    WNAME    "/dev/window"
  18.  
  19. #define HS_DEFAULT 9
  20. #define VS_DEFAULT 12
  21. #define BASE_DEFAULT 9
  22.  
  23. #define    reg    register
  24.  
  25. typedef char bool;
  26.  
  27. #define CHAR(a)        (((achr_t)a) & 0x7F)
  28.  
  29. # define    TRUE    (1)
  30. # define    FALSE    (0)
  31. # define    ERR    (0)
  32. # define    OK    (1)
  33.  
  34. #ifdef SYS5
  35. #include    <termio.h>
  36. typedef struct termio    TTY;
  37. #else
  38. #include    <sgtty.h>
  39. typedef    struct sgttyb    TTY;
  40. #endif /*SYS5*/
  41.  
  42. /*
  43.  * Capabilities from termcap
  44.  */
  45.  
  46. extern bool     AM, BS, CA, NC, slkshort;
  47. extern bool    MS;
  48. extern char     *BC, *BE, *BO, *CD, *CE, *CI, *CL, *CM,
  49.         *CV, *EE, *FE, *FL, *HO, *KM, *LL, *ND,
  50.         *SE, *SO, *TI, *UE, *UP, *US, *VE, *VS,
  51.         *XE, *XS, PC;
  52.  
  53. extern short    SG;
  54. /*
  55.  * From the tty modes...
  56.  */
  57. extern char    ttytype[];
  58. /*
  59.  * window definitions
  60.  */
  61. typedef int (*Fint)();
  62. typedef unsigned short    achr_t;
  63.  
  64. /* ansi attributes                    */
  65. #define ATTRUNDER    (A_UNDERLINE << 8)    /* underlined    */
  66. #define ATTRREV        (A_REVERSE << 8)    /* inverse video*/
  67. #define ATTRBOLD    (A_BOLD << 8)        /* bold        */
  68. #define ATTRSTRIKE    (A_STRIKE << 8)        /* strike-out    */
  69. #define ATTRALL        (ATTRREV|ATTRUNDER|ATTRSTRIKE|ATTRBOLD)
  70. #define ATTRFONT    0xE000    /* high 3 bits are font        */
  71.  
  72. /* ansi interpreter states                */
  73. #define    NORM    0    /* normal characters        */
  74. #define ESC    1    /* received ESC (0x1b)        */
  75. #define CSI    2    /* received CSI (ESC [)        */
  76. #define PARAM    3    /* parsing parm string        */
  77.  
  78. /* other ansi parameters                */
  79. #define NAPARAM    16    /* max number of parameters    */
  80. #define NAROW    27    /* max number of char rows/w    */
  81. #define ERRCHR    '?'    /* error character        */
  82. #define ERRATTR    ATTRREV
  83.  
  84.  
  85. /* Generic Rectangle                            */
  86. struct recdef
  87. {
  88.     unsigned short    rec_ulx;    /* upper-left x            */
  89.      unsigned short    rec_uly;    /* upper-left y            */
  90.     unsigned short    rec_lrx;    /* lower-right x (exclusive)    */
  91.     unsigned short    rec_lry;    /* lower-right y (exclusive)    */
  92. };
  93.  
  94. /* Window Structure                            */
  95.  
  96. struct    dirt    { short firstc, lastc; };
  97. typedef struct dirt DIRT;
  98.  
  99. struct window {
  100.     struct    recdef    w_rec;        /* window dimensions        */
  101.     struct    recdef    w_inrec;    /* dimensions within borders      */
  102.     struct    oldef    *w_ol;        /* obscured list        */
  103.     struct    window    *w_back;    /* window behind this one    */
  104.     struct    window    *w_front;    /* window in front of this one    */
  105.     unsigned short    w_uflags;    /* user specified flags        */
  106.     short    w_astate;        /* ansi parser state        */
  107.     short    w_iparam;        /* parameter index        */
  108.     short    w_nparam;        /* parameter count        */
  109.     short    w_aparam[NAPARAM];    /* parameters            */
  110.     Fint    *w_adisp;        /* ptr to dispatch table    */
  111.     unsigned char    w_sflags;    /* window state flags        */
  112.     short    w_cury, w_curx;
  113.     achr_t    w_attr;
  114.     achr_t    **w_rptr;
  115.     DIRT    *w_dirt;
  116.     char    w_nflags;        /* noise line dirty flags    */
  117.     char    w_noise[WTXTNUM][WTXTLEN];/* noise line storage        */
  118.     FILE    *w_outf;        /* output stdio file descriptor    */
  119. };
  120.  
  121. typedef struct window WINDOW;
  122.  
  123. /* Obscured Rectangle                            */
  124. struct oldef
  125. {
  126.     struct    recdef    ol_rec;        /* dimensions of obs. on screen    */
  127.     WINDOW        *ol_lobs;    /* ptr to frontmost wp        */
  128.     struct    oldef    *ol_next;    /* next oldef in a chain    */
  129.     struct    oldef    *ol_last;    /* prev oldef in a chain    */
  130. };
  131.  
  132. typedef union { WINDOW *w; FILE *f; int i; } WF;
  133. WF wnmap();            /* map window/file # to WINDOW/FILE pointer */
  134.  
  135. /* window state flags (w_sflags) */
  136. #define    _DIRTY        1    /* window contents modified    */
  137. #define _SS2        2    /* pending single-shift 2     */
  138. #define _CUROFF        4    /* cursor turned off        */
  139. #define _BELL        8    /* bell char seen        */
  140. #define _MAPNL        0x10    /* map nl to cr-nl on output    */
  141. #define _NSCROLL    0x20    /* window doesn't scroll    */
  142. /* user specified window flags (w_uflags) */
  143. /* #define NBORDER    1    /* window has borders (window.h)*/
  144.  
  145. #define    _NOCHANGE    -1
  146.  
  147. extern WF    window[];
  148. extern WINDOW    physcr;
  149.  
  150. extern achr_t    aspace;
  151. extern bool    tbtflg;
  152. extern bool    twbflg;
  153.  
  154. #endif /*WINDOW*/
  155.