/************************************************************************
 * This program is Copyright (C) 1986 by Jonathan Payne.  JOVE is	*
 * provided to you without charge, and with no warranty.  You may give	*
 * away copies of JOVE, including sources, provided that this notice is *
 * included in all the files.						*
 ************************************************************************/

#ifndef _SCREEN_H_
#define _SCREEN_H_

#ifndef TUNED
#   include "tune.h"
#endif

#ifdef Extern
RCS_H(screen, "$Id: screen.h,v 14.31.0.8 1993/11/02 03:29:09 tom Exp tom $")
#endif

#ifndef Extern
#   define Extern	extern
#endif

/* screen.c */

struct scrimage {
	disk_line
		s_id;		/* which buffer line */
	short	s_offset;	/* offset to start printing at */
#ifdef COLOR
	char	s_color,	/* color of the line */
#else
	short
#endif
		s_flags;	/* various flags */
	unsigned s_vln;		/* Visible Line Number */
	Line	*s_lp;		/* so we can turn off red bit */
	Window	*s_window;	/* window that contains this line */
};

/* [TRH] next is already defined in "jove.h":
#define DIRTY		01	/* just needs updating for some reason */
#define MODELINE	02	/* this is a modeline */
#define STANDOUT	010	/* this (mode) line in reverse video */

#define VIS_ATTRIB	(STANDOUT|HIGHLIGHT)
				/* HIGHLIGHT is defined in "jove.h" */
struct screenline {
	char	*s_line,
		*s_length;
};

Extern int	OkayAbort;

Extern struct scrimage
	*DesiredScreen,		/* the desired (logical) screen */
	*PhysScreen,		/* the actual (logical) screen */
	*Curimage;		/* current line in PhysScreen */

Extern struct screenline
	*Screen,		/* the screen (a bunch of screenline) */
	*Curline;		/* current line */

Extern char
	*cursor,		/* offset into current Line */
	*cursend;

Extern int
	CapCol,			/* position of physical cursor */
	CapLine,

	i_line,			/* position of virtual cursor */
	i_col;

extern int ILI, LI, CO;		/* TINY kludge, duplicated from "termcap.h" */


/* these are forward in screen.c itself, so always needed. */
extern void	(*TTins_line)__(( int _(top), int _(bottom), int _(num) )),
		(*TTdel_line)__(( int _(top), int _(bottom), int _(num) )),

		cl_scr __(( int _(doit) )),
		i_set __(( int _(line), int _(col) )),
		Placur __(( int _(line), int _(col) ));
#ifndef NO_TRIV_PROTO
extern void	make_scr __(( void )),
		v_inval __(( void )),
		cl_eol __(( void )),
		cl_standout __(( void )),
		standout __(( int _(length) )),
		dobell __(( int _(ntimes) )),
#   ifdef FAST_FLASH
		flash __(( void )),
#   endif
		scursoff __(( void )),
		cursoff __(( void )),
		curson __(( void )),
		curstoLL __(( void )),
		v_ins_line __(( int _(num), int _(top), int _(bottom) )),
		v_del_line __(( int _(num), int _(top), int _(bottom) ));
extern int	swrite __(( const char *_(line), int _(abortable) )),
		BufSwrite __(( struct scrimage *_(des_p) )),
		Overtype __(( const char *_(str) ));
#endif /* NO_TRIV_PROTO */

#ifdef ID_CHAR
extern void	INSmode __(( int _(on) )),
		DeTab __(( int _(s_offset), const char *_(buf), char *_(outbuf),
			   int _(limit), int _(visspace) ));
extern int	IDchar __(( const char *_(new), int _(lineno), int _(col) ));
#endif /* ID_CHAR */

#ifdef COLOR

#   define NCOLORS		8
#   define MK_COLOR(fg,bg)	( (((fg)&7)<<3) | ((bg)&7) )
#   define FG_COLOR(c)		((c)>>3)
#   define BG_COLOR(c)		((c)&7)

#   define BLACK	0
#   define RED		1
#   define GREEN	2
#   define YELLOW	3
#   define BLUE		4
#   define MAGENTA	5
#   define CYAN		6
#   define WHITE	7

#   define FG		0
#   define BG		1
#   ifdef ATARIST
#	define DEF_COLOR	MK_COLOR(BLACK, WHITE)
#   endif
#   ifdef MAC
#	define DEF_COLOR	MK_COLOR(BLACK, WHITE)
#   endif
#   ifndef DEF_COLOR
#	define DEF_COLOR	MK_COLOR(WHITE, BLACK)
#   endif

extern void	set_color __(( int _(color) )),
		req_color __(( int _(color) ));

Extern int	CurrColor;

#   define mesg_color	Gcolor[0]

#else /* ! COLOR */

#   define set_color(c)
#   define req_color(c)

#endif /* COLOR */

#endif /* _SCREEN_H_ */

#undef Extern

/*======================================================================
 * $Log: screen.h,v $
 * Revision 14.31.0.8  1993/11/02  03:29:09  tom
 * (struct scrimage): change type of s_vln to unsigned int.
 *
 * Revision 14.31  1993/02/15  03:04:41  tom
 * some cosmetic surgery.
 *
 * Revision 14.30  1993/01/26  18:43:05  tom
 * cleanup whitespace.
 *
 * Revision 14.26  1992/08/26  23:56:48  tom
 * add RCS directives.
 *
 */
