tvlib_h

/*
**	Copyright 1991-2016, Fermi Research Alliance, LLC.  All rights reserved.
*/
/******************************************************************************/
/* tvlib.h
**
**	This is a header file containing function prototypes for
**	routines in the console library (CLIB).
**
**	V0.0	B S Hendricks / Accelerator Controls		25-Jul-12
**	Created
**
*/
/******************************************************************************/

#ifndef TVLIB_DEFINED				/* do this only once */
#define	TVLIB_DEFINED

#include "cnsparam.h"
#include "cns_data_structs.h"
#include <X11/X.h>				/* needed for KeySym */

/******************************************************************************/
/* 
**	defined constants for argument values for TVxxx routines
*/
/******************************************************************************/

/*
** tvcase ...
*/
    #define	TV_UPPER_CASE_ONLY	0		/* allow only upper case input */
    #define	TV_MIXED_CASE		1		/* allow mixed case input */
    #define	TV_LOWER_CASE_ONLY	2		/* allow only lower case input */

/*
**  tv_kb_echo...
*/
    #define	KEY_ECHO_ALL		0x00		/* allow echoing of all characters */
    #define	KEY_ECHO_NONE		0xff		/* suppress the echoing of all characters except cursor positioning ones */
    #define	KEY_ECHO_NOKP		0x02		/* suppress the echoing of key pad characters */
    #define	KEY_ECHO_NOTAB		0x04		/* suppress the echoing of tab characters */
    #define	KEY_ECHO_NOCTRL		0x08		/* suppress the echoing of control characters */

/*
**  tvfontsize_c...
*/
    #define	TVFONT_SMALL		0		/* size 1 TV font */
    #define	TVFONT_MEDIUM		1		/* size 2 TV font */
    #define	TVFONT_LARGE		2		/* size 3 TV font */
    #define	TVFONT_NOTLARGE		-1		/* if size 3 then size 2 TV font */


/******************************************************************************/
/* 
**	returned status definitions for TVxxx routines
*/
/******************************************************************************/


/******************************************************************************/
/*
**	function prototypes for TVxxx routines
*/
/******************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

int inbox(short *row, short *nrows, short *col, short *ncols);
int inbox_c(int row, int nrows, int col, int ncols);
int infld(short *row, short *col, short *ncols);
int infld_c(int row, int col, int ncols);
void tv2lx(short *ix=(short *) NULL,short *iy=(short *) NULL,
	   short *islot=(short *) NULL);	/* copy TV to Lexidata */
void tv2ss(short *isize=(short *) NULL,short *ix=(short *) NULL,
	   short *iy=(short *) NULL,short *islot=(short *) NULL);	/* copy TV to 614 */
void tv_get_key(short *row, short *col, KeySym *key_sym,
	        unsigned int *modstate=(unsigned int *) NULL, int peek=FALSE);
void tv_get_title(char *title_text, char *icon_text);
int tv_is_mapped(void);
unsigned short tv_kb_echo(short *echo_enable);
void tv_last_char(XCHAR *new_char, XCHAR *old_char);
int tv_paste_callback_add(paste_handler funct,
			  void *callback_data=(void *) NULL);
int tv_paste_callback_remove(paste_handler funct,
			     void *callback_data=(void *) NULL);
void tv_pld_init(void);
void tv_put_key_fifo(int row, int col, KeySym key_sym,
		     unsigned int mod_state);
void tv_set_title(const char *title_text, const char *icon_text=(char *) NULL);
void tvblnk(unsigned char *row, unsigned char *col, short *nchars,
	    char *fcolor=(char *) NULL, char *bcolor=(char *) NULL,
	    char *blink=(char *) NULL);		/* draw blanks on the TV */
void tvblnk_c(int row, int col, int nchars,
	      int colors=WHITE);		/* 'C' version of tvblnk */
void tvbrat(void);
void tvcase(short *kb_case);			/* enable/disable lower case characters */
void tvceol(unsigned char *row, unsigned char *col, char *fcolor=(char *) NULL,
	    char *bcolor=(char *) NULL, char *blink=(char *) NULL);	/* erase to the end of the line */
void tvceol_c(int row, int column, char fcolor=WHITE, char bcolor=BLACK,
	      char blink=FALSE);
void tvceop(unsigned char *row, unsigned char *col, char *fcolor=(char *) NULL,
	    char *bcolor=(char *) NULL, char *blink=(char *) NULL);	/* erase to the end of the page */
void tvceop_c(int row, int column, char fcolor=WHITE, char bcolor=BLACK,
	      char blink=FALSE);
void tvclr(void);				/* clear the TV */
void tvcolr(unsigned char *row, unsigned char *column, short *num_chars,
	    char *fcolor=(char *) NULL, char *bcolor=(char *) NULL,
	    char *blink=(char *) NULL);		/* change the color of a text string */
void tvcolr_c(int row, int column, int num_chars,
	      int colors=WHITE);		/* 'C' version of tvcolr */
void tvdisp(short *srow, short *scol, short *vun,
	    short *recno, short *status);	/* display saved compressed text */
void tvdisp_c(int srow, int scol, short vun,
	      int recno, short *status);	/* 'C' version of tvdisp */
void tvfill(unsigned char *row, unsigned char *column, char *chr,
	    short *num_chars, char *fcolor=(char *) NULL,
	    char *bcolor=(char *) NULL,char *blink=(char *) NULL);	/* fill part of the screen with the same character */
void tvfill_c(int row, int column, int chr, int num_chars,
	      int colors=WHITE);		/* 'C' version of tvfill */
void tvflsh(void);				/* flush the TV command buffer */
void tvfontsize_c(int fsize);			/* set TV window font size */
void tvkbat(char *fcolor=(char *) NULL, char *bcolor=(char *) NULL,
	    char *blink=(char *) NULL);		/* set the attributes for typed in characters */
void tvm(unsigned char *row, unsigned char *column, char *text,
	 short *num_chars, char *fcolor=(char *) NULL,
	 char *bcolor=(char *) NULL, char *blink=(char *) NULL);	/* display text on the TV */
void tvm_c(int row, int column, char *text, int num_chars,
	   int colors=WHITE);			/* 'C' version of tvm */
void tvmx(unsigned char *row, unsigned char *column, XCHAR *xtext,
	  short *num_chars);			/* display color coded text on the TV */
void tvmx_c(int row, int column, XCHAR const *text, int num_chars);	/* 'C' version of tvmx */
void tvrfmt(short *nrows, short *ncols);	/* read TV screen format */
void tvrkba(short *fcolor, short *bcolor, short *blink,
	    short *dncase=(short *) NULL);	/* read TV keyboard attributes */
void tvrst(void);				/* reset the TV */
void tvrwdo(short *locol, short *hicol);	/* read present scrolling limits */
void tvsave(short *srow, short *nrows, short *scol, short *ncols,
	   short *vun, short *recno, short *recsiz, short *status);	/* save compressed text */
void tvsave_c(int srow, int nrows, int scol, int ncols,
	      short vun, int recno, int recsiz, short *status);	/* 'C' version of tvsave */
void tvscrl(short *rowa, short *rowb,
	    short *fcolor=(short *) NULL, short *bcolor=(short *) NULL,
	    short *blink=(short *) NULL);	/* scroll a TV window */
void tvscrs(unsigned char *row, unsigned char *column);	/* position the TV cursor */
void tvscrs_c(int row, int column);		/* position the TV cursor */
void tvsfmt(short *nrows, short *ncols);	/* set TV screen format */
int tvslot(short *slot);			/* choose window for TVM I/O */
void tvtitl(char *);				/* set the title of a TV window */
void tvwndo(short *locol, short *hicol);	/* set TV scrolling limits */
int wdelet(short *wid, unsigned char *row, unsigned char *column);	/* delete a TV window */
int wdelet_c(short wid, int row, int column);	/* 'C' version of wdelet */
int winbox_c(int wid, int wrow, int nrows,
	     int wcol, int ncols);		/* 'window' version of inbox */
int wincol_c(int wid, int col);
int winfld_c(int wid, int row, int col, int ncols);	/* 'window' version of infld */
int winrow_c(int wid, int row);
int wmake(unsigned char *lcol, unsigned char *urow,
	  unsigned char *rcol, unsigned char *drow,
	  char *nowrit, char *brdclr, char *ttlclr,
	  char *title, short *wid);		/* create a TV window */
int wmake_c(int lcol, int urow, int rcol, int drow,
	    int nowrit, int brdclr, int ttlclr,
	    char *title, short *wid);
void wtvblnk_c(int wid, int wrow, int wcol, int nchars, int colors);
void wtvcolr_c(int wid, int wrow, int wcol, int nchars, int colors);
void wtvfill_c(int wid, int wrow, int wcol, int chr, int nchars, int colors);
void wtvm_c(int wid, int wrow, int wcol, char *text,
	    int nchars, int colors);
void wtvmx_c(int wid, int wrow, int wcol, XCHAR *xtext, int nchars);

#ifdef __cplusplus
}
#endif


/******************************************************************************/
/*
**	equivalent name definitions
*/
/******************************************************************************/

    #define	INBOX				inbox
    #define	INBOX_C				inbox_c
    #define	INFLD				infld
    #define	INFLD_C				infld_c
    #define	TV2LX				tv2lx
    #define	TV2SS				tv2ss
    #define	TV_GET_KEY			tv_get_key
    #define	TV_GET_TITLE			tv_get_title
    #define	TV_IS_MAPPED			tv_is_mapped
    #define	TV_KB_ECHO			tv_kb_echo
    #define	TV_LAST_CHAR			tv_last_char
    #define	TV_PLD_INIT			tv_pld_init
    #define	TV_PUT_KEY_FIFO			tv_put_key_fifo
    #define	TV_SET_TITLE			tv_set_title
    #define	TVBLNK				tvblnk
    #define	TVBLNK_C			tvblnk_c
    #define	TVBRAT				tvbrat
    #define	TVCASE				tvcase
    #define	TVCEOL				tvceol
    #define	TVCEOL_C			tvceol_c
    #define	TVCEOP				tvceop
    #define	TVCEOP_C			tvceop_c
    #define	TVCLR				tvclr
    #define	TVCOLR				tvcolr
    #define	TVCOLR_C			tvcolr_c
    #define	TVDISP				tvdisp
    #define	TVDISP_C			tvdisp_c
    #define	TVFILL				tvfill
    #define	TVFILL_C			tvfill_c
    #define	TVFLSH				tvflsh
    #define	TVKBAT				tvkbat
    #define	TVM				tvm
    #define	TVM_C				tvm_c
    #define	TVMX				tvmx
    #define	TVMX_C				tvmx_c
    #define	TVRFMT				tvrfmt
    #define	TVRKBA				tvrkba
    #define	TVRST				tvrst
    #define	TVRWDO				tvrwdo
    #define	TVSAVE				tvsave
    #define	TVSAVE_C			tvsave_c
    #define	TVSCRL				tvscrl
    #define	TVSCRS				tvscrs
    #define	TVSCRS_C			tvscrs_c
    #define	TVSFMT				tvsfmt
    #define	TVSLOT				tvslot
    #define	TVTITL				tvtitl
    #define	TVWNDO				tvwndo
    #define	WDELET				wdelet
    #define	WDELET_C			wdelet_c
    #define	WINBOX_C			winbox_c
    #define	WINCOL_C			wincol_c
    #define	WINFLD_C			winfld_c
    #define	WINROW_C			winrow_c
    #define	WMAKE				wmake
    #define	WMAKE_C				wmake_c
    #define	WTVBLNK_C			wtvblnk_c
    #define	WTVCOLR_C			wtvcolr_c
    #define	WTVFILL_C			wtvfill_c
    #define	WTVM_C				wtvm_c
    #define	WTVMX_C				wtvmx_c

#endif