!short: Defines
#define ^bSAVE^b    TRUE                    /* similar truth */
#define ^bRESTORE^b FALSE                   /* fibs */
#define ^bPAINT^b   TRUE                    /* screen update modes */
#define ^bFLASH^b   FALSE                   /* ditto */
#define ^bREPLACE^b 1                       /* for flicker free */
#define ^bERASE^b   0                       /* scroll w_sapd & w_sapu */
#define ^bFAST^b    0x01                    /* fast retrace */
#define ^bSLOW^b    0x08                    /* slow retrace */

#define ^bNULPTR^b  (char *) 0              /* null pointer */
#define ^bBEL^b     0x07                    /* beep */
#define ^bBS^b      0x08                    /* backspace */
#define ^bNUL^b     '\0'                    /* NUL char */
#define ^bESC^b     0x1b                    /* Escape */
#define ^bCR^b      0x0d                    /* carriage return */
#define ^bLF^b      0x0a                    /* linefeed */
#define ^bDEL^b     0x7f                    /* delete */
#define ^bNAK^b     0x15                    /* ^U */
#define ^bETX^b     0x03                    /* ^C */
#define ^bCAN^b     0x18                    /* ^X */
#define ^bDel^b     0x53                    /* Del key scan code */
#define ^bECHO^b    0x8000                  /* echo disable bit */

#define ^bBIOS^b    0x01                    /* BIOS Scrolling */
#define ^bDMAS^b    0x02                    /* The BOSS's DMA Scrolling */
!short: Externals
extern int ^bwn_dmaflg^b                   /* dma flag */
extern char ^bwn_sbit^b                    /* retrace test bit 8 slow, 1 fast */
extern int ^bwn_blank^b                    /* vidon & vidoff control flag */
extern int ^bwns_bchars[]^b                /* box chars */
extern unsigned int ^bwns_mtflg^b          /* monitor type flag */
extern int ^bwns_cflag^b                   /* close in progress flag */

extern struct ^bSREGS wns_srp^b            /* for segread */

extern unsigned ^bwni_seg[]^b              /* for wns_push/pop */
extern unsigned ^bwni_off[]^b              /* ditto */
extern unsigned ^bwni_ptr[]^b              /* ditto */

#define ^bBCUL^b  wns_bchars[0]             /* some shorthand for later */
#define ^bBCUR^b  wns_bchars[1]
#define ^bBCTB^b  wns_bchars[2]
#define ^bBCSD^b  wns_bchars[3]
#define ^bBCLL^b  wns_bchars[4]
#define ^bBCLR^b  wns_bchars[5]

!short: Structures
#if LC2 | LC3 | DLC | CI86       
extern unsigned ^bwns_mtype()^b            /* make everyone happy */
#endif

#define WMR   wn->bsize                 /* shorthand */

typedef struct wcb                      /* Window control block */
{
int ulx,                                /* upper left corner x coordinate */
    uly,                                /* upper left corner y coordinate */
    xsize,                              /* width of window - INSIDE dimension */
    ysize,                              /* height of window -INSIDE dimension */
    ccx,                                /* virtual cursor offset in window */
    ccy,
    style,                              /* attribute to be used in window */
    bstyle,                             /* border attribute */
    bsize;                              /* total border size 0 or 2 only */
char *scrnsave;                         /* pointer to screen save buffer */
int page,                               /* current video page being used */
    oldx,                               /* cursor position when window was */
    oldy,                               /* opened (used for screen restore) */
    wrpflg,                             /* wrap flag */
    synflg;                             /* cursor sync flag */
char *handle;                           /* my own id */
    char *prevptr;                      /* linked list - previous */
    char *nextptr;                      /* linked list - next */
    unsigned tmpseg;                    /* for activate */
    unsigned tmpoff;                    /* ditto */
    int  smeth;                         /* scroll method to use */
} WINDOW, *WINDOWPTR;

extern WINDOWPTR ^bwns_last^b              /* last window opened */

#if MSCV3 | MSCV4 | BORLAND             /* allow for LINT_ARGS */
#ifndef GENFNS
#include "windows.fns"                  /* enforce type checking */
#endif
#else                                   /* and almost lint args */
struct wcb ^b*wn_open()^b
struct wcb ^b*wn_move()^b
struct wcb ^b*wn_save()^b
char ^b*wn_gets()^b
#endif
!short: Colors
#define ^bBLACK^b   0x00                    /* foreground */
#define ^bRED^b     0x04                    /* background */
#define ^bGREEN^b   0x02                    /* colors */
#define ^bYELLOW^b  0x06                    /* bg << 4 | fg */
#define ^bBLUE^b    0x01
#define ^bMAGENTA^b 0x05
#define ^bCYAN^b    0x03
#define ^bWHITE^b   0x07
#define ^bBLINK^b   0x80
#define ^bBOLD^b    0x08
#define ^bNDISPB^b  0x00                    /* non display black */
#define ^bNDISPW^b  0x77                    /* non display white */
#define ^bRVIDEO^b  0x70                    /* reverse video */
#define ^bUNLINE^b  0x01                    /* under line (BLUE) */

#define ^bNVIDEO^b  0x07                    /* normal video */
#define ^bNORMAL^b  0x03                    /* cyan is normal for me */
!short: Display Mode Atributes
#define ^bB4025^b  0                        /* black & white 40 x 25 */
#define ^bC4025^b  1                        /* color 40 x 25 */
#define ^bB8025^b  2                        /* black & white 80 x 25 */
#define ^bC8025^b  3                        /* color 80 x 25 */
#define ^bC320^b   4                        /* color graphics 320 x 200 */
#define ^bB320^b   5                        /* black & white graphics */
#define ^bHIRES^b  6                        /* B&W hi res 640 * 200 */
#define ^bMONO^b   7                        /* monocrome 80 x 25 */
!short: Macro to set attribute byte
#define ^bv_setatr^b(bg,fg,blink,bold) ((blink|(bg<<4))|(fg|bold))
!short: PopUp Structures
struct ^bmitem^b {                        /* menu item template */
    int r;                              /* row */
    int c;                              /* col */
    char *t;                            /* text */
    int rv;                             /* return value */
};
  
struct ^bpmenu^b {                        /* popup menu structure */
    int fm;                             /* first menu item index */
    int lm;                             /* last menu item index */
    struct mitem scrn[25];              /* a bunch of menu items */
};

WINDOWPTR qpopup();                     /* function returns WP */
    
