X * PTBEG, PTEND, FORWARD, and REVERSE are all toggle-able values for
X * the scan routines.
X */
X#define PTBEG 0 /* Leave the point at the beginning on search */
X#define PTEND 1 /* Leave the point at the end on search */
X#define FORWARD 0 /* forward direction */
X#define REVERSE 1 /* backwards direction */
X
X#define FIOSUC 0 /* File I/O, success. */
X#define FIOFNF 1 /* File I/O, file not found. */
X#define FIOEOF 2 /* File I/O, end of file. */
X#define FIOERR 3 /* File I/O, error. */
X#define FIOMEM 4 /* File I/O, out of memory */
X#define FIOFUN 5 /* File I/O, eod of file/bad line*/
X
X#define CFCPCN 0x0001 /* Last command was C-P, C-N */
X#define CFKILL 0x0002 /* Last command was a kill */
X
X#define BELL 0x07 /* a bell character */
X#define TAB 0x09 /* a tab character */
X
X#if V7 | USG | BSD
X#define PATHCHR ':'
X#else
X#define PATHCHR ';'
X#endif
X
X#define INTWIDTH sizeof(int) * 3
X
X/* Macro argument token types */
X
X#define TKNUL 0 /* end-of-string */
X#define TKARG 1 /* interactive argument */
X#define TKBUF 2 /* buffer argument */
X#define TKVAR 3 /* user variables */
X#define TKENV 4 /* environment variables */
X#define TKFUN 5 /* function.... */
X#define TKDIR 6 /* directive */
X#define TKLBL 7 /* line label */
X#define TKLIT 8 /* numeric literal */
X#define TKSTR 9 /* quoted string literal */
X#define TKCMD 10 /* command name */
X
X/* Internal defined functions */
X
X#define nextab(a) (a & ~7) + 8
X#ifdef abs
X#undef abs
X#endif
X
X/* DIFCASE represents the integer difference between upper
X and lower case letters. It is an xor-able value, which is
X fortunate, since the relative positions of upper to lower
X case letters is the opposite of ascii in ebcdic.
X*/
X
X#ifdef islower
X#undef islower
X#endif
X
X#if ASCII
X
X#define DIFCASE 0x20
X#define isletter(c) (('a' <= c && 'z' >= c) || ('A' <= c && 'Z' >= c))
X#define islower(c) (('a' <= c && 'z' >= c))
X#endif
X
X#if EBCDIC
X
X#define DIFCASE 0x40
X#define isletter(c) (('a' <= c && 'i' >= c) || ('j' <= c && 'r' >= c) || ('s' <= c && 'z' >= c) || ('A' <= c && 'I' >= c) || ('J' <= c && 'R' >= c) || ('S' <= c && 'Z' >= c))
X#define islower(c) (('a' <= c && 'i' >= c) || ('j' <= c && 'r' >= c) || ('s' <= c && 'z' >= c))
X#endif
X
X/* Dynamic RAM tracking and reporting redefinitions */
X
X#if RAMSIZE
X#define malloc allocate
X#define free release
X#endif
X
X/* De-allocate memory always on exit (if the operating system or
X main program can not
X*/
X
X#if CLEAN
X#define exit(a) cexit(a)
X#endif
X
X/*
X * There is a window structure allocated for every active display window. The
X * windows are kept in a big list, in top to bottom screen order, with the
X * listhead at "wheadp". Each window contains its own values of dot and mark.
X * The flag field contains some bits that are set by commands to guide
X * redisplay. Although this is a bit of a compromise in terms of decoupling,
X * the full blown redisplay is just too expensive to run for every input
X * character.
X */
Xtypedef struct WINDOW {
X struct WINDOW *w_wndp; /* Next window */
X struct BUFFER *w_bufp; /* Buffer displayed in window */
X struct LINE *w_linep; /* Top line in the window */
X struct LINE *w_dotp; /* Line containing "." */
X short w_doto; /* Byte offset for "." */
X struct LINE *w_markp; /* Line containing "mark" */
X short w_marko; /* Byte offset for "mark" */
X char w_toprow; /* Origin 0 top row of window */
X char w_ntrows; /* # of rows of text in window */