/*
 *
 * Copyright (c) 1993 by Ezra Story.  All rights reserved.  Permission to
 * copy this program is given provided that the copy is not sold and that
 * this copyright notice is included.
 * $Id: mydefs.h 1.1 1994/06/06 22:05:24 Ezra_Story Exp $
 */

/* auto-extern define */
#define proto extern
#define local static

typedef int fildes_t;
typedef unsigned char ubyte;

#define WINBUFSZ 512      /* input buffer for each window */
#define WINOUTSZ 256       /* contiguous output limit on window */
#define OUTPUTSZ 512      /* output size after xlation */

/* window struct */
typedef struct window
{
    NODE        n;                  /* node for priority sorting */
    int         id;                 /* window # */
    fildes_t    fd;                 /* pty fd for this window */
    int         pr;                 /* process for this window */
    int         xsz;                /* columns */
    int         ysz;                /* rows */
    char        ibuf[WINBUFSZ+8];   /* input buffer */
    int         ib;                 /* size */
} WIN;

/* FD mask defines */
#ifndef FD_SET
#define FD_SET(n,p)     ((p)->fds_bits[0] |= (1 << (n)))
#define FD_CLR(n,p)     ((p)->fds_bits[0] &= ~(1 << (n)))
#define FD_ISSET(n,p)   ((p)->fds_bits[0] & (1 << (n)))
#define FD_ZERO(p)      ((p)->fds_bits[0] = 0)
#define FD_SETSIZE      (NBBY*sizeof(long))
#endif

struct selmask {
        struct fd_set   sm_rd;
        struct fd_set   sm_wt;
        struct fd_set   sm_ex;
};

#define MAXWINDOWS 33
#define MAXP1WIN   8

/* #define DOCBREAK 1 */

#include "pprotos.h"
