Main Page | Class List | File List | Class Members | File Members

window.h

Go to the documentation of this file.
00001 /* Copyright (c) 1993-2002
00002  *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
00003  *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
00004  * Copyright (c) 1987 Oliver Laumann
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2, or (at your option)
00009  * any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program (see the file COPYING); if not, write to the
00018  * Free Software Foundation, Inc.,
00019  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
00020  *
00021  ****************************************************************
00022  * $Id: window.h,v 1.11 1994/05/31 12:33:27 mlschroe Exp $ FAU
00023  */
00024 
00025 
00026 /* keep this in sync with the initialisations in window.c */
00027 struct NewWindow
00028 {
00029   int   StartAt;        /* where to start the search for the slot */
00030   char  *aka;           /* aka string */
00031   char  **args;         /* argv vector */
00032   char  *dir;           /* directory for chdir */
00033   char  *term;          /* TERM to be set instead of "screen" */
00034   int   aflag;
00035   int   flowflag;
00036   int   lflag;
00037   int   histheight;
00038   int   monitor;
00039   int   wlock;          /* default writelock setting */
00040   int   silence;
00041   int   wrap;
00042   int   Lflag;          /* logging */
00043   int   slow;           /* inter character milliseconds */
00044   int   gr;
00045   int   c1;
00046   int   bce;
00047   int   encoding;
00048   char  *hstatus;
00049   char  *charset;
00050 };
00051 
00052 #ifdef PSEUDOS
00053 
00054 struct pseudowin
00055 {
00056   int   p_fdpat;
00057   int   p_pid;
00058   int   p_ptyfd;
00059   struct event p_readev;
00060   struct event p_writeev;
00061   char  p_cmd[MAXSTR];
00062   char  p_tty[MAXSTR];
00063   char  p_inbuf[IOSIZE];        /* buffered writing to p_ptyfd */
00064   int   p_inlen;
00065 };
00066 
00067 /* bits for fdpat: */
00068 #define F_PMASK         0x0003
00069 #define F_PSHIFT        2
00070 #define F_PFRONT        0x0001                  /* . */
00071 #define F_PBACK         0x0002                  /* ! */
00072 #define F_PBOTH         (F_PFRONT | F_PBACK)    /* : */
00073 
00074 #define F_UWP           0x1000                  /* | */
00075 
00076 /* The screen process ...)
00077  * ... wants to write to pseudo */
00078 #define W_WP(w) ((w)->w_pwin && ((w)->w_pwin->p_fdpat & F_PFRONT))
00079 
00080 /* ... wants to write to window: user writes to window 
00081  * or stdout/stderr of pseudo are duplicated to window */
00082 #define W_WW(w) (!((w)->w_pwin) || \
00083 (((w)->w_pwin->p_fdpat & F_PMASK) == F_PBACK) || \
00084 ((((w)->w_pwin->p_fdpat >> F_PSHIFT) & F_PMASK) == F_PBOTH) || \
00085 ((((w)->w_pwin->p_fdpat >> (F_PSHIFT * 2)) & F_PMASK) == F_PBOTH))
00086 
00087 /* ... wants to read from pseudowin */
00088 #define W_RP(w) ((w)->w_pwin && ((w)->w_pwin->p_fdpat & \
00089 ((F_PFRONT << (F_PSHIFT * 2)) | (F_PFRONT << F_PSHIFT)) ))
00090 
00091 /* ... wants to read from window */
00092 #define W_RW(w) (!((w)->w_pwin) || ((w)->w_pwin->p_fdpat & F_PFRONT))
00093 
00094 /* user input is written to pseudo */
00095 #define W_UWP(w) ((w)->w_pwin && ((w)->w_pwin->p_fdpat & F_UWP))
00096 
00097 /* pseudo output has to be stuffed in window */
00098 #define W_PTOW(w) (\
00099 ((w)->w_pwin->p_fdpat & F_PMASK << F_PSHIFT) == F_PBOTH << F_PSHIFT || \
00100 ((w)->w_pwin->p_fdpat & F_PMASK << F_PSHIFT * 2) == F_PBOTH << F_PSHIFT * 2 )
00101 
00102 /* window output has to be stuffed in pseudo */
00103 #define W_WTOP(w) (((w)->w_pwin->p_fdpat & F_PMASK) == F_PBOTH)
00104 
00105 #endif /* PSEUDOS */
00106 
00107 /* definitions for wlocktype */
00108 #define WLOCK_OFF       0       /* all in w_userbits can write */
00109 #define WLOCK_AUTO      1       /* who selects first, can write */
00110 #define WLOCK_ON        2       /* user writes even if deselected */
00111 
00112 
00113 #ifdef COPY_PASTE
00114 struct paster
00115 {
00116   char  *pa_pastebuf;           /* this gets pasted in the window */
00117   char  *pa_pasteptr;           /* pointer in pastebuf */
00118   int    pa_pastelen;           /* bytes left to paste */
00119   struct layer *pa_pastelayer;  /* layer to paste into */
00120   struct event pa_slowev;       /* slowpaste event */
00121 };
00122 #else
00123 struct paster;
00124 #endif
00125 
00126 struct win 
00127 {
00128   struct win *w_next;           /* next window */
00129   int    w_type;                /* type of window */
00130   void  *w_data;
00131   struct layer w_layer;         /* our layer */
00132   struct layer *w_savelayer;    /* the layer to keep */
00133   int    w_blocked;             /* block input */
00134 #ifdef PSEUDOS
00135   struct pseudowin *w_pwin;     /* ptr to pseudo */
00136 #endif
00137   struct display *w_pdisplay;   /* display for printer relay */
00138   struct display *w_lastdisp;   /* where the last input was made */
00139   int    w_number;              /* window number */
00140   struct event w_readev;
00141   struct event w_writeev;
00142   struct event w_silenceev;     /* silence event */
00143   int    w_ptyfd;               /* fd of the master pty */
00144   char   w_inbuf[IOSIZE];
00145   int    w_inlen;
00146   char   w_outbuf[IOSIZE];
00147   int    w_outlen;
00148   int    w_aflag;               /* (-a option) */
00149   char  *w_title;               /* name of the window */
00150   char  *w_akachange;           /* autoaka hack */
00151   char   w_akabuf[MAXSTR];      /* aka buffer */
00152   int    w_autoaka;             /* autoaka hack */
00153   int    w_intermediate;        /* char used while parsing ESC-seq */
00154   int    w_args[MAXARGS];       /* emulator args */
00155   int    w_NumArgs;
00156 
00157 #ifdef MULTIUSER
00158   int    w_wlock;               /* WLOCK_AUTO, WLOCK_OFF, WLOCK_ON */
00159   struct acluser *w_wlockuser;  /* NULL when unlocked or user who writes */
00160   AclBits w_userbits[ACL_BITS_PER_WIN];
00161   AclBits w_lio_notify;         /* whom to tell when lastio+seconds < time() */
00162   AclBits w_mon_notify;         /* whom to tell monitor statis */
00163 #endif
00164 
00165   enum state_t w_state;         /* parser state */
00166   enum string_t w_StringType;
00167   struct mline *w_mlines;
00168   struct mchar w_rend;          /* current rendition */
00169 #ifdef FONT
00170   char   w_FontL;               /* character font GL */
00171   char   w_FontR;               /* character font GR */
00172 # ifdef ENCODINGS
00173   char   w_FontE;               /* character font GR locked */
00174 # endif
00175   int    w_Charset;             /* charset number GL */
00176   int    w_CharsetR;            /* charset number GR */
00177   int    w_charsets[4];         /* Font = charsets[Charset] */
00178 #endif
00179   int    w_ss;          
00180   int    w_saved;
00181   int    w_Saved_x, w_Saved_y;
00182   struct mchar w_SavedRend;
00183 #ifdef FONT
00184   int    w_SavedCharset;
00185   int    w_SavedCharsetR;
00186   int    w_SavedCharsets[4];
00187 #endif
00188   int    w_top, w_bot;          /* scrollregion */
00189   int    w_wrap;                /* autowrap */
00190   int    w_origin;              /* origin mode */
00191   int    w_insert;              /* window is in insert mode */
00192   int    w_keypad;              /* keypad mode */
00193   int    w_cursorkeys;          /* appl. cursorkeys mode */
00194   int    w_revvid;              /* reverse video */
00195   int    w_curinv;              /* cursor invisible */
00196   int    w_curvvis;             /* cursor very visible */
00197   int    w_autolf;              /* automatic linefeed */
00198   char  *w_hstatus;             /* hardstatus line */
00199   int    w_gr;                  /* enable GR flag */
00200   int    w_c1;                  /* enable C1 flag */
00201   int    w_bce;                 /* enable backcol erase */
00202 #if 0
00203   int    w_encoding;            /* for input and paste */
00204 #endif
00205   int    w_decodestate;         /* state of our input decoder */
00206 #ifdef DW_CHARS
00207   int    w_mbcs;                /* saved char for multibytes charset */
00208 #endif
00209   char   w_string[MAXSTR];
00210   char  *w_stringp;
00211   char  *w_tabs;                /* line with tabs */
00212   int    w_bell;                /* bell status of this window */
00213   int    w_flow;                /* flow flags */
00214   struct logfile *w_log;        /* log to file */
00215   int    w_logsilence;          /* silence in secs */
00216   int    w_monitor;             /* monitor status */
00217   int    w_silencewait;         /* wait for silencewait secs */
00218   int    w_silence;             /* silence status (Lloyd Zusman) */
00219   char   w_vbwait;            
00220   char   w_norefresh;           /* dont redisplay when switching to that win */
00221 #ifdef RXVT_OSC
00222   char   w_xtermosc[4][MAXSTR]; /* special xterm/rxvt escapes */
00223 #endif
00224   int    w_mouse;               /* mouse mode 0,9,1000 */
00225 #ifdef HAVE_BRAILLE
00226   int    w_bd_x, w_bd_y;        /* Braille cursor position */
00227 #endif
00228 
00229 #ifdef COPY_PASTE
00230   int    w_slowpaste;           /* do careful writes to the window */
00231   int    w_histheight;          /* all histbases are malloced with width * histheight */
00232   int    w_histidx;             /* 0 <= histidx < histheight; where we insert lines */
00233   struct mline *w_hlines;       /* history buffer */
00234   struct paster w_paster;       /* paste info */
00235 #else
00236   int    w_histheight;          /* always 0 */
00237 #endif
00238   int    w_pid;                 /* process at the other end of ptyfd */ 
00239 
00240   char  *w_cmdargs[MAXARGS];    /* command line argument vector */
00241   char  *w_dir;                 /* directory for chdir */
00242   char  *w_term;                /* TERM to be set instead of "screen" */
00243 
00244   int    w_lflag;               /* login flag */
00245   slot_t w_slot;                /* utmp slot */
00246 #if defined (UTMPOK)
00247   struct utmp w_savut;          /* utmp entry of this window */
00248 #endif
00249 
00250   char   w_tty[MAXSTR];
00251 
00252   int    w_zauto;
00253 #ifdef ZMODEM
00254   struct display *w_zdisplay;
00255 #endif
00256 #ifdef BUILTIN_TELNET
00257   struct sockaddr_in w_telsa;
00258   char   w_telbuf[IOSIZE];
00259   int    w_telbufl;
00260   char   w_telmopts[256];
00261   char   w_telropts[256];
00262   int    w_telstate;
00263   char   w_telsubbuf[128];
00264   int    w_telsubidx;
00265   struct event w_telconnev;
00266 #endif
00267   struct mline *w_alt_mlines;
00268   int    w_alt_width;
00269   int    w_alt_height;
00270   int    w_alt_histheight;
00271   int    w_alt_x, w_alt_y;
00272 #ifdef COPY_PASTE
00273   struct mline *w_alt_hlines;
00274   int    w_alt_histidx;
00275 #endif
00276 };
00277 
00278 
00279 #define w_encoding   w_layer.l_encoding
00280 #define w_width  w_layer.l_width
00281 #define w_height w_layer.l_height
00282 #define w_x      w_layer.l_x
00283 #define w_y      w_layer.l_y
00284 
00285 /* definitions for w_type */
00286 #define W_TYPE_PTY              0
00287 #define W_TYPE_PLAIN            1
00288 #define W_TYPE_TELNET           2
00289 
00290 
00291 /*
00292  * Definitions for flow
00293  *   000  -(-)  flow off, auto would be off
00294  *   001  +(-)  flow on , auto would be off
00295  *   010  -(+)  flow off, auto would be on
00296  *   011  +(+)  flow on , auto would be on
00297  *   100  -     flow auto, currently off
00298  *   111  +     flow auto, currently on
00299  * Application controls auto_flow via TIOCPKT, if available, 
00300  * else via application keypad mode.
00301  */
00302 #define FLOW_NOW        (1<<0)
00303 #define FLOW_AUTO       (1<<1)
00304 #define FLOW_AUTOFLAG   (1<<2)
00305 
00306 
00307 /*
00308  * WIN gives us a reference to line y of the *whole* image
00309  * where line 0 is the oldest line in our history.
00310  * y must be in whole image coordinate system, not in display.
00311  */
00312 
00313 #define WIN(y) ((y < fore->w_histheight) ? \
00314       &fore->w_hlines[(fore->w_histidx + y) % fore->w_histheight] \
00315     : &fore->w_mlines[y - fore->w_histheight])
00316 
00317 #define Layer2Window(l) ((struct win *)(l)->l_bottom->l_data)

Generated on Sat Jul 2 20:56:16 2005 for GNU Screen by  doxygen 1.4.3