1: #include <X/mit-copyright.h>
   2: 
   3: /*	Copyright	Massachusetts Institute of Technology	1984, 1985 */
   4: 
   5: /* ptyx.h */
   6: 
   7: #define MAX_COLS    200
   8: #define MAX_ROWS    128
   9: 
  10: /*
  11:  * The origin of a screen is 0, 0.  Therefore, the number of rows
  12:  * on a screen is screen->max_row + 1, and similarly for columns.
  13:  */
  14: 
  15: typedef short **ScrnBuf;
  16: 
  17: /*
  18:  * ANSI emulation.
  19:  */
  20: #define INQ 0x05
  21: #define FF  0x0C            /* C0, C1 control names		*/
  22: #define LS1 0x0E
  23: #define LS0 0x0F
  24: #define CAN 0x18
  25: #define SUB 0x1A
  26: #define ESC 0x1B
  27: #define US  0x1F
  28: #define DEL 0x7F
  29: #define SS2 0x8E
  30: #define SS3 0x8F
  31: #define DCS 0x90
  32: #define OLDID   0x9A            /* ESC Z			*/
  33: #define CSI 0x9B
  34: #define ST  0x9C
  35: #define OSC 0x9D
  36: #define PM  0x9E
  37: #define APC 0x9F
  38: #define RDEL    0xFF
  39: 
  40: #define NPARAM  10          /* Max. parameters		*/
  41: 
  42: typedef struct {
  43:     unsigned char   a_type;
  44:     unsigned char   a_pintro;
  45:     unsigned char   a_final;
  46:     unsigned char   a_inters;
  47:     char    a_nparam;       /* # of parameters		*/
  48:     char    a_dflt[NPARAM];     /* Default value flags		*/
  49:     short   a_param[NPARAM];    /* Parameters			*/
  50:     char    a_nastyf;       /* Error flag			*/
  51: }   ANSI;
  52: 
  53: typedef struct {
  54:     int     row;
  55:     int     col;
  56:     unsigned    flags;  /* Vt100 saves graphics rendition. Ugh! */
  57: } SavedCursor;
  58: 
  59: typedef struct {
  60:     Window      window;     /* X window for screen		*/
  61:     Window      iconwindow; /* window for icon		*/
  62:     Bitmap      iconmask;   /* mask for icon outline	*/
  63:     int     border;     /* inner border			*/
  64:     int             borderwidth;    /* outer border	    	    	*/
  65:     int     width;      /* width of window - borders (pixels)*/
  66:     int     height;     /* height of window -borders (pixels)*/
  67:     Display     *display;   /* X display for screen		*/
  68:     int     respond;    /* socket for responses
  69: 					   (position report, etc.)	*/
  70: 
  71:     /* Terminal fonts must be of the same size and of fixed width */
  72:     Font        fnt_norm;   /* normal font of terminal	*/
  73:     Font        fnt_bold;   /* bold font of terminal	*/
  74:     int     f_width;    /* width of fonts in pixels	*/
  75:     int     f_height;   /* height of fonts in pixels	*/
  76: 
  77:     int     cur_col;    /* current cursor column	*/
  78:     int     cur_row;    /* current cursor row		*/
  79:     int     max_col;    /* rightmost column		*/
  80:     int     max_row;    /* bottom row			*/
  81:     int     top_marg;   /* top line of scrolling region */
  82:     int     bot_marg;   /* bottom line of  "	    "	*/
  83: 
  84:     ScrnBuf     buf;        /* screen buffer		*/
  85:     Bitmap      cursor;     /* cursor bits			*/
  86:     Bitmap      mask;       /* mask cursor bits		*/
  87:     Cursor      curs;       /* cursor resource from X	*/
  88:     Cursor      rcurs;      /* reverse version of cursor	*/
  89:     int     foreground; /* foreground color		*/
  90:     int     background; /* Background color		*/
  91:     int     cursorcolor;    /* Cursor color			*/
  92:     int     mousecolor; /* Mouse color			*/
  93:     Pixmap      bordertile; /* tile pixmap for border	*/
  94:     Pixmap      bgndtile;   /* background tile pixmap	*/
  95:     unsigned    xorplane;   /* z plane for inverts		*/
  96:     unsigned short  do_wrap;    /* true if cursor in last column
  97: 					   and character just output    */
  98:     short   incopy;         /* 0 if no RasterCopy exposure
  99: 					   event processed since last
 100: 					   RasterCopy			*/
 101: #ifdef CROCKSCROLL
 102:     short       scrollincr; /* scroll increment		*/
 103: #endif
 104:     unsigned short  multiscroll;    /* true if multi-scroll		*/
 105:     int     scrolls;    /* outstanding scroll count	*/
 106:     SavedCursor sc;     /* data for restore cursor	*/
 107:     long        pid;        /* pid of process on far side   */
 108: 
 109:     /* Improved VT100 emulation stuff.				*/
 110:     ANSI        ansi;       /* ANSI parsing variables.	*/
 111:     char        gsets[4];   /* G0 through G3.		*/
 112:     char        curgl;      /* Current GL setting.		*/
 113:     char        curgr;      /* Current GR setting.		*/
 114:     char        curss;      /* Current single shift.	*/
 115:     char        rx8bit;     /* TRUE if Rx is 8 bit.		*/
 116:     char        tx8bit;     /* TRUE if Tx is 8 bit.		*/
 117:     /* Tektronix plotting information */
 118:     int     TekEmu;     /* true if Tektronix emulation	*/
 119:     int     cur_X;      /* current screen x		*/
 120:     int     cur_Y;      /* current screen y		*/
 121:     int     cur_x;      /* current Tektronix x		*/
 122:     int     cur_y;      /* current Tektronix y		*/
 123:     int     pen;        /* current Tektronix pen 0=up, 1=dn */
 124:     double      TekScale;   /* scale factor Tek -> vs100	*/
 125:     int     TekGMode;   /* plot mode switch		*/
 126:     int     TekAMode;   /* alpha after plot mode switch */
 127:     int     TekIMode;   /* incremental plot mode switch */
 128:     int     TekPMode;   /* point plot mode switch	*/
 129: #ifdef JUMPSCROLL
 130:     int     scroll_amt; /* amount to scroll		*/
 131:     int     refresh_amt;    /* amount to refresh		*/
 132:     int     jumpscroll; /* whether we should jumpscroll */
 133: #endif JUMPSCROLL
 134:     int     (*mode)();  /* this will be THE mode	*/
 135:     unsigned short  send_mouse_pos; /* user wants mouse transition  */
 136:                     /* and position information	*/
 137: } Screen;
 138: 
 139: /* meaning of bits for entries in screen buffer */
 140: #define CHAR        0177
 141: #define BOLDbit     0200
 142: #define INVERSEbit  0400
 143: 
 144: 
 145: typedef struct
 146: {
 147:     unsigned    offset;     /* status of shift, control, meta */
 148: #define SHIFT   0x0001
 149: #define META    0x0002
 150: #define CONTROL 0x0004
 151: 
 152:     unsigned    flags;
 153: } Keyboard;
 154: 
 155: /* define masks for flags */
 156: #define CAPS_LOCK   0x01
 157: #define KYPD_APL    0x02
 158: #define CURSOR_APL  0x04
 159: 
 160: 
 161: #define MAX_TABS    320
 162: #define TAB_ARRAY_SIZE  10  /* number of ints to provide MAX_TABS bits */
 163: 
 164: typedef unsigned Tabs [TAB_ARRAY_SIZE];
 165: 
 166: 
 167: #define BUF_SIZE 4096
 168: 
 169: typedef struct
 170: {
 171:     int     cnt;        /* count of char's left in buf	*/
 172:     unsigned char   *ptr;       /* pointer to next char in buf	*/
 173:     unsigned char   buf[BUF_SIZE];  /* buffer			*/
 174:     int     fildes;     /* file descriptor to read from	*/
 175: } Buffer;
 176: 
 177: 
 178: typedef struct
 179: {
 180:     Keyboard    keyboard;   /* terminal keyboard		*/
 181:     Screen      screen;     /* terminal screeen		*/
 182:     Buffer      buf;        /* buffer for data to process	*/
 183:     unsigned    flags;      /* mode flags			*/
 184:     Tabs        tabs;       /* tabstops of the terminal	*/
 185: } Terminal;
 186: 
 187: 
 188: /* masks for terminal flags */
 189: 
 190: #define INVERSE     0x01    /* invert the characters to be output */
 191: #define LINEFEED    0x02
 192: #define BOLD        0x04
 193: #define WRAPAROUND  0x08
 194: #define REVERSE_VIDEO   0x10    /* true if screen white on black */
 195: #define ORIGIN      0x20    /* true if in origin mode */
 196: #define INSERT      0x40    /* true if in insert mode */
 197: #define SMOOTHSCROLL    0x80    /* true if in smooth scroll mode */
 198: 
 199:     /* must be a power of two */
 200: #define TEK_LINK_BLOCK_SIZE 1024
 201: 
 202: typedef struct _TekLink
 203: {
 204:     struct _TekLink *next;  /* pointer to next TekLink in list
 205: 				   NULL <=> this is last TekLink */
 206:     unsigned char   data [TEK_LINK_BLOCK_SIZE];
 207: } TekLink;
 208: 
 209: #define TekBufPut(chr)                      \
 210:     /* if out of memory malloc some more */         \
 211:     {                           \
 212:         if (tb_end & TEK_LINK_BLOCK_SIZE)       \
 213:             TekBufExtend ();            \
 214:         tb_end_link->data [tb_end++] = chr;     \
 215:     }
 216: 
 217: 
 218: #define CursorX(screen) (screen->cur_col * screen->f_width + screen->border)
 219: #define CursorY(screen) (screen->cur_row * screen->f_height + screen->border)
 220: 
 221: /*
 222:  * To handle Tektronix plotting well, add graphics cursor position
 223:  * to get correct position for characters on the screen.
 224:  * screen->border is taken into account in screen->cur[XY]
 225:  */
 226: 
 227: #define TCursorX(screen) (screen->cur_X)
 228: #define TCursorY(screen) (screen->cur_Y - screen->f_height)
 229: 
 230: int ANSInormal();
 231: int ANSIparse();
 232: int ANSIstring();

Defined struct's

_TekLink defined in line 202; used 10 times

Defined typedef's

ScrnBuf defined in line 15; used 13 times
Tabs defined in line 164; used 6 times
TekLink defined in line 207; used 11 times

Defined macros

APC defined in line 37; used 3 times
BOLD defined in line 192; used 7 times
BOLDbit defined in line 141; used 7 times
BUF_SIZE defined in line 167; used 2 times
CAN defined in line 24; used 1 times
CAPS_LOCK defined in line 156; never used
CONTROL defined in line 150; never used
CursorY defined in line 219; used 20 times
DCS defined in line 31; used 3 times
DEL defined in line 28; used 2 times
ESC defined in line 26; used 6 times
FF defined in line 21; used 1 times
INQ defined in line 20; used 1 times
INSERT defined in line 196; used 2 times
INVERSEbit defined in line 142; used 6 times
LINEFEED defined in line 191; used 7 times
LS0 defined in line 23; never used
LS1 defined in line 22; never used
MAX_COLS defined in line 7; used 1 times
MAX_ROWS defined in line 8; used 2 times
MAX_TABS defined in line 161; used 3 times
META defined in line 149; never used
NPARAM defined in line 40; used 3 times
OLDID defined in line 32; never used
OSC defined in line 35; used 3 times
PM defined in line 36; used 3 times
RDEL defined in line 38; used 1 times
SHIFT defined in line 148; never used
SS2 defined in line 29; never used
SS3 defined in line 30; used 3 times
ST defined in line 34; never used
SUB defined in line 25; used 2 times
TAB_ARRAY_SIZE defined in line 162; used 3 times
TCursorX defined in line 227; used 3 times
TCursorY defined in line 228; used 3 times
TEK_LINK_BLOCK_SIZE defined in line 200; used 11 times
TekBufPut defined in line 209; used 5 times
US defined in line 27; used 1 times

Usage of this include

Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2101
Valid CSS Valid XHTML 1.0 Strict